+ return $this->page_simple($pconf, $graph_extras);
+ }
+
+ function page_index($pconf) {
+ // create a bare, very simple index list HTML page and return it in a string
+
+ $ptitle = isset($pconf['title_page'])?$pconf['title_page']:'Index - RRD statistics';
+
+ $out = '<html><head>';
+ $out .= '<title>'.$ptitle.'</title>';
+ $out .= '<style>';
+ if (isset($pconf['style_base'])) { $out .= $pconf['style_base']; }
+ else {
+ $out .= 'h1 { font-weight: bold; font-size: 1.5em; }';
+ $out .= '.footer { font-size: 0.75em; margin: 0.5em 0; }';
+ $out .= 'li.scanfile { font-style: italic; }';
+ }
+ if (isset($pconf['style'])) { $out .= $pconf['style']; }
+ $out .= '</style>';
+ $out .= '</head>';
+ $out .= '<body>';
+
+ $out .= '<h1>'.$ptitle.'</h1>';
+ $out .= '<p class="intro">The following RRD stats are available:</p>';
+
+ $out .= '<ul class="indexlist">';
+ $snames = array(); $s_exclude = array();
+ $stats = array(); $sfiles = array();
+ if (isset($pconf['index_ids'])) {
+ foreach (explode(',', $pconf['index_ids']) as $iid) {
+ if ($iid{0} == '-') { $s_exclude[] = substr($iid, 1); }
+ else { $snames[] = $iid; }
+ }
+ }
+ if (!isset($pconf['scan_config']) || $pconf['scan_config']) {
+ foreach ($this->config_all as $iname=>$rinfo) {
+ if (($iname != '*') && !(isset($rinfo['hidden']) && $rinfo['hidden']) &&
+ !(in_array($iname, $snames)) && !(in_array($iname, $s_exclude))) {
+ $snames[] = $iname;
+ }
+ }
+ }
+ foreach ($snames as $iname) {
+ $newstat = array('name'=>$iname);
+ $sfiles[] = isset($this->config_all[$iname]['file'])?$this->config_all[$iname]['file']:$iname.'.rrd';
+ foreach ($this->config_all[$iname] as $key=>$val) {
+ if (substr($key, 0, 5) == 'page.') { $newstat['sub'][] = substr($key, 5); }
+ }
+ $stats[] = $newstat;
+ }
+ if (isset($pconf['scan_files']) && $pconf['scan_files']) {
+ $rrdfiles = glob('*.rrd');
+ foreach ($rrdfiles as $rrdfile) {
+ $iname = (substr($rrdfile, -4) == '.rrd')?substr($rrdfile, 0, -4):$rrdfile;
+ if (!in_array($rrdfile, $sfiles) && !(in_array($iname, $s_exclude))) {
+ $stats[] = array('name'=>$iname, 'class'=>'scanfile');
+ }
+ }
+ }
+ foreach ($stats as $stat) {
+ $out .= '<li'.(isset($stat['class'])?' class="'.$stat['class'].'"':'').'>';
+ $surl = '?stat='.$stat['name'];
+ $out .= '<a href="'.$surl.'">'.$stat['name'].'</a>';
+ if (isset($stat['sub']) && count($stat['sub'])) {
+ $sprt = array();
+ foreach ($stat['sub'] as $ssub) { $sprt[] = '<a href="'.$surl.'&sub='.$ssub.'">'.$ssub.'</a>'; }
+ $out .= ' <span="subs">('.implode(', ', $sprt).')</span>';
+ }
+ $out .= '</li>';
+ }
+ $out .= '</ul>';
+
+ $out .= '<p class="footer">';
+ $out .= 'Statistics created by <a href="http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/">RRDtool</a>';
+ $out .= ' using a library created by <a href="http://www.kairo.at/">KaiRo.at</a>.';
+ $out .= '</p>';
+
+ $out .= '</body></html>';
+
+ return $out;
+ }
+
+ function page_overview($pconf, $graph_extras = null) {
+ // create an overview HTML page (including graphs) and return it in a string
+
+ return $this->page_index($pconf);
+ }
+
+ function page_simple($pconf, $graph_extras = null) {
+ // create a simple (MRTG-like) HTML page and return it in a string
+