aboutsummaryrefslogtreecommitdiff
path: root/engine
diff options
context:
space:
mode:
authorcash <cash.costello@gmail.com>2011-12-05 21:54:09 -0500
committercash <cash.costello@gmail.com>2011-12-05 21:54:09 -0500
commitc2cddede38dbb29d53167e296981a678759e0648 (patch)
tree7d48ff3779f502d93ab09e7ba074a179c6ec85a0 /engine
parent77c79deec262938410fe02e6cba7cb0568de703b (diff)
downloadelgg-c2cddede38dbb29d53167e296981a678759e0648.tar.gz
elgg-c2cddede38dbb29d53167e296981a678759e0648.tar.bz2
first version of a 404 page
Diffstat (limited to 'engine')
-rw-r--r--engine/lib/pagehandler.php31
1 files changed, 31 insertions, 0 deletions
diff --git a/engine/lib/pagehandler.php b/engine/lib/pagehandler.php
index aba921416..16be6e3b2 100644
--- a/engine/lib/pagehandler.php
+++ b/engine/lib/pagehandler.php
@@ -110,3 +110,34 @@ function elgg_unregister_page_handler($handler) {
unset($CONFIG->pagehandler[$handler]);
}
+
+/**
+ * Serve an error page
+ *
+ * @param string $hook The name of the hook
+ * @param string $type The type of the hook
+ * @param bool $result The current value of the hook
+ * @param array $params Parameters related to the hook
+ */
+function elgg_error_page_handler($hook, $type, $result, $params) {
+ if (elgg_view_exists("errors/$type")) {
+ $content = elgg_view("errors/$type", $params);
+ } else {
+ $content = elgg_view("errors/default", $params);
+ }
+ $body = elgg_view_layout('error', array('content' => $content));
+ echo elgg_view_page($title, $body, 'error');
+ exit;
+}
+
+/**
+ * Initializes the page handler/routing system
+ *
+ * @return void
+ * @access private
+ */
+function page_handler_init() {
+ elgg_register_plugin_hook_handler('forward', '404', 'elgg_error_page_handler');
+}
+
+elgg_register_event_handler('init', 'system', 'page_handler_init');