From 6a8e432b10a32473a52883477af36fb1eba3478f Mon Sep 17 00:00:00 2001 From: fredtempez Date: Wed, 15 Nov 2023 14:41:50 +0100 Subject: [PATCH] =?UTF-8?q?Masque=20les=20ic=C3=B4nes=20de=20gestion=20dan?= =?UTF-8?q?s=20le=20cours?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/class/layout.class.php | 7 +++++-- core/class/router.class.php | 12 ++++++++++++ 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/core/class/layout.class.php b/core/class/layout.class.php index 1256442..a5dc54b 100644 --- a/core/class/layout.class.php +++ b/core/class/layout.class.php @@ -1046,7 +1046,10 @@ class layout extends common 'attr' => 'data-lity' ]) . ''; } - if ($this->getUser('group') >= self::GROUP_ADMIN) { + if ( + self::$siteContent === 'home' + && $this->getUser('group') >= self::GROUP_ADMIN + ) { $rightItems .= '
  • ' . template::ico('puzzle', [ 'help' => 'Modules', 'href' => helper::baseUrl() . 'plugin' @@ -1241,7 +1244,7 @@ class layout extends common // Trouver la clé de l'élément recherché $key = array_search($elementToFind, $hierarchy); - + $previousPage = null; $nextPage = null; if ($key !== false) { diff --git a/core/class/router.class.php b/core/class/router.class.php index b4fa4ee..fab6217 100644 --- a/core/class/router.class.php +++ b/core/class/router.class.php @@ -884,6 +884,12 @@ class core extends common exit(); } if ($access === false) { + // Bascule sur le site d'accueil + if ($_SESSION['ZWII_SITE_CONTENT'] !== 'home') { + $_SESSION['ZWII_SITE_CONTENT'] = 'home'; + header('Location:' . helper::baseUrl() . $this->getUrl()); + exit(); + } http_response_code(403); if ($accessInfo['userName']) { $this->addOutput([ @@ -905,6 +911,12 @@ class core extends common } } } elseif ($this->output['content'] === '') { + // Bascule sur le site d'accueil pour afficher la page d'erreur + if ($_SESSION['ZWII_SITE_CONTENT'] !== 'home') { + $_SESSION['ZWII_SITE_CONTENT'] = 'home'; + header('Location:' . helper::baseUrl() . $this->getUrl()); + exit(); + } http_response_code(404); if ( $this->getData(['config', 'page404']) !== 'none'