From 19d5659a8f6e1add15a3e85314f5677773cac76f Mon Sep 17 00:00:00 2001 From: rugk Date: Mon, 18 Jul 2016 13:11:15 +0200 Subject: [PATCH 1/3] Change array https://github.com/PrivateBin/PrivateBin/issues/41 Not tested locally, let's say what Travis says... :smile: --- lib/i18n.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/i18n.php b/lib/i18n.php index c788f2ea..b5670258 100644 --- a/lib/i18n.php +++ b/lib/i18n.php @@ -141,7 +141,7 @@ class i18n // check if the lang cookie was set and that language exists if (array_key_exists('lang', $_COOKIE) && in_array($_COOKIE['lang'], $availableLanguages)) { - $match = $_COOKIE['lang']; + $match = $availableLanguages[$_COOKIE['lang']]; } // find a translation file matching the browsers language preferences else From 80e9d75477681d113646558ae9e0c9fb87c7367c Mon Sep 17 00:00:00 2001 From: rugk Date: Mon, 18 Jul 2016 13:12:54 +0200 Subject: [PATCH 2/3] Remove unnecessary array Now it is right... --- lib/i18n.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/i18n.php b/lib/i18n.php index b5670258..651114a4 100644 --- a/lib/i18n.php +++ b/lib/i18n.php @@ -141,7 +141,7 @@ class i18n // check if the lang cookie was set and that language exists if (array_key_exists('lang', $_COOKIE) && in_array($_COOKIE['lang'], $availableLanguages)) { - $match = $availableLanguages[$_COOKIE['lang']]; + $match = $availableLanguages['lang']; } // find a translation file matching the browsers language preferences else From 2e863e3ed9094385f0bfc76136eed47bf20e2679 Mon Sep 17 00:00:00 2001 From: rugk Date: Mon, 18 Jul 2016 13:25:41 +0200 Subject: [PATCH 3/3] Search key first Looks a bit complicated, but well... --- lib/i18n.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/i18n.php b/lib/i18n.php index 651114a4..65f25b6a 100644 --- a/lib/i18n.php +++ b/lib/i18n.php @@ -141,7 +141,7 @@ class i18n // check if the lang cookie was set and that language exists if (array_key_exists('lang', $_COOKIE) && in_array($_COOKIE['lang'], $availableLanguages)) { - $match = $availableLanguages['lang']; + $match = $availableLanguages[array_search($_COOKIE['lang'], $availableLanguages)]; } // find a translation file matching the browsers language preferences else