36782-vm/includes/init.php
2025-12-12 21:23:08 +00:00

27 lines
641 B
PHP

<?php
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
require_once __DIR__ . '/i18n.php';
if (isset($_GET['lang'])) {
set_lang($_GET['lang']);
$uri = $_SERVER['REQUEST_URI'];
$url_parts = parse_url($uri);
$path = $url_parts['path'];
$query = [];
if (isset($url_parts['query'])) {
parse_str($url_parts['query'], $query);
unset($query['lang']);
}
$new_url = $path;
if (!empty($query)) {
$new_url .= '?' . http_build_query($query);
}
header("Location: " . $new_url);
exit;
}
require_once __DIR__ . '/auth.php';
require_once __DIR__ . '/helpers.php';