From ef6d7b9565ee734c9a4282f4fccf68ec1675f45b Mon Sep 17 00:00:00 2001 From: laf Date: Wed, 15 Jul 2015 22:04:19 +0100 Subject: [PATCH] Fixed some scrut issues labelled Major --- html/billing-graph.php | 2 +- html/csv.php | 2 +- html/includes/PasswordHash.php | 2 -- html/includes/functions.inc.php | 3 ++- html/includes/graphs/device/collectd.inc.php | 3 ++- html/includes/graphs/device/toner.inc.php | 2 +- html/includes/graphs/toner/usage.inc.php | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/html/billing-graph.php b/html/billing-graph.php index b7d9c6200..7545b8719 100644 --- a/html/billing-graph.php +++ b/html/billing-graph.php @@ -112,7 +112,7 @@ if ($count <= 1) { $i = '0'; foreach (dbFetch('SELECT *, UNIX_TIMESTAMP(timestamp) AS formatted_date FROM bill_data WHERE bill_id = ? AND `timestamp` >= FROM_UNIXTIME( ? ) AND `timestamp` <= FROM_UNIXTIME( ? ) ORDER BY timestamp ASC', array($bill_id, $start, $end)) as $row) { - @$timestamp = $row['formatted_date']; + $timestamp = $row['formatted_date']; if (!$first) { $first = $timestamp; } diff --git a/html/csv.php b/html/csv.php index 19203237d..cbd77fe5f 100644 --- a/html/csv.php +++ b/html/csv.php @@ -37,7 +37,7 @@ require 'includes/authenticate.inc.php'; $report = mres($vars['report']); if (!empty($report) && file_exists("includes/reports/$report.csv.inc.php")) { - if ($debug == false) { + if ($debug === false) { header('Content-Type: text/csv'); header('Content-Disposition: attachment; filename="'.$report.'-'.date('Ymd').'.csv"'); } diff --git a/html/includes/PasswordHash.php b/html/includes/PasswordHash.php index 757d47d55..914ab2e4d 100644 --- a/html/includes/PasswordHash.php +++ b/html/includes/PasswordHash.php @@ -47,8 +47,6 @@ class PasswordHash { function get_random_bytes($count) { - $output = ''; - $output = openssl_random_pseudo_bytes($count,$strong); if(empty($output)) diff --git a/html/includes/functions.inc.php b/html/includes/functions.inc.php index 6aed9fa6f..0b62367cf 100644 --- a/html/includes/functions.inc.php +++ b/html/includes/functions.inc.php @@ -673,6 +673,7 @@ function overlibprint($text) { function humanmedia($media) { + global $rewrite_iftype; array_preg_replace($rewrite_iftype, $media); return $media; @@ -825,7 +826,7 @@ function generate_ap_link($args, $text=null, $type=null) { $url = generate_ap_url($args); if (port_permitted($args['interface_id'], $args['device_id'])) { - return overlib_link($url, $text, $content, $class); + return overlib_link($url, $text, $content, null); } else { return fixifName($text); diff --git a/html/includes/graphs/device/collectd.inc.php b/html/includes/graphs/device/collectd.inc.php index 7de642433..b15c1a89e 100644 --- a/html/includes/graphs/device/collectd.inc.php +++ b/html/includes/graphs/device/collectd.inc.php @@ -94,6 +94,7 @@ function error($code, $code_msg, $title, $msg) { imagestring($png, 5, 60, 35, sprintf('%s [%d]', $code_msg, $code), $c_etxt); if (function_exists('imagettfbbox') && is_file($config['error_font'])) { // Detailled error message + $errorfont = $config['error_font']; $fmt_msg = makeTextBlock($msg, $errorfont, 10, ($w - 86)); $fmtbox = imagettfbbox(12, 0, $errorfont, $fmt_msg); imagettftext($png, 10, 0, 55, (35 + 3 + imagefontwidth(5) - $fmtbox[7] + $fmtbox[1]), $c_txt, $errorfont, $fmt_msg); @@ -274,7 +275,7 @@ else if ($rrd_cmd) { header('Cache-Control: max-age=60'); $rt = 0; passthru($rrd_cmd, $rt); - if ($rt != 0) { + if ($rt !== 0) { return error500($graph_identifier, 'RRD failed to generate the graph: '.$rt); } diff --git a/html/includes/graphs/device/toner.inc.php b/html/includes/graphs/device/toner.inc.php index 9ba469cc0..bd132c4e6 100644 --- a/html/includes/graphs/device/toner.inc.php +++ b/html/includes/graphs/device/toner.inc.php @@ -7,7 +7,7 @@ $rrd_options .= ' -l 0 -E '; $iter = '1'; $rrd_options .= " COMMENT:'Toner level Cur Min Max\\n'"; foreach (dbFetchRows('SELECT * FROM toner where device_id = ?', array($device['device_id'])) as $toner) { - $colour = toner2colour($toner['toner_descr']); + $colour = toner2colour($toner['toner_descr'], 100 - $toner['toner_current']); if ($colour['left'] == null) { // FIXME generic colour function diff --git a/html/includes/graphs/toner/usage.inc.php b/html/includes/graphs/toner/usage.inc.php index 2b617eb8b..274845db7 100644 --- a/html/includes/graphs/toner/usage.inc.php +++ b/html/includes/graphs/toner/usage.inc.php @@ -6,7 +6,7 @@ require 'includes/graphs/common.inc.php'; $rrd_options .= " COMMENT:' Cur Max\\n'"; -$colour = toner2colour($toner['toner_descr']); +$colour = toner2colour($toner['toner_descr'], 100 - $toner['toner_current']); if ($colour['left'] == null) { $colour['left'] = 'CC0000'; }