Apply "Squiz" code style on old (pre-2014) files

This commit is contained in:
Job Snijders
2015-07-10 13:36:21 +02:00
parent e4f4eb44dc
commit ebd0f6fc35
539 changed files with 13591 additions and 13223 deletions

View File

@@ -1,59 +1,61 @@
<?php
include("includes/graphs/common.inc.php");
require 'includes/graphs/common.inc.php';
$rrd_options .= " -l 0 -E ";
$rrd_options .= ' -l 0 -E ';
$iter = "1";
$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']);
foreach (dbFetchRows('SELECT * FROM toner where device_id = ?', array($device['device_id'])) as $toner) {
$colour = toner2colour($toner['toner_descr']);
if ($colour['left'] == NULL)
{
// FIXME generic colour function
switch ($iter)
{
case "1":
$colour['left']= "000000";
break;
case "2":
$colour['left']= "008C00";
break;
case "3":
$colour['left']= "4096EE";
break;
case "4":
$colour['left']= "73880A";
break;
case "5":
$colour['left']= "D01F3C";
break;
case "6":
$colour['left']= "36393D";
break;
case "7":
default:
$colour['left']= "FF0000";
unset($iter);
break;
}
}
if ($colour['left'] == null) {
// FIXME generic colour function
switch ($iter)
{
case '1':
$colour['left'] = '000000';
break;
$hostname = gethostbyid($toner['device_id']);
case '2':
$colour['left'] = '008C00';
break;
$descr = substr(str_pad($toner['toner_descr'], 16),0,16);
$rrd_filename = $config['rrd_dir'] . "/".$device['hostname']."/" . safename("toner-" . $toner['toner_index'] . ".rrd");
$toner_id = $toner['toner_id'];
case '3':
$colour['left'] = '4096EE';
break;
$rrd_options .= " DEF:toner$toner_id=$rrd_filename:toner:AVERAGE";
$rrd_options .= " LINE2:toner$toner_id#".$colour['left'].":'" . $descr . "'";
$rrd_options .= " GPRINT:toner$toner_id:LAST:'%5.0lf%%'";
$rrd_options .= " GPRINT:toner$toner_id:MIN:'%5.0lf%%'";
$rrd_options .= " GPRINT:toner$toner_id:MAX:%5.0lf%%\\\\l";
case '4':
$colour['left'] = '73880A';
break;
$iter++;
}
case '5':
$colour['left'] = 'D01F3C';
break;
?>
case '6':
$colour['left'] = '36393D';
break;
case '7':
default:
$colour['left'] = 'FF0000';
unset($iter);
break;
}//end switch
}//end if
$hostname = gethostbyid($toner['device_id']);
$descr = substr(str_pad($toner['toner_descr'], 16), 0, 16);
$rrd_filename = $config['rrd_dir'].'/'.$device['hostname'].'/'.safename('toner-'.$toner['toner_index'].'.rrd');
$toner_id = $toner['toner_id'];
$rrd_options .= " DEF:toner$toner_id=$rrd_filename:toner:AVERAGE";
$rrd_options .= " LINE2:toner$toner_id#".$colour['left'].":'".$descr."'";
$rrd_options .= " GPRINT:toner$toner_id:LAST:'%5.0lf%%'";
$rrd_options .= " GPRINT:toner$toner_id:MIN:'%5.0lf%%'";
$rrd_options .= " GPRINT:toner$toner_id:MAX:%5.0lf%%\\\\l";
$iter++;
}//end foreach