From 5ce8eefa6bed7e5ce75cb5297122e3daebc45553 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 7 Jun 2021 10:57:03 +0200 Subject: [PATCH 1/4] Bugs divers --- core/module/addon/addon.php | 8 ++++++-- core/module/translate/view/copy/copy.css | 19 +++++++++++++++++++ module/gallery/gallery.php | 12 +++++++----- module/news/news.php | 12 +++++++----- module/search/search.php | 8 +++++--- 5 files changed, 44 insertions(+), 15 deletions(-) diff --git a/core/module/addon/addon.php b/core/module/addon/addon.php index 7899ffea..6b7c05d2 100644 --- a/core/module/addon/addon.php +++ b/core/module/addon/addon.php @@ -429,7 +429,9 @@ class addon extends common { // Parcourir les pages utilisant le module foreach (array_keys($inPages,$this->getUrl(2)) as $pageId) { // Export des pages hébergeant le module - $pageContent[$pageId] = $this->getData(['page',$pageId]); + $pageParam[$pageId] = $this->getData(['page',$pageId]); + // Export du contenu de la page + $pageContent[$pageId] = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $pageId, 'content'])); // Export de fr/module.json $moduleId = 'fr/module.json'; $moduleDir = str_replace('site/data/','',$infoModules[$this->getUrl(2)]['dataDirectory']); @@ -467,7 +469,9 @@ class addon extends common { } // Enregistrement des pages dans le dossier de langue identique à module if (!file_exists($tmpFolder . '/' . $lang . '/page.json')) { - file_put_contents($tmpFolder . '/' . $lang . '/page.json', json_encode($pageContent)); + file_put_contents($tmpFolder . '/' . $lang . '/page.json', json_encode($pageParam)); + mkdir ($tmpFolder . '/' . $lang . '/content'); + file_put_contents($tmpFolder . '/' . $lang . '/content/' . $this->getData(['page', $pageId, 'content']), $pageContent); } // création du zip $fileName = $this->getUrl(2) . '.zip'; diff --git a/core/module/translate/view/copy/copy.css b/core/module/translate/view/copy/copy.css index 8b137891..88fe3629 100644 --- a/core/module/translate/view/copy/copy.css +++ b/core/module/translate/view/copy/copy.css @@ -1 +1,20 @@ +/** + * This file is part of Zwii. + * + * For full copyright and license information, please see the LICENSE + * file that was distributed with this source code. + * + * @author Rémi Jean + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2021, Frédéric Tempez + * @license GNU General Public License, version 3 + * @link http://zwiicms.fr/ + */ + +/** @import url("site/data/admin.css"); */ + +/** NE PAS EFFACER +* admin.css +*/ \ No newline at end of file diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index c681e2a1..f66beb66 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -181,11 +181,13 @@ class gallery extends common { // Mise à jour 3.1 if (version_compare($versionData, '3.1', '<') ) { - // Déplacer les données du dossier Pages - $this->copyDir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0), self::DATADIRECTORY . $this->getUrl(0)); - $this->removeDir(self::DATADIRECTORY . 'pages/'); - $style = $this->getData(['module', $this->getUrl(0), 'theme', 'style']); - $this->setData(['module', $this->getUrl(0), 'theme', 'style', str_replace('pages/', '', $style)]); + if (is_dir(self::DATADIRECTORY . 'pages/')) { + // Déplacer les données du dossier Pages + $this->copyDir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0), self::DATADIRECTORY . $this->getUrl(0)); + $this->removeDir(self::DATADIRECTORY . 'pages/'); + $style = $this->getData(['module', $this->getUrl(0), 'theme', 'style']); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', str_replace('pages/', '', $style)]); + } // Mettre à jour la version $this->setData(['module',$this->getUrl(0),'config', 'versionData', '3.1' ]); } diff --git a/module/news/news.php b/module/news/news.php index ec869d2a..fe78379b 100644 --- a/module/news/news.php +++ b/module/news/news.php @@ -494,11 +494,13 @@ class news extends common { } // Mise à jour 3.3 if (version_compare($versionData, '3.3', '<') ) { - // Déplacer les données du dossier Pages - $this->copyDir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0), self::DATADIRECTORY . $this->getUrl(0)); - $this->removeDir(self::DATADIRECTORY . 'pages/' ); - $style = $this->getData(['module', $this->getUrl(0), 'theme', 'style']); - $this->setData(['module', $this->getUrl(0), 'theme', 'style', str_replace('pages/', '', $style)]); + if (is_dir(self::DATADIRECTORY . 'pages/')) { + // Déplacer les données du dossier Pages + $this->copyDir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0), self::DATADIRECTORY . $this->getUrl(0)); + $this->removeDir(self::DATADIRECTORY . 'pages/' ); + $style = $this->getData(['module', $this->getUrl(0), 'theme', 'style']); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', str_replace('pages/', '', $style)]); + } // Mettre à jour la version $this->setData(['module',$this->getUrl(0),'config', 'versionData', '3.3' ]); } diff --git a/module/search/search.php b/module/search/search.php index 33c4dca4..268f3e3e 100644 --- a/module/search/search.php +++ b/module/search/search.php @@ -92,9 +92,11 @@ class search extends common { // Mise à jour 2.2 if (version_compare($versionData, '2.2', '<') ) { - // Déplacer les données du dossier Pages - $this->copyDir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0), self::DATADIRECTORY . $this->getUrl(0)); - $this->removeDir(self::DATADIRECTORY . 'pages/'); + if (is_dir(self::DATADIRECTORY . 'pages/')) { + // Déplacer les données du dossier Pages + $this->copyDir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0), self::DATADIRECTORY . $this->getUrl(0)); + $this->removeDir(self::DATADIRECTORY . 'pages/'); + } // Mettre à jour la version $this->setData(['module',$this->getUrl(0),'config', 'versionData', '2.2' ]); } From 85f31d986d986fafe15151d9a0131c9f66e27556 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 7 Jun 2021 13:27:52 +0200 Subject: [PATCH 2/4] addon import page content --- core/module/addon/addon.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/core/module/addon/addon.php b/core/module/addon/addon.php index 6b7c05d2..3e2a0f1d 100644 --- a/core/module/addon/addon.php +++ b/core/module/addon/addon.php @@ -550,6 +550,8 @@ class addon extends common { if( $list === ''){ file_put_contents(self::DATA_DIR . '/' .$key . '/' . $fileTarget . '.json', json_encode( $data ,JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT|LOCK_EX) ); } + // copie du contenu de la page + $this->copyDir (self::TEMP_DIR . $tempFolder . '/' .$key . '/content', self::DATA_DIR . '/' .$key . '/'); // Supprimer les fichiers importés unlink (self::TEMP_DIR . $tempFolder . '/' .$key . '/' . $fileTarget . '.json'); } From a8ebd8cc732c824944e2b94fbf47dccbac05ab89 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 7 Jun 2021 18:59:18 +0200 Subject: [PATCH 3/4] bug i18n advanced --- core/module/config/config.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/module/config/config.php b/core/module/config/config.php index ad98ce40..c9b2c6fb 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -479,6 +479,9 @@ class config extends common { 'timeout' => $this->getInput('configAdvancedConnectTimeout',helper::FILTER_INT), 'log' => $this->getInput('configAdvancedConnectLog',helper::FILTER_BOOLEAN), 'captcha' => $this->getInput('configAdvancedConnectCaptcha',helper::FILTER_BOOLEAN), + ], + 'i18n' => [ + 'enabled' => $this->getData(['config', 'i18n', 'enabled']) ] ] ]); From 3f94b9f3de7389fe8e5a9a8257b3669a9e3e9438 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 7 Jun 2021 19:02:38 +0200 Subject: [PATCH 4/4] addon bug import --- core/module/addon/addon.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/module/addon/addon.php b/core/module/addon/addon.php index 3e2a0f1d..851c22fb 100644 --- a/core/module/addon/addon.php +++ b/core/module/addon/addon.php @@ -551,7 +551,7 @@ class addon extends common { file_put_contents(self::DATA_DIR . '/' .$key . '/' . $fileTarget . '.json', json_encode( $data ,JSON_UNESCAPED_UNICODE|JSON_PRETTY_PRINT|LOCK_EX) ); } // copie du contenu de la page - $this->copyDir (self::TEMP_DIR . $tempFolder . '/' .$key . '/content', self::DATA_DIR . '/' .$key . '/'); + $this->copyDir (self::TEMP_DIR . $tempFolder . '/' .$key . '/content', self::DATA_DIR . '/' .$key . '/content'); // Supprimer les fichiers importés unlink (self::TEMP_DIR . $tempFolder . '/' .$key . '/' . $fileTarget . '.json'); }