+ if (isset($this->config_all[$sname][$s_psname]['title_page'])) {
+ $s_ptitle = $this->config_all[$sname][$s_psname]['title_page'];
+ }
+ elseif (isset($this->config_all[$sname]['page']['title_page'])) {
+ $s_ptitle = $this->config_all[$sname]['page']['title_page'];
+ }
+ else {
+ $s_ptitle = isset($s_psub)?sprintf(dgettext($td, '%s (%s) statistics'), $sname, $s_psub):sprintf(dgettext($td, '%s statistics'), $sname);
+ }
+ if (!isset($pconf['hide_titles']) || !$pconf['hide_titles']) {
+ $out .= '<h2>'.$s_ptitle.'</h2>'."\n";
+ }
+
+ $s_rrd = new rrdstat($this->config_all, $sname);
+ if (in_array($s_rrd->status, array('ok','readonly','graphonly'))) {
+ $tframe = isset($pconf['graph_timeframe'])?$pconf['graph_timeframe']:'day';
+ $gmeta = $s_rrd->graph_plus($tframe, $g_sub);
+ if (isset($pconf['graph_url'])) {
+ $gURL = $pconf['graph_url'];
+ $gURL = str_replace('%f', basename($gmeta['filename']), $gURL);
+ $gURL = str_replace('%p', $gmeta['filename'], $gURL);
+ if (substr($gURL, -1) == '/') { $gURL .= $gmeta['filename']; }
+ }
+ else {
+ $gURL = $gmeta['filename'];
+ }
+ $sURL = str_replace('%i', $sname, $sURL_base);
+ $sURL = str_replace('%a', isset($s_psub)?$sURL_add:'', $sURL);
+ $sURL = str_replace('%s', isset($s_psub)?$s_psub:'', $sURL);
+ $out .= '<a href="'.$sURL.'">';
+ $out .= '<img src="'.$gURL.'"';
+ $out .= ' alt="'.$s_rrd->basename.(!is_null($g_sub)?' - '.$g_sub:'').' - '.$tframe.'" class="rrdgraph"';
+ if (isset($gmeta['width']) && isset($gmeta['height'])) { $out .= ' style="width:'.$gmeta['width'].'px;height:'.$gmeta['height'].'px;"'; }
+ $out .= '></a>'."\n";
+ }
+ else {
+ $out .= sprintf(dgettext($td, 'RRD error: status is "%s"'), $s_rrd->status)."\n";
+ }
+ }
+ else {
+ $out .= ' ';
+ }
+ $out .= '</td>'."\n";
+ }
+ $out .= '</tr>'."\n";
+ }
+ $out .= '</table>'."\n";
+
+ $out .= $this->h_page_footer();
+ $out .= '</body></html>'."\n";
+ return $out;
+ }
+
+ function page_simple($pconf, $graph_extras = null) {
+ // create a simple (MRTG-like) HTML page and return it in a string
+ $td = $this->mod_textdomain;
+
+ $ptitle = isset($pconf['title_page'])?$pconf['title_page']:sprintf(dgettext($td, '%s - RRD statistics'),$this->basename);
+ $gtitle = array();
+ $gtitle['day'] = isset($pconf['title_day'])?$pconf['title_day']:dgettext($td, 'Day overview (scaling 5 minutes)');
+ $gtitle['week'] = isset($pconf['title_week'])?$pconf['title_week']:dgettext($td, 'Week overview (scaling 30 minutes)');
+ $gtitle['month'] = isset($pconf['title_month'])?$pconf['title_month']:dgettext($td, 'Month overview (scaling 2 hours)');
+ $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 .= '<title>'.$ptitle.'</title>'."\n";
+ $out .= '<style type="text/css">'."\n";
+ if (isset($pconf['style_base'])) { $out .= $pconf['style_base']; }
+ else {
+ $out .= 'h1 { font-weight: bold; font-size: 1.5em; }'."\n";
+ $out .= 'h2 { font-weight: bold; font-size: 1em; }'."\n";
+ $out .= '.gdata, .gvar, .ginfo { font-size: 0.75em; margin: 0.5em 0; }'."\n";
+ $out .= 'table.gdata, table.legend { border: 1px solid gray; border-collapse: collapse; }'."\n";
+ $out .= 'table.gdata td, table.gdata th, '."\n";
+ $out .= 'table.legend td, table.legend th { border: 1px solid gray; padding: 0.1em 0.2em; }'."\n";
+ $out .= 'div.legend { font-size: 0.75em; margin: 0.5em 0; }'."\n";
+ $out .= 'div.legend p { margin: 0; }'."\n";
+ $out .= '.footer { font-size: 0.75em; margin: 0.5em 0; }'."\n";
+ }
+ if (isset($pconf['style'])) { $out .= $pconf['style']; }
+ $out .= '</style>'."\n";
+ $out .= '</head>'."\n";
+ $out .= '<body>'."\n";
+
+ $out .= '<h1>'.$ptitle.'</h1>'."\n";
+ if (isset($pconf['text_intro']) && strlen($pconf['text_intro'])) { $out .= '<p class="intro">'.$pconf['text_intro'].'</p>'."\n"; }
+ if (!isset($pconf['show_update']) || $pconf['show_update']) {
+ $out .= '<p class="last_up">';
+ if (is_null($this->last_update())) { $up_time = dgettext($td, 'unknown'); }
+ elseif (class_exists('baseutils')) { $up_time = baseutils::dateFormat($this->last_update(), 'short'); }
+ else { $up_time = date('Y-m-d H:i:s', $this->last_update()); }
+ $out .= sprintf(dgettext($td, 'Last Update: %s'), $up_time);
+ $out .= '</p>'."\n";
+ }
+
+ $g_sub = isset($pconf['graph_sub'])?$pconf['graph_sub']:null;
+ if (in_array($this->status, array('ok','readonly','graphonly'))) {