diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-12-16 21:06:34 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-12-16 21:06:34 +0000 |
commit | 670a292277682351c373780746aedd5c110b3b08 (patch) | |
tree | f6122c8d99f90f001e0d5e0d84f2dde8f99e0214 /includes/common.inc | |
parent | 595c790a9c488b16875e4a0f8eb5a35e0df2845c (diff) | |
download | brdo-670a292277682351c373780746aedd5c110b3b08.tar.gz brdo-670a292277682351c373780746aedd5c110b3b08.tar.bz2 |
- Reworked 404 (page not found) handling. Patch by walkah. You can specify a
custom 404 page in the administration page. As a result, error.php could be
removed.
Diffstat (limited to 'includes/common.inc')
-rw-r--r-- | includes/common.inc | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/includes/common.inc b/includes/common.inc index 3b086f736..4376fa685 100644 --- a/includes/common.inc +++ b/includes/common.inc @@ -103,6 +103,24 @@ function drupal_rebuild_path_map() { drupal_get_path_map("rebuild"); } +function drupal_not_found() { + header("HTTP/1.0 404 Not Found"); + watchdog("httpd", "404 error: ". $_GET['q'] ." not found"); + + $path = drupal_get_normal_path(variable_get('site_404', '')); + + if ($path) { + menu_set_active_item($path); + } + + if ($path && menu_active_handler_exists()) { + menu_execute_active_handler(); + } + else { + print theme("page", '<h1>'. t('Page not found') .'</h1>'); + } +} + function error_handler($errno, $message, $filename, $line, $variables) { $types = array(1 => "error", 2 => "warning", 4 => "parse error", 8 => "notice", 16 => "core error", 32 => "core warning", 64 => "compile error", 128 => "compile warning", 256 => "user error", 512 => "user warning", 1024 => "user notice"); $entry = $types[$errno] .": $message in $filename on line $line."; |