[fix] serveurList on m_dom.php

This commit is contained in:
alban 2014-03-27 19:08:33 +01:00
parent 6fc53c040d
commit aa9acaa165
1 changed files with 10 additions and 9 deletions

View File

@ -936,6 +936,7 @@ class m_dom {
$egal = "domain = "; $egal = "domain = ";
break; break;
} }
$serveurList = array();
// pour ajouter un nouveau TLD, utiliser le code ci-dessous. // pour ajouter un nouveau TLD, utiliser le code ci-dessous.
// echo "serveur : $serveur <br />"; // echo "serveur : $serveur <br />";
if (($fp = @fsockopen($serveur, 43)) > 0) { if (($fp = @fsockopen($serveur, 43)) > 0) {
@ -958,7 +959,7 @@ class m_dom {
$found = true; $found = true;
$tmp = strtolower(str_replace(chr(10), "", str_replace(chr(13), "", str_replace(" ", "", str_replace("Name Server:", "", $ligne))))); $tmp = strtolower(str_replace(chr(10), "", str_replace(chr(13), "", str_replace(" ", "", str_replace("Name Server:", "", $ligne)))));
if ($tmp) if ($tmp)
$server[] = $tmp; $serveurList[] = $tmp;
} }
break; break;
case "cx": case "cx":
@ -966,7 +967,7 @@ class m_dom {
if ($ligne == "" && $state == 1) if ($ligne == "" && $state == 1)
$state = 2; $state = 2;
if ($state == 1) if ($state == 1)
$server[] = strtolower($ligne); $serveurList[] = strtolower($ligne);
if ($ligne == "Nameservers:" && $state == 0) { if ($ligne == "Nameservers:" && $state == 0) {
$state = 1; $state = 1;
$found = true; $found = true;
@ -978,7 +979,7 @@ class m_dom {
if ($found) if ($found)
$tmp = trim($ligne); $tmp = trim($ligne);
if ($tmp) if ($tmp)
$server[] = $tmp; $serveurList[] = $tmp;
if ($ligne == "Nameservers:") { if ($ligne == "Nameservers:") {
$state = 1; $state = 1;
$found = true; $found = true;
@ -991,7 +992,7 @@ class m_dom {
$tmp = strtolower(preg_replace('/Name Server: ([^ ]+)\..$/', "\\1", $ligne)); $tmp = strtolower(preg_replace('/Name Server: ([^ ]+)\..$/', "\\1", $ligne));
$tmp = preg_replace('/[^-_a-z0-9\.]/', '', $tmp); $tmp = preg_replace('/[^-_a-z0-9\.]/', '', $tmp);
if ($tmp) if ($tmp)
$server[] = $tmp; $serveurList[] = $tmp;
} }
break; break;
case "it": case "it":
@ -999,7 +1000,7 @@ class m_dom {
$found = true; $found = true;
$tmp = strtolower(preg_replace("/nserver:\s*[^ ]*\s*([^\s]*)$/", "\\1", $ligne)); $tmp = strtolower(preg_replace("/nserver:\s*[^ ]*\s*([^\s]*)$/", "\\1", $ligne));
if ($tmp) if ($tmp)
$server[] = $tmp; $serveurList[] = $tmp;
} }
break; break;
case "fr": case "fr":
@ -1008,7 +1009,7 @@ class m_dom {
$found = true; $found = true;
$tmp = strtolower(preg_replace("#nserver:\s*([^\s]*)\s*.*$#", "\\1", $ligne)); $tmp = strtolower(preg_replace("#nserver:\s*([^\s]*)\s*.*$#", "\\1", $ligne));
if ($tmp) if ($tmp)
$server[] = $tmp; $serveurList[] = $tmp;
} }
break; break;
case "ca": case "ca":
@ -1020,14 +1021,14 @@ class m_dom {
if (preg_match('#^[^%]#', $ligne) && $ligne = preg_replace('#[[:space:]]#', "", $ligne)) { if (preg_match('#^[^%]#', $ligne) && $ligne = preg_replace('#[[:space:]]#', "", $ligne)) {
// first non-whitespace line is considered to be the nameservers themselves // first non-whitespace line is considered to be the nameservers themselves
$found = true; $found = true;
$server[] = $ligne; $serveurList[] = $ligne;
} }
} }
break; break;
case "coop": case "coop":
if (preg_match('#Host Name:\s*([^\s]+)#', $ligne, $matches)) { if (preg_match('#Host Name:\s*([^\s]+)#', $ligne, $matches)) {
$found = true; $found = true;
$server[] = $matches[1]; $serveurList[] = $matches[1];
} }
} // switch } // switch
} // while } // while
@ -1038,7 +1039,7 @@ class m_dom {
} }
if ($found) { if ($found) {
return $server; return $serveurList;
} else { } else {
$err->raise("dom", _("The domain cannot be found in the Whois database")); $err->raise("dom", _("The domain cannot be found in the Whois database"));
return false; return false;