mirror of
https://codeberg.org/PostERG/xamxam.git
synced 2026-05-06 19:19:19 +02:00
refactor: extract templates from public/
- Created /templates for main site (header.php, footer.php)
- Created /templates/admin for admin section (head.php, footer.php)
- Removed /public/includes and /public/admin/inc
- Updated all references in code and docs
- Tests passing ✅
Cleaner separation: /public only contains web-accessible files (PHP entry points + assets)
This commit is contained in:
@@ -57,7 +57,7 @@ function wasSelected($key, $value)
|
||||
return $formData[$key] == $value;
|
||||
}
|
||||
?>
|
||||
<?php require_once __DIR__ . "/inc/head.php"; ?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/head.php'; ?>
|
||||
<main>
|
||||
<?php if ($error): ?>
|
||||
<div class="error-message">
|
||||
@@ -260,4 +260,4 @@ function wasSelected($key, $value)
|
||||
</form>
|
||||
</main>
|
||||
|
||||
<?php require_once __DIR__ . "/inc/footer.php"; ?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|
||||
@@ -173,7 +173,7 @@ try {
|
||||
die("Erreur lors du chargement: " . $e->getMessage());
|
||||
}
|
||||
?>
|
||||
<?php require_once __DIR__ . '/inc/head.php'; ?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/head.php'; ?>
|
||||
|
||||
<main>
|
||||
<?php if ($error): ?>
|
||||
@@ -318,4 +318,4 @@ try {
|
||||
</form>
|
||||
</main>
|
||||
|
||||
<?php require_once __DIR__ . '/inc/footer.php'; ?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|
||||
|
||||
@@ -277,7 +277,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) {
|
||||
$_SESSION['csrf_token'] = bin2hex(random_bytes(32));
|
||||
}
|
||||
?>
|
||||
<?php require_once __DIR__ . '/inc/head.php'; ?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/head.php'; ?>
|
||||
|
||||
<main>
|
||||
<h2>Importer des TFE depuis un fichier CSV</h2>
|
||||
@@ -347,4 +347,4 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) {
|
||||
<p>Voir: <code>../db/Database_TFE_test.csv</code></p>
|
||||
</main>
|
||||
|
||||
<?php require_once __DIR__ . "/inc/footer.php"; ?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|
||||
@@ -1,6 +0,0 @@
|
||||
<footer>
|
||||
<p>Formulaire fait avec ❤ en PHP et <a href="https://watercss.kognise.dev/">Water.css</a>.</p>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,71 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title><?php echo htmlspecialchars($pageTitle ?? 'Admin'); ?> - Post-ERG</title>
|
||||
<link rel="stylesheet" href="/assets/modern-normalize.min.css">
|
||||
<link rel="stylesheet" href="/assets/admin.css">
|
||||
<link rel="shortcut icon" href="/assets/admin_favicon.svg" type="image/svg+xml">
|
||||
<?php if (php_sapi_name() === 'cli-server'): ?>
|
||||
<!-- Live reload for development -->
|
||||
<script>
|
||||
(function poll() {
|
||||
fetch('/live-reload.php')
|
||||
.then(r => r.json())
|
||||
.then(d => {
|
||||
if (d.changed) location.reload();
|
||||
else setTimeout(poll, 1000);
|
||||
})
|
||||
.catch(() => setTimeout(poll, 2000));
|
||||
})();
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<h1><?php echo htmlspecialchars($pageTitle ?? 'Admin'); ?></h1>
|
||||
<nav>
|
||||
<?php
|
||||
// Detect current page
|
||||
$currentPage = basename($_SERVER['PHP_SELF']);
|
||||
$thesisId = $_GET['id'] ?? null;
|
||||
|
||||
// Build navigation based on context
|
||||
$navLinks = [];
|
||||
|
||||
// Always show list
|
||||
if ($currentPage !== 'index.php') {
|
||||
$navLinks[] = '<a href="/admin/"><button>📋 Liste des TFE</button></a>';
|
||||
}
|
||||
|
||||
// Show add thesis if not on add page
|
||||
if ($currentPage !== 'add.php') {
|
||||
$navLinks[] = '<a href="/admin/add.php"><button>➕ Ajouter un TFE</button></a>';
|
||||
}
|
||||
|
||||
// Show import if not on import page
|
||||
if ($currentPage !== 'import.php') {
|
||||
$navLinks[] = '<a href="/admin/import.php"><button>📥 Importer CSV</button></a>';
|
||||
}
|
||||
|
||||
// If on edit or thanks page with thesis ID, show edit and view links
|
||||
if ($thesisId && in_array($currentPage, ['edit.php', 'thanks.php'])) {
|
||||
if ($currentPage !== 'edit.php') {
|
||||
$navLinks[] = '<a href="/admin/edit.php?id=' . intval($thesisId) . '"><button>✏️ Modifier</button></a>';
|
||||
}
|
||||
if ($currentPage !== 'thanks.php') {
|
||||
$navLinks[] = '<a href="/admin/thanks.php?id=' . intval($thesisId) . '"><button>👁️ Voir</button></a>';
|
||||
}
|
||||
}
|
||||
|
||||
echo implode(' ', $navLinks);
|
||||
?>
|
||||
<?php if (defined('ADMIN_PASSWORD_HASH')): ?>
|
||||
<a href="/admin/logout.php"><button>🔐 Déconnexion</button></a>
|
||||
<?php endif; ?>
|
||||
</nav>
|
||||
</header>
|
||||
@@ -77,7 +77,7 @@ try {
|
||||
}
|
||||
?>
|
||||
|
||||
<?php require_once __DIR__ . "/inc/head.php"; ?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/head.php'; ?>
|
||||
<script>
|
||||
function toggleAll(source) {
|
||||
const checkboxes = document.querySelectorAll('input[name="selected_theses[]"]');
|
||||
@@ -285,4 +285,4 @@ try {
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
|
||||
<?php require_once __DIR__ . "/inc/footer.php"; ?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|
||||
|
||||
@@ -71,7 +71,7 @@ function formatFileSize($bytes) {
|
||||
// Set page title for header
|
||||
$pageTitle = "Merci";
|
||||
?>
|
||||
<?php require_once __DIR__ . '/inc/head.php'; ?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/head.php'; ?>
|
||||
|
||||
<main>
|
||||
<?php if ($error): ?>
|
||||
@@ -198,4 +198,4 @@ $pageTitle = "Merci";
|
||||
<?php endif; ?>
|
||||
</main>
|
||||
|
||||
<?php require_once __DIR__ . '/inc/footer.php'; ?>
|
||||
<?php require_once APP_ROOT . '/templates/admin/footer.php'; ?>
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
<!-- footer.php -->
|
||||
<footer>
|
||||
<div>
|
||||
<button>Année</button>
|
||||
</div>
|
||||
<div>
|
||||
<button>Cursus</button>
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,46 +0,0 @@
|
||||
<!-- header.php -->
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="author" content="">
|
||||
<meta name="description" content="">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Posterg</title>
|
||||
<link rel="stylesheet" href="assets/modern-normalize.css">
|
||||
<link rel="stylesheet" href="assets/common.css">
|
||||
<link rel="stylesheet" href="assets/main.css">
|
||||
<?php if (php_sapi_name() === 'cli-server'): ?>
|
||||
<!-- Live reload for development -->
|
||||
<script>
|
||||
(function poll() {
|
||||
fetch('/live-reload.php')
|
||||
.then(r => r.json())
|
||||
.then(d => { if (d.changed) location.reload(); else setTimeout(poll, 1000); })
|
||||
.catch(() => setTimeout(poll, 2000));
|
||||
})();
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header>
|
||||
<a class="title" href="index.php">
|
||||
<h1>posterg</h1>
|
||||
</a>
|
||||
<section>
|
||||
<p class="apropos">
|
||||
Ce site post-ERG a été créé pour répertorier et valoriser les mémoires de l'ERG - École de Recherches Graphique de Bruxelles.
|
||||
L’objectif est à la fois d’offrir une vitrine aux projets des ancien·nes étudiant·es 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.
|
||||
</p>
|
||||
<p class="colophon">
|
||||
Design & développement : Olivia Marly, Théo Hennequin & Théophile Gervreau-Mercie
|
||||
Typographies : Ductus (Amélie Dumont), Hyphont-e
|
||||
</p>
|
||||
</section>
|
||||
<nav role="navigation" aria-label="main navigation">
|
||||
<button><a href="search.php"">Recherche</a></button>
|
||||
<button><a href=" search.php"">Partager</a></button>
|
||||
</nav>
|
||||
</header>
|
||||
@@ -19,7 +19,7 @@ try {
|
||||
$totalPages = 0;
|
||||
}
|
||||
|
||||
include APP_ROOT . '/public/includes/header.php';
|
||||
include APP_ROOT . '/templates/header.php';
|
||||
?>
|
||||
|
||||
<main>
|
||||
@@ -54,4 +54,4 @@ include APP_ROOT . '/public/includes/header.php';
|
||||
</nav>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php include APP_ROOT . '/public/includes/footer.php'; ?>
|
||||
<?php include APP_ROOT . '/templates/footer.php'; ?>
|
||||
|
||||
@@ -29,7 +29,7 @@ if (isset($_GET['id'])) {
|
||||
}
|
||||
|
||||
// Include the header template
|
||||
include APP_ROOT . '/public/includes/header.php'; ?>
|
||||
include APP_ROOT . '/templates/header.php'; ?>
|
||||
<main>
|
||||
<div class="item">
|
||||
<div class="card-content">
|
||||
@@ -151,4 +151,4 @@ include APP_ROOT . '/public/includes/header.php'; ?>
|
||||
</main>
|
||||
|
||||
<!-- Include the footer template -->
|
||||
<?php include APP_ROOT . '/public/includes/footer.php'; ?>
|
||||
<?php include APP_ROOT . '/templates/footer.php'; ?>
|
||||
@@ -16,7 +16,7 @@ if (!$rateLimit->check()) {
|
||||
$rateLimit->sendHeaders();
|
||||
|
||||
// Display error page
|
||||
include APP_ROOT . '/public/includes/header.php';
|
||||
include APP_ROOT . '/templates/header.php';
|
||||
echo '<section class="section">';
|
||||
echo ' <div class="container">';
|
||||
echo ' <div class="notification is-danger">';
|
||||
@@ -26,7 +26,7 @@ if (!$rateLimit->check()) {
|
||||
echo ' </div>';
|
||||
echo ' </div>';
|
||||
echo '</section>';
|
||||
include APP_ROOT . '/public/includes/footer.php';
|
||||
include APP_ROOT . '/templates/footer.php';
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -122,7 +122,7 @@ try {
|
||||
$languages = [];
|
||||
}
|
||||
|
||||
include APP_ROOT . '/public/includes/header.php'; ?>
|
||||
include APP_ROOT . '/templates/header.php'; ?>
|
||||
|
||||
<section class="section">
|
||||
<div class="container">
|
||||
@@ -415,4 +415,4 @@ include APP_ROOT . '/public/includes/header.php'; ?>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<?php include APP_ROOT . '/public/includes/footer.php'; ?>
|
||||
<?php include APP_ROOT . '/templates/footer.php'; ?>
|
||||
|
||||
Reference in New Issue
Block a user