-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathadmin_load.php
68 lines (65 loc) · 2.12 KB
/
admin_load.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
<?php
require 'assets/init.php';
cleanConfigData();
if (IS_LOGGED == false || (PT_IsAdmin() == false && !in_array($pt->user->admin, array(1,2,3)))) {
header("Location: " . PT_Link(''));
exit();
}
if (!empty($_GET)) {
foreach ($_GET as $key => $value) {
if (!is_array($value)) {
$value = preg_replace('/on[^<>=]+=[^<>]*/m', '', $value);
$_GET[$key] = strip_tags($value);
}
else{
foreach ($value as $keyv => $valuev) {
$valuev = preg_replace('/on[^<>=]+=[^<>]*/m', '', $valuev);
$value[$keyv] = strip_tags($valuev);
}
$_GET[$key] = $value;
}
}
}
if (!empty($_POST)) {
foreach ($_POST as $key => $value) {
if (!is_array($value)) {
$value = preg_replace('/on[^<>=]+=[^<>]*/m', '', $value);
$_POST[$key] = strip_tags($value);
}
else{
foreach ($value as $keyv => $valuev) {
$valuev = preg_replace('/on[^<>=]+=[^<>]*/m', '', $valuev);
$value[$keyv] = strip_tags($valuev);
}
$_POST[$key] = $value;
}
}
}
$path = (!empty($_GET['path'])) ? getPageFromPath($_GET['path']) : null;
$files = scandir('admin-panel/pages');
unset($files[0]);
unset($files[1]);
$page = 'dashboard';
if (!empty($path['page']) && in_array($path['page'], $files) && file_exists('admin-panel/pages/'.$path['page'].'/content.html')) {
$page = $path['page'];
}
if ($pt->user->admin != 1 && !CheckHavePermission($page) && $page != 'changelog') {
$permission = json_decode($pt->user->permission,true);
if (!empty($permission) && is_array($permission)) {
foreach ($permission as $key => $value) {
if(isset($permission[$key]) && $permission[$key] == "1") {
$page = $key;
}
}
}
else{
$page = 'dashboard';
}
}
$data = array();
$text = PT_LoadAdminPage($page.'/content');
?>
<input type="hidden" id="json-data" value='<?php echo htmlspecialchars(json_encode($data));?>'>
<?php
echo $text;
?>