You are here

function _menu_site_is_offline in Drupal 4

Same name and namespace in other branches
  1. 5 includes/menu.inc \_menu_site_is_offline()
  2. 6 includes/menu.inc \_menu_site_is_offline()
  3. 7 includes/menu.inc \_menu_site_is_offline()

Returns TRUE if the site is off-line for maintenance.

1 call to _menu_site_is_offline()
menu_execute_active_handler in includes/menu.inc
Execute the handler associated with the active menu item.

File

includes/menu.inc, line 1344
API for the Drupal menu system.

Code

function _menu_site_is_offline() {

  // Check if site is set to off-line mode
  if (variable_get('site_offline', 0)) {

    // Check if the user has administration privileges
    if (!user_access('administer site configuration')) {

      // Check if this is an attempt to login
      if (drupal_get_normal_path($_GET['q']) != 'user') {
        return TRUE;
      }
    }
    else {
      $offline_message = t('Operating in off-line mode.');
      $messages = drupal_set_message();

      // Ensure that the off-line message is displayed only once [allowing for page redirects].
      if (!isset($messages) || !isset($messages['status']) || !in_array($offline_message, $messages['status'])) {
        drupal_set_message($offline_message);
      }
    }
  }
  return FALSE;
}