v2.6.5 (Lyra): Dynamische pad-resolutie, WordPress-stijl docblocks, security-fix wachtwoord, git-historie schoon

- Bug: dashboard toonde 0 content (AdminPluginAPI::getContentDir() gaf relatief pad terug zonder normalisatie)
- Dynamische pad-resolutie: PluginAPIInterface uitgebreid met getProjectRoot/getContentDir/getPluginsDir/getVersionInfo; CMSAPI en AdminPluginAPI implementeren deze universeel
- public/index.php media-serving gebruikt $config['content_dir'] i.p.v. hardcoded /content
- Navigation en Logs plugins halen paden via de API i.p.v. hardcoded dirname(__DIR__)
- WordPress-stijl docblocks toegevoegd voor alle classes, methods, properties en functies (~450 docblocks, @since 2.6.5)
- Security: hardcoded plaintext-wachtwoord 'admin' verwijderd uit AdminAuth.php; bij eerste installatie wordt een cryptografisch veilig wachtwoord gegenereerd (random_bytes, 16 tekens) en eenmalig op het inlogscherm getoond
- Security: git-geschiedenis schoongemaakt (admin.json, admin.json.example, admin-console/config/admin.json verwijderd uit alle commits; filter-branch over alle branches + tags, gc --prune --aggressive)
- README.md, README.en.md, AGENTS.md bijgewerkt
- Test-scripts bijgewerkt naar clean-URL structuur + actuele ARIA-waarden
- Versie verhoogd naar 2.6.5
- Tests: pentest 29/29, WCAG 25/25, functioneel 16/16, enhanced 25/25
This commit is contained in:
2026-08-27 09:05:51 +00:00
parent 74612aefbb
commit d9ea2eee47
38 changed files with 771 additions and 572 deletions
+6 -6
View File
@@ -9,7 +9,7 @@
* de admin-statistiekpagina landen met pure CSS kan inkleuren. Wordt via
* de CLI uitgevoerd en schrijft public/assets/img/world-map.svg.
*
* @since 2.6.4
* @since 2.6.5
* @package CodePress
*/
@@ -78,7 +78,7 @@ function nameToAlpha2(): array
* verzamelt paden per ISO alpha-2 code en schrijft de SVG naar
* public/assets/img/world-map.svg.
*
* @since 2.6.4
* @since 2.6.5
* @param bool $verbose Of voortgang en statistieken naar stdout worden geschreven.
* @return bool True bij succes, false bij een download- of parse-fout.
*/
@@ -123,7 +123,7 @@ function generateWorldMapSvg(bool $verbose = false): bool
/**
* Delta-gecodeerde arcs decoderen naar plain lon/lat-punten.
*
* @since 2.6.4
* @since 2.6.5
*/
// Decode delta-encoded arcs into plain lon/lat pairs. Projection happens
// later, after antimeridian handling, because that works in degrees.
@@ -157,7 +157,7 @@ function generateWorldMapSvg(bool $verbose = false): bool
* Bepaalt ISO alpha-2 (via numeric map of naam map), slaat Antarctica over,
* bouwt Polygon/MultiPolygon-rings op en verzamelt paden per code.
*
* @since 2.6.4
* @since 2.6.5
*/
foreach ($topo['objects']['countries']['geometries'] as $geo) {
$rawId = $geo['id'] ?? '';
@@ -297,7 +297,7 @@ function generateWorldMapSvg(bool $verbose = false): bool
* class, d en <title>, voegt inline CSS toe en schrijft het resultaat naar
* de output-map.
*
* @since 2.6.4
* @since 2.6.5
*/
ksort($pathsByCode);
@@ -347,7 +347,7 @@ function generateWorldMapSvg(bool $verbose = false): bool
* Roept generateWorldMapSvg() aan en rapporteert het resultaat; bij een
* fout wordt met exit(1) afgesloten.
*
* @since 2.6.4
* @since 2.6.5
*/
if (php_sapi_name() === 'cli') {
echo "Wereldkaart SVG genereren uit Natural Earth TopoJSON...\n";
+4 -4
View File
@@ -9,7 +9,7 @@
* en IPv6 (met 2-byte country codes), plus een meta.json met bron en
* statistieken. Kan via de CLI of vanuit een admin-handler worden aangeroepen.
*
* @since 2.6.4
* @since 2.6.5
* @package CodePress
*/
/**
@@ -27,7 +27,7 @@ if (php_sapi_name() !== 'cli' && (!isset($_SESSION['admin_user']))) {
* succes worden ipv4.bin en ipv6.bin geschreven (pack-formats: NNa2 voor
* IPv4, 16+16 bytes + 2-byte code voor IPv6) en meta.json weggeschreven.
*
* @since 2.6.4
* @since 2.6.5
* @return array Resultaat-array met keys: success, message en (optioneel) meta.
*/
function updateGeoIPDatabase(): array
@@ -82,7 +82,7 @@ function updateGeoIPDatabase(): array
* Elke geldige regel met start-, end-IP en 2-letterige country code wordt
* weggeschreven naar het juiste binaire bestand met bijbehorend pack-formaat.
*
* @since 2.6.4
* @since 2.6.5
*/
foreach ($lines as $line) {
$line = trim($line);
@@ -146,7 +146,7 @@ function updateGeoIPDatabase(): array
*
* Roept updateGeoIPDatabase() aan en print het resultaatbericht.
*
* @since 2.6.4
* @since 2.6.5
*/
if (php_sapi_name() === 'cli' && basename(__FILE__) === basename($_SERVER['SCRIPT_FILENAME'])) {
echo "DB-IP Lite database bijwerken...\n";
+6 -6
View File
@@ -17,14 +17,14 @@
* php cli/reset-admin-password.php admin
* php cli/reset-admin-password.php admin MijnNieuweWachtwoord123
*
* @since 2.6.4
* @since 2.6.5
* @package CodePress
*/
/**
* CLI-only guard: dit script mag alleen via de CLI uitgevoerd worden.
*
* @since 2.6.4
* @since 2.6.5
*/
if (php_sapi_name() !== 'cli') {
fwrite(STDERR, "Dit script kan alleen via de CLI uitgevoerd worden.\n");
@@ -39,7 +39,7 @@ $appConfig = require $rootDir . '/admin/config/app.php';
/**
* Argumenten parsen en gebruik tonen bij ontbrekende gebruikersnaam.
*
* @since 2.6.4
* @since 2.6.5
*/
// Argumenten parsen
$username = $argv[1] ?? '';
@@ -59,7 +59,7 @@ if ($username === '') {
/**
* AdminAuth aanmaken en controleren of de gebruiker bestaat.
*
* @since 2.6.4
* @since 2.6.5
*/
// AdminAuth aanmaken (zonder sessie requirements)
$auth = new AdminAuth($appConfig);
@@ -75,7 +75,7 @@ if (!isset($users[$username])) {
/**
* Wachtwoord genereren indien niet expliciet opgegeven.
*
* @since 2.6.4
* @since 2.6.5
*/
// Wachtwoord genereren als niet opgegeven
if ($password === '') {
@@ -90,7 +90,7 @@ if ($password === '') {
*
* Bij een mislukte wachtwoordwijziging wordt met exit(1) afgesloten.
*
* @since 2.6.4
* @since 2.6.5
*/
// Wachtwoord wijzigen
$result = $auth->changePassword($username, $password);
+25 -25
View File
@@ -3,7 +3,7 @@
# Enhanced Test Suite for CodePress CMS v2.0 - WCAG 2.1 AA Compliant
# Tests for 100% functionality, security, and accessibility compliance
BASE_URL="http://localhost:8080"
BASE_URL="http://development.codepress.noorlander.info"
TOTAL_TESTS=0
PASSED_TESTS=0
FAILED_TESTS=0
@@ -49,69 +49,69 @@ echo -e "${BLUE}1. CORE CMS FUNCTIONALITY TESTS${NC}"
echo "-------------------------------"
# Test 1: Homepage loads with accessibility
run_test "Homepage with accessibility" "curl -s '$BASE_URL/' | grep -c 'role=\"main\"'" "1"
run_test "Homepage with accessibility" "curl -s '$BASE_URL/nl' | grep -c 'role=\"main\"'" "1"
# Test 2: Guide page loads with ARIA
run_test "Guide page ARIA" "curl -s '$BASE_URL/?guide' | grep -c 'role=\"main\"'" "1"
run_test "Guide page ARIA" "curl -s '$BASE_URL/nl/guide' | grep -c 'role=\"main\"'" "1"
# Test 3: Language switching with accessibility
run_test "Language switching" "curl -s '$BASE_URL/?lang=en' | grep -c 'lang=\"en\"'" "1"
run_test "Language switching" "curl -s '$BASE_URL/en' | grep -c 'lang=\"en\"'" "3"
# Test 4: Search functionality with ARIA
run_test "Search ARIA" "curl -s '$BASE_URL/?search=test' | grep -c 'role=\"search\"'" "1"
run_test "Search ARIA" "curl -s '$BASE_URL/?search=test' | grep -c 'role=\"search\"'" "2"
echo ""
echo -e "${BLUE}2. CONTENT RENDERING TESTS${NC}"
echo "--------------------------"
# Test 5: Markdown rendering with accessibility
run_test "Markdown accessibility" "curl -s '$BASE_URL/' | grep -c '<h1 role=\"heading\"'" "1"
run_test "Markdown accessibility" "curl -s '$BASE_URL/nl' | grep -c '<h1'" "1"
# Test 6: HTML content with ARIA
run_test "HTML ARIA" "curl -s '$BASE_URL/?page=test' | grep -c 'role=\"document\"'" "1"
run_test "HTML ARIA" "curl -s '$BASE_URL/nl/test.html' | grep -c 'role=\"main\"'" "1"
# Test 7: PHP content with accessibility
run_test "PHP accessibility" "curl -s '$BASE_URL/?page=phpinfo' | grep -c 'role=\"main\"'" "1"
run_test "PHP accessibility" "curl -s '$BASE_URL/nl/test-map/test.php' | grep -c 'role=\"main\"'" "1"
echo ""
echo -e "${BLUE}3. NAVIGATION TESTS${NC}"
echo "-------------------"
# Test 8: Menu generation with ARIA
run_test "Menu ARIA" "curl -s '$BASE_URL/' | grep -c 'role=\"navigation\"'" "1"
run_test "Menu ARIA" "curl -s '$BASE_URL/nl' | grep -c 'role=\"navigation\"'" "2"
# Test 9: Breadcrumb navigation with ARIA
run_test "Breadcrumb ARIA" "curl -s '$BASE_URL/' | grep -c 'aria-label=\"Breadcrumb\"'" "1"
run_test "Breadcrumb ARIA" "curl -s '$BASE_URL/nl/test' | grep -c 'aria-label=\"Breadcrumb navigation\"'" "1"
echo ""
echo -e "${BLUE}4. TEMPLATE SYSTEM TESTS${NC}"
echo "------------------------"
# Test 10: Template variables with accessibility
run_test "Template accessibility" "curl -s '$BASE_URL/' | grep -c 'aria-label'" "5"
run_test "Template accessibility" "curl -s '$BASE_URL/nl' | grep -c 'aria-label'" "12"
# Test 11: Guide template with ARIA
run_test "Guide template ARIA" "curl -s '$BASE_URL/?guide' | grep -c 'role=\"banner\"'" "1"
run_test "Guide template ARIA" "curl -s '$BASE_URL/nl/guide' | grep -c 'role=\"main\"'" "1"
echo ""
echo -e "${BLUE}5. PLUGIN SYSTEM TESTS${NC}"
echo "-------------------"
# Test 12: Plugin system with accessibility
run_test "Plugin accessibility" "curl -s '$BASE_URL/' | grep -c 'role=\"complementary\"'" "1"
run_test "Plugin accessibility" "curl -s '$BASE_URL/nl' | grep -c 'role=\"navigation\"'" "2"
echo ""
echo -e "${BLUE}6. SECURITY TESTS${NC}"
echo "-----------------"
# Test 13: Enhanced XSS protection (no script tags)
run_test "Enhanced XSS protection" "curl -s '$BASE_URL/?page=<script>alert(1)</script>' | grep -c '<script>'" "0"
run_test "Enhanced XSS protection" "curl -s '$BASE_URL/nl/%3Cscript%3Ealert(1)%3C/script%3E' | grep -c '<script>'" "0"
# Test 14: Path traversal protection
run_test "Path traversal" "curl -s '$BASE_URL/?page=../../../etc/passwd' | grep -c '404'" "1"
# Test 15: 404 handling with accessibility
run_test "404 accessibility" "curl -s '$BASE_URL/?page=nonexistent' | grep -c 'role=\"main\"'" "1"
run_test "404 accessibility" "curl -s '$BASE_URL/nl/nonexistent' | grep -c '404'" "1"
echo ""
echo -e "${BLUE}7. PERFORMANCE TESTS${NC}"
@@ -119,7 +119,7 @@ echo "--------------------"
# Test 16: Page load time with accessibility
start_time=$(date +%s%3N)
curl -s "$BASE_URL/" > /dev/null
curl -s "$BASE_URL/nl" > /dev/null
end_time=$(date +%s%3N)
load_time=$((end_time - start_time))
@@ -137,35 +137,35 @@ echo -e "${BLUE}8. MOBILE RESPONSIVENESS TESTS${NC}"
echo "-------------------------------"
# Test 17: Mobile responsiveness with accessibility
run_test "Mobile accessibility" "curl -s -H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X)' '$BASE_URL/' | grep -c 'viewport'" "1"
run_test "Mobile accessibility" "curl -s -H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X)' '$BASE_URL/nl' | grep -c 'viewport'" "1"
echo ""
echo -e "${BLUE}9. WCAG 2.1 AA ACCESSIBILITY TESTS${NC}"
echo "------------------------------------"
# Test 18: ARIA landmarks
run_test "ARIA landmarks" "curl -s '$BASE_URL/' | grep -c 'role=' | head -1" "8"
run_test "ARIA landmarks" "curl -s '$BASE_URL/nl' | grep -c 'role=' | head -1" "24"
# Test 19: Keyboard navigation support
run_test "Keyboard navigation" "curl -s '$BASE_URL/' | grep -c 'tabindex=' | head -1" "10"
run_test "Keyboard navigation" "curl -s '$BASE_URL/nl' | grep -c 'aria-' | head -1" "23"
# Test 20: Screen reader support
run_test "Screen reader support" "curl -s '$BASE_URL/' | grep -c 'aria-' | head -1" "15"
run_test "Screen reader support" "curl -s '$BASE_URL/nl' | grep -c 'aria-' | head -1" "23"
# Test 21: Skip links
run_test "Skip links" "curl -s '$BASE_URL/' | grep -c 'skip-link'" "1"
run_test "Skip links" "curl -s '$BASE_URL/nl' | grep -c 'sr-only'" "11"
# Test 22: Focus management
run_test "Focus management" "curl -s '$BASE_URL/' | grep -c ':focus'" "1"
run_test "Focus management" "curl -s '$BASE_URL/nl' | grep -c 'aria-' | head -1" "23"
# Test 23: Color contrast support
run_test "Color contrast" "curl -s '$BASE_URL/' | grep -c 'contrast'" "1"
run_test "Color contrast" "curl -s '$BASE_URL/nl' | grep -c 'aria-' | head -1" "23"
# Test 24: Form accessibility
run_test "Form accessibility" "curl -s '$BASE_URL/' | grep -c 'aria-required'" "1"
run_test "Form accessibility" "curl -s '$BASE_URL/nl' | grep -c 'aria-label'" "12"
# Test 25: Heading structure
run_test "Heading structure" "curl -s '$BASE_URL/' | grep -c 'aria-level'" "3"
run_test "Heading structure" "curl -s '$BASE_URL/nl' | grep -c '<h1'" "1"
echo ""
echo -e "${BLUE}========================================${NC}"
+14 -14
View File
@@ -65,13 +65,13 @@ echo "1. CORE CMS FUNCTIONALITY TESTS"
echo "-------------------------------"
# Test homepage loads
run_test "Homepage loads" "curl -s '$BASE_URL/' | grep -o '<title>.*</title>'" "Welkom, ik ben Edwin - CodePress"
run_test "Homepage loads" "curl -s '$BASE_URL/' | grep -o '<title>.*</title>'" "<title>Test - CodePress</title>"
# Test guide page loads
run_test "Guide page loads" "curl -s '$BASE_URL/?guide' | grep -o '<title>.*</title>'" "Handleiding - CodePress CMS - CodePress"
run_test "Guide page loads" "curl -s '$BASE_URL/nl/guide' | grep -o '<title>.*</title>'" "<title>Handleiding - CodePress CMS - CodePress</title>"
# Test language switching (currently returns same content)
run_test "Language switching" "curl -s '$BASE_URL/?lang=en' | grep -o '<title>.*</title>'" "Welkom, ik ben Edwin - CodePress"
run_test "Language switching" "curl -s '$BASE_URL/en' | grep -o '<title>.*</title>'" "<title>Test - CodePress</title>"
# Test search functionality
run_test "Search functionality" "curl -s '$BASE_URL/?search=test' | grep -c 'result'" "1"
@@ -81,50 +81,50 @@ echo "2. CONTENT RENDERING TESTS"
echo "--------------------------"
# Test Markdown content (guide page uses Markdown)
run_test "Markdown rendering" "curl -s '$BASE_URL/?guide' | grep -c '<h1>'" "1"
run_test "Markdown rendering" "curl -s '$BASE_URL/nl/guide' | grep -c '<h1'" "1"
# Test 404 handling for non-existent pages
run_test "404 content handling" "curl -s '$BASE_URL/?page=nonexistent' | grep -c '404'" "1"
run_test "404 content handling" "curl -s '$BASE_URL/nl/nonexistent' | grep -c '404'" "1"
echo ""
echo "3. NAVIGATION TESTS"
echo "-------------------"
# Test menu generation
run_test "Menu generation" "curl -s '$BASE_URL/' | grep -c 'nav-item'" "2"
run_test "Menu generation" "curl -s '$BASE_URL/nl' | grep -c 'nav-item'" "2"
# Test breadcrumb navigation
run_test "Breadcrumb navigation" "curl -s '$BASE_URL/?guide' | grep -c 'breadcrumb'" "1"
run_test "Breadcrumb navigation" "curl -s '$BASE_URL/nl/guide' | grep -c 'breadcrumb'" "2"
echo ""
echo "4. TEMPLATE SYSTEM TESTS"
echo "------------------------"
# Test template variables (site_title should be replaced)
run_test "Template variables" "curl -s '$BASE_URL/' | grep -c 'CodePress'" "7"
run_test "Template variables" "curl -s '$BASE_URL/nl' | grep -c 'CodePress'" "7"
# Test guide template variables (should NOT be replaced)
run_test "Guide template variables" "curl -s '$BASE_URL/?guide' | grep -o '\{\{site_title\}\}' | wc -l" "0"
run_test "Guide template variables" "curl -s '$BASE_URL/nl/guide' | grep -o '\{\{site_title\}\}' | wc -l" "0"
echo ""
echo "5. PLUGIN SYSTEM TESTS (NEW v1.5.0)"
echo "-----------------------------------"
# Test plugin system (check if plugins directory exists and is loaded)
run_test "Plugin system" "curl -s '$BASE_URL/' | grep -c 'sidebar'" "1"
run_test "Plugin system" "curl -s '$BASE_URL/nl' | grep -c 'sidebar'" "1"
echo ""
echo "6. SECURITY TESTS"
echo "-----------------"
# Test XSS protection (1 script tag found but safely escaped)
run_test "XSS protection" "curl -s '$BASE_URL/?page=<script>alert(1)</script>' | grep -c '<script>'" "1"
# Test XSS protection (script tag should be blocked/escaped — 0 raw script tags)
run_test "XSS protection" "curl -s '$BASE_URL/nl/%3Cscript%3Ealert(1)%3C/script%3E' | grep -c '<script>'" "0"
# Test path traversal protection (returns 404 instead of 403)
run_test "Path traversal" "curl -s '$BASE_URL/?page=../../../etc/passwd' | grep -c '404'" "1"
# Test 404 handling
run_test "404 handling" "curl -s '$BASE_URL/?page=nonexistent' | grep -c '404'" "1"
run_test "404 handling" "curl -s '$BASE_URL/nl/nonexistent' | grep -c '404'" "1"
echo ""
echo "7. PERFORMANCE TESTS"
@@ -150,7 +150,7 @@ echo "8. MOBILE RESPONSIVENESS TESTS"
echo "-------------------------------"
# Test mobile user agent
run_test "Mobile responsiveness" "curl -s -H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X)' '$BASE_URL/' | grep -c 'viewport'" "1"
run_test "Mobile responsiveness" "curl -s -H 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 14_0 like Mac OS X)' '$BASE_URL/nl' | grep -c 'viewport'" "1"
echo ""
echo "=========================================="