From: Tim Düsterhus Date: Thu, 7 Sep 2017 15:23:49 +0000 (+0200) Subject: Support custom permission denied message X-Git-Tag: 3.1.0_Alpha_4~19 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=da5e89f320287726cfa276cf024a8a2b6e529643;p=GitHub%2FWoltLab%2FWCF.git Support custom permission denied message --- diff --git a/com.woltlab.wcf/templates/permissionDenied.tpl b/com.woltlab.wcf/templates/permissionDenied.tpl index 15ef266d92..ccd0e512fb 100644 --- a/com.woltlab.wcf/templates/permissionDenied.tpl +++ b/com.woltlab.wcf/templates/permissionDenied.tpl @@ -4,7 +4,11 @@ {include file='header' __disableAds=true}
-

{lang}wcf.page.error.permissionDenied{/lang}

+ {if $message|isset} +

{$message}

+ {else} +

{lang}wcf.page.error.permissionDenied{/lang}

+ {/if}
{event name='content'} diff --git a/wcfsetup/install/files/lib/system/exception/PermissionDeniedException.class.php b/wcfsetup/install/files/lib/system/exception/PermissionDeniedException.class.php index 2b0cf43108..15b0a86c20 100644 --- a/wcfsetup/install/files/lib/system/exception/PermissionDeniedException.class.php +++ b/wcfsetup/install/files/lib/system/exception/PermissionDeniedException.class.php @@ -19,8 +19,9 @@ class PermissionDeniedException extends UserException { /** * Creates a new PermissionDeniedException object. */ - public function __construct() { - parent::__construct(WCF::getLanguage()->getDynamicVariable('wcf.page.error.permissionDenied')); + public function __construct($message = null) { + if ($message === null) $message = WCF::getLanguage()->getDynamicVariable('wcf.page.error.permissionDenied'); + parent::__construct($message); } /** @@ -39,6 +40,7 @@ class PermissionDeniedException extends UserException { 'name' => get_class($this), 'file' => $this->getFile(), 'line' => $this->getLine(), + 'message' => $this->getMessage(), 'stacktrace' => $this->getTraceAsString(), 'templateName' => 'permissionDenied', 'templateNameApplication' => 'wcf'