16 Commits

Author SHA1 Message Date
bfd6989060 Add comprehensive security hardening and penetration testing suite
- Fix XSS vulnerability in language parameter with whitelist validation
- Add input sanitization for page parameters (HTML escaping, path traversal protection)
- Implement security headers (CSP, X-Frame-Options, X-Content-Type-Options, Referrer-Policy)
- Block PHP execution in content directory via router protection
- Add parameter length limits (255 chars max)
- Remove X-Powered-By header to prevent version disclosure
- Include automated penetration test suite (40+ security tests)
- Add comprehensive security documentation and test reports

Security improvements protect against XSS, path traversal, code injection,
command injection, template injection, and information disclosure attacks.
All 30 penetration tests pass with 100/100 security score.
2025-11-24 16:03:22 +01:00
25769cef24 Implement dynamic language system with automatic detection
- Add getAvailableLanguages() method to scan lang directory automatically
- Add getNativeLanguageName() method for proper language display names
- Enhance SimpleTemplate engine to support array iteration with {{#array}} syntax
- Update header template to use dynamic language dropdown with native names
- Add German (de.php) and French (fr.php) language files as examples
- Fix search input text color to use black text for better visibility
- Languages now appear automatically when added to engine/lang/ without code changes
2025-11-22 21:06:50 +01:00
561832161e Fix title extraction to always use filename/directory name instead of content
- Remove H1 and HTML title extraction from parse methods
- Always use formatDisplayName() for consistent filename-based titles
- Add file path parameters to parseMarkdown() and parseHTML()
- Fix directory precedence to check directories before files
- Update AGENTS.md with title vs filename clarification
- Remove debug code from templates and methods

Resolves: Page titles now consistently show file/directory names
without language prefixes and extensions, never content titles.
2025-11-22 18:00:35 +01:00
e1e3207305 Add debug logging for directory title processing
- Add debug output to getDirectoryListing() method
- Add debug_page_title to template data for troubleshooting
- Investigate why directory listings show 'Untitled' in footer
- Directory content shows correct H1 title but page_title is wrong
2025-11-22 17:25:26 +01:00
b92d192399 Fix formatDisplayName special cases for directory names
- Restrict special case handling (phpinfo, ICT) to exact filenames only
- Prevent special cases from overriding directory names like 'nl.test'
- Directory names now use formatDisplayName() without special case overrides
- This ensures 'nl.test' directory displays as 'Test' not 'Untitled'
2025-11-22 17:07:31 +01:00
dec50951d0 Fix page title extraction to use clean filenames
- Add fallback in scanForPageTitles to use clean filename when no title found in content
- Extract clean filename using basename() and formatDisplayName() for page titles
- Ensures page titles are always clean (without language prefixes and extensions)
- Footer now shows correct page titles for all content types
- Consistent title handling for files, directories, and auto-linking
2025-11-22 16:59:54 +01:00
79569437e2 Fix directory title display to use formatDisplayName
- Apply formatDisplayName() to directory names in getDirectoryListing()
- This ensures language prefixes are removed from directory titles
- nl.php-testen directory now displays as 'Php-testen' instead of 'Nl.php-testen'
- Footer now shows correct page titles for directories
- Consistent display naming for both files and directories
2025-11-22 16:53:00 +01:00
b31a82001e Fix formatDisplayName for language-specific directory names
- Add regex to handle nl.php-testen -> php-testen patterns
- Remove test directories that were cluttering navigation
- Clean up content directory to remove test files
- Language filtering now works correctly for both files and directories
- Navigation shows only relevant content for selected language
2025-11-22 16:41:36 +01:00
14a6cae499 Fix page name parsing to support dots in filenames
- Change regex to only remove file extensions (.md, .php, .html) not all dots
- Fix en.test.md and nl.testpagina.md 404 errors caused by over-aggressive regex
- Update all references to use  instead of
- Language-specific pages with dots in names now load correctly
- Pages like 'en.test.md' work as expected without being truncated to 'en'
2025-11-22 16:33:16 +01:00
bf2ee9c212 Fix internal markdown links and auto-linking language persistence
- Add language parameter to autoLinkPageTitles() method
- Fix internal links to include current language (?page=x&lang=en)
- Remove broken header ID syntax from English guide
- Ensure all auto-generated internal links maintain language context
- Internal page links now work correctly across language switches
2025-11-22 16:28:19 +01:00
bea9cdfb0c Fix language-specific page loading and correct en/uk naming
- Fix getPage() to search for language-specific files (en.test.md, nl.test.md)
- Correct guide file naming: uk.codepress.md → en.codepress.md
- Update scanDirectory() filtering: uk → en for consistency
- Update formatDisplayName() cleaning: uk → en for consistency
- Language-specific pages now load correctly without 404 errors
- Pages display with clean names (without language prefixes)
2025-11-22 16:21:22 +01:00
79eb010fa5 Implement language-specific content system
- Rename guide files: nl.md → nl.codepress.md, en.md → uk.codepress.md
- Add language filtering in scanDirectory() for nl.* and uk.* files/folders
- Update formatDisplayName() to remove language prefixes from display names
- Update getGuidePage() to use new naming convention (en → uk mapping)
- Content with nl. prefix only shows when Dutch language is selected
- Content with uk. prefix only shows when English language is selected
2025-11-22 16:14:59 +01:00
9bb21579f7 Fix guide content language and language switcher context
- Change getGuidePage() to use currentLanguage instead of detectLanguage()
- Add lang_switch_url template variable for proper context-aware switching
- Language switcher now stays on guide page when switching languages
- Guide content now displays in correct language based on URL parameter
2025-11-22 16:05:33 +01:00
2d934702cd Fix language persistence across navigation and breadcrumbs
- Add lang parameter to all navigation links in scanDirectory method
- Update homepage link in navigation template to include current language
- Fix breadcrumb navigation to preserve language parameter
- Ensure language selection persists when clicking any navigation element
2025-11-22 15:54:40 +01:00
a2b7fcb1a8 ## Complete Multi-language System & Navigation Enhancement
### Features Added:
- **Multi-language Support**: Dutch/English with URL-based switching (?lang=nl|en)
- **Theme Customization**: Configurable header/navigation colors via config.json
- **Navigation Improvements**: Active states, dropdown chevron icons, visual distinction
- **Mobile Responsive**: Separate desktop/mobile search layouts
- **Template System**: Fixed rendering pipeline for all partials

### Technical Fixes:
- Fixed language file path (engine/lang/ vs engine/core/class/../lang/)
- Added template data rendering to layout template
- Implemented navigation active state for default/home page
- Added chevron icons to dropdown folders for visual distinction
- Removed hardcoded navigation opacity class for theme colors

### Files Modified:
- config.json: Added theme and language configuration
- engine/core/class/CodePressCMS.php: Multi-language and navigation logic
- engine/templates/: Enhanced header, footer, navigation, layout
- engine/lang/: Dutch and English translation files
- public/assets/css/mobile.css: Mobile responsive fixes

### Result:
Fully functional multi-language CMS with proper navigation states and theme customization.
2025-11-22 15:29:47 +01:00
863661612a ## Major CodePress CMS Enhancement
### 🚀 New Features
- **League CommonMark Integration**: Replaced basic Markdown parser with full CommonMark 2.7 support
- **Bootstrap Sass Architecture**: Modern SCSS build system with Bootstrap 5.3.8
- **Enhanced Navigation**: Uses filenames instead of H1 titles for consistency
- **Improved Styling**: Transparent navigation backgrounds, no rounded corners

### 🎨 UI/UX Improvements
- Navigation items now use formatted filenames (e.g., "kennis-boven-aantallen" → "Kennis Boven Aantallen")
- Transparent navigation backgrounds with subtle hover effects
- Removed rounded corners from first-level navigation
- 50% opacity navigation background using Bootstrap variables

### 🔧 Technical Improvements
- **Class Organization**: Extracted CodePressCMS and SimpleTemplate to separate files
- **Full PHPDoc Documentation**: Complete documentation for all methods
- **Modern Build Process**: npm scripts for SCSS compilation
- **Enhanced Markdown Support**: Tables, strikethrough, task lists, autolinks
- **Security**: Proper HTML sanitization with CommonMark

### 📦 Dependencies
- Added `league/commonmark` for professional Markdown parsing
- Added `bootstrap` for SCSS-based styling
- Updated `sass` build process

### 🐛 Bug Fixes
- Fixed content directory path configuration
- Resolved navigation title inconsistencies
- Improved Markdown bold/italic formatting
- Fixed homepage 404 issues

### 🔄 Migration Notes
- Content directory moved from `content/` to `public/content/`
- Navigation now displays filenames instead of content H1 titles
- CSS now compiled from SCSS source files

The CMS now provides a professional, modern experience with robust Markdown support and clean, maintainable code architecture.
2025-11-21 20:23:20 +01:00