-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin2.php
119 lines (110 loc) · 2.82 KB
/
admin2.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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/** used by build-script,
* stateless,
* authentification done in every call by GET-Parameters
* use GET/REQUEST (no POST for securtiy needed because it's just called by other scripts)
*/
//TODO: remote-address-check:
// if($_SERVER['REMOTE_ADDR'] != "127.0.0.1")
// {
// echo "error_localhost_only";
//// exit;
// }
require_once('lib/Debug.class.php');
require_once('lib/database.class.php');
require_once('config.php');
//error_reporting(E_ALL);
//ini_set('display_errors', true);
require_once('lib/log.class.php');
require_once('lib/language.class.php');
require_once('lib/user.class.php');
$language = new language();
$language->load_stringtable();
require_once('lib/message_box.class.php');
$message_box = new message_box();
$user = new user();
$user->login($_REQUEST['login_name'],$_REQUEST['login_password']);
if($user->is_logged_in() && $user->is_admin())
{
if($user->check_admin_permission(@$_REQUEST['part'],@$_REQUEST['method']))
{
switch(@$_REQUEST['part']) {
case 'scenario':
{
require_once('lib/scenario.class.php');
switch(@$_REQUEST['method']) {
case 'add2':
{
$scen = new scenario();
//echo new id
echo $scen->add($_REQUEST['scenario'],$_REQUEST['versions'],@$_REQUEST['leagues']);
break;
}
case 'add_version2':
{
$scen = new scenario();
if($_REQUEST['scenario_id'])
echo $scen->load_data($_REQUEST['scenario_id']);
else
echo $scen->load_data_by_league_filename($_REQUEST['league_id'], $_REQUEST['filename']);
$scen->add_version($_REQUEST['version']);
break;
}
case 'delete_all_versions2':
{
$scen = new scenario();
if($_REQUEST['scenario_id'])
echo $scen->load_data($_REQUEST['scenario_id']);
else
echo $scen->load_data_by_league_filename($_REQUEST['league_id'], $_REQUEST['filename']);
$scen->delete_all_versions();
break;
}
/*case 'edit2':
{
$scen = new scenario();
$scen->edit($_REQUEST['scenario'],$_REQUEST['versions'],$_REQUEST['scenarios_merge'],@$_POST['leagues']);
break;
}
case 'delete2':
{
$scen = new scenario();
$scen->delete($_REQUEST['scenario']['id']);
break;
}*/
}
break;
}
case 'resource':
{
require_once('lib/resource.class.php');
$resource = new resource();
switch(@$_REQUEST['method']) {
case 'add2':
{
$resource->add($_REQUEST['resource']);
return;
}
/*case 'edit2':
{
$resource->edit($_REQUEST['resource'], $_REQUEST['old_hash']);
break;
}
case 'delete2':
{
$resource->delete($_REQUEST['resource']['hash']);
break;
}*/
}
}
}
}
else
{
//no permission:
echo "error_access_denied";
}
}
else
echo "error_access_denied";
?>