From fa3c582a2bd91433399a5b275616052028a5a011 Mon Sep 17 00:00:00 2001 From: polo Date: Thu, 18 Sep 2025 00:27:20 +0200 Subject: =?UTF-8?q?news=20positionn=C3=A9es=20en=20fonction=20de=20leur=20?= =?UTF-8?q?date,=20suppression=20de=20leurs=20boutons=20position,=20am?= =?UTF-8?q?=C3=A9liorations=20routage=20page=20article,=20bouton=20share?= =?UTF-8?q?=20en=20bas=20pour=20les=20news?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/controller/ArticleController.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/controller/ArticleController.php') diff --git a/src/controller/ArticleController.php b/src/controller/ArticleController.php index cb132cf..411c1dc 100644 --- a/src/controller/ArticleController.php +++ b/src/controller/ArticleController.php @@ -36,14 +36,19 @@ class ArticleController if($json['id'][0] === 'n') // ici $id est un bloc { $section_id = (int)substr($id, 1); // id du bloc
- if(!$director->findNodeById($section_id)){ - echo json_encode(['success' => false, 'error' => 'article_not_saved']); + if(!$director->findNodeById($section_id)){ // erreur mauvais id + echo json_encode(['success' => false, 'error' => 'article_not_saved, bad id']); die; } $director->makeSectionNode(); $node = $director->getNode(); // =
- + if(is_array($content)){ // cas d'une nouvelle "news" + if($node->getPage()->getEndOfPath() !== $json['from']){ // erreur mauvais from + echo json_encode(['success' => false, 'error' => 'article_not_saved, bad from']); + die; + } + $date = new \DateTime($content['d'] . ':' . (new \DateTime)->format('s')); // l'input type="datetime-local" ne donne pas les secondes, on les ajoute: 'hh:mm' . ':ss' $article = new Article($content['i'], $date, $content['t'], $content['p']); $article_node = new Node('new', [], count($node->getChildren()) + 1, $node, $node->getPage(), $article); -- cgit v1.2.3