mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-03 01:03:28 +09:00
Add config.php options to set defaults for Cookie class #2184
This commit is contained in:
parent
5005a09f06
commit
a3cde9c109
3 changed files with 34 additions and 3 deletions
|
|
@ -58,17 +58,25 @@ class Cookie
|
|||
}
|
||||
|
||||
// Set defaults.
|
||||
if (!isset($options['path']))
|
||||
if (!array_key_exists('path', $options))
|
||||
{
|
||||
$options['path'] = \RX_BASEURL;
|
||||
$options['path'] = config('cookie.path') ?? \RX_BASEURL;
|
||||
}
|
||||
if (!array_key_exists('domain', $options) && ($default_domain = config('cookie.domain')))
|
||||
{
|
||||
$options['domain'] = $default_domain;
|
||||
}
|
||||
if (!isset($options['secure']))
|
||||
{
|
||||
$options['secure'] = \RX_SSL && !!config('session.use_ssl_cookies');
|
||||
}
|
||||
if (!isset($options['httponly']))
|
||||
{
|
||||
$options['httponly'] = config('cookie.httponly') ?? false;
|
||||
}
|
||||
if (!isset($options['samesite']))
|
||||
{
|
||||
$options['samesite'] = 'Lax';
|
||||
$options['samesite'] = config('cookie.samesite') ?? 'Lax';
|
||||
}
|
||||
|
||||
// PHP 7.3+ supports the samesite attribute natively. PHP 7.2 requires a hack.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue