-
Notifications
You must be signed in to change notification settings - Fork 0
/
init.php
70 lines (58 loc) · 1.63 KB
/
init.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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?php
/**
* Page initiator
*
* @author Pierre HUBERT
*/
//Define the base of the project
define("PROJECT_PATH", __DIR__."/");
//Include classes
foreach(glob(PROJECT_PATH."classes/*.php") as $classFile){
require_once $classFile;
}
//Include functions
foreach(glob(PROJECT_PATH."functions/*.php") as $funcFile){
require_once $funcFile;
}
//Include helpers
foreach(glob(PROJECT_PATH."helpers/*.php") as $funcFile){
require_once $funcFile;
}
//Create root object
$cs = new CS();
//Create configuration element
$config = new config();
$cs->register("config", $config);
//Include configuration
foreach(glob(PROJECT_PATH."config/*.php") as $confFile){
require $confFile;
}
//Reload overwrite config if any
if(file_exists(PROJECT_PATH."config/overwrite.php"))
require PROJECT_PATH."config/overwrite.php";
unset($config);
//Connexion to the database
$db = new DBLibrary(($cs->config->get("site_mode") == "debug"));
$cs->register("db", $db);
$db->openMYSQL($cs->config->get('mysql')['host'],
$cs->config->get('mysql')['user'],
$cs->config->get('mysql')['password'],
$cs->config->get('mysql')['database']);
define("DBprefix", $cs->config->get("dbprefix"));
unset($db);
//Add token object
$clients = new APIClients();
$cs->register("clients", $clients);
unset($clients);
//Include models
foreach(glob(PROJECT_PATH."classes/models/*.php") as $classFile){
require_once $classFile;
}
//Include components
foreach(glob(PROJECT_PATH."classes/components/*.php") as $classFile){
require_once $classFile;
}
//Add components object
$components = new Components();
$cs->register("components", $components);
unset($components);