summaryrefslogtreecommitdiffstats
path: root/modules-available/dozmod/api.inc.php
diff options
context:
space:
mode:
authorSimon Rettberg2025-05-09 14:55:44 +0200
committerSimon Rettberg2025-05-09 14:55:44 +0200
commit66946ca799ca10489c4f41c499515d0df4633129 (patch)
tree76ca04c4a360d683309f193badb8ad882c5cac10 /modules-available/dozmod/api.inc.php
parent[rebootcontrol] POST -> GET for fetching client status via AJAX (diff)
downloadslx-admin-66946ca799ca10489c4f41c499515d0df4633129.tar.gz
slx-admin-66946ca799ca10489c4f41c499515d0df4633129.tar.xz
slx-admin-66946ca799ca10489c4f41c499515d0df4633129.zip
Use http_response_code() instead of header(), add a few missing repsonse codes
Diffstat (limited to 'modules-available/dozmod/api.inc.php')
-rw-r--r--modules-available/dozmod/api.inc.php10
1 files changed, 5 insertions, 5 deletions
diff --git a/modules-available/dozmod/api.inc.php b/modules-available/dozmod/api.inc.php
index 34b5136d..5a8f6302 100644
--- a/modules-available/dozmod/api.inc.php
+++ b/modules-available/dozmod/api.inc.php
@@ -284,7 +284,7 @@ function outputResource(string $lecture_uuid, string $resource): void
#[NoReturn]
function fatalDozmodUnreachable()
{
- Header('HTTP/1.1 504 Gateway Timeout');
+ http_response_code(504);
die('DMSD currently not available');
}
@@ -292,7 +292,7 @@ function readLectureParam(array $locationIds): string
{
$lecture = Request::get('lecture', false, 'string');
if ($lecture === false) {
- Header('HTTP/1.1 400 Bad Request');
+ http_response_code(400);
die('Missing lecture UUID');
}
$lectures = getLectureUuidsForLocations($locationIds);
@@ -301,7 +301,7 @@ function readLectureParam(array $locationIds): string
}
/* check that the user requests a lecture that he is allowed to have */
if (!in_array($lecture, $lectures)) {
- Header('HTTP/1.1 403 Forbidden');
+ http_response_code(403);
die("You don't have permission to access this lecture");
}
return $lecture;
@@ -316,7 +316,7 @@ function readImageParam(): string
$image = Request::get('lecture', false, 'string');
if ($image === false) {
- Header('HTTP/1.1 400 Bad Request');
+ http_response_code(400);
die('Missing IMAGE UUID');
}
return $image;
@@ -331,7 +331,7 @@ if ($resource === false) {
}
if (!in_array($resource, $availableRessources)) {
- Header('HTTP/1.1 400 Bad Request');
+ http_response_code(400);
die("unknown resource: $resource");
}