NobGit
public nobgit read

NobMail

Based on mailcow: dockerized

Languages

Repository composition by tracked source files.

PHP
PHP 49% JavaScript 35% HTML 9% CSS 4% Shell 2% Python 1% Lua 0% Perl 0% Ruby 0% SCSS 0%
Create file Wiki Documentation
Clone
https://nobgit.com/orgs/nobgit/nobmail.git
ssh://[email protected]:2222/orgs/nobgit/nobmail.git

Commit

[web] fixed html in alerts

Signed-off-by: Kristian Feldsam <[email protected]>

08f8eeb2
Kristian Feldsam <[email protected]> 4 years, 8 months ago
data/web/inc/footer.inc.php  | 3 ++-
 data/web/templates/base.twig | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

Diff

diff --git a/data/web/inc/footer.inc.php b/data/web/inc/footer.inc.php
index 4a66d466..9c08c663 100644
--- a/data/web/inc/footer.inc.php
+++ b/data/web/inc/footer.inc.php
@@ -12,7 +12,8 @@ $alertbox_log_parser = alertbox_log_parser($_SESSION);
 $alerts = [];
 if (is_array($alertbox_log_parser)) {
   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));
   foreach($alert as $alert_type => $alert_msg) {
diff --git a/data/web/templates/base.twig b/data/web/templates/base.twig
index 32b5f405..79042d59 100644
--- a/data/web/templates/base.twig
+++ b/data/web/templates/base.twig
@@ -172,7 +172,7 @@ function recursiveBase64StrToArrayBuffer(obj) {
     // TFA, CSRF, Alerts in footer.inc.php
     // Other general functions in mailcow.js
     {% 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 %}
 
     // Confirm TFA modal