rewrite v1.0

This commit is contained in:
Pontoporeia
2023-05-02 20:17:58 +02:00
parent 763ad7d722
commit 4a1e4b696e
9 changed files with 301 additions and 25 deletions

3
.gitignore vendored
View File

@@ -1,4 +1,5 @@
/vendor/
/composer.lock
### Data et Mémoire###
data
data/yaml/
data/content/

65
assets/icon.svg Normal file
View File

@@ -0,0 +1,65 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
stroke-linecap="round"
stroke-linejoin="round"
class="lucide lucide-archive-restore"
version="1.1"
id="svg12"
sodipodi:docname="icon.svg"
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns="http://www.w3.org/2000/svg"
xmlns:svg="http://www.w3.org/2000/svg">
<defs
id="defs16" />
<sodipodi:namedview
id="namedview14"
pagecolor="#ffffff"
bordercolor="#000000"
borderopacity="0.25"
inkscape:showpageshadow="2"
inkscape:pageopacity="0.0"
inkscape:pagecheckerboard="0"
inkscape:deskcolor="#d1d1d1"
showgrid="false"
inkscape:zoom="24.719275"
inkscape:cx="5.2185997"
inkscape:cy="13.713995"
inkscape:window-width="1920"
inkscape:window-height="1011"
inkscape:window-x="0"
inkscape:window-y="32"
inkscape:window-maximized="1"
inkscape:current-layer="svg12" />
<rect
width="20"
height="5"
x="2"
y="4"
rx="2"
id="rect2"
style="stroke:#c104fc;stroke-opacity:1" />
<path
d="M12 13v7"
id="path4"
style="stroke:#c104fc;stroke-opacity:1" />
<path
d="m9 16 3-3 3 3"
id="path6"
style="stroke:#c104fc;stroke-opacity:1" />
<path
d="M4 9v9a2 2 0 0 0 2 2h2"
id="path8"
style="stroke:#c104fc;stroke-opacity:1" />
<path
d="M20 9v9a2 2 0 0 1-2 2h-2"
id="path10"
style="stroke:#c104fc;stroke-opacity:1" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 31 KiB

View File

