-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
205 lines (172 loc) · 6.76 KB
/
Copy pathindex.php
File metadata and controls
205 lines (172 loc) · 6.76 KB
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?php
//Start session
session_start();
//Require general file
require_once( dirname(__FILE__) . "/general.php");
/**
* Check if user is logged in
*/
if(!isset($_SESSION["login"]) || $_SESSION["login"] == false || !isset($_SESSION["user"]) || empty($_SESSION["user"])) {
header("Location: " . $url . "auth.php?rdrp=" . urlencode($url . "?" . explode('?', $_SERVER["REQUEST_URI"], 2)[1])); //Redirect to login page
exit;
}
/**
* Go to first available page
*/
if(! isset($_GET["id"])){
$sub = User::first_accessable_page($current_user); //Get first page to access
if( User::system_access($current_user) === true ){
//Get main menu id
$main = Menu::main_id($sub);
//Redirect to first accessable page
header("location: ". $url ."?id=". $main ."&sub=". $sub);
exit;
}else{
//Redirect to error page
header("location: ". $url ."/error?error=1");
exit;
}
}
?>
<!DOCTYPE html>
<html lang="de" dir="ltr">
<head>
<meta charset="utf-8">
<title>TKTDATA - TICKETVERWALTUNG</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="cache-control" content="no-cache">
<meta name="author" content="Sven Waser">
<meta name="publisher" content="Sven Waser">
<meta name="copyright" content="Sven Waser">
<meta name="reply-to" content="sven.waser@sven-waser.ch">
<meta name="description" content="TKTData. Eine simple und benutzerfreundliche Ticket-Verwaltungssoftware">
<meta name="keywords" content="TKTData">
<meta name="content-language" content="de">
<meta name="robots" content="noindex">
<meta name="theme-color" content="#232b43">
<link rel="shortcut icon" type="image/x-icon" href="<?php echo $url; ?>medias/logo/favicon.ico">
<link rel="shortcut icon" href="<?php echo $url; ?>medias/logo/favicon.ico">
<link rel="icon" type="image/png" href="<?php echo $url; ?>medias/logo/favicon.png" sizes="32x32">
<link rel="apple-touch-icon" sizes="180x180" href="<?php echo $url; ?>medias/logo/logo-512.png">
<link rel="apple-touch-icon-precomposed" sizes="180x180" href="<?php echo $url; ?>medias/logo/logo-512.png">
<meta name="msapplication-TileColor" content="#232b43">
<meta name="msapplication-TileImage" content="<?php echo $url; ?>medias/logo/logo-512.png">
<!-- Custom scripts -->
<link rel="stylesheet" href="<?php echo $url; ?>style.css" />
<link rel="stylesheet" href="<?php echo $url; ?>fonts/fonts.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.3/styles/gruvbox-dark.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/10.0.3/highlight.min.js"></script>
<!-- Plugin scripts -->
<?php
/////////////////////////////
// Require plugins style
/////////////////////////////
$plugins = glob( dirname(__FILE__) . "/plugins/*" , GLOB_ONLYDIR );
foreach( $plugins as $plugin ) {
/* Require function file */
if(file_exists( $plugin . "/style.css" )) {
echo '<link rel="stylesheet" href="' . $url . '/plugins/' . basename( $plugin ) . '/style.css">';
}
}
?>
<!-- Custom js -->
<script src="<?php echo $url; ?>js/jsQR.js"></script><!--https://github.com/cozmo/jsQR-->
<script src="<?php echo $url; ?>js/input.js"></script>
<script src="<?php echo $url; ?>js/mail.js"></script>
<script src="<?php echo $url; ?>js/menu.js"></script>
<script src="<?php echo $url; ?>js/ajax.js"></script>
<script src="<?php echo $url; ?>js/imageUpload.js"></script>
<script src="<?php echo $url; ?>js/Chart.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body onload="document.getElementsByClassName('loader')[0].style.display = 'none';">
<!-- noscript and loader -->
<noscript>
<div class="fullscreen center">
<form>
<img src="medias/logo/logo-fitted.png" />
<span>Bitte aktiviere JavaScript um diese Webseite zu nutzen</span>
</form>
</div>
</noscript>
<div class="loader">
<span class="text">Building page...</span>
<div class="letter">
<span class="base"></span>
<span class="top"></span>
</div>
</div>
<?php
/**
* Display menu
*/
echo Menu::display();
?>
<article>
<?php
/**
* Display custom html
*/
//Create new page variable
$displayPage = $page;
/**
* Check if Main menu page is selected
*/
$conn = Access::connect();
$check = $conn->prepare("SELECT id FROM " . MENU . " WHERE id=:page AND (submenu IS NULL OR submenu='' OR submenu='0') ORDER BY layout");
$check->execute(array(":page" => $page));
$pages = $conn->prepare("SELECT page FROM " . USER_RIGHTS . " WHERE page IN (SELECT id FROM " . MENU . " WHERE submenu=:page ORDER BY layout) LIMIT 0, 1");
$pages->execute(array(":page" => $displayPage));
if( $check->rowCount() > 0){
//Define new page (First page of main menu)
$displayPage = $pages->fetch()[0];
}
/**
* Display content of current page if user has access
*/
if( User::w_access_allowed($displayPage, $current_user) || User::r_access_allowed($displayPage, $current_user ) || $displayPage == "profil"){
//Generate file
$page_file = dirname(__FILE__) . "/pages/".$displayPage.".php";
//Check file
if(file_exists( $page_file )) {
//Display page
require_once( $page_file );
}else {
//Get plugin name
$name = new Plugin();
$name = $name->get_page( intval($displayPage) )["plugin"];
//Plugin default path
$plugin_file = dirname(__FILE__) . "/plugins/" . $name . "/index.php";
//Check file
if(file_exists( $plugin_file )) {
require_once( $plugin_file );
}else {
Action::fs_info('Die Seite <strong>#' . $page . "</strong> existiert nicht.", "Zurück", $url);
}
}
}else{
/**
* Check if user has permission to access this system
*/
$sub = User::first_accessable_page($current_user); //Get first page to access
if( $sub !== false ){ //Check if there is a page available
//Get main menu id
$main = Menu::main_id($sub);
//Denied access and button to return to first available page
Action::fs_info('Zugriff auf die Seite <strong>#' . $page . "</strong> verweigert.", "Zurück", $url);
}else{
//Redirect to error page
header("location: ". $url ."/error?error=1");
}
}
?>
</article>
<?php
/**
* Display footer
*/
footer();
?>
</body>
</html>