/** * A convenience function to test if the site is marked as down according to the config panel. * This method includes handling the preference that indicates that site-down behaviour should * be disabled for certain IP address ranges. * * @return boolean */ function is_sitedown() { global $CMS_INSTALL_PAGE; if (isset($CMS_INSTALL_PAGE)) { return TRUE; } if (get_site_preference('enablesitedownmessage') !== '1') { return FALSE; } if (get_site_preference('sitedownexcludeadmins')) { $uid = get_userid(FALSE); if ($uid) { return FALSE; } } if (!isset($_SERVER['REMOTE_ADDR'])) { return TRUE; } $excludes = get_site_preference('sitedownexcludes', ''); if (empty($excludes)) { return TRUE; } $tmp = explode(',', $excludes); $ret = cms_ipmatches($_SERVER['REMOTE_ADDR'], $excludes); if ($ret) { return FALSE; } return TRUE; }
/** * A convenience function to test if the site is marked as down according to the config panel. * This method includes handling the preference that indicates that site-down behaviour should * be disabled for certain IP address ranges. * * @return boolean */ function is_sitedown() { if (get_site_preference('enablesitedownmessage') !== '1') { return FALSE; } $excludes = get_site_preference('sitedownexcludes', ''); if (!isset($_SERVER['REMOTE_ADDR'])) { return TRUE; } if (empty($excludes)) { return TRUE; } $ret = cms_ipmatches($_SERVER['REMOTE_ADDR'], $excludes); if ($ret) { return FALSE; } return TRUE; }