-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·59 lines (47 loc) · 1.36 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
<?php
/**
* Artiom FEDOROV
*
*/
session_start();
error_reporting(15);
// Define des chemins du projet
require_once("./api.php");
$controller = request::get("controller");
$action = request::get("action");
if ($controller == "") {
$controller = "users";
}
if($action == "") {
$action = "login";
}
if (users::isConnected()) {
if ($controller == "") {
$controller = "projects";
}
if($action == "") {
$action = "index";
}
if ((file_exists(PATH_SCRIPTS . $controller . "/" . $action . ".php")) && ((PATH_TEMPLATES . $controller . "/" . $action . ".php"))) {
require_once (PATH_SCRIPTS . $controller . "/" . $action . ".php");
ob_start();
require_once (PATH_TEMPLATES . $controller . "/" . $action . ".php");
//$template_content = ob_get_contents();
$template_content = ob_get_contents();
ob_end_clean();
require_once( PATH_TEMPLATES . "layouts/main.php");
} else {
echo("ERROR::Template or script missing");
}
// redirection vers template 404 // error si not found
} else {
$controller = "users";
$action = "login";
require_once (PATH_SCRIPTS . $controller . "/" . $action . ".php");
ob_start();
require_once (PATH_TEMPLATES . $controller . "/" . $action . ".php");
$template_content = ob_get_contents();
ob_end_clean();
require_once( PATH_TEMPLATES . "layouts/connect.php");
}
?>