diff options
Diffstat (limited to 'Zotlabs')
-rw-r--r-- | Zotlabs/Daemon/Notifier.php | 8 | ||||
-rw-r--r-- | Zotlabs/Lib/Activity.php | 20 | ||||
-rw-r--r-- | Zotlabs/Lib/Libzot.php | 30 | ||||
-rw-r--r-- | Zotlabs/Lib/Queue.php | 25 | ||||
-rw-r--r-- | Zotlabs/Module/Network.php | 4 | ||||
-rw-r--r-- | Zotlabs/Module/Outbox.php | 2 |
6 files changed, 55 insertions, 34 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php index 8aee08fe6..776cf4f63 100644 --- a/Zotlabs/Daemon/Notifier.php +++ b/Zotlabs/Daemon/Notifier.php @@ -111,6 +111,12 @@ class Notifier { $sys = get_sys_channel(); $normal_mode = true; + $upstream = false; + $uplink = false; + $target_item = []; + $parent_item = []; + $top_level_post = false; + $relay_to_owner = false; if ($cmd === 'keychange') { self::$channel = channelx_by_n($item_id); @@ -360,8 +366,6 @@ class Notifier { // the hostname in the message_id and provides a second (fallback) opinion. $relay_to_owner = (!$top_level_post && intval($target_item['item_origin']) && comment_local_origin($target_item)); - $uplink = false; - $upstream = false; // $cmd === 'relay' indicates the owner is sending it to the original recipients // don't allow the item in the relay command to relay to owner under any circumstances, it will loop diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index a93ad9d23..372ef3dd7 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -2252,11 +2252,11 @@ class Activity { // over-ride the object timestamp with the activity - if ($act->data['published']) { + if (isset($act->data['published'])) { $s['created'] = datetime_convert('UTC', 'UTC', $act->data['published']); } - if ($act->data['updated']) { + if (isset($act->data['updated'])) { $s['edited'] = datetime_convert('UTC', 'UTC', $act->data['updated']); } @@ -2710,7 +2710,7 @@ class Activity { // This is a zot6 packet and the raw activitypub or diaspora message json // is possibly available in the attachement. - if (array_key_exists('signed', $raw_arr) && is_array($act->data['attachment'])) { + if (array_key_exists('signed', $raw_arr) && isset($act->data['attachment']) && is_array($act->data['attachment'])) { foreach($act->data['attachment'] as $a) { if ( isset($a['type']) && $a['type'] === 'PropertyValue' && @@ -2730,7 +2730,7 @@ class Activity { } // old style: can be removed after most hubs are on 7.0.2 - elseif (array_key_exists('signed', $raw_arr) && is_array($act->obj) && is_array($act->obj['attachment'])) { + elseif (array_key_exists('signed', $raw_arr) && is_array($act->obj) && isset($act->data['attachment']) && is_array($act->obj['attachment'])) { foreach($act->obj['attachment'] as $a) { if ( isset($a['type']) && $a['type'] === 'PropertyValue' && @@ -3019,30 +3019,34 @@ class Activity { dbesc($item['parent_mid']), intval($item['uid']) ); + if (!$parent) { if (!plugin_is_installed('pubcrawl')) { return; } else { $fetch = false; + // TODO: debug // if (perm_is_allowed($channel['channel_id'],$observer_hash,'send_stream') && (PConfig::Get($channel['channel_id'],'system','hyperdrive',true) || $act->type === 'Announce')) { if (perm_is_allowed($channel['channel_id'], $observer_hash, 'send_stream') || $is_sys_channel) { $fetch = (($fetch_parents) ? self::fetch_and_store_parents($channel, $observer_hash, $item, $force) : false); } + if ($fetch) { $parent = q("select * from item where mid = '%s' and uid = %d limit 1", dbesc($item['parent_mid']), intval($item['uid']) ); } - else { - logger('no parent'); - return; - } } } + if (!$parent) { + logger('no parent'); + return; + } + if ($parent[0]['parent_mid'] !== $item['parent_mid']) { $item['thr_parent'] = $item['parent_mid']; } diff --git a/Zotlabs/Lib/Libzot.php b/Zotlabs/Lib/Libzot.php index 340f844d5..8bf3c51d5 100644 --- a/Zotlabs/Lib/Libzot.php +++ b/Zotlabs/Lib/Libzot.php @@ -904,11 +904,11 @@ class Libzot { $s = Libsync::sync_locations($arr, $arr); if ($s) { - if ($s['change_message']) + if (isset($s['change_message'])) $what .= $s['change_message']; - if ($s['changed']) + if (isset($s['changed'])) $changed = $s['changed']; - if ($s['message']) + if (isset($s['message'])) $ret['message'] .= $s['message']; } @@ -1769,7 +1769,7 @@ class Libzot { dbesc($arr['author_xchan']) ); - if (intval($arr['item_deleted'])) { + if (isset($arr['item_deleted']) && $arr['item_deleted']) { // remove_community_tag is a no-op if this isn't a community tag activity self::remove_community_tag($sender, $arr, $channel['channel_id']); @@ -2020,11 +2020,11 @@ class Libzot { $arr['owner_xchan'] = $a['signature']['signer']; } - if ($AS->meta['hubloc'] || $arr['author_xchan'] === $arr['owner_xchan']) { + if (isset($AS->meta['hubloc']) || $arr['author_xchan'] === $arr['owner_xchan']) { $arr['item_verified'] = true; } - if ($AS->meta['signed_data']) { + if (isset($AS->meta['signed_data'])) { IConfig::Set($arr, 'activitypub', 'signed_data', $AS->meta['signed_data'], false); $j = json_decode($AS->meta['signed_data'], true); if ($j) { @@ -2518,14 +2518,14 @@ class Libzot { $access_policy = ACCESS_PRIVATE; } - $directory_url = htmlspecialchars((string)$arr['directory_url'], ENT_COMPAT, 'UTF-8', false); - $url = htmlspecialchars((string)strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false); - $sellpage = htmlspecialchars((string)$arr['sellpage'], ENT_COMPAT, 'UTF-8', false); - $site_location = htmlspecialchars((string)$arr['location'], ENT_COMPAT, 'UTF-8', false); - $site_realm = htmlspecialchars((string)$arr['realm'], ENT_COMPAT, 'UTF-8', false); - $site_project = htmlspecialchars((string)$arr['project'], ENT_COMPAT, 'UTF-8', false); - $site_crypto = ((array_key_exists('encryption', $arr) && is_array($arr['encryption'])) ? htmlspecialchars((string)implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : ''); - $site_version = ((array_key_exists('version', $arr)) ? htmlspecialchars((string)$arr['version'], ENT_COMPAT, 'UTF-8', false) : ''); + $directory_url = ((isset($arr['directory_url'])) ? htmlspecialchars($arr['directory_url'], ENT_COMPAT, 'UTF-8', false) : ''); + $url = ((isset($arr['url'])) ? htmlspecialchars(strtolower($arr['url']), ENT_COMPAT, 'UTF-8', false) : ''); + $sellpage = ((isset($arr['sellpage'])) ? htmlspecialchars($arr['sellpage'], ENT_COMPAT, 'UTF-8', false) : ''); + $site_location = ((isset($arr['location'])) ? htmlspecialchars($arr['location'], ENT_COMPAT, 'UTF-8', false) : ''); + $site_realm = ((isset($arr['realm'])) ? htmlspecialchars($arr['realm'], ENT_COMPAT, 'UTF-8', false) : ''); + $site_project = ((isset($arr['project'])) ? htmlspecialchars($arr['project'], ENT_COMPAT, 'UTF-8', false) : ''); + $site_crypto = ((isset($arr['encryption']) && is_array($arr['encryption'])) ? htmlspecialchars(implode(',', $arr['encryption']), ENT_COMPAT, 'UTF-8', false) : ''); + $site_version = ((isset($arr['version'])) ? htmlspecialchars($arr['version'], ENT_COMPAT, 'UTF-8', false) : ''); // You can have one and only one primary directory per realm. // Downgrade any others claiming to be primary. As they have @@ -3198,7 +3198,7 @@ class Libzot { } foreach ($arr as $v) { - if ($v[$check] === 'zot6') { + if (isset($v[$check]) && $v[$check] === 'zot6') { return $v; } } diff --git a/Zotlabs/Lib/Queue.php b/Zotlabs/Lib/Queue.php index 246b42667..a646aee6d 100644 --- a/Zotlabs/Lib/Queue.php +++ b/Zotlabs/Lib/Queue.php @@ -110,21 +110,30 @@ class Queue { return false; } + $hash = $arr['hash'] ?? ''; + $account_id = $arr['account_id'] ?? 0; + $channel_id = $arr['channel_id'] ?? 0; + $driver = $arr['driver'] ?? 'zot6'; + $posturl = $arr['posturl'] ?? ''; + $priority = $arr['priority'] ?? 0; + $priority = $arr['notify'] ?? ''; + $msg = $arr['msg'] ?? ''; + $x = q("insert into outq ( outq_hash, outq_account, outq_channel, outq_driver, outq_posturl, outq_async, outq_priority, outq_created, outq_updated, outq_scheduled, outq_notify, outq_msg ) values ( '%s', %d, %d, '%s', '%s', %d, %d, '%s', '%s', '%s', '%s', '%s' )", - dbesc($arr['hash']), - intval($arr['account_id']), - intval($arr['channel_id']), - dbesc(($arr['driver']) ? $arr['driver'] : 'zot6'), - dbesc($arr['posturl']), + dbesc($hash), + intval($account_id), + intval($channel_id), + dbesc($driver), + dbesc($posturl), intval(1), - intval(isset($arr['priority']) ? $arr['priority'] : 0), + intval($priority), dbesc(datetime_convert()), dbesc(datetime_convert()), dbesc(datetime_convert()), - dbesc($arr['notify']), - dbesc(($arr['msg']) ? $arr['msg'] : '') + dbesc($notify), + dbesc($msg) ); return $x; diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index f4f6cc8d1..279875544 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -129,6 +129,9 @@ class Network extends \Zotlabs\Web\Controller { $pf = ((x($_GET, 'pf')) ? $_GET['pf'] : ''); $unseen = ((x($_GET, 'unseen')) ? $_GET['unseen'] : ''); + $status_editor = ''; + + if (Apps::system_app_installed(local_channel(), 'Affinity Tool')) { $affinity_locked = intval(get_pconfig(local_channel(), 'affinity', 'lock', 1)); if ($affinity_locked) { @@ -208,6 +211,7 @@ class Network extends \Zotlabs\Web\Controller { 'reset' => t('Reset form') ); + $a = ''; $status_editor = status_editor($a, $x, false, 'Network'); $o .= $status_editor; diff --git a/Zotlabs/Module/Outbox.php b/Zotlabs/Module/Outbox.php index 503b464d1..24a3399a5 100644 --- a/Zotlabs/Module/Outbox.php +++ b/Zotlabs/Module/Outbox.php @@ -76,7 +76,7 @@ class Outbox extends Controller { App::set_pager_itemspage(30); } - if (App::$pager['unset'] && $total > 30) { + if (isset(App::$pager['unset']) && $total > 30) { $ret = Activity::paged_collection_init($total, App::$query_string); } else { |