From 5d7081a22446aa8f67e38a115cb89e8ea60c3f9e Mon Sep 17 00:00:00 2001 From: Mario Date: Wed, 26 Oct 2022 21:40:27 +0000 Subject: fix php warnings --- Zotlabs/Lib/Activity.php | 15 ++++++++------- Zotlabs/Module/Hq.php | 4 ++-- Zotlabs/Module/Like.php | 24 ++++++++++++------------ 3 files changed, 22 insertions(+), 21 deletions(-) (limited to 'Zotlabs') diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index e3306ca3e..1a34fdae6 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -721,7 +721,7 @@ class Activity { $ret['type'] = self::activity_mapper($i['verb']); - if (intval($i['item_deleted']) && !$recurse) { + if ((isset($i['item_deleted']) && intval($i['item_deleted'])) && !$recurse) { $is_response = false; if (ActivityStreams::is_response_activity($ret['type'])) { @@ -805,10 +805,10 @@ class Activity { $ret['diaspora:guid'] = $i['uuid']; - if ($i['title']) + if (isset($i['title']) && $i['title']) $ret['name'] = html2plain(bbcode($i['title'], ['cache' => true])); - if ($i['summary']) + if (isset($i['summary']) && $i['summary']) $ret['summary'] = bbcode($i['summary'], ['cache' => true]); if ($ret['type'] === 'Announce') { @@ -820,13 +820,14 @@ class Activity { ]; } - $ret['published'] = datetime_convert('UTC', 'UTC', $i['created'], ATOM_TIME); - if ($i['created'] !== $i['edited']) + $ret['published'] = ((isset($i['created'])) ? datetime_convert('UTC', 'UTC', $i['created'], ATOM_TIME) : datetime_convert()); + if (isset($i['created'], $i['edited']) && $i['created'] !== $i['edited']) $ret['updated'] = datetime_convert('UTC', 'UTC', $i['edited'], ATOM_TIME); - if ($i['app']) { + + if (isset($i['app']) && $i['app']) { $ret['generator'] = ['type' => 'Application', 'name' => $i['app']]; } - if ($i['location'] || $i['coord']) { + if (isset($i['location']) || isset($i['coord'])) { $ret['location'] = ['type' => 'Place']; if ($i['location']) { $ret['location']['name'] = $i['location']; diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index cd95ac4b0..0b2d0ea7d 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -243,8 +243,8 @@ class Hq extends \Zotlabs\Web\Controller { if (!local_channel()) return; - $options['offset'] = $_REQUEST['offset']; - $options['type'] = $_REQUEST['type']; + $options['offset'] = $_REQUEST['offset'] ?? 0; + $options['type'] = $_REQUEST['type'] ?? ''; $ret = Messages::get_messages_page($options); diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index 8b36e8396..98fa7db5a 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -106,7 +106,7 @@ class Like extends Controller { $o = EMPTY_STR; $sys_channel = get_sys_channel(); $observer = App::get_observer(); - $interactive = $_REQUEST['interactive']; + $interactive = $_REQUEST['interactive'] ?? false; if ((!$observer) || ($interactive)) { $o .= '

' . t('Like/Dislike') . '

'; @@ -140,7 +140,7 @@ class Like extends Controller { $extended_like = false; $object = $target = null; $post_type = EMPTY_STR; - $objtype = EMPTY_STR; + $obj_type = EMPTY_STR; if (argc() == 3) { @@ -182,7 +182,7 @@ class Like extends Controller { } } $post_type = t('channel'); - $objtype = ACTIVITY_OBJ_PROFILE; + $obj_type = ACTIVITY_OBJ_PROFILE; $profile = $r[0]; } @@ -211,7 +211,7 @@ class Like extends Controller { $public = false; $post_type = t('thing'); - $objtype = ACTIVITY_OBJ_PROFILE; + $obj_type = ACTIVITY_OBJ_PROFILE; $tgttype = ACTIVITY_OBJ_THING; $links = array(); @@ -273,7 +273,7 @@ class Like extends Controller { intval($ch[0]['channel_id']), dbesc($observer['xchan_hash']), dbesc($activity), - dbesc(($tgttype) ? $tgttype : $objtype), + dbesc(($tgttype) ? $tgttype : $obj_type), dbesc($obj_id) ); @@ -446,10 +446,10 @@ class Like extends Controller { if ($item['obj_type'] === ACTIVITY_OBJ_EVENT) $post_type = t('event'); - $objtype = (($item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE); + $obj_type = (($item['resource_type'] === 'photo') ? ACTIVITY_OBJ_PHOTO : ACTIVITY_OBJ_NOTE); - if ($objtype === ACTIVITY_OBJ_NOTE && (!intval($item['item_thread_top']))) - $objtype = ACTIVITY_OBJ_COMMENT; + if ($obj_type === ACTIVITY_OBJ_NOTE && (!intval($item['item_thread_top']))) + $obj_type = ACTIVITY_OBJ_COMMENT; $object = json_encode(Activity::fetch_item(['id' => $item['mid']])); @@ -508,7 +508,7 @@ class Like extends Controller { $allow_gid = $item['allow_gid']; $deny_cid = $item['deny_cid']; $deny_gid = $item['deny_gid']; - $private = $item['private']; + $private = $item['item_private']; } @@ -533,7 +533,7 @@ class Like extends Controller { } $arr['verb'] = $activity; - $arr['obj_type'] = $objtype; + $arr['obj_type'] = $obj_type; $arr['obj'] = $object; if ($target) { @@ -569,7 +569,7 @@ class Like extends Controller { intval($post_id), dbesc($arr['mid']), dbesc($activity), - dbesc(($tgttype) ? $tgttype : $objtype), + dbesc(($tgttype) ? $tgttype : $obj_type), dbesc($obj_id), dbesc(($target) ? $target : $object) ); @@ -578,7 +578,7 @@ class Like extends Controller { dbesc($ch[0]['channel_hash']), dbesc($arr['mid']), dbesc($activity), - dbesc(($tgttype) ? $tgttype : $objtype), + dbesc(($tgttype) ? $tgttype : $obj_type), dbesc($obj_id) ); if ($r) -- cgit v1.2.3