Fixed encoding issue for text input types
authorAlexander Ebert <ebert@woltlab.com>
Tue, 1 Aug 2017 09:43:19 +0000 (11:43 +0200)
committerAlexander Ebert <ebert@woltlab.com>
Tue, 1 Aug 2017 09:43:27 +0000 (11:43 +0200)
Fixes #2353

wcfsetup/install/files/lib/data/contact/option/ContactOptionAction.class.php
wcfsetup/install/files/lib/data/custom/option/CustomOption.class.php

index 88e09db585d6e5fc24cc3e2f61b7604cc7ac7f5e..f25dcc595af0bc36850ea678c2fab9a66168b0c9 100644 (file)
@@ -59,7 +59,7 @@ class ContactOptionAction extends CustomOptionAction {
                        $options[] = [
                                'isMessage' => $object->isMessage(),
                                'title' => $object->getLocalizedName($defaultLanguage),
-                               'value' => $object->getFormattedOptionValue()
+                               'value' => $object->getFormattedOptionValue(true)
                        ];
                }
                
index 1ec04892f5c045c3ff39926a9065081de01b4c5c..ec22b6601d58f8d834934f6d4b584311b445de54 100644 (file)
@@ -88,10 +88,11 @@ abstract class CustomOption extends Option {
        
        /**
         * Returns the formatted value of this option.
-        *
+        * 
+        * @param       boolean         $forcePlaintext
         * @return      string
         */
-       public function getFormattedOptionValue() {
+       public function getFormattedOptionValue($forcePlaintext = false) {
                switch ($this->optionType) {
                        case 'boolean':
                                return WCF::getLanguage()->get('wcf.acp.customOption.optionType.boolean.'.($this->optionValue ? 'yes' : 'no'));
@@ -128,15 +129,21 @@ abstract class CustomOption extends Option {
                                        }
                                }
                                return $result;
-                               
+                       
+                       /** @noinspection PhpMissingBreakStatementInspection */
                        case 'textarea':
-                               return SimpleMessageParser::getInstance()->parse($this->optionValue);
-                               
+                               if (!$forcePlaintext) return SimpleMessageParser::getInstance()->parse($this->optionValue);
+                               // fallthrough
+                       
+                       /** @noinspection PhpMissingBreakStatementInspection */
                        case 'message':
-                               return MessageParser::getInstance()->parse($this->optionValue);
-                               
+                               if (!$forcePlaintext) return MessageParser::getInstance()->parse($this->optionValue);
+                               // fallthrough
+                       
+                       /** @noinspection PhpMissingBreakStatementInspection */
                        case 'URL':
-                               return StringUtil::getAnchorTag($this->optionValue);
+                               if (!$forcePlaintext) return StringUtil::getAnchorTag($this->optionValue);
+                               // fallthrough
                                
                        default:
                                return StringUtil::encodeHTML($this->optionValue);