Fix bugs theme import export

This commit is contained in:
Fred Tempez 2023-10-05 14:35:57 +02:00
parent 7180f6ebd0
commit 821709a7dc
2 changed files with 15 additions and 8 deletions

View File

@ -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/';

View File

@ -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);