You are here

function hosting_init in Hosting 6.2

Same name and namespace in other branches
  1. 5 hosting.module \hosting_init()
  2. 7.4 hosting.module \hosting_init()
  3. 7.3 hosting.module \hosting_init()

Implementation of hook_init().

File

./hosting.module, line 296
Hosting module.

Code

function hosting_init() {

  // Definitions for the default platforms, clients etc.
  // Done to avoid using 'magic numbers'
  define('HOSTING_DEFAULT_CLIENT', variable_get('hosting_default_client', 1));
  define('HOSTING_DEFAULT_DB_SERVER', variable_get('hosting_default_db_server', 2));
  define('HOSTING_DEFAULT_WEB_SERVER', variable_get('hosting_default_web_server', 3));

  /**
   * This client has access to everything, see hosting_client.access.inc
   */
  define('HOSTING_ADMIN_CLIENT', variable_get('hosting_admin_client', 1));
  define('HOSTING_OWN_DB_SERVER', variable_get('hosting_own_db_server', 2));
  define('HOSTING_OWN_WEB_SERVER', variable_get('hosting_own_web_server', 3));
  define('HOSTING_OWN_PLATFORM', variable_get('hosting_own_platform', 6));

  /**
   * Find the base URL, this is used by the initial 'hosting-setup' drush command
   * This gets defined in the bootstrap, so just using the global definition.
   */
  define('HOSTING_DEFAULT_BASE_URL', $GLOBALS['base_url']);

  // moved from hook_menu()
  drupal_add_css(drupal_get_path('module', 'hosting') . '/hosting.css');

  // Redirect anonymous users to our default welcome page
  global $user;
  $welcome = variable_get('hosting_welcome_page', TRUE);
  if ($welcome && !user_is_logged_in() && php_sapi_name() != 'cli' && drupal_is_front_page()) {
    drupal_goto('welcome');
  }
}