2 require_once(__DIR__.'/../../class/autoloader.class.php');
4 if ($_SERVER['REQUEST_METHOD'] == 'GET') {
5 $template = new Template('admin');
6 echo $template->render([]);
7 } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
8 $method = $_POST['action'] . 'Action';
10 header('Content-type: application/json; charset=UTF-8');
11 $data = AJAX::$method($_POST);
12 $return = json_encode($data);
14 if ($return === false) {
15 error_log('Return ' . var_export($data,true));
16 $return = json_encode(array('status' => false, 'error' => 'Rückgabedaten können nicht kodiert werden.'));