diff options
author | friendica <info@friendica.com> | 2015-01-22 17:41:16 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2015-01-22 17:41:16 -0800 |
commit | e46eba125888704b4381aa8418495e91eeb565c8 (patch) | |
tree | d91e1e52560ea27be806f416485d32b831d03ebc /include | |
parent | 29436081a86650e7905a79eba4fdf7dc12f1c7c9 (diff) | |
download | volse-hubzilla-e46eba125888704b4381aa8418495e91eeb565c8.tar.gz volse-hubzilla-e46eba125888704b4381aa8418495e91eeb565c8.tar.bz2 volse-hubzilla-e46eba125888704b4381aa8418495e91eeb565c8.zip |
heavy lifting converting item flag bits
Diffstat (limited to 'include')
-rw-r--r-- | include/ConversationObject.php | 2 | ||||
-rw-r--r-- | include/ItemObject.php | 14 | ||||
-rw-r--r-- | include/api.php | 17 | ||||
-rw-r--r-- | include/conversation.php | 2 | ||||
-rwxr-xr-x | include/diaspora.php | 4 | ||||
-rw-r--r-- | include/enotify.php | 2 | ||||
-rw-r--r-- | include/identity.php | 3 | ||||
-rwxr-xr-x | include/items.php | 104 | ||||
-rw-r--r-- | include/notifier.php | 9 | ||||
-rw-r--r-- | include/notify.php | 7 | ||||
-rw-r--r-- | include/statistics_fns.php | 9 | ||||
-rw-r--r-- | include/taxonomy.php | 6 | ||||
-rw-r--r-- | include/widgets.php | 4 | ||||
-rw-r--r-- | include/zot.php | 7 |
14 files changed, 79 insertions, 111 deletions
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)) { |