Remove usage of each() (obsolete since PHP 7.2)

This commit is contained in:
SimpleRezo 2020-05-02 13:18:54 +02:00
parent f55ba784c8
commit 4a1eb26eaa
10 changed files with 612 additions and 622 deletions

View file

@ -61,7 +61,7 @@ class at_handler
if (isset($reg['domain']['descr'])) if (isset($reg['domain']['descr']))
{ {
while (list($key, $val) = each($reg['domain']['descr'])) foreach ($reg['domain']['descr'] as $key => $val)
{ {
$v = trim(substr(strstr($val, ':'), 1)); $v = trim(substr(strstr($val, ':'), 1));
if (strstr($val, '[organization]:')) if (strstr($val, '[organization]:'))
@ -99,4 +99,3 @@ class at_handler
return $r; return $r;
} }
} }
?>

File diff suppressed because it is too large Load diff

View file

@ -48,7 +48,7 @@ class fastdomain_handler
'domain.status' => 'Status:' 'domain.status' => 'Status:'
); );
while (list($key, $val) = each($data_str)) foreach ($data_str as $key => $val)
{ {
$faststr = strpos($val, ' (FAST-'); $faststr = strpos($val, ' (FAST-');
if ($faststr) if ($faststr)
@ -75,4 +75,3 @@ class fastdomain_handler
return $r; return $r;
} }
} }
?>

View file

@ -65,7 +65,7 @@ array_splice($data_str['rawdata'],18,1);
if (isset($reg['domain']['descr:'])) if (isset($reg['domain']['descr:']))
{ {
while (list($key, $val) = each($reg['domain']['descr:'])) foreach ($reg['domain']['descr:'] as $key => $val)
{ {
$v = trim(substr(strstr($val, ':'), 1)); $v = trim(substr(strstr($val, ':'), 1));
if (strstr($val, '[organization]:')) if (strstr($val, '[organization]:'))
@ -103,4 +103,3 @@ array_splice($data_str['rawdata'],18,1);
return $r; return $r;
} }
} }
?>

View file

@ -60,7 +60,7 @@ class afrinic_handler
} }
if (isset($r['owner']['remarks']) && is_array($r['owner']['remarks'])) if (isset($r['owner']['remarks']) && is_array($r['owner']['remarks']))
while (list($key, $val) = each($r['owner']['remarks'])) foreach ($r['owner']['remarks'] as $key => $val)
{ {
$pos = strpos($val,'rwhois://'); $pos = strpos($val,'rwhois://');
@ -74,4 +74,3 @@ class afrinic_handler
return $r; return $r;
} }
} }
?>

View file

@ -74,7 +74,7 @@ class apnic_handler
$r['registered'] = 'yes'; $r['registered'] = 'yes';
while (list($key,$val) = each($contacts)) foreach ($contacts as $key => $val)
if (isset($rb[$key])) if (isset($rb[$key]))
{ {
if (is_array($rb[$key])) if (is_array($rb[$key]))
@ -120,4 +120,3 @@ class apnic_handler
return $r; return $r;
} }
} }
?>

View file

@ -43,7 +43,7 @@ class nu_handler
'handle' => 'Record ID:' 'handle' => 'Record ID:'
); );
while (list($key, $val) = each($data_str['rawdata'])) foreach ($data_str['rawdata'] as $key => $val)
{ {
$val = trim($val); $val = trim($val);
@ -51,7 +51,7 @@ class nu_handler
{ {
if ($val == 'Domain servers in listed order:') if ($val == 'Domain servers in listed order:')
{ {
while (list($key, $val) = each($data_str['rawdata'])) foreach ($data_str['rawdata'] as $key => $val)
{ {
$val = trim($val); $val = trim($val);
if ($val == '') if ($val == '')
@ -63,7 +63,7 @@ class nu_handler
reset($items); reset($items);
while (list($field, $match) = each($items)) foreach ($items as $field => $match)
if (strstr($val, $match)) if (strstr($val, $match))
{ {
$r['regrinfo']['domain'][$field] = trim(substr($val, strlen($match))); $r['regrinfo']['domain'][$field] = trim(substr($val, strlen($match)));
@ -87,4 +87,3 @@ class nu_handler
return $r; return $r;
} }
} }
?>

View file

@ -43,7 +43,7 @@ if (empty($blocks) || !is_array($blocks['main']))
$r = $blocks['main']; $r = $blocks['main'];
$ret['registered'] = 'yes'; $ret['registered'] = 'yes';
while (list($key,$val) = each($contacts)) foreach ($contacts as $key => $val)
if (isset($r[$key])) if (isset($r[$key]))
{ {
if (is_array($r[$key])) if (is_array($r[$key]))
@ -74,7 +74,7 @@ $blocks = false;
$gkey = 'main'; $gkey = 'main';
$dend = false; $dend = false;
while (list($key,$val)=each($rawdata)) foreach ($rawdata as $key => $val)
{ {
$val=trim($val); $val=trim($val);
@ -341,7 +341,7 @@ if (!$items)
$r = []; $r = [];
$disok = true; $disok = true;
while (list($key,$val) = each($rawdata)) foreach ($rawdata as $key => $val)
{ {
if (trim($val) != '') if (trim($val) != '')
{ {
@ -427,7 +427,7 @@ function get_blocks ( $rawdata, $items, $partial_match = false, $def_block = fal
$r = array(); $r = array();
$endtag = ''; $endtag = '';
while (list($key,$val) = each($rawdata)) foreach ($rawdata as $key => $val)
{ {
$val = trim($val); $val = trim($val);
if ($val == '') continue; if ($val == '') continue;
@ -475,7 +475,7 @@ while (list($key,$val) = each($rawdata))
// Block found, get data ... // Block found, get data ...
while (list($key,$val) = each($rawdata)) foreach ($rawdata as $key => $val)
{ {
$val = trim($val); $val = trim($val);
@ -633,7 +633,7 @@ while (list($key,$val)=each($array))
reset($items); reset($items);
$ok = false; $ok = false;
while (list($match,$field) = each($items)) foreach ($items as $match => $field)
{ {
$pos = strpos(strtolower($val),$match); $pos = strpos(strtolower($val),$match);
@ -847,7 +847,7 @@ while (!$ok)
reset($res); reset($res);
$ok = true; $ok = true;
while (list($key, $val) = each($res)) foreach ($res as $key => $val)
{ {
if ($val == '' || $key == '') continue; if ($val == '' || $key == '') continue;
@ -884,4 +884,3 @@ else
return sprintf("%.4d-%02d-%02d",$res['y'],$res['m'],$res['d']); return sprintf("%.4d-%02d-%02d",$res['y'],$res['m'],$res['d']);
} }
?>

View file

@ -112,8 +112,8 @@ class utils extends Whois {
if (is_array($nserver)) if (is_array($nserver))
{ {
reset($nserver); reset($nserver);
while (list($host, $ip) = each($nserver)) foreach ($nserver as $host => $ip)
{ {
$url = '<a href="'. str_replace('$0',$ip,$link)."\">$host</a>"; $url = '<a href="'. str_replace('$0',$ip,$link)."\">$host</a>";
$out = str_replace($host, $url, $out); $out = str_replace($host, $url, $out);
@ -149,4 +149,3 @@ else
return '<a href="'.$url.'" target="_blank">'.$web.'</a>'; return '<a href="'.$url.'" target="_blank">'.$web.'</a>';
} }
?>

View file

@ -50,7 +50,7 @@ class zanet_handler
$rawdata = array(); $rawdata = array();
while (list($key, $line) = each($data_str['rawdata'])) foreach ($data_str['rawdata'] as $key => $line)
{ {
if (strpos($line, ' Contact ') !== false) if (strpos($line, ' Contact ') !== false)
{ {
@ -87,4 +87,3 @@ class zanet_handler
return $r; return $r;
} }
} }
?>