use cookie to identify mobile option

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7555 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
haneul 2010-06-28 07:05:50 +00:00
parent 901a0e8d01
commit 003b499c40

View file

@ -23,7 +23,17 @@ class Mobile {
} }
else else
{ {
$this->ismobile = Context::get('mobile') || preg_match('/(iPod|iPhone|Android|BlackBerry|SCH\-M[0-9]+)/',$_SERVER['HTTP_USER_AGENT']); $m = Context::get('m');
if($m == "1") {
setcookie("mobile", true);
$this->ismobile = true;
}
else if($m === "0") {
setcookie("mobile", "");
$this->ismobile = false;
}
else if($_COOKIE["mobile"]) $this->ismobile = true;
else $this->ismobile = preg_match('/(iPod|iPhone|Android|BlackBerry|SCH\-M[0-9]+)/',$_SERVER['HTTP_USER_AGENT']);
} }
return $this->ismobile; return $this->ismobile;