fix: require SmtpRelay.php before StudentEmail.php in partage/index.php

This commit is contained in:
Pontoporeia
2026-04-30 11:34:52 +02:00
parent cb883ab33f
commit 9ba60084bf
3 changed files with 219 additions and 103 deletions

View File

@@ -30,6 +30,8 @@
## Bug fixes (continued) ## Bug fixes (continued)
- [x] Fix fatal `Class "SmtpRelay" not found` in `StudentEmail.php` — add `require_once SmtpRelay.php` before `StudentEmail.php` in `partage/index.php`
- [x] Add missing favicon tags to all three `<head>` blocks in `partage/index.php` (error page, password gate, main form) - [x] Add missing favicon tags to all three `<head>` blocks in `partage/index.php` (error page, password gate, main form)
## Rename posterg → xamxam throughout codebase ## Rename posterg → xamxam throughout codebase

View File

@@ -430,6 +430,7 @@ function handleShareLinkSubmission(string $slug): void
} }
require_once APP_ROOT . '/src/Controllers/ThesisCreateController.php'; require_once APP_ROOT . '/src/Controllers/ThesisCreateController.php';
require_once APP_ROOT . '/src/SmtpRelay.php';
require_once APP_ROOT . '/src/StudentEmail.php'; require_once APP_ROOT . '/src/StudentEmail.php';
require_once APP_ROOT . '/src/AppLogger.php'; require_once APP_ROOT . '/src/AppLogger.php';

View File

