Semi-stable version with old variable names

This commit is contained in:
Fabio Herzig
2026-07-16 18:43:30 +02:00
parent 3731183654
commit c8e7ce9174
165 changed files with 25654 additions and 9728 deletions
+31 -6
View File
@@ -48,22 +48,41 @@ function verify_csrf() {
die("Access Denied: Invalid CSRF Token.");
}
} else {
http_response_code(403);
http_response_code(405);
die("Access Denied: Invalid Request Type.");
}
}
function verify_delete_csrf($_DELETE) {
if ($_SERVER['REQUEST_METHOD'] === 'DELETE') {
$token = $_DELETE['csrf_token'] ?? '';
if (!hash_equals($_SESSION['csrf_token'], $token)) {
http_response_code(403);
die("Access Denied: Invalid CSRF Token.");
}
} else {
http_response_code(405);
die("Access Denied: Invalid Request Type.");
}
}
$allowedUserTypes = ['trainer', 'kampfrichter', 'wk_leitung'];
function check_user_permission(string $type, bool $return = false) {
function check_user_permission(string $type, bool $return = false, bool $display = false) {
global $allowedUserTypes;
if (!in_array($type, $allowedUserTypes, true)) {
if ($return) {
return false;
} else {
http_response_code(403);
die("Invalid User Type Configuration");
if ($display) {
http_response_code(403);
include __DIR__ . "/../www/error-pages/403.html";
exit;
} else {
http_response_code(403);
die("Invalid User Type Configuration");
}
}
}
@@ -77,8 +96,14 @@ function check_user_permission(string $type, bool $return = false) {
if ($return) {
return false;
} else {
http_response_code(403);
die("Access Denied");
if ($display) {
http_response_code(403);
include __DIR__ . "/../www/error-pages/403.html";
exit;
} else {
http_response_code(403);
die("Access Denied");
}
}
}