mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	restructure/reindent/htmlfix html pages, remove dead code
git-svn-id: http://www.observium.org/svn/observer/trunk@1897 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
		@@ -1,26 +1,27 @@
 | 
			
		||||
<?php print_optionbar_start(28); ?>
 | 
			
		||||
 | 
			
		||||
<table cellpadding=0 cellspacing=0 class=devicetable width=100%>
 | 
			
		||||
<table cellpadding="0" cellspacing="0" class="devicetable" width="100%">
 | 
			
		||||
  <tr>
 | 
			
		||||
  <form method='post' action=''>
 | 
			
		||||
    <td width='200' style="padding: 1px;">
 | 
			
		||||
      <select name='device_id' id='device_id'>
 | 
			
		||||
      <option value=''>All Devices</option>
 | 
			
		||||
      <?php
 | 
			
		||||
        $query = mysql_query("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
 | 
			
		||||
        while($data = mysql_fetch_array($query)) {
 | 
			
		||||
          echo("<option value='".$data['device_id']."'");
 | 
			
		||||
          if($data['device_id'] == $_POST['device_id']) { echo("selected"); }
 | 
			
		||||
          echo(">".$data['hostname']."</option>");
 | 
			
		||||
        }
 | 
			
		||||
      ?>
 | 
			
		||||
  <form method="post" action="">
 | 
			
		||||
    <td width="200" style="padding: 1px;">
 | 
			
		||||
      <select name="device_id" id="device_id">
 | 
			
		||||
      <option value="">All Devices</option>
 | 
			
		||||
<?php
 | 
			
		||||
$query = mysql_query("SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname`");
 | 
			
		||||
while ($data = mysql_fetch_array($query))
 | 
			
		||||
{
 | 
			
		||||
  echo('<option value="'.$data['device_id'].'"');
 | 
			
		||||
  if ($data['device_id'] == $_POST['device_id']) { echo("selected"); }
 | 
			
		||||
  echo(">".$data['hostname']."</option>");
 | 
			
		||||
}
 | 
			
		||||
?>
 | 
			
		||||
      </select>
 | 
			
		||||
    </td>
 | 
			
		||||
    <td width='200' style="padding: 1px;">
 | 
			
		||||
      <select name='interface' id='interface'>
 | 
			
		||||
      <option value=''>All Interfaces</option>
 | 
			
		||||
      <option value='Loopback%' <?php if($_POST['interface'] == "Loopback%"){ echo("selected");} ?> >Loopbacks</option>
 | 
			
		||||
      <option value='Vlan%' <?php if($_POST['interface'] == "Vlan%"){ echo("selected");} ?> >VLANs</option>
 | 
			
		||||
    <td width="200" style="padding: 1px;">
 | 
			
		||||
      <select name="interface" id="interface">
 | 
			
		||||
      <option value="">All Interfaces</option>
 | 
			
		||||
      <option value="Loopback%" <?php if ($_POST['interface'] == "Loopback%"){ echo("selected"); } ?> >Loopbacks</option>
 | 
			
		||||
      <option value="Vlan%" <?php if ($_POST['interface'] == "Vlan%"){ echo("selected"); } ?> >VLANs</option>
 | 
			
		||||
      </select>
 | 
			
		||||
    </td>
 | 
			
		||||
    <td>
 | 
			
		||||
@@ -37,60 +38,59 @@
 | 
			
		||||
 | 
			
		||||
print_optionbar_end();
 | 
			
		||||
 | 
			
		||||
echo("<table width=100% cellspacing=0 cellpadding=2>");
 | 
			
		||||
echo('<table width="100%" cellspacing="0" cellpadding="2">');
 | 
			
		||||
 | 
			
		||||
if($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
 | 
			
		||||
if($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".$_POST['interface']."'"; }
 | 
			
		||||
# FIXME SQL INJECTION!!
 | 
			
		||||
if ($_POST['device_id']) { $where .= " AND I.device_id = '".$_POST['device_id']."'"; }
 | 
			
		||||
if ($_POST['interface']) { $where .= " AND I.ifDescr LIKE '".$_POST['interface']."'"; }
 | 
			
		||||
 | 
			
		||||
$sql = "SELECT * FROM `ipv4_addresses` AS A, `ports` AS I, `devices` AS D, `ipv4_networks` AS N WHERE I.interface_id = A.interface_id AND I.device_id = D.device_id AND N.ipv4_network_id = A.ipv4_network_id $where ORDER BY A.ipv4_address";
 | 
			
		||||
 | 
			
		||||
$query = mysql_query($sql);
 | 
			
		||||
 | 
			
		||||
echo("<tr class=tablehead><th>Device</a></th><th>Interface</th><th>Address</th><th>Description</th></tr>");
 | 
			
		||||
echo('<tr class="tablehead"><th>Device</a></th><th>Interface</th><th>Address</th><th>Description</th></tr>');
 | 
			
		||||
 | 
			
		||||
$row = 1;
 | 
			
		||||
 | 
			
		||||
while($interface = mysql_fetch_array($query)) {
 | 
			
		||||
 | 
			
		||||
  if($_POST['address']) { 
 | 
			
		||||
while ($interface = mysql_fetch_array($query))
 | 
			
		||||
{
 | 
			
		||||
  if ($_POST['address'])
 | 
			
		||||
  {
 | 
			
		||||
    list($addy, $mask) = explode("/", $_POST['address']);
 | 
			
		||||
    if(!$mask) { $mask = "32"; }
 | 
			
		||||
    if (!match_network($addy . "/" . $mask, $interface['ipv4_address'] )) { $ignore = 1; } 
 | 
			
		||||
    if (!$mask) { $mask = "32"; }
 | 
			
		||||
    if (!match_network($addy . "/" . $mask, $interface['ipv4_address'] )) { $ignore = 1; }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 if(!$ignore) {
 | 
			
		||||
 | 
			
		||||
  if(is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
 | 
			
		||||
 | 
			
		||||
  $speed = humanspeed($interface['ifSpeed']);
 | 
			
		||||
  $type = humanmedia($interface['ifType']);
 | 
			
		||||
 | 
			
		||||
  list($prefix, $length) = explode("/", $interface['ipv4_network']);
 | 
			
		||||
 | 
			
		||||
    if($interface['in_errors'] > 0 || $interface['out_errors'] > 0) {
 | 
			
		||||
    $error_img = generate_port_link($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
 | 
			
		||||
  } else { $error_img = ""; }
 | 
			
		||||
 | 
			
		||||
  if( port_permitted($interface['interface_id']) )
 | 
			
		||||
  if (!$ignore)
 | 
			
		||||
  {
 | 
			
		||||
    echo('<tr bgcolor="' . $row_colour . '">
 | 
			
		||||
    if (is_integer($row/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
 | 
			
		||||
 | 
			
		||||
    $speed = humanspeed($interface['ifSpeed']);
 | 
			
		||||
    $type = humanmedia($interface['ifType']);
 | 
			
		||||
 | 
			
		||||
    list($prefix, $length) = explode("/", $interface['ipv4_network']);
 | 
			
		||||
 | 
			
		||||
    if ($interface['in_errors'] > 0 || $interface['out_errors'] > 0)
 | 
			
		||||
    {
 | 
			
		||||
      $error_img = generate_port_link($interface,"<img src='images/16/chart_curve_error.png' alt='Interface Errors' border=0>",errors);
 | 
			
		||||
    } else { $error_img = ""; }
 | 
			
		||||
 | 
			
		||||
    if (port_permitted($interface['interface_id']))
 | 
			
		||||
    {
 | 
			
		||||
      echo('<tr bgcolor="' . $row_colour . '">
 | 
			
		||||
          <td class="list-bold">' . generate_device_link($interface) . '</td>
 | 
			
		||||
          <td class="list-bold">' . generate_port_link($interface, makeshortif(fixifname($interface['ifDescr']))) . ' ' . $error_img . '</td>
 | 
			
		||||
          <td>' . $interface['ipv4_address'] . '/'.$length.'</td>
 | 
			
		||||
          <td>' . $interface['ifAlias'] . "</td>
 | 
			
		||||
        </tr>\n");
 | 
			
		||||
 | 
			
		||||
    $row++;
 | 
			
		||||
 | 
			
		||||
      $row++;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
unset($ignore);
 | 
			
		||||
 | 
			
		||||
  unset($ignore);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
echo("</table>");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
?>
 | 
			
		||||
?>
 | 
			
		||||
		Reference in New Issue
	
	Block a user