From 8871d9bb21df89a18da89f347b16f3de7e452fe4 Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Tue, 24 Jan 2023 20:09:53 +0100 Subject: [PATCH] modify structure sent to recipe/edit to include POST_URI --- Controllers/RecipeController.php | 10 +++++----- Views/recipe/edit.php | 29 ++++++++++++++++------------- 2 files changed, 21 insertions(+), 18 deletions(-) diff --git a/Controllers/RecipeController.php b/Controllers/RecipeController.php index 70f0cdc..51962c3 100644 --- a/Controllers/RecipeController.php +++ b/Controllers/RecipeController.php @@ -35,21 +35,21 @@ final class RecipeController } $O_recipeModel = new RecipeModel(); - $A_returnArray = $O_recipeModel->getFullRecipe($A_urlParams[0]); - if ($A_returnArray === null) { + $A_recipe = $O_recipeModel->getFullRecipe($A_urlParams[0]); + if ($A_recipe === null) { throw new HTTPSpecialCaseException(404); } - if ($A_returnArray["AUTHOR_ID"] !== $_SESSION["ID"]) { + if ($A_recipe["AUTHOR_ID"] !== $_SESSION["ID"]) { throw new HTTPSpecialCaseException(400, "You are not the owner of this recipe"); } - View::show("recipe/edit", $A_returnArray); + View::show("recipe/edit", array("POST_URI" => "/recipe/update", "RECIPE" => $A_recipe)); } public function newAction(Array $A_urlParams = null, Array $A_postParams = null) { - View::show("recipe/edit", array()); + View::show("recipe/edit", array("POST_URI" => "/recipe/create", "RECIPE" => array())); } public function searchAction(Array $A_urlParams = null, Array $A_postParams = null, Array $A_getParams = null) diff --git a/Views/recipe/edit.php b/Views/recipe/edit.php index dabc63b..452122c 100644 --- a/Views/recipe/edit.php +++ b/Views/recipe/edit.php @@ -1,4 +1,7 @@ -