refactor: reorganize to standard PHP structure

- Moved /lib → /src (PHP source code)
- Moved /includes → /public/includes (main site templates)
- Admin section remains self-contained in /public/admin with its own /inc
- Updated all require/include paths across codebase
- Updated config/bootstrap.php, justfile, tests, docs
- All tests passing 

Structure now follows PHP best practices:
  /config      - Configuration files
  /database    - SQLite database + schema
  /docs        - Documentation (intact)
  /nginx       - Server config (intact)
  /public      - Web-accessible files (entry point)
    /admin     - Self-contained admin interface
    /assets    - CSS, fonts, icons
    /includes  - Main site templates (header/footer)
  /scripts     - Deployment scripts (intact)
  /src         - PHP source classes (Database, AdminAuth, RateLimit)
  /tests       - Test suites
This commit is contained in:
Théophile Gervreau-Mercier
2026-02-12 12:11:16 +01:00
parent 0b650cd3e7
commit 0e4921583e
26 changed files with 40 additions and 42 deletions

View File

@@ -0,0 +1,12 @@
<!-- footer.php -->
<footer>
<div>
<button>Année</button>
</div>
<div>
<button>Cursus</button>
</div>
</footer>
</body>
</html>

View File

@@ -0,0 +1,46 @@
<!-- 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.
Lobjectif est à la fois doffrir 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 lhistoire 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>

View File

@@ -1,7 +1,7 @@
<?php
// Load configuration
require_once __DIR__ . '/../config/bootstrap.php';
require_once APP_ROOT . '/lib/Database.php';
require_once APP_ROOT . '/src/Database.php';
$pageTitle = "Liste des TFE";
$page = isset($_GET["page"]) ? intval($_GET["page"]) : 1;
@@ -19,7 +19,7 @@ try {
$totalPages = 0;
}
include APP_ROOT . '/includes/header.php';
include APP_ROOT . '/public/includes/header.php';
?>
<main>
@@ -54,4 +54,4 @@ include APP_ROOT . '/includes/header.php';
</nav>
<?php endif; ?>
<?php include APP_ROOT . '/includes/footer.php'; ?>
<?php include APP_ROOT . '/public/includes/footer.php'; ?>

View File

@@ -18,8 +18,7 @@ $root = dirname(__DIR__);
$watchDirs = [
$root . '/public',
$root . '/includes',
$root . '/lib',
$root . '/src',
$root . '/config',
];

View File

@@ -3,7 +3,7 @@
require_once __DIR__ . '/../config/bootstrap.php';
// Load required libraries and classes
require_once APP_ROOT . '/lib/Database.php';
require_once APP_ROOT . '/src/Database.php';
// Check if an id parameter is provided in the URL
if (isset($_GET['id'])) {
@@ -29,7 +29,7 @@ if (isset($_GET['id'])) {
}
// Include the header template
include APP_ROOT . '/includes/header.php'; ?>
include APP_ROOT . '/public/includes/header.php'; ?>
<main>
<div class="item">
<div class="card-content">
@@ -151,4 +151,4 @@ include APP_ROOT . '/includes/header.php'; ?>
</main>
<!-- Include the footer template -->
<?php include APP_ROOT . '/includes/footer.php'; ?>
<?php include APP_ROOT . '/public/includes/footer.php'; ?>

View File

@@ -1,8 +1,8 @@
<?php
// Bootstrap application
require_once __DIR__ . '/../config/bootstrap.php';
require_once APP_ROOT . '/lib/Database.php';
require_once APP_ROOT . '/lib/RateLimit.php';
require_once APP_ROOT . '/src/Database.php';
require_once APP_ROOT . '/src/RateLimit.php';
// Rate limiting: 30 requests per minute
@@ -16,7 +16,7 @@ if (!$rateLimit->check()) {
$rateLimit->sendHeaders();
// Display error page
include APP_ROOT . '/includes/header.php';
include APP_ROOT . '/public/includes/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 . '/includes/footer.php';
include APP_ROOT . '/public/includes/footer.php';
exit;
}
@@ -122,7 +122,7 @@ try {
$languages = [];
}
include APP_ROOT . '/includes/header.php'; ?>
include APP_ROOT . '/public/includes/header.php'; ?>
<section class="section">
<div class="container">
@@ -415,4 +415,4 @@ include APP_ROOT . '/includes/header.php'; ?>
</div>
</section>
<?php include APP_ROOT . '/includes/footer.php'; ?>
<?php include APP_ROOT . '/public/includes/footer.php'; ?>