]> git.mxchange.org Git - friendica.git/commitdiff
Workaround for misconfigured Friendica servers
authorMichael Vogel <icarus@dabo.de>
Sun, 6 Dec 2015 17:52:19 +0000 (18:52 +0100)
committerMichael Vogel <icarus@dabo.de>
Sun, 6 Dec 2015 17:52:19 +0000 (18:52 +0100)
include/Scrape.php
mod/noscrape.php

index af90a07506af141ef34fbad327c7c68aad439298..b7df8e04feebdac46e9493eb5cfc1b5e0f3a78c4 100644 (file)
@@ -632,9 +632,7 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
 
                if ($connectornetworks)
                        $check_feed = false;
-
                if($check_feed) {
-
                        $feedret = scrape_feed(($poll) ? $poll : $url);
 
                        logger('probe_url: scrape_feed ' . (($poll)? $poll : $url) . ' returns: ' . print_r($feedret,true), LOGGER_DATA);
@@ -726,6 +724,46 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
                                }
                        }
 
+                       // Workaround for misconfigured Friendica servers
+                       if (($network == "") AND (strstr($url, "/profile/"))) {
+                               $noscrape = str_replace("/profile/", "/noscrape/", $url);
+                               $noscrapejson = fetch_url($noscrape);
+                               if ($noscrapejson) {
+
+                                       $network = NETWORK_DFRN;
+
+                                       $poco = str_replace("/profile/", "/poco/", $url);
+
+                                       $noscrapedata = json_decode($noscrapejson, true);
+
+                                       if (isset($noscrapedata["addr"]))
+                                               $addr = $noscrapedata["addr"];
+
+                                       if (isset($noscrapedata["fn"]))
+                                               $vcard["fn"] = $noscrapedata["fn"];
+
+                                       if (isset($noscrapedata["key"]))
+                                               $pubkey = $noscrapedata["key"];
+
+                                       if (isset($noscrapedata["photo"]))
+                                               $vcard["photo"] = $noscrapedata["photo"];
+
+                                       if (isset($noscrapedata["dfrn-request"]))
+                                               $request = $noscrapedata["dfrn-request"];
+
+                                       if (isset($noscrapedata["dfrn-confirm"]))
+                                               $confirm = $noscrapedata["dfrn-confirm"];
+
+                                       if (isset($noscrapedata["dfrn-notify"]))
+                                               $notify = $noscrapedata["dfrn-notify"];
+
+                                       if (isset($noscrapedata["dfrn-poll"]))
+                                               $poll = $noscrapedata["dfrn-poll"];
+
+//                                     print_r($noscrapedata);
+                               }
+                       }
+
                        if((! $vcard['photo']) && strlen($email))
                                $vcard['photo'] = avatar_img($email);
                        if($poll === $profile)
index 34d5254fc0efe24eac3f31b25ffcbd324116762c..51bd7234cf283a6b63e1d55d5af7e814ec6a589d 100644 (file)
@@ -24,6 +24,7 @@ function noscrape_init(&$a) {
 
        $json_info = array(
                'fn' => $a->profile['name'],
+               'addr' => $a->profile['addr'],
                'key' => $a->profile['pubkey'],
                'homepage' => $a->get_baseurl()."/profile/{$which}",
                'comm' => (x($a->profile,'page-flags')) && ($a->profile['page-flags'] == PAGE_COMMUNITY),