aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Module/Layouts.php
diff options
context:
space:
mode:
authorjeroenpraat <jeroenpraat@xs4all.nl>2016-04-30 22:30:37 +0200
committerjeroenpraat <jeroenpraat@xs4all.nl>2016-04-30 22:30:37 +0200
commit3d9fcee075802d8090a394e458e6bc7faba4af18 (patch)
tree850337863d3c84761e87357d6a13d7c43a7e63a9 /Zotlabs/Module/Layouts.php
parent917bcb55fd3beee4eb8590256a458872b9da7605 (diff)
parent026787fc73cb76975b55425cdec9b6701a097935 (diff)
downloadvolse-hubzilla-3d9fcee075802d8090a394e458e6bc7faba4af18.tar.gz
volse-hubzilla-3d9fcee075802d8090a394e458e6bc7faba4af18.tar.bz2
volse-hubzilla-3d9fcee075802d8090a394e458e6bc7faba4af18.zip
Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev
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;
+
}
-
+
}