Add Rhymix\Framework\Cookie class with sane defaults

This commit is contained in:
Kijin Sung 2023-10-24 22:37:21 +09:00
parent 53ec02b6bb
commit 5005a09f06
4 changed files with 128 additions and 7 deletions

View file

@ -321,7 +321,7 @@ class Context
$lang_type = preg_replace('/[^a-zA-Z0-9_-]/', '', $lang_type ?? '');
if ($set_lang_cookie)
{
setcookie('lang_type', $lang_type, time() + 86400 * 365, \RX_BASEURL, '', !!config('session.use_ssl_cookies'));
Rhymix\Framework\Cookie::set('lang_type', $lang_type, ['expires' => 365]);
}
if(!$lang_type || !isset($enabled_langs[$lang_type]))

View file

@ -72,8 +72,7 @@ class Mobile
$uatype = $uahash . ':' . (self::$_ismobile ? '1' : '0');
if ($cookie !== $uatype)
{
setcookie('rx_uatype', $uatype, 0, \RX_BASEURL, '', !!config('session.use_ssl_cookies'));
$_COOKIE['rx_uatype'] = $uatype;
Rhymix\Framework\Cookie::set('rx_uatype', $uatype, ['expires' => 0]);
}
return self::$_ismobile;