mirror of
https://github.com/stylersnico/librenms.git
synced 2026-07-30 16:14:21 +02:00
Revert "Don't escape single quotes in alert templates so that we can compare strings in if statements"
This reverts commit 124afc2054.
This commit is contained in:
+1
-13
@@ -359,18 +359,6 @@ function ExtTransports($obj) {
|
|||||||
}//end ExtTransports()
|
}//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
|
* Format Alert
|
||||||
* @param array $obj Alert-Array
|
* @param array $obj Alert-Array
|
||||||
@@ -378,7 +366,7 @@ function TplEscape($tpl) {
|
|||||||
*/
|
*/
|
||||||
function FormatAlertTpl($obj) {
|
function FormatAlertTpl($obj) {
|
||||||
$tpl = $obj["template"];
|
$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;
|
$parsed = $msg;
|
||||||
$s = strlen($msg);
|
$s = strlen($msg);
|
||||||
$x = $pos = -1;
|
$x = $pos = -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user