prepare("SELECT * FROM `websettings` WHERE `maintenance` = 1"); $query->execute(); if ($query->rowCount() > 0) { return true; } return false; } public static function CanBypassMaintenance() { // Wouldn't really be a bypass per say, but you know, reusing existing code is better than // copying already existing code. if (!WebContextManager::IsUnderMaintenance()) return true; if ( !WebContextManager::CurrentUser->IsAdministrator() && !WebContextManager::IsCurrentIpAddressWhitelisted() ) return false; return true; } public static function IsCurrentIpAddressWhitelisted() { $currentIp = WebContextManager::GetCurrentIPAddress(); $ipWhitelist = []; // query from db return in_array($currentIp, $ipWhitelist); } private static PDO $pdo = $GLOBALS['pdo']; public static const $CurrentUser = new User(); } }