1
0
mirror of https://gitlab.com/animath/si/plateforme-corres2math.git synced 2025-07-03 15:22:48 +02:00

Corrections mineurs

This commit is contained in:
galaxyoyo
2019-09-25 01:08:38 +02:00
parent 371605d265
commit 2b1bb79efb
6 changed files with 22 additions and 19 deletions

View File

@ -33,7 +33,7 @@ if (isset($_POST["team_edit"])) {
}
if (isset($_POST["request_validation"])) {
if (!canValidate($team)) {
if (!canValidate($_SESSION["team"])) {
$has_error = true;
$error_message = "Votre équipe ne peut pas demander la validation : il manque soit des participants, soit des documents.";
}
@ -73,12 +73,10 @@ if (isset($_GET["publish_videos"])) {
class SendDocument
{
private $file;
private $type;
public function __construct()
{
$this->file = $_FILES["document"];
$this->type = strtoupper(htmlspecialchars($_POST["type"]));
}
public function makeVerifications()
@ -102,9 +100,9 @@ class SendDocument
if (!rename($this->file["tmp_name"], "$LOCAL_PATH/files/$id"))
throw new AssertionError("Une erreur est survenue lors de l'envoi du fichier.");
$req = $DB->prepare("INSERT INTO `documents`(`file_id`, `user`, `team`, `problem`, `type`)
VALUES (?, ?, ?, ?, ?);");
$req->execute([$id, $_SESSION["user_id"], $_SESSION["team"]->getId(), $_SESSION["team"]->getProblem(), $this->type]);
$req = $DB->prepare("INSERT INTO `documents`(`file_id`, `user`, `team`, `problem`)
VALUES (?, ?, ?, ?);");
$req->execute([$id, $_SESSION["user_id"], $_SESSION["team"]->getId(), $_SESSION["team"]->getProblem()]);
}
}