From 87971f9c2318e1b0ee7dcb16d1ca07c3fe14fa50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9ophile=20Gervreau-Mercier?= Date: Thu, 12 Feb 2026 12:15:41 +0100 Subject: [PATCH] refactor: extract templates from public/ MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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) --- config/bootstrap.php | 2 +- docs/SECURITY_ANALYSIS.md | 2 +- public/admin/add.php | 4 ++-- public/admin/edit.php | 4 ++-- public/admin/import.php | 4 ++-- public/admin/index.php | 4 ++-- public/admin/thanks.php | 4 ++-- public/index.php | 4 ++-- public/memoire.php | 4 ++-- public/search.php | 8 ++++---- .../rate_limit/ad921d60486366258809553a3db49a4a.json | 2 +- {public/admin/inc => templates/admin}/footer.php | 0 {public/admin/inc => templates/admin}/head.php | 0 {public/includes => templates}/footer.php | 0 {public/includes => templates}/header.php | 0 15 files changed, 21 insertions(+), 21 deletions(-) rename {public/admin/inc => templates/admin}/footer.php (100%) rename {public/admin/inc => templates/admin}/head.php (100%) rename {public/includes => templates}/footer.php (100%) rename {public/includes => templates}/header.php (100%) diff --git a/config/bootstrap.php b/config/bootstrap.php index 4327e68..82de8a5 100644 --- a/config/bootstrap.php +++ b/config/bootstrap.php @@ -25,7 +25,7 @@ if (php_sapi_name() === 'cli-server') { // Simple helper function for including templates function include_template($name) { - $path = APP_ROOT . '/public/includes/' . $name; + $path = APP_ROOT . '/templates/' . $name; if (file_exists($path)) { include $path; } diff --git a/docs/SECURITY_ANALYSIS.md b/docs/SECURITY_ANALYSIS.md index 5e63902..cb5a80b 100644 --- a/docs/SECURITY_ANALYSIS.md +++ b/docs/SECURITY_ANALYSIS.md @@ -254,7 +254,7 @@ ini_set('error_log', '/var/log/posterg/error.log'); ### 10. External CDN Stylesheet Without Subresource Integrity (SRI) -**File:** `public/admin/inc/head.php` +**File:** `templates/admin/head.php` ```html diff --git a/public/admin/add.php b/public/admin/add.php index 4586bc9..790e6ca 100644 --- a/public/admin/add.php +++ b/public/admin/add.php @@ -57,7 +57,7 @@ function wasSelected($key, $value) return $formData[$key] == $value; } ?> - +
@@ -260,4 +260,4 @@ function wasSelected($key, $value)
- \ No newline at end of file + \ No newline at end of file diff --git a/public/admin/edit.php b/public/admin/edit.php index 2118e6d..3f502f2 100644 --- a/public/admin/edit.php +++ b/public/admin/edit.php @@ -173,7 +173,7 @@ try { die("Erreur lors du chargement: " . $e->getMessage()); } ?> - +
@@ -318,4 +318,4 @@ try {
- + diff --git a/public/admin/import.php b/public/admin/import.php index fd8ab78..3fbd4ea 100644 --- a/public/admin/import.php +++ b/public/admin/import.php @@ -277,7 +277,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) { $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); } ?> - +

Importer des TFE depuis un fichier CSV

@@ -347,4 +347,4 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['csv_file'])) {

Voir: ../db/Database_TFE_test.csv

- \ No newline at end of file + \ No newline at end of file diff --git a/public/admin/index.php b/public/admin/index.php index 3d30dcb..d9b619e 100644 --- a/public/admin/index.php +++ b/public/admin/index.php @@ -77,7 +77,7 @@ try { } ?> - +