aboutsummaryrefslogtreecommitdiff
path: root/lib/Minz/Error.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-06-13 18:51:52 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-06-13 18:51:52 +0200
commitf58fdfe93dbf969338fe9cecbd728e0f7add4617 (patch)
treee1629da3361235d1c4ef28944624326491628045 /lib/Minz/Error.php
parentc053825ff8f9792e692c101585481129b006937b (diff)
parent61f4d5457818204eb28ed394d4f1b97160542baa (diff)
Merge branch 'dev' into beta
Diffstat (limited to 'lib/Minz/Error.php')
-rw-r--r--lib/Minz/Error.php32
1 files changed, 24 insertions, 8 deletions
diff --git a/lib/Minz/Error.php b/lib/Minz/Error.php
index 337ab6c0a..c8222a430 100644
--- a/lib/Minz/Error.php
+++ b/lib/Minz/Error.php
@@ -23,13 +23,32 @@ class Minz_Error {
$logs = self::processLogs ($logs);
$error_filename = APP_PATH . '/Controllers/errorController.php';
+ switch ($code) {
+ case 200 :
+ header('HTTP/1.1 200 OK');
+ break;
+ case 403 :
+ header('HTTP/1.1 403 Forbidden');
+ break;
+ case 404 :
+ header('HTTP/1.1 404 Not Found');
+ break;
+ case 500 :
+ header('HTTP/1.1 500 Internal Server Error');
+ break;
+ case 503 :
+ header('HTTP/1.1 503 Service Unavailable');
+ break;
+ default :
+ header('HTTP/1.1 500 Internal Server Error');
+ }
+
if (file_exists ($error_filename)) {
$params = array (
'code' => $code,
'logs' => $logs
);
- Minz_Response::setHeader ($code);
if ($redirect) {
Minz_Request::forward (array (
'c' => 'error'
@@ -41,19 +60,16 @@ class Minz_Error {
), false);
}
} else {
- $text = '<h1>An error occured</h1>'."\n";
+ echo '<h1>An error occured</h1>' . "\n";
if (!empty ($logs)) {
- $text .= '<ul>'."\n";
+ echo '<ul>' . "\n";
foreach ($logs as $log) {
- $text .= '<li>' . $log . '</li>'."\n";
+ echo '<li>' . $log . '</li>' . "\n";
}
- $text .= '</ul>'."\n";
+ echo '</ul>' . "\n";
}
- Minz_Response::setHeader ($code);
- Minz_Response::setBody ($text);
- Minz_Response::send ();
exit ();
}
}