From ad275ec629e0ffff25e51a4b2f7a9b646922eb8c Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Sat, 12 Sep 2020 09:52:30 +0200 Subject: [PATCH] initialisation --- core/core.php | 2 +- core/module/config/config.php | 1 + core/module/config/view/index/index.php | 12 +++++++-- core/module/install/ressource/defaultdata.php | 26 ++++++++++++++++++- core/module/maintenance/maintenance.php | 23 +++++++++++----- core/module/maintenance/view/index/index.php | 2 +- 6 files changed, 55 insertions(+), 11 deletions(-) diff --git a/core/core.php b/core/core.php index ef872517..587f2c02 100644 --- a/core/core.php +++ b/core/core.php @@ -1713,7 +1713,7 @@ class core extends common { // Déconnexion $user = new user; $user->logout(); - // Rédirection + // Redirection http_response_code(302); header('Location:' . helper::baseUrl() . 'maintenance'); exit(); diff --git a/core/module/config/config.php b/core/module/config/config.php index ce2248c3..cd5dcf0e 100644 --- a/core/module/config/config.php +++ b/core/module/config/config.php @@ -442,6 +442,7 @@ class config extends common { 'homePageId' => $this->getInput('configHomePageId', helper::FILTER_ID, true), 'page404' => $this->getInput('configPage404'), 'page403' => $this->getInput('configPage403'), + 'page302' => $this->getInput('configPage302'), 'analyticsId' => $this->getInput('configAnalyticsId'), 'autoBackup' => $this->getInput('configAutoBackup', helper::FILTER_BOOLEAN), 'maintenance' => $this->getInput('configMaintenance', helper::FILTER_BOOLEAN), diff --git a/core/module/config/view/index/index.php b/core/module/config/view/index/index.php index 2f9a82e5..2875ba7d 100644 --- a/core/module/config/view/index/index.php +++ b/core/module/config/view/index/index.php @@ -176,7 +176,7 @@
-
+
'Aucune'],helper::arrayCollumn($pages, 'title', 'SORT_ASC')), [ 'label' => 'Accès interdit, erreur 403', @@ -187,11 +187,19 @@
'Aucune'],helper::arrayCollumn($pages, 'title', 'SORT_ASC')), [ - 'label' => 'Page inexistante, erreur 404 ', + 'label' => 'Page inexistante, erreur 404', 'selected' =>$this->getData(['config', 'page404']), 'help' => 'Une page 404 ne doit pas apparaître dans l\'arborescence du menu. Créez et éditez une page orpheline.' ]); ?>
+
+ 'Aucune'],helper::arrayCollumn($pages, 'title', 'SORT_ASC')), [ + 'label' => 'Site en maintenance', + 'selected' =>$this->getData(['config', 'page302']), + 'help' => 'Page de maintenance personnalisable' + ]); ?> +
diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index 86a97694..4635ce66 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -10,8 +10,9 @@ class init extends common { 'favicon' => 'favicon.ico', 'faviconDark' => 'faviconDark.ico', 'homePageId' => 'accueil', + 'page302' => 'erreur302', + 'page403' => 'erreur403', 'page404' => 'erreur404', - 'page403' => 'erreur403', 'maintenance' => false, 'social' => [ 'facebookId' => 'facebook', @@ -544,6 +545,29 @@ class init extends common { 'hideMenuHead' => false, 'hideMenuChildren' => false ], + 'erreur302' => [ + 'typeMenu' => 'text', + 'iconUrl' => '', + 'disable' => false, + 'content' => '

Maintenance en cours...<\/h1>\r\n

Notre site est actuellement en maintenance. Nous sommes désolés pour la gêne occasionnée et faisons notre possible pour être rapidement de retour.<\/p>\r\n

\r\n
<\/span>Administration<\/a><\/div>\r\n<\/div>\r\n

<\/p>', + 'hideTitle' => false, + 'breadCrumb' => false, + 'metaDescription' => '', + 'metaTitle' => '', + 'moduleId' => '', + 'modulePosition' => 'bottom', + 'parentPageId' => '', + 'position' => 0, + 'group' => self::GROUP_VISITOR, + 'targetBlank' => false, + 'title' => 'Erreur 302', + 'block' => '12', + 'barLeft' => '', + 'barRight' => '', + 'displayMenu' => 'none', + 'hideMenuSide' => false, + 'hideMenuChildren' =>false + ], 'erreur403' => [ 'typeMenu' => 'text', 'iconUrl' => '', diff --git a/core/module/maintenance/maintenance.php b/core/module/maintenance/maintenance.php index 63e76e76..377c6f9f 100644 --- a/core/module/maintenance/maintenance.php +++ b/core/module/maintenance/maintenance.php @@ -22,12 +22,23 @@ class maintenance extends common { * Maintenance */ public function index() { - // Valeurs en sortie - $this->addOutput([ - 'display' => self::DISPLAY_LAYOUT_LIGHT, - 'title' => 'Maintenance en cours...', - 'view' => 'index' - ]); + // Page perso définie et existante + if ($this->getData(['config','page302']) !== 'none' + AND $this->getData(['page',$this->getData(['config','page302'])]) ) { + $this->addOutput([ + 'display' => self::DISPLAY_LAYOUT_LIGHT, + 'title' => $this->getData(['page',$this->getData(['config','page302']),'title']), + 'content' => $this->getdata(['page',$this->getData(['config','page302']),'content']) . '

', + 'view' => 'index' + ]); + } else { + // Valeurs en sortie + $this->addOutput([ + 'display' => self::DISPLAY_LAYOUT_LIGHT, + 'title' => 'Maintenance en cours...', + 'view' => 'index' + ]); + } } } \ No newline at end of file diff --git a/core/module/maintenance/view/index/index.php b/core/module/maintenance/view/index/index.php index 52b7ac08..de412318 100644 --- a/core/module/maintenance/view/index/index.php +++ b/core/module/maintenance/view/index/index.php @@ -2,7 +2,7 @@
'Administration', + 'value' => 'Connexion', 'href' => helper::baseUrl() . 'user/login', 'ico' => 'lock' ]); ?>