]> git.mxchange.org Git - friendica.git/blobdiff - include/network.php
Merge remote branch 'upstream/master'
[friendica.git] / include / network.php
index 23ef50b21bd34095a68de6386bda7d180bf84bcf..4bec4a172778db2c1c452b937787fe25a9f7aaac 100644 (file)
@@ -172,7 +172,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
         $url_parsed = @parse_url($newurl);
         if (isset($url_parsed)) {
             $redirects++;
-            return fetch_url($newurl,$binary,$redirects,$timeout);
+            return fetch_url($newurl,false,$redirects,$timeout);
         }
     }
        $a->set_curl_code($http_code);
@@ -206,6 +206,7 @@ function xml_status($st, $message = '') {
 if(! function_exists('http_status_exit')) {
 function http_status_exit($val) {
 
+    $err = '';
        if($val >= 400)
                $err = 'Error';
        if($val >= 200 && $val < 300)
@@ -452,7 +453,7 @@ function lrdd($uri, $debug = false) {
                        logger('lrdd: parse error: ' . $e);
                }
 
-               if($dom) {
+               if(isset($dom) && $dom) {
                        $items = $dom->getElementsByTagName('link');
                        foreach($items as $item) {
                                $x = $item->getAttribute('rel');
@@ -587,13 +588,14 @@ function fetch_xrd_links($url) {
 
 if(! function_exists('validate_url')) {
 function validate_url(&$url) {
-       // no naked subdomains
-       if(strpos($url,'.') === false)
+       
+       // no naked subdomains (allow localhost for tests)
+       if(strpos($url,'.') === false && strpos($url,'/localhost/') === false)
                return false;
        if(substr($url,0,4) != 'http')
                $url = 'http://' . $url;
        $h = @parse_url($url);
-
+       
        if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR))) {
                return true;
        }