Recursively search for database config
[infodrom.org/service.infodrom.org] / src / ajax.php
1 <?php
2 require_once('config.php');
3 require_once('future.php');
4
5 function json_return($data)
6 {
7   header('Content-type: application/json; charset="UTF-8"');
8   echo json_encode($data);
9   exit();
10 }
11
12 $backend = new AJAXBackend();
13
14 $data = array();
15
16 if (strlen($_POST['func'])) {
17   if (method_exists($backend, $_POST['func'])) {
18     $func = $_POST['func'];
19     $data = $backend->$func();
20   } else {
21     $data = array('error' => 'Unbekannte Funktion '.$_POST['func'].'.');
22   }
23 }
24
25 json_return($data);
26
27 ?>