mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
just another cleanup commit, don't mind me...
git-svn-id: http://www.observium.org/svn/observer/trunk@1885 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
@ini_set("session.gc_maxlifetime","0");
|
||||
@ini_set("session.gc_maxlifetime","0");
|
||||
|
||||
session_start();
|
||||
|
||||
// Preflight checks
|
||||
if(!is_dir($config['rrd_dir']))
|
||||
if (!is_dir($config['rrd_dir']))
|
||||
echo("<div class='errorbox'>RRD Log Directory is missing ({$config['rrd_dir']}). Graphing may fail.</div>");
|
||||
|
||||
if(!is_dir($config['temp_dir']))
|
||||
if (!is_dir($config['temp_dir']))
|
||||
echo("<div class='errorbox'>Temp Directory is missing ({$config['tmp_dir']}). Graphing may fail.</div>");
|
||||
|
||||
if(!is_writable($config['temp_dir']))
|
||||
if (!is_writable($config['temp_dir']))
|
||||
echo("<div class='errorbox'>Temp Directory is not writable ({$config['tmp_dir']}). Graphing may fail.</div>");
|
||||
|
||||
if(isset($_GET['logout']) && $_SESSION['authenticated']) {
|
||||
if (isset($_GET['logout']) && $_SESSION['authenticated']) {
|
||||
mysql_query("INSERT INTO authlog (`user`,`address`,`result`) VALUES ('" . $_SESSION['username'] . "', '".$_SERVER["REMOTE_ADDR"]."', 'logged out')");
|
||||
unset($_SESSION);
|
||||
session_destroy();
|
||||
@@ -24,13 +24,13 @@ if(isset($_GET['logout']) && $_SESSION['authenticated']) {
|
||||
$auth_message = "Logged Out";
|
||||
}
|
||||
|
||||
if(isset($_GET['username']) && isset($_GET['password'])){
|
||||
if (isset($_GET['username']) && isset($_GET['password'])){
|
||||
$_SESSION['username'] = mres($_GET['username']);
|
||||
$_SESSION['password'] = mres($_GET['password']);
|
||||
} elseif(isset($_POST['username']) && isset($_POST['password'])){
|
||||
} elseif (isset($_POST['username']) && isset($_POST['password'])){
|
||||
$_SESSION['username'] = mres($_POST['username']);
|
||||
$_SESSION['password'] = mres($_POST['password']);
|
||||
} elseif(isset($_COOKIE['username']) && isset($_COOKIE['password'])){
|
||||
} elseif (isset($_COOKIE['username']) && isset($_COOKIE['password'])){
|
||||
$_SESSION['username'] = mres($_COOKIE['username']);
|
||||
$_SESSION['password'] = mres($_COOKIE['password']);
|
||||
}
|
||||
@@ -58,25 +58,25 @@ if (isset($_SESSION['username']))
|
||||
{
|
||||
$_SESSION['userlevel'] = get_userlevel($_SESSION['username']);
|
||||
$_SESSION['user_id'] = get_userid($_SESSION['username']);
|
||||
if(!$_SESSION['authenticated'])
|
||||
if (!$_SESSION['authenticated'])
|
||||
{
|
||||
$_SESSION['authenticated'] = true;
|
||||
mysql_query("INSERT INTO authlog (`user`,`address`,`result`) VALUES ('".$_SESSION['username']."', '".$_SERVER["REMOTE_ADDR"]."', 'logged in')");
|
||||
header("Location: ".$_SERVER['REQUEST_URI']);
|
||||
}
|
||||
if(isset($_POST['remember']))
|
||||
if (isset($_POST['remember']))
|
||||
{
|
||||
setcookie("username", $_SESSION['username'], time()+60*60*24*100, "/");
|
||||
setcookie("password", $_SESSION['password'], time()+60*60*24*100, "/");
|
||||
}
|
||||
$permissions = permissions_cache($_SESSION['user_id']);
|
||||
|
||||
}
|
||||
elseif (isset($_SESSION['username']))
|
||||
{
|
||||
$auth_message = "Authentication Failed";
|
||||
}
|
||||
elseif (isset($_SESSION['username']))
|
||||
{
|
||||
$auth_message = "Authentication Failed";
|
||||
unset ($_SESSION['authenticated']);
|
||||
mysql_query("INSERT INTO authlog (`user`,`address`,`result`) VALUES ('".$_SESSION['username']."', '".$_SERVER["REMOTE_ADDR"]."', 'authentication failure')");
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -4,14 +4,14 @@ function authenticate($username,$password)
|
||||
{
|
||||
global $config;
|
||||
|
||||
if(isset($_SERVER['REMOTE_USER']))
|
||||
if (isset($_SERVER['REMOTE_USER']))
|
||||
{
|
||||
$_SESSION['username'] = mres($_SERVER['REMOTE_USER']);
|
||||
|
||||
$sql = "SELECT username FROM `users` WHERE `username`='".$_SESSION['username'] . "'";;
|
||||
$query = mysql_query($sql);
|
||||
$row = @mysql_fetch_array($query);
|
||||
if($row['username'] && $row['username'] == $_SESSION['username'])
|
||||
if ($row['username'] && $row['username'] == $_SESSION['username'])
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@ function authenticate($username,$password)
|
||||
$sql = "SELECT username FROM `users` WHERE `username`='".$username."' AND `password`='".$encrypted."'";
|
||||
$query = mysql_query($sql);
|
||||
$row = @mysql_fetch_array($query);
|
||||
if($row['username'] && $row['username'] == $username)
|
||||
if ($row['username'] && $row['username'] == $username)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
function generate_device_link($device, $text=0, $linksuffix="", $start=0, $end=0)
|
||||
function generate_device_link($device, $text=0, $linksuffix="", $start=0, $end=0)
|
||||
{
|
||||
global $twoday; global $day; global $now; global $config;
|
||||
|
||||
@@ -16,39 +16,41 @@ function generate_device_link($device, $text=0, $linksuffix="", $start=0, $end=0
|
||||
elseif (isset($config['os'][$device['os_group']]['over']))
|
||||
{
|
||||
$graphs = $config['os'][$device['os_group']]['over'];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$graphs = $config['os']['default']['over'];
|
||||
$graphs = $config['os']['default']['over'];
|
||||
}
|
||||
|
||||
$url = $config['base_url']."/device/" . $device['device_id'] . "/" . $linksuffix;
|
||||
$contents = "<div class=list-large>".$device['hostname'];
|
||||
if($device['hardware']) { $contents .= " - ".$device['hardware']; }
|
||||
if ($device['hardware']) { $contents .= " - ".$device['hardware']; }
|
||||
$contents .= "</div>";
|
||||
|
||||
$contents .= "<div>";
|
||||
if($device['os']) { $contents .= mres($config['os'][$device['os']]['text']); }
|
||||
if($device['version']) { $contents .= " ".mres($device['version']); }
|
||||
if($device['features']) { $contents .= " (".mres($device['features']).")"; }
|
||||
# if($device['hardware']) { $contents .= " - ".$device['hardware']; }
|
||||
if ($device['os']) { $contents .= mres($config['os'][$device['os']]['text']); }
|
||||
if ($device['version']) { $contents .= " ".mres($device['version']); }
|
||||
if ($device['features']) { $contents .= " (".mres($device['features']).")"; }
|
||||
# if ($device['hardware']) { $contents .= " - ".$device['hardware']; }
|
||||
$contents .= "</div>";
|
||||
|
||||
|
||||
# if (isset($device['location'])) { $contents .= "" . htmlentities($device['location'])."<br />"; }
|
||||
foreach ($graphs as $entry)
|
||||
{
|
||||
$graph = $entry['graph'];
|
||||
$graphhead = $entry['text'];
|
||||
$graphhead = $entry['text'];
|
||||
$contents .= '<div style="width: 708px">';
|
||||
$contents .= '<span style="margin-left: 5px; font-size: 12px; font-weight: bold;">'.$graphhead.'</span><br />';
|
||||
$contents .= '<img src="' . $config['base_url'] . "/graph.php?id=" . $device['device_id'] . "&from=$start&to=$end&width=275&height=100&type=$graph&legend=no" . '" style="margin: 2px;">';
|
||||
$contents .= '<img src="' . $config['base_url'] . "/graph.php?id=" . $device['device_id'] . "&from=".$config['week']."&to=$end&width=275&height=100&type=$graph&legend=no" . '" style="margin: 2px;">';
|
||||
$contents .= '</div>';
|
||||
}
|
||||
|
||||
$text = htmlentities($text);
|
||||
$link = overlib_link($url, $text, $contents, $class);
|
||||
if(device_permitted($device['device_id'])) {
|
||||
|
||||
if (device_permitted($device['device_id']))
|
||||
{
|
||||
return $link;
|
||||
} else {
|
||||
return $device['hostname'];
|
||||
@@ -58,16 +60,19 @@ function generate_device_link($device, $text=0, $linksuffix="", $start=0, $end=0
|
||||
return $link;
|
||||
}
|
||||
|
||||
function overlib_link($url, $text, $contents, $class) {
|
||||
function overlib_link($url, $text, $contents, $class)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$contents = str_replace("\"", "\'", $contents);
|
||||
$output = "<a class='".$class."' href='".$url."'";
|
||||
$output .= " onmouseover=\"return overlib('".$contents."'".$config['overlib_defaults'].");\" onmouseout=\"return nd();\">";
|
||||
$output .= $text."</a>";
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
function generate_graph_popup($graph_array)
|
||||
function generate_graph_popup($graph_array)
|
||||
{
|
||||
global $config;
|
||||
## Take $graph_array and print day,week,month,year graps in overlib, hovered over graph
|
||||
@@ -98,65 +103,73 @@ function print_graph_popup($graph_array)
|
||||
|
||||
|
||||
|
||||
function permissions_cache($user_id)
|
||||
function permissions_cache($user_id)
|
||||
{
|
||||
$permissions = array();
|
||||
$query = mysql_query("SELECT * FROM devices_perms WHERE user_id = '".$user_id."'");
|
||||
while($device = mysql_fetch_assoc($query)) {
|
||||
$permissions['device'][$device['device_id']] = 1;
|
||||
while ($device = mysql_fetch_assoc($query))
|
||||
{
|
||||
$permissions['device'][$device['device_id']] = 1;
|
||||
}
|
||||
$query = mysql_query("SELECT * FROM ports_perms WHERE user_id = '".$user_id."'");
|
||||
while($port = mysql_fetch_assoc($query)) {
|
||||
while ($port = mysql_fetch_assoc($query))
|
||||
{
|
||||
$permissions['port'][$port['interface_id']] = 1;
|
||||
}
|
||||
$query = mysql_query("SELECT * FROM bill_perms WHERE user_id = '".$user_id."'");
|
||||
while($bill = mysql_fetch_assoc($query)) {
|
||||
while ($bill = mysql_fetch_assoc($query))
|
||||
{
|
||||
$permissions['bill'][$bill['bill_id']] = 1;
|
||||
}
|
||||
return $permissions;
|
||||
}
|
||||
|
||||
function bill_permitted($bill_id)
|
||||
function bill_permitted($bill_id)
|
||||
{
|
||||
global $_SESSION; global $permissions;
|
||||
|
||||
if ($_SESSION['userlevel'] >= "5") {
|
||||
$allowed = TRUE;
|
||||
} elseif ( $permissions['bill'][$bill_id]) {
|
||||
} elseif ($permissions['bill'][$bill_id]) {
|
||||
$allowed = TRUE;
|
||||
} else {
|
||||
$allowed = FALSE;
|
||||
}
|
||||
return $allowed;
|
||||
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
function port_permitted($interface_id, $device_id = NULL)
|
||||
{
|
||||
global $_SESSION; global $permissions;
|
||||
if(!is_numeric($device_id)) { $device_id = get_device_id_by_interface_id($interface_id); }
|
||||
|
||||
if ($_SESSION['userlevel'] >= "5") {
|
||||
if (!is_numeric($device_id)) { $device_id = get_device_id_by_interface_id($interface_id); }
|
||||
|
||||
if ($_SESSION['userlevel'] >= "5")
|
||||
{
|
||||
$allowed = TRUE;
|
||||
} elseif ( device_permitted($device_id)) {
|
||||
} elseif (device_permitted($device_id)) {
|
||||
$allowed = TRUE;
|
||||
} elseif ( $permissions['port'][$interface_id]) {
|
||||
} elseif ($permissions['port'][$interface_id]) {
|
||||
$allowed = TRUE;
|
||||
} else {
|
||||
$allowed = FALSE;
|
||||
}
|
||||
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
function application_permitted($app_id, $device_id = NULL)
|
||||
{
|
||||
global $_SESSION; global $permissions;
|
||||
if(is_numeric($app_id))
|
||||
if (is_numeric($app_id))
|
||||
{
|
||||
if(!$device_id) { $device_id = device_by_id_cache ($app_id); }
|
||||
if (!$device_id) { $device_id = device_by_id_cache ($app_id); }
|
||||
if ($_SESSION['userlevel'] >= "5") {
|
||||
$allowed = TRUE;
|
||||
} elseif ( device_permitted($device_id)) {
|
||||
} elseif (device_permitted($device_id)) {
|
||||
$allowed = TRUE;
|
||||
} elseif ( $permissions['application'][$app_id]) {
|
||||
} elseif ($permissions['application'][$app_id]) {
|
||||
$allowed = TRUE;
|
||||
} else {
|
||||
$allowed = FALSE;
|
||||
@@ -167,33 +180,34 @@ function application_permitted($app_id, $device_id = NULL)
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
|
||||
function device_permitted($device_id)
|
||||
{
|
||||
global $_SESSION; global $permissions;
|
||||
if ($_SESSION['userlevel'] >= "5") {
|
||||
|
||||
if ($_SESSION['userlevel'] >= "5")
|
||||
{
|
||||
$allowed = true;
|
||||
} elseif ( $permissions['device'][$device_id] ) {
|
||||
} elseif ($permissions['device'][$device_id] ) {
|
||||
$allowed = true;
|
||||
} else {
|
||||
$allowed = false;
|
||||
}
|
||||
return $allowed;
|
||||
|
||||
return $allowed;
|
||||
}
|
||||
|
||||
|
||||
function print_graph_tag ($args)
|
||||
function print_graph_tag ($args)
|
||||
{
|
||||
echo(generate_graph_tag ($args));
|
||||
}
|
||||
|
||||
function generate_graph_tag ($args)
|
||||
function generate_graph_tag ($args)
|
||||
{
|
||||
global $config;
|
||||
|
||||
$sep = "?";
|
||||
$url = $config['base_url'] . "/graph.php";
|
||||
foreach ($args as $key => $arg)
|
||||
foreach ($args as $key => $arg)
|
||||
{
|
||||
$url .= $sep.$key."=".$arg;
|
||||
$sep="&";
|
||||
@@ -202,7 +216,7 @@ function generate_graph_tag ($args)
|
||||
}
|
||||
|
||||
|
||||
function print_percentage_bar ($width, $height, $percent, $left_text, $left_colour, $left_background, $right_text, $right_colour, $right_background)
|
||||
function print_percentage_bar ($width, $height, $percent, $left_text, $left_colour, $left_background, $right_text, $right_colour, $right_background)
|
||||
{
|
||||
$output = '
|
||||
<div style="font-size:11px;">
|
||||
@@ -219,15 +233,15 @@ function generate_port_link($args, $text = NULL, $type = NULL)
|
||||
{
|
||||
global $twoday; global $now; global $config; global $day; global $month;
|
||||
$args = ifNameDescr($args);
|
||||
if(!$text) { $text = fixIfName($args['label']); }
|
||||
if($type) { $args['graph_type'] = $type; }
|
||||
if(!$args['graph_type']) { $args['graph_type'] = 'port_bits'; }
|
||||
|
||||
if (!$text) { $text = fixIfName($args['label']); }
|
||||
if ($type) { $args['graph_type'] = $type; }
|
||||
if (!$args['graph_type']) { $args['graph_type'] = 'port_bits'; }
|
||||
|
||||
$class = ifclass($args['ifOperStatus'], $args['ifAdminStatus']);
|
||||
if(!isset($args['hostname'])) { $args = array_merge($args, device_by_id_cache($args['device_id'])); }
|
||||
if (!isset($args['hostname'])) { $args = array_merge($args, device_by_id_cache($args['device_id'])); }
|
||||
|
||||
$content = "<div class=list-large>".$args['hostname']." - " . fixifName($args['label']) . "</div>";
|
||||
if($args['ifAlias']) { $content .= $args['ifAlias']."<br />"; }
|
||||
if ($args['ifAlias']) { $content .= $args['ifAlias']."<br />"; }
|
||||
$content .= "<div style=\'width: 850px\'>";
|
||||
$graph_array['type'] = $args['graph_type'];
|
||||
$graph_array['legend'] = "yes";
|
||||
@@ -244,26 +258,24 @@ function generate_port_link($args, $text = NULL, $type = NULL)
|
||||
$graph_array['from'] = $config['year'];
|
||||
$content .= generate_graph_tag($graph_array);
|
||||
$content .= "</div>";
|
||||
|
||||
|
||||
$url = $config['base_url']."/device/".$args['device_id']."/interface/" . $args['interface_id'] . "/";
|
||||
|
||||
if(port_permitted($args['interface_id'])) {
|
||||
if (port_permitted($args['interface_id'])) {
|
||||
return overlib_link($url, $text, $content, $class);
|
||||
} else {
|
||||
return fixifName($text);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function generate_port_thumbnail($args)
|
||||
function generate_port_thumbnail($args)
|
||||
{
|
||||
if(!$args['bg']) { $args['bg'] = "FFFFF"; }
|
||||
if (!$args['bg']) { $args['bg'] = "FFFFF"; }
|
||||
$args['content'] = "<img src='graph.php?type=".$args['graph_type']."&id=".$args['interface_id']."&from=".$args['from']."&to=".$args['to']."&width=".$args['width']."&height=".$args['height']."&legend=no&bg=".$args['bg']."'>";
|
||||
$output = generate_port_link($args, $args['content']);
|
||||
echo($output);
|
||||
echo generate_port_link($args, $args['content']);
|
||||
}
|
||||
|
||||
function print_optionbar_start ($height = 20, $width = 0, $marginbottom = 5)
|
||||
function print_optionbar_start ($height = 20, $width = 0, $marginbottom = 5)
|
||||
{
|
||||
echo("
|
||||
<div style='text-align: center; margin-top: 0px; margin-bottom: ".$marginbottom."px; " . ($width ? 'max-width: ' . $width . (strstr($width,'%') ? '' : 'px') . '; ' : '') . "'>
|
||||
@@ -278,20 +290,20 @@ function print_optionbar_start ($height = 20, $width = 0, $marginbottom = 5)
|
||||
}
|
||||
|
||||
|
||||
function print_optionbar_end ()
|
||||
function print_optionbar_end()
|
||||
{
|
||||
echo(" </div>
|
||||
echo(' </div>
|
||||
</div>
|
||||
<b class='rounded'>
|
||||
<b class='rounded5'></b>
|
||||
<b class='rounded4'></b>
|
||||
<b class='rounded3'></b>
|
||||
<b class='rounded2'><b></b></b>
|
||||
<b class='rounded1'><b></b></b></b>
|
||||
</div>");
|
||||
<b class="rounded">
|
||||
<b class="rounded5"></b>
|
||||
<b class="rounded4"></b>
|
||||
<b class="rounded3"></b>
|
||||
<b class="rounded2"><b></b></b>
|
||||
<b class="rounded1"><b></b></b></b>
|
||||
</div>');
|
||||
}
|
||||
|
||||
function geteventicon ($message)
|
||||
function geteventicon($message)
|
||||
{
|
||||
if ($message == "Device status changed to Down") { $icon = "server_connect.png"; }
|
||||
if ($message == "Device status changed to Up") { $icon = "server_go.png"; }
|
||||
@@ -302,17 +314,18 @@ function geteventicon ($message)
|
||||
if (isset($icon)) { return $icon; } else { return false; }
|
||||
}
|
||||
|
||||
function overlibprint($text) {
|
||||
return "onmouseover=\"return overlib('" . $text . "');\" onmouseout=\"return nd();\"";
|
||||
function overlibprint($text)
|
||||
{
|
||||
return "onmouseover=\"return overlib('" . $text . "');\" onmouseout=\"return nd();\"";
|
||||
}
|
||||
|
||||
function humanmedia($media)
|
||||
function humanmedia($media)
|
||||
{
|
||||
array_preg_replace($rewrite_iftype, $media);
|
||||
return $media;
|
||||
}
|
||||
|
||||
function humanspeed($speed)
|
||||
function humanspeed($speed)
|
||||
{
|
||||
$speed = formatRates($speed);
|
||||
if ($speed == "") { $speed = "-"; }
|
||||
@@ -329,16 +342,17 @@ function print_message($text)
|
||||
echo('<table class="messagebox" cellpadding="3"><tr><td><img src="/images/16/tick.png" align="absmiddle"> '.$text.'</td></tr></table>');
|
||||
}
|
||||
|
||||
function devclass($device)
|
||||
function devclass($device)
|
||||
{
|
||||
if (isset($device['status']) && $device['status'] == '0') { $class = "list-device-down"; } else { $class = "list-device"; }
|
||||
if (isset($device['ignore']) && $device['ignore'] == '1') {
|
||||
if (isset($device['status']) && $device['status'] == '0') { $class = "list-device-down"; } else { $class = "list-device"; }
|
||||
if (isset($device['ignore']) && $device['ignore'] == '1')
|
||||
{
|
||||
$class = "list-device-ignored";
|
||||
if (isset($device['status']) && $device['status'] == '1') { $class = "list-device-ignored-up"; }
|
||||
}
|
||||
if (isset($device['disabled']) && $device['disabled'] == '1') { $class = "list-device-disabled"; }
|
||||
}
|
||||
if (isset($device['disabled']) && $device['disabled'] == '1') { $class = "list-device-disabled"; }
|
||||
|
||||
return $class;
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
if($bg == $list_colour_b) { $bg = $list_colour_a; } else { $bg = $list_colour_b; }
|
||||
if ($bg == $list_colour_b) { $bg = $list_colour_a; } else { $bg = $list_colour_b; }
|
||||
if ($device['status'] == '0') { $class = "list-device-down"; $bg_image = "images/warning-background.png"; } else { $class = "list-device"; unset ($bg_image); }
|
||||
if ($device['ignore'] == '1') {
|
||||
$class = "list-device-ignored";
|
||||
@@ -12,21 +12,21 @@
|
||||
|
||||
$image = getImage($device['device_id']);
|
||||
if ($device['os'] == "ios") { formatCiscoHardware($device, true); }
|
||||
$device['os_text'] = $config['os'][$device['os']]['text'];
|
||||
$device['os_text'] = $config['os'][$device['os']]['text'];
|
||||
|
||||
$port_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `ports` WHERE `device_id` = '".$device['device_id']."'"),0);
|
||||
$sensor_count = mysql_result(mysql_query("SELECT COUNT(*) FROM `sensors` WHERE `device_id` = '".$device['device_id']."'"),0);
|
||||
|
||||
echo(' <tr background="'.$bg_image.'" bgcolor="' . $bg . '" onmouseover="this.style.backgroundColor=\'#fdd\';" onmouseout="this.style.backgroundColor=\'' . $bg . '\';"
|
||||
echo(' <tr background="'.$bg_image.'" bgcolor="' . $bg . '" onmouseover="this.style.backgroundColor=\'#fdd\';" onmouseout="this.style.backgroundColor=\'' . $bg . '\';"
|
||||
onclick="location.href=\'/device/'.$device['device_id'].'/\'" style="cursor: pointer;">
|
||||
<td width="40" align="center" valign="middle">' . $image . '</td>
|
||||
<td width="300"><span style="font-weight: bold; font-size: 14px;">' . generate_device_link($device) . '</span>
|
||||
<br />' . $device['sysName'] . '</td>
|
||||
<td width=55>');
|
||||
|
||||
if($port_count) { echo(' <img src="images/icons/port.png" align=absmiddle> '.$port_count); }
|
||||
if ($port_count) { echo(' <img src="images/icons/port.png" align=absmiddle> '.$port_count); }
|
||||
echo('<br />');
|
||||
if($sensor_count) { echo(' <img src="images/icons/sensors.png" align=absmiddle> '.$sensor_count); }
|
||||
if ($sensor_count) { echo(' <img src="images/icons/sensors.png" align=absmiddle> '.$sensor_count); }
|
||||
|
||||
|
||||
echo(' </td>
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
<script type="text/javascript" src="<?php echo($config['base_url']); ?>/js/tw-sack.js"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
|
||||
var ajax = new Array();
|
||||
|
||||
function getInterfaceList(sel)
|
||||
{
|
||||
var deviceId = sel.options[sel.selectedIndex].value;
|
||||
document.getElementById('interface_id').options.length = 0; // Empty city select box
|
||||
if(deviceId.length>0){
|
||||
if (deviceId.length>0){
|
||||
var index = ajax.length;
|
||||
ajax[index] = new sack();
|
||||
|
||||
|
||||
@@ -1,49 +1,58 @@
|
||||
<?php
|
||||
|
||||
# enable/disable ports/interfaces on devices.
|
||||
#
|
||||
|
||||
$device_id=intval($_POST['device']);
|
||||
$device_id = intval($_POST['device']);
|
||||
$rows_updated = 0;
|
||||
|
||||
foreach ($_POST as $key => $val) {
|
||||
if (strncmp($key,"oldval_",7) == 0) {
|
||||
foreach ($_POST as $key => $val)
|
||||
{
|
||||
if (strncmp($key,"oldval_",7) == 0)
|
||||
{
|
||||
# Interface identifier passed as part of the field name
|
||||
|
||||
# Interface identifier passed as part of the field name
|
||||
#
|
||||
$interface_id = intval(substr($key,7));
|
||||
$interface_id = intval(substr($key,7));
|
||||
|
||||
$oldval = intval($val) ? 1 : 0;
|
||||
$newval = $_POST['ignore_'.$interface_id] ? 1 : 0;
|
||||
$oldval = intval($val) ? 1 : 0;
|
||||
$newval = $_POST['ignore_'.$interface_id] ? 1 : 0;
|
||||
|
||||
# As checkboxes are not posted when unset - we effectively need to do a diff to work
|
||||
# out a set->unset case.
|
||||
#
|
||||
if ($oldval == $newval)
|
||||
continue;
|
||||
|
||||
if (!mysql_query('UPDATE `ports` SET `ignore`='.$newval.' WHERE `device_id`='.$device_id.' AND `interface_id`='.$interface_id))
|
||||
$n = -1;
|
||||
else
|
||||
$n = mysql_affected_rows();
|
||||
# As checkboxes are not posted when unset - we effectively need to do a diff to work
|
||||
# out a set->unset case.
|
||||
|
||||
if ($n <0) {
|
||||
$rows_updated = -1;
|
||||
break;
|
||||
};
|
||||
$rows_updated += $n;
|
||||
};
|
||||
};
|
||||
if ($oldval == $newval)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!mysql_query('UPDATE `ports` SET `ignore`='.$newval.' WHERE `device_id`='.$device_id.' AND `interface_id`='.$interface_id))
|
||||
{
|
||||
$n = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$n = mysql_affected_rows();
|
||||
}
|
||||
|
||||
if($rows_updated > 0) {
|
||||
$update_message = $rows_updated . " Device record updated.";
|
||||
$updated = 1;
|
||||
} elseif ($rows_updated = '-1') {
|
||||
$update_message = "Device record unchanged. No update necessary.";
|
||||
$updated = -1;
|
||||
} else {
|
||||
$update_message = "Device record update error.";
|
||||
$updated = 0;
|
||||
if ($n <0)
|
||||
{
|
||||
$rows_updated = -1;
|
||||
break;
|
||||
}
|
||||
|
||||
$rows_updated += $n;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
if ($rows_updated > 0)
|
||||
{
|
||||
$update_message = $rows_updated . " Device record updated.";
|
||||
$updated = 1;
|
||||
} elseif ($rows_updated = '-1') {
|
||||
$update_message = "Device record unchanged. No update necessary.";
|
||||
$updated = -1;
|
||||
} else {
|
||||
$update_message = "Device record update error.";
|
||||
$updated = 0;
|
||||
}
|
||||
|
||||
?>
|
||||
@@ -1,15 +1,17 @@
|
||||
<?php
|
||||
|
||||
|
||||
$graph_array['type'] = $graph_type;
|
||||
$graph_array['id'] = $device['device_id'];
|
||||
|
||||
$g_i++;
|
||||
if(!is_integer($g_i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
if (!is_integer($g_i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
echo('<div style="background-color: '.$row_colour.';">');
|
||||
echo('<div style="padding:4px 0px 0px 8px;" class=graphhead>'.$graph_title.'</div>');
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
echo("</div>");
|
||||
|
||||
echo('</div>');
|
||||
|
||||
?>
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
#print_r($interface);
|
||||
#echo("</pre>");
|
||||
|
||||
# This file prints a table row for each interface
|
||||
|
||||
# This file prints a table row for each interface
|
||||
|
||||
$interface['device_id'] = $device['device_id'];
|
||||
$interface['hostname'] = $device['hostname'];
|
||||
|
||||
@@ -13,11 +13,11 @@
|
||||
|
||||
$interface = ifLabel($interface);
|
||||
|
||||
if(!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
if (!is_integer($i/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
|
||||
|
||||
|
||||
if($interface['ifInErrors_delta'] > 0 || $interface['ifOutErrors_delta'] > 0) {
|
||||
$error_img = generate_port_link($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>","port_errors");
|
||||
if ($interface['ifInErrors_delta'] > 0 || $interface['ifOutErrors_delta'] > 0) {
|
||||
$error_img = generate_port_link($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>","port_errors");
|
||||
} else { $error_img = ""; }
|
||||
|
||||
echo("<tr style=\"background-color: $row_colour; padding: 5px;\" valign=top onmouseover=\"this.style.backgroundColor='$list_highlight';\" onmouseout=\"this.style.backgroundColor='$row_colour';\"
|
||||
@@ -29,17 +29,17 @@
|
||||
</span><br /><span class=interface-desc>".$interface['ifAlias']."</span>");
|
||||
|
||||
|
||||
if($interface['ifAlias']) { echo("<br />"); }
|
||||
if ($interface['ifAlias']) { echo("<br />"); }
|
||||
|
||||
unset ($break);
|
||||
if($port_details) {
|
||||
if ($port_details) {
|
||||
$ipdata = mysql_query("SELECT * FROM `ipv4_addresses` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
|
||||
while($ip = mysql_fetch_Array($ipdata)) {
|
||||
while ($ip = mysql_fetch_Array($ipdata)) {
|
||||
echo("$break <a class=interface-desc href=\"javascript:popUp('/netcmd.php?cmd=whois&query=$ip[ipv4_address]')\">$ip[ipv4_address]/$ip[ipv4_prefixlen]</a>");
|
||||
$break = ",";
|
||||
}
|
||||
$ip6data = mysql_query("SELECT * FROM `ipv6_addresses` WHERE `interface_id` = '" . $interface['interface_id'] . "'");
|
||||
while($ip6 = mysql_fetch_Array($ip6data)) {
|
||||
while ($ip6 = mysql_fetch_Array($ip6data)) {
|
||||
echo("$break <a class=interface-desc href=\"javascript:popUp('/netcmd.php?cmd=whois&query=".$ip6['ipv6_address']."')\">".Net_IPv6::compress($ip6['ipv6_address'])."/".$ip6['ipv6_prefixlen']."</a>");
|
||||
$break = ",";
|
||||
}
|
||||
@@ -70,7 +70,7 @@
|
||||
$interface['graph_type'] = "port_adsl_attainable";
|
||||
echo(generate_port_link($interface, "<img src='graph.php?type=".$interface['graph_type']."&id=".$interface['interface_id']."&from=".$from."&to=".$now."&width=".$width."&height=".$height."&legend=no&bg=".
|
||||
str_replace("#","", $row_colour)."'>", $interface['graph_type']));
|
||||
|
||||
|
||||
echo("</td><td width=135>");
|
||||
echo("".$interface['adslAturCurrAtn'] . "dB/". $interface['adslAtucCurrAtn'] . "dB");
|
||||
echo("<br />");
|
||||
@@ -93,7 +93,7 @@
|
||||
str_replace("#","", $row_colour)."'>", $interface['graph_type']));
|
||||
|
||||
|
||||
# if($interface[ifDuplex] != unknown) { echo("<span class=box-desc>Duplex " . $interface['ifDuplex'] . "</span>"); } else { echo("-"); }
|
||||
# if ($interface[ifDuplex] != unknown) { echo("<span class=box-desc>Duplex " . $interface['ifDuplex'] . "</span>"); } else { echo("-"); }
|
||||
|
||||
|
||||
# echo("</td><td width=150>");
|
||||
@@ -111,15 +111,15 @@
|
||||
|
||||
echo("</td>");
|
||||
|
||||
if($graph_type == "etherlike")
|
||||
{
|
||||
$graph_file = $config['rrd_dir'] . "/" . $device['hostname'] . "/etherlike-". 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";
|
||||
$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;
|
||||
|
||||
$daily_traffic = "graph.php?port=$if_id&type=" . $graph_type . "&from=$from&to=$now&width=210&height=100";
|
||||
@@ -136,7 +136,7 @@ echo("</td>");
|
||||
|
||||
echo("<tr style='background-color: $bg; padding: 5px;'><td colspan=7>");
|
||||
|
||||
echo("<a href='device/" . $interface['device_id'] . "/interface/" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\"
|
||||
echo("<a href='device/" . $interface['device_id'] . "/interface/" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$daily_url\'>', LEFT".$config['overlib_defaults'].");\"
|
||||
onmouseout=\"return nd();\"> <img src='$daily_traffic' border=0></a>");
|
||||
echo("<a href='device/" . $interface['device_id'] . "/interface/" . $interface['interface_id'] . "' onmouseover=\"return overlib('<img src=\'$weekly_url\'>', LEFT".$config['overlib_defaults'].");\"
|
||||
onmouseout=\"return nd();\"> <img src='$weekly_traffic' border=0></a>");
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
<?php
|
||||
|
||||
global $config;
|
||||
global $config;
|
||||
|
||||
#if(!$graph_type) { $graph_type = $_GET['type']; }
|
||||
#if(!$device) { $device['device_id'] = getifhost($interface['interface_id']); }
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "215";
|
||||
$graph_array['to'] = $now;
|
||||
$graph_array['id'] = $interface['interface_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
|
||||
$graph_array['height'] = "100";
|
||||
$graph_array['width'] = "215";
|
||||
$graph_array['to'] = $now;
|
||||
$graph_array['id'] = $interface['interface_id'];
|
||||
$graph_array['type'] = $graph_type;
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
include("includes/print-quadgraphs.inc.php");
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -11,11 +11,11 @@ if (isset($config['enable_bgp']) && $config['enable_bgp'])
|
||||
}
|
||||
|
||||
$query_a = mysql_query("SELECT * FROM `devices`");
|
||||
while($device = mysql_fetch_array($query_a)) {
|
||||
while ($device = mysql_fetch_array($query_a)) {
|
||||
$this_alert = 0;
|
||||
if ($device['status'] == 0 && $device['ignore'] == '0') { $this_alert = "1"; } elseif ($device['ignore'] == '0') {
|
||||
if (mysql_result(mysql_query("SELECT count(service_id) FROM services WHERE service_status = '0' AND device_id = '".$device['device_id']."'"),0)) { $this_alert = "1"; }
|
||||
if (mysql_result(mysql_query("SELECT count(*) FROM ports WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND device_id = '" . $device['device_id'] . "' AND `ignore` = '0'"),0)) { $this_alert = "1";}
|
||||
if (mysql_result(mysql_query("SELECT count(*) FROM ports WHERE `ifOperStatus` = 'down' AND `ifAdminStatus` = 'up' AND device_id = '" . $device['device_id'] . "' AND `ignore` = '0'"),0)) { $this_alert = "1"; }
|
||||
}
|
||||
if ($this_alert) {
|
||||
$device_alerts++;
|
||||
@@ -151,11 +151,11 @@ if ($ports['ignored'])
|
||||
echo('<li><a href="ports/ignored/"><img src="images/16/chart_curve_link.png" border="0" align="absmiddle" /> Ignored ('.$ports['ignored'].')</a></li>');
|
||||
}
|
||||
|
||||
if ($config['enable_billing']) { echo('<li><a href="bills/"><img src="images/16/money_pound.png" border="0" align="absmiddle" /> Traffic Bills</a></li>'); $ifbreak = 1;}
|
||||
if ($config['enable_billing']) { echo('<li><a href="bills/"><img src="images/16/money_pound.png" border="0" align="absmiddle" /> Traffic Bills</a></li>'); $ifbreak = 1; }
|
||||
|
||||
if ($config['enable_pseudowires']) { echo('<li><a href="pseudowires/"><img src="images/16/arrow_switch.png" border="0" align="absmiddle" /> Pseudowires</a></li>'); $ifbreak = 1;}
|
||||
if ($config['enable_pseudowires']) { echo('<li><a href="pseudowires/"><img src="images/16/arrow_switch.png" border="0" align="absmiddle" /> Pseudowires</a></li>'); $ifbreak = 1; }
|
||||
|
||||
if ($config['enable_pseudowires']) { echo('<li><a href="vrfs/"><img src="images/16/layers.png" border="0" align="absmiddle" /> VRFs</a></li>'); $ifbreak = 1;}
|
||||
if ($config['enable_pseudowires']) { echo('<li><a href="vrfs/"><img src="images/16/layers.png" border="0" align="absmiddle" /> VRFs</a></li>'); $ifbreak = 1; }
|
||||
|
||||
?>
|
||||
<li><a href="ipv4/"><img src="images/16/email_link.png" border="0" align="absmiddle" /> IPv4 Search</a></li>
|
||||
@@ -166,12 +166,12 @@ if ($config['enable_pseudowires']) { echo('<li><a href="vrfs/"><img src="images/
|
||||
if ($_SESSION['userlevel'] >= '5')
|
||||
{
|
||||
echo('<li><hr width="140" /></li>');
|
||||
if ($config['int_customers']) { echo('<li><a href="customers/"><img src="images/16/group_link.png" border="0" align="absmiddle" /> Customers</a></li>'); $ifbreak = 1;}
|
||||
if ($config['int_customers']) { echo('<li><a href="customers/"><img src="images/16/group_link.png" border="0" align="absmiddle" /> Customers</a></li>'); $ifbreak = 1; }
|
||||
if ($config['int_l2tp']) { echo('<li><a href="iftype/l2tp/"><img src="images/16/user.png" border="0" align="absmiddle" /> L2TP</a></li>'); $ifbreak = 1; }
|
||||
if ($config['int_transit']) { echo('<li><a href="iftype/transit/"><img src="images/16/lorry_link.png" border="0" align="absmiddle" /> Transit</a></li>'); $ifbreak = 1; }
|
||||
if ($config['int_peering']) { echo('<li><a href="iftype/peering/"><img src="images/16/bug_link.png" border="0" align="absmiddle" /> Peering</a></li>'); $ifbreak = 1; }
|
||||
if ($config['int_peering'] && $config['int_transit']) { echo('<li><a href="iftype/peering,transit/"><img src="images/16/world_link.png" border="0" align="absmiddle" /> Peering + Transit</a></li>'); $ifbreak = 1; }
|
||||
if ($config['int_core']) { echo('<li><a href="iftype/core/"><img src="images/16/brick_link.png" border="0" align="absmiddle" /> Core</a></li>'); $ifbreak = 1;}
|
||||
if ($config['int_core']) { echo('<li><a href="iftype/core/"><img src="images/16/brick_link.png" border="0" align="absmiddle" /> Core</a></li>'); $ifbreak = 1; }
|
||||
}
|
||||
|
||||
if ($ifbreak) { echo('<li><hr width="140" /></li>'); }
|
||||
@@ -184,9 +184,9 @@ if (isset($interface_alerts))
|
||||
$sql = "SELECT * FROM `ports` AS P, `devices` as D WHERE P.`deleted` = '1' AND D.device_id = P.device_id";
|
||||
$query = mysql_query($sql);
|
||||
$deleted_ports = 0;
|
||||
while($interface = mysql_fetch_assoc($query))
|
||||
while ($interface = mysql_fetch_assoc($query))
|
||||
{
|
||||
if(port_permitted($interface['interface_id'], $interface['device_id']))
|
||||
if (port_permitted($interface['interface_id'], $interface['device_id']))
|
||||
{
|
||||
$deleted_ports++;
|
||||
}
|
||||
@@ -197,7 +197,7 @@ while($interface = mysql_fetch_assoc($query))
|
||||
<li><a href="ports/admindown/"><img src="images/16/if-disable.png" border="0" align="absmiddle" /> Disabled</a></li>
|
||||
<?php
|
||||
|
||||
if($deleted_ports) { echo('<li><a href="ports/deleted/"><img src="images/16/cross.png" border="0" align="absmiddle" /> Deleted ('.$deleted_ports.')</a></li>'); }
|
||||
if ($deleted_ports) { echo('<li><a href="ports/deleted/"><img src="images/16/cross.png" border="0" align="absmiddle" /> Deleted ('.$deleted_ports.')</a></li>'); }
|
||||
|
||||
?>
|
||||
</ul></td></tr></table>
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
if(device_permitted($entry['device_id'])) {
|
||||
|
||||
|
||||
$syslog_iter++;
|
||||
if(!is_integer($syslog_iter/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
if (device_permitted($entry['device_id']))
|
||||
{
|
||||
$syslog_iter++;
|
||||
if (!is_integer($syslog_iter/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
|
||||
|
||||
echo("<tr style=\"background-color: $bg_colour\">
|
||||
<td width=0></td>");
|
||||
@@ -15,8 +12,9 @@ if(!is_integer($syslog_iter/2)) { $bg_colour = $list_colour_a; } else { $bg_colo
|
||||
|
||||
$entry['hostname'] = shorthost($entry['hostname'], 20);
|
||||
|
||||
if($_GET['page'] != "device") {
|
||||
echo("<td width=160><strong>".generate_device_link($entry)."</strong></td>");
|
||||
if ($_GET['page'] != "device")
|
||||
{
|
||||
echo("<td width=160><strong>".generate_device_link($entry)."</strong></td>");
|
||||
}
|
||||
|
||||
echo(" <td class=syslog>
|
||||
@@ -28,4 +26,4 @@ if(!is_integer($syslog_iter/2)) { $bg_colour = $list_colour_a; } else { $bg_colo
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -9,14 +9,14 @@ echo("<td width=200 class=box-desc>" . $vlan['vlan_descr'] . "</td>");
|
||||
|
||||
echo("<td class=list-bold>");
|
||||
$ports_query = mysql_query("SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVlan` = '" . $vlan['vlan_vlan'] . "' ");
|
||||
while($port = mysql_fetch_array($ports_query))
|
||||
while ($port = mysql_fetch_array($ports_query))
|
||||
{
|
||||
if ($_GET['opta'])
|
||||
{
|
||||
$graph_type = $_GET['opta'];
|
||||
|
||||
echo("<div style='display: block; padding: 2px; margin: 2px; min-width: 139px; max-width:139px; min-height:85px; max-height:85px; text-align: center; float: left; background-color: ".$list_colour_b_b.";'>
|
||||
<div style='font-weight: bold;'>".makeshortif ($port['ifDescr'])."</div>
|
||||
<div style='font-weight: bold;'>".makeshortif($port['ifDescr'])."</div>
|
||||
<a href='device/".$device['device_id']."/interface/".$port['interface_id']."/' onmouseover=\"return overlib('\
|
||||
<div style=\'font-size: 16px; padding:5px; font-weight: bold; color: #e5e5e5;\'>".$device['hostname']." - ".$port['ifDescr']."</div>\
|
||||
".$port['ifAlias']." \
|
||||
@@ -29,7 +29,7 @@ while($port = mysql_fetch_array($ports_query))
|
||||
}
|
||||
else
|
||||
{
|
||||
echo($vlan['port_sep'] . generate_port_link($port, makeshortif ($port['ifDescr'])));
|
||||
echo($vlan['port_sep'] . generate_port_link($port, makeshortif($port['ifDescr'])));
|
||||
$vlan['port_sep'] = ", ";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
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; }
|
||||
|
||||
echo("<tr bgcolor='$bg_colour'>");
|
||||
|
||||
@@ -11,8 +11,8 @@ echo("<td width=100 class=box-desc>" . $vrf['mplsVpnVrfRouteDistinguisher'] . "<
|
||||
|
||||
echo("<td class=list-bold>");
|
||||
$ports_query = mysql_query("SELECT * FROM ports WHERE `device_id` = '" . $device['device_id'] . "' AND `ifVrf` = '" . $vrf['vrf_id'] . "' ");
|
||||
while($port = mysql_fetch_array($ports_query)) {
|
||||
if($_GET['opta']) {
|
||||
while ($port = mysql_fetch_array($ports_query)) {
|
||||
if ($_GET['opta']) {
|
||||
$graph_type = "port_" . $_GET['opta'];
|
||||
echo("<div style='display: block; padding: 2px; margin: 2px; min-width: 139px; max-width:139px; min-height:85px; max-height:85px; text-align: center; float: left; background-color: #e9e9e9;'>
|
||||
<div style='font-weight: bold;'>".makeshortif($port['ifDescr'])."</div>
|
||||
|
||||
@@ -40,13 +40,12 @@ else
|
||||
$services['disabled'] = mysql_result(mysql_query("SELECT count(service_id) FROM services AS S, devices AS D, devices_perms AS P WHERE P.user_id = '" . $_SESSION['user_id'] . "' AND P.device_id = D.device_id AND S.device_id = D.device_id AND service_ignore = '1'"),0);
|
||||
}
|
||||
|
||||
if($devices['down']) { $devices['bgcolour'] = "#ffcccc"; } else { $devices['bgcolour'] = "transparent"; }
|
||||
if($ports['down']) { $ports['bgcolour'] = "#ffcccc"; } else { $ports['bgcolour'] = "#e5e5e5"; }
|
||||
if($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['bgcolour'] = "transparent"; }
|
||||
if ($devices['down']) { $devices['bgcolour'] = "#ffcccc"; } else { $devices['bgcolour'] = "transparent"; }
|
||||
if ($ports['down']) { $ports['bgcolour'] = "#ffcccc"; } else { $ports['bgcolour'] = "#e5e5e5"; }
|
||||
if ($services['down']) { $services['bgcolour'] = "#ffcccc"; } else { $services['bgcolour'] = "transparent"; }
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<table cellpadding="2" cellspacing="0" border="0">
|
||||
<tr style="background-color: <?php echo($devices[bgcolour]); ?>">
|
||||
<td width="5"></td>
|
||||
|
||||
Reference in New Issue
Block a user