mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 09:41:40 +09:00
Fix manual mobile setting not working
This commit is contained in:
parent
ba8ff52904
commit
3d8b7755ee
1 changed files with 3 additions and 3 deletions
|
|
@ -46,11 +46,11 @@ class Mobile
|
|||
// Try to detect from URL arguments and cookies, and finally fall back to user-agent detection.
|
||||
$m = Context::get('m');
|
||||
$cookie = (isset($_COOKIE['mobile']) && $_SESSION['user_agent'] === md5($_SERVER['HTTP_USER_AGENT'])) ? $_COOKIE['mobile'] : null;
|
||||
if ($m === '1' || $cookie === 'true')
|
||||
if ($m === '1' || ($m === null && $cookie === 'true'))
|
||||
{
|
||||
self::$_ismobile = TRUE;
|
||||
}
|
||||
elseif ($m === '0' || $cookie === 'false')
|
||||
elseif ($m === '0' || ($m === null && $cookie === 'false'))
|
||||
{
|
||||
self::$_ismobile = FALSE;
|
||||
}
|
||||
|
|
@ -60,7 +60,7 @@ class Mobile
|
|||
}
|
||||
|
||||
// Set cookie to prevent recalculation.
|
||||
if (!$cookie)
|
||||
if ($cookie !== (self::$_ismobile ? 'true' : 'false'))
|
||||
{
|
||||
$_SESSION['user_agent'] = md5($_SERVER['HTTP_USER_AGENT']);
|
||||
$_COOKIE['mobile'] = self::$_ismobile ? 'true' : 'false';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue