diff options
Diffstat (limited to 'include/zot.php')
-rw-r--r-- | include/zot.php | 41 |
1 files changed, 26 insertions, 15 deletions
diff --git a/include/zot.php b/include/zot.php index 34e7f3e42..0376dc7f5 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1110,13 +1110,18 @@ function zot_import($arr, $sender_url) { logger('specific recipients'); $recip_arr = array(); foreach($i['notify']['recipients'] as $recip) { - $recip_arr[] = make_xchan_hash($recip['guid'],$recip['guid_sig']); + if(is_array($recip)) { + $recip_arr[] = make_xchan_hash($recip['guid'],$recip['guid_sig']); + } + } + $r = false; + if($recip_arr) { + stringify_array_elms($recip_arr); + $recips = implode(',',$recip_arr); + $r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) and not ( channel_pageflags & %d ) > 0 ", + intval(PAGE_REMOVED) + ); } - stringify_array_elms($recip_arr); - $recips = implode(',',$recip_arr); - $r = q("select channel_hash as hash from channel where channel_hash in ( " . $recips . " ) and not ( channel_pageflags & %d ) > 0 ", - intval(PAGE_REMOVED) - ); if(! $r) { logger('recips: no recipients on this site'); continue; @@ -1272,7 +1277,8 @@ function public_recips($msg) { $include_sys = false; if($msg['message']['type'] === 'activity') { - $include_sys = true; + if(! get_config('system','disable_discover_tab')) + $include_sys = true; $col = 'channel_w_stream'; $field = PERMS_W_STREAM; if(array_key_exists('flags',$msg['message']) && in_array('thread_parent', $msg['message']['flags'])) { @@ -1554,8 +1560,9 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ $tag_delivery = tgroup_check($channel['channel_id'],$arr); - $perm = (($arr['mid'] == $arr['parent_mid']) ? 'send_stream' : 'post_comments'); - + $perm = 'send_stream'; + if(($arr['mid'] !== $arr['parent_mid']) && ($relay)) + $perm = 'post_comments'; // This is our own post, possibly coming from a channel clone @@ -1654,9 +1661,9 @@ function process_delivery($sender, $arr, $deliveries, $relay, $public = false, $ } } - $ab = q("select abook.* from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and (abook_flags & %d) = 0", + $ab = q("select * from abook where abook_channel = %d and abook_xchan = '%s'", intval($channel['channel_id']), - intval(ABOOK_FLAG_SELF) + dbesc($arr['owner_xchan']) ); $abook = (($ab) ? $ab[0] : null); @@ -2887,7 +2894,12 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } if(array_key_exists('channel',$arr) && is_array($arr['channel']) && count($arr['channel'])) { - $disallowed = array('channel_id','channel_account_id','channel_primary','channel_prvkey', 'channel_address', 'channel_notifyflags'); + if(array_key_exists('channel_removed',$arr['channel'])) + $arr['channel_pageflags'] |= PAGE_REMOVED; + if(array_key_exists('channel_system',$arr['channel'])) + $arr['channel_pageflags'] |= PAGE_SYSTEM; + + $disallowed = array('channel_id','channel_account_id','channel_primary','channel_prvkey', 'channel_address', 'channel_notifyflags', 'channel_removed', 'channel_system'); $clean = array(); foreach($arr['channel'] as $k => $v) { @@ -2918,7 +2930,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { $total_feeds ++; } - $disallowed = array('abook_id','abook_account','abook_channel'); + $disallowed = array('abook_id','abook_account','abook_channel','abook_blocked','abook_ignored','abook_hidden','abook_archived','abook_pending','abook_unconnected','abook_self','abook_feed'); foreach($arr['abook'] as $abook) { @@ -3017,7 +3029,6 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { foreach($clean as $k => $v) { if($k == 'abook_dob') $v = dbescdate($v); - $r = dbq("UPDATE abook set " . dbesc($k) . " = '" . dbesc($v) . "' where abook_xchan = '" . dbesc($clean['abook_xchan']) . "' and abook_channel = " . intval($channel['channel_id'])); } @@ -3200,7 +3211,7 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) { } if(count($clean)) { foreach($clean as $k => $v) { - $r = dbq("UPDATE profile set " . dbesc($k) . " = '" . dbesc($v) + $r = dbq("UPDATE profile set `" . dbesc($k) . "` = '" . dbesc($v) . "' where profile_guid = '" . dbesc($profile['profile_guid']) . "' and uid = " . intval($channel['channel_id'])); } } |