]> git.mxchange.org Git - friendica.git/blobdiff - include/Scrape.php
add doxygen to config functions
[friendica.git] / include / Scrape.php
index 84257f4811aac6e3d132af29475475c82ddd17df..a26576a69ec5257182c839e846cd59ac1238c266 100644 (file)
@@ -596,7 +596,7 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
        if($diaspora && $diaspora_base && $diaspora_guid) {
                $diaspora_notify = $diaspora_base.'receive/users/'.$diaspora_guid;
 
-               if($mode == PROBE_DIASPORA || ! $notify || ($notify == $diaspora_notify)) {
+               if($mode == PROBE_DIASPORA || !$notify || ($notify == $diaspora_notify)) {
                        $notify = $diaspora_notify;
                        $batch  = $diaspora_base . 'receive/public' ;
                }
@@ -799,6 +799,9 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
        if (substr($baseurl, -10) == "/index.php")
                $baseurl = str_replace("/index.php", "", $baseurl);
 
+       if ($network == "")
+               $network = NETWORK_PHANTOM;
+
        $baseurl = rtrim($baseurl, "/");
 
        if(strpos($url,'@') AND ($addr == "") AND ($network == NETWORK_DFRN))
@@ -832,7 +835,7 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
                        require_once('include/bbcode.php');
                        $address = GetProfileUsername($url, "", true);
                        $result2 = probe_url($address, $mode, ++$level);
-                       if ($result2['network'] != "")
+                       if (!in_array($result2['network'], array("", NETWORK_PHANTOM, NETWORK_FEED)))
                                $result = $result2;
                }
 
@@ -840,13 +843,25 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
                if (($result['network'] == NETWORK_FEED) AND ($result['baseurl'] != "") AND ($result['nick'] != "")) {
                        $addr = $result['nick'].'@'.str_replace("http://", "", $result['baseurl']);
                        $result2 = probe_url($addr, $mode, ++$level);
-                       if (($result2['network'] != "") AND ($result2['network'] != NETWORK_FEED))
+                       if (!in_array($result2['network'], array("", NETWORK_PHANTOM, NETWORK_FEED)))
+                               $result = $result2;
+               }
+
+               // Quickfix for Hubzilla systems with enabled OStatus plugin
+               if (($result['network'] == NETWORK_DIASPORA) AND ($result["batch"] == "")) {
+                       $result2 = probe_url($url, PROBE_DIASPORA, ++$level);
+                       if ($result2['network'] == NETWORK_DIASPORA) {
+                               $addr = $result["addr"];
                                $result = $result2;
+
+                               if (($result["addr"] == "") AND ($addr != ""))
+                                       $result["addr"] = $addr;
+                       }
                }
        }
 
        // Only store into the cache if the value seems to be valid
-       if (!in_array($result['network'], array(NETWORK_PHANTOM, ""))) {
+       if ($result['network'] != NETWORK_PHANTOM) {
                Cache::set("probe_url:".$mode.":".$original_url,serialize($result), CACHE_DAY);
 
                /// @todo temporary fix - we need a real contact update function that updates only changing fields