From e8eaeb86f077deaffdaa0c3262284e4f540cada6 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Mon, 16 Jan 2012 13:22:13 +0100 Subject: CS fixes --- public_html/api/index.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'public_html/api/index.php') diff --git a/public_html/api/index.php b/public_html/api/index.php index 54ae2cb..1349a1c 100644 --- a/public_html/api/index.php +++ b/public_html/api/index.php @@ -1,18 +1,19 @@ dispatch($postdata); - } catch(Exception $e) { - error_log($e->getMessage()); - $controller->output->error($e->getMessage(), $e->getCode()); - } +// init frontend controller +$controller = new kolab_admin_api_controller; - // if we arrive here the controller didn't generate output - $controller->output->error("Invalid request"); +try { + $postdata = $_SERVER['REQUEST_METHOD'] == 'POST' ? @json_decode(file_get_contents('php://input'), true) : null; + $controller->dispatch($postdata); +} catch(Exception $e) { + error_log($e->getMessage()); + $controller->output->error($e->getMessage(), $e->getCode()); +} + +// if we arrive here the controller didn't generate output +$controller->output->error("Invalid request"); ?> -- cgit v1.1