]> git.mxchange.org Git - friendica.git/commitdiff
baseurl should now be set correctly at all the time.
authorMichael <heluecht@pirati.ca>
Thu, 23 Mar 2017 07:10:22 +0000 (07:10 +0000)
committerMichael <heluecht@pirati.ca>
Thu, 23 Mar 2017 07:10:22 +0000 (07:10 +0000)
include/Probe.php

index 1b6feb107f4d32cf260da732dac770b64247790d..929e89a68ade48d4cca41f3b6ae84734261b11f1 100644 (file)
@@ -18,6 +18,8 @@ require_once('include/network.php');
  */
 class Probe {
 
+       private static $baseurl;
+
        /**
         * @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";
                $url = "http://".$host."/.well-known/host-meta";
 
+               $baseurl = "http://".$host;
+
                $xrd_timeout = Config::get('system','xrd_timeout', 20);
                $redirects = 0;
 
@@ -102,6 +106,9 @@ class Probe {
                        elseif ($attributes["rel"] == "lrdd")
                                $xrd_data["lrdd"] = $attributes["template"];
                }
+
+               self::$baseurl = $baseurl;
+
                return $xrd_data;
        }
 
@@ -258,8 +265,13 @@ class Probe {
                                $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 = self::rearrange_data($data);
 
@@ -286,6 +298,7 @@ class Probe {
                                        dbesc(normalise_link($data['url']))
                        );
                }
+
                return $data;
        }