瀏覽代碼

[web] fixed html in alerts

Signed-off-by: Kristian Feldsam <feldsam@gmail.com>
Kristian Feldsam 3 年之前
父節點
當前提交
08f8eeb2e6
共有 2 個文件被更改,包括 3 次插入2 次删除
  1. 2 1
      data/web/inc/footer.inc.php
  2. 1 1
      data/web/templates/base.twig

+ 2 - 1
data/web/inc/footer.inc.php

@@ -12,7 +12,8 @@ $alertbox_log_parser = alertbox_log_parser($_SESSION);
 $alerts = [];
 $alerts = [];
 if (is_array($alertbox_log_parser)) {
 if (is_array($alertbox_log_parser)) {
   foreach ($alertbox_log_parser as $log) {
   foreach ($alertbox_log_parser as $log) {
-    $alerts[trim($log['type'], '"')][] = trim($log['msg'], '"');
+    $message = strtr($log['msg'], ["\n" => '', "\r" => '', "\t" => '<br>']);
+    $alerts[trim($log['type'], '"')][] = trim($message, '"');
   }
   }
   $alert = array_filter(array_unique($alerts));
   $alert = array_filter(array_unique($alerts));
   foreach($alert as $alert_type => $alert_msg) {
   foreach($alert as $alert_type => $alert_msg) {

+ 1 - 1
data/web/templates/base.twig

@@ -172,7 +172,7 @@ function recursiveBase64StrToArrayBuffer(obj) {
     // TFA, CSRF, Alerts in footer.inc.php
     // TFA, CSRF, Alerts in footer.inc.php
     // Other general functions in mailcow.js
     // Other general functions in mailcow.js
     {% for alert_type, alert_msg in alerts %}
     {% for alert_type, alert_msg in alerts %}
-    mailcow_alert_box('{{ alert_msg|raw|replace({"\n": "", "\r": "", "\t": "<br>"}) }}', '{{ alert_type }}');
+    mailcow_alert_box('{{ alert_msg|raw }}', '{{ alert_type }}');
     {% endfor %}
     {% endfor %}
 
 
     // Confirm TFA modal
     // Confirm TFA modal