diff options
Diffstat (limited to 'type')
| -rw-r--r-- | type/Base.class.php | 12 | 
1 files changed, 9 insertions, 3 deletions
| diff --git a/type/Base.class.php b/type/Base.class.php index 90056cf..c47aba2 100644 --- a/type/Base.class.php +++ b/type/Base.class.php | |||
| @@ -6,6 +6,7 @@ class Type_Base { | |||
| 6 | var $datadir; | 6 | var $datadir; | 
| 7 | var $rrdtool; | 7 | var $rrdtool; | 
| 8 | var $rrdtool_opts = array(); | 8 | var $rrdtool_opts = array(); | 
| 9 | var $rrd_url; | ||
| 9 | var $cache; | 10 | var $cache; | 
| 10 | var $args; | 11 | var $args; | 
| 11 | var $seconds; | 12 | var $seconds; | 
| @@ -44,6 +45,7 @@ class Type_Base { | |||
| 44 | $config['rrdtool_opts']); | 45 | $config['rrdtool_opts']); | 
| 45 | } | 46 | } | 
| 46 | } | 47 | } | 
| 48 | $this->rrd_url = $config['rrd_url']; | ||
| 47 | $this->cache = $config['cache']; | 49 | $this->cache = $config['cache']; | 
| 48 | $this->parse_get($_get); | 50 | $this->parse_get($_get); | 
| 49 | $this->rrd_title = sprintf( | 51 | $this->rrd_title = sprintf( | 
| @@ -137,6 +139,9 @@ class Type_Base { | |||
| 137 | } | 139 | } | 
| 138 | 140 | ||
| 139 | function rrd_escape($value) { | 141 | function rrd_escape($value) { | 
| 142 | # In case people have really bizarre URLs in $CONFIG['rrd_url'], | ||
| 143 | # it should not be dropped. | ||
| 144 | return str_replace('\\', '\\\\', $value); | ||
| 140 | # http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html#IEscaping_the_colon | 145 | # http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html#IEscaping_the_colon | 
| 141 | return str_replace(':', '\:', $value); | 146 | return str_replace(':', '\:', $value); | 
| 142 | } | 147 | } | 
| @@ -144,10 +149,11 @@ class Type_Base { | |||
| 144 | function parse_filename($file) { | 149 | function parse_filename($file) { | 
| 145 | if ($this->graph_type == 'canvas') { | 150 | if ($this->graph_type == 'canvas') { | 
| 146 | $file = str_replace($this->datadir . '/', '', $file); | 151 | $file = str_replace($this->datadir . '/', '', $file); | 
| 147 | # rawurlencode all but / | 152 | $rrd_url = str_replace('{file}', $file, $this->rrd_url); | 
| 148 | $file = 'rrd.php?' . str_replace('%2F', '/', rawurlencode($file)); | 153 | $rrd_url = str_replace('{file_escaped}', | 
| 154 | urlencode($file), $rrd_url); | ||
| 149 | } | 155 | } | 
| 150 | return $this->rrd_escape($file); | 156 | return $this->rrd_escape($rrd_url); | 
| 151 | } | 157 | } | 
| 152 | 158 | ||
| 153 | function rrd_files() { | 159 | function rrd_files() { | 
