From 82d064f49d1504d936007f150bcc4f12d29cc44f Mon Sep 17 00:00:00 2001 From: robert Date: Fri, 27 May 2005 21:09:49 +0000 Subject: [PATCH] make graph_url work correctly, add stats_url parameters to get index links more flexible, fix some notices, make 'L' detection better, fix some warnings, allow desc on rrd_field, correct basename (no path in there) --- include/classes/rrdstat.php-class | 33 ++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) diff --git a/include/classes/rrdstat.php-class b/include/classes/rrdstat.php-class index 5e8cc66..ea32b52 100644 --- a/include/classes/rrdstat.php-class +++ b/include/classes/rrdstat.php-class @@ -200,7 +200,7 @@ class rrdstat { } elseif (isset($iinfo['file'])) { $this->rrd_file = (($iinfo['file']{0} != '/')?$this->basedir:'').$iinfo['file']; - $this->basename = (substr($this->rrd_file, -4) == '.rrd')?substr($this->rrd_file, 0, -4):$this->rrd_file; + $this->basename = basename((substr($this->rrd_file, -4) == '.rrd')?substr($this->rrd_file, 0, -4):$this->rrd_file); } elseif (!is_null($conf_id) && file_exists($conf_id.'.rrd')) { $this->rrd_file = (($iinfo['file']{0} != '/')?$this->basedir:'').$conf_id.'.rrd'; @@ -354,7 +354,7 @@ class rrdstat { } } $key_names = (!is_numeric(array_shift(array_keys($upvals)))); - if (in_array('L', $upvals)) { + if (in_array('L', $upvals, true)) { // for at least one value, we need to set the same as the last recorded value $fvals = $this->fetch(); $rowids = array_shift($fvals); @@ -563,6 +563,7 @@ class rrdstat { $grow['legend'] = $ds['legend']; if (!isset($gconf['show_legend'])) { $gconf['show_legend'] = true; } } + if (isset($ds['desc'])) { $grow['desc'] = $ds['desc']; } $graphrows[] = $grow; } } @@ -707,7 +708,7 @@ class rrdstat { $pconf = $pconf + (array)$this->config_page; $return = null; - switch ($pconf['type']) { + switch (@$pconf['type']) { case 'index': $return = $this->page_index($pconf); break; @@ -765,14 +766,27 @@ class rrdstat { $stats = $this->h_page_statsArray($pconf); + if (isset($pconf['stats_url'])) { $sURL_base = $pconf['stats_url']; } + else { $sURL_base = '?stat=%i%a'; } + + if (isset($pconf['stats_url_add'])) { $sURL_add = $pconf['stats_url_add']; } + else { $sURL_add = '&sub=%s'; } + $out .= '