* * @author Perfler Dominik <*****@*****.**> * @copyright 2014-2015 Perfler Dominik * @license MIT */ header('Content-Type: application/json'); // Since we always use JSON for responses we set the Content-Type at the beginning $_RESPONSE = array(); // This array will hold the response if (http_response_code() == 503) { Lightwork::Done('error', 'ERROR_SITE_OFFLINE'); } else { if (http_response_code() == 500) { Lightwork::Done('error', 'ERROR_SCRIPT_SERVER_ERROR'); } else { $script = Lightwork::Script(); // Grab the script if (isset($script['status']) && isset($script['message'])) { Lightwork::Done($script['status'], $script['message']); } else { if ($script['method'] != METHOD && $script['method'] != 'ANY') { Lightwork::Done('error', 'SCRIPT_METHOD_NOT_ALLOWED'); } // The allowed method (GET, POST, PUT, ...) doesn't match with this request prepare(); // This will modify the request so it is easier to parse if (!is_null($script['validator'])) { $form = new Form($script['validator']); // Initialize a new form if (!$form->checkHoneypot()) { // Check the honeypot (if form has one)