<?php
if (session_status() === PHP_SESSION_NONE) {
    $https = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');
    @session_set_cookie_params([
        'lifetime' => 0,
        'path' => '/',
        'domain' => '',
        'secure' => $https,
        'httponly' => true,
        'samesite' => 'Lax',
    ]);
    ini_set('session.use_strict_mode', '1');
    session_start();
}
$ugfxSessionTimeout = 60 * 60 * 4;
if (!empty($_SESSION['ugfx_admin']['last_seen_epoch']) && (time() - (int)$_SESSION['ugfx_admin']['last_seen_epoch']) > $ugfxSessionTimeout) {
    unset($_SESSION['ugfx_admin']);
    session_regenerate_id(true);
}
$_SESSION['ugfx_admin']['last_seen_epoch'] = time();
require_once __DIR__ . '/stream_lib.php';
require_once __DIR__ . '/nowplaying_lib.php';
require_once __DIR__ . '/functions.php';
require_once __DIR__ . '/config.php';
ugfx_protect_storage_dir(dirname(__DIR__) . '/storage/uploads');
ugfx_protect_storage_dir(dirname(__DIR__) . '/storage/chat');
if (!defined('UGFX_SKIP_CHART_AUTOUPDATE')) {
    ugfx_chart_autoupdate(false);
}
?>
