diff options
Diffstat (limited to 'include/notifier.php')
-rw-r--r-- | include/notifier.php | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/include/notifier.php b/include/notifier.php index 81f971107..4b387513b 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -90,6 +90,9 @@ function notifier_run($argv, $argc){ if(! $item_id) return; + require_once('include/identity.php'); + $sys = get_sys_channel(); + if($cmd == 'permission_update') { // Get the recipient $r = q("select abook.*, hubloc.* from abook @@ -288,6 +291,11 @@ function notifier_run($argv, $argc){ if($s) $channel = $s[0]; + if($channel['channel_hash'] !== $target_item['author_xchan'] && $channel['channel_hash'] !== $target_item['owner_xchan']) { + logger("notifier: Sending channel {$channel['channel_hash']} is not owner {$target_item['owner_xchan']} or author {$target_item['author_xchan']}"); + return; + } + if($target_item['id'] == $target_item['parent']) { $parent_item = $target_item; @@ -308,6 +316,10 @@ function notifier_run($argv, $argc){ $top_level_post = false; } + // avoid looping of discover items 12/4/2014 + + if($sys && $parent_item['uid'] == $sys['channel_id']) + return; $encoded_item = encode_item($target_item); @@ -481,10 +493,11 @@ function notifier_run($argv, $argc){ $hash = random_string(); if($packet_type === 'refresh' || $packet_type === 'purge') { $n = zot_build_packet($channel,$packet_type); - q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )", + q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )", dbesc($hash), intval($channel['channel_account_id']), intval($channel['channel_id']), + dbesc('zot'), dbesc($hub['hubloc_callback']), intval(1), dbesc(datetime_convert()), @@ -495,10 +508,11 @@ function notifier_run($argv, $argc){ } else { $n = zot_build_packet($channel,'notify',$env_recips,(($private) ? $hub['hubloc_sitekey'] : null),$hash); - q("insert into outq ( outq_hash, outq_account, outq_channel, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s' )", + q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_created, outq_updated, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, '%s', '%s', '%s', '%s' )", dbesc($hash), intval($target_item['aid']), intval($target_item['uid']), + dbesc('zot'), dbesc($hub['hubloc_callback']), intval(1), dbesc(datetime_convert()), |