From 63d02f358c2e9b8047f72af41f25aede55811f81 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 4 Apr 2023 16:59:05 +0200 Subject: [PATCH] Bugs d'installation avec les BDD au singulier WIP --- LISEZMOI.md | 2 +- core/class/layout.class.php | 4 +- core/class/router.class.php | 10 +- core/core.php | 2 + core/include/update.inc.php | 3 +- core/module/install/ressource/defaultdata.php | 146 ++++++++++-------- .../install/ressource/i18n/language.json | 16 -- core/module/theme/theme.php | 12 +- 8 files changed, 99 insertions(+), 96 deletions(-) delete mode 100644 core/module/install/ressource/i18n/language.json diff --git a/LISEZMOI.md b/LISEZMOI.md index b2f54115..2d233533 100644 --- a/LISEZMOI.md +++ b/LISEZMOI.md @@ -79,7 +79,7 @@ A l'occasion de l'installation d'une verion majeure, il est recommandé de réal [R] content Dossier des contenus de page [F] accueil.html Exemple contenu de la page d'accueil [R] fonts Dossier contenant les fontes installées - [F] fonts.html Fichier contenant les appels des fontes à charger sur cdnFonts + [F] font.html Fichier contenant les appels des fontes à charger sur cdnFonts [F] fonts.css Fichier contenant la feuille de style liée aux polices de caractères locales [F] fontes.woff Fichiers locaux des fontes (woff, etc..) [R] modules Personnalisation des modules ou données propres diff --git a/core/class/layout.class.php b/core/class/layout.class.php index 9e12727a..b429f25e 100644 --- a/core/class/layout.class.php +++ b/core/class/layout.class.php @@ -1100,8 +1100,8 @@ class layout extends common public function showFonts() { // Import des fontes liées au thème - if (file_exists(self::DATA_DIR . 'fonts/fonts.html')) { - include_once(self::DATA_DIR . 'fonts/fonts.html'); + if (file_exists(self::DATA_DIR . 'fonts/font.html')) { + include_once(self::DATA_DIR . 'fonts/font.html'); } } diff --git a/core/class/router.class.php b/core/class/router.class.php index b786ff26..3ffaeb1b 100644 --- a/core/class/router.class.php +++ b/core/class/router.class.php @@ -123,7 +123,7 @@ class core extends common } /** - * Chargement des polices en ligne dans un fichier fonts.html inclus dans main.php + * Chargement des polices en ligne dans un fichier font.html inclus dans main.php */ $fontFile = ''; $gf = false; @@ -142,7 +142,7 @@ class core extends common if (!is_dir(self::DATA_DIR . 'font')) { mkdir(self::DATA_DIR . 'font'); } - file_put_contents(self::DATA_DIR . 'fonts/fonts.html', $fontFile); + file_put_contents(self::DATA_DIR . 'fonts/font.html', $fontFile); /** * Fontes installées localement @@ -322,7 +322,7 @@ class core extends common if (!is_dir(self::DATA_DIR . 'font')) { mkdir(self::DATA_DIR . 'font'); } - file_put_contents(self::DATA_DIR . 'fonts/fonts.html', $fontFile); + file_put_contents(self::DATA_DIR . 'fonts/font.html', $fontFile); // Enregistre la personnalisation file_put_contents(self::DATA_DIR . 'theme.css', $css); @@ -369,7 +369,7 @@ class core extends common } /** - * Chargement des polices en ligne dans un fichier fonts.html inclus dans main.php + * Chargement des polices en ligne dans un fichier font.html inclus dans main.php */ $fontFile = ''; foreach ($fonts as $fontId) { @@ -380,7 +380,7 @@ class core extends common } } // Enregistre la personnalisation - file_put_contents(self::DATA_DIR . 'fonts/fonts.html', $fontFile); + file_put_contents(self::DATA_DIR . 'fonts/font.html', $fontFile); /** * Fontes installées localement diff --git a/core/core.php b/core/core.php index 8bbe4ae1..cf5b165e 100644 --- a/core/core.php +++ b/core/core.php @@ -601,12 +601,14 @@ class common { // Créer la base de données des langues + /* if ($module === 'language') { copy('core/module/install/ressource/i18n/language.json', self::DATA_DIR . 'language.json'); $this->copyDir('core/module/install/ressource/i18n', self::I18N_DIR); unlink(self::I18N_DIR . 'language.json'); return; } + */ // Tableau avec les données vierges require_once('core/module/install/ressource/defaultdata.php'); diff --git a/core/include/update.inc.php b/core/include/update.inc.php index 255bd59b..5edf1a4a 100644 --- a/core/include/update.inc.php +++ b/core/include/update.inc.php @@ -954,7 +954,8 @@ if ($this->getData(['core', 'dataVersion']) < 12301) { if ($this->getData(['core', 'dataVersion']) < 12400) { // Nettoyage du dossier de langue d'installation' - unlink('core/vendor/tinymce/langs/langs.zip'); + if (file_exists('core/vendor/tinymce/langs/langs.zip')) + unlink('core/vendor/tinymce/langs/langs.zip'); if (file_exists('core/module/install/ressource/i18n/de.json')) unlink('core/module/install/ressource/i18n/de.json'); if (file_exists('core/module/install/ressource/i18n/it.json')) diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index f4b55339..7f2836f8 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -90,12 +90,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' => [ @@ -207,7 +207,7 @@ class init extends common ], 'module' => [], 'user' => [], - 'theme' => [ + 'theme' => [ 'body' => [ 'backgroundColor' => 'rgba(236, 239, 241, 1)', 'image' => '', @@ -333,7 +333,20 @@ class init extends common 'borderBlockColor' => 'rgba(190, 202, 209, 1)' ], 'blacklist' => [], - 'language'=> [], + 'language' => [ + "fr_FR" => [ + "version" => 12300, + "date" => 1677838293 + ], + "es" => [ + "version" => 12300, + "date" => 1677838293 + ], + "en_EN" => [ + "version" => 12300, + "date" => 1677838293 + ] + ], 'profil' => [ '-1' => [ 'name' => 'Banni', @@ -374,33 +387,33 @@ class init extends common ] ], '1' => [ - 'name' => 'Membre', - 'readonly' => false, - 'comment' => 'Accède aux pages réservées et à un dossier partagé', - 'file' => [ - 'download' => false, - 'edit' => false, - 'create' => false, - 'rename' => false, - 'upload' => false, - 'delete' => false, - 'preview' => false, - 'duplicate' => false, - 'extract' => false, - 'copycut' => false, - 'chmod' => false - ], - 'folder' => [ - 'create' => false, - 'delete' => false, - 'rename' => false, - 'copycut' => false, - 'chmod' => false, - 'share' => true, - 'path' => './site/file/source/partage/', - ] + 'name' => 'Membre', + 'readonly' => false, + 'comment' => 'Accède aux pages réservées et à un dossier partagé', + 'file' => [ + 'download' => false, + 'edit' => false, + 'create' => false, + 'rename' => false, + 'upload' => false, + 'delete' => false, + 'preview' => false, + 'duplicate' => false, + 'extract' => false, + 'copycut' => false, + 'chmod' => false ], + 'folder' => [ + 'create' => false, + 'delete' => false, + 'rename' => false, + 'copycut' => false, + 'chmod' => false, + 'share' => true, + 'path' => './site/file/source/partage/', + ] ], + ], '2' => [ '0' => [ 'name' => 'Modérateur', @@ -571,7 +584,7 @@ class init extends common 'block' => '12', 'barLeft' => '', 'barRight' => '', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -598,7 +611,7 @@ class init extends common 'block' => '12', 'barLeft' => '', 'barRight' => '', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -625,7 +638,7 @@ class init extends common 'block' => '4-8', 'barLeft' => 'barre', 'barRight' => '', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -652,7 +665,7 @@ class init extends common 'block' => '9-3', 'barLeft' => '', 'barRight' => 'barrelateraleavecmenu', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -679,7 +692,7 @@ class init extends common 'block' => '12', 'barLeft' => '', 'barRight' => '', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -706,7 +719,7 @@ class init extends common 'block' => '12', 'barLeft' => '', 'barRight' => '', - 'displayMenu' => 'none', + 'displayMenu' => 'none', 'hideMenuSide' => false, 'hideMenuChildren' => false, 'extraPosition' => false, @@ -987,13 +1000,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, @@ -1006,13 +1020,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, @@ -1025,13 +1040,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 ], ], ], @@ -1081,24 +1097,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' => [ @@ -1267,4 +1283,4 @@ class init extends common 'content' => '

