mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-12 16:06:25 +02:00
some hacky changes to device.php to display port
git-svn-id: http://www.observium.org/svn/observer/trunk@1430 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
+53
-59
@@ -2,7 +2,15 @@
|
||||
|
||||
if($_GET['id']) {$_GET['id'] = mres($_GET['id']); }
|
||||
|
||||
if(devicepermitted($_GET['id'])) {
|
||||
print_r($_GET);
|
||||
|
||||
if($_GET['section'] == "interface" && is_numeric($_GET['opta']) && interfacepermitted($_GET['opta'])) {
|
||||
echo("device!");
|
||||
$check_device = get_device_id_by_interface_id($_GET['opta']);
|
||||
$permit_ports = 1;
|
||||
}
|
||||
|
||||
if(devicepermitted($_GET['id']) || $check_device == $_GET['id']) {
|
||||
|
||||
$selected['iface'] = "selected";
|
||||
|
||||
@@ -13,7 +21,6 @@ $section = mres($_GET['section']);
|
||||
$section = str_replace(".", "", $section);
|
||||
$select[$section] = "selected";
|
||||
|
||||
|
||||
$device_query = mysql_query("SELECT * FROM `devices` WHERE `device_id` = '" . $_GET['id'] . "'");
|
||||
while($device = mysql_fetch_array($device_query)) {
|
||||
|
||||
@@ -23,11 +30,11 @@ while($device = mysql_fetch_array($device_query)) {
|
||||
include("includes/device-header.inc.php");
|
||||
echo("</table>");
|
||||
|
||||
echo("<div class=mainpane>");
|
||||
echo("<div class=mainpane>");
|
||||
|
||||
echo('<ul id="maintab" class="shadetabs">');
|
||||
echo('<ul id="maintab" class="shadetabs">');
|
||||
|
||||
if($config['show_overview_tab']) {
|
||||
if(devicepermitted($_GET['id']) && $config['show_overview_tab']) {
|
||||
echo("
|
||||
<li class=" . $select['overview'] . ">
|
||||
<a href='".$config['base_url']."/device/" . $device['device_id'] . "/overview/'>
|
||||
@@ -36,36 +43,36 @@ echo("
|
||||
</li>");
|
||||
}
|
||||
|
||||
|
||||
#if ((is_file($config['install_dir'] . "/html/pages/device/graphs/os-".$device['os'].".inc.php")) ||
|
||||
# ($device['os_group'] && is_file($config['install_dir'] . "/html/pages/device/graphs/os-".$device['os_group'].".inc.php")))
|
||||
#{
|
||||
echo('<li class="' . $select['graphs'] . '">
|
||||
if(devicepermitted($_GET['id'])) {
|
||||
echo('<li class="' . $select['graphs'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/graphs/">
|
||||
<img src="images/16/server_chart.png" align="absmiddle" border="0"> Graphs
|
||||
</a>
|
||||
</li>');
|
||||
#}
|
||||
|
||||
$health = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(sensor_id) from sensors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(current_id) from current WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(freq_id) from frequencies WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(volt_id) from voltage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(fan_id) from fanspeed WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
|
||||
if($health) {
|
||||
echo('<li class="' . $select['health'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/health/">
|
||||
<img src="images/icons/sensors.png" align="absmiddle" border="0" /> Health
|
||||
</a>
|
||||
</li>');
|
||||
}
|
||||
|
||||
if(@mysql_result(mysql_query("select count(app_id) from applications WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
|
||||
if(devicepermitted($_GET['id'])) {
|
||||
|
||||
$health = mysql_result(mysql_query("select count(*) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(sensor_id) from sensors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from cempMemPool WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from cpmCPU WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(*) from processors WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(current_id) from current WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(freq_id) from frequencies WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(volt_id) from voltage WHERE device_id = '" . $device['device_id'] . "'"), 0) +
|
||||
mysql_result(mysql_query("select count(fan_id) from fanspeed WHERE device_id = '" . $device['device_id'] . "'"), 0);
|
||||
|
||||
if($health) {
|
||||
echo('<li class="' . $select['health'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/health/">
|
||||
<img src="images/icons/sensors.png" align="absmiddle" border="0" /> Health
|
||||
</a>
|
||||
</li>');
|
||||
}
|
||||
}
|
||||
|
||||
if(devicepermitted($_GET['id']) && @mysql_result(mysql_query("select count(app_id) from applications WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
|
||||
{
|
||||
echo('<li class="' . $select['apps'] . '">
|
||||
<a href="' . $config['base_url'] . '/device/' . $device['device_id'] . '/apps/">
|
||||
@@ -85,7 +92,7 @@ if(@mysql_result(mysql_query("select count(app_id) from applications WHERE devic
|
||||
#</li>');
|
||||
#}
|
||||
|
||||
if(is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/")) {
|
||||
if(devicepermitted($_GET['id']) && is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/")) {
|
||||
echo('<li class="' . $select['collectd'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/collectd/">
|
||||
<img src="images/16/chart_line.png" align="absmiddle" border="0" /> CollectD
|
||||
@@ -93,7 +100,7 @@ if(is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/")) {
|
||||
</li>');
|
||||
}
|
||||
|
||||
if(@mysql_result(mysql_query("select count(interface_id) from ports WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
if(devicepermitted($_GET['id']) && @mysql_result(mysql_query("select count(interface_id) from ports WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
echo('<li class="' . $select['ports'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/ports/' .$config['ports_page_default']. '">
|
||||
<img src="images/16/connect.png" align="absmiddle" border="0" /> Ports
|
||||
@@ -101,7 +108,7 @@ if(@mysql_result(mysql_query("select count(interface_id) from ports WHERE device
|
||||
</li>');
|
||||
}
|
||||
|
||||
if(@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
if(devicepermitted($_GET['id']) && @mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
echo('<li class="' . $select['vlans'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/vlans/">
|
||||
<img src="images/16/vlans.png" align="absmiddle" border="0" /> VLANs
|
||||
@@ -109,7 +116,7 @@ if(@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id =
|
||||
</li>');
|
||||
}
|
||||
|
||||
if(@mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
if(devicepermitted($_GET['id']) && @mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
echo('<li class="' . $select['vrfs'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/vrfs/">
|
||||
<img src="images/16/layers.png" align="absmiddle" border="0" /> VRFs
|
||||
@@ -118,7 +125,7 @@ if(@mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $
|
||||
}
|
||||
|
||||
|
||||
if($config['enable_bgp'] && $device['bgpLocalAs']) {
|
||||
if(devicepermitted($_GET['id']) && $config['enable_bgp'] && $device['bgpLocalAs']) {
|
||||
echo('<li class="' . $select['bgp'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/bgp/">
|
||||
<img src="images/16/link.png" align="absmiddle" border="0" /> BGP
|
||||
@@ -128,7 +135,6 @@ if($config['enable_bgp'] && $device['bgpLocalAs']) {
|
||||
|
||||
### This probably needs to die? DEATH TO NAGIOS!
|
||||
|
||||
|
||||
#if(@mysql_result(mysql_query("SELECT count(*) FROM nagios_hosts WHERE address = '".$device['hostname']."'", $nagios_link), 0) > '0') {
|
||||
# echo('<li class="' . $select['nagios'] . '">
|
||||
# <a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/nagios/">
|
||||
@@ -146,13 +152,13 @@ if($_SESSION['userlevel'] >= "5" && mysql_result(mysql_query("SELECT count(*) FR
|
||||
</li>');
|
||||
}
|
||||
|
||||
if($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."'"), 0) > '0') {
|
||||
if(devicepermitted($_GET['id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."'"), 0) > '0') {
|
||||
echo('<li class="' . $select['entphysical'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/entphysical/">
|
||||
<img src="images/16/bricks.png" align="absmiddle" border="0" /> Inventory
|
||||
</a>
|
||||
</li>');
|
||||
} elseif ( $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '".$_GET['id']."'"), 0) > '0') {
|
||||
} elseif ( devicepermitted($_GET['id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '".$_GET['id']."'"), 0) > '0') {
|
||||
echo('<li class="' . $select['hrdevice'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/hrdevice/">
|
||||
<img src="images/16/bricks.png" align="absmiddle" border="0" /> Inventory
|
||||
@@ -160,20 +166,7 @@ if($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entP
|
||||
</li>');
|
||||
}
|
||||
|
||||
|
||||
|
||||
#if(mysql_result(mysql_query("select count(storage_id) from storage WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
# echo("
|
||||
#<li class=" . $select['storage'] . ">
|
||||
# <a href='".$config['base_url']."/device/" . $device['device_id'] . '/storage/">
|
||||
# <img src="images/16/database.png" align="absmiddle" border="0" /> Storage
|
||||
# </a>
|
||||
#</li>
|
||||
#");
|
||||
#}
|
||||
|
||||
|
||||
if(mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
if(devicepermitted($_GET['id']) && mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
echo('<li class="' . $select['srv'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/srv/">
|
||||
<img src="images/icons/services.png" align="absmiddle" border="0" /> Services
|
||||
@@ -182,7 +175,7 @@ if(mysql_result(mysql_query("select count(service_id) from services WHERE device
|
||||
');
|
||||
}
|
||||
|
||||
if(@mysql_result(mysql_query("select count(toner_id) from toner WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
if(devicepermitted($_GET['id']) && @mysql_result(mysql_query("select count(toner_id) from toner WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0') {
|
||||
echo('<li class="' . $select['toner'] . '">
|
||||
<a href="'.$config['base_url'].'/device/' . $device['device_id'] . '/toner/">
|
||||
<img src="images/icons/toner.png" align="absmiddle" border="0" /> Toner
|
||||
@@ -190,14 +183,15 @@ if(@mysql_result(mysql_query("select count(toner_id) from toner WHERE device_id
|
||||
</li>');
|
||||
}
|
||||
|
||||
if(devicepermitted($_GET['id'])) {
|
||||
echo('<li class="' . $select['events'] . '">
|
||||
<a href="'.$config['base_url']. "/device/" . $device['device_id'] . '/events/">
|
||||
<img src="images/16/report_magnify.png" align="absmiddle" border="0" /> Events
|
||||
</a>
|
||||
</li>');
|
||||
}
|
||||
|
||||
echo('<li class="' . $select['events'] . '">
|
||||
<a href="'.$config['base_url']. "/device/" . $device['device_id'] . '/events/">
|
||||
<img src="images/16/report_magnify.png" align="absmiddle" border="0" /> Events
|
||||
</a>
|
||||
</li>');
|
||||
|
||||
if($config['enable_syslog']) {
|
||||
if(devicepermitted($_GET['id']) && $config['enable_syslog']) {
|
||||
echo('<li class="' . $select['syslog'] . '">
|
||||
<a href="'.$config['base_url']."/device/" . $device['device_id'] . '/syslog/">
|
||||
<img src="images/16/printer.png" align="absmiddle" border="0" /> Syslog
|
||||
|
||||
Reference in New Issue
Block a user