Fixed encoding issues
authorMarcel Werk <burntime@woltlab.com>
Mon, 22 Jul 2013 13:47:56 +0000 (15:47 +0200)
committerMarcel Werk <burntime@woltlab.com>
Mon, 22 Jul 2013 13:47:56 +0000 (15:47 +0200)
com.woltlab.wcf/templates/offline.tpl
com.woltlab.wcf/templates/userNotice.tpl
wcfsetup/install/files/lib/system/template/plugin/NewlineToBreakModifierTemplatePlugin.class.php [new file with mode: 0644]

index 8c317e3c1f4dc8b2d709f958c1d011d184b3c7dc..1fcd65077e6e2d75f7ca2f2aff121c612fd1c870 100644 (file)
@@ -12,7 +12,7 @@
 
 <div class="warning">
        <p><strong>{lang}wcf.page.offline{/lang}</strong></p>
-       <p>{if OFFLINE_MESSAGE_ALLOW_HTML}{@OFFLINE_MESSAGE|language}{else}{@OFFLINE_MESSAGE|language|htmlspecialchars|nl2br}{/if}</p>
+       <p>{if OFFLINE_MESSAGE_ALLOW_HTML}{@OFFLINE_MESSAGE|language}{else}{@OFFLINE_MESSAGE|language|newlineToBreak}{/if}</p>
 </div>
 
 {include file='footer'}
index 2e4e9ac9f051d9749fae5ef1679ed878ec099468..9f6dfb80df2ecb8dd05f7468d7111bf92181f115 100644 (file)
@@ -2,7 +2,7 @@
        {if OFFLINE && $__wcf->session->getPermission('admin.general.canViewPageDuringOfflineMode')}
                <div class="warning">
                        <p><strong>{lang}wcf.page.offline{/lang}</strong></p>
-                       <p>{if OFFLINE_MESSAGE_ALLOW_HTML}{@OFFLINE_MESSAGE|language}{else}{@OFFLINE_MESSAGE|language|htmlspecialchars|nl2br}{/if}</p>
+                       <p>{if OFFLINE_MESSAGE_ALLOW_HTML}{@OFFLINE_MESSAGE|language}{else}{@OFFLINE_MESSAGE|language|newlineToBreak}{/if}</p>
                </div>
        {/if}
        
diff --git a/wcfsetup/install/files/lib/system/template/plugin/NewlineToBreakModifierTemplatePlugin.class.php b/wcfsetup/install/files/lib/system/template/plugin/NewlineToBreakModifierTemplatePlugin.class.php
new file mode 100644 (file)
index 0000000..f5e82fb
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+namespace wcf\system\template\plugin;
+use wcf\system\template\TemplateEngine;
+use wcf\util\StringUtil;
+
+/**
+ * The 'newlineToBreak' modifier inserts HTML line breaks before all newlines.
+ * 
+ * @author     Marcel Werk
+ * @copyright  2001-2013 WoltLab GmbH
+ * @license    GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
+ * @package    com.woltlab.wcf
+ * @subpackage system.template.plugin
+ * @category   Community Framework
+ */
+class NewlineToBreakModifierTemplatePlugin implements IModifierTemplatePlugin {
+       /**
+        * @see wcf\system\template\IModifierTemplatePlugin::execute()
+        */
+       public function execute($tagArgs, TemplateEngine $tplObj) {
+               return nl2br(StringUtil::encodeHTML($tagArgs[0]));
+       }
+}