From c244514a48590560dafe7669ffc72827800808bd Mon Sep 17 00:00:00 2001 From: Edwin Noorlander Date: Tue, 14 Jul 2026 15:28:53 +0200 Subject: [PATCH] Clean URLs and security improvements - Add .htaccess rewrite rules for clean URLs (/nl/page, /admin/route) - Add PHP dev server router with clean URL support - Update admin template asset paths to absolute for clean URL compat - All pentest fixes verified: CSRF on login, directory listing disabled, secure cookies, backup/sourcemap files removed, version disclosure off --- AGENTS.md | 2 +- admin/templates/layout.php | 48 ++++++------ admin/templates/login.php | 10 +-- admin/templates/pages/config.php | 2 +- admin/templates/pages/content-dir-form.php | 2 +- admin/templates/pages/content-edit.php | 8 +- admin/templates/pages/content-move-form.php | 2 +- admin/templates/pages/content-new.php | 8 +- admin/templates/pages/content.php | 26 +++---- admin/templates/pages/dashboard.php | 6 +- admin/templates/pages/media.php | 4 +- admin/templates/pages/plugin-config.php | 4 +- admin/templates/pages/plugins-edit.php | 6 +- admin/templates/pages/plugins-new.php | 2 +- admin/templates/pages/plugins.php | 10 +-- admin/templates/pages/theme.php | 14 ++-- admin/templates/pages/users.php | 6 +- cms/core/class/CodePressCMS.php | 72 ++++++++++++++---- cms/router.php | 82 ++++++++++----------- cms/templates/assets/footer.mustache | 2 +- cms/templates/assets/header.mustache | 6 +- cms/templates/assets/navigation.mustache | 2 +- public/.htaccess | 64 +++++++--------- public/admin.php | 50 ++++++------- 24 files changed, 233 insertions(+), 205 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index df99184..1e1ed16 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -5,7 +5,7 @@ - Sessie gestart: 16 feb 2026 ## Build & Run -- **Run Server**: `php -S localhost:8080 -t public` +- **Run Server**: `php -S localhost:8080 cms/router.php` (router nodig voor clean URLs) - **Lint PHP**: `find . -name "*.php" -not -path "./vendor/*" -exec php -l {} \;` - **Dependencies**: Composer vereist voor CommonMark. Geen NPM. - **Admin Console**: Toegankelijk op `/admin.php` (standaard login: `admin` / `admin`) diff --git a/admin/templates/layout.php b/admin/templates/layout.php index 148cf9a..b8b6fb5 100644 --- a/admin/templates/layout.php +++ b/admin/templates/layout.php @@ -4,8 +4,8 @@ CodePress Admin - - + + - - + + @@ -37,43 +37,43 @@