Permission syntax fix, adding regex replacements for routing, color fix

This commit is contained in:
2020-07-13 17:57:03 +02:00
parent 7fa02a1f39
commit 35637ddc37
5 changed files with 23 additions and 9 deletions

View File

@@ -111,6 +111,20 @@ if(isset($_GET["api"]) && is_string($_GET["api"])) {
$response = (new Document404($user))->getCode();
} else {
$target = trim(explode("\n", $route["target"])[0]);
$pattern = str_replace("/","\\/", $route["request"]);
$pattern = "/$pattern/";
if (!startsWith($requestedUri, '/')) {
$requestedUri = "/$requestedUri";
}
@preg_match("$pattern", $requestedUri, $match);
if (is_array($match) && !empty($match)) {
foreach($match as $index => $value) {
$target = str_replace("$$index", $value, $target);
}
}
switch ($route["action"]) {
case "redirect_temporary":
http_response_code(307);