diff --git a/sites/all/modules/mobile_tools/mobile_tools.module b/sites/all/modules/mobile_tools/mobile_tools.module index f32be1b..231e43e 100755 --- a/sites/all/modules/mobile_tools/mobile_tools.module +++ b/sites/all/modules/mobile_tools/mobile_tools.module @@ -498,17 +498,22 @@ function _mobile_tools_site_detection() { return 'desktop'; } - // find longest url - $longest_url = strlen($mobile) > strlen($desktop) ? $mobile : $desktop ; - $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; - $uri = $protocol . $_SERVER['HTTP_HOST'] . request_uri(); - $pos = strpos($uri, preg_replace('{/$}', '', $longest_url)); - if ($pos === FALSE) { - return $longest_url == $mobile ? 'desktop' : 'mobile'; - } - else { - return $longest_url == $mobile ? 'mobile' : 'desktop'; - } + // Don't understand this code: We search for the longest URL? How can we say the longest URL is the mobile URL? + // Let's say our desktop url is domain.com and the mobile url is m.domain.com. Here, + // the shorter URL is the mobile site. +// $longest_url = strlen($mobile) > strlen($desktop) ? $mobile : $desktop ; +// $protocol = isset($_SERVER['HTTPS']) ? 'https://' : 'http://'; +// $uri = $protocol . $_SERVER['HTTP_HOST'] . request_uri(); +// $pos = strpos($uri, preg_replace('{/$}', '', $longest_url)); +// if ($pos === FALSE) { +// return $longest_url == $mobile ? 'desktop' : 'mobile'; +// } +// else { +// return $longest_url == $mobile ? 'mobile' : 'desktop'; +// } + + // If everything fails, we return desktop by default + return 'desktop'; } /**