From de7ef1645b9a73ffc8caf1d10ead3f4d70faeb41 Mon Sep 17 00:00:00 2001 From: Johnnybegood90 Date: Thu, 12 Mar 2026 13:14:09 +0100 Subject: [PATCH] Bad config.php location. --- src/config.php | 14 ++++++++++++- src/tpl/config.php | 51 ---------------------------------------------- 2 files changed, 13 insertions(+), 52 deletions(-) delete mode 100644 src/tpl/config.php diff --git a/src/config.php b/src/config.php index da6c8d2..393a8da 100644 --- a/src/config.php +++ b/src/config.php @@ -30,9 +30,21 @@ $allow_personal_epg = !empty($config['allow_personal_epg']); $first_source = $epg_sources[0] ?? []; $epg_url = htmlspecialchars($first_source['epg_url'] ?? ''); $m3u_url = htmlspecialchars($first_source['m3u_url'] ?? ''); + +// ── Locale detection ───────────────────────────────────────────────────────── +$supported_locales = ['en', 'fr', 'es']; +$locale = 'en'; +$accept = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'en'; +foreach (explode(',', $accept) as $lang) { + $code = strtolower(substr(trim($lang), 0, 2)); + if (in_array($code, $supported_locales)) { $locale = $code; break; } +} +$locale_path = __DIR__ . "/../locales/{$locale}.json"; +$L = json_decode(file_get_contents($locale_path), true); +// ───────────────────────────────────────────────────────────────────────────── ?> - + diff --git a/src/tpl/config.php b/src/tpl/config.php deleted file mode 100644 index 393a8da..0000000 --- a/src/tpl/config.php +++ /dev/null @@ -1,51 +0,0 @@ - 'Main', - 'epg_url' => $config['epg_url'], - 'm3u_url' => $config['m3u_url'] ?? '', - ]]; - $config['allow_personal_epg'] = false; - unset($config['epg_url'], $config['m3u_url']); - file_put_contents($config_path, json_encode($config, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES)); -} -// ───────────────────────────────────────────────────────────────────────────── - -$group_name = htmlspecialchars($config['group_name'] ?? 'GridTV'); -$epg_sources = $config['epg_sources'] ?? []; -$allow_personal_epg = !empty($config['allow_personal_epg']); - -// Première source par défaut (pour compatibilité avec le reste du code) -$first_source = $epg_sources[0] ?? []; -$epg_url = htmlspecialchars($first_source['epg_url'] ?? ''); -$m3u_url = htmlspecialchars($first_source['m3u_url'] ?? ''); - -// ── Locale detection ───────────────────────────────────────────────────────── -$supported_locales = ['en', 'fr', 'es']; -$locale = 'en'; -$accept = $_SERVER['HTTP_ACCEPT_LANGUAGE'] ?? 'en'; -foreach (explode(',', $accept) as $lang) { - $code = strtolower(substr(trim($lang), 0, 2)); - if (in_array($code, $supported_locales)) { $locale = $code; break; } -} -$locale_path = __DIR__ . "/../locales/{$locale}.json"; -$L = json_decode(file_get_contents($locale_path), true); -// ───────────────────────────────────────────────────────────────────────────── -?> - - - - - -GridTV — <?= $group_name ?>