- version.php: 1.5.0 → 1.6.0 + changelog for media browser, editor, theme management, content move/rename, /-media/ prefix - README.md/README.en.md: complete rewrite with current project structure, config format, admin features, CodeMirror, themes, quick start - guide/nl.codepress.md, guide/en.codepress.md: comprehensive update matching all current admin routes, features, and project layout - TODO.md: compiled from docs/TODO.md with completed/future items
218 lines
7.5 KiB
Markdown
218 lines
7.5 KiB
Markdown
# CodePress CMS
|
|
|
|
**[🇳🇱 Nederlands](README.md) | [🇬🇧 English](#)**
|
|
|
|
A lightweight, file-based content management system built with PHP.
|
|
|
|
**Version:** 1.5.0 | **License:** AGPL v3 / Commercial
|
|
|
|
## ✨ Features
|
|
|
|
- 📝 **Multi-format Content** - Supports Markdown, PHP and HTML files
|
|
- 🧭 **Dynamic Navigation** - Automatic menu generation with dropdowns
|
|
- 🌍 **Multi-language** - Dutch and English with automatic detection
|
|
- 🔍 **Search Functionality** - Full-text search through all content
|
|
- 🧭 **Breadcrumb Navigation** - Intuitive navigation paths with sidebar toggle
|
|
- 🔗 **Auto-linking** - Automatic links between pages
|
|
- 📱 **Responsive Design** - Works perfectly on all devices
|
|
- ⚙️ **JSON Configuration** - Easy configuration via JSON
|
|
- 🎨 **Themes** - Customizable themes with colors and backgrounds
|
|
- 🔒 **Security** - Secure content management (100/100 security score)
|
|
- 🛡️ **Admin Console** - Built-in admin panel with CodeMirror editor, media browser, theme manager, and plugin configuration
|
|
|
|
## 🚀 Quick Start
|
|
|
|
```bash
|
|
php -S localhost:8080 -t public
|
|
```
|
|
Visit `http://localhost:8080` in your browser.
|
|
Admin panel: `http://localhost:8080/admin.php` (login: `admin` / `admin`)
|
|
|
|
## 📁 Project Structure
|
|
|
|
```
|
|
codepress/
|
|
├── cms/ # Core CMS engine
|
|
│ ├── core/
|
|
│ │ ├── class/
|
|
│ │ │ ├── CodePressCMS.php # Main CMS class
|
|
│ │ │ ├── Logger.php # Logging system
|
|
│ │ │ ├── SimpleTemplate.php # Mustache-style template engine
|
|
│ │ │ ├── Cache.php
|
|
│ │ │ ├── AssetManager.php
|
|
│ │ │ ├── SearchEngine.php
|
|
│ │ │ ├── ContentSecurityPolicy.php
|
|
│ │ │ └── ...
|
|
│ │ ├── plugin/
|
|
│ │ │ ├── PluginManager.php # Plugin loader
|
|
│ │ │ └── CMSAPI.php # Plugin API
|
|
│ │ ├── config.php # Configuration loader
|
|
│ │ └── index.php # Bootstrap (autoloader)
|
|
│ ├── lang/ # Language files (nl.php, en.php)
|
|
│ ├── templates/ # Mustache templates
|
|
│ │ ├── layout.mustache
|
|
│ │ ├── assets/ (header, navigation, footer)
|
|
│ │ ├── markdown_content.mustache
|
|
│ │ ├── php_content.mustache
|
|
│ │ └── html_content.mustache
|
|
│ └── router.php # PHP dev server router
|
|
├── admin/ # Admin panel
|
|
│ ├── config/
|
|
│ │ ├── app.php # Admin configuration
|
|
│ │ └── admin.json # Users & security
|
|
│ ├── src/
|
|
│ │ └── AdminAuth.php # Authentication (sessions, 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/ # Uploaded theme backgrounds
|
|
├── themes/ # Theme configurations
|
|
│ ├── default/theme.json
|
|
│ └── test/theme.json
|
|
├── content/ # Content files
|
|
├── guide/ # Manuals (nl/en)
|
|
├── docs/ # Documentation
|
|
└── config.json # Site configuration
|
|
```
|
|
|
|
## ⚙️ Configuration
|
|
|
|
### Basic Configuration (`config.json`)
|
|
|
|
```json
|
|
{
|
|
"site_title": "CodePress",
|
|
"content_dir": "content",
|
|
"templates_dir": "cms/templates",
|
|
"default_page": "index",
|
|
"active_theme": "default",
|
|
"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"
|
|
},
|
|
"features": {
|
|
"auto_link_pages": true,
|
|
"search_enabled": true,
|
|
"breadcrumbs_enabled": true
|
|
}
|
|
}
|
|
```
|
|
|
|
## 📝 Content Types
|
|
|
|
### Markdown (.md)
|
|
- Auto-linking between pages
|
|
- GitHub Flavored Markdown via `league/commonmark`
|
|
- Automatic title extraction
|
|
- Multi-language with `en.page.md` and `nl.page.md`
|
|
|
|
### PHP (.php)
|
|
- Full PHP support
|
|
- Dynamic content generation
|
|
|
|
### HTML (.html)
|
|
- Static HTML pages
|
|
- Bootstrap components
|
|
|
|
## 🛡️ Admin Console
|
|
|
|
CodePress includes a built-in admin panel for managing your website.
|
|
|
|
**Access:** `/admin.php` | **Default login:** `admin` / `admin`
|
|
|
|
### Modules
|
|
- **Dashboard** - Overview with statistics and quick actions
|
|
- **Content** - Browse, create, edit, rename, move, and delete files
|
|
- **CodeMirror Editor** - Syntax highlighting with toolbar (bold, italic, heading, link, image, list, media)
|
|
- **Media Browser** - Upload and insert images/video/audio with size prompt
|
|
- **Configuration** - Edit `config.json` with JSON validation
|
|
- **Themes** - Create, activate, edit, delete themes with background upload
|
|
- **Plugins** - Overview, install, configure, and toggle
|
|
- **Users** - Add, remove users and change passwords
|
|
|
|
### Security
|
|
- Session-based authentication with bcrypt password hashing
|
|
- CSRF protection on all forms
|
|
- Brute-force protection (5 attempts, 15 min lockout)
|
|
- Path traversal protection via `realpath()` + prefix-check
|
|
- Session timeout (30 min)
|
|
- Security headers: CSP, X-Frame-Options, X-Content-Type-Options
|
|
|
|
> **Important:** Change the default password immediately after installation via Users.
|
|
|
|
## 🎨 Themes
|
|
|
|
Themes are stored in `themes/name/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"
|
|
}
|
|
```
|
|
|
|
## 🌍 Multi-language Support
|
|
|
|
- File naming convention: `nl.[page].md` and `en.[page].md`
|
|
- Language prefix is automatically removed from display
|
|
- URL: `/?page=test&lang=nl` or `/?page=test&lang=en`
|
|
- Automatic language detection via browser or config
|
|
|
|
## 🔧 Requirements
|
|
|
|
- **PHP 8.1+**
|
|
- **Web server** (Apache, Nginx, or PHP built-in server)
|
|
- **Composer** (for `league/commonmark`)
|
|
|
|
## 🛠️ Installation
|
|
|
|
```bash
|
|
git clone https://git.noorlander.info/E.Noorlander/CodePress.git
|
|
cd CodePress
|
|
composer install
|
|
php -S localhost:8080 -t public
|
|
```
|
|
|
|
## 📖 Documentation
|
|
|
|
- **[Guide (NL)](guide/nl.codepress.md)**
|
|
- **[Guide (EN)](guide/en.codepress.md)**
|
|
- **[TODO](TODO.md)** - Upcoming improvements
|
|
- **[AGENTS.md](AGENTS.md)** - Developer instructions
|
|
|
|
## 📄 License
|
|
|
|
CodePress CMS is available under a **dual-license model**: AGPL v3 (open-source) or Commercial.
|
|
|
|
---
|
|
|
|
*Built by Edwin Noorlander*
|