From 6b43788556ff711cf66c5a78dbb4488aa19818ee Mon Sep 17 00:00:00 2001 From: Fabian Schieder Date: Sat, 28 Feb 2026 01:23:36 +0100 Subject: [PATCH] Refactor index.php to use absolute paths for logos; add logo existence check function --- index.php | 142 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 81 insertions(+), 61 deletions(-) diff --git a/index.php b/index.php index 3e46f17..9383a5c 100644 --- a/index.php +++ b/index.php @@ -1,18 +1,27 @@ [ [ "title" => "Gitea", "description" => "Mein privates Git-Repository – Quellcode, Projekte & mehr.", "url" => "/git", - "logo" => "icons/gitea.svg", + "logo" => "/icons/gitea.svg", "color" => "#609926" ], [ "title" => "Nextcloud", "description" => "Meine persönliche Cloud – Dateien, Kalender & Kontakte.", "url" => "/nextcloud", - "logo" => "icons/nextcloud.svg", + "logo" => "/icons/nextcloud.svg", "color" => "#0082c9" ], ], @@ -21,7 +30,7 @@ $projects = [ "title" => "Geizkragen.store", "description" => "Schulprojekt – Ein Online-Shop für Schnäppchenjäger.", "url" => "https://geizkragen.store", - "logo" => "icons/geizkragen.png", + "logo" => "/icons/geizkragen.png", "color" => "#e8281e", "external" => true ], @@ -31,7 +40,7 @@ $projects = [ "title" => "Home Assistant", "description" => "Meine Smart-Home-Zentrale – Automatisierungen & Geräte.", "url" => "http://homeassistant.fabianschieder.com", - "logo" => "icons/homeassistant.svg", + "logo" => "/icons/homeassistant.svg", "color" => "#18BCF2", "external" => true ], @@ -39,12 +48,22 @@ $projects = [ "title" => "NAS", "description" => "Mein Netzwerkspeicher – Daten & Backups.", "url" => "http://nas.fabianschieder.com", - "logo" => "icons/nas.svg", + "logo" => "/icons/nas.svg", "color" => "#a855f7", "external" => true ], ], ]; + +/** + * Optional: Prüft serverseitig, ob die Logo-Datei existiert. + * Verhindert Broken Images. + */ +function logoExists(string $webPath): bool { + $filePath = $_SERVER['DOCUMENT_ROOT'] . $webPath; + return is_file($filePath); +} + ?> @@ -52,76 +71,77 @@ $projects = [ Fabian Schieder - + -
+
-
-
FS
-

Fabian Schieder

-

Entwickler · Schüler · Macher

-
+
+
FS
+

Fabian Schieder

+

Entwickler · Schüler · Macher

+
-
- $items): ?> +
+ $items): ?>

- - Privat - - Schule - - Dienste - + Privat'; + break; + case "schule": + echo ' Schule'; + break; + case "dienste": + echo ' Dienste'; + break; + } + ?>

+
- -
+ +
- + - - - - - - - - - - + \ No newline at end of file