From 882144a0f97eb3fa54552f0a78970a1c09d7c41e Mon Sep 17 00:00:00 2001 From: Pim van den Berg Date: Sun, 4 Aug 2013 15:19:42 +0200 Subject: type/default: double escape colon in legend/filename when not using canvas Since commit v0.3-97-g5793a8c [integrate jsrrdgraph in CGP], double quotes have been removed around filenames and legend because it shouldn't be necessary (and jsrrdgraph didn't support it). This broke graphs rendered by rrdtool with files including a colon in it's name. Hopefully this is fixed now by double escaping them. Reported-by: Poil (https://github.com/pommi/CGP/issues/20) --- type/Default.class.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'type') diff --git a/type/Default.class.php b/type/Default.class.php index 416a352..01718e4 100644 --- a/type/Default.class.php +++ b/type/Default.class.php @@ -111,7 +111,13 @@ class Type_Default { } function rrd_escape($value) { - return str_replace(':', '\:', $value); + if ($this->graph_type == 'canvas') { + # http://oss.oetiker.ch/rrdtool/doc/rrdgraph_graph.en.html#IEscaping_the_colon + return str_replace(':', '\:', $value); + } else { + # php needs it double escaped to execute rrdtool correctly + return str_replace(':', '\\\:', $value); + } } function parse_filename($file) { -- cgit v1.1