summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-01-23 06:33:08 +0000
committerEvan Prodromou <evan@controlyourself.ca>2009-01-23 06:33:08 +0000
commitda5c5499b8ebe2e0089fbc4080d26556f0bb11b4 (patch)
treea70e05f6471b01beafe0bcb00422ed86162df56d /lib/util.php
parent745885902ae69e832d910b82c6bc21520885b136 (diff)
parent538518ead6b15ce08f36304aed826626476a0883 (diff)
Merge branch 'master' of /var/www/trunk
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php53
1 files changed, 4 insertions, 49 deletions
diff --git a/lib/util.php b/lib/util.php
index 42bc08e7e..0b5abfa48 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -23,60 +23,15 @@
function common_server_error($msg, $code=500)
{
- static $status = array(500 => 'Internal Server Error',
- 501 => 'Not Implemented',
- 502 => 'Bad Gateway',
- 503 => 'Service Unavailable',
- 504 => 'Gateway Timeout',
- 505 => 'HTTP Version Not Supported');
-
- if (!array_key_exists($code, $status)) {
- $code = 500;
- }
-
- $status_string = $status[$code];
-
- header('HTTP/1.1 '.$code.' '.$status_string);
- header('Content-type: text/plain');
-
- print $msg;
- print "\n";
- exit();
+ $err = new ServerErrorAction($msg, $code);
+ $err->showPage();
}
// Show a user error
function common_user_error($msg, $code=400)
{
- static $status = array(400 => 'Bad Request',
- 401 => 'Unauthorized',
- 402 => 'Payment Required',
- 403 => 'Forbidden',
- 404 => 'Not Found',
- 405 => 'Method Not Allowed',
- 406 => 'Not Acceptable',
- 407 => 'Proxy Authentication Required',
- 408 => 'Request Timeout',
- 409 => 'Conflict',
- 410 => 'Gone',
- 411 => 'Length Required',
- 412 => 'Precondition Failed',
- 413 => 'Request Entity Too Large',
- 414 => 'Request-URI Too Long',
- 415 => 'Unsupported Media Type',
- 416 => 'Requested Range Not Satisfiable',
- 417 => 'Expectation Failed');
-
- if (!array_key_exists($code, $status)) {
- $code = 400;
- }
-
- $status_string = $status[$code];
-
- header('HTTP/1.1 '.$code.' '.$status_string);
-
- common_show_header('Error');
- common_element('div', array('class' => 'error'), $msg);
- common_show_footer();
+ $err = new ClientErrorAction($msg, $code);
+ $err->showPage();
}
function common_init_locale($language=null)