1
0
mirror of https://gitlab.com/animath/si/plateforme.git synced 2025-06-30 15:21:17 +02:00

Ajout d'une classe pour les fichiers à télécharger, meilleur support des organisateurs d'un tournoi

This commit is contained in:
galaxyoyo
2019-09-07 18:43:51 +02:00
parent 8606ae7b95
commit 44e91a1f8b
5 changed files with 338 additions and 39 deletions

View File

@ -3,19 +3,12 @@
$tournament_name = htmlspecialchars($_GET["name"]);
$tournament = Tournament::fromName($tournament_name);
$orgas = $tournament->getOrganizers();
if ($tournament === null)
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 = [];
$orgas_id = [];
while (($orga_data = $orgas_req->fetch()) !== false) {
$orgas[] = User::fromId($orga_data["id"]);
$orgas_id[] = $orga_data["id"];
}
if (isset($_GET["modifier"]) && $_SESSION["role"] != Role::ADMIN && !in_array($_SESSION["user_id"], $orgas_id))
if (isset($_GET["modifier"]) && $_SESSION["role"] != Role::ADMIN && !$tournament->organize($_SESSION["user_id"]))
require_once "server_files/403.php";
if (isset($_POST["edit_tournament"])) {