From ff16d480c03ef8274399fc4701b9588d4ac1650c Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 27 Oct 2022 21:22:06 +0200 Subject: [PATCH] =?UTF-8?q?Bug=20installation,=20pb=20de=20pr=C3=A9selecti?= =?UTF-8?q?on=20de=20langue=20UI=20en=20cours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.php | 14 ++++++++++---- core/module/install/install.php | 17 ++++++++--------- .../install/view/postinstall/postinstall.php | 2 +- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/core/core.php b/core/core.php index 0941e85a..6ddd7e83 100644 --- a/core/core.php +++ b/core/core.php @@ -338,9 +338,16 @@ class common } // Langue de l'administration - self::$i18nUI = $this->getData(['user', $this->getUser('id'), 'language']); - // La langue par défaut du contenu est celle du site si le cookie est absent. - self::$i18nUI = (empty(self::$i18nUI) || is_null(self::$i18nUI)) ? self::$i18nUI = 'fr_FR' : self::$i18nUI; + if ($this->getData(['user']) === []) { + // Installation en cours + self::$i18nUI = array_key_exists($this->getInput('ZWII_UI'), self::$languages) ? $this->getInput('ZWII_UI') : 'fr_FR'; + helper::deleteCookie('ZWII_UI'); + } else { + // Langue sélectionnée dans le compte + self::$i18nUI = $this->getData(['user', $this->getUser('id'), 'language']); + // Validation de la langue + self::$i18nUI = (empty(self::$i18nUI) || is_null(self::$i18nUI)) ? self::$i18nUI = 'fr_FR' : self::$i18nUI; + } // Le fichier existe-t-il ? if (!file_exists(self::I18N_DIR . self::$i18nUI . '.json')) { @@ -2739,7 +2746,6 @@ class core extends common // TinyMCE $colors = helper::colorVariants($this->getData(['admin', 'colorText'])); $css .= 'body:not(.editorWysiwyg),span .zwiico-help {color:' . $colors['normal'] . ';}'; - echo $colors['invert']; $css .= 'table thead tr, table thead tr .zwiico-help{ background-color:' . $colors['normal'] . '; color:' . $colors['text'] . ';}'; $css .= 'table thead th { color:' . $colors['text'] . ';}'; $colors = helper::colorVariants($this->getData(['admin', 'backgroundColorButton'])); diff --git a/core/module/install/install.php b/core/module/install/install.php index 88f03ceb..f12bf6fa 100644 --- a/core/module/install/install.php +++ b/core/module/install/install.php @@ -55,13 +55,11 @@ class install extends common else { // Soumission du formulaire if ($this->isPost()) { - // Langue de l'UI - self::$i18nUI = $this->getInput('installLanguage'); - // Par défaut la langue du contenu est celle du site - self::$i18nContent = self::$i18nUI; + $lang = $this->getInput('installLanguage'); + setcookie('ZWII_UI', $lang, time() + 3600, helper::baseUrl(false, false), '', helper::isHttps(), true); // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . 'install/postinstall' + 'redirect' => helper::baseUrl() . 'install/postinstall/' . $lang ]); } } @@ -106,6 +104,10 @@ class install extends common if ($this->isPost()) { $success = true; + + // Validation de la langue transmise + $lang = array_key_exists($this->getUrl(2), self::$languages) ? $this->getUrl(2) : 'fr_FR'; + // Double vérification pour le mot de passe if ($this->getInput('installPassword', helper::FILTER_STRING_SHORT, true) !== $this->getInput('installConfirmPassword', helper::FILTER_STRING_SHORT, true)) { self::$inputNotices['installConfirmPassword'] = 'Incorrect'; @@ -117,10 +119,8 @@ class install extends common $userMail = $this->getInput('installMail', helper::FILTER_MAIL, true); $userId = $this->getInput('installId', helper::FILTER_ID, true); - // Création de l'utilisateur si les données sont complétées. // success retour de l'enregistrement des données - $success = $this->setData([ 'user', $userId, @@ -133,7 +133,7 @@ class install extends common 'signature' => 1, 'mail' => $userMail, 'password' => $this->getInput('installPassword', helper::FILTER_PASSWORD, true), - 'language' => self::$i18nUI + 'language' => $lang ] ]); @@ -165,7 +165,6 @@ class install extends common }*/ // Installation du site de test - if ($this->getInput('installDefaultData', helper::FILTER_BOOLEAN) === FALSE) { $this->initData('page', self::$i18nContent, true); $this->initData('module', self::$i18nContent, true); diff --git a/core/module/install/view/postinstall/postinstall.php b/core/module/install/view/postinstall/postinstall.php index cd4de68b..7554f9eb 100644 --- a/core/module/install/view/postinstall/postinstall.php +++ b/core/module/install/view/postinstall/postinstall.php @@ -55,7 +55,7 @@
- false ]); ?>