mirror of
https://github.com/phpbb/phpbb.git
synced 2025-02-24 12:03:21 +01:00
Merge remote-tracking branch 'github-vse/ticket/10521' into develop-ascraeus
* github-vse/ticket/10521: [ticket/10521] Allow language switching by URL parameter
This commit is contained in:
commit
1399d60954
@ -1045,8 +1045,9 @@ class session
|
|||||||
* @param string $name Name of the cookie, will be automatically prefixed with the phpBB cookie name. track becomes [cookie_name]_track then.
|
* @param string $name Name of the cookie, will be automatically prefixed with the phpBB cookie name. track becomes [cookie_name]_track then.
|
||||||
* @param string $cookiedata The data to hold within the cookie
|
* @param string $cookiedata The data to hold within the cookie
|
||||||
* @param int $cookietime The expiration time as UNIX timestamp. If 0 is provided, a session cookie is set.
|
* @param int $cookietime The expiration time as UNIX timestamp. If 0 is provided, a session cookie is set.
|
||||||
|
* @param int $httponly Use HttpOnly. Defaults to true. Use false to make cookie accessible by client-side scripts.
|
||||||
*/
|
*/
|
||||||
function set_cookie($name, $cookiedata, $cookietime)
|
function set_cookie($name, $cookiedata, $cookietime, $httponly = true)
|
||||||
{
|
{
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -1054,7 +1055,7 @@ class session
|
|||||||
$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'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain'];
|
$domain = (!$config['cookie_domain'] || $config['cookie_domain'] == 'localhost' || $config['cookie_domain'] == '127.0.0.1') ? '' : '; domain=' . $config['cookie_domain'];
|
||||||
|
|
||||||
header('Set-Cookie: ' . $name_data . (($cookietime) ? '; expires=' . $expire : '') . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . '; HttpOnly', false);
|
header('Set-Cookie: ' . $name_data . (($cookietime) ? '; expires=' . $expire : '') . '; path=' . $config['cookie_path'] . $domain . ((!$config['cookie_secure']) ? '' : '; secure') . ';' . (($httponly) ? ' HttpOnly' : ''), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -80,10 +80,18 @@ class user extends \phpbb\session
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$change_lang = $request->variable($config['cookie_name'] . '_lang', '', true, \phpbb\request\request_interface::COOKIE);
|
$lang_override = $request->variable('language', '');
|
||||||
if ($change_lang)
|
if ($lang_override)
|
||||||
{
|
{
|
||||||
$use_lang = basename($change_lang);
|
$this->set_cookie('lang', $lang_override, 0, false);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$lang_override = $request->variable($config['cookie_name'] . '_lang', '', true, \phpbb\request\request_interface::COOKIE);
|
||||||
|
}
|
||||||
|
if ($lang_override)
|
||||||
|
{
|
||||||
|
$use_lang = basename($lang_override);
|
||||||
$user_lang_name = (file_exists($this->lang_path . $use_lang . "/common.$phpEx")) ? $use_lang : basename($config['default_lang']);
|
$user_lang_name = (file_exists($this->lang_path . $use_lang . "/common.$phpEx")) ? $use_lang : basename($config['default_lang']);
|
||||||
$this->data['user_lang'] = $user_lang_name;
|
$this->data['user_lang'] = $user_lang_name;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user