From 424e8400f97497d942b6a85d76248f5a89f074ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20C=C3=B4t=C3=A9-Tremblay?= Date: Sat, 6 May 2017 13:01:31 -0400 Subject: [PATCH] Bugfix: Save in wrong lang when multiple tabs open (#1101) * Bugfix: Save in wrong lang when multiple tabs open English and french in this PR are used only for example purposes. When you have multiple tabs opened in different languages, it often cause to ovewrite the french contents with the english contents (or vice-versa, or according to your specific language configuration). How to reproduce the bug : 1. Open a tab and edit a page in french 2. In another tab, open the same page in english then save 3. Return to the french tab and save 4. **The english contents got overwrited by the french contents** This patch makes the use of the language code in URL instead of the session when editing a page, preventing to overwrite the contents of another page while power-editing with many tabs in different languages. * Remove unused scopes about the session language --- admin.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/admin.php b/admin.php index d39dd406..1ae1ea33 100644 --- a/admin.php +++ b/admin.php @@ -585,8 +585,8 @@ class AdminPlugin extends Plugin // Initialize Admin Language if needed /** @var Language $language */ $language = $this->grav['language']; - if ($language->enabled() && empty($this->grav['session']->admin_lang)) { - $this->grav['session']->admin_lang = $language->getLanguage(); + if ($language->enabled()) { + $this->grav['session']->admin_lang = $language->getActive(); } // Decide admin template and route.