diff options
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/include/items.php b/include/items.php index 02d31fcb5..1fe98c119 100755 --- a/include/items.php +++ b/include/items.php @@ -25,7 +25,7 @@ require_once('include/permissions.php'); * * @param array $item * @param[out] boolean $private_envelope - * @param boolean $include_groups + * @param boolean $include_groups * @return array containing the recipients */ function collect_recipients($item, &$private_envelope,$include_groups = true) { @@ -95,9 +95,24 @@ function collect_recipients($item, &$private_envelope,$include_groups = true) { //$sys = get_sys_channel(); if(array_key_exists('public_policy',$item) && $item['public_policy'] !== 'self') { - $r = q("select abook_xchan, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 and abook_pending = 0 and abook_archived = 0 ", + + $hookinfo = [ + 'recipients' => [], + 'item' => $item, + 'private_envelope' => $private_envelope, + 'include_groups' => $include_groups + ]; + + call_hooks('collect_public_recipients',$hookinfo); + + if ($hookinfo['recipients']) { + $r = $hookinfo['recipients']; + } else { + $r = q("select abook_xchan, xchan_network from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 and abook_pending = 0 and abook_archived = 0 ", intval($item['uid']) - ); + ); + } + if($r) { // filter out restrictive public_policy settings from remote networks @@ -395,7 +410,7 @@ function post_activity_item($arr, $allow_code = false, $deliver = true) { if(! $arr['mid']) { - $arr['uuid'] = ((x($arr,'uuid')) ? $arr['uuid'] : item_message_id()); + $arr['uuid'] = ((x($arr,'uuid')) ? $arr['uuid'] : item_message_id()); } $arr['mid'] = ((x($arr,'mid')) ? $arr['mid'] : z_root() . '/item/' . $arr['uuid']); $arr['parent_mid'] = ((x($arr,'parent_mid')) ? $arr['parent_mid'] : $arr['mid']); @@ -2033,6 +2048,11 @@ function item_store($arr, $allow_exec = false, $deliver = true) { item_update_parent_commented($arr); + + if(strpos($arr['body'],'[embed]') !== false) { + Master::Summon([ 'Cache_embeds', $current_post ]); + } + // If _creating_ a deleted item, don't propagate it further or send out notifications. // We need to store the item details just in case the delete came in before the original post, // so that we have an item in the DB that's marked deleted and won't store a fresh post @@ -2369,6 +2389,13 @@ function item_store_update($arr, $allow_exec = false, $deliver = true) { */ call_hooks('item_stored_update',$arr); + if(strpos($arr['body'],'[embed]') !== false) { + Master::Summon([ 'Cache_embeds', $orig_post_id ]); + } + + + + if($deliver) { send_status_notifications($orig_post_id,$arr); tag_deliver($uid,$orig_post_id); @@ -2385,15 +2412,15 @@ function item_update_parent_commented($item) { $update_parent = true; - // update the commented timestamp on the parent + // update the commented timestamp on the parent // - unless this is a moderated comment or a potential clone of an older item - // which we don't wish to bring to the surface. As the queue only holds deliveries - // for 3 days, it's suspected of being an older cloned item if the creation time + // which we don't wish to bring to the surface. As the queue only holds deliveries + // for 3 days, it's suspected of being an older cloned item if the creation time //is older than that. if(intval($item['item_blocked']) === ITEM_MODERATED) $update_parent = false; - + if($item['created'] < datetime_convert('','','now - 4 days')) $update_parent = false; @@ -2989,7 +3016,9 @@ function tgroup_check($uid, $item) { * @param array $channel * @param array $item * @param int $item_id - * @param boolean $parent + * @param array $parent + * @param boolean $edit (optional) default false + * @return void */ function start_delivery_chain($channel, $item, $item_id, $parent, $edit = false) { @@ -3024,7 +3053,7 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $edit = false) } // This will change the author to the post owner. Useful for RSS feeds which are to be syndicated - // to federated platforms which can't verify the identity of the author. + // to federated platforms which can't verify the identity of the author. // This MAY cause you to run afoul of copyright law. $rewrite_author = intval(get_abconfig($channel['channel_id'],$item['owner_xchan'],'system','rself')); @@ -3537,7 +3566,7 @@ function item_expire($uid,$days,$comment_days = 7) { if(! $comment_days) $comment_days = 7; - + // $expire_network_only = save your own wall posts // and just expire conversations started by others // do not enable this until we can pass bulk delete messages through zot @@ -4877,7 +4906,7 @@ function copy_of_pubitem($channel,$mid) { dbesc($mid), intval($syschan['channel_id']) ); - + if($r) { $items = fetch_post_tags($r,true); foreach($items as $rv) { @@ -4903,5 +4932,5 @@ function copy_of_pubitem($channel,$mid) { } } - return $result; + return $result; } |