page: redirect location option in abort()
[minimedit.git] / error.inc.php
index faa71905a3dc3d7061570f963d6b6ce0b9bac91a..a9669c4fc85d60152e4768fd107aac403b0f1c8d 100644 (file)
@@ -1,9 +1,16 @@
 <?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;
+               }
+       }
        print "$body\n";
        exit;
 }