minor changes for testing

Signed-off-by: Michael Kaufmann (d00p) <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann (d00p)
2018-02-25 11:47:28 +01:00
parent 2f30d85d32
commit 243b68cc37
4 changed files with 21 additions and 12 deletions

10
api.php
View File

@@ -54,11 +54,13 @@ exit();
*/
function json_response($status, $status_message = '', $data = null)
{
$resheader = $_SERVER["SERVER_PROTOCOL"] . " " . $status;
if (! empty($status_message)) {
$resheader .= ' ' . str_replace("\n", " ", $status_message);
if (isset($_SERVER["SERVER_PROTOCOL"]) && ! empty($_SERVER["SERVER_PROTOCOL"])) {
$resheader = $_SERVER["SERVER_PROTOCOL"] . " " . $status;
if (! empty($status_message)) {
$resheader .= ' ' . str_replace("\n", " ", $status_message);
}
header($resheader);
}
header($resheader);
$response['status'] = $status;
$response['status_message'] = $status_message;