From 834989df95864fcf3deaedfc881de60865da45d8 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Thu, 17 Mar 2011 00:09:20 +0000 Subject: [PATCH] restructure/reindent/htmlfix html pages, remove dead code git-svn-id: http://www.observium.org/svn/observer/trunk@1897 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/pages/about.inc.php | 4 +- html/pages/addhost.inc.php | 32 +- html/pages/addsrv.inc.php | 51 +-- html/pages/adduser.inc.php | 20 +- html/pages/alerts.inc.php | 71 ---- html/pages/authlog.inc.php | 31 +- html/pages/bgp.inc.php | 60 ++-- html/pages/bill.inc.php | 255 +++++++------- html/pages/bill/actions.inc.php | 14 +- html/pages/bill/edit.inc.php | 16 +- html/pages/bills.inc.php | 92 ++--- html/pages/customers.inc.php | 34 +- html/pages/delhost.inc.php | 14 +- html/pages/delsrv.inc.php | 19 +- html/pages/deluser.inc.php | 14 +- html/pages/device.inc.php | 11 +- html/pages/device/edit/services.inc.php | 2 +- html/pages/device/entphysical.inc.php | 2 +- html/pages/device/health.inc.php | 2 +- html/pages/device/health/diskio.inc.php | 6 +- html/pages/device/health/mempools.inc.php | 8 +- html/pages/device/health/processors.inc.php | 2 +- html/pages/device/health/storage.inc.php | 8 +- html/pages/device/overview/ports.inc.php | 2 +- html/pages/device/overview/processors.inc.php | 2 +- html/pages/device/overview/storage.inc.php | 2 +- html/pages/device/port/junose-atm-vp.inc.php | 4 +- html/pages/device/showconfig.inc.php | 4 +- html/pages/devices.inc.php | 27 +- html/pages/edituser.inc.php | 317 +++++++++--------- html/pages/eventlog.inc.php | 11 +- html/pages/front/default.php | 64 ++-- html/pages/front/demo.php | 36 +- html/pages/front/example2.php | 52 +-- html/pages/front/jt.php | 52 +-- html/pages/graphs.inc.php | 48 ++- html/pages/health.inc.php | 40 ++- html/pages/health/current.inc.php | 50 ++- html/pages/health/fanspeeds.inc.php | 51 ++- html/pages/health/frequencies.inc.php | 48 +-- html/pages/health/humidity.inc.php | 52 ++- html/pages/health/memory.inc.php | 93 ++--- html/pages/health/processors.inc.php | 72 ++-- html/pages/health/storage.inc.php | 91 +++-- html/pages/health/temperatures.inc.php | 53 ++- html/pages/health/voltages.inc.php | 54 ++- html/pages/iftype.inc.php | 33 +- html/pages/inventory.inc.php | 45 +-- html/pages/ipv4.inc.php | 100 +++--- html/pages/ipv6.inc.php | 112 +++---- html/pages/list.inc.php | 11 +- html/pages/locations.inc.php | 42 +-- html/pages/logon.inc.php | 9 +- html/pages/ports.inc.php | 7 +- html/pages/ports/default.inc.php | 74 ++-- html/pages/ports/deleted.inc.php | 36 +- html/pages/preferences.inc.php | 37 +- html/pages/pseudowires.inc.php | 52 +-- html/pages/purgeports.inc.php | 71 ++-- html/pages/services.inc.php | 22 +- html/pages/settings.inc.php | 14 +- html/pages/storage.inc.php | 90 ++--- html/pages/syslog.inc.php | 30 +- html/pages/vrf.inc.php | 83 ++--- html/pages/vrfs.inc.php | 96 +++--- 65 files changed, 1447 insertions(+), 1510 deletions(-) delete mode 100644 html/pages/alerts.inc.php diff --git a/html/pages/about.inc.php b/html/pages/about.inc.php index 750e3955a3..c7141a62f2 100644 --- a/html/pages/about.inc.php +++ b/html/pages/about.inc.php @@ -2,14 +2,14 @@

Observium

diff --git a/html/pages/addhost.inc.php b/html/pages/addhost.inc.php index f08eb5a298..dfee96cf44 100644 --- a/html/pages/addhost.inc.php +++ b/html/pages/addhost.inc.php @@ -1,31 +1,33 @@ You are not permitted to perform this function"); -exit; - +if ($_SESSION['userlevel'] < 10) +{ + # FIXME generic box? + echo("You are not permitted to perform this function"); + exit; } echo("

Add Device

"); -if($_POST['hostname'] && $_POST['community']) { - if($_SESSION['userlevel'] > '5') { +if ($_POST['hostname'] && $_POST['community']) +{ + if ($_SESSION['userlevel'] > '5') + { $hostname = mres($_POST['hostname']); $community = mres($_POST['community']); $snmpver = mres($_POST['snmpver']); - if($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; } + if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; } echo("

"); echo("Adding host $hostname community $community port $port

"); - $result = addHost($hostname, $community, $snmpver, $port); + $result = addHost($hostname, $community, $snmpver, $port); echo("

"); } else { echo("

Error: You don't have the necessary privileges to add hosts.

"); } -} elseif ( $_POST['hostname'] && !$_POST['community'] ) { +} elseif ($_POST['hostname'] && !$_POST['community'] ) { echo("

Error: A community string is required.

"); -} elseif ( !$_POST['hostname'] && $_POST['community'] ) { -echo("

Error: A hostname is required.

"); +} elseif (!$_POST['hostname'] && $_POST['community'] ) { + echo("

Error: A hostname is required.

"); } ?> @@ -36,10 +38,10 @@ echo("

Error: A hostname is required.

");
- + - + @@ -53,7 +55,7 @@ echo("

Error: A hostname is required.

"); - +
HostnameHostname
CommunityCommunity
diff --git a/html/pages/addsrv.inc.php b/html/pages/addsrv.inc.php index 5d20695e5a..f6e18cbc09 100644 --- a/html/pages/addsrv.inc.php +++ b/html/pages/addsrv.inc.php @@ -1,32 +1,41 @@ Insufficient privileges to perform this function."); -} else { - -if($_POST['addsrv']) { - if($_SESSION['userlevel'] == '10') { - include("includes/service-add.inc.php"); - } } +else +{ + if ($_POST['addsrv']) + { + if ($_SESSION['userlevel'] == '10') + { + include("includes/service-add.inc.php"); + } + } -if ($handle = opendir($config['install_dir'] . "/includes/services/")) { - while (false !== ($file = readdir($handle))) { - if ($file != "." && $file != ".." && !strstr($file, ".")) { - $servicesform .= ""; - } + if ($handle = opendir($config['install_dir'] . "/includes/services/")) + { + while (false !== ($file = readdir($handle))) + { + if ($file != "." && $file != ".." && !strstr($file, ".")) + { + $servicesform .= ""; + } } closedir($handle); -} + } -$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`"); -while($device = mysql_fetch_array($query)) { - $devicesform .= ""; -} + $query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`"); + while ($device = mysql_fetch_array($query)) + { + $devicesform .= ""; + } -if($updated) { print_message("Device Settings Saved"); } + if ($updated) { print_message("Device Settings Saved"); } -echo(" + echo("

Add Service

@@ -44,7 +53,7 @@ echo(" Type - +
Please enter a password!
"); } @@ -64,4 +64,4 @@ else echo("
"); -?> +?> \ No newline at end of file diff --git a/html/pages/alerts.inc.php b/html/pages/alerts.inc.php deleted file mode 100644 index 42232c2fb7..0000000000 --- a/html/pages/alerts.inc.php +++ /dev/null @@ -1,71 +0,0 @@ - - -"); - -$query = mysql_query($sql); -while($event = mysql_fetch_array($query)) -{ - -if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; } - -$type = $event[importance]; - -switch ($type) { -case "9": - $type = ""; - break; -case "7": - $type = ""; - break; -case "2": - $type = ""; - break; -case "0": - $type = ""; - break; -} - -if(!$argh) { - echo(" - - - - $event[time] - - - $event[hostname] - - - $type - - - $event[message] - - - - - - - - - -"); -} - -} - -?> - diff --git a/html/pages/authlog.inc.php b/html/pages/authlog.inc.php index 445906711f..2eee68337f 100644 --- a/html/pages/authlog.inc.php +++ b/html/pages/authlog.inc.php @@ -1,19 +1,17 @@ "); -$data = mysql_query($query); + while ($entry = mysql_fetch_array($data)) + { + if ($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; } - -echo(""); - -while($entry = mysql_fetch_array($data)) { - - if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; } - - echo(" + echo(" @@ -28,16 +26,9 @@ while($entry = mysql_fetch_array($data)) { "); + } - + echo("
" . $entry['datetime'] . "
"); } -echo(""); - -} else { - - - -} - -?> +?> \ No newline at end of file diff --git a/html/pages/bgp.inc.php b/html/pages/bgp.inc.php index 03eb95cc4c..8fb250a738 100644 --- a/html/pages/bgp.inc.php +++ b/html/pages/bgp.inc.php @@ -1,4 +1,4 @@ -iBGP"; } else { $peer_type = "eBGP"; - if($peer['bgpPeerRemoteAS'] >= '64512' && $peer['bgpPeerRemoteAS'] <= '65535') { $peer_type = "Priv eBGP"; } + if ($peer['bgpPeerRemoteAs'] == $peer['bgpLocalAs']) { $peer_type = "iBGP"; } else { $peer_type = "eBGP"; + if ($peer['bgpPeerRemoteAS'] >= '64512' && $peer['bgpPeerRemoteAS'] <= '65535') { $peer_type = "Priv eBGP"; } } $peerhost = mysql_fetch_array(mysql_query("SELECT * FROM ipaddr AS A, ports AS I, devices AS D WHERE A.addr = '".$peer['bgpPeerIdentifier']."' AND I.interface_id = A.interface_id AND D.device_id = I.device_id")); - if($peerhost) { $peername = generate_device_link($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); } + if ($peerhost) { $peername = generate_device_link($peerhost, shorthost($peerhost['hostname'])); } else { unset($peername); } echo(" @@ -47,44 +46,43 @@ else AS" . $peer['bgpPeerRemoteAs'] . "
" . $peer['astext'] . " " . $peer['bgpPeerAdminStatus'] . "
" . $peer['bgpPeerState'] . "
" .formatUptime($peer['bgpPeerFsmEstablishedTime']). "
- Updates " . format_si($peer['bgpPeerInUpdates']) . " + Updates " . format_si($peer['bgpPeerInUpdates']) . " " . format_si($peer['bgpPeerOutUpdates']) . ""); - if($graphs) { - + if ($graphs) + { $graph_type = "bgpupdates"; - - $daily_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100"; - $daily_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150"; - $weekly_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100"; - $weekly_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150"; + $daily_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=210&height=100"; + $daily_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$day&to=$now&width=500&height=150"; - $monthly_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100"; - $monthly_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150"; + $weekly_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=210&height=100"; + $weekly_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$week&to=$now&width=500&height=150"; - $yearly_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100"; - $yearly_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150"; + $monthly_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=210&height=100"; + $monthly_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$month&to=$now&width=500&height=150"; - echo(""); + $yearly_traffic = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=210&height=100"; + $yearly_url = "graph.php?peer=" . $peer['bgpPeer_id'] . "&type=$graph_type&from=$year&to=$now&width=500&height=150"; - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + echo(""); + + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].");\" onmouseout=\"return nd();\"> "); - echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> "); - echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> + echo("', LEFT".$config['overlib_defaults'].", WIDTH, 350);\" onmouseout=\"return nd();\"> "); - echo(""); - - } $i++; } + echo(""); } -?> + +?> \ No newline at end of file diff --git a/html/pages/bill.inc.php b/html/pages/bill.inc.php index 30b9554304..ab085f3608 100644 --- a/html/pages/bill.inc.php +++ b/html/pages/bill.inc.php @@ -1,35 +1,35 @@ = 1000000) { $paidrate_text = $paid_mb . "Mbps is the CDR."; } - + $day_data = getDates($dayofmonth); $datefrom = $day_data['0']; $dateto = $day_data['1']; @@ -38,130 +38,129 @@ if(bill_permitted($bill_id)) { $dir_95th = $rate_data['dir_95th']; $total_data = $rate_data['total_data']; $rate_average = $rate_data['rate_average']; - - if ($rate_95th > $paid_kb) { - $over = $rate_95th - $paid_kb; - $bill_text = $over . "Kbit excess."; - $bill_color = "#cc0000"; - } else { - $under = $paid_kb - $rate_95th; - $bill_text = $under . "Kbit headroom."; - $bill_color = "#0000cc"; + + if ($rate_95th > $paid_kb) + { + $over = $rate_95th - $paid_kb; + $bill_text = $over . "Kbit excess."; + $bill_color = "#cc0000"; } - + else + { + $under = $paid_kb - $rate_95th; + $bill_text = $under . "Kbit headroom."; + $bill_color = "#0000cc"; + } + $fromtext = mysql_result(mysql_query("SELECT DATE_FORMAT($datefrom, '%M %D %Y')"), 0); $totext = mysql_result(mysql_query("SELECT DATE_FORMAT($dateto, '%M %D %Y')"), 0); $unixfrom = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP('$datefrom')"), 0); $unixto = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP('$dateto')"), 0); - + echo("

Bill : " . $bill_name . "

"); - + print_optionbar_start(); - - if(!$_GET['optb']) { $_GET['optb'] = "details"; } - - if($_GET['optb'] == "details") { echo(""); } + + if (!$_GET['optb']) { $_GET['optb'] = "details"; } + + if ($_GET['optb'] == "details") { echo(""); } echo("Details"); - if($_GET['optb'] == "details") { echo(""); } - - if($_SESSION['userlevel'] == "10") + if ($_GET['optb'] == "details") { echo(""); } + + if ($_SESSION['userlevel'] == "10") { echo(" | "); - if($_GET['optb'] == "edit") { echo(""); } + if ($_GET['optb'] == "edit") { echo(""); } echo("Edit"); - if($_GET['optb'] == "edit") { echo(""); } + if ($_GET['optb'] == "edit") { echo(""); } echo(" | "); - if($_GET['optb'] == "delete") { echo(""); } + if ($_GET['optb'] == "delete") { echo(""); } echo("Delete"); - if($_GET['optb'] == "delete") { echo(""); } + if ($_GET['optb'] == "delete") { echo(""); } } print_optionbar_end(); - + # echo("
"); - - - if($_GET['optb'] == "edit" && $_SESSION['userlevel'] == "10") { - + + if ($_GET['optb'] == "edit" && $_SESSION['userlevel'] == "10") + { include("pages/bill/edit.inc.php"); - - } elseif($_GET['optb'] == "delete" && $_SESSION['userlevel'] == "10") { - + } + elseif ($_GET['optb'] == "delete" && $_SESSION['userlevel'] == "10") + { include("pages/bill/delete.inc.php"); + } + elseif ($_GET['optb'] == "details") + { - } elseif($_GET['optb'] == "details") { - - echo("

Billed Ports

"); - + $ports = mysql_query("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devices` AS D WHERE B.bill_id = '".$bill_id."' AND P.interface_id = B.port_id AND D.device_id = P.device_id"); - while ($port = mysql_fetch_array($ports)) { - - echo(generate_port_link($port) . " on " . generate_device_link($port) . "
"); - + while ($port = mysql_fetch_array($ports)) + { + echo(generate_port_link($port) . " on " . generate_device_link($port) . "
"); } - + echo("

