This repository has been archived by the owner on Oct 29, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
admin.php
executable file
·416 lines (352 loc) · 9.37 KB
/
admin.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
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
<?php
session_start();
require("include/functions.php");
$config_file = 'config.php';
if (file_exists($config_file)) {
require($config_file);
}
else {
header("Location: error.php?e=config");
die();
}
require("include/apply_config.php");
$force_admin = TRUE;
require("include/check_admin.php");
#DB
use \DByte\DB;
DB::$c = $pdo;
if (isset($_GET["u"])){
$u = filter_var($_GET["u"], FILTER_SANITIZE_NUMBER_INT);
}
else{
$u = "";
}
if (isset($_GET["uu"])){
$uu = filter_var($_GET["uu"], FILTER_SANITIZE_NUMBER_INT);
}
else{
$uu = "";
}
if (!isset($_GET["tt"])){
$tt = 0;
}
else{
$tt = $_GET["tt"];
}
if (!isset($_GET["imgset"])){
$imgset = 0;
}
else{
$imgset = $_GET["imgset"];
}
echo "<!DOCTYPE html>
<html lang=\"en\">
<head>
<title>$app_custom_name - Administration Area</title>";
#Get CSS
require("include/get_css3.php");
require("include/get_jqueryui.php");
?>
<!-- Validation Script -->
<script src="js/jquery.validate.js"></script>
<!-- Form validation from http://bassistance.de/jquery-plugins/jquery-plugin-validation/ -->
<script type="text/javascript">
$().ready(function() {
// validate signup form on keyup and submit
$("#AddUserForm").validate({
rules: {
UserName: {
required: true
},
UserFullname: {
required: true
},
UserEmail: {
required: true,
email: true
},
newpassword1: {
required: true,
minlength: 5
},
newpassword2: {
equalTo: "#newpassword1"
}
},
messages: {
UserName: "Please enter a username for this user",
UserFullname: "Please enter the full name of this user",
UserEmail: "Please enter a valid email of this user",
newpassword2: "The passwords do not match"
}
});
});
</script>
<style type="text/css">
#fileForm label.error {
margin-left: 10px;
width: auto;
display: inline;
}
</style>
<!-- #KML Add validation -->
<script type="text/javascript">
$().ready(function() {
// validate signup form on keyup and submit
$("#AddKML").validate({
rules: {
KmlName: {
required: true
},
KmlURL: {
required: true,
url: true
}
},
messages: {
KmlName: "Please enter a name to display for this layer",
KmlURL: "Please enter the full URL of this layer"
}
});
});
</script>
<style type="text/css">
#AddKML label.error {
margin-left: 10px;
width: auto;
display: inline;
}
</style>
<!-- #QF Add validation -->
<script type="text/javascript">
$().ready(function() {
// validate signup form on keyup and submit
$("#AddQF").validate({
rules: {
QualityFlagID: {
required: true
},
QualityFlag: {
required: true
}
},
messages: {
QualityFlagID: "Please enter a value",
QualityFlag: "Please enter the meaning of this flag"
}
});
});
</script>
<style type="text/css">
#AddQF label.error {
margin-left: 10px;
width: auto;
display: inline;
}
</style>
<!-- JQuery Confirmation -->
<script type="text/javascript">
$(function() {
$("#dialog").dialog({
autoOpen: false,
bgiframe: true,
resizable: false,
draggable: false,
height:140,
modal: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
"Set as inactive": function() {
document.delform.submit();
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('form#delform').submit(function(){
$("p#dialog-email").html($("input#UserID").val());
$('#dialog').dialog('open');
return false;
});
});
</script>
<!-- JQuery Confirmation -->
<script type="text/javascript">
$(function() {
$("#dialog2").dialog({
autoOpen: false,
bgiframe: true,
resizable: false,
draggable: false,
height:140,
modal: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
"Delete data": function() {
document.delform2.submit();
},
"Cancel": function() {
$(this).dialog("close");
}
}
});
$('form#delform2').submit(function(){
$("p#dialog-email").html($("input#ColID").val());
$('#dialog2').dialog('open');
return false;
});
});
</script>
<script type="text/javascript">
$(function() {
$("#dialogdata").dialog({
autoOpen: false,
bgiframe: true,
resizable: false,
draggable: false,
height:140,
modal: true,
overlay: {
backgroundColor: '#000',
opacity: 0.5
},
buttons: {
"Delete data": function() {
document.del_weatherdata.submit();
},
"Cancel": function() {
$(this).dialogdata("close");
}
}
});
$('form#del_weatherdata').submit(function(){
$("p#dialog-email").html($("input#ColID").val());
$('#dialogdata').dialog('open');
return false;
});
});
</script>
<script src="js/jquery.validate.js"></script>
<!-- Form validation from http://bassistance.de/jquery-plugins/jquery-plugin-validation/ -->
<script type="text/javascript">
$().ready(function() {
// validate signup form on keyup and submit
$("#AddSensors").validate({
rules: {
Recorder: {
required: true
},
Microphone: {
required: true
}
},
messages: {
Recorder: "Please enter the name/model of the recorder",
Microphone: "Please enter the name/model of the microphone"
}
});
});
</script>
<style type="text/css">
#AddSensors label.error {
margin-left: 10px;
width: auto;
display: inline;
}
</style>
<!-- Hide success messages -->
<script type="text/javascript">
$(function() {
// setTimeout() function will be fired after page is loaded
// it will wait for 5 sec. and then will fire
// $("#successMessage").hide() function
setTimeout(function() {
$("#tt1").hide('blind', {}, 500)
}, 5000);
});
</script>
<script type="text/javascript">
$(function() {
// setTimeout() function will be fired after page is loaded
// it will wait for 5 sec. and then will fire
// $("#successMessage").hide() function
setTimeout(function() {
$("#tt2").hide('blind', {}, 500)
}, 5000);
});
</script>
<!-- Tooltips-->
<script>
$(function() {
$( document ).tooltip();
});
</script>
<?php
if ($use_googleanalytics) {
echo $googleanalytics_code;
}
#Execute custom code for head, if set
if (is_file("$absolute_dir/customhead.php")) {
include("customhead.php");
}
?>
</head>
<body>
<!--Blueprint container-->
<div class="container">
<?php
require("include/topbar.php");
?>
<h2>Administration Area</h2>
<p>Use this page to set up users, permissions, and other general options for the application.</p>
<?php
#Check last version
$last_ver=file("http://ljvillanueva.github.io/pumilio/cur_ver.txt", FILE_IGNORE_NEW_LINES);
$last_ver=$last_ver[0];
$last_ver_e=explode(".",$last_ver);
#get this version
require("include/version.php");
$website_version_e=explode(".",$website_version);
if (count($website_version_e) == 4){
$w_dev = trim($website_version_e[3]);
if ($w_dev == "dev"){
echo "<div class=\"alert alert-danger\">
<span class=\"glyphicon glyphicon-exclamation-sign\" aria-hidden=\"true\"></span>
You are using a development version of Pumilio. This version may be more up to date
than the current version, but may be unstable.<br>
This version is recommended ONLY for development and for testing since there can be data corruption or loss.</div>";
}
}
if ($last_ver_e[2]>$website_version_e[2] && $last_ver_e[1] == $website_version_e[1]) {
$update_message = "<div class=\"alert alert-warning\" id=\"pumversion\">A new version of Pumilio is available ($last_ver) which includes bug fixes.<br>You are running version $website_version<br>Visit the <a href=\"http://pumilio.sourceforge.net\">project website</a> for more details.</div>";
}
elseif ($last_ver_e[1]>$website_version_e[1] && $last_ver_e[0] == $website_version_e[0]) {
$update_message = "<div class=\"alert alert-warning\" id=\"pumversion\">A new version of Pumilio is available ($last_ver) which includes new or improved features.<br>You are running version $website_version<br>Visit the <a href=\"http://pumilio.sourceforge.net\">project website</a> for more details.</div>";
}
elseif ($last_ver_e[0]>$website_version_e[0]) {
$update_message = "<div class=\"alert alert-warning\" id=\"pumversion\">A new major version of Pumilio is available ($last_ver) which includes major improvements.<br>You are running version $website_version<br>Visit the <a href=\"http://pumilio.sourceforge.net\">project website</a> for more details.</div>";
}
else {
$update_message = "<div class=\"alert alert-success\" id=\"pumversion\">Pumilio is up to date, you are running version $website_version</div>";
}
echo $update_message;
flush();
require("include/adminpumilio.php");
require("include/bottom.php");
?>
</body>
</html>
<?php
#Close session to release script from php session
session_write_close();
flush(); @ob_flush();
#Delete old temp files
delete_old('tmp/', 3);
?>