diff options
author | Max Kostikov <max@kostikov.co> | 2021-05-14 08:56:06 +0000 |
---|---|---|
committer | Mario <mario@mariovavti.com> | 2021-05-14 08:56:06 +0000 |
commit | a03423794a1a9dc15588d40684fee3bf9a57b629 (patch) | |
tree | 072ef73577b3ecefcc85f26c7db41166ffbd3d49 | |
parent | f085c3c98f834bc4e3906c456f1447de2e955118 (diff) | |
download | volse-hubzilla-a03423794a1a9dc15588d40684fee3bf9a57b629.tar.gz volse-hubzilla-a03423794a1a9dc15588d40684fee3bf9a57b629.tar.bz2 volse-hubzilla-a03423794a1a9dc15588d40684fee3bf9a57b629.zip |
Random PHP 8 fixes
-rw-r--r-- | Zotlabs/Module/Magic.php | 3 | ||||
-rw-r--r-- | Zotlabs/Module/Photos.php | 8 | ||||
-rw-r--r-- | Zotlabs/Module/Sse.php | 3 | ||||
-rw-r--r-- | include/channel.php | 5 | ||||
-rw-r--r-- | include/feedutils.php | 14 | ||||
-rw-r--r-- | include/opengraph.php | 2 |
6 files changed, 21 insertions, 14 deletions
diff --git a/Zotlabs/Module/Magic.php b/Zotlabs/Module/Magic.php index b4372e26d..bfd38d2fa 100644 --- a/Zotlabs/Module/Magic.php +++ b/Zotlabs/Module/Magic.php @@ -40,7 +40,7 @@ class Magic extends Controller { goaway($dest); } - $basepath = $parsed['scheme'] . '://' . $parsed['host'] . (($parsed['port']) ? ':' . $parsed['port'] : ''); + $basepath = $parsed['scheme'] . '://' . $parsed['host'] . (isset($parsed['port']) ? ':' . $parsed['port'] : ''); $owapath = SConfig::get($basepath,'system','openwebauth', $basepath . '/owa'); // This is ready-made for a plugin that provides a blacklist or "ask me" before blindly authenticating. @@ -110,6 +110,7 @@ class Magic extends Controller { $headers['(request-target)'] = 'post ' . '/owa'; $headers = HTTPSig::create_sig($headers,$channel['channel_prvkey'], channel_url($channel),true,'sha512'); + $redirects = 0; $x = z_post_url($owapath,$data,$redirects,[ 'headers' => $headers ]); logger('owa fetch returned: ' . print_r($x,true),LOGGER_DATA); if ($x['success']) { diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php index 099289c03..e62accb06 100644 --- a/Zotlabs/Module/Photos.php +++ b/Zotlabs/Module/Photos.php @@ -876,7 +876,7 @@ class Photos extends \Zotlabs\Web\Controller { $prevlink = ''; $nextlink = ''; - if($_GET['order'] === 'posted') + if(isset($_GET['order']) && $_GET['order'] === 'posted') $order = 'ASC'; else $order = 'DESC'; @@ -901,8 +901,8 @@ class Photos extends \Zotlabs\Web\Controller { } } - $prevlink = z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['hash'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); - $nextlink = z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['hash'] . (($_GET['order'] === 'posted') ? '?f=&order=posted' : ''); + $prevlink = z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/image/' . $prvnxt[$prv]['hash'] . (($order == 'ASC') ? '?f=&order=posted' : ''); + $nextlink = z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/image/' . $prvnxt[$nxt]['hash'] . (($order == 'ASC') ? '?f=&order=posted' : ''); } @@ -987,7 +987,7 @@ class Photos extends \Zotlabs\Web\Controller { } $tags = array(); - if($link_item['term']) { + if(x($link_item, 'term')) { $cnt = 0; foreach($link_item['term'] as $t) { $tags[$cnt] = array(0 => format_term_for_display($t)); diff --git a/Zotlabs/Module/Sse.php b/Zotlabs/Module/Sse.php index 8bea65207..6f3df299f 100644 --- a/Zotlabs/Module/Sse.php +++ b/Zotlabs/Module/Sse.php @@ -108,7 +108,8 @@ class Sse extends Controller { echo 'data: {}'; echo "\n\n"; - ob_end_flush(); + if(ob_get_length() > 0) + ob_end_flush(); flush(); if(connection_status() != CONNECTION_NORMAL || connection_aborted()) { diff --git a/include/channel.php b/include/channel.php index 31c7c407f..e636a22d6 100644 --- a/include/channel.php +++ b/include/channel.php @@ -1516,8 +1516,11 @@ function profile_load($nickname, $profile = '') { if($p[0]['keywords']) { $keywords = str_replace(array('#',',',' ',',,'),array('',' ',',',','),$p[0]['keywords']); - if(strlen($keywords) && $can_view_profile) + if(strlen($keywords) && $can_view_profile) { + if(! isset(App::$page['htmlhead'])) + App::$page['htmlhead'] = ''; App::$page['htmlhead'] .= '<meta name="keywords" content="' . htmlentities($keywords,ENT_COMPAT,'UTF-8') . '" />' . "\r\n" ; + } } App::$profile = $p[0]; diff --git a/include/feedutils.php b/include/feedutils.php index e827bde98..f489030b6 100644 --- a/include/feedutils.php +++ b/include/feedutils.php @@ -296,7 +296,7 @@ function get_atom_author($feed, $item) { $rawauthor = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'author'); - if($rawauthor && $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { + if($rawauthor && isset($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'])) { $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; foreach($base as $link) { if(!x($author, 'author_photo') || ! $author['author_photo']) { @@ -336,7 +336,7 @@ function get_atom_author($feed, $item) { 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']) { + if($rawauthor && isset($rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'])) { $base = $rawauthor[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; foreach($base as $link) { if($link['attribs']['']['rel'] === 'alternate' && (! $author['author_link'])) { @@ -372,16 +372,16 @@ function get_atom_author($feed, $item) { if(! $rawowner) $rawowner = $item->get_item_tags(NAMESPACE_ZOT, 'owner'); - if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']) + if(isset($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data'])) $author['owner_name'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['name'][0]['data']); - elseif($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data']) + elseif(isset($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data'])) $author['owner_name'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['name'][0]['data']); - if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']) + if(isset($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data'])) $author['owner_link'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['uri'][0]['data']); - elseif($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']) + elseif(isset($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data'])) $author['owner_link'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']); - if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']) { + if(isset($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'])) { $base = $rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link']; foreach($base as $link) { diff --git a/include/opengraph.php b/include/opengraph.php index 4c88570d3..465acbd39 100644 --- a/include/opengraph.php +++ b/include/opengraph.php @@ -62,6 +62,8 @@ $ogimagetype = $channel['xchan_photo_mimetype']; } + if (! isset(App::$page['htmlhead'])) + App::$page['htmlhead'] = ''; App::$page['htmlhead'] .= '<meta property="og:title" content="' . htmlspecialchars((isset($ogtitle) ? $ogtitle : $channel['channel_name'])) . '">' . "\r\n"; App::$page['htmlhead'] .= '<meta property="og:image" content="' . $ogimage . '">' . "\r\n"; App::$page['htmlhead'] .= '<meta property="og:image:type" content="' . $ogimagetype . '">' . "\r\n"; |