blob: 1e280d0b019d161ddf4f178099e5810f84e905be [file] [log] [blame]
Copybara botbe50d492023-11-30 00:16:42 +01001<?php
2// Core of the application
3
4const INTERNAL_CLASS_NAMESPACE = "Internal\\";
5
6// Classes autoload
7spl_autoload_register(function($className) {
8 if ($className == "lbuchs\WebAuthn\Binary\ByteBuffer") {
9 include_once(__DIR__."/lib/WebAuthn/Binary/ByteBuffer.php");
10 return;
11 }
12
13
14 include_once(__DIR__."/inc/".$className.".php");
15});
16
17// Getting configuration
18require_once(__DIR__."/config.php");
19
20// Setting timezone and locale accordingly
21date_default_timezone_set("Europe/Madrid");
22setlocale(LC_TIME, 'es_ES.UTF-8', 'es_ES', 'es');
23
24// Database settings
25$con = @mysqli_connect($conf["db"]["server"], $conf["db"]["user"], $conf["db"]["password"], $conf["db"]["database"]) or die("There was an error connecting to the database.\n");
26mysqli_set_charset($con, "utf8mb4");
27
28// Session settings
29session_set_cookie_params([
30 "lifetime" => 0,
31 "path" => $conf["path"],
32 "httponly" => true
33]);
34session_start();
35
36// Check if app has been installed
37if (db::needsSetUp()) {
38 security::logout();
39 die("Please, run install.php from the command line to install the app before using it.");
40}