philippurbschat.de/philcore/app/init.php

49 lines
No EOL
1.3 KiB
PHP

<?php
if (session_status() === PHP_SESSION_NONE) {
session_set_cookie_params([
'path' => '/',
'httponly' => true,
'secure' => (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off'),
'samesite' => 'Lax'
]);
session_start();
}
date_default_timezone_set('Europe/Berlin');
// 2. Autoloader
spl_autoload_register(function($className) {
$paths = [
__DIR__ . '/../core/',
__DIR__ . '/models/',
__DIR__ . '/services/'
];
foreach ($paths as $path) {
$file = $path . $className . '.php';
$fileLower = $path . strtolower($className) . '.php';
if (file_exists($file)) {
require_once $file;
return;
} elseif (file_exists($fileLower)) {
require_once $fileLower;
return;
}
}
});
// 3. ENV laden
Config::load(__DIR__ . '/../.env');
/**
* 4. GLOBALER STAGING-SCHUTZ
* Dieser Block ist spezifisch für die "philippurbschat.de" Staging-Umgebung.
* Er bindet den zentralen Login (auth.php) ein, der eine Ebene über
* diesem Projekt liegt, um Single-Sign-On zu ermöglichen.
*/
$current_project = 'philcore';
$globalAuth = __DIR__ . '/../../auth.php';
if (file_exists($globalAuth)) {
require_once $globalAuth;
}