From 1d56b9a1bb155d7a0b4377f9bb1e195230e545e4 Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 14 Sep 2022 12:31:19 +0000 Subject: php8: warning fixes --- Zotlabs/Lib/Activity.php | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Lib/Activity.php') 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']; } -- cgit v1.2.3