diff options
| author | polo <ordipolo@gmx.fr> | 2026-05-19 00:19:23 +0200 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-05-19 00:19:23 +0200 |
| commit | ac78568e1c1a91564eb6bd35c03d9a8a781bc53d (patch) | |
| tree | 11deab2f8b82c30110faa4329be7c14f2ba394c1 /src/controller/MenuAndPathsController.php | |
| parent | e79931432e63a86c5b7ced8a41186a24239794fe (diff) | |
| download | cms-ac78568e1c1a91564eb6bd35c03d9a8a781bc53d.tar.gz cms-ac78568e1c1a91564eb6bd35c03d9a8a781bc53d.tar.bz2 cms-ac78568e1c1a91564eb6bd35c03d9a8a781bc53d.zip | |
lancés et captures d'exceptions page maintenance, page menu et chemins: interdiction pour une page d'avoir pour parent une adresse d'un site, regression contructeur de MenuBuilder, MAJ de paquets dans composer.json
Diffstat (limited to 'src/controller/MenuAndPathsController.php')
| -rw-r--r-- | src/controller/MenuAndPathsController.php | 8 |
1 files changed, 7 insertions, 1 deletions
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 | |||
| 141 | $page = Model::$menu->findPageById((int)$id); | 141 | $page = Model::$menu->findPageById((int)$id); |
| 142 | 142 | ||
| 143 | $parent = $page->getParent(); // peut être null | 143 | $parent = $page->getParent(); // peut être null |
| 144 | if($parent == null){ | 144 | if($parent === null){ |
| 145 | $parent = Model::$menu; | 145 | $parent = Model::$menu; |
| 146 | } | 146 | } |
| 147 | 147 | ||
| @@ -150,6 +150,12 @@ class MenuAndPathsController | |||
| 150 | if($page->getPosition() > 1){ | 150 | if($page->getPosition() > 1){ |
| 151 | foreach($parent->getChildren() as $child){ | 151 | foreach($parent->getChildren() as $child){ |
| 152 | if($child->getPosition() === $page->getPosition() - 1){ | 152 | if($child->getPosition() === $page->getPosition() - 1){ |
| 153 | // refus si $parent est une adresse, ça va casser le lien, exemple: index.php?page=chemin/http://un_site_web.fr/vers/ici | ||
| 154 | if(str_starts_with($child->getEndOfPath(), 'http')){ | ||
| 155 | echo json_encode(['success' => false, 'error' => 'new_parent_is_a_link']); | ||
| 156 | die; | ||
| 157 | } | ||
| 158 | |||
| 153 | $page->setParent($child); | 159 | $page->setParent($child); |
| 154 | break; | 160 | break; |
| 155 | } | 161 | } |
