syntaxer run

git-svn-id: http://www.observium.org/svn/observer/trunk@2642 61d68cd4-352d-0410-923a-c4978735b2b8
This commit is contained in:
Tom Laermans
2011-10-04 09:10:21 +00:00
parent 9e12148dd3
commit 2dc8b807e9
46 changed files with 94 additions and 95 deletions
+2 -2
View File
@@ -14,7 +14,7 @@ function generate_url($vars, $new_vars = array())
$url = $vars['page']."/";
unset($vars['page']);
foreach($vars as $var => $value)
foreach ($vars as $var => $value)
{
if ($value != "" && strstr($var, "opt") === FALSE)
{
@@ -465,7 +465,7 @@ function foldersize($path)
$files = scandir($path);
$total_files = 0;
foreach($files as $t)
foreach ($files as $t)
{
if (is_dir(rtrim($path, '/') . '/' . $t))
{
@@ -1,21 +1,21 @@
<?php
$nototal = 1;
$nototal = 1;
$ds_in = "msg_recv";
$ds_out = "msg_sent";
$ds_in = "msg_recv";
$ds_out = "msg_sent";
$graph_titel .= "::messages";
$unit_text = "Messages/sec";
$graph_titel .= "::messages";
$unit_text = "Messages/sec";
$colour_line_in = "008800FF";
$colour_line_out = "000088FF";
$colour_area_in = "CEFFCE66";
$colour_area_out = "CECEFF66";
$colour_area_in_max = "CC88CC";
$colour_area_out_max = "FFEFAA";
$colour_line_in = "008800FF";
$colour_line_out = "000088FF";
$colour_area_in = "CEFFCE66";
$colour_area_out = "CECEFF66";
$colour_area_in_max = "CC88CC";
$colour_area_out_max = "FFEFAA";
$mailscanner_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-mailscannerV2-" . $app['app_id'] . ".rrd";
$mailscanner_rrd = $config['rrd_dir'] . "/" . $device['hostname'] . "/app-mailscannerV2-" . $app['app_id'] . ".rrd";
if (is_file($mailscanner_rrd))
{
+1 -1
View File
@@ -2,7 +2,7 @@
## Generate a list of ports and then call the multi_bits grapher to generate from the list
$i=0;
foreach(dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = ? AND D.device_id = I.device_id", array($id)) as $port)
foreach (dbFetchRows("SELECT * FROM `ports` AS I, `devices` AS D WHERE `port_descr_type` = 'cust' AND `port_descr_descr` = ? AND D.device_id = I.device_id", array($id)) as $port)
{
if (is_file($config['rrd_dir'] . "/" . $port['hostname'] . "/port-" . safename($port['ifIndex'] . ".rrd")))
{
+1 -1
View File
@@ -9,7 +9,7 @@ $rrd_options .= " -u 100 -l 0 -E -b 1024 ";
$iter = "1"; $i=1;
$rrd_options .= " COMMENT:' Min Cur Max\\n'";
foreach(dbFetchRows("SELECT * FROM `mempools` where `device_id` = ?", array($id)) as $mempool)
foreach (dbFetchRows("SELECT * FROM `mempools` where `device_id` = ?", array($id)) as $mempool)
{
# FIXME generic colour function
if ($iter=="1") { $colour="CC0000"; } elseif ($iter=="2") { $colour="008C00"; } elseif ($iter=="3") { $colour="4096EE"; }
@@ -17,7 +17,7 @@ $stats = array('icmpInMsgs' => '00cc00',
$i=0;
foreach($stats as $stat => $colour)
foreach ($stats as $stat => $colour)
{
$i++;
$rrd_list[$i]['filename'] = $rrd_filename;
@@ -17,7 +17,7 @@ $stats = array('icmpInSrcQuenchs' => array(),
$i=0;
foreach($stats as $stat => $array)
foreach ($stats as $stat => $array)
{
$i++;
$rrd_list[$i]['filename'] = $rrd_filename;
@@ -14,7 +14,7 @@ $stats = array('ipForwDatagrams' => array(),
'ipOutNoRoutes' => array());
$i=0;
foreach($stats as $stat => $array)
foreach ($stats as $stat => $array)
{
$i++;
$rrd_list[$i]['filename'] = $rrd_filename;
@@ -14,7 +14,7 @@ $stats = array('snmpInTraps',
'snmpOutSetRequests');
$i=0;
foreach($stats as $stat)
foreach ($stats as $stat)
{
$i++;
$rrd_list[$i]['filename'] = $rrd_filename;
@@ -9,7 +9,7 @@ $stats = array('snmpInPkts',
'snmpOutPkts');
$i=0;
foreach($stats as $stat)
foreach ($stats as $stat)
{
$i++;
$rrd_list[$i]['filename'] = $rrd_filename;
@@ -8,7 +8,7 @@ $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-tcp.
$stats = array('tcpInSegs','tcpOutSegs','tcpActiveOpens','tcpPassiveOpens','tcpAttemptFails','tcpEstabResets','tcpRetransSegs');
$i=0;
foreach($stats as $stat)
foreach ($stats as $stat)
{
$i++;
$rrd_list[$i]['filename'] = $rrd_filename;
@@ -8,7 +8,7 @@ $rrd_filename = $config['rrd_dir'] . "/" . $device['hostname'] . "/netstats-udp.
$stats = array('udpInDatagrams','udpOutDatagrams','udpInErrors','udpNoPorts');
$i=0;
foreach($stats as $stat)
foreach ($stats as $stat)
{
$i++;
$rrd_list[$i]['filename'] = $rrd_filename;
@@ -31,7 +31,7 @@ if($width > "500")
$rrd_options .= " COMMENT:'".substr(str_pad($unit_text, $descr_len+5),0,$descr_len+5)." RTT Loss SDev RTT\:SDev\l'";
}
foreach($smokeping_files[$direction][$device['hostname']] as $source => $filename)
foreach ($smokeping_files[$direction][$device['hostname']] as $source => $filename)
{
if (!isset($config['graph_colours'][$colourset][$iter])) { $iter = 0; }
@@ -48,7 +48,7 @@ foreach($smokeping_files[$direction][$device['hostname']] as $source => $filenam
# $rrd_options .= " CDEF:dm$i=median$i,0,".$max->{$start}.",LIMIT";
/// start emulate Smokeping::calc_stddev
foreach(range(1, $pings) as $p)
foreach (range(1, $pings) as $p)
{
$rrd_options .= " DEF:pin".$i."p".$p."=".$filename.":ping".$p.":AVERAGE";
$rrd_options .= " CDEF:p".$i."p".$p."=pin".$i."p".$p.",UN,0,pin".$i."p".$p.",IF";
@@ -56,7 +56,7 @@ foreach($smokeping_files[$direction][$device['hostname']] as $source => $filenam
unset($pings_options, $m_options, $sdev_options);
foreach(range(2, $pings) as $p)
foreach (range(2, $pings) as $p)
{
$pings_options .= ",p".$i."p".$p.",UN,+";
$m_options .= ",p".$i."p".$p.",+";
+1 -1
View File
@@ -3,7 +3,7 @@
## Generate a list of ports and then call the multi_bits grapher to generate from the list
$i=0;
foreach(dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ? AND `pagpGroupIfIndex` = ?", array($port['device_id'], $port['ifIndex'])) as $int)
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ? AND `pagpGroupIfIndex` = ?", array($port['device_id'], $port['ifIndex'])) as $int)
{
if (is_file($config['rrd_dir'] . "/" . $hostname . "/port-" . safename($int['ifIndex'] . ".rrd")))
{
+6 -6
View File
@@ -125,7 +125,7 @@ echo("</td>");
echo("<td width=375 valign=top class=interface-desc>");
if (strpos($port['label'], "oopback") === false && !$graph_type)
{
foreach(dbFetchRows("SELECT * FROM `links` AS L, `ports` AS I, `devices` AS D WHERE L.local_interface_id = ? AND L.remote_interface_id = I.interface_id AND I.device_id = D.device_id", array($if_id)) as $link)
foreach (dbFetchRows("SELECT * FROM `links` AS L, `ports` AS I, `devices` AS D WHERE L.local_interface_id = ? AND L.remote_interface_id = I.interface_id AND I.device_id = D.device_id", array($if_id)) as $link)
{
# echo("<img src='images/16/connect.png' align=absmiddle alt='Directly Connected' /> " . generate_port_link($link, makeshortif($link['label'])) . " on " . generate_device_link($link, shorthost($link['hostname'])) . "</a><br />");
# $br = "<br />";
@@ -145,7 +145,7 @@ if (strpos($port['label'], "oopback") === false && !$graph_type)
AND A.ipv4_network_id = ? AND D.device_id = I.device_id
AND D.device_id != ?";
$array = array($net['ipv4_network_id'], $device['device_id']);
foreach(dbFetchRows($sql, $array) AS $new)
foreach (dbFetchRows($sql, $array) AS $new)
{
echo($new['ipv4_network_id']);
$this_ifid = $new['interface_id'];
@@ -166,7 +166,7 @@ if (strpos($port['label'], "oopback") === false && !$graph_type)
AND D.device_id != ? AND A.ipv6_origin != 'linklayer' AND A.ipv6_origin != 'wellknown'";
$array = array($net['ipv6_network_id'], $device['device_id']);
foreach(dbFetchRows($sql, $array) AS $new)
foreach (dbFetchRows($sql, $array) AS $new)
{
echo($new['ipv6_network_id']);
$this_ifid = $new['interface_id'];
@@ -213,7 +213,7 @@ if ($port_details)
$br = "<br />";
}
foreach(dbFetchRows("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = ? and `device_id` = ?", array($port['ifIndex'], $device['device_id'])) as $member)
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `pagpGroupIfIndex` = ? and `device_id` = ?", array($port['ifIndex'], $device['device_id'])) as $member)
{
echo("$br<img src='images/16/brick_link.png' align=absmiddle> <strong>" . generate_port_link($member) . " (PAgP)</strong>");
$br = "<br />";
@@ -226,7 +226,7 @@ if ($port_details)
$br = "<br />";
}
foreach(dbFetchRows("SELECT * FROM `ports_stack` WHERE `interface_id_low` = ? and `device_id` = ?", array($port['ifIndex'], $device['device_id'])) as $higher_if)
foreach (dbFetchRows("SELECT * FROM `ports_stack` WHERE `interface_id_low` = ? and `device_id` = ?", array($port['ifIndex'], $device['device_id'])) as $higher_if)
{
if ($higher_if['interface_id_high'])
{
@@ -236,7 +236,7 @@ if ($port_details)
}
}
foreach(dbFetchRows("SELECT * FROM `ports_stack` WHERE `interface_id_high` = ? and `device_id` = ?", array($port['ifIndex'], $device['device_id'])) as $lower_if)
foreach (dbFetchRows("SELECT * FROM `ports_stack` WHERE `interface_id_high` = ? and `device_id` = ?", array($port['ifIndex'], $device['device_id'])) as $lower_if)
{
if ($lower_if['interface_id_low'])
{
+2 -2
View File
@@ -9,13 +9,13 @@ foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $device)
$device['real_location'] = $device['location'];
$device['location'] = get_dev_attrib($device,'override_sysLocation_string');
}
$devices['count']++;
$cache['devices']['hostname'][$device['hostname']] = $device['device_id'];
$cache['devices']['id'][$device['device_id']] = $device;
}
if($_SESSION['userlevel'] >= 5)
{
$devices['up'] = dbFetchCell("SELECT COUNT(*) FROM devices WHERE status = '1' AND `ignore` = '0'");
+2 -2
View File
@@ -85,12 +85,12 @@ foreach ($segments as $pos => $segment)
}
}
foreach($_GET as $name => $value)
foreach ($_GET as $name => $value)
{
$vars[$name] = $value;
}
foreach($_POST as $name => $value)
foreach ($_POST as $name => $value)
{
$vars[$name] = $value;
}
+1 -1
View File
@@ -26,7 +26,7 @@ else
closedir($handle);
}
foreach(dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $device)
foreach (dbFetchRows("SELECT * FROM `devices` ORDER BY `hostname`") as $device)
{
$devicesform .= "<option value='" . $device['device_id'] . "'>" . $device['hostname'] . "</option>";
}
+2 -2
View File
@@ -3,8 +3,8 @@
global $config;
$graphs = array('mailscanner_sent' => 'Mailscanner - Sent / Received',
'mailscanner_spam' => 'Mailscanner - Spam / Virus',
'mailscanner_reject' => 'Mailscanner - Rejected / Waiting / Relayed');
'mailscanner_spam' => 'Mailscanner - Spam / Virus',
'mailscanner_reject' => 'Mailscanner - Rejected / Waiting / Relayed');
foreach ($graphs as $key => $text)
{
+2 -2
View File
@@ -35,7 +35,7 @@ echo('<div style="padding:4px 0px 4px 8px;" class=graphhead>Poller Modules</div>
echo('<table width="100%" cellpadding=5>');
echo('<tr><th>Module</th><th>Global</th><th>Device</th></tr>');
foreach($config['poller_modules'] as $module => $module_status)
foreach ($config['poller_modules'] as $module => $module_status)
{
if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
@@ -73,7 +73,7 @@ $i=0;
echo('<div style="padding:4px 0px 4px 8px;" class=graphhead>Discovery Modules</div>');
echo('<table width="100%" cellpadding=5>');
echo('<tr><th>Module</th><th>Global</th><th>Device</th></tr>');
foreach($config['discovery_modules'] as $module => $module_status)
foreach ($config['discovery_modules'] as $module => $module_status)
{
if (!is_integer($i/2)) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
echo('<tr bgcolor="'.$bg_colour.'"><td><b>'.$module.'</b></td><td>');
+1 -1
View File
@@ -13,7 +13,7 @@ if (count($mempools))
echo("<table width=100% cellspacing=0 cellpadding=5>");
$mempool_rows = '0';
foreach($mempools as $mempool)
foreach ($mempools as $mempool)
{
if (is_integer($mempool_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
$percent= round($mempool['mempool_perc'],0);
@@ -13,7 +13,7 @@ if (count($processors))
echo("<img align='absmiddle' src='".$config['base_url']."/images/icons/processor.png'> Processors</a></p>");
echo("<table width=100% cellspacing=0 cellpadding=5>");
foreach($processors as $proc)
foreach ($processors as $proc)
{
if (is_integer($processor_rows/2)) { $row_colour = $list_colour_a; } else { $row_colour = $list_colour_b; }
## REPLACE THIS SHITTY CODE. IT IS ALSO ELSEWHERE.
+1 -1
View File
@@ -14,7 +14,7 @@ print_optionbar_start();
echo("Polling Interval: ");
foreach(array(0.25, 1, 2, 5, 15, 60) as $interval)
foreach (array(0.25, 1, 2, 5, 15, 60) as $interval)
{
echo($thinger);
if ($vars['interval'] == $interval) { echo("<span class='pagemenu-selected'>"); }
+1 -1
View File
@@ -100,7 +100,7 @@ if ($vars['view'] == 'minigraphs')
$ports = dbFetchRows("SELECT * FROM `ports` WHERE `device_id` = ? AND `deleted` = '0' ORDER BY `ifIndex` ASC", array($device['device_id']));
### As we've dragged the whole database, lets pre-populate our caches :)
### FIXME - we should probably split the fetching of link/stack/etc into functions and cache them here too to cut down on single row queries.
foreach($ports as $port)
foreach ($ports as $port)
{
$port_cache[$port['interface_id']] = $port;
$port_index_cache[$port['device_id']][$port['ifIndex']] = $port;
+1 -1
View File
@@ -10,7 +10,7 @@ echo('<tr><th>Local Port</th>
<th>Protocol</th>
</tr>');
foreach(dbFetchRows("SELECT * FROM links AS L, ports AS I WHERE I.device_id = ? AND I.interface_id = L.local_interface_id", array($device['device_id'])) as $neighbour)
foreach (dbFetchRows("SELECT * FROM links AS L, ports AS I WHERE I.device_id = ? AND I.interface_id = L.local_interface_id", array($device['device_id'])) as $neighbour)
{
if ($bg_colour == $list_colour_b) { $bg_colour = $list_colour_a; } else { $bg_colour = $list_colour_b; }
+5 -5
View File
@@ -34,7 +34,7 @@ if($vars['searchbar'] != "hide")
<option value=''>All OSes</option>
<?php
foreach(dbFetch('SELECT `os` FROM `devices` AS D WHERE 1 GROUP BY `os` ORDER BY `os`') as $data)
foreach (dbFetch('SELECT `os` FROM `devices` AS D WHERE 1 GROUP BY `os` ORDER BY `os`') as $data)
{
if ($data['os'])
{
@@ -50,7 +50,7 @@ foreach(dbFetch('SELECT `os` FROM `devices` AS D WHERE 1 GROUP BY `os` ORDER BY
<option value=''>All Versions</option>
<?php
foreach(dbFetch('SELECT `version` FROM `devices` AS D WHERE 1 GROUP BY `version` ORDER BY `version`') as $data)
foreach (dbFetch('SELECT `version` FROM `devices` AS D WHERE 1 GROUP BY `version` ORDER BY `version`') as $data)
{
if ($data['version'])
{
@@ -66,7 +66,7 @@ foreach(dbFetch('SELECT `version` FROM `devices` AS D WHERE 1 GROUP BY `version`
<select name="hardware" id="hardware">
<option value="">All Platforms</option>
<?php
foreach(dbFetch('SELECT `hardware` FROM `devices` AS D WHERE 1 GROUP BY `hardware` ORDER BY `hardware`') as $data)
foreach (dbFetch('SELECT `hardware` FROM `devices` AS D WHERE 1 GROUP BY `hardware` ORDER BY `hardware`') as $data)
{
if ($data['hardware'])
{
@@ -82,7 +82,7 @@ foreach(dbFetch('SELECT `hardware` FROM `devices` AS D WHERE 1 GROUP BY `hardwar
<option value="">All Featuresets</option>
<?php
foreach(dbFetch('SELECT `features` FROM `devices` AS D WHERE 1 GROUP BY `features` ORDER BY `features`') as $data)
foreach (dbFetch('SELECT `features` FROM `devices` AS D WHERE 1 GROUP BY `features` ORDER BY `features`') as $data)
{
if ($data['features'])
{
@@ -116,7 +116,7 @@ foreach (getlocations() as $location) ## FIXME function name sucks maybe get_loc
<option value="">All Device Types</option>
<?php
foreach(dbFetch('SELECT `type` FROM `devices` AS D WHERE 1 GROUP BY `type` ORDER BY `type`') as $data)
foreach (dbFetch('SELECT `type` FROM `devices` AS D WHERE 1 GROUP BY `type` ORDER BY `type`') as $data)
{
if ($data['type'])
{
+1 -1
View File
@@ -176,7 +176,7 @@ if ($_SESSION['userlevel'] != '10') { include("includes/error-no-perm.inc.php");
echo("<form method='post' action=''>
<input type='hidden' value='edituser' name='page'>
<select name='user_id'>");
foreach($user_list as $user_entry)
foreach ($user_list as $user_entry)
{
echo("<option value='" . $user_entry['user_id'] . "'>" . $user_entry['username'] . "</option>");
}
+1 -1
View File
@@ -11,7 +11,7 @@ $dev_list = array('6' => 'Central Fileserver',
'7' => 'NE61 Fileserver',
'34' => 'DE56 Fileserver');
foreach($dev_list as $device_id => $descr)
foreach ($dev_list as $device_id => $descr)
{
echo("<td>");
+1 -1
View File
@@ -239,7 +239,7 @@ if(!isset($vars['ignore'])) { $vars['ignore'] = "0"; }
if(!isset($vars['disabled'])) { $vars['disabled'] = "0"; }
if(!isset($vars['deleted'])) { $vars['deleted'] = "0"; }
foreach($vars as $var => $value)
foreach ($vars as $var => $value)
{
if ($value != "")
{
+1 -1
View File
@@ -151,7 +151,7 @@ else
}
$peer_query = "select * from bgpPeers AS B, devices AS D WHERE B.device_id = D.device_id ".$where." ORDER BY D.hostname, B.bgpPeerRemoteAs, B.bgpPeerIdentifier";
foreach(dbFetchRows($peer_query) as $peer)
foreach (dbFetchRows($peer_query) as $peer)
{
unset ($alert, $bg_image);
+1 -1
View File
@@ -68,7 +68,7 @@ if($_GET['optb'] == "all" ) {
echo("</td><td>");
unset($seperator);
foreach(dbFetchRows("SELECT * FROM `ports` WHERE `ifVrf` = ? AND `device_id` = ?", array($device['vrf_id'], $device['device_id'])) as $port)
foreach (dbFetchRows("SELECT * FROM `ports` WHERE `ifVrf` = ? AND `device_id` = ?", array($device['vrf_id'], $device['device_id'])) as $port)
{
$port = array_merge ($device, $port);
+14 -13
View File
@@ -26,13 +26,14 @@ function shorthost($hostname, $len=12)
return ($shorthost);
}
function isCli() {
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
return true;
} else {
return false;
}
function isCli()
{
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR']))
{
return true;
} else {
return false;
}
}
function print_error($text)
@@ -53,7 +54,6 @@ function print_message($text)
}
}
function delete_port($int_id)
{
global $config;
@@ -62,7 +62,8 @@ function delete_port($int_id)
$interface_tables = array('adjacencies', 'ipaddr', 'ip6adjacencies', 'ip6addr', 'mac_accounting', 'bill_ports', 'pseudowires', 'ports');
foreach($interface_tables as $table) {
foreach ($interface_tables as $table)
{
dbDelete($table, "`interface_id` = ?", array($int_id));
}
@@ -255,7 +256,7 @@ function getifhost($id)
function gethostbyid($id)
{
global $cache;
return $cache['devices']['id'][$id]['hostname'];
}
@@ -299,14 +300,14 @@ function getifdescrbyid($id)
function getidbyname($hostname)
{
global $cache;
return $cache['devices']['hostname'][$hostname];
}
function gethostosbyid($id)
{
global $cache;
return $cache['devices']['id'][$id]['os'];
}
@@ -341,7 +342,7 @@ function set_dev_attrib($device, $attrib_type, $attrib_value)
function get_dev_attribs($device)
{
$attribs = array();
foreach(dbFetchRows("SELECT * FROM devices_attribs WHERE `device_id` = ?", array($device)) as $entry)
foreach (dbFetchRows("SELECT * FROM devices_attribs WHERE `device_id` = ?", array($device)) as $entry)
{
$attribs[$entry['attrib_type']] = $entry['attrib_value'];
}
+2 -2
View File
@@ -23,10 +23,10 @@ if (is_array($cefs))
{
$entity_name = $entity_array[$entity]['entPhysicalName'] ." - ".$entity_array[$entity]['entPhysicalModelName'];
echo("\n$entity $entity_name\n");
foreach($afis as $afi => $paths)
foreach ($afis as $afi => $paths)
{
echo(" |- $afi\n");
foreach($paths as $path => $path_name)
foreach ($paths as $path => $path_name)
{
echo(" | |-".$path.": ".$path_name['cefSwitchingPath']."\n");
+1 -1
View File
@@ -77,7 +77,7 @@ function discover_device($device, $options = NULL)
include("includes/discovery/".$options['m'].".inc.php");
}
} else {
foreach($config['discovery_modules'] as $module => $module_status)
foreach ($config['discovery_modules'] as $module => $module_status)
{
if ($attribs['discover_'.$module] || ( $module_status && !isset($attribs['discover_'.$module])))
{
+1 -1
View File
@@ -11,7 +11,7 @@ if($device['os'] == "vrp")
if (is_array($mempools_array))
{
foreach($mempools_array as $index => $entry)
foreach ($mempools_array as $index => $entry)
{
if ($entry['hwEntityMemSize'] != 0 )
{
+2 -2
View File
@@ -11,9 +11,9 @@ while ($entry = mysql_fetch_assoc($query))
$stack_poll_array = snmpwalk_cache_twopart_oid($device, "ifStackStatus", array());
foreach($stack_poll_array as $interface_id_high => $entry_high)
foreach ($stack_poll_array as $interface_id_high => $entry_high)
{
foreach($entry_high as $interface_id_low => $entry_low)
foreach ($entry_high as $interface_id_low => $entry_low)
{
$ifStackStatus = $entry_low['ifStackStatus'];
if (isset($stack_db_array[$interface_id_high][$interface_id_low]))
+1 -1
View File
@@ -27,7 +27,7 @@ if ($device['os'] == "apc")
$temps['airIRRCUnitStatusReturnAirTempMetric'] = "Return Air";
$temps['airIRRCUnitStatusEnteringFluidTemperatureMetric'] = "Entering Fluid";
$temps['airIRRCUnitStatusLeavingFluidTemperatureMetric'] = "Leaving Fluid";
foreach($temps as $obj => $descr)
foreach ($temps as $obj => $descr)
{
$oids = snmp_get($device, $obj . ".0", "-OsqnU", "PowerNet-MIB");
list($oid,$current) = explode(' ',$oids);
@@ -19,7 +19,7 @@ if ($device['os'] == "cometsystem-p85xx")
if ($oids)
{
$out = array();
foreach(explode("\n", $oids) as $line)
foreach (explode("\n", $oids) as $line)
{
preg_match($regexp, $line, $match);
if ($match['name'])
@@ -43,7 +43,7 @@ if ($device['os'] == "cometsystem-p85xx")
}
}
foreach($out as $sensor_id=>$sensor)
foreach ($out as $sensor_id=>$sensor)
{
if ($sensor['temp_intval'] != 9999)
{
+1 -1
View File
@@ -152,7 +152,7 @@ function delete_device($id)
$device_tables = array('entPhysical', 'devices_attribs', 'devices_perms', 'bgpPeers', 'vlans', 'vrfs', 'storage', 'alerts', 'eventlog',
'syslog', 'ports', 'services', 'alerts', 'toner', 'frequency', 'current', 'sensors');
foreach($device_tables as $table) {
foreach ($device_tables as $table) {
dbDelete($table, "`device_id` = ?", array($id));
}
+2 -2
View File
@@ -6,7 +6,7 @@ $ike_array = snmpwalk_cache_oid($device, "cikeTunnelEntry", array(), "CISCO-IP
$tunnels_db = dbFetchRows("SELECT * FROM `ipsec_tunnels` WHERE `device_id` = ?", array($device['device_id']));
foreach ($tunnels_db as $tunnel) { $tunnels[$tunnel['peer_addr']] = $tunnel;}
foreach($ipsec_array as $index => $tunnel)
foreach ($ipsec_array as $index => $tunnel)
{
$tunnel = array_merge($tunnel, $ike_array[$tunnel['cipSecTunIkeTunnelIndex']]);
@@ -46,7 +46,7 @@ foreach($ipsec_array as $index => $tunnel)
{
$tunnel_id = dbInsert(array('device_id' => $device['device_id'], 'peer_addr' => $tunnel['cikeTunRemoteValue'], 'local_addr' => $tunnel['cikeTunLocalValue'], 'tunnel_name' => $tunnel['cikeTunLocalName']), 'ipsec_tunnels');
} else {
foreach($db_oids as $db_oid => $db_value) {
foreach ($db_oids as $db_oid => $db_value) {
$db_update[$db_value] = $tunnel[$db_oid];
}
+2 -2
View File
@@ -25,10 +25,10 @@ if (is_array($cefs))
{
$entity_name = $entity_array[$entity]['entPhysicalName'] ." - ".$entity_array[$entity]['entPhysicalModelName'];
echo("\n$entity $entity_name\n");
foreach($afis as $afi => $paths)
foreach ($afis as $afi => $paths)
{
echo(" |- $afi\n");
foreach($paths as $path => $cef_stat)
foreach ($paths as $path => $cef_stat)
{
echo(" | |-".$path.": ".$cef_stat['cefSwitchingPath']);
+1 -1
View File
@@ -148,7 +148,7 @@ function poll_device($device, $options)
include("includes/polling/".$options['m'].".inc.php");
}
} else {
foreach($config['poller_modules'] as $module => $module_status)
foreach ($config['poller_modules'] as $module => $module_status)
{
if ($attribs['poll_'.$module] || ( $module_status && !isset($attribs['poll_'.$module])))
{
+1 -1
View File
@@ -974,7 +974,7 @@ function rewrite_adslLineType($adslLineType)
'fastOrInterleaved' => 'Fast/Interleaved',
'fastAndInterleaved' => 'Fast+Interleaved');
foreach($adslLineTypes as $type => $text)
foreach ($adslLineTypes as $type => $text)
{
if ($adslLineType == $type)
{
+4 -6
View File
@@ -68,8 +68,7 @@ function rrdtool_pipe_open(&$rrd_process, &$rrd_pipes)
function rrdtool_pipe_close(&$rrd_process, &$rrd_pipes)
{
if($debug)
if ($debug)
{
echo stream_get_contents($rrd_pipes[1]);
echo stream_get_contents($rrd_pipes[2]);
@@ -83,7 +82,7 @@ function rrdtool_pipe_close(&$rrd_process, &$rrd_pipes)
// proc_close in order to avoid a deadlock
$return_value = proc_close($rrd_process);
if($debug)
if ($debug)
{
echo $return_value;
}
@@ -100,7 +99,6 @@ function rrdtool_pipe_close(&$rrd_process, &$rrd_pipes)
function rrdtool_graph($graph_file, $options)
{
global $config, $debug;
rrdtool_pipe_open($rrd_process, $rrd_pipes);
@@ -121,7 +119,7 @@ function rrdtool_graph($graph_file, $options)
rrdtool_pipe_close($rrd_process, $rrd_pipes);
if($debug)
if ($debug)
{
echo("<p>");
if ($debug) { echo("graph $graph_file $options"); }
@@ -178,8 +176,8 @@ function rrdtool($command, $filename, $options)
function rrdtool_create($filename, $options)
{
global $config, $debug;
global $config; global $debug;
$command = $config['rrdtool'] . " create $filename $options";
if ($debug) { echo($command."\n"); }
+1 -1
View File
@@ -751,7 +751,7 @@ $config['os'][$os]['type'] = "network";
$config['os'][$os]['text'] = "Symbol AP";
$config['os'][$os]['icon'] = "symbol";
foreach($config['os'] as $this_os => $blah)
foreach ($config['os'] as $this_os => $blah)
{
if (isset($config['os'][$this_os]['group']))
{
+1 -1
View File
@@ -38,7 +38,7 @@ function process_syslog ($entry, $update) {
global $dev_cache;
foreach($config['syslog_filter'] as $bi)
foreach ($config['syslog_filter'] as $bi)
if (strpos($entry['msg'], $bi) !== FALSE) {
print_r($entry);
echo('D-'.$bi);
+1 -1
View File
@@ -9,7 +9,7 @@ $stats['services'] = dbFetchCell("SELECT count(*) FROM services");
$stats['applications'] = dbFetchCell("SELECT count(*) FROM applications");
$stats['bgp'] = dbFetchCell("SELECT count(*) FROM bgpPeers");
foreach(dbFetch("SELECT `os` FROM `devices` GROUP BY `os`") as $dt_data)
foreach (dbFetch("SELECT `os` FROM `devices` GROUP BY `os`") as $dt_data)
{
$stats['devicetypes'][$dt_data[os]] = dbFetchCell("SELECT COUNT(*) FROM `devices` WHERE `os` = '".$dt_data['os']."'");
}