Fix logic bugs and strip %%

This commit is contained in:
f0o
2015-05-11 13:02:40 +00:00
parent 651f9d9d87
commit a8e5880423
2 changed files with 4 additions and 3 deletions

View File

@@ -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);