Corrections mineures

This commit is contained in:
Yohann D'ANELLO 2020-02-03 16:44:38 +01:00
parent 61d5af0651
commit 59985f8fc8
5 changed files with 21 additions and 8 deletions

View File

@ -32,7 +32,7 @@ $ROUTES["^ajouter_organisateur$"] = ["server_files/controllers/ajouter_organisat
$ROUTES["^ajouter_tournoi$"] = ["server_files/controllers/ajouter_tournoi.php"];
$ROUTES["^confirmer_mail/([a-z0-9]*)/?$"] = ["server_files/controllers/confirmer_mail.php", "token"];
$ROUTES["^connexion/(confirmation-mail)/?$"] = ["server_files/controllers/connexion.php", "confirmation-mail"];
$ROUTES["^connexion/(mdp_oublie)/?$"] = ["server_files/controllers/connexion.php", "mdp_oublie"];
$ROUTES["^connexion/(mdp-oublie)/?$"] = ["server_files/controllers/connexion.php", "mdp_oublie"];
$ROUTES["^connexion/(reinitialiser_mdp)/(.*)/?$"] = ["server_files/controllers/connexion.php", "reset_password", "token"];
$ROUTES["^connexion/?$"] = ["server_files/controllers/connexion.php"];
$ROUTES["^deconnexion/?$"] = ["server_files/controllers/deconnexion.php"];

View File

@ -188,7 +188,8 @@ 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.");
$mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), $this->file["tmp_name"]);
ensure($mime == "application/pdf" || $mime = "image/png" || $mime == "image/jpeg", "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.");
}

View File

@ -32,14 +32,14 @@ if ($file !== null) {
if ($type == DocumentType::SOLUTION) {
$problem = $file->getProblem();
$name = "Problème $problem $trigram.pdf";
$name = "Problème $problem $trigram";
if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) && (!isset($_SESSION["team"]) || $_SESSION["team"]->getId() != $team->getId()))
require_once "server_files/403.php";
}
else if ($type == DocumentType::SYNTHESIS) {
$dest = $file->getDest();
$name = "Note de synthèse $trigram pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur") . ".pdf";
$name = "Note de synthèse $trigram pour " . ($dest == DestType::OPPOSANT ? "l'opposant" : "le rapporteur");
if (($_SESSION["role"] == Role::PARTICIPANT || $_SESSION["role"] == Role::ENCADRANT) && (!isset($_SESSION["team"]) || $_SESSION["team"]->getId() != $team->getId()))
require_once "server_files/403.php";
@ -68,18 +68,26 @@ if ($file !== null) {
break;
}
if ($type == DocumentType::MOTIVATION_LETTER)
$name = "Lettre de motivation de l'équipe $trigram.pdf";
$name = "Lettre de motivation de l'équipe $trigram";
else {
$surname = $user->getSurname();
$first_name = $user->getFirstName();
$name .= " de $first_name $surname.pdf";
$name .= " de $first_name $surname";
}
}
}
else
require_once "server_files/404.php";
header("Content-Type: application/pdf");
$mime = finfo_file(finfo_open(FILEINFO_MIME_TYPE), "$LOCAL_PATH/files/$id");
if ($mime == "application/pdf")
$name .= ".pdf";
elseif ($mime == "image/png")
$name .= ".png";
else
$name = ".jpg";
header("Content-Type: $mime");
header("Content-Disposition: inline; filename=\"$name\"");
readfile("$LOCAL_PATH/files/$id");

View File

@ -86,7 +86,7 @@ if (isset($user) && !$has_error) {
</div>
</div>
<div class="form-group col-md-6">
<label for="birth_date">Date de naissance :</label>
<label for="birth_date">Date de naissance : (au format aaaa-mm-jj si votre navigateur supporte mal les formulaires)</label>
<input class="form-control" type="date" id="birth_date" name="birth_date"
value="<?php if (isset($user)) echo $user->birth_date ?>" required/>
</div>

View File

@ -223,6 +223,10 @@ if (!$has_error && (isset($my_account) || isset($new_password))) {
<?php } ?>
<?php printDocuments($documents); ?>
<?php if ($not_validated) { ?>
<div class="alert alert-warning">
Les fichiers doivent être au format PDF, PNG ou JPEG et peser moins de 2 Mo.
</div>
<form method="POST" enctype="multipart/form-data">
<div class="form-row">