aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xboot.php22
-rw-r--r--include/ConversationObject.php2
-rw-r--r--include/ItemObject.php14
-rw-r--r--include/api.php17
-rw-r--r--include/conversation.php2
-rwxr-xr-xinclude/diaspora.php4
-rw-r--r--include/enotify.php2
-rw-r--r--include/identity.php3
-rwxr-xr-xinclude/items.php104
-rw-r--r--include/notifier.php9
-rw-r--r--include/notify.php7
-rw-r--r--include/statistics_fns.php9
-rw-r--r--include/taxonomy.php6
-rw-r--r--include/widgets.php4
-rw-r--r--include/zot.php7
-rw-r--r--mod/channel.php25
-rw-r--r--mod/display.php5
-rwxr-xr-xmod/events.php2
-rw-r--r--mod/home.php2
-rw-r--r--mod/item.php2
-rwxr-xr-xmod/like.php6
-rw-r--r--mod/manage.php7
-rw-r--r--mod/network.php16
-rw-r--r--mod/p.php5
-rw-r--r--mod/photos.php6
-rw-r--r--mod/ping.php22
-rw-r--r--mod/starred.php8
-rwxr-xr-xmod/subthread.php3
28 files changed, 129 insertions, 192 deletions
diff --git a/boot.php b/boot.php
index b3bed8592..9544f70af 100755
--- a/boot.php
+++ b/boot.php
@@ -537,17 +537,17 @@ define ( 'ITEM_PENDING_REMOVE', 0x0800); // deleted, notification period has
*/
//define ( 'ITEM_ORIGIN', 0x0001);
-define ( 'ITEM_UNSEEN', 0x0002);
-define ( 'ITEM_STARRED', 0x0004);
-define ( 'ITEM_UPLINK', 0x0008);
-define ( 'ITEM_CONSENSUS', 0x0010); // an item which may present agree/disagree/abstain options
-define ( 'ITEM_WALL', 0x0020);
-define ( 'ITEM_THREAD_TOP', 0x0040);
-define ( 'ITEM_NOTSHOWN', 0x0080); // technically visible but not normally shown (e.g. like/dislike)
-define ( 'ITEM_NSFW', 0x0100);
-define ( 'ITEM_RELAY', 0x0200); // used only in the communication layers, not stored
-define ( 'ITEM_MENTIONSME', 0x0400);
-define ( 'ITEM_NOCOMMENT', 0x0800); // commenting/followups are disabled
+//define ( 'ITEM_UNSEEN', 0x0002);
+//define ( 'ITEM_STARRED', 0x0004);
+//define ( 'ITEM_UPLINK', 0x0008);
+//define ( 'ITEM_CONSENSUS', 0x0010); // an item which may present agree/disagree/abstain options
+//define ( 'ITEM_WALL', 0x0020);
+//define ( 'ITEM_THREAD_TOP', 0x0040);
+//define ( 'ITEM_NOTSHOWN', 0x0080); // technically visible but not normally shown (e.g. like/dislike)
+//define ( 'ITEM_NSFW', 0x0100);
+//define ( 'ITEM_RELAY', 0x0200); // used only in the communication layers, not stored
+//define ( 'ITEM_MENTIONSME', 0x0400);
+//define ( 'ITEM_NOCOMMENT', 0x0800); // commenting/followups are disabled
define ( 'ITEM_OBSCURED', 0x1000); // bit-mangled to protect from casual browsing by site admin
define ( 'ITEM_VERIFIED', 0x2000); // Signature verification was successful
define ( 'ITEM_RETAINED', 0x4000); // We looked at this item once to decide whether or not to expire it, and decided not to.
diff --git a/include/ConversationObject.php b/include/ConversationObject.php
index 7dc4c8c19..ada642482 100644
--- a/include/ConversationObject.php
+++ b/include/ConversationObject.php
@@ -166,7 +166,7 @@ class Conversation extends BaseObject {
if(($item->get_data_value('author_xchan') === $ob_hash) || ($item->get_data_value('owner_xchan') === $ob_hash))
$item->set_commentable(true);
- if($item->get_data_value('item_flags') & ITEM_NOCOMMENT) {
+ if(intval($item->get_data_value('item_nocomment'))) {
$item->set_commentable(false);
}
elseif(($this->observer) && (! $item->is_commentable())) {
diff --git a/include/ItemObject.php b/include/ItemObject.php
index 82a321732..0bb125312 100644
--- a/include/ItemObject.php
+++ b/include/ItemObject.php
@@ -179,9 +179,9 @@ class Item extends BaseObject {
'do' => t("Add Star"),
'undo' => t("Remove Star"),
'toggle' => t("Toggle Star Status"),
- 'classdo' => (($item['item_flags'] & ITEM_STARRED) ? "hidden" : ""),
- 'classundo' => (($item['item_flags'] & ITEM_STARRED) ? "" : "hidden"),
- 'isstarred' => (($item['item_flags'] & ITEM_STARRED) ? "starred icon-star" : "unstarred icon-star-empty"),
+ 'classdo' => (intval($item['item_starred']) ? "hidden" : ""),
+ 'classundo' => (intval($item['item_starred']) ? "" : "hidden"),
+ 'isstarred' => (intval($item['item_starred']) ? "starred icon-star" : "unstarred icon-star-empty"),
'starred' => t('starred'),
);
@@ -191,9 +191,9 @@ class Item extends BaseObject {
}
- $verified = (($item['item_flags'] & ITEM_VERIFIED) ? t('Message signature validated') : '');
- $forged = ((($item['sig']) && (! ($item['item_flags'] & ITEM_VERIFIED))) ? t('Message signature incorrect') : '');
- $unverified = '' ; // (($this->is_wall_to_wall() && (! ($item['item_flags'] & ITEM_VERIFIED))) ? t('Message cannot be verified') : '');
+ $verified = (intval($item['item_verified']) ? t('Message signature validated') : '');
+ $forged = ((($item['sig']) && (! intval($item['item_verified']))) ? t('Message signature incorrect') : '');
+ $unverified = '' ; // (($this->is_wall_to_wall() && (! intval($item['item_verified']))) ? t('Message cannot be verified') : '');
@@ -569,7 +569,7 @@ class Item extends BaseObject {
if((! visible_activity($child->data)) || array_key_exists('author_blocked',$child->data)) {
continue;
}
- if($child->data['item_flags'] & ITEM_UNSEEN)
+ if($child->data['item_unseen'])
$total ++;
}
}
diff --git a/include/api.php b/include/api.php
index 51de412cf..579ae626f 100644
--- a/include/api.php
+++ b/include/api.php
@@ -336,10 +336,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'];
}
@@ -363,9 +362,8 @@ require_once('include/items.php');
$countfollowers = $r[0]['count'];
}
- $r = q("SELECT count(`id`) as `count` FROM item where ( item_flags & %d )>0 and uid = %d and item_restrict = 0",
- intval($uinfo[0]['channel_id']),
- intval(ITEM_STARRED)
+ $r = q("SELECT count(`id`) as `count` FROM item where item_starred = 1 and uid = %d and item_restrict = 0",
+ intval($uinfo[0]['channel_id'])
);
$starred = $r[0]['count'];
@@ -1004,10 +1002,7 @@ require_once('include/items.php');
// at the network timeline just mark everything seen.
if (api_user() == $user_info['uid']) {
- $r = q("UPDATE `item` SET item_flags = ( item_flags & ~%d )
- WHERE (item_flags & %d)>0 and uid = %d",
- intval(ITEM_UNSEEN),
- intval(ITEM_UNSEEN),
+ $r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 and uid = %d",
intval($user_info['uid'])
);
}
@@ -1615,7 +1610,7 @@ require_once('include/items.php');
'in_reply_to_user_id' => $in_reply_to_user_id,
'in_reply_to_screen_name' => $in_reply_to_screen_name,
'geo' => '',
- 'favorited' => (($item['item_flags'] & ITEM_STARRED) ? true : false),
+ 'favorited' => (intval($item['item_starred']) ? true : false),
'user' => $status_user ,
'statusnet_html' => trim(prepare_text($item['body'],$item['mimetype'])),
diff --git a/include/conversation.php b/include/conversation.php
index 25c844fef..e81bb49e0 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -96,7 +96,7 @@ function localize_item(&$item){
if(! $item['object'])
return;
- if($item['item_flags'] & ITEM_THREAD_TOP)
+ if(intval($item['item_thread_top']))
return;
$obj = json_decode_plus($item['object']);
diff --git a/include/diaspora.php b/include/diaspora.php
index ae405f663..4e7b968e7 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -893,8 +893,8 @@ function diaspora_post($importer,$xml,$msg) {
$datarray['app'] = $app;
- $datarray['item_flags'] = ITEM_UNSEEN|ITEM_THREAD_TOP;
-
+ $datarray['item_unseen'] = 1;
+ $datarray['item_thread_top'] = 1;
$result = item_store($datarray);
return;
diff --git a/include/enotify.php b/include/enotify.php
index 6fc771c58..53f1ae5ef 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -157,7 +157,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]',
diff --git a/include/identity.php b/include/identity.php
index e196cb247..ce29e71f0 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -589,8 +589,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 not (item_restrict & %d)>0 and uid = %d",
intval(ITEM_DELETED),
intval($channel_id)
);
diff --git a/include/items.php b/include/items.php
index b2fc05f09..2478d773c 100755
--- a/include/items.php
+++ b/include/items.php
@@ -430,7 +430,7 @@ function post_activity_item($arr) {
$arr['comment_policy'] = map_scope($channel['channel_w_comment']);
- if ((! $arr['plink']) && ($arr['item_flags'] & ITEM_THREAD_TOP)) {
+ if ((! $arr['plink']) && (intval($arr['item_thread_top']))) {
$arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid'];
}
@@ -835,11 +835,8 @@ function get_item_elements($x) {
$arr['item_flags'] = 0;
-
if(array_key_exists('flags',$x) && in_array('consensus',$x['flags']))
- $arr['item_flags'] |= ITEM_CONSENSUS;
-
-
+ $arr['item_consensus'] = 1;
if(array_key_exists('flags',$x) && in_array('deleted',$x['flags']))
$arr['item_restrict'] = ITEM_DELETED;
@@ -1135,7 +1132,7 @@ function encode_item($item,$mirror = false) {
$x['public_scope'] = $scope;
- if($item['item_flags'] & ITEM_NOCOMMENT)
+ if($item['item_nocomment'])
$x['comment_scope'] = 'none';
else
$x['comment_scope'] = $c_scope;
@@ -1317,11 +1314,11 @@ function encode_item_flags($item) {
$ret[] = 'deleted';
if($item['item_restrict'] & ITEM_HIDDEN)
$ret[] = 'hidden';
- if($item['item_flags'] & ITEM_THREAD_TOP)
+ if(intval($item['item_thread_top']))
$ret[] = 'thread_parent';
- if($item['item_flags'] & ITEM_NSFW)
+ if(intval($item['item_nsfw']))
$ret[] = 'nsfw';
- if($item['item_flags'] & ITEM_CONSENSUS)
+ if(intval($item['item_consensus']))
$ret[] = 'consensus';
if($item['item_private'])
$ret[] = 'private';
@@ -2042,12 +2039,11 @@ function item_store($arr,$allow_exec = false) {
$arr['comment_policy'] = ((x($arr,'comment_policy')) ? notags(trim($arr['comment_policy'])) : 'contacts' );
- $arr['item_flags'] = $arr['item_flags'] | ITEM_UNSEEN;
-
- if($arr['comment_policy'] == 'none')
- $arr['item_flags'] = $arr['item_flags'] | ITEM_NOCOMMENT;
-
+ if(! array_key_exists('item_unseen',$arr))
+ $arr['item_unseen'] = 1;
+ if((! array_key_exists('item_nocomment',$arr)) && ($arr['comment_policy'] == 'none'))
+ $arr['item_nocomment'] = 1;
// handle time travelers
// Allow a bit of fudge in case somebody just has a slightly slow/fast clock
@@ -2073,7 +2069,7 @@ function item_store($arr,$allow_exec = false) {
$deny_gid = $arr['deny_gid'];
$public_policy = $arr['public_policy'];
$comments_closed = $arr['comments_closed'];
- $arr['item_flags'] = $arr['item_flags'] | ITEM_THREAD_TOP;
+ $arr['item_thread_top'] = 1;
}
else {
@@ -2121,8 +2117,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.
@@ -2142,7 +2138,7 @@ function item_store($arr,$allow_exec = false) {
// The original author commented, but as this is a comment, the permissions
// weren't fixed up so it will still show the comment as private unless we fix it here.
- if((intval($r[0]['item_flags']) & ITEM_UPLINK) && (! $r[0]['item_private']))
+ if(intval($r[0]['item_uplink']) && (! $r[0]['item_private']))
$arr['item_private'] = 0;
}
else {
@@ -2337,15 +2333,7 @@ function item_store_update($arr,$allow_exec = false) {
// override the unseen flag with the original
- if($arr['item_flags'] & ITEM_UNSEEN)
- $arr['item_flags'] = $arr['item_flags'] ^ ITEM_UNSEEN;
-
- if($orig[0]['item_flags'] & ITEM_VERIFIED)
- $orig[0]['item_flags'] = $orig[0]['item_flags'] ^ ITEM_VERIFIED;
-
- if($orig[0]['item_flags'] & ITEM_OBSCURED)
- $orig[0]['item_flags'] = $orig[0]['item_flags'] ^ ITEM_OBSCURED;
-
+ $arr['item_unseen'] = $orig[0]['item_unseen'];
$arr['item_flags'] = intval($arr['item_flags']) | $orig[0]['item_flags'];
$arr['item_restrict'] = intval($arr['item_restrict']) | $orig[0]['item_restrict'];
@@ -2371,7 +2359,7 @@ function item_store_update($arr,$allow_exec = false) {
$channel = get_app()->get_channel();
if($channel['channel_hash'] === $arr['author_xchan']) {
$arr['sig'] = base64url_encode(rsa_sign($arr['body'],$channel['channel_prvkey']));
- $arr['item_flags'] |= ITEM_VERIFIED;
+ $arr['item_verified'] = 1;
}
}
@@ -2701,8 +2689,8 @@ function tag_deliver($uid,$item_id) {
$item = $i[0];
- if(($item['source_xchan']) && ($item['item_flags'] & ITEM_UPLINK)
- && ($item['item_flags'] & ITEM_THREAD_TOP) && ($item['edited'] != $item['created'])) {
+ if(($item['source_xchan']) && intval($item['item_uplink'])
+ && intval($item['item_thread_top']) && ($item['edited'] != $item['created'])) {
// this is an update (edit) to a post which was already processed by us and has a second delivery chain
// Just start the second delivery chain to deliver the updated post
proc_run('php','include/notifier.php','tgroup',$item['id']);
@@ -2800,13 +2788,13 @@ function tag_deliver($uid,$item_id) {
// This might be a followup (e.g. comment) by the original post author to a tagged forum
// If so setup a second delivery chain
- if( ! ($item['item_flags'] & ITEM_THREAD_TOP)) {
+ if( ! intval($item['item_thread_top'])) {
$x = q("select * from item where id = parent and parent = %d and uid = %d limit 1",
intval($item['parent']),
intval($uid)
);
- if(($x) && ($x[0]['item_flags'] & ITEM_UPLINK)) {
+ if(($x) && intval($x[0]['item_uplink'])) {
start_delivery_chain($u[0],$item,$item_id,$x[0]);
}
}
@@ -2836,8 +2824,7 @@ function tag_deliver($uid,$item_id) {
if($mention) {
logger('tag_deliver: mention found for ' . $u[0]['channel_name']);
- $r = q("update item set item_flags = ( item_flags | %d ) where id = %d",
- intval(ITEM_MENTIONSME),
+ $r = q("update item set item_mentionsme = 1 where id = %d",
intval($item_id)
);
@@ -2948,10 +2935,9 @@ function tgroup_check($uid,$item) {
// or is a followup and we have already accepted the top level post as an uplink
if($item['mid'] != $item['parent_mid']) {
- $r = q("select id from item where mid = '%s' and uid = %d and ( item_flags & %d )>0 limit 1",
+ $r = q("select id from item where mid = '%s' and uid = %d and item_uplink = 1 limit 1",
dbesc($item['parent_mid']),
- intval($uid),
- intval(ITEM_UPLINK)
+ intval($uid)
);
if($r)
return true;
@@ -3037,14 +3023,11 @@ function start_delivery_chain($channel,$item,$item_id,$parent) {
$item_wall = 1;
$item_origin = 1;
+ $item_uplink = 0;
+ $item_nocomment = 0;
$flag_bits = $item['item_flags'];
- // unset the nocomment bit if it's there.
-
- if($flag_bits & ITEM_NOCOMMENT)
- $flag_bits = $flag_bits ^ ITEM_NOCOMMENT;
-
// maintain the original source, which will be the original item owner and was stored in source_xchan
// when we created the delivery fork
@@ -3055,7 +3038,7 @@ function start_delivery_chain($channel,$item,$item_id,$parent) {
);
}
else {
- $flag_bits = $flag_bits | ITEM_UPLINK;
+ $item_uplink = 1;
$r = q("update item set source_xchan = owner_xchan where id = %d",
intval($item_id)
);
@@ -3085,8 +3068,10 @@ 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',
+ $r = q("update item set item_uplink = %d, item_nocomment = %d, 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', item_wall = %d, item_origin = %d where id = %d",
+ intval($item_uplink),
+ intval($item_nocomment),
intval($flag_bits),
dbesc($channel['channel_hash']),
dbesc($channel['channel_allow_cid']),
@@ -3868,7 +3853,7 @@ function item_expire($uid,$days) {
$expire_network_only = 1;
- $sql_extra = ((intval($expire_network_only)) ? " AND not (item_flags & " . intval(ITEM_WALL) . ")>0 " : "");
+ $sql_extra = ((intval($expire_network_only)) ? " AND item_wall = 0 " : "");
$r = q("SELECT * FROM `item`
WHERE `uid` = %d
@@ -3903,7 +3888,7 @@ function item_expire($uid,$days) {
retain_item($item['id']);
continue;
}
- if($item['item_flags'] & ITEM_STARRED) {
+ if(intval($item['item_starred'])) {
retain_item($item['id']);
continue;
}
@@ -4027,7 +4012,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']);
@@ -4132,7 +4117,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
@@ -4331,19 +4316,17 @@ function zot_feed($uid,$observer_xchan,$arr) {
$r = q("SELECT distinct parent, created from item
WHERE uid != %d
and uid in (" . stream_perms_api_uids(PERMS_PUBLIC) . ") AND item_restrict = 0
- AND (item_flags & %d)>0
+ AND item_wall = 1
and item_private = 0 $sql_extra ORDER BY created ASC $limit",
- intval($uid),
- intval(ITEM_WALL)
+ intval($uid)
);
}
else {
$r = q("SELECT distinct parent, created from item
WHERE uid = %d AND item_restrict = 0
- AND (item_flags & %d)>0
+ AND item_wall = 1
$sql_extra ORDER BY created ASC $limit",
- intval($uid),
- intval(ITEM_WALL)
+ intval($uid)
);
}
@@ -4403,12 +4386,12 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
if($arr['star'])
- $sql_options .= " and (item_flags & " . intval(ITEM_STARRED) . ")>0 ";
+ $sql_options .= " and item_starred = 1 ";
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 ) ";
+ $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options ) ";
if($arr['since_id'])
$sql_extra .= " and item.id > " . $since_id . " ";
@@ -4486,9 +4469,8 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
if($arr['conv'] && $channel) {
- $sql_extra .= sprintf(" AND parent IN (SELECT distinct parent from item where ( author_xchan like '%s' or ( item_flags & %d )>0)) ",
- dbesc(protect_sprintf($uidhash)),
- intval(ITEM_MENTIONSME)
+ $sql_extra .= sprintf(" AND parent IN (SELECT distinct parent from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ",
+ dbesc(protect_sprintf($uidhash))
);
}
@@ -4528,7 +4510,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
}
- $simple_update = (($client_mode & CLIENT_MODE_UPDATE) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " )>0 " : '');
+ $simple_update = (($client_mode & CLIENT_MODE_UPDATE) ? " and item.item_unseen = 1 " : '');
if($client_mode & CLIENT_MODE_LOAD)
$simple_update = '';
diff --git a/include/notifier.php b/include/notifier.php
index 241dffbd1..092b27498 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -206,10 +206,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')
);
@@ -374,7 +373,7 @@ function notifier_run($argv, $argc){
// tag_deliver'd post which needs to be sent back to the original author
- if(($cmd === 'uplink') && ($parent_item['item_flags'] & ITEM_UPLINK) && (! $top_level_post)) {
+ if(($cmd === 'uplink') && intval($parent_item['item_uplink']) && (! $top_level_post)) {
logger('notifier: uplink');
$uplink = true;
}
@@ -395,7 +394,7 @@ function notifier_run($argv, $argc){
// if our parent is a tag_delivery recipient, uplink to the original author causing
// a delivery fork.
- if(($parent_item['item_flags'] & ITEM_UPLINK) && (! $top_level_post) && ($cmd !== 'uplink')) {
+ if(intval($parent_item['item_uplink']) && (! $top_level_post) && ($cmd !== 'uplink')) {
logger('notifier: uplinking this item');
proc_run('php','include/notifier.php','uplink',$item_id);
}
@@ -408,7 +407,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;
}
diff --git a/include/notify.php b/include/notify.php
index aa96fa279..987ca8c0f 100644
--- a/include/notify.php
+++ b/include/notify.php
@@ -5,9 +5,6 @@ function format_notification($item) {
$ret = '';
-// return array();
-
-
require_once('include/conversation.php');
// Call localize_item with the "brief" flag to get a one line status for activities.
@@ -19,7 +16,7 @@ function format_notification($item) {
$itemem_text = $item['localize'];
}
else {
- $itemem_text = (($item['item_flags'] & ITEM_THREAD_TOP)
+ $itemem_text = (($item['item_thread_top'])
? t('created a new post')
: sprintf( t('commented on %s\'s post'), $item['owner']['xchan_name']));
}
@@ -32,7 +29,7 @@ function format_notification($item) {
'url' => $item['author']['xchan_url'],
'photo' => $item['author']['xchan_photo_s'],
'when' => relative_date($item['created']),
- 'class' => (($item['item_flags'] & ITEM_UNSEEN) ? 'notify-unseen' : 'notify-seen'),
+ 'class' => (($item['item_unseen']) ? 'notify-unseen' : 'notify-seen'),
'message' => strip_tags(bbcode($itemem_text))
);
diff --git a/include/statistics_fns.php b/include/statistics_fns.php
index 288925a2c..ce2eee5e7 100644
--- a/include/statistics_fns.php
+++ b/include/statistics_fns.php
@@ -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);
diff --git a/include/taxonomy.php b/include/taxonomy.php
index be80008df..a5ccada62 100644
--- a/include/taxonomy.php
+++ b/include/taxonomy.php
@@ -101,8 +101,10 @@ function tagadelic($uid, $count = 0, $authors = '', $flags = 0, $restrict = 0, $
$sql_options = '';
$count = intval($count);
- if($flags)
- $sql_options .= " and ((item_flags & " . intval($flags) . ") = " . intval($flags) . ") ";
+ if($flags) {
+ if($flags === 'wall')
+ $sql_options .= " and item_wall = 1 ";
+ }
if($authors) {
if(! is_array($authors))
diff --git a/include/widgets.php b/include/widgets.php
index 9f9268055..d4888789f 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -391,7 +391,7 @@ function widget_tagcloud_wall($arr) {
$limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50);
if(feature_enabled($a->profile['profile_uid'], 'tagadelic'))
- return wtagblock($a->profile['profile_uid'], $limit, $a->profile['channel_hash'], ITEM_WALL);
+ return wtagblock($a->profile['profile_uid'], $limit, $a->profile['channel_hash'], 'wall');
return '';
}
@@ -406,7 +406,7 @@ function widget_catcloud_wall($arr) {
$limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50);
- return catblock($a->profile['profile_uid'], $limit, $a->profile['channel_hash'], ITEM_WALL);
+ return catblock($a->profile['profile_uid'], $limit, $a->profile['channel_hash'], 'wall');
}
diff --git a/include/zot.php b/include/zot.php
index 435592b6a..07d228ea5 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1436,13 +1436,10 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
// 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);
- }
+ $arr['item_wall'] = 0;
}
if((! perm_is_allowed($channel['channel_id'],$sender['hash'],$perm)) && (! $tag_delivery) && (! $local_public)) {
diff --git a/mod/channel.php b/mod/channel.php
index c8ac83baf..84b302cce 100644
--- a/mod/channel.php
+++ b/mod/channel.php
@@ -147,23 +147,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 = '%s' and uid = %d AND item_restrict = 0
- AND (item_flags & %d) > 0 AND (item_flags & %d) > 0 $sql_extra limit 1",
+ AND item_wall = 1 AND item_unseen = 1 $sql_extra limit 1",
dbesc($mid),
- intval($a->profile['profile_uid']),
- intval(ITEM_WALL),
- intval(ITEM_UNSEEN)
+ intval($a->profile['profile_uid'])
);
} else {
$r = q("SELECT distinct parent 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_unseen = 1
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(ITEM_UNSEEN),
intval(ABOOK_FLAG_BLOCKED)
);
}
@@ -192,10 +188,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);
@@ -205,13 +200,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_thread_top = 1
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)
);
}
@@ -317,11 +310,7 @@ function channel_content(&$a, $update = 0, $load = false) {
}
if($is_owner && $update_unseen) {
- $r = q("UPDATE item SET item_flags = (item_flags & ~%d)
- WHERE (item_flags & %d) > 0 AND (item_flags & %d) > 0 AND uid = %d $update_unseen",
- intval(ITEM_UNSEEN),
- intval(ITEM_UNSEEN),
- intval(ITEM_WALL),
+ $r = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 and item_wall = 1 AND uid = %d $update_unseen",
intval(local_user())
);
}
diff --git a/mod/display.php b/mod/display.php
index f14aca6da..b9b660fdd 100644
--- a/mod/display.php
+++ b/mod/display.php
@@ -231,10 +231,7 @@ function display_content(&$a, $update = 0, $load = false) {
}
if($updateable) {
- $x = q("UPDATE item SET item_flags = ( item_flags & ~%d )
- WHERE (item_flags & %d)>0 AND uid = %d and parent = %d ",
- intval(ITEM_UNSEEN),
- intval(ITEM_UNSEEN),
+ $x = q("UPDATE item SET item_unseen = 0 where item_unseen = 1 AND uid = %d and parent = %d ",
intval(local_user()),
intval($r[0]['parent'])
);
diff --git a/mod/events.php b/mod/events.php
index 28a816ea4..14ff03468 100755
--- a/mod/events.php
+++ b/mod/events.php
@@ -392,7 +392,7 @@ function events_content(&$a) {
$last_date = $d;
// FIXME
- $edit = (($rr['item_flags'] & ITEM_WALL) ? array($a->get_baseurl().'/events/event/'.$rr['event_hash'],t('Edit event'),'','') : null);
+ $edit = (intval($rr['item_wall']) ? array($a->get_baseurl().'/events/event/'.$rr['event_hash'],t('Edit event'),'','') : null);
$title = strip_tags(html_entity_decode(bbcode($rr['summary']),ENT_QUOTES,'UTF-8'));
if(! $title) {
list($title, $_trash) = explode("<br",bbcode($rr['desc']),2);
diff --git a/mod/home.php b/mod/home.php
index 2e57a2ab9..648a8ff4f 100644
--- a/mod/home.php
+++ b/mod/home.php
@@ -170,7 +170,7 @@ function home_content(&$a, $update = 0, $load = false) {
$page_mode = 'list';
- $simple_update = (($update) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " ) > 0 " : '');
+ $simple_update = (($update) ? " and item.item_unseen = 1 " : '');
if($update && $_SESSION['loadtime'])
$simple_update .= " and item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' ";
diff --git a/mod/item.php b/mod/item.php
index 152c10b13..a6ab99ef5 100644
--- a/mod/item.php
+++ b/mod/item.php
@@ -809,7 +809,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'],
diff --git a/mod/like.php b/mod/like.php
index 4d4d4249e..968f9c81e 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -328,14 +328,14 @@ function like_content(&$a) {
),
));
- if(! ($item['item_flags'] & ITEM_THREAD_TOP))
+ if(! intval($item['item_thread_top']))
$post_type = 'comment';
$arr['item_origin'] = 1;
$arr['item_notshown'] = 1;
- if($item['item_flags'] & ITEM_WALL)
- $item_flags |= ITEM_WALL;
+ if(intval($item['item_wall']))
+ $arr['item_wall'] = 1;
// if this was a linked photo and was hidden, unhide it.
diff --git a/mod/manage.php b/mod/manage.php
index 6797b4892..4297e8f08 100644
--- a/mod/manage.php
+++ b/mod/manage.php
@@ -56,16 +56,15 @@ function manage_content(&$a) {
$channels[$x]['default_links'] = '1';
- $c = q("SELECT id, item_restrict, item_flags FROM item
- WHERE (item_restrict = %d) and ( item_flags & %d )>0 and uid = %d",
+ $c = q("SELECT id, item_restrict, item_wall FROM item
+ WHERE (item_restrict = %d) and item_unseen = 1 and uid = %d",
intval(ITEM_VISIBLE),
- intval(ITEM_UNSEEN),
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'] ++;
diff --git a/mod/network.php b/mod/network.php
index 65332e3f6..5e583f657 100644
--- a/mod/network.php
+++ b/mod/network.php
@@ -154,12 +154,12 @@ function network_content(&$a, $update = 0, $load = false) {
$sql_options = (($star)
- ? " and (item_flags & " . intval(ITEM_STARRED) . ") > 0"
+ ? " and item_starred = 1 "
: '');
$sql_nets = '';
- $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE (item_flags & " . intval(ITEM_THREAD_TOP) . ")>0 $sql_options ) ";
+ $sql_extra = " AND `item`.`parent` IN ( SELECT `parent` FROM `item` WHERE item_thread_top = 1 $sql_options ) ";
if($group) {
$contact_str = '';
@@ -291,9 +291,8 @@ function network_content(&$a, $update = 0, $load = false) {
}
if($conv) {
- $sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or ( item_flags & %d ) > 0)) ",
- dbesc(protect_sprintf($channel['channel_hash'])),
- intval(ITEM_MENTIONSME)
+ $sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ",
+ dbesc(protect_sprintf($channel['channel_hash']))
);
}
@@ -346,7 +345,7 @@ function network_content(&$a, $update = 0, $load = false) {
else
$page_mode = 'client';
- $simple_update = (($update) ? " and ( item.item_flags & " . intval(ITEM_UNSEEN) . " ) > 0 " : '');
+ $simple_update = (($update) ? " and item.item_unseen = 1 " : '');
// This fixes a very subtle bug so I'd better explain it. You wake up in the morning or return after a day
// or three and look at your matrix page - after opening up your browser. The first page loads just as it
@@ -465,10 +464,7 @@ function network_content(&$a, $update = 0, $load = false) {
}
if(($update_unseen) && (! $firehose))
- $r = q("UPDATE item SET item_flags = ( item_flags & ~%d)
- WHERE (item_flags & %d) > 0 AND uid = %d $update_unseen ",
- intval(ITEM_UNSEEN),
- intval(ITEM_UNSEEN),
+ $r = q("UPDATE item SET item_unseen = 0 WHERE item_unseen = 1 AND uid = %d $update_unseen ",
intval(local_user())
);
diff --git a/mod/p.php b/mod/p.php
index 9d1c12dbc..80e835a91 100644
--- a/mod/p.php
+++ b/mod/p.php
@@ -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)
);
diff --git a/mod/photos.php b/mod/photos.php
index b2eb2847f..216a562c7 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -877,11 +877,9 @@ function photos_content(&$a) {
}
if((local_user()) && (local_user() == $link_item['uid'])) {
- q("UPDATE `item` SET item_flags = (item_flags & ~%d) WHERE parent = %d and uid = %d and (item_flags & %d)>0",
- intval(ITEM_UNSEEN),
+ q("UPDATE `item` SET item_unseen = 0 WHERE parent = %d and uid = %d and item_unseen = 1",
intval($link_item['parent']),
- intval(local_user()),
- intval(ITEM_UNSEEN)
+ intval(local_user())
);
}
}
diff --git a/mod/ping.php b/mod/ping.php
index e5fc4d930..62e8197df 100644
--- a/mod/ping.php
+++ b/mod/ping.php
@@ -151,17 +151,12 @@ function ping_init(&$a) {
if(x($_REQUEST, 'markRead') && local_user()) {
switch($_REQUEST['markRead']) {
case 'network':
- $r = q("update item set item_flags = ( item_flags & ~%d ) where (item_flags & %d) > 0 and uid = %d",
- intval(ITEM_UNSEEN),
- intval(ITEM_UNSEEN),
+ $r = q("update item set item_unseen = 0 where item_unseen = 1 and uid = %d",
intval(local_user())
);
break;
case 'home':
- $r = q("update item set item_flags = ( item_flags & ~%d ) where (item_flags & %d) > 0 and (item_flags & %d) > 0 and uid = %d",
- intval(ITEM_UNSEEN),
- intval(ITEM_UNSEEN),
- intval(ITEM_WALL),
+ $r = q("update item set item_unseen = 0 where item_unseen = 1 and item_wall = 1 and uid = %d",
intval(local_user())
);
break;
@@ -188,8 +183,7 @@ function ping_init(&$a) {
}
if(x($_REQUEST, 'markItemRead') && local_user()) {
- $r = q("update item set item_flags = ( item_flags & ~%d ) where parent = %d and uid = %d",
- intval(ITEM_UNSEEN),
+ $r = q("update item set item_unseen = 0 where parent = %d and uid = %d",
intval($_REQUEST['markItemRead']),
intval(local_user())
);
@@ -276,10 +270,9 @@ function ping_init(&$a) {
$result = array();
$r = q("SELECT * FROM item
- WHERE item_restrict = %d and ( item_flags & %d ) > 0 and uid = %d
+ WHERE item_restrict = %d and item_unseen = 1 and uid = %d
and author_xchan != '%s' ORDER BY created DESC",
intval(ITEM_VISIBLE),
- intval(ITEM_UNSEEN),
intval(local_user()),
dbesc($ob_hash)
);
@@ -287,7 +280,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);
}
@@ -383,10 +376,9 @@ function ping_init(&$a) {
if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) {
$r = q("SELECT id, item_restrict, item_flags FROM item
- WHERE (item_restrict = %d) and ( item_flags & %d ) > 0 and uid = %d
+ WHERE (item_restrict = %d) and item_unseen = 1 and uid = %d
and author_xchan != '%s'",
intval(ITEM_VISIBLE),
- intval(ITEM_UNSEEN),
intval(local_user()),
dbesc($ob_hash)
);
@@ -396,7 +388,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'] ++;
diff --git a/mod/starred.php b/mod/starred.php
index 05b45bea3..931b24a71 100644
--- a/mod/starred.php
+++ b/mod/starred.php
@@ -19,15 +19,15 @@ function starred_init(&$a) {
if(! count($r))
killme();
- $item_flags = ( $r[0]['item_flags'] ^ ITEM_STARRED );
+ $item_starred = (intval($r[0]['item_starred']) ? 0 : 1);
- $r = q("UPDATE item SET item_flags = %d WHERE uid = %d and id = %d",
- intval($item_flags),
+ $r = q("UPDATE item SET item_starred = %d WHERE uid = %d and id = %d",
+ intval($item_starred),
intval(local_user()),
intval($message_id)
);
header('Content-type: application/json');
- echo json_encode(array('result' => (($item_flags & ITEM_STARRED) ? 1 : 0)));
+ echo json_encode(array('result' => $item_starred));
killme();
}
diff --git a/mod/subthread.php b/mod/subthread.php
index 92ada64ad..f4472cf05 100755
--- a/mod/subthread.php
+++ b/mod/subthread.php
@@ -96,10 +96,9 @@ function subthread_content(&$a) {
),
));
- if(! ($item['item_flags'] & ITEM_THREAD_TOP))
+ if(! intval($item['item_thread_top']))
$post_type = 'comment';
-
$bodyverb = t('%1$s is following %2$s\'s %3$s');
$arr = array();