From da5e89f320287726cfa276cf024a8a2b6e529643 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Thu, 7 Sep 2017 17:23:49 +0200 Subject: [PATCH] Support custom permission denied message --- com.woltlab.wcf/templates/permissionDenied.tpl | 6 +++++- .../system/exception/PermissionDeniedException.class.php | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) 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' -- 2.20.1