From cee3345ea3c8b670e0ad211f8df60c462a65ba65 Mon Sep 17 00:00:00 2001
From: Pontoporeia
Date: Mon, 8 Jun 2026 11:35:53 +0200
Subject: [PATCH] tfe.php: afficher CC2r + licence, formater contact court,
supprimer download PDF
---
TODO.md | 5 +++++
app/storage/logs/admin-2026-06-08.log | 1 +
app/templates/public/tfe.php | 29 +++++++++++++++++++--------
3 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/TODO.md b/TODO.md
index 31de3e7..d6c963b 100644
--- a/TODO.md
+++ b/TODO.md
@@ -1,5 +1,7 @@
# TODO
+- [x] Fix htmx checkbox "Activer la restriction d'accès": add missing csrf_token in #fieldset-restrictions (fixes token invalide + full parametres.php injection)
+
- [x] Convert all file inputs to FilePond (CSV import, file-field.php; fix dialog init + missing CSS/JS on index page)
- [x] Fix `account.php`: replace `!==` CSRF token check with `hash_equals` (constant-time comparison)
- [x] Fix `ShareLink::setPassword()`: also encrypt and store plain-text password, matching `create()` behavior
@@ -16,3 +18,6 @@
- [x] Page TFE: corriger texte inclusif ("utilisateur·ices autorisé·es")
- [x] Page TFE: empêcher les mots-clés de se couper au milieu du mot lors du wrapping
- [x] Page TFE: rendre le texte des TFE internes/interdits éditable dans les paramètres
+- [x] Page TFE: afficher CC2r en plus de la licence choisie (ex: "CC2r, CC BY")
+- [x] Page TFE: formater le contact au plus court (stripper https://www., afficher @identifiant pour Instagram/Mastodon)
+- [x] Page TFE: supprimer le lien de téléchargement du PDF sous l'iframe
diff --git a/app/storage/logs/admin-2026-06-08.log b/app/storage/logs/admin-2026-06-08.log
index 24ac196..94608cd 100644
--- a/app/storage/logs/admin-2026-06-08.log
+++ b/app/storage/logs/admin-2026-06-08.log
@@ -1 +1,2 @@
{"timestamp":"2026-06-08T08:33:36+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","resource":"thesis","action":"publish","status":"success","context":{"count":143,"ids":[143,142,141,140,139,138,137,136,135,134,133,132,131,130,129,128,127,126,125,124,123,122,121,120,119,118,117,116,115,114,113,112,111,110,109,108,107,106,105,104,103,102,101,100,99,98,97,96,95,94,93,92,91,90,89,88,87,86,85,84,83,82,81,80,79,78,77,76,75,74,73,72,71,70,69,68,67,66,65,64,63,62,61,60,59,58,57,56,55,54,53,52,51,50,49,48,47,46,45,44,43,42,41,40,39,38,37,36,35,34,33,32,31,30,29,28,27,26,25,24,23,22,21,20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1]}}
+{"timestamp":"2026-06-08T09:24:44+00:00","ip":"127.0.0.1","user_agent":"Mozilla/5.0 (X11; Linux x86_64; rv:151.0) Gecko/20100101 Firefox/151.0","resource":"settings","action":"formulaire_update","status":"success","context":{"values":{"restricted_files_enabled":"0"}}}
diff --git a/app/templates/public/tfe.php b/app/templates/public/tfe.php
index b1d5433..8873ded 100644
--- a/app/templates/public/tfe.php
+++ b/app/templates/public/tfe.php
@@ -164,10 +164,13 @@
-
+
Licence :
- = htmlspecialchars($data["license_type"]) ?>
+ = htmlspecialchars(implode(", ", array_filter([$_cc2r ? "CC2r" : null, $_lic]))) ?>
@@ -185,9 +188,22 @@
$_contact = $data["contact_interne"];
$_isUrl = filter_var($_contact, FILTER_VALIDATE_URL) !== false;
$_isEmail = !$_isUrl && str_contains($_contact, "@");
- if ($_isUrl): ?>
+ if ($_isUrl):
+ $_host = parse_url($_contact, PHP_URL_HOST);
+ $_path = parse_url($_contact, PHP_URL_PATH) ?? '';
+ $_isInstagram = $_host && str_contains($_host, 'instagram.com');
+ $_isMastodon = $_path && str_contains($_path, '/@');
+ if ($_isInstagram):
+ $_username = trim($_path, '/');
+ $_display = $_username ? '@' . $_username : preg_replace("#^https?://(www\.)?#i", "", rtrim($_contact, "/"));
+ elseif ($_isMastodon):
+ $_username = trim($_path, '/@');
+ $_display = $_username ? '@' . $_username : preg_replace("#^https?://(www\.)?#i", "", rtrim($_contact, "/"));
+ else:
+ $_display = preg_replace("#^https?://(www\.)?#i", "", rtrim($_contact, "/"));
+ endif; ?>
- = htmlspecialchars(preg_replace("#^https?://#i", "", rtrim($_contact, "/"))) ?>
+ = htmlspecialchars($_display) ?>
(ouvre dans un nouvel onglet)
@@ -201,7 +217,7 @@
Lien :
@@ -326,9 +342,6 @@
style="border:none"
title="= $fileName ?>">
-
- Télécharger le PDF
-