This repository has been archived by the owner on Aug 16, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.php
81 lines (64 loc) · 1.95 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
<?php
/**
* Created by PhpStorm.
* User: Florian Moser
* Date: 23.05.2015
* Time: 10:00
*/
foreach (glob($_SERVER['DOCUMENT_ROOT'] . "/common/*.php") as $filename) {
include_once $filename;
}
foreach (glob($_SERVER['DOCUMENT_ROOT'] . "/controller/*.php") as $filename) {
include_once $filename;
}
foreach (glob($_SERVER['DOCUMENT_ROOT'] . "/classes/models/*.php") as $filename) {
include_once $filename;
}
foreach (glob($_SERVER['DOCUMENT_ROOT'] . "/services/*.php") as $filename) {
include_once $filename;
}
foreach (glob($_SERVER['DOCUMENT_ROOT'] . "/view/*.php") as $filename) {
include_once $filename;
}
/* commons */
include_once $_SERVER['DOCUMENT_ROOT'] . "/templates/partcreator.php";
session_start();
// $_GET und $_POST zusammenfasen
$request = array_merge($_GET, $_POST);
$requestFiles = $_FILES;
$arr = explode("/", $_SERVER['REQUEST_URI']);
//get controller
$params = array();
for ($i = 1; $i < count($arr); $i++) {
if ($arr[$i] != "")
$params[] = $arr[$i];
}
if (count($params) == 0)
$params[0] = "";
$allowedParams = [
"persons",
"export",
"import",
"settings"
];
define("ACTIVE_PARAMS", serialize($params));
$user = GetActiveUser();
if (in_array($params[0], $allowedParams) && $user !== false) {
$controllerName = strtoupper(substr($params[0], 0, 1)) . substr($params[0], 1) . "Controller";
$params = RemoveFirstEntryInArray($params);
// Controller erstellen
$controller = new $controllerName($request, $requestFiles, $params);
// Inhalt der Webanwendung ausgeben.
echo $controller->Display();
} else {
if ($params[0] == "api") {
$params = RemoveFirstEntryInArray($params);
$controller = new ApiController($request, $requestFiles, $params);
echo $controller->Display();
} else {
$controller = new MainController($request, $requestFiles, $params);
// Inhalt der Webanwendung ausgeben.
echo $controller->Display();
}
}
?>