From 9a6d196f328f1c32b935a71b5a46ece09f34af0b Mon Sep 17 00:00:00 2001 From: Adam Amstrong Date: Wed, 21 Nov 2007 14:26:24 +0000 Subject: [PATCH] Changes! git-svn-id: http://www.observium.org/svn/observer/trunk@117 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/.htaccess | 1 + html/graph.php | 21 ++-- html/includes/authenticate.inc | 7 +- html/includes/edit-host.inc | 3 +- html/includes/print-device-graph.php | 8 +- html/includes/print-event-short.inc | 6 +- html/includes/print-event.inc | 2 +- html/includes/print-interface-graphs.php | 10 +- html/includes/print-interface.inc | 18 +--- html/includes/print-menubar.php | 11 +- html/includes/print-service.inc | 2 +- html/includes/print-syslog.inc | 4 +- html/includes/topnav.inc | 23 ++++- html/index.php | 7 +- html/pages/addhost.php | 1 - html/pages/addsrv.php | 4 +- html/pages/customers.php | 2 +- html/pages/default.php | 124 +++++++++++++++++++---- html/pages/delhost.php | 8 +- html/pages/delsrv.php | 2 +- html/pages/device.php | 32 +++++- html/pages/device/dev-edit.inc | 10 +- html/pages/device/dev-graphs.inc | 8 +- html/pages/device/dev-overview.inc | 30 ++++-- html/pages/devices.php | 2 +- html/pages/iftype.php | 17 ++-- html/pages/interfaces.php | 2 +- html/pages/temperatures.php | 2 +- html/percentage.php | 79 ++++++++++++--- 29 files changed, 325 insertions(+), 121 deletions(-) diff --git a/html/.htaccess b/html/.htaccess index 716530c27..4f36fb6c9 100644 --- a/html/.htaccess +++ b/html/.htaccess @@ -9,3 +9,4 @@ RewriteCond %{REQUEST_URI} !^(.*)\.gif$ RewriteCond %{REQUEST_URI} !^(.*)\.png$ RewriteRule ^([a-z]+)$ ?page=$1 + diff --git a/html/graph.php b/html/graph.php index a8c9029d4..472e28418 100644 --- a/html/graph.php +++ b/html/graph.php @@ -1,8 +1,8 @@ ', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); ?> diff --git a/html/includes/print-event-short.inc b/html/includes/print-event-short.inc index fe47bbe25..b7c020e7d 100644 --- a/html/includes/print-event-short.inc +++ b/html/includes/print-event-short.inc @@ -15,15 +15,15 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; } echo(" - $entry[humandate] + ".$entry['humandate']." "); - $if['interface_id'] = $entry[interface]; + $if['interface_id'] = $entry['interface']; $if['ifDescr'] = makeshortif($interface); echo(" " . generateiflink($if) . " " . - truncate($entry[message], 45) + htmlspecialchars(truncate($entry['message'], 45)) . " "); diff --git a/html/includes/print-event.inc b/html/includes/print-event.inc index 93e8004db..97d2ce30a 100644 --- a/html/includes/print-event.inc +++ b/html/includes/print-event.inc @@ -35,7 +35,7 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; } echo(" $icon - " . $entry['message'] . " + " . htmlspecialchars($entry['message']) . " "); diff --git a/html/includes/print-interface-graphs.php b/html/includes/print-interface-graphs.php index 5df5829af..b10627a94 100644 --- a/html/includes/print-interface-graphs.php +++ b/html/includes/print-interface-graphs.php @@ -1,5 +1,7 @@ ', LEFT, BORDER, 0);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT, BORDER, 0);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT, BORDER, 0, WIDTH, 350);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> "); - echo("', LEFT, BORDER, 0, WIDTH, 350);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> "); ?> diff --git a/html/includes/print-interface.inc b/html/includes/print-interface.inc index 36b3ebca7..2cead4f6f 100644 --- a/html/includes/print-interface.inc +++ b/html/includes/print-interface.inc @@ -117,12 +117,8 @@ echo(""); // If we're showing graphs, generate the graph and print the img tags if($dographs && is_file("rrd/" . $hostname . ".". $ifIndex . ".rrd")) { - $type = $_GET['type']; + $type = $_GET['type']; -# echo(""); -# include("includes/print-interface-graphs.php"); -# echo(""); - $daily_traffic = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$day&to=$now&width=210&height=100"; $daily_url = "graph.php?if=$if_id&type=" . $_GET['type'] . "&from=$day&to=$now&width=500&height=150"; @@ -137,23 +133,19 @@ echo(""); echo(""); - echo("', LEFT, BORDER, 0);\" + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT, BORDER, 0);\" + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT, WIDTH, 350, BORDER, 0);\" + echo("', LEFT, WIDTH, 350".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT, WIDTH, 350, BORDER, 0);\" + echo("', LEFT, WIDTH, 350".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); echo(""); -# echo(""); -# echo(" "); -# echo(" "); -# echo(""); } diff --git a/html/includes/print-menubar.php b/html/includes/print-menubar.php index 11ced5182..0ec8b4c4d 100644 --- a/html/includes/print-menubar.php +++ b/html/includes/print-menubar.php @@ -57,7 +57,7 @@ echo("

  • Alerts ($device_alerts)
  • "); -if($_SESSION['userlevel'] > '5') { +if($_SESSION['userlevel'] >= '10') { echo("

  • Add Device
  • @@ -80,7 +80,7 @@ echo("

  • } ?> '5') { +if($_SESSION['userlevel'] >= '10') { echo("

  • @@ -105,11 +105,14 @@ if($_SESSION['userlevel'] > '5') { '5') { +if($_SESSION['userlevel'] >= '5') { echo("

  • "); if($show_if_customers) { echo("
  • Customers
  • "); $ifbreak = 1;} + if($show_if_l2tp) { echo("
  • L2TP
  • "); $ifbreak = 1; } + if($show_if_transit) { echo("
  • Transit
  • "); $ifbreak = 1; } if($show_if_peering) { echo("
  • Peering
  • "); $ifbreak = 1; } + if($show_if_core) { echo("
  • Core
  • "); $ifbreak = 1;} } @@ -137,7 +140,7 @@ echo("
  • My Settings
  • Change Password
  • - = '10') { echo("

  • System Settings
  • diff --git a/html/includes/print-service.inc b/html/includes/print-service.inc index be042a09f..5809cf39a 100644 --- a/html/includes/print-service.inc +++ b/html/includes/print-service.inc @@ -29,7 +29,7 @@ if($device_id) { if(!$samehost) { $device['device_id'] = $device_id; $device['hostname'] = $device_hostname; - echo("" . generatedevicelink($device) . ""); + echo("" . generatedevicelink($device) . ""); } else { echo(""); } diff --git a/html/includes/print-syslog.inc b/html/includes/print-syslog.inc index 34856bb0b..be283c7c0 100644 --- a/html/includes/print-syslog.inc +++ b/html/includes/print-syslog.inc @@ -27,9 +27,7 @@ if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; } echo($entry['datetime'] . " - - " . $entry['priority'] . " -
    + " . $entry['program'] . " diff --git a/html/includes/topnav.inc b/html/includes/topnav.inc index 8e2e9b0d6..4a4335cc8 100644 --- a/html/includes/topnav.inc +++ b/html/includes/topnav.inc @@ -1,5 +1,7 @@ = '5') { + $devices['count'] = mysql_result(mysql_query("SELECT count(*) FROM devices"),0); $devices['up'] = mysql_result(mysql_query("SELECT count(*) FROM devices WHERE status = '1' AND `ignore` = '0'"),0); $devices['down'] = mysql_result(mysql_query("SELECT count(*) FROM devices WHERE status = '0' AND `ignore` = '0'"),0); @@ -15,12 +17,29 @@ $services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM servic $services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0' AND service_ignore = '0'"),0); $services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_ignore = '1'"),0); +} else { + + $devices['count'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id"),0); + $devices['up'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND D.status = '1' AND D.ignore = '0'"),0); + $devices['down'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND D.status = '0' AND D.ignore = '0'"),0); + $devices['disabled'] = mysql_result(mysql_query("SELECT count(D.device_id) FROM devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND D.ignore = '1'"),0); + + $interfaces['count'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id"),0); + $interfaces['up'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'up'"),0); + $interfaces['down'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up'"),0); + $interfaces['disabled'] = mysql_result(mysql_query("SELECT count(*) FROM interfaces AS I, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND I.device_id = D.device_id AND ifAdminStatus = 'down'"),0); + + $services['count'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id"),0); + $services['up'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id AND service_status = '1' AND service_ignore ='0'"),0); + $services['down'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id AND service_status = '0' AND service_ignore = '0'"),0); + $services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.service_host = D.device_id AND service_ignore = '1'"),0); + +} + if($devices['down']) { $devices['bgcolour'] = "#ffcccc"; } else { $devices['bgcolour'] = ""; } if($interfaces['down']) { $interfaces['bgcolour'] = "#ffcccc"; } else { $interfaces['bgcolour'] = "#e5e5e5"; } if($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['bgcolour'] = ""; } - - ?> diff --git a/html/index.php b/html/index.php index c35e47bbe..428e70211 100755 --- a/html/index.php +++ b/html/index.php @@ -30,7 +30,9 @@ if($_GET[debug]) { + +