diff --git a/server_files/classes/Team.php b/server_files/classes/Team.php index a3d54d4..a5e75f2 100644 --- a/server_files/classes/Team.php +++ b/server_files/classes/Team.php @@ -70,10 +70,10 @@ class Team return $team; } - public static function getAllTeams($problem) + public static function getAllTeams($problem, $only_validated = false) { global $DB, $YEAR; - $req = $DB->prepare("SELECT * FROM `teams` WHERE " . ($problem < 0 ? "" : "`problem` = ? AND ") . "`year` = $YEAR;"); + $req = $DB->prepare("SELECT * FROM `teams` WHERE " . ($problem < 0 ? "" : "`problem` = ? AND ") . ($only_validated ? "`validation_status` = 'VALIDATED' AND " : "") . "`year` = $YEAR;"); $req->execute([htmlspecialchars($problem)]); $teams = []; diff --git a/server_files/controllers/equipe.php b/server_files/controllers/equipe.php index b71b1f6..871c3a6 100644 --- a/server_files/controllers/equipe.php +++ b/server_files/controllers/equipe.php @@ -102,7 +102,7 @@ class UpdateVideoTeams } } -$other_teams = Team::getAllTeams($team->getProblem()); +$other_teams = Team::getAllTeams($team->getProblem(), true); $documents = Document::getAllDocuments($team->getProblem(), $team->getId()); require_once "server_files/views/equipe.php"; diff --git a/server_files/model.php b/server_files/model.php index 1f73cfd..bb8f2ff 100644 --- a/server_files/model.php +++ b/server_files/model.php @@ -155,7 +155,9 @@ function getZipFile($problem, $team_id = -1) foreach ($data as $file) { $file_id = $file->getFileId(); $user = User::fromId($file->getUserId()); - $name = "Autorisation de droit à l'image de " . $user->getFirstName() . " " . $user->getSurname() . ".pdf"; + $mime_type = finfo_file(finfo_open(FILEINFO_MIME_TYPE), "$LOCAL_PATH/files/$file_id"); + $ext = $mime_type == "application/pdf" ? "pdf" : ($mime_type == "image/png" ? "png" : "jpg"); + $name = "Autorisation de droit à l'image de " . $user->getFirstName() . " " . $user->getSurname() . "." . $ext; $zip->addFile("$LOCAL_PATH/files/$file_id", $name); }