From 136ec180844f059b4cb94704f6b3653c4654f198 Mon Sep 17 00:00:00 2001 From: Samuel Georges Date: Sat, 27 Feb 2016 22:39:26 +1100 Subject: [PATCH] This allows AJAX to function on maintenance and 404 pages --- modules/cms/classes/Controller.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/modules/cms/classes/Controller.php b/modules/cms/classes/Controller.php index 59e39d395..faa52da07 100644 --- a/modules/cms/classes/Controller.php +++ b/modules/cms/classes/Controller.php @@ -168,7 +168,10 @@ class Controller MaintenanceSettings::get('is_enabled', false) && !BackendAuth::getUser() ) { - $this->setStatusCode(503); + if (!Request::ajax()) { + $this->setStatusCode(503); + } + $page = Page::loadCached($this->theme, MaintenanceSettings::get('cms_page')); } @@ -191,7 +194,9 @@ class Controller * If the page was not found, render the 404 page - either provided by the theme or the built-in one. */ if (!$page || $url === '404') { - $this->setStatusCode(404); + if (!Request::ajax()) { + $this->setStatusCode(404); + } // Log the 404 request if (!App::runningUnitTests()) {