1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-25 15:37:27 +02:00

Utilisation d'un dispatcher pour gérer les redirections

This commit is contained in:
galaxyoyo
2019-09-07 13:42:36 +02:00
parent ae648d7615
commit 4d3f6d1847
45 changed files with 246 additions and 190 deletions

View File

@ -1,14 +1,12 @@
<?php
require_once "../config.php";
if (!isset($_GET["file_id"])) {
header("Location: $URL_BASE");
exit();
}
if (!isset($_SESSION["user_id"]))
require_once "../403.php";
require_once "server_files/403.php";
$id = htmlspecialchars($_GET["file_id"]);
$type = "SOLUTION";
@ -34,7 +32,7 @@ if ($data !== false) {
$name = "Problème $problem $trigram.pdf";
if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) && (!isset($_SESSION["team"]) || $_SESSION["team"]->getId() != $team->getId()))
require_once "../403.php";
require_once "server_files/403.php";
// TODO Seuls les organisateurs concernés doivent pouvoir télécharger les fichiers
}
@ -49,7 +47,7 @@ if ($data !== false) {
$user = User::fromId($user_id);
if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) && $user_id != $_SESSION["user_id"])
require_once "../403.php";
require_once "server_files/403.php";
// TODO Seuls les organisateurs concernés doivent pouvoir télécharger les fichiers
@ -70,7 +68,7 @@ if ($data !== false) {
}
}
else {
require_once "../404.php";
require_once "server_files/404.php";
http_response_code(404);
exit();
}