From 8c49908598b608e47d9f71ebe9b41e09d19044b3 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Wed, 13 Sep 2023 18:29:25 +0200 Subject: [PATCH] =?UTF-8?q?Nom=20g=C3=A9n=C3=A9riques=20de=20variables?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/class/layout.class.php | 4 ++-- core/class/router.class.php | 8 +++---- core/core.php | 30 ++++++++++++------------- core/module/maintenance/maintenance.php | 2 +- core/module/page/page.php | 22 +++++++++--------- core/module/page/view/edit/edit.php | 2 +- core/module/plugin/plugin.php | 6 ++--- module/search/search.php | 8 +++---- 8 files changed, 41 insertions(+), 41 deletions(-) diff --git a/core/class/layout.class.php b/core/class/layout.class.php index 6b5b4c3..b43683f 100644 --- a/core/class/layout.class.php +++ b/core/class/layout.class.php @@ -896,9 +896,9 @@ class layout extends common // Sélecteur de cours if ($this->getUser('group') >= self::GROUP_TEACHER) { $leftItems .= '
  • '; } diff --git a/core/class/router.class.php b/core/class/router.class.php index 2aaac2e..8fa13e1 100644 --- a/core/class/router.class.php +++ b/core/class/router.class.php @@ -613,10 +613,10 @@ class core extends common $inlineScript[] = $this->getData(['page', $this->getUrl(0), 'js']) === null ? '' : $this->getData(['page', $this->getUrl(0), 'js']); // Importe le contenu, le CSS et le script des barres - $contentRight = $this->getData(['page', $this->getUrl(0), 'barRight']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$courseContent) : ''; + $contentRight = $this->getData(['page', $this->getUrl(0), 'barRight']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barRight']), self::$siteContent) : ''; $inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'css']); $inlineScript[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barRight']), 'js']); - $contentLeft = $this->getData(['page', $this->getUrl(0), 'barLeft']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$courseContent) : ''; + $contentLeft = $this->getData(['page', $this->getUrl(0), 'barLeft']) ? $this->getPage($this->getData(['page', $this->getUrl(0), 'barLeft']), self::$siteContent) : ''; $inlineStyle[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'css']); $inlineScript[] = $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']) === null ? '' : $this->getData(['page', $this->getData(['page', $this->getUrl(0), 'barLeft']), 'js']); @@ -634,7 +634,7 @@ class core extends common $this->addOutput([ 'title' => $title, - 'content' => $this->getPage($this->getUrl(0), self::$courseContent), + 'content' => $this->getPage($this->getUrl(0), self::$siteContent), 'metaDescription' => $this->getData(['page', $this->getUrl(0), 'metaDescription']), 'metaTitle' => $this->getData(['page', $this->getUrl(0), 'metaTitle']), 'typeMenu' => $this->getData(['page', $this->getUrl(0), 'typeMenu']), @@ -660,7 +660,7 @@ class core extends common : $this->getData(['page', $this->getUrl(0), 'metaDescription']); // Importe le CSS de la page principale - $pageContent = $this->getPage($this->getUrl(0), self::$courseContent); + $pageContent = $this->getPage($this->getUrl(0), self::$siteContent); $this->addOutput([ 'title' => $title, diff --git a/core/core.php b/core/core.php index d674114..87d6b9f 100644 --- a/core/core.php +++ b/core/core.php @@ -170,7 +170,7 @@ class common // Langue de l'interface sélectionnée public static $i18nUI = 'fr_FR'; // Langues de contenu - public static $courseContent = 'home'; + public static $siteContent = 'home'; public static $languages = [ 'de' => 'Deutsch', 'en_EN' => 'English', @@ -220,7 +220,7 @@ class common 'profil' => '', ]; - private $courseFiles = [ + private $contentFiles = [ 'page' => '', 'module' => '', ]; @@ -324,7 +324,7 @@ class common // Déterminer le contenu du site if (isset($_SESSION['ZWII_COURSE'])) { // Déterminé par la session présente - self::$courseContent = $_SESSION['ZWII_COURSE']; + self::$siteContent = $_SESSION['ZWII_COURSE']; } // Instanciation de la classe des entrées / sorties // Les fichiers de configuration @@ -332,8 +332,8 @@ class common $this->initDB($module); } // Les fichiers des cours - foreach ($this->courseFiles as $module => $value) { - $this->initDB($module, self::$courseContent); + foreach ($this->contentFiles as $module => $value) { + $this->initDB($module, self::$siteContent); } @@ -347,10 +347,10 @@ class common } } // Charge le site d'accueil - //if (self::$courseContent === 'home') { - foreach ($this->courseFiles as $stageId => $item) { + //if (self::$siteContent === 'home') { + foreach ($this->contentFiles as $stageId => $item) { if ( - file_exists(self::DATA_DIR . self::$courseContent . '/' . $stageId . '.json') === false + file_exists(self::DATA_DIR . self::$siteContent . '/' . $stageId . '.json') === false ) { $this->initData($stageId); } @@ -628,24 +628,24 @@ class common require_once('core/module/install/ressource/defaultdata.php'); // L'arborescence - if (!file_exists(self::DATA_DIR . self::$courseContent)) { - mkdir(self::DATA_DIR . self::$courseContent, 0755); + if (!file_exists(self::DATA_DIR . self::$siteContent)) { + mkdir(self::DATA_DIR . self::$siteContent, 0755); } - if (!file_exists(self::DATA_DIR . self::$courseContent . '/content')) { - mkdir(self::DATA_DIR . self::$courseContent . '/content', 0755); + if (!file_exists(self::DATA_DIR . self::$siteContent . '/content')) { + mkdir(self::DATA_DIR . self::$siteContent . '/content', 0755); } /* * Le site d'accueil, home ne dispose pas des mêmes modèles */ - $template = self::$courseContent === 'home' ? init::$siteTemplate :init:: $courseDefault; + $template = self::$siteContent === 'home' ? init::$siteTemplate :init:: $courseDefault; // Création de page ou de module $this->setData([$module, $template[$module]]); // Création des pages if ($module === 'page') { - $content = self::$courseContent === 'home' ? init::$siteContent : init::$courseContent; + $content = self::$siteContent === 'home' ? init::$siteContent : init::$courseContent; foreach ($content as $key => $value) { - $this->setPage($key, $value, self::$courseContent); + $this->setPage($key, $value, self::$siteContent); } } diff --git a/core/module/maintenance/maintenance.php b/core/module/maintenance/maintenance.php index 8b99f71..5be16a7 100644 --- a/core/module/maintenance/maintenance.php +++ b/core/module/maintenance/maintenance.php @@ -41,7 +41,7 @@ class maintenance extends common ? '' : $this->getData(['page', $this->getData(['config', 'page302']), 'title']), //'content' => $this->getdata(['page',$this->getData(['config','page302']),'content']), - 'content' => $this->getPage($this->getData(['config', 'page302']), self::$courseContent), + 'content' => $this->getPage($this->getData(['config', 'page302']), self::$siteContent), 'view' => 'index' ]); } else { diff --git a/core/module/page/page.php b/core/module/page/page.php index c35b034..91dd36d 100644 --- a/core/module/page/page.php +++ b/core/module/page/page.php @@ -174,11 +174,11 @@ class page extends common ] ]); // Creation du contenu de la page - if (!is_dir(self::DATA_DIR . self::$courseContent . '/content')) { - mkdir(self::DATA_DIR . self::$courseContent . '/content', 0755); + if (!is_dir(self::DATA_DIR . self::$siteContent . '/content')) { + mkdir(self::DATA_DIR . self::$siteContent . '/content', 0755); } - //file_put_contents(self::DATA_DIR . self::$courseContent . '/content/' . $pageId . '.html', '

    Contenu de votre nouvelle page.

    '); - $this->setPage($pageId, '

    Contenu de votre nouvelle page.

    ', self::$courseContent); + //file_put_contents(self::DATA_DIR . self::$siteContent . '/content/' . $pageId . '.html', '

    Contenu de votre nouvelle page.

    '); + $this->setPage($pageId, '

    Contenu de votre nouvelle page.

    ', self::$siteContent); // Met à jour le sitemap $this->updateSitemap(); @@ -279,8 +279,8 @@ class page extends common } // Effacer la page $this->deleteData(['page', $page]); - if (file_exists(self::DATA_DIR . self::$courseContent . '/content/' . $page . '.html')) { - unlink(self::DATA_DIR . self::$courseContent . '/content/' . $page . '.html'); + if (file_exists(self::DATA_DIR . self::$siteContent . '/content/' . $page . '.html')) { + unlink(self::DATA_DIR . self::$siteContent . '/content/' . $page . '.html'); } $this->deleteData(['module', $page]); @@ -369,8 +369,8 @@ class page extends common // Supprime l'ancienne page si l'id a changée if ($pageId !== $this->getUrl(2)) { $this->deleteData(['page', $this->getUrl(2)]); - if (file_exists(self::DATA_DIR . self::$courseContent . '/content/' . $this->getUrl(2) . '.html')) { - unlink(self::DATA_DIR . self::$courseContent . '/content/' . $this->getUrl(2) . '.html'); + if (file_exists(self::DATA_DIR . self::$siteContent . '/content/' . $this->getUrl(2) . '.html')) { + unlink(self::DATA_DIR . self::$siteContent . '/content/' . $this->getUrl(2) . '.html'); } } // Traitement des pages spéciales affectées dans la config : @@ -508,11 +508,11 @@ class page extends common ]); // Creation du contenu de la page - if (!is_dir(self::DATA_DIR . self::$courseContent . '/content')) { - mkdir(self::DATA_DIR . self::$courseContent . '/content', 0755); + if (!is_dir(self::DATA_DIR . self::$siteContent . '/content')) { + mkdir(self::DATA_DIR . self::$siteContent . '/content', 0755); } $content = empty($this->getInput('pageEditContent', null)) ? '

    ' : str_replace('

    ', '

     

    ', $this->getInput('pageEditContent', null)); - $this->setPage($pageId, $content, self::$courseContent); + $this->setPage($pageId, $content, self::$siteContent); // Met à jour le sitemap $this->updateSitemap(); diff --git a/core/module/page/view/edit/edit.php b/core/module/page/view/edit/edit.php index 6186800..50b1151 100644 --- a/core/module/page/view/edit/edit.php +++ b/core/module/page/view/edit/edit.php @@ -108,7 +108,7 @@
    'editorWysiwyg', - 'value' => $this->getPage($this->getUrl(2), self::$courseContent) + 'value' => $this->getPage($this->getUrl(2), self::$siteContent) ]); ?>
    diff --git a/core/module/plugin/plugin.php b/core/module/plugin/plugin.php index aa5baa4..712b642 100644 --- a/core/module/plugin/plugin.php +++ b/core/module/plugin/plugin.php @@ -531,19 +531,19 @@ class plugin extends common $infoModules[$pagesInfos[$keyi18n][$keyPage]['moduleId']]['version'], template::flag($keyi18n, '20px') . ' ' . $pagesInfos[$keyi18n][$keyPage]['title'] . ' (' . $keyPage . ')', template::button('dataExport' . $keyPage, [ - 'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/filemanager/' . self::$courseContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage, + 'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/filemanager/' . self::$siteContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage, // appel de fonction vaut exécution, utiliser un paramètre 'value' => template::ico('download-cloud'), 'help' => 'Sauvegarder les données du module dans le gestionnaire de fichiers' ]), template::button('dataExport' . $keyPage, [ - 'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/download/' . self::$courseContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage, + 'href' => helper::baseUrl() . $this->getUrl(0) . '/dataExport/download/' . self::$siteContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage, // appel de fonction vaut exécution, utiliser un paramètre 'value' => template::ico('download'), 'help' => 'Sauvegarder et télécharger les données du module' ]), template::button('dataDelete' . $keyPage, [ - 'href' => helper::baseUrl() . $this->getUrl(0) . '/dataDelete/' . self::$courseContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage, + 'href' => helper::baseUrl() . $this->getUrl(0) . '/dataDelete/' . self::$siteContent . '/' . $pagesInfos[$keyi18n][$keyPage]['moduleId'] . '/' . $keyPage, // appel de fonction vaut exécution, utiliser un paramètre 'value' => template::ico('trash'), 'class' => 'buttonRed dataDelete', diff --git a/module/search/search.php b/module/search/search.php index b5e5f53..566c84c 100644 --- a/module/search/search.php +++ b/module/search/search.php @@ -213,8 +213,8 @@ class search extends common ) { $url = $parentId; $titre = $this->getData(['page', $parentId, 'title']); - //$content = file_get_contents(self::DATA_DIR . self::$courseContent . '/content/' . $this->getData(['page', $parentId, 'content'])); - $content = $this->getPage($parentId, self::$courseContent); + //$content = file_get_contents(self::DATA_DIR . self::$siteContent . '/content/' . $this->getData(['page', $parentId, 'content'])); + $content = $this->getPage($parentId, self::$siteContent); $content = $titre . ' ' . $content; // Pages sauf pages filles et articles de blog $tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier); @@ -232,8 +232,8 @@ class search extends common ) { $url = $childId; $titre = $this->getData(['page', $childId, 'title']); - //$content = file_get_contents(self::DATA_DIR . self::$courseContent . '/content/' . $this->getData(['page', $childId, 'content'])); - $content = $this->getPage($childId, self::$courseContent); + //$content = file_get_contents(self::DATA_DIR . self::$siteContent . '/content/' . $this->getData(['page', $childId, 'content'])); + $content = $this->getPage($childId, self::$siteContent); $content = $titre . ' ' . $content; //Pages filles $tempData = $this->occurrence($url, $titre, $content, $motclef, self::$motentier);