You are here

function mobile_tools_detection_boot in Mobile Tools 5

Being called in the hook_init() implementation This function is in charge of device detection, redirection or displaying a notification

1 call to mobile_tools_detection_boot()
mobile_tools_init in ./mobile_tools.module
Implementation of hook_boot().

File

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

Code

function mobile_tools_detection_boot() {
  global $base_url;
  $handling = variable_get('mobile_tools_handling', 0);
  if ($_SESSION['mobile-tools-mobile-device']['type'] != $_SESSION['mobile-tools-site-type']) {
    switch ($handling) {
      case 'redirect':

        //redirect
        $destination = $_SESSION['mobile-tools-mobile-device']['type'] == 'mobile' ? variable_get('mobile_tools_mobile_url', mobile_tools_create_mobile_url($base_url)) : variable_get('mobile_tools_desktop_url', $base_url);
        mobile_tools_goto($destination);
        break;
    }
  }
}