diff --git a/database-update.sql b/database-update.sql
index 347ecf04a..a37fbe52f 100644
--- a/database-update.sql
+++ b/database-update.sql
@@ -29,3 +29,4 @@ ALTER TABLE `vrfs` MODIFY `mplsVpnVrfRouteDistinguisher` VARCHAR(128);
ALTER TABLE `vrfs` MODIFY `vrf_name` VARCHAR(128);
ALTER TABLE `ports` MODIFY `ifDescr` VARCHAR(255);
CREATE TABLE IF NOT EXISTS `vmware_vminfo` (`id` int(11) NOT NULL AUTO_INCREMENT, `device_id` int(11) NOT NULL, `vmwVmVMID` int(11) NOT NULL, `vmwVmDisplayName` varchar(128) NOT NULL, `vmwVmGuestOS` varchar(128) NOT NULL, `vmwVmMemSize` int(11) NOT NULL, `vmwVmCpus` int(11) NOT NULL, `vmwVmState` varchar(128) NOT NULL, PRIMARY KEY (`id`), KEY `device_id` (`device_id`), KEY `vmwVmVMID` (`vmwVmVMID`)) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+ALTER TABLE `ports` MODIFY `port_descr_type` VARCHAR(255);
diff --git a/html/includes/device-ipmi-edit.inc.php b/html/includes/device-ipmi-edit.inc.php
deleted file mode 100644
index 19bd9916d..000000000
--- a/html/includes/device-ipmi-edit.inc.php
+++ /dev/null
@@ -1,16 +0,0 @@
-
diff --git a/html/includes/graphs/bill/auth.inc.php b/html/includes/graphs/bill/auth.inc.php
index f91c0b571..c9f1d1db2 100644
--- a/html/includes/graphs/bill/auth.inc.php
+++ b/html/includes/graphs/bill/auth.inc.php
@@ -3,7 +3,6 @@
### Authorises bill viewing and sets $ports as reference to mysql query containing ports for this bill
include("../includes/billing.php");
-include("../includes/functions.php"); ## FIXME zeropad()
if (is_numeric($_GET['id']) && ($config['allow_unauth_graphs'] || bill_permitted($_GET['id'])))
{
diff --git a/html/includes/header.inc.php b/html/includes/header.inc.php
index 40583e608..790506088 100644
--- a/html/includes/header.inc.php
+++ b/html/includes/header.inc.php
@@ -10,9 +10,9 @@ if ($_SESSION['authenticated'])
} else {
echo("Not logged in!");
}
-# FIXME worksforme, why was this disabled again? -TL
-# if (Net_IPv6::checkIPv6($_SERVER['REMOTE_ADDR'])) { echo(" via IPv6"); } else { echo(" via IPv4"); }
- ?>
+
+if (Net_IPv6::checkIPv6($_SERVER['REMOTE_ADDR'])) { echo(" via IPv6"); } else { echo(" via IPv4"); }
+?>
diff --git a/html/pages/device.inc.php b/html/pages/device.inc.php
index 8929a47d7..470829506 100644
--- a/html/pages/device.inc.php
+++ b/html/pages/device.inc.php
@@ -22,6 +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'] . "'");
+ # FIXME device_by_id_cache ?
while ($device = mysql_fetch_array($device_query))
{
if ($config['os'][$device['os']]['group']) { $device['os_group'] = $config['os'][$device['os']]['group']; }
@@ -33,189 +34,186 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id'])
echo('
');
echo('
');
-
- if (device_permitted($_GET['id']))
- {
- if ($config['show_overview_tab'])
+ if (device_permitted($device['device_id']))
{
- echo('
+ if ($config['show_overview_tab'])
+ {
+ echo('
-
Overview
');
- }
+ }
- echo('-
+ echo('
-
Graphs
');
- $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);
+ $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('-
+ if ($health)
+ {
+ echo('
-
Health
');
- }
+ }
- if (@mysql_result(mysql_query("select count(app_id) from applications WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
- {
- echo('-
+ if (@mysql_result(mysql_query("select count(app_id) from applications WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('
-
Apps
');
- }
+ }
- if (is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/"))
- {
- echo('-
+ if (is_dir($config['collectd_dir'] . "/" . $device['hostname'] ."/"))
+ {
+ echo('
-
CollectD
');
- }
+ }
- if (@mysql_result(mysql_query("select count(interface_id) from ports WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
- {
- echo('-
+ if (@mysql_result(mysql_query("select count(interface_id) from ports WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('
-
Ports
');
- }
+ }
- if (@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
- {
- echo('-
+ if (@mysql_result(mysql_query("select count(vlan_id) from vlans WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('
-
VLANs
');
- }
+ }
- if (@mysql_result(mysql_query("SELECT COUNT(id) FROM vmware_vminfo WHERE device_id = '" . $device["device_id"] . "'"), 0) > '0')
- {
- echo('-
+ if (@mysql_result(mysql_query("SELECT COUNT(id) FROM vmware_vminfo WHERE device_id = '" . $device["device_id"] . "'"), 0) > '0')
+ {
+ echo('
-
Virtual Machines
');
- }
+ }
- if (@mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
- {
- echo('-
+ if (@mysql_result(mysql_query("select count(*) from vrfs WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('
-
VRFs
');
- }
+ }
- if ($config['enable_bgp'] && $device['bgpLocalAs'])
- {
- echo('-
+ if ($config['enable_bgp'] && $device['bgpLocalAs'])
+ {
+ echo('
-
BGP
');
- }
+ }
- if ($_SESSION['userlevel'] >= "5" && mysql_result(mysql_query("SELECT count(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"),0))
- {
- echo('-
+ if ($_SESSION['userlevel'] >= "5" && mysql_result(mysql_query("SELECT count(*) FROM links AS L, ports AS I WHERE I.device_id = '".$device['device_id']."' AND I.interface_id = L.local_interface_id"),0))
+ {
+ echo('
-
Map
');
- }
+ }
- if ($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."'"), 0) > '0')
- {
- echo('-
+ if ($config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."'"), 0) > '0')
+ {
+ echo('
-
Inventory
');
- }
- elseif (device_permitted($_GET['id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '".$_GET['id']."'"), 0) > '0')
- {
- echo('-
+ }
+ elseif (device_permitted($device['device_id']) && $config['enable_inventory'] && @mysql_result(mysql_query("SELECT * FROM `hrDevice` WHERE device_id = '".$device['device_id']."'"), 0) > '0')
+ {
+ echo('
-
Inventory
');
- }
+ }
- if (mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
- {
- echo('-
+ if (mysql_result(mysql_query("select count(service_id) from services WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('
-
Services
');
- }
+ }
- if (@mysql_result(mysql_query("select count(toner_id) from toner WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
- {
- echo('-
+ if (@mysql_result(mysql_query("select count(toner_id) from toner WHERE device_id = '" . $device['device_id'] . "'"), 0) > '0')
+ {
+ echo('
-
Toner
');
- }
+ }
- if (device_permitted($_GET['id']))
- {
- echo('-
+ if (device_permitted($device['device_id']))
+ {
+ echo('
-
Events
');
- }
+ }
- if ($config['enable_syslog'])
- {
- echo('-
+ if ($config['enable_syslog'])
+ {
+ echo('
-
Syslog
-
- ');
+ ');
+ }
}
- }
-
- if ($_SESSION['userlevel'] >= "7")
- {
- if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_configs']); }
- foreach ($config['rancid_configs'] as $configs)
+ if ($_SESSION['userlevel'] >= "7")
{
- if ($configs[strlen($configs)-1] != '/') { $configs .= '/'; }
- if (is_file($configs . $device['hostname'])) { $device_config_file = $configs . $device['hostname']; }
+ if (!is_array($config['rancid_configs'])) { $config['rancid_configs'] = array($config['rancid_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']; }
+ }
}
- }
- if ($device_config_file)
- {
- echo('-
+
+ if ($device_config_file)
+ {
+ echo('
-
Config
-
- ');
+ ');
}
if ($_SESSION['userlevel'] >= "7")
@@ -224,15 +222,13 @@ if (device_permitted($_GET['id']) || $check_device == $_GET['id'])
Settings
-
- ');
+ ');
}
echo("
");
echo('
');
- ## FIXME safe??
- include("pages/device/".mres($section).".inc.php");
+ include("pages/device/".mres(basename($section)).".inc.php");
echo("
");
}
@@ -241,4 +237,5 @@ else
{
include("includes/error-no-perm.inc.php");
}
-?>
+
+?>
\ No newline at end of file
diff --git a/html/pages/device/bgp.inc.php b/html/pages/device/bgp.inc.php
index 032c923ad..4e3ae6802 100644
--- a/html/pages/device/bgp.inc.php
+++ b/html/pages/device/bgp.inc.php
@@ -7,17 +7,17 @@ print_optionbar_start();
echo("
");
diff --git a/html/pages/device/edit/ipmi.inc.php b/html/pages/device/edit/ipmi.inc.php
index 77e32d1ea..829e3aa89 100644
--- a/html/pages/device/edit/ipmi.inc.php
+++ b/html/pages/device/edit/ipmi.inc.php
@@ -4,12 +4,19 @@ if ($_POST['editing'])
{
if ($_SESSION['userlevel'] > "7")
{
- include("includes/device-ipmi-edit.inc.php");
+ $ipmi_hostname = mres($_POST['ipmi_hostname']);
+ $ipmi_username = mres($_POST['ipmi_username']);
+ $ipmi_password = mres($_POST['ipmi_password']);
+
+ if ($ipmi_hostname != '') { set_dev_attrib($device, 'ipmi_hostname', $ipmi_hostname); } else { del_dev_attrib($device, 'ipmi_hostname'); }
+ if ($ipmi_username != '') { set_dev_attrib($device, 'ipmi_username', $ipmi_username); } else { del_dev_attrib($device, 'ipmi_username'); }
+ if ($ipmi_password != '') { set_dev_attrib($device, 'ipmi_password', $ipmi_password); } else { del_dev_attrib($device, 'ipmi_password'); }
+
+ $update_message = "Device IPMI data updated.";
+ $updated = 1;
}
}
-$descr = $device['purpose'];
-
if ($updated && $update_message)
{
print_message($update_message);
diff --git a/html/pages/device/entphysical.inc.php b/html/pages/device/entphysical.inc.php
index 864e429fa..890363c96 100644
--- a/html/pages/device/entphysical.inc.php
+++ b/html/pages/device/entphysical.inc.php
@@ -4,7 +4,7 @@ function printEntPhysical($ent, $level, $class)
{
global $device;
- $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex");
+ $query = mysql_query("SELECT * FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent."' ORDER BY entPhysicalContainedIn,entPhysicalIndex");
while ($ent = mysql_fetch_array($query))
{
echo("
@@ -58,7 +58,7 @@ function printEntPhysical($ent, $level, $class)
echo("
");
- $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$_GET['id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"),0);
+ $count = mysql_result(mysql_query("SELECT COUNT(*) FROM `entPhysical` WHERE device_id = '".$device['device_id']."' AND entPhysicalContainedIn = '".$ent['entPhysicalIndex']."'"),0);
if ($count)
{
echo("