diff --git a/TODO.md b/TODO.md index 5eb30d8..9e4c92f 100644 --- a/TODO.md +++ b/TODO.md @@ -452,16 +452,12 @@ Goal: rename the tables and column to the canonical M2M pattern (`tags`, `thesis ### D — Template structure / boilerplate duplication -- [ ] **Every public page duplicates its own ``** — `index.php`, `search.php`, `tfe.php`, - `apropos.php`, `licence.php` each contain an identical block: ``, - ``, ``, ``, ``, - ``, ``, live-reload script. Only `` and one - extra CSS `<link>` differ. Extract a `templates/public/head.php` partial accepting - `$pageTitle` and `$extraCss` — mirrors the pattern `templates/admin/head.php` already uses. +- [x] **Every public page duplicates its own `<head>`** — extracted to `templates/public/head.php` + accepting `$pageTitle` and `$extraCss`; all 5 public pages updated to use the partial. + Mirrors the pattern `templates/admin/head.php` already uses. -- [ ] **Live-reload snippet copy-pasted into 6 files** — `index.php`, `search.php`, `tfe.php`, - `apropos.php`, `licence.php`, `templates/admin/head.php` all contain the same 6-line - `(function poll(){…})()` block. Consolidate into the shared head partials. +- [x] **Live-reload snippet copy-pasted into 6 files** — consolidated into `templates/public/head.php`; + removed from `index.php`, `search.php`, `tfe.php`, `apropos.php`, `licence.php`. - [x] **`templates/header.php` and `templates/head.php` are dead files** — neither is `include`d anywhere in the codebase. Both contain outdated markup from a previous design iteration diff --git a/public/apropos.php b/public/apropos.php index 6755582..1f3fd43 100644 --- a/public/apropos.php +++ b/public/apropos.php @@ -24,27 +24,10 @@ try { $pd = new Parsedown(); $pd->setSafeMode(true); $aboutHtml = $pd->text($rawContent); +$pageTitle = 'À Propos – Posterg'; +$extraCss = ['assets/apropos.css']; ?> -<!DOCTYPE html> -<html lang="fr"> -<head> - <meta charset="UTF-8"> - <meta name="viewport" content="width=device-width, initial-scale=1"> - <title>À Propos – Posterg - - - - - - - - + diff --git a/public/index.php b/public/index.php index 95c82ac..372edcb 100644 --- a/public/index.php +++ b/public/index.php @@ -50,27 +50,10 @@ try { } $currentNav = ''; +$pageTitle = 'Posterg'; +$extraCss = ['assets/main.css']; ?> - - - - - - Posterg - - - - - - - - + diff --git a/public/licence.php b/public/licence.php index 7ee0ef5..46ff67b 100644 --- a/public/licence.php +++ b/public/licence.php @@ -7,39 +7,23 @@ $currentNav = 'licence'; try { $db = Database::getInstance(); - $page = $db->getPage('licenses'); - $content = $page ? $page['content'] : ''; - $pageTitle = $page ? $page['title'] : 'Licences'; + $dbPage = $db->getPage('licenses'); + $content = $dbPage ? $dbPage['content'] : ''; + $licencePageTitle = $dbPage ? $dbPage['title'] : 'Licences'; } catch (Exception $e) { error_log("Error loading licence page: " . $e->getMessage()); $content = ''; - $pageTitle = 'Licences'; + $licencePageTitle = 'Licences'; } $pd = new Parsedown(); $pd->setSafeMode(true); $html = $pd->text($content); + +$pageTitle = $licencePageTitle . ' – Posterg'; +$extraCss = ['assets/apropos.css']; ?> - - - - - - <?= htmlspecialchars($pageTitle) ?> – Posterg - - - - - - - - + diff --git a/public/search.php b/public/search.php index 18751e6..b763ed8 100644 --- a/public/search.php +++ b/public/search.php @@ -61,27 +61,10 @@ try { $currentNav = 'repertoire'; $searchBarValue = $_GET['query'] ?? ''; +$pageTitle = 'Répertoire – Posterg'; +$extraCss = ['assets/search.css']; ?> - - - - - - Répertoire – Posterg - - - - - - - - + diff --git a/public/tfe.php b/public/tfe.php index 9ed8342..1ff2089 100644 --- a/public/tfe.php +++ b/public/tfe.php @@ -17,27 +17,10 @@ if (isset($_GET['id'])) { } $currentNav = ''; +$pageTitle = $data['title'] . ' – Posterg'; +$extraCss = ['assets/tfe.css']; ?> - - - - - - <?= htmlspecialchars($data['title']) ?> – Posterg - - - - - - - - + diff --git a/src/cache/rate_limit/ad921d60486366258809553a3db49a4a.json b/src/cache/rate_limit/ad921d60486366258809553a3db49a4a.json index d02218c..52d28aa 100644 --- a/src/cache/rate_limit/ad921d60486366258809553a3db49a4a.json +++ b/src/cache/rate_limit/ad921d60486366258809553a3db49a4a.json @@ -1 +1 @@ -[1774702347] \ No newline at end of file +[1774712930] \ No newline at end of file diff --git a/storage/test.db b/storage/test.db index 01a9fda..ae94255 100644 Binary files a/storage/test.db and b/storage/test.db differ diff --git a/templates/public/head.php b/templates/public/head.php new file mode 100644 index 0000000..6e35683 --- /dev/null +++ b/templates/public/head.php @@ -0,0 +1,22 @@ + + + + + + <?= htmlspecialchars($pageTitle ?? 'Posterg') ?> + + + + + + + + + +