Index: mobile_tools.module =================================================================== --- mobile_tools.module (revision 1454) +++ mobile_tools.module (working copy) @@ -272,13 +272,13 @@ if (!$page_match) { // The case where a mobile user is accessing the desktop site if ($device['type'] == 'mobile' && $current_url_type == 'desktop') { - $destination_url = mobile_tools_get_redirect_url('mobile'); - mobile_tools_goto($destination_url); + $destination_url = mobile_tools_get_redirect_url('mobile'); + mobile_tools_goto($destination_url); // The case where a desktop user is accessing the mobile site } elseif ($device['type'] == 'desktop' && $current_url_type == 'mobile') { - $destination_url = mobile_tools_get_redirect_url('desktop'); - mobile_tools_goto($destination_url); + $destination_url = mobile_tools_get_redirect_url('desktop'); + mobile_tools_goto($destination_url); } } } @@ -323,7 +323,7 @@ return $mobile_tools_device; } // Checking the possible arguments - $session_time = REQUEST_TIME + variable_get('mobile_tools_cookie_session', 3600 * 24 * 30); + $session_time = $_SERVER['REQUEST_TIME'] + variable_get('mobile_tools_cookie_session', 3600 * 24 * 30); //first check if the device type is forced in the device argument if (isset($_GET['device'])){ switch ($_GET['device']) { @@ -333,23 +333,25 @@ return array('type' => $_GET['device'], 'group' => ''); break; case 'auto': - setCookie('mt_device', '', REQUEST_TIME - 3600, '/', $cookie_domain); + setCookie('mt_device', '', $_SERVER['REQUEST_TIME'] - 3600, '/', $cookie_domain); break; default: $device_groups = mobile_tools_device_groups(); if(isset($device_groups[$_GET['device']])){ + $_COOKIE['mt_device'] = $_GET['device']; setCookie('mt_device', $_GET['device'], variable_get('mobile_tools_cookie_lifetime', $session_time) , '/', $cookie_domain); return array('type' => 'mobile', 'group' => $_GET['device']); } } - } elseif(isset($_COOKIE['mt_device'])){ + } + elseif(isset($_COOKIE['mt_device'])){ switch ($_COOKIE['mt_device']) { case 'desktop': case 'mobile': return array('type' => $_COOKIE['mt_device'], 'group' => ''); break; case 'auto': - setCookie('mt_device', '', REQUEST_TIME - 3600, '/'); + setCookie('mt_device', '', $_SERVER['REQUEST_TIME'] - 3600, '/'); break; default: $device_groups = mobile_tools_device_groups(); @@ -817,4 +819,4 @@ ), ), ); -} \ No newline at end of file +}