more message restrict conversions
This commit is contained in:
parent
a2cdd1499c
commit
ff68ea6087
13
boot.php
13
boot.php
@ -520,20 +520,25 @@ define ( 'ACCOUNT_ROLE_ADMIN', 0x1000 );
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
define ( 'ITEM_VISIBLE', 0x0000);
|
define ( 'ITEM_VISIBLE', 0x0000);
|
||||||
define ( 'ITEM_HIDDEN', 0x0001);
|
//define ( 'ITEM_HIDDEN', 0x0001);
|
||||||
define ( 'ITEM_BLOCKED', 0x0002);
|
define ( 'ITEM_BLOCKED', 0x0002);
|
||||||
define ( 'ITEM_MODERATED', 0x0004);
|
define ( 'ITEM_MODERATED', 0x0004);
|
||||||
define ( 'ITEM_SPAM', 0x0008);
|
define ( 'ITEM_SPAM', 0x0008);
|
||||||
define ( 'ITEM_DELETED', 0x0010);
|
//define ( 'ITEM_DELETED', 0x0010);
|
||||||
define ( 'ITEM_UNPUBLISHED', 0x0020);
|
define ( 'ITEM_UNPUBLISHED', 0x0020);
|
||||||
define ( 'ITEM_WEBPAGE', 0x0040); // is a static web page, not a conversational item
|
//define ( 'ITEM_WEBPAGE', 0x0040); // is a static web page, not a conversational item
|
||||||
define ( 'ITEM_DELAYED_PUBLISH', 0x0080);
|
define ( 'ITEM_DELAYED_PUBLISH', 0x0080);
|
||||||
define ( 'ITEM_BUILDBLOCK', 0x0100); // Named thusly to make sure nobody confuses this with ITEM_BLOCKED
|
define ( 'ITEM_BUILDBLOCK', 0x0100); // Named thusly to make sure nobody confuses this with ITEM_BLOCKED
|
||||||
define ( 'ITEM_PDL', 0x0200); // Page Description Language - e.g. Comanche
|
//define ( 'ITEM_PDL', 0x0200); // Page Description Language - e.g. Comanche
|
||||||
define ( 'ITEM_BUG', 0x0400); // Is a bug, can be used by the internal bug tracker
|
define ( 'ITEM_BUG', 0x0400); // Is a bug, can be used by the internal bug tracker
|
||||||
define ( 'ITEM_PENDING_REMOVE', 0x0800); // deleted, notification period has lapsed
|
define ( 'ITEM_PENDING_REMOVE', 0x0800); // deleted, notification period has lapsed
|
||||||
// Don't make us evaluate this same item again.
|
// Don't make us evaluate this same item again.
|
||||||
|
|
||||||
|
define ( 'ITEM_TYPE_POST', 0 );
|
||||||
|
define ( 'ITEM_TYPE_BLOCK', 1 );
|
||||||
|
define ( 'ITEM_TYPE_PDL', 2 );
|
||||||
|
define ( 'ITEM_TYPE_WEBPAGE', 3 );
|
||||||
|
|
||||||
define ( 'DBTYPE_MYSQL', 0 );
|
define ( 'DBTYPE_MYSQL', 0 );
|
||||||
define ( 'DBTYPE_POSTGRES', 1 );
|
define ( 'DBTYPE_POSTGRES', 1 );
|
||||||
|
|
||||||
|
@ -841,7 +841,7 @@ function get_item_elements($x) {
|
|||||||
if(array_key_exists('flags',$x) && in_array('deleted',$x['flags']))
|
if(array_key_exists('flags',$x) && in_array('deleted',$x['flags']))
|
||||||
$arr['item_deleted'] = 1;
|
$arr['item_deleted'] = 1;
|
||||||
if(array_key_exists('flags',$x) && in_array('hidden',$x['flags']))
|
if(array_key_exists('flags',$x) && in_array('hidden',$x['flags']))
|
||||||
$arr['item_restrict'] = ITEM_HIDDEN;
|
$arr['item_hidden'] = 1;
|
||||||
|
|
||||||
// Here's the deal - the site might be down or whatever but if there's a new person you've never
|
// Here's the deal - the site might be down or whatever but if there's a new person you've never
|
||||||
// seen before sending stuff to your stream, we MUST be able to look them up and import their data from their
|
// seen before sending stuff to your stream, we MUST be able to look them up and import their data from their
|
||||||
@ -1312,7 +1312,7 @@ function encode_item_flags($item) {
|
|||||||
|
|
||||||
if(intval($item['item_deleted']))
|
if(intval($item['item_deleted']))
|
||||||
$ret[] = 'deleted';
|
$ret[] = 'deleted';
|
||||||
if($item['item_restrict'] & ITEM_HIDDEN)
|
if(intval($item['item_hidden']))
|
||||||
$ret[] = 'hidden';
|
$ret[] = 'hidden';
|
||||||
if(intval($item['item_thread_top']))
|
if(intval($item['item_thread_top']))
|
||||||
$ret[] = 'thread_parent';
|
$ret[] = 'thread_parent';
|
||||||
@ -1916,11 +1916,11 @@ function item_store($arr,$allow_exec = false) {
|
|||||||
// If a page layout is provided, ensure it exists and belongs to us.
|
// If a page layout is provided, ensure it exists and belongs to us.
|
||||||
|
|
||||||
if(array_key_exists('layout_mid',$arr) && $arr['layout_mid']) {
|
if(array_key_exists('layout_mid',$arr) && $arr['layout_mid']) {
|
||||||
$l = q("select item_restrict from item where mid = '%s' and uid = %d limit 1",
|
$l = q("select item_type from item where mid = '%s' and uid = %d limit 1",
|
||||||
dbesc($arr['layout_mid']),
|
dbesc($arr['layout_mid']),
|
||||||
intval($arr['uid'])
|
intval($arr['uid'])
|
||||||
);
|
);
|
||||||
if((! $l) || (! ($l[0]['item_restrict'] & ITEM_PDL)))
|
if((! $l) || (! ($l[0]['item_type'] != ITEM_TYPE_PDL)))
|
||||||
unset($arr['layout_mid']);
|
unset($arr['layout_mid']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3967,8 +3967,7 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
|
|||||||
// hook calls a remote process which loops. We'll delete it properly in a second.
|
// hook calls a remote process which loops. We'll delete it properly in a second.
|
||||||
|
|
||||||
if(($linked_item) && (! $force)) {
|
if(($linked_item) && (! $force)) {
|
||||||
$r = q("UPDATE item SET item_restrict = ( item_restrict | %d ) WHERE id = %d",
|
$r = q("UPDATE item SET item_hidden = 1 WHERE id = %d",
|
||||||
intval(ITEM_HIDDEN),
|
|
||||||
intval($item['id'])
|
intval($item['id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -4041,9 +4040,8 @@ function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL,$force = false) {
|
|||||||
|
|
||||||
case DROPITEM_PHASE1:
|
case DROPITEM_PHASE1:
|
||||||
if($linked_item && ! $force) {
|
if($linked_item && ! $force) {
|
||||||
$r = q("UPDATE item SET item_restrict = ( item_restrict | %d ),
|
$r = q("UPDATE item SET item_hidden = 1,
|
||||||
changed = '%s', edited = '%s' WHERE id = %d",
|
changed = '%s', edited = '%s' WHERE id = %d",
|
||||||
intval(ITEM_HIDDEN),
|
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($item['id'])
|
intval($item['id'])
|
||||||
@ -4062,9 +4060,8 @@ function delete_item_lowlevel($item,$stage = DROPITEM_NORMAL,$force = false) {
|
|||||||
case DROPITEM_NORMAL:
|
case DROPITEM_NORMAL:
|
||||||
default:
|
default:
|
||||||
if($linked_item && ! $force) {
|
if($linked_item && ! $force) {
|
||||||
$r = q("UPDATE item SET item_restrict = ( item_restrict | %d ),
|
$r = q("UPDATE item SET item_hidden = 1,
|
||||||
changed = '%s', edited = '%s' WHERE id = %d",
|
changed = '%s', edited = '%s' WHERE id = %d",
|
||||||
intval(ITEM_HIDDEN),
|
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($item['id'])
|
intval($item['id'])
|
||||||
@ -4522,9 +4519,9 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
|||||||
$sql_extra .= item_permissions_sql($channel['channel_id']);
|
$sql_extra .= item_permissions_sql($channel['channel_id']);
|
||||||
|
|
||||||
if($arr['pages'])
|
if($arr['pages'])
|
||||||
$item_restrict = " AND (item_restrict & " . ITEM_WEBPAGE . ") ";
|
$item_restrict = " AND item_type = " . ITEM_TYPE_WEBPAGE . " ";
|
||||||
else
|
else
|
||||||
$item_restrict = " AND item_restrict = 0 ";
|
$item_restrict = " AND item_type = 0 ";
|
||||||
|
|
||||||
|
|
||||||
if($arr['nouveau'] && ($client_mode & CLIENT_MODE_LOAD) && $channel) {
|
if($arr['nouveau'] && ($client_mode & CLIENT_MODE_LOAD) && $channel) {
|
||||||
@ -4629,11 +4626,11 @@ function update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remo
|
|||||||
|
|
||||||
$page_type = '';
|
$page_type = '';
|
||||||
|
|
||||||
if($webpage & ITEM_WEBPAGE)
|
if($webpage == ITEM_TYPE_WEBPAGE)
|
||||||
$page_type = 'WEBPAGE';
|
$page_type = 'WEBPAGE';
|
||||||
elseif($webpage & ITEM_BUILDBLOCK)
|
elseif($webpage == ITEM_TYPE_BLOCK)
|
||||||
$page_type = 'BUILDBLOCK';
|
$page_type = 'BUILDBLOCK';
|
||||||
elseif($webpage & ITEM_PDL)
|
elseif($webpage == ITEM_TYPE_PDL)
|
||||||
$page_type = 'PDL';
|
$page_type = 'PDL';
|
||||||
elseif($namespace && $remote_id) {
|
elseif($namespace && $remote_id) {
|
||||||
$page_type = $namespace;
|
$page_type = $namespace;
|
||||||
|
@ -316,9 +316,12 @@ function notifier_run($argv, $argc){
|
|||||||
if(intval($target_item['item_deleted']))
|
if(intval($target_item['item_deleted']))
|
||||||
logger('notifier: target item ITEM_DELETED', LOGGER_DEBUG);
|
logger('notifier: target item ITEM_DELETED', LOGGER_DEBUG);
|
||||||
|
|
||||||
$unforwardable = ITEM_UNPUBLISHED|ITEM_DELAYED_PUBLISH|ITEM_WEBPAGE|ITEM_BUILDBLOCK|ITEM_PDL;
|
if(intval($target_item['item_type']) != ITEM_TYPE_POST) {
|
||||||
if($target_item['item_restrict'] & $unforwardable) {
|
logger('notifier: target item not forwardable: type ' . $target_item['item_type'], LOGGER_DEBUG);
|
||||||
logger('notifier: target item not forwardable: flags ' . $target_item['item_restrict'], LOGGER_DEBUG);
|
return;
|
||||||
|
}
|
||||||
|
if(intval($target_item['item_unpublished']) || intval($target_item['item_delayed_publish'])) {
|
||||||
|
logger('notifier: target item not published, so not forwardable', LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ function photo_upload($channel, $observer, $args) {
|
|||||||
|
|
||||||
// Create item container
|
// Create item container
|
||||||
|
|
||||||
$item_restrict = (($visible) ? ITEM_VISIBLE : ITEM_HIDDEN);
|
$item_hidden = (($visible) ? 0 : 1 );
|
||||||
$title = '';
|
$title = '';
|
||||||
$mid = item_message_id();
|
$mid = item_message_id();
|
||||||
|
|
||||||
@ -235,8 +235,7 @@ function photo_upload($channel, $observer, $args) {
|
|||||||
$arr['uid'] = $channel_id;
|
$arr['uid'] = $channel_id;
|
||||||
$arr['mid'] = $mid;
|
$arr['mid'] = $mid;
|
||||||
$arr['parent_mid'] = $mid;
|
$arr['parent_mid'] = $mid;
|
||||||
$arr['item_flags'] = $item_flags;
|
$arr['item_hidden'] = $item_hidden;
|
||||||
$arr['item_restrict'] = $item_restrict;
|
|
||||||
$arr['resource_type'] = 'photo';
|
$arr['resource_type'] = 'photo';
|
||||||
$arr['resource_id'] = $photo_hash;
|
$arr['resource_id'] = $photo_hash;
|
||||||
$arr['owner_xchan'] = $channel['channel_hash'];
|
$arr['owner_xchan'] = $channel['channel_hash'];
|
||||||
@ -446,7 +445,7 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) {
|
|||||||
|
|
||||||
// Create item container
|
// Create item container
|
||||||
|
|
||||||
$item_restrict = (($visible) ? ITEM_VISIBLE : ITEM_HIDDEN);
|
$item_hidden = (($visible) ? 0 : 1 );
|
||||||
|
|
||||||
$title = '';
|
$title = '';
|
||||||
$mid = item_message_id();
|
$mid = item_message_id();
|
||||||
@ -460,20 +459,20 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) {
|
|||||||
$arr['item_wall'] = 1;
|
$arr['item_wall'] = 1;
|
||||||
$arr['item_origin'] = 1;
|
$arr['item_origin'] = 1;
|
||||||
$arr['item_thread_top'] = 1;
|
$arr['item_thread_top'] = 1;
|
||||||
$arr['item_restrict'] = $item_restrict;
|
$arr['item_hidden'] = $item_hidden;
|
||||||
$arr['resource_type'] = 'photo';
|
$arr['resource_type'] = 'photo';
|
||||||
$arr['resource_id'] = $photo['resource_id'];
|
$arr['resource_id'] = $photo['resource_id'];
|
||||||
$arr['owner_xchan'] = $channel['channel_hash'];
|
$arr['owner_xchan'] = $channel['channel_hash'];
|
||||||
$arr['author_xchan'] = $creator_hash;
|
$arr['author_xchan'] = $creator_hash;
|
||||||
|
|
||||||
$arr['allow_cid'] = $photo['allow_cid'];
|
$arr['allow_cid'] = $photo['allow_cid'];
|
||||||
$arr['allow_gid'] = $photo['allow_gid'];
|
$arr['allow_gid'] = $photo['allow_gid'];
|
||||||
$arr['deny_cid'] = $photo['deny_cid'];
|
$arr['deny_cid'] = $photo['deny_cid'];
|
||||||
$arr['deny_gid'] = $photo['deny_gid'];
|
$arr['deny_gid'] = $photo['deny_gid'];
|
||||||
|
|
||||||
$arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid'];
|
$arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid'];
|
||||||
|
|
||||||
$arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']'
|
$arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']'
|
||||||
. '[zmg]' . z_root() . '/photo/' . $photo['resource_id'] . '-' . $photo['scale'] . '[/zmg]'
|
. '[zmg]' . z_root() . '/photo/' . $photo['resource_id'] . '-' . $photo['scale'] . '[/zmg]'
|
||||||
. '[/zrl]';
|
. '[/zrl]';
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $restrict = 0, $
|
|||||||
// Fetch tags
|
// Fetch tags
|
||||||
$r = q("select term, count(term) as total from term left join item on term.oid = item.id
|
$r = q("select term, count(term) as total from term left join item on term.oid = item.id
|
||||||
where term.uid = %d and term.type = %d
|
where term.uid = %d and term.type = %d
|
||||||
and otype = %d and item_restrict = %d and item_private = 0
|
and otype = %d and item_type = %d and item_private = 0
|
||||||
$sql_options
|
$sql_options
|
||||||
group by term order by total desc %s",
|
group by term order by total desc %s",
|
||||||
intval($uid),
|
intval($uid),
|
||||||
|
@ -1549,9 +1549,9 @@ function unamp($s) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function layout_select($channel_id, $current = '') {
|
function layout_select($channel_id, $current = '') {
|
||||||
$r = q("select mid,sid from item left join item_id on iid = item.id where service = 'PDL' and item.uid = item_id.uid and item_id.uid = %d and (item_restrict & %d)>0",
|
$r = q("select mid,sid from item left join item_id on iid = item.id where service = 'PDL' and item.uid = item_id.uid and item_id.uid = %d and item_type = %d ",
|
||||||
intval($channel_id),
|
intval($channel_id),
|
||||||
intval(ITEM_PDL)
|
intval(ITEM_TYPE_PDL)
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
$o = t('Select a page layout: ');
|
$o = t('Select a page layout: ');
|
||||||
|
@ -29,7 +29,7 @@ function widget_tagcloud($args) {
|
|||||||
$type = TERM_CATEGORY;
|
$type = TERM_CATEGORY;
|
||||||
|
|
||||||
// FIXME there exists no $authors variable
|
// FIXME there exists no $authors variable
|
||||||
$r = tagadelic($uid, $count, $authors, $flags, ITEM_WEBPAGE, $type);
|
$r = tagadelic($uid, $count, $authors, $flags, ITEM_TYPE_WEBPAGE, $type);
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
$o = '<div class="tagblock widget"><h3>' . t('Categories') . '</h3><div class="tags" align="center">';
|
$o = '<div class="tagblock widget"><h3>' . t('Categories') . '</h3><div class="tags" align="center">';
|
||||||
@ -688,7 +688,7 @@ function widget_item($arr) {
|
|||||||
require_once('include/security.php');
|
require_once('include/security.php');
|
||||||
$sql_extra = item_permissions_sql($uid);
|
$sql_extra = item_permissions_sql($uid);
|
||||||
|
|
||||||
$r = q("select * from item where mid = '%s' and uid = %d and item_restrict = " . intval(ITEM_WEBPAGE) . " $sql_extra limit 1",
|
$r = q("select * from item where mid = '%s' and uid = %d and item_type = " . intval(ITEM_TYPE_WEBPAGE) . " $sql_extra limit 1",
|
||||||
dbesc($arr['mid']),
|
dbesc($arr['mid']),
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
|
@ -1532,7 +1532,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if($arr['item_restrict'] & ITEM_DELETED) {
|
if(intval($arr['item_deleted'])) {
|
||||||
|
|
||||||
// remove_community_tag is a no-op if this isn't a community tag activity
|
// remove_community_tag is a no-op if this isn't a community tag activity
|
||||||
remove_community_tag($sender,$arr,$channel['channel_id']);
|
remove_community_tag($sender,$arr,$channel['channel_id']);
|
||||||
@ -1549,14 +1549,14 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("select id, edited, item_restrict, item_flags, mid, parent_mid from item where mid = '%s' and uid = %d limit 1",
|
$r = q("select * from item where mid = '%s' and uid = %d limit 1",
|
||||||
dbesc($arr['mid']),
|
dbesc($arr['mid']),
|
||||||
intval($channel['channel_id'])
|
intval($channel['channel_id'])
|
||||||
);
|
);
|
||||||
if($r) {
|
if($r) {
|
||||||
// We already have this post.
|
// We already have this post.
|
||||||
$item_id = $r[0]['id'];
|
$item_id = $r[0]['id'];
|
||||||
if($r[0]['item_restrict'] & ITEM_DELETED) {
|
if(intval($r[0]['item_deleted'])) {
|
||||||
// It was deleted locally.
|
// It was deleted locally.
|
||||||
$result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
|
$result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']);
|
||||||
continue;
|
continue;
|
||||||
@ -1686,7 +1686,7 @@ function delete_imported_item($sender,$item,$uid) {
|
|||||||
|
|
||||||
logger('delete_imported_item invoked',LOGGER_DEBUG);
|
logger('delete_imported_item invoked',LOGGER_DEBUG);
|
||||||
|
|
||||||
$r = q("select id, item_restrict from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' )
|
$r = q("select id, item_deleted from item where ( author_xchan = '%s' or owner_xchan = '%s' or source_xchan = '%s' )
|
||||||
and mid = '%s' and uid = %d limit 1",
|
and mid = '%s' and uid = %d limit 1",
|
||||||
dbesc($sender['hash']),
|
dbesc($sender['hash']),
|
||||||
dbesc($sender['hash']),
|
dbesc($sender['hash']),
|
||||||
@ -1700,7 +1700,7 @@ function delete_imported_item($sender,$item,$uid) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if($r[0]['item_restrict'] & ITEM_DELETED) {
|
if(intval($r[0]['item_deleted'])) {
|
||||||
logger('delete_imported_item: item was already deleted');
|
logger('delete_imported_item: item was already deleted');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ function display_content(&$a, $update = 0, $load = false) {
|
|||||||
|
|
||||||
$target_item = null;
|
$target_item = null;
|
||||||
|
|
||||||
$r = q("select id, uid, mid, parent_mid, item_restrict from item where mid like '%s' limit 1",
|
$r = q("select id, uid, mid, parent_mid, item_type, item_deleted from item where mid like '%s' limit 1",
|
||||||
dbesc($item_hash . '%')
|
dbesc($item_hash . '%')
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ function display_content(&$a, $update = 0, $load = false) {
|
|||||||
|
|
||||||
$r = null;
|
$r = null;
|
||||||
|
|
||||||
if($target_item['item_restrict'] & ITEM_WEBPAGE) {
|
if($target_item['item_type'] == ITEM_TYPE_WEBPAGE) {
|
||||||
$x = q("select * from channel where channel_id = %d limit 1",
|
$x = q("select * from channel where channel_id = %d limit 1",
|
||||||
intval($target_item['uid'])
|
intval($target_item['uid'])
|
||||||
);
|
);
|
||||||
|
@ -135,7 +135,7 @@ function editlayout_content(&$a) {
|
|||||||
$o .= replace_macros($tpl,array(
|
$o .= replace_macros($tpl,array(
|
||||||
'$return_path' => $rp,
|
'$return_path' => $rp,
|
||||||
'$action' => 'item',
|
'$action' => 'item',
|
||||||
'$webpage' => ITEM_PDL,
|
'$webpage' => ITEM_TYPE_PDL,
|
||||||
'$share' => t('Edit'),
|
'$share' => t('Edit'),
|
||||||
'$upload' => t('Upload photo'),
|
'$upload' => t('Upload photo'),
|
||||||
'$attach' => t('Attach file'),
|
'$attach' => t('Attach file'),
|
||||||
|
@ -166,7 +166,7 @@ function editwebpage_content(&$a) {
|
|||||||
|
|
||||||
$o .= replace_macros($tpl,array(
|
$o .= replace_macros($tpl,array(
|
||||||
'$return_path' => $rp,
|
'$return_path' => $rp,
|
||||||
'$webpage' => ITEM_WEBPAGE,
|
'$webpage' => ITEM_TYPE_WEBPAGE,
|
||||||
'$placeholdpagetitle' => t('Page link title'),
|
'$placeholdpagetitle' => t('Page link title'),
|
||||||
'$pagetitle' => $page_title,
|
'$pagetitle' => $page_title,
|
||||||
|
|
||||||
|
@ -74,10 +74,10 @@ function home_content(&$a, $update = 0, $load = false) {
|
|||||||
|
|
||||||
$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 limit 1",
|
item_type = %d limit 1",
|
||||||
intval($u[0]['channel_id']),
|
intval($u[0]['channel_id']),
|
||||||
dbesc($page_id),
|
dbesc($page_id),
|
||||||
intval(ITEM_WEBPAGE)
|
intval(ITEM_TYPE_WEBPAGE)
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r) {
|
if($r) {
|
||||||
|
@ -28,17 +28,17 @@ function impel_init(&$a) {
|
|||||||
|
|
||||||
switch($j['type']) {
|
switch($j['type']) {
|
||||||
case 'webpage':
|
case 'webpage':
|
||||||
$arr['item_restrict'] = ITEM_WEBPAGE;
|
$arr['item_type'] = ITEM_TYPE_WEBPAGE;
|
||||||
$namespace = 'WEBPAGE';
|
$namespace = 'WEBPAGE';
|
||||||
$installed_type = t('webpage');
|
$installed_type = t('webpage');
|
||||||
break;
|
break;
|
||||||
case 'block':
|
case 'block':
|
||||||
$arr['item_restrict'] = ITEM_BUILDBLOCK;
|
$arr['item_type'] = ITEM_TYPE_BLOCK;
|
||||||
$namespace = 'BUILDBLOCK';
|
$namespace = 'BUILDBLOCK';
|
||||||
$installed_type = t('block');
|
$installed_type = t('block');
|
||||||
break;
|
break;
|
||||||
case 'layout':
|
case 'layout':
|
||||||
$arr['item_restrict'] = ITEM_PDL;
|
$arr['item_type'] = ITEM_TYPE_PDL;
|
||||||
$namespace = 'PDL';
|
$namespace = 'PDL';
|
||||||
$installed_type = t('layout');
|
$installed_type = t('layout');
|
||||||
break;
|
break;
|
||||||
|
@ -839,9 +839,8 @@ function item_post(&$a) {
|
|||||||
// This way we don't see every picture in your new photo album posted to your wall at once.
|
// This way we don't see every picture in your new photo album posted to your wall at once.
|
||||||
// They will show up as people comment on them.
|
// They will show up as people comment on them.
|
||||||
|
|
||||||
if($parent_item['item_restrict'] & ITEM_HIDDEN) {
|
if(intval($parent_item['item_hidden'])) {
|
||||||
$r = q("UPDATE `item` SET `item_restrict` = %d WHERE `id` = %d",
|
$r = q("UPDATE item SET item_hidden = 0 WHERE id = %d",
|
||||||
intval($parent_item['item_restrict'] - ITEM_HIDDEN),
|
|
||||||
intval($parent_item['id'])
|
intval($parent_item['id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1047,8 +1046,8 @@ function item_check_service_class($channel_id,$iswebpage) {
|
|||||||
if ($iswebpage) {
|
if ($iswebpage) {
|
||||||
$r = q("select count(i.id) as total from item i
|
$r = q("select count(i.id) as total from item i
|
||||||
right join channel c on (i.author_xchan=c.channel_hash and i.uid=c.channel_id )
|
right join channel c on (i.author_xchan=c.channel_hash and i.uid=c.channel_id )
|
||||||
and i.parent=i.id and (i.item_restrict & %d)>0 and i.item_deleted = 0 and i.uid= %d ",
|
and i.parent=i.id and i.item_type = %d and i.item_deleted = 0 and i.uid= %d ",
|
||||||
intval(ITEM_WEBPAGE),
|
intval(ITEM_TYPE_WEBPAGE),
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@ function layouts_content(&$a) {
|
|||||||
// 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_PDL,
|
'webpage' => ITEM_TYPE_PDL,
|
||||||
'is_owner' => true,
|
'is_owner' => true,
|
||||||
'nickname' => $a->profile['channel_address'],
|
'nickname' => $a->profile['channel_address'],
|
||||||
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
||||||
|
12
mod/like.php
12
mod/like.php
@ -229,9 +229,10 @@ function like_content(&$a) {
|
|||||||
|
|
||||||
// get the item. Allow linked photos (which are normally hidden) to be liked
|
// get the item. Allow linked photos (which are normally hidden) to be liked
|
||||||
|
|
||||||
$r = q("SELECT * FROM item WHERE id = %d and (item_restrict = 0 or item_restrict = %d) LIMIT 1",
|
$r = q("SELECT * FROM item WHERE id = %d
|
||||||
intval($item_id),
|
and item_blocked = 0 and item_moderated = 0 and item_spam = 0
|
||||||
intval(ITEM_HIDDEN)
|
and item_deleted = 0 and item_unpublished = 0 and item_delayed_publish = 0 LIMIT 1",
|
||||||
|
intval($item_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! $item_id || (! $r)) {
|
if(! $item_id || (! $r)) {
|
||||||
@ -339,9 +340,8 @@ function like_content(&$a) {
|
|||||||
|
|
||||||
// if this was a linked photo and was hidden, unhide it.
|
// if this was a linked photo and was hidden, unhide it.
|
||||||
|
|
||||||
if($item['item_restrict'] & ITEM_HIDDEN) {
|
if(intval($item['item_hidden'])) {
|
||||||
$r = q("update item set item_restrict = (item_restrict ^ %d) where id = %d",
|
$r = q("update item set item_hidden = 0 where id = %d",
|
||||||
intval(ITEM_HIDDEN),
|
|
||||||
intval($item['id'])
|
intval($item['id'])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -56,10 +56,10 @@ function page_init(&$a) {
|
|||||||
|
|
||||||
$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 $sql_options $revision limit 1",
|
item_type = %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_TYPE_WEBPAGE)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! $r) {
|
if(! $r) {
|
||||||
@ -68,10 +68,10 @@ function page_init(&$a) {
|
|||||||
|
|
||||||
$x = q("select item.* from item left join item_id on item.id = item_id.iid
|
$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
|
where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and
|
||||||
item_restrict = %d $revision limit 1",
|
item_type = %d $revision limit 1",
|
||||||
intval($u[0]['channel_id']),
|
intval($u[0]['channel_id']),
|
||||||
dbesc($page_id),
|
dbesc($page_id),
|
||||||
intval(ITEM_WEBPAGE)
|
intval(ITEM_TYPE_WEBPAGE)
|
||||||
);
|
);
|
||||||
if($x) {
|
if($x) {
|
||||||
// Yes, it's there. You just aren't allowed to see it.
|
// Yes, it's there. You just aren't allowed to see it.
|
||||||
|
@ -106,7 +106,7 @@ function webpages_content(&$a) {
|
|||||||
$o = profile_tabs($a,true);
|
$o = profile_tabs($a,true);
|
||||||
|
|
||||||
$x = array(
|
$x = array(
|
||||||
'webpage' => ITEM_WEBPAGE,
|
'webpage' => ITEM_TYPE_WEBPAGE,
|
||||||
'is_owner' => true,
|
'is_owner' => true,
|
||||||
'nickname' => $a->profile['channel_address'],
|
'nickname' => $a->profile['channel_address'],
|
||||||
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
|
||||||
|
Reference in New Issue
Block a user