From 94a182a396ac028bbd2c4e7e4c1c5df45777c78d Mon Sep 17 00:00:00 2001 From: Eldon Koyle Date: Mon, 7 Mar 2016 16:12:57 -0700 Subject: [PATCH] Revert "Don't escape single quotes in alert templates so that we can compare strings in if statements" This reverts commit 124afc2054529b080abd0b9629b0673edad279e9. --- alerts.php | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/alerts.php b/alerts.php index 0948045a9..fc27e130f 100755 --- a/alerts.php +++ b/alerts.php @@ -359,18 +359,6 @@ function ExtTransports($obj) { }//end ExtTransports() -/** - * Escape certain characters in template string - * @param string $tpl Template - * @return string - */ -function TplEscape($tpl) { - // theoretically like addslashes(), but don't escape single quote (') and do escape $ - // FIXME: is there still a way to break out of the double-quoted string, maybe with a unicode char? - return preg_replace('(["\\\\$\\0])','\\0',$tpl); -} - - /** * Format Alert * @param array $obj Alert-Array @@ -378,7 +366,7 @@ function TplEscape($tpl) { */ function FormatAlertTpl($obj) { $tpl = $obj["template"]; - $msg = '$ret .= "'.str_replace(array('{else}', '{/if}', '{/foreach}'), array('"; } else { $ret .= "', '"; } $ret .= "', '"; } $ret .= "'), TplEscape($tpl)).'";'; + $msg = '$ret .= "'.str_replace(array('{else}', '{/if}', '{/foreach}'), array('"; } else { $ret .= "', '"; } $ret .= "', '"; } $ret .= "'), addslashes($tpl)).'";'; $parsed = $msg; $s = strlen($msg); $x = $pos = -1;