From e414988bee687756bacf931b4dcc5f1f9a9c672b Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Thu, 19 Nov 2020 08:53:52 +0100 Subject: [PATCH] Durcir update blog et news --- core/core.php | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/core/core.php b/core/core.php index 89078323..78dd6d43 100755 --- a/core/core.php +++ b/core/core.php @@ -1462,22 +1462,28 @@ class common { } // Mettre à jour les données des blogs les articles sont dans posts foreach ($pageList as $parentKey => $parent) { - //La page a une galerie + //La page a un blog if ($this->getData(['page',$parent,'moduleId']) === 'blog' ) { - foreach ( $this->getData(['module', $parent]) as $blogKey => $blogItem) { - $data = $this->getdata(['module',$parent,$blogKey]); - $this->deleteData(['module',$parent, $blogKey]); - $this->setData([ 'module', $parent, 'posts', $blogKey, $data ]); + if (is_array($this->getData(['module', $parent]))) { + foreach ( $this->getData(['module', $parent]) as $blogKey => $blogItem) { + if ($blogKey === 'posts' OR $blogKey === 'config') {continue;} + $data = $this->getdata(['module',$parent,$blogKey]); + $this->deleteData(['module',$parent, $blogKey]); + $this->setData([ 'module', $parent, 'posts', $blogKey, $data ]); + } } } } foreach ($pageList as $parentKey => $parent) { - //La page a une galerie + //La page a une news if ($this->getData(['page',$parent,'moduleId']) === 'news' ) { - foreach ( $this->getData(['module', $parent]) as $newsKey => $newsItem) { - $data = $this->getdata(['module',$parent,$newsKey]); - $this->deleteData(['module',$parent, $newsKey]); - $this->setData([ 'module', $parent, 'posts', $newsKey, $data ]); + if (is_array($this->getData(['module', $parent]))) { + foreach ( $this->getData(['module', $parent]) as $newsKey => $newsItem) { + if ($blogKey === 'posts' OR $blogKey === 'config') {continue;} + $data = $this->getdata(['module',$parent,$newsKey]); + $this->deleteData(['module',$parent, $newsKey]); + $this->setData([ 'module', $parent, 'posts', $newsKey, $data ]); + } } } }