ajustement formulaire

This commit is contained in:
Pontoporeia
2023-05-12 09:31:41 +02:00
parent 4a1e4b696e
commit 9414966b24
6 changed files with 521 additions and 29 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

442
error.log
View File

@@ -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] 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] 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 [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

View File

@@ -24,10 +24,35 @@ $titre = filter_var($_POST["titre"], FILTER_SANITIZE_STRING);
$tag = filter_var($_POST["tag"], FILTER_SANITIZE_STRING); $tag = filter_var($_POST["tag"], FILTER_SANITIZE_STRING);
$promoteurice = filter_var($_POST["promoteurice"], FILTER_SANITIZE_STRING); $promoteurice = filter_var($_POST["promoteurice"], FILTER_SANITIZE_STRING);
$problematique = filter_var($_POST["problématique"], 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); $orientation = filter_var($_POST["orientation"], FILTER_SANITIZE_STRING);
$ap = filter_var($_POST["ap"], 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"]; $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 = []; $uploadedFiles = [];
// Create necessary directories // Create necessary directories
@@ -47,9 +72,9 @@ $sanitizedAuteurice = Transliterator::transliterate($auteurice);
$uniqueFileName = $sanitizedAuteurice . "_" . $date . "_" . $uniqueId; $uniqueFileName = $sanitizedAuteurice . "_" . $date . "_" . $uniqueId;
// Define security constraints // Define security constraints
$allowedMimeTypes = ['image/jpeg', 'image/png', 'application/pdf']; $allowedMimeTypes = ['image/jpeg', 'image/png', 'application/pdf', 'video/mp4', 'application/zip'];
$allowedExtensions = ['jpg', 'jpeg', 'png', 'pdf']; $allowedExtensions = ['jpg', 'jpeg', 'png', 'pdf', 'mp4', 'zip'];
$maxFileSize = 5 * 1024 * 1024; // 5 MB $maxFileSize = 50 * 1024 * 1024; // 50 MB
// Process uploaded files // Process uploaded files
if (is_array($files["name"])) { if (is_array($files["name"])) {
@@ -88,6 +113,7 @@ if (is_array($files["name"])) {
error_log("Failed to move uploaded file: " . $files["name"][$i]); error_log("Failed to move uploaded file: " . $files["name"][$i]);
} }
} }
} }
@@ -97,12 +123,14 @@ $formData = [
'année' => $annee, 'année' => $annee,
'email' => $mail, 'email' => $mail,
'titre' => $titre, 'titre' => $titre,
'tag' => $tag, 'tag' => $tagArray,
'promoteurice' => $promoteurice, 'promoteurice' => $promoteurice,
'problématique' => $problematique, 'problématique' => $problematique,
'resume' => $resume, 'description' => $resume,
'orientation' => $orientation, 'orientation' => $orientation,
'ap' => $ap, 'ap' => $ap,
'lien' => $lien,
'couverture' => $couverturePath,
'files' => $uploadedFiles 'files' => $uploadedFiles
]; ];

View File

@@ -25,25 +25,6 @@
<label>Année diplômante (2023, 2024, ...)</label> <label>Année diplômante (2023, 2024, ...)</label>
<input type="text" name="année" placeholder="..." required> <input type="text" name="année" placeholder="..." required>
<label>Contact : mail, insta, ...</label>
<input type="email" name="mail" placeholder="Votre contact">
<label>Titre du mémoire</label>
<input type="titre" name="titre" placeholder="..." required>
<label>Tag/mots-clefs sur le mémoire</label>
<input type="text" name="tag" placeholder="typographie, photographie, outils libre, post-colonial,..">
<label>Promoteur.rice</label>
<input type="text" name="promoteurice" placeholder="nom/prénom/pseudo">
<label>Problématique</label>
<input type="text" name="problématique" placeholder="Problématique de ton mémoire...">
<label>Résumé en quelque lignes</label>
<textarea id="textareaField" rows="8" type="text" name="résumé" placeholder="Description de ton mémoire..."></textarea>
<label>Orientation principale</label> <label>Orientation principale</label>
<select name="orientation" required> <select name="orientation" required>
<option value="">-- Ton orientation --</option> <option value="">-- Ton orientation --</option>
@@ -73,11 +54,38 @@
<option value="PAOC">Pratique de l'art et outils critiques</option> <option value="PAOC">Pratique de l'art et outils critiques</option>
</select> </select>
<label>Contact : mail, insta, ...</label>
<input type="email" name="mail" placeholder="Votre contact">
<label>Titre du mémoire</label>
<input type="titre" name="titre" placeholder="..." required>
<label>Tag/mots-clefs sur le mémoire</label>
<input type="text" name="tag" placeholder="typographie, photographie, outils libre, post-colonial,..">
<label>Promoteur.rice</label>
<input type="text" name="promoteurice" placeholder="nom/prénom/pseudo">
<label>Problématique</label>
<input type="text" name="problématique" placeholder="Problématique de ton mémoire...">
<label>Résumé en quelque lignes</label>
<textarea id="textareaField" rows="8" type="text" name="description" placeholder="Description de ton mémoire..."></textarea>
<label>Lien vers un site web ou quelque chose d'autres en lignes</label>
<input type="text" name="lien" placeholder="https://monmémoire.erg.be/...">
<label>Importer une couverture</label>
<i>Vérifie que ton fichier est bien un jpg.</i>
<br>
<!-- THE FILES[] IS NECESSARY IF THERE ARE MULTIPLE FILES UPLOADED -->
<input type="file" name="couverture">
<label>Importer les divers fichers de son mémoire</label> <label>Importer les divers fichers de son mémoire</label>
<i>Si tu veux importer un dossier, créer une archive zip.</i> <i>Si tu veux importer un dossier, créer une archive zip.</i>
<!-- THE FILES[] IS NECESSARY IF THERE ARE MULTIPLE FILES UPLOADED --> <!-- THE FILES[] IS NECESSARY IF THERE ARE MULTIPLE FILES UPLOADED -->
<input type="file" name="files[]" multiple><br> <input type="file" name="files[]" multiple>
<br>
<input type="submit" name="go" value="envoyer"> <input type="submit" name="go" value="envoyer">
</form> </form>
</main> </main>

14
struct.txt Normal file
View File

@@ -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

View File

@@ -30,9 +30,9 @@ $data = Yaml::parseFile($yamlFile);
<h1>Merci 💜</h1> <h1>Merci 💜</h1>
</header> </header>
<main> <main>
<p>d'avoir remplit le formulaire. Le contenu soumis a été sauvegardé et est en attente d'approbation.</p> <p>d'avoir rempli le formulaire. Le contenu soumis a été sauvegardé et est en attente de traitement.</p>
<h4>Voici les informations que vous avez encoder dans le formulaire, affiché tel que c'est stocké, en yaml:</h4> <h4>Voici les informations que vous avez encodées dans le formulaire, affiché tel que c'est stocké, en yaml:</h4>
<pre><code><?php echo htmlspecialchars(Yaml::dump($data)); ?></code></pre> <pre><code><?php echo htmlspecialchars(Yaml::dump($data)); ?></code></pre>
<p>Pour revenir au <a href="index.php">formulaire</a>.</p> <p>Pour revenir au <a href="index.php">formulaire</a>.</p>
</main> </main>