From 04a7e4c6ebbdb237018a5e66d5089dbcfdfecb4b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=C3=A9dric=20FAMIBELLE-PRONZOLA?= Date: Wed, 8 Oct 2025 20:52:40 +0400 Subject: [PATCH] refactor: use variable DEFAULT_TIMEZONE --- countdown.php | 2 +- direct.php | 6 +++--- includes/config.default.php | 4 ++++ includes/config.local.php.sample | 4 ++++ includes/config.php | 2 +- index.php | 6 +++--- 6 files changed, 16 insertions(+), 8 deletions(-) diff --git a/countdown.php b/countdown.php index c19d2dd..6e1e9e4 100644 --- a/countdown.php +++ b/countdown.php @@ -113,7 +113,7 @@ setSecurityHeaders(); ]; foreach($timezones as $name => $timezone): - $targetDateLocal = new DateTime(COUNTDOWN_TARGET_DATE, new DateTimeZone('Indian/Reunion')); + $targetDateLocal = new DateTime(COUNTDOWN_TARGET_DATE, new DateTimeZone(DEFAULT_TIMEZONE)); $targetDateLocal->setTimezone(new DateTimeZone($timezone)); // Vérifier si c'est un jour différent diff --git a/direct.php b/direct.php index 42ee2be..6965ce0 100644 --- a/direct.php +++ b/direct.php @@ -170,12 +170,12 @@ $liveStream = getLiveStream(); format($liveDate); diff --git a/includes/config.default.php b/includes/config.default.php index e1bb0e4..10322d6 100644 --- a/includes/config.default.php +++ b/includes/config.default.php @@ -58,6 +58,10 @@ if (!defined('SITE_DESCRIPTION')) define('SITE_DESCRIPTION', 'Votre plateforme d if (!defined('SITE_LOGO')) define('SITE_LOGO', 'img/logo.png'); if (!defined('SITE_FAVICON')) define('SITE_FAVICON', 'img/favicon.png'); +// Configuration du fuseau horaire par défaut +// Liste des fuseaux disponibles : https://www.php.net/manual/fr/timezones.php +if (!defined('DEFAULT_TIMEZONE')) define('DEFAULT_TIMEZONE', 'Indian/Reunion'); + // Réseaux sociaux if (!defined('FACEBOOK_URL')) define('FACEBOOK_URL', '#'); if (!defined('X_URL')) define('X_URL', '#'); diff --git a/includes/config.local.php.sample b/includes/config.local.php.sample index 53029c0..33b1b65 100644 --- a/includes/config.local.php.sample +++ b/includes/config.local.php.sample @@ -136,6 +136,10 @@ define('PRIORITY_CATEGORIES', [ // Favicon du site // define('SITE_FAVICON', 'img/favicon.png'); +// Fuseau horaire par défaut pour l'affichage des dates +// Liste des fuseaux disponibles : https://www.php.net/manual/fr/timezones.php +// define('DEFAULT_TIMEZONE', 'Indian/Reunion'); + // ========================================= // Réseaux sociaux // ========================================= diff --git a/includes/config.php b/includes/config.php index d7440b3..617be78 100644 --- a/includes/config.php +++ b/includes/config.php @@ -23,7 +23,7 @@ if (file_exists($config_default_file)) { // Locale et fuseau horaire setlocale(LC_TIME, 'fr_FR.UTF-8'); -date_default_timezone_set('Indian/Reunion'); +date_default_timezone_set(DEFAULT_TIMEZONE); // Initialisation des catégories de vidéo depuis l'API $peertube_categories = initCategories(); diff --git a/index.php b/index.php index 5bc7d8e..8129324 100644 --- a/index.php +++ b/index.php @@ -160,12 +160,12 @@ setSecurityHeaders(); format($liveDate);