From 2dc8b807e9a3c7254123598d0dc0810c2847f7a1 Mon Sep 17 00:00:00 2001 From: Tom Laermans Date: Tue, 4 Oct 2011 09:10:21 +0000 Subject: [PATCH] syntaxer run git-svn-id: http://www.observium.org/svn/observer/trunk@2642 61d68cd4-352d-0410-923a-c4978735b2b8 --- html/includes/functions.inc.php | 4 +-- .../application/mailscanner_sent.inc.php | 24 ++++++++--------- html/includes/graphs/customer/bits.inc.php | 2 +- html/includes/graphs/device/mempool.inc.php | 2 +- .../graphs/device/netstat_icmp.inc.php | 2 +- .../graphs/device/netstat_icmp_info.inc.php | 2 +- .../includes/graphs/device/netstat_ip.inc.php | 2 +- .../graphs/device/netstat_snmp.inc.php | 2 +- .../graphs/device/netstat_snmp_pkt.inc.php | 2 +- .../graphs/device/netstat_tcp.inc.php | 2 +- .../graphs/device/netstat_udp.inc.php | 2 +- .../device/smokeping_all_common.inc.php | 6 ++--- html/includes/graphs/port/pagp_bits.inc.php | 2 +- html/includes/print-interface.inc.php | 12 ++++----- html/includes/topnav.inc.php | 4 +-- html/index.php | 4 +-- html/pages/addsrv.inc.php | 2 +- html/pages/device/apps/mailscanner.inc.php | 4 +-- html/pages/device/edit/modules.inc.php | 4 +-- html/pages/device/overview/mempools.inc.php | 2 +- html/pages/device/overview/processors.inc.php | 2 +- html/pages/device/port/realtime.inc.php | 2 +- html/pages/device/ports.inc.php | 2 +- html/pages/device/ports/neighbours.inc.php | 2 +- html/pages/devices.inc.php | 10 +++---- html/pages/edituser.inc.php | 2 +- html/pages/front/demo.php | 2 +- html/pages/ports.inc.php | 2 +- html/pages/routing/bgp.inc.php | 2 +- html/pages/routing/vrf.inc.php | 2 +- includes/common.php | 27 ++++++++++--------- includes/discovery/cisco-cef.inc.php | 4 +-- includes/discovery/functions.inc.php | 2 +- includes/discovery/mempools/vrp.inc.php | 2 +- includes/discovery/ports-stack.inc.php | 4 +-- includes/discovery/temperatures/apc.inc.php | 2 +- .../temperatures/cometsystem-p85xx.inc.php | 4 +-- includes/functions.php | 2 +- includes/polling/cipsec-tunnels.inc.php | 4 +-- includes/polling/cisco-cef.inc.php | 4 +-- includes/polling/functions.inc.php | 2 +- includes/rewrites.php | 2 +- includes/rrdtool.inc.php | 10 +++---- includes/static-config.php | 2 +- includes/syslog.php | 2 +- includes/versioncheck.inc.php | 2 +- 46 files changed, 94 insertions(+), 95 deletions(-) diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 25f49eff4..b299dc41e 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -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)) { diff --git a/html/includes/graphs/application/mailscanner_sent.inc.php b/html/includes/graphs/application/mailscanner_sent.inc.php index 8747feca4..c006f5c5a 100644 --- a/html/includes/graphs/application/mailscanner_sent.inc.php +++ b/html/includes/graphs/application/mailscanner_sent.inc.php @@ -1,21 +1,21 @@ '00cc00', $i=0; -foreach($stats as $stat => $colour) +foreach ($stats as $stat => $colour) { $i++; $rrd_list[$i]['filename'] = $rrd_filename; diff --git a/html/includes/graphs/device/netstat_icmp_info.inc.php b/html/includes/graphs/device/netstat_icmp_info.inc.php index 73530852a..51b5b54f5 100644 --- a/html/includes/graphs/device/netstat_icmp_info.inc.php +++ b/html/includes/graphs/device/netstat_icmp_info.inc.php @@ -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; diff --git a/html/includes/graphs/device/netstat_ip.inc.php b/html/includes/graphs/device/netstat_ip.inc.php index a065d16ed..0db64cd40 100644 --- a/html/includes/graphs/device/netstat_ip.inc.php +++ b/html/includes/graphs/device/netstat_ip.inc.php @@ -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; diff --git a/html/includes/graphs/device/netstat_snmp.inc.php b/html/includes/graphs/device/netstat_snmp.inc.php index dfcc845ee..a82ce0007 100644 --- a/html/includes/graphs/device/netstat_snmp.inc.php +++ b/html/includes/graphs/device/netstat_snmp.inc.php @@ -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; diff --git a/html/includes/graphs/device/netstat_snmp_pkt.inc.php b/html/includes/graphs/device/netstat_snmp_pkt.inc.php index b184418de..2cc1e3ea8 100644 --- a/html/includes/graphs/device/netstat_snmp_pkt.inc.php +++ b/html/includes/graphs/device/netstat_snmp_pkt.inc.php @@ -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; diff --git a/html/includes/graphs/device/netstat_tcp.inc.php b/html/includes/graphs/device/netstat_tcp.inc.php index 8a12bd1b1..e175bb72b 100644 --- a/html/includes/graphs/device/netstat_tcp.inc.php +++ b/html/includes/graphs/device/netstat_tcp.inc.php @@ -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; diff --git a/html/includes/graphs/device/netstat_udp.inc.php b/html/includes/graphs/device/netstat_udp.inc.php index aaa0e2e4f..b491bb48f 100644 --- a/html/includes/graphs/device/netstat_udp.inc.php +++ b/html/includes/graphs/device/netstat_udp.inc.php @@ -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; diff --git a/html/includes/graphs/device/smokeping_all_common.inc.php b/html/includes/graphs/device/smokeping_all_common.inc.php index 589bb75ff..8aefdf0f7 100644 --- a/html/includes/graphs/device/smokeping_all_common.inc.php +++ b/html/includes/graphs/device/smokeping_all_common.inc.php @@ -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.",+"; diff --git a/html/includes/graphs/port/pagp_bits.inc.php b/html/includes/graphs/port/pagp_bits.inc.php index 4b601530e..517fd8d7e 100644 --- a/html/includes/graphs/port/pagp_bits.inc.php +++ b/html/includes/graphs/port/pagp_bits.inc.php @@ -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"))) { diff --git a/html/includes/print-interface.inc.php b/html/includes/print-interface.inc.php index bb24f089b..61ebb971a 100644 --- a/html/includes/print-interface.inc.php +++ b/html/includes/print-interface.inc.php @@ -125,7 +125,7 @@ echo(""); echo(""); 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("Directly Connected " . generate_port_link($link, makeshortif($link['label'])) . " on " . generate_device_link($link, shorthost($link['hostname'])) . "
"); # $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 = "
"; } - 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 " . generate_port_link($member) . " (PAgP)"); $br = "
"; @@ -226,7 +226,7 @@ if ($port_details) $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']) { diff --git a/html/includes/topnav.inc.php b/html/includes/topnav.inc.php index 3064a0d74..5fc245374 100644 --- a/html/includes/topnav.inc.php +++ b/html/includes/topnav.inc.php @@ -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'"); diff --git a/html/index.php b/html/index.php index 19ef3c764..49b603a25 100755 --- a/html/index.php +++ b/html/index.php @@ -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; } diff --git a/html/pages/addsrv.inc.php b/html/pages/addsrv.inc.php index cd8e17dec..5a2e1967f 100644 --- a/html/pages/addsrv.inc.php +++ b/html/pages/addsrv.inc.php @@ -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 .= ""; } diff --git a/html/pages/device/apps/mailscanner.inc.php b/html/pages/device/apps/mailscanner.inc.php index 2464fcaac..c006f07b2 100644 --- a/html/pages/device/apps/mailscanner.inc.php +++ b/html/pages/device/apps/mailscanner.inc.php @@ -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) { diff --git a/html/pages/device/edit/modules.inc.php b/html/pages/device/edit/modules.inc.php index e28bfe07a..d93dae89c 100644 --- a/html/pages/device/edit/modules.inc.php +++ b/html/pages/device/edit/modules.inc.php @@ -35,7 +35,7 @@ echo('
Poller Modules
echo(''); echo(''); -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('
Discovery Modules
'); echo('
ModuleGlobalDevice
'); echo(''); -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('
ModuleGlobalDevice
'.$module.''); diff --git a/html/pages/device/overview/mempools.inc.php b/html/pages/device/overview/mempools.inc.php index 2e9bec10b..aaa8f274d 100644 --- a/html/pages/device/overview/mempools.inc.php +++ b/html/pages/device/overview/mempools.inc.php @@ -13,7 +13,7 @@ if (count($mempools)) echo(""); $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); diff --git a/html/pages/device/overview/processors.inc.php b/html/pages/device/overview/processors.inc.php index 3953904fb..8645f69c9 100644 --- a/html/pages/device/overview/processors.inc.php +++ b/html/pages/device/overview/processors.inc.php @@ -13,7 +13,7 @@ if (count($processors)) echo(" Processors

"); echo("
"); - 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. diff --git a/html/pages/device/port/realtime.inc.php b/html/pages/device/port/realtime.inc.php index cde53e704..87fd8a851 100644 --- a/html/pages/device/port/realtime.inc.php +++ b/html/pages/device/port/realtime.inc.php @@ -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(""); } diff --git a/html/pages/device/ports.inc.php b/html/pages/device/ports.inc.php index b8fb777ec..c961379d9 100644 --- a/html/pages/device/ports.inc.php +++ b/html/pages/device/ports.inc.php @@ -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; diff --git a/html/pages/device/ports/neighbours.inc.php b/html/pages/device/ports/neighbours.inc.php index 8c1ea6feb..ac666ff10 100644 --- a/html/pages/device/ports/neighbours.inc.php +++ b/html/pages/device/ports/neighbours.inc.php @@ -10,7 +10,7 @@ echo(''); -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; } diff --git a/html/pages/devices.inc.php b/html/pages/devices.inc.php index 6f805ccc4..c252bc0b5 100644 --- a/html/pages/devices.inc.php +++ b/html/pages/devices.inc.php @@ -34,7 +34,7 @@ if($vars['searchbar'] != "hide") All VersionsAll FeaturesetsAll Device Types
Local Port Protocol
"); diff --git a/html/pages/ports.inc.php b/html/pages/ports.inc.php index 2c4d259c1..7194d48cf 100644 --- a/html/pages/ports.inc.php +++ b/html/pages/ports.inc.php @@ -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 != "") { diff --git a/html/pages/routing/bgp.inc.php b/html/pages/routing/bgp.inc.php index bba1a57a4..cc988115f 100644 --- a/html/pages/routing/bgp.inc.php +++ b/html/pages/routing/bgp.inc.php @@ -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); diff --git a/html/pages/routing/vrf.inc.php b/html/pages/routing/vrf.inc.php index c825486fa..e4ee1647d 100644 --- a/html/pages/routing/vrf.inc.php +++ b/html/pages/routing/vrf.inc.php @@ -68,7 +68,7 @@ if($_GET['optb'] == "all" ) { echo(""); 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); diff --git a/includes/common.php b/includes/common.php index 731f4448d..8223b4cba 100644 --- a/includes/common.php +++ b/includes/common.php @@ -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']; } diff --git a/includes/discovery/cisco-cef.inc.php b/includes/discovery/cisco-cef.inc.php index 0dad72a99..07f81a16e 100755 --- a/includes/discovery/cisco-cef.inc.php +++ b/includes/discovery/cisco-cef.inc.php @@ -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"); diff --git a/includes/discovery/functions.inc.php b/includes/discovery/functions.inc.php index 44c10cdb2..85472e550 100644 --- a/includes/discovery/functions.inc.php +++ b/includes/discovery/functions.inc.php @@ -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]))) { diff --git a/includes/discovery/mempools/vrp.inc.php b/includes/discovery/mempools/vrp.inc.php index 6fa1967ba..9f563b502 100644 --- a/includes/discovery/mempools/vrp.inc.php +++ b/includes/discovery/mempools/vrp.inc.php @@ -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 ) { diff --git a/includes/discovery/ports-stack.inc.php b/includes/discovery/ports-stack.inc.php index 5d4ac1e27..dd5323943 100644 --- a/includes/discovery/ports-stack.inc.php +++ b/includes/discovery/ports-stack.inc.php @@ -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])) diff --git a/includes/discovery/temperatures/apc.inc.php b/includes/discovery/temperatures/apc.inc.php index 19b9000d1..93855b146 100644 --- a/includes/discovery/temperatures/apc.inc.php +++ b/includes/discovery/temperatures/apc.inc.php @@ -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); diff --git a/includes/discovery/temperatures/cometsystem-p85xx.inc.php b/includes/discovery/temperatures/cometsystem-p85xx.inc.php index 105d516ba..e9a82cc6f 100644 --- a/includes/discovery/temperatures/cometsystem-p85xx.inc.php +++ b/includes/discovery/temperatures/cometsystem-p85xx.inc.php @@ -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) { diff --git a/includes/functions.php b/includes/functions.php index adb591722..b87b9dedf 100755 --- a/includes/functions.php +++ b/includes/functions.php @@ -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)); } diff --git a/includes/polling/cipsec-tunnels.inc.php b/includes/polling/cipsec-tunnels.inc.php index 261297825..4f1404155 100644 --- a/includes/polling/cipsec-tunnels.inc.php +++ b/includes/polling/cipsec-tunnels.inc.php @@ -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]; } diff --git a/includes/polling/cisco-cef.inc.php b/includes/polling/cisco-cef.inc.php index 1cf6d7152..c3cbe0aba 100755 --- a/includes/polling/cisco-cef.inc.php +++ b/includes/polling/cisco-cef.inc.php @@ -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']); diff --git a/includes/polling/functions.inc.php b/includes/polling/functions.inc.php index 662bb4362..d43afecde 100644 --- a/includes/polling/functions.inc.php +++ b/includes/polling/functions.inc.php @@ -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]))) { diff --git a/includes/rewrites.php b/includes/rewrites.php index 46d375215..4ded6a893 100644 --- a/includes/rewrites.php +++ b/includes/rewrites.php @@ -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) { diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 40a7cd4ea..d25a690f4 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -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("

"); 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"); } diff --git a/includes/static-config.php b/includes/static-config.php index adc6d149f..a06129bc6 100644 --- a/includes/static-config.php +++ b/includes/static-config.php @@ -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'])) { diff --git a/includes/syslog.php b/includes/syslog.php index 360453151..7feb9fa91 100755 --- a/includes/syslog.php +++ b/includes/syslog.php @@ -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); diff --git a/includes/versioncheck.inc.php b/includes/versioncheck.inc.php index e16d1191e..7225e3934 100644 --- a/includes/versioncheck.inc.php +++ b/includes/versioncheck.inc.php @@ -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']."'"); }