$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);
}
-// if (in_array($network, ['', Protocol::ZOT])) {
-// $result = self::zot($webfinger, $result);
-// }
if ((!$result && ($network == "")) || ($network == Protocol::PUMPIO)) {
$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).
if (empty($zot_url) && !empty($data['addr']) && !empty(self::$baseurl)) {
$condition = ['nurl' => Strings::normaliseLink(self::$baseurl), 'platform' => ['hubzilla']];
if (!DBA::exists('gserver', $condition)) {
- exit;
+ return $data;
}
$zot_url = self::$baseurl . '/.well-known/zot-info?address=' . $data['addr'];
}
- if (!empty($zot_url)) {
- $data = self::pollZot($zot_url, $data);
+ if (empty($zot_url)) {
+ return $data;
+ }
+
+ $data = self::pollZot($zot_url, $data);
+
+ if (!empty($data['url']) && !empty($webfinger['aliases']) && is_array($webfinger['aliases'])) {
+ foreach ($webfinger['aliases'] as $alias) {
+ if (!strstr($alias, '@') && Strings::normaliseLink($alias) != Strings::normaliseLink($data['url'])) {
+ $data['alias'] = $alias;
+ }
+ }
}
return $data;
if (!is_array($json)) {
return $data;
}
-//print_r($json);
+
if (empty($data['network'])) {
if (!empty($json['protocols']) && in_array('zot', $json['protocols'])) {
$data['network'] = Protocol::ZOT;
private static function diaspora($webfinger)
{
$hcard_url = "";
-
$data = [];
// The array is reversed to take into account the order of preference for same-rel links
}
if (empty($data["url"]) || empty($hcard_url)) {
- return $data;
+ return false;
}
if (!empty($webfinger["aliases"]) && is_array($webfinger["aliases"])) {
// 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"])
// 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;
$curlResult = Network::curl($pubkey);
if ($curlResult->isTimeout()) {
self::$istimeout = true;
- if ($short) {
- return false;
- } else {
- return $data;
- }
+ return false;
}
$pubkey = $curlResult->getBody();
}
&& isset($data["url"])
) {
$data["network"] = Protocol::OSTATUS;
- } elseif ($short) {
- return false;
} else {
- return $data;
+ return false;
}
if ($short) {
$curlResult = Network::curl($data["poll"]);
if ($curlResult->isTimeout()) {
self::$istimeout = true;
- return $data;
+ return false;
}
$feed = $curlResult->getBody();
$dummy1 = null;
$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"])) {