Utilisation d'un dispatcher pour gérer les redirections
This commit is contained in:
parent
ae648d7615
commit
4d3f6d1847
29
.htaccess
29
.htaccess
|
@ -1,28 +1,7 @@
|
|||
ErrorDocument 403 /tfjm/403.php
|
||||
ErrorDocument 404 /tfjm/404.php
|
||||
ErrorDocument 403 /tfjm/server_files/403.php
|
||||
ErrorDocument 404 /tfjm/server_files/404.php
|
||||
|
||||
Options +FollowSymlinks
|
||||
# Options -Indexes
|
||||
Options -Indexes
|
||||
RewriteEngine On
|
||||
RewriteOptions Inherit
|
||||
RewriteBase /tfjm
|
||||
RewriteRule index.html accueil [L]
|
||||
RewriteRule ^accueil$ server_files/index.php [L]
|
||||
RewriteRule ^ajouter_equipe$ server_files/ajouter_equipe.php [L]
|
||||
RewriteRule ^ajouter_organisateur$ server_files/ajouter_organisateur.php [L]
|
||||
RewriteRule ^ajouter_tournoi$ server_files/ajouter_tournoi.php [L]
|
||||
RewriteRule ^confirmer_mail/(.*?)$ server_files/confirmer_mail.php?token=$1 [L]
|
||||
RewriteRule ^connexion$ server_files/connexion.php [L]
|
||||
RewriteRule ^deconnexion$ server_files/deconnexion.php [L]
|
||||
RewriteRule ^equipe/(.*?)$ server_files/equipe.php?trigram=$1 [L]
|
||||
RewriteRule ^file/(.*?)$ server_files/view_file.php?file_id=$1 [L]
|
||||
RewriteRule ^inscription$ server_files/inscription.php [L]
|
||||
RewriteRule ^mon_compte$ server_files/mon_compte.php [L]
|
||||
RewriteRule ^mon_equipe$ server_files/mon_equipe.php [L]
|
||||
RewriteRule ^rejoindre_equipe$ server_files/rejoindre_equipe.php [L]
|
||||
RewriteRule ^solutions$ server_files/solutions.php [L]
|
||||
RewriteRule ^solutions_orga$ server_files/solutions_orga.php [L]
|
||||
RewriteRule ^syntheses$ server_files/syntheses.php [L]
|
||||
RewriteRule ^syntheses_orga$ server_files/syntheses_orga.php [L]
|
||||
RewriteRule ^tournoi/(.*?)$ server_files/tournoi.php?nom=$1 [L]
|
||||
RewriteRule ^tournois$ server_files/tournois.php [L]
|
||||
RewriteRule ^(.*)$ dispatcher.php?path=$1 [QSA,L]
|
||||
|
|
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 7.1 KiB After Width: | Height: | Size: 7.1 KiB |
|
@ -0,0 +1,68 @@
|
|||
<?php
|
||||
|
||||
require_once "server_files/config.php";
|
||||
|
||||
require_once "server_files/model.php";
|
||||
require_once "server_files/classes/Role.php";
|
||||
require_once "server_files/classes/Team.php";
|
||||
require_once "server_files/classes/Tournament.php";
|
||||
require_once "server_files/classes/User.php";
|
||||
require_once "server_files/classes/ValidationStatus.php";
|
||||
|
||||
loadUserValues();
|
||||
|
||||
if (!isset($_GET["path"]))
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$path = $_GET["path"];
|
||||
|
||||
$ROUTES = [];
|
||||
|
||||
# URL paths
|
||||
|
||||
$ROUTES["^(|accueil|index|accueil\.php|accueil\.html|accueil\.py|index\.php|index\.html|index\.py)$"] = ["server_files/controllers/index.php"];
|
||||
$ROUTES["^ajouter_equipe$"] = ["server_files/controllers/ajouter_equipe.php"];
|
||||
$ROUTES["^ajouter_organisateur$"] = ["server_files/controllers/ajouter_organisateur.php"];
|
||||
$ROUTES["^ajouter_tournoi$"] = ["server_files/controllers/ajouter_tournoi.php"];
|
||||
$ROUTES["^confirmer_mail/([a-z0-9]*)/?$"] = ["server_files/controllers/confirmer_mail.php", "token"];
|
||||
$ROUTES["^connexion/?$"] = ["server_files/controllers/connexion.php"];
|
||||
$ROUTES["^deconnexion/?$"] = ["server_files/controllers/deconnexion.php"];
|
||||
$ROUTES["^equipe/([A-Z]{3})/?$"] = ["server_files/controllers/equipe.php", "trigram"];
|
||||
$ROUTES["^file/[a-z0-9]{64}/?$"] = ["server_files/controllers/view_file.php", "file_id"];
|
||||
$ROUTES["^informations/([0-9]*)/.*?$"] = ["server_files/controllers/informations.php", "id"];
|
||||
$ROUTES["^inscription/?$"] = ["server_files/controllers/inscription.php"];
|
||||
$ROUTES["^mon_compte/?$"] = ["server_files/controllers/mon_compte.php"];
|
||||
$ROUTES["^mon_equipe/(modifier)/?$"] = ["server_files/controllers/mon_equipe.php", "modifier"];
|
||||
$ROUTES["^mon_equipe/?$"] = ["server_files/controllers/mon_equipe.php"];
|
||||
$ROUTES["^rejoindre_equipe/?$"] = ["server_files/controllers/rejoindre_equipe.php"];
|
||||
$ROUTES["^solutions/?$"] = ["server_files/controllers/solutions.php"];
|
||||
$ROUTES["^solutions_orga/?$"] = ["server_files/controllers/solutions_orga.php"];
|
||||
$ROUTES["^syntheses/?$"] = ["server_files/controllers/syntheses.php"];
|
||||
$ROUTES["^syntheses_orga/?$"] = ["server_files/controllers/syntheses_orga.php"];
|
||||
$ROUTES["^tournoi/(.*)/?$"] = ["server_files/controllers/tournoi.php", "name"];
|
||||
$ROUTES["^tournois/?$"] = ["server_files/controllers/tournois.php"];
|
||||
|
||||
# Assets files
|
||||
|
||||
$ROUTES["^favicon\.ico$"] = ["assets/favicon.ico", "image/x-icon"];
|
||||
$ROUTES["^logo\.svg$"] = ["assets/logo.svg", "image/svg+xml"];
|
||||
$ROUTES["^style\.css$"] = ["assets/style.css", "text/css"];
|
||||
|
||||
foreach ($ROUTES as $route => $file) {
|
||||
if (preg_match('#' . $route . '#', $path, $matches)) {
|
||||
for ($i = 1; $i < sizeof($file); ++$i)
|
||||
$_GET[$file[$i]] = $matches[$i];
|
||||
|
||||
if (!preg_match("#php$#", $file[0])) {
|
||||
header("Content-Type: " . $matches[1]);
|
||||
readfile($file[0]);
|
||||
exit();
|
||||
}
|
||||
|
||||
/** @noinspection PhpIncludeInspection */
|
||||
require $file[0];
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
require_once "server_files/404.php";
|
13
index.html
13
index.html
|
@ -1 +1,12 @@
|
|||
Le mod Rewrite n'est pas activé.
|
||||
<!doctype html>
|
||||
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<title>Erreur</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
Le mode <i>Rewrite</i> n'est pas activé.
|
||||
</body>
|
||||
</html>
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
class Team
|
||||
{
|
||||
private $id;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
class Tournament
|
||||
{
|
||||
private $id;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
class User
|
||||
{
|
||||
private $id;
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (!isset($_SESSION["role"]) || ($_SESSION["role"] != Role::PARTICIPANT && $_SESSION["role"] != Role::ENCADRANT))
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$tournaments_response = $DB->query("SELECT `id`, `name` FROM `tournaments` WHERE `date_inscription` > CURRENT_DATE AND `year` = '$YEAR';");
|
||||
|
||||
|
@ -62,6 +60,4 @@ function registerTeam() {
|
|||
return false;
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/ajouter_equipe.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/ajouter_equipe.php";
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (!isset($_SESSION["role"]) || $_SESSION["role"] != Role::ADMIN)
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
|
||||
if (isset($_POST["submitted"])) {
|
||||
$error_message = addOrganizer();
|
||||
|
@ -59,6 +57,4 @@ function addOrganizer()
|
|||
return false;
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/ajouter_organisateur.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/ajouter_organisateur.php";
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (!isset($_SESSION["role"]) || $_SESSION["role"] != Role::ADMIN)
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$orgas_response = $DB->query("SELECT `id`, `surname`, `first_name` FROM `users` WHERE (`role` = 'ORGANIZER' OR `role` = 'ADMIN') AND `year` = '$YEAR';");
|
||||
|
||||
|
@ -109,6 +107,4 @@ function registerTournament() {
|
|||
return false;
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/ajouter_tournoi.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/ajouter_tournoi.php";
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
$token = $_GET["token"];
|
||||
|
||||
if (isset($token)) {
|
||||
|
@ -16,6 +14,6 @@ if (isset($token)) {
|
|||
else {
|
||||
$error_message = "Il n'y a pas de compte à valider !";
|
||||
}
|
||||
require_once "../views/header.php";
|
||||
require_once "server_files/views/header.php";
|
||||
echo "<h2>$error_message</h2>";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/footer.php";
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (isset($_POST["submitted"]) && !isset($_SESSION["user_id"])) {
|
||||
$error_message = login();
|
||||
}
|
||||
|
@ -132,6 +130,4 @@ function sendConfirmEmail() {
|
|||
return false;
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/connexion.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/connexion.php";
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
unset($_SESSION["user_id"]);
|
||||
session_destroy();
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "server_files/views/header.php";
|
||||
echo "<h2>Déconnexion réussie !</h2>";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/footer.php";
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (!isset($_SESSION["user_id"]) || $_SESSION["role"] != Role::ORGANIZER && $_SESSION["role"] != Role::ADMIN)
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$trigram = htmlspecialchars($_GET["trigram"]);
|
||||
|
||||
$team = Team::fromTrigram($trigram);
|
||||
|
||||
if ($team === null)
|
||||
require_once "../404.php";
|
||||
require_once "server_files/404.php";
|
||||
|
||||
if (isset($_POST["validate"])) {
|
||||
$team->setValidationStatus(ValidationStatus::VALIDATED);
|
||||
|
@ -73,6 +71,4 @@ if ($team->isSelectedForFinal()) {
|
|||
|
||||
$tournament = Tournament::fromId($team->getTournamentId());
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/equipe.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/equipe.php";
|
||||
|
|
|
@ -1,6 +1,3 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/index.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/index.php";
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (!isset($_SESSION["role"]))
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
|
||||
$id = $_GET["id"];
|
||||
$user = User::fromId($id);
|
||||
|
||||
if ($_SESSION["role"] != Role::ORGANIZER && $_SESSION["role"] != Role::ADMIN) {
|
||||
if ($user->getId() != $_SESSION["user_id"] && ($user->getTeamId() == null || $user->getTeamId() != $_SESSION["user"]->getTeamId()))
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
}
|
||||
|
||||
if ($user === null) {
|
||||
require_once "../404.php";
|
||||
require_once "server_files/404.php";
|
||||
}
|
||||
|
||||
$team = Team::fromId($user->getTeamId());
|
||||
|
@ -22,6 +20,4 @@ $team = Team::fromId($user->getTeamId());
|
|||
$documents_req = $DB->query("SELECT * FROM `documents` WHERE `user` = $id;");
|
||||
$tournaments_req = $DB->query("SELECT `tournament`, `name` FROM `organizers` JOIN `tournaments` ON `tournaments`.`id` = `tournament` WHERE `organizer` = $id ORDER BY `date_start`, `name`;");
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/informations.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/informations.php";
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (isset($_POST["submitted"])) {
|
||||
$error_message = register();
|
||||
}
|
||||
|
@ -128,6 +126,4 @@ function register() {
|
|||
return false;
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/inscription.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/inscription.php";
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (isset($_POST["submitted"])) {
|
||||
$error_message = updateAccount();
|
||||
} elseif (isset($_POST["submitted_password"])) {
|
||||
|
@ -9,7 +7,7 @@ if (isset($_POST["submitted"])) {
|
|||
}
|
||||
|
||||
if (!isset($_SESSION["user_id"]))
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
|
||||
/** @var User $user */
|
||||
$user = $_SESSION["user"];
|
||||
|
@ -126,6 +124,4 @@ function updatePassword()
|
|||
return false;
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/mon_compte.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/mon_compte.php";
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (isset($_POST["leave_team"])) {
|
||||
quitTeam();
|
||||
exit();
|
||||
|
@ -30,7 +28,7 @@ if (isset($_SESSION["user_id"]) && isset($_SESSION["team"]) && $_SESSION["team"]
|
|||
$documents_req->execute([$_SESSION["user_id"], $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $tournament->getId()]]);
|
||||
}
|
||||
else
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
|
||||
if (isset($_POST["team_edit"])) {
|
||||
$error_message = updateTeam();
|
||||
|
@ -158,6 +156,4 @@ function checkCanValidate()
|
|||
return $can_validate;
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/mon_equipe.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/mon_equipe.php";
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (isset($_SESSION["team"]) || !isset($_SESSION["user"]) || ($_SESSION["role"] != Role::PARTICIPANT && $_SESSION["role"] != Role::ENCADRANT))
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
|
||||
if (isset($_POST["submitted"])) {
|
||||
$error_message = joinTeam();
|
||||
|
@ -52,6 +50,4 @@ function joinTeam() {
|
|||
return false;
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/rejoindre_equipe.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/rejoindre_equipe.php";
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (!isset($_SESSION["team_id"]))
|
||||
require_once "../403.php";
|
||||
if (!isset($_SESSION["team"]))
|
||||
require_once "server_files/403.php";
|
||||
|
||||
if (isset($_POST["send_solution"])) {
|
||||
$error_message = saveSolution();
|
||||
}
|
||||
|
||||
$solutions_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
|
||||
$solutions_req->execute([$_SESSION["team_id"], $_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
|
||||
/** @var Team $team */
|
||||
$team = $_SESSION["team"];
|
||||
|
||||
$tournament_req = $DB->prepare("SELECT `date_solutions` FROM `tournaments` WHERE `id` = ?;");
|
||||
$tournament_req->execute([$_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
|
||||
$tournament_data = $tournament_req->fetch();
|
||||
$solutions_req = $DB->prepare("SELECT `file_id`, `problem`, COUNT(`problem`) AS `version` FROM `solutions` WHERE `team` = ? AND `tournament` = ? GROUP BY `problem`, `uploaded_at` ORDER BY `problem`, `uploaded_at` DESC;");
|
||||
$solutions_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId()]]);
|
||||
|
||||
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId());
|
||||
|
||||
function saveSolution() {
|
||||
global $LOCAL_PATH, $DB;
|
||||
|
@ -58,6 +57,4 @@ function saveSolution() {
|
|||
return false;
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/solutions.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/solutions.php";
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (!isset($_SESSION["role"]) || $_SESSION["role"] != Role::ADMIN && $_SESSION["role"] != Role::ORGANIZER)
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
|
||||
/** @noinspection SqlAggregates */
|
||||
$req = $DB->query("SELECT `tournaments`.`id`, `name` FROM `tournaments` JOIN `organizers` ON `tournament` = `tournaments`.`id` WHERE "
|
||||
|
@ -47,7 +45,7 @@ if (isset($_POST["download_zip"])) {
|
|||
exit();
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "server_files/views/header.php";
|
||||
|
||||
while (($data_tournament = $req->fetch()) !== false) {
|
||||
echo "<h1>Tournoi de " . $data_tournament["name"] . "</h1>\n";
|
||||
|
@ -72,4 +70,4 @@ while (($data_tournament = $req->fetch()) !== false) {
|
|||
echo "</form><hr />\n";
|
||||
}
|
||||
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/footer.php";
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
if (!isset($_SESSION["team_id"]))
|
||||
require_once "../403.php";
|
||||
if (!isset($_SESSION["team"]))
|
||||
require_once "server_files/403.php";
|
||||
|
||||
if (isset($_POST["send_synthese"])) {
|
||||
$error_message = saveSynthese();
|
||||
}
|
||||
|
||||
$syntheses_req = $DB->prepare("SELECT `file_id`, `dest`, COUNT(`dest`) AS `version` FROM `syntheses` WHERE `team` = ? AND `tournament` = ? GROUP BY `dest`, `uploaded_at` ORDER BY `dest`, `uploaded_at` DESC;");
|
||||
$syntheses_req->execute([$_SESSION["team_id"], $_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
|
||||
/** @var Team $team */
|
||||
$team = $_SESSION["team"];
|
||||
|
||||
$tournament_req = $DB->prepare("SELECT `date_solutions`, `date_syntheses` FROM `tournaments` WHERE `id` = ?;");
|
||||
$tournament_req->execute([$_SESSION[isset($_SESSION["final_id"]) ? "final_id" : "tournament_id"]]);
|
||||
$tournament_data = $tournament_req->fetch();
|
||||
$syntheses_req = $DB->prepare("SELECT `file_id`, `dest`, COUNT(`dest`) AS `version` FROM `syntheses` WHERE `team` = ? AND `tournament` = ? GROUP BY `dest`, `uploaded_at` ORDER BY `dest`, `uploaded_at` DESC;");
|
||||
$syntheses_req->execute([$team->getId(), $_SESSION[$team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId()]]);
|
||||
|
||||
$tournament = Tournament::fromId($team->isSelectedForFinal() ? $_SESSION["final"]->getId() : $team->getTournamentId());
|
||||
|
||||
function saveSynthese() {
|
||||
global $LOCAL_PATH, $DB;
|
||||
|
@ -54,6 +53,4 @@ function saveSynthese() {
|
|||
return false;
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/syntheses.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/syntheses.php";
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
<?php require_once "../config.php";
|
||||
|
||||
if (!isset($_SESSION["role"]) || $_SESSION["role"] != Role::ADMIN && $_SESSION["role"] != Role::ORGANIZER)
|
||||
require_once "../403.php";
|
||||
<?php if (!isset($_SESSION["role"]) || $_SESSION["role"] != Role::ADMIN && $_SESSION["role"] != Role::ORGANIZER)
|
||||
require_once "server_files/403.php";
|
||||
|
||||
if (isset($_POST["download_zip"])) {
|
||||
$id = $_POST["tournament"];
|
||||
|
@ -40,7 +38,7 @@ if (isset($_POST["download_zip"])) {
|
|||
exit();
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "server_files/views/header.php";
|
||||
|
||||
$req = $DB->query("SELECT `tournaments`.`id`, `name` FROM `tournaments` JOIN `organizers` ON `tournament` = `tournaments`.`id` WHERE "
|
||||
. ($_SESSION["role"] == Role::ADMIN ? "" : "`organizer` = '" . $_SESSION["user_id"] . "' AND ")
|
||||
|
@ -69,4 +67,4 @@ while (($data_tournament = $req->fetch()) !== false) {
|
|||
echo "</form><hr />\n";
|
||||
}
|
||||
|
||||
require_once '../views/footer.php';
|
||||
require_once "server_files/views/footer.php";
|
||||
|
|
|
@ -1,13 +1,11 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
$tournament_name = htmlspecialchars($_GET["nom"]);
|
||||
$tournament_name = htmlspecialchars($_GET["name"]);
|
||||
|
||||
$tournament = Tournament::fromName($tournament_name);
|
||||
|
||||
if ($tournament === null)
|
||||
require_once "../404.php";
|
||||
require_once "server_files/404.php";
|
||||
|
||||
$orgas_req = $DB->query("SELECT `users`.`id` AS `id` FROM `users` JOIN `organizers` ON `users`.`id` = `organizer` WHERE `tournament` = " . $tournament->getId() . ";");
|
||||
$orgas = [];
|
||||
|
@ -18,7 +16,7 @@ while (($orga_data = $orgas_req->fetch()) !== false) {
|
|||
}
|
||||
|
||||
if (isset($_GET["modifier"]) && $_SESSION["role"] != Role::ADMIN && !in_array($_SESSION["user_id"], $orgas_id))
|
||||
require_once "../403.php";
|
||||
require_once "server_files/403.php";
|
||||
|
||||
if (isset($_POST["edit_tournament"])) {
|
||||
$error_message = updateTournament();
|
||||
|
@ -123,6 +121,4 @@ function updateTournament() {
|
|||
exit();
|
||||
}
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/tournoi.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/tournoi.php";
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
<?php
|
||||
|
||||
require_once "../config.php";
|
||||
|
||||
$response = $DB->query("SELECT `name`, `date_start`, `date_end`, `date_inscription`, `date_solutions`, `size` FROM `tournaments`
|
||||
WHERE `year` = '$YEAR' AND `final` = false ORDER BY `date_start`, `name`;");
|
||||
$final_data = $DB->query("SELECT `name`, `date_start`, `date_end`, `date_solutions`, `size` FROM `tournaments` WHERE `final` AND `year` = $YEAR;")->fetch();
|
||||
|
||||
require_once "../views/header.php";
|
||||
require_once "../views/tournois.php";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/tournois.php";
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php if ($_SESSION["team"] != NULL) { ?>
|
||||
<?php
|
||||
require_once "header.php";
|
||||
|
||||
if ($_SESSION["team"] != NULL) { ?>
|
||||
<h2>Vous êtes déjà dans une équipe.</h2>
|
||||
<?php } else if (isset($access_code)) { ?>
|
||||
Votre équipe a bien été créée ! Voici le code d'accès à transmettre aux autres membres de votre équipe : <strong><?= $access_code ?></strong>
|
||||
|
@ -48,4 +51,6 @@
|
|||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
<?php
|
||||
require_once "header.php";
|
||||
|
||||
if (isset($error_message)) {
|
||||
if ($error_message !== false) {
|
||||
echo "<h2>Erreur : " . $error_message . "</h2>";
|
||||
|
@ -51,3 +53,5 @@ if (isset($error_message)) {
|
|||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
<?php if (isset($error_message)) {
|
||||
<?php
|
||||
require_once "header.php";
|
||||
|
||||
if (isset($error_message)) {
|
||||
if ($error_message !== false) {
|
||||
echo "<h2>Erreur : " . $error_message . "</h2>";
|
||||
} else {
|
||||
|
@ -118,4 +121,6 @@
|
|||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
|
@ -1,6 +1,9 @@
|
|||
<?php if (isset($error_message) && $error_message) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>
|
||||
|
||||
<?php
|
||||
require_once "header.php";
|
||||
|
||||
if (isset($error_message) && $error_message)
|
||||
echo "<h2>Erreur : " . $error_message . "</h2>";
|
||||
|
||||
if (isset($error_message) && $error_message === FALSE) {
|
||||
if (isset($_GET["mdp_oublie"]))
|
||||
echo "Le mail de récupération de mot de passe a bien été envoyé.";
|
||||
|
@ -89,4 +92,6 @@ else if (isset($_SESSION["user_id"])) { ?>
|
|||
</table>
|
||||
</form>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
|
@ -1,3 +1,5 @@
|
|||
<?php require_once "header.php" ?>
|
||||
|
||||
<h2>Informations sur l'équipe</h2>
|
||||
|
||||
Nom de l'équipe : <?= $team->getName() ?><br />
|
||||
|
@ -90,4 +92,6 @@ if (!$team->isSelectedForFinal() && isset($_SESSION["user_id"]) && $_SESSION["ro
|
|||
<form method="POST">
|
||||
<input style="width: 100%;" type="submit" name="select" value="Sélectionner pour la finale nationale" />
|
||||
</form>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<body>
|
||||
<ul id="menu">
|
||||
<li id="menu-logo"><img src="<?= $URL_BASE ?>/logo.svg" alt="logo tfjm"></li>
|
||||
<li id="menu-logo"><img src="<?= $URL_BASE ?>/logo.svg" alt="Logo TFJM²"></li>
|
||||
<li><a href="<?= $URL_BASE ?>/">Accueil</a></li>
|
||||
<li><a href="<?= $URL_BASE ?>/tournois">Liste des tournois</a></li>
|
||||
<?php if (!isset($_SESSION["user_id"])) { ?>
|
||||
|
@ -55,16 +55,16 @@
|
|||
<hr />
|
||||
<?php
|
||||
if ($_SESSION["role"] != Role::ADMIN) {
|
||||
echo "<li><a href=\"?be-admin=1\">Devenir administrateur</a></li>";
|
||||
echo "<li><a href=\"?be-admin=1\">Devenir administrateur</a></li>\n";
|
||||
}
|
||||
if ($_SESSION["role"] != Role::ORGANIZER) {
|
||||
echo "<li><a href=\"?be-organizer=1\">Devenir organisateur</a></li>";
|
||||
echo "<li><a href=\"?be-organizer=1\">Devenir organisateur</a></li>\n";
|
||||
}
|
||||
if ($_SESSION["role"] != Role::PARTICIPANT) {
|
||||
echo "<li><a href=\"?be-participant=1\">Devenir participant</a></li>";
|
||||
echo "<li><a href=\"?be-participant=1\">Devenir participant</a></li>\n";
|
||||
}
|
||||
if ($_SESSION["role"] != Role::ENCADRANT) {
|
||||
echo "<li><a href=\"?be-encadrant=1\">Devenir encadrant</a></li>";
|
||||
echo "<li><a href=\"?be-encadrant=1\">Devenir encadrant</a></li>\n";
|
||||
}
|
||||
?>
|
||||
<?php } ?>
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
<?php require_once "header.php" ?>
|
||||
|
||||
<div class="container-fluid">
|
||||
|
||||
|
||||
|
@ -101,4 +103,6 @@
|
|||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
|
@ -1,3 +1,5 @@
|
|||
<?php require_once "header.php" ?>
|
||||
|
||||
<h1><?= $user->getFirstName() . " " . $user->getSurname() ?></h1>
|
||||
|
||||
<?php if ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCADRANT) { ?>
|
||||
|
@ -64,4 +66,6 @@ elseif ($user->getRole() == Role::PARTICIPANT || $user->getRole() == Role::ENCAD
|
|||
}
|
||||
echo "$name de $first_name $surname : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require_once "footer.php";
|
|
@ -1,4 +1,9 @@
|
|||
<?php if (isset($error_message) && $error_message) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>
|
||||
<?php
|
||||
require_once "header.php";
|
||||
|
||||
if (isset($error_message) && $error_message)
|
||||
echo "<h2>Erreur : " . $error_message . "</h2>";
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (isset($error_message) && $error_message === FALSE) {
|
||||
|
@ -140,4 +145,6 @@ if (isset($error_message) && $error_message === FALSE) {
|
|||
selectRole();
|
||||
</script>
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
|
@ -1,4 +1,9 @@
|
|||
<?php if (isset($error_message) && $error_message) echo "<h2>Erreur : " . $error_message . "</h2>"; ?>
|
||||
<?php
|
||||
require_once "header.php";
|
||||
|
||||
if (isset($error_message) && $error_message)
|
||||
echo "<h2>Erreur : " . $error_message . "</h2>";
|
||||
?>
|
||||
|
||||
<?php
|
||||
if (isset($error_message) && $error_message === FALSE) {
|
||||
|
@ -170,4 +175,6 @@ if (isset($error_message) && $error_message === FALSE) {
|
|||
<td colspan="2"><input type="submit" style="width: 100%" value="Mettre à jour mon mot de passe"/></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</form>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
|
@ -1,10 +1,14 @@
|
|||
<?php if (isset($error_message)) {
|
||||
<?php
|
||||
require_once "header.php";
|
||||
|
||||
if (isset($error_message)) {
|
||||
if ($error_message !== false) {
|
||||
echo "<h2>Erreur : " . $error_message . "</h2>";
|
||||
} else {
|
||||
echo "<h2>Le fichier a été correctement envoyé !</h2>";
|
||||
}
|
||||
} ?>
|
||||
}
|
||||
?>
|
||||
|
||||
<h2>Informations sur l'équipe</h2>
|
||||
|
||||
|
@ -164,3 +168,5 @@ Code d'accès : <strong><?= $team->getAccessCode() ?></strong><br/>
|
|||
</table>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
|
@ -1,4 +1,7 @@
|
|||
<?php if (isset($error_message) && $error_message === false) { ?>
|
||||
<?php
|
||||
require_once "header.php" ;
|
||||
|
||||
if (isset($error_message) && $error_message === false) { ?>
|
||||
Vous avez bien rejoint l'équipe <?= $_SESSION["team"]->getName() ?> !
|
||||
<?php } else { ?>
|
||||
|
||||
|
@ -25,4 +28,6 @@
|
|||
</table>
|
||||
</form>
|
||||
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
|
@ -1,4 +1,7 @@
|
|||
<?php if (isset($error_message)) {
|
||||
<?php
|
||||
require_once "header.php";
|
||||
|
||||
if (isset($error_message)) {
|
||||
if ($error_message !== false) {
|
||||
echo "<h2>Erreur : " . $error_message . "</h2>";
|
||||
} else {
|
||||
|
@ -6,7 +9,7 @@
|
|||
}
|
||||
}?>
|
||||
|
||||
<?php if (date("yyyy-mm-dd") < $tournament_data["date_solutions"]) { ?>
|
||||
<?php if (date("yyyy-mm-dd") < $tournament->getSolutionsDate()) { ?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
|
||||
<table style="width: 100%;">
|
||||
|
@ -54,5 +57,6 @@ while (($data = $solutions_req->fetch()) !== false) {
|
|||
$version = $data["version"];
|
||||
echo "Problème $problem (Version $version) : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
require_once "footer.php";
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
<?php
|
||||
if (date("yyyy-mm-dd") < $tournament_data["date_solutions"]) {
|
||||
require_once "header.php";
|
||||
|
||||
if (date("yyyy-mm-dd") < $tournament->getSolutionsDate()) {
|
||||
echo "<h3>Il est trop tôt pour se préoccuper des notes de synthèse, attendez le tirage des poules.</h3>";
|
||||
require_once "../views/footer.php";
|
||||
require_once "server_files/views/footer.php";
|
||||
}
|
||||
|
||||
if (isset($error_message)) {
|
||||
|
@ -13,7 +15,7 @@ if (isset($error_message)) {
|
|||
}
|
||||
}?>
|
||||
|
||||
<?php if (date("yyyy-mm-dd") < $tournament_data["date_syntheses"]) { ?>
|
||||
<?php if (date("yyyy-mm-dd") < $tournament->getSynthesesDate()) { ?>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="5000000" />
|
||||
<table style="width: 100%;">
|
||||
|
@ -58,4 +60,5 @@ while (($data = $syntheses_req->fetch()) !== false) {
|
|||
$version = $data["version"];
|
||||
echo "Note de synthèse pour " . ($dest == "OPPOSANT" ? "l'opposant" : "le rapporteur") . " (Version $version) : <a href=\"$URL_BASE/file/$file_id\">Télécharger</a><br />";
|
||||
}
|
||||
?>
|
||||
|
||||
require_once "footer.php";
|
|
@ -1,3 +1,5 @@
|
|||
<?php require_once "header.php" ?>
|
||||
|
||||
<h2>Tournoi de <?= $tournament->getName() ?></h2>
|
||||
|
||||
<strong>Organisateur<?= sizeof($orgas) >= 2 ? 's' : '' ?> :</strong>
|
||||
|
@ -224,3 +226,5 @@ else {
|
|||
</form>
|
||||
<?php } ?>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
<?php require_once "header.php" ?>
|
||||
|
||||
<h2>Liste des tournois</h2>
|
||||
|
||||
<table style="border: 1px solid black; width: 100%">
|
||||
|
@ -41,4 +43,6 @@
|
|||
<th style="border: 1px solid black; text-align: center">Places disponibles</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
<?php require_once "footer.php" ?>
|
||||
|
|
Loading…
Reference in New Issue