-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
52 lines (46 loc) · 1.58 KB
/
index.php
File metadata and controls
52 lines (46 loc) · 1.58 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
date_default_timezone_set('Europe/Paris');
define('NAME', 'DreamVids Authenticator');
define('POST', $_SERVER['REQUEST_METHOD'] == 'POST');
define('ROOT', str_replace('index.php', '', $_SERVER['SCRIPT_FILENAME']), true);
define('WEBROOT', str_replace('index.php', '', $_SERVER['SCRIPT_NAME']), true);
define('BEANS', ROOT.'beans/');
define('SYSTEM', ROOT.'system/');
define('APP', ROOT.'app/');
define('LANGDIR', ROOT.'lang/');
define('MODELS', APP.'models/');
define('VIEWS', APP.'views/');
define('CONTROLLERS', APP.'controllers/');
define('ASSETS', WEBROOT.'assets/');
define('CSS', ASSETS.'css/');
define('JS', ASSETS.'js/');
define('FONTS', ASSETS.'fonts/');
define('IMG', ASSETS.'img/');
if (isset($_COOKIE['lang']) && file_exists(LANGDIR.$_COOKIE['lang'].'.json')) {
$lang = $_COOKIE['lang'];
}
elseif (isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && file_exists(LANGDIR.$_SERVER['HTTP_ACCEPT_LANGUAGE'].'.json')) {
$lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
}
else {
$lang = 'fr'; // TODO: change default language if needed
}
define('LANG', $lang);
// Vendor
require_once 'vendor/autoload.php';
// System requires
require_once SYSTEM.'ModelInterface.php';
require_once SYSTEM.'Utils.php';
require_once SYSTEM.'Controller.php';
require_once SYSTEM.'Request.php';
require_once SYSTEM.'Data.php';
require_once SYSTEM.'Client.php';
require_once SYSTEM.'Lang.php';
// Models
require_once MODELS.'Session.php';
require_once MODELS.'Token.php';
if (!file_exists(CONTROLLERS.Request::get()->getArg(0).'.php') ) {
Controller::error404();
exit();
}
require_once CONTROLLERS.Request::get()->getArg(0).'.php';