Rechercher dans le site

' ] ]; -} +} \ No newline at end of file diff --git a/core/module/install/ressource/i18n/language.json b/core/module/install/ressource/i18n/language.json deleted file mode 100644 index 4625d747..00000000 --- a/core/module/install/ressource/i18n/language.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "languages": { - "fr_FR": { - "version": 12300, - "date": 1677838293 - }, - "es": { - "version": 12300, - "date": 1677838293 - }, - "en_EN": { - "version": 12300, - "date": 1677838293 - } - } -} \ No newline at end of file diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index e0c0c659..5bbcb4a0 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -1083,9 +1083,9 @@ class theme extends common foreach ($fonts as $fontId => $fontName) { $zip->addFile(self::DATA_DIR . 'fonts/' . $fontName, self::DATA_DIR . 'fonts/' . $fontName); } - if (file_exists(self::DATA_DIR . 'fonts/fonts.html')) { + if (file_exists(self::DATA_DIR . 'fonts/font.html')) { - $zip->addFile(self::DATA_DIR . 'fonts/fonts.html', self::DATA_DIR . 'fonts/fonts.html'); + $zip->addFile(self::DATA_DIR . 'fonts/font.html', self::DATA_DIR . 'fonts/font.html'); } break; case 'theme': @@ -1121,9 +1121,9 @@ class theme extends common foreach ($fonts as $fontId => $fontName) { $zip->addFile(self::DATA_DIR . 'fonts/' . $fontName, self::DATA_DIR . 'fonts/' . $fontName); } - if (file_exists(self::DATA_DIR . 'fonts/fonts.html')) { + if (file_exists(self::DATA_DIR . 'fonts/font.html')) { - $zip->addFile(self::DATA_DIR . 'fonts/fonts.html', self::DATA_DIR . 'fonts/fonts.html'); + $zip->addFile(self::DATA_DIR . 'fonts/font.html', self::DATA_DIR . 'fonts/font.html'); } break; } @@ -1236,7 +1236,7 @@ class theme extends common $fontsInstalled = array_unique($fontsInstalled); /** - * Chargement des polices en ligne dans un fichier fonts.html inclus dans main.php + * Chargement des polices en ligne dans un fichier font.html inclus dans main.php */ $gf = false; $fileContent = ''; @@ -1287,7 +1287,7 @@ class theme extends common } // Enregistre la personnalisation - file_put_contents(self::DATA_DIR . 'fonts/fonts.html', $fileContent); + file_put_contents(self::DATA_DIR . 'fonts/font.html', $fileContent); // Enregistre la personnalisation file_put_contents(self::DATA_DIR . 'fonts/fonts.css', $fileContentCss); }