From a549e37fff1a3e7a884fb506565cb35e77e1710c Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Sun, 7 Mar 2010 22:22:29 +0000 Subject: [PATCH] cleanups code, YAY COMMIT 1000 git-svn-id: http://www.observium.org/svn/observer/trunk@1000 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/authenticate.inc.php | 2 +- html/includes/dev-overview-data.inc.php | 93 ++++++++++++++---------- html/pages/device/overview/ports.inc.php | 32 ++++---- 3 files changed, 71 insertions(+), 56 deletions(-) diff --git a/html/includes/authenticate.inc.php b/html/includes/authenticate.inc.php index e796f5ca8b..3422b826a3 100644 --- a/html/includes/authenticate.inc.php +++ b/html/includes/authenticate.inc.php @@ -46,7 +46,7 @@ if (isset($_SESSION['username'])) if (authenticate($_SESSION['username'],$_SESSION['password'])) { $_SESSION['userlevel'] = get_userlevel($_SESSION['username']); - $_SESSION['user_id'] = get_userid($_SESSION['username']);; + $_SESSION['user_id'] = get_userid($_SESSION['username']); if(!$_SESSION['authenticated']) { $_SESSION['authenticated'] = true; diff --git a/html/includes/dev-overview-data.inc.php b/html/includes/dev-overview-data.inc.php index 70909db703..2994bd4796 100644 --- a/html/includes/dev-overview-data.inc.php +++ b/html/includes/dev-overview-data.inc.php @@ -1,54 +1,73 @@ " . $device['sysDescr'] . ""); + if ($config['overview_show_sysDescr']) + { + echo('
' . $device['sysDescr'] . "
"); } -# $uptime = @mysql_result(mysql_query("SELECT `attrib_value` FROM `devices_attribs` WHERE `device_id` = '" . $device['device_id'] . "' AND `attrib_type` = 'uptime'"), 0); $uptime = $device['uptime']; - if(is_file("images/devices/" . $device['hardware'] . ".gif")) { + if(is_file("images/devices/" . $device['hardware'] . ".gif")) + { $dev_img = "
"; - } elseif (is_file("images/devices/" . $device['hardware'] . ".jpg")) { + } + elseif (is_file("images/devices/" . $device['hardware'] . ".jpg")) + { $dev_img = "
"; - } else { unset($dev_img); } + } + elseif (is_file("images/devices/" . $device['hardware'] . ".png")) + { + $dev_img = "
"; + } + else + { + $dev_img = ''; + } + if ($device['os'] == "ios") { formatCiscoHardware($device); } + if ($device['features']) { $device['features'] = "(".$device['features'].")"; } + $device['os_text'] = $os_text[$device['os']]; - if ($device['os'] == "ios") { formatCiscoHardware($device); } - if ($device['features']) { $device['features'] = "(".$device['features'].")"; } - $device['os_text'] = $os_text[$device[os]]; + echo($dev_img . ' + '); - echo("$ddev_img -
"); + if($device['hardware']) + { + echo(' + + + '); + } - if($device['hardware']) {echo(" - - - "); } + echo(' + + + '); - echo(" - - - "); + if($device['sysContact']) + { + echo(' + + + '); + } - if($device['sysContact']) {echo(" - - - "); } + if($device['location']) + { + echo(' + + + '); + } - if($device['location']) {echo(" - - - "); } - - if($uptime) { echo(" - - - "); } - - echo(" - -
Hardware' . $device['hardware']. '
Hardware" . $device['hardware']. "
Operating System' . $device['os_text'] . ' ' . $device['version'] . ' ' . $device['features'] . '
Operating System" . $device['os_text'] . " " . $device['version'] . " " . $device['features'] . "
Contact' . htmlspecialchars($device['sysContact']). '
Contact" . htmlspecialchars($device['sysContact']). "
Location' . $device['location']. '
Location" . $device['location']. "
Uptime" . formatUptime($uptime) . "
"); - + if($uptime) + { + echo(' + Uptime + ' . formatUptime($uptime) . ' + '); + } + echo(' + '); ?> diff --git a/html/pages/device/overview/ports.inc.php b/html/pages/device/overview/ports.inc.php index 61f30c4e1f..e7ba3f4f9f 100644 --- a/html/pages/device/overview/ports.inc.php +++ b/html/pages/device/overview/ports.inc.php @@ -1,24 +1,24 @@ - " . device_traffic_image($device['device_id'], 490, 100, $day, '-300s') . ""); + echo('
+ ' . device_traffic_image($device['device_id'], 490, 100, $day, '-300s')); + echo('
'); - echo("
"); + echo(' + + + + + + +
' . $ports['total'] . ' ' . $ports['up'] . ' ' . $ports['down'] . ' ' . $ports['disabled'] . '
'); -echo(" - - - - - - -
$ports[total] $ports[up] $ports[down] $ports[disabled]
"); - - echo("
"); + echo('
'); $sql = "SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND deleted != '1'"; $query = mysql_query($sql); + $ifsep = ""; while($data = mysql_fetch_array($query)) { $data = ifNameDescr($data); $data['hostname'] = $device['hostname']; @@ -26,11 +26,7 @@ echo(" $ifsep = ", "; } unset($ifsep); + echo("
"); echo("
"); - - echo("
"); - } - - ?>