2 require_once('config.php');
3 require_once('future.php');
7 if (strlen($_POST['func'])) {
8 $backend = new AJAXBackend();
10 if (method_exists($backend, $_POST['func'])) {
11 $func = $_POST['func'];
12 json_return($backend->$func());
15 $path = substr($_SERVER['HTTP_REFERER'], strpos($_SERVER['HTTP_REFERER'], $_SERVER['SERVER_NAME'])+strlen($_SERVER['SERVER_NAME'])+1);
16 $slash = strpos($path, '/', strpos($path, '/')+1);
18 if ($slash !== false) {
19 $path = getcwd() . '/' . substr($path, 0, $slash) . '/' . 'moduleajaxbackend.class.php';
21 if (file_exists($path)) {
23 $backend = new ModuleAJAXBackend();
25 $method = 'ajax_' . $_POST['func'];
26 if (method_exists($backend, $method)) {
27 json_return($backend->$method());
32 error_log('Unknown function '.$_POST['func']);
33 json_return(array('status' => false,
34 'error' => 'Unknown function '.urlencode($_POST['func']).'.'));
37 error_log('Unknown usage');
38 json_return(array('status' => false, 'error' => 'Unknown usage'));