acl in webpages and a couple of other little bits related to webpages - sort the list of pages by last edited and use prepare_body() so we get private stuff (and attachments, categories, etc.) formatted correctly
This commit is contained in:
parent
ee629534d5
commit
49a392942c
@ -33,10 +33,12 @@ function magic_init(&$a) {
|
|||||||
|
|
||||||
if(count($b) >= 2) {
|
if(count($b) >= 2) {
|
||||||
$u = $b[0] . '//' . $b[2];
|
$u = $b[0] . '//' . $b[2];
|
||||||
|
dbg(1);
|
||||||
$x = q("select xchan.xchan_url, hubloc.* from xchan left join hubloc on xchan_hash = hubloc_hash
|
$x = q("select xchan.xchan_url, hubloc.* from xchan left join hubloc on xchan_hash = hubloc_hash
|
||||||
where hubloc_url = '%s' order by hubloc_id desc limit 1",
|
where hubloc_url = '%s' order by hubloc_id desc limit 1",
|
||||||
dbesc($u)
|
dbesc($u)
|
||||||
);
|
);
|
||||||
|
dbg(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
mod/page.php
33
mod/page.php
@ -53,20 +53,38 @@ function page_content(&$a) {
|
|||||||
else
|
else
|
||||||
$revision = " order by revision desc ";
|
$revision = " order by revision desc ";
|
||||||
|
|
||||||
|
require_once('include/security.php');
|
||||||
|
$sql_options = item_permissions_sql($u[0]['channel_id']);
|
||||||
|
|
||||||
$r = q("select item.* from item left join item_id on item.id = item_id.iid
|
$r = q("select item.* from item left join item_id on item.id = item_id.iid
|
||||||
where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and
|
where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and
|
||||||
item_restrict = %d $revision limit 1",
|
item_restrict = %d $sql_options $revision limit 1",
|
||||||
intval($u[0]['channel_id']),
|
intval($u[0]['channel_id']),
|
||||||
dbesc($page_id),
|
dbesc($page_id),
|
||||||
intval(ITEM_WEBPAGE)
|
intval(ITEM_WEBPAGE)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! $r) {
|
if(! $r) {
|
||||||
notice( t('Item not found.') . EOL);
|
|
||||||
|
// Check again with no permissions clause to see if it is a permissions issue
|
||||||
|
|
||||||
|
$x = q("select item.* from item left join item_id on item.id = item_id.iid
|
||||||
|
where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and
|
||||||
|
item_restrict = %d $revision limit 1",
|
||||||
|
intval($u[0]['channel_id']),
|
||||||
|
dbesc($page_id),
|
||||||
|
intval(ITEM_WEBPAGE)
|
||||||
|
);
|
||||||
|
if($x) {
|
||||||
|
// Yes, it's there. You just aren't allowed to see it.
|
||||||
|
notice( t('Permission denied.') . EOL);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
notice( t('Page not found.') . EOL);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dbg(1);
|
|
||||||
if($r[0]['layout_mid']) {
|
if($r[0]['layout_mid']) {
|
||||||
$l = q("select body from item where mid = '%s' and uid = %d limit 1",
|
$l = q("select body from item where mid = '%s' and uid = %d limit 1",
|
||||||
dbesc($r[0]['layout_mid']),
|
dbesc($r[0]['layout_mid']),
|
||||||
@ -78,12 +96,11 @@ dbg(1);
|
|||||||
comanche_parser(get_app(),$l[0]['body']);
|
comanche_parser(get_app(),$l[0]['body']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
dbg(0);
|
|
||||||
|
|
||||||
logger('layout: ' . print_r($a->layout,true));
|
|
||||||
|
|
||||||
|
|
||||||
// Use of widgets should be determined by Comanche, but we don't have it yet, so...
|
// logger('layout: ' . print_r($a->layout,true));
|
||||||
|
|
||||||
|
// Use of widgets should be determined by Comanche, but we don't have it on system pages yet, so...
|
||||||
|
|
||||||
if ($perms['write_pages']) {
|
if ($perms['write_pages']) {
|
||||||
$chan = $a->channel['channel_id'];
|
$chan = $a->channel['channel_id'];
|
||||||
@ -95,7 +112,7 @@ logger('layout: ' . print_r($a->layout,true));
|
|||||||
xchan_query($r);
|
xchan_query($r);
|
||||||
$r = fetch_post_tags($r,true);
|
$r = fetch_post_tags($r,true);
|
||||||
|
|
||||||
$o .= prepare_page($r[0]);
|
$o .= prepare_body($r[0],true);
|
||||||
return $o;
|
return $o;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -58,12 +58,15 @@ function webpages_content(&$a) {
|
|||||||
// 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. This lets you post pages at other people's channels.
|
// Nickname is set to the observers xchan, and profile_uid to the owners. This lets you post pages at other people's channels.
|
||||||
require_once ('include/conversation.php');
|
require_once ('include/conversation.php');
|
||||||
|
require_once('include/acl_selectors.php');
|
||||||
|
|
||||||
$x = array(
|
$x = array(
|
||||||
'webpage' => ITEM_WEBPAGE,
|
'webpage' => ITEM_WEBPAGE,
|
||||||
'is_owner' => true,
|
'is_owner' => true,
|
||||||
'nickname' => $a->profile['channel_address'],
|
'nickname' => $a->profile['channel_address'],
|
||||||
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
||||||
'bang' => (($group || $cid) ? '!' : ''),
|
'bang' => (($group || $cid) ? '!' : ''),
|
||||||
|
'acl' => ((local_user() && local_user() == $owner) ? populate_acl($a->get_channel()) : ''),
|
||||||
'visitor' => 'block',
|
'visitor' => 'block',
|
||||||
'profile_uid' => intval($owner),
|
'profile_uid' => intval($owner),
|
||||||
'mimetype' => $mimetype,
|
'mimetype' => $mimetype,
|
||||||
@ -76,7 +79,7 @@ require_once ('include/conversation.php');
|
|||||||
//Get a list of webpages. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
|
//Get a list of webpages. We can't display all them because endless scroll makes that unusable, so just list titles and an edit link.
|
||||||
//TODO - this should be replaced with pagelist_widget
|
//TODO - this should be replaced with pagelist_widget
|
||||||
|
|
||||||
$r = q("select * from item_id where uid = %d and service = 'WEBPAGE' order by sid asc",
|
$r = q("select item_id.* from item_id left join item on item_id.iid = item.id where item_id.uid = %d and service = 'WEBPAGE' order by item.created desc",
|
||||||
intval($owner)
|
intval($owner)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
2013-11-13.496
|
2013-11-14.497
|
||||||
|
Reference in New Issue
Block a user