Add Charte static page (public + admin editing)

This commit is contained in:
Pontoporeia
2026-06-10 00:18:49 +02:00
parent 317547ac93
commit 4a2b000fca
10 changed files with 405 additions and 30 deletions
+42
View File
@@ -0,0 +1,42 @@
<?php
require_once APP_ROOT . '/src/Database.php';
require_once APP_ROOT . '/src/ErrorHandler.php';
require_once APP_ROOT . '/src/EmailObfuscator.php';
use League\CommonMark\CommonMarkConverter;
class CharteController
{
public static function create(): self
{
return new self();
}
public function handle(): array
{
try {
$db = Database::getInstance();
$dbPage = $db->getPage('charte');
$content = $dbPage ? $dbPage['content'] : '';
$pageTitle = $dbPage ? $dbPage['title'] : 'Charte';
} catch (Exception $e) {
ErrorHandler::log('charte_page', $e);
$content = '';
$pageTitle = 'Charte';
}
$converter = new CommonMarkConverter(['html_input' => 'strip']);
$html = EmailObfuscator::obfuscateHtml($converter->convert($content)->getContent());
return [
'content' => $content,
'html' => $html,
'pageTitle' => $pageTitle . ' XAMXAM',
'metaDescription' => "Charte d'utilisation de XAMXAM, le répertoire des TFE de l'erg.",
'currentNav' => 'charte',
'extraCss' => ['/assets/css/apropos.css'],
'bodyClass' => 'apropos-body',
];
}
}