mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
Merge branch '3.3.x'
This commit is contained in:
commit
534d9cbc72
1 changed files with 27 additions and 1 deletions
|
@ -1079,7 +1079,7 @@ class session
|
||||||
*/
|
*/
|
||||||
function set_cookie($name, $cookiedata, $cookietime, $httponly = true)
|
function set_cookie($name, $cookiedata, $cookietime, $httponly = true)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config, $phpbb_dispatcher;
|
||||||
|
|
||||||
// If headers are already set, we just return
|
// If headers are already set, we just return
|
||||||
if (headers_sent())
|
if (headers_sent())
|
||||||
|
@ -1087,6 +1087,32 @@ class session
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$disable_cookie = false;
|
||||||
|
/**
|
||||||
|
* Event to modify or disable setting cookies
|
||||||
|
*
|
||||||
|
* @event core.set_cookie
|
||||||
|
* @var bool disable_cookie Set to true to disable setting this cookie
|
||||||
|
* @var string name Name of the cookie
|
||||||
|
* @var string cookiedata The data to hold within the cookie
|
||||||
|
* @var int cookietime The expiration time as UNIX timestamp
|
||||||
|
* @var bool httponly Use HttpOnly?
|
||||||
|
* @since 3.2.9-RC1
|
||||||
|
*/
|
||||||
|
$vars = array(
|
||||||
|
'disable_cookie',
|
||||||
|
'name',
|
||||||
|
'cookiedata',
|
||||||
|
'cookietime',
|
||||||
|
'httponly',
|
||||||
|
);
|
||||||
|
extract($phpbb_dispatcher->trigger_event('core.set_cookie', compact($vars)));
|
||||||
|
|
||||||
|
if ($disable_cookie)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$name_data = rawurlencode($config['cookie_name'] . '_' . $name) . '=' . rawurlencode($cookiedata);
|
$name_data = rawurlencode($config['cookie_name'] . '_' . $name) . '=' . rawurlencode($cookiedata);
|
||||||
$expire = gmdate('D, d-M-Y H:i:s \\G\\M\\T', $cookietime);
|
$expire = gmdate('D, d-M-Y H:i:s \\G\\M\\T', $cookietime);
|
||||||
$domain = (!$config['cookie_domain'] || $config['cookie_domain'] == '127.0.0.1' || strpos($config['cookie_domain'], '.') === false) ? '' : '; domain=' . $config['cookie_domain'];
|
$domain = (!$config['cookie_domain'] || $config['cookie_domain'] == '127.0.0.1' || strpos($config['cookie_domain'], '.') === false) ? '' : '; domain=' . $config['cookie_domain'];
|
||||||
|
|
Loading…
Add table
Reference in a new issue