mirror of
				https://github.com/librenms/librenms.git
				synced 2024-10-07 16:52:45 +00:00 
			
		
		
		
	some formatting cleanups, introduce some more FIXMEs to look at, plus replace mysql_fetch_array by mysql_fetch_assoc, for great justice
git-svn-id: http://www.observium.org/svn/observer/trunk@2029 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
		@@ -8,7 +8,7 @@ $nodes = array();
 | 
			
		||||
 | 
			
		||||
$sql = mysql_query("SELECT * FROM `devices` AS D, `devices_attribs` AS A WHERE D.status = '1' AND A.device_id = D.device_id AND A.attrib_type = 'uptime' AND A.attrib_value > '0' AND A.attrib_value < '86400'");
 | 
			
		||||
 | 
			
		||||
while ($device = mysql_fetch_array($sql)){
 | 
			
		||||
while ($device = mysql_fetch_assoc($sql)){
 | 
			
		||||
  unset($already);
 | 
			
		||||
  $i = 0;
 | 
			
		||||
  while ($i <= count($nodes)) {
 | 
			
		||||
@@ -23,7 +23,7 @@ while ($device = mysql_fetch_array($sql)){
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
$sql = mysql_query("SELECT * FROM `devices` WHERE `status` = '0' AND `ignore` = '0'");
 | 
			
		||||
while ($device = mysql_fetch_array($sql)){
 | 
			
		||||
while ($device = mysql_fetch_assoc($sql)){
 | 
			
		||||
   if (device_permitted($device['device_id'])) {
 | 
			
		||||
      echo("<div style='text-align: center; margin: 2px; border: solid 2px #d0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffbbbb;'>
 | 
			
		||||
       <strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
 | 
			
		||||
@@ -36,7 +36,7 @@ while ($device = mysql_fetch_array($sql)){
 | 
			
		||||
if ($config['warn']['ifdown']) {
 | 
			
		||||
 | 
			
		||||
$sql = mysql_query("SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id AND ifOperStatus = 'down' AND ifAdminStatus = 'up' AND D.ignore = '0' AND I.ignore = '0'");
 | 
			
		||||
while ($interface = mysql_fetch_array($sql)){
 | 
			
		||||
while ($interface = mysql_fetch_assoc($sql)){
 | 
			
		||||
   if (port_permitted($interface['interface_id'])) {
 | 
			
		||||
      echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
 | 
			
		||||
       <strong>".generate_device_link($interface, shorthost($interface['hostname']))."</strong><br />
 | 
			
		||||
@@ -50,7 +50,7 @@ while ($interface = mysql_fetch_array($sql)){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$sql = mysql_query("SELECT * FROM `services` AS S, `devices` AS D WHERE S.device_id = D.device_id AND service_status = 'down' AND D.ignore = '0' AND S.service_ignore = '0'");
 | 
			
		||||
while ($service = mysql_fetch_array($sql)){
 | 
			
		||||
while ($service = mysql_fetch_assoc($sql)){
 | 
			
		||||
   if (device_permitted($service['device_id'])) {
 | 
			
		||||
      echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
 | 
			
		||||
      <strong>".generate_device_link($service, shorthost($service['hostname']))."</strong><br />
 | 
			
		||||
@@ -62,7 +62,7 @@ while ($service = mysql_fetch_array($sql)){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$sql = mysql_query("SELECT * FROM `devices` AS D, bgpPeers AS B WHERE bgpPeerAdminStatus = 'start' AND bgpPeerState != 'established' AND B.device_id = D.device_id");
 | 
			
		||||
while ($peer = mysql_fetch_array($sql)){
 | 
			
		||||
while ($peer = mysql_fetch_assoc($sql)){
 | 
			
		||||
   if (device_permitted($peer['device_id'])) {
 | 
			
		||||
      echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ffddaa;'>
 | 
			
		||||
      <strong>".generate_device_link($peer, shorthost($peer['hostname']))."</strong><br />
 | 
			
		||||
@@ -74,7 +74,7 @@ while ($peer = mysql_fetch_array($sql)){
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
$sql = mysql_query("SELECT * FROM devices_attribs AS A, `devices` AS D WHERE A.attrib_value < '84600' AND A.attrib_type = 'uptime' AND A.device_id = D.device_id AND ignore = '0' AND disabled = '0'");
 | 
			
		||||
while ($device = mysql_fetch_array($sql)){
 | 
			
		||||
while ($device = mysql_fetch_assoc($sql)){
 | 
			
		||||
   if (device_permitted($device['device_id']) && $device['attrib_value'] < "84600" && $device['attrib_type'] == "uptime") {
 | 
			
		||||
      echo("<div style='text-align: center; margin: 2px; border: solid 2px #D0D0D0; float: left; margin-right: 2px; padding: 3px; width: 118px; height: 85px; background: #ddffdd;'>
 | 
			
		||||
      <strong>".generate_device_link($device, shorthost($device['hostname']))."</strong><br />
 | 
			
		||||
@@ -96,7 +96,7 @@ echo("
 | 
			
		||||
$sql = "SELECT *, DATE_FORMAT(timestamp, '%D %b %T') AS date from syslog,devices WHERE syslog.device_id = devices.device_id ORDER BY seq DESC LIMIT 20";
 | 
			
		||||
$query = mysql_query($sql);
 | 
			
		||||
echo("<table cellspacing=0 cellpadding=2 width=100%>");
 | 
			
		||||
while ($entry = mysql_fetch_array($query)) { include("includes/print-syslog.inc.php"); }
 | 
			
		||||
while ($entry = mysql_fetch_assoc($query)) { include("includes/print-syslog.inc.php"); }
 | 
			
		||||
echo("</table>");
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -114,7 +114,7 @@ if ($_SESSION['userlevel'] >= '5')
 | 
			
		||||
  $sql  = "select * from ports as I, devices as D WHERE `ifAlias` like 'Transit: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while ($interface = mysql_fetch_array($query)) {
 | 
			
		||||
  while ($interface = mysql_fetch_assoc($query)) {
 | 
			
		||||
    $ports['transit'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
@@ -122,7 +122,7 @@ if ($_SESSION['userlevel'] >= '5')
 | 
			
		||||
  $sql  = "select * from ports as I, devices as D WHERE `ifAlias` like 'Peering: %' AND I.device_id = D.device_id ORDER BY I.ifAlias";
 | 
			
		||||
  $query = mysql_query($sql);
 | 
			
		||||
  unset ($seperator);
 | 
			
		||||
  while ($interface = mysql_fetch_array($query)) {
 | 
			
		||||
  while ($interface = mysql_fetch_assoc($query)) {
 | 
			
		||||
    $ports['peering'] .= $seperator . $interface['interface_id'];
 | 
			
		||||
    $seperator = ",";
 | 
			
		||||
  }
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user