From ac78568e1c1a91564eb6bd35c03d9a8a781bc53d Mon Sep 17 00:00:00 2001 From: polo Date: Tue, 19 May 2026 00:19:23 +0200 Subject: =?UTF-8?q?lanc=C3=A9s=20et=20captures=20d'exceptions=20page=20mai?= =?UTF-8?q?ntenance,=20page=20menu=20et=20chemins:=20interdiction=20pour?= =?UTF-8?q?=20une=20page=20d'avoir=20pour=20parent=20une=20adresse=20d'un?= =?UTF-8?q?=20site,=20regression=20contructeur=20de=20MenuBuilder,=20MAJ?= =?UTF-8?q?=20de=20paquets=20dans=20composer.json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/MenuAndPathsController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/controller/MenuAndPathsController.php') diff --git a/src/controller/MenuAndPathsController.php b/src/controller/MenuAndPathsController.php index 4d37f3d..799f14b 100644 --- a/src/controller/MenuAndPathsController.php +++ b/src/controller/MenuAndPathsController.php @@ -141,7 +141,7 @@ class MenuAndPathsController $page = Model::$menu->findPageById((int)$id); $parent = $page->getParent(); // peut être null - if($parent == null){ + if($parent === null){ $parent = Model::$menu; } @@ -150,6 +150,12 @@ class MenuAndPathsController if($page->getPosition() > 1){ foreach($parent->getChildren() as $child){ if($child->getPosition() === $page->getPosition() - 1){ + // refus si $parent est une adresse, ça va casser le lien, exemple: index.php?page=chemin/http://un_site_web.fr/vers/ici + if(str_starts_with($child->getEndOfPath(), 'http')){ + echo json_encode(['success' => false, 'error' => 'new_parent_is_a_link']); + die; + } + $page->setParent($child); break; } -- cgit v1.2.3