Add second UUID to template
[infodrom/musiikki-web.git] / html / index.php
1 <?php
2 require_once(__DIR__.'/../class/autoloader.class.php');
3
4 session_name('MUSIIKKI');
5 session_start();
6
7 if ($_SERVER['REQUEST_METHOD'] == 'GET') {
8     $template = new Template('main');
9     echo $template->render([]);
10 } elseif ($_SERVER['REQUEST_METHOD'] == 'POST') {
11     $method = $_POST['action'] . 'Action';
12
13     header('Content-type: application/json; charset=UTF-8');
14     $data = AJAX::$method($_POST);
15     $return = json_encode($data);
16
17     if ($return === false) {
18         error_log('Return ' . var_export($data,true));
19         $return = json_encode(array('status' => false, 'error' => 'Rückgabedaten können nicht kodiert werden.'));
20     }
21
22     echo $return;
23 }