From: Alexander Ebert Date: Fri, 10 Feb 2012 15:18:17 +0000 (+0100) Subject: i18n handler no longer enforce values for plain input X-Git-Tag: 2.0.0_Beta_1~1358^2~4 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5df4c77cd6ef9aaf04ed7591be4ccc9f5cb01843;p=GitHub%2FWoltLab%2FWCF.git i18n handler no longer enforce values for plain input Fixes #426 --- diff --git a/wcfsetup/install/files/lib/system/language/I18nHandler.class.php b/wcfsetup/install/files/lib/system/language/I18nHandler.class.php index 5ed59ada00..d9a9dcee17 100644 --- a/wcfsetup/install/files/lib/system/language/I18nHandler.class.php +++ b/wcfsetup/install/files/lib/system/language/I18nHandler.class.php @@ -141,10 +141,16 @@ class I18nHandler extends SingletonFactory { * * @param string $elementID * @param boolean $requireI18n + * @param boolean $permitEmptyValue * @return boolean */ - public function validateValue($elementID, $requireI18n = false) { + public function validateValue($elementID, $requireI18n = false, $permitEmptyValue = false) { if ($this->isPlainValue($elementID)) { + // plain values may be left empty + if ($permitEmptyValue) { + return true; + } + if ($requireI18n || $this->getValue($elementID) == '') { return false; } diff --git a/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php b/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php index dee53c4c8c..db02e6a440 100644 --- a/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/TextI18nOptionType.class.php @@ -40,7 +40,7 @@ class TextI18nOptionType extends TextOptionType { * @see wcf\system\option\IOptionType::validate() */ public function validate(Option $option, $newValue) { - if (!I18nHandler::getInstance()->validateValue($option->optionName, $option->requireI18n)) { + if (!I18nHandler::getInstance()->validateValue($option->optionName, $option->requireI18n, true)) { throw new UserInputException($option->optionName, 'validationFailed'); } } diff --git a/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php b/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php index 50eb0a9abb..71bb4ac62e 100644 --- a/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php +++ b/wcfsetup/install/files/lib/system/option/TextareaI18nOptionType.class.php @@ -39,7 +39,7 @@ class TextareaI18nOptionType extends TextareaOptionType { * @see wcf\system\option\IOptionType::validate() */ public function validate(Option $option, $newValue) { - if (!I18nHandler::getInstance()->validateValue($option->optionName, $option->requireI18n)) { + if (!I18nHandler::getInstance()->validateValue($option->optionName, $option->requireI18n, true)) { throw new UserInputException($option->optionName, 'validationFailed'); } }