Fixed the scrut coding style issues

This commit is contained in:
Neil Lathwood
2015-02-22 16:45:40 +00:00
parent 3045835093
commit a4d3c8709d
15 changed files with 29 additions and 3 deletions
+4
View File
@@ -49,6 +49,7 @@ function getDates($dayofmonth, $months=0)
$last_from = date_format($date_start, 'Ymd') . "000000";
$last_to = date_format($date_end, 'Ymd') . "235959";
$return = array();
$return['0'] = $date_from;
$return['1'] = $date_to;
$return['2'] = $last_from;
@@ -76,6 +77,7 @@ function getValue($host, $port, $id, $inout)
function getLastPortCounter($port_id,$inout)
{
$return = array();
$rows = dbFetchCell("SELECT count(counter) from `port_" . mres($inout) . "_measurements` WHERE `port_id`='" . mres($port_id)."'");
if ($rows > 0)
@@ -92,6 +94,7 @@ function getLastPortCounter($port_id,$inout)
function getLastMeasurement($bill_id)
{
$return = array();
$rows = dbFetchCell("SELECT count(delta) from bill_data WHERE bill_id='".mres($bill_id)."'");
if ($rows > 0)
@@ -142,6 +145,7 @@ function get95thout($bill_id,$datefrom,$dateto)
function getRates($bill_id,$datefrom,$dateto)
{
$data = array();
$mq_text = "SELECT count(delta) FROM bill_data ";
$mq_text .= " WHERE bill_id = '".mres($bill_id)."'";
$mq_text .= " AND timestamp > '".mres($datefrom)."' AND timestamp <= '".mres($dateto)."'";
+1
View File
@@ -147,6 +147,7 @@ function get_port_by_ifIndex($device_id, $ifIndex)
function get_all_devices($device, $type = "")
{
global $cache;
$devices = array();
// FIXME needs access control checks!
// FIXME respect $type (server, network, etc) -- needs an array fill in topnav.
+3
View File
@@ -132,6 +132,7 @@ function percent_colour($perc)
function interface_errors($rrd_file, $period = '-1d') // Returns the last in/out errors value in RRD
{
global $config;
$errors = array();
$cmd = $config['rrdtool']." fetch -s $period -e -300s $rrd_file AVERAGE | grep : | cut -d\" \" -f 4,5";
$data = trim(shell_exec($cmd));
@@ -584,6 +585,7 @@ function match_network($nets, $ip, $first=false)
function snmp2ipv6($ipv6_snmp)
{
$ipv6 = explode('.',$ipv6_snmp);
$ipv6_2 = array();
# Workaround stupid Microsoft bug in Windows 2008 -- this is fixed length!
# < fenestro> "because whoever implemented this mib for Microsoft was ignorant of RFC 2578 section 7.7 (2)"
@@ -600,6 +602,7 @@ function snmp2ipv6($ipv6_snmp)
function ipv62snmp($ipv6)
{
$ipv6_split = array();
$ipv6_ex = explode(':',Net_IPv6::uncompress($ipv6));
for ($i = 0;$i < 8;$i++) { $ipv6_ex[$i] = zeropad($ipv6_ex[$i],4); }
$ipv6_ip = implode('',$ipv6_ex);
+1
View File
@@ -222,6 +222,7 @@ function poll_device($device, $options)
rrdtool_update($ping_rrd, "N:$ping_time");
}
$update_array = array();
$update_array['last_polled'] = array('NOW()');
$update_array['last_polled_timetaken'] = $device_time;
$update_array['last_ping'] = array('NOW()');
+1
View File
@@ -205,6 +205,7 @@ function rrdtool_create($filename, $options)
function rrdtool_update($filename, $options)
{
$values = array();
// Do some sanitisation on the data if passed as an array.
if (is_array($options))
{
+2 -1
View File
@@ -53,6 +53,7 @@ function snmp_get_multi($device, $oids, $options = "-OQUs", $mib = NULL, $mibdir
if (!$debug) { $cmd .= " 2>/dev/null"; }
$data = trim(external_exec($cmd));
$runtime_stats['snmpget']++;
$array = array();
foreach (explode("\n", $data) as $entry)
{
list($oid,$value) = explode("=", $entry);
@@ -189,7 +190,7 @@ function snmp_walk($device, $oid, $options = NULL, $mib = NULL, $mibdir = NULL)
return $data;
}
function snmpwalk_cache_cip($device, $oid, $array, $mib = 0)
function snmpwalk_cache_cip($device, $oid, $array = array(), $mib = 0)
{
global $config;