mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-07 11:39:18 +02:00
86 lines
2.6 KiB
PHP
86 lines
2.6 KiB
PHP
<?php
|
|
require_once __DIR__ . "/../../bootstrap.php";
|
|
require_once __DIR__ . '/../../src/AdminAuth.php';
|
|
AdminAuth::requireLogin();
|
|
require_once __DIR__ . '/../../src/Database.php';
|
|
|
|
$pageTitle = "Contenus";
|
|
|
|
try {
|
|
$db = new Database();
|
|
$pages = $db->getAllPages();
|
|
$aproposKeys = $db->getAllAproposContents();
|
|
} catch (Exception $e) {
|
|
error_log("Error loading contenus: " . $e->getMessage());
|
|
die("Erreur lors du chargement des contenus.");
|
|
}
|
|
?>
|
|
<?php $isAdmin = true; $bodyClass = 'admin-body'; require_once APP_ROOT . '/templates/head.php'; ?>
|
|
<?php include APP_ROOT . '/templates/header.php'; ?>
|
|
|
|
<main id="main-content">
|
|
<h1>Contenus</h1>
|
|
|
|
|
|
|
|
<h2>Pages statiques</h2>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Slug</th>
|
|
<th scope="col">Titre</th>
|
|
<th scope="col">Mis à jour</th>
|
|
<th scope="col">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($pages as $p): ?>
|
|
<tr>
|
|
<td><code><?= htmlspecialchars($p['slug']) ?></code></td>
|
|
<td><?= htmlspecialchars($p['title']) ?></td>
|
|
<td><?= htmlspecialchars($p['updated_at'] ?? '—') ?></td>
|
|
<td>
|
|
<a href="/admin/contenus-edit.php?slug=<?= urlencode($p['slug']) ?>"
|
|
class="admin-btn admin-btn--sm">Éditer</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
|
|
<h2 style="margin-top:2rem;">À propos</h2>
|
|
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th scope="col">Clé</th>
|
|
<th scope="col">Type</th>
|
|
<th scope="col">Mis à jour</th>
|
|
<th scope="col">Action</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<?php foreach ($aproposKeys as $a): ?>
|
|
<?php
|
|
$typeLabel = match($a['key']) {
|
|
'contacts' => 'Contacts',
|
|
'credits' => 'Crédits',
|
|
};
|
|
?>
|
|
<tr>
|
|
<td><code><?= htmlspecialchars($a['key']) ?></code></td>
|
|
<td><?= htmlspecialchars($typeLabel) ?></td>
|
|
<td><?= htmlspecialchars($a['updated_at'] ?? '—') ?></td>
|
|
<td>
|
|
<a href="/admin/contenus-edit.php?apropos=<?= urlencode($a['key']) ?>"
|
|
class="admin-btn admin-btn--sm">Éditer</a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</main>
|
|
|
|
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|