From: Alexander Ebert Date: Tue, 15 Aug 2017 15:34:51 +0000 (+0200) Subject: Fixed displayed error messages X-Git-Tag: 3.1.0_Alpha_1~25 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=312bb4b3ef24fda88a07f8f740715da6704c65bc;p=GitHub%2FWoltLab%2FWCF.git Fixed displayed error messages --- diff --git a/wcfsetup/install/files/js/WCF.Message.js b/wcfsetup/install/files/js/WCF.Message.js index 148a853856..53427a76ed 100644 --- a/wcfsetup/install/files/js/WCF.Message.js +++ b/wcfsetup/install/files/js/WCF.Message.js @@ -497,7 +497,9 @@ if (COMPILER_TARGET_DEFAULT) { $innerError = $('').appendTo(this._textarea.parent()); } - $innerError.html((data.returnValues.errorType === 'empty' ? WCF.Language.get('wcf.global.form.error.empty') : data.returnValues.errorMessage)); + var message = (data.returnValues.errorType === 'empty' ? WCF.Language.get('wcf.global.form.error.empty') : data.returnValues.errorMessage); + if (data.returnValues.realErrorMessage) message = data.returnValues.realErrorMessage; + $innerError.html(message); return false; } diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js index 45ba8725d2..b8f6dc738c 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/InlineEditor.js @@ -696,7 +696,7 @@ define( this._restoreEditor(); //noinspection JSUnresolvedVariable - if (!data || data.returnValues === undefined || data.returnValues.errorType === undefined) { + if (!data || data.returnValues === undefined || data.returnValues.realErrorMessage === undefined) { return true; } @@ -709,7 +709,7 @@ define( } //noinspection JSUnresolvedVariable - innerError.textContent = data.returnValues.errorType; + innerError.textContent = data.returnValues.realErrorMessage; return false; }, diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js index 272f1e8b94..959ec965cb 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Ui/Message/Reply.js @@ -283,7 +283,7 @@ define(['Ajax', 'Core', 'EventHandler', 'Language', 'Dom/ChangeListener', 'Dom/U */ _handleError: function(data) { //noinspection JSUnresolvedVariable - this.throwError(this._textarea, data.returnValues.errorType); + this.throwError(this._textarea, data.returnValues.realErrorMessage); }, /** @@ -397,7 +397,7 @@ define(['Ajax', 'Core', 'EventHandler', 'Language', 'Dom/ChangeListener', 'Dom/U this._hideLoadingOverlay(); //noinspection JSUnresolvedVariable - if (data === null || data.returnValues === undefined || data.returnValues.errorType === undefined) { + if (data === null || data.returnValues === undefined || data.returnValues.realErrorMessage === undefined) { return true; } diff --git a/wcfsetup/install/files/lib/system/exception/ValidateActionException.class.php b/wcfsetup/install/files/lib/system/exception/ValidateActionException.class.php index a3492182fc..bd61d92cb0 100644 --- a/wcfsetup/install/files/lib/system/exception/ValidateActionException.class.php +++ b/wcfsetup/install/files/lib/system/exception/ValidateActionException.class.php @@ -29,7 +29,9 @@ class ValidateActionException extends \Exception { public function __construct($fieldName, $errorMessage = 'empty', array $variables = []) { $this->errorMessage = $errorMessage; if (mb_strpos($this->errorMessage, '.') === false) { - $this->errorMessage = WCF::getLanguage()->get('wcf.global.form.error.'.$this->errorMessage); + if (preg_match('~^([a-zA-Z0-9-_]+\.)+[a-zA-Z0-9-_]+$~', $this->errorMessage)) { + $this->errorMessage = WCF::getLanguage()->get('wcf.global.form.error.'.$this->errorMessage); + } } else { $this->errorMessage = WCF::getLanguage()->getDynamicVariable($this->errorMessage, $variables);