whitespace
This commit is contained in:
parent
d43c7603bf
commit
026787fc73
@ -5,47 +5,45 @@ require_once('include/identity.php');
|
|||||||
require_once('include/conversation.php');
|
require_once('include/conversation.php');
|
||||||
require_once('include/acl_selectors.php');
|
require_once('include/acl_selectors.php');
|
||||||
|
|
||||||
|
|
||||||
class Layouts extends \Zotlabs\Web\Controller {
|
class Layouts extends \Zotlabs\Web\Controller {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
|
|
||||||
if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
|
if(argc() > 1 && argv(1) === 'sys' && is_site_admin()) {
|
||||||
$sys = get_sys_channel();
|
$sys = get_sys_channel();
|
||||||
if($sys && intval($sys['channel_id'])) {
|
if($sys && intval($sys['channel_id'])) {
|
||||||
\App::$is_sys = true;
|
\App::$is_sys = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(argc() > 1)
|
if(argc() > 1)
|
||||||
$which = argv(1);
|
$which = argv(1);
|
||||||
else
|
else
|
||||||
return;
|
return;
|
||||||
|
|
||||||
profile_load($a,$which);
|
profile_load($a,$which);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get() {
|
||||||
function get() {
|
|
||||||
|
|
||||||
if(! \App::$profile) {
|
if(! \App::$profile) {
|
||||||
notice( t('Requested profile is not available.') . EOL );
|
notice( t('Requested profile is not available.') . EOL );
|
||||||
\App::$error = 404;
|
\App::$error = 404;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$which = argv(1);
|
$which = argv(1);
|
||||||
|
|
||||||
$_SESSION['return_url'] = \App::$query_string;
|
$_SESSION['return_url'] = \App::$query_string;
|
||||||
|
|
||||||
$uid = local_channel();
|
$uid = local_channel();
|
||||||
$owner = 0;
|
$owner = 0;
|
||||||
$channel = null;
|
$channel = null;
|
||||||
$observer = \App::get_observer();
|
$observer = \App::get_observer();
|
||||||
|
|
||||||
$channel = \App::get_channel();
|
$channel = \App::get_channel();
|
||||||
|
|
||||||
if(\App::$is_sys && is_site_admin()) {
|
if(\App::$is_sys && is_site_admin()) {
|
||||||
$sys = get_sys_channel();
|
$sys = get_sys_channel();
|
||||||
if($sys && intval($sys['channel_id'])) {
|
if($sys && intval($sys['channel_id'])) {
|
||||||
@ -54,7 +52,7 @@ class Layouts extends \Zotlabs\Web\Controller {
|
|||||||
$observer = $sys;
|
$observer = $sys;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! $owner) {
|
if(! $owner) {
|
||||||
// Figure out who the page owner is.
|
// Figure out who the page owner is.
|
||||||
$r = q("select channel_id from channel where channel_address = '%s'",
|
$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']);
|
$owner = intval($r[0]['channel_id']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
|
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
|
||||||
|
|
||||||
$perms = get_all_perms($owner,$ob_hash);
|
$perms = get_all_perms($owner,$ob_hash);
|
||||||
|
|
||||||
if(! $perms['write_pages']) {
|
if(! $perms['write_pages']) {
|
||||||
notice( t('Permission denied.') . EOL);
|
notice( t('Permission denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Block design features from visitors
|
// Block design features from visitors
|
||||||
|
|
||||||
if((! $uid) || ($uid != $owner)) {
|
if((! $uid) || ($uid != $owner)) {
|
||||||
notice( t('Permission denied.') . EOL);
|
notice( t('Permission denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the observer, check their permissions
|
// Get the observer, check their permissions
|
||||||
|
|
||||||
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
|
$ob_hash = (($observer) ? $observer['xchan_hash'] : '');
|
||||||
|
|
||||||
$perms = get_all_perms($owner,$ob_hash);
|
$perms = get_all_perms($owner,$ob_hash);
|
||||||
|
|
||||||
if(! $perms['write_pages']) {
|
if(! $perms['write_pages']) {
|
||||||
notice( t('Permission denied.') . EOL);
|
notice( t('Permission denied.') . EOL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//This feature is not exposed in redbasic ui since it is not clear why one would want to
|
//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.
|
//download a json encoded pdl file - we dont have a possibility to import it.
|
||||||
//Use the buildin share/install feature instead.
|
//Use the buildin share/install feature instead.
|
||||||
@ -109,11 +107,11 @@ class Layouts extends \Zotlabs\Web\Controller {
|
|||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create a status editor (for now - we'll need a WYSIWYG eventually) to create pages
|
// 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.
|
// Nickname is set to the observers xchan, and profile_uid to the owners.
|
||||||
// This lets you post pages at other people's channels.
|
// This lets you post pages at other people's channels.
|
||||||
|
|
||||||
$x = array(
|
$x = array(
|
||||||
'webpage' => ITEM_TYPE_PDL,
|
'webpage' => ITEM_TYPE_PDL,
|
||||||
'is_owner' => true,
|
'is_owner' => true,
|
||||||
@ -131,24 +129,24 @@ class Layouts extends \Zotlabs\Web\Controller {
|
|||||||
'novoting' => true,
|
'novoting' => true,
|
||||||
'bbco_autocomplete' => 'comanche'
|
'bbco_autocomplete' => 'comanche'
|
||||||
);
|
);
|
||||||
|
|
||||||
if($_REQUEST['title'])
|
if($_REQUEST['title'])
|
||||||
$x['title'] = $_REQUEST['title'];
|
$x['title'] = $_REQUEST['title'];
|
||||||
if($_REQUEST['body'])
|
if($_REQUEST['body'])
|
||||||
$x['body'] = $_REQUEST['body'];
|
$x['body'] = $_REQUEST['body'];
|
||||||
if($_REQUEST['pagetitle'])
|
if($_REQUEST['pagetitle'])
|
||||||
$x['pagetitle'] = $_REQUEST['pagetitle'];
|
$x['pagetitle'] = $_REQUEST['pagetitle'];
|
||||||
|
|
||||||
$editor = status_editor($a,$x);
|
$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
|
$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",
|
where item_id.uid = %d and service = 'PDL' and item_type = %d order by item.created desc",
|
||||||
intval($owner),
|
intval($owner),
|
||||||
intval(ITEM_TYPE_PDL)
|
intval(ITEM_TYPE_PDL)
|
||||||
);
|
);
|
||||||
|
|
||||||
$pages = null;
|
$pages = null;
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
$pages = array();
|
$pages = array();
|
||||||
foreach($r as $rr) {
|
foreach($r as $rr) {
|
||||||
@ -173,10 +171,10 @@ class Layouts extends \Zotlabs\Web\Controller {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Build the base URL for edit links
|
//Build the base URL for edit links
|
||||||
$url = z_root() . '/editlayout/' . $which;
|
$url = z_root() . '/editlayout/' . $which;
|
||||||
|
|
||||||
$o .= replace_macros(get_markup_template('layoutlist.tpl'), array(
|
$o .= replace_macros(get_markup_template('layoutlist.tpl'), array(
|
||||||
'$title' => t('Layouts'),
|
'$title' => t('Layouts'),
|
||||||
'$create' => t('Create'),
|
'$create' => t('Create'),
|
||||||
@ -194,8 +192,9 @@ class Layouts extends \Zotlabs\Web\Controller {
|
|||||||
'$channel' => $which,
|
'$channel' => $which,
|
||||||
'$view' => t('View'),
|
'$view' => t('View'),
|
||||||
));
|
));
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user