From 1a951d96ced034ec68b301b671d34325cd7f011c Mon Sep 17 00:00:00 2001 From: "jade.van_brabandt" Date: Mon, 20 Nov 2023 14:09:07 +0100 Subject: [PATCH] feat : change in git ignore --- .gitignore | 2 +- Website/controllers/ControllerUser.php | 31 +++++++++++-------------- Website/controllers/FrontController.php | 20 +++++++--------- Website/usages/Config.php | 19 +++++++++++++++ 4 files changed, 43 insertions(+), 29 deletions(-) create mode 100644 Website/usages/Config.php diff --git a/.gitignore b/.gitignore index e5728f9..95fc2fd 100755 --- a/.gitignore +++ b/.gitignore @@ -820,4 +820,4 @@ replay_pid* # .nfs files are created when an open file is removed but is still being accessed .nfs* # config ignore to not stock password on the git (: -/Website/usages/Config.php \ No newline at end of file +/Website/usages/Config_DB.php \ No newline at end of file diff --git a/Website/controllers/ControllerUser.php b/Website/controllers/ControllerUser.php index f2308d5..1597a00 100644 --- a/Website/controllers/ControllerUser.php +++ b/Website/controllers/ControllerUser.php @@ -135,7 +135,6 @@ class ControllerUser 'numQuestion' => $numQuestion, 'answerss' => $_SESSION["Answers"], ]); - } else { $answerContent = $_SESSION["Answers"][$numQuestion][$answerNumber]->getContent(); $_SESSION["playerAnswersContent"][$numQuestion] = $answerContent; @@ -158,22 +157,21 @@ class ControllerUser $Final[]["Question"] = array(); $Final[]["goodAnswer"] = array(); $Final[]["PlayerAnswer"] = array(); - $c=0; + $c = 0; foreach ($_SESSION["Questions"] as &$question) { $answer = $this->mdAnswer->getAnswerByID($question->getIdAnswerGood()); $Final[$c]["goodAnswer"] = $answer->getContent(); - $c=$c+1; + $c = $c + 1; } - $c=0; + $c = 0; foreach ($_SESSION["Questions"] as $question) { $Final[$c]["Question"] = $question->getContent(); - $c=$c+1; + $c = $c + 1; } - $c=0; - foreach ($_SESSION["playerAnswersContent"] as $answer) - { + $c = 0; + foreach ($_SESSION["playerAnswersContent"] as $answer) { $Final[$c]["PlayerAnswer"] = $answer; - $c=$c+1; + $c = $c + 1; } echo $this->twig->render($this->vues["viewScore"], [ 'score' => $_SESSION["Score"], @@ -199,22 +197,21 @@ class ControllerUser $Final[]["Question"] = array(); $Final[]["goodAnswer"] = array(); $Final[]["PlayerAnswer"] = array(); - $c=0; + $c = 0; foreach ($_SESSION["Questions"] as &$question) { $answer = $this->mdAnswer->getAnswerByID($question->getIdAnswerGood()); $Final[$c]["goodAnswer"] = $answer->getContent(); - $c=$c+1; + $c = $c + 1; } - $c=0; + $c = 0; foreach ($_SESSION["Questions"] as $question) { $Final[$c]["Question"] = $question->getContent(); - $c=$c+1; + $c = $c + 1; } - $c=0; - foreach ($_SESSION["playerAnswersContent"] as $answer) - { + $c = 0; + foreach ($_SESSION["playerAnswersContent"] as $answer) { $Final[$c]["PlayerAnswer"] = $answer; - $c=$c+1; + $c = $c + 1; } echo $this->twig->render($this->vues["viewScore"], [ 'score' => $_SESSION["Score"], diff --git a/Website/controllers/FrontController.php b/Website/controllers/FrontController.php index cc20a13..3768bcd 100755 --- a/Website/controllers/FrontController.php +++ b/Website/controllers/FrontController.php @@ -4,7 +4,7 @@ class FrontController function __construct() { global $dsn, $user, $pass, $vues; - + try { // Initialize AltoRouter $router = new AltoRouter(); @@ -37,19 +37,17 @@ class FrontController if ($match) { $controller = $match['target']; if (strpos($controller, "#") !== false) { - list($controller,$action)=explode("#",$controller); - } - else { - $action=$match['params']['action']; - $id=$match['params']['id']; + list($controller, $action) = explode("#", $controller); + } else { + $action = $match['params']['action']; + $id = $match['params']['id']; } - $controller = new $controller; - if (is_callable(array($controller, $action))) { - call_user_func_array(array($controller, $action), array($match['params'])); + $controller = new $controller; + if (is_callable(array($controller, $action))) { + call_user_func_array(array($controller, $action), array($match['params'])); } } - } - catch (Exception $e) { + } catch (Exception $e) { header("Location:" . $vues["erreur"]); } } diff --git a/Website/usages/Config.php b/Website/usages/Config.php new file mode 100644 index 0000000..82edcd7 --- /dev/null +++ b/Website/usages/Config.php @@ -0,0 +1,19 @@ +