diff options
-rwxr-xr-x | boot.php | 2 | ||||
-rw-r--r-- | include/Import/refimport.php | 8 | ||||
-rw-r--r-- | include/activities.php | 5 | ||||
-rw-r--r-- | include/attach.php | 9 | ||||
-rw-r--r-- | include/bb2diaspora.php | 16 | ||||
-rwxr-xr-x | include/diaspora.php | 15 | ||||
-rw-r--r-- | include/event.php | 54 | ||||
-rw-r--r-- | include/externals.php | 20 | ||||
-rwxr-xr-x | include/items.php | 27 | ||||
-rw-r--r-- | include/notifier.php | 3 | ||||
-rw-r--r-- | include/photos.php | 76 | ||||
-rw-r--r-- | include/zot.php | 2 | ||||
-rw-r--r-- | mod/connedit.php | 4 | ||||
-rw-r--r-- | mod/item.php | 22 | ||||
-rwxr-xr-x | mod/like.php | 11 | ||||
-rwxr-xr-x | mod/mood.php | 12 | ||||
-rwxr-xr-x | mod/poke.php | 10 | ||||
-rwxr-xr-x | mod/subthread.php | 29 | ||||
-rw-r--r-- | mod/tagger.php | 6 | ||||
-rw-r--r-- | mod/thing.php | 4 |
20 files changed, 156 insertions, 179 deletions
@@ -536,7 +536,7 @@ define ( 'ITEM_PENDING_REMOVE', 0x0800); // deleted, notification period has * Item Flags */ -define ( 'ITEM_ORIGIN', 0x0001); +//define ( 'ITEM_ORIGIN', 0x0001); define ( 'ITEM_UNSEEN', 0x0002); define ( 'ITEM_STARRED', 0x0004); define ( 'ITEM_UPLINK', 0x0008); diff --git a/include/Import/refimport.php b/include/Import/refimport.php index 181b2b398..a7c0ef4c8 100644 --- a/include/Import/refimport.php +++ b/include/Import/refimport.php @@ -88,7 +88,10 @@ 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_origin'] = 1; + $arr['item_wall'] = 1; + $arr['item_thread_top'] = 1; + $arr['verb'] = ACTIVITY_POST; // this is an assumption @@ -256,7 +259,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_origin'] = 1; + $arr['item_wall'] = 1; $arr['verb'] = ACTIVITY_POST; $arr['comment_policy'] = 'contacts'; diff --git a/include/activities.php b/include/activities.php index d770ccb23..ba12bc5d1 100644 --- a/include/activities.php +++ b/include/activities.php @@ -21,7 +21,10 @@ function profile_activity($changed, $value) { $arr['uid'] = local_user(); $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_wall'] = 1; + $arr['item_origin'] = 1; + $arr['item_thread_top'] = 1; + $arr['verb'] = ACTIVITY_UPDATE; $arr['obj_type'] = ACTIVITY_OBJ_PROFILE; diff --git a/include/attach.php b/include/attach.php index 5ef3bea24..5a945dd66 100644 --- a/include/attach.php +++ b/include/attach.php @@ -954,7 +954,9 @@ function file_activity($channel_id, $hash, $allow_cid, $allow_gid, $deny_cid, $d $mid = item_message_id(); - $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_UNSEEN; + $arr['item_wall'] = 1; + $arr['item_origin'] = 1; + $arr['item_unseen'] = 1; if($action == 'post') { //check if activity item exists @@ -975,7 +977,6 @@ function file_activity($channel_id, $hash, $allow_cid, $allow_gid, $deny_cid, $d $arr['uid'] = $channel_id; $arr['mid'] = $dmid; $arr['parent_mid'] = $dmid; - $arr['item_flags'] = $item_flags; $arr['author_xchan'] = $poster['xchan_hash']; $arr['owner_xchan'] = $poster['xchan_hash']; $arr['title'] = ''; @@ -1016,7 +1017,9 @@ function file_activity($channel_id, $hash, $allow_cid, $allow_gid, $deny_cid, $d $arr['uid'] = $channel_id; $arr['mid'] = $mid; $arr['parent_mid'] = $mid; - $arr['item_flags'] = $item_flags; + $arr['item_wall'] = 1; + $arr['item_origin'] = 1; + $arr['item_unseen'] = 1; $arr['author_xchan'] = $poster['xchan_hash']; $arr['owner_xchan'] = $poster['xchan_hash']; $arr['title'] = ''; diff --git a/include/bb2diaspora.php b/include/bb2diaspora.php index 5c93ac3aa..e8f81aec4 100644 --- a/include/bb2diaspora.php +++ b/include/bb2diaspora.php @@ -271,22 +271,6 @@ function bb2diaspora_itemwallwall(&$item) { . $item['body']; } - // We have to do something similar for wall-to-wall comments. ITEM_WALL|ITEM_ORIGIN indicates that it was posted on this site. - // Regular matrix comments may have one of these bits set, but not both. - - // Update: this is getting triggered way too often and unnecessarily. Commenting out until we find a better solution. - // It's not an easy problem. For now we'll live with the mis-attributions, as wall to wall comments are much less frequent - // than wall-to-wall posts. - -// if(($item['mid'] != $item['parent_mid']) && ($item['author_xchan'] != $item['owner_xchan']) && (($item['item_flags'] & (ITEM_WALL|ITEM_ORIGIN)) == (ITEM_WALL|ITEM_ORIGIN)) && (is_array($item['author'])) && $item['author']['xchan_url'] && $item['author']['xchan_name'] && $item['author']['xchan_photo_m']) { -// logger('bb2diaspora_itemwallwall: wall to wall comment',LOGGER_DEBUG); - // post will come across with the owner's identity. Throw a preamble onto the post to indicate the true author. -// $item['body'] = "\n\n" -// . '[img]' . $item['author']['xchan_photo_m'] . '[/img]' -// . '[url=' . $item['author']['xchan_url'] . ']' . $item['author']['xchan_name'] . '[/url]' . "\n\n" -// . $item['body']; -// } - // $item['author'] might cause a surprise further down the line if it wasn't expected to be here. if(! $author_exists) diff --git a/include/diaspora.php b/include/diaspora.php index e494aac0f..ae405f663 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -1414,7 +1414,7 @@ function diaspora_comment($importer,$xml,$msg) { if($result && $result['success']) $message_id = $result['item_id']; - if(($parent_item['item_flags'] & ITEM_ORIGIN) && (! $parent_author_signature)) { + if(intval($parent_item['item_origin']) && (! $parent_author_signature)) { // if the message isn't already being relayed, notify others // the existence of parent_author_signature means the parent_author or owner // is already relaying. @@ -1996,7 +1996,7 @@ function diaspora_like($importer,$xml,$msg) { // the existence of parent_author_signature means the parent_author or owner // is already relaying. The parent_item['origin'] indicates the message was created on our system - if(($parent_item['item_flags'] & ITEM_ORIGIN) && (! $parent_author_signature)) + if(intval($parent_item['item_origin']) && (! $parent_author_signature)) proc_run('php','include/notifier.php','comment-import',$message_id); return; @@ -2105,19 +2105,12 @@ function diaspora_signed_retraction($importer,$xml,$msg) { $r[0]['parent'] ); if($p) { - if(($p[0]['item_flags'] & ITEM_ORIGIN) && (! $parent_author_signature)) { -// FIXME so we can relay this -// q("insert into sign (`retract_iid`,`signed_text`,`signature`,`signer`) values (%d,'%s','%s','%s') ", -// $r[0]['id'], -// dbesc($signed_data), -// dbesc($sig), -// dbesc($diaspora_handle) -// ); + if(intval($p[0]['item_origin']) && (! $parent_author_signature)) { // the existence of parent_author_signature would have meant the parent_author or owner // is already relaying. - logger('diaspora_signed_retraction: relaying relayable_retraction'); + logger('diaspora_signed_retraction: relaying relayable_retraction'); proc_run('php','include/notifier.php','drop',$r[0]['id']); } } diff --git a/include/event.php b/include/event.php index 1ed541d99..9da7a42a9 100644 --- a/include/event.php +++ b/include/event.php @@ -456,53 +456,55 @@ function event_store_item($arr,$event) { $private = (($arr['allow_cid'] || $arr['allow_gid'] || $arr['deny_cid'] || $arr['deny_gid']) ? 1 : 0); - + + $item_wall = 0; + $item_origin = 0; + $item_thread_top = 0; if($item) { $item_arr['id'] = $item['id']; } else { $wall = (($z[0]['channel_hash'] == $event['event_xchan']) ? true : false); - - $item_flags = ITEM_THREAD_TOP; + $item_thread_top = 1; if($wall) { - $item_flags |= ITEM_WALL; - $item_flags |= ITEM_ORIGIN; + $item_wall = 1; + $item_origin = 1; } - $item_arr['item_flags'] = $item_flags; } if(! $arr['mid']) $arr['mid'] = item_message_id(); - $item_arr['aid'] = $z[0]['channel_account_id']; - $item_arr['uid'] = $arr['uid']; - $item_arr['author_xchan'] = $arr['event_xchan']; - $item_arr['mid'] = $arr['mid']; - $item_arr['parent_mid'] = $arr['mid']; + $item_arr['aid'] = $z[0]['channel_account_id']; + $item_arr['uid'] = $arr['uid']; + $item_arr['author_xchan'] = $arr['event_xchan']; + $item_arr['mid'] = $arr['mid']; + $item_arr['parent_mid'] = $arr['mid']; - $item_arr['owner_xchan'] = (($wall) ? $z[0]['channel_hash'] : $arr['event_xchan']); - $item_arr['author_xchan'] = $arr['event_xchan']; - $item_arr['title'] = $arr['summary']; - $item_arr['allow_cid'] = $arr['allow_cid']; - $item_arr['allow_gid'] = $arr['allow_gid']; - $item_arr['deny_cid'] = $arr['deny_cid']; - $item_arr['deny_gid'] = $arr['deny_gid']; - $item_arr['item_private'] = $private; - $item_arr['verb'] = ACTIVITY_POST; + $item_arr['owner_xchan'] = (($wall) ? $z[0]['channel_hash'] : $arr['event_xchan']); + $item_arr['author_xchan'] = $arr['event_xchan']; + $item_arr['title'] = $arr['summary']; + $item_arr['allow_cid'] = $arr['allow_cid']; + $item_arr['allow_gid'] = $arr['allow_gid']; + $item_arr['deny_cid'] = $arr['deny_cid']; + $item_arr['deny_gid'] = $arr['deny_gid']; + $item_arr['item_private'] = $private; + $item_arr['verb'] = ACTIVITY_POST; + $item_arr['item_wall'] = $item_wall; + $item_arr['item_origin'] = $item_origin; + $item_arr['item_thread_top'] = $item_thread_top;; if(array_key_exists('term',$arr)) $item_arr['term'] = $arr['term']; - $item_arr['resource_type'] = 'event'; - $item_arr['resource_id'] = $event['event_hash']; - - $item_arr['obj_type'] = ACTIVITY_OBJ_EVENT; - - $item_arr['body'] = $prefix . format_event_bbcode($arr); + $item_arr['resource_type'] = 'event'; + $item_arr['resource_id'] = $event['event_hash']; + $item_arr['obj_type'] = ACTIVITY_OBJ_EVENT; + $item_arr['body'] = $prefix . format_event_bbcode($arr); // if it's local send the permalink to the channel page. // otherwise we'll fallback to /display/$message_id diff --git a/include/externals.php b/include/externals.php index b0f853dc6..3b6d170d5 100644 --- a/include/externals.php +++ b/include/externals.php @@ -93,26 +93,6 @@ function externals_run($argv, $argc){ $results = process_delivery(array('hash' => 'undefined'), get_item_elements($message), array(array('hash' => $sys['xchan_hash'])), false, true); $total ++; -// $z = q("select id from item where mid = '%s' and uid = %d limit 1", -// dbesc($message['message_id']), -// intval($sys['channel_id']) -// ); -$z = null; - if($z) { - $flag_bits = ITEM_WALL|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' - where id = %d", - intval($flag_bits), - dbesc($sys['xchan_hash']), - intval($z[0]['id']) - ); - } } logger('externals: import_public_posts: ' . $total . ' messages imported', LOGGER_DEBUG); } diff --git a/include/items.php b/include/items.php index fb2f2586a..b2fc05f09 100755 --- a/include/items.php +++ b/include/items.php @@ -364,13 +364,12 @@ function post_activity_item($arr) { if((($arr['parent']) && $arr['parent'] != $arr['id']) || (($arr['parent_mid']) && $arr['parent_mid'] != $arr['mid'])) $is_comment = true; - if(! x($arr,'item_flags')) { - if($is_comment) - $arr['item_flags'] = ITEM_ORIGIN; - else - $arr['item_flags'] = ITEM_ORIGIN | ITEM_WALL | ITEM_THREAD_TOP; - } - + if(! array_key_exists('item_origin',$arr)) + $arr['item_origin'] = 1; + if(! array_key_exists('item_wall',$arr) && (! $is_comment)) + $arr['item_wall'] = 1; + if(! array_key_exists('item_thread_top',$arr) && (! $is_comment)) + $arr['item_thread_top'] = 1; $channel = get_app()->get_channel(); $observer = get_app()->get_observer(); @@ -2917,10 +2916,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) - || ($item['item_flags'] & ITEM_ORIGIN) - || (!($item['item_flags'] & ITEM_THREAD_TOP)) - || ($item['id'] != $item['parent'])) { + if(intval($item['item_wall']) || intval($item['item_origin']) || (! intval($item['item_thread_top'])) || ($item['id'] != $item['parent'])) { logger('tag_deliver: item was local or a comment. rejected.'); return; } @@ -3039,7 +3035,10 @@ function start_delivery_chain($channel,$item,$item_id,$parent) { if((! $private) && $new_public_policy) $private = 1; - $flag_bits = $item['item_flags'] | ITEM_WALL|ITEM_ORIGIN; + $item_wall = 1; + $item_origin = 1; + + $flag_bits = $item['item_flags']; // unset the nocomment bit if it's there. @@ -3087,7 +3086,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 = %d, item_origin = %d where id = %d", intval($flag_bits), dbesc($channel['channel_hash']), dbesc($channel['channel_allow_cid']), @@ -3099,6 +3098,8 @@ function start_delivery_chain($channel,$item,$item_id,$parent) { dbesc(map_scope($channel['channel_w_comment'])), dbesc($title), dbesc($body), + intval($item_wall), + $intval($item_origin), intval($item_id) ); diff --git a/include/notifier.php b/include/notifier.php index 29646fb38..241dffbd1 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -362,7 +362,7 @@ function notifier_run($argv, $argc){ $encoded_item = encode_item($target_item); - $relay_to_owner = (((! $top_level_post) && ($target_item['item_flags'] & ITEM_ORIGIN)) ? true : false); + $relay_to_owner = (((! $top_level_post) && (intval($target_item['item_origin']))) ? true : false); $uplink = false; @@ -371,7 +371,6 @@ function notifier_run($argv, $argc){ logger('notifier: relay_to_owner: ' . (($relay_to_owner) ? 'true' : 'false'), LOGGER_DATA); logger('notifier: top_level_post: ' . (($top_level_post) ? 'true' : 'false'), LOGGER_DATA); - logger('notifier: target_item_flags: ' . $target_item['item_flags'] . ' ' . (($target_item['item_flags'] & ITEM_ORIGIN ) ? 'true' : 'false'), LOGGER_DATA); // tag_deliver'd post which needs to be sent back to the original author diff --git a/include/photos.php b/include/photos.php index 2393153c6..0ac47f7ba 100644 --- a/include/photos.php +++ b/include/photos.php @@ -225,30 +225,31 @@ function photo_upload($channel, $observer, $args) { // Create item container - $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP; $item_restrict = (($visible) ? ITEM_VISIBLE : ITEM_HIDDEN); $title = ''; $mid = item_message_id(); $arr = array(); - $arr['aid'] = $account_id; - $arr['uid'] = $channel_id; - $arr['mid'] = $mid; - $arr['parent_mid'] = $mid; - $arr['item_flags'] = $item_flags; - $arr['item_restrict'] = $item_restrict; - $arr['resource_type'] = 'photo'; - $arr['resource_id'] = $photo_hash; - $arr['owner_xchan'] = $channel['channel_hash']; - $arr['author_xchan'] = $observer['xchan_hash']; - $arr['title'] = $title; - $arr['allow_cid'] = $str_contact_allow; - $arr['allow_gid'] = $str_group_allow; - $arr['deny_cid'] = $str_contact_deny; - $arr['deny_gid'] = $str_group_deny; - $arr['verb'] = ACTIVITY_POST; - + $arr['aid'] = $account_id; + $arr['uid'] = $channel_id; + $arr['mid'] = $mid; + $arr['parent_mid'] = $mid; + $arr['item_flags'] = $item_flags; + $arr['item_restrict'] = $item_restrict; + $arr['resource_type'] = 'photo'; + $arr['resource_id'] = $photo_hash; + $arr['owner_xchan'] = $channel['channel_hash']; + $arr['author_xchan'] = $observer['xchan_hash']; + $arr['title'] = $title; + $arr['allow_cid'] = $str_contact_allow; + $arr['allow_gid'] = $str_group_allow; + $arr['deny_cid'] = $str_contact_deny; + $arr['deny_gid'] = $str_group_deny; + $arr['verb'] = ACTIVITY_POST; + $arr['item_wall'] = 1; + $arr['item_origin'] = 1; + $arr['item_thread_top'] = 1; $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid']; if ($width_x_height) @@ -431,7 +432,6 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) { // Create item container - $item_flags = ITEM_WALL|ITEM_ORIGIN|ITEM_THREAD_TOP; $item_restrict = (($visible) ? ITEM_VISIBLE : ITEM_HIDDEN); $title = ''; @@ -439,25 +439,27 @@ function photos_create_item($channel, $creator_hash, $photo, $visible = false) { $arr = array(); - $arr['aid'] = $channel['channel_account_id']; - $arr['uid'] = $channel['channel_id']; - $arr['mid'] = $mid; - $arr['parent_mid'] = $mid; - $arr['item_flags'] = $item_flags; - $arr['item_restrict'] = $item_restrict; - $arr['resource_type'] = 'photo'; - $arr['resource_id'] = $photo['resource_id']; - $arr['owner_xchan'] = $channel['channel_hash']; - $arr['author_xchan'] = $creator_hash; - - $arr['allow_cid'] = $photo['allow_cid']; - $arr['allow_gid'] = $photo['allow_gid']; - $arr['deny_cid'] = $photo['deny_cid']; - $arr['deny_gid'] = $photo['deny_gid']; - - $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid']; + $arr['aid'] = $channel['channel_account_id']; + $arr['uid'] = $channel['channel_id']; + $arr['mid'] = $mid; + $arr['parent_mid'] = $mid; + $arr['item_wall'] = 1; + $arr['item_origin'] = 1; + $arr['item_thread_top'] = 1; + $arr['item_restrict'] = $item_restrict; + $arr['resource_type'] = 'photo'; + $arr['resource_id'] = $photo['resource_id']; + $arr['owner_xchan'] = $channel['channel_hash']; + $arr['author_xchan'] = $creator_hash; + + $arr['allow_cid'] = $photo['allow_cid']; + $arr['allow_gid'] = $photo['allow_gid']; + $arr['deny_cid'] = $photo['deny_cid']; + $arr['deny_gid'] = $photo['deny_gid']; + + $arr['plink'] = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $arr['mid']; - $arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']' + $arr['body'] = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo['resource_id'] . ']' . '[zmg]' . z_root() . '/photo/' . $photo['resource_id'] . '-' . $photo['scale'] . '[/zmg]' . '[/zrl]'; diff --git a/include/zot.php b/include/zot.php index 9cb6c47d8..435592b6a 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1549,7 +1549,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque $result[] = array($d['hash'],'update ignored',$channel['channel_name'] . ' <' . $channel['channel_address'] . '@' . get_app()->get_hostname() . '>',$arr['mid']); // We need this line to ensure wall-to-wall comments are relayed (by falling through to the relay bit), // and at the same time not relay any other relayable posts more than once, because to do so is very wasteful. - if(! ($r[0]['item_flags'] & ITEM_ORIGIN)) + if(! intval($r[0]['item_origin'])) continue; } } diff --git a/mod/connedit.php b/mod/connedit.php index c27f4588a..f5dba8a02 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -186,7 +186,9 @@ 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_wall'] = 1; + $xarr['item_origin'] = 1; + $xarr['item_thread_top'] = 1; $xarr['owner_xchan'] = $xarr['author_xchan'] = $channel['channel_hash']; $xarr['allow_cid'] = $channel['channel_allow_cid']; $xarr['allow_gid'] = $channel['channel_allow_gid']; diff --git a/mod/item.php b/mod/item.php index b3370fecf..152c10b13 100644 --- a/mod/item.php +++ b/mod/item.php @@ -281,7 +281,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_wall'] && $parent_item['item_origin'])) { $walltowall_comment = true; $walltowall = true; } @@ -640,14 +640,10 @@ function item_post(&$a) { } } - if(local_user() != $profile_uid) - $item_flags |= ITEM_UNSEEN; - - if($post_type === 'wall' || $post_type === 'wall-comment') - $item_flags = $item_flags | ITEM_WALL; + $item_unseen = ((local_user() != $profile_uid) ? 1 : 0); + $item_wall = (($post_type === 'wall' || $post_type === 'wall-comment') ? 1 : 0); + $item_origin = (($origin) ? 1 : 0); - if($origin) - $item_flags = $item_flags | ITEM_ORIGIN; if($moderated) $item_restrict = $item_restrict | ITEM_MODERATED; @@ -678,11 +674,9 @@ function item_post(&$a) { $datarray = array(); - if(! $parent) { - $item_flags = $item_flags | ITEM_THREAD_TOP; - } + $item_thead_top = ((! $parent) ? 1 : 0); - if ((! $plink) && ($item_flags & ITEM_THREAD_TOP)) { + if ((! $plink) && ($item_thread_top)) { $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid; } @@ -717,6 +711,10 @@ function item_post(&$a) { $datarray['postopts'] = $postopts; $datarray['item_restrict'] = $item_restrict; $datarray['item_flags'] = $item_flags; + $datarray['item_unseen'] = $item_unseen; + $datarray['item_wall'] = $item_wall; + $datarray['item_origin'] = $item_origin; + $datarray['item_thread_top'] = $item_thread_top; $datarray['layout_mid'] = $layout_mid; $datarray['public_policy'] = $public_policy; $datarray['comment_policy'] = map_scope($channel['channel_w_comment']); diff --git a/mod/like.php b/mod/like.php index b3afd910f..4d4d4249e 100755 --- a/mod/like.php +++ b/mod/like.php @@ -293,10 +293,12 @@ function like_content(&$a) { } $mid = item_message_id(); + $arr = array(); if($extended_like) { - $item_flags = ITEM_THREAD_TOP|ITEM_ORIGIN|ITEM_WALL; - + $arr['item_thread_top'] = 1; + $arr['item_origin'] = 1; + $arr['item_wall'] = 1; } else { $post_type = (($item['resource_type'] === 'photo') ? t('photo') : t('status')); @@ -329,7 +331,9 @@ function like_content(&$a) { if(! ($item['item_flags'] & ITEM_THREAD_TOP)) $post_type = 'comment'; - $item_flags = ITEM_ORIGIN | ITEM_NOTSHOWN; + $arr['item_origin'] = 1; + $arr['item_notshown'] = 1; + if($item['item_flags'] & ITEM_WALL) $item_flags |= ITEM_WALL; @@ -361,7 +365,6 @@ function like_content(&$a) { killme(); - $arr = array(); if($extended_like) { $ulink = '[zrl=' . $ch[0]['xchan_url'] . ']' . $ch[0]['xchan_name'] . '[/zrl]'; diff --git a/mod/mood.php b/mod/mood.php index e6f4760e0..bf59eac1f 100755 --- a/mod/mood.php +++ b/mod/mood.php @@ -61,10 +61,6 @@ 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_UNSEEN; - if(! $parent_mid) - $item_flags |= ITEM_THREAD_TOP; - $arr = array(); @@ -72,7 +68,6 @@ function mood_init(&$a) { $arr['uid'] = $uid; $arr['mid'] = $mid; $arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid); - $arr['item_flags'] = $item_flags; $arr['author_xchan'] = $poster['xchan_hash']; $arr['owner_xchan'] = (($parent_mid) ? $r[0]['owner_xchan'] : $poster['xchan_hash']); $arr['title'] = ''; @@ -83,8 +78,13 @@ function mood_init(&$a) { $arr['item_private'] = $private; $arr['verb'] = $activity; $arr['body'] = $action; + $arr['item_origin'] = 1; + $arr['item_wall'] = 1; + $arr['item_unseen'] = 1; + if(! $parent_mid) + $item['item_thread_top'] = 1; - 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']; } diff --git a/mod/poke.php b/mod/poke.php index b22f7d9d5..9fde46f62 100755 --- a/mod/poke.php +++ b/mod/poke.php @@ -87,9 +87,6 @@ function poke_init(&$a) { $arr = array(); - $arr['item_flags'] = ITEM_WALL | ITEM_ORIGIN; - if($parent_item) - $arr['item_flags'] |= ITEM_THREAD_TOP; $arr['owner_xchan'] = (($parent_item) ? $parent_item['owner_xchan'] : $channel['channel_hash']); $arr['parent_mid'] = (($parent_mid) ? $parent_mid : $mid); @@ -115,6 +112,13 @@ function poke_init(&$a) { $arr['object'] = json_encode($obj); + $arr['item_origin'] = 1; + $arr['item_wall'] = 1; + $arr['item_unseen'] = 1; + if(! $parent_item) + $item['item_thread_top'] = 1; + + post_activity_item($arr); return; diff --git a/mod/subthread.php b/mod/subthread.php index f0f54f4a6..92ada64ad 100755 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -102,24 +102,23 @@ 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(); - $arr['mid'] = $mid; - $arr['aid'] = $owner_aid; - $arr['uid'] = $owner_uid; - $arr['item_flags'] = $item_flags; - $arr['parent'] = $item['id']; - $arr['parent_mid'] = $item['mid']; - $arr['thr_parent'] = $item['mid']; - $arr['owner_xchan'] = $thread_owner['xchan_hash']; - $arr['author_xchan'] = $observer['xchan_hash']; + $arr['mid'] = $mid; + $arr['aid'] = $owner_aid; + $arr['uid'] = $owner_uid; + $arr['parent'] = $item['id']; + $arr['parent_mid'] = $item['mid']; + $arr['thr_parent'] = $item['mid']; + $arr['owner_xchan'] = $thread_owner['xchan_hash']; + $arr['author_xchan'] = $observer['xchan_hash']; + $arr['item_origin'] = 1; + $arr['item_notshown'] = 1; + if(intval($item['item_wall'])) + $arr['item_wall'] = 1; + else + $arr['item_wall'] = 0; - $ulink = '[zrl=' . $item_author['xchan_url'] . ']' . $item_author['xchan_name'] . '[/zrl]'; $alink = '[zrl=' . $observer['xchan_url'] . ']' . $observer['xchan_name'] . '[/zrl]'; $plink = '[zrl=' . $a->get_baseurl() . '/display/' . $item['mid'] . ']' . $post_type . '[/zrl]'; diff --git a/mod/tagger.php b/mod/tagger.php index bfda114d2..83f6ee029 100644 --- a/mod/tagger.php +++ b/mod/tagger.php @@ -109,10 +109,8 @@ function tagger_content(&$a) { $arr['owner_xchan'] = $item['owner_xchan']; $arr['author_xchan'] = $channel['channel_hash']; - - $arr['item_flags'] = ITEM_ORIGIN; - if($item['item_flags'] & ITEM_WALL) - $arr['item_flags'] |= ITEM_WALL; + $arr['item_origin'] = 1; + $arr['item_wall'] = ((intval($item['item_wall'])) ? 1 : 0); $ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]'; $alink = '[zrl=' . $item['xchan_url'] . ']' . $item['xchan_name'] . '[/zrl]'; diff --git a/mod/thing.php b/mod/thing.php index f53a6ab7b..4896c8a6e 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -182,8 +182,10 @@ function thing_init(&$a) { $arr['owner_xchan'] = $channel['channel_hash']; $arr['author_xchan'] = $channel['channel_hash']; + $arr['item_origin'] = 1; + $arr['item_wall'] = 1; + $arr['item_thread_top'] = 1; - $arr['item_flags'] = ITEM_ORIGIN|ITEM_WALL|ITEM_THREAD_TOP; $ulink = '[zrl=' . $channel['xchan_url'] . ']' . $channel['channel_name'] . '[/zrl]'; $plink = '[zrl=' . $term['url'] . ']' . $term['term'] . '[/zrl]'; |