From 9bf00fcf5e101634bc40c0c0ed0ca3a2bb0f8848 Mon Sep 17 00:00:00 2001 From: Fabian Schieder Date: Sat, 28 Feb 2026 01:36:36 +0100 Subject: [PATCH] Enhance logoExists function to improve path resolution and add debug output for testing --- index.php | 36 ++++++++++++++++++++++++++++++++---- 1 file changed, 32 insertions(+), 4 deletions(-) diff --git a/index.php b/index.php index 9cd7b1d..a590bbc 100644 --- a/index.php +++ b/index.php @@ -61,11 +61,29 @@ $projects = [ */ function logoExists(string $webPath): bool { $base = rtrim($_SERVER['DOCUMENT_ROOT'] ?? '/var/www/fabianschieder.com', '/'); - $full = $base . ltrim($webPath, '.'); - // Debug: echo "\n"; + $full = $base . '/' . ltrim($webPath, '/'); return is_file($full); } +// ── DEBUG: Entferne diesen Block nach dem Testen ────────────────────────── +if (isset($_GET['debug'])) { + echo '
';
+    echo "DOCUMENT_ROOT: " . ($_SERVER['DOCUMENT_ROOT'] ?? 'nicht gesetzt') . "\n";
+    echo "PHP __FILE__:  " . __FILE__ . "\n";
+    echo "PHP dirname:   " . dirname(__FILE__) . "\n\n";
+    $testIcons = ['/icons/gitea.svg', '/icons/nextcloud.svg', '/icons/geizkragen.png', '/icons/homeassistant.svg', '/icons/nas.svg'];
+    foreach ($testIcons as $icon) {
+        $base = rtrim($_SERVER['DOCUMENT_ROOT'] ?? '/var/www/fabianschieder.com', '/');
+        $full = $base . '/' . ltrim($icon, '/');
+        $alt  = dirname(__FILE__) . '/' . ltrim($icon, '/');
+        echo $icon . "\n";
+        echo "  via DOCUMENT_ROOT → " . $full . " → " . (is_file($full) ? "✅ OK" : "❌ nicht gefunden") . "\n";
+        echo "  via dirname       → " . $alt  . " → " . (is_file($alt)  ? "✅ OK" : "❌ nicht gefunden") . "\n\n";
+    }
+    echo '
'; +} +// ── END DEBUG ───────────────────────────────────────────────────────────── + ?> @@ -116,11 +134,21 @@ function logoExists(string $webPath): bool {
- + + + > + + +