-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex_wp.php
72 lines (63 loc) · 2.52 KB
/
index_wp.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
<?php
/*
* This file is part of Uncovery Minecraft.
* Copyright (C) 2015 uncovery.me
*
* Uncovery Minecraft is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, either version 3 of the License, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
* This file is the entry point for the code when called through wordpress.
* It also manages direct functon calls via URL, such as the 2D map and others.s
*/
global $UMC_USER, $UMC_ENV, $UMC_USERS;
// do not process any functions if we have a 404 error;
if (function_exists('is_404') && is_404()) {
return;
}
require_once(__DIR__ . '/core_include.php');
$s_get = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
$s_post = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
if (isset($s_get['function']) && function_exists('umc_'.$s_get['function'])) {
umc_function_call($s_get['function']);
} else if (isset($s_post['function']) && function_exists('umc_'.$s_post['function'])) {
umc_function_call($s_post['function']);
} /* else if (isset($s_get['function']) && !function_exists('umc_'.$s_get['function'])){
XMPP_ERROR_send_msg("Could not load function {$s_get['function']}");
}
*/
if (!$UMC_ENV) {
umc_set_environment();
}
/**
* Verify that an externally called function is actually a vaild, no-risk function call.
*
* $UMC_FUNCTIONS is defined in all the files where the respective function is located
*
* @global type $UMC_FUNCTIONS
* @param type $function
*/
function umc_function_call($function) {
global $UMC_FUNCTIONS;
// we check if the function is in the list of known functions
if (!isset($UMC_FUNCTIONS[$function])) {
// if not, send a warning so that it can be included for the future
XMPP_ERROR_send_msg("Unverified function call '$function'");
$function_name = 'umc_' . $function;
} else {
// if yes, all fine, get proper function name
$function_name = $UMC_FUNCTIONS[$function];
}
// execute code
echo $function_name();
}