2017-05-17 11:48:24 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Page initiator
|
|
|
|
*
|
|
|
|
* @author Pierre HUBERT
|
2017-05-17 11:51:22 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
//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;
|
|
|
|
}
|
|
|
|
|
2017-05-25 13:16:34 +00:00
|
|
|
//Include helpers
|
|
|
|
foreach(glob(PROJECT_PATH."helpers/*.php") as $funcFile){
|
|
|
|
require_once $funcFile;
|
|
|
|
}
|
|
|
|
|
2017-05-17 11:51:22 +00:00
|
|
|
//Create root object
|
2017-05-17 12:01:36 +00:00
|
|
|
$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;
|
|
|
|
}
|
2017-05-17 12:43:12 +00:00
|
|
|
unset($config);
|
2017-05-17 12:01:36 +00:00
|
|
|
|
|
|
|
//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']);
|
2017-05-27 08:52:12 +00:00
|
|
|
define("DBprefix", $cs->config->get("dbprefix"));
|
2017-05-17 12:43:12 +00:00
|
|
|
unset($db);
|
2017-05-17 12:01:36 +00:00
|
|
|
|
2017-05-17 12:43:12 +00:00
|
|
|
//Add token object
|
|
|
|
$tokens = new Tokens();
|
|
|
|
$cs->register("tokens", $tokens);
|
|
|
|
unset($tokens);
|
|
|
|
|
|
|
|
//Add user object
|
|
|
|
$user = new User();
|
|
|
|
$cs->register("user", $user);
|
2017-05-26 07:36:20 +00:00
|
|
|
unset($user);
|
|
|
|
|
2017-05-26 08:23:55 +00:00
|
|
|
//Include components
|
|
|
|
foreach(glob(PROJECT_PATH."classes/components/*.php") as $classFile){
|
|
|
|
require_once $classFile;
|
|
|
|
}
|
|
|
|
|
2017-05-26 07:36:20 +00:00
|
|
|
//Add components object
|
|
|
|
$components = new Components();
|
|
|
|
$cs->register("components", $components);
|
|
|
|
unset($components);
|