BLAM::checkLogged(); $response = BLAM::getReminders($_POST['timestamp_day']); // returns null or exception break; case 'getTaskDetail': BLAM::checkLogged(); $response = BLAM::getTaskDetail($_POST['id']); break; case 'confirmNotification': BLAM::checkLogged(); $response = BLAM::confirmNotification($_POST['ticket_id'], $_POST['update_id'], $_POST['type']); break; case 'getSMSList': BLAM::checkLogged(); $response = BLAM::getSMSList($_POST['handled'], $_POST['first_id'], $_POST['timestamp_last_update']); break; case 'getSMS': BLAM::checkLogged(); $response = BLAM::getSMSDetail($_POST['id']); break; case 'handleSMS': BLAM::checkLogged(); $response = BLAM::handleSMS($_POST['id'], $_SESSION['user']['id']); break; default: throw new Exception('Wrong action'); } echo json_encode($response); } catch (Exception $e) { die(json_encode(array('error' => $e->getMessage()))); }