Skip to content

Commit

Permalink
feature(core): adds handling of 400 and 403 error codes
Browse files Browse the repository at this point in the history
Improves handling of 400 and 403 HTTP error codes
  • Loading branch information
hypeJunction committed Apr 11, 2015
1 parent 0769708 commit 243ca40
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions engine/lib/pagehandler.php
Expand Up @@ -293,6 +293,8 @@ function elgg_error_page_handler($hook, $type, $result, $params) {
function _elgg_page_handler_init() {
elgg_register_page_handler('', 'elgg_front_page_handler');
// Registered at 600 so that plugins can register at the default 500 and get to run first
elgg_register_plugin_hook_handler('forward', '400', 'elgg_error_page_handler', 600);
elgg_register_plugin_hook_handler('forward', '403', 'elgg_error_page_handler', 600);
elgg_register_plugin_hook_handler('forward', '404', 'elgg_error_page_handler', 600);
}

Expand Down
4 changes: 4 additions & 0 deletions languages/en.php
Expand Up @@ -112,6 +112,10 @@

'error:default:title' => 'Oops...',
'error:default:content' => 'Oops... something went wrong.',
'error:400:title' => 'Bad request',
'error:400:content' => 'Sorry. The request is invalid or incomplete.',
'error:403:title' => 'Forbidden',
'error:403:content' => 'Sorry. You are not allowed to access the requested page.',
'error:404:title' => 'Page not found',
'error:404:content' => 'Sorry. We could not find the page that you requested.',

Expand Down
6 changes: 6 additions & 0 deletions views/default/errors/400.php
@@ -0,0 +1,6 @@
<?php
/**
* Bad request error
*/

echo elgg_echo('error:400:content');
6 changes: 6 additions & 0 deletions views/default/errors/403.php
@@ -0,0 +1,6 @@
<?php
/**
* Forbidden error
*/

echo elgg_echo('error:403:content');

0 comments on commit 243ca40

Please sign in to comment.