v2.5.1: Admin theme refactor, Navigation plugin, user roles, guide restructure

- Reorganize admin into admin/theme/default/ (views + assets)
- Rename GuideNav to Navigation plugin (essential, protected)
- Plugin assets support (SCSS/CSS) loaded after theme CSS
- User roles: Admin, Content Manager, BI Manager, Site Admin
- Role-based access control (RBAC) for admin routes and sidebar
- Guide restructure: sub-topics in separate folders with sidebar nav
- Dynamic breadcrumb for homepage and subdirectories
- Fix theme path traversal (../../ -> ../) in admin.php
- Fix CodeMirror mode load order (xml -> css -> js -> htmlmixed -> php)
- Fix editor-toolbar.js null checks for plugin edit pages
- Layout select from theme.json with live frontmatter update
- Footer sticky at bottom of viewport (min-height: 100vh)
- Breadcrumb color fix (var(--nav-font) -> var(--header-bg))
- Remove language switcher from guide pages
- Update README.md and README.en.md
- Bump version to 2.5.1
This commit is contained in:
2026-08-10 15:36:29 +02:00
parent 0961b23b8d
commit cd498c8c3a
209 changed files with 11033 additions and 9125 deletions
+167 -163
View File
@@ -2,222 +2,226 @@
**[🇳🇱 Nederlands](#) | [🇬🇧 English](README.en.md)**
Een lichtgewicht, file-based content management systeem gebouwd met PHP.
Een lichtgewicht, file-based content management systeem gebouwd met PHP (≥8.0).
**Versie:** 1.5.0 | **Licentie:** AGPL v3 / Commercial
**Versie:** 2.5.0 | **Licentie:** AGPL v3 / Commercial
## ✨ Features
- 📝 **Multi-format Content** - Ondersteunt Markdown, PHP en HTML bestanden
- 🧭 **Dynamic Navigation** - Automatische menu generatie met dropdowns
- 🌍 **Multi-language** - Nederlands en Engels met automatische detectie
- 🔍 **Search Functionality** - Volledige tekst zoek door alle content
- 🧭 **Breadcrumb Navigation** - Intuïtieve navigatiepaden met sidebar toggle
- 🔗 **Auto-linking** - Automatische links tussen pagina's
- 📱 **Responsive Design** - Werkt perfect op alle apparaten
- ⚙️ **JSON Configuratie** - Eenvoudige configuratie via JSON
- 🎨 **Thema's** - Aanpasbare thema's met eigen kleuren en achtergronden
- 🔒 **Security** - Beveiligde content management (100/100 security score)
- 🛡️ **Admin Console** - Ingebouwd admin paneel met CodeMirror editor, media browser, themabeheer en plugin configuratie
- 📝 **Multi-format Content** - Markdown, PHP en HTML bestanden
- 🧭 **Dynamic Navigation** - Automatische menu generatie
- 🌍 **Multi-language** - NL/EN/DE/FR ondersteuning
- 🔍 **Search** - Volledige tekst zoekfunctie
- 📱 **Responsive** - Bootstrap 5 thema's
- 🔒 **Security** - 100/100 pentest score
- 🛡️ **Admin Console** - CodeMirror editor, media beheer, thema's, plugins
- 👥 **Gebruikersrollen** - Admin, Content Beheerder, BI Beheerder, Site Admin
- 📊 **Analytics** - Bezoekersstatistieken met GeoIP
- 🤖 **BotGuard** - Bot/AI bescherming
- 📈 **Logging** - Uitgebreid logging systeem
- 🔌 **Plugin Systeem** - Sidebar plugins met eigen CSS/SCSS, Twig templates
## 🚀 Quick Start
```bash
php -S localhost:8080 -t public
# Installeer dependencies
composer install
# Start server met router voor schone URLs
php -S localhost:8080 cms/router.php
```
Bezoek `http://localhost:8080` in je browser.
Admin paneel: `http://localhost:8080/admin.php` (login: `admin` / `admin`)
**Website:** `http://localhost:8080`
**Admin:** `http://localhost:8080/admin` (login: `admin` / `admin`)
## 📚 Handleidingen
Zie **[guide/](guide/)** voor uitgebreide documentatie per rol:
| Rol | Handleiding |
|-----|-------------|
| 📝 Redacteur | [Content Beheerder](guide/nl/content-beheerder.md) |
| ⚙️ Administrator | [Admin Beheerder](guide/nl/admin-beheerder.md) |
| 🎨 Theme bouwer | [Theme Developer](guide/nl/theme-developer.md) |
| 💻 Developer | [CodePress Developer](guide/nl/codepress-developer.md) |
Elke handleiding heeft sub-onderdelen in aparte mappen met een zijbalknavigatie.
## 👥 Gebruikersrollen
| Rol | Permissies |
|-----|-----------|
| **Admin** | Volledige toegang (alles) |
| **Content Beheerder** | Content beheer, handleiding |
| **BI Beheerder** | Statistieken, logs, handleiding |
| **Site Admin** | Thema, plugins, statistieken, logs, update, handleiding |
## 📁 Project Structuur
```
codepress/
├── cms/ # Core CMS engine
│ ├── core/
│ ├── class/
├── CodePressCMS.php # Hoofd CMS class
│ │ ├── Logger.php # Logging systeem
├── SimpleTemplate.php # Mustache-style template engine
│ │ ├── Cache.php
├── AssetManager.php
├── SearchEngine.php
│ │ ├── ContentSecurityPolicy.php
└── ...
├── plugin/
│ │ ── PluginManager.php # Plugin loader
└── CMSAPI.php # API voor plugins
│ ├── config.php # Config loader
│ │ ── index.php # Bootstrap (autoloader)
│ ├── lang/ # Taalbestanden (nl.php, en.php)
└── router.php # PHP dev server router (serveert ook /themes/)
├── themes/ # Dynamische thema's (volledig zelfstandig)
├── default/ # Standaard thema
│ ├── theme.json # { title, default_layout, layout→.twig mapping, kleuren }
├── base.twig # Hoofd layout
│ ├── full_content.twig # Layout: volledige breedte
│ ├── left_sidebar.twig # Layout: sidebar links
├── right_sidebar.twig # Layout: sidebar rechts
├── custom1.twig # Layout: custom
├── partials/ # header, navigation, footer
── css/theme.scss # SCSS bron (runtime gecompileerd)
│ │ └── js/theme.js # Thema JavaScript
│ ├── demo/ # Demo thema
── test/ # Test thema
── admin/ # Admin paneel
│ ├── config/
│ ├── app.php # Admin configuratie
│ └── admin.json # Gebruikers & security
│ ├── src/
└── AdminAuth.php # Authenticatie (sessies, bcrypt, CSRF)
│ ├── templates/
│ │ ├── login.php
│ │ ├── layout.php
│ │ └── pages/ (dashboard, content, content-edit, content-new,
│ │ content-dir-form, content-move-form, config, plugins,
│ │ plugins-edit, plugins-new, plugin-config, theme, media, users)
│ └── storage/logs/
├── cli/test/ # CLI scripts & tests
├── plugins/ # CMS plugins (HTMLBlock, MQTTTracker)
├── public/ # Web root
│ ├── assets/
│ │ ├── css/ (Bootstrap, styles, editor.css)
│ │ ├── js/ (Bootstrap, app.js, editor-toolbar.js)
│ │ └── codemirror/ (CodeMirror editor + modes)
│ ├── index.php # Website entry point
│ ├── admin.php # Admin entry point + router
│ └── themes/ # Geuploade thema achtergronden
├── themes/ # Thema configuraties
│ ├── default/theme.json
│ └── test/theme.json
├── content/ # Content bestanden
├── guide/ # Handleidingen (nl/en)
├── docs/ # Documentatie
└── config.json # Site configuratie
├── cms/ # Core CMS engine
│ ├── core/class/ # CMS classes (CodePressCMS, ThemeManager, etc.)
│ ├── core/plugin/ # Plugin systeem (PluginManager, CMSAPI)
├── lang/ # Taalbestanden (nl.php, en.php)
└── router.php # PHP dev server router (schone URLs)
├── admin/ # Admin console
├── config/ # Admin configuratie (admin.json)
├── src/AdminAuth.php # Authenticatie, rollen, permissies
├── storage/ # Logs, cache, geoip
└── theme/default/ # Admin thema
├── assets/ # CSS, JS, fonts, codemirror
├── views/ # Twig templates (layouts, pages)
── theme.json # Admin thema configuratie
├── themes/ # Website thema's
│ ├── default/ # Standaard thema
│ │ ── theme.json # Layout mapping, kleuren
│ ├── base.twig # Hoofd layout
│ ├── *.twig # Layout templates
│ │ ├── partials/ # Header, navigation, footer
│ └── assets/ # SCSS, CSS, JS, img
└── demo/ # Demo thema
├── plugins/ # Plugins
│ ├── HTMLBlock/ # Voorbeeld sidebar plugin
└── Navigation/ # Essentiële navigatie plugin (beschermd)
├── Navigation.php # Plugin code
├── plugin.json # Plugin metadata
├── assets/scss/ # Plugin SCSS bron
── assets/css/ # Plugin CSS
├── content/ # Website content (.md, .php, .html)
├── public/ # Web root
── index.php # Website entry point
│ └── admin.php # Admin entry point + routing
├── guide/ # Handleidingen (nl/en)
│ ├── nl/ # Nederlandse handleidingen
│ └── en/ # Engelse handleidingen
├── cli/test/ # Test suites
├── var/ # Cache (twig)
├── config.json # Site configuratie
├── composer.json # PHP dependencies
└── version.php # Versie informatie
```
## ⚙️ Configuratie
### Basis Configuratie (`config.json`)
### config.json
```json
{
"site_title": "CodePress",
"content_dir": "content",
"default_page": "index",
"active_theme": "default",
"default_page": "auto",
"language": {
"default": "nl",
"available": ["nl", "en"]
},
"seo": {
"description": "CodePress CMS - Lightweight file-based content management system",
"keywords": "cms, php, content management, file-based"
},
"author": {
"name": "E. Noorlander",
"website": "https://noorlander.info"
},
"enabled_plugins": ["HTMLBlock", "Navigation"],
"features": {
"auto_link_pages": true,
"search_enabled": true,
"breadcrumbs_enabled": true
}
},
"security": {
"block_ai_bots": true,
"rate_limit_enabled": true
},
"analytics": { "enabled": true },
"logging": { "enabled": true }
}
```
## 📝 Content Types
## 🔧 Dependencies
### Markdown (.md)
- Auto-linking tussen pagina's
- GitHub Flavored Markdown via `league/commonmark`
- Automatische titel extractie
- Multi-language met `nl.bestand.md` en `en.bestand.md`
- **PHP ≥8.0** met extensies: json, mbstring
- **Composer** packages:
- twig/twig (templating)
- scssphp/scssphp (SCSS compilatie)
- league/commonmark (Markdown met HeadingPermalinks)
- maxmind-db/reader (GeoIP)
### PHP (.php)
- Volledige PHP ondersteuning
- Dynamische content generatie
## 🔐 Security
### HTML (.html)
- Statische HTML pagina's
- Bootstrap componenten
- ✅ XSS preventie (htmlspecialchars)
- ✅ CSRF tokens (admin formulieren)
- ✅ Path traversal preventie (realpath checks)
- ✅ Secure cookies (HttpOnly, SameSite)
- ✅ Security headers (X-Frame-Options, CSP)
- ✅ Bot/AI bescherming (BotGuard)
- ✅ Rate limiting per IP
- ✅ Role-based access control (RBAC)
## 🛡️ Admin Console
## 🔌 Plugins
CodePress bevat een ingebouwd admin paneel voor het beheren van je website.
### Plugin structuur
**Toegang:** `/admin.php` | **Standaard login:** `admin` / `admin`
### Modules
- **Dashboard** - Overzicht met statistieken en snelle acties
- **Content** - Bestanden browsen, aanmaken, bewerken, hernoemen en verwijderen
- **CodeMirror Editor** - Syntax highlighting met toolbar (vet, cursief, kop, link, afbeelding, lijst, media)
- **Media Browser** - Uploaden en invoegen van afbeeldingen/video/audio met size prompt
- **Configuratie** - `config.json` bewerken met JSON-validatie
- **Thema's** - Thema aanmaken, activeren, bewerken, verwijderen met achtergrond upload
- **Plugins** - Overzicht, installeren, configureren en toggle
- **Gebruikers** - Gebruikers toevoegen, verwijderen en wachtwoorden wijzigen
### Beveiliging
- Session-based authenticatie met bcrypt password hashing
- CSRF-bescherming op alle formulieren
- Brute-force bescherming (5 pogingen, 15 min lockout)
- Path traversal bescherming via `realpath()` + prefix-check
- Session timeout (30 min)
- Security headers: CSP, X-Frame-Options, X-Content-Type-Options
> **Belangrijk:** Wijzig het standaard wachtwoord direct na installatie via Gebruikers.
## 🎨 Thema's
Thema's worden opgeslagen in `themes/naam/theme.json`:
```json
{
"name": "default",
"label": "Standard",
"header_color": "#0a369d",
"header_font_color": "#ffffff",
"navigation_color": "#2754b4",
"navigation_font_color": "#ffffff",
"sidebar_background": "#f8f9fa",
"sidebar_border": "#dee2e6",
"background_image": "/themes/default_bg.jpg"
}
```
plugins/MijnPlugin/
├── MijnPlugin.php # Plugin code (naam = pluginnaam)
├── plugin.json # Plugin metadata
├── assets/scss/ # Plugin SCSS bron
└── assets/css/ # Plugin CSS (na compilatie)
```
## 🌍 Multi-language Support
### Essentiële plugins
- Bestandsnaam conventie: `nl.[pagina].md` en `en.[page].md`
- Taalprefix wordt automatisch verwijderd uit weergave
- URL: `/?page=test&lang=nl` of `/?page=test&lang=en`
- Automatische taal detector op basis van browser of config
De **Navigation** plugin is een essentiële plugin en kan niet worden gedeactiveerd, bewerkt of verwijderd. Deze plugin genereert automatisch de zijbalknavigatie voor handleidingen en content.
## 🔧 Vereisten
### Plugin CSS
- **PHP 8.1+**
- **Webserver** (Apache, Nginx, of PHP built-in server)
- **Composer** (voor `league/commonmark`)
Plugin CSS wordt automatisch geladen na thema CSS, zodat thema's plugin styling kunnen overschrijven.
## 🛠️ Installatie
## 📝 Content Voorbeelden
### Markdown met frontmatter
```markdown
---
layout: full_content
plugins: HTMLBlock, Navigation
---
# Pagina titel
Content in Markdown formaat...
```
### PHP content
```php
<?php
/** @var ContentAPI $api */
$pages = $api->getAllPages();
echo "<h1>Mijn Pagina</h1>";
echo "<p>Aantal pagina's: " . count($pages) . "</p>";
```
## 🧪 Testen
```bash
git clone https://git.noorlander.info/E.Noorlander/CodePress.git
cd CodePress
composer install
php -S localhost:8080 -t public
# Penetration tests
cli/test/pentest/security-test.sh
# Accessibility tests (WCAG 2.1 AA)
cli/test/accessibility.sh
# Functionele tests
cli/test/functional/*.sh
```
## 📖 Documentatie
## 📞 Ondersteuning
- **[Handleiding (NL)](guide/nl.codepress.md)**
- **[Guide (EN)](guide/en.codepress.md)**
- **[TODO](TODO.md)** - Openstaande verbeteringen
- **[AGENTS.md](AGENTS.md)** - Ontwikkelaar instructies
- **Documentatie:** [guide/](guide/)
- **Issues:** Git repository
- **Contact:** commercial@noorlander.info
## 📄 Licentie
CodePress CMS is beschikbaar onder een **dual-license model**: AGPL v3 (open-source) of Commercial.
**Dual-licensed:**
- **AGPL v3** - Voor open-source projecten
- **Commercial** - Voor propriëtair gebruik
Zie [LICENSE](LICENSE) voor details.
---
*Gebouwd door Edwin Noorlander*
**CodePress CMS** - Gebouwd door E.Noorlander / CodePress Development Team