validate_url allow naked subdomain if is "localhost"
This commit is contained in:
parent
60871555f5
commit
67a2d5be77
1 changed files with 4 additions and 3 deletions
|
@ -587,13 +587,14 @@ function fetch_xrd_links($url) {
|
||||||
|
|
||||||
if(! function_exists('validate_url')) {
|
if(! function_exists('validate_url')) {
|
||||||
function validate_url(&$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;
|
return false;
|
||||||
if(substr($url,0,4) != 'http')
|
if(substr($url,0,4) != 'http')
|
||||||
$url = 'http://' . $url;
|
$url = 'http://' . $url;
|
||||||
$h = @parse_url($url);
|
$h = @parse_url($url);
|
||||||
|
|
||||||
if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR))) {
|
if(($h) && (dns_get_record($h['host'], DNS_A + DNS_CNAME + DNS_PTR))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue