aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Zotlabs/Module/Layouts.php71
1 files changed, 35 insertions, 36 deletions
diff --git a/Zotlabs/Module/Layouts.php b/Zotlabs/Module/Layouts.php
index ce84b6bf1..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,11 +107,11 @@ 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,
@@ -131,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) {
@@ -173,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'),
@@ -194,8 +192,9 @@ class Layouts extends \Zotlabs\Web\Controller {
'$channel' => $which,
'$view' => t('View'),
));
-
+
return $o;
+
}
-
+
}