|
|
@ -56,73 +56,80 @@ class FrontControleur
|
|
|
|
|
|
|
|
|
|
|
|
$id = array();
|
|
|
|
$id = array();
|
|
|
|
|
|
|
|
|
|
|
|
$twig->render("accueil.html",[]);
|
|
|
|
try{
|
|
|
|
|
|
|
|
$twig->render("accueil.html",[]);
|
|
|
|
|
|
|
|
|
|
|
|
if (!$match) {
|
|
|
|
if (!$match) {
|
|
|
|
|
|
|
|
|
|
|
|
$dVueErreur[] = "Error 404 Page not found";
|
|
|
|
$dVueErreur[] = "Error 404 Page not found";
|
|
|
|
echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]);
|
|
|
|
echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if ($match) {
|
|
|
|
if ($match) {
|
|
|
|
|
|
|
|
|
|
|
|
$controller = $match['target'] ?? NULL;
|
|
|
|
$controller = $match['target'] ?? NULL;
|
|
|
|
$action = $match['params']['action'] ?? NULL;
|
|
|
|
$action = $match['params']['action'] ?? NULL;
|
|
|
|
$id = $match['params']['id'] ?? NULL;
|
|
|
|
$id = $match['params']['id'] ?? NULL;
|
|
|
|
|
|
|
|
|
|
|
|
$namespace = 'App\\controleur\\';
|
|
|
|
$namespace = 'App\\controleur\\';
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
if ($controller == "MembreControleur") {
|
|
|
|
if ($controller == "MembreControleur") {
|
|
|
|
if ($_SESSION["role"] != "Membre" && $_SESSION["role"] != "Admin") {
|
|
|
|
if ($_SESSION["role"] != "Membre" && $_SESSION["role"] != "Admin") {
|
|
|
|
|
|
|
|
|
|
|
|
echo $twig->render("connection.html",['msg' => 'Vous devez vous connecter pour effectuer cette action']);
|
|
|
|
echo $twig->render("connection.html", ['msg' => 'Vous devez vous connecter pour effectuer cette action']);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
else{
|
|
|
|
$controller = "MembreControleur";
|
|
|
|
$controller = "MembreControleur";
|
|
|
|
$controller = $namespace . $controller;
|
|
|
|
$controller = $namespace . $controller;
|
|
|
|
//echo "controller : ".$controller;
|
|
|
|
//echo "controller : ".$controller;
|
|
|
|
$controller = new $controller();
|
|
|
|
$controller = new $controller();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ($controller == "AdminControleur") {
|
|
|
|
|
|
|
|
if ($_SESSION["role"] != "Admin") {
|
|
|
|
|
|
|
|
$dVueErreur = ["Erreur : Vous n'avez pas les privileges pour cette action"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
global $twig;
|
|
|
|
if ($controller == "AdminControleur") {
|
|
|
|
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
|
|
|
|
if ($_SESSION["role"] != "Admin") {
|
|
|
|
return;
|
|
|
|
$dVueErreur = ["Erreur : Vous n'avez pas les privileges pour cette action"];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
global $twig;
|
|
|
|
|
|
|
|
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
$controller = "AdminControleur";
|
|
|
|
|
|
|
|
$controller = $namespace . $controller;
|
|
|
|
|
|
|
|
$controller = new $controller();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else{
|
|
|
|
|
|
|
|
$controller = "AdminControleur";
|
|
|
|
if ($controller == "UtilisateurControleur") {
|
|
|
|
$controller = $namespace . $controller;
|
|
|
|
$controller = $namespace . $controller;
|
|
|
|
$controller = new $controller();
|
|
|
|
$controller = new $controller();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if($controller == "UtilisateurControleur")
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$controller = $namespace . $controller;
|
|
|
|
|
|
|
|
$controller = new $controller();
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (is_callable(array($controller, $action))) {
|
|
|
|
if (is_callable(array($controller, $action))) {
|
|
|
|
|
|
|
|
|
|
|
|
call_user_func(array($controller, $action), $match['params']);
|
|
|
|
call_user_func(array($controller, $action), $match['params']);
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo $twig->render('accueil.html');
|
|
|
|
echo $twig->render('accueil.html');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} catch (Error $error) {
|
|
|
|
} catch (Error $error) {
|
|
|
|
$dVueErreur = ['Erreur : Action inconnue'];
|
|
|
|
$dVueErreur = ['Erreur : Action inconnue'];
|
|
|
|
|
|
|
|
|
|
|
|
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
|
|
|
|
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
catch(Error $e)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
$dVueErreur = ['Erreur : Action inconnue'];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|