<?php
-/* ***** BEGIN LICENSE BLOCK *****
- *
- * The contents of this file are subject to Austrian copyright reegulations
- * ("Urheberrecht"); you may not use this file except in compliance with
- * those laws.
- * This contents and any derived work, if it gets distributed in any way,
- * is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND,
- * either express or implied.
- *
- * The Original Code is KaiRo's RRD statistics class.
- *
- * The Initial Developer of the Original Code is
- * KaiRo - Robert Kaiser.
- * Portions created by the Initial Developer are Copyright (C) 2005-2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s): Robert Kaiser <kairo@kairo.at>
- *
- * ***** END LICENSE BLOCK ***** */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
class rrdstat {
// rrdstat PHP class
}
$graph_cmd = $this->rrdtool_bin.' graph '.str_replace('*', '\*', $fname.$gOpts.$gDefs.$gGraphs.$addSpecial);
- $return = `$graph_cmd 2>&1`;
-
- if (strpos($return, 'ERROR') !== false) {
- trigger_error($this->rrd_file.' - rrd graph error: '.$return, E_USER_WARNING);
- $return = 'command:'.$graph_cmd."\n\n".$return;
+ if (!is_writable($fname)) {
+ trigger_error($this->rrd_file.' - graph file not writable: '.$fname, E_USER_WARNING);
+ return 'command:'.$graph_cmd."\n\n".'unwritable file: '.$fname;
}
- if (0) {
- // debug output
- $return = 'command:'.$graph_cmd."\n\n".$return;
+ $graph_out = `$graph_cmd 2>&1`;
+
+ if (strpos($graph_out, 'ERROR') !== false) {
+ trigger_error($this->rrd_file.' - rrd graph error: '.$graph_out, E_USER_WARNING);
+ return 'command:'.$graph_cmd."\n\n".$graph_out;
}
$legendlines = '';
foreach ($graphrows as $grow) {
$legendline .= '|'.(isset($grow['legend_long'])?$grow['legend_long']:'');
$legendlines .= 'legend:'.$legendline."\n";
}
- $return = 'file:'.$fname."\n".$legendlines.$return;
+ $return = 'file:'.$fname."\n".$legendlines.$graph_out;
return $return;
}
$td = $this->mod_textdomain;
$ptitle = isset($pconf['title_page'])?$pconf['title_page']:dgettext($td, 'RRD statistics index');
- $out = '<html><head>'."\n";
+ $out = '<!DOCTYPE html>'."\n";
+ $out .= '<html><head>'."\n";
$out .= '<title>'.$ptitle.'</title>'."\n";
$out .= '<style type="text/css">'."\n";
if (isset($pconf['style_base'])) { $out .= $pconf['style_base']; }
else { $sURL_base = '?stat=%i%a'; }
if (isset($pconf['stats_url_add'])) { $sURL_add = $pconf['stats_url_add']; }
- else { $sURL_add = '&sub=%s'; }
+ else { $sURL_add = '&sub=%s'; }
$out .= '<ul class="indexlist">'."\n";
foreach ($stats as $stat) {
$sURL = str_replace('%s', $ssub, $sURL);
$sprt[] = '<a href="'.$sURL.'">'.$ssub.'</a>';
}
- $out .= ' <span="subs">('.implode(', ', $sprt).')</span>';
+ $out .= ' <span class="subs">('.implode(', ', $sprt).')</span>';
}
$out .= '</li>'."\n";
}
$td = $this->mod_textdomain;
$ptitle = isset($pconf['title_page'])?$pconf['title_page']:dgettext($td, 'RRD statistics overview');
- $out = '<html><head>'."\n";
+ $out = '<!DOCTYPE html>'."\n";
+ $out .= '<html><head>'."\n";
$out .= '<title>'.$ptitle.'</title>'."\n";
$out .= '<style type="text/css">'."\n";
if (isset($pconf['style_base'])) { $out .= $pconf['style_base']; }
else { $sURL_base = '?stat=%i%a'; }
if (isset($pconf['stats_url_add'])) { $sURL_add = $pconf['stats_url_add']; }
- else { $sURL_add = '&sub=%s'; }
+ else { $sURL_add = '&sub=%s'; }
$default_num_cols = $GLOBALS['ua']->isMobile()?1:2;
$num_cols = is_numeric(@$pconf['num_rows'])?$pconf['num_rows']:$default_num_cols;
$gtitle['year'] = isset($pconf['title_year'])?$pconf['title_year']:dgettext($td, 'Year overview (scaling 1 day)');
$ltitle = isset($pconf['title_legend'])?$pconf['title_legend']:dgettext($td, 'Legend:');
- $out = '<html><head>'."\n";
+ $out = '<!DOCTYPE html>'."\n";
+ $out .= '<html><head>'."\n";
$out .= '<title>'.$ptitle.'</title>'."\n";
$out .= '<style type="text/css">'."\n";
if (isset($pconf['style_base'])) { $out .= $pconf['style_base']; }