routeur londres

pull/21/head
brongniart 7 months ago
parent c1b4508828
commit 1688bc60d1

@ -12,7 +12,7 @@ require_once __DIR__ . '/config/config.php';
require __DIR__ . '/vendor/autoload.php';
$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', 'Chocolat-77');
$co = new \Gateway\Connection('pgsql:host=localhost;dbname=dbkekentin;', 'kekentin', '');
//twig
$loader = new \Twig\Loader\FilesystemLoader('vue/templates');
@ -21,7 +21,7 @@ $twig = new \Twig\Environment($loader, [
]);
$cont = new Controleur\FrontControler(/*$co*/);
$cont = new Controleur\FrontControler($co);
session_unset();
session_destroy();

@ -11,12 +11,12 @@ document.addEventListener("DOMContentLoaded", function() {
if (currentTheme === 'light') {
document.body.classList.remove('dark-mode');
document.body.classList.add('light-mode');
themeIcon.src = '../images/light.svg'; // Affiche l'icône pour basculer vers le mode sombre
favicon.href = '../images/iconeClaire.ico'; // Favicon pour le mode clair
themeIcon.src = 'images/light.svg'; // Affiche l'icône pour basculer vers le mode sombre
favicon.href = 'images/iconeClaire.ico'; // Favicon pour le mode clair
} else {
document.body.classList.add('dark-mode');
themeIcon.src = '../images/dark.svg'; // Affiche l'icône pour basculer vers le mode clair
favicon.href = '../images/iconeSombre.ico'; // Favicon pour le mode sombre
themeIcon.src = 'images/dark.svg'; // Affiche l'icône pour basculer vers le mode clair
favicon.href = 'images/iconeSombre.ico'; // Favicon pour le mode sombre
}
} else {
console.error("Élément(s) manquant(s) : icône du thème ou favicon.");
@ -34,15 +34,15 @@ function toggleTheme() {
// Si on est en mode sombre, on passe en mode clair
body.classList.remove('dark-mode');
body.classList.add('light-mode');
themeIcon.src = '../images/light.svg'; // Change vers le logo sombre
favicon.href = '../images/iconeClaire.ico'; // Favicon pour le mode clair
themeIcon.src = 'images/light.svg'; // Change vers le logo sombre
favicon.href = 'images/iconeClaire.ico'; // Favicon pour le mode clair
localStorage.setItem('theme', 'light'); // Enregistre le thème clair dans localStorage
} else {
// Sinon, on repasse en mode sombre
body.classList.remove('light-mode');
body.classList.add('dark-mode');
themeIcon.src = '../images/dark.svg'; // Change vers le logo clair
favicon.href = '../images/iconeSombre.ico'; // Favicon pour le mode sombre
themeIcon.src = 'images/dark.svg'; // Change vers le logo clair
favicon.href = 'images/iconeSombre.ico'; // Favicon pour le mode sombre
localStorage.setItem('theme', 'dark'); // Enregistre le thème sombre dans localStorage
}
} else {

@ -7,11 +7,11 @@ Class FrontControler{
private $listAction;
private string $role = 'admin' //Mettre en admin le temps de créer les comptes
private string $role = 'admin'; //Mettre en admin le temps de créer les comptes
private Connection $co;
public function __construct(/*$co*/){
public function __construct($co){
global $twig;
@ -23,8 +23,10 @@ Class FrontControler{
$dVueEreur = [];
$router = new \AltoRouter();
$router->setBasePath('/~kekentin/WF/WF-Website');
$router->map('GET', '/', 'VisitorControler');
$router->map('GET', '/', 'VisitorControler','accueil');
/*
'i' => '[0-9]++'
@ -35,13 +37,11 @@ Class FrontControler{
'' => '[^/\.]++'
*/
$router->map('GET|POST', '/quote/[i:idQuote]?', 'VisitorControler');
$router->map('GET|POST', '/login', 'VisitorControler');
$router->map('GET|POST', '/signin', 'VisitorControler');
$router->map('GET|POST', '/quiz', 'UserControler');
$router->map('GET|POST', '/quote/[i:idQuote]?', 'VisitorControler','quote');
$router->map('GET|POST', '/login', 'VisitorControler','login');
$router->map('GET|POST', '/signin', 'VisitorControler','signin');
$router->map('GET|POST', '/quiz/[i:id]?', 'QuizControler');
$router->map('GET|POST', '/quiz/[i:id]?', 'QuizControler','quiz');
$match = $router->match();
@ -54,30 +54,26 @@ Class FrontControler{
else{
$controller=$match['target'] ?? null;
$action = explode('/',$_SERVER['PHP_SELF']);
if(count($action)>2){
$action=$action[2];
}
else{
$action='accueil';
}
$action = $match['name'];
//Si existe, on lappelle
if(!$this->ifExisteAction($action)){
$dVueEreur[] = "Action introuvable";
$this->vueErreur($dVueEreur);
}
if(!$this->verifDroit($action)){
else if(!$this->verifDroit($action)){
$action='login';
$controller='VisitorControler';
}
$controller = '\\Controleur\\' . $controller;
$controller = new $controller;
if (is_callable(array($controller, $action))) {
call_user_func_array(array($controller, $action),
array($match['params']));
else {
$controller = '\\Controleur\\' . $controller;
$controller = new $controller;
if (is_callable(array($controller, $action))) {
call_user_func_array(array($controller, $action),
array($match['params']));
}
}
}

@ -1,7 +1,7 @@
<?php
namespace Gateway;
#use PDO;
use PDO;
class Connection extends \PDO {

@ -11,7 +11,7 @@
echo $twig->render('head.html.twig', array(
'title' => "Accueil",
'style' => "../../public/styles/styleAccueil.css",
'style' => "public/styles/styleAccueil.css",
));
echo $twig->render('bandeau.html.twig');

@ -1,14 +1,14 @@
<div class="header">
<div class="nav">
<a href="favorite.html"><img src="../images/coeur.svg" alt="coeur" width="67px" height="67px" onmousedown="return false"></a>
<img id="theme-icon" src="../images/light.svg" alt="toggle theme" width="72px" height="37px" onmousedown="return false" onclick="toggleTheme()">
<a href="/quiz"><img src="../images/quizz.svg" alt="quizz" width="51px" height="82px" onmousedown="return false"></a>
<a href="favorite.html"><img src="images/coeur.svg" alt="coeur" width="67px" height="67px" onmousedown="return false"></a>
<img id="theme-icon" src="images/dark.svg" alt="toggle theme" width="72px" height="37px" onmousedown="return false" onclick="toggleTheme()">
<a href="/quiz"><img src="images/quizz.svg" alt="quizz" width="51px" height="82px" onmousedown="return false"></a>
</div>
<div class="logo">
<a href="/"><img src="../images/WIKIFANTASY.png" alt="Logo" width="227px" height="106px" onmousedown="return false"></a>
<a href="/"><img src="images/WIKIFANTASY.png" alt="Logo" width="227px" height="106px" onmousedown="return false"></a>
</div>
<div class="user">
<a href="/login"><img src="../images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false"></a>
<a href="/login"><img src="images/user_dark.png" alt="user" width="70px" height="70px" onmousedown="return false"></a>
</div>
</div>

@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title>
<link rel="stylesheet" href="{{ style }}">
<link id="favicon" rel="icon" href="../../public/images/iconeSombre.ico" />
<script src="../public/script/theme-toggle.js"></script>
<link id="favicon" rel="icon" href="public/images/iconeSombre.ico" />
<script src="public/script/theme-toggle.js"></script>
</head>
Loading…
Cancel
Save