From d4a29c41a503095e8bcfe74a5eed1127eb64eb96 Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Sun, 15 May 2011 15:29:47 +0000 Subject: [PATCH] more db* git-svn-id: http://www.observium.org/svn/observer/trunk@2324 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/pages/device/apps.inc.php | 6 ++-- html/pages/device/ciscosensors.inc.php | 39 ------------------------- html/pages/device/entphysical.inc.php | 8 +++--- html/pages/device/events.inc.php | 7 ++--- html/pages/device/graphs.inc.php | 3 +- html/pages/device/health.inc.php | 22 +++++++------- html/pages/device/hrdevice.inc.php | 10 +++---- html/pages/device/overview.inc.php | 40 +++++++++++--------------- html/pages/device/port.inc.php | 13 ++++----- html/pages/device/ports.inc.php | 11 +++---- html/pages/device/services.inc.php | 7 ++--- html/pages/device/syslog.inc.php | 19 ++++++------ html/pages/device/vlans.inc.php | 3 +- html/pages/device/vm.inc.php | 3 +- 14 files changed, 66 insertions(+), 125 deletions(-) delete mode 100644 html/pages/device/ciscosensors.inc.php diff --git a/html/pages/device/apps.inc.php b/html/pages/device/apps.inc.php index 5200d7870..c65369f5c 100644 --- a/html/pages/device/apps.inc.php +++ b/html/pages/device/apps.inc.php @@ -1,12 +1,10 @@ "); } - echo("" . htmlspecialchars($type) ."\n"); - if ($_GET['opta'] == $type) { echo(""); } - $sep = ' | '; -} - -unset ($sep); - -print_optionbar_end(); - -$query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' and entSensorType = '".$_GET['opta']."' ORDER BY `entPhysicalName`"); -while ($data = mysql_fetch_assoc($query)) -{ - if ($data['entSensorMeasuredEntity']) - { - $measured = mysql_fetch_assoc(mysql_query("SELECT * FROM entPhysical WHERE device_id = '".$device['device_id']."' AND entPhysicalIndex = '".$data['entSensorMeasuredEntity']."'")); - } - - echo("

".$measured['entPhysicalName']." ".$data['entPhysicalName']."

"); - $graph_type = "cisco_entity_sensor"; - $args = "&a=".$data['entPhysical_id']; - - include("includes/print-device-graph.php"); - - echo("
"); -} - -?> \ No newline at end of file diff --git a/html/pages/device/entphysical.inc.php b/html/pages/device/entphysical.inc.php index ea32ae863..b180050e6 100644 --- a/html/pages/device/entphysical.inc.php +++ b/html/pages/device/entphysical.inc.php @@ -4,8 +4,8 @@ function printEntPhysical($ent, $level, $class) { global $device; - $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex"); - while ($ent = mysql_fetch_assoc($query)) + $ents = dbFetchRows("SELECT * FROM `entPhysical` WHERE device_id = ? AND entPhysicalContainedIn = ? ORDER BY entPhysicalContainedIn,entPhysicalIndex", array($device['device_id'], $ent)); + foreach ($ents as $ent) { echo("
  • "); @@ -28,7 +28,7 @@ function printEntPhysical($ent, $level, $class) if ($ent['ifIndex']) { - $interface = mysql_fetch_assoc(mysql_query("SELECT * FROM `ports` WHERE ifIndex = '".$ent['ifIndex']."' AND device_id = '".$device['device_id']."'")); + $interface = dbFetchRow("SELECT * FROM `ports` WHERE ifIndex = ? AND device_id = ?", array($ent['ifIndex'], $device['device_id'])); $ent['entPhysicalName'] = generate_port_link($interface); } @@ -61,7 +61,7 @@ function printEntPhysical($ent, $level, $class) echo(""); - $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"),0); + $count = dbFetchCell("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"); if ($count) { echo("