Added Borderpoint status to Preorder

This commit is contained in:
Frank Schubert
2025-05-07 18:33:20 +02:00
parent c7ce28acf8
commit 678544ced7
9 changed files with 336 additions and 143 deletions
+20 -4
View File
@@ -318,14 +318,30 @@ class mfBaseController
return $url;
}
public static function returnJson($data)
public static function returnJson($response)
{
if (is_array($data)) {
if(mfResponse::isResponse($response)) {
$code = $response['code'];
$status = $response['status'];
$data = $response['data'];
$proto = "HTTP/1.0";
if($_SERVER["SERVER_PROTOCOL"]) {
$proto = $_SERVER["SERVER_PROTOCOL"];
}
header("$proto $code $status");
header("Content-type: application/json");
//http_response_code($code);
echo json_encode(["status" => $status, "result" => $data]);
exit;
}
if (is_array($response)) {
header("Content-Type: application/json");
echo json_encode($data);
echo json_encode($response);
exit;
} else {
throw new Exception("Data not an array");
throw new Exception("Response data not an array");
}
}