<?php
# custom error handling for MinimEdit
-function abort($body, $status = NULL)
+function abort($body, string $status = NULL)
{
- if ($status) header("HTTP/1.1 $status");
+ if ($status) {
+ header("HTTP/1.1 $status");
+ if ($status[0] === '3') {
+ # redirection (body specifies target)
+ header("Location: $body");
+ exit;
+ }
+ }
+ header('Content-Type: text/plain; charset=utf-8');
print "$body\n";
exit;
}