diff --git a/index.php b/index.php index a92283c..a4837a8 100644 --- a/index.php +++ b/index.php @@ -15,8 +15,8 @@ if(!isset($_SESSION['theme'])){ require_once __DIR__ . '/config/config.php'; require __DIR__ . '/vendor/autoload.php'; -$co = new \Gateway\Connection('pgsql:host=localhost;dbname=wikifantasy3;', 'postgres', 'sucepute'); -//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); +//$co = new \Gateway\Connection('pgsql:host=localhost;dbname=wikifantasy3;', 'postgres', 'sucepute'); +$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'passwd'); //twig $loader = new \Twig\Loader\FilesystemLoader('vue/templates'); diff --git a/public/styles/style.css b/public/styles/style.css index 290006e..a1ee1fe 100644 --- a/public/styles/style.css +++ b/public/styles/style.css @@ -175,6 +175,18 @@ body{ height : 7vh; } +.error{ + display:block; + margin-top: 30vh; + text-align: center; + font-size: 5em; +} + +.explanation{ + text-align: center; + font-size: 3em; +} + /* écran tablette*/ @media (max-width: 834px) or (max-aspect-ratio : 1/1){ diff --git a/src/Controleur/FrontControler.php b/src/Controleur/FrontControler.php index ad40e9e..eef610d 100644 --- a/src/Controleur/FrontControler.php +++ b/src/Controleur/FrontControler.php @@ -55,13 +55,14 @@ Class FrontControler{ $router->map('GET|POST', '/validsubmit', 'UserControler','validsubmit'); $router->map('GET|POST', '/add', 'UserControler', 'add'); $router->map('GET|POST', '/accueilQuiz', 'UserControler', 'accueilQuiz'); + $router->map('GET|POST', '/error', 'VisitorControler','error'); $match = $router->match(); $action = NULL; if(!$match){ - $dVueEreur[] = "Requête introuvable"; + $dVueEreur = [404,"Page inconue"]; $this->vueErreur($dVueEreur); } else{ @@ -71,7 +72,7 @@ Class FrontControler{ //Si existe, on l’appelle if(!$this->ifExisteAction($action)){ - $dVueEreur[] = "Action introuvable"; + $dVueEreur = [404,"Action inconue"]; $this->vueErreur($dVueEreur); } @@ -112,9 +113,8 @@ Class FrontControler{ return false; } - private function vueErreur(array $dVueErreur){ + private function vueErreur(array $erreur){ global $vues; - echo "{$dVueErreur[0]}"; require_once $vues['erreur']; } diff --git a/src/Controleur/UserControler.php b/src/Controleur/UserControler.php index 34c093c..a7a5100 100644 --- a/src/Controleur/UserControler.php +++ b/src/Controleur/UserControler.php @@ -527,7 +527,6 @@ class UserControler { } else{ require_once($vues["create"]); - var_dump($error); } } @@ -542,6 +541,7 @@ class UserControler { $question = $questMod->getRandomQuestion([$_POST["questionType"],$_POST["awnserType"]],$_POST["langue"]); addTab($question); if($question == null){ + $erreur = [501,"Erreur serveur lors de l'obtention de la question"]; $require_once($vues["erreur"]); } else{ diff --git a/src/Controleur/VisitorControler.php b/src/Controleur/VisitorControler.php index 523c3c5..9f5f150 100644 --- a/src/Controleur/VisitorControler.php +++ b/src/Controleur/VisitorControler.php @@ -56,10 +56,21 @@ Class VisitorControler { public function quote(array $arg){ global $vues; $id= $arg['idQuote'] ?? 1; + if($id > 999999999){ + $erreur = [404,"Citation inexistante pour le moment",'../']; + require_once($vues['erreur']); + exit(); + } $f = $this->uMod->isFavorite($_SESSION["user"],$id); $q = $this->qMod->searchId($id); $c = $this->cMod->getComment($id); - require_once $vues['quote']; + if($q->getContent() != 'NULL'){ + require_once $vues['quote']; + } + else{ + $erreur = [404,"Citation inexistante pour le moment","../"]; + require_once($vues['erreur']); + } } public function favorite() { diff --git a/vue/erreur.php b/vue/erreur.php index dc283d5..f3b64f5 100644 --- a/vue/erreur.php +++ b/vue/erreur.php @@ -1,5 +1,25 @@ -
Erreur {{numero}} : {{context}}
+ + \ No newline at end of file