From 4c0e0bd4b690d51b35610e75b3abe7829d6b7c86 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 7 Apr 2021 08:04:43 +0200 Subject: [PATCH 1/8] i18n pour la v11 --- core/core.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/core/core.php b/core/core.php index 9efcb80d..2ec1c162 100755 --- a/core/core.php +++ b/core/core.php @@ -143,6 +143,16 @@ class common { self::GROUP_MODERATOR => 'Éditeur', self::GROUP_ADMIN => 'Administrateur' ]; + // Langues proposées + public static $i18nList = [ + 'fr' => 'Français (fr)', + 'de' => 'Allemand (de)', + 'en' => 'Anglais (en)', + 'es' => 'Espagnol (es)', + 'it' => 'Italien (it)', + 'nl' => 'Néerlandais (nl)', + 'pt' => 'Portugais (pt)', + ]; // Langue courante public static $i18nCurrent = 'fr'; public static $timezone; From fc2fbf2103146e7e6f9e56ebfc782284e8cee136 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 7 Apr 2021 11:58:22 +0200 Subject: [PATCH 2/8] init --- core/core.php | 31 +++++++++++++++++++++++++++++++ core/module/addon/addon.php | 3 ++- module/search/search.php | 14 +++++++------- 3 files changed, 40 insertions(+), 8 deletions(-) diff --git a/core/core.php b/core/core.php index 2ec1c162..b06d8637 100755 --- a/core/core.php +++ b/core/core.php @@ -1585,6 +1585,37 @@ class common { } $this->setData(['core', 'dataVersion', 10502]); } + + // Version 10.6.00 + if ($this->getData(['core', 'dataVersion']) < 10600) { + + // Mise à jour des données des modules autonomes + + // Liste des pages dans pageList + $pageList = array(); + foreach ($this->getHierarchy(null,null,null) as $parentKey=>$parentValue) { + $pageList [] = $parentKey; + foreach ($parentValue as $childKey) { + $pageList [] = $childKey; + } + } + // Parcourir pageList et rechercher les modules au CSS autonome + foreach ($pageList as $parentKey => $parent) { + // Module search + echo $parent; + if ( + $this->getData(['page',$parent,'moduleId']) === 'search' + ){ + if(class_exists($parent)) { + $module = new $moduleId; + $module->initCSS($parent); + } + } + } + + } + die(); + //$this->setData(['core', 'dataVersion', 10600]); } } diff --git a/core/module/addon/addon.php b/core/module/addon/addon.php index 62efd452..4ae57f00 100644 --- a/core/module/addon/addon.php +++ b/core/module/addon/addon.php @@ -303,7 +303,8 @@ class addon extends common { file_put_contents($tmpFolder . '/' . $moduleId, json_encode($tmpData)); } // Export des données localisées dans le dossier de données du module - if ($infoModules[$this->getUrl(2)]['dataDirectory'] ) { + if ($infoModules[$this->getUrl(2)]['dataDirectory'] && + is_dir($infoModules[$this->getUrl(2)]['dataDirectory'])) { $this->custom_copy ($infoModules[$this->getUrl(2)]['dataDirectory'], $tmpFolder . '/' . $moduleDir); } } diff --git a/module/search/search.php b/module/search/search.php index 6f3f13e7..ebaf52de 100755 --- a/module/search/search.php +++ b/module/search/search.php @@ -78,22 +78,22 @@ class search extends common { * Initialisation du thème du module * Appelée par les fonctions index et config */ - private function initCss(){ + private function initCss($moduleId){ // Création des valeurs de réglage par défaut - if ( !is_array($this->getData(['module', $this->getUrl(0), 'config']) ) ) { + if ( !is_array($this->getData(['module',$moduleId, 'config']) ) ) { require_once('module/search/ressource/defaultdata.php'); // Sauver les données par défaut - init::$defaultData['style'] = self::DATADIRECTORY . $this->getUrl(0) . '.css'; + init::$defaultData['style'] = self::DATADIRECTORY . $moduleId . '.css'; $this->setData(['module', $this->getUrl(0), 'config', init::$defaultData]); - $style = '.searchItem {background:' . $this->getData(['module', $this->getUrl(0), 'config', 'keywordColor']). ';}'; + $style = '.searchItem {background:' . $this->getData(['module', $moduleId, 'config', 'keywordColor']). ';}'; // 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 . $moduleId . '.css' , $style ); } @@ -104,7 +104,7 @@ class search extends common { public function config() { // Initialisation d'un nouveau module - $this->initCss(); + $this->initCss($this->getUrl(0)); // Mise à jour des données de module $this->update(); @@ -154,7 +154,7 @@ class search extends common { public function index() { // Initialisation d'un nouveau module - $this->initCss(); + $this->initCss($this->getUrl(0)); // Mise à jour des données de module $this->update(); From 695abf314abb7ed3690fb7c83002b37618b5e142 Mon Sep 17 00:00:00 2001 From: F Tempez Date: Wed, 7 Apr 2021 13:57:09 +0200 Subject: [PATCH 3/8] warning stristr deprecated --- module/gallery/view/gallery/gallery.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/gallery/view/gallery/gallery.php b/module/gallery/view/gallery/gallery.php index fbb576c8..b7a68a99 100755 --- a/module/gallery/view/gallery/gallery.php +++ b/module/gallery/view/gallery/gallery.php @@ -13,7 +13,7 @@
getdata(['module',$this->getUrl(0),$this->getUrl(1),'config','homePicture'])) ) { + getdata(['module',$this->getUrl(0),$this->getUrl(1),'config','homePicture']) ) { echo 'id="homePicture"'; } ?> class="galleryGalleryPicture" style="background-image:url('')" From e3744bf7d826cdf4dfed29e16b122cee2fe5b6cc Mon Sep 17 00:00:00 2001 From: F Tempez Date: Wed, 7 Apr 2021 13:57:54 +0200 Subject: [PATCH 4/8] Bug module initcss manque style --- module/gallery/gallery.php | 64 ++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 24 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 1e453fe2..e9138cdb 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 if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '3.0', '<') ) { // Changement de l'arborescence dans module.json @@ -175,12 +174,30 @@ class gallery extends common { /** * Initialisation du thème d'un nouveau module */ - private function initCSS() { - if ( $this->getData(['module', $this->getUrl(0), 'config']) === null ) { + private function initCSS($moduleId) { + $fileCSS = self::DATADIRECTORY . $moduleId . '.css' ; + if ( $this->getData(['module', $moduleId, 'config']) === null ) { require_once('module/gallery/ressource/defaultdata.php'); - $this->setData(['module', $this->getUrl(0), 'config', theme::$defaultData]); + $this->setData(['module', $moduleId, 'config', [ + 'style' => $fileCSS, + 'thumbAlign' => theme::$defaultData['thumbAlign'], + 'thumbWidth' => theme::$defaultData['thumbWidth'], + 'thumbHeight' => theme::$defaultData['thumbHeight'], + 'thumbMargin' => theme::$defaultData['thumbMargin'], + 'thumbBorder' => theme::$defaultData['thumbBorder'], + 'thumbOpacity' => theme::$defaultData['thumbOpacity'], + 'thumbBorderColor' => theme::$defaultData['thumbBorderColor'], + 'thumbRadius' => theme::$defaultData['thumbRadius'], + 'thumbShadows' => theme::$defaultData['thumbShadows'], + 'thumbShadowsColor'=> theme::$defaultData['thumbShadowsColor'], + 'legendHeight' => theme::$defaultData['legendHeight'], + 'legendAlign' => theme::$defaultData['legendAlign'], + 'legendTextColor' => theme::$defaultData['legendTextColor'], + 'legendBgColor' => theme::$defaultData['legendBgColor'], + 'versionData' => theme::$defaultData['versionData'] + ]]); } - if ( !file_exists(self::DATADIRECTORY . $this->getUrl(0) . '.css')) { + if ( !file_exists(self::DATADIRECTORY . $moduleId . '.css')) { // Variables génériques // Dossier de l'instance @@ -189,30 +206,29 @@ class gallery extends common { } // Nom de la feuille de style - $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '.css' ; - $this->setData(['module', $this->getUrl(0), 'config', 'style', $fileCSS]); + $this->setData(['module', $moduleId, 'config', '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', $this->getUrl(0), 'config', 'thumbAlign']),$content ); - $content = str_replace('#thumbWidth#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbWidth']),$content ); - $content = str_replace('#thumbHeight#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbHeight']),$content ); - $content = str_replace('#thumbMargin#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbMargin']),$content ); - $content = str_replace('#thumbBorder#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbBorder']),$content ); - $content = str_replace('#thumbBorderColor#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbBorderColor']),$content ); - $content = str_replace('#thumbOpacity#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbOpacity']),$content ); - $content = str_replace('#thumbShadows#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbShadows']),$content ); - $content = str_replace('#thumbShadowsColor#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbShadowsColor']),$content ); - $content = str_replace('#thumbRadius#',$this->getData(['module', $this->getUrl(0), 'config', 'thumbRadius']),$content ); - $content = str_replace('#legendAlign#',$this->getData(['module', $this->getUrl(0), 'config', 'legendAlign']),$content ); - $content = str_replace('#legendHeight#',$this->getData(['module', $this->getUrl(0), 'config', 'legendHeight']),$content ); - $content = str_replace('#legendTextColor#',$this->getData(['module', $this->getUrl(0), 'config', 'legendTextColor']),$content ); - $content = str_replace('#legendBgColor#',$this->getData(['module', $this->getUrl(0), 'config', 'legendBgColor']),$content ); + $content = str_replace('#thumbAlign#',$this->getData(['module', $moduleId, 'config', 'thumbAlign']),$content ); + $content = str_replace('#thumbWidth#',$this->getData(['module', $moduleId, 'config', 'thumbWidth']),$content ); + $content = str_replace('#thumbHeight#',$this->getData(['module', $moduleId, 'config', 'thumbHeight']),$content ); + $content = str_replace('#thumbMargin#',$this->getData(['module', $moduleId, 'config', 'thumbMargin']),$content ); + $content = str_replace('#thumbBorder#',$this->getData(['module', $moduleId, 'config', 'thumbBorder']),$content ); + $content = str_replace('#thumbBorderColor#',$this->getData(['module', $moduleId, 'config', 'thumbBorderColor']),$content ); + $content = str_replace('#thumbOpacity#',$this->getData(['module', $moduleId, 'config', 'thumbOpacity']),$content ); + $content = str_replace('#thumbShadows#',$this->getData(['module', $moduleId, 'config', 'thumbShadows']),$content ); + $content = str_replace('#thumbShadowsColor#',$this->getData(['module', $moduleId, 'config', 'thumbShadowsColor']),$content ); + $content = str_replace('#thumbRadius#',$this->getData(['module', $moduleId, 'config', 'thumbRadius']),$content ); + $content = str_replace('#legendAlign#',$this->getData(['module', $moduleId, 'config', 'legendAlign']),$content ); + $content = str_replace('#legendHeight#',$this->getData(['module', $moduleId, 'config', 'legendHeight']),$content ); + $content = str_replace('#legendTextColor#',$this->getData(['module', $moduleId, 'config', 'legendTextColor']),$content ); + $content = str_replace('#legendBgColor#',$this->getData(['module', $moduleId, 'config', 'legendBgColor']),$content ); // Ecriture de la feuille de style - file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '.css' , $content . $themeCss); + file_put_contents(self::DATADIRECTORY . $moduleId . '.css' , $content . $themeCss); } } @@ -276,7 +292,7 @@ class gallery extends common { public function config() { // Initialisation du thème d'un nouveau module - $this->initCss(); + $this->initCss($this->getUrl(0)); // Mise à jour des données de module $this->update(); @@ -561,7 +577,7 @@ class gallery extends common { */ public function index() { // Initialisation du thème du nouveau module - $this->initCss(); + $this->initCss($this->getUrl(0)); // Mise à jour des données de module $this->update(); // Images d'une galerie From 3247e14a83c65ca0e9464ff6f38d6b350f2a7e0b Mon Sep 17 00:00:00 2001 From: F Tempez Date: Wed, 7 Apr 2021 14:06:07 +0200 Subject: [PATCH 5/8] initCss variable d'instance --- module/gallery/gallery.php | 6 +++--- module/search/search.php | 4 +--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index e9138cdb..4bce7c20 100755 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -175,7 +175,9 @@ class gallery extends common { * Initialisation du thème d'un nouveau module */ private function initCSS($moduleId) { + // Variable commune $fileCSS = self::DATADIRECTORY . $moduleId . '.css' ; + // Check la présence de la config if ( $this->getData(['module', $moduleId, 'config']) === null ) { require_once('module/gallery/ressource/defaultdata.php'); $this->setData(['module', $moduleId, 'config', [ @@ -197,14 +199,12 @@ class gallery extends common { 'versionData' => theme::$defaultData['versionData'] ]]); } + // Check la présence de la feuille de style if ( !file_exists(self::DATADIRECTORY . $moduleId . '.css')) { - // Variables génériques - // Dossier de l'instance if (!is_dir(self::DATADIRECTORY )) { mkdir (self::DATADIRECTORY, 0777, true); } - // Nom de la feuille de style $this->setData(['module', $moduleId, 'config', 'style', $fileCSS]); diff --git a/module/search/search.php b/module/search/search.php index ebaf52de..ae57e49c 100755 --- a/module/search/search.php +++ b/module/search/search.php @@ -85,7 +85,7 @@ class search extends common { // Sauver les données par défaut init::$defaultData['style'] = self::DATADIRECTORY . $moduleId . '.css'; - $this->setData(['module', $this->getUrl(0), 'config', init::$defaultData]); + $this->setData(['module', $moduleId, 'config', init::$defaultData]); $style = '.searchItem {background:' . $this->getData(['module', $moduleId, 'config', 'keywordColor']). ';}'; @@ -94,8 +94,6 @@ class search extends common { mkdir (self::DATADIRECTORY , 0777, true); } $success = file_put_contents(self::DATADIRECTORY . $moduleId . '.css' , $style ); - - } } From 55c921025a4b78acf7f9925c293a5eaddb50026b Mon Sep 17 00:00:00 2001 From: F Tempez Date: Wed, 7 Apr 2021 14:26:12 +0200 Subject: [PATCH 6/8] News : initCss --- module/news/news.php | 64 ++++++++++++++++++++++++++++++++++---------- 1 file changed, 50 insertions(+), 14 deletions(-) diff --git a/module/news/news.php b/module/news/news.php index d26de5ab..b87ee9c5 100755 --- a/module/news/news.php +++ b/module/news/news.php @@ -70,20 +70,6 @@ class news extends common { public static $articleSignature = ''; - /** - * Mise à jour du module - * Appelée par les fonctions index et config - */ - private function update() { - // Version 3.0 - if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '3.0', '<') ) { - $this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 16]); - $this->setData(['module', $this->getUrl(0), 'config', 'itemsperCol', 6]); - $this->setData(['module', $this->getUrl(0), 'config', 'versionData','3.0']); - } - } - - /** * Flux RSS */ @@ -178,6 +164,10 @@ class news extends common { * Configuration */ public function config() { + + // Initialisation du thème du nouveau module + $this->initCss($this->getUrl(0)); + // Mise à jour des données de module $this->update(); @@ -347,6 +337,10 @@ class news extends common { * Accueil */ public function index() { + + // Initialisation du thème du nouveau module + $this->initCss($this->getUrl(0)); + // Mise à jour des données de module $this->update(); // Affichage d'un article @@ -428,4 +422,46 @@ class news extends common { return $this->getData(['user', $userId, 'firstname']); } } + + /** + * Mise à jour du module + * Appelée par les fonctions index et config + */ + private function update() { + // Version 3.0 + if (version_compare($this->getData(['module', $this->getUrl(0), 'config', 'versionData']), '3.0', '<') ) { + $this->setData(['module', $this->getUrl(0), 'config', 'itemsperPage', 16]); + $this->setData(['module', $this->getUrl(0), 'config', 'itemsperCol', 6]); + $this->setData(['module', $this->getUrl(0), 'config', 'versionData','3.0']); + } + } + + /** + * Initialisation du thème d'un nouveau module + */ + private function initCSS($moduleId) { + // Variable commune + $fileCSS = self::DATADIRECTORY . $moduleId . '.css' ; + + if ( $this->getData(['module', $moduleId, 'config', 'itemsHeight']) === null ) { + + $this->setData(['module', $moduleId, 'config', 'itemsHeight', '200px']); + + // Générer la feuille de CSS + $style = '.newsContent {height: 200px;}'; + + // Dossier de l'instance + if (!is_dir(self::DATADIRECTORY)) { + mkdir (self::DATADIRECTORY, 0777, true); + } + + // Sauver la feuille de style + $success = file_put_contents(self::DATADIRECTORY .$moduleId . '.css' , $style ); + + // Nom de la feuille de style + $this->setData(['module', $moduleId, 'config', 'style', self::DATADIRECTORY .$moduleId]); + // Fin feuille de style + + } + } } From 43da5f03db4ce12e4748760a90cf693c16f05960 Mon Sep 17 00:00:00 2001 From: F Tempez Date: Wed, 7 Apr 2021 14:29:24 +0200 Subject: [PATCH 7/8] =?UTF-8?q?Appel=20automatique=20des=20initCSS=20lors?= =?UTF-8?q?=20de=20la=20mise=20=C3=A0=20jour=20vers=2010600?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/core/core.php b/core/core.php index b06d8637..8f43811f 100755 --- a/core/core.php +++ b/core/core.php @@ -1599,12 +1599,12 @@ class common { $pageList [] = $childKey; } } - // Parcourir pageList et rechercher les modules au CSS autonome + // Parcourir pageList et rechercher les modules au CSS autonomes foreach ($pageList as $parentKey => $parent) { - // Module search - echo $parent; if ( $this->getData(['page',$parent,'moduleId']) === 'search' + || $this->getData(['page',$parent,'moduleId']) === 'gallery' + || $this->getData(['page',$parent,'moduleId']) === 'news' ){ if(class_exists($parent)) { $module = new $moduleId; @@ -1612,10 +1612,9 @@ class common { } } } - + } - die(); - //$this->setData(['core', 'dataVersion', 10600]); + $this->setData(['core', 'dataVersion', 10600]); } } From babebc5a7ee49756b1f86f0d055aa3ac56417d8c Mon Sep 17 00:00:00 2001 From: F Tempez Date: Wed, 7 Apr 2021 14:35:21 +0200 Subject: [PATCH 8/8] =?UTF-8?q?fix=20setData=20mal=20plac=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/core.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/core/core.php b/core/core.php index 8f43811f..10a48b71 100755 --- a/core/core.php +++ b/core/core.php @@ -1612,9 +1612,8 @@ class common { } } } - - } $this->setData(['core', 'dataVersion', 10600]); + } } }