From 03e5e48b3f55ce1ee478cefa4a84573c99ee1bd4 Mon Sep 17 00:00:00 2001 From: beaulaton Date: Mon, 4 Nov 2024 09:52:43 +0100 Subject: [PATCH] Controleur pour la page Login (Kentin) --- cache/4c/4c09a23641745f18c4a77cbf74811c72.php | 90 +++++++++++++++++++ cache/57/572879f536ab89f645ae886cddb0ed04.php | 78 ++++++++++++++++ config/config.php | 1 + src/Controleur/FrontControler.php | 13 ++- src/Controleur/VisitorControler.php | 6 ++ vue/quote.php | 6 +- 6 files changed, 189 insertions(+), 5 deletions(-) create mode 100644 cache/4c/4c09a23641745f18c4a77cbf74811c72.php create mode 100644 cache/57/572879f536ab89f645ae886cddb0ed04.php diff --git a/cache/4c/4c09a23641745f18c4a77cbf74811c72.php b/cache/4c/4c09a23641745f18c4a77cbf74811c72.php new file mode 100644 index 0000000..d618adc --- /dev/null +++ b/cache/4c/4c09a23641745f18c4a77cbf74811c72.php @@ -0,0 +1,90 @@ + + */ + private array $macros = []; + + public function __construct(Environment $env) + { + parent::__construct($env); + + $this->source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 1 + yield " + + + + + "; + // line 6 + yield $this->env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["title"] ?? null), "html", null, true); + yield " + env->getRuntime('Twig\Runtime\EscaperRuntime')->escape(($context["style"] ?? null), "html", null, true); + yield "\"> + + + + "; + yield from []; + } + + /** + * @codeCoverageIgnore + */ + public function getTemplateName(): string + { + return "head.html.twig"; + } + + /** + * @codeCoverageIgnore + */ + public function isTraitable(): bool + { + return false; + } + + /** + * @codeCoverageIgnore + */ + public function getDebugInfo(): array + { + return array ( 53 => 7, 49 => 6, 42 => 1,); + } + + public function getSourceContext(): Source + { + return new Source("", "head.html.twig", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/head.html.twig"); + } +} diff --git a/cache/57/572879f536ab89f645ae886cddb0ed04.php b/cache/57/572879f536ab89f645ae886cddb0ed04.php new file mode 100644 index 0000000..b20eacf --- /dev/null +++ b/cache/57/572879f536ab89f645ae886cddb0ed04.php @@ -0,0 +1,78 @@ + + */ + private array $macros = []; + + public function __construct(Environment $env) + { + parent::__construct($env); + + $this->source = $this->getSourceContext(); + + $this->parent = false; + + $this->blocks = [ + ]; + } + + protected function doDisplay(array $context, array $blocks = []): iterable + { + $macros = $this->macros; + // line 1 + yield "
+
+ \"coeur\" + \"toggle + \"quizz\" +
+
+ \"Logo\" +
+
+ \"user\" +
+
"; + yield from []; + } + + /** + * @codeCoverageIgnore + */ + public function getTemplateName(): string + { + return "bandeau.html.twig"; + } + + /** + * @codeCoverageIgnore + */ + public function getDebugInfo(): array + { + return array ( 42 => 1,); + } + + public function getSourceContext(): Source + { + return new Source("", "bandeau.html.twig", "/home/www/lebeaulato/public_html/WF-Website/vue/templates/bandeau.html.twig"); + } +} diff --git a/config/config.php b/config/config.php index 3caadec..cd389e1 100644 --- a/config/config.php +++ b/config/config.php @@ -17,6 +17,7 @@ $mdp = ''; $vues['erreur'] = 'vue/erreur.php'; $vues['accueil'] = 'vue/accueil.php'; $vues['quote'] = 'vue/quote.php'; +$vues['login'] = 'vue/login.html'; //Style css $style['accueil'] = 'public/styles/styleAccueil.css'; diff --git a/src/Controleur/FrontControler.php b/src/Controleur/FrontControler.php index e27e784..97156cb 100644 --- a/src/Controleur/FrontControler.php +++ b/src/Controleur/FrontControler.php @@ -30,6 +30,7 @@ Class FrontControler{ */ $router->map('GET|POST', '/quote/[i:idQuote]?', 'VisitorControler'); + $router->map('GET|POST', '/login', 'VisitorControler'); $match = $router->match(); $action = NULL; @@ -53,6 +54,12 @@ Class FrontControler{ $dVueEreur[] = "Action introuvable"; $this->vueErreur($dVueEreur); } + + if(!$this->verifDroit($action)){ + $action='login'; + $controller='VisitorControler'; + } + $controller = '\\Controleur\\' . $controller; $controller = new $controller; @@ -77,9 +84,9 @@ Class FrontControler{ } private function verifDroit(string $action):bool { - if( in_array($action , $listAction['admin']) && $role == 'admin') return true; - elseif( in_array($action , $listAction['user']) && ($role == 'admin' || $role == 'user') ) return true; - elseif(in_array($action , $listAction['visitor']) && ($role == 'admin'|| $role == 'user'|| $role == 'visitor')) return true; + if( in_array($action , $this->listAction['admin']) && $this->role == 'admin') return true; + elseif( in_array($action , $this->listAction['user']) && ($this->role == 'admin' || $this->role == 'user') ) return true; + elseif(in_array($action , $this->listAction['visitor']) && ($this->role == 'admin'|| $this->role == 'user'|| $this->role == 'visitor')) return true; return false; } diff --git a/src/Controleur/VisitorControler.php b/src/Controleur/VisitorControler.php index e9bdd55..0c60b74 100644 --- a/src/Controleur/VisitorControler.php +++ b/src/Controleur/VisitorControler.php @@ -16,4 +16,10 @@ Class VisitorControler{ require_once $vues['quote']; } + + public function login(){ + + global $vues; + require_once $vues['login']; + } } diff --git a/vue/quote.php b/vue/quote.php index c892127..f2269f8 100644 --- a/vue/quote.php +++ b/vue/quote.php @@ -1,13 +1,15 @@ false, ]); - // + + //global $twig; + echo $twig->render('head.html.twig', array( 'title' => "Quote", 'style' => "../public/styles/styleQuote.css",