From 442ad51d8fec52690e46a4fd46a1d9dadf988651 Mon Sep 17 00:00:00 2001 From: misol Date: Sat, 21 Apr 2012 16:54:03 +0000 Subject: [PATCH] =?UTF-8?q?Issue=201774,=20fix=20for=20Android=20Opera=20M?= =?UTF-8?q?ini.=20reported=20by=20'=ED=95=98=EB=8A=98=EC=A2=85'=20http://w?= =?UTF-8?q?ww.xpressengine.com/freeboard/20708676?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10590 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/mobile/Mobile.class.php | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/classes/mobile/Mobile.class.php b/classes/mobile/Mobile.class.php index aac5b75ae..7353e0210 100644 --- a/classes/mobile/Mobile.class.php +++ b/classes/mobile/Mobile.class.php @@ -128,14 +128,29 @@ class Mobile { { static $UACheck; if(isset($UACheck)) return $UACheck; - $padAgent = array('iPad','webOS','hp-tablet','PlayBook'); + $padAgent = array('iPad','Android','webOS','hp-tablet','PlayBook'); + + // Android with 'Mobile' string is not a tablet-like device, and 'Andoroid' without 'Mobile' string is a tablet-like device. + $exceptionAgent = array(0 =>'Opera Mini','Android' => 'Mobile'); foreach($padAgent as $agent) { if(strpos($_SERVER['HTTP_USER_AGENT'], $agent) !== FALSE) { - $UACheck = TRUE; - return TRUE; + if(!isset($exceptionAgent[$agent])) + { + $UACheck = TRUE; + return TRUE; + } + elseif(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[$agent]) === FALSE) + { + // Agent is the Android Opera Mini, it does not have 'Mobile' string. + if(strpos($_SERVER['HTTP_USER_AGENT'], $exceptionAgent[0]) === FALSE) + { + $UACheck = TRUE; + return TRUE; + } + } } }