From 821709a7dc8190ef4c405066971e47bfd7acfd47 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Thu, 5 Oct 2023 14:35:57 +0200 Subject: [PATCH] Fix bugs theme import export --- core/core.php | 2 +- core/module/theme/theme.php | 21 ++++++++++++++------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/core/core.php b/core/core.php index 52fe6fb..8a17448 100644 --- a/core/core.php +++ b/core/core.php @@ -50,7 +50,7 @@ class common const ACCESS_TIMER = 1800; // Numéro de version - const ZWII_VERSION = '1.0.16'; + const ZWII_VERSION = '1.0.17'; // URL autoupdate const ZWII_UPDATE_URL = 'https://forge.chapril.org/ZwiiCMS-Team/update/raw/branch/master/lms/'; diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index b348ed4..333bc56 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -1000,6 +1000,7 @@ class theme extends common ; } } + // Valeurs en sortie $this->addOutput([ 'title' => helper::translate('Gestion des thèmes'), @@ -1043,8 +1044,8 @@ class theme extends common // Archive de thème ? if ( file_exists(self::TEMP_DIR . $tempFolder . '/site/data/custom.css') - and file_exists(self::TEMP_DIR . $tempFolder . '/site/data/' . self::$siteContent . '/theme.css') - and file_exists(self::TEMP_DIR . $tempFolder . '/site/data/' . self::$siteContent . '/theme.json') + and file_exists(self::TEMP_DIR . $tempFolder . '/site/data//theme.css') + and file_exists(self::TEMP_DIR . $tempFolder . '/site/data//theme.json') ) { $modele = 'theme'; } @@ -1060,13 +1061,18 @@ class theme extends common // Substitution des fontes Google if ($modele = 'theme') { - $c = $this->subFont(self::DATA_DIR . 'theme.json'); + // Déplacement des deux fichiers de theme dans le siteContent + copy (self::DATA_DIR . 'theme.css', self::DATA_DIR . self::$siteContent . '/theme.css'); + copy (self::DATA_DIR . 'theme.json', self::DATA_DIR . self::$siteContent . '/theme.json'); + unlink(self::DATA_DIR . 'theme.css'); + unlink(self::DATA_DIR . 'theme.json'); + $c = $this->subFont(self::DATA_DIR . self::$siteContent . '/theme.json'); // Un remplacement nécessite la régénération de la feuille de style if ( $c > 0 - and file_exists(self::DATA_DIR . self::$siteContent . 'theme.css') + and file_exists(self::DATA_DIR . self::$siteContent . '/theme.css') ) { - unlink(self::DATA_DIR . self::$siteContent . 'theme.css'); + unlink(self::DATA_DIR . self::$siteContent . '/theme.css'); } } if ($modele = 'admin') { @@ -1191,8 +1197,8 @@ class theme extends common } break; case 'theme': - $zip->addFile(self::DATA_DIR . 'theme.json', self::DATA_DIR . 'theme.json'); - $zip->addFile(self::DATA_DIR . self::$siteContent . 'theme.css', self::DATA_DIR . self::$siteContent . 'theme.css'); + $zip->addFile(self::DATA_DIR . self::$siteContent . '/theme.json', self::DATA_DIR . 'theme.json'); + $zip->addFile(self::DATA_DIR . self::$siteContent . '/theme.css', self::DATA_DIR . 'theme.css'); $zip->addFile(self::DATA_DIR . 'custom.css', self::DATA_DIR . 'custom.css'); // Traite l'image dans le body if ($this->getData(['theme', 'body', 'image']) !== '') { @@ -1229,6 +1235,7 @@ class theme extends common } break; } + $ret = $zip->close(); } return ($zipFilename);