# CodePress CMS **[๐Ÿ‡ณ๐Ÿ‡ฑ Dutch](README.md) | [๐Ÿ‡ฌ๐Ÿ‡ง English](#)** A lightweight, file-based content management system built with PHP (โ‰ฅ8.0). **Version:** 2.5.1 | **License:** AGPL v3 / Commercial ## โœจ Features - ๐Ÿ“ **Multi-format Content** - Markdown, PHP and HTML files - ๐Ÿงญ **Dynamic Navigation** - Automatic menu generation - ๐ŸŒ **Multi-language** - NL/EN/DE/FR support - ๐Ÿ” **Search** - Full-text search - ๐Ÿ“ฑ **Responsive** - Bootstrap 5 themes - ๐Ÿ”’ **Security** - 100/100 pentest score - ๐Ÿ›ก๏ธ **Admin Console** - CodeMirror editor, media management, themes, plugins - ๐Ÿ‘ฅ **User Roles** - Admin, Content Manager, BI Manager, Site Admin - ๐Ÿ“Š **Analytics** - Visitor statistics with GeoIP - ๐Ÿค– **BotGuard** - Bot/AI protection - ๐Ÿ“ˆ **Logging** - Comprehensive logging system - ๐Ÿ”Œ **Plugin System** - Sidebar plugins with own CSS/SCSS, Twig templates ## ๐Ÿš€ Quick Start ```bash # Install dependencies composer install # Start server with router for clean URLs php -S localhost:8080 cms/router.php ``` **Website:** `http://localhost:8080` **Admin:** `http://localhost:8080/admin` (login: `admin` / `admin`) ## ๐Ÿ“š Documentation See **[guide/](guide/)** for extensive documentation per role: | Role | Guide | |------|-------| | ๐Ÿ“ Content Editor | [Content Manager](guide/en/content-beheerder.md) | | โš™๏ธ Administrator | [Admin Manager](guide/en/admin-beheerder.md) | | ๐ŸŽจ Theme Developer | [Theme Developer](guide/en/theme-developer.md) | | ๐Ÿ’ป Developer | [CodePress Developer](guide/en/codepress-developer.md) | Each guide has sub-topics in separate folders with sidebar navigation. ## ๐Ÿ‘ฅ User Roles | Role | Permissions | |------|------------| | **Admin** | Full access (everything) | | **Content Manager** | Content management, guide | | **BI Manager** | Statistics, logs, guide | | **Site Admin** | Theme, plugins, statistics, logs, update, guide | ## ๐Ÿ“ Project Structure ``` codepress/ โ”œโ”€โ”€ cms/ # Core CMS engine โ”‚ โ”œโ”€โ”€ core/class/ # CMS classes (CodePressCMS, ThemeManager, etc.) โ”‚ โ”œโ”€โ”€ core/plugin/ # Plugin system (PluginManager, CMSAPI) โ”‚ โ”œโ”€โ”€ lang/ # Translation files (nl.php, en.php) โ”‚ โ””โ”€โ”€ router.php # PHP dev server router (clean URLs) โ”œโ”€โ”€ admin/ # Admin console โ”‚ โ”œโ”€โ”€ config/ # Admin configuration (admin.json) โ”‚ โ”œโ”€โ”€ src/AdminAuth.php # Authentication, roles, permissions โ”‚ โ”œโ”€โ”€ storage/ # Logs, cache, geoip โ”‚ โ””โ”€โ”€ theme/default/ # Admin theme โ”‚ โ”œโ”€โ”€ assets/ # CSS, JS, fonts, codemirror โ”‚ โ”œโ”€โ”€ views/ # Twig templates (layouts, pages) โ”‚ โ””โ”€โ”€ theme.json # Admin theme configuration โ”œโ”€โ”€ themes/ # Website themes โ”‚ โ”œโ”€โ”€ default/ # Default theme โ”‚ โ”‚ โ”œโ”€โ”€ theme.json # Layout mapping, colors โ”‚ โ”‚ โ”œโ”€โ”€ base.twig # Main layout โ”‚ โ”‚ โ”œโ”€โ”€ *.twig # Layout templates โ”‚ โ”‚ โ”œโ”€โ”€ partials/ # Header, navigation, footer โ”‚ โ”‚ โ””โ”€โ”€ assets/ # SCSS, CSS, JS, img โ”‚ โ””โ”€โ”€ demo/ # Demo theme โ”œโ”€โ”€ plugins/ # Plugins โ”‚ โ”œโ”€โ”€ HTMLBlock/ # Example sidebar plugin โ”‚ โ””โ”€โ”€ Navigation/ # Essential navigation plugin (protected) โ”‚ โ”œโ”€โ”€ Navigation.php # Plugin code โ”‚ โ”œโ”€โ”€ plugin.json # Plugin metadata โ”‚ โ”œโ”€โ”€ assets/scss/ # Plugin SCSS source โ”‚ โ””โ”€โ”€ 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/ # Documentation (nl/en) โ”‚ โ”œโ”€โ”€ nl/ # Dutch guides โ”‚ โ””โ”€โ”€ en/ # English guides โ”œโ”€โ”€ cli/test/ # Test suites โ”œโ”€โ”€ var/ # Cache (twig) โ”œโ”€โ”€ config.json # Site configuration โ”œโ”€โ”€ composer.json # PHP dependencies โ””โ”€โ”€ version.php # Version information ``` ## โš™๏ธ Configuration ### config.json ```json { "site_title": "CodePress", "active_theme": "default", "default_page": "auto", "language": { "default": "nl", "available": ["nl", "en"] }, "enabled_plugins": ["HTMLBlock", "Navigation"], "features": { "search_enabled": true, "breadcrumbs_enabled": true }, "security": { "block_ai_bots": true, "rate_limit_enabled": true }, "analytics": { "enabled": true }, "logging": { "enabled": true } } ``` ## ๐Ÿ”ง Dependencies - **PHP โ‰ฅ8.0** with extensions: json, mbstring - **Composer** packages: - twig/twig (templating) - scssphp/scssphp (SCSS compilation) - league/commonmark (Markdown with HeadingPermalinks) - maxmind-db/reader (GeoIP) ## ๐Ÿ” Security - โœ… XSS prevention (htmlspecialchars) - โœ… CSRF tokens (admin forms) - โœ… Path traversal prevention (realpath checks) - โœ… Secure cookies (HttpOnly, SameSite) - โœ… Security headers (X-Frame-Options, CSP) - โœ… Bot/AI protection (BotGuard) - โœ… Rate limiting per IP - โœ… Role-based access control (RBAC) ## ๐Ÿ”Œ Plugins ### Plugin structure ``` plugins/MyPlugin/ โ”œโ”€โ”€ MyPlugin.php # Plugin code (name = plugin name) โ”œโ”€โ”€ plugin.json # Plugin metadata โ”œโ”€โ”€ assets/scss/ # Plugin SCSS source โ””โ”€โ”€ assets/css/ # Plugin CSS (after compilation) ``` ### Essential plugins The **Navigation** plugin is an essential plugin and cannot be disabled, edited, or deleted. This plugin automatically generates sidebar navigation for guides and content. ### Plugin CSS Plugin CSS is automatically loaded after theme CSS, so themes can override plugin styling. ## ๐Ÿ“ Content Examples ### Markdown with frontmatter ```markdown --- layout: full_content plugins: HTMLBlock, Navigation --- # Page title Content in Markdown format... ``` ### PHP content ```php getAllPages(); echo "

My Page

"; echo "

Number of pages: " . count($pages) . "

"; ``` ## ๐Ÿงช Testing ```bash # Penetration tests cli/test/pentest/security-test.sh # Accessibility tests (WCAG 2.1 AA) cli/test/accessibility.sh # Functional tests cli/test/functional/*.sh ``` ## ๐Ÿ“ž Support - **Documentation:** [guide/](guide/) - **Issues:** Git repository - **Contact:** commercial@noorlander.info ## ๐Ÿ“„ License **Dual-licensed:** - **AGPL v3** - For open-source projects - **Commercial** - For proprietary use See [LICENSE](LICENSE) for details. --- **CodePress CMS** - Built by E.Noorlander / CodePress Development Team