4.6.x common.inc drupal_access_denied()
4.7.x common.inc drupal_access_denied()
5.x common.inc drupal_access_denied()
6.x common.inc drupal_access_denied()
7.x common.inc drupal_access_denied()

Generates a 403 error if the request is not allowed.

8 calls to drupal_access_denied()
comment_edit in modules/comment.module
file_download in includes/file.inc
Call modules to find out if a file is accessible for a given user.
index.php in ./index.php
The PHP page that serves all page requests on a Drupal installation.
node_page in modules/node.module
Menu callback; dispatches control to the appropriate operation handler.
page_example_baz in developer/examples/page_example.module
A more complex page callback that takes arguments.

... See full list

File

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

Code

function drupal_access_denied() {
  drupal_set_header('HTTP/1.0 403 Forbidden');
  watchdog('access denied', t('%page denied access.', array('%page' => theme('placeholder', $_GET['q']))), WATCHDOG_WARNING, l(t('view'), $_GET['q']));

  $path = drupal_get_normal_path(variable_get('site_403', ''));
  $status = MENU_NOT_FOUND;
  if ($path && $path != $_GET['q']) {
    menu_set_active_item($path);
    $status = menu_execute_active_handler();
  }

  if ($status != MENU_FOUND) {
    drupal_set_title(t('Access denied'));
    print theme('page', message_access());
  }
}