From ef6406d4c9ac8ce872095a076d023e46aa1d2d3d Mon Sep 17 00:00:00 2001
From: Tom Laermans
","port_errors");
+} else { $error_img = ""; }
- if ($interface['ifInErrors_delta'] > 0 || $interface['ifOutErrors_delta'] > 0) {
- $error_img = generate_port_link($interface,"
","port_errors");
- } else { $error_img = ""; }
+echo("
+ ");
+echo("
+ " . generate_port_link($interface, $interface['ifIndex'] . ". ".$interface['label']) . "
+
".$interface['ifAlias']."");
- echo("
- ");
- echo("
- " . generate_port_link($interface, $interface['ifIndex'] . ". ".$interface['label']) . "
+if ($interface['ifAlias']) { echo("
"); }
-
".$interface['ifAlias']."");
-
-
- if ($interface['ifAlias']) { echo("
"); }
-
- unset ($break);
- if ($port_details) {
- $ipdata = mysql_query("SELECT * FROM `ipv4_addresses` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
- while ($ip = mysql_fetch_Array($ipdata)) {
- echo("$break $ip[ipv4_address]/$ip[ipv4_prefixlen]");
- $break = ",";
- }
- $ip6data = mysql_query("SELECT * FROM `ipv6_addresses` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
- while ($ip6 = mysql_fetch_Array($ip6data)) {
- echo("$break ".Net_IPv6::compress($ip6['ipv6_address'])."/".$ip6['ipv6_prefixlen']."");
- $break = ",";
- }
+unset ($break);
+if ($port_details)
+{
+ $ipdata = mysql_query("SELECT * FROM `ipv4_addresses` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
+ while ($ip = mysql_fetch_Array($ipdata))
+ {
+ echo("$break $ip[ipv4_address]/$ip[ipv4_prefixlen]");
+ $break = ",";
}
+ $ip6data = mysql_query("SELECT * FROM `ipv6_addresses` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
+ while ($ip6 = mysql_fetch_Array($ip6data))
+ {
+ echo("$break ".Net_IPv6::compress($ip6['ipv6_address'])."/".$ip6['ipv6_prefixlen']."");
+ $break = ",";
+ }
+}
- echo("");
+echo("");
- $width="120"; $height="40"; $from = $day;
+$width="120"; $height="40"; $from = $day;
- echo("");
- echo(formatRates($interface['ifInOctets_rate'] * 8)."
".formatRates($interface['ifOutOctets_rate'] * 8));
- echo("
");
- $interface['graph_type'] = "port_bits";
- echo(generate_port_link($interface, "", $interface['graph_type']));
+echo("
");
+echo(formatRates($interface['ifInOctets_rate'] * 8)."
".formatRates($interface['ifOutOctets_rate'] * 8));
+echo("
");
+$interface['graph_type'] = "port_bits";
+echo(generate_port_link($interface, "", $interface['graph_type']));
- echo("
");
- echo("".formatRates($interface['adslAturChanCurrTxRate']) . "/". formatRates($interface['adslAtucChanCurrTxRate']));
- echo("
");
- $interface['graph_type'] = "port_adsl_speed";
- echo(generate_port_link($interface, "", $interface['graph_type']));
+echo("
");
+echo("".formatRates($interface['adslAturChanCurrTxRate']) . "/". formatRates($interface['adslAtucChanCurrTxRate']));
+echo("
");
+$interface['graph_type'] = "port_adsl_speed";
+echo(generate_port_link($interface, "", $interface['graph_type']));
- echo("
");
- echo("".formatRates($interface['adslAturCurrAttainableRate']) . "/". formatRates($interface['adslAtucCurrAttainableRate']));
- echo("
");
- $interface['graph_type'] = "port_adsl_attainable";
- echo(generate_port_link($interface, "", $interface['graph_type']));
+echo("
");
+echo("".formatRates($interface['adslAturCurrAttainableRate']) . "/". formatRates($interface['adslAtucCurrAttainableRate']));
+echo("
");
+$interface['graph_type'] = "port_adsl_attainable";
+echo(generate_port_link($interface, "", $interface['graph_type']));
- echo("
");
- echo("".$interface['adslAturCurrAtn'] . "dB/". $interface['adslAtucCurrAtn'] . "dB");
- echo("
");
- $interface['graph_type'] = "port_adsl_attenuation";
- echo(generate_port_link($interface, "", $interface['graph_type']));
+echo("
");
+echo("".$interface['adslAturCurrAtn'] . "dB/". $interface['adslAtucCurrAtn'] . "dB");
+echo("
");
+$interface['graph_type'] = "port_adsl_attenuation";
+echo(generate_port_link($interface, "", $interface['graph_type']));
- echo("
");
- echo("".$interface['adslAturCurrSnrMgn'] . "dB/". $interface['adslAtucCurrSnrMgn'] . "dB");
- echo("
");
- $interface['graph_type'] = "port_adsl_snr";
- echo(generate_port_link($interface, "", $interface['graph_type']));
-
- echo("
");
- echo("".$interface['adslAturCurrOutputPwr'] . "dBm/". $interface['adslAtucCurrOutputPwr'] . "dBm");
- echo("
");
- $interface['graph_type'] = "port_adsl_power";
- echo(generate_port_link($interface, "", $interface['graph_type']));
+echo("
");
+echo("".$interface['adslAturCurrSnrMgn'] . "dB/". $interface['adslAtucCurrSnrMgn'] . "dB");
+echo("
");
+$interface['graph_type'] = "port_adsl_snr";
+echo(generate_port_link($interface, "", $interface['graph_type']));
+echo("
");
+echo("".$interface['adslAturCurrOutputPwr'] . "dBm/". $interface['adslAtucCurrOutputPwr'] . "dBm");
+echo("
");
+$interface['graph_type'] = "port_adsl_power";
+echo(generate_port_link($interface, "", $interface['graph_type']));
# if ($interface[ifDuplex] != unknown) { echo("Duplex " . $interface['ifDuplex'] . ""); } else { echo("-"); }
-
# echo("
");
# echo($port_adsl['adslLineCoding']."/".$port_adsl['adslLineType']);
# echo(" ");
- if ($graph_type == "etherlike")
- {
- $graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/etherlike-". safename($interface['ifIndex']) . ".rrd";
- } else {
- $graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/". safename($interface['ifIndex']) . ".rrd";
- }
+if ($graph_type == "etherlike")
+{
+ $graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/etherlike-". safename($interface['ifIndex']) . ".rrd";
+} else {
+ $graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/". safename($interface['ifIndex']) . ".rrd";
+}
- if ($graph_type && is_file($graph_file)) {
+if ($graph_type && is_file($graph_file))
+{
+ $type = $graph_type;
- $type = $graph_type;
+ $daily_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$from&to=$now&width=210&height=100";
+ $daily_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$from&to=$now&width=500&height=150";
- $daily_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$from&to=$now&width=210&height=100";
- $daily_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$from&to=$now&width=500&height=150";
+ $weekly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=210&height=100";
+ $weekly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=500&height=150";
- $weekly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=210&height=100";
- $weekly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$week&to=$now&width=500&height=150";
+ $monthly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=210&height=100";
+ $monthly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=500&height=150";
- $monthly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=210&height=100";
- $monthly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$month&to=$now&width=500&height=150";
-
- $yearly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=210&height=100";
- $yearly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=500&height=150";
+ $yearly_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=210&height=100";
+ $yearly_url = "graph.php?port=$if_id&type=" . $graph_type . "&from=$year&to=$now&width=500&height=150";
echo("
");
@@ -107,46 +102,44 @@
# echo("
");
# echo("SNR:".$port_adsl['adslAtucCurrSnrMgn'] . "dB/". $port_adsl['adslAturCurrSnrMgn']. "dB");
-
-
echo(" ");
- }
+}
- ?>
+?>
\ No newline at end of file
diff --git a/html/pages/addhost.inc.php b/html/pages/addhost.inc.php
index 02f8e347f4..4a10f3c76d 100644
--- a/html/pages/addhost.inc.php
+++ b/html/pages/addhost.inc.php
@@ -2,8 +2,7 @@
if ($_SESSION['userlevel'] < 10)
{
- # FIXME generic box?
- echo("You are not permitted to perform this function");
+ include("includes/error-no-perm.inc.php");
exit;
}
@@ -17,17 +16,15 @@ if ($_POST['hostname'] && $_POST['community'])
$community = mres($_POST['community']);
$snmpver = mres($_POST['snmpver']);
if ($_POST['port']) { $port = mres($_POST['port']); } else { $port = "161"; }
- echo("");
+ print_message("Adding host $hostname community $community port $port");
$result = addHost($hostname, $community, $snmpver, $port);
- echo("");
echo("', LEFT".$config['overlib_defaults'].");\"
- onmouseout=\"return nd();\"> ");
+ onmouseout=\"return nd();\">
");
echo("', LEFT".$config['overlib_defaults'].");\"
- onmouseout=\"return nd();\">
");
+ onmouseout=\"return nd();\">
");
echo("', LEFT, WIDTH, 350".$config['overlib_defaults'].");\"
- onmouseout=\"return nd();\">
");
+ onmouseout=\"return nd();\">
");
echo("', LEFT, WIDTH, 350".$config['overlib_defaults'].");\"
- onmouseout=\"return nd();\">
");
+ onmouseout=\"return nd();\">
");
echo("
Error: You don't have the necessary privileges to add hosts.
"); + print_error("You don't have the necessary privileges to add hosts."); } } elseif ($_POST['hostname'] && !$_POST['community']) { - echo("Error: A community string is required.
"); + print_error("A community string is required."); } elseif (!$_POST['hostname'] && $_POST['community']) { - echo("Error: A hostname is required.
"); + print_error("A hostname is required."); } ?> diff --git a/html/pages/addsrv.inc.php b/html/pages/addsrv.inc.php index f6e18cbc09..55454b3a17 100644 --- a/html/pages/addsrv.inc.php +++ b/html/pages/addsrv.inc.php @@ -2,8 +2,7 @@ if ($_SESSION['userlevel'] < '10') { -## FIXME generic "box" include? - echo("Insufficient privileges to perform this function."); + include("includes/error-no-perm.inc.php"); } else { diff --git a/html/pages/delhost.inc.php b/html/pages/delhost.inc.php index 2757f97d6a..c4676640ce 100644 --- a/html/pages/delhost.inc.php +++ b/html/pages/delhost.inc.php @@ -2,7 +2,7 @@ if ($_SESSION['userlevel'] < 10) { - echo("You are not permitted to perform this function"); + include("includes/error-no-perm.inc.php"); exit; } diff --git a/html/pages/delsrv.inc.php b/html/pages/delsrv.inc.php index 854a6f23cd..67a02517d2 100644 --- a/html/pages/delsrv.inc.php +++ b/html/pages/delsrv.inc.php @@ -2,25 +2,25 @@ if ($_SESSION['userlevel'] < '5') { - print_error("Insufficient Privileges"); + include("includes/error-no-perm.inc.php"); } else { - -if ($_POST['delsrv']) -{ - if ($_SESSION['userlevel'] > "5") { - include("includes/service-delete.inc.php"); + 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)) -{ - $servicesform .= ""; -} + $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)) + { + $servicesform .= ""; + } -if ($updated) { print_message("Service Deleted!"); } + if ($updated) { print_message("Service Deleted!"); } -echo(" + echo("