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
This commit is contained in:
2026-07-14 15:28:53 +02:00
parent 98f74b2861
commit c244514a48
24 changed files with 233 additions and 205 deletions
+1 -1
View File
@@ -5,7 +5,7 @@
- Sessie gestart: 16 feb 2026 - Sessie gestart: 16 feb 2026
## Build & Run ## 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 {} \;` - **Lint PHP**: `find . -name "*.php" -not -path "./vendor/*" -exec php -l {} \;`
- **Dependencies**: Composer vereist voor CommonMark. Geen NPM. - **Dependencies**: Composer vereist voor CommonMark. Geen NPM.
- **Admin Console**: Toegankelijk op `/admin.php` (standaard login: `admin` / `admin`) - **Admin Console**: Toegankelijk op `/admin.php` (standaard login: `admin` / `admin`)
+24 -24
View File
@@ -4,8 +4,8 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CodePress Admin</title> <title>CodePress Admin</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css"> <link rel="stylesheet" href="/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/bootstrap-icons.css"> <link rel="stylesheet" href="/assets/css/bootstrap-icons.css">
<style> <style>
body { background-color: #f5f6fa; min-height: 100vh; } body { background-color: #f5f6fa; min-height: 100vh; }
.admin-sidebar { background-color: #0a369d; min-height: 100vh; width: 240px; position: fixed; top: 0; left: 0; z-index: 100; } .admin-sidebar { background-color: #0a369d; min-height: 100vh; width: 240px; position: fixed; top: 0; left: 0; z-index: 100; }
@@ -25,8 +25,8 @@
} }
</style> </style>
<?php if (in_array($route ?? '', ['content-edit', 'content-new', 'plugins-edit'])): ?> <?php if (in_array($route ?? '', ['content-edit', 'content-new', 'plugins-edit'])): ?>
<link rel="stylesheet" href="assets/codemirror/codemirror.min.css"> <link rel="stylesheet" href="/assets/codemirror/codemirror.min.css">
<link rel="stylesheet" href="assets/css/editor.css"> <link rel="stylesheet" href="/assets/css/editor.css">
<?php endif; ?> <?php endif; ?>
</head> </head>
<body> <body>
@@ -37,43 +37,43 @@
</div> </div>
<ul class="nav flex-column mt-2"> <ul class="nav flex-column mt-2">
<li class="nav-item"> <li class="nav-item">
<a class="nav-link <?= ($route ?? '') === 'dashboard' || ($route ?? '') === '' ? 'active' : '' ?>" href="admin.php?route=dashboard"> <a class="nav-link <?= ($route ?? '') === 'dashboard' || ($route ?? '') === '' ? 'active' : '' ?>" href="/admin/dashboard">
<i class="bi bi-speedometer2"></i> Dashboard <i class="bi bi-speedometer2"></i> Dashboard
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link <?= ($route ?? '') === 'content' || str_starts_with($route ?? '', 'content') ? 'active' : '' ?>" href="admin.php?route=content"> <a class="nav-link <?= ($route ?? '') === 'content' || str_starts_with($route ?? '', 'content') ? 'active' : '' ?>" href="/admin/content">
<i class="bi bi-file-earmark-text"></i> Content <i class="bi bi-file-earmark-text"></i> Content
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link <?= ($route ?? '') === 'theme' ? 'active' : '' ?>" href="admin.php?route=theme"> <a class="nav-link <?= ($route ?? '') === 'theme' ? 'active' : '' ?>" href="/admin/theme">
<i class="bi bi-palette"></i> Thema <i class="bi bi-palette"></i> Thema
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link <?= ($route ?? '') === 'config' ? 'active' : '' ?>" href="admin.php?route=config"> <a class="nav-link <?= ($route ?? '') === 'config' ? 'active' : '' ?>" href="/admin/config">
<i class="bi bi-sliders"></i> Configuratie <i class="bi bi-sliders"></i> Configuratie
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link <?= ($route ?? '') === 'plugins' ? 'active' : '' ?>" href="admin.php?route=plugins"> <a class="nav-link <?= ($route ?? '') === 'plugins' ? 'active' : '' ?>" href="/admin/plugins">
<i class="bi bi-plug"></i> Plugins <i class="bi bi-plug"></i> Plugins
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link <?= ($route ?? '') === 'users' ? 'active' : '' ?>" href="admin.php?route=users"> <a class="nav-link <?= ($route ?? '') === 'users' ? 'active' : '' ?>" href="/admin/users">
<i class="bi bi-people"></i> Gebruikers <i class="bi bi-people"></i> Gebruikers
</a> </a>
</li> </li>
<li class="nav-item mt-3"> <li class="nav-item mt-3">
<a class="nav-link" href="index.php" target="_blank"> <a class="nav-link" href="/" target="_blank">
<i class="bi bi-box-arrow-up-right"></i> Website bekijken <i class="bi bi-box-arrow-up-right"></i> Website bekijken
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link text-warning" href="admin.php?route=logout"> <a class="nav-link text-warning" href="/admin/logout">
<i class="bi bi-box-arrow-left"></i> Uitloggen <i class="bi bi-box-arrow-left"></i> Uitloggen
</a> </a>
</li> </li>
@@ -147,19 +147,19 @@
?> ?>
</main> </main>
<script src="assets/js/bootstrap.bundle.min.js"></script> <script src="/assets/js/bootstrap.bundle.min.js"></script>
<?php if (in_array($route ?? '', ['content-edit', 'content-new', 'plugins-edit'])): ?> <?php if (in_array($route ?? '', ['content-edit', 'content-new', 'plugins-edit'])): ?>
<script src="assets/codemirror/codemirror.min.js"></script> <script src="/assets/codemirror/codemirror.min.js"></script>
<script src="assets/codemirror/mode/markdown.min.js"></script> <script src="/assets/codemirror/mode/markdown.min.js"></script>
<script src="assets/codemirror/mode/xml.min.js"></script> <script src="/assets/codemirror/mode/xml.min.js"></script>
<script src="assets/codemirror/mode/htmlmixed.min.js"></script> <script src="/assets/codemirror/mode/htmlmixed.min.js"></script>
<script src="assets/codemirror/mode/php.min.js"></script> <script src="/assets/codemirror/mode/php.min.js"></script>
<script src="assets/codemirror/mode/clike.min.js"></script> <script src="/assets/codemirror/mode/clike.min.js"></script>
<script src="assets/codemirror/mode/css.min.js"></script> <script src="/assets/codemirror/mode/css.min.js"></script>
<script src="assets/codemirror/mode/javascript.min.js"></script> <script src="/assets/codemirror/mode/javascript.min.js"></script>
<script src="assets/codemirror/addon/edit/closebrackets.min.js"></script> <script src="/assets/codemirror/addon/edit/closebrackets.min.js"></script>
<script src="assets/codemirror/addon/selection/active-line.min.js"></script> <script src="/assets/codemirror/addon/selection/active-line.min.js"></script>
<script src="assets/js/editor-toolbar.js"></script> <script src="/assets/js/editor-toolbar.js"></script>
<?php endif; ?> <?php endif; ?>
</body> </body>
</html> </html>
+5 -5
View File
@@ -4,8 +4,8 @@
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>CodePress Admin - Login</title> <title>CodePress Admin - Login</title>
<link rel="stylesheet" href="assets/css/bootstrap.min.css"> <link rel="stylesheet" href="/assets/css/bootstrap.min.css">
<link rel="stylesheet" href="assets/css/bootstrap-icons.css"> <link rel="stylesheet" href="/assets/css/bootstrap-icons.css">
<style> <style>
body { background-color: #f5f6fa; } body { background-color: #f5f6fa; }
.login-card { max-width: 400px; margin: 10vh auto; } .login-card { max-width: 400px; margin: 10vh auto; }
@@ -26,7 +26,7 @@
<button type="button" class="btn-close" data-bs-dismiss="alert"></button> <button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div> </div>
<?php endif; ?> <?php endif; ?>
<form method="POST" action="admin.php?route=login"> <form method="POST" action="/admin/login">
<input type="hidden" name="csrf_token" value="<?= htmlspecialchars($csrfToken) ?>"> <input type="hidden" name="csrf_token" value="<?= htmlspecialchars($csrfToken) ?>">
<div class="mb-3"> <div class="mb-3">
<label for="username" class="form-label">Gebruikersnaam</label> <label for="username" class="form-label">Gebruikersnaam</label>
@@ -51,10 +51,10 @@
</div> </div>
</div> </div>
<p class="text-center text-muted mt-3 small"> <p class="text-center text-muted mt-3 small">
<a href="index.php" class="text-decoration-none"><i class="bi bi-arrow-left"></i> Terug naar website</a> <a href="/" class="text-decoration-none"><i class="bi bi-arrow-left"></i> Terug naar website</a>
</p> </p>
</div> </div>
</div> </div>
<script src="assets/js/bootstrap.bundle.min.js"></script> <script src="/assets/js/bootstrap.bundle.min.js"></script>
</body> </body>
</html> </html>
+1 -1
View File
@@ -5,7 +5,7 @@
<i class="bi bi-filetype-json"></i> config.json <i class="bi bi-filetype-json"></i> config.json
</div> </div>
<div class="card-body"> <div class="card-body">
<form method="POST" action="admin.php?route=config"> <form method="POST" action="/admin/config">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<div class="mb-3"> <div class="mb-3">
<textarea name="config_content" class="form-control font-monospace" rows="25" style="font-size: 0.9rem; tab-size: 4;"><?= htmlspecialchars($siteConfig) ?></textarea> <textarea name="config_content" class="form-control font-monospace" rows="25" style="font-size: 0.9rem; tab-size: 4;"><?= htmlspecialchars($siteConfig) ?></textarea>
+1 -1
View File
@@ -20,7 +20,7 @@
</div> </div>
<div class="card-footer text-end"> <div class="card-footer text-end">
<a href="admin.php?route=content&dir=<?= urlencode(dirname($dir) === '.' ? '' : dirname($dir)) ?>" class="btn btn-secondary">Annuleren</a> <a href="/admin/content&dir=<?= urlencode(dirname($dir) === '.' ? '' : dirname($dir)) ?>" class="btn btn-secondary">Annuleren</a>
<button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> Opslaan</button> <button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> Opslaan</button>
</div> </div>
</form> </form>
+4 -4
View File
@@ -2,7 +2,7 @@
<div class="card shadow-sm"> <div class="card shadow-sm">
<div class="card-body"> <div class="card-body">
<form method="POST" action="admin.php?route=content-edit&file=<?= urlencode($file) ?>" id="editor-form"> <form method="POST" action="/admin/content-edit&file=<?= urlencode($file) ?>" id="editor-form">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<div class="row mb-3"> <div class="row mb-3">
<div class="col-md-4"> <div class="col-md-4">
@@ -48,7 +48,7 @@
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
<i class="bi bi-check-lg"></i> Opslaan <i class="bi bi-check-lg"></i> Opslaan
</button> </button>
<a href="admin.php?route=content&dir=<?= urlencode(dirname($file)) ?>" class="btn btn-outline-secondary" id="back-btn">Terug</a> <a href="/admin/content&dir=<?= urlencode(dirname($file)) ?>" class="btn btn-outline-secondary" id="back-btn">Terug</a>
</div> </div>
</form> </form>
</div> </div>
@@ -172,7 +172,7 @@ document.addEventListener('DOMContentLoaded', function () {
document.getElementById('media-size-form').classList.add('d-none'); document.getElementById('media-size-form').classList.add('d-none');
document.getElementById('media-grid').classList.remove('d-none'); document.getElementById('media-grid').classList.remove('d-none');
pendingFile = null; pendingFile = null;
fetch('admin.php?route=media-list') fetch('/admin/media-list')
.then(function (r) { return r.json(); }) .then(function (r) { return r.json(); })
.then(function (files) { .then(function (files) {
var grid = document.getElementById('media-grid'); var grid = document.getElementById('media-grid');
@@ -288,7 +288,7 @@ document.addEventListener('DOMContentLoaded', function () {
var formData = new FormData(form); var formData = new FormData(form);
formData.append('csrf_token', '<?= $csrf ?>'); formData.append('csrf_token', '<?= $csrf ?>');
fetch('admin.php?route=media', { method: 'POST', body: formData }) fetch('/admin/media', { method: 'POST', body: formData })
.then(function () { .then(function () {
form.reset(); form.reset();
document.getElementById('media-upload-btn').disabled = true; document.getElementById('media-upload-btn').disabled = true;
+1 -1
View File
@@ -28,7 +28,7 @@
</div> </div>
<div class="card-footer text-end"> <div class="card-footer text-end">
<a href="admin.php?route=content&dir=<?= urlencode(dirname($item) === '.' ? '' : dirname($item)) ?>" class="btn btn-secondary">Annuleren</a> <a href="/admin/content&dir=<?= urlencode(dirname($item) === '.' ? '' : dirname($item)) ?>" class="btn btn-secondary">Annuleren</a>
<button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> Verplaatsen</button> <button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> Verplaatsen</button>
</div> </div>
</form> </form>
+4 -4
View File
@@ -2,7 +2,7 @@
<div class="card shadow-sm"> <div class="card shadow-sm">
<div class="card-body"> <div class="card-body">
<form method="POST" action="admin.php?route=content-new&dir=<?= urlencode($dir ?? '') ?>" id="editor-form" data-new-page> <form method="POST" action="/admin/content-new&dir=<?= urlencode($dir ?? '') ?>" id="editor-form" data-new-page>
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<div class="row mb-3"> <div class="row mb-3">
<div class="col-md-8"> <div class="col-md-8">
@@ -55,7 +55,7 @@
<button type="submit" class="btn btn-primary" id="content-create-btn" disabled> <button type="submit" class="btn btn-primary" id="content-create-btn" disabled>
<i class="bi bi-check-lg"></i> Aanmaken <i class="bi bi-check-lg"></i> Aanmaken
</button> </button>
<a href="admin.php?route=content&dir=<?= urlencode($dir ?? '') ?>" class="btn btn-outline-secondary" id="back-btn">Terug</a> <a href="/admin/content&dir=<?= urlencode($dir ?? '') ?>" class="btn btn-outline-secondary" id="back-btn">Terug</a>
</div> </div>
</form> </form>
</div> </div>
@@ -174,7 +174,7 @@ document.addEventListener('DOMContentLoaded', function () {
document.getElementById('media-size-form').classList.add('d-none'); document.getElementById('media-size-form').classList.add('d-none');
document.getElementById('media-grid').classList.remove('d-none'); document.getElementById('media-grid').classList.remove('d-none');
pendingFile = null; pendingFile = null;
fetch('admin.php?route=media-list') fetch('/admin/media-list')
.then(function (r) { return r.json(); }) .then(function (r) { return r.json(); })
.then(function (files) { .then(function (files) {
var grid = document.getElementById('media-grid'); var grid = document.getElementById('media-grid');
@@ -289,7 +289,7 @@ document.addEventListener('DOMContentLoaded', function () {
var formData = new FormData(form); var formData = new FormData(form);
formData.append('csrf_token', '<?= $csrf ?>'); formData.append('csrf_token', '<?= $csrf ?>');
fetch('admin.php?route=media', { method: 'POST', body: formData }) fetch('/admin/media', { method: 'POST', body: formData })
.then(function () { .then(function () {
form.reset(); form.reset();
document.getElementById('media-upload-btn').disabled = true; document.getElementById('media-upload-btn').disabled = true;
+13 -13
View File
@@ -7,7 +7,7 @@
<button type="button" class="btn btn-outline-secondary btn-sm me-1" data-bs-toggle="modal" data-bs-target="#createDirModal"> <button type="button" class="btn btn-outline-secondary btn-sm me-1" data-bs-toggle="modal" data-bs-target="#createDirModal">
<i class="bi bi-folder-plus"></i> Nieuwe map <i class="bi bi-folder-plus"></i> Nieuwe map
</button> </button>
<a href="admin.php?route=content-new&dir=<?= urlencode($subdir) ?>" class="btn btn-primary btn-sm"> <a href="/admin/content-new&dir=<?= urlencode($subdir) ?>" class="btn btn-primary btn-sm">
<i class="bi bi-plus-lg"></i> Nieuw bestand <i class="bi bi-plus-lg"></i> Nieuw bestand
</a> </a>
</div> </div>
@@ -16,7 +16,7 @@
<div class="collapse mb-4" id="uploadForm"> <div class="collapse mb-4" id="uploadForm">
<div class="card shadow-sm"> <div class="card shadow-sm">
<div class="card-body"> <div class="card-body">
<form method="POST" action="admin.php?route=content&dir=<?= urlencode($subdir) ?>" enctype="multipart/form-data"> <form method="POST" action="/admin/content&dir=<?= urlencode($subdir) ?>" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<div class="mb-3"> <div class="mb-3">
<label for="file" class="form-label">Bestanden selecteren</label> <label for="file" class="form-label">Bestanden selecteren</label>
@@ -38,7 +38,7 @@
?> ?>
<nav aria-label="breadcrumb" class="mb-3"> <nav aria-label="breadcrumb" class="mb-3">
<ol class="breadcrumb"> <ol class="breadcrumb">
<li class="breadcrumb-item"><a href="admin.php?route=content"><i class="bi bi-house"></i></a></li> <li class="breadcrumb-item"><a href="/admin/content"><i class="bi bi-house"></i></a></li>
<?php <?php
$crumbPath = ''; $crumbPath = '';
foreach (explode('/', $subdir) as $i => $crumb): foreach (explode('/', $subdir) as $i => $crumb):
@@ -48,7 +48,7 @@
<?php if ($crumbPath === $subdir): ?> <?php if ($crumbPath === $subdir): ?>
<?= htmlspecialchars($crumb) ?> <?= htmlspecialchars($crumb) ?>
<?php else: ?> <?php else: ?>
<a href="admin.php?route=content&dir=<?= urlencode($crumbPath) ?>"><?= htmlspecialchars($crumb) ?></a> <a href="/admin/content&dir=<?= urlencode($crumbPath) ?>"><?= htmlspecialchars($crumb) ?></a>
<?php endif; ?> <?php endif; ?>
</li> </li>
<?php endforeach; ?> <?php endforeach; ?>
@@ -76,11 +76,11 @@
<tr> <tr>
<td> <td>
<?php if ($item['is_dir']): ?> <?php if ($item['is_dir']): ?>
<a href="admin.php?route=content&dir=<?= urlencode($item['path']) ?>"> <a href="/admin/content&dir=<?= urlencode($item['path']) ?>">
<i class="bi bi-folder-fill text-warning"></i> <?= htmlspecialchars($item['name']) ?> <i class="bi bi-folder-fill text-warning"></i> <?= htmlspecialchars($item['name']) ?>
</a> </a>
<?php else: ?> <?php else: ?>
<a href="admin.php?route=content-edit&file=<?= urlencode($item['path']) ?>"> <a href="/admin/content-edit&file=<?= urlencode($item['path']) ?>">
<?php <?php
$icon = match($item['extension']) { $icon = match($item['extension']) {
'md' => 'bi-file-text text-primary', 'md' => 'bi-file-text text-primary',
@@ -104,26 +104,26 @@
<td class="text-muted"><?= $item['modified'] ?></td> <td class="text-muted"><?= $item['modified'] ?></td>
<td> <td>
<?php if ($item['is_dir']): ?> <?php if ($item['is_dir']): ?>
<a href="admin.php?route=content-dir-rename&dir=<?= urlencode($item['path']) ?>" class="btn btn-sm btn-outline-secondary" title="Hernoemen"> <a href="/admin/content-dir-rename&dir=<?= urlencode($item['path']) ?>" class="btn btn-sm btn-outline-secondary" title="Hernoemen">
<i class="bi bi-pencil"></i> <i class="bi bi-pencil"></i>
</a> </a>
<a href="admin.php?route=content-move&item=<?= urlencode($item['path']) ?>" class="btn btn-sm btn-outline-info" title="Verplaatsen"> <a href="/admin/content-move&item=<?= urlencode($item['path']) ?>" class="btn btn-sm btn-outline-info" title="Verplaatsen">
<i class="bi bi-arrows-move"></i> <i class="bi bi-arrows-move"></i>
</a> </a>
<form method="POST" action="admin.php?route=content-dir-delete&dir=<?= urlencode($item['path']) ?>" class="d-inline" onsubmit="return confirm('Weet je zeker dat je deze map wilt verwijderen? De map moet leeg zijn.')"> <form method="POST" action="/admin/content-dir-delete&dir=<?= urlencode($item['path']) ?>" class="d-inline" onsubmit="return confirm('Weet je zeker dat je deze map wilt verwijderen? De map moet leeg zijn.')">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<button type="submit" class="btn btn-sm btn-outline-danger" title="Verwijderen"> <button type="submit" class="btn btn-sm btn-outline-danger" title="Verwijderen">
<i class="bi bi-trash"></i> <i class="bi bi-trash"></i>
</button> </button>
</form> </form>
<?php else: ?> <?php else: ?>
<a href="admin.php?route=content-edit&file=<?= urlencode($item['path']) ?>" class="btn btn-sm btn-outline-primary" title="Bewerken"> <a href="/admin/content-edit&file=<?= urlencode($item['path']) ?>" class="btn btn-sm btn-outline-primary" title="Bewerken">
<i class="bi bi-pencil"></i> <i class="bi bi-pencil"></i>
</a> </a>
<a href="admin.php?route=content-move&item=<?= urlencode($item['path']) ?>" class="btn btn-sm btn-outline-info" title="Verplaatsen"> <a href="/admin/content-move&item=<?= urlencode($item['path']) ?>" class="btn btn-sm btn-outline-info" title="Verplaatsen">
<i class="bi bi-arrows-move"></i> <i class="bi bi-arrows-move"></i>
</a> </a>
<form method="POST" action="admin.php?route=content-delete&file=<?= urlencode($item['path']) ?>" class="d-inline" onsubmit="return confirm('Weet je zeker dat je dit bestand wilt verwijderen?')"> <form method="POST" action="/admin/content-delete&file=<?= urlencode($item['path']) ?>" class="d-inline" onsubmit="return confirm('Weet je zeker dat je dit bestand wilt verwijderen?')">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<button type="submit" class="btn btn-sm btn-outline-danger" title="Verwijderen"> <button type="submit" class="btn btn-sm btn-outline-danger" title="Verwijderen">
<i class="bi bi-trash"></i> <i class="bi bi-trash"></i>
@@ -143,7 +143,7 @@
<div class="modal fade" id="createDirModal" tabindex="-1"> <div class="modal fade" id="createDirModal" tabindex="-1">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">
<form method="POST" action="admin.php?route=content-dir-create&dir=<?= urlencode($subdir) ?>"> <form method="POST" action="/admin/content-dir-create&dir=<?= urlencode($subdir) ?>">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<div class="modal-header"> <div class="modal-header">
<h5 class="modal-title"><i class="bi bi-folder-plus"></i> Nieuwe map aanmaken</h5> <h5 class="modal-title"><i class="bi bi-folder-plus"></i> Nieuwe map aanmaken</h5>
+3 -3
View File
@@ -67,9 +67,9 @@
<div class="card-header"><i class="bi bi-lightning"></i> Snelle acties</div> <div class="card-header"><i class="bi bi-lightning"></i> Snelle acties</div>
<div class="card-body"> <div class="card-body">
<div class="d-grid gap-2"> <div class="d-grid gap-2">
<a href="admin.php?route=content-new" class="btn btn-outline-primary"><i class="bi bi-plus-lg"></i> Nieuwe pagina</a> <a href="/admin/content-new" class="btn btn-outline-primary"><i class="bi bi-plus-lg"></i> Nieuwe pagina</a>
<a href="admin.php?route=config" class="btn btn-outline-secondary"><i class="bi bi-sliders"></i> Configuratie bewerken</a> <a href="/admin/config" class="btn btn-outline-secondary"><i class="bi bi-sliders"></i> Configuratie bewerken</a>
<a href="admin.php?route=content" class="btn btn-outline-info"><i class="bi bi-folder2-open"></i> Content beheren</a> <a href="/admin/content" class="btn btn-outline-info"><i class="bi bi-folder2-open"></i> Content beheren</a>
<a href="index.php" target="_blank" class="btn btn-outline-success"><i class="bi bi-box-arrow-up-right"></i> Website bekijken</a> <a href="index.php" target="_blank" class="btn btn-outline-success"><i class="bi bi-box-arrow-up-right"></i> Website bekijken</a>
</div> </div>
</div> </div>
+2 -2
View File
@@ -8,7 +8,7 @@
<div class="collapse mb-4" id="uploadForm"> <div class="collapse mb-4" id="uploadForm">
<div class="card shadow-sm"> <div class="card shadow-sm">
<div class="card-body"> <div class="card-body">
<form method="POST" action="admin.php?route=media" enctype="multipart/form-data"> <form method="POST" action="/admin/media" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<div class="mb-3"> <div class="mb-3">
<label for="file" class="form-label">Bestanden selecteren</label> <label for="file" class="form-label">Bestanden selecteren</label>
@@ -53,7 +53,7 @@
<td class="text-muted small"><?= htmlspecialchars($file['modified']) ?></td> <td class="text-muted small"><?= htmlspecialchars($file['modified']) ?></td>
<td><code class="small"><?= htmlspecialchars($file['url']) ?></code></td> <td><code class="small"><?= htmlspecialchars($file['url']) ?></code></td>
<td> <td>
<form method="POST" action="admin.php?route=media" class="d-inline" onsubmit="return confirm('Weet je zeker dat je &#39;<?= htmlspecialchars($file['name']) ?>&#39; wilt verwijderen?')"> <form method="POST" action="/admin/media" class="d-inline" onsubmit="return confirm('Weet je zeker dat je &#39;<?= htmlspecialchars($file['name']) ?>&#39; wilt verwijderen?')">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<input type="hidden" name="delete" value="<?= htmlspecialchars($file['name']) ?>"> <input type="hidden" name="delete" value="<?= htmlspecialchars($file['name']) ?>">
<button type="submit" class="btn btn-sm btn-outline-danger" title="Verwijderen"> <button type="submit" class="btn btn-sm btn-outline-danger" title="Verwijderen">
+2 -2
View File
@@ -15,14 +15,14 @@
<?php if (!empty($pluginConfig)): ?> <?php if (!empty($pluginConfig)): ?>
<div class="card-footer text-end"> <div class="card-footer text-end">
<a href="admin.php?route=plugins" class="btn btn-secondary">Annuleren</a> <a href="/admin/plugins" class="btn btn-secondary">Annuleren</a>
<button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> Opslaan</button> <button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> Opslaan</button>
</div> </div>
<?php endif; ?> <?php endif; ?>
</form> </form>
<div class="mt-3"> <div class="mt-3">
<a href="admin.php?route=plugins" class="btn btn-outline-secondary btn-sm"> <a href="/admin/plugins" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-arrow-left"></i> Terug naar plugins <i class="bi bi-arrow-left"></i> Terug naar plugins
</a> </a>
</div> </div>
+3 -3
View File
@@ -1,13 +1,13 @@
<div class="d-flex justify-content-between align-items-center mb-4"> <div class="d-flex justify-content-between align-items-center mb-4">
<h2><i class="bi bi-pencil"></i> Plugin bewerken: <?= htmlspecialchars($pluginName) ?></h2> <h2><i class="bi bi-pencil"></i> Plugin bewerken: <?= htmlspecialchars($pluginName) ?></h2>
<a href="admin.php?route=plugins" class="btn btn-outline-secondary btn-sm"> <a href="/admin/plugins" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-arrow-left"></i> Terug <i class="bi bi-arrow-left"></i> Terug
</a> </a>
</div> </div>
<div class="card shadow-sm"> <div class="card shadow-sm">
<div class="card-body"> <div class="card-body">
<form method="POST" action="admin.php?route=plugins-edit&plugin=<?= urlencode($pluginName) ?>" id="editor-form"> <form method="POST" action="/admin/plugins-edit&plugin=<?= urlencode($pluginName) ?>" id="editor-form">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<div class="d-flex justify-content-between align-items-center mb-2"> <div class="d-flex justify-content-between align-items-center mb-2">
<span class="badge bg-secondary">PHP</span> <span class="badge bg-secondary">PHP</span>
@@ -21,7 +21,7 @@
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
<i class="bi bi-check-lg"></i> Opslaan <i class="bi bi-check-lg"></i> Opslaan
</button> </button>
<a href="admin.php?route=plugins" class="btn btn-outline-secondary">Annuleren</a> <a href="/admin/plugins" class="btn btn-outline-secondary">Annuleren</a>
</div> </div>
</form> </form>
</div> </div>
+1 -1
View File
@@ -34,7 +34,7 @@
</div> </div>
<div class="card-footer text-end"> <div class="card-footer text-end">
<a href="admin.php?route=plugins" class="btn btn-secondary">Annuleren</a> <a href="/admin/plugins" class="btn btn-secondary">Annuleren</a>
<button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> Aanmaken</button> <button type="submit" class="btn btn-primary"><i class="bi bi-check-lg"></i> Aanmaken</button>
</div> </div>
</form> </form>
+5 -5
View File
@@ -1,6 +1,6 @@
<div class="d-flex justify-content-between align-items-center mb-4"> <div class="d-flex justify-content-between align-items-center mb-4">
<h2><i class="bi bi-plug"></i> Plugins</h2> <h2><i class="bi bi-plug"></i> Plugins</h2>
<a href="admin.php?route=plugins-new" class="btn btn-primary btn-sm"> <a href="/admin/plugins-new" class="btn btn-primary btn-sm">
<i class="bi bi-plus-lg"></i> Nieuwe plugin <i class="bi bi-plus-lg"></i> Nieuwe plugin
</a> </a>
</div> </div>
@@ -113,23 +113,23 @@
<div class="mt-3 d-flex justify-content-between align-items-center"> <div class="mt-3 d-flex justify-content-between align-items-center">
<div class="btn-group btn-group-sm"> <div class="btn-group btn-group-sm">
<?php if ($plugin['has_main']): ?> <?php if ($plugin['has_main']): ?>
<a href="admin.php?route=plugins-edit&plugin=<?= urlencode($plugin['name']) ?>" class="btn btn-outline-secondary" title="Bewerken"> <a href="/admin/plugins-edit&plugin=<?= urlencode($plugin['name']) ?>" class="btn btn-outline-secondary" title="Bewerken">
<i class="bi bi-pencil"></i> <i class="bi bi-pencil"></i>
</a> </a>
<?php endif; ?> <?php endif; ?>
<form method="POST" action="admin.php?route=plugins-toggle&plugin=<?= urlencode($plugin['name']) ?>" class="d-inline"> <form method="POST" action="/admin/plugins-toggle&plugin=<?= urlencode($plugin['name']) ?>" class="d-inline">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<button type="submit" class="btn btn-sm <?= $plugin['viewable'] ? 'btn-outline-warning' : 'btn-outline-success' ?>" title="<?= $plugin['viewable'] ? 'Verbergen' : 'Tonen' ?>"> <button type="submit" class="btn btn-sm <?= $plugin['viewable'] ? 'btn-outline-warning' : 'btn-outline-success' ?>" title="<?= $plugin['viewable'] ? 'Verbergen' : 'Tonen' ?>">
<i class="bi <?= $plugin['viewable'] ? 'bi-eye-slash' : 'bi-eye' ?>"></i> <?= $plugin['viewable'] ? 'Verberg' : 'Toon' ?> <i class="bi <?= $plugin['viewable'] ? 'bi-eye-slash' : 'bi-eye' ?>"></i> <?= $plugin['viewable'] ? 'Verberg' : 'Toon' ?>
</button> </button>
</form> </form>
<?php if ($plugin['has_config']): ?> <?php if ($plugin['has_config']): ?>
<a href="admin.php?route=plugins-config&plugin=<?= urlencode($plugin['name']) ?>" class="btn btn-outline-primary" title="Configureren"> <a href="/admin/plugins-config&plugin=<?= urlencode($plugin['name']) ?>" class="btn btn-outline-primary" title="Configureren">
<i class="bi bi-gear"></i> <i class="bi bi-gear"></i>
</a> </a>
<?php endif; ?> <?php endif; ?>
</div> </div>
<form method="POST" action="admin.php?route=plugins-delete&plugin=<?= urlencode($plugin['name']) ?>" class="d-inline" onsubmit="return confirm('Weet je zeker dat je de plugin &#39;<?= htmlspecialchars($plugin['name']) ?>&#39; wilt verwijderen? Alle bestanden worden permanent verwijderd.')"> <form method="POST" action="/admin/plugins-delete&plugin=<?= urlencode($plugin['name']) ?>" class="d-inline" onsubmit="return confirm('Weet je zeker dat je de plugin &#39;<?= htmlspecialchars($plugin['name']) ?>&#39; wilt verwijderen? Alle bestanden worden permanent verwijderd.')">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<button type="submit" class="btn btn-sm btn-outline-danger" title="Verwijderen"> <button type="submit" class="btn btn-sm btn-outline-danger" title="Verwijderen">
<i class="bi bi-trash"></i> <i class="bi bi-trash"></i>
+7 -7
View File
@@ -3,14 +3,14 @@
<!-- Edit theme --> <!-- Edit theme -->
<div class="d-flex justify-content-between align-items-center mb-4"> <div class="d-flex justify-content-between align-items-center mb-4">
<h2><i class="bi bi-palette"></i> Bewerk thema: <?= htmlspecialchars($editTheme['name'] ?? $editThemeName) ?></h2> <h2><i class="bi bi-palette"></i> Bewerk thema: <?= htmlspecialchars($editTheme['name'] ?? $editThemeName) ?></h2>
<a href="admin.php?route=theme" class="btn btn-outline-secondary btn-sm"> <a href="/admin/theme" class="btn btn-outline-secondary btn-sm">
<i class="bi bi-arrow-left"></i> Terug <i class="bi bi-arrow-left"></i> Terug
</a> </a>
</div> </div>
<div class="card shadow-sm"> <div class="card shadow-sm">
<div class="card-body"> <div class="card-body">
<form method="POST" action="admin.php?route=theme" enctype="multipart/form-data"> <form method="POST" action="/admin/theme" enctype="multipart/form-data">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<input type="hidden" name="action" value="save"> <input type="hidden" name="action" value="save">
<input type="hidden" name="theme" value="<?= htmlspecialchars($editThemeName) ?>"> <input type="hidden" name="theme" value="<?= htmlspecialchars($editThemeName) ?>">
@@ -150,7 +150,7 @@
<button type="submit" class="btn btn-primary"> <button type="submit" class="btn btn-primary">
<i class="bi bi-check-lg"></i> Opslaan <i class="bi bi-check-lg"></i> Opslaan
</button> </button>
<a href="admin.php?route=theme" class="btn btn-outline-secondary">Annuleren</a> <a href="/admin/theme" class="btn btn-outline-secondary">Annuleren</a>
</div> </div>
</form> </form>
</div> </div>
@@ -169,7 +169,7 @@
<div class="collapse mb-4" id="newThemeForm"> <div class="collapse mb-4" id="newThemeForm">
<div class="card shadow-sm"> <div class="card shadow-sm">
<div class="card-body"> <div class="card-body">
<form method="POST" action="admin.php?route=theme" class="row g-3 align-items-end"> <form method="POST" action="/admin/theme" class="row g-3 align-items-end">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<input type="hidden" name="action" value="create"> <input type="hidden" name="action" value="create">
<div class="col-md-6"> <div class="col-md-6">
@@ -233,11 +233,11 @@
</div> </div>
<div class="d-flex gap-2"> <div class="d-flex gap-2">
<a href="admin.php?route=theme&edit=<?= urlencode($themeName) ?>" class="btn btn-outline-primary btn-sm"> <a href="/admin/theme&edit=<?= urlencode($themeName) ?>" class="btn btn-outline-primary btn-sm">
<i class="bi bi-pencil"></i> Bewerken <i class="bi bi-pencil"></i> Bewerken
</a> </a>
<?php if ($themeName !== $activeTheme): ?> <?php if ($themeName !== $activeTheme): ?>
<form method="POST" action="admin.php?route=theme"> <form method="POST" action="/admin/theme">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<input type="hidden" name="action" value="activate"> <input type="hidden" name="action" value="activate">
<input type="hidden" name="theme" value="<?= htmlspecialchars($themeName) ?>"> <input type="hidden" name="theme" value="<?= htmlspecialchars($themeName) ?>">
@@ -247,7 +247,7 @@
</form> </form>
<?php endif; ?> <?php endif; ?>
<?php if ($themeName !== 'default'): ?> <?php if ($themeName !== 'default'): ?>
<form method="POST" action="admin.php?route=theme"> <form method="POST" action="/admin/theme">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<input type="hidden" name="action" value="delete"> <input type="hidden" name="action" value="delete">
<input type="hidden" name="theme" value="<?= htmlspecialchars($themeName) ?>"> <input type="hidden" name="theme" value="<?= htmlspecialchars($themeName) ?>">
+3 -3
View File
@@ -29,7 +29,7 @@
<td class="text-muted"><?= htmlspecialchars($u['created']) ?></td> <td class="text-muted"><?= htmlspecialchars($u['created']) ?></td>
<td> <td>
<!-- Change password --> <!-- Change password -->
<form method="POST" action="admin.php?route=users" class="d-inline"> <form method="POST" action="/admin/users" class="d-inline">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<input type="hidden" name="action" value="change_password"> <input type="hidden" name="action" value="change_password">
<input type="hidden" name="pw_username" value="<?= htmlspecialchars($u['username']) ?>"> <input type="hidden" name="pw_username" value="<?= htmlspecialchars($u['username']) ?>">
@@ -41,7 +41,7 @@
</div> </div>
</form> </form>
<?php if ($u['username'] !== $user['username']): ?> <?php if ($u['username'] !== $user['username']): ?>
<form method="POST" action="admin.php?route=users" class="d-inline ms-1" onsubmit="return confirm('Weet je zeker dat je deze gebruiker wilt verwijderen?')"> <form method="POST" action="/admin/users" class="d-inline ms-1" onsubmit="return confirm('Weet je zeker dat je deze gebruiker wilt verwijderen?')">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<input type="hidden" name="action" value="delete"> <input type="hidden" name="action" value="delete">
<input type="hidden" name="delete_username" value="<?= htmlspecialchars($u['username']) ?>"> <input type="hidden" name="delete_username" value="<?= htmlspecialchars($u['username']) ?>">
@@ -64,7 +64,7 @@
<div class="card shadow-sm"> <div class="card shadow-sm">
<div class="card-header"><i class="bi bi-person-plus"></i> Gebruiker toevoegen</div> <div class="card-header"><i class="bi bi-person-plus"></i> Gebruiker toevoegen</div>
<div class="card-body"> <div class="card-body">
<form method="POST" action="admin.php?route=users"> <form method="POST" action="/admin/users">
<input type="hidden" name="csrf_token" value="<?= $csrf ?>"> <input type="hidden" name="csrf_token" value="<?= $csrf ?>">
<input type="hidden" name="action" value="add"> <input type="hidden" name="action" value="add">
<div class="mb-3"> <div class="mb-3">
+58 -14
View File
@@ -57,6 +57,48 @@ class CodePressCMS {
} }
} }
/**
* Build a clean URL for a page
*
* @param string $page Page path (e.g., 'blog/leren/artikel')
* @param string|null $lang Language code
* @param array $params Additional query parameters
* @return string Clean URL
*/
public function buildUrl($page = 'index', $lang = null, $params = []) {
$lang = $lang ?: $this->currentLanguage;
$url = '/' . $lang;
if ($page && $page !== 'index') {
$url .= '/' . $page;
}
if (!empty($params)) {
$url .= '?' . http_build_query($params);
}
return $url;
}
/**
* Build a clean admin URL
*
* @param string $route Admin route
* @param array $params Additional query parameters
* @return string Clean admin URL
*/
public static function buildAdminUrl($route = '', $params = []) {
$url = $route ? '/admin/' . $route : '/admin';
if (!empty($params)) {
$url .= '?' . http_build_query($params);
}
return $url;
}
/**
* Build URL string for template use (non-static, with current lang context)
*/
public function url($page = 'index', $extraParams = []) {
return $this->buildUrl($page, $this->currentLanguage, $extraParams);
}
/** /**
* Get current language from request or config * Get current language from request or config
* *
@@ -215,7 +257,7 @@ class CodePressCMS {
'type' => 'file', 'type' => 'file',
'title' => $title, 'title' => $title,
'path' => $pathWithoutExt, 'path' => $pathWithoutExt,
'url' => '?page=' . $pathWithoutExt . '&lang=' . $this->currentLanguage 'url' => $this->buildUrl($pathWithoutExt)
]; ];
} }
} }
@@ -262,7 +304,7 @@ class CodePressCMS {
$this->searchResults[] = [ $this->searchResults[] = [
'title' => $title, 'title' => $title,
'path' => $relativePath, 'path' => $relativePath,
'url' => '?page=' . $relativePath . '&lang=' . $this->currentLanguage, 'url' => $this->buildUrl($relativePath),
'snippet' => $this->createSnippet($content, $query) 'snippet' => $this->createSnippet($content, $query)
]; ];
} }
@@ -297,8 +339,9 @@ class CodePressCMS {
return $this->getSearchResults(); return $this->getSearchResults();
} }
// Check if guide is requested // Check if guide is requested (either via ?guide or /guide clean URL)
if (isset($_GET['guide'])) { $pageCheck = $_GET['page'] ?? '';
if (isset($_GET['guide']) || $pageCheck === 'guide') {
return $this->getGuidePage(); return $this->getGuidePage();
} }
@@ -536,9 +579,9 @@ class CodePressCMS {
// Auto-link page titles to existing content pages (but not in H1 tags) // Auto-link page titles to existing content pages (but not in H1 tags)
$body = $this->autoLinkPageTitles($body, $cleanName); $body = $this->autoLinkPageTitles($body, $cleanName);
// Convert relative internal links to CMS format // Convert relative internal links to clean URLs
$body = preg_replace('/href="\/blog\/([^"]+)"/', 'href="?page=blog/$1"', $body); $body = preg_replace('/href="\/blog\/([^"]+)"/', 'href="/' . $this->currentLanguage . '/blog/$1"', $body);
$body = preg_replace('/href="\/([^"]+)"/', 'href="?page=$1"', $body); $body = preg_replace('/href="\/([^"]+)"/', 'href="/' . $this->currentLanguage . '/$1"', $body);
return [ return [
'title' => $title ?: $cleanName ?: 'Untitled', 'title' => $title ?: $cleanName ?: 'Untitled',
@@ -578,7 +621,7 @@ class CodePressCMS {
return $text; // Don't link existing links, current page title, or H1 headings return $text; // Don't link existing links, current page title, or H1 headings
} }
return '<a href="?page=' . $pagePath . '&lang=' . $this->currentLanguage . '" class="auto-link" title="' . $this->t('go_to') . ' ' . htmlspecialchars($pageTitle) . '">' . $text . '</a>'; return '<a href="' . $this->buildUrl($pagePath) . '" class="auto-link" title="' . $this->t('go_to') . ' ' . htmlspecialchars($pageTitle) . '">' . $text . '</a>';
}; };
$content = preg_replace_callback($pattern, $replacement, $content); $content = preg_replace_callback($pattern, $replacement, $content);
@@ -916,7 +959,7 @@ private function getGuidePage() {
$allItems[] = [ $allItems[] = [
'name' => ucfirst($item), 'name' => ucfirst($item),
'path' => $relativePath, 'path' => $relativePath,
'url' => '?page=' . $relativePath, 'url' => $this->buildUrl($relativePath),
'icon' => 'bi-folder', 'icon' => 'bi-folder',
'type' => 'directory' 'type' => 'directory'
]; ];
@@ -929,7 +972,7 @@ private function getGuidePage() {
$allItems[] = [ $allItems[] = [
'name' => $fileTitle, 'name' => $fileTitle,
'path' => $pathWithoutExt, 'path' => $pathWithoutExt,
'url' => '?page=' . $pathWithoutExt, 'url' => $this->buildUrl($pathWithoutExt),
'icon' => $icon, 'icon' => $icon,
'type' => 'file' 'type' => 'file'
]; ];
@@ -1021,7 +1064,7 @@ private function getGuidePage() {
'is_homepage' => (!isset($_GET['page']) || $_GET['page'] === $this->config['default_page']), 'is_homepage' => (!isset($_GET['page']) || $_GET['page'] === $this->config['default_page']),
'home_active_class' => (!isset($_GET['page']) || $_GET['page'] === $this->config['default_page']) ? 'active' : '', 'home_active_class' => (!isset($_GET['page']) || $_GET['page'] === $this->config['default_page']) ? 'active' : '',
'is_guide_page' => isset($_GET['guide']), 'is_guide_page' => isset($_GET['guide']),
'lang_switch_url' => isset($_GET['guide']) ? '&guide' : '&page=' . $this->config['default_page'], 'lang_switch_url' => '',
'author_name' => $this->config['author']['name'] ?? 'CodePress Developer', 'author_name' => $this->config['author']['name'] ?? 'CodePress Developer',
'author_website' => $this->config['author']['website'] ?? '#', 'author_website' => $this->config['author']['website'] ?? '#',
'author_git' => 'https://git.noorlander.info/E.Noorlander', 'author_git' => 'https://git.noorlander.info/E.Noorlander',
@@ -1133,13 +1176,14 @@ private function getGuidePage() {
$sidebarToggle = '<li class="breadcrumb-item sidebar-toggle-item"><button type="button" class="sidebar-toggle-btn" onclick="toggleSidebar()" title="Toggle Sidebar" aria-label="Toggle Sidebar" aria-expanded="true"><i class="bi bi-layout-sidebar-inset"></i></button></li>'; $sidebarToggle = '<li class="breadcrumb-item sidebar-toggle-item"><button type="button" class="sidebar-toggle-btn" onclick="toggleSidebar()" title="Toggle Sidebar" aria-label="Toggle Sidebar" aria-expanded="true"><i class="bi bi-layout-sidebar-inset"></i></button></li>';
if (isset($_GET['search'])) { if (isset($_GET['search'])) {
return '<nav aria-label="breadcrumb"><ol class="breadcrumb">' . $sidebarToggle . '<li class="breadcrumb-item"><a href="?page=' . $this->config['default_page'] . '&lang=' . $this->currentLanguage . '"><i class="bi bi-house"></i></a></li><li class="breadcrumb-item"> > </li><li class="breadcrumb-item active">' . $this->t('search') . '</li></ol></nav>'; return '<nav aria-label="breadcrumb"><ol class="breadcrumb">' . $sidebarToggle . '<li class="breadcrumb-item"><a href="/' . $this->currentLanguage . '"><i class="bi bi-house"></i></a></li><li class="breadcrumb-item"> > </li><li class="breadcrumb-item active">' . $this->t('search') . '</li></ol></nav>';
} }
$page = $_GET['page'] ?? $this->config['default_page']; $page = $_GET['page'] ?? $this->config['default_page'];
$page = htmlspecialchars($page, ENT_QUOTES, 'UTF-8'); $page = htmlspecialchars($page, ENT_QUOTES, 'UTF-8');
$page = preg_replace('/\.[^.]+$/', '', $page); $page = preg_replace('/\.[^.]+$/', '', $page);
// Convert page to clean URL format for breadcrumb
if ($page === $this->config['default_page']) { if ($page === $this->config['default_page']) {
return '<nav aria-label="breadcrumb"><ol class="breadcrumb">' . $sidebarToggle . '<li class="breadcrumb-item active"><i class="bi bi-house"></i></li></ol></nav>'; return '<nav aria-label="breadcrumb"><ol class="breadcrumb">' . $sidebarToggle . '<li class="breadcrumb-item active"><i class="bi bi-house"></i></li></ol></nav>';
} }
@@ -1148,7 +1192,7 @@ private function getGuidePage() {
// Start with sidebar toggle, then home icon linking to default page (root) // Start with sidebar toggle, then home icon linking to default page (root)
$breadcrumb .= $sidebarToggle; $breadcrumb .= $sidebarToggle;
$breadcrumb .= '<li class="breadcrumb-item"><a href="?page=' . $this->config['default_page'] . '&lang=' . $this->currentLanguage . '"><i class="bi bi-house"></i></a></li>'; $breadcrumb .= '<li class="breadcrumb-item"><a href="/' . $this->currentLanguage . '"><i class="bi bi-house"></i></a></li>';
// Split page path and build breadcrumb items // Split page path and build breadcrumb items
$parts = explode('/', $page); $parts = explode('/', $page);
@@ -1164,7 +1208,7 @@ private function getGuidePage() {
$breadcrumb .= '<li class="breadcrumb-item"> > </li><li class="breadcrumb-item active">' . $title . '</li>'; $breadcrumb .= '<li class="breadcrumb-item"> > </li><li class="breadcrumb-item active">' . $title . '</li>';
} else { } else {
// Parent directory - clickable link with separator // Parent directory - clickable link with separator
$breadcrumb .= '<li class="breadcrumb-item"> > </li><li class="breadcrumb-item"><a href="?page=' . $safePath . '&lang=' . $this->currentLanguage . '">' . $title . '</a></li>'; $breadcrumb .= '<li class="breadcrumb-item"> > </li><li class="breadcrumb-item"><a href="/' . $this->currentLanguage . '/' . $safePath . '">' . $title . '</a></li>';
} }
} }
+33 -39
View File
@@ -1,59 +1,53 @@
<?php <?php
// Router file for PHP development server to handle security and static files // Router file for PHP development server - clean URL support + static file serving
$requestUri = $_SERVER['REQUEST_URI']; $requestUri = $_SERVER['REQUEST_URI'];
$parsedUrl = parse_url($requestUri); $parsedUrl = parse_url($requestUri);
$path = $parsedUrl['path']; $path = $parsedUrl['path'] ?? '/';
$path = rtrim($path, '/') ?: '/';
$publicDir = __DIR__ . '/../public';
// Block direct access to content directory
if (strpos($path, '/content/') === 0) {
http_response_code(403);
echo '<h1>403 - Forbidden</h1><p>Access denied.</p>';
return true;
}
// Block PHP execution in content directory
if (preg_match('/\.php$/i', $path) && strpos($path, '/content/') !== false) {
http_response_code(403);
echo '<h1>403 - Forbidden</h1><p>PHP execution not allowed in content directory.</p>';
return true;
}
// Block access to sensitive files
$sensitiveFiles = ['.htaccess', 'config.php'];
foreach ($sensitiveFiles as $file) {
if (basename($path) === $file && dirname($path) === '/') {
http_response_code(403);
echo '<h1>403 - Forbidden</h1><p>Access denied.</p>';
return true;
}
}
// Serve static files from engine/assets
if (strpos($path, '/engine/') === 0) {
$filePath = __DIR__ . $path;
if (file_exists($filePath)) {
// Set appropriate content type
$extension = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
$mimeTypes = [ $mimeTypes = [
'css' => 'text/css', 'css' => 'text/css',
'js' => 'application/javascript', 'js' => 'application/javascript',
'svg' => 'image/svg+xml', 'svg' => 'image/svg+xml',
'png' => 'image/png',
'jpg' => 'image/jpeg',
'ico' => 'image/x-icon',
'woff' => 'font/woff', 'woff' => 'font/woff',
'woff2' => 'font/woff2', 'woff2' => 'font/woff2',
'ttf' => 'font/ttf' 'json' => 'application/json',
]; ];
if (isset($mimeTypes[$extension])) { // Serve static files from public/
header('Content-Type: ' . $mimeTypes[$extension]); $filePath = $publicDir . $path;
if (is_file($filePath)) {
$ext = strtolower(pathinfo($filePath, PATHINFO_EXTENSION));
if (isset($mimeTypes[$ext])) {
header('Content-Type: ' . $mimeTypes[$ext]);
} }
// Serve the file
readfile($filePath); readfile($filePath);
return true; return true;
} }
// Admin routes: /admin/login → admin.php?route=login
if (preg_match('#^/admin(?:/(.+))?$#', $path, $m)) {
$_GET['route'] = $m[1] ?? 'dashboard';
require $publicDir . '/admin.php';
return true;
} }
// Route all other requests to index.php // Language-prefixed routes: /nl/page/path → index.php?lang=nl&page=page/path
include __DIR__ . '/index.php'; if (preg_match('#^/(nl|en)(?:/(.+))?$#', $path, $m)) {
$_GET['lang'] = $m[1];
$_GET['page'] = $m[2] ?? 'index';
if ($_GET['page'] === 'guide') {
$_GET['guide'] = '1';
}
require $publicDir . '/index.php';
return true;
}
// Root or unknown → index.php
require $publicDir . '/index.php';
return true; return true;
+1 -1
View File
@@ -19,7 +19,7 @@
</div> </div>
<div class="site-info"> <div class="site-info">
<small class="text-muted"> <small class="text-muted">
<a href="?guide&lang={{current_lang}}" class="footer-icon guide" title="{{t_guide}}"> <a href="/{{current_lang}}/guide" class="footer-icon guide" title="{{t_guide}}">
<i class="bi bi-book"></i> <i class="bi bi-book"></i>
</a> </a>
<span class="ms-1">|</span> <span class="ms-1">|</span>
+3 -3
View File
@@ -1,6 +1,6 @@
<header id="site-header" class="navbar navbar-expand-lg navbar-dark" style="background-color: transparent;"> <header id="site-header" class="navbar navbar-expand-lg navbar-dark" style="background-color: transparent;">
<div class="container-fluid"> <div class="container-fluid">
<a class="navbar-brand" href="?page={{default_page}}&lang={{current_lang}}"> <a class="navbar-brand" href="/{{current_lang}}">
<img src="/assets/icon.svg" alt="CodePress Logo" width="32" height="32" class="me-2"> <img src="/assets/icon.svg" alt="CodePress Logo" width="32" height="32" class="me-2">
{{site_title}} {{site_title}}
</a> </a>
@@ -27,7 +27,7 @@
<ul class="dropdown-menu dropdown-menu-end" role="menu"> <ul class="dropdown-menu dropdown-menu-end" role="menu">
{{#available_langs}} {{#available_langs}}
<li role="none"> <li role="none">
<a class="dropdown-item {{#is_current}}active{{/is_current}}" href="?lang={{code}}{{lang_switch_url}}" role="menuitem" {{#is_current}}aria-current="true"{{/is_current}} lang="{{code}}"> <a class="dropdown-item {{#is_current}}active{{/is_current}}" href="/{{code}}" role="menuitem" {{#is_current}}aria-current="true"{{/is_current}} lang="{{code}}">
{{native_name}} {{native_name}}
</a> </a>
</li> </li>
@@ -47,7 +47,7 @@
<ul class="dropdown-menu dropdown-menu-end" role="menu"> <ul class="dropdown-menu dropdown-menu-end" role="menu">
{{#available_langs}} {{#available_langs}}
<li role="none"> <li role="none">
<a class="dropdown-item {{#is_current}}active{{/is_current}}" href="?lang={{code}}{{lang_switch_url}}" role="menuitem" {{#is_current}}aria-current="true"{{/is_current}} lang="{{code}}"> <a class="dropdown-item {{#is_current}}active{{/is_current}}" href="/{{code}}" role="menuitem" {{#is_current}}aria-current="true"{{/is_current}} lang="{{code}}">
{{native_name}} {{native_name}}
</a> </a>
</li> </li>
+1 -1
View File
@@ -5,7 +5,7 @@
<div class="col"> <div class="col">
<ul class="nav nav-tabs flex-wrap" role="menubar"> <ul class="nav nav-tabs flex-wrap" role="menubar">
<li class="nav-item" role="none"> <li class="nav-item" role="none">
<a class="nav-link {{home_active_class}}" href="?page={{homepage}}&lang={{current_lang}}" role="menuitem" aria-current="{{#is_homepage}}page{{/is_homepage}}"> <a class="nav-link {{home_active_class}}" href="/{{current_lang}}" role="menuitem" aria-current="{{#is_homepage}}page{{/is_homepage}}">
<i class="bi bi-house" aria-hidden="true"></i> {{homepage_title}} <i class="bi bi-house" aria-hidden="true"></i> {{homepage_title}}
</a> </a>
</li> </li>
+21 -31
View File
@@ -1,50 +1,44 @@
# Disable directory listing # Disable directory listing
Options -Indexes Options -Indexes
# Security - Block access to sensitive files and directories # Security - Block sensitive files
<Files ~ "^\."> <Files ~ "^\.">
Order allow,deny Require all denied
Deny from all
</Files> </Files>
<FilesMatch "\.(ini|log|conf|config|map)$"> <FilesMatch "\.(ini|log|conf|config|map)$">
Order allow,deny Require all denied
Deny from all
</FilesMatch> </FilesMatch>
# Block access to backup files
<FilesMatch "\.(backup|bak|old|orig|swp|save)$"> <FilesMatch "\.(backup|bak|old|orig|swp|save)$">
Order allow,deny Require all denied
Deny from all
</FilesMatch> </FilesMatch>
# URL Routing - Route all requests to index.php
<IfModule mod_rewrite.c> <IfModule mod_rewrite.c>
RewriteEngine On RewriteEngine On
# Set base directory
RewriteBase / RewriteBase /
# Block direct access to PHP files in content directory # Admin routes: /admin/login → admin.php?route=login
RewriteRule ^content/.*\.php$ - [F,L] RewriteRule ^admin$ admin.php?route=dashboard [L,QSA]
RewriteRule ^admin/(.+)$ admin.php?route=$1 [L,QSA]
# Route all non-file/non-directory requests to index.php # Language-prefixed page routes: /nl, /en, /nl/page/path
RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(nl|en)/?$ index.php?lang=$1 [L,QSA]
RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(nl|en)/(.+)$ index.php?lang=$1&page=$2 [L,QSA]
RewriteRule ^(.*)$ index.php [QSA,L]
# Allow access to assets # Root
RewriteRule ^$ index.php [L]
# Serve existing static files directly
RewriteCond %{REQUEST_FILENAME} -f RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^assets/.*$ - [L] RewriteRule ^ - [L]
# Allow access to content assets # Block directory listing for remaining physical dirs
RewriteRule ^content/assets/.*$ - [L] RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [F]
# Serve files from content/-assets/ via index.php # Fallback to index.php
RewriteRule ^-assets/.*$ index.php [L] RewriteRule ^(.*)$ index.php [L,QSA]
# Block direct access to all other content files
RewriteRule ^content/.*$ - [F,L]
</IfModule> </IfModule>
# Security headers # Security headers
@@ -53,21 +47,17 @@ Options -Indexes
Header always set X-Frame-Options DENY Header always set X-Frame-Options DENY
Header always set X-XSS-Protection "1; mode=block" Header always set X-XSS-Protection "1; mode=block"
Header always set Referrer-Policy "strict-origin-when-cross-origin" Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self';"
</IfModule> </IfModule>
# PHP settings
<IfModule mod_php.c> <IfModule mod_php.c>
php_flag display_errors Off php_flag display_errors Off
php_flag log_errors On php_flag log_errors On
php_value error_log /var/log/php_errors.log
php_value max_execution_time 30 php_value max_execution_time 30
php_value memory_limit 128M php_value memory_limit 128M
php_value upload_max_filesize 10M php_value upload_max_filesize 10M
php_value post_max_size 10M php_value post_max_size 10M
</IfModule> </IfModule>
# Default index file
DirectoryIndex index.php DirectoryIndex index.php
# Error handling
ErrorDocument 404 /index.php ErrorDocument 404 /index.php
+25 -25
View File
@@ -2,7 +2,7 @@
/** /**
* CodePress Admin Console - Entry Point * CodePress Admin Console - Entry Point
* Access via: /admin.php?route=login|dashboard|content|config|plugins|users|logout * Access via: //admin/login|dashboard|content|config|plugins|users|logout
*/ */
// Security headers // Security headers
@@ -29,7 +29,7 @@ if ($route === 'login') {
// All other routes require authentication // All other routes require authentication
if (!$auth->isAuthenticated()) { if (!$auth->isAuthenticated()) {
header('Location: admin.php?route=login'); header('Location: /admin/login');
exit; exit;
} }
@@ -37,7 +37,7 @@ if (!$auth->isAuthenticated()) {
switch ($route) { switch ($route) {
case 'logout': case 'logout':
$auth->logout(); $auth->logout();
header('Location: admin.php?route=login'); header('Location: /admin/login');
exit; exit;
case 'dashboard': case 'dashboard':
@@ -122,7 +122,7 @@ switch ($route) {
break; break;
default: default:
header('Location: admin.php?route=dashboard'); header('Location: /admin/dashboard');
exit; exit;
} }
@@ -143,7 +143,7 @@ function handleLogin(AdminAuth $auth): void
$result = $auth->login($username, $password); $result = $auth->login($username, $password);
if ($result['success']) { if ($result['success']) {
$auth->regenerateCsrfToken(); $auth->regenerateCsrfToken();
header('Location: admin.php?route=dashboard'); header('Location: /admin/dashboard');
exit; exit;
} }
$error = $result['message']; $error = $result['message'];
@@ -264,7 +264,7 @@ function handleContentEdit(AdminAuth $auth, array $config): void
$realPath = realpath($filePath); $realPath = realpath($filePath);
$realContentDir = realpath($contentDir); $realContentDir = realpath($contentDir);
if (!$realPath || !$realContentDir || strpos($realPath, $realContentDir) !== 0) { if (!$realPath || !$realContentDir || strpos($realPath, $realContentDir) !== 0) {
header('Location: admin.php?route=content'); header('Location: /admin/content');
exit; exit;
} }
@@ -405,7 +405,7 @@ function handleContentNew(AdminAuth $auth, array $config): void
} }
file_put_contents($filePath, $content); file_put_contents($filePath, $content);
header('Location: admin.php?route=content&dir=' . urlencode($dir)); header('Location: /admin/content&dir=' . urlencode($dir));
exit; exit;
} }
} }
@@ -454,14 +454,14 @@ function handleContentDelete(AdminAuth $auth, array $config): void
} }
$dir = dirname($file); $dir = dirname($file);
header('Location: admin.php?route=content&dir=' . urlencode($dir === '.' ? '' : $dir)); header('Location: /admin/content&dir=' . urlencode($dir === '.' ? '' : $dir));
exit; exit;
} }
function handleContentDirCreate(AdminAuth $auth, array $config): void function handleContentDirCreate(AdminAuth $auth, array $config): void
{ {
if ($_SERVER['REQUEST_METHOD'] !== 'POST') { if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
header('Location: admin.php?route=content'); header('Location: /admin/content');
exit; exit;
} }
@@ -470,7 +470,7 @@ function handleContentDirCreate(AdminAuth $auth, array $config): void
$subdir = str_replace(['../', '..\\'], '', $subdir); $subdir = str_replace(['../', '..\\'], '', $subdir);
if (!$auth->verifyCsrf($_POST['csrf_token'] ?? '')) { if (!$auth->verifyCsrf($_POST['csrf_token'] ?? '')) {
header('Location: admin.php?route=content&dir=' . urlencode($subdir)); header('Location: /admin/content&dir=' . urlencode($subdir));
exit; exit;
} }
@@ -483,7 +483,7 @@ function handleContentDirCreate(AdminAuth $auth, array $config): void
} }
} }
header('Location: admin.php?route=content&dir=' . urlencode($subdir)); header('Location: /admin/content&dir=' . urlencode($subdir));
exit; exit;
} }
@@ -498,7 +498,7 @@ function handleContentDirRename(AdminAuth $auth, array $config): void
$realContentDir = realpath($contentDir); $realContentDir = realpath($contentDir);
if (!$realPath || !$realContentDir || strpos($realPath, $realContentDir) !== 0 || !is_dir($fullPath)) { if (!$realPath || !$realContentDir || strpos($realPath, $realContentDir) !== 0 || !is_dir($fullPath)) {
header('Location: admin.php?route=content'); header('Location: /admin/content');
exit; exit;
} }
@@ -518,7 +518,7 @@ function handleContentDirRename(AdminAuth $auth, array $config): void
} }
$parentRelative = dirname($dir); $parentRelative = dirname($dir);
header('Location: admin.php?route=content&dir=' . urlencode($parentRelative === '.' ? '' : $parentRelative)); header('Location: /admin/content&dir=' . urlencode($parentRelative === '.' ? '' : $parentRelative));
exit; exit;
} }
@@ -540,7 +540,7 @@ function handleContentMove(AdminAuth $auth, array $config): void
$realContentDir = realpath($contentDir); $realContentDir = realpath($contentDir);
if (!$realPath || !$realContentDir || strpos($realPath, $realContentDir) !== 0) { if (!$realPath || !$realContentDir || strpos($realPath, $realContentDir) !== 0) {
header('Location: admin.php?route=content'); header('Location: /admin/content');
exit; exit;
} }
@@ -560,7 +560,7 @@ function handleContentMove(AdminAuth $auth, array $config): void
} }
$parentRelative = is_file($fullPath) ? dirname($item) : dirname($item); $parentRelative = is_file($fullPath) ? dirname($item) : dirname($item);
header('Location: admin.php?route=content&dir=' . urlencode($parentRelative === '.' ? '' : $parentRelative)); header('Location: /admin/content&dir=' . urlencode($parentRelative === '.' ? '' : $parentRelative));
exit; exit;
} }
@@ -598,7 +598,7 @@ function handleContentDirDelete(AdminAuth $auth, array $config): void
} }
$parentDir = dirname($dir); $parentDir = dirname($dir);
header('Location: admin.php?route=content&dir=' . urlencode($parentDir === '.' ? '' : $parentDir)); header('Location: /admin/content&dir=' . urlencode($parentDir === '.' ? '' : $parentDir));
exit; exit;
} }
@@ -833,7 +833,7 @@ function handlePluginConfig(AdminAuth $auth, array $config): void
$messageType = ''; $messageType = '';
if (empty($pluginName) || !is_dir($pluginPath)) { if (empty($pluginName) || !is_dir($pluginPath)) {
header('Location: admin.php?route=plugins'); header('Location: /admin/plugins');
exit; exit;
} }
@@ -878,7 +878,7 @@ function handlePluginEdit(AdminAuth $auth, array $config): void
$messageType = ''; $messageType = '';
if (empty($pluginName) || !is_dir($pluginPath) || !file_exists($pluginFile)) { if (empty($pluginName) || !is_dir($pluginPath) || !file_exists($pluginFile)) {
header('Location: admin.php?route=plugins'); header('Location: /admin/plugins');
exit; exit;
} }
@@ -954,7 +954,7 @@ function handlePluginNew(AdminAuth $auth, array $config): void
file_put_contents($pluginPath . '/README.md', $readme); file_put_contents($pluginPath . '/README.md', $readme);
} }
header('Location: admin.php?route=plugins'); header('Location: /admin/plugins');
exit; exit;
} }
} }
@@ -968,7 +968,7 @@ function handlePluginNew(AdminAuth $auth, array $config): void
function handlePluginToggle(AdminAuth $auth, array $config): void function handlePluginToggle(AdminAuth $auth, array $config): void
{ {
if ($_SERVER['REQUEST_METHOD'] !== 'POST') { if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
header('Location: admin.php?route=plugins'); header('Location: /admin/plugins');
exit; exit;
} }
@@ -977,7 +977,7 @@ function handlePluginToggle(AdminAuth $auth, array $config): void
$pluginPath = $pluginsDir . '/' . $pluginName; $pluginPath = $pluginsDir . '/' . $pluginName;
if (empty($pluginName) || !is_dir($pluginPath)) { if (empty($pluginName) || !is_dir($pluginPath)) {
header('Location: admin.php?route=plugins'); header('Location: /admin/plugins');
exit; exit;
} }
@@ -992,14 +992,14 @@ function handlePluginToggle(AdminAuth $auth, array $config): void
} }
} }
header('Location: admin.php?route=plugins'); header('Location: /admin/plugins');
exit; exit;
} }
function handlePluginDelete(AdminAuth $auth, array $config): void function handlePluginDelete(AdminAuth $auth, array $config): void
{ {
if ($_SERVER['REQUEST_METHOD'] !== 'POST') { if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
header('Location: admin.php?route=plugins'); header('Location: /admin/plugins');
exit; exit;
} }
@@ -1008,7 +1008,7 @@ function handlePluginDelete(AdminAuth $auth, array $config): void
$pluginPath = $pluginsDir . '/' . $pluginName; $pluginPath = $pluginsDir . '/' . $pluginName;
if (empty($pluginName) || !is_dir($pluginPath)) { if (empty($pluginName) || !is_dir($pluginPath)) {
header('Location: admin.php?route=plugins'); header('Location: /admin/plugins');
exit; exit;
} }
@@ -1021,7 +1021,7 @@ function handlePluginDelete(AdminAuth $auth, array $config): void
rmdir($pluginPath); rmdir($pluginPath);
} }
header('Location: admin.php?route=plugins'); header('Location: /admin/plugins');
exit; exit;
} }