Example of the cookie option

This commit is contained in:
Min-Soo Kim 2018-08-02 00:35:27 +09:00
parent d090f402cc
commit 93a35c251b
10 changed files with 36 additions and 4 deletions

View file

@ -306,7 +306,7 @@ class Context
{
if($_COOKIE['lang_type'] !== $lang_type)
{
setcookie('lang_type', $lang_type, time() + 86400 * 365, '/', null, self::isAlwaysSSL());
setcookie('lang_type', $lang_type, time() + 86400 * 365, '/', null, self::isCookieSSL());
}
}
elseif($_COOKIE['lang_type'])
@ -639,6 +639,21 @@ class Context
return $ssl_only;
}
/**
* Return Cookie SSL status
*
* @param boolen $purge_cache Set true to get uncached SSL_enforce value.
* @return boolean (true|false)
*/
public static function isCookieSSL($purge_cache = false)
{
static $ssl_only = null;
if(is_null($ssl_only) || $purge_cache === true)
{
$ssl_only = (self::isAlwaysSSL() && config('session.use_ssl_cookie'));
}
return $ssl_only;
}
/**
* Return default URL