From 4dd133321ba8200ef80d565b83fd451a3ed2941c Mon Sep 17 00:00:00 2001 From: Edwin Noorlander Date: Mon, 24 Nov 2025 17:01:19 +0100 Subject: [PATCH] Add bilingual README documentation (NL/EN) with v1.0.0 info - Add README.en.md for English documentation - Update README.md with language selector and v1.0.0 info - Include dual-license information (AGPL v3 + Commercial) - Add quality metrics (Security: 100/100, Code: 98/100) - Add comprehensive feature documentation - Add installation and configuration guides - Add class documentation for developers --- README.en.md | 377 +++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 23 +++- 2 files changed, 399 insertions(+), 1 deletion(-) create mode 100644 README.en.md diff --git a/README.en.md b/README.en.md new file mode 100644 index 0000000..07b9794 --- /dev/null +++ b/README.en.md @@ -0,0 +1,377 @@ +# CodePress CMS + +**[🇳🇱 Nederlands](README.md) | [🇬🇧 English](#)** + +A lightweight, file-based content management system built with PHP. + +**Version:** 1.0.0 | **License:** AGPL v3 / Commercial + +## ✨ Features + +- 📝 **Multi-format Content** - Supports Markdown, PHP and HTML files +- 🧭 **Dynamic Navigation** - Automatic menu generation with dropdowns +- 🔍 **Search Functionality** - Full-text search through all content +- 🧭 **Breadcrumb Navigation** - Intuitive navigation paths +- 🔗 **Auto-linking** - Automatic links between pages +- 📱 **Responsive Design** - Works perfectly on all devices +- ⚙️ **JSON Configuration** - Easy configuration via JSON +- 🎨 **Bootstrap 5** - Modern UI framework +- 🔒 **Security** - Secure content management (100/100 security score) + +## 🚀 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 + +## 📁 Project Structure + +``` +codepress/ +├── engine/ +│ ├── core/ +│ │ ├── class/ +│ │ │ ├── CodePressCMS.php # Main CMS class +│ │ │ ├── Logger.php # Logging system +│ │ │ └── SimpleTemplate.php # Template engine +│ │ ├── config.php # Configuration loader +│ │ └── index.php # CMS engine +│ ├── 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 +├── public/ # Web root +│ ├── assets/ +│ │ ├── css/ +│ │ ├── js/ +│ │ └── favicon.svg +│ ├── content/ # Content files +│ │ ├── nl.homepage.md # Dutch homepage +│ │ ├── en.homepage.md # English homepage +│ │ └── [lang].[page].md # Multi-language pages +│ └── index.php # Entry point +├── config.json # Configuration +├── version.php # Version tracking +└── README.md # This file +``` + +## ⚙️ Configuration + +### Basic Configuration (`config.json`) + +```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" + }, + "seo": { + "description": "CodePress CMS - Lightweight file-based content management system", + "keywords": "cms, php, content management, file-based" + } +} +``` + +### 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 +- Automatic title extraction +- Multi-language support with `[lang].[page].md` format + +### 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 + + AllowOverride All + Require all granted + + + + RewriteEngine On + RewriteCond %{REQUEST_FILENAME} !-f + RewriteCond %{REQUEST_FILENAME} !-d + RewriteRule ^(.*)$ index.php [QSA,L] + +``` + +#### 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. + +## 📖 Documentation + +- **[Guide (NL)](guide/nl.codepress.md)** - Dutch documentation +- **[Guide (EN)](guide/en.codepress.md)** - English documentation +- **[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 + +--- + +*Built with ❤️ by Edwin Noorlander* diff --git a/README.md b/README.md index 60c5fba..b9ed668 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,11 @@ # CodePress CMS +**[🇳🇱 Nederlands](#) | [🇬🇧 English](README.en.md)** + Een lichtgewicht, file-based content management systeem gebouwd met PHP. +**Versie:** 1.0.0 | **Licentie:** AGPL v3 / Commercial + ## ✨ Features - 📝 **Multi-format Content** - Ondersteunt Markdown, PHP en HTML bestanden @@ -238,7 +242,24 @@ Bijdragen zijn welkom! Zie [AGENTS.md](AGENTS.md) voor ontwikkelrichtlijnen. ## 📄 Licentie -Open-source licentie. Zie de repository voor meer informatie. +CodePress CMS is beschikbaar onder een **dual-license model**: + +### 🆓 AGPL v3 (Open-Source) +- **Gratis** voor niet-commercieel gebruik +- **Vereist** het delen van wijzigingen +- **Copyleft** bescherming +- Zie [LICENSE](LICENSE) voor details + +### 💼 Commercial License +Voor bedrijfsmatig gebruik zonder AGPL verplichtingen: + +- **Individual:** €99 (1 developer) +- **Business:** €499 (10 developers) +- **Enterprise:** €2499 (unlimited) +- **SaaS:** €999/jaar + +📧 **Contact:** commercial@noorlander.info +📖 **Meer info:** [LICENSE-INFO.md](LICENSE-INFO.md) ## 🔗 Links