Fix default template assignment

This commit is contained in:
f0o
2015-08-30 17:07:02 +01:00
parent ac7d0c9420
commit 9057d48273
+5 -2
View File
@@ -343,7 +343,8 @@ function ExtTransports($obj) {
* @return string * @return string
*/ */
function FormatAlertTpl($obj) { function FormatAlertTpl($obj) {
$msg = '$ret .= "'.str_replace(array('{else}', '{/if}', '{/foreach}'), array('"; } else { $ret .= "', '"; } $ret .= "', '"; } $ret .= "'), addslashes($obj["template"])).'";'; $tpl = $obj["template"];
$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;
@@ -421,7 +422,9 @@ function DescribeAlert($alert) {
$obj['device_id'] = $alert['device_id']; $obj['device_id'] = $alert['device_id'];
$extra = $alert['details']; $extra = $alert['details'];
if (!isset($tpl['template'])) { if (!isset($tpl['template'])) {
$tpl['template'] = $default_tpl; $obj['template'] = $default_tpl;
} else {
$obj['template'] = $tpl['template'];
} }
if ($alert['state'] >= 1) { if ($alert['state'] >= 1) {
if (!empty($tpl['title'])) { if (!empty($tpl['title'])) {