Apply fixes from StyleCI (#12120)

This commit is contained in:
Jellyfrog
2020-09-21 15:40:17 +02:00
committed by GitHub
parent 77c531527c
commit 82f43cb98d
1733 changed files with 18337 additions and 18540 deletions

View File

@@ -7,23 +7,23 @@ foreach ($_GET as $name => $value) {
$vars[$name] = $value;
}
list($type, $subtype) = extract_graph_type($vars['type']);
[$type, $subtype] = extract_graph_type($vars['type']);
if (is_numeric($vars['device'])) {
$device = device_by_id_cache($vars['device']);
} elseif (!empty($vars['device'])) {
} elseif (! empty($vars['device'])) {
$device = device_by_name($vars['device']);
}
// FIXME -- remove these
$width = $vars['width'];
$height = $vars['height'];
$title = $vars['title'];
$width = $vars['width'];
$height = $vars['height'];
$title = $vars['title'];
$vertical = $vars['vertical'];
$legend = $vars['legend'];
$output = (!empty($vars['output']) ? $vars['output'] : 'default');
$legend = $vars['legend'];
$output = (! empty($vars['output']) ? $vars['output'] : 'default');
$from = parse_at_time($_GET['from']) ?: Config::get('time.day');
$to = parse_at_time($_GET['to']) ?: Config::get('time.now');
$to = parse_at_time($_GET['to']) ?: Config::get('time.now');
$graph_type = (isset($vars['graph_type']) ? $vars['graph_type'] : Config::get('webui.graph_type'));
$period = ($to - $from);
@@ -38,8 +38,8 @@ require Config::get('install_dir') . "/includes/html/graphs/$type/auth.inc.php";
$graph_title = format_hostname($device);
if ($auth && is_customoid_graph($type, $subtype)) {
$unit = $vars['unit'];
include(Config::get('install_dir') . "/includes/html/graphs/customoid/customoid.inc.php");
$unit = $vars['unit'];
include Config::get('install_dir') . "/includes/html/graphs/customoid/customoid.inc.php";
} elseif ($auth && is_file(Config::get('install_dir') . "/includes/html/graphs/$type/$subtype.inc.php")) {
include Config::get('install_dir') . "/includes/html/graphs/$type/$subtype.inc.php";
} else {
@@ -62,9 +62,9 @@ function graph_error($string)
if ($height > '99') {
shell_exec($rrd_cmd);
d_echo('<pre>'.$rrd_cmd.'</pre>');
d_echo('<pre>' . $rrd_cmd . '</pre>');
if (is_file($graphfile) && !$debug) {
if (is_file($graphfile) && ! $debug) {
header('Content-type: image/png');
$fd = fopen($graphfile, 'r');
fpassthru($fd);
@@ -72,7 +72,7 @@ function graph_error($string)
unlink($graphfile);
}
} else {
if (!$debug) {
if (! $debug) {
header('Content-type: image/png');
}
@@ -113,7 +113,7 @@ if ($error_msg) {
echo "<div class='infobox'>";
echo "<p style='font-size: 16px; font-weight: bold;'>RRDTool Command</p>";
echo "<pre class='rrd-pre'>";
echo "rrdtool ". Rrd::buildCommand("graph", $graphfile, $rrd_options);
echo "rrdtool " . Rrd::buildCommand("graph", $graphfile, $rrd_options);
echo "</pre>";
$return = rrdtool_graph($graphfile, $rrd_options);
echo "<p style='font-size: 16px; font-weight: bold;'>RRDTool Output</p>";
@@ -127,11 +127,11 @@ if ($error_msg) {
rrdtool_graph($graphfile, $rrd_options);
d_echo($rrd_cmd);
if (is_file($graphfile)) {
if (!$debug) {
if (! $debug) {
set_image_type();
if (Config::get('trim_tobias') && $graph_type !== 'svg') {
list($w, $h, $type, $attr) = getimagesize($graphfile);
$src_im = imagecreatefrompng($graphfile);
[$w, $h, $type, $attr] = getimagesize($graphfile);
$src_im = imagecreatefrompng($graphfile);
$src_x = '0';
// begin x
$src_y = '0';
@@ -146,15 +146,15 @@ if ($error_msg) {
// destination y
$dst_im = imagecreatetruecolor($src_w, $src_h);
imagesavealpha($dst_im, true);
$white = imagecolorallocate($dst_im, 255, 255, 255);
$white = imagecolorallocate($dst_im, 255, 255, 255);
$trans_colour = imagecolorallocatealpha($dst_im, 0, 0, 0, 127);
imagefill($dst_im, 0, 0, $trans_colour);
imagecopy($dst_im, $src_im, $dst_x, $dst_y, $src_x, $src_y, $src_w, $src_h);
if ($output === 'base64') {
ob_start();
imagepng($png);
$imagedata = ob_get_contents();
imagedestroy($png);
imagepng($png);
$imagedata = ob_get_contents();
imagedestroy($png);
ob_end_clean();
$base64_output = base64_encode($imagedata);
@@ -165,7 +165,7 @@ if ($error_msg) {
} else {
if ($output === 'base64') {
$imagedata = file_get_contents($graphfile);
$base64_output = base64_encode($imagedata);
$base64_output = base64_encode($imagedata);
} else {
$fd = fopen($graphfile, 'r');
fpassthru($fd);
@@ -174,7 +174,7 @@ if ($error_msg) {
}
} else {
echo `ls -l $graphfile`;
echo '<img src="'.data_uri($graphfile, 'image/svg+xml').'" alt="graph" />';
echo '<img src="' . data_uri($graphfile, 'image/svg+xml') . '" alt="graph" />';
}
unlink($graphfile);
} else {