diff options
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 | } |
