]> git.mxchange.org Git - friendica.git/commitdiff
Issue 1913: Report invalid feed
authorMichael Vogel <icarus@dabo.de>
Sat, 3 Oct 2015 22:28:15 +0000 (00:28 +0200)
committerMichael Vogel <icarus@dabo.de>
Sat, 3 Oct 2015 22:28:15 +0000 (00:28 +0200)
include/Scrape.php
include/gprobe.php
include/identity.php
include/socgraph.php
mod/follow.php

index 93d68be22b892af7f95ae34bab506617b443204d..5e26c461aea21c9302e78adf3ee5f58604cc7405 100644 (file)
@@ -652,9 +652,10 @@ function probe_url($url, $mode = PROBE_NORMAL, $level = 1) {
                        $feed->set_raw_data(($xml) ? $xml : '<?xml version="1.0" encoding="utf-8" ?><xml></xml>');
 
                        $feed->init();
-                       if($feed->error())
+                       if($feed->error()) {
                                logger('probe_url: scrape_feed: Error parsing XML: ' . $feed->error());
-
+                               $network = NETWORK_PHANTOM;
+                       }
 
                        if(! x($vcard,'photo'))
                                $vcard['photo'] = $feed->get_image_url();
index 03cdbd072ba6debb9e5e03ef3b5468d2e58a3d10..84292f263affb3fb7d6daed93f566674f20f2e38 100644 (file)
@@ -47,7 +47,7 @@ function gprobe_run(&$argv, &$argc){
                $result = Cache::get("gprobe:".$urlparts["host"]);
                if (!is_null($result)) {
                        $result = unserialize($result);
-                       if ($result["network"] == NETWORK_FEED) {
+                       if (in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
                                logger("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG);
                                return;
                        }
index b4bc79e00f3c5795cfbbc3abcc69d47b08397fca..6faddffd3c0027276b645019de241a1d43cb297c 100644 (file)
@@ -710,7 +710,7 @@ function zrl_init(&$a) {
                $result = Cache::get("gprobe:".$urlparts["host"]);
                if (!is_null($result)) {
                        $result = unserialize($result);
-                       if ($result["network"] == NETWORK_FEED) {
+                       if (in_array($result["network"], array(NETWORK_FEED, NETWORK_PHANTOM))) {
                                logger("DDoS attempt detected for ".$urlparts["host"]." by ".$_SERVER["REMOTE_ADDR"].". server data: ".print_r($_SERVER, true), LOGGER_DEBUG);
                                return;
                        }
index d380af4344e504bce6bba8d4f2dd07903f884a3b..b0f0c8672ff6ddf34da14fa22a4d18ab9cd122b5 100644 (file)
@@ -570,7 +570,7 @@ function poco_last_updated($profile, $force = false) {
                return false;
        }
 
-       if (($data["poll"] == "") OR ($data["network"] == NETWORK_FEED)) {
+       if (($data["poll"] == "") OR (in_array($data["network"], array(NETWORK_FEED, NETWORK_PHANTOM)))) {
                q("UPDATE `gcontact` SET `last_failure` = '%s' WHERE `nurl` = '%s'",
                        dbesc(datetime_convert()), dbesc(normalise_link($profile)));
                return false;
index bdcde774351bbd649f8a3d42da30ff81b3c06c0c..dd717aacd91ad99026513203a4ce6422cf069615 100755 (executable)
@@ -31,6 +31,12 @@ function follow_content(&$a) {
 
        $ret = probe_url($url);
 
+       if ($ret["network"] == NETWORK_PHANTOM) {
+               notice( t("The network type couldn't be detected. Contact can't be added.") . EOL);
+               goaway($_SESSION['return_url']);
+               // NOTREACHED
+       }
+
        if ($ret["network"] == NETWORK_MAIL)
                $ret["url"] = $ret["addr"];