From 5ce8eefa6bed7e5ce75cb5297122e3daebc45553 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 7 Jun 2021 10:57:03 +0200 Subject: [PATCH] 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' ]); }