From a8e5880423c5962dcc125cf3cb0106ffcc40fe7c Mon Sep 17 00:00:00 2001 From: f0o Date: Mon, 11 May 2015 13:02:40 +0000 Subject: [PATCH] Fix logic bugs and strip %% --- html/includes/graphs/common.inc.php | 6 +++--- includes/rrdtool.inc.php | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/html/includes/graphs/common.inc.php b/html/includes/graphs/common.inc.php index 31f4d9e12ae8..d2e27f00e8a7 100644 --- a/html/includes/graphs/common.inc.php +++ b/html/includes/graphs/common.inc.php @@ -7,9 +7,9 @@ if ($_GET['height']) { $height = mres($_GET['height']); } if ($_GET['inverse']) { $in = 'out'; $out = 'in'; $inverse=TRUE; } else { $in = 'in'; $out = 'out'; } if ($_GET['legend'] == "no") { $rrd_options .= " -g"; } -if ($_GET['nototal']) { $nototal=TRUE;} else { $nototal=FALSE;} -if ($_GET['nodetails']) { $nodetails=TRUE; } else { $nodetails=FALSE; } -if ($_GET['noagg']) { $noagg=TRUE; } else { $noagg=FALSE; } +if (empty($_GET['nototal'])) { $nototal=TRUE; } else { $nototal=FALSE; } +if (empty($_GET['nodetails'])) { $nodetails=TRUE; } else { $nodetails=FALSE; } +if (empty($_GET['noagg'])) { $noagg=TRUE; } else { $noagg=FALSE; } if ($_GET['title'] == "yes") { $rrd_options .= " --title='".$graph_title."' "; } if (isset($_GET['graph_title'])) { $rrd_options .= " --title='".$_GET['graph_title']."' "; } diff --git a/includes/rrdtool.inc.php b/includes/rrdtool.inc.php index 7938eaf80e1c..d1562ac685a7 100644 --- a/includes/rrdtool.inc.php +++ b/includes/rrdtool.inc.php @@ -257,6 +257,7 @@ function rrdtool_lastupdate($filename, $options) function rrdtool_escape($string, $maxlength = NULL) { $result = shorten_interface_type($string); + $result = str_replace('%','%%',$result); if ( is_numeric($maxlength) ) { $extra = substr_count($string,':',0,$maxlength); $result = substr(str_pad($result, $maxlength),0,$maxlength+$extra);