| 10 |  | # | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 11 |  | # END CONFIGURATION | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 12 |  |  | 
 
 
 
 
 
 
 
 | 13 | + | include("iutils.inc.php"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 14 |  |  | 
 
 
 
 
 
 
 
 
 | 14 | – | # return an array of subdirectories from a directory. | 
 
 
 
 
 
 
 
 
 | 15 | – | function getdirArray($dir='./',$sort='asort') { | 
 
 
 
 
 
 
 
 
 | 16 | – | global $dir_file_count; | 
 
 
 
 
 
 
 
 
 | 17 | – | if ( is_dir($dir) ) { | 
 
 
 
 
 
 
 
 
 | 18 | – | $fd = @opendir($dir); | 
 
 
 
 
 
 
 
 
 | 19 | – | while ( ($part = @readdir($fd)) == TRUE ) { | 
 
 
 
 
 
 
 
 
 | 20 | – | clearstatcache(); | 
 
 
 
 
 
 
 
 
 | 21 | – | if ($part != "." && $part != "..") { | 
 
 
 
 
 
 
 
 
 | 22 | – | $dir_array[] = $part; | 
 
 
 
 
 
 
 
 
 | 23 | – | } | 
 
 
 
 
 
 
 
 
 | 24 | – | } | 
 
 
 
 
 
 
 
 
 | 25 | – | if($fd == TRUE) { | 
 
 
 
 
 
 
 
 
 | 26 | – | closedir($fd); | 
 
 
 
 
 
 
 
 
 | 27 | – | } | 
 
 
 
 
 
 
 
 
 | 28 | – | if (is_array($dir_array)) { | 
 
 
 
 
 
 
 
 
 | 29 | – | $sort($dir_array); | 
 
 
 
 
 
 
 
 
 | 30 | – | $dir_file_count = count($dir_array); | 
 
 
 
 
 
 
 
 
 | 31 | – | Return $dir_array; | 
 
 
 
 
 
 
 
 
 | 32 | – | } else { | 
 
 
 
 
 
 
 
 
 | 33 | – | Return FALSE; | 
 
 
 
 
 
 
 
 
 | 34 | – | } | 
 
 
 
 
 
 
 
 
 | 35 | – | } else { | 
 
 
 
 
 
 
 
 
 | 36 | – | Return FALSE; | 
 
 
 
 
 
 
 
 
 | 37 | – | } | 
 
 
 
 
 
 
 
 
 | 38 | – | } | 
 
 
 
 
 
 
 
 
 | 39 | – |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 15 |  | function printLine($title) { | 
 
 
 
 
 
 
 
 
 
 
 | 16 | < | echo "<hr color=\"#9999ff\">"; | 
 
 
 
 
 
 
 
 
 | 16 | > | echo "<hr style=\"color:#9999ff;\">"; | 
 
 
 
 
 
 
 
 
 
 
 | 17 |  | echo "<b>$title</b>"; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 18 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 19 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 35 |  | } | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 36 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 37 |  |  | 
 
 
 
 
 
 
 
 | 38 | + | function linkToHistory($report) { | 
 
 
 
 
 
 
 
 | 39 | + | global $machine; | 
 
 
 
 
 
 
 
 | 40 | + | $yesterday = date("Y-m-d", time() - 86400); | 
 
 
 
 
 
 
 
 | 41 | + | echo <<<EOT | 
 
 
 
 
 
 
 
 | 42 | + | <a href="browser.php?machine_name=$machine&report=$report&day=$yesterday&submit=Show"> | 
 
 
 
 
 
 
 
 | 43 | + | <img src="minichart.gif" width="20" height="20" border="0"> | 
 
 
 
 
 
 
 
 | 44 | + | </a> | 
 
 
 
 
 
 
 
 | 45 | + | <font size="2">View yesterday's 24-hour chart</font> | 
 
 
 
 
 
 
 
 | 46 | + | EOT; | 
 
 
 
 
 
 
 
 | 47 | + | } | 
 
 
 
 
 
 
 
 | 48 | + |  | 
 
 
 
 
 
 
 
 | 49 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 50 |  | # show a bar-represented value. | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 51 |  | function showBar($title, $value, $max, $units, $input) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 52 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 53 |  | include("latest_config.inc.php"); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 54 |  |  | 
 
 
 
 
 
 
 
 | 55 | + | $report = $value; | 
 
 
 
 
 
 
 
 | 56 | + |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 57 |  | preg_match("/$value=([^\,]*)\,/", $input, $matches); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 58 |  | $value = $matches[1]; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 59 |  | if (!is_int($max)) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 82 |  | <td align="right"><?=$max?><?=$units?></td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 83 |  | </tr> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 84 |  | <tr> | 
 
 
 
 
 
 
 
 | 85 | + | <td colspan="2" align="center"><? linkToHistory($report); ?></td> | 
 
 
 
 
 
 
 
 | 86 | + | </tr> | 
 
 
 
 
 
 
 
 | 87 | + | <tr> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 88 |  | <td colspan="2"> </td> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 89 |  | </tr> | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 90 |  | </table> | 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 | 124 |  | clearstatcache(); | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 125 |  | $data_age = time() - $last_modified; | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 126 |  |  | 
 
 
 
 
 
 
 
 
 
 
 | 127 | < | $last_modified = strftime("%a %d %b %Y at %T", $last_modified); | 
 
 
 
 
 
 
 
 
 | 127 | > | $last_modified = date("l jS F - g:ia", $last_modified); | 
 
 
 
 
 
 
 
 
 
 
 | 128 |  |  | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 129 |  | if ($data_age > $warning_age) { | 
 
 
 
 
 
 
 
 
 
 
 
 
 | 130 |  | $warning = <<<EOT |