remove some unused functions and migrated some more functions to PDO database class, refs #1287

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2013-11-14 08:27:57 +01:00
parent 868b472b98
commit 12800b730d
23 changed files with 326 additions and 500 deletions

View File

@@ -17,24 +17,22 @@
*
*/
function getIpAddresses()
{
global $db, $theme;
$query = 'SELECT `id`, `ip`, `port` FROM `' . TABLE_PANEL_IPSANDPORTS . '` ORDER BY `ip` ASC, `port` ASC';
$result = $db->query($query);
function getIpAddresses() {
$result_stmt = Database::query("
SELECT `id`, `ip`, `port` FROM `" . TABLE_PANEL_IPSANDPORTS . "` ORDER BY `ip` ASC, `port` ASC
");
$system_ipaddress_array = array();
while($row = $db->fetch_array($result))
{
if(!isset($system_ipaddress_array[$row['ip']])
&& !in_array($row['ip'], $system_ipaddress_array))
{
if(filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6))
{
while ($row = $result_stmt->fetch(PDO::FETCH_ASSOC)) {
if (!isset($system_ipaddress_array[$row['ip']])
&& !in_array($row['ip'], $system_ipaddress_array)
) {
if (filter_var($row['ip'], FILTER_VALIDATE_IP, FILTER_FLAG_IPV6)) {
$row['ip'] = '[' . $row['ip'] . ']';
}
$system_ipaddress_array[$row['ip']] = $row['ip'];
}
}