From 2306b949f2aca993e33d70ff5a4cb219f016b8f5 Mon Sep 17 00:00:00 2001 From: Michael Date: Mon, 23 Dec 2019 14:30:48 +0000 Subject: [PATCH] Partly reworked, part 2 --- src/Network/Probe.php | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/src/Network/Probe.php b/src/Network/Probe.php index fe7a25a05f..fdce426963 100644 --- a/src/Network/Probe.php +++ b/src/Network/Probe.php @@ -645,7 +645,7 @@ class Probe $result = self::diaspora($webfinger); } if ((!$result && ($network == "")) || ($network == Protocol::OSTATUS)) { - $result = self::ostatus($webfinger, false); + $result = self::ostatus($webfinger); } // if (in_array($network, ['', Protocol::ZOT])) { // $result = self::zot($webfinger, $result); @@ -654,7 +654,7 @@ class Probe $result = self::pumpio($webfinger, $addr); } if ((!$result && ($network == "")) || ($network == Protocol::FEED)) { - $result = self::feed($uri, true); + $result = self::feed($uri); } else { // We overwrite the detected nick with our try if the previois routines hadn't detected it. // Additionally it is overwritten when the nickname doesn't make sense (contains spaces). @@ -1294,7 +1294,6 @@ class Probe private static function diaspora($webfinger) { $hcard_url = ""; - $data = []; // The array is reversed to take into account the order of preference for same-rel links @@ -1345,6 +1344,10 @@ class Probe // Fetch further information from the hcard $data = self::pollHcard($hcard_url, $data); + if (!$data) { + return false; + } + if (!empty($data["url"]) && !empty($data["guid"]) && !empty($data["baseurl"]) @@ -1361,6 +1364,8 @@ class Probe // We have to overwrite the detected value for "notify" since Hubzilla doesn't send it $data["notify"] = $data["baseurl"] . "/receive/users/" . $data["guid"]; $data["batch"] = $data["baseurl"] . "/receive/public"; + } else { + return false; } return $data; @@ -1419,11 +1424,7 @@ class Probe $curlResult = Network::curl($pubkey); if ($curlResult->isTimeout()) { self::$istimeout = true; - if ($short) { - return false; - } else { - return $data; - } + return false; } $pubkey = $curlResult->getBody(); } @@ -1444,10 +1445,8 @@ class Probe && isset($data["url"]) ) { $data["network"] = Protocol::OSTATUS; - } elseif ($short) { - return false; } else { - return $data; + return false; } if ($short) { @@ -1458,7 +1457,7 @@ class Probe $curlResult = Network::curl($data["poll"]); if ($curlResult->isTimeout()) { self::$istimeout = true; - return $data; + return false; } $feed = $curlResult->getBody(); $dummy1 = null; @@ -1466,7 +1465,7 @@ class Probe $dummy2 = null; $feed_data = Feed::import($feed, $dummy1, $dummy2, $dummy3, true); if (!$feed_data) { - return $data; + return false; } if (!empty($feed_data["header"]["author-name"])) {