From cd97c32444b617331aca135529b568374b9117e7 Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Sun, 18 Apr 2021 21:25:32 +0200 Subject: more PHP 8 fixes --- include/feedutils.php | 17 +++++++++-------- include/text.php | 10 +++++----- 2 files changed, 14 insertions(+), 13 deletions(-) (limited to 'include') diff --git a/include/feedutils.php b/include/feedutils.php index 6cae14a01..e827bde98 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -324,7 +324,7 @@ function get_atom_author($feed, $item) { // check for a yahoo media element (github etc.) - if(! $author['author_photo']) { + if(! x($author,'author_photo') || ! $author['author_photo']) { $rawmedia = $item->get_item_tags(NAMESPACE_YMEDIA,'thumbnail'); if($rawmedia && $rawmedia[0]['attribs']['']['url']) { $author['author_photo'] = strip_tags(unxmlify($rawmedia[0]['attribs']['']['url'])); @@ -334,7 +334,7 @@ function get_atom_author($feed, $item) { // No photo/profile-link on the item - look at the feed level - if((! (x($author,'author_link'))) || (! (x($author,'author_photo')))) { + if(! x($author,'author_link') || ! x($author,'author_photo')) { $rawauthor = $feed->get_feed_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'author'); if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; @@ -478,13 +478,13 @@ function get_atom_elements($feed, $item) { if($rawedited) $res['edited'] = unxmlify($rawedited[0]['data']); - if((x($res,'edited')) && (! (x($res,'created')))) + if(x($res,'edited') && ! x($res,'created')) $res['created'] = $res['edited']; - if(! $res['created']) + if(! x($res,'created')) $res['created'] = $item->get_date('c'); - if(! $res['edited']) + if(! x($res,'edited')) $res['edited'] = $item->get_date('c'); $rawverb = $item->get_item_tags(NAMESPACE_ACTIVITY, 'verb'); @@ -509,7 +509,7 @@ function get_atom_elements($feed, $item) { } } - $ostatus_protocol = (($ostatus_conversation || $res['verb']) ? true : false); + $ostatus_protocol = ($ostatus_conversation || (x($res,'verb') && $res['verb']) ? true : false); $mastodon = (($item->get_item_tags('http://mastodon.social/schema/1.0','scope')) ? true : false); if($mastodon) { @@ -1113,7 +1113,8 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { $parent_link = $rawthread[0]['attribs']['']['href']; } - logger('in-reply-to: ' . $parent_mid, LOGGER_DEBUG); + if(isset($parent_mid)) + logger('in-reply-to: ' . $parent_mid, LOGGER_DEBUG); if($is_reply) { @@ -1408,7 +1409,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) { // if we have everything but a photo, provide the default profile photo - if($author['author_name'] && $author['author_link'] && (! $author['author_photo'])) + if($author['author_name'] && $author['author_link'] && (! x($author,'author_photo') || ! $author['author_photo'])) $author['author_photo'] = z_root() . '/' . get_default_profile_photo(80); if(is_array($contact)) { diff --git a/include/text.php b/include/text.php index 749e1fd70..622c44f14 100644 --- a/include/text.php +++ b/include/text.php @@ -1108,7 +1108,7 @@ function magiclink_url($observer,$myaddr,$url) { function micropro($contact, $redirect = false, $class = '', $mode = false) { - if($contact['click']) + if(x($contact,'click')) $url = '#'; else $url = chanlink_hash($contact['xchan_hash']); @@ -1121,10 +1121,10 @@ function micropro($contact, $redirect = false, $class = '', $mode = false) { $tpl = 'micropro_card.tpl'; return replace_macros(get_markup_template($tpl), array( - '$click' => (($contact['click']) ? $contact['click'] : ''), - '$class' => $class . (($contact['archived']) ? ' archived' : ''), - '$oneway' => (($contact['oneway']) ? true : false), - '$perminfo' => $contact['perminfo'], + '$click' => (x($contact,'click') ? $contact['click'] : ''), + '$class' => $class . (x($contact,'archived') && $contact['archived'] ? ' archived' : ''), + '$oneway' => (x($contact,'oneway') && $contact['oneway'] ? true : false), + '$perminfo' => (x($contact,'perminfo') ? $contact['perminfo'] : ''), '$url' => $url, '$photo' => $contact['xchan_photo_s'], '$name' => $contact['xchan_name'], -- cgit v1.2.3