Error pages no longer load special box layouts
authorMarcel Werk <burntime@woltlab.com>
Tue, 11 Oct 2016 16:10:34 +0000 (18:10 +0200)
committerMarcel Werk <burntime@woltlab.com>
Tue, 11 Oct 2016 16:10:34 +0000 (18:10 +0200)
Fixes #2115

wcfsetup/install/files/lib/system/box/BoxHandler.class.php
wcfsetup/install/files/lib/system/exception/NamedUserException.class.php
wcfsetup/install/files/lib/system/exception/PermissionDeniedException.class.php

index d35fab4d2aa58220ba141d9457a7d31b2c592228..09320cebed30c9532a2fb725c316d363e3586134 100644 (file)
@@ -36,14 +36,21 @@ class BoxHandler extends SingletonFactory {
         */
        protected $boxesByPosition = [];
        
+       /**
+        * @var bool
+        */
+       protected $disablePageLayout = false;
+       
        /**
         * @inheritDoc
         */
        protected function init() {
                // get active page id
                $pageID = 0;
-               if (($request = RequestHandler::getInstance()->getActiveRequest()) !== null) {
-                       $pageID = $request->getPageID();
+               if (!$this->disablePageLayout) {
+                       if (($request = RequestHandler::getInstance()->getActiveRequest()) !== null) {
+                               $pageID = $request->getPageID();
+                       }
                }
                
                // load box layout for active page
@@ -192,4 +199,11 @@ class BoxHandler extends SingletonFactory {
                        }
                }
        }
+       
+       /**
+        * Disables the loading of the box layout for the active page.
+        */
+       public function disablePageLayout() {
+               $this->disablePageLayout = true;
+       }
 }
index 473bac5a4ebf0409c9b10bf75a898f83d6433bec..258ff7eb6a4965842449321351a0113a54cb88b2 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\exception;
+use wcf\system\box\BoxHandler;
 use wcf\system\session\SessionHandler;
 use wcf\system\WCF;
 
@@ -16,6 +17,7 @@ class NamedUserException extends UserException {
         * Shows a styled page with the given error message.
         */
        public function show() {
+               BoxHandler::getInstance()->disablePageLayout();
                SessionHandler::getInstance()->disableTracking();
                
                WCF::getTPL()->assign([
index 555b55ae945fea769e9309e573ff3b146287a513..d2fe446972da8a93a8002a72d06084268dca762b 100644 (file)
@@ -1,5 +1,6 @@
 <?php
 namespace wcf\system\exception;
+use wcf\system\box\BoxHandler;
 use wcf\system\session\SessionHandler;
 use wcf\system\WCF;
 
@@ -24,6 +25,7 @@ class PermissionDeniedException extends UserException {
         * Prints a permission denied exception.
         */
        public function show() {
+               BoxHandler::getInstance()->disablePageLayout();
                SessionHandler::getInstance()->disableTracking();
                
                @header('HTTP/1.0 403 Forbidden');