@@ -1,6 +1,24 @@
@font-face {
font-family: police1;
src: url("./fonts/Combinedd.otf");
src: url("./Combinedd.otf");
}
/* Dark theme */
/* UTILE POUR FORCER UN MODE LIGHT */
@media (prefers-color-scheme: dark) {
:root,
::backdrop {
--bg: #fff;
--accent-bg: #f5f7ff;
--text: #212121;
--text-light: #585858;
--border: #898EA4;
--accent: #0d47a1;
--code: #d81b60;
--preformatted: #444;
--marked: #ffdd33;
--disabled: #efefef;
}
}
body{
@@ -10,15 +28,18 @@
/* ENTÊTE */
header {
font-family: 'police1';
background: linear-gradient(315deg, rgba(77, 168, 112, 1) 0%, rgba(193, 4, 252, 1) 66%);
background: linear-gradient(280deg, rgba(77, 168, 112, 1) 0%, rgba(193, 4, 252, 1) 85%);
text-decoration: none;
outline: none;
font-size: 2rem;
}
body > header h1 {
color: white;
margin: 3rem auto auto auto;
}
/* FORMULAIRE */
form label {
@@ -44,8 +65,8 @@
}
input {
font-family: police1;
font-weight: bold;
/* font-family: police1; */
/* font-weight: bold; */
background-color: none;
color: rgb(193, 4, 252);
border: 1px solid rgb(193, 4, 252);
@@ -72,10 +93,7 @@ input {
margin-top: 2rem;
}
body > header h1 {
color: white;
margin: 3rem auto auto auto;
}

172
error.log
View File

@@ -2,3 +2,175 @@
Stack trace:
#0 {main}
thrown in /home/lockpick/Projects/posterg-formulaire/formulaire.php on line 42
[02-May-2023 17:27:08 UTC] FILES array: Array
(
[files] => Array
(
[name] => undefinedMega_2023-04-24.pdf
[full_path] => undefinedMega_2023-04-24.pdf
[type] => application/pdf
[tmp_name] => /tmp/phptz5xyY
[error] => 0
[size] => 64998
)
)
[02-May-2023 17:29:09 UTC] FILES array: Array
(
[files] => Array
(
[name] => undefinedMega_2023-04-24.pdf
[full_path] => undefinedMega_2023-04-24.pdf
[type] => application/pdf
[tmp_name] => /tmp/phpbgEPg4
[error] => 0
[size] => 64998
)
)
[02-May-2023 17:29:24 UTC] FILES array: Array
(
[files] => Array
(
[name] => Array
(
[0] => UdeM_Guide-ecriture-inclusive.pdf
[1] => undefinedMega_2023-04-24.pdf
)
[full_path] => Array
(
[0] => UdeM_Guide-ecriture-inclusive.pdf
[1] => undefinedMega_2023-04-24.pdf
)
[type] => Array
(
[0] => application/pdf
[1] => application/pdf
)
[tmp_name] => Array
(
[0] => /tmp/php5XBNaE
[1] => /tmp/phpGrs9Dq
)
[error] => Array
(
[0] => 0
[1] => 0
)
[size] => Array
(
[0] => 579957
[1] => 64998
)
)
)
[02-May-2023 17:29:24 UTC] Processing file: UdeM_Guide-ecriture-inclusive.pdf
[02-May-2023 17:29:24 UTC] File successfully moved: data/content///UdeM_Guide-ecriture-inclusive.pdf
[02-May-2023 17:29:24 UTC] Processing file: undefinedMega_2023-04-24.pdf
[02-May-2023 17:29:24 UTC] File successfully moved: data/content///undefinedMega_2023-04-24.pdf
[02-May-2023 17:31:08 UTC] FILES array: Array
(
[files] => Array
(
[name] => Array
(
[0] => UdeM_Guide-ecriture-inclusive.pdf
[1] => undefinedMega_2023-04-24.pdf
)
[full_path] => Array
(
[0] => UdeM_Guide-ecriture-inclusive.pdf
[1] => undefinedMega_2023-04-24.pdf
)
[type] => Array
(
[0] => application/pdf
[1] => application/pdf
)
[tmp_name] => Array
(
[0] => /tmp/phpQbhzwi
[1] => /tmp/phpm8u5q7
)
[error] => Array
(
[0] => 0
[1] => 0
)
[size] => Array
(
[0] => 579957
[1] => 64998
)
)
)
[02-May-2023 17:31:08 UTC] Processing file: UdeM_Guide-ecriture-inclusive.pdf
[02-May-2023 17:31:08 UTC] File successfully moved: data/content/2024/Théophile Gervreau-Mercier/UdeM_Guide-ecriture-inclusive.pdf
[02-May-2023 17:31:08 UTC] Processing file: undefinedMega_2023-04-24.pdf
[02-May-2023 17:31:08 UTC] File successfully moved: data/content/2024/Théophile Gervreau-Mercier/undefinedMega_2023-04-24.pdf
[02-May-2023 17:31:34 UTC] FILES array: Array
(
[files] => Array
(
[name] => Array
(
[0] => UdeM_Guide-ecriture-inclusive.pdf
[1] => undefinedMega_2023-04-24.pdf
)
[full_path] => Array
(
[0] => UdeM_Guide-ecriture-inclusive.pdf
[1] => undefinedMega_2023-04-24.pdf
)
[type] => Array
(
[0] => application/pdf
[1] => application/pdf
)
[tmp_name] => Array
(
[0] => /tmp/phpC8OF8o
[1] => /tmp/phpGoliAt
)
[error] => Array
(
[0] => 0
[1] => 0
)
[size] => Array
(
[0] => 579957
[1] => 64998
)
)
)
[02-May-2023 17:31:34 UTC] Processing file: 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] File successfully moved: data/content/2025/Théophile Gervreau-Mercier/undefinedMega_2023-04-24.pdf

View File

@@ -5,6 +5,9 @@ ini_set('display_errors', 0);
ini_set('log_errors', 1);
ini_set('error_log', 'error.log');
// Log the content of the $_FILES array
error_log("FILES array: " . print_r($_FILES, true));
require_once 'vendor/autoload.php';
use Symfony\Component\Yaml\Yaml;
use Behat\Transliterator\Transliterator;
@@ -51,29 +54,42 @@ $maxFileSize = 5 * 1024 * 1024; // 5 MB
// Process uploaded files
if (is_array($files["name"])) {
for ($i = 0; $i < count($files["name"]); $i++) {
// Log the file being processed
error_log("Processing file: " . $files["name"][$i]);
// Check for file upload errors
if ($files["error"][$i] !== UPLOAD_ERR_OK) {
error_log("File upload error: " . $files["name"][$i]);
continue;
}
// Check MIME type and file extension
$finfo = new finfo(FILEINFO_MIME_TYPE);
$mimeType = $finfo->file($files["tmp_name"][$i]);
$fileExtension = pathinfo($files["name"][$i], PATHINFO_EXTENSION);
if (!in_array($mimeType, $allowedMimeTypes) || !in_array($fileExtension, $allowedExtensions)) {
echo "Invalid file type or extension: " . $files["name"][$i] . "<br>";
error_log("Invalid file type or extension: " . $files["name"][$i]);
continue;
}
// Check file size
if ($files["size"][$i] > $maxFileSize) {
echo "File is too large: " . $files["name"][$i] . "<br>";
error_log("File is too large: " . $files["name"][$i]);
continue;
}
// Move and set permissions for the uploaded file
$targetFile = $targetDir . basename($files["name"][$i]);
move_uploaded_file($files["tmp_name"][$i], $targetFile);
if (move_uploaded_file($files["tmp_name"][$i], $targetFile)) {
// Log successful file move
error_log("File successfully moved: " . $targetFile);
chmod($targetFile, 0644);
$uploadedFiles[] = $targetFile;
} else {
error_log("Failed to move uploaded file: " . $files["name"][$i]);
}
}
}
// Prepare form data for YAML
$formData = [
@@ -100,3 +116,4 @@ file_put_contents($yamlFilePath, $yamlData);
// Redirect to the thank you page
header('Location: thanks.php?file=' . urlencode($yamlFilePath));
?>

View File

@@ -9,6 +9,7 @@
<link rel="stylesheet" href="assets/normalize.css">
<link rel="stylesheet" href="assets/simple.css">
<link rel="stylesheet" href="assets/posterg.css">
<link rel="shortcut icon" href="assets/icon.svg" type="image/svg">
</head>
<body>
<header>
@@ -19,16 +20,16 @@
<main>
<form action="formulaire.php" method="post" enctype="multipart/form-data">
<label>Nom/Prénom/Pseudo</label>
<input type="text" name="auteurice" placeholder="...">
<input type="text" name="auteurice" placeholder="..." required>
<label>Année diplômante (2020, 2021, ...)</label>
<input type="text" name="année" placeholder="...">
<label>Année diplômante (2023, 2024, ...)</label>
<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="...">
<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,..">
@@ -44,7 +45,7 @@
<label>Orientation principale</label>
<select name="orientation">
<select name="orientation" required>
<option value="">-- Ton orientation --</option>
<option value="typographie">Typographie</option>
<option value="graphisme">Graphisme</option>
@@ -64,7 +65,7 @@
</select>
<label>Atelier Pratique</label>
<select name="ap">
<select name="ap" required>
<option value="">-- Ton AP --</option>
<option value="DPM">Design et politique du multiple</option>
<option value="APS">Art et pratique situé</option>
@@ -74,7 +75,8 @@
<label>Importer les divers fichers de son mémoire</label>
<i>Si tu veux importer un dossier, créer une archive zip.</i>
<input type="file" name="files" multiple><br>
<!-- THE FILES[] IS NECESSARY IF THERE ARE MULTIPLE FILES UPLOADED -->
<input type="file" name="files[]" multiple><br>
<input type="submit" name="go" value="envoyer">
</form>

View File

@@ -22,6 +22,8 @@ $data = Yaml::parseFile($yamlFile);
<link rel="stylesheet" href="assets/normalize.css">
<link rel="stylesheet" href="assets/simple.css">
<link rel="stylesheet" href="assets/posterg.css">
<link rel="shortcut icon" href="assets/icon.svg" type="image/svg">
</head>
<body>
<header>