From 9f9817aee023e8ddccdcb8728eca633eb6a701a2 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 17 Aug 2021 08:24:12 +0200 Subject: [PATCH] 11007 en cours --- core/core.php | 61 +++++++++++++++++++++++------ core/module/addon/addon.php | 3 +- core/module/page/view/edit/edit.php | 3 +- module/search/search.php | 6 ++- 4 files changed, 58 insertions(+), 15 deletions(-) diff --git a/core/core.php b/core/core.php index 104f85b4..25e48d37 100755 --- a/core/core.php +++ b/core/core.php @@ -465,6 +465,39 @@ class common { } } + /** + * Lire les données de la page + * @param string pageId + * @param return contenu de la page + */ + public function getPage($page) { + + return file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $page, 'content'])); + + } + + /** + * Ecrire les données de la page + * @param string pageId + * @param string contenu de la page + */ + public function setPage($page, $value) { + + file_put_contents(self::DATA_DIR . $lang . '/content/' . $this->getData(['page', $page, 'content']), $value); + + } + + /** + * Effacer les données de la page + * @param string pageId + * @param return statut de l'effacement + */ + public function deletePage($page) { + + return unlink(self::DATA_DIR . $lang . '/content/' . $this->getData(['page', $page, 'content'])); + + } + /** * Sauvegarde des données * @param array $keys Clé(s) des données @@ -2337,17 +2370,20 @@ class core extends common { ) { $this->addOutput([ 'title' => $title, - 'content' => file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getUrl(0), 'content'])), + //'content' => file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getUrl(0), 'content'])), + 'content' => $this->getPage($this->getUrl(0)), 'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']), 'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']), 'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']), 'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']), 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), - 'contentRight' => $this->getData(['page',$this->getUrl(0),'barRight']) ? - file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barRight']), 'content'])) + 'contentRight' => $this->getData(['page',$this->getUrl(0),'barRight']) + //file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barRight']), 'content'])) + ? $this->getPage($this->getData(['page',$this->getUrl(0),'barRight'])) : '', - 'contentLeft' => $this->getData(['page',$this->getUrl(0),'barLeft']) ? - file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barLeft']), 'content'])) + 'contentLeft' => $this->getData(['page',$this->getUrl(0),'barLeft']) + //file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barLeft']), 'content'])) + ? $this->getPage($this->getData(['page',$this->getUrl(0),'barLeft'])) : '', ]); } @@ -2367,15 +2403,18 @@ class core extends common { 'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']), 'iconUrl' => $this->getData(['page', $this->getUrl(0), 'iconUrl']), 'disable' => $this->getData(['page', $this->getUrl(0), 'disable']), - 'contentRight' => $this->getData(['page',$this->getUrl(0),'barRight']) ? - file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barRight']), 'content'])) + 'contentRight' => $this->getData(['page',$this->getUrl(0),'barRight']) + //file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barRight']), 'content'])) + //? $this->getPage($this->getData(['page',$this->getUrl(0),'barRight'])) + ? $this->getPage($this->getData(['page',$this->getUrl(0),'barRight'])) : '', - 'contentLeft' => $this->getData(['page',$this->getUrl(0),'barLeft']) ? - file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barLeft']), 'content'])) + 'contentLeft' => $this->getData(['page',$this->getUrl(0),'barLeft']) + // ? file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getData(['page',$this->getUrl(0),'barLeft']), 'content'])) + ? $this->getPage($this->getData(['page',$this->getUrl(0),'barLeft'])) : '', ]); - $pageContent = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getUrl(0), 'content'])); - + //$pageContent = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getUrl(0), 'content'])); + $pageContent = $this->getPage($this->getUrl(0)); } else { $moduleId = $this->getUrl(0); diff --git a/core/module/addon/addon.php b/core/module/addon/addon.php index 2793cc41..41dbc02c 100644 --- a/core/module/addon/addon.php +++ b/core/module/addon/addon.php @@ -429,7 +429,8 @@ class addon extends common { // Export des pages hébergeant le module $pageParam[$pageId] = $this->getData(['page',$pageId]); // Export du contenu de la page - $pageContent[$pageId] = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $pageId, 'content'])); + //$pageContent[$pageId] = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $pageId, 'content'])); + $pageContent[$pageId] = $this->getPage($pageId); // Export de fr/module.json $moduleId = 'fr/module.json'; $moduleDir = str_replace('site/data/','',$infoModules[$this->getUrl(2)]['dataDirectory']); diff --git a/core/module/page/view/edit/edit.php b/core/module/page/view/edit/edit.php index 4c99a212..a9c03355 100644 --- a/core/module/page/view/edit/edit.php +++ b/core/module/page/view/edit/edit.php @@ -96,7 +96,8 @@ echo template::formOpen('pageEditForm');
'editorWysiwyg', - 'value' => file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getUrl(2), 'content'])) + //'value' => file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $this->getUrl(2), 'content'])) + 'value' => $this->getPage($this->getUrl(2)) ]); ?>
diff --git a/module/search/search.php b/module/search/search.php index e71aa931..4162b414 100644 --- a/module/search/search.php +++ b/module/search/search.php @@ -266,7 +266,8 @@ class search extends common { $this->getData(['page', $parentId, 'block']) !== 'bar') { $url = $parentId; $titre = $this->getData(['page', $parentId, 'title']); - $content = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $parentId, 'content'])); + //$content = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $parentId, 'content'])); + $content = $this->getPage($parentId); $contenu = $titre . ' ' . $contenu ; // Pages sauf pages filles et articles de blog $tempData = $this->occurrence($url, $titre, $contenu, $motclef, self::$motentier); @@ -282,7 +283,8 @@ class search extends common { $this->getData(['page', $parentId, 'block']) !== 'bar') { $url = $childId; $titre = $this->getData(['page', $childId, 'title']); - $content = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $childId, 'content'])); + //$content = file_get_contents(self::DATA_DIR . self::$i18n . '/content/' . $this->getData(['page', $childId, 'content'])); + $content = $this->getPage($childId); $contenu = $titre . ' ' . $contenu ; //Pages filles $tempData = $this->occurrence($url, $titre, $contenu, $motclef, self::$motentier);