From 11d831e4d7bd4163ea518892f541252ce1acea2e Mon Sep 17 00:00:00 2001 From: Max Kostikov Date: Wed, 10 Mar 2021 11:14:02 +0000 Subject: More PHP 8 fixes --- include/network.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'include/network.php') diff --git a/include/network.php b/include/network.php index f5ff48fce..fcc7b4289 100644 --- a/include/network.php +++ b/include/network.php @@ -1134,11 +1134,15 @@ function discover_by_webbie($webbie, $protocol = '') { foreach($x['links'] as $link) { if(array_key_exists('rel',$link)) { if($link['rel'] === PROTOCOL_ZOT6 && ((! $protocol) || (strtolower($protocol) === 'zot6'))) { + logger('zot6 found for ' . $webbie, LOGGER_DEBUG); $record = Zotfinger::exec($link['href']); + if (! $record) { + logger('Record not found for ' . $link['href']); + continue; + } // Check the HTTP signature - $hsig = $record['signature']; if($hsig && $hsig['signer'] === $link['href'] && $hsig['header_valid'] === true && $hsig['content_valid'] === true) $hsig_valid = true; @@ -1226,7 +1230,7 @@ function webfinger_rfc7033($webbie, $zot = false) { if($m['scheme'] !== 'https') return false; - $rhs = $m['host'] . (($m['port']) ? ':' . $m['port'] : ''); + $rhs = $m['host'] . (array_key_exists('port', $m) ? ':' . $m['port'] : ''); $resource = urlencode($webbie); } } @@ -1957,10 +1961,10 @@ function service_plink($contact, $guid) { $m = parse_url($contact['xchan_url']); if($m) { - $url = $m['scheme'] . '://' . $m['host'] . (($m['port']) ? ':' . $m['port'] : ''); + $url = $m['scheme'] . '://' . $m['host'] . (array_key_exists('port', $m) ? ':' . $m['port'] : ''); } else { - $url = 'https://' . substr($contact['xchan_addr'],strpos($contact['xchan_addr'],'@')+1); + $url = 'https://' . substr($contact['xchan_addr'], strpos($contact['xchan_addr'], '@') + 1); } $handle = substr($contact['xchan_addr'], 0, strpos($contact['xchan_addr'],'@')); -- cgit v1.2.3