Corrections mineures
This commit is contained in:
parent
61d5af0651
commit
59985f8fc8
|
@ -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"];
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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">
|
||||
|
|
Loading…
Reference in New Issue