summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Millette <millette@controlyourself.ca>2009-01-23 05:57:08 +0000
committerRobin Millette <millette@plantard.controlezvous.ca>2009-01-23 05:57:08 +0000
commitfbd1cf4dfa452166a5985d9a9177d57e8554f09f (patch)
tree1de29858f729dc429e5c4bd2e9c13e6e64e1128e
parentc628bbb1928308fe1e20f00eccfdc2a1b2c9105e (diff)
use new error actions classes to display error
-rw-r--r--lib/clienterroraction.php (renamed from actions/clienterror.php)0
-rw-r--r--lib/servererroraction.php (renamed from actions/servererror.php)0
-rw-r--r--lib/util.php53
3 files changed, 4 insertions, 49 deletions
diff --git a/actions/clienterror.php b/lib/clienterroraction.php
index ef6fd51df..ef6fd51df 100644
--- a/actions/clienterror.php
+++ b/lib/clienterroraction.php
diff --git a/actions/servererror.php b/lib/servererroraction.php
index a39886591..a39886591 100644
--- a/actions/servererror.php
+++ b/lib/servererroraction.php
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)