This repository has been archived by the owner on Feb 2, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
85 lines (64 loc) · 2.82 KB
/
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
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
//--------------------------------------------- INITIALISATION -------------------------------------------------------//
$page_root = "index.php";
require("vendor/autoload.php");
use \core\Autoloader;
use \core\auth\Connexion;
use \core\contenus\Contenus;
use \core\modules\RouterModule;
use \core\Configuration;
require("config/initialise.php");
$page = "index";
if ((isset($_GET['page'])) && ($_GET['page'] != null)) {
$page = $_GET['page'];
}
//--------------------------------------------- FIN INITIALISATION DES CLASS -------------------------------------------------------//
//--------------------------------------------- INITIALISATION DES CLASS -------------------------------------------------------//
$login = new Connexion();
$config = new Configuration();
$nav = new \core\Navigation();
$arr = [];
if (isset($_SESSION["idlogin".CLEF_SITE])) {
$membre = new \core\auth\Membre($_SESSION["idlogin".CLEF_SITE]);
$img_profil = $membre->getImg();
}
//--------------------------------------------- FIN INITIALISATION DES CLASS -------------------------------------------------------//
//--------------------------------------------- GENERATION META TITLE ++ DESCRIPTION -------------------------------------------------------//
//initialisation des contenus
$contenu = new Contenus($page);
//--------------------------------------------- FIN GENERATION META TITLE ++ DESCRIPTION -------------------------------------------------------//
//--------------------------------------------- ROUTING -------------------------------------------------------//
$controller = new \core\RouterController($page);
if ($controller->getErreur() === false) {
require_once($controller->getController());
}
else {
$cache = new \core\Cache($page);
$router_module = new RouterModule();
if ($router_module->getRouteModuleExist($page)) {
$page = $router_module->getUrl($page);
if ($router_module->getController() != "") {
require_once(MODULEROOT.$router_module->getController());
}
$loader = new Twig_Loader_Filesystem(['modules/'.$router_module->getModule()."/app/views", "app/views"]);
$twig = new Twig_Environment($loader);
$arr_page = \core\App::getValues();
$page = $router_module->getPage();
}
else {
$explode = explode("/", $page);
$loader = new Twig_Loader_Filesystem('app/views');
$twig = new Twig_Environment($loader);
$arr_page = \core\App::getValues();
$page = end($explode);
if (!file_exists(ROOT."app/views/".$page.".html")) {
\core\RedirectError::Redirect(404);
}
require("app/controller/initialise_all.php");
}
if ($cache->setStart() === false) {
require("app/views/template/principal.php");
}
$cache->setEnd();
}
//--------------------------------------------- FIN ROUTING -------------------------------------------------------//