mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-06-25 16:19:19 +02:00
Added EmailObfuscator class (src/EmailObfuscator.php) that converts email addresses to HTML decimal entities (e.g. foo@...) so browsers render them correctly but bots and scrapers see gibberish. Methods: - email($addr): obfuscate for display in HTML content - mailto($addr): return obfuscated mailto: href - obfuscateHtml($html): post-process rendered HTML to obfuscate all mailto: links (used after Parsedown/Markdown rendering) Applied to: - partage/index.php: mailto link at top + error scenarios via _flash_contact flag rendered in form.php (outside htmlspecialchars to avoid double-escape) - admin/acces.php: request email mailto links - admin/file-access.php: request email mailto links - public/about.php: contact email mailto links - public/tfe.php: author contact mailto links - AboutController: Parsedown output post-processing - LicenceController: Parsedown output post-processing - Dispatcher::render(): require_once EmailObfuscator for all public views Also fixed _flash_contact session flag in form.php partial to show contact email line on share link validation errors (separate from flash_error/warning to bypass htmlspecialchars double-escaping).
34 lines
1.6 KiB
PHP
34 lines
1.6 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../../bootstrap.php';
|
|
require_once __DIR__ . '/../../src/AdminAuth.php';
|
|
require_once __DIR__ . '/../../src/ShareLink.php';
|
|
require_once APP_ROOT . '/src/EmailObfuscator.php';
|
|
|
|
App::adminGuard();
|
|
|
|
// ── Liens d'accès étudiant·e ──────────────────────────────────────────────────
|
|
$shareLink = ShareLink::make();
|
|
$links = $shareLink->listActive();
|
|
$archivedLinks = $shareLink->listArchived();
|
|
|
|
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
|
|
$baseUrl = $protocol . '://' . ($_SERVER['HTTP_HOST'] ?? 'localhost');
|
|
|
|
// ── Demandes d'accès aux fichiers ─────────────────────────────────────────────
|
|
require_once APP_ROOT . '/src/Controllers/FileAccessController.php';
|
|
|
|
$controller = FileAccessController::create();
|
|
$vars = $controller->handle();
|
|
extract($vars);
|
|
|
|
// ── Page setup ────────────────────────────────────────────────────────────────
|
|
$pageTitle = 'Accès';
|
|
$isAdmin = true;
|
|
$bodyClass = 'admin-body';
|
|
|
|
require_once APP_ROOT . '/templates/head.php';
|
|
echo '<link rel="stylesheet" href="/assets/css/file-access.css">';
|
|
include APP_ROOT . '/templates/header.php';
|
|
include APP_ROOT . '/templates/admin/acces.php';
|
|
require_once APP_ROOT . '/templates/admin/footer.php';
|