From 9977fb8c3eee0edb3e7f81927bce7c27b858f163 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Tue, 25 Apr 2023 11:07:38 +0200 Subject: [PATCH 1/3] destruction de session --- core/module/user/user.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/module/user/user.php b/core/module/user/user.php index c11ba4e4..e7e28b36 100644 --- a/core/module/user/user.php +++ b/core/module/user/user.php @@ -532,9 +532,6 @@ class user extends common file_put_contents(self::DATA_DIR . 'journal.log', $dataLog, FILE_APPEND); } - // Detruit la session - session_destroy(); - // Stockage des cookies if (!empty($_COOKIE['ZWII_USER_ID'])) { self::$userId = $_COOKIE['ZWII_USER_ID']; @@ -554,7 +551,10 @@ class user extends common { helper::deleteCookie('ZWII_USER_ID'); helper::deleteCookie('ZWII_USER_PASSWORD'); + + // Détruit la session session_destroy(); + // Valeurs en sortie $this->addOutput([ 'notification' => helper::translate('Déconnexion !'), From dde705805ad021673de324c9bb761e692f3cbac9 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 26 Apr 2023 21:40:09 +0200 Subject: [PATCH 2/3] 12309 test 01 --- core/class/jsondb/JsonDb.class.php | 5 +- core/core.php | 15 ++- core/module/install/install.php | 39 ++++---- core/module/install/ressource/defaultdata.php | 97 +++++++++++-------- core/module/translate/translate.php | 2 +- 5 files changed, 86 insertions(+), 72 deletions(-) diff --git a/core/class/jsondb/JsonDb.class.php b/core/class/jsondb/JsonDb.class.php index c5cfa3ee..d07f0ac9 100644 --- a/core/class/jsondb/JsonDb.class.php +++ b/core/class/jsondb/JsonDb.class.php @@ -115,7 +115,7 @@ class JsonDb extends \Prowebcraft\Dot protected function loadData($reload = false) { if ($this->data === null || $reload) { - $this->db = $this->config['dir'] . DIRECTORY_SEPARATOR . $this->config['name']; + $this->db = $this->config['dir'] . $this->config['name']; if (!file_exists($this->db)) { return null; // Rebuild database manage by CMS } else { @@ -150,8 +150,7 @@ class JsonDb extends \Prowebcraft\Dot if ($w == $l) { break; } - $try++; - sleep(1); + $t++; } if ($w !== $l) { exit('Erreur d\'écriture, les données n\'ont pas été sauvegardées'); diff --git a/core/core.php b/core/core.php index 63b9b7ed..df8b4cf5 100644 --- a/core/core.php +++ b/core/core.php @@ -53,11 +53,11 @@ class common const ACCESS_TIMER = 1800; // Numéro de version et branche pour l'auto-update - const ZWII_VERSION = '12.3.09'; + const ZWII_VERSION = '12.3.09.test01'; // URL autoupdate const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/'; - const ZWII_UPDATE_CHANNEL = "v12"; + const ZWII_UPDATE_CHANNEL = "test"; // URL langues de l'UI en ligne const ZWII_UI_URL = 'https://forge.chapril.org/ZwiiCMS-Team/zwiicms-translations/raw/branch/master/'; @@ -331,7 +331,7 @@ class common // Instanciation de la classe des entrées / sorties // Récupère les descripteurs foreach ($this->dataFiles as $keys => $value) { - // Constructeur JsonDB + // Constructeur JsonDB; $this->dataFiles[$keys] = new \Prowebcraft\JsonDb([ 'name' => $keys . '.json', 'dir' => $this->dataPath($keys, self::$i18nContent), @@ -368,8 +368,8 @@ class common } else { if (isset($_SESSION['ZWII_UI'])) { self::$i18nUI = $_SESSION['ZWII_UI']; - } elseif (isset($_SESSION['ZWII_CONTENT'])) { - self::$i18nUI = $_SESSION['ZWII_CONTENT']; + } elseif (isset($_COOKIE['ZWII_UI'])) { + self::$i18nUI = $_COOKIE['ZWII_UI']; } else { self::$i18nUI = 'fr_FR'; } @@ -630,9 +630,14 @@ class common } $db->save; + + // Créer le jeu de pages du site de test if ($module === 'page') { + + // Dossier du contenu des pages $langFolder = $lang . '/content/'; + // Dossier des pages if (!is_dir(self::DATA_DIR . $langFolder)) { mkdir(self::DATA_DIR . $langFolder, 0755); diff --git a/core/module/install/install.php b/core/module/install/install.php index 9c4601db..02a645f4 100644 --- a/core/module/install/install.php +++ b/core/module/install/install.php @@ -57,6 +57,7 @@ class install extends common $lang = $this->getInput('installLanguage'); // Pour la suite de l'installation // setcookie('ZWII_UI', $lang, time() + 3600, helper::baseUrl(false, false), '', false, false); + $_SESSION['ZWII_UI'] = $this->getInput('installLanguage'); // Valeurs en sortie @@ -143,41 +144,37 @@ class install extends common ); // Validation de la langue transmise - $_SESSION['ZWII_UI'] = array_key_exists($_SESSION['ZWII_UI'], self::$languages) ? $_SESSION['ZWII_UI'] : 'fr_FR'; + self::$i18nUI = $_SESSION['ZWII_UI']; + self::$i18nUI = array_key_exists(self::$i18nUI, self::$languages) ? self::$i18nUI : 'fr_FR'; - // La langue du site est la langue de l'UI - $_SESSION['ZWII_CONTENT'] = $_SESSION['ZWII_UI']; - - // Efface les langues déjà installées - foreach ($this->getData(['languages']) as $lang => $value) { - if (is_dir(self::DATA_DIR . $lang)) - $this->removeDir(self::DATA_DIR . $lang); - } + // par défaut le contenu est la langue d'installation + self::$i18nContent = self::$i18nUI; + $_SESSION['ZWII_CONTENT'] = self::$i18nContent; // Création du dossier de langue avec le marqueur de langue par défaut - if (!is_dir(self::DATA_DIR . $_SESSION['ZWII_CONTENT'])) { - mkdir(self::DATA_DIR . $_SESSION['ZWII_CONTENT']); - touch(self::DATA_DIR . $_SESSION['ZWII_CONTENT'] . '/.default'); + if (!is_dir(self::DATA_DIR . self::$i18nContent)) { + mkdir(self::DATA_DIR . self::$i18nContent); + touch(self::DATA_DIR . self::$i18nContent . '/.default'); } // Installation du site de test if ( $this->getInput('installDefaultData', helper::FILTER_BOOLEAN) === false - && $_SESSION['ZWII_CONTENT'] === 'fr_FR' + && self::$i18nContent === 'fr_FR' ) { - $this->initData('page', $_SESSION['ZWII_CONTENT'], true); - $this->initData('module', $_SESSION['ZWII_CONTENT'], true); - $this->initData('locale', $_SESSION['ZWII_CONTENT'], true); + $this->initData('page', self::$i18nContent, true); + $this->initData('module', self::$i18nContent, true); $this->setData(['module', 'blog', 'posts', 'mon-premier-article', 'userId', $userId]); $this->setData(['module', 'blog', 'posts', 'mon-deuxieme-article', 'userId', $userId]); $this->setData(['module', 'blog', 'posts', 'mon-troisieme-article', 'userId', $userId]); } // Jeu réduit pour les pages étrangères - if ($_SESSION['ZWII_CONTENT'] !== 'fr_FR') { - $this->initData('page', $_SESSION['ZWII_CONTENT'], false); - $this->initData('module', $_SESSION['ZWII_CONTENT'], false); - $this->initData('locale', $_SESSION['ZWII_CONTENT'], false); + if (self::$i18nContent !== 'fr_FR') { + $this->initData('page', self::$i18nContent, false); + $this->initData('module', self::$i18nContent, false); + if (is_dir(self::DATA_DIR . 'fr_FR')) + $this->removeDir(self::DATA_DIR . 'fr_FR'); } // Sauvegarder la configuration du Proxy @@ -243,7 +240,7 @@ class install extends common // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl(true) . $this->getData(['locale', 'homePageId']), + 'redirect' => helper::baseUrl(), 'notification' => $sent === true ? helper::translate('Installation terminée') : $sent, 'state' => ($sent === true && $success === true) ? true : null ]); diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 29a023b0..7d9ece2e 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -91,12 +91,12 @@ class init extends common ], 'droid-sans-2' => [ 'name' => 'Droid Sans', - 'font-family' => '\'Droid Sans\', sans-serif', + 'font-family' => '\'Droid Sans\', sans-serif', 'resource' => 'https://fonts.cdnfonts.com/css/droid-sans-2' ], 'droid-serif-2' => [ 'name' => 'Droid Serif', - 'font-family' => '\'Droid Serif\', serif', + 'font-family' => '\'Droid Serif\', serif', 'resource' => 'https://fonts.cdnfonts.com/css/droid-serif-2' ], 'indie-flower' => [ @@ -208,7 +208,7 @@ class init extends common ], 'module' => [], 'user' => [], - 'theme' => [ + 'theme' => [ 'body' => [ 'backgroundColor' => 'rgba(236, 239, 241, 1)', 'image' => '', @@ -334,7 +334,7 @@ class init extends common 'borderBlockColor' => 'rgba(190, 202, 209, 1)' ], 'blacklist' => [], - 'languages'=> [], + 'languages' => [], ]; public static $defaultDataI18n = [ 'en_EN' => [ @@ -443,7 +443,7 @@ class init extends common 'block' => '12', 'barLeft' => '', 'barRight' => '', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -470,7 +470,7 @@ class init extends common 'block' => '12', 'barLeft' => '', 'barRight' => '', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -497,7 +497,7 @@ class init extends common 'block' => '4-8', 'barLeft' => 'barre', 'barRight' => '', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -524,7 +524,7 @@ class init extends common 'block' => '9-3', 'barLeft' => '', 'barRight' => 'barrelateraleavecmenu', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -551,7 +551,7 @@ class init extends common 'block' => '12', 'barLeft' => '', 'barRight' => '', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -578,7 +578,7 @@ class init extends common 'block' => '12', 'barLeft' => '', 'barRight' => '', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -860,13 +860,14 @@ class init extends common 'publishedOn' => 1548790902, 'state' => true, 'title' => 'Mon premier article', - 'userId' => '', // Géré au moment de l'installation + 'userId' => '', + // Géré au moment de l'installation 'editConsent' => 'all', 'commentMaxlength' => '500', - 'commentApproved' => false, - 'commentClose' => false, - 'commentNotification' => false, - 'commentGroupNotification' => 1 + 'commentApproved' => false, + 'commentClose' => false, + 'commentNotification' => false, + 'commentGroupNotification' => 1 ], 'mon-deuxieme-article' => [ 'closeComment' => false, @@ -880,13 +881,14 @@ class init extends common 'publishedOn' => 1550432502, 'state' => true, 'title' => 'Mon deuxième article', - 'userId' => '', // Géré au moment de l'installation + 'userId' => '', + // Géré au moment de l'installation 'editConsent' => 'all', 'commentMaxlength' => '500', - 'commentApproved' => false, - 'commentClose' => false, - 'commentNotification' => false, - 'commentGroupNotification' => 1 + 'commentApproved' => false, + 'commentClose' => false, + 'commentNotification' => false, + 'commentGroupNotification' => 1 ], 'mon-troisieme-article' => [ 'closeComment' => true, @@ -900,13 +902,14 @@ class init extends common 'publishedOn' => 1550864502, 'state' => true, 'title' => 'Mon troisième article', - 'userId' => '', // Géré au moment de l'installation + 'userId' => '', + // Géré au moment de l'installation 'editConsent' => 'all', 'commentMaxlength' => '500', - 'commentApproved' => false, - 'commentClose' => false, - 'commentNotification' => false, - 'commentGroupNotification' => 1 + 'commentApproved' => false, + 'commentClose' => false, + 'commentNotification' => false, + 'commentGroupNotification' => 1 ], ], ], @@ -956,24 +959,24 @@ class init extends common ], ], 'theme' => [ - 'thumbAlign' => 'center', - 'thumbWidth' => '18em', - 'thumbHeight' => '15em', - 'thumbMargin' => '.5em', - 'thumbBorder' => '.1em', - 'thumbOpacity' => '.7', + 'thumbAlign' => 'center', + 'thumbWidth' => '18em', + 'thumbHeight' => '15em', + 'thumbMargin' => '.5em', + 'thumbBorder' => '.1em', + 'thumbOpacity' => '.7', 'thumbBorderColor' => 'rgba(221, 221, 221, 1)', - 'thumbRadius' => '.3em', - 'thumbShadows' => '1px 1px 10px', + 'thumbRadius' => '.3em', + 'thumbShadows' => '1px 1px 10px', 'thumbShadowsColor' => 'rgba(125, 125, 125, 1)', - 'legendHeight' => '.375em', - 'legendAlign' => 'center', - 'legendTextColor' => 'rgba(255, 255, 255, 1)', - 'legendBgColor' => 'rgba(0, 0, 0, .6)', - 'style' => 'site/data/modules/gallery/galeries.css' + 'legendHeight' => '.375em', + 'legendAlign' => 'center', + 'legendTextColor' => 'rgba(255, 255, 255, 1)', + 'legendBgColor' => 'rgba(0, 0, 0, .6)', + 'style' => 'site/data/modules/gallery/galeries.css' ], 'config' => [ - 'versionData' => '3.0' + 'versionData' => '3.0' ], ], 'site-de-zwii' => [ @@ -1021,9 +1024,19 @@ class init extends common 'page404' => 'none', 'legalPageId' => 'none', 'searchPageId' => 'none', + 'searchPageLabel' => 'Rechercher', + 'sitemapPageLabel' => 'Plan du site', + 'legalPageLabel' => 'Mentions légales', 'metaDescription' => 'Zwii est un CMS sans base de données qui permet de créer et gérer facilement un site web sans aucune connaissance en programmation.', - 'title' => 'Votre site en quelques clics !' - ] + 'title' => 'Votre site en quelques clics !', + 'cookies' => [ + 'mainLabel' => 'Ce site utilise des cookies nécessaires à son fonctionnement, ils permettent de fluidifier son fonctionnement par exemple en mémorisant les données de connexion, la langue que vous avez choisie ou la validation de ce message.', + 'titleLabel' => 'Cookies essentiels', + 'linkLegalLabel' => 'Consulter les mentions légales', + 'cookiesFooterText' => 'Cookies', + 'buttonValidLabel' => 'J\'ai compris' + ] + ], ]; public static $siteContent = [ @@ -1142,4 +1155,4 @@ class init extends common 'content' => '

