Fix some scrutinizer coding style issues

This commit is contained in:
Mike Rostermund
2015-08-04 18:34:24 +02:00
parent e7d87d6b0a
commit 5369112d48
7 changed files with 14 additions and 8 deletions

View File

@@ -119,7 +119,7 @@ if (isset($_GET['term'],$_GET['device_id'])) {
$obj = array_chunk($obj, 20, true);
$obj = $obj[0];
$flds = array();
if ($current == true) {
if ($current === true) {
foreach ($obj as $fld) {
$flds[] = $fld['name'];
}

View File

@@ -4,7 +4,7 @@ $ds = @ldap_connect($config['auth_ldap_server'], $config['auth_ldap_port']);
if ($config['auth_ldap_starttls'] && ($config['auth_ldap_starttls'] == 'optional' || $config['auth_ldap_starttls'] == 'require')) {
$tls = ldap_start_tls($ds);
if ($config['auth_ldap_starttls'] == 'require' && $tls == false) {
if ($config['auth_ldap_starttls'] == 'require' && $tls === false) {
echo '<h2>Fatal error: LDAP TLS required but not successfully negotiated:'.ldap_error($ds).'</h2>';
exit;
}

View File

@@ -17,7 +17,7 @@ if ($handle = opendir($rrddir)) {
}
}
if (isset($total) && $total == true) {
if (isset($total) && $total === true) {
$graphs = array(
'shoutcast_multi_bits' => 'Traffic Statistics - Total of all Shoutcast servers',
'shoutcast_multi_stats' => 'Shoutcast Statistics - Total of all Shoutcast servers',

View File

@@ -653,7 +653,9 @@ function discover_mempool(&$valid, $device, $index, $type, $descr, $precision='1
}
else {
echo '.';
$update_data['mempool_descr'] = $descr;
$update_data = array(
'mempool_descr' => $descr,
);
if (!empty($entPhysicalIndex)) {
$update_data['entPhysicalIndex'] = $entPhysicalIndex;

View File

@@ -265,10 +265,12 @@ function poll_device($device, $options) {
rrdtool_update($ping_rrd, "N:$ping_time");
}
$update_array['last_polled'] = array('NOW()');
$update_array['last_polled_timetaken'] = $device_time;
$update_array['last_ping'] = array('NOW()');
$update_array['last_ping_timetaken'] = $ping_time;
$update_array = array(
'last_polled' => array('NOW()'),
'last_polled_timetaken' => $device_time,
'last_ping' => array('NOW()'),
'last_ping_timetaken' => $ping_time,
);
// echo("$device_end - $device_start; $device_time $device_run");
echo "Polled in $device_time seconds\n";

View File

@@ -311,6 +311,7 @@ function snmp_cache_ifIndex($device) {
$data = trim(external_exec($cmd));
$device_id = $device['device_id'];
$array = array();
foreach (explode("\n", $data) as $entry) {
list ($this_oid, $this_value) = preg_split('/=/', $entry);
list ($this_oid, $this_index) = explode('.', $this_oid, 2);

View File

@@ -733,6 +733,7 @@ function updateXML(&$output, &$rra) {
}
function removeComments(&$output) {
$new_array = array();
if (sizeof($output)) {
foreach($output as $line) {
$line = trim($line);