You are here

function mobile_tools_boot in Mobile Tools 6

Same name and namespace in other branches
  1. 6.3 mobile_tools.module \mobile_tools_boot()
  2. 6.2 mobile_tools.module \mobile_tools_boot()

Implementation of hook_boot(). Hook boot is called for both anonymous users and logged in users

File

./mobile_tools.module, line 136
Mobile Tools provides a range of functionality assisting in creating a mobile Drupal site . this functionality contains:

Code

function mobile_tools_boot() {
  global $conf, $user, $base_url;

  // Get the device object
  $device = mobile_tools_get_device();

  // First call the redirect function. This will redirect the userif needed.
  if (variable_get('mobile_tools_redirect', FALSE)) {
    $redirected = mobile_tools_device_redirect($device);
  }

  // Switch theme if needed
  $theme_switched = mobile_tools_switch_theme($device);

  // Some small extras
  if (mobile_tools_is_mobile_site() == 'mobile' || $theme_switched) {
    $conf['default_nodes_main'] = variable_get('default_nodes_main_mobile', variable_get('default_nodes_main', 10));
    $conf['site_frontpage'] = variable_get('site_frontpage_mobile', variable_get('site_frontpage', 'node'));
  }

  // include the mobile tools roles file if the setting is enabled
  if (variable_get('mobile_tools_enable_roles', 0)) {
    include dirname(__FILE__) . '/mobile_tools_roles.inc';
    mobile_tools_roles_boot();

    // assigns the user the mobile role
  }
}