@@ -2,75 +2,107 @@
<article class="tfe-layout"> <article class="tfe-layout">
<!-- LEFT: info article header --> <!-- LEFT: info article header -->
<header class="tfe-left"> <section class="tfe-left">
<!-- Author above title --> <!-- Author above title -->
<p class="tfe-author"><?= htmlspecialchars($data['authors'] ?? 'Auteur inconnu') ?></p> <p class="tfe-author"><?= htmlspecialchars(
$data["authors"] ?? "Auteur inconnu",
) ?></p>
<h1 class="tfe-title"> <h1 class="tfe-title">
<?= htmlspecialchars($data['title']) ?> <?= htmlspecialchars($data["title"]) ?>
<?php if (!empty($data['subtitle'])): ?> <?php if (!empty($data["subtitle"])): ?>
<?= htmlspecialchars($data['subtitle']) ?> <?= htmlspecialchars($data["subtitle"]) ?>
<?php endif; ?> <?php endif; ?>
</h1> </h1>
<dl> <dl>
<?php if (!empty($data['orientation'])): ?> <?php if (!empty($data["orientation"])): ?>
<div> <div>
<dt>Orientation :</dt> <dt>Orientation :</dt>
<dd><a href="/repertoire?or[]=<?= urlencode($data['orientation']) ?>"><?= htmlspecialchars($data['orientation']) ?></a></dd> <dd><a href="/repertoire?or[]=<?= urlencode(
$data["orientation"],
) ?>"><?= htmlspecialchars($data["orientation"]) ?></a></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['ap_program'])): ?> <?php if (!empty($data["ap_program"])): ?>
<div> <div>
<dt>Atelier pluridisciplinaire :</dt> <dt>Atelier pluridisciplinaire :</dt>
<dd><a href="/repertoire?ap[]=<?= urlencode($data['ap_program']) ?>"><?= htmlspecialchars($data['ap_program']) ?></a></dd> <dd><a href="/repertoire?ap[]=<?= urlencode(
$data["ap_program"],
) ?>"><?= htmlspecialchars($data["ap_program"]) ?></a></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['year'])): ?> <?php if (!empty($data["year"])): ?>
<div> <div>
<dt>Date :</dt> <dt>Date :</dt>
<dd><a href="/repertoire?fy[]=<?= urlencode($data['year']) ?>"><?= htmlspecialchars($data['year']) ?></a></dd> <dd><a href="/repertoire?fy[]=<?= urlencode(
$data["year"],
) ?>"><?= htmlspecialchars($data["year"]) ?></a></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['languages'])): ?> <?php if (!empty($data["languages"])): ?>
<div> <div>
<dt>Langue :</dt> <dt>Langue :</dt>
<dd><?php <dd><?php
$langs = array_map('trim', explode(',', $data['languages'])); $langs = array_map(
$langLinks = array_map(fn($l) => '<a href="/search?query=' . urlencode($l) . '">' . htmlspecialchars($l) . '</a>', $langs); "trim",
echo implode(', ', $langLinks); explode(",", $data["languages"]),
);
$langLinks = array_map(
fn($l) => '<a href="/search?query=' .
urlencode($l) .
'">' .
htmlspecialchars($l) .
"</a>",
$langs,
);
echo implode(", ", $langLinks);
?></dd> ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['formats'])): ?> <?php if (!empty($data["formats"])): ?>
<div> <div>
<dt>Format :</dt> <dt>Format :</dt>
<dd><?php <dd><?php
$fmts = array_map('trim', explode(',', $data['formats'])); $fmts = array_map("trim", explode(",", $data["formats"]));
$fmtLinks = array_map(fn($f) => '<a href="/search?query=' . urlencode($f) . '">' . htmlspecialchars($f) . '</a>', $fmts); $fmtLinks = array_map(
echo implode(', ', $fmtLinks); fn($f) => '<a href="/search?query=' .
urlencode($f) .
'">' .
htmlspecialchars($f) .
"</a>",
$fmts,
);
echo implode(", ", $fmtLinks);
?></dd> ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['file_size_info'])): ?> <?php if (!empty($data["file_size_info"])): ?>
<div> <div>
<dt>Durée :</dt> <dt>Durée :</dt>
<dd><?= htmlspecialchars($data['file_size_info']) ?></dd> <dd><?= htmlspecialchars($data["file_size_info"]) ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['keywords'])): ?> <?php if (!empty($data["keywords"])): ?>
<div> <div>
<dt>Mots-clés :</dt> <dt>Mots-clés :</dt>
<dd><?php <dd><?php
$kws = array_map('trim', explode(',', $data['keywords'])); $kws = array_map("trim", explode(",", $data["keywords"]));
$kwLinks = array_map(fn($k) => '<a href="/repertoire?kw[]=' . urlencode($k) . '">' . htmlspecialchars($k) . '</a>', $kws); $kwLinks = array_map(
echo implode(', ', $kwLinks); fn($k) => '<a href="/repertoire?kw[]=' .
urlencode($k) .
'">' .
htmlspecialchars($k) .
"</a>",
$kws,
);
echo implode(", ", $kwLinks);
?></dd> ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
@@ -79,8 +111,15 @@
<div> <div>
<dt>Promoteur·ice interne :</dt> <dt>Promoteur·ice interne :</dt>
<dd><?php <dd><?php
$links = array_map(fn($n) => '<a href="/search?query=' . urlencode($n) . '">' . htmlspecialchars($n) . '</a>', $promoteursInternes); $links = array_map(
echo implode(', ', $links); fn($n) => '<a href="/search?query=' .
urlencode($n) .
'">' .
htmlspecialchars($n) .
"</a>",
$promoteursInternes,
);
echo implode(", ", $links);
?></dd> ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
@@ -89,8 +128,15 @@
<div> <div>
<dt>Promoteur·ice externe :</dt> <dt>Promoteur·ice externe :</dt>
<dd><?php <dd><?php
$links = array_map(fn($n) => '<a href="/search?query=' . urlencode($n) . '">' . htmlspecialchars($n) . '</a>', $promoteursExternes); $links = array_map(
echo implode(', ', $links); fn($n) => '<a href="/search?query=' .
urlencode($n) .
'">' .
htmlspecialchars($n) .
"</a>",
$promoteursExternes,
);
echo implode(", ", $links);
?></dd> ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
@@ -99,8 +145,15 @@
<div> <div>
<dt>Président·e du jury :</dt> <dt>Président·e du jury :</dt>
<dd><?php <dd><?php
$links = array_map(fn($n) => '<a href="/search?query=' . urlencode($n) . '">' . htmlspecialchars($n) . '</a>', $juryPresidents); $links = array_map(
echo implode(', ', $links); fn($n) => '<a href="/search?query=' .
urlencode($n) .
'">' .
htmlspecialchars($n) .
"</a>",
$juryPresidents,
);
echo implode(", ", $links);
?></dd> ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
@@ -109,60 +162,88 @@
<div> <div>
<dt>Lecteur·ices :</dt> <dt>Lecteur·ices :</dt>
<dd><?php <dd><?php
$links = array_map(fn($n) => '<a href="/search?query=' . urlencode($n) . '">' . htmlspecialchars($n) . '</a>', $juryLecteurs); $links = array_map(
echo implode(', ', $links); fn($n) => '<a href="/search?query=' .
urlencode($n) .
'">' .
htmlspecialchars($n) .
"</a>",
$juryLecteurs,
);
echo implode(", ", $links);
?></dd> ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['access_type'])): ?> <?php if (!empty($data["access_type"])): ?>
<div> <div>
<dt>Accès :</dt> <dt>Accès :</dt>
<dd><?= htmlspecialchars($data['access_type']) ?></dd> <dd><?= htmlspecialchars($data["access_type"]) ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['license_type'])): ?> <?php if (!empty($data["license_type"])): ?>
<div> <div>
<dt>Licence :</dt> <dt>Licence :</dt>
<dd><?= htmlspecialchars($data['license_type']) ?></dd> <dd><?= htmlspecialchars($data["license_type"]) ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['context_note'])): ?> <?php if (!empty($data["context_note"])): ?>
<div class="tfe-meta-note"> <div class="tfe-meta-note">
<dt>Note :</dt> <dt>Note :</dt>
<dd class="tfe-note-value"><?= nl2br(htmlspecialchars($data['context_note'])) ?></dd> <dd class="tfe-note-value"><?= nl2br(
htmlspecialchars($data["context_note"]),
) ?></dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['author_email']) && !empty($data['author_show_contact'])): ?> <?php if (
!empty($data["author_email"]) &&
!empty($data["author_show_contact"])
): ?>
<div> <div>
<dt>Contact :</dt> <dt>Contact :</dt>
<dd> <dd>
<?php <?php
$_contact = $data['author_email']; $_contact = $data["author_email"];
$_isUrl = filter_var($_contact, FILTER_VALIDATE_URL) !== false; $_isUrl =
$_isEmail = !$_isUrl && str_contains($_contact, '@'); filter_var($_contact, FILTER_VALIDATE_URL) !==
if ($_isUrl): false;
?> $_isEmail = !$_isUrl && str_contains($_contact, "@");
<a href="<?= htmlspecialchars($_contact) ?>" target="_blank" rel="noopener"> if ($_isUrl): ?>
<?= htmlspecialchars(preg_replace('#^https?://#i', '', rtrim($_contact, '/'))) ?> <a href="<?= htmlspecialchars(
$_contact,
) ?>" target="_blank" rel="noopener">
<?= htmlspecialchars(
preg_replace(
"#^https?://#i",
"",
rtrim($_contact, "/"),
),
) ?>
<span class="sr-only">(ouvre dans un nouvel onglet)</span> <span class="sr-only">(ouvre dans un nouvel onglet)</span>
</a> </a>
<?php elseif ($_isEmail): ?> <?php elseif ($_isEmail): ?>
<a href="mailto:<?= htmlspecialchars($_contact) ?>"><?= htmlspecialchars($_contact) ?></a> <a href="mailto:<?= htmlspecialchars(
$_contact,
) ?>"><?= htmlspecialchars($_contact) ?></a>
<?php else: ?> <?php else: ?>
<?= htmlspecialchars($_contact) ?> <?= htmlspecialchars($_contact) ?>
<?php endif; ?> <?php endif;
?>
</dd> </dd>
</div> </div>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($data['baiu_link'])): ?> <?php if (!empty($data["baiu_link"])): ?>
<?php <?php
$_baiuHref = htmlspecialchars($data['baiu_link']); $_baiuHref = htmlspecialchars($data["baiu_link"]);
$_baiuLabel = preg_replace('#^https?://#i', '', rtrim($data['baiu_link'], '/')); $_baiuLabel = preg_replace(
"#^https?://#i",
"",
rtrim($data["baiu_link"], "/"),
);
?> ?>
<div> <div>
<dt>Lien :</dt> <dt>Lien :</dt>
@@ -177,18 +258,16 @@
<?php endif; ?> <?php endif; ?>
</dl> </dl>
<?php if (!empty($data['synopsis'])): ?> <?php if (!empty($data["synopsis"])): ?>
<p class="tfe-synopsis-text"> <p class="tfe-synopsis-text">
<?= nl2br(htmlspecialchars($data['synopsis'])) ?> <?= nl2br(htmlspecialchars($data["synopsis"])) ?>
</p> </p>
<?php endif; ?> <?php endif; ?>
</header> </section>
<!-- RIGHT: media — supplementary aside --> <!-- RIGHT: media — supplementary aside -->
<aside class="tfe-right"> <section class="tfe-right">
<?php <?php $_videoIndex = 0; ?>
$_videoIndex = 0;
?>
<?php if ($isInterdit): ?> <?php if ($isInterdit): ?>
<p class="tfe-restricted"> <p class="tfe-restricted">
Ce TFE n'est pas disponible en ligne. Ce TFE n'est pas disponible en ligne.
@@ -203,7 +282,9 @@
<form id="access-request-form" class="tfe-access-request-form" <form id="access-request-form" class="tfe-access-request-form"
data-thesis-id="<?= $thesisId ?>"> data-thesis-id="<?= $thesisId ?>">
<input type="hidden" name="csrf_token" <input type="hidden" name="csrf_token"
value="<?= htmlspecialchars($_SESSION['csrf_token'] ?? '') ?>"> value="<?= htmlspecialchars(
$_SESSION["csrf_token"] ?? "",
) ?>">
<div class="form-group"> <div class="form-group">
<label for="access-email">Votre adresse email :</label> <label for="access-email">Votre adresse email :</label>
@@ -287,58 +368,90 @@
}); });
})(); })();
</script> </script>
<?php elseif (!empty($data['files'])): ?> <?php elseif (!empty($data["files"])): ?>
<?php foreach ($data['files'] as $file): ?> <?php foreach ($data["files"] as $file): ?>
<?php <?php
$ext = strtolower(pathinfo($file['file_path'], PATHINFO_EXTENSION)); $ext = strtolower(
$fileType = $file['file_type'] ?? ''; pathinfo($file["file_path"], PATHINFO_EXTENSION),
if ($ext === 'vtt') continue; );
if ($fileType === 'cover') continue; $fileType = $file["file_type"] ?? "";
if ($ext === "vtt") {
continue;
}
if ($fileType === "cover") {
continue;
}
?> ?>
<figure> <figure>
<?php if ($ext === 'pdf'): ?> <?php if ($ext === "pdf"): ?>
<iframe src="/media?path=<?= urlencode($file['file_path']) ?>" <iframe src="/media?path=<?= urlencode(
$file["file_path"],
) ?>"
width="100%" height="700px" width="100%" height="700px"
style="border:none" style="border:none"
title="<?= htmlspecialchars($file['original_name'] ?? basename($file['file_path'])) ?>"> title="<?= htmlspecialchars(
$file["original_name"] ??
basename($file["file_path"]),
) ?>">
</iframe> </iframe>
<p class="tfe-pdf-fallback"> <p class="tfe-pdf-fallback">
<a href="/media?path=<?= urlencode($file['file_path']) ?>&download=1"> <a href="/media?path=<?= urlencode(
$file["file_path"],
) ?>&download=1">
Télécharger le PDF Télécharger le PDF
</a> </a>
</p> </p>
<?php elseif (in_array($ext, ['jpg','jpeg','png','gif','bmp','webp'])): ?> <?php elseif (
<img src="/media?path=<?= urlencode($file['file_path']) ?>" in_array($ext, [
"jpg",
"jpeg",
"png",
"gif",
"bmp",
"webp",
])
): ?>
<img src="/media?path=<?= urlencode(
$file["file_path"],
) ?>"
alt="<?= htmlspecialchars( alt="<?= htmlspecialchars(
!empty($file['description']) !empty($file["description"])
? $file['description'] ? $file["description"]
: ($data['title'] . ' — ' . ($data['authors'] ?? '')) : $data["title"] .
" — " .
($data["authors"] ?? ""),
) ?>"> ) ?>">
<?php elseif ($ext === 'mp4'): ?> <?php elseif ($ext === "mp4"): ?>
<?php <?php
$_vttPath = $captionFiles[$_videoIndex] ?? null; $_vttPath = $captionFiles[$_videoIndex] ?? null;
$_videoIndex++; $_videoIndex++;
?> ?>
<video width="100%" controls> <video width="100%" controls>
<source src="/media?path=<?= urlencode($file['file_path']) ?>" type="video/mp4"> <source src="/media?path=<?= urlencode(
$file["file_path"],
) ?>" type="video/mp4">
<?php if ($_vttPath): ?> <?php if ($_vttPath): ?>
<track kind="captions" <track kind="captions"
src="/media?path=<?= urlencode($_vttPath) ?>" src="/media?path=<?= urlencode(
$_vttPath,
) ?>"
srclang="fr" srclang="fr"
label="Sous-titres" label="Sous-titres"
default> default>
<?php endif; ?> <?php endif; ?>
</video> </video>
<?php endif; ?> <?php endif; ?>
<?php if (!empty($file['description'])): ?> <?php if (!empty($file["description"])): ?>
<figcaption><?= htmlspecialchars($file['description']) ?></figcaption> <figcaption><?= htmlspecialchars(
$file["description"],
) ?></figcaption>
<?php endif; ?> <?php endif; ?>
</figure> </figure>
<?php endforeach; ?> <?php endforeach; ?>
<?php else: ?> <?php else: ?>
<p class="tfe-no-files">Aucun fichier disponible pour ce TFE.</p> <p class="tfe-no-files">Aucun fichier disponible pour ce TFE.</p>
<?php endif; ?> <?php endif; ?>
</aside> </section>
</article> </article>
</main> </main>