From af28fae6e9e27184b52c6b26637c9e7e0feb428d Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Sat, 16 Feb 2013 19:36:15 +0100 Subject: [PATCH] Fixed offline mode for AJAX requests --- .../lib/system/request/RequestHandler.class.php | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php index 6c49d06fb6..fb096083f9 100644 --- a/wcfsetup/install/files/lib/system/request/RequestHandler.class.php +++ b/wcfsetup/install/files/lib/system/request/RequestHandler.class.php @@ -1,5 +1,6 @@ * @package com.woltlab.wcf * @subpackage system.request @@ -50,10 +51,16 @@ class RequestHandler extends SingletonFactory { // handle offline mode if (!$isACPRequest && defined('OFFLINE') && OFFLINE) { if (!WCF::getSession()->getPermission('admin.general.canViewPageDuringOfflineMode') && !$this->activeRequest->isAvailableDuringOfflineMode()) { - WCF::getTPL()->assign(array( - 'templateName' => 'offline' - )); - WCF::getTPL()->display('offline'); + if (isset($_SERVER['X-Requested-With']) && ($_SERVER['X-Requested-With'] == 'XMLHttpRequest')) { + throw new AJAXException(WCF::getLanguage()->get('wcf.global.ajax.error.permissionDenied'), AJAXException::INSUFFICIENT_PERMISSIONS); + } + else { + WCF::getTPL()->assign(array( + 'templateName' => 'offline' + )); + WCF::getTPL()->display('offline'); + } + exit; } } -- 2.20.1