Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/http.php
blob: 0647802ca285d7bcb070932de586e4522dfd0273 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

# do not include twice
if (function_exists("throw_http_error"))
  return;

function throw_http_error($error_number, $error_message, $extra_message = "") {
  header("Status: " . $error_number . " " . $error_message);
  print "Error " . $error_number . ": " . $error_message . "\n";
  if ($extra_message != "")
    print "<br>\n" . $extra_message;
  die();
};

function die_500($message) {
  throw_http_error(500, "Internal Server Error", $message);
};

function redirect_temporarily($uri) {
  header("Location: " . $uri);
  print "<!DOCTYPE HTML PUBLIC \"-//IETF//DTD HTML 2.0//EN\">\n";
  print "<html><head>\n";
  print "<title>302 Found</title>\n";
  print "</head><body>\n";
  print "<h1>Found</h1>\n";
  print "<p>The document has moved <a href=\"" . $uri . "\">here</a>.</p>\n";
  print "<hr>\n";
  print "</body></html>\n";
  die();
};