mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-07 11:39:18 +02:00
Names, roles, emails, and credits on the À propos page were hardcoded directly in apropos.php HTML. To update a contact meant editing a template file — risky for non-developers and easy to introduce a typo or broken mailto link. Changes: - config/apropos.php: new config array with erg_url, contacts[] (name, role, email per person) and credits[] (label/value pairs); follows the same pattern as config/admin_credentials.php - public/apropos.php: loads config via require; aside section now loops over $apropos['contacts'] and $apropos['credits'] with htmlspecialchars throughout; hardcoded HTML strings removed entirely Also audited todo/02-php-components.md and marked 8 stale items as done: all 5 form field partials were already implemented and in use, the flash-message consolidation was already handled by App::consumeFlash(), and the RateLimit cache dir was already at storage/cache/rate_limit (excluded from deploy rsync).
92 lines
3.7 KiB
PHP
92 lines
3.7 KiB
PHP
<?php
|
||
require_once __DIR__ . '/../config/bootstrap.php';
|
||
require_once APP_ROOT . '/src/Database.php';
|
||
require_once APP_ROOT . '/src/Parsedown.php';
|
||
|
||
$apropos = require APP_ROOT . '/config/apropos.php';
|
||
|
||
$currentNav = 'apropos';
|
||
|
||
// Fallback static content used when DB content is the placeholder
|
||
define('APROPOS_STATIC_CONTENT', "Ce site POSTERG a été créé pour répertorier et valoriser les mémoires de l'erg – École de Recherches Graphique de Bruxelles.\n\nL'objectif est à la fois d'offrir une vitrine aux projets des anciens étudiantes et de mettre en lumière la diversité des disciplines et des parcours qui façonnent l'histoire de l'école à travers les âges, depuis près de 100 ans.");
|
||
|
||
try {
|
||
$db = Database::getInstance();
|
||
$aboutPage = $db->getPage('about');
|
||
$rawContent = $aboutPage ? $aboutPage['content'] : '';
|
||
// Use static fallback if content is placeholder
|
||
if (empty(trim($rawContent)) || trim($rawContent) === 'Contenu à venir') {
|
||
$rawContent = APROPOS_STATIC_CONTENT;
|
||
}
|
||
} catch (Exception $e) {
|
||
error_log("Error loading about page: " . $e->getMessage());
|
||
$rawContent = APROPOS_STATIC_CONTENT;
|
||
}
|
||
|
||
$pd = new Parsedown();
|
||
$pd->setSafeMode(true);
|
||
$aboutHtml = $pd->text($rawContent);
|
||
$pageTitle = 'À Propos – Posterg';
|
||
$metaDescription = 'À propos de Posterg, le répertoire des mémoires de fin d\'études de l\'erg – École de Recherches Graphiques de Bruxelles.';
|
||
$ogTags = [
|
||
'type' => 'website',
|
||
'title' => $pageTitle,
|
||
'description' => $metaDescription,
|
||
'url' => 'https://posterg.erg.be/apropos.php',
|
||
'site_name' => 'Posterg – ERG',
|
||
];
|
||
$extraCss = ['/assets/css/apropos.css'];
|
||
$bodyClass = 'apropos-body';
|
||
?>
|
||
<?php include APP_ROOT . '/templates/head.php'; ?>
|
||
<?php include APP_ROOT . '/templates/header.php'; ?>
|
||
|
||
<main class="apropos-main" id="main-content">
|
||
<div class="apropos-layout">
|
||
|
||
<!-- LEFT: main text (from DB, Markdown-rendered) -->
|
||
<div class="prose">
|
||
<?= $aboutHtml ?>
|
||
</div>
|
||
|
||
<!-- RIGHT: links, contacts, credits (data from config/apropos.php) -->
|
||
<aside class="apropos-aside">
|
||
|
||
<section>
|
||
<h2 class="apropos-section-title">
|
||
<a href="<?= htmlspecialchars($apropos['erg_url']) ?>" target="_blank" rel="noopener">Site de l'erg</a>
|
||
</h2>
|
||
</section>
|
||
|
||
<?php if (!empty($apropos['contacts'])): ?>
|
||
<section>
|
||
<h2 class="apropos-section-title">Contacts</h2>
|
||
|
||
<?php foreach ($apropos['contacts'] as $contact): ?>
|
||
<address>
|
||
<strong><?= htmlspecialchars($contact['name']) ?></strong>
|
||
<span><?= htmlspecialchars($contact['role']) ?></span>
|
||
<a href="mailto:<?= htmlspecialchars($contact['email']) ?>"><?= htmlspecialchars($contact['email']) ?></a>
|
||
</address>
|
||
<?php endforeach; ?>
|
||
</section>
|
||
<?php endif; ?>
|
||
|
||
<?php if (!empty($apropos['credits'])): ?>
|
||
<section>
|
||
<h2 class="apropos-section-title">Crédits</h2>
|
||
<?php foreach ($apropos['credits'] as $credit): ?>
|
||
<p class="apropos-credits-text">
|
||
<?= htmlspecialchars($credit['label']) ?> : <?= htmlspecialchars($credit['value']) ?>
|
||
</p>
|
||
<?php endforeach; ?>
|
||
</section>
|
||
<?php endif; ?>
|
||
|
||
</aside>
|
||
|
||
</div>
|
||
</main>
|
||
|
||
<?php include APP_ROOT . '/templates/footer.php'; ?>
|