You are here

function drupal_not_found in Drupal 4

Same name and namespace in other branches
  1. 5 includes/common.inc \drupal_not_found()
  2. 6 includes/common.inc \drupal_not_found()
  3. 7 includes/common.inc \drupal_not_found()

Generates a 404 error if the request can not be handled.

28 calls to drupal_not_found()
blogapi_blogapi in modules/blogapi.module
blog_page_user in modules/blog.module
Displays a Drupal page containing recent blog entries of a given user.
book_admin_edit in modules/book.module
Display an administrative view of the hierarchy of a book.
book_export in modules/book.module
Menu callback; Generates various representation of a book page with all descendants and prints the requested representation to output.
contact_mail_user in modules/contact.module
Personal contact page.

... See full list

File

includes/common.inc, line 285
Common functions that many Drupal modules will need to reference.

Code

function drupal_not_found() {
  drupal_set_header('HTTP/1.0 404 Not Found');
  watchdog('page not found', t('%page not found.', array(
    '%page' => theme('placeholder', $_GET['q']),
  )), WATCHDOG_WARNING);

  // Keep old path for reference
  if (!isset($_REQUEST['destination'])) {
    $_REQUEST['destination'] = $_GET['q'];
  }
  $path = drupal_get_normal_path(variable_get('site_404', ''));
  if ($path && $path != $_GET['q']) {
    menu_set_active_item($path);
    $return = menu_execute_active_handler();
  }
  else {

    // Redirect to a non-existent menu item to make possible tabs disappear.
    menu_set_active_item('');
  }
  if (empty($return)) {
    drupal_set_title(t('Page not found'));
  }
  print theme('page', $return);
}