aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Comuni <fabrix.xm@gmail.com>2012-04-13 09:42:53 +0200
committerFabio Comuni <fabrix.xm@gmail.com>2012-04-13 09:42:53 +0200
commit67a2d5be771514b17b3f96979e7c2c350aa24778 (patch)
tree9a19bbe6e4b2dc7a5a3139ab707f925b82a435a8
parent60871555f539caec07f2dcfe37f11fc090bac1be (diff)
downloadvolse-hubzilla-67a2d5be771514b17b3f96979e7c2c350aa24778.tar.gz
volse-hubzilla-67a2d5be771514b17b3f96979e7c2c350aa24778.tar.bz2
volse-hubzilla-67a2d5be771514b17b3f96979e7c2c350aa24778.zip
validate_url allow naked subdomain if is "localhost"
-rw-r--r--include/network.php7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/network.php b/include/network.php
index 23ef50b21..8c678a443 100644
--- a/include/network.php
+++ b/include/network.php
@@ -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;
}