Rechercher dans le site

' ] ]; -} +} \ No newline at end of file diff --git a/core/module/translate/translate.php b/core/module/translate/translate.php index 53acaee4..60783e3a 100644 --- a/core/module/translate/translate.php +++ b/core/module/translate/translate.php @@ -667,7 +667,7 @@ class translate extends common // Valeurs en sortie $this->addOutput([ - 'redirect' => helper::baseUrl() . $this->getData(['locale', $this->getUrl(2), 'homePageId']) + 'redirect' => helper::baseUrl() ]); } From 329c7a3ad44e4eab731c89ab39aa779f5c3bc1ef Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 26 Apr 2023 21:51:35 +0200 Subject: [PATCH 3/3] Langues fichier --- core/module/install/ressource/i18n/en_EN.json | 2 +- core/module/install/ressource/i18n/es.json | 2 +- core/module/install/ressource/i18n/languages.json | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/core/module/install/ressource/i18n/en_EN.json b/core/module/install/ressource/i18n/en_EN.json index 93540b54..e65c238a 100644 --- a/core/module/install/ressource/i18n/en_EN.json +++ b/core/module/install/ressource/i18n/en_EN.json @@ -203,7 +203,7 @@ "Famille": "Family", "Favicon thème sombre": "Dark theme favicon", "Feuille de style spécifique à la page.": "Style sheet specific to the page.", - "Fichiers": "", + "Fichiers": "Files", "Fichiers effacés": "Erased files", "Fil d'Ariane dans le titre": "Breadcrumb in the title", "Fond du sous-menu": "Background of the submenu", diff --git a/core/module/install/ressource/i18n/es.json b/core/module/install/ressource/i18n/es.json index b6f2c825..37cc8180 100644 --- a/core/module/install/ressource/i18n/es.json +++ b/core/module/install/ressource/i18n/es.json @@ -203,7 +203,7 @@ "Famille": "Vínculo", "Favicon thème sombre": "favicon de tema oscuro", "Feuille de style spécifique à la page.": "Hoja de estilo específica de la página.", - "Fichiers": "", + "Fichiers": "Archivos", "Fichiers effacés": "archivos borrados", "Fil d'Ariane dans le titre": "Migas de pan en el título", "Fond du sous-menu": "Fondo del submenú", diff --git a/core/module/install/ressource/i18n/languages.json b/core/module/install/ressource/i18n/languages.json index e6658427..28449e74 100644 --- a/core/module/install/ressource/i18n/languages.json +++ b/core/module/install/ressource/i18n/languages.json @@ -2,15 +2,15 @@ "languages": { "fr_FR": { "version": 12309, - "date": 1682358881 + "date": 1682538594 }, "es": { "version": 12309, - "date": 1682358881 + "date": 1682538594 }, "en_EN": { "version": 12309, - "date": 1682358881 + "date": 1682538594 } } } \ No newline at end of file