aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Layouts.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-04-30 15:02:45 -0700
committerredmatrix <git@macgirvin.com>2016-04-30 15:02:45 -0700
commit84d93cca6e2ac0b552a6f5c570fbcfce766200a1 (patch)
treea8a9c46ee6f70dd4b8824499a49b1e39e2980dc6 /Zotlabs/Module/Layouts.php
parent45512e6aba602604143e946cca49c363ae88aa1e (diff)
parent9446d0cbb463af6a256efebf97e10618469f1193 (diff)
downloadvolse-hubzilla-84d93cca6e2ac0b552a6f5c570fbcfce766200a1.tar.gz
volse-hubzilla-84d93cca6e2ac0b552a6f5c570fbcfce766200a1.tar.bz2
volse-hubzilla-84d93cca6e2ac0b552a6f5c570fbcfce766200a1.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
Diffstat (limited to 'Zotlabs/Module/Layouts.php')
-rw-r--r--Zotlabs/Module/Layouts.php77
1 files changed, 39 insertions, 38 deletions
diff --git a/Zotlabs/Module/Layouts.php b/Zotlabs/Module/Layouts.php
index 50cb401bc..aafe4342e 100644
--- a/Zotlabs/Module/Layouts.php
+++ b/Zotlabs/Module/Layouts.php
@@ -5,47 +5,45 @@ require_once('include/identity.php');
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
-
class Layouts extends \Zotlabs\Web\Controller {
function init() {
-
+
if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
$sys = get_sys_channel();
if($sys && intval($sys['channel_id'])) {
\App::$is_sys = true;
}
}
-
+
if(argc() > 1)
$which = argv(1);
else
return;
-
+
profile_load($a,$which);
-
+
}
-
-
- function get() {
-
+
+ function get() {
+
if(! \App::$profile) {
notice( t('Requested profile is not available.') . EOL );
\App::$error = 404;
return;
}
-
+
$which = argv(1);
-
+
$_SESSION['return_url'] = \App::$query_string;
-
+
$uid = local_channel();
$owner = 0;
$channel = null;
$observer = \App::get_observer();
-
+
$channel = \App::get_channel();
-
+
if(\App::$is_sys && is_site_admin()) {
$sys = get_sys_channel();
if($sys && intval($sys['channel_id'])) {
@@ -54,7 +52,7 @@ class Layouts extends \Zotlabs\Web\Controller {
$observer = $sys;
}
}
-
+
if(! $owner) {
// Figure out who the page owner is.
$r = q("select channel_id from channel where channel_address = '%s'",
@@ -64,34 +62,34 @@ class Layouts extends \Zotlabs\Web\Controller {
$owner = intval($r[0]['channel_id']);
}
}
-
+
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
-
+
$perms = get_all_perms($owner,$ob_hash);
-
+
if(! $perms['write_pages']) {
notice( t('Permission denied.') . EOL);
return;
}
-
+
// Block design features from visitors
-
+
if((! $uid) || ($uid != $owner)) {
notice( t('Permission denied.') . EOL);
return;
}
-
+
// Get the observer, check their permissions
-
+
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
-
+
$perms = get_all_perms($owner,$ob_hash);
-
+
if(! $perms['write_pages']) {
notice( t('Permission denied.') . EOL);
return;
}
-
+
//This feature is not exposed in redbasic ui since it is not clear why one would want to
//download a json encoded pdl file - we dont have a possibility to import it.
//Use the buildin share/install feature instead.
@@ -109,19 +107,21 @@ class Layouts extends \Zotlabs\Web\Controller {
killme();
}
}
-
+
// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
// Nickname is set to the observers xchan, and profile_uid to the owners.
// This lets you post pages at other people's channels.
-
+
$x = array(
'webpage' => ITEM_TYPE_PDL,
'is_owner' => true,
'nickname' => \App::$profile['channel_address'],
- 'bang' => '',
'showacl' => false,
'visitor' => false,
- 'nopreview' => 1,
+ 'hide_voting' => true,
+ 'hide_future' => true,
+ 'hide_expire' => true,
+ 'hide_preview'=> true,
'ptlabel' => t('Layout Name'),
'profile_uid' => intval($owner),
'expanded' => true,
@@ -129,24 +129,24 @@ class Layouts extends \Zotlabs\Web\Controller {
'novoting' => true,
'bbco_autocomplete' => 'comanche'
);
-
+
if($_REQUEST['title'])
$x['title'] = $_REQUEST['title'];
if($_REQUEST['body'])
$x['body'] = $_REQUEST['body'];
if($_REQUEST['pagetitle'])
$x['pagetitle'] = $_REQUEST['pagetitle'];
-
+
$editor = status_editor($a,$x);
-
+
$r = q("select iid, sid, mid, title, body, mimetype, created, edited, item_type from item_id left join item on item_id.iid = item.id
where item_id.uid = %d and service = 'PDL' and item_type = %d order by item.created desc",
intval($owner),
intval(ITEM_TYPE_PDL)
);
-
+
$pages = null;
-
+
if($r) {
$pages = array();
foreach($r as $rr) {
@@ -171,10 +171,10 @@ class Layouts extends \Zotlabs\Web\Controller {
);
}
}
-
+
//Build the base URL for edit links
$url = z_root() . '/editlayout/' . $which;
-
+
$o .= replace_macros(get_markup_template('layoutlist.tpl'), array(
'$title' => t('Layouts'),
'$create' => t('Create'),
@@ -192,8 +192,9 @@ class Layouts extends \Zotlabs\Web\Controller {
'$channel' => $which,
'$view' => t('View'),
));
-
+
return $o;
+
}
-
+
}