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/controllers/mon_compte.php b/server_files/controllers/mon_compte.php index 6bc8462..dc944e4 100644 --- a/server_files/controllers/mon_compte.php +++ b/server_files/controllers/mon_compte.php @@ -150,8 +150,9 @@ class SendDocument ensure($this->file["size"] <= 2e6, "Le fichier doit peser moins que 2 Mo."); ensure(!$this->file["error"], "Une erreur est survenue."); - ensure(finfo_file(finfo_open(FILEINFO_MIME_TYPE), $this->file["tmp_name"]) == "application/pdf", "Le fichier doit être au format PDF."); - ensure(is_dir("$LOCAL_PATH/files") || mkdir("$LOCAL_PATH/files"), "Un problème est survenue dans l'envoi du fichier. Veuillez contacter l'administrateur du serveur."); + $mime_type = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $this->file["tmp_name"]); + ensure($mime_type == "application/pdf" || $mime_type == "image/png" || $mime_type == "image/jpeg", "Le fichier doit être au format PDF."); + ensure(is_dir("$LOCAL_PATH/files") || mkdir("$LOCAL_PATH/files"), "Un problème est survenu dans l'envoi du fichier. Veuillez vérifier que le fichier pèse moins de 2 Mo. Merci de compresser votre fichier si tel n'est pas le cas. En cas de problème, merci de contacter l'administrateur du serveur."); } public function sendDocument()