Bump version to 1.6.0, update docs and guides to match current project state
- 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
This commit is contained in:
430
README.en.md
430
README.en.md
@@ -10,21 +10,23 @@ A lightweight, file-based content management system built with PHP.
|
||||
|
||||
- 📝 **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
|
||||
- 🧭 **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
|
||||
- 🎨 **Bootstrap 5** - Modern UI framework
|
||||
- 🎨 **Themes** - Customizable themes with colors and backgrounds
|
||||
- 🔒 **Security** - Secure content management (100/100 security score)
|
||||
- 🛡️ **Admin Console** - Built-in admin panel for content, config, plugins and user management
|
||||
- 🛡️ **Admin Console** - Built-in admin panel with CodeMirror editor, media browser, theme manager, and plugin configuration
|
||||
|
||||
## 🚀 Quick Start
|
||||
|
||||
1. **Upload** files to web server
|
||||
2. **Set permissions** for web server
|
||||
3. **Configure** (optional) via `config.json`
|
||||
4. **Visit** website via browser
|
||||
```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
|
||||
|
||||
@@ -35,40 +37,55 @@ codepress/
|
||||
│ │ ├── class/
|
||||
│ │ │ ├── CodePressCMS.php # Main CMS class
|
||||
│ │ │ ├── Logger.php # Logging system
|
||||
│ │ │ └── SimpleTemplate.php # Template engine
|
||||
│ │ │ ├── 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 # CMS engine
|
||||
│ │ └── index.php # Bootstrap (autoloader)
|
||||
│ ├── lang/ # Language files (nl.php, en.php)
|
||||
│ └── templates/ # Template files
|
||||
│ ├── layout.mustache
|
||||
│ ├── assets/
|
||||
│ │ ├── header.mustache
|
||||
│ │ ├── navigation.mustache
|
||||
│ │ └── footer.mustache
|
||||
│ ├── markdown_content.mustache
|
||||
│ ├── php_content.mustache
|
||||
│ └── html_content.mustache
|
||||
│ ├── 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 service
|
||||
│ └── templates/ # Admin templates
|
||||
├── cli/ # CLI scripts & tests
|
||||
│ └── test/
|
||||
├── public/ # Web root
|
||||
│ │ └── 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/
|
||||
│ │ ├── js/
|
||||
│ │ └── favicon.svg
|
||||
│ │ ├── 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
|
||||
├── content/ # Content files
|
||||
├── plugins/ # CMS plugins
|
||||
├── docs/ # Documentation
|
||||
├── config.json # Configuration
|
||||
└── README.md
|
||||
│ ├── 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
|
||||
@@ -78,251 +95,45 @@ codepress/
|
||||
```json
|
||||
{
|
||||
"site_title": "CodePress",
|
||||
"content_dir": "public/content",
|
||||
"templates_dir": "engine/templates",
|
||||
"default_page": "homepage",
|
||||
"default_lang": "nl",
|
||||
"author": {
|
||||
"name": "Edwin Noorlander",
|
||||
"website": "https://noorlander.info",
|
||||
"git": "https://git.noorlander.info/E.Noorlander/CodePress.git"
|
||||
"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
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Configuration Options
|
||||
|
||||
- **`site_title`** - Website name
|
||||
- **`content_dir`** - Directory with content files
|
||||
- **`templates_dir`** - Directory with template files
|
||||
- **`default_page`** - Default page (e.g., `"homepage"`)
|
||||
- **`default_lang`** - Default language (`"nl"` or `"en"`)
|
||||
- **`author`** - Author information with links
|
||||
- **`seo`** - SEO settings
|
||||
|
||||
## 📝 Content Types
|
||||
|
||||
### Markdown (.md)
|
||||
- Auto-linking between pages
|
||||
- GitHub Flavored Markdown support
|
||||
- Syntax highlighting for code blocks
|
||||
- GitHub Flavored Markdown via `league/commonmark`
|
||||
- Automatic title extraction
|
||||
- Multi-language support with `[lang].[page].md` format
|
||||
- Multi-language with `en.page.md` and `nl.page.md`
|
||||
|
||||
### PHP (.php)
|
||||
- Full PHP support
|
||||
- Dynamic content generation
|
||||
- Database integration possible
|
||||
- Session management available
|
||||
|
||||
### HTML (.html)
|
||||
- Static HTML pages
|
||||
- Bootstrap components
|
||||
- Custom CSS and JavaScript
|
||||
- Full HTML5 validation
|
||||
|
||||
## 🌍 Multi-language Support
|
||||
|
||||
CodePress supports multiple languages with automatic detection:
|
||||
|
||||
### File Naming Convention
|
||||
- `nl.[page].md` - Dutch content
|
||||
- `en.[page].md` - English content
|
||||
- Language prefix is automatically removed from display
|
||||
|
||||
### URL Format
|
||||
- `/?page=test&lang=nl` - Dutch version
|
||||
- `/?page=test&lang=en` - English version
|
||||
- `/?page=test` - Uses default language from config
|
||||
|
||||
### Language Switching
|
||||
- Automatic language selector in navigation
|
||||
- Preserves current page when switching languages
|
||||
- Falls back to default language if translation missing
|
||||
|
||||
## 🎨 Design Features
|
||||
|
||||
### Navigation
|
||||
- **Tab-style navigation** with Bootstrap
|
||||
- **Dropdown menus** for folders and sub-folders
|
||||
- **Home button** with icon
|
||||
- **Active state** indication
|
||||
- **Responsive** hamburger menu
|
||||
- **Language selector** with flags
|
||||
|
||||
### Layout
|
||||
- **Flexbox layout** for modern structure
|
||||
- **Fixed header** with logo and search
|
||||
- **Breadcrumb navigation** between header and content
|
||||
- **Fixed footer** with metadata and version
|
||||
- **Scrollable content** area
|
||||
|
||||
### Responsive
|
||||
- **Mobile-first** approach
|
||||
- **Touch-friendly** interaction
|
||||
- **Adaptive** widths
|
||||
- **Consistent** experience
|
||||
|
||||
## 🔧 Requirements
|
||||
|
||||
- **PHP 8.4+** or higher
|
||||
- **Web server** (Apache, Nginx, etc.)
|
||||
- **Write permissions** for PHP files
|
||||
- **Mod_rewrite** (optional for pretty URLs)
|
||||
|
||||
## 🛠️ Installation
|
||||
|
||||
### Via Composer
|
||||
```bash
|
||||
composer create-project codepress/codepress
|
||||
cd codepress
|
||||
```
|
||||
|
||||
### Manual
|
||||
1. **Download** the files
|
||||
2. **Upload** to web server
|
||||
3. **Set permissions** (755 for directories, 644 for files)
|
||||
4. **Configure** `config.json`
|
||||
|
||||
### Web Server Configuration
|
||||
|
||||
#### Apache
|
||||
```apache
|
||||
<Directory "/var/www/codepress">
|
||||
AllowOverride All
|
||||
Require all granted
|
||||
</Directory>
|
||||
|
||||
<IfModule mod_rewrite.c>
|
||||
RewriteEngine On
|
||||
RewriteCond %{REQUEST_FILENAME} !-f
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.*)$ index.php [QSA,L]
|
||||
</IfModule>
|
||||
```
|
||||
|
||||
#### Nginx
|
||||
```nginx
|
||||
server {
|
||||
root /var/www/codepress/public;
|
||||
index index.php;
|
||||
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php?$query_string;
|
||||
}
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass unix:/var/run/php/php8.4-fpm.sock;
|
||||
fastcgi_index index.php;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## 🏗️ PHP Classes
|
||||
|
||||
### SimpleTemplate Class
|
||||
`engine/core/class/SimpleTemplate.php`
|
||||
|
||||
Lightweight template rendering engine supporting Mustache-style syntax without external dependencies.
|
||||
|
||||
**Methods:**
|
||||
- `render($template, $data)` - Renders template with data
|
||||
- `replacePartial($matches)` - Replaces `{{>partial}}` placeholders
|
||||
|
||||
**Features:**
|
||||
- `{{>partial}}` - Partial includes
|
||||
- `{{#variable}}...{{/variable}}` - Conditional blocks
|
||||
- `{{^variable}}...{{/variable}}` - Negative conditional blocks
|
||||
- `{{{variable}}}` - Unescaped HTML content
|
||||
- `{{variable}}` - Escaped content
|
||||
|
||||
### CodePressCMS Class
|
||||
`engine/core/class/CodePressCMS.php`
|
||||
|
||||
Main CMS class managing all content management functionality.
|
||||
|
||||
**Public Methods:**
|
||||
- `__construct($config)` - Initialize CMS with configuration
|
||||
- `getPage()` - Retrieves current page content
|
||||
- `getMenu()` - Generates navigation structure
|
||||
- `render()` - Renders complete page with templates
|
||||
|
||||
**Private Methods:**
|
||||
- `buildMenu()` - Builds menu structure from content directory
|
||||
- `scanDirectory($dir, $prefix)` - Scans directory for content
|
||||
- `performSearch($query)` - Executes search query
|
||||
- `parseMarkdown($content)` - Converts Markdown to HTML
|
||||
- `parsePHP($filePath)` - Processes PHP files
|
||||
- `parseHTML($content)` - Processes HTML files
|
||||
- `getBreadcrumb()` - Generates breadcrumb navigation
|
||||
- `renderMenu($items, $level)` - Renders menu HTML
|
||||
- `getContentType($page)` - Determines content type
|
||||
- `formatDisplayName($name)` - Formats file/directory names for display
|
||||
|
||||
**Features:**
|
||||
- Multi-format content support (MD, PHP, HTML)
|
||||
- Dynamic navigation with dropdowns
|
||||
- Search functionality with snippets
|
||||
- Breadcrumb navigation
|
||||
- Auto-linking between pages
|
||||
- File metadata tracking
|
||||
- Responsive template rendering
|
||||
- Multi-language support
|
||||
|
||||
### Logger Class
|
||||
`engine/core/class/Logger.php`
|
||||
|
||||
Structured logging system for debugging and monitoring.
|
||||
|
||||
**Methods:**
|
||||
- `__construct($logFile, $level)` - Initialize logger
|
||||
- `debug($message, $context)` - Debug level logging
|
||||
- `info($message, $context)` - Info level logging
|
||||
- `warning($message, $context)` - Warning level logging
|
||||
- `error($message, $context)` - Error level logging
|
||||
|
||||
**Features:**
|
||||
- PSR-3 compatible logging interface
|
||||
- Configurable log levels
|
||||
- JSON context support
|
||||
- File-based logging with rotation
|
||||
- Timestamp and severity tracking
|
||||
|
||||
## 🔒 Security
|
||||
|
||||
CodePress CMS has undergone comprehensive security testing:
|
||||
|
||||
- **Security Score:** 100/100
|
||||
- **Penetration Tests:** 40+ tests passed
|
||||
- **Vulnerabilities:** 0 critical, 0 high, 0 medium
|
||||
- **Protection:** XSS, SQL Injection, Path Traversal, CSRF
|
||||
- **Headers:** CSP, X-Frame-Options, X-Content-Type-Options
|
||||
- **Input Validation:** All user inputs sanitized
|
||||
- **Output Encoding:** htmlspecialchars() on all output
|
||||
|
||||
See [pentest/PENTEST.md](pentest/PENTEST.md) for detailed security report.
|
||||
|
||||
## 📊 Quality Metrics
|
||||
|
||||
### Functionality: 92/100
|
||||
- ✅ 46/50 tests passed
|
||||
- ✅ Core functionality working
|
||||
- ⚠️ 4 minor issues (non-critical)
|
||||
|
||||
### Code Quality: 98/100
|
||||
- ✅ Clean, maintainable code
|
||||
- ✅ PSR-12 compliant
|
||||
- ✅ No unused functions
|
||||
- ✅ Structured logging system
|
||||
|
||||
### Overall: 96/100
|
||||
|
||||
See [function-test/test-report.md](function-test/test-report.md) for detailed test results.
|
||||
|
||||
## 🛡️ Admin Console
|
||||
|
||||
@@ -332,78 +143,75 @@ CodePress includes a built-in admin panel for managing your website.
|
||||
|
||||
### Modules
|
||||
- **Dashboard** - Overview with statistics and quick actions
|
||||
- **Content** - Browse, create, edit and delete files
|
||||
- **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
|
||||
- **Plugins** - Overview of installed plugins
|
||||
- **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
|
||||
- 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)** - Dutch documentation
|
||||
- **[Guide (EN)](guide/en.codepress.md)** - English documentation
|
||||
- **[Release Notes v1.5.0](RELEASE-NOTES-v1.5.0.md)** - Comprehensive release information
|
||||
- **[Guide (NL)](guide/nl.codepress.md)**
|
||||
- **[Guide (EN)](guide/en.codepress.md)**
|
||||
- **[TODO](TODO.md)** - Upcoming improvements
|
||||
- **[AGENTS.md](AGENTS.md)** - Developer instructions
|
||||
- **[DEVELOPMENT.md](DEVELOPMENT.md)** - Development guide
|
||||
- **[CONTRIBUTING.md](CONTRIBUTING.md)** - Contribution guidelines
|
||||
|
||||
## 🤝 Contributing
|
||||
|
||||
Contributions are welcome! See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
||||
|
||||
**Important:**
|
||||
- All contributions must be notified to the author
|
||||
- Contributions are subject to AGPL v3 terms
|
||||
- Contact commercial@noorlander.info for commercial licensing
|
||||
|
||||
## 📄 License
|
||||
|
||||
CodePress CMS is available under a **dual-license model**:
|
||||
|
||||
### 🆓 AGPL v3 (Open-Source)
|
||||
- **Free** for non-commercial use
|
||||
- **Requires** sharing modifications
|
||||
- **Copyleft** protection
|
||||
- See [LICENSE](LICENSE) for details
|
||||
|
||||
### 💼 Commercial License
|
||||
For commercial use without AGPL obligations:
|
||||
|
||||
- **Individual:** €99 (1 developer)
|
||||
- **Business:** €499 (10 developers)
|
||||
- **Enterprise:** €2499 (unlimited)
|
||||
- **SaaS:** €999/year
|
||||
|
||||
📧 **Contact:** commercial@noorlander.info
|
||||
📖 **More info:** [LICENSE-INFO.md](LICENSE-INFO.md)
|
||||
|
||||
## 🔗 Links
|
||||
|
||||
- **Website**: https://noorlander.info
|
||||
- **Repository**: https://git.noorlander.info/E.Noorlander/CodePress
|
||||
- **Issues**: https://git.noorlander.info/E.Noorlander/CodePress/issues
|
||||
- **Releases**: https://git.noorlander.info/E.Noorlander/CodePress/releases
|
||||
|
||||
## 📦 Version History
|
||||
|
||||
See [version.php](version.php) for detailed changelog.
|
||||
|
||||
**Current Version: 1.0.0**
|
||||
- Initial production release
|
||||
- AGPL v3 + Commercial dual-license
|
||||
- Multi-language support (NL/EN)
|
||||
- Security score: 100/100
|
||||
- Code quality: 98/100
|
||||
- Comprehensive testing suite
|
||||
CodePress CMS is available under a **dual-license model**: AGPL v3 (open-source) or Commercial.
|
||||
|
||||
---
|
||||
|
||||
*Built with ❤️ by Edwin Noorlander*
|
||||
*Built by Edwin Noorlander*
|
||||
|
||||
Reference in New Issue
Block a user