aboutsummaryrefslogtreecommitdiff
path: root/src/router.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/router.php')
-rw-r--r--src/router.php5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/router.php b/src/router.php
index ccab426..8c33d6e 100644
--- a/src/router.php
+++ b/src/router.php
@@ -83,8 +83,7 @@ elseif($_SERVER['REQUEST_METHOD'] === 'POST'){
83 // requêtes JSON avec fetch() 83 // requêtes JSON avec fetch()
84 if($_SERVER['CONTENT_TYPE'] === 'application/json') 84 if($_SERVER['CONTENT_TYPE'] === 'application/json')
85 { 85 {
86 $data = file_get_contents('php://input'); 86 $json = json_decode($request->getContent(), true); // = json_decode(file_get_contents('php://input'), true);
87 $json = json_decode($data, true);
88 87
89 if($request->query->has('action')) 88 if($request->query->has('action'))
90 { 89 {
@@ -309,7 +308,7 @@ else{
309 308
310/* -- utilisation de la réponse -- */ 309/* -- utilisation de la réponse -- */
311if(isset($response)){ 310if(isset($response)){
312 // cas des mauvais id de la page article (d'autres cas à prévoir) 311 // cas gérés (d'autres sont à prévoir): mauvais id de la page article, accès page création d'article sans être admin
313 if($request->isMethod('GET') && $response->getStatusCode() == 302){ // 302 redirection temporaire 312 if($request->isMethod('GET') && $response->getStatusCode() == 302){ // 302 redirection temporaire
314 header('Location: ' . new URL(['page' => !empty($_GET['from']) ? $_GET['from'] : 'accueil'])); 313 header('Location: ' . new URL(['page' => !empty($_GET['from']) ? $_GET['from'] : 'accueil']));
315 } 314 }