Centralisation des constantes

This commit is contained in:
2026-05-04 18:19:42 +02:00
parent 1babf4c52e
commit cdd2abaa96
14 changed files with 16391 additions and 143 deletions
+7 -3
View File
@@ -17,10 +17,14 @@ function require_login(?string $loginPage = '/login.php'): void
}
if (empty($_SESSION['user'])) {
// URL de la page courante (ex: /gift-list.php?foo=bar)
$currentUrl = $_SERVER['REQUEST_URI'] ?? '/';
if (!empty($_SERVER['HTTP_X_REQUESTED_WITH']) || (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/json') !== false)) {
header('Content-Type: application/json');
http_response_code(401);
echo json_encode(['success' => false, 'error' => 'Session expirée. Veuillez vous reconnecter.']);
exit;
}
// On redirige vers la page de login en ajoutant ?redirect=...
$currentUrl = $_SERVER['REQUEST_URI'] ?? '/';
$redirectParam = urlencode($currentUrl);
$target = ($loginPage ?? '/login.php') . '?redirect=' . $redirectParam;
+8
View File
@@ -0,0 +1,8 @@
<?php
// PachaFamily Config - Version sans erreur
if (!defined('ID_ALEX')) {
define('ID_ALEX', 2);
define('ID_LAIA', 3);
define('CURRENCY', '€');
define('ZONE_SCOLAIRE', 'C');
}
+3 -1
View File
@@ -1,5 +1,7 @@
<?php
if (file_exists(__DIR__ . '/config.php')) {
require_once __DIR__ . '/config.php';
}
// Activer erreurs
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);