]> git.mxchange.org Git - friendica.git/commitdiff
validate_url allow naked subdomain if is "localhost"
authorFabio Comuni <fabrix.xm@gmail.com>
Fri, 13 Apr 2012 07:42:53 +0000 (09:42 +0200)
committerFabio Comuni <fabrix.xm@gmail.com>
Fri, 13 Apr 2012 07:42:53 +0000 (09:42 +0200)
include/network.php

index 23ef50b21bd34095a68de6386bda7d180bf84bcf..8c678a443a6b9840b122a123b6435af8be2312cb 100644 (file)
@@ -587,13 +587,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;
        }