Browse Source

Fixed footer escaping

Patrik Kernstock 2 weeks ago
parent
commit
702ed85dfd
2 changed files with 10 additions and 2 deletions
  1. 5 1
      data/web/inc/header.inc.php
  2. 5 1
      data/web/js/build/013-mailcow.js

+ 5 - 1
data/web/inc/header.inc.php

@@ -62,7 +62,11 @@ if ($app_links_processed){
   }
   }
 }
 }
 
 
-
+// Workaround to get text with <br> straight to twig.
+// Using "nl2br" doesn't work with Twig as it would escape everything by default.
+if (isset($UI_TEXTS["ui_footer"])) {
+  $UI_TEXTS["ui_footer"] = nl2br($UI_TEXTS["ui_footer"]);
+}
 
 
 $globalVariables = [
 $globalVariables = [
   'mailcow_hostname' => getenv('MAILCOW_HOSTNAME'),
   'mailcow_hostname' => getenv('MAILCOW_HOSTNAME'),

+ 5 - 1
data/web/js/build/013-mailcow.js

@@ -48,7 +48,11 @@ $(document).ready(function() {
     })
     })
   }
   }
   $(".rot-enc").html(function(){
   $(".rot-enc").html(function(){
-    return str_rot13($(this).text())
+    footer_html = $(this).html();
+    footer_html = footer_html.replace(/&lt;/g, '<').replace(/&gt;/g, '>')
+                             .replace(/&amp;/g, '&').replace(/&nzc;/g, '&')
+                             .replace(/&quot;/g, '"').replace(/&#x27;/g, "'");
+    return str_rot13(footer_html)
   });
   });
   // https://stackoverflow.com/questions/4399005/implementing-jquerys-shake-effect-with-animate
   // https://stackoverflow.com/questions/4399005/implementing-jquerys-shake-effect-with-animate
   function shake(div,interval,distance,times) {
   function shake(div,interval,distance,times) {