From: Alexander Ebert Date: Fri, 10 Feb 2012 15:08:27 +0000 (+0100) Subject: i18n handler now properly validates all languages X-Git-Tag: 2.0.0_Beta_1~1358^2~5 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=470e23e35d22ac11f1853273713f5fc6918bf003;p=GitHub%2FWoltLab%2FWCF.git i18n handler now properly validates all languages Fixes #418 --- diff --git a/wcfsetup/install/files/lib/system/language/I18nHandler.class.php b/wcfsetup/install/files/lib/system/language/I18nHandler.class.php index 1699e24d45..5ed59ada00 100644 --- a/wcfsetup/install/files/lib/system/language/I18nHandler.class.php +++ b/wcfsetup/install/files/lib/system/language/I18nHandler.class.php @@ -23,6 +23,12 @@ class I18nHandler extends SingletonFactory { */ protected $assignValueVariablesDisabled = false; + /** + * list of available languages + * @var array + */ + protected $availableLanguages = array(); + /** * list of element ids * @var array @@ -47,6 +53,13 @@ class I18nHandler extends SingletonFactory { */ protected $elementOptions = array(); + /** + * @see wcf\system\SingletonFactory::init() + */ + protected function init() { + $this->availableLanguages = LanguageFactory::getInstance()->getLanguages(); + } + /** * Registers a new element id, returns false if element id is already set. * @@ -140,8 +153,12 @@ class I18nHandler extends SingletonFactory { return false; } else { - foreach ($this->i18nValues[$elementID] as $value) { - if (empty($value)) { + foreach ($this->availableLanguages as $language) { + if (!isset($this->i18nValues[$elementID][$language->languageID])) { + return false; + } + + if (empty($this->i18nValues[$elementID][$language->languageID])) { return false; } } @@ -327,7 +344,7 @@ class I18nHandler extends SingletonFactory { } WCF::getTPL()->assign(array( - 'availableLanguages' => LanguageFactory::getInstance()->getLanguages(), + 'availableLanguages' => $this->availableLanguages, 'i18nPlainValues' => $elementValues, 'i18nValues' => $elementValuesI18n ));