From: Alexander Ebert Date: Wed, 12 Feb 2014 20:39:18 +0000 (+0100) Subject: Improved AJAX error messages X-Git-Tag: 2.0.3~47 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=12afec7defc7613162f617c7e4bc18570fcaaeab;p=GitHub%2FWoltLab%2FWCF.git Improved AJAX error messages --- diff --git a/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php b/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php index aa523b61c7..18f6da8ef3 100644 --- a/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php +++ b/wcfsetup/install/files/lib/action/AJAXInvokeAction.class.php @@ -12,6 +12,7 @@ use wcf\system\WCF; use wcf\util\ClassUtil; use wcf\util\JSON; use wcf\util\StringUtil; +use wcf\system\exception\InvalidSecurityTokenException; /** * Default implementation for AJAX-based method calls. @@ -158,7 +159,7 @@ class AJAXInvokeAction extends AbstractSecureAction { throw $e; } - if ($e instanceof IllegalLinkException) { + if ($e instanceof InvalidSecurityTokenException) { throw new AJAXException(WCF::getLanguage()->get('wcf.ajax.error.sessionExpired'), AJAXException::SESSION_EXPIRED, $e->getTraceAsString()); } else if ($e instanceof PermissionDeniedException) { @@ -167,6 +168,9 @@ class AJAXInvokeAction extends AbstractSecureAction { else if ($e instanceof SystemException) { throw new AJAXException($e->getMessage(), AJAXException::INTERNAL_ERROR, $e->__getTraceAsString(), array(), $e->getExceptionID()); } + else if ($e instanceof IllegalLinkException) { + throw new AJAXException(WCF::getLanguage()->get('wcf.ajax.error.illegalLink'), AJAXException::ILLEGAL_LINK, $e->getTraceAsString()); + } else if ($e instanceof UserInputException) { // repackage as ValidationActionException $exception = new ValidateActionException($e->getField(), $e->getType(), $e->getVariables()); diff --git a/wcfsetup/install/files/lib/action/AbstractSecureAction.class.php b/wcfsetup/install/files/lib/action/AbstractSecureAction.class.php index 489f9df0d1..4dd8add3e6 100644 --- a/wcfsetup/install/files/lib/action/AbstractSecureAction.class.php +++ b/wcfsetup/install/files/lib/action/AbstractSecureAction.class.php @@ -1,6 +1,6 @@ checkSecurityToken($_REQUEST['t'])) { - throw new IllegalLinkException(); + throw new InvalidSecurityTokenException(); } } } diff --git a/wcfsetup/install/files/lib/system/exception/AJAXException.class.php b/wcfsetup/install/files/lib/system/exception/AJAXException.class.php index ed89d91e9a..854b41f905 100644 --- a/wcfsetup/install/files/lib/system/exception/AJAXException.class.php +++ b/wcfsetup/install/files/lib/system/exception/AJAXException.class.php @@ -7,7 +7,7 @@ use wcf\util\JSON; * AJAXException provides JSON-encoded exceptions. * * @author Alexander Ebert - * @copyright 2001-2013 WoltLab GmbH + * @copyright 2001-2014 WoltLab GmbH * @license GNU Lesser General Public License * @package com.woltlab.wcf * @subpackage system.exception @@ -32,6 +32,12 @@ class AJAXException extends LoggedException { */ const INSUFFICIENT_PERMISSIONS = 403; + /** + * illegal link + * @var integer + */ + const ILLEGAL_LINK = 404; + /** * bad parameters * @var integer diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index a2b24facb1..a7cb41a19f 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1374,6 +1374,7 @@ Wenn Sie unter System -> Optionen -> Allgemein -> E-Mails alle + @@ -1789,6 +1790,8 @@ Fehler sind beispielsweise: + + diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 46adc49c5d..ea6afdc846 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1374,6 +1374,7 @@ You can define the default sender in System -> Options -> General -> + @@ -1788,6 +1789,8 @@ Errors are: + +