Created
March 29, 2014 14:17
-
-
Save Elsensee/9855271 to your computer and use it in GitHub Desktop.
ticket/10521 patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -1986,8 +1986,8 @@ function tracking_unserialize($string, $max_depth = 3) | |
*/ | |
function append_sid($url, $params = false, $is_amp = true, $session_id = false) | |
{ | |
- global $_SID, $_EXTRA_URL, $phpbb_hook, $phpbb_path_helper; | |
- global $phpbb_dispatcher; | |
+ global $_SID, $_EXTRA_URL, $db, $phpbb_hook, $phpbb_path_helper; | |
+ global $phpbb_dispatcher, $phpEx, $request, $user; | |
if ($params === '' || (is_array($params) && empty($params))) | |
{ | |
@@ -2001,6 +2001,21 @@ function append_sid($url, $params = false, $is_amp = true, $session_id = false) | |
$url = $phpbb_path_helper->update_web_root_path($url); | |
} | |
+ $lang_request = $request->variable('lang', ''); | |
+ if ($lang_request) | |
+ { | |
+ $sql = 'SELECT lang_dir | |
+ FROM ' . LANG_TABLE . ' | |
+ WHERE lang_iso = \'' . $db->sql_escape($lang_request) . '\''; | |
+ $result = $db->sql_query($sql); | |
+ $lang_dir = $db->sql_fetchfield('lang_dir'); | |
+ $db->sql_freeresult($result); | |
+ if (!empty($dir) && file_exists($user->lang_path . $lang_dir . "/common.$phpEx") && !in_array('lang=' . $lang_request, $_EXTRA_URL)) | |
+ { | |
+ $_EXTRA_URL[] = 'lang=' . $lang_request; | |
+ } | |
+ } | |
+ | |
$append_sid_overwrite = false; | |
/** | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -70,7 +70,9 @@ class user extends \phpbb\session | |
function setup($lang_set = false, $style_id = false) | |
{ | |
global $db, $template, $config, $auth, $phpEx, $phpbb_root_path, $cache; | |
- global $phpbb_dispatcher; | |
+ global $phpbb_dispatcher, $_EXTRA_URL; | |
+ | |
+ $_EXTRA_URL = array(); | |
if ($this->data['user_id'] != ANONYMOUS) | |
{ | |
@@ -121,6 +123,23 @@ class user extends \phpbb\session | |
*/ | |
} | |
+ $lang_request = $request->variable('lang', $user_lang_name)); | |
+ $lang_changed = ($lang_request != $user_lang_name); | |
+ if ($lang_changed) | |
+ { | |
+ $sql = 'SELECT lang_dir | |
+ FROM ' . LANG_TABLE . ' | |
+ WHERE lang_iso = \'' . $db->sql_escape($lang_request) . '\''; | |
+ $result = $db->sql_query($sql); | |
+ $lang_dir = $db->sql_fetchrow('lang_dir'); | |
+ $db->sql_freeresult($result); | |
+ if (!empty($dir) && file_exists($this->lang_path . $lang_dir . "/common.$phpEx")) | |
+ { | |
+ $user_lang_name = $lang_request; | |
+ $_EXTRA_URL[] = 'lang=' . $user_lang_name; | |
+ } | |
+ } | |
+ | |
$user_data = $this->data; | |
$lang_set_ext = array(); | |
@@ -189,7 +208,7 @@ class user extends \phpbb\session | |
$style_id = $style_request; | |
$SID .= '&style=' . $style_id; | |
- $_EXTRA_URL = array('style=' . $style_id); | |
+ $_EXTRA_URL[] = 'style=' . $style_id; | |
} | |
else | |
{ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment