baseurl should now be set correctly at all the time.

This commit is contained in:
Michael 2017-03-23 07:10:22 +00:00
parent 26ec56dfa5
commit c25af197c9
1 changed files with 14 additions and 1 deletions

View File

@ -18,6 +18,8 @@ require_once('include/network.php');
*/ */
class Probe { class Probe {
private static $baseurl;
/** /**
* @brief Rearrange the array so that it always has the same order * @brief Rearrange the array so that it always has the same order
* *
@ -57,6 +59,8 @@ class Probe {
$ssl_url = "https://".$host."/.well-known/host-meta"; $ssl_url = "https://".$host."/.well-known/host-meta";
$url = "http://".$host."/.well-known/host-meta"; $url = "http://".$host."/.well-known/host-meta";
$baseurl = "http://".$host;
$xrd_timeout = Config::get('system','xrd_timeout', 20); $xrd_timeout = Config::get('system','xrd_timeout', 20);
$redirects = 0; $redirects = 0;
@ -102,6 +106,9 @@ class Probe {
elseif ($attributes["rel"] == "lrdd") elseif ($attributes["rel"] == "lrdd")
$xrd_data["lrdd"] = $attributes["template"]; $xrd_data["lrdd"] = $attributes["template"];
} }
self::$baseurl = $baseurl;
return $xrd_data; return $xrd_data;
} }
@ -258,8 +265,13 @@ class Probe {
$data['nick'] = trim(substr($data['nick'], 0, strpos($data['nick'], ' '))); $data['nick'] = trim(substr($data['nick'], 0, strpos($data['nick'], ' ')));
} }
if (!isset($data["network"])) if (self::$baseurl != "") {
$data["baseurl"] = self::$baseurl;
}
if (!isset($data["network"])) {
$data["network"] = NETWORK_PHANTOM; $data["network"] = NETWORK_PHANTOM;
}
$data = self::rearrange_data($data); $data = self::rearrange_data($data);
@ -286,6 +298,7 @@ class Probe {
dbesc(normalise_link($data['url'])) dbesc(normalise_link($data['url']))
); );
} }
return $data; return $data;
} }