convert ITEM_WALL from bitfield to standalone
This commit is contained in:
parent
75b8bfc07a
commit
25b599a4bd
@ -88,7 +88,8 @@ function refimport_content(&$a) {
|
||||
$arr['author_xchan'] = $channel['channel_hash'];
|
||||
$arr['owner_xchan'] = $channel['channel_hash'];
|
||||
$arr['app'] = REFLECT_BLOGNAME;
|
||||
$arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL|ITEM_THREAD_TOP;
|
||||
$arr['item_flags'] = ITEM_ORIGIN|ITEM_THREAD_TOP;
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['verb'] = ACTIVITY_POST;
|
||||
|
||||
// this is an assumption
|
||||
@ -256,7 +257,8 @@ function reflect_comment_store($channel,$post,$comment,$user) {
|
||||
$arr['edited'] = $comment['created'];
|
||||
$arr['author_xchan'] = $hash;
|
||||
$arr['owner_xchan'] = $channel['channel_hash'];
|
||||
$arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL;
|
||||
$arr['item_flags'] = ITEM_ORIGIN;
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['verb'] = ACTIVITY_POST;
|
||||
$arr['comment_policy'] = 'contacts';
|
||||
|
||||
|
@ -21,7 +21,8 @@ function profile_activity($changed, $value) {
|
||||
$arr['uid'] = local_channel();
|
||||
$arr['aid'] = $self['channel_account_id'];
|
||||
$arr['owner_xchan'] = $arr['author_xchan'] = $self['xchan_hash'];
|
||||
$arr['item_flags'] = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP;
|
||||
$arr['item_flags'] = ITEM_ORIGIN|ITEM_THREAD_TOP;
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['verb'] = ACTIVITY_UPDATE;
|
||||
$arr['obj_type'] = ACTIVITY_OBJ_PROFILE;
|
||||
|
||||
|
@ -344,10 +344,9 @@ require_once('include/items.php');
|
||||
// count public wall messages
|
||||
$r = q("SELECT COUNT(`id`) as `count` FROM `item`
|
||||
WHERE `uid` = %d
|
||||
AND ( item_flags & %d )>0 and item_restrict = 0
|
||||
AND item_wall = 1 and item_restrict = 0
|
||||
AND `allow_cid`='' AND `allow_gid`='' AND `deny_cid`='' AND `deny_gid`=''",
|
||||
intval($usr[0]['channel_id']),
|
||||
intval(ITEM_WALL)
|
||||
intval($usr[0]['channel_id'])
|
||||
);
|
||||
$countitms = $r[0]['count'];
|
||||
}
|
||||
|
@ -1031,7 +1031,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
|
||||
|
||||
$objtype = ACTIVITY_OBJ_FILE;
|
||||
|
||||
$item_flags = ITEM_WALL|ITEM_ORIGIN;
|
||||
$item_flags = ITEM_ORIGIN;
|
||||
|
||||
$private = (($arr_allow_cid[0] || $arr_allow_gid[0] || $arr_deny_cid[0] || $arr_deny_gid[0]) ? 1 : 0);
|
||||
|
||||
@ -1078,6 +1078,7 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
|
||||
$arr['parent_mid'] = $u_mid;
|
||||
$arr['item_flags'] = $item_flags;
|
||||
$arr['item_unseen'] = 1;
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['author_xchan'] = $poster['xchan_hash'];
|
||||
$arr['owner_xchan'] = $poster['xchan_hash'];
|
||||
$arr['title'] = '';
|
||||
|
@ -171,7 +171,7 @@ function notification($params) {
|
||||
$item_post_type);
|
||||
|
||||
// "your post"
|
||||
if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && ($p[0]['item_flags'] & ITEM_WALL))
|
||||
if($p[0]['owner']['xchan_name'] == $p[0]['author']['xchan_name'] && intval($p[0]['item_wall']))
|
||||
$dest_str = sprintf(t('%1$s, %2$s commented on [zrl=%3$s]your %4$s[/zrl]'),
|
||||
$recip['channel_name'],
|
||||
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]',
|
||||
|
@ -479,7 +479,7 @@ function event_store_item($arr, $event) {
|
||||
|
||||
$item_flags = ITEM_THREAD_TOP;
|
||||
if($wall) {
|
||||
$item_flags |= ITEM_WALL;
|
||||
$item_arr['item_wall'] = 1;
|
||||
$item_flags |= ITEM_ORIGIN;
|
||||
}
|
||||
$item_arr['item_flags'] = $item_flags;
|
||||
|
@ -99,14 +99,14 @@ function externals_run($argv, $argc){
|
||||
// );
|
||||
$z = null;
|
||||
if($z) {
|
||||
$flag_bits = ITEM_WALL|ITEM_ORIGIN|ITEM_UPLINK;
|
||||
$flag_bits = ITEM_ORIGIN|ITEM_UPLINK;
|
||||
// preserve the source
|
||||
|
||||
$r = q("update item set source_xchan = owner_xchan where id = %d",
|
||||
intval($z[0]['id'])
|
||||
);
|
||||
|
||||
$r = q("update item set item_flags = ( item_flags | %d ), owner_xchan = '%s'
|
||||
$r = q("update item set item_flags = ( item_flags | %d ), item_wall = 1, owner_xchan = '%s'
|
||||
where id = %d",
|
||||
intval($flag_bits),
|
||||
dbesc($sys['xchan_hash']),
|
||||
|
@ -583,8 +583,7 @@ function identity_basic_export($channel_id, $items = false) {
|
||||
|
||||
/** @warning this may run into memory limits on smaller systems */
|
||||
|
||||
$r = q("select * from item where (item_flags & %d)>0 and not (item_restrict & %d)>0 and uid = %d",
|
||||
intval(ITEM_WALL),
|
||||
$r = q("select * from item where item_wall = 1 and (item_restrict & %d) = 0 and uid = %d",
|
||||
intval(ITEM_DELETED),
|
||||
intval($channel_id)
|
||||
);
|
||||
|
@ -385,8 +385,10 @@ function post_activity_item($arr) {
|
||||
if(! x($arr,'item_flags')) {
|
||||
if($is_comment)
|
||||
$arr['item_flags'] = ITEM_ORIGIN;
|
||||
else
|
||||
$arr['item_flags'] = ITEM_ORIGIN | ITEM_WALL | ITEM_THREAD_TOP;
|
||||
else {
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['item_flags'] = ITEM_ORIGIN | ITEM_THREAD_TOP;
|
||||
}
|
||||
}
|
||||
|
||||
$channel = get_app()->get_channel();
|
||||
@ -2016,6 +2018,7 @@ function item_store($arr, $allow_exec = false) {
|
||||
$arr['deny_gid'] = ((x($arr,'deny_gid')) ? trim($arr['deny_gid']) : '');
|
||||
$arr['item_private'] = ((x($arr,'item_private')) ? intval($arr['item_private']) : 0 );
|
||||
$arr['item_flags'] = ((x($arr,'item_flags')) ? intval($arr['item_flags']) : 0 );
|
||||
$arr['item_wall'] = ((x($arr,'item_wall')) ? intval($arr['item_wall']) : 0 );
|
||||
|
||||
// only detect language if we have text content, and if the post is private but not yet
|
||||
// obscured, make it so.
|
||||
@ -2178,8 +2181,8 @@ function item_store($arr, $allow_exec = false) {
|
||||
$public_policy = $r[0]['public_policy'];
|
||||
$comments_closed = $r[0]['comments_closed'];
|
||||
|
||||
if($r[0]['item_flags'] & ITEM_WALL)
|
||||
$arr['item_flags'] = $arr['item_flags'] | ITEM_WALL;
|
||||
if(intval($r[0]['item_wall']))
|
||||
$arr['item_wall'] = 1;
|
||||
|
||||
// An uplinked comment might arrive with a downstream owner.
|
||||
// Fix it.
|
||||
@ -2607,11 +2610,10 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id,
|
||||
|
||||
$x = array('signer' => $diaspora_handle, 'body' => $signed_body, 'signed_text' => $signed_text, 'signature' => base64_encode($authorsig));
|
||||
|
||||
$key = get_config('system','pubkey');
|
||||
$y = crypto_encapsulate(json_encode($x),$key);
|
||||
$y = json_encode($x);
|
||||
|
||||
$r = q("update item set diaspora_meta = '%s' where id = %d",
|
||||
dbesc(json_encode($y)),
|
||||
dbesc($y),
|
||||
intval($post_id)
|
||||
);
|
||||
|
||||
@ -2966,7 +2968,7 @@ function tag_deliver($uid, $item_id) {
|
||||
// prevent delivery looping - only proceed
|
||||
// if the message originated elsewhere and is a top-level post
|
||||
|
||||
if(($item['item_flags'] & ITEM_WALL)
|
||||
if((intval($item['item_wall']))
|
||||
|| ($item['item_flags'] & ITEM_ORIGIN)
|
||||
|| (!($item['item_flags'] & ITEM_THREAD_TOP))
|
||||
|| ($item['id'] != $item['parent'])) {
|
||||
@ -3106,7 +3108,8 @@ function start_delivery_chain($channel, $item, $item_id, $parent) {
|
||||
if((! $private) && $new_public_policy)
|
||||
$private = 1;
|
||||
|
||||
$flag_bits = $item['item_flags'] | ITEM_WALL;
|
||||
|
||||
$flag_bits = $item['item_flags'];
|
||||
|
||||
// The message didn't necessarily originate on this site, (we'll honour it if it did),
|
||||
// but the parent post of this thread will be reset as a local post, as it is the top of
|
||||
@ -3152,7 +3155,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent) {
|
||||
}
|
||||
|
||||
$r = q("update item set item_flags = %d, owner_xchan = '%s', allow_cid = '%s', allow_gid = '%s',
|
||||
deny_cid = '%s', deny_gid = '%s', item_private = %d, public_policy = '%s', comment_policy = '%s', title = '%s', body = '%s' where id = %d",
|
||||
deny_cid = '%s', deny_gid = '%s', item_private = %d, public_policy = '%s', comment_policy = '%s', title = '%s', body = '%s', item_wall = 1 where id = %d",
|
||||
intval($flag_bits),
|
||||
dbesc($channel['channel_hash']),
|
||||
dbesc($channel['channel_allow_cid']),
|
||||
@ -3909,7 +3912,7 @@ function item_expire($uid,$days) {
|
||||
if(! intval($expire_limit))
|
||||
$expire_limit = 5000;
|
||||
|
||||
$sql_extra = ((intval($expire_network_only)) ? " AND (item_flags & " . intval(ITEM_WALL) . ") = 0 " : "");
|
||||
$sql_extra = ((intval($expire_network_only)) ? " AND item_wall = 0 " : "");
|
||||
|
||||
$r = q("SELECT * FROM `item`
|
||||
WHERE `uid` = %d
|
||||
@ -4070,7 +4073,7 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL,$force = fal
|
||||
// We'll rely on the undocumented behaviour that DROPITEM_PHASE1 is (hopefully) only
|
||||
// set if we know we're going to send delete notifications out to others.
|
||||
|
||||
if((($item['item_flags'] & ITEM_WALL) && ($stage != DROPITEM_PHASE2)) || ($stage == DROPITEM_PHASE1))
|
||||
if((intval($item['item_wall']) && ($stage != DROPITEM_PHASE2)) || ($stage == DROPITEM_PHASE1))
|
||||
proc_run('php','include/notifier.php','drop',$notify_id);
|
||||
|
||||
goaway($a->get_baseurl() . '/' . $_SESSION['return_url']);
|
||||
@ -4178,7 +4181,7 @@ function delete_item_lowlevel($item, $stage = DROPITEM_NORMAL, $force = false) {
|
||||
|
||||
function first_post_date($uid,$wall = false) {
|
||||
|
||||
$wall_sql = (($wall) ? sprintf(" and (item_flags & %d)>0 ", ITEM_WALL) : "" );
|
||||
$wall_sql = (($wall) ? " and item_wall = 1 " : "" );
|
||||
|
||||
$r = q("select id, created from item
|
||||
where item_restrict = %d and uid = %d and id = parent $wall_sql
|
||||
@ -4386,19 +4389,17 @@ function zot_feed($uid,$observer_xchan,$arr) {
|
||||
$r = q("SELECT parent, created, postopts from item
|
||||
WHERE uid != %d
|
||||
AND item_private = 0 AND item_restrict = 0 AND uid in (" . stream_perms_api_uids(PERMS_PUBLIC,10,1) . ")
|
||||
AND (item_flags & %d) > 0
|
||||
AND item_wall = 1
|
||||
$sql_extra GROUP BY parent ORDER BY created ASC $limit",
|
||||
intval($uid),
|
||||
intval(ITEM_WALL)
|
||||
intval($uid)
|
||||
);
|
||||
}
|
||||
else {
|
||||
$r = q("SELECT parent, created, postopts from item
|
||||
WHERE uid = %d AND item_restrict = 0
|
||||
AND (item_flags & %d) > 0
|
||||
AND item_wall = 1
|
||||
$sql_extra GROUP BY parent ORDER BY created ASC $limit",
|
||||
intval($uid),
|
||||
intval(ITEM_WALL)
|
||||
intval($uid)
|
||||
);
|
||||
}
|
||||
|
||||
@ -4465,7 +4466,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
|
||||
$sql_options .= " and (item_flags & " . intval(ITEM_STARRED) . ")>0 ";
|
||||
|
||||
if($arr['wall'])
|
||||
$sql_options .= " and (item_flags & " . intval(ITEM_WALL) . ")>0 ";
|
||||
$sql_options .= " and item_wall = 1 ";
|
||||
|
||||
$sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ")>0 $sql_options ) ";
|
||||
|
||||
|
@ -228,10 +228,9 @@ function notifier_run($argv, $argc){
|
||||
|
||||
$normal_mode = false;
|
||||
$expire = true;
|
||||
$items = q("SELECT * FROM item WHERE uid = %d AND ( item_flags & %d )>0
|
||||
$items = q("SELECT * FROM item WHERE uid = %d AND item_wall = 1
|
||||
AND ( item_restrict & %d )>0 AND `changed` > %s - INTERVAL %s",
|
||||
intval($item_id),
|
||||
intval(ITEM_WALL),
|
||||
intval(ITEM_DELETED),
|
||||
db_utcnow(), db_quoteinterval('10 MINUTE')
|
||||
);
|
||||
@ -457,7 +456,7 @@ function notifier_run($argv, $argc){
|
||||
// don't send deletions onward for other people's stuff
|
||||
// TODO verify this is needed - copied logic from same place in old code
|
||||
|
||||
if(($target_item['item_restrict'] & ITEM_DELETED) && (!($target_item['item_flags'] & ITEM_WALL))) {
|
||||
if(($target_item['item_restrict'] & ITEM_DELETED) && (! intval($target_item['item_wall']))) {
|
||||
logger('notifier: ignoring delete notification for non-wall item');
|
||||
return;
|
||||
}
|
||||
|
@ -219,7 +219,7 @@ function photo_upload($channel, $observer, $args) {
|
||||
}
|
||||
}
|
||||
|
||||
$item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP;
|
||||
$item_flags = ITEM_ORIGIN|ITEM_THREAD_TOP;
|
||||
$item_restrict = (($visible) ? ITEM_VISIBLE : ITEM_HIDDEN);
|
||||
$title = '';
|
||||
$mid = item_message_id();
|
||||
@ -234,6 +234,7 @@ function photo_upload($channel, $observer, $args) {
|
||||
$arr['mid'] = $mid;
|
||||
$arr['parent_mid'] = $mid;
|
||||
$arr['item_flags'] = $item_flags;
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['item_restrict'] = $item_restrict;
|
||||
$arr['resource_type'] = 'photo';
|
||||
$arr['resource_id'] = $photo_hash;
|
||||
@ -488,7 +489,7 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) {
|
||||
|
||||
// Create item container
|
||||
|
||||
$item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP;
|
||||
$item_flags = ITEM_ORIGIN|ITEM_THREAD_TOP;
|
||||
$item_restrict = (($visible) ? ITEM_VISIBLE : ITEM_HIDDEN);
|
||||
|
||||
$mid = item_message_id();
|
||||
@ -500,6 +501,7 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) {
|
||||
$arr['mid'] = $mid;
|
||||
$arr['parent_mid'] = $mid;
|
||||
$arr['item_flags'] = $item_flags;
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['item_restrict'] = $item_restrict;
|
||||
$arr['resource_type'] = 'photo';
|
||||
$arr['resource_id'] = $photo['resource_id'];
|
||||
|
@ -23,8 +23,7 @@ function update_channels_active_halfyear_stat() {
|
||||
$s .= ',';
|
||||
$s .= intval($rr['channel_id']);
|
||||
}
|
||||
$x = q("select uid from item where uid in ( $s ) and (item_flags & %d)>0 and created > %s - INTERVAL %s group by uid",
|
||||
intval(ITEM_WALL),
|
||||
$x = q("select uid from item where uid in ( $s ) and item_wall = 1 and created > %s - INTERVAL %s group by uid",
|
||||
db_utcnow(), db_quoteinterval('6 MONTH')
|
||||
);
|
||||
if($x) {
|
||||
@ -50,8 +49,7 @@ function update_channels_active_monthly_stat() {
|
||||
$s .= ',';
|
||||
$s .= intval($rr['channel_id']);
|
||||
}
|
||||
$x = q("select uid from item where uid in ( $s ) and ( item_flags & %d )>0 and created > %s - INTERVAL %s group by uid",
|
||||
intval(ITEM_WALL),
|
||||
$x = q("select uid from item where uid in ( $s ) and item_wall = 1 and created > %s - INTERVAL %s group by uid",
|
||||
db_utcnow(), db_quoteinterval('1 MONTH')
|
||||
);
|
||||
if($x) {
|
||||
@ -66,8 +64,7 @@ function update_channels_active_monthly_stat() {
|
||||
}
|
||||
|
||||
function update_local_posts_stat() {
|
||||
$posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE (item_flags & %d)>0 ",
|
||||
intval(ITEM_WALL) );
|
||||
$posts = q("SELECT COUNT(*) AS local_posts FROM `item` WHERE item_wall = 1 ");
|
||||
if (is_array($posts)) {
|
||||
$local_posts_stat = intval($posts[0]["local_posts"]);
|
||||
set_config('system','local_posts_stat',$local_posts_stat);
|
||||
|
@ -111,8 +111,12 @@ function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $restrict = 0, $
|
||||
$sql_options = item_permissions_sql($uid);
|
||||
$count = intval($count);
|
||||
|
||||
if($flags)
|
||||
if($flags) {
|
||||
if($flags == ITEM_WALL)
|
||||
$sql_options .= " and item_wall = 1 ";
|
||||
else
|
||||
$sql_options .= " and ((item_flags & " . intval($flags) . ") = " . intval($flags) . ") ";
|
||||
}
|
||||
|
||||
if($authors) {
|
||||
if(! is_array($authors))
|
||||
|
@ -1559,12 +1559,12 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $
|
||||
// This is our own post, possibly coming from a channel clone
|
||||
|
||||
if($arr['owner_xchan'] == $d['hash']) {
|
||||
$arr['item_flags'] = $arr['item_flags'] | ITEM_WALL;
|
||||
$arr['item_wall'] = 1;
|
||||
}
|
||||
else {
|
||||
// clear the wall flag if it is set
|
||||
if($arr['item_flags'] & ITEM_WALL) {
|
||||
$arr['item_flags'] = ($arr['item_flags'] ^ ITEM_WALL);
|
||||
if(intval($arr['item_wall'])) {
|
||||
$arr['item_wall'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -662,6 +662,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||
`mimetype` char(255) NOT NULL DEFAULT '',
|
||||
`title` text NOT NULL,
|
||||
`body` mediumtext NOT NULL,
|
||||
`html` mediumtext NOT NULL,
|
||||
`app` char(255) NOT NULL DEFAULT '',
|
||||
`lang` char(64) NOT NULL DEFAULT '',
|
||||
`revision` int(10) unsigned NOT NULL DEFAULT '0',
|
||||
@ -692,6 +693,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||
`item_flags` int(11) NOT NULL DEFAULT '0',
|
||||
`item_private` tinyint(4) NOT NULL DEFAULT '0',
|
||||
`item_unseen` smallint(1) NOT NULL DEFAULT '0',
|
||||
`item_wall` smallint(1) NOT NULL DEFAULT '0',
|
||||
PRIMARY KEY (`id`),
|
||||
KEY `uid` (`uid`),
|
||||
KEY `parent` (`parent`),
|
||||
@ -722,6 +724,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||
KEY `comments_closed` (`comments_closed`),
|
||||
KEY `changed` (`changed`),
|
||||
KEY `item_unseen` (`item_unseen`),
|
||||
KEY `item_wall` (`item_wall`),
|
||||
FULLTEXT KEY `title` (`title`),
|
||||
FULLTEXT KEY `body` (`body`),
|
||||
FULLTEXT KEY `allow_cid` (`allow_cid`),
|
||||
|
@ -502,6 +502,7 @@ CREATE TABLE "item" (
|
||||
"mimetype" text NOT NULL DEFAULT '',
|
||||
"title" text NOT NULL,
|
||||
"body" text NOT NULL,
|
||||
"html" text NOT NULL,
|
||||
"app" text NOT NULL DEFAULT '',
|
||||
"lang" varchar(64) NOT NULL DEFAULT '',
|
||||
"revision" bigint NOT NULL DEFAULT '0',
|
||||
@ -532,6 +533,7 @@ CREATE TABLE "item" (
|
||||
"item_flags" bigint NOT NULL DEFAULT '0',
|
||||
"item_private" numeric(4) NOT NULL DEFAULT '0',
|
||||
"item_unseen" smallint NOT NULL DEFAULT '0',
|
||||
"item_wall" smallint NOT NULL DEFAULT '0',
|
||||
"item_search_vector" tsvector,
|
||||
PRIMARY KEY ("id")
|
||||
);
|
||||
@ -564,6 +566,7 @@ create index "item_public_policy" on item ("public_policy");
|
||||
create index "item_comment_policy" on item ("comment_policy");
|
||||
create index "item_layout_mid" on item ("layout_mid");
|
||||
create index "item_unseen" on item ("item_unseen");
|
||||
create index "item_wall" on item ("item_wall");
|
||||
|
||||
-- fulltext indexes
|
||||
create index "item_search_idx" on item USING gist("item_search_vector");
|
||||
|
@ -166,21 +166,19 @@ function channel_content(&$a, $update = 0, $load = false) {
|
||||
if(($update) && (! $load)) {
|
||||
if ($mid) {
|
||||
$r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d AND item_restrict = 0
|
||||
AND (item_flags & %d) > 0 $simple_update $sql_extra limit 1",
|
||||
AND item_wall = 1 $simple_update $sql_extra limit 1",
|
||||
dbesc($mid . '%'),
|
||||
intval($a->profile['profile_uid']),
|
||||
intval(ITEM_WALL)
|
||||
intval($a->profile['profile_uid'])
|
||||
);
|
||||
} else {
|
||||
$r = q("SELECT distinct parent AS `item_id`, created from item
|
||||
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
|
||||
WHERE uid = %d AND item_restrict = 0
|
||||
AND (item_flags & %d) > 0 $simple_update
|
||||
AND item_wall = 1 $simple_update
|
||||
AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||
$sql_extra
|
||||
ORDER BY created DESC",
|
||||
intval($a->profile['profile_uid']),
|
||||
intval(ITEM_WALL),
|
||||
intval(ABOOK_FLAG_BLOCKED)
|
||||
);
|
||||
$_SESSION['loadtime'] = datetime_convert();
|
||||
@ -210,10 +208,9 @@ function channel_content(&$a, $update = 0, $load = false) {
|
||||
if($load || ($_COOKIE['jsAvailable'] != 1)) {
|
||||
if ($mid) {
|
||||
$r = q("SELECT parent AS item_id from item where mid = '%s' and uid = %d AND item_restrict = 0
|
||||
AND (item_flags & %d)>0 $sql_extra limit 1",
|
||||
AND item_wall = 1 $sql_extra limit 1",
|
||||
dbesc($mid),
|
||||
intval($a->profile['profile_uid']),
|
||||
intval(ITEM_WALL)
|
||||
intval($a->profile['profile_uid'])
|
||||
);
|
||||
if (! $r) {
|
||||
notice( t('Permission denied.') . EOL);
|
||||
@ -223,12 +220,11 @@ function channel_content(&$a, $update = 0, $load = false) {
|
||||
$r = q("SELECT distinct id AS item_id, created FROM item
|
||||
left join abook on item.author_xchan = abook.abook_xchan
|
||||
WHERE uid = %d AND item_restrict = 0
|
||||
AND (item_flags & %d)>0 and (item_flags & %d)>0
|
||||
AND item_wall = 1 and (item_flags & %d)>0
|
||||
AND ((abook.abook_flags & %d) = 0 or abook.abook_flags is null)
|
||||
$sql_extra $sql_extra2
|
||||
ORDER BY created DESC $pager_sql ",
|
||||
intval($a->profile['profile_uid']),
|
||||
intval(ITEM_WALL),
|
||||
intval(ITEM_THREAD_TOP),
|
||||
intval(ABOOK_FLAG_BLOCKED)
|
||||
);
|
||||
@ -339,8 +335,7 @@ function channel_content(&$a, $update = 0, $load = false) {
|
||||
|
||||
if($is_owner && $update_unseen) {
|
||||
$r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1
|
||||
AND (item_flags & %d) > 0 AND uid = %d $update_unseen",
|
||||
intval(ITEM_WALL),
|
||||
AND item_wall = 1 AND uid = %d $update_unseen",
|
||||
intval(local_channel())
|
||||
);
|
||||
}
|
||||
|
@ -240,7 +240,8 @@ function connedit_post(&$a) {
|
||||
&& (intval(get_pconfig($channel['channel_id'],'system','post_newfriend')))) {
|
||||
$xarr = array();
|
||||
$xarr['verb'] = ACTIVITY_FRIEND;
|
||||
$xarr['item_flags'] = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP;
|
||||
$xarr['item_flags'] = ITEM_ORIGIN|ITEM_THREAD_TOP;
|
||||
$xarr['item_wall'] = 1;
|
||||
$xarr['owner_xchan'] = $xarr['author_xchan'] = $channel['channel_hash'];
|
||||
$xarr['allow_cid'] = $channel['channel_allow_cid'];
|
||||
$xarr['allow_gid'] = $channel['channel_allow_gid'];
|
||||
|
@ -190,7 +190,7 @@ function home_content(&$a, $update = 0, $load = false) {
|
||||
|
||||
if(get_config('system','site_firehose')) {
|
||||
require_once('include/security.php');
|
||||
$uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and (item_flags & " . intval(ITEM_WALL) . " ) > 0 ";
|
||||
$uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 ";
|
||||
}
|
||||
else {
|
||||
$sys = get_sys_channel();
|
||||
|
11
mod/item.php
11
mod/item.php
@ -295,7 +295,7 @@ function item_post(&$a) {
|
||||
// For comments, We need to additionally look at the parent and see if it's a wall post that originated locally.
|
||||
|
||||
if($observer['xchan_name'] != $owner_xchan['xchan_name']) {
|
||||
if($parent_item && ($parent_item['item_flags'] & (ITEM_WALL|ITEM_ORIGIN)) == (ITEM_WALL|ITEM_ORIGIN)) {
|
||||
if($parent_item && ($parent_item['item_flags'] & ITEM_ORIGIN) && intval($parent_item['item_wall'])) {
|
||||
$walltowall_comment = true;
|
||||
$walltowall = true;
|
||||
}
|
||||
@ -658,9 +658,10 @@ function item_post(&$a) {
|
||||
}
|
||||
|
||||
$item_unseen = 1;
|
||||
$item_wall = 0;
|
||||
|
||||
if($post_type === 'wall' || $post_type === 'wall-comment')
|
||||
$item_flags = $item_flags | ITEM_WALL;
|
||||
$item_wall = 1;
|
||||
|
||||
if($origin)
|
||||
$item_flags = $item_flags | ITEM_ORIGIN;
|
||||
@ -731,6 +732,7 @@ function item_post(&$a) {
|
||||
$datarray['deny_cid'] = $str_contact_deny;
|
||||
$datarray['deny_gid'] = $str_group_deny;
|
||||
$datarray['item_private'] = $private;
|
||||
$datarray['item_wall'] = $item_wall;
|
||||
$datarray['attach'] = $attachments;
|
||||
$datarray['thr_parent'] = $thr_parent;
|
||||
$datarray['postopts'] = $postopts;
|
||||
@ -823,7 +825,7 @@ function item_post(&$a) {
|
||||
// only send comment notification if this is a wall-to-wall comment,
|
||||
// otherwise it will happen during delivery
|
||||
|
||||
if(($datarray['owner_xchan'] != $datarray['author_xchan']) && ($parent_item['item_flags'] & ITEM_WALL)) {
|
||||
if(($datarray['owner_xchan'] != $datarray['author_xchan']) && intval($parent_item['item_wall'])) {
|
||||
notification(array(
|
||||
'type' => NOTIFY_COMMENT,
|
||||
'from_xchan' => $datarray['author_xchan'],
|
||||
@ -1085,8 +1087,7 @@ function item_check_service_class($channel_id,$iswebpage) {
|
||||
);
|
||||
}
|
||||
else {
|
||||
$r = q("select count(id) as total from item where parent = id and item_restrict = 0 and (item_flags & %d) > 0 and uid = %d ",
|
||||
intval(ITEM_WALL),
|
||||
$r = q("select count(id) as total from item where parent = id and item_restrict = 0 and item_wall = 1 and uid = %d ",
|
||||
intval($channel_id)
|
||||
);
|
||||
}
|
||||
|
10
mod/like.php
10
mod/like.php
@ -337,10 +337,11 @@ function like_content(&$a) {
|
||||
}
|
||||
|
||||
$mid = item_message_id();
|
||||
$item_wall = 0;
|
||||
|
||||
if($extended_like) {
|
||||
$item_flags = ITEM_THREAD_TOP|ITEM_ORIGIN|ITEM_WALL;
|
||||
|
||||
$item_flags = ITEM_THREAD_TOP|ITEM_ORIGIN;
|
||||
$item_wall = 1;
|
||||
}
|
||||
else {
|
||||
$post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status'));
|
||||
@ -376,8 +377,8 @@ function like_content(&$a) {
|
||||
$post_type = 'comment';
|
||||
|
||||
$item_flags = ITEM_ORIGIN | ITEM_NOTSHOWN;
|
||||
if($item['item_flags'] & ITEM_WALL)
|
||||
$item_flags |= ITEM_WALL;
|
||||
if(intval($item['item_wall']))
|
||||
$item_wall = 1;
|
||||
|
||||
// if this was a linked photo and was hidden, unhide it.
|
||||
|
||||
@ -437,6 +438,7 @@ function like_content(&$a) {
|
||||
$arr['aid'] = (($extended_like) ? $ch[0]['channel_account_id'] : $owner_aid);
|
||||
$arr['uid'] = $owner_uid;
|
||||
$arr['item_flags'] = $item_flags;
|
||||
$arr['item_wall'] = $item_wall;
|
||||
$arr['parent_mid'] = (($extended_like) ? $mid : $item['mid']);
|
||||
$arr['owner_xchan'] = (($extended_like) ? $ch[0]['xchan_hash'] : $thread_owner['xchan_hash']);
|
||||
$arr['author_xchan'] = $observer['xchan_hash'];
|
||||
|
@ -56,14 +56,14 @@ function manage_content(&$a) {
|
||||
$channels[$x]['default_links'] = '1';
|
||||
|
||||
|
||||
$c = q("SELECT id, item_restrict, item_flags FROM item
|
||||
$c = q("SELECT id, item_restrict, item_flags, item_wall FROM item
|
||||
WHERE item_restrict = 0 and item_unseen = 1 and uid = %d",
|
||||
intval($channels[$x]['channel_id'])
|
||||
);
|
||||
|
||||
if($c) {
|
||||
foreach ($c as $it) {
|
||||
if($it['item_flags'] & ITEM_WALL)
|
||||
if(intval($it['item_wall']))
|
||||
$channels[$x]['home'] ++;
|
||||
else
|
||||
$channels[$x]['network'] ++;
|
||||
|
@ -61,7 +61,7 @@ function mood_init(&$a) {
|
||||
$mid = item_message_id();
|
||||
|
||||
$action = sprintf( t('%1$s is %2$s','mood'), '[zrl=' . $poster['xchan_url'] . ']' . $poster['xchan_name'] . '[/zrl]' , $verbs[$verb]);
|
||||
$item_flags = ITEM_WALL|ITEM_ORIGIN;
|
||||
$item_flags = ITEM_ORIGIN;
|
||||
if(! $parent_mid)
|
||||
$item_flags |= ITEM_THREAD_TOP;
|
||||
|
||||
@ -72,6 +72,7 @@ function mood_init(&$a) {
|
||||
$arr['mid'] = $mid;
|
||||
$arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid);
|
||||
$arr['item_flags'] = $item_flags;
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['author_xchan'] = $poster['xchan_hash'];
|
||||
$arr['owner_xchan'] = (($parent_mid) ? $r[0]['owner_xchan'] : $poster['xchan_hash']);
|
||||
$arr['title'] = '';
|
||||
|
@ -11,9 +11,8 @@ function p_init(&$a) {
|
||||
|
||||
$mid = str_replace('.xml','',argv(1));
|
||||
|
||||
$r = q("select * from item where mid = '%s' and (item_flags & %d)>0 and item_private = 0 limit 1",
|
||||
dbesc($mid),
|
||||
intval(ITEM_WALL)
|
||||
$r = q("select * from item where mid = '%s' and item_wall = 1 and item_private = 0 limit 1",
|
||||
dbesc($mid)
|
||||
);
|
||||
|
||||
|
||||
|
@ -156,8 +156,7 @@ function ping_init(&$a) {
|
||||
);
|
||||
break;
|
||||
case 'home':
|
||||
$r = q("update item set item_unseen = 0 where item_unseen = 1 and (item_flags & %d) > 0 and uid = %d",
|
||||
intval(ITEM_WALL),
|
||||
$r = q("update item set item_unseen = 0 where item_unseen = 1 and item_wall = 1 and uid = %d",
|
||||
intval(local_channel())
|
||||
);
|
||||
break;
|
||||
@ -282,7 +281,7 @@ function ping_init(&$a) {
|
||||
if($r) {
|
||||
xchan_query($r);
|
||||
foreach($r as $item) {
|
||||
if((argv(1) === 'home') && (! ($item['item_flags'] & ITEM_WALL)))
|
||||
if((argv(1) === 'home') && (! intval($item['item_wall'])))
|
||||
continue;
|
||||
$result[] = format_notification($item);
|
||||
}
|
||||
@ -390,7 +389,7 @@ function ping_init(&$a) {
|
||||
call_hooks('network_ping', $arr);
|
||||
|
||||
foreach ($r as $it) {
|
||||
if($it['item_flags'] & ITEM_WALL)
|
||||
if(intval($it['item_wall']))
|
||||
$result['home'] ++;
|
||||
else
|
||||
$result['network'] ++;
|
||||
|
@ -87,10 +87,11 @@ function poke_init(&$a) {
|
||||
|
||||
|
||||
$arr = array();
|
||||
$arr['item_flags'] = ITEM_WALL | ITEM_ORIGIN;
|
||||
$arr['item_flags'] = ITEM_ORIGIN;
|
||||
if($parent_item)
|
||||
$arr['item_flags'] |= ITEM_THREAD_TOP;
|
||||
|
||||
$arr['item_wall'] = 1;
|
||||
$arr['owner_xchan'] = (($parent_item) ? $parent_item['owner_xchan'] : $channel['channel_hash']);
|
||||
$arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid);
|
||||
$arr['title'] = '';
|
||||
|
@ -103,9 +103,6 @@ function subthread_content(&$a) {
|
||||
$bodyverb = t('%1$s is following %2$s\'s %3$s');
|
||||
|
||||
$item_flags = ITEM_ORIGIN | ITEM_NOTSHOWN;
|
||||
if($item['item_flags'] & ITEM_WALL)
|
||||
$item_flags |= ITEM_WALL;
|
||||
|
||||
|
||||
$arr = array();
|
||||
|
||||
@ -113,6 +110,7 @@ function subthread_content(&$a) {
|
||||
$arr['aid'] = $owner_aid;
|
||||
$arr['uid'] = $owner_uid;
|
||||
$arr['item_flags'] = $item_flags;
|
||||
$arr['item_wall'] = $item['item_wall'];
|
||||
$arr['parent'] = $item['id'];
|
||||
$arr['parent_mid'] = $item['mid'];
|
||||
$arr['thr_parent'] = $item['mid'];
|
||||
|
@ -109,8 +109,7 @@ function tagger_content(&$a) {
|
||||
|
||||
|
||||
$arr['item_flags'] = ITEM_ORIGIN;
|
||||
if($item['item_flags'] & ITEM_WALL)
|
||||
$arr['item_flags'] |= ITEM_WALL;
|
||||
$arr['item_wall'] = $item['item_wall'];
|
||||
|
||||
$ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
|
||||
$alink = '[zrl=' . $item['xchan_url'] . ']' . $item['xchan_name'] . '[/zrl]';
|
||||
|
@ -177,7 +177,8 @@ function thing_init(&$a) {
|
||||
$arr['owner_xchan'] = $channel['channel_hash'];
|
||||
$arr['author_xchan'] = $channel['channel_hash'];
|
||||
|
||||
$arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL|ITEM_THREAD_TOP;
|
||||
$arr['item_flags'] = ITEM_ORIGIN|ITEM_THREAD_TOP;
|
||||
$arr['item_wall'] = 1;
|
||||
|
||||
$ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]';
|
||||
$plink = '[zrl=' . $term['url'] . ']' . $term['term'] . '[/zrl]';
|
||||
|
Reference in New Issue
Block a user