From 26fe5fb21472930a28d0ecd6a48dbc75bf4f5562 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 11 Apr 2021 19:13:08 +0200 Subject: [PATCH 1/7] blog example defaultdata --- core/module/install/ressource/defaultdata.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 67b1b38b..01d695ce 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -663,12 +663,7 @@ class init extends common { 'config' => [ 'feeds' => true, 'feedsLabel' => "Syndication RSS", - "editConsent" => "all", - "commentMaxlength" => "500", - "commentApproved" => false, - "commentClose" => false, - "commentNotification" => false, - "commentGroupNotification" => 1 + 'itemsperPage' => 4 ], 'posts' => [ 'mon-premier-article' => [ From 452123813e600e79fb56ceeb3c03f337d2517ba4 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 11 Apr 2021 19:20:48 +0200 Subject: [PATCH 2/7] Blog site sample Positions not set --- core/module/install/ressource/defaultdata.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 01d695ce..9c0245c7 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -681,6 +681,7 @@ class init extends common { 'picture' => 'galerie/landscape/meadow.jpg', 'hidePicture' => false, 'pictureSize' => 20, + 'picturePosition' => 'left', 'publishedOn' => 1548790902, 'state' => true, 'title' => 'Mon premier article', @@ -699,6 +700,7 @@ class init extends common { 'picture' => 'galerie/landscape/desert.jpg', 'hidePicture' => false, 'pictureSize' => 40, + 'picturePosition' => 'right', 'publishedOn' => 1550432502, 'state' => true, 'title' => 'Mon deuxième article', @@ -717,6 +719,7 @@ class init extends common { 'picture' => 'galerie/landscape/iceberg.jpg', 'hidePicture' => false, 'pictureSize' => 100, + 'picturePosition' => 'left', 'publishedOn' => 1550864502, 'state' => true, 'title' => 'Mon troisième article', From 4d17eebdd63df76cd66f88bad03c3a6f02d44b53 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 11 Apr 2021 19:24:50 +0200 Subject: [PATCH 3/7] Blog Nettoyage des espaces inutiles --- module/blog/view/article/article.php | 6 +++--- module/blog/view/edit/edit.php | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/module/blog/view/article/article.php b/module/blog/view/article/article.php index 98cafbac..05f9626b 100755 --- a/module/blog/view/article/article.php +++ b/module/blog/view/article/article.php @@ -20,11 +20,11 @@ $heure = mb_detect_encoding(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])), 'UTF-8', true) ? strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn'])) : utf8_encode(strftime('%H:%M', $this->getData(['module', $this->getUrl(0), 'posts', $this->getUrl(1), 'publishedOn']))); - echo $date . ' à ' . $heure; + echo $date . ' à ' . $heure; ?> getUser('password') === $this->getInput('ZWII_USER_PASSWORD') AND ( // Propriétaire @@ -55,7 +55,7 @@
- ' . $this->getData(['module',$this->getUrl(0), 'config', 'feedsLabel']) . '

' ; ?>
diff --git a/module/blog/view/edit/edit.php b/module/blog/view/edit/edit.php index a492e10c..02d334ed 100755 --- a/module/blog/view/edit/edit.php +++ b/module/blog/view/edit/edit.php @@ -8,7 +8,7 @@ 'value' => 'Retour' ]); ?>
-
+
true, 'value' => 'Enregistrer en brouillon' @@ -21,7 +21,6 @@ 'Publier' ]); ?> -
From cde0e525282929b323d619790796f05a3a6e7417 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 11 Apr 2021 19:53:41 +0200 Subject: [PATCH 4/7] Gallery sample defalutdata --- core/module/install/ressource/defaultdata.php | 6 ++++-- module/gallery/gallery.php | 12 +++--------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 9c0245c7..493744e5 100755 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -774,7 +774,7 @@ class init extends common { ] ], ], - 'config' => [ + 'theme' => [ 'thumbAlign' => 'center', 'thumbWidth' => '18em', 'thumbHeight' => '15em', @@ -789,9 +789,11 @@ class init extends common { 'legendAlign' => 'center', 'legendTextColor' => 'rgba(255, 255, 255, 1)', 'legendBgColor' => 'rgba(0, 0, 0, .6)', - 'versionData' => '3.0', 'style' => 'site/data/modules/gallery/galeries.css' ], + 'config' => [ + 'versionData' => '3.0' + ], ], 'site-de-zwii' => [ 'url' => 'https://zwiicms.fr/', diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 2346ba3c..69f55f5b 100755 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -149,6 +149,7 @@ class gallery extends common { */ private function update() { + // Mise à jour d'une version inférieure, la gallery existe mais pas content if ($this->getData(['module', $this->getUrl(0)]) && $this->getData(['module', $this->getUrl(0), 'content']) === NULL ) { @@ -172,9 +173,6 @@ class gallery extends common { $this->setData(['module', $this->getUrl(0), 'theme', $data]); // Nom de la feuille de style $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $moduleId . '.css']); - } else { - // Theme par défaut - $this->init($this->geturl(0)); } // Nouvelle version $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.0']); @@ -301,9 +299,7 @@ class gallery extends common { $this->update(); // Initialisation d'un nouveau module - if ($this->getData(['module', $this->getUrl(0)]) === null) { - $this->init($this->getUrl(0)); - } + $this->init($this->getUrl(0)); //Affichage de la galerie triée $g = $this->getData(['module', $this->getUrl(0), 'content']); @@ -589,9 +585,7 @@ class gallery extends common { $this->update(); // Initialisation d'un nouveau module - if ($this->getData(['module', $this->getUrl(0)]) === null) { - $this->init($this->getUrl(0)); - } + $this->init($this->getUrl(0)); // Images d'une galerie if($this->getUrl(1)) { From d25dbd3a81c432f24613210eb2b16d9a958d25ff Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sun, 11 Apr 2021 20:09:46 +0200 Subject: [PATCH 5/7] =?UTF-8?q?Blog=20bouton=20d=C3=A9plac=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/blog/view/edit/edit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/blog/view/edit/edit.php b/module/blog/view/edit/edit.php index 02d334ed..3ef8006c 100755 --- a/module/blog/view/edit/edit.php +++ b/module/blog/view/edit/edit.php @@ -8,7 +8,7 @@ 'value' => 'Retour' ]); ?>
-
+
true, 'value' => 'Enregistrer en brouillon' From 2f5a8c565d40455a272c7fd6e86f0519094c7eb4 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 12 Apr 2021 12:03:55 +0200 Subject: [PATCH 6/7] change --- CHANGES.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGES.md b/CHANGES.md index 2f9116af..2329c986 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,7 +3,7 @@ ## version 10.6.00 Cette version apporte aux modules une autonomie complète par rapport au noyau. - mise à jour interne (fonction update) - - feuille de style propres aux instances (fonction initCss) + - feuille de style propres aux instances (fonction init) - Modifications : - Module Search : en l'absence de texte dans le bouton Rechercher, une loupe est affichée. From b4da3b7d98b328facb851aef5be2fdfba4ae6ed6 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Mon, 12 Apr 2021 17:54:31 +0200 Subject: [PATCH 7/7] Simplification + gestion des ressources de module au niveau de la page --- CHANGES.md | 3 +- README.md | 9 ++- core/module/page/page.php | 17 ++++ module/gallery/gallery.php | 103 ++++++++++++------------ module/news/news.php | 67 ++++++++------- module/search/ressource/defaultdata.php | 2 +- module/search/search.php | 63 +++++++-------- 7 files changed, 139 insertions(+), 125 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 2329c986..6e8b3b5b 100755 --- a/CHANGES.md +++ b/CHANGES.md @@ -5,7 +5,8 @@ Cette version apporte aux modules une autonomie complète par rapport au noyau. - mise à jour interne (fonction update) - feuille de style propres aux instances (fonction init) - Modifications : - - Module Search : en l'absence de texte dans le bouton Rechercher, une loupe est affichée. + - Module search : en l'absence de texte dans le bouton Rechercher, une loupe est affichée. + - Modules search, news et gallery, chaque module de page dispose de réglages de thème stockés dans des feuilles de style séparés. Nouvelle structure de données distinguant configuration, données et thème. ## version 10.5.02 - Corrections : diff --git a/README.md b/README.md index 02f45c9a..e678297a 100755 --- a/README.md +++ b/README.md @@ -60,22 +60,23 @@ Pour revenir à la version 8, renommez ce fichier "data.json". [R] vendor Librairies extérieures [F] core.js.php Cœur javascript [F] core.php Cœur PHP - + [R] module Modules de page [R] blog Blog [R] form Gestionnaire de formulaires [R] gallery Galerie [R] news Nouvelles [R] redirection Redirection - + [R] site Contenu du site [R] backup Sauvegardes automatiques [R] data Répertoire des données [R] fr Dossier localisé [F] page.json Données des pages [F] module.json Données des modules de pages + [R] modules Personnalisation des modules ou données propres [F] admin.css Thème des pages d'administration - [F] admin.json Données de thème des pages d'administration + [F] admin.json Données de thème des pages d'administration [F] blacklist.json Journalisation des tentatives de connexion avec des comptes inconnus [F] config.json Configuration du site [F] core.json Configuration du noyau @@ -89,7 +90,7 @@ Pour revenir à la version 8, renommez ce fichier "data.json". [R] source Ressources diverses [R] thumb Miniatures des images [R] tmp Répertoire temporaire - + [F] index.php Fichier d'initialisation de ZwiiCMS [F] robots.txt Filtrage des répertoires accessibles aux robots des moteurs de recherche [F] sitemap.xml Plan du site diff --git a/core/module/page/page.php b/core/module/page/page.php index f842e3da..744e5eda 100755 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -258,6 +258,13 @@ class page extends common { } // Suppression else { + + // Effacer le dossier du module + $moduleId = $this->getData(['page',$url[0],'moduleId']); + $modulesData = helper::getModules(); + if (is_dir($modulesData[$moduleId]['dataDirectory'])) { + $this->removeDir( $modulesData[$moduleId]['dataDirectory'] ); + } // Effacer la page $this->deleteData(['page', $url[0]]); $this->deleteData(['module', $url[0]]); @@ -312,6 +319,16 @@ class page extends common { if ($this->getData(['module', $this->getUrl(2)]) !== null ) { $this->setData(['module', $pageId, $this->getData(['module', $this->getUrl(2)])]); $this->deleteData(['module', $this->getUrl(2)]); + // Renommer le dossier du module + $moduleId = $this->getData(['page',$this->getUrl(2),'moduleId']); + $modulesData = helper::getModules(); + if (is_dir($modulesData[$moduleId]['dataDirectory'])) { + // Renommer la feuille de style + rename( $modulesData[$moduleId]['dataDirectory'],str_replace($this->geturl(2),$pageId, $modulesData[$moduleId]['dataDirectory'])); + $this->removeDir($modulesData[$moduleId]['dataDirectory']); + // Mettre à jour le nom de la feuille de site + $this->setData(['module',$pageId,'theme','style',str_replace($this->geturl(2),$pageId, $modulesData[$moduleId]['dataDirectory'])]); + } } // Si la page correspond à la page d'accueil, change l'id dans la configuration du site if($this->getData(['locale', 'homePageId']) === $this->getUrl(2)) { diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 69f55f5b..7e0d406d 100755 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -149,7 +149,6 @@ class gallery extends common { */ private function update() { - // Mise à jour d'une version inférieure, la gallery existe mais pas content if ($this->getData(['module', $this->getUrl(0)]) && $this->getData(['module', $this->getUrl(0), 'content']) === NULL ) { @@ -172,7 +171,7 @@ class gallery extends common { $this->deleteData(['theme','gallery']); $this->setData(['module', $this->getUrl(0), 'theme', $data]); // Nom de la feuille de style - $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $moduleId . '.css']); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']); } // Nouvelle version $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.0']); @@ -185,49 +184,50 @@ class gallery extends common { * Config * Content */ - private function init($moduleId) { + private function init() { // Variable commune - $fileCSS = self::DATADIRECTORY . $moduleId . '.css' ; + $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ; // Check la présence du thème - if ( $this->getData(['module', $moduleId, 'theme']) === null ) { + if ( $this->getData(['module', $this->getUrl(0), 'theme']) === null ) { require_once('module/gallery/ressource/defaultdata.php'); - $this->setData(['module', $moduleId, 'theme', theme::$defaultTheme]); + $this->setData(['module', $this->getUrl(0), 'theme', theme::$defaultTheme]); + // Nom de la feuille de style + $this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]); } // Check la présence de la feuille de style - if ( !file_exists(self::DATADIRECTORY . $moduleId . '.css')) { + if ( !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) { // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY )) { - mkdir (self::DATADIRECTORY, 0777, true); + if (!is_dir(self::DATADIRECTORY . $this->getUrl(0) )) { + mkdir (self::DATADIRECTORY . $this->getUrl(0), 0777, true); } - // Nom de la feuille de style - $this->setData(['module', $moduleId, 'theme', 'style', $fileCSS]); - // Générer la feuille de CSS $content = file_get_contents('module/gallery/ressource/vartheme.css'); $themeCss = file_get_contents('module/gallery/ressource/theme.css'); // Injection des variables - $content = str_replace('#thumbAlign#',$this->getData(['module', $moduleId, 'theme', 'thumbAlign']),$content ); - $content = str_replace('#thumbWidth#',$this->getData(['module', $moduleId, 'theme', 'thumbWidth']),$content ); - $content = str_replace('#thumbHeight#',$this->getData(['module', $moduleId, 'theme', 'thumbHeight']),$content ); - $content = str_replace('#thumbMargin#',$this->getData(['module', $moduleId, 'theme', 'thumbMargin']),$content ); - $content = str_replace('#thumbBorder#',$this->getData(['module', $moduleId, 'theme', 'thumbBorder']),$content ); - $content = str_replace('#thumbBorderColor#',$this->getData(['module', $moduleId, 'theme', 'thumbBorderColor']),$content ); - $content = str_replace('#thumbOpacity#',$this->getData(['module', $moduleId, 'theme', 'thumbOpacity']),$content ); - $content = str_replace('#thumbShadows#',$this->getData(['module', $moduleId, 'theme', 'thumbShadows']),$content ); - $content = str_replace('#thumbShadowsColor#',$this->getData(['module', $moduleId, 'theme', 'thumbShadowsColor']),$content ); - $content = str_replace('#thumbRadius#',$this->getData(['module', $moduleId, 'theme', 'thumbRadius']),$content ); - $content = str_replace('#legendAlign#',$this->getData(['module', $moduleId, 'theme', 'legendAlign']),$content ); - $content = str_replace('#legendHeight#',$this->getData(['module', $moduleId, 'theme', 'legendHeight']),$content ); - $content = str_replace('#legendTextColor#',$this->getData(['module', $moduleId, 'theme', 'legendTextColor']),$content ); - $content = str_replace('#legendBgColor#',$this->getData(['module', $moduleId, 'theme', 'legendBgColor']),$content ); + $content = str_replace('#thumbAlign#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbAlign']),$content ); + $content = str_replace('#thumbWidth#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbWidth']),$content ); + $content = str_replace('#thumbHeight#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbHeight']),$content ); + $content = str_replace('#thumbMargin#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbMargin']),$content ); + $content = str_replace('#thumbBorder#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbBorder']),$content ); + $content = str_replace('#thumbBorderColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbBorderColor']),$content ); + $content = str_replace('#thumbOpacity#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbOpacity']),$content ); + $content = str_replace('#thumbShadows#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbShadows']),$content ); + $content = str_replace('#thumbShadowsColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbShadowsColor']),$content ); + $content = str_replace('#thumbRadius#',$this->getData(['module', $this->getUrl(0), 'theme', 'thumbRadius']),$content ); + $content = str_replace('#legendAlign#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendAlign']),$content ); + $content = str_replace('#legendHeight#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendHeight']),$content ); + $content = str_replace('#legendTextColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendTextColor']),$content ); + $content = str_replace('#legendBgColor#',$this->getData(['module', $this->getUrl(0), 'theme', 'legendBgColor']),$content ); // Ecriture de la feuille de style - file_put_contents(self::DATADIRECTORY . $moduleId . '.css' , $content . $themeCss); + file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' , $content . $themeCss); + // Nom de la feuille de style + $this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]); } // Check Config - if ( $this->getData(['module', $moduleId, 'config']) === null ) { + if ( $this->getData(['module', $this->getUrl(0), 'config']) === null ) { require_once('module/gallery/ressource/defaultdata.php'); - $this->setData(['module', $moduleId, 'config', theme::$defaultData]); + $this->setData(['module', $this->getUrl(0), 'config', theme::$defaultData]); } // Contenu vide de la galerie @@ -299,7 +299,7 @@ class gallery extends common { $this->update(); // Initialisation d'un nouveau module - $this->init($this->getUrl(0)); + $this->init(); //Affichage de la galerie triée $g = $this->getData(['module', $this->getUrl(0), 'content']); @@ -585,7 +585,7 @@ class gallery extends common { $this->update(); // Initialisation d'un nouveau module - $this->init($this->getUrl(0)); + $this->init(); // Images d'une galerie if($this->getUrl(1)) { @@ -727,29 +727,26 @@ class gallery extends common { } // Soumission du formulaire if($this->isPost()) { - // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY )) { - mkdir (self::DATADIRECTORY, 0777, true); + if (!is_dir(self::DATADIRECTORY . $this->getUrl(0) )) { + mkdir (self::DATADIRECTORY . $this->getUrl(0), 0777, true); } - $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '.css' ; - // Fin feuille de style - $this->getData(['module', $this->getUrl(0), 'theme', [ - 'thumbAlign' => $this->getinput('galleryThemeThumbAlign'), - 'thumbWidth' => $this->getinput('galleryThemeThumbWidth'), - 'thumbHeight' => $this->getinput('galleryThemeThumbHeight'), - 'thumbMargin' => $this->getinput('galleryThemeThumbMargin'), - 'thumbBorder' => $this->getinput('galleryThemeThumbBorder'), - 'thumbBorderColor' => $this->getinput('galleryThemeThumbBorderColor'), - 'thumbOpacity' => $this->getinput('galleryThemeThumbOpacity'), - 'thumbShadows' => $this->getinput('galleryThemeThumbShadows'), - 'thumbShadowsColor' => $this->getinput('galleryThemeThumbShadowsColor'), - 'thumbRadius' => $this->getinput('galleryThemeThumbRadius'), - 'legendHeight' => $this->getinput('galleryThemeLegendHeight'), - 'legendAlign' => $this->getinput('galleryThemeLegendAlign'), - 'legendTextColor' => $this->getinput('galleryThemeLegendTextColor'), - 'legendBgColor' => $this->getinput('galleryThemeLegendBgColor'), - 'style' => $fileCSS, + $this->setData(['module', $this->getUrl(0), 'theme', [ + 'thumbAlign' => $this->getinput('galleryThemeThumbAlign', helper::FILTER_STRING_SHORT), + 'thumbWidth' => $this->getinput('galleryThemeThumbWidth', helper::FILTER_STRING_SHORT), + 'thumbHeight' => $this->getinput('galleryThemeThumbHeight', helper::FILTER_STRING_SHORT), + 'thumbMargin' => $this->getinput('galleryThemeThumbMargin', helper::FILTER_STRING_SHORT), + 'thumbBorder' => $this->getinput('galleryThemeThumbBorder', helper::FILTER_STRING_SHORT), + 'thumbBorderColor' => $this->getinput('galleryThemeThumbBorderColor', helper::FILTER_STRING_SHORT), + 'thumbOpacity' => $this->getinput('galleryThemeThumbOpacity', helper::FILTER_STRING_SHORT), + 'thumbShadows' => $this->getinput('galleryThemeThumbShadows', helper::FILTER_STRING_SHORT), + 'thumbShadowsColor' => $this->getinput('galleryThemeThumbShadowsColor', helper::FILTER_STRING_SHORT), + 'thumbRadius' => $this->getinput('galleryThemeThumbRadius', helper::FILTER_STRING_SHORT), + 'legendHeight' => $this->getinput('galleryThemeLegendHeight', helper::FILTER_STRING_SHORT), + 'legendAlign' => $this->getinput('galleryThemeLegendAlign', helper::FILTER_STRING_SHORT), + 'legendTextColor' => $this->getinput('galleryThemeLegendTextColor', helper::FILTER_STRING_SHORT), + 'legendBgColor' => $this->getinput('galleryThemeLegendBgColor', helper::FILTER_STRING_SHORT), + 'style' => self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ]]); // Création des fichiers CSS $content = file_get_contents('module/gallery/ressource/vartheme.css'); @@ -769,7 +766,7 @@ class gallery extends common { $content = str_replace('#legendHeight#',$this->getinput('galleryThemeLegendHeight'),$content ); $content = str_replace('#legendTextColor#',$this->getinput('galleryThemeLegendTextColor'),$content ); $content = str_replace('#legendBgColor#',$this->getinput('galleryThemeLegendBgColor'),$content ); - $success = file_put_contents($fileCSS, $content . $themeCss); + $success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $content . $themeCss); // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl() . '/theme', diff --git a/module/news/news.php b/module/news/news.php index 4af1cb48..cdd91409 100755 --- a/module/news/news.php +++ b/module/news/news.php @@ -177,29 +177,27 @@ class news extends common { $this->update(); // Initialisation d'un nouveau module - if ($this->getData(['module', $this->getUrl(0)]) === null) { - $this->init($this->getUrl(0)); - } + $this->init(); // Soumission du formulaire if($this->isPost()) { - // Générer la feuille de CSS + // Générer la feuille de CSS $style = '.newsContent {height:' . $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT) . ';}'; $style .= '.newsBlur {background: linear-gradient(#333 ' . $this->getInput('newsConfigItemsBlur',helper::FILTER_STRING_SHORT) . ',#FFF );'; $style .= ' background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;}'; - + // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY)) { - mkdir (self::DATADIRECTORY, 0777, true); + if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) { + mkdir (self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', 0777, true); } - $success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '.css' , $style ); + $success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $style ); // Fin feuille de style $this->setData(['module', $this->getUrl(0), 'theme',[ - 'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '.css' : '', + 'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '', 'itemsHeight' => $this->getInput('newsConfigItemsHeight',helper::FILTER_STRING_SHORT), 'itemsBlur' => $this->getInput('newsConfigItemsBlur',helper::FILTER_STRING_SHORT) ]]); @@ -360,10 +358,7 @@ class news extends common { $this->update(); // Initialisation d'un nouveau module - if ($this->getData(['module', $this->getUrl(0)]) === null) { - $this->init($this->getUrl(0)); - } - + $this->init(); // Affichage d'un article if( @@ -454,37 +449,41 @@ class news extends common { // Version 3.0 if ($this->getData(['module', $this->getUrl(0), 'config']) === NULL ) { // Données config et theme absentes du précédent module - $this->init($this->getUrl(0)); + $this->init(); } } /** * Initialisation du thème d'un nouveau module */ - private function init($moduleId) { - // Variable commune - $fileCSS = self::DATADIRECTORY . $moduleId . '.css' ; + private function init() { - // Données du module - require_once('module/news/ressource/defaultdata.php'); - $this->setData(['module', $moduleId, 'config',init::$defaultData ]); - // Données de thème - $this->setData(['module', $moduleId, 'theme',init::$defaultTheme ]); + $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css'; - // Générer la feuille de CSS - $style = '.newsContent {height: ' . $this->getData([ 'module', $moduleId, 'theme', 'itemsHeight' ]) .';}'; - $style .= '.newsBlur {background: linear-gradient(#333 ' . $this->getData([ 'module', $moduleId, 'theme', 'itemsBlur' ]) . ',#FFF );'; - $style .= ' background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;}'; - - // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY)) { - mkdir (self::DATADIRECTORY, 0777, true); + // Données du module + if ($this->getData(['module', $this->getUrl(0) ]) === null) { + require_once('module/news/ressource/defaultdata.php'); + $this->setData(['module', $this->getUrl(0), 'config', init::$defaultData]); + // Données de thème + $this->setData(['module', $this->getUrl(0), 'theme', init::$defaultTheme]); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ]); } - // Sauver la feuille de style - file_put_contents(self::DATADIRECTORY .$moduleId . '.css' , $style ); + // Dossier de l'instance + if (!is_dir(self::DATADIRECTORY . $this->getUrl(0) )) { + mkdir (self::DATADIRECTORY . $this->getUrl(0) , 0777, true); + } - // Stocker le nom de la feuille de style - $this->setData(['module', $moduleId, 'theme', 'style', self::DATADIRECTORY . $moduleId . '.css']); + // Check la présence de la feuille de style + if ( !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) { + // Générer la feuille de CSS + $style = '.newsContent {height: ' . $this->getData([ 'module', $this->getUrl(0), 'theme', 'itemsHeight' ]) .';}'; + $style .= '.newsBlur {background: linear-gradient(#333 ' . $this->getData([ 'module', $this->getUrl(0), 'theme', 'itemsBlur' ]) . ',#FFF );'; + $style .= ' background-clip: text;-webkit-background-clip: text;-webkit-text-fill-color: transparent;}'; + // Sauver la feuille de style + file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' , $style ); + // Stocker le nom de la feuille de style + $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']); + } } } diff --git a/module/search/ressource/defaultdata.php b/module/search/ressource/defaultdata.php index 74f7a636..a4980e6e 100755 --- a/module/search/ressource/defaultdata.php +++ b/module/search/ressource/defaultdata.php @@ -1,6 +1,6 @@ 100, 'resultHideContent' => false, 'placeHolder' => 'Un ou plusieurs mots-clés séparés par un espace ou par +', diff --git a/module/search/search.php b/module/search/search.php index 9a5fad73..15a8a690 100755 --- a/module/search/search.php +++ b/module/search/search.php @@ -56,7 +56,7 @@ class search extends common { if ($this->getData(['module', $this->getUrl(0), 'previewLength']) ) { $data = $this->getData(['module', $this->getUrl(0)]); // Feuille de style - $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '.css' ; + $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ; $this->setData(['module', $this->getUrl(0), 'config', [ 'submitText' => $this->getData(['module', $this->getUrl(0), 'submitText']), 'placeHolder' => $this->getData(['module', $this->getUrl(0), 'placeHolder']), @@ -70,8 +70,8 @@ class search extends common { ]]); // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY)) { - mkdir (self::DATADIRECTORY, 0777, true); + if (!is_dir(self::DATADIRECTORY . $this->getUrl(0) )) { + mkdir (self::DATADIRECTORY . $this->getUrl(0), 0777, true); } // Générer la feuille de CSS $style = '.keywordColor {background: ' . $this->getData(['module', $this->getUrl(0), 'theme', 'keywordColor']) . ';}'; @@ -91,29 +91,34 @@ class search extends common { /** * Initialisation du module */ - private function init($moduleId){ - // Variable commune - $fileCSS = self::DATADIRECTORY . $moduleId . '.css' ; + private function init(){ - // Données du module - require_once('module/search/ressource/defaultdata.php'); - $this->setData(['module', $moduleId, 'config',init::$defaultData ]); - // Données de thème - $this->setData(['module', $moduleId, 'theme',init::$defaultTheme ]); - // Générer la feuille de CSS - $style = '.keywordColor {background: ' . $this->getData([ 'module', $moduleId, 'theme', 'keywordColor' ]) . ';}'; + $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ; - // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY)) { - mkdir (self::DATADIRECTORY, 0777, true); + if ($this->getData(['module', $this->getUrl(0)]) === null) { + // Données du module + require_once('module/search/ressource/defaultdata.php'); + $this->setData(['module', $this->getUrl(0), 'config',init::$defaultConfig ]); + // Données de thème + $this->setData(['module', $this->getUrl(0), 'theme',init::$defaultTheme ]); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' ]); } - // Sauver la feuille de style - file_put_contents(self::DATADIRECTORY .$moduleId . '.css' , $style ); + // Dossier de l'instance + if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) { + mkdir (self::DATADIRECTORY . $this->getUrl(0), 0777, true); + } - // Stocker le nom de la feuille de style - $this->setData(['module', $moduleId, 'theme', 'style', self::DATADIRECTORY . $moduleId . '.css']); + // Check la présence de la feuille de style + if ( !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) { + // Générer la feuille de CSS + $style = '.keywordColor {background: ' . $this->getData([ 'module', $this->getUrl(0), 'theme', 'keywordColor' ]) . ';}'; + // Sauver la feuille de style + file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $style ); + // Stocker le nom de la feuille de style + $this->setData(['module', $this->getUrl(0) , 'theme', 'style', $fileCSS]); + } } @@ -124,20 +129,15 @@ class search extends common { $this->update(); // Initialisation d'un nouveau module - if ($this->getData(['module', $this->getUrl(0)]) === null) { - $this->init($this->getUrl(0)); - } + $this->init(); + if($this->isPost()) { // Générer la feuille de CSS $style = '.keywordColor {background:' . $this->getInput('searchKeywordColor') . ';}'; - // Dossier de l'instance - if (!is_dir(self::DATADIRECTORY)) { - mkdir (self::DATADIRECTORY , 0777, true); - } - $success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '.css' , $style ); + $success = file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' , $style ); // Fin feuille de style // Soumission du formulaire @@ -150,7 +150,7 @@ class search extends common { ]]); $this->setData(['module', $this->getUrl(0), 'theme',[ 'keywordColor' => $this->getInput('searchKeywordColor'), - 'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '.css' : '', + 'style' => $success ? self::DATADIRECTORY . $this->getUrl(0) . '/theme.css' : '', ]]); @@ -178,9 +178,8 @@ class search extends common { $this->update(); // Initialisation d'un nouveau module - if ($this->getData(['module', $this->getUrl(0)]) === null) { - $this->init($this->getUrl(0)); - } + $this->init(); + if($this->isPost()) { //Initialisations variables