From 2d90d60f9a676adc84d1957c80df053fa9a8f0e6 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Tim=20D=C3=BCsterhus?= Date: Fri, 24 Jul 2015 17:25:07 +0200 Subject: [PATCH] Change language in SessionHandler::changeUser(). --- wcfsetup/install/files/lib/system/WCF.class.php | 2 ++ .../install/files/lib/system/session/SessionHandler.class.php | 3 +++ 2 files changed, 5 insertions(+) diff --git a/wcfsetup/install/files/lib/system/WCF.class.php b/wcfsetup/install/files/lib/system/WCF.class.php index 63390bf742..7007493502 100644 --- a/wcfsetup/install/files/lib/system/WCF.class.php +++ b/wcfsetup/install/files/lib/system/WCF.class.php @@ -585,6 +585,8 @@ class WCF { * @param integer $languageID */ public static final function setLanguage($languageID) { + if (!$languageID) $languageID = LanguageFactory::getInstance()->getDefaultLanguageID(); + self::$languageObj = LanguageFactory::getInstance()->getLanguage($languageID); self::getTPL()->setLanguageID(self::getLanguage()->languageID); } diff --git a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php index 8a00833981..fd0f7828f2 100644 --- a/wcfsetup/install/files/lib/system/session/SessionHandler.class.php +++ b/wcfsetup/install/files/lib/system/session/SessionHandler.class.php @@ -737,6 +737,9 @@ class SessionHandler extends SingletonFactory { $this->languageID = $this->user->languageID; $this->styleID = $this->user->styleID; + // change language + WCF::setLanguage($this->languageID ?: 0); + // in some cases the language id can be stuck in the session variables $this->unregister('languageID'); -- 2.20.1