From cc630ccfa3467e2599338199484b0abbebeae4b8 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Fri, 20 Aug 2021 11:44:38 +0200 Subject: [PATCH] =?UTF-8?q?11007=20news=20et=20gallery=20init=20ne=20s'ex?= =?UTF-8?q?=C3=A9cute=20que=20si=20le=20num=C3=A9ro=20de=20version=20du=20?= =?UTF-8?q?module=20n'existe=20pas?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module/gallery/gallery.php | 11 +++++------ module/news/news.php | 22 +++++----------------- 2 files changed, 10 insertions(+), 23 deletions(-) diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index f66beb66..6f40ac7c 100644 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -179,6 +179,11 @@ class gallery extends common { $versionData = $this->getData(['module',$this->getUrl(0),'config', 'versionData' ]); + // le module n'est pas initialisé + if ($versionData === NULL) { + $this->init(); + } + // Mise à jour 3.1 if (version_compare($versionData, '3.1', '<') ) { if (is_dir(self::DATADIRECTORY . 'pages/')) { @@ -313,9 +318,6 @@ class gallery extends common { // Mise à jour des données de module $this->update(); - // Initialisation d'un nouveau module - $this->init(); - //Affichage de la galerie triée $g = $this->getData(['module', $this->getUrl(0), 'content']); $p = helper::arrayCollumn(helper::arrayCollumn($g,'config'),'position'); @@ -599,9 +601,6 @@ class gallery extends common { // Mise à jour des données de module $this->update(); - // Initialisation d'un nouveau module - $this->init(); - // Images d'une galerie if($this->getUrl(1)) { // La galerie n'existe pas diff --git a/module/news/news.php b/module/news/news.php index 177e806d..5da4ed42 100755 --- a/module/news/news.php +++ b/module/news/news.php @@ -189,9 +189,6 @@ class news extends common { // Mise à jour des données de module $this->update(); - // Initialisation d'un nouveau module - $this->init(); - // Soumission du formulaire if($this->isPost()) { @@ -396,9 +393,6 @@ class news extends common { // Mise à jour des données de module $this->update(); - // Initialisation d'un nouveau module - $this->init(); - // Affichage d'un article if( $this->getUrl(1) @@ -502,19 +496,13 @@ class news extends common { */ private function update() { - // Créer la structure de configuration si absente - // Il n'existait aucun paramétrage dans les version précédentes - if ($this->getData(['module', $this->getUrl(0), 'config', 'itemsperPage']) === NULL ) { - // Données config et theme absentes du précédent module - 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' ]); - } - $versionData = $this->getData(['module',$this->getUrl(0),'config', 'versionData' ]); + // le module n'est pas initialisé + if ($versionData === NULL) { + $this->init(); + } + // Mise à jour 3.2 if (version_compare($versionData, '3.1', '<') ) { $this->setData(['module',$this->getUrl(0),'theme', 'itemsBlur', '0%' ]);