forked from sdc/xerte_2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
management.php
292 lines (217 loc) · 12.6 KB
/
management.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
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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
<?php
require_once(dirname(__FILE__) . "/config.php");
_load_language_file("/management.inc");
/**
*
* Login page, self posts to become management page
*
* @author Patrick Lockley
* @version 1.0
* @copyright Copyright (c) 2008,2009 University of Nottingham
* @package
*/
function mgt_page($xerte_toolkits_site, $extra)
{
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?PHP echo $xerte_toolkits_site->site_title; ?></title>
<?PHP
echo "<script type=\"text/javascript\"> // JAVASCRIPT library for fixed variables\n // management of javascript is set up here\n // SITE SETTINGS\n";
echo "var site_url = \"" . $xerte_toolkits_site->site_url . "\";\n";
echo "var site_apache = \"" . $xerte_toolkits_site->apache . "\";\n";
echo "var properties_ajax_php_path = \"website_code/php/properties/\";\n var management_ajax_php_path = \"website_code/php/management/\";\n var ajax_php_path = \"website_code/php/\";\n";
?></script>
<link href="website_code/styles/frontpage.css" media="screen" type="text/css" rel="stylesheet" />
<link href="website_code/styles/xerte_buttons.css" media="screen" type="text/css" rel="stylesheet" />
<!--
University of Nottingham Xerte Online Toolkits
HTML to use to set up the login page
The {{}} pairs are replaced in the page formatting functions in display library
Version 1.0
-->
</head>
<body>
<div class="topbar">
<img src="<?PHP echo $xerte_toolkits_site->site_logo; ?>" style="margin-left:10px; float:left" />
<img src="<?PHP echo $xerte_toolkits_site->organisational_logo; ?>" style="margin-right:10px; float:right" />
</div>
<div class="mainbody">
<div class="title">
<p>
<?PHP echo $xerte_toolkits_site->welcome_message; ?>
</p>
</div>
<div class="mainbody_holder">
<div class="mainbody_div_2">
<div class="top_left sign_in_TL m_b_d_2_child" style="background-color:#f3eee2;">
<div class="top_right sign_in_TR m_b_d_2_child">
<div class="bottom_left sign_in_BL m_b_d_2_child">
<div class="bottom_right sign_in_BR m_b_d_2_child">
<p>
<?PHP echo MANAGEMENT_LOGIN; ?>
</p>
<div>
<form method="post" enctype="application/x-www-form-urlencoded" action="management.php"><p>Username <input type="text" size="20" maxlength="100" name="login" /></p><p>Password <input type="password" size="20" maxlength="100" name="password" /></p><p style="clear:left; width:95%; padding-bottom:15px;"><button type="submit" class="xerte_button" style="float:right" ><?php echo MANAGEMENT_BUTTON_LOGIN; ?></button></p></form>
<!--
After this, the login form is handled by the php
-->
<?PHP
echo $extra;
?>
</div>
</div>
</div>
</div>
</div>
<div class="border"></div>
</div>
<div class="mainbody_left">
<div class="tutorials">
</div>
</div>
<div class="mainbody_div">
</div>
</div>
</div>
<div class="border">
</div>
<p class="copyright">
<img src="website_code/images/lt_logo.gif" /><br>
<?PHP echo $xerte_toolkits_site->copyright; ?>
</p>
</div>
</body>
</html>
<?PHP
}
/*
* As with index.php, check for posts and similar
*/
if (empty($_POST["login"]) && empty($_POST["password"])) {
mgt_page($xerte_toolkits_site, MANAGEMENT_USERNAME_AND_PASSWORD_EMPTY);
/*
* Password left empty
*/
} else if (empty($_POST["password"])) {
mgt_page($xerte_toolkits_site, MANAGEMENT_PASSWORD_EMPTY);
/*
* Password and username provided, so try to authenticate
*/
} else {
global $authmech;
if (!isset($authmech))
{
$authmech = Xerte_Authentication_Factory::create($xerte_toolkits_site->authentication_method);
}
if (($_POST["login"] == $xerte_toolkits_site->admin_username) && ($_POST["password"] == $xerte_toolkits_site->admin_password)) {
$_SESSION['toolkits_logon_id'] = "site_administrator";
$mysql_id = database_connect("management.php database connect success", "management.php database connect fail");
/*
* Password and username provided, so try to authenticate
*/
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?PHP echo $xerte_toolkits_site->site_title; ?></title>
<link href="website_code/styles/frontpage.css" media="screen" type="text/css" rel="stylesheet" />
<link href="website_code/styles/xerte_buttons.css" media="screen" type="text/css" rel="stylesheet" />
<link href="website_code/styles/management.css" media="screen" type="text/css" rel="stylesheet" />
<?PHP
echo "<script type=\"text/javascript\"> // JAVASCRIPT library for fixed variables\n // management of javascript is set up here\n // SITE SETTINGS\n";
echo "var site_url = \"" . $xerte_toolkits_site->site_url . "\";\n";
echo "var site_apache = \"" . $xerte_toolkits_site->apache . "\";\n";
echo "var properties_ajax_php_path = \"website_code/php/properties/\";\n var management_ajax_php_path = \"website_code/php/management/\";\n var ajax_php_path = \"website_code/php/\";\n";
?></script>
<!--
University of Nottingham Xerte Online Toolkits
HTML to use to set up the login page
The {{}} pairs are replaced in the page formatting functions in display library
Version 1.0
-->
<?php
_include_javascript_file("website_code/scripts/file_system.js");
_include_javascript_file("website_code/scripts/screen_display.js");
_include_javascript_file("website_code/scripts/ajax_management.js");
_include_javascript_file("website_code/scripts/management.js");
_include_javascript_file("website_code/scripts/import.js");
_include_javascript_file("website_code/scripts/template_management.js");
_include_javascript_file("website_code/scripts/logout.js");
if ($authmech->canManageUser($jsscript))
{
_include_javascript_file($jsscript);
}
?>
</head>
<body onload="javascript:site_list()">
<iframe id="upload_iframe" name="upload_iframe" src="#" style="width:0px;height:0px; display:none;"></iframe>
<!--
Folder popup is the div that appears when creating a new folder
-->
<div class="topbar">
<div style="width:50%; height:100%; float:right; position:relative; background-image:url(<?php echo $xerte_toolkits_site->site_url . $xerte_toolkits_site->organisational_logo ?>); background-repeat:no-repeat; background-position:right; margin-right:10px; float:right">
<p style="float:right; margin:0px; color:#a01a13;"><button type="button" class="xerte_button" onclick="javascript:logout()" ><?PHP echo MANAGEMENT_LOGOUT; ?></button></p>
</div>
<img src="<?php echo $xerte_toolkits_site->site_logo;?>" style="margin-left:10px; float:left" />
</div>
<!--
Main part of the page
-->
<div class="pagecontainer">
<div class="admin_mgt_area">
<div class="admin_mgt_area_top">
<div class="top_left sign_in_TL m_b_d_2_child">
<div class="top_right sign_in_TR m_b_d_2_child">
<p class="heading">
<?PHP echo MANAGEMENT_TITLE; ?>
</p>
</div>
</div>
</div>
<div class="admin_mgt_area_middle">
<div class="admin_mgt_area_middle_button">
<!--
admin area menu
-->
<div class="admin_mgt_area_middle_button_left">
<button type="button" class="xerte_button" onclick="javascript:site_list();"><?PHP echo MANAGEMENT_MENUBAR_SITE; ?> </button>
<button type="button" class="xerte_button" onclick="javascript:templates_list();"><?PHP echo MANAGEMENT_MENUBAR_CENTRAL; ?> </button>
<button type="button" class="xerte_button" onclick="javascript:users_list();"><?PHP echo MANAGEMENT_MENUBAR_USERS; ?> </button>
<button type="button" class="xerte_button" onclick="javascript:user_templates_list();"><?PHP echo MANAGEMENT_MENUBAR_TEMPLATES; ?> </button>
<button type="button" class="xerte_button" onclick="javascript:errors_list();"><?PHP echo MANAGEMENT_MENUBAR_ERRORS; ?> </button>
<button type="button" class="xerte_button" onclick="javascript:play_security_list();"><?PHP echo MANAGEMENT_MENUBAR_PLAY; ?> </button>
<button type="button" class="xerte_button" onclick="javascript:categories_list();"><?PHP echo MANAGEMENT_MENUBAR_CATEGORIES; ?> </button>
<button type="button" class="xerte_button" onclick="javascript:licenses_list();"><?PHP echo MANAGEMENT_MENUBAR_LICENCES; ?> </button>
<button type="button" class="xerte_button" onclick="javascript:feeds_list();"><?PHP echo MANAGEMENT_MENUBAR_FEEDS; ?> </button>
</div>
<div class="admin_mgt_area_middle_button_right">
<button type="button" class="xerte_button" onclick="javascript:save_changes()"><?PHP echo MANAGEMENT_MENUBAR_SAVE; ?> </button>
</div>
<div id="admin_area">
<?PHP
} else {
/*
* Wrong password message
*/
mgt_page($xerte_toolkits_site, MANAGEMENT_LOGON_FAIL . " " . MANAGEMENT_NOT_ADMIN_USERNAME);
/*
* Check the user is set as an admin in the usertype record in the logindetails table, and display the page
*/
echo file_get_contents($xerte_toolkits_site->website_code_path . "admin_headers");
echo "<script type=\"text/javascript\"> // JAVASCRIPT library for fixed variables\n // management of javascript is set up here\n // SITE SETTINGS\n";
echo "var site_url = \"" . $xerte_toolkits_site->site_url . "\";\n";
echo "var site_apache = \"" . $xerte_toolkits_site->apache . "\";\n";
echo "var properties_ajax_php_path = \"website_code/php/properties/\";";
echo "var management_ajax_php_path = \"website_code/php/management/\";";
echo "var ajax_php_path = \"website_code/php/\";</script>";
echo admin_page_format_top(file_get_contents($xerte_toolkits_site->website_code_path . "admin_top"));
echo file_get_contents($xerte_toolkits_site->website_code_path . "admin_middle");
}
}
?>
</body>
</html>