From 118b209042d078fdc9db01876643583ef9c40ff6 Mon Sep 17 00:00:00 2001 From: Kijin Sung Date: Mon, 31 Jul 2017 23:33:25 +0900 Subject: [PATCH] Add Context::isLocked() to detect site lock easily --- classes/context/Context.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 737ad9de8..d95b98ba8 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -152,6 +152,12 @@ class Context */ public $is_uploaded = FALSE; + /** + * Checks if the site is locked + * @var bool TRUE if the site is locked + */ + public $is_site_locked = FALSE; + /** * Pattern for request vars check * @var array @@ -1482,6 +1488,7 @@ class Context define('_XE_SITELOCK_TITLE_', config('lock.title') ?: self::getLang('admin.sitelock_in_use')); define('_XE_SITELOCK_MESSAGE_', config('lock.message')); unset($_SESSION['XE_VALIDATOR_RETURN_URL']); + self::$_instance->is_site_locked = true; // Load the sitelock template. if(FileHandler::exists(RX_BASEDIR . 'common/tpl/sitelock.user.html')) @@ -2472,6 +2479,16 @@ class Context return (bool)config('config_version'); } + /** + * Checks whether the site is locked + * + * @return bool True if the site is locked, otherwise false + */ + public static function isLocked() + { + return (bool)self::$_instance->is_site_locked; + } + /** * Transforms codes about widget or other features into the actual code, deprecatred *