]> git.mxchange.org Git - friendica.git/blobdiff - include/network.php
attribution issue - don't take author name from contact if available from item.
[friendica.git] / include / network.php
old mode 100644 (file)
new mode 100755 (executable)
index e89eb94..25db62d
@@ -22,7 +22,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
        }
        
        @curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
-       @curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
+       @curl_setopt($ch, CURLOPT_USERAGENT, "Friendica");
 
 
        if(intval($timeout)) {
@@ -105,7 +105,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
        curl_setopt($ch, CURLOPT_POST,1);
        curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
-       curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
+       curl_setopt($ch, CURLOPT_USERAGENT, "Friendica");
 
        if(intval($timeout)) {
                curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
@@ -535,6 +535,9 @@ function fetch_xrd_links($url) {
        if ((! $xml) || (! stristr($xml,'<xrd')))
                return array();
 
+       // fix diaspora's bad xml
+       $xml = str_replace(array('href=&quot;','&quot;/>'),array('href="','"/>'),$xml);
+
        $h = parse_xml_string($xml);
        if(! $h)
                return array();
@@ -576,6 +579,9 @@ function fetch_xrd_links($url) {
 
 if(! function_exists('validate_url')) {
 function validate_url(&$url) {
+       // no naked subdomains
+       if(strpos($url,'.') === false)
+               return false;
        if(substr($url,0,4) != 'http')
                $url = 'http://' . $url;
        $h = @parse_url($url);