Bill Summary

"); - - if($bill_data['bill_type'] == "quota") { - + + if ($bill_data['bill_type'] == "quota") + { // The Customer is billed based on a pre-paid quota - + echo("

Quota Bill

"); $percent = round(($total_data / 1024) / $bill_data['bill_gb'] * 100, 2); $unit = "MB"; $total_data = round($total_data, 2); - echo("Billing Period from " . $fromtext . " to " . $totext . " + echo("Billing Period from " . $fromtext . " to " . $totext . "
Transferred ".formatStorage($total_data * 1024 * 1024)." of ".formatStorage($bill_data['bill_gb'] * 1024 * 1024 * 1024)." (".$percent."%)
Average rate " . formatRates($rate_average * 1000)); if ($percent > 100) { $perc = "100"; } else { $perc = $percent; } - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; + } elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; + } elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; + } elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } else { $left_background='9abf5b'; $right_background='bbd392'; } echo("

".print_percentage_bar (350, 20, $perc, NULL, "ffffff", $left_background, $percent . "%", "ffffff", $right_background)."

"); - + $type="&ave=yes"; - - - } elseif($bill_data['bill_type'] == "cdr") { - + } + elseif ($bill_data['bill_type'] == "cdr") + { // The customer is billed based on a CDR with 95th%ile overage - + echo("

CDR / 95th Bill

"); $unit = "kbps"; $cdr = $bill_data['bill_cdr']; - if($rate_95th > "1000") { $rate_95th = $rate_95th / 1000; $cdr = $cdr / 1000; $unit = "Mbps"; } - if($rate_95th > "1000") { $rate_95th = $rate_95th / 1000; $cdr = $cdr / 1000; $unit = "Gps"; } + if ($rate_95th > "1000") { $rate_95th = $rate_95th / 1000; $cdr = $cdr / 1000; $unit = "Mbps"; } + if ($rate_95th > "1000") { $rate_95th = $rate_95th / 1000; $cdr = $cdr / 1000; $unit = "Gps"; } $rate_95th = round($rate_95th, 2); - + $percent = round(($rate_95th) / $cdr * 100, 2); - + $type="&95th=yes"; - + echo("" . $fromtext . " to " . $totext . "
Measured ".$rate_95th."$unit of ".$cdr."$unit (".$percent."%)"); if ($percent > 100) { $perc = "100"; } else { $perc = $percent; } - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; + } elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; + } elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; + } elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } else { $left_background='9abf5b'; $right_background='bbd392'; } echo("

".print_percentage_bar (350, 20, $perc, NULL, "ffffff", $left_background, $percent . "%", "ffffff", $right_background)."

"); - # echo("

Billing Period : " . $fromtext . " to " . $totext . "
# " . $paidrate_text . "
# " . $total_data . "MB transfered in the current billing cycle.
@@ -169,94 +168,94 @@ if(bill_permitted($bill_id)) { # " . $rate_95th . "Kbps @ 95th Percentile. (" . $dir_95th . ") (" . $bill_text . ") #

#
"); - + } - + # echo(""); - -# $bi = ""; - $bi = ""; + $bi = ""; - $lastmonth = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 MONTH))"), 0); $yesterday = mysql_result(mysql_query("SELECT UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 1 DAY))"), 0); $rightnow = date(U); - + # $di = ""; - $di = ""; + $di = ""; + - # $mi = ""; - - $mi = ""; + + $mi = ""; - if($null) { - - echo(" + if ($null) + { + echo(" - + - - From: + + From: - - To: + + To: - + - + "); - + } - - if ($_GET[all]) { - $ai = ""; - echo("

Entire Data View

$ai"); - } elseif ($_GET[custom]) { - $cg = ""; - echo("

Custom Graph

$cg"); - } else { + + if ($_GET['all']) + { + $ai = ""; + echo("

Entire Data View

$ai"); + } + elseif ($_GET['custom']) + { + $cg = ""; + echo("

Custom Graph

$cg"); + } + else + { echo("

Billing View

$bi

24 Hour View

$di"); echo("

Monthly View

$mi"); -# echo("
Graph All Data (SLOW)"); +# echo("
Graph All Data (SLOW)"); } - } # End if details - -} else { - - include("includes/error-no-perm.inc.php"); - } - -?> - - +else +{ + include("includes/error-no-perm.inc.php"); +} + +?> \ No newline at end of file diff --git a/html/pages/bill/actions.inc.php b/html/pages/bill/actions.inc.php index d457d6b2b3..59b2c65366 100644 --- a/html/pages/bill/actions.inc.php +++ b/html/pages/bill/actions.inc.php @@ -1,13 +1,13 @@ Bill Properties Updated"); } diff --git a/html/pages/bill/edit.inc.php b/html/pages/bill/edit.inc.php index 7605a7a046..b156ca2870 100644 --- a/html/pages/bill/edit.inc.php +++ b/html/pages/bill/edit.inc.php @@ -67,25 +67,25 @@ $ports_array = mysql_query("SELECT * FROM `bill_ports` AS B, `ports` AS P, `devi WHERE B.bill_id = '".$bill_data['bill_id']."' AND P.interface_id = B.port_id AND D.device_id = P.device_id"); -if(mysql_affected_rows()) +if (mysql_affected_rows()) { echo("

Billed Ports

"); echo(""); - while($port = mysql_fetch_array($ports_array)) + while ($port = mysql_fetch_array($ports_array)) { - if($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; } + if ($bg == $list_colour_a) { $bg = $list_colour_b; } else { $bg=$list_colour_a; } echo(""); echo(""); - } + } echo("
"); echo(generate_device_link($port) . " - " . generate_port_link($port)); - if($port['ifAlias']) { echo(" - " . $port['ifAlias']); } + if ($port['ifAlias']) { echo(" - " . $port['ifAlias']); } echo(""); echo("
"); echo("
"); } @@ -100,10 +100,10 @@ if(mysql_affected_rows()) "); $device_list = mysql_query("SELECT * FROM `devices` ORDER BY hostname"); - while($device = mysql_fetch_array($device_list)) { + while ($device = mysql_fetch_array($device_list)) { unset($done); - foreach($access_list as $ac) { if($ac == $device['device_id']) { $done = 1; } } - if(!$done) { echo(""); } + foreach ($access_list as $ac) { if ($ac == $device['device_id']) { $done = 1; } } + if (!$done) { echo(""); } } echo(" diff --git a/html/pages/bills.inc.php b/html/pages/bills.inc.php index 6f50b69c02..d3ee902035 100644 --- a/html/pages/bills.inc.php +++ b/html/pages/bills.inc.php @@ -1,8 +1,7 @@ - "; - } - echo(""); -if($_GET['opta'] == "add") { +if ($_GET['opta'] == "add") +{ ?>
Add Bill
@@ -74,12 +72,11 @@ if($_GET['opta'] == "add") { +?> @@ -120,48 +117,51 @@ print_optionbar_start('40'); "); $i=1; - while($bill = mysql_fetch_array($query)) { - #echo("
");
-   #print_r($permissions);
-   #echo("
"); - if(bill_permitted($bill['bill_id'])) { - unset($class); - $day_data = getDates($bill['bill_day']); - $datefrom = $day_data['0']; - $dateto = $day_data['1']; - $rate_data = getRates($bill['bill_id'],$datefrom,$dateto); - $rate_95th = $rate_data['rate_95th']; - $dir_95th = $rate_data['dir_95th']; - $total_data = $rate_data['total_data']; - $rate_average = $rate_data['rate_average']; + while ($bill = mysql_fetch_array($query)) + { + #echo("
");
+    #print_r($permissions);
+    #echo("
"); + if (bill_permitted($bill['bill_id'])) + { + unset($class); + $day_data = getDates($bill['bill_day']); + $datefrom = $day_data['0']; + $dateto = $day_data['1']; + $rate_data = getRates($bill['bill_id'],$datefrom,$dateto); + $rate_95th = $rate_data['rate_95th']; + $dir_95th = $rate_data['dir_95th']; + $total_data = $rate_data['total_data']; + $rate_average = $rate_data['rate_average']; - if($bill['bill_type'] == "cdr") { - $type = "CDR"; - $allowed = formatRates($bill['bill_cdr'] * 1000); - $used = formatRates($rate_data['rate_95th'] * 1000); - $percent = round(($rate_data['rate_95th'] / $bill['bill_cdr']) * 100,2); - } elseif ($bill['bill_type'] == "quota") { - $type = "Quota"; - $allowed = formatStorage($bill['bill_gb']* 1024 * 1024 * 1024); - $used = formatStorage($rate_data['total_data'] * 1024 * 1024); - $percent = round(($rate_data['total_data'] / ($bill['bill_gb'] * 1024)) * 100,2); - } + if ($bill['bill_type'] == "cdr") + { + $type = "CDR"; + $allowed = formatRates($bill['bill_cdr'] * 1000); + $used = formatRates($rate_data['rate_95th'] * 1000); + $percent = round(($rate_data['rate_95th'] / $bill['bill_cdr']) * 100,2); + } elseif ($bill['bill_type'] == "quota") { + $type = "Quota"; + $allowed = formatStorage($bill['bill_gb']* 1024 * 1024 * 1024); + $used = formatStorage($rate_data['total_data'] * 1024 * 1024); + $percent = round(($rate_data['total_data'] / ($bill['bill_gb'] * 1024)) * 100,2); + } - if ($percent > 100) { $perc = "100"; } else { $perc = $percent; } - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } + if ($percent > 100) { $perc = "100"; } else { $perc = $percent; } + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } - if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - echo(" + if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + echo(" @@ -173,12 +173,12 @@ print_optionbar_end(); "); - $i++; - } ### PERMITTED + $i++; + } ### PERMITTED } echo("
".$bill['bill_name']."Edit Edit
"); } echo(""); -?> +?> \ No newline at end of file diff --git a/html/pages/customers.inc.php b/html/pages/customers.inc.php index 2db8bd07e3..9176e9c9e7 100644 --- a/html/pages/customers.inc.php +++ b/html/pages/customers.inc.php @@ -19,32 +19,31 @@ echo(" $i = 1; -while($customer = mysql_fetch_array($cust_query)) { - +while ($customer = mysql_fetch_array($cust_query)) +{ $i++; - + $port_sql = "SELECT * FROM `ports` WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = '".$customer['port_descr_descr']."'"; $port_query = mysql_query($port_sql); $customer_name = $customer['port_descr_descr']; - if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } + if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } - while($port = mysql_fetch_array($port_query)) { - $device = device_by_id_cache($port['device_id']); + while ($port = mysql_fetch_array($port_query)) + { + $device = device_by_id_cache($port['device_id']); unset($class); $ifname = fixifname($device['ifDescr']); - $ifclass = ifclass($port['ifOperStatus'], $port['ifAdminStatus']); - if($device['os'] == "ios") { - - if($port['ifTrunk']) { $vlan = "" . $port['ifTrunk'] . ""; - } elseif ($port['ifVlan']) { $vlan = "VLAN " . $port['ifVlan'] . ""; - } else { $vlan = ""; } - + if ($device['os'] == "ios") + { + if ($port['ifTrunk']) { $vlan = "" . $port['ifTrunk'] . ""; } + elseif ($port['ifVlan']) { $vlan = "VLAN " . $port['ifVlan'] . ""; } + else { $vlan = ""; } } echo(" @@ -61,19 +60,16 @@ while($customer = mysql_fetch_array($cust_query)) { unset($customer_name); - } - echo(" + echo(" "); - - } - echo(""); +echo(""); -?> +?> \ No newline at end of file diff --git a/html/pages/delhost.inc.php b/html/pages/delhost.inc.php index 305470a0a5..2757f97d6a 100644 --- a/html/pages/delhost.inc.php +++ b/html/pages/delhost.inc.php @@ -1,11 +1,13 @@ You are not permitted to perform this function"); exit; } -if($_REQUEST['id']) { +if ($_REQUEST['id']) +{ echo(delete_device(mres($_REQUEST['id']))); } @@ -19,16 +21,14 @@ if($_REQUEST['id']) { $query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`"); -while($data = mysql_fetch_array($query)) { - +while ($data = mysql_fetch_array($query)) +{ echo(""); - } ?> - +

- diff --git a/html/pages/delsrv.inc.php b/html/pages/delsrv.inc.php index ebed8890cb..854a6f23cd 100644 --- a/html/pages/delsrv.inc.php +++ b/html/pages/delsrv.inc.php @@ -1,21 +1,24 @@ "5") { +if ($_POST['delsrv']) +{ + if ($_SESSION['userlevel'] > "5") { include("includes/service-delete.inc.php"); } } $query = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY hostname"); -while($device = mysql_fetch_array($query)) { +while ($device = mysql_fetch_array($query)) +{ $servicesform .= ""; } -if($updated) { print_message("Service Deleted!"); } +if ($updated) { print_message("Service Deleted!"); } echo("

Delete Service

@@ -29,13 +32,13 @@ echo(" + "); - } -?> + +?> \ No newline at end of file diff --git a/html/pages/deluser.inc.php b/html/pages/deluser.inc.php index 441aba7033..bf8862d3d3 100644 --- a/html/pages/deluser.inc.php +++ b/html/pages/deluser.inc.php @@ -2,27 +2,27 @@ echo("
"); -if($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php"); } else +if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php"); } else { echo("

Delete User

"); if (auth_usermanagement()) { - if($_GET['action'] == "del") + if ($_GET['action'] == "del") { $delete_username = mysql_result(mysql_query("SELECT username FROM users WHERE user_id = '" . mres($_GET['user_id']) . "'"),0); - if($_GET['confirm'] == "yes") + if ($_GET['confirm'] == "yes") { mysql_query("DELETE FROM `devices_perms` WHERE `user_id` = '" . mres($_GET['user_id']) . "'"); # FIXME v sql query should be replaced by authmodule mysql_query("DELETE FROM `users` WHERE `user_id` = '" . mres($_GET['user_id']) . "'"); - if(mysql_affected_rows()) { echo("User '$delete_username' deleted!"); } + if (mysql_affected_rows()) { echo("User '$delete_username' deleted!"); } - } - else + } + else { echo("You have requested deletion of the user '$delete_username'. This action can not be reversed.
Click to confirm
"); } @@ -31,7 +31,7 @@ if($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php"); # FIXME v mysql query should be replaced by authmodule $userlist = mysql_query("SELECT * FROM `users`"); - while($userentry = mysql_fetch_array($userlist)) + while ($userentry = mysql_fetch_array($userlist)) { $i++; echo($i . ". " . $userentry['username'] . " diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php index 22c2e5132e..4d3d98ad66 100644 --- a/html/pages/device.inc.php +++ b/html/pages/device.inc.php @@ -22,7 +22,7 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id']) $select[$section] = "selected"; $device_query = mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $_GET['id'] . "'"); - while($device = mysql_fetch_array($device_query)) + while ($device = mysql_fetch_array($device_query)) { if ($config['os'][$device['os']]['group']) { $device['os_group'] = $config['os'][$device['os']]['group']; } @@ -140,7 +140,7 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id']) '); } - elseif ( device_permitted($_GET['id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '".$_GET['id']."'"), 0) > '0') + elseif (device_permitted($_GET['id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '".$_GET['id']."'"), 0) > '0') { echo('
  • @@ -148,7 +148,7 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id'])
  • '); } - + if (mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') { echo('
  • @@ -190,7 +190,7 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id']) if ($_SESSION['userlevel'] >= "7") { if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); } - foreach($config['rancid_configs'] as $configs) { + foreach ($config['rancid_configs'] as $configs) { if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; } if (is_file($configs . $device['hostname'])) { $device_config_file = $configs . $device['hostname']; } } @@ -226,5 +226,4 @@ else { include("includes/error-no-perm.inc.php"); } -?> - \ No newline at end of file +?> \ No newline at end of file diff --git a/html/pages/device/edit/services.inc.php b/html/pages/device/edit/services.inc.php index 9d66fdafc3..767175dc84 100644 --- a/html/pages/device/edit/services.inc.php +++ b/html/pages/device/edit/services.inc.php @@ -23,7 +23,7 @@ if ($handle = opendir($config['install_dir'] . "/includes/services/")) $servicesform .= ""; } } - + closedir($handle); } diff --git a/html/pages/device/entphysical.inc.php b/html/pages/device/entphysical.inc.php index ec1f4aafe7..f97044299e 100644 --- a/html/pages/device/entphysical.inc.php +++ b/html/pages/device/entphysical.inc.php @@ -65,7 +65,7 @@ function printEntPhysical($ent, $level, $class) printEntPhysical($ent['entPhysicalIndex'], $level+1, ''); echo(""); } - + echo("
  • "); } } diff --git a/html/pages/device/health.inc.php b/html/pages/device/health.inc.php index adae5fce96..ed6dbe9167 100644 --- a/html/pages/device/health.inc.php +++ b/html/pages/device/health.inc.php @@ -63,7 +63,7 @@ if (is_file("pages/device/health/".mres($_GET['opta']).".inc.php")) { include("pages/device/health/".mres($_GET['opta']).".inc.php"); } else { - foreach ($datas as $type) + foreach ($datas as $type) { if ($type != "overview") { diff --git a/html/pages/device/health/diskio.inc.php b/html/pages/device/health/diskio.inc.php index 3f3b70b6b6..23d3f61885 100644 --- a/html/pages/device/health/diskio.inc.php +++ b/html/pages/device/health/diskio.inc.php @@ -25,9 +25,9 @@ while ($drive = mysql_fetch_array($query)) $fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\""; if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } - elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } - elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } - elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } else { $left_background='9abf5b'; $right_background='bbd392'; } echo("" . $drive['diskio_descr'] . ""); diff --git a/html/pages/device/health/mempools.inc.php b/html/pages/device/health/mempools.inc.php index a90695d533..20a93ca9de 100644 --- a/html/pages/device/health/mempools.inc.php +++ b/html/pages/device/health/mempools.inc.php @@ -27,10 +27,10 @@ while ($mempool = mysql_fetch_array($mempools)) $perc = round($mempool['mempool_used'] / $mempool['mempool_total'] * 100); - if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } - elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } - elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } - elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } else { $left_background='9abf5b'; $right_background='bbd392'; } echo("" . $text_descr . " diff --git a/html/pages/device/health/processors.inc.php b/html/pages/device/health/processors.inc.php index 223688f719..c2d3e302f6 100644 --- a/html/pages/device/health/processors.inc.php +++ b/html/pages/device/health/processors.inc.php @@ -7,7 +7,7 @@ echo(""); $i = '1'; $procs = mysql_query("SELECT * FROM `processors` WHERE device_id = '" . $device['device_id'] . "'"); -while ($proc = mysql_fetch_array($procs)) +while ($proc = mysql_fetch_array($procs)) { $proc_url = "device/".$device['device_id']."/health/processors/"; diff --git a/html/pages/device/health/storage.inc.php b/html/pages/device/health/storage.inc.php index b532d67ee7..c25245ed57 100644 --- a/html/pages/device/health/storage.inc.php +++ b/html/pages/device/health/storage.inc.php @@ -34,10 +34,10 @@ while ($drive = mysql_fetch_array($query)) $fs_popup .= ""; $fs_popup .= "', RIGHT, FGCOLOR, '#e5e5e5');\" onmouseout=\"return nd();\""; - if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } - elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } - elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } - elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } else { $left_background='9abf5b'; $right_background='bbd392'; } echo(""); $processor_rows++; } - + echo("
    " . $drive['storage_descr'] . " diff --git a/html/pages/device/overview/ports.inc.php b/html/pages/device/overview/ports.inc.php index a56554cd67..10bf25210a 100644 --- a/html/pages/device/overview/ports.inc.php +++ b/html/pages/device/overview/ports.inc.php @@ -56,7 +56,7 @@ if ($ports['total']) echo("$ifsep" . generate_port_link($data, makeshortif(strtolower($data['label'])))); $ifsep = ", "; } - + unset($ifsep); echo(" "); echo(""); diff --git a/html/pages/device/overview/processors.inc.php b/html/pages/device/overview/processors.inc.php index 1199824272..4527f19a30 100644 --- a/html/pages/device/overview/processors.inc.php +++ b/html/pages/device/overview/processors.inc.php @@ -45,7 +45,7 @@ if (mysql_result(mysql_query("SELECT count(*) from processors WHERE device_id =
    "); echo("
    "); } diff --git a/html/pages/device/overview/storage.inc.php b/html/pages/device/overview/storage.inc.php index bdb47d917f..8ef4aa6033 100644 --- a/html/pages/device/overview/storage.inc.php +++ b/html/pages/device/overview/storage.inc.php @@ -64,7 +64,7 @@ if (mysql_result(mysql_query("SELECT count(storage_id) from storage WHERE device "); $drive_rows++; } - + echo(""); echo(""); } diff --git a/html/pages/device/port/junose-atm-vp.inc.php b/html/pages/device/port/junose-atm-vp.inc.php index 3edbc50dc5..b8b2880451 100644 --- a/html/pages/device/port/junose-atm-vp.inc.php +++ b/html/pages/device/port/junose-atm-vp.inc.php @@ -24,14 +24,14 @@ while ($vp = mysql_fetch_array($vps)) $periods = array('day', 'week', 'month', 'year'); echo(''); - + foreach ($periods as $period) { $graph_array['from'] = $$period; $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; echo(overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); } - + echo(''); $row++; diff --git a/html/pages/device/showconfig.inc.php b/html/pages/device/showconfig.inc.php index e369084bdd..0402356c27 100644 --- a/html/pages/device/showconfig.inc.php +++ b/html/pages/device/showconfig.inc.php @@ -6,7 +6,7 @@ if ($_SESSION['userlevel'] >= "7") { if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); } - foreach ($config['rancid_configs'] as $configs) + foreach ($config['rancid_configs'] as $configs) { if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; } if (is_file($configs . $device['hostname'])) { $file = $configs . $device['hostname']; } @@ -25,7 +25,7 @@ if ($_SESSION['userlevel'] >= "7") } $text = join("\n",$lines); } - + $language = "ios"; $geshi = new GeSHi($text, $language); $geshi->enable_line_numbers(GESHI_FANCY_LINE_NUMBERS); diff --git a/html/pages/devices.inc.php b/html/pages/devices.inc.php index 2c83980115..b2ef8c15bd 100644 --- a/html/pages/devices.inc.php +++ b/html/pages/devices.inc.php @@ -1,4 +1,4 @@ - - + '); $device_query = mysql_query($sql); -while ($device = mysql_fetch_array($device_query)) { - if ( device_permitted($device['device_id']) ) { +while ($device = mysql_fetch_array($device_query)) +{ + if (device_permitted($device['device_id'])) + { include("includes/hostbox.inc.php"); } } diff --git a/html/pages/edituser.inc.php b/html/pages/edituser.inc.php index 2ec7ec1ad7..b6f94a9d4b 100644 --- a/html/pages/edituser.inc.php +++ b/html/pages/edituser.inc.php @@ -4,181 +4,184 @@ include("includes/javascript-interfacepicker.inc.php"); echo("
    "); -if($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php"); } else { +if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php"); } else +{ + if ($_GET['user_id']) + { + $user_data = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE user_id = '" . $_GET['user_id'] . "'")); + echo("

    " . $user_data['realname'] . "

    Change...

    "); + // Perform actions if requested -if($_GET['user_id']) { - $user_data = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE user_id = '" . $_GET['user_id'] . "'")); - echo("

    " . $user_data['realname'] . "

    Change...

    "); - // Perform actions if requested - - if($_GET['action'] == "deldevperm") { - if(mysql_result(mysql_query("SELECT COUNT(*) FROM devices_perms WHERE `device_id` = '" . $_GET['device_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { - mysql_query("DELETE FROM devices_perms WHERE `device_id` = '" . $_GET['device_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); + if ($_GET['action'] == "deldevperm") + { + if (mysql_result(mysql_query("SELECT COUNT(*) FROM devices_perms WHERE `device_id` = '" . $_GET['device_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { + mysql_query("DELETE FROM devices_perms WHERE `device_id` = '" . $_GET['device_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); + } } - } - if($_GET['action'] == "adddevperm") { - if(!mysql_result(mysql_query("SELECT COUNT(*) FROM devices_perms WHERE `device_id` = '" . $_GET['device_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { - mysql_query("INSERT INTO devices_perms (`device_id`, `user_id`) VALUES ('" . $_GET['device_id'] . "', '" . $_GET['user_id'] . "')"); + if ($_GET['action'] == "adddevperm") + { + if (!mysql_result(mysql_query("SELECT COUNT(*) FROM devices_perms WHERE `device_id` = '" . $_GET['device_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { + mysql_query("INSERT INTO devices_perms (`device_id`, `user_id`) VALUES ('" . $_GET['device_id'] . "', '" . $_GET['user_id'] . "')"); + } } - } - - if($_GET['action'] == "delifperm") { - if(mysql_result(mysql_query("SELECT COUNT(*) FROM ports_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { - mysql_query("DELETE FROM ports_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); + if ($_GET['action'] == "delifperm") + { + if (mysql_result(mysql_query("SELECT COUNT(*) FROM ports_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { + mysql_query("DELETE FROM ports_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); + } } - } - if($_GET['action'] == "addifperm") { - if(!mysql_result(mysql_query("SELECT COUNT(*) FROM ports_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { - mysql_query("INSERT INTO ports_perms (`interface_id`, `user_id`) VALUES ('" . $_GET['interface_id'] . "', '" . $_GET['user_id'] . "')"); + if ($_GET['action'] == "addifperm") + { + if (!mysql_result(mysql_query("SELECT COUNT(*) FROM ports_perms WHERE `interface_id` = '" . $_GET['interface_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { + mysql_query("INSERT INTO ports_perms (`interface_id`, `user_id`) VALUES ('" . $_GET['interface_id'] . "', '" . $_GET['user_id'] . "')"); + } } - } - - if($_GET['action'] == "delbillperm") { - if(mysql_result(mysql_query("SELECT COUNT(*) FROM bill_perms WHERE `bill_id` = '" . $_GET['bill_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { - mysql_query("DELETE FROM bill_perms WHERE `bill_id` = '" . $_GET['bill_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); + if ($_GET['action'] == "delbillperm") + { + if (mysql_result(mysql_query("SELECT COUNT(*) FROM bill_perms WHERE `bill_id` = '" . $_GET['bill_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { + mysql_query("DELETE FROM bill_perms WHERE `bill_id` = '" . $_GET['bill_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"); + } } - } - if($_GET['action'] == "addbillperm") { - if(!mysql_result(mysql_query("SELECT COUNT(*) FROM bill_perms WHERE `bill_id` = '" . $_GET['bill_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { - mysql_query("INSERT INTO bill_perms (`bill_id`, `user_id`) VALUES ('" . $_GET['bill_id'] . "', '" . $_GET['user_id'] . "')"); + if ($_GET['action'] == "addbillperm") + { + if (!mysql_result(mysql_query("SELECT COUNT(*) FROM bill_perms WHERE `bill_id` = '" . $_GET['bill_id'] . "' AND `user_id` = '" . $_GET['user_id'] . "'"),0)) { + mysql_query("INSERT INTO bill_perms (`bill_id`, `user_id`) VALUES ('" . $_GET['bill_id'] . "', '" . $_GET['user_id'] . "')"); + } } - } + echo("
    @@ -24,7 +24,7 @@ print_optionbar_start(62); All Versions All Platforms All Featuresets All Locations
    DeviceOperating SystemPlatformUptime
    "); + // Display devices this users has access to + echo("

    Device Access

    "); - -echo("
    "); - - // Display devices this users has access to - echo("

    Device Access

    "); - - $device_perm_data = mysql_query("SELECT * from devices_perms as P, devices as D WHERE `user_id` = '" . $_GET['user_id'] . "' AND D.device_id = P.device_id"); - while($device_perm = mysql_fetch_array($device_perm_data)) { - echo("" . $device_perm['hostname'] . "
    "); - $access_list[] = $device_perm['device_id']; - $permdone = "yes"; - } - - if(!$permdone) { echo("None Configured"); } - - - // Display devices this user doesn't have access to - echo("

    Grant access to new device

    "); - echo(" - - - - "); + if (!$permdone) { echo("None Configured"); } - echo("
    "); - echo("

    Interface Access

    "); + // Display devices this user doesn't have access to + echo("

    Grant access to new device

    "); + echo("
    + + + +
    ".$interface_perm['hostname']." - ".$interface_perm['ifDescr']."
    ". - "" . $interface_perm['ifAlias'] . "
      
    "); - $ipermdone = "yes"; - } - - if(!$ipermdone) { echo("None Configured"); } - - // Display devices this user doesn't have access to - echo("

    Grant access to new interface

    "); - - echo(" - - - - - - -
    Device:
    Interface:
    "); - - echo("
    "); - echo("

    Bill Access

    "); - - $bill_perm_data = mysql_query("SELECT * from bills AS B, bill_perms AS P WHERE P.user_id = '" . $_GET['user_id'] . - "' AND P.bill_id = B.bill_id"); - - while($bill_perm = mysql_fetch_array($bill_perm_data)) { - echo("
    ".$bill_perm['bill_name']."  
    "); - $bill_access_list[] = $bill_perm['bill_id']; - - $bpermdone = "yes"; - } - - if(!$bpermdone) { echo("None Configured"); } - - // Display devices this user doesn't have access to - echo("

    Grant access to new bill

    "); - echo("
    - - - -
    "); + + echo("
    "); + echo("

    Interface Access

    "); + + $interface_perm_data = mysql_query("SELECT * from ports_perms as P, ports as I, devices as D WHERE `user_id` = '" . $_GET['user_id'] . + "' AND I.interface_id = P.interface_id AND D.device_id = I.device_id"); + + while ($interface_perm = mysql_fetch_array($interface_perm_data)) + { + echo("
    ".$interface_perm['hostname']." - ".$interface_perm['ifDescr']."
    ". + "" . $interface_perm['ifAlias'] . "
      
    "); + $ipermdone = "yes"; + } + + if (!$ipermdone) { echo("None Configured"); } + + // Display devices this user doesn't have access to + echo("

    Grant access to new interface

    "); + + echo("
    + + + + + + +
    Device:
    Interface:
    "); + + echo("
    "); + echo("

    Bill Access

    "); + + $bill_perm_data = mysql_query("SELECT * from bills AS B, bill_perms AS P WHERE P.user_id = '" . $_GET['user_id'] . + "' AND P.bill_id = B.bill_id"); + + while ($bill_perm = mysql_fetch_array($bill_perm_data)) + { + echo("
    ".$bill_perm['bill_name']."  
    "); + $bill_access_list[] = $bill_perm['bill_id']; + + $bpermdone = "yes"; + } + + if (!$bpermdone) { echo("None Configured"); } + + // Display devices this user doesn't have access to + echo("

    Grant access to new bill

    "); + echo("
    + + + +
    "); + echo("
    "); + + } else { + + $user_list = mysql_query("SELECT * FROM `users`"); + + echo("

    Select a user to edit

    "); + + echo("
    + +
    "); } -echo(" "); - -echo("
    "); - -} else { - - $user_list = mysql_query("SELECT * FROM `users`"); - - echo("

    Select a user to edit

    "); - - echo("
    - -
    "); - - - -} - } echo(""); -?> - +?> \ No newline at end of file diff --git a/html/pages/eventlog.inc.php b/html/pages/eventlog.inc.php index 7ec3a9cc72..64047a98ec 100644 --- a/html/pages/eventlog.inc.php +++ b/html/pages/eventlog.inc.php @@ -1,8 +1,9 @@ = '10') { mysql_query("TRUNCATE TABLE `eventlog`"); } +if ($_GET['opta'] == "expunge" && $_SESSION['userlevel'] >= '10') { mysql_query("TRUNCATE TABLE `eventlog`"); } -if($_SESSION['userlevel'] >= '5') { +if ($_SESSION['userlevel'] >= '5') +{ $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,250"; } else { $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %Y %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host = P.device_id AND P.user_id = " . $_SESSION['user_id'] . " ORDER BY `datetime` DESC LIMIT 0,250"; @@ -10,13 +11,13 @@ if($_SESSION['userlevel'] >= '5') { $data = mysql_query($query); - echo(''); -while($entry = mysql_fetch_array($data)) { +while ($entry = mysql_fetch_array($data)) +{ include("includes/print-event.inc"); } echo("
    "); -?> +?> \ No newline at end of file diff --git a/html/pages/front/default.php b/html/pages/front/default.php index ec61ee073c..b8a01fe8be 100644 --- a/html/pages/front/default.php +++ b/html/pages/front/default.php @@ -1,6 +1,7 @@ $content "); @@ -8,12 +9,13 @@ echo("
    "); -if($_SESSION['userlevel'] == '10') { +if ($_SESSION['userlevel'] == '10') +{ $sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'"); } else { $sql = mysql_query("SELECT * FROM `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND D.status = '0' AND D.ignore = '0'"); } -while($device = mysql_fetch_array($sql)){ +while ($device = mysql_fetch_array($sql)){ generate_front_box("#ffaaaa", "
    ".generate_device_link($device, shorthost($device['hostname']))."
    Device Down
    @@ -22,7 +24,8 @@ while($device = mysql_fetch_array($sql)){ } -if($_SESSION['userlevel'] == '10') { +if ($_SESSION['userlevel'] == '10') +{ $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); } else { $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); @@ -30,52 +33,56 @@ $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D, devices_perms AS ### These things need to become more generic, and more manageable across different frontpages... rewrite inc :> -while($interface = mysql_fetch_array($sql)){ - if(!$interface['deleted']){ - $interface = ifNameDescr($interface); - generate_front_box("#ffdd99", "
    ".generate_device_link($interface, shorthost($interface['hostname']))."
    +while ($interface = mysql_fetch_array($sql)) +{ + if (!$interface['deleted']) + { + $interface = ifNameDescr($interface); + generate_front_box("#ffdd99", "
    ".generate_device_link($interface, shorthost($interface['hostname']))."
    Port Down
    ".generate_port_link($interface, truncate(makeshortif($interface['label']),13,''))."
    " . ($interface['ifAlias'] ? ''.truncate($interface['ifAlias'], 20, '').'' : '') . "
    "); - } } /* FIXME service permissions? seem nonexisting now.. */ $sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'"); -while($service = mysql_fetch_array($sql)){ - generate_front_box("#ffaaaa", "
    ".generate_device_link($service, shorthost($service['hostname']))."
    - Service Down - ".$service['service_type']."
    - ".truncate($interface['ifAlias'], 20)." -
    "); +while ($service = mysql_fetch_array($sql)) +{ + generate_front_box("#ffaaaa", "
    ".generate_device_link($service, shorthost($service['hostname']))."
    + Service Down + ".$service['service_type']."
    + ".truncate($interface['ifAlias'], 20)." +
    "); } if (isset($config['enable_bgp']) && $config['enable_bgp']) { - if($_SESSION['userlevel'] == '10') { + if ($_SESSION['userlevel'] == '10') + { $sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0"); } else { $sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND bgpPeerState != 'established' AND bgpPeerState != '' AND B.device_id = D.device_id AND D.ignore = 0"); } - while($peer = mysql_fetch_array($sql)) + while ($peer = mysql_fetch_array($sql)) { generate_front_box("#ffaaaa", "
    ".generate_device_link($peer, shorthost($peer['hostname']))."
    - BGP Down + BGP Down ".$peer['bgpPeerIdentifier']."
    AS".truncate($peer['bgpPeerRemoteAs']." ".$peer['astext'], 14, "")."
    "); } } -if($_SESSION['userlevel'] == '10') { +if ($_SESSION['userlevel'] == '10') +{ $sql = mysql_query("SELECT * FROM `devices` AS D WHERE D.status = '1' AND D.uptime < '84600' AND D.ignore = 0"); } else { $sql = mysql_query("SELECT * FROM `devices` AS D, devices_perms AS P WHERE D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' AND D.status = '1' AND D.uptime < '84600' AND D.ignore = 0"); } -while($device = mysql_fetch_array($sql)){ +while ($device = mysql_fetch_array($sql)){ generate_front_box("#aaffaa", "
    ".generate_device_link($device, shorthost($device['hostname']))."
    Device
    Rebooted

    ".formatUptime($device['uptime'], 'short')." @@ -83,19 +90,19 @@ while($device = mysql_fetch_array($sql)){ } -if($config['enable_syslog']) { - +if ($config['enable_syslog']) +{ ## Open Syslog Div - echo("
    + echo("

    Recent Syslog Messages

    "); $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20"; $query = mysql_query($sql); echo(""); - while($entry = mysql_fetch_array($query)) { + while ($entry = mysql_fetch_array($query)) { $entry = array_merge($entry, device_by_id_cache($entry['device_id'])); - include("includes/print-syslog.inc"); + include("includes/print-syslog.inc"); } echo("
    "); @@ -108,7 +115,8 @@ if($config['enable_syslog']) {

    Recent Eventlog Entries

    "); -if($_SESSION['userlevel'] == '10') { +if ($_SESSION['userlevel'] == '10') +{ $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` ORDER BY `datetime` DESC LIMIT 0,15"; } else { $query = "SELECT *,DATE_FORMAT(datetime, '%D %b %T') as humandate FROM `eventlog` AS E, devices_perms AS P WHERE E.host = @@ -119,7 +127,7 @@ $data = mysql_query($query); echo(""); -while($entry = mysql_fetch_array($data)) { +while ($entry = mysql_fetch_array($data)) { include("includes/print-event.inc"); } @@ -129,4 +137,4 @@ echo("
    "); echo("
    "); -?> +?> \ No newline at end of file diff --git a/html/pages/front/demo.php b/html/pages/front/demo.php index 087a5e1178..ea09176dbd 100644 --- a/html/pages/front/demo.php +++ b/html/pages/front/demo.php @@ -8,7 +8,7 @@ $nodes = array(); $sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'"); -while($device = mysql_fetch_array($sql)){ +while ($device = mysql_fetch_array($sql)){ unset($already); $i = 0; while ($i <= count($nodes)) { @@ -18,13 +18,13 @@ while($device = mysql_fetch_array($sql)){ } $i++; } - if(!$already) { $nodes[] = $device['device_id']; } + if (!$already) { $nodes[] = $device['device_id']; } } $sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'"); -while($device = mysql_fetch_array($sql)){ - if(device_permitted($device['device_id'])) { +while ($device = mysql_fetch_array($sql)){ + if (device_permitted($device['device_id'])) { echo("
    ".generate_device_link($device, shorthost($device['hostname']))."
    Device Down
    @@ -33,11 +33,11 @@ while($device = mysql_fetch_array($sql)){ } } -if($config['warn']['ifdown']) { +if ($config['warn']['ifdown']) { $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); -while($interface = mysql_fetch_array($sql)){ - if(port_permitted($interface['interface_id'])) { +while ($interface = mysql_fetch_array($sql)){ + if (port_permitted($interface['interface_id'])) { echo("
    ".generate_device_link($interface, shorthost($interface['hostname']))."
    Port Down
    @@ -50,8 +50,8 @@ while($interface = mysql_fetch_array($sql)){ } $sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'"); -while($service = mysql_fetch_array($sql)){ - if(device_permitted($service['device_id'])) { +while ($service = mysql_fetch_array($sql)){ + if (device_permitted($service['device_id'])) { echo("
    ".generate_device_link($service, shorthost($service['hostname']))."
    Service Down
    @@ -62,11 +62,11 @@ while($service = mysql_fetch_array($sql)){ } $sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id"); -while($peer = mysql_fetch_array($sql)){ - if(device_permitted($peer['device_id'])) { +while ($peer = mysql_fetch_array($sql)){ + if (device_permitted($peer['device_id'])) { echo("
    ".generate_device_link($peer, shorthost($peer['hostname']))."
    - BGP Down
    + BGP Down
    ".$peer['bgpPeerIdentifier']."
    AS".$peer['bgpPeerRemoteAs']." ".truncate($peer['astext'], 10)."
    "); @@ -74,8 +74,8 @@ while($peer = mysql_fetch_array($sql)){ } $sql = mysql_query("SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_value < '84600' AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'"); -while($device = mysql_fetch_array($sql)){ - if(device_permitted($device['device_id']) && $device['attrib_value'] < "84600" && $device['attrib_type'] == "uptime" ) { +while ($device = mysql_fetch_array($sql)){ + if (device_permitted($device['device_id']) && $device['attrib_value'] < "84600" && $device['attrib_type'] == "uptime" ) { echo("
    ".generate_device_link($device, shorthost($device['hostname']))."
    Device
    Rebooted

    @@ -87,7 +87,7 @@ while($device = mysql_fetch_array($sql)){ echo(" -
    $errorboxes
    +
    $errorboxes

    Recent Syslog Messages

    @@ -96,10 +96,10 @@ echo(" $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from `syslog` ORDER BY seq DESC LIMIT 20"; $query = mysql_query($sql); echo(""); -while($entry = mysql_fetch_array($query)) +while ($entry = mysql_fetch_array($query)) { $entry = array_merge($entry, device_by_id_cache($entry['device_id'])); - include("includes/print-syslog.inc"); + include("includes/print-syslog.inc"); } echo("
    "); @@ -119,7 +119,7 @@ echo("
    echo("
    "); - if($ports['fileserver']) { + if ($ports['fileserver']) { echo("
    "); echo("
    Central Fileserver
    "); diff --git a/html/pages/front/example2.php b/html/pages/front/example2.php index 306516d395..669e5931da 100644 --- a/html/pages/front/example2.php +++ b/html/pages/front/example2.php @@ -11,37 +11,39 @@ $nodes = array(); $sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'"); -while($device = mysql_fetch_array($sql)){ +while ($device = mysql_fetch_array($sql)) +{ unset($already); $i = 0; - while ($i <= count($nodes)) { + while ($i <= count($nodes)) + { $thisnode = $device['device_id']; - if ($nodes[$i] == $thisnode) { + if ($nodes[$i] == $thisnode) + { $already = "yes"; } $i++; } - if(!$already) { $nodes[] = $device['device_id']; } + if (!$already) { $nodes[] = $device['device_id']; } } - $sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'"); -while($device = mysql_fetch_array($sql)){ +while ($device = mysql_fetch_array($sql)){ echo("
    ".generate_device_link($device, shorthost($device['hostname']))."
    - Device Down + Device Down ".truncate($device['location'], 20)."
    "); } $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); -while($interface = mysql_fetch_array($sql)){ +while ($interface = mysql_fetch_array($sql)){ echo("
    ".generate_device_link($interface, shorthost($interface['hostname']))."
    - Port Down + Port Down ".generate_port_link($interface, makeshortif($interface['ifDescr']))."
    ".truncate($interface['ifAlias'], 20)."
    "); @@ -49,11 +51,11 @@ while($interface = mysql_fetch_array($sql)){ } $sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'"); -while($service = mysql_fetch_array($sql)){ +while ($service = mysql_fetch_array($sql)){ echo("
    ".generate_device_link($service, shorthost($service['hostname']))."
    - Service Down + Service Down ".$service['service_type']."
    ".truncate($interface['ifAlias'], 20)."
    "); @@ -61,11 +63,11 @@ while($service = mysql_fetch_array($sql)){ } $sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerState != 'established' AND B.device_id = D.device_id"); -while($peer = mysql_fetch_array($sql)){ +while ($peer = mysql_fetch_array($sql)){ echo("
    ".generate_device_link($peer, shorthost($peer['hostname']))."
    - BGP Down + BGP Down ".$peer['bgpPeerIdentifier']."
    AS".$peer['bgpPeerRemoteAs']." ".truncate($peer['astext'], 10)."
    "); @@ -73,21 +75,19 @@ while($peer = mysql_fetch_array($sql)){ } $sql = mysql_query("SELECT * FROM `devices` AS D, devices_attribs AS A WHERE A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value < '84600'"); -while($device = mysql_fetch_array($sql)){ +while ($device = mysql_fetch_array($sql)){ echo("
    ".generate_device_link($device, shorthost($device['hostname']))."
    - Device
    Rebooted

    + Device
    Rebooted

    ".formatUptime($device['attrib_value'])."
    "); } - - echo(" -
    $errorboxes
    +
    $errorboxes

    Recent Syslog Messages

    @@ -96,7 +96,7 @@ echo(" $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog ORDER BY timestamp DESC LIMIT 20"; $query = mysql_query($sql); echo(""); -while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } +while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } echo("
    "); @@ -108,13 +108,13 @@ echo("
    /// this stuff can be customised to show whatever you want.... -if($_SESSION['userlevel'] >= '5') { +if ($_SESSION['userlevel'] >= '5') { $sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'L2TP: %' AND I.device_id = D.device_id AND D.hostname LIKE '%"; $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); - while($interface = mysql_fetch_array($query)) { + while ($interface = mysql_fetch_array($query)) { $ports['l2tp'] .= $seperator . $interface['interface_id']; $seperator = ","; } @@ -123,7 +123,7 @@ if($_SESSION['userlevel'] >= '5') { $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); - while($interface = mysql_fetch_array($query)) { + while ($interface = mysql_fetch_array($query)) { $ports['transit'] .= $seperator . $interface['interface_id']; $seperator = ","; } @@ -132,12 +132,12 @@ if($_SESSION['userlevel'] >= '5') { $sql .= $config['mydomain'] . "' ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); - while($interface = mysql_fetch_array($query)) { + while ($interface = mysql_fetch_array($query)) { $ports['voip'] .= $seperator . $interface['interface_id']; $seperator = ","; } - if($ports['transit']) { + if ($ports['transit']) { echo("', CENTER, LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". "
    Internet Transit
    ". @@ -145,7 +145,7 @@ if($_SESSION['userlevel'] >= '5') { "&from=".$day."&to=".$now."&width=200&height=100'>
    "); } - if($ports['l2tp']) { + if ($ports['l2tp']) { echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". "
    L2TP ADSL
    ". @@ -153,7 +153,7 @@ if($_SESSION['userlevel'] >= '5') { "&from=".$day."&to=".$now."&width=200&height=100'>
    "); } - if($ports['voip']) { + if ($ports['voip']) { echo("', LEFT, FGCOLOR, '#e5e5e5', BGCOLOR, '#e5e5e5', WIDTH, 400, HEIGHT, 250);\" onmouseout=\"return nd();\" >". "
    VoIP to PSTN
    ". diff --git a/html/pages/front/jt.php b/html/pages/front/jt.php index f32f1f4df3..9157ddc0d7 100644 --- a/html/pages/front/jt.php +++ b/html/pages/front/jt.php @@ -8,7 +8,7 @@ $nodes = array(); $sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'"); -while($device = mysql_fetch_array($sql)){ +while ($device = mysql_fetch_array($sql)){ unset($already); $i = 0; while ($i <= count($nodes)) { @@ -18,13 +18,13 @@ while($device = mysql_fetch_array($sql)){ } $i++; } - if(!$already) { $nodes[] = $device['device_id']; } + if (!$already) { $nodes[] = $device['device_id']; } } $sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'"); -while($device = mysql_fetch_array($sql)){ - if(device_permitted($device['device_id'])) { +while ($device = mysql_fetch_array($sql)){ + if (device_permitted($device['device_id'])) { echo("
    ".generate_device_link($device, shorthost($device['hostname']))."
    Device Down
    @@ -33,11 +33,11 @@ while($device = mysql_fetch_array($sql)){ } } -if($config['warn']['ifdown']) { +if ($config['warn']['ifdown']) { $sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'"); -while($interface = mysql_fetch_array($sql)){ - if(port_permitted($interface['interface_id'])) { +while ($interface = mysql_fetch_array($sql)){ + if (port_permitted($interface['interface_id'])) { echo("
    ".generate_device_link($interface, shorthost($interface['hostname']))."
    Port Down
    @@ -50,8 +50,8 @@ while($interface = mysql_fetch_array($sql)){ } $sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'"); -while($service = mysql_fetch_array($sql)){ - if(device_permitted($service['device_id'])) { +while ($service = mysql_fetch_array($sql)){ + if (device_permitted($service['device_id'])) { echo("
    ".generate_device_link($service, shorthost($service['hostname']))."
    Service Down
    @@ -62,11 +62,11 @@ while($service = mysql_fetch_array($sql)){ } $sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id"); -while($peer = mysql_fetch_array($sql)){ - if(device_permitted($peer['device_id'])) { +while ($peer = mysql_fetch_array($sql)){ + if (device_permitted($peer['device_id'])) { echo("
    ".generate_device_link($peer, shorthost($peer['hostname']))."
    - BGP Down
    + BGP Down
    ".$peer['bgpPeerIdentifier']."
    AS".$peer['bgpPeerRemoteAs']." ".truncate($peer['astext'], 10)."
    "); @@ -74,8 +74,8 @@ while($peer = mysql_fetch_array($sql)){ } $sql = mysql_query("SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_value < '84600' AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'"); -while($device = mysql_fetch_array($sql)){ - if(device_permitted($device['device_id']) && $device['attrib_value'] < "84600" && $device['attrib_type'] == "uptime" ) { +while ($device = mysql_fetch_array($sql)){ + if (device_permitted($device['device_id']) && $device['attrib_value'] < "84600" && $device['attrib_type'] == "uptime" ) { echo("
    ".generate_device_link($device, shorthost($device['hostname']))."
    Device
    Rebooted

    @@ -87,7 +87,7 @@ while($device = mysql_fetch_array($sql)){ echo(" -
    $errorboxes
    +
    $errorboxes

    Recent Syslog Messages

    @@ -96,7 +96,7 @@ echo(" $sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog,devices WHERE syslog.device_id = devices.device_id ORDER BY seq DESC LIMIT 20"; $query = mysql_query($sql); echo(""); -while($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } +while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc"); } echo("
    "); @@ -108,13 +108,13 @@ echo("
    /// this stuff can be customised to show whatever you want.... -if($_SESSION['userlevel'] >= '5') +if ($_SESSION['userlevel'] >= '5') { $sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); - while($interface = mysql_fetch_array($query)) { + while ($interface = mysql_fetch_array($query)) { $ports['transit'] .= $seperator . $interface['interface_id']; $seperator = ","; } @@ -122,7 +122,7 @@ if($_SESSION['userlevel'] >= '5') $sql = "select * from ports as I, devices as D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id ORDER BY I.ifAlias"; $query = mysql_query($sql); unset ($seperator); - while($interface = mysql_fetch_array($query)) { + while ($interface = mysql_fetch_array($query)) { $ports['peering'] .= $seperator . $interface['interface_id']; $seperator = ","; } @@ -136,7 +136,7 @@ if($_SESSION['userlevel'] >= '5') echo("
    "); - if($ports['peering'] && $ports['transit']) { + if ($ports['peering'] && $ports['transit']) { echo("
    \ @@ -151,7 +151,7 @@ if($_SESSION['userlevel'] >= '5') echo("
    "); - if($ports['transit']) { + if ($ports['transit']) { echo(""); } - if($ports['peering']) { + if ($ports['peering']) { echo("
    \ @@ -177,7 +177,7 @@ if($_SESSION['userlevel'] >= '5') echo("
    "); - if($ports['broadband'] && $ports['wave_broadband'] && $ports['new_broadband']) { + if ($ports['broadband'] && $ports['wave_broadband'] && $ports['new_broadband']) { echo("
    \ @@ -192,7 +192,7 @@ if($_SESSION['userlevel'] >= '5') echo("
    "); - if($ports['broadband']) { + if ($ports['broadband']) { echo("
    \ @@ -205,7 +205,7 @@ if($_SESSION['userlevel'] >= '5') echo("
    "); - if($ports['new_broadband']) { + if ($ports['new_broadband']) { echo(""); - if($ports['wave_broadband']) { + if ($ports['wave_broadband']) { echo("
    \ diff --git a/html/pages/graphs.inc.php b/html/pages/graphs.inc.php index b66299b166..6e6c128424 100644 --- a/html/pages/graphs.inc.php +++ b/html/pages/graphs.inc.php @@ -1,51 +1,47 @@ [A-Za-z0-9]+)_(?P.+)/', mres($graph_type), $graphtype); - preg_match('/^(?P[A-Za-z0-9]+)_(?P.+)/', mres($graph_type), $graphtype); +$type = $graphtype['type']; +$subtype = $graphtype['subtype']; - $type = $graphtype['type']; - $subtype = $graphtype['subtype']; +if (isset($config['graph'][$type][$subtype])) { $descr = $config['graph'][$type][$subtype]; } else { $descr = $graph_type; } - if(isset($config['graph'][$type][$subtype])) { $descr = $config['graph'][$type][$subtype]; } else { $descr = $graph_type; } +#$descr = mysql_result(mysql_query("SELECT `graph_descr` FROM `graph_types` WHERE `graph_type` = '".$type."' AND `graph_subtype` = '".$subtype."'"),0); - #$descr = mysql_result(mysql_query("SELECT `graph_descr` FROM `graph_types` WHERE `graph_type` = '".$type."' AND `graph_subtype` = '".$subtype."'"),0); +$descr = $config['graph_types'][$type][$subtype]['descr']; - $descr = $config['graph_types'][$type][$subtype]['descr']; +if (is_file("includes/graphs/".$type."/auth.inc.php")) +{ + include("includes/graphs/".$type."/auth.inc.php"); +} - if(is_file("includes/graphs/".$type."/auth.inc.php")) - { - include("includes/graphs/".$type."/auth.inc.php"); - } - - if(!$auth) - { - include("includes/error-no-perm.inc.php"); - } else { +if (!$auth) +{ + include("includes/error-no-perm.inc.php"); +} else { -# Do we really need to show the type? User does not have to see the type of graph (i.e. sensor_temperature) -# if(isset($config['graph'][$type][$subtype])) { $title .= " :: ".$config['graph'][$type][$subtype]; } else { $title .= " :: ".$graph_type; } +# Do we really need to show the type? User does not have to see the type of graph (i.e. sensor_temperature) +# if (isset($config['graph'][$type][$subtype])) { $title .= " :: ".$config['graph'][$type][$subtype]; } else { $title .= " :: ".$graph_type; } $graph_array['height'] = "60"; $graph_array['width'] = "150"; - $graph_array['legend'] = "no"; + $graph_array['legend'] = "no"; $graph_array['to'] = $now; $graph_array['id'] = $id; $graph_array['type'] = $graph_type; $graph_array['from'] = $day; $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; - print_optionbar_start(); echo($title); print_optionbar_end(); - echo("
    "); echo("
    "); @@ -116,11 +112,7 @@ if(is_numeric($_GET['optd'])) { $to = $_GET['optd']; } else { $to = $now; } echo("
    "); echo(generate_graph_tag($graph_array)); echo("
    "); - - echo("
    "); - } - -?> +?> \ No newline at end of file diff --git a/html/pages/health.inc.php b/html/pages/health.inc.php index 1a67e478bf..2f9cd6fa01 100644 --- a/html/pages/health.inc.php +++ b/html/pages/health.inc.php @@ -2,23 +2,22 @@ $datas = array('Processors','Memory','Storage','Temperatures', 'Humidity', 'Fanspeeds', 'Voltages', 'Frequencies', 'Current'); -if(!$_GET['opta']) { $_GET['opta'] = "processors"; } -if(!$_GET['optb']) { $_GET['optb'] = "nographs"; } - +if (!$_GET['opta']) { $_GET['opta'] = "processors"; } +if (!$_GET['optb']) { $_GET['optb'] = "nographs"; } print_optionbar_start('', ''); $sep = ""; -foreach ($datas as $texttype) +foreach ($datas as $texttype) { $type = strtolower($texttype); echo($sep); - if ($_GET['opta'] == $type) - { + if ($_GET['opta'] == $type) + { echo(""); echo(''); - } - else + } + else { echo(''); } @@ -26,26 +25,39 @@ foreach ($datas as $texttype) if ($_GET['opta'] == $type) { echo(""); } $sep = ' | '; } + unset ($sep); echo('
    '); -if($_GET['optb'] == "graphs") { echo(''); +if ($_GET['optb'] == "graphs") +{ + echo(''); echo(''); } else { echo(''); } + echo(' Graphs'); -if($_GET['optb'] == "graphs") { echo(''); } + +if ($_GET['optb'] == "graphs") +{ + echo(''); +} + echo(' | '); -if($_GET['optb'] == "nographs") { echo(''); + +if ($_GET['optb'] == "nographs") +{ + echo(''); echo(''); } else { echo(''); } -echo(' No Graphs'); -if($_GET['optb'] == "nographs") { echo(''); } +echo(' No Graphs'); + +if ($_GET['optb'] == "nographs") { echo(''); } echo('
    '); @@ -69,4 +81,4 @@ switch ($_GET['opta']) break; } -?> +?> \ No newline at end of file diff --git a/html/pages/health/current.inc.php b/html/pages/health/current.inc.php index 6c0f76734c..27bb5862a1 100644 --- a/html/pages/health/current.inc.php +++ b/html/pages/health/current.inc.php @@ -3,7 +3,8 @@ $graph_type = "sensor_current"; $unit = "A"; -if($_SESSION['userlevel'] >= '5') { +if ($_SESSION['userlevel'] >= '5') +{ $sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='current' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_descr"; } else { $sql = "SELECT * FROM `current` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='current' AND S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_descr"; @@ -26,16 +27,16 @@ echo(' $row = 1; -while($sensor = mysql_fetch_array($query)) +while ($sensor = mysql_fetch_array($query)) { - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150"; $sensor_popup = "', LEFT);\" onmouseout=\"return nd();\"> " . $sensor['sensor_descr'] . ""; - if($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } - + if ($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } + $sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100"; $sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100"; $sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100"; @@ -56,40 +57,37 @@ while($sensor = mysql_fetch_array($query)) " . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . " \n"); - if($_GET['optb'] == "graphs") { ## If graphs + if ($_GET['optb'] == "graphs") + { ## If graphs + echo(""); - echo(""); + $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; - $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; + $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; - $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; + $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; - $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; + $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo(""); - - } # endif graphs + echo(""); + } # endif graphs $row++; - } echo(""); - -?> +?> \ No newline at end of file diff --git a/html/pages/health/fanspeeds.inc.php b/html/pages/health/fanspeeds.inc.php index d928d5b018..75cd350af0 100644 --- a/html/pages/health/fanspeeds.inc.php +++ b/html/pages/health/fanspeeds.inc.php @@ -3,7 +3,8 @@ $graph_type = "sensor_fanspeed"; $unit = "rpm"; -if($_SESSION['userlevel'] >= '5') { +if ($_SESSION['userlevel'] >= '5') +{ $sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='fanspeed' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_descr"; } else { $sql = "SELECT * FROM `sensors` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='fanspeed' AND S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_descr"; @@ -25,16 +26,16 @@ echo(' $row = 1; -while($sensor = mysql_fetch_array($query)) +while ($sensor = mysql_fetch_array($query)) { - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150"; $sensor_popup = "', LEFT);\" onmouseout=\"return nd();\"> " . $sensor['sensor_descr'] . ""; - if($sensor['sensor_current'] <= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } - + if ($sensor['sensor_current'] <= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } + $sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100"; $sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100"; $sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100"; @@ -54,42 +55,38 @@ while($sensor = mysql_fetch_array($query)) " . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . " \n"); - if($_GET['optb'] == "graphs") { ## If graphs + if ($_GET['optb'] == "graphs") + { - echo(""); + echo(""); - $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; + $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; - $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; + $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; - $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; + $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; - $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; + $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo(""); - - } # endif graphs - + echo(""); + } # endif graphs $row++; - } echo(""); - -?> - +?> \ No newline at end of file diff --git a/html/pages/health/frequencies.inc.php b/html/pages/health/frequencies.inc.php index 7b714c6a38..60de2206fa 100644 --- a/html/pages/health/frequencies.inc.php +++ b/html/pages/health/frequencies.inc.php @@ -3,7 +3,8 @@ $graph_type = "sensor_frequency"; $unit = "Hz"; -if($_SESSION['userlevel'] >= '5') { +if ($_SESSION['userlevel'] >= '5') +{ $sql = "SELECT * FROM `sensors` AS V, `devices` AS D WHERE V.sensor_class='freq' AND V.device_id = D.device_id ORDER BY D.hostname, V.sensor_descr"; } else { $sql = "SELECT * FROM `sensors` AS V, `devices` AS D, devices_perms as P WHERE V.sensor_class='freq' V.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, V.sensor_descr"; @@ -25,16 +26,16 @@ echo(' $row = 1; -while($sensor = mysql_fetch_array($query)) +while ($sensor = mysql_fetch_array($query)) { - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150"; $sensor_popup = "', LEFT);\" onmouseout=\"return nd();\"> " . $sensor['sensor_descr'] . ""; - if($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } - + if ($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } + $sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100"; $sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100"; $sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100"; @@ -54,39 +55,38 @@ while($sensor = mysql_fetch_array($query)) " . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . " \n"); - if($_GET['optb'] == "graphs") { ## If graphs + if ($_GET['optb'] == "graphs") + { - echo(""); + echo(""); - $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; + $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; - $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; + $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; - $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; + $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; - $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; + $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo(""); + echo(""); - } # endif graphs + } # endif graphs $row++; - } echo(""); - -?> +?> \ No newline at end of file diff --git a/html/pages/health/humidity.inc.php b/html/pages/health/humidity.inc.php index c2f1b1efdf..fd0918668c 100644 --- a/html/pages/health/humidity.inc.php +++ b/html/pages/health/humidity.inc.php @@ -3,7 +3,8 @@ $graph_type = "sensor_humidity"; $unit = "%"; -if($_SESSION['userlevel'] >= '5') { +if ($_SESSION['userlevel'] >= '5') +{ $sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='humidity' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_index, S.sensor_descr"; } else { $sql = "SELECT * FROM `sensors` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='humidity' AND S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_index, S.sensor_descr"; @@ -25,9 +26,9 @@ echo(' $row = 1; -while($sensor = mysql_fetch_array($query)) +while ($sensor = mysql_fetch_array($query)) { - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150"; $sensor_popup = "', LEFT);\" onmouseout=\"return nd();\"> @@ -38,8 +39,8 @@ while($sensor = mysql_fetch_array($query)) $sensor_perc = $sensor['sensor_current'] / $sensor['sensor_limit'] * 100; $sensor_colour = percent_colour($sensor_perc); - if($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } - + if ($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } + $sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100"; $sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100"; $sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100"; @@ -59,42 +60,37 @@ while($sensor = mysql_fetch_array($query)) " . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . " \n"); - if($_GET['optb'] == "graphs") { ## If graphs + if ($_GET['optb'] == "graphs") + { + echo(""); - echo(""); + $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; - $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; + $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; - $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; + $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; - $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; + $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo(""); - - } # endif graphs - + echo(""); + } # endif graphs $row++; - } echo(""); - -?> - +?> \ No newline at end of file diff --git a/html/pages/health/memory.inc.php b/html/pages/health/memory.inc.php index 5e2207543b..71d66877e9 100644 --- a/html/pages/health/memory.inc.php +++ b/html/pages/health/memory.inc.php @@ -1,17 +1,19 @@ "); - echo(""); - $i = '1'; - $mempools = mysql_query("SELECT * FROM `mempools` AS M, `devices` as D WHERE D.device_id = M.device_id ORDER BY D.hostname"); - while($mempool = mysql_fetch_array($mempools)) { - if(device_permitted($mempool['device_id'])) { - if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - + +echo("
    "); +echo("
    "); +$i = '1'; +$mempools = mysql_query("SELECT * FROM `mempools` AS M, `devices` as D WHERE D.device_id = M.device_id ORDER BY D.hostname"); +while ($mempool = mysql_fetch_array($mempools)) +{ + if (device_permitted($mempool['device_id'])) + { + if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + $proc_url = "?page=device/".$device['device_id']."/health/memory/"; - + $text_descr = $mempool['mempool_descr']; $mempool_url = "/device/".$mempool['device_id']."/health/memory/"; @@ -27,11 +29,11 @@ $graph_type = "mempool_usage"; $perc = round($mempool['mempool_used'] / $mempool['mempool_total'] * 100); - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } echo(" @@ -42,40 +44,39 @@ $graph_type = "mempool_usage"; "); - if($_GET['optb'] == "graphs") { ## If graphs - - echo(""); - + echo(""); } # endif graphs - - $i++; - } - } - echo("
    ".generate_device_link($mempool)." ".$perc."%
    "); - - $daily_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; - - $weekly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; - - $monthly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; - - $yearly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> + + if ($_GET['optb'] == "graphs") + { + echo("
    "); + + $daily_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; + + $weekly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; + + $monthly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; + + $yearly_graph = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $mempool['mempool_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; + + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("
    "); - echo("
    "); - - -?> + $i++; + } +} + +echo(""); +echo("
    "); + +?> \ No newline at end of file diff --git a/html/pages/health/processors.inc.php b/html/pages/health/processors.inc.php index 8a95b57f3c..6102ea01b9 100644 --- a/html/pages/health/processors.inc.php +++ b/html/pages/health/processors.inc.php @@ -2,15 +2,15 @@ $graph_type = "processor_usage"; - echo("
    "); - echo(" "); - $i = '1'; - $procs = mysql_query("SELECT * FROM `processors` AS P, `devices` AS D WHERE D.device_id = P.device_id ORDER BY D.hostname"); - while($proc = mysql_fetch_array($procs)) { - - if(device_permitted($proc['device_id'])) { - - if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } +echo("
    "); +echo("
    "); +$i = '1'; +$procs = mysql_query("SELECT * FROM `processors` AS P, `devices` AS D WHERE D.device_id = P.device_id ORDER BY D.hostname"); +while ($proc = mysql_fetch_array($procs)) +{ + if (device_permitted($proc['device_id'])) + { + if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $device = $proc; @@ -20,7 +20,6 @@ $graph_type = "processor_usage"; $text_descr = str_replace("Sub-Module", "Module ", $text_descr); $text_descr = str_replace("DFC Card", "DFC", $text_descr); - $proc_url = "/device/".$device['device_id']."/health/processors/"; $mini_url = $config['base_url'] . "/graph.php?id=".$proc['processor_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; @@ -31,11 +30,11 @@ $graph_type = "processor_usage"; $perc = round($proc['processor_usage']); - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } echo(" @@ -44,42 +43,41 @@ $graph_type = "processor_usage"; '); - - if($_GET['optb'] == "graphs") { ## If graphs are requested, do them, else not! - echo(' + echo(" "); - } #end graphs if + } #end graphs if $i++; - } - } - echo("
    ".generate_device_link($proc)." ".print_percentage_bar (400, 20, $perc, $perc."%", "ffffff", $left_background, (100 - $perc)."%" , "ffffff", $right_background).'
    '); + if ($_GET['optb'] == "graphs") + { ## If graphs are requested, do them, else not! + echo('
    '); - $daily_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; + $daily_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; - $weekly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; + $weekly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; - $monthly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; + $monthly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; - $yearly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; + $yearly_graph = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $proc['processor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - echo(" ', LEFT);\" onmouseout=\"return nd();\"> + echo(" ', LEFT);\" onmouseout=\"return nd();\"> "); - echo(" ', LEFT);\" onmouseout=\"return nd();\"> + echo(" ', LEFT);\" onmouseout=\"return nd();\"> "); - echo(" ', LEFT);\" onmouseout=\"return nd();\"> + echo(" ', LEFT);\" onmouseout=\"return nd();\"> "); - echo(" ', LEFT);\" onmouseout=\"return nd();\"> + echo(" ', LEFT);\" onmouseout=\"return nd();\"> "); - echo("
    "); - echo("
    "); +} +echo(""); +echo("
    "); -?> +?> \ No newline at end of file diff --git a/html/pages/health/storage.inc.php b/html/pages/health/storage.inc.php index dba98f4708..e71ea63c0c 100644 --- a/html/pages/health/storage.inc.php +++ b/html/pages/health/storage.inc.php @@ -19,48 +19,53 @@ echo(" $row = 1; -while($drive = mysql_fetch_array($query)) { - - if(device_permitted($drive['device_id'])){ - +while ($drive = mysql_fetch_array($query)) +{ + if (device_permitted($drive['device_id'])) + { $skipdrive = 0; - if ($drive["os"] == "junos") { - foreach ($config['ignore_junos_os_drives'] as $jdrive) { - if (preg_match($jdrive, $drive["storage_descr"])) { - $skipdrive = 1; - } + if ($drive["os"] == "junos") + { + foreach ($config['ignore_junos_os_drives'] as $jdrive) + { + if (preg_match($jdrive, $drive["storage_descr"])) + { + $skipdrive = 1; } - $drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]); + } + $drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]); } - if ($drive['os'] == "freebsd") { - foreach ($config['ignore_bsd_os_drives'] as $jdrive) { - if (preg_match($jdrive, $drive["storage_descr"])) { - $skipdrive = 1; - } + if ($drive['os'] == "freebsd") + { + foreach ($config['ignore_bsd_os_drives'] as $jdrive) + { + if (preg_match($jdrive, $drive["storage_descr"])) + { + $skipdrive = 1; } + } } if ($skipdrive) { continue; } - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $perc = round($drive['storage_perc'], 0); $total = formatStorage($drive['storage_size']); $free = formatStorage($drive['storage_free']); $used = formatStorage($drive['storage_used']); - $store_url = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=125"; + $store_url = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=125"; $store_popup = "onmouseover=\"return overlib('', LEFT);\" onmouseout=\"return nd();\""; $mini_graph = $config['base_url'] . "/graph.php?id=".$drive['storage_id']."&type=".$graph_type."&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } - + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } echo("" . generate_device_link($drive) . "" . $drive['storage_descr'] . " @@ -68,45 +73,39 @@ while($drive = mysql_fetch_array($query)) { ".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, $free, "ffffff", $right_background)." $perc"."%"); + if ($_GET['optb'] == "graphs") + { - if($_GET['optb'] == "graphs") { ## If graphs + echo(""); - echo(""); + $daily_graph = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; - $daily_graph = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; + $weekly_graph = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; - $weekly_graph = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; + $monthly_graph = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; - $monthly_graph = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; + $yearly_graph = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - $yearly_graph = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $drive['storage_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo(""); + echo(""); } # endif graphs - - $row++; - } - } echo("
    "); - -?> - +?> \ No newline at end of file diff --git a/html/pages/health/temperatures.inc.php b/html/pages/health/temperatures.inc.php index e11e5cd2ed..00db1a04d9 100644 --- a/html/pages/health/temperatures.inc.php +++ b/html/pages/health/temperatures.inc.php @@ -3,7 +3,8 @@ $graph_type = "sensor_temperature"; $unit = "°C"; -if($_SESSION['userlevel'] >= '5') { +if ($_SESSION['userlevel'] >= '5') +{ $sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='temperature' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_index, S.sensor_descr"; } else { $sql = "SELECT * FROM `sensors` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='temperature' AND S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_index, S.sensor_descr"; @@ -25,9 +26,9 @@ echo(' $row = 1; -while($sensor = mysql_fetch_array($query)) +while ($sensor = mysql_fetch_array($query)) { - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150"; $sensor_popup = "', LEFT);\" onmouseout=\"return nd();\"> @@ -38,8 +39,8 @@ while($sensor = mysql_fetch_array($query)) $sensor_perc = $sensor['sensor_current'] / $sensor['sensor_limit'] * 100; $sensor_colour = percent_colour($sensor_perc); - if($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } - + if ($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } + $sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100"; $sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100"; $sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100"; @@ -59,42 +60,36 @@ while($sensor = mysql_fetch_array($query)) " . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . " \n"); - if($_GET['optb'] == "graphs") { ## If graphs + if ($_GET['optb'] == "graphs") + { + echo(""); - echo(""); + $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; - $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; + $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; - $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; + $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; - $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; + $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo(""); - - } # endif graphs - - + echo(""); + } # endif graphs $row++; - } echo(""); - -?> - +?> \ No newline at end of file diff --git a/html/pages/health/voltages.inc.php b/html/pages/health/voltages.inc.php index c2c70df649..302566e03c 100644 --- a/html/pages/health/voltages.inc.php +++ b/html/pages/health/voltages.inc.php @@ -3,7 +3,8 @@ $graph_type = "sensor_voltage"; $unit = "V"; -if($_SESSION['userlevel'] >= '5') { +if ($_SESSION['userlevel'] >= '5') +{ $sql = "SELECT * FROM `sensors` AS S, `devices` AS D WHERE S.sensor_class='voltage' AND S.device_id = D.device_id ORDER BY D.hostname, S.sensor_descr"; } else { $sql = "SELECT * FROM `sensors` AS S, `devices` AS D, devices_perms as P WHERE S.sensor_class='voltage' AND S.device_id = D.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' ORDER BY D.hostname, S.sensor_descr"; @@ -25,16 +26,16 @@ echo(' $row = 1; -while($sensor = mysql_fetch_array($query)) +while ($sensor = mysql_fetch_array($query)) { - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } $weekly_sensor = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=500&height=150"; $sensor_popup = "', LEFT);\" onmouseout=\"return nd();\"> " . $sensor['sensor_descr'] . ""; - if($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } - + if ($sensor['sensor_current'] >= $sensor['sensor_limit']) { $alert = 'alert'; } else { $alert = ""; } + $sensor_day = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=300&height=100"; $sensor_week = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=300&height=100"; $sensor_month = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=300&height=100"; @@ -54,43 +55,36 @@ while($sensor = mysql_fetch_array($query)) " . (isset($sensor['sensor_notes']) ? $sensor['sensor_notes'] : '') . " \n"); - if($_GET['optb'] == "graphs") { ## If graphs + if ($_GET['optb'] == "graphs") + { + echo(""); - echo(""); + $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; + $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; - $daily_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=211&height=100"; - $daily_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$day&to=$now&width=400&height=150"; + $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; + $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; - $weekly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=211&height=100"; - $weekly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$week&to=$now&width=400&height=150"; + $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; + $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; - $monthly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=211&height=100"; - $monthly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$month&to=$now&width=400&height=150"; + $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; + $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - $yearly_graph = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=211&height=100"; - $yearly_url = "graph.php?id=" . $sensor['sensor_id'] . "&type=".$graph_type."&from=$year&to=$now&width=400&height=150"; - - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo("', LEFT);\" onmouseout=\"return nd();\"> + echo("', LEFT);\" onmouseout=\"return nd();\"> "); - echo(""); - - } # endif graphs - - - + echo(""); + } # endif graphs $row++; - } echo(""); - -?> - +?> \ No newline at end of file diff --git a/html/pages/iftype.inc.php b/html/pages/iftype.inc.php index 0721c0b07a..61d2969f50 100644 --- a/html/pages/iftype.inc.php +++ b/html/pages/iftype.inc.php @@ -1,11 +1,11 @@ - + "); @@ -37,41 +37,42 @@ if ($if_list) $interface['interface_id'] = $if_list; include("includes/print-interface-graphs.inc.php"); echo(""); - + $sql = "select * from ports as I, devices as D WHERE $type_where AND I.device_id = D.device_id ORDER BY I.ifAlias"; $query = mysql_query($sql); - while($interface = mysql_fetch_array($query)) + while ($interface = mysql_fetch_array($query)) { $done = "yes"; unset($class); $interface['ifAlias'] = str_ireplace($type . ": ", "", $interface['ifAlias']); $interface['ifAlias'] = str_ireplace("[PNI]", "Private", $interface['ifAlias']); $ifclass = ifclass($interface['ifOperStatus'], $interface['ifAdminStatus']); - if($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; } + if ($bg == "#ffffff") { $bg = "#e5e5e5"; } else { $bg="#ffffff"; } echo(" - "); } - + } else { echo(""); } + ?> -
    Total Graph for ports of type : ".$types."
    " . generate_port_link($interface,$interface['port_descr_descr']) . "
    +
    " . generate_port_link($interface,$interface['port_descr_descr']) . "
    ".generate_device_link($interface)." ".generate_port_link($interface)." "); - - if(mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)) + + if (mysql_result(mysql_query("SELECT count(*) FROM mac_accounting WHERE interface_id = '".$interface['interface_id']."'"),0)) { echo(" MAC Accounting"); } - + echo("
    "); - - if(file_exists($config['rrd_dir'] . "/" . $interface['hostname'] . "/port-" . $interface['ifIndex'] . ".rrd")) + + if (file_exists($config['rrd_dir'] . "/" . $interface['hostname'] . "/port-" . $interface['ifIndex'] . ".rrd")) { $graph_type = "port_bits"; include("includes/print-interface-graphs.inc.php"); } - + echo("
    None found.
    \ No newline at end of file + \ No newline at end of file diff --git a/html/pages/inventory.inc.php b/html/pages/inventory.inc.php index ee25aa1140..3356281b55 100644 --- a/html/pages/inventory.inc.php +++ b/html/pages/inventory.inc.php @@ -11,16 +11,17 @@ ".$data['entPhysicalModelName'].""); } ?>
    "); } } -} elseif($_GET['optb'] == "purge" && $_GET['optc']) { +} elseif ($_GET['optb'] == "purge" && $_GET['optc']) { $interface = mysql_fetch_assoc(mysql_query("SELECT * from `ports` AS P, `devices` AS D WHERE `interface_id` = '".mres($_GET['optc'])."' AND D.device_id = P.device_id")); - if(port_permitted($interface['interface_id'], $interface['device_id'])) + if (port_permitted($interface['interface_id'], $interface['device_id'])) delete_port($interface['interface_id']); echo("
    Deleted ".generate_device_link($interface)." - ".generate_port_link($interface)."
    "); } - - $i_deleted = 1; - echo(""); echo(""); $sql = "SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id"; $query = mysql_query($sql); -while($interface = mysql_fetch_assoc($query)) { +while ($interface = mysql_fetch_assoc($query)) +{ $interface = ifLabel($interface, $interface); - if(port_permitted($interface['interface_id'], $interface['device_id'])){ - if(is_integer($i_deleted/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if (port_permitted($interface['interface_id'], $interface['device_id'])) + { + if (is_integer($i_deleted/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } echo(""); - echo(""); - echo(""); - echo(""); - echo(""); + echo(""); + echo(""); + echo(""); + echo(""); $i_deleted++; } @@ -44,5 +45,4 @@ while($interface = mysql_fetch_assoc($query)) { echo("
    Purge All
    ".generate_device_link($interface)."".generate_port_link($interface)." Purge".generate_device_link($interface)."".generate_port_link($interface)." Purge
    "); - -?> +?> \ No newline at end of file diff --git a/html/pages/preferences.inc.php b/html/pages/preferences.inc.php index b8af8e7fc4..8151d8c6e7 100644 --- a/html/pages/preferences.inc.php +++ b/html/pages/preferences.inc.php @@ -2,20 +2,20 @@ echo("
    "); echo("

    User Preferences

    "); - -if($_POST['action'] == "changepass") { - - if(authenticate($_SESSION['username'],$_POST['old_pass'])) { - if($_POST['new_pass'] == "" || $_POST['new_pass2'] == "") +if ($_POST['action'] == "changepass") +{ + if (authenticate($_SESSION['username'],$_POST['old_pass'])) + { + if ($_POST['new_pass'] == "" || $_POST['new_pass2'] == "") { $changepass_message = "Password must not be blank."; } - elseif($_POST['new_pass'] == $_POST['new_pass2']) + elseif ($_POST['new_pass'] == $_POST['new_pass2']) { changepassword($_SESSION['username'],$_POST['new_pass']); - $changepass_message = "Password Changed."; - } - else + $changepass_message = "Password Changed."; + } + else { $changepass_message = "Passwords don't match."; } @@ -49,26 +49,23 @@ if (passwordscanchange()) echo("
    "); echo("
    Device Permissions
    "); -if($_SESSION['userlevel'] == '10') { echo("Global Administrative Access"); } -if($_SESSION['userlevel'] == '5') { echo("Global Viewing Access"); } -if($_SESSION['userlevel'] == '1') { +if ($_SESSION['userlevel'] == '10') { echo("Global Administrative Access"); } +if ($_SESSION['userlevel'] == '5') { echo("Global Viewing Access"); } +if ($_SESSION['userlevel'] == '1') { $perms = mysql_query("SELECT * FROM `devices_perms` AS P, `devices` AS D WHERE `user_id` = '" . $user_id . "' AND P.device_id = D.device_id"); - - while($perm = mysql_fetch_array($perms)) { + while ($perm = mysql_fetch_array($perms)) + { echo("" . $perm['hostname'] . "
    "); $dev_access = 1; } - if(!$dev_access) { echo("No access!"); } - - } + if (!$dev_access) { echo("No access!"); } +} echo("
    "); echo("
    "); - - echo("
    "); -?> +?> \ No newline at end of file diff --git a/html/pages/pseudowires.inc.php b/html/pages/pseudowires.inc.php index 681437c4b3..cdc56edf41 100644 --- a/html/pages/pseudowires.inc.php +++ b/html/pages/pseudowires.inc.php @@ -2,25 +2,27 @@ print_optionbar_start(); -echo("Details | Graphs : +echo("Details | Graphs : Mini "); print_optionbar_end(); - list($opta, $optb, $optc, $optd, $opte) = explode("/", $_GET['opta']); +list($opta, $optb, $optc, $optd, $opte) = explode("/", $_GET['opta']); echo(""); $sql = "SELECT * FROM pseudowires AS P, ports AS I, devices AS D WHERE P.interface_id = I.interface_id AND I.device_id = D.device_id ORDER BY D.hostname,I.ifDescr"; $query = mysql_query($sql); -while($pw_a = mysql_fetch_array($query)) { - $i = 0; - while ($i < count($linkdone)) { - $thislink = $pw_a['device_id'] . $pw_a['interface_id']; - if ($linkdone[$i] == $thislink) { $skip = "yes"; } - $i++; +while ($pw_a = mysql_fetch_array($query)) +{ + $i = 0; + while ($i < count($linkdone)) + { + $thislink = $pw_a['device_id'] . $pw_a['interface_id']; + if ($linkdone[$i] == $thislink) { $skip = "yes"; } + $i++; } $pw_b = mysql_fetch_array(mysql_query("SELECT * from `devices` AS D, `ports` AS I, `pseudowires` AS P WHERE D.device_id = '".$pw_a['peer_device_id']."' AND @@ -28,58 +30,62 @@ while($pw_a = mysql_fetch_array($query)) { P.cpwVcID = '".$pw_a['cpwVcID']."' AND P.interface_id = I.interface_id")); - if(!port_permitted($pw_a['interface_id'])) { $skip = "yes"; } - if(!port_permitted($pw_b['interface_id'])) { $skip = "yes"; } + if (!port_permitted($pw_a['interface_id'])) { $skip = "yes"; } + if (!port_permitted($pw_b['interface_id'])) { $skip = "yes"; } - - if($skip) { + if ($skip) + { unset($skip); } else { - - if($bg == "ffffff") { $bg = "e5e5e5"; } else { $bg="ffffff"; } + if ($bg == "ffffff") { $bg = "e5e5e5"; } else { $bg="ffffff"; } echo(""); echo(""); - if($opta == "graphs") { + + if ($opta == "graphs") + { echo(""); - } $linkdone[] = $pw_b['device_id'] . $pw_b['interface_id']; } - } echo("
    ".$pw_a['cpwVcID']."".generate_device_link($pw_a)."".generate_port_link($pw_a)." ".generate_device_link($pw_b)."".generate_port_link($pw_b)."
    ".$pw_a['ifAlias']."".$pw_b['ifAlias']."
    "); - if(!$optb) { $optb = "mini"; } - if($pw_a) { + if (!$optb) { $optb = "mini"; } + + if ($pw_a) + { $pw_a['width'] = "150"; $pw_a['height'] = "30"; $pw_a['from'] = $day; $pw_a['to'] = $now; $pw_a['bg'] = $bg; $types = array('bits','pkts','errors'); - foreach($types as $graph_type) { + foreach ($types as $graph_type) + { $pw_a['graph_type'] = $graph_type; generate_port_thumbnail($pw_a); } } echo(""); - if($pw_b) { + if ($pw_b) + { $pw_b['width'] = "150"; $pw_b['height'] = "30"; $pw_b['from'] = $day; $pw_b['to'] = $now; $pw_b['bg'] = $bg; $types = array('bits','pkts','errors'); - foreach($types as $graph_type) { + foreach ($types as $graph_type) + { $pw_b['graph_type'] = $graph_type; generate_port_thumbnail($pw_b); } } echo("
    "); -?> +?> \ No newline at end of file diff --git a/html/pages/purgeports.inc.php b/html/pages/purgeports.inc.php index 758013cdd5..569adad433 100644 --- a/html/pages/purgeports.inc.php +++ b/html/pages/purgeports.inc.php @@ -1,40 +1,45 @@ Deleting IPv4 address " . $ipaddr['addr'] . "/" . $ipaddr['cidr'] ); - mysql_query("DELETE FROM addr WHERE id = '".$addr['id']."'"); - echo("
    "); - } +function delete_port($interface_id) +{ + $ipaddrs = mysql_query("SELECT * FROM `ipaddr` WHERE `interface_id` = '$interface_id'"); + while ($ipaddr = mysql_fetch_array($ipaddrs)) + { + echo("
    Deleting IPv4 address " . $ipaddr['addr'] . "/" . $ipaddr['cidr'] ); + mysql_query("DELETE FROM addr WHERE id = '".$addr['id']."'"); + echo("
    "); + } - $ip6addr = mysql_query("SELECT * FROM `ip6addr` WHERE `interface_id` = '$interface_id'"); - while($ip6addr = mysql_fetch_array($ip6addrs)) { - echo("
    Deleting IPv6 address " . $ip6addr['ip6_comp_addr'] . "/" . $ip6addr['ip6_prefixlen'] ); - mysql_query("DELETE FROM ip6addr WHERE ip6_addr_id = '".$ip6addr['ip6_addr_id']."'"); - echo("
    "); - } + $ip6addr = mysql_query("SELECT * FROM `ip6addr` WHERE `interface_id` = '$interface_id'"); + while ($ip6addr = mysql_fetch_array($ip6addrs)) + { + echo("
    Deleting IPv6 address " . $ip6addr['ip6_comp_addr'] . "/" . $ip6addr['ip6_prefixlen'] ); + mysql_query("DELETE FROM ip6addr WHERE ip6_addr_id = '".$ip6addr['ip6_addr_id']."'"); + echo("
    "); + } - $ip6addr = mysql_query("SELECT * FROM `ip6addr` WHERE `interface_id` = '$interface_id'"); - while($ip6addr = mysql_fetch_array($ip6addrs)) { - echo("
    Deleting IPv6 address " . $ip6addr['ip6_comp_addr'] . "/" . $ip6addr['ip6_prefixlen'] ); - mysql_query("DELETE FROM ip6addr WHERE ip6_addr_id = '".$ip6addr['ip6_addr_id']."'"); - echo("
    "); - } + $ip6addr = mysql_query("SELECT * FROM `ip6addr` WHERE `interface_id` = '$interface_id'"); + while ($ip6addr = mysql_fetch_array($ip6addrs)) + { + echo("
    Deleting IPv6 address " . $ip6addr['ip6_comp_addr'] . "/" . $ip6addr['ip6_prefixlen'] ); + mysql_query("DELETE FROM ip6addr WHERE ip6_addr_id = '".$ip6addr['ip6_addr_id']."'"); + echo("
    "); + } - mysql_query("DELETE FROM `pseudowires` WHERE `interface_id` = '$interface_id'"); - mysql_query("DELETE FROM `mac_accounting` WHERE `interface_id` = '$interface_id'"); - mysql_query("DELETE FROM `links` WHERE `local_interface_id` = '$interface_id'"); - mysql_query("DELETE FROM `links` WHERE `remote_interface_id` = '$interface_id'"); - mysql_query("DELETE FROM `ports_perms` WHERE `interface_id` = '$interface_id'"); - mysql_query("DELETE FROM `ports` WHERE `interface_id` = '$interface_id'"); - } + mysql_query("DELETE FROM `pseudowires` WHERE `interface_id` = '$interface_id'"); + mysql_query("DELETE FROM `mac_accounting` WHERE `interface_id` = '$interface_id'"); + mysql_query("DELETE FROM `links` WHERE `local_interface_id` = '$interface_id'"); + mysql_query("DELETE FROM `links` WHERE `remote_interface_id` = '$interface_id'"); + mysql_query("DELETE FROM `ports_perms` WHERE `interface_id` = '$interface_id'"); + mysql_query("DELETE FROM `ports` WHERE `interface_id` = '$interface_id'"); +} - $ports = mysql_query("SELECT * FROM `ports` WHERE `deleted` = '1'"); - while($port = mysql_fetch_array($ports)) { - echo("
    Deleting port " . $port['interface_id'] . " - " . $port['ifDescr'] ); - delete_port($port['interface_id']); - echo("
    "); - } +$ports = mysql_query("SELECT * FROM `ports` WHERE `deleted` = '1'"); +while ($port = mysql_fetch_array($ports)) +{ + echo("
    Deleting port " . $port['interface_id'] . " - " . $port['ifDescr'] ); + delete_port($port['interface_id']); + echo("
    "); +} -?> +?> \ No newline at end of file diff --git a/html/pages/services.inc.php b/html/pages/services.inc.php index 8e6dae4996..9f56b80c05 100644 --- a/html/pages/services.inc.php +++ b/html/pages/services.inc.php @@ -1,34 +1,35 @@ Basic | "); echo("Details"); print_optionbar_end(); -if($_GET['status'] == '0') { $where = " AND service_status = '0'"; } else { unset ($where); } +if ($_GET['status'] == '0') { $where = " AND service_status = '0'"; } else { unset ($where); } echo("
    "); //echo(""); -if ($_SESSION['userlevel'] >= '5') { +if ($_SESSION['userlevel'] >= '5') +{ $host_sql = "SELECT * FROM devices AS D, services AS S WHERE D.device_id = S.device_id GROUP BY D.hostname ORDER BY D.hostname"; } else { $host_sql = "SELECT * FROM devices AS D, services AS S, devices_perms AS P WHERE D.device_id = S.device_id AND D.device_id = P.device_id AND P.user_id = '" . $_SESSION['user_id'] . "' $where GROUP BY D.hostname ORDER BY D.hostname"; } $host_query = mysql_query($host_sql); - while($host_data = mysql_fetch_array($host_query)) { + while ($host_data = mysql_fetch_array($host_query)) + { $device_id = $host_data['device_id']; $device_hostname = $host_data['hostname']; $service_query = mysql_query("SELECT * FROM `services` WHERE `device_id` = '" . $host_data['device_id'] . "' $where"); - while($service = mysql_fetch_array($service_query)) + while ($service = mysql_fetch_array($service_query)) { include("includes/print-service.inc"); # $samehost = 1; - if($_GET['opta'] == "details") + if ($_GET['opta'] == "details") { - $graph_array['height'] = "100"; $graph_array['width'] = "215"; $graph_array['to'] = $now; @@ -39,8 +40,9 @@ if ($_SESSION['userlevel'] >= '5') { echo('
    DeviceServiceStatusChangedCheckedMessage
    '); - foreach($periods as $period) { - $graph_array['from'] = $$period; + foreach ($periods as $period) + { + $graph_array['from'] = $$period; $graph_array_zoom = $graph_array; $graph_array_zoom['height'] = "150"; $graph_array_zoom['width'] = "400"; echo(overlib_link($_SERVER['REQUEST_URI'], generate_graph_tag($graph_array), generate_graph_tag($graph_array_zoom), NULL)); } @@ -52,4 +54,4 @@ if ($_SESSION['userlevel'] >= '5') { echo("
    "); -?> +?> \ No newline at end of file diff --git a/html/pages/settings.inc.php b/html/pages/settings.inc.php index b98958f661..be3c34e72e 100644 --- a/html/pages/settings.inc.php +++ b/html/pages/settings.inc.php @@ -1,16 +1,12 @@ "); -print_r($config); -echo(""); - +if ($_SESSION['userlevel'] == '10') +{ + echo("
    ");
    +  print_r($config);
    +  echo("
    "); } else { - include("includes/error-no-perm.inc.php"); - } - ?> diff --git a/html/pages/storage.inc.php b/html/pages/storage.inc.php index 563f16f15f..77971bba25 100644 --- a/html/pages/storage.inc.php +++ b/html/pages/storage.inc.php @@ -1,6 +1,7 @@ = '5') { +if ($_SESSION['userlevel'] >= '5') +{ $sql = "SELECT * FROM `storage` AS S, `devices` AS D WHERE S.device_id = D.device_id ORDER BY D.hostname, S.storage_descr"; } else { $sql = "SELECT * FROM `storage` AS S, `devices` AS D, devices_perms as P WHERE S.device_id = D.device_id AND "; @@ -22,60 +23,63 @@ echo(" $row = 1; -while($drive = mysql_fetch_array($query)) { +while ($drive = mysql_fetch_array($query)) +{ + $skipdrive = 0; - $skipdrive = 0; - - if ($drive["os"] == "junos") { - foreach ($config['ignore_junos_os_drives'] as $jdrive) { - if (preg_match($jdrive, $drive["storage_descr"])) { - $skipdrive = 1; - } - } - $drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]); + if ($drive["os"] == "junos") + { + foreach ($config['ignore_junos_os_drives'] as $jdrive) + { + if (preg_match($jdrive, $drive["storage_descr"])) + { + $skipdrive = 1; + } } - if ($drive['os'] == "freebsd") { - foreach ($config['ignore_bsd_os_drives'] as $jdrive) { - if (preg_match($jdrive, $drive["storage_descr"])) { - $skipdrive = 1; - } - } + $drive["storage_descr"] = preg_replace("/.*mounted on: (.*)/", "\\1", $drive["storage_descr"]); + + } + + if ($drive['os'] == "freebsd") + { + foreach ($config['ignore_bsd_os_drives'] as $jdrive) + { + if (preg_match($jdrive, $drive["storage_descr"])) + { + $skipdrive = 1; + } } + } - if ($skipdrive) { continue; } - if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } + if ($skipdrive) { continue; } + if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; } - $perc = round($drive['storage_perc'], 0); - $total = formatStorage($drive['storage_size']); - $free = formatStorage($drive['storage_free']); - $used = formatStorage($drive['storage_used']); + $perc = round($drive['storage_perc'], 0); + $total = formatStorage($drive['storage_size']); + $free = formatStorage($drive['storage_free']); + $used = formatStorage($drive['storage_used']); - $store_url = "graph.php?id=" . $drive['storage_id'] . "&type=storage&from=$month&to=$now&width=400&height=125"; - $store_popup = "onmouseover=\"return overlib('', LEFT);\" onmouseout=\"return nd();\""; + $store_url = "graph.php?id=" . $drive['storage_id'] . "&type=storage&from=$month&to=$now&width=400&height=125"; + $store_popup = "onmouseover=\"return overlib('', LEFT);\" onmouseout=\"return nd();\""; - $mini_graph = $config['base_url'] . "/graph.php?id=".$drive['storage_id']."&type=storage&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; + $mini_graph = $config['base_url'] . "/graph.php?id=".$drive['storage_id']."&type=storage&from=".$day."&to=".$now."&width=80&height=20&bg=f4f4f4"; - if($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; - } elseif($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; - } elseif($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; - } elseif($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; - } else { $left_background='9abf5b'; $right_background='bbd392'; } + if ($perc > '90') { $left_background='c4323f'; $right_background='C96A73'; } + elseif ($perc > '75') { $left_background='bf5d5b'; $right_background='d39392'; } + elseif ($perc > '50') { $left_background='bf875b'; $right_background='d3ae92'; } + elseif ($perc > '25') { $left_background='5b93bf'; $right_background='92b7d3'; } + else { $left_background='9abf5b'; $right_background='bbd392'; } + echo("" . generate_device_link($drive) . "" . $drive['storage_descr'] . " + + + ".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, formatStorage($free), "ffffff", $right_background)." + $perc"."%"); - echo("" . generate_device_link($drive) . "" . $drive['storage_descr'] . " - - - ".print_percentage_bar (400, 20, $perc, "$used / $total", "ffffff", $left_background, formatStorage($free), "ffffff", $right_background)." - $perc"."%"); - - - $row++; - + $row++; } echo("
    "); - -?> - +?> \ No newline at end of file diff --git a/html/pages/syslog.inc.php b/html/pages/syslog.inc.php index 0119c9901d..7e3b239408 100644 --- a/html/pages/syslog.inc.php +++ b/html/pages/syslog.inc.php @@ -1,8 +1,8 @@ -= '10') { mysql_query("TRUNCATE TABLE `syslog`"); } ?> += '10') { mysql_query("TRUNCATE TABLE `syslog`"); } ?> - +
    "); +
    "); -if($_GET['opta'] == graphs ) { - if($_GET['optb']) { +if ($_GET['opta'] == 'graphs') +{ + if ($_GET['optb']) + { $graph_type = $_GET['optb']; } else { $graph_type = "bits"; @@ -19,45 +21,48 @@ if($_GET['opta'] == graphs ) { $dographs = 1; } -if($_GET['opta'] == "details" ) { +if ($_GET['opta'] == "details" ) +{ $port_details = 1; } - echo("
    "); - $vrf_query = mysql_query("SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = '".$_GET['id']."'"); - $vrf = mysql_fetch_array($vrf_query); - echo(""); - echo(""); - echo(""); - echo(""); - echo("
    " . $vrf['vrf_name'] . "" . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . "
    "); +echo("
    "); +$vrf_query = mysql_query("SELECT * FROM `vrfs` WHERE mplsVpnVrfRouteDistinguisher = '".$_GET['id']."'"); +$vrf = mysql_fetch_array($vrf_query); +echo(""); +echo(""); +echo(""); +echo(""); +echo("
    " . $vrf['vrf_name'] . "" . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . "
    "); +$devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id"); +$x=1; - $devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id"); - $x=1; - while($device = mysql_fetch_array($devices)) { - $hostname = $device['hostname']; - #if(!is_integer($x/2)) { $device_colour = $list_colour_a; } else { $device_colour = $list_colour_b; } - echo(""); - include("includes/device-header.inc.php"); - echo("
    "); - $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); - unset($seperator); - echo(""); - $i=1; - while($interface = mysql_fetch_array($ports)) { - if(!is_integer($x/2)) { - if(is_integer($i/2)) { $int_colour = $list_colour_a_a; } else { $int_colour = $list_colour_a_b; } - } else { - if(is_integer($i/2)) { $int_colour = $list_colour_b_b; } else { $int_colour = $list_colour_b_a; } - } - include("includes/print-interface.inc.php"); - $i++; - } - $x++; - echo("
    "); - echo("
    "); - } - -?> +while ($device = mysql_fetch_array($devices)) +{ + $hostname = $device['hostname']; + #if (!is_integer($x/2)) { $device_colour = $list_colour_a; } else { $device_colour = $list_colour_b; } + echo(""); + include("includes/device-header.inc.php"); + echo("
    "); + $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); + unset($seperator); + echo(""); + $i=1; + while ($interface = mysql_fetch_array($ports)) + { + if (!is_integer($x/2)) + { + if (is_integer($i/2)) { $int_colour = $list_colour_a_a; } else { $int_colour = $list_colour_a_b; } + } else { + if (is_integer($i/2)) { $int_colour = $list_colour_b_b; } else { $int_colour = $list_colour_b_a; } + } + include("includes/print-interface.inc.php"); + $i++; + } + $x++; + echo("
    "); + echo("
    "); +} +?> \ No newline at end of file diff --git a/html/pages/vrfs.inc.php b/html/pages/vrfs.inc.php index e34b8beb89..ff529a7f51 100644 --- a/html/pages/vrfs.inc.php +++ b/html/pages/vrfs.inc.php @@ -1,61 +1,65 @@ = '5') { -print_optionbar_start(); -echo(" +if ($_SESSION['userlevel'] >= '5') +{ + print_optionbar_start(); + echo(" Basic | Graphs : Bits | Packets | NU Packets | Errors "); -print_optionbar_end(); + print_optionbar_end(); + echo("
    "); + $i = "1"; + $vrf_query = mysql_query("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`"); + while ($vrf = mysql_fetch_array($vrf_query)) + { + if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } + echo(""); + echo(""); + echo(""); + #echo(""); + echo("
    " . $vrf['vrf_name'] . "
    " . $vrf['mplsVpnVrfDescription'] . "
    " . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . ""); + $devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id"); + $x=1; + while ($device = mysql_fetch_array($devices)) + { + if (!is_integer($i/2)) + { + if (!is_integer($x/2)) { $dev_colour = $list_colour_a_a; } else { $dev_colour = $list_colour_a_b; } + } else { + if (!is_integer($x/2)) { $dev_colour = $list_colour_b_b; } else { $dev_colour = $list_colour_b_a; } + } + echo("
    ".generate_device_link($device, shorthost($device['hostname']))); - echo("
    "); - $i = "1"; - $vrf_query = mysql_query("SELECT * FROM `vrfs` GROUP BY `mplsVpnVrfRouteDistinguisher`"); - while($vrf = mysql_fetch_array($vrf_query)) { + if ($device['vrf_name'] != $vrf['vrf_name']) { echo("Configured : ".$device['vrf_name']."', CAPTION, 'VRF Inconsistency' ,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"> "); } + echo(""); - echo(""); - echo(""); - #echo(""); - echo(""); - $i++; } echo("
    "); + $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); + unset($seperator); - if(!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; } - echo("
    " . $vrf['vrf_name'] . "
    " . $vrf['mplsVpnVrfDescription'] . "
    " . $vrf['mplsVpnVrfRouteDistinguisher'] . "" . $vrf['mplsVpnVrfDescription'] . ""); - $devices = mysql_query("SELECT * FROM `vrfs` AS V, `devices` AS D WHERE `mplsVpnVrfRouteDistinguisher` = '".$vrf['mplsVpnVrfRouteDistinguisher']."' AND D.device_id = V.device_id"); - $x=1; - while($device = mysql_fetch_array($devices)) { - - if(!is_integer($i/2)) { - if(!is_integer($x/2)) { $dev_colour = $list_colour_a_a; } else { $dev_colour = $list_colour_a_b; } - } else { - if(!is_integer($x/2)) { $dev_colour = $list_colour_b_b; } else { $dev_colour = $list_colour_b_a; } - } - echo(""); @@ -64,16 +68,14 @@ print_optionbar_end(); echo("
    ".generate_device_link($device, shorthost($device['hostname']))); - if($device['vrf_name'] != $vrf['vrf_name']) { echo("Configured : ".$device['vrf_name']."', CAPTION, 'VRF Inconsistency' ,FGCOLOR,'#e5e5e5', BGCOLOR, '#c0c0c0', BORDER, 5, CELLPAD, 4, CAPCOLOR, '#050505');\" onmouseout=\"return nd();\"> "); } - echo(""); - $ports = mysql_query("SELECT * FROM `ports` WHERE `ifVrf` = '".$device['vrf_id']."' and device_id = '".$device['device_id']."'"); - unset($seperator); - - while($port = mysql_fetch_array($ports)) { - $port = array_merge ($device, $port); - if($_GET['opta']) { - $port['width'] = "130"; - $port['height'] = "30"; - $port['from'] = $day; - $port['to'] = $now; - $port['bg'] = "#".$bg; - $port['graph_type'] = "port_".$_GET['opta']; - echo("
    ".makeshortif($port['ifDescr'])."
    "); - generate_port_thumbnail($port); - echo("
    ".truncate(short_port_descr($port['ifAlias']), 22, '')."
    + generate_port_thumbnail($port); + echo("
    ".truncate(short_port_descr($port['ifAlias']), 22, '')."
    "); } else { - echo($seperator.generate_port_link($port,makeshortif($port['ifDescr']))); - $seperator = ", "; + echo($seperator.generate_port_link($port,makeshortif($port['ifDescr']))); + $seperator = ", "; } } echo("
    "); } else { -include("includes/error-no-perm.inc.php"); + include("includes/error-no-perm.inc.php"); } ## End Permission if -?> - +?> \ No newline at end of file