From 8045f7f375a127ba476011cb1aac522643b9b498 Mon Sep 17 00:00:00 2001 From: Noe GARNIER Date: Sat, 19 Nov 2022 18:21:24 +0100 Subject: [PATCH] Mise en place d'un AutoLoader --- WEB/Config/Autoload.php | 51 ++++++++++++++++++++++++++++ WEB/Config/Config.php | 26 ++++++++++---- WEB/Controller/Controller.php | 27 ++++++++++----- WEB/Controller/PartieGateway.php | 4 --- WEB/View/src/pages/Presentation.html | 2 +- WEB/index.php | 25 ++++---------- 6 files changed, 96 insertions(+), 39 deletions(-) create mode 100644 WEB/Config/Autoload.php diff --git a/WEB/Config/Autoload.php b/WEB/Config/Autoload.php new file mode 100644 index 00000000..c67bf2f5 --- /dev/null +++ b/WEB/Config/Autoload.php @@ -0,0 +1,51 @@ + \ No newline at end of file diff --git a/WEB/Config/Config.php b/WEB/Config/Config.php index ce30a946..67b8ee8f 100644 --- a/WEB/Config/Config.php +++ b/WEB/Config/Config.php @@ -1,16 +1,28 @@ signUp(); @@ -36,6 +35,9 @@ class Controller case "goToSignUp": $this->goToSignUp(); break; + case "goToEnigme": + $this->goToEnigme(); + break; } } catch (PDOException $e) { @@ -54,7 +56,7 @@ class Controller $joueur = new Joueur($_REQUEST['email'], $_REQUEST['username'], $_REQUEST['password']); $gateway->insert($joueur); $_SESSION['connected'] = 'true'; - require ('./View/src/pages/Main.php'); + require ($rep.$vues['main']);; }catch (Exception $e){ require($rep.$vues['erreurSignUp']); } @@ -72,7 +74,7 @@ class Controller throw new InvalidMdpException("Mot de passe invalide"); } $_SESSION['connected'] = 'true'; - require ('./View/src/pages/Main.php'); + require ($rep.$vues['main']); }catch (JoueurNotFoundException $e){ require($rep.$vues['erreurLoginEmail']); }catch (InvalidMdpException $m) { @@ -83,7 +85,7 @@ class Controller private function goToPresentation() { global $rep, $vues; try { - require ('./View/src/pages/Presentation.html'); + require ($rep.$vues['presenation']); }catch (Exception $e){ require($rep.$vues['erreur404']); } @@ -92,7 +94,7 @@ class Controller private function goToHome() { global $rep, $vues; try { - require ('./View/src/pages/Main.php'); + require ($rep.$vues['main']); }catch (Exception $e){ require($rep.$vues['erreur404']); } @@ -101,7 +103,7 @@ class Controller private function goToLogin() { global $rep, $vues; try { - require ('./View/src/pages/LogSign/Login.php'); + require ($rep.$vues['login']); }catch (Exception $e){ require($rep.$vues['erreur404']); } @@ -110,7 +112,16 @@ class Controller private function goToSignUp() { global $rep, $vues; try { - require ('./View/src/pages/LogSign/SignUp.php'); + require ($rep.$vues['signUp']); + }catch (Exception $e){ + require($rep.$vues['erreur404']); + } + } + + private function goToEnigme() { + global $rep, $vues; + try { + require ($rep.$vues['enigme']); }catch (Exception $e){ require($rep.$vues['erreur404']); } diff --git a/WEB/Controller/PartieGateway.php b/WEB/Controller/PartieGateway.php index 1b0ccaf8..7d35c6ff 100644 --- a/WEB/Controller/PartieGateway.php +++ b/WEB/Controller/PartieGateway.php @@ -1,8 +1,4 @@
- Foxy + Foxy

Bonjour utilisateur ! Je suis Foxy, une IA créer par Howard Aiken, un eminent chercheur, malhereusement celui-ci est mort. J'ai besoin de votre aide pour protéger mon code source d'une organisation diff --git a/WEB/index.php b/WEB/index.php index e72b326e..9c18317b 100644 --- a/WEB/index.php +++ b/WEB/index.php @@ -1,24 +1,11 @@