diff --git a/config/prod/config.php b/config/prod/config.php index 27341ff..5322436 100644 --- a/config/prod/config.php +++ b/config/prod/config.php @@ -1,4 +1,8 @@ 0, // Session-Cookie - 'path' => '/', - 'domain' => '', // leer = aktuelle Domain - 'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'), - 'httponly' => true, - 'samesite' => 'Lax', // oder 'Strict' falls du sehr streng sein willst - ]); - - session_start(); - } -} -require_once __DIR__ . "/config.php"; -require_once __DIR__ . "/db.php"; -require_once __DIR__ . '/../src/functions.php'; diff --git a/config/staging/config.php b/config/staging/config.php index 0d31d43..62e208e 100644 --- a/config/staging/config.php +++ b/config/staging/config.php @@ -1,4 +1,8 @@ $code, 'label' => $meta['label'] ?? strtoupper($code), - 'flag' => $meta['flag'] ?? '🏳️' + 'flag' => $meta['flag'] ?? '🏳️', ]; } -// Falls Sprache ungültig oder nicht vorhanden → erste verfügbare Sprache wählen +// Falls keine Sprachdateien gefunden wurden → Minimal-Fallback +if (empty($availableLangs)) { + $availableLangs = [ + 'en' => [ + 'code' => 'en', + 'label' => 'English', + 'flag' => '🇬🇧', + ], + ]; +} + +// Falls Sprache ungültig oder nicht in available → erste verfügbare Sprache wählen if (!$lang || !isset($availableLangs[$lang])) { - $lang = array_key_first($availableLangs) ?: 'en'; + // erste Sprache aus dem Array, ohne array_key_first (falls ältere PHP-Version) + $keys = array_keys($availableLangs); + $lang = $keys[0] ?? 'en'; } // ----------------------------------------------------------- @@ -72,7 +89,7 @@ $activeLangFile = $i18nDir . '/' . $lang . '.json'; $activeLangData = []; if (is_readable($activeLangFile)) { - $json = json_decode(file_get_contents($activeLangFile), true); + $json = json_decode(@file_get_contents($activeLangFile), true); if (is_array($json)) { $activeLangData = $json; } @@ -85,7 +102,7 @@ $fallbackLangData = []; $fallbackFile = $i18nDir . '/en.json'; if ($lang !== 'en' && is_readable($fallbackFile)) { - $json = json_decode(file_get_contents($fallbackFile), true); + $json = json_decode(@file_get_contents($fallbackFile), true); if (is_array($json)) { $fallbackLangData = $json; } @@ -105,6 +122,4 @@ $GLOBALS['i18n'] = [ // ----------------------------------------------------------- // 6) Rest des Systems laden // ----------------------------------------------------------- -require_once __DIR__ . "/config.php"; -require_once __DIR__ . "/db.php"; -require_once __DIR__ . '/../src/functions.php'; +