-
Notifications
You must be signed in to change notification settings - Fork 5
/
index.php
105 lines (83 loc) · 2.96 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/* Lozeil -- Copyright (C) No Parking 2013 - 2016 */
require dirname(__FILE__)."/inc/require.inc.php";
$application = new Application();
$application->boot();
$global_status = false;
if ($GLOBALS['config']['db_profiler']) {
$dbInst = new db_perf();
} else {
$dbInst = new db();
}
$timer = new Benchmark_Timer;
$timer->start();
$content_object = new Content();
if (isset($_SESSION['userdatabase']) and $_SESSION['userdatabase'] != $GLOBALS['dbconfig']['name']) {
session_destroy();
}
if (isset($_POST['username']) and $_POST['username'] != '') {
$auth = new User_Authentication();
if ($auth->is_authorized($_POST['username'], $_POST['password'])) {
$_SESSION += $auth->session_headers();
}
}
$authenticated_user = new User_Authenticated();
if (isset($_SESSION['userid'])) {
$authenticated_user->load(array('id' => (int)$_SESSION['userid']));
$_SESSION['accountant_view'] = $authenticated_user->is_expert() ? "1" : "0";
$content_object->user($authenticated_user);
}
if (isset($_SESSION['username']) and $_SESSION['username']) {
if (isset($_GET['content']) and !empty($_GET['content']) and $_GET['content'] != 'login.php' ) {
$content_object->filename($_GET['content']);
} else {
$content_object->filename($authenticated_user->defaultpage());
}
$content = $content_object->filename();
$content_included = $content_object->pathname();
$location = clean_location($_SERVER['PHP_SELF']);
if (isset($_GET['content']) and $_GET['content'] == "login.php") {
header("Location: index.php");
} elseif ($content_object->check_access_denied() === true) {
$content_included = dirname(__FILE__)."/contents/".Content::access_denied;
}
switch (true) {
case isset($_REQUEST['method']) or preg_match("/ajax/", $content):
case preg_match("/export/", $content) and isset($_POST['date_picker_from']) and isset($_POST['menu_actions_export_submit']):
$theme = new Theme_Empty();
break;
default:
$theme = Theme::factory(isset($_REQUEST['theme']) ? $_REQUEST['theme'] : "");
break;
}
echo $theme->html_top();
echo $theme->head();
echo $theme->body_top($location, $content);
echo $theme->content_top();
include($content_included);
echo $theme->content_bottom();
echo $theme->show_status();
echo $theme->body_bottom();
echo $theme->html_bottom();
} else {
$location = clean_location($_SERVER['PHP_SELF']);
if (isset($_GET['content']) and $content_object->is_accessible_unauthorized($_GET['content'])) {
$content_object->filename($_GET['content']);
} else {
$content_object->filename_login();
}
$content = $content_object->filename();
$content_included = $content_object->pathname();
$theme = new Theme_Default();
echo $theme->html_top();
echo $theme->head();
echo $theme->body_top($location, $content);
echo $theme->content_top();
include($content_included);
echo $theme->content_bottom();
echo $theme->show_status();
echo $theme->body_bottom();
echo $theme->html_bottom();
}
$timer->stop();
register_shutdown_function(array($application, "shutdown"));