if (tg('val')) { $id_releve = tp('lin'); global $db; model::load('tresorie', 'relvee'); if (!validerreleve($id_releve)) { exit("2#Erreur Système "); } else { exit("1#Validation réussie"); } //Success Opération } if (tp('del') == 1) { $id_releve = tp('lin'); $idcompte = $db->QuerySingleValue0("SELECT id_compte FROM tresori_onape WHERE id={$id_releve}"); model::load('tresorie', 'relvee'); if (test_date($id_releve, $idcompte)) { if (!delet_releve($id_releve)) { exit("3#Erreur System"); } if (test_releve_exist($id_releve, $idcompte)) { exit("1#Suppression réussie"); } else { exit("1#Suppression réussie"); } } else { if (delet_releve($id_releve)) { exit("1"); } else { exit("3#Erreur System"); } }
} } } } return true; } if (!isUserLoggedIn()) { http_response_code(403); showError('You need to login to create an event.'); } else { if (isset($_POST['submit'])) { if (isset($_POST['type']) && isset($_POST['name']) && isset($_POST['description']) && isset($_POST['date']) && isset($_FILES["image"]) && isset($_POST["csrf_token"])) { if (validateCSRFToken($_POST["csrf_token"])) { $extension = pathinfo($_FILES["image"]["name"], PATHINFO_EXTENSION); if (isset($extension)) { if (test_date($_POST['date'])) { $idEvent = createEvent($_POST['type'], $_POST['name'], $_POST['description'], $_POST['date'], isset($_POST['public']), $_SESSION['userid']); if ($idEvent != -1) { try { if (file_exists($_FILES['image']['tmp_name']) && is_uploaded_file($_FILES['image']['tmp_name'])) { // Check if an image was been uploaded $target_dir = "images/events/"; $target_file = $target_dir . $idEvent . '.' . $extension; if (!updateEventImage($idEvent, $target_file)) { throw new RuntimeException("Could not set event image."); } uploadImage($_FILES["image"], $target_file); } showSuccess("Event created."); } catch (RuntimeException $e) { showError($e->getMessage());
$values = isset($_POST["values"]) ? $_POST["values"] : array(); $problems = ""; $hints = ""; if (empty($_FILES)) { $problems = gettext("Could not upload document.") . " "; $hints = str_replace(array("%SIZE", "%TIME"), array(readable_filesize($max_file_size), (string) ini_get('max_execution_time')), gettext("Maybe your document exceeded the allowed file size (max. %SIZE) or the upload might have taken too long (max. %TIME seconds).")) . " "; } //�berpr�ft, ob ein pdf hochgeladen wurde $path_part = pathinfo($_FILES["material"]["name"]); if ($path_part["extension"] != "pdf") { $problems = gettext("file-type not allowed") . " (" . $path_part["extension"] . ")"; $hints = gettext("Please choose a pdf-document") . " "; } //�berpr�ft, ob ein Datum richtig ist if (isset($values["enddate_d"]) && isset($values["enddate_h"])) { if (!test_date($values["enddate_d"], $values["enddate_h"])) { $problems = gettext("Wrong Date") . " "; $hints = gettext("Please enter a valid date.") . " "; } } if (!isset($values["groupsize"])) { $problems = gettext("No Groupsize") . " "; $hints = gettext("Please enter a groupsize.") . " "; } if (!empty($_FILES["material"]["error"]) && $_FILES["material"]["error"] > 0) { $problems = gettext("No file chosen.") . " "; $hints = gettext("Please choose a local file to upload.") . " "; } if (empty($problems)) { $content = file_get_contents($_FILES["material"]["tmp_name"]); $filename = str_replace(array("\\", "'"), array("", ""), $_FILES["material"]["name"]);