From 8ba644016861f8761a3493d93d2af02b037c25ea Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos <1697880+AngelFQC@users.noreply.github.com> Date: Sat, 6 Jul 2024 19:15:52 -0500 Subject: [PATCH] Install: Fix change installation language --- assets/vue/components/installer/Step1.vue | 3 ++- public/main/install/index.php | 17 +++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/assets/vue/components/installer/Step1.vue b/assets/vue/components/installer/Step1.vue index 0fe8e8d32a..113af804e7 100644 --- a/assets/vue/components/installer/Step1.vue +++ b/assets/vue/components/installer/Step1.vue @@ -15,7 +15,7 @@ ["en_US", "fr_FR"].includes(language.isocode)) const { t } = useI18n(); diff --git a/public/main/install/index.php b/public/main/install/index.php index 165d808805..a68bb59e34 100644 --- a/public/main/install/index.php +++ b/public/main/install/index.php @@ -66,9 +66,19 @@ putenv('APP_DEBUG=1'); session_start(); +Container::$session = new HttpSession(); + require_once 'install.lib.php'; $installationLanguage = 'en_US'; +if (!empty($_POST['language_list']) && !ChamiloSession::has('install_language')) { + $search = ['../', '\\0']; + $installationLanguage = str_replace($search, '', urldecode($_POST['language_list'])); + ChamiloSession::write('install_language', $installationLanguage); +} elseif (ChamiloSession::has('install_language')) { + $installationLanguage = ChamiloSession::read('install_language'); +} + // Set translation $translator = new Translator($installationLanguage); $translator->addLoader('po', new PoFileLoader()); @@ -79,8 +89,6 @@ $translator->addResource( ); Container::$translator = $translator; -Container::$session = new HttpSession(); - // The function api_get_setting() might be called within the installation scripts. // We need to provide some limited support for it through initialization of the // global array-type variable $_setting. @@ -109,14 +117,12 @@ $adminFirstName = get_lang('John'); $loginForm = 'admin'; $passForm = ''; $institutionUrlForm = 'https://chamilo.org'; -$languageForm = ''; +$languageForm = $installationLanguage; $campusForm = 'My campus'; $educationForm = 'Albert Einstein'; $adminPhoneForm = '(000) 001 02 03'; $institutionForm = 'My Organisation'; $session_lifetime = 360000; -//$installLanguage = isset($_SESSION['install_language']) ? $_SESSION['install_language'] : 'english'; -$installLanguage = ''; $installationGuideLink = '../../documentation/installation_guide.html'; // Setting the error reporting levels. @@ -225,7 +231,6 @@ if (!isset($_GET['running'])) { $loginForm = 'admin'; $passForm = api_generate_password(12, false); $institutionUrlForm = 'https://chamilo.org'; - $languageForm = api_get_language_isocode(); $checkEmailByHashSent = 0; $userMailCanBeEmpty = 1; $allowSelfReg = 'approval';