/
index.php
30 lines (24 loc) · 886 Bytes
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
require 'config.php';
if (
isset($_SERVER['REQUEST_URI'])
&& strpos($_SERVER['REQUEST_URI'], Config::$base) !== 0
) http_response_code(404) && exit;
if ( ! isset($_SERVER['HTTPS']) || $_SERVER['HTTPS'] !== 'on')
http_response_code(500) && exit;
header('Strict-Transport-Security: max-age=86400');
spl_autoload_register();
Core\Session::start();
Core\CSRF::handle();
Core\Router::getURI();
date_default_timezone_set('UTC');
Core\DB::connect();
define('BASEPATH', __DIR__.'/');
Core\Router::controller('open');
if ( ! \Core\Session::authenticated())
header('Location: '.Config::$base.'auth/login') || exit;
Core\Router::controller();
http_response_code(404) && exit;