<?php

use bin\php\Classes\pageBuilder;

session_start();
define('APP_INIT', true);

if (!isset($_SESSION['user'])) {
    header("Location: /login/");
    exit;
}

include_once './bin/php/Classes/pageBuilder.php';
include_once './bin/php/db_connect.php';
include_once './bin/php/Functions/globalFunctions.php';
include_once './login/php/authFunctions.php';

$locale = getPreferredLocale();

$translations = require $_SERVER['DOCUMENT_ROOT'] . "/bin/locales/{$locale}.php";

$GLOBALS['modules_enabled'] = getEnabledModules();

$pageBuilder = new pageBuilder();

if ($GLOBALS['pageContentToShow']['noUsersAllowed']) {
    if (checkIfUser()) {
        exit;
    }
}
setSessionParams();

$pageBuilder->buildPage();

?>