mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-28 08:02:41 +02:00
device subpages cleanup, remove dead code
git-svn-id: http://www.observium.org/svn/observer/trunk@1896 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
if($_POST['editing']) {
|
||||
if($_SESSION['userlevel'] > "7") {
|
||||
if ($_POST['editing'])
|
||||
{
|
||||
if ($_SESSION['userlevel'] > "7")
|
||||
{
|
||||
include("includes/device-edit.inc.php");
|
||||
}
|
||||
}
|
||||
@@ -9,7 +11,8 @@ if($_POST['editing']) {
|
||||
$device = mysql_fetch_array(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'"));
|
||||
$descr = $device['purpose'];
|
||||
|
||||
if($updated && $update_message) {
|
||||
if ($updated && $update_message)
|
||||
{
|
||||
print_message($update_message);
|
||||
} elseif ($update_message) {
|
||||
print_error($update_message);
|
||||
@@ -53,11 +56,14 @@ echo("<table cellpadding=0 cellspacing=0><tr><td>
|
||||
<td width='300'><div align='right'>SNMP Transport</div></td>
|
||||
<td colspan='3'>
|
||||
<select name='transport'>");
|
||||
foreach ($config['snmp']['transports'] as $transport) {
|
||||
|
||||
foreach ($config['snmp']['transports'] as $transport)
|
||||
{
|
||||
echo ("<option value='".$transport."'");
|
||||
if ($transport == $device['transport']) { echo (" selected='selected'"); }
|
||||
echo (">".$transport."</option>");
|
||||
}
|
||||
|
||||
echo(" </select>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -102,11 +108,11 @@ echo("
|
||||
<tr>
|
||||
<td><div align='right'>Disable</div></td>
|
||||
<td><input name='disabled' type='checkbox' id='disabled' value='1'");
|
||||
if($device['disabled']) { echo("checked=checked"); }
|
||||
if ($device['disabled']) { echo("checked=checked"); }
|
||||
echo("/></td>
|
||||
<td><div align='right'>Ignore</div></td>
|
||||
<td><input name='ignore' type='checkbox' id='disable' value='1'");
|
||||
if($device['ignore']) { echo("checked=checked"); }
|
||||
if ($device['ignore']) { echo("checked=checked"); }
|
||||
echo("/></td>
|
||||
</tr>");
|
||||
|
||||
@@ -120,5 +126,4 @@ echo('
|
||||
</td>
|
||||
<td width="50"></td><td></td></tr></table>');
|
||||
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -1,7 +1,9 @@
|
||||
<?php
|
||||
|
||||
if($_POST['editing']) {
|
||||
if($_SESSION['userlevel'] > "7") {
|
||||
if ($_POST['editing'])
|
||||
{
|
||||
if ($_SESSION['userlevel'] > "7")
|
||||
{
|
||||
include("includes/device-ipmi-edit.inc.php");
|
||||
}
|
||||
}
|
||||
@@ -9,7 +11,8 @@ if($_POST['editing']) {
|
||||
$device = mysql_fetch_assoc(mysql_query("SELECT * FROM `devices` WHERE `device_id` = '".$device['device_id']."'"));
|
||||
$descr = $device['purpose'];
|
||||
|
||||
if($updated && $update_message) {
|
||||
if ($updated && $update_message)
|
||||
{
|
||||
print_message($update_message);
|
||||
} elseif ($update_message) {
|
||||
print_error($update_message);
|
||||
|
||||
@@ -2,14 +2,16 @@
|
||||
|
||||
echo('<div style="padding: 10px;">');
|
||||
|
||||
if($_POST['ignoreport']) {
|
||||
if($_SESSION['userlevel'] == '10') {
|
||||
if ($_POST['ignoreport'])
|
||||
{
|
||||
if ($_SESSION['userlevel'] == '10')
|
||||
{
|
||||
include("includes/port-edit.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if($updated && $update_message) {
|
||||
if ($updated && $update_message)
|
||||
{
|
||||
print_message($update_message);
|
||||
} elseif ($update_message) {
|
||||
print_error($update_message);
|
||||
@@ -23,13 +25,14 @@ echo("<div style='float: left;'>
|
||||
<tr><th>Port</th><th>ifDescr</th><th>ifAdminStatus</th><th>ifOperStatus</th><th>Ignore</th></tr>");
|
||||
|
||||
$query = mysql_query("SELECT * FROM `ports` WHERE device_id='".$device['device_id']."' ORDER BY `ifIndex` ");
|
||||
while($device = mysql_fetch_array($query)) {
|
||||
while ($device = mysql_fetch_array($query))
|
||||
{
|
||||
echo("<tr>");
|
||||
echo("<td align=right>". $device['ifIndex']."</td>");
|
||||
echo("<td align=left>".$device['ifDescr'] . "</td>");
|
||||
echo("<td align=right>". $device['ifAdminStatus']."</td>");
|
||||
|
||||
# Mark interfaces which are OperDown (but not AdminDown) yet not ignored, or up - yet ignored - as to draw the attention
|
||||
# Mark interfaces which are OperDown (but not AdminDown) yet not ignored, or up - yet ignored - as to draw the attention
|
||||
# to a possible problem.
|
||||
#
|
||||
$outofsync = ($device['ignore'] == ($device['ifOperStatus'] == 'down' && $device['ifAdminStatus'] != 'down' ? 1 : 0)) ? "" : "class=red";
|
||||
@@ -48,4 +51,4 @@ echo('</table>');
|
||||
echo('</form>');
|
||||
echo('</div>');
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -2,49 +2,53 @@
|
||||
|
||||
echo('<div style="padding: 10px;">');
|
||||
|
||||
if($_POST['addsrv']) {
|
||||
if($_SESSION['userlevel'] == '10') {
|
||||
if ($_POST['addsrv']) {
|
||||
if ($_SESSION['userlevel'] == '10') {
|
||||
include("includes/service-add.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['delsrv']) {
|
||||
if($_SESSION['userlevel'] == '10') {
|
||||
if ($_POST['delsrv']) {
|
||||
if ($_SESSION['userlevel'] == '10') {
|
||||
include("includes/service-delete.inc.php");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ($handle = opendir($config['install_dir'] . "/includes/services/")) {
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if ($file != "." && $file != ".." && !strstr($file, ".")) {
|
||||
$servicesform .= "<option value='$file'>$file</option>";
|
||||
}
|
||||
if ($handle = opendir($config['install_dir'] . "/includes/services/"))
|
||||
{
|
||||
while (false !== ($file = readdir($handle)))
|
||||
{
|
||||
if ($file != "." && $file != ".." && !strstr($file, "."))
|
||||
{
|
||||
$servicesform .= "<option value='$file'>$file</option>";
|
||||
}
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
closedir($handle);
|
||||
}
|
||||
|
||||
$query = mysql_query("SELECT * FROM `devices` ORDER BY `hostname`");
|
||||
while($device = mysql_fetch_array($query)) {
|
||||
while ($device = mysql_fetch_array($query))
|
||||
{
|
||||
$devicesform .= "<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>";
|
||||
}
|
||||
|
||||
if($updated) { print_message("Device Settings Saved"); }
|
||||
|
||||
|
||||
if(mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0') {
|
||||
$i = "1";
|
||||
$service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type");
|
||||
while($service = mysql_fetch_array($service_query)) {
|
||||
$existform .= "<option value='" . $service['service_id'] . "'>" . $service['service_type'] . "</option>";
|
||||
|
||||
}
|
||||
if ($updated) { print_message("Device Settings Saved"); }
|
||||
|
||||
if (mysql_result(mysql_query("SELECT COUNT(*) from `services` WHERE `device_id` = '".$device['device_id']."'"), 0) > '0')
|
||||
{
|
||||
$i = "1";
|
||||
$service_query = mysql_query("select * from services WHERE device_id = '".$device['device_id']."' ORDER BY service_type");
|
||||
while ($service = mysql_fetch_array($service_query))
|
||||
{
|
||||
$existform .= "<option value='" . $service['service_id'] . "'>" . $service['service_type'] . "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
if($existform){
|
||||
echo('<div style="float: left;">');
|
||||
echo("
|
||||
if($existform
|
||||
{
|
||||
echo('<div style="float: left;">');
|
||||
echo("
|
||||
|
||||
<h1>Remove Service</h1>
|
||||
|
||||
@@ -64,12 +68,10 @@ echo("
|
||||
</tr>
|
||||
</table>
|
||||
<input type='submit' name='Submit' value='Delete' />
|
||||
<label><br />
|
||||
</label>
|
||||
</form>");
|
||||
|
||||
|
||||
echo('</div>');
|
||||
echo('</div>');
|
||||
}
|
||||
|
||||
echo('<div style="width: 45%; float: right;">');
|
||||
@@ -95,10 +97,7 @@ echo("
|
||||
<input type='submit' name='Submit' value='Add' />
|
||||
<label><br />
|
||||
</label>
|
||||
</form>");
|
||||
</form>
|
||||
</div>");
|
||||
|
||||
echo('</div>');
|
||||
|
||||
echo('</div>');
|
||||
|
||||
?>
|
||||
?>
|
||||
Reference in New Issue
Block a user