reduce code - unnecessary complicated

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2015-02-15 07:54:34 +01:00
parent 1581e08594
commit 2382f526b2

View File

@@ -441,19 +441,12 @@ if ($page == 'admins'
} else {
$ipaddress = makeoption($lng['admin']['allips'], "-1");
$ips = array();
$ipsandports_stmt = Database::query("
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip`, `port` ASC
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip` ASC
");
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row['ip'] = '[' . $row['ip'] . ']';
}
if (!in_array($row['ip'], $ips)) {
$ipaddress.= makeoption($row['ip'], $row['id']);
$ips[] = $row['ip'];
}
$ipaddress.= makeoption($row['ip'], $row['id']);
}
$admin_add_data = include_once dirname(__FILE__).'/lib/formfields/admin/formfield.admin.php';
@@ -767,19 +760,12 @@ if ($page == 'admins'
$result['email'] = $idna_convert->decode($result['email']);
$ipaddress = makeoption($lng['admin']['allips'], "-1", $result['ip']);
$ips = array();
$ipsandports_stmt = Database::query("
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip`, `port` ASC
SELECT `id`, `ip` FROM `" . TABLE_PANEL_IPSANDPORTS . "` GROUP BY `ip` ORDER BY `ip`, `port` ASC
");
while ($row = $ipsandports_stmt->fetch(PDO::FETCH_ASSOC)) {
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row['ip'] = '[' . $row['ip'] . ']';
}
if (!in_array($row['ip'], $ips)) {
$ipaddress.= makeoption($row['ip'], $row['id'], $result['ip']);
$ips[] = $row['ip'];
}
$ipaddress.= makeoption($row['ip'], $row['id'], $result['ip']);
}
$result = htmlentities_array($result);