diff --git a/data/cover/Théophile Gervreau-Mercier_2024_.png b/data/cover/Théophile Gervreau-Mercier_2024_.png new file mode 100644 index 0000000..0a109c4 Binary files /dev/null and b/data/cover/Théophile Gervreau-Mercier_2024_.png differ diff --git a/error.log b/error.log index 7e96795..760c56a 100644 --- a/error.log +++ b/error.log @@ -174,3 +174,445 @@ Stack trace: [02-May-2023 17:31:34 UTC] File successfully moved: data/content/2025/Théophile Gervreau-Mercier/UdeM_Guide-ecriture-inclusive.pdf [02-May-2023 17:31:34 UTC] Processing file: undefinedMega_2023-04-24.pdf [02-May-2023 17:31:34 UTC] File successfully moved: data/content/2025/Théophile Gervreau-Mercier/undefinedMega_2023-04-24.pdf +[03-May-2023 16:06:52 UTC] FILES array: Array +( + [files] => Array + ( + [name] => Array + ( + [0] => why_oatmeal_is_cheap_fdg2023.pdf + ) + + [full_path] => Array + ( + [0] => why_oatmeal_is_cheap_fdg2023.pdf + ) + + [type] => Array + ( + [0] => application/pdf + ) + + [tmp_name] => Array + ( + [0] => /tmp/phpX9bMti + ) + + [error] => Array + ( + [0] => 0 + ) + + [size] => Array + ( + [0] => 568705 + ) + + ) + +) + +[03-May-2023 16:06:52 UTC] Processing file: why_oatmeal_is_cheap_fdg2023.pdf +[03-May-2023 16:06:52 UTC] File successfully moved: data/content/2025/Théophile Gervreau-Mercier/why_oatmeal_is_cheap_fdg2023.pdf +[04-May-2023 08:22:06 UTC] FILES array: Array +( + [files] => Array + ( + [name] => Array + ( + [0] => why_oatmeal_is_cheap_fdg2023.pdf + ) + + [full_path] => Array + ( + [0] => why_oatmeal_is_cheap_fdg2023.pdf + ) + + [type] => Array + ( + [0] => application/pdf + ) + + [tmp_name] => Array + ( + [0] => /tmp/phpREgzf4 + ) + + [error] => Array + ( + [0] => 0 + ) + + [size] => Array + ( + [0] => 568705 + ) + + ) + +) + +[04-May-2023 08:22:06 UTC] Processing file: why_oatmeal_is_cheap_fdg2023.pdf +[04-May-2023 08:22:06 UTC] File successfully moved: data/content/2024/Théophile Gervreau-Mercier/why_oatmeal_is_cheap_fdg2023.pdf +[04-May-2023 21:36:54 UTC] FILES array: Array +( + [files] => Array + ( + [name] => Array + ( + [0] => undefinedMega_2023-04-24.pdf + [1] => mov_bbb.mp4 + ) + + [full_path] => Array + ( + [0] => undefinedMega_2023-04-24.pdf + [1] => mov_bbb.mp4 + ) + + [type] => Array + ( + [0] => application/pdf + [1] => video/mp4 + ) + + [tmp_name] => Array + ( + [0] => /tmp/phpwhLgCH + [1] => /tmp/phprfELDx + ) + + [error] => Array + ( + [0] => 0 + [1] => 0 + ) + + [size] => Array + ( + [0] => 64998 + [1] => 788493 + ) + + ) + +) + +[04-May-2023 21:36:55 UTC] PHP Warning: Undefined array key "tags" in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 27 +[04-May-2023 21:36:55 UTC] PHP Fatal error: Uncaught TypeError: array_map(): Argument #2 ($array) must be of type array, null given in /home/lockpick/Projects/posterg-formulaire/formulaire.php:25 +Stack trace: +#0 /home/lockpick/Projects/posterg-formulaire/formulaire.php(25): array_map() +#1 {main} + thrown in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 25 +[04-May-2023 21:39:04 UTC] FILES array: Array +( + [files] => Array + ( + [name] => Array + ( + [0] => undefinedMega_2023-04-24.pdf + [1] => mov_bbb.mp4 + ) + + [full_path] => Array + ( + [0] => undefinedMega_2023-04-24.pdf + [1] => mov_bbb.mp4 + ) + + [type] => Array + ( + [0] => application/pdf + [1] => video/mp4 + ) + + [tmp_name] => Array + ( + [0] => /tmp/php5iA7cZ + [1] => /tmp/phpkc0Kil + ) + + [error] => Array + ( + [0] => 0 + [1] => 0 + ) + + [size] => Array + ( + [0] => 64998 + [1] => 788493 + ) + + ) + +) + +[04-May-2023 21:39:04 UTC] Processing file: undefinedMega_2023-04-24.pdf +[04-May-2023 21:39:04 UTC] File successfully moved: data/content/2024/Théophile Gervreau-Mercier/undefinedMega_2023-04-24.pdf +[04-May-2023 21:39:04 UTC] PHP Warning: Undefined variable $pdfMimeTypes in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 115 +[04-May-2023 21:39:04 UTC] PHP Fatal error: Uncaught TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in /home/lockpick/Projects/posterg-formulaire/formulaire.php:115 +Stack trace: +#0 /home/lockpick/Projects/posterg-formulaire/formulaire.php(115): in_array() +#1 {main} + thrown in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 115 +[05-May-2023 08:16:20 UTC] FILES array: Array +( + [couverture] => Array + ( + [name] => PXL_20230429_202209418.jpg + [full_path] => PXL_20230429_202209418.jpg + [type] => + [tmp_name] => + [error] => 1 + [size] => 0 + ) + + [files] => Array + ( + [name] => Array + ( + [0] => why_oatmeal_is_cheap_fdg2023.pdf + ) + + [full_path] => Array + ( + [0] => why_oatmeal_is_cheap_fdg2023.pdf + ) + + [type] => Array + ( + [0] => application/pdf + ) + + [tmp_name] => Array + ( + [0] => /tmp/phpgC7WDR + ) + + [error] => Array + ( + [0] => 0 + ) + + [size] => Array + ( + [0] => 568705 + ) + + ) + +) + +[05-May-2023 08:16:20 UTC] PHP Warning: Undefined variable $memoireFolder in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 34 +[05-May-2023 08:16:20 UTC] Processing file: why_oatmeal_is_cheap_fdg2023.pdf +[05-May-2023 08:16:20 UTC] File successfully moved: data/content/2024/Théophile Gervreau-Mercier/why_oatmeal_is_cheap_fdg2023.pdf +[05-May-2023 08:16:20 UTC] PHP Warning: Undefined variable $previewPath in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 126 +[05-May-2023 08:17:52 UTC] FILES array: Array +( + [couverture] => Array + ( + [name] => PXL_20230429_202209418.jpg + [full_path] => PXL_20230429_202209418.jpg + [type] => + [tmp_name] => + [error] => 1 + [size] => 0 + ) + + [files] => Array + ( + [name] => Array + ( + [0] => why_oatmeal_is_cheap_fdg2023.pdf + ) + + [full_path] => Array + ( + [0] => why_oatmeal_is_cheap_fdg2023.pdf + ) + + [type] => Array + ( + [0] => application/pdf + ) + + [tmp_name] => Array + ( + [0] => /tmp/php9es1iw + ) + + [error] => Array + ( + [0] => 0 + ) + + [size] => Array + ( + [0] => 568705 + ) + + ) + +) + +[05-May-2023 08:17:52 UTC] PHP Warning: Undefined variable $memoireFolder in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 34 +[05-May-2023 08:17:52 UTC] Processing file: why_oatmeal_is_cheap_fdg2023.pdf +[05-May-2023 08:17:52 UTC] File successfully moved: data/content/2024/Théophile Gervreau-Mercier/why_oatmeal_is_cheap_fdg2023.pdf +[05-May-2023 08:24:04 UTC] FILES array: Array +( + [couverture] => Array + ( + [name] => PXL_20230429_202209418.jpg + [full_path] => PXL_20230429_202209418.jpg + [type] => + [tmp_name] => + [error] => 1 + [size] => 0 + ) + + [files] => Array + ( + [name] => Array + ( + [0] => why_oatmeal_is_cheap_fdg2023.pdf + ) + + [full_path] => Array + ( + [0] => why_oatmeal_is_cheap_fdg2023.pdf + ) + + [type] => Array + ( + [0] => application/pdf + ) + + [tmp_name] => Array + ( + [0] => /tmp/phpGPzdzS + ) + + [error] => Array + ( + [0] => 0 + ) + + [size] => Array + ( + [0] => 568705 + ) + + ) + +) + +[05-May-2023 08:24:04 UTC] PHP Warning: Undefined variable $memoireFolder in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 34 +[05-May-2023 08:24:04 UTC] Processing file: why_oatmeal_is_cheap_fdg2023.pdf +[05-May-2023 08:24:04 UTC] File successfully moved: data/content/2024/Théophile Gervreau-Mercier/why_oatmeal_is_cheap_fdg2023.pdf +[05-May-2023 10:15:12 UTC] FILES array: Array +( + [couverture] => Array + ( + [name] => Screenshot 2023-05-03 at 18-09-15 ThankYou.png + [full_path] => Screenshot 2023-05-03 at 18-09-15 ThankYou.png + [type] => image/png + [tmp_name] => /tmp/php3w8hiB + [error] => 0 + [size] => 177748 + ) + + [files] => Array + ( + [name] => Array + ( + [0] => how do I make a bookmarklet in firefox.md + ) + + [full_path] => Array + ( + [0] => how do I make a bookmarklet in firefox.md + ) + + [type] => Array + ( + [0] => text/markdown + ) + + [tmp_name] => Array + ( + [0] => /tmp/phplxW8Jk + ) + + [error] => Array + ( + [0] => 0 + ) + + [size] => Array + ( + [0] => 3677 + ) + + ) + +) + +[05-May-2023 10:15:12 UTC] PHP Warning: Undefined variable $memoireFolder in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 38 +[05-May-2023 10:15:12 UTC] PHP Warning: Undefined variable $uniqueId in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 46 +[05-May-2023 10:15:12 UTC] Processing file: how do I make a bookmarklet in firefox.md +[05-May-2023 10:15:12 UTC] Invalid file type or extension: how do I make a bookmarklet in firefox.md +[05-May-2023 10:15:12 UTC] PHP Warning: Undefined variable $resume in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 129 +[05-May-2023 10:30:59 UTC] FILES array: Array +( + [couverture] => Array + ( + [name] => Screenshot 2023-05-03 at 18-09-15 ThankYou.png + [full_path] => Screenshot 2023-05-03 at 18-09-15 ThankYou.png + [type] => image/png + [tmp_name] => /tmp/phpb4uUfg + [error] => 0 + [size] => 177748 + ) + + [files] => Array + ( + [name] => Array + ( + [0] => how do I make a bookmarklet in firefox.md + ) + + [full_path] => Array + ( + [0] => how do I make a bookmarklet in firefox.md + ) + + [type] => Array + ( + [0] => text/markdown + ) + + [tmp_name] => Array + ( + [0] => /tmp/phpvJqkeo + ) + + [error] => Array + ( + [0] => 0 + ) + + [size] => Array + ( + [0] => 3677 + ) + + ) + +) + +[05-May-2023 10:30:59 UTC] PHP Warning: Undefined variable $memoireFolder in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 38 +[05-May-2023 10:30:59 UTC] PHP Warning: Undefined variable $uniqueId in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 46 +[05-May-2023 10:30:59 UTC] Processing file: how do I make a bookmarklet in firefox.md +[05-May-2023 10:30:59 UTC] Invalid file type or extension: how do I make a bookmarklet in firefox.md +[05-May-2023 10:30:59 UTC] PHP Warning: Undefined variable $resume in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 129 diff --git a/formulaire.php b/formulaire.php index 065e855..d0a5da8 100644 --- a/formulaire.php +++ b/formulaire.php @@ -24,10 +24,35 @@ $titre = filter_var($_POST["titre"], FILTER_SANITIZE_STRING); $tag = filter_var($_POST["tag"], FILTER_SANITIZE_STRING); $promoteurice = filter_var($_POST["promoteurice"], FILTER_SANITIZE_STRING); $problematique = filter_var($_POST["problématique"], FILTER_SANITIZE_STRING); -$resume = filter_var($_POST["résumé"], FILTER_SANITIZE_STRING); +$description = filter_var($_POST["description"], FILTER_SANITIZE_STRING); $orientation = filter_var($_POST["orientation"], FILTER_SANITIZE_STRING); $ap = filter_var($_POST["ap"], FILTER_SANITIZE_STRING); +$lien = filter_var($_POST["lien"], FILTER_SANITIZE_STRING); +$couverture = $_FILES["couverture"]; $files = $_FILES["files"]; + +// Transformation du string de mot-clé en un array. +$tagArray = explode(', ', $tag); + + +$coverFolder = $memoireFolder . "data/cover/"; +if (!file_exists($coverFolder)) { + mkdir($coverFolder, 0755, true); +} + +$couverturePath = ""; +if ($couverture["error"] === UPLOAD_ERR_OK) { + $fileExtension = pathinfo($couverture["name"], PATHINFO_EXTENSION); + $newCouvertureName = $auteurice . "_" . $annee . "_" . $uniqueId . "." . $fileExtension; + $targetFile = $coverFolder . $newCouvertureName; + if (move_uploaded_file($couverture["tmp_name"], $targetFile)) { + chmod($targetFile, 0644); + $couverturePath = $targetFile; + } else { + error_log("Failed to move uploaded couverture file: " . $couverture["name"]); + } +} + $uploadedFiles = []; // Create necessary directories @@ -47,9 +72,9 @@ $sanitizedAuteurice = Transliterator::transliterate($auteurice); $uniqueFileName = $sanitizedAuteurice . "_" . $date . "_" . $uniqueId; // Define security constraints -$allowedMimeTypes = ['image/jpeg', 'image/png', 'application/pdf']; -$allowedExtensions = ['jpg', 'jpeg', 'png', 'pdf']; -$maxFileSize = 5 * 1024 * 1024; // 5 MB +$allowedMimeTypes = ['image/jpeg', 'image/png', 'application/pdf', 'video/mp4', 'application/zip']; +$allowedExtensions = ['jpg', 'jpeg', 'png', 'pdf', 'mp4', 'zip']; +$maxFileSize = 50 * 1024 * 1024; // 50 MB // Process uploaded files if (is_array($files["name"])) { @@ -88,6 +113,7 @@ if (is_array($files["name"])) { error_log("Failed to move uploaded file: " . $files["name"][$i]); } } + } @@ -97,12 +123,14 @@ $formData = [ 'année' => $annee, 'email' => $mail, 'titre' => $titre, - 'tag' => $tag, + 'tag' => $tagArray, 'promoteurice' => $promoteurice, 'problématique' => $problematique, - 'resume' => $resume, + 'description' => $resume, 'orientation' => $orientation, 'ap' => $ap, + 'lien' => $lien, + 'couverture' => $couverturePath, 'files' => $uploadedFiles ]; diff --git a/index.php b/index.php index 9a2054f..7463b38 100644 --- a/index.php +++ b/index.php @@ -25,25 +25,6 @@ - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + Vérifie que ton fichier est bien un jpg. +
+ + + Si tu veux importer un dossier, créer une archive zip. -
- + +
diff --git a/struct.txt b/struct.txt new file mode 100644 index 0000000..197348d --- /dev/null +++ b/struct.txt @@ -0,0 +1,14 @@ +. +├── assets +├── composer.json +├── composer.lock +├── data +├── error.log +├── formulaire.php +├── index.php +├── README.md +├── struct.txt +├── thanks.php +└── vendor + +4 directories, 8 files diff --git a/thanks.php b/thanks.php index db97f51..8323732 100644 --- a/thanks.php +++ b/thanks.php @@ -30,9 +30,9 @@ $data = Yaml::parseFile($yamlFile);

Merci 💜

-

d'avoir remplit le formulaire. Le contenu soumis a été sauvegardé et est en attente d'approbation.

+

d'avoir rempli le formulaire. Le contenu soumis a été sauvegardé et est en attente de traitement.

-

Voici les informations que vous avez encoder dans le formulaire, affiché tel que c'est stocké, en yaml:

+

Voici les informations que vous avez encodées dans le formulaire, affiché tel que c'est stocké, en yaml:

Pour revenir au formulaire.