Same name and namespace in other branches
- 4.6.x includes/common.inc \drupal_access_denied()
- 4.7.x includes/common.inc \drupal_access_denied()
- 6.x includes/common.inc \drupal_access_denied()
- 7.x includes/common.inc \drupal_access_denied()
Generates a 403 error if the request is not allowed.
5 calls to drupal_access_denied()
- file_download in includes/
file.inc - Call modules that implement hook_file_download() to find out if a file is accessible and what headers it should be transferred with. If a module returns -1 drupal_access_denied() will be returned. If one or more modules returned headers the download…
- node_revision_delete in modules/
node/ node.module - Delete the revision with specified revision number. A "delete revision" nodeapi event is invoked when a revision is deleted.
- node_revision_revert in modules/
node/ node.module - Revert to the revision with the specified revision number. A node and nodeapi "update" event is triggered (via the node_save() call) when a revision is reverted.
- page_example_baz in developer/
examples/ page_example.module - A more complex page callback that takes arguments.
- profile_browse in modules/
profile/ profile.module - Menu callback; display a list of user information.
File
- includes/
common.inc, line 386 - Common functions that many Drupal modules will need to reference.
Code
function drupal_access_denied() {
drupal_set_header('HTTP/1.1 403 Forbidden');
watchdog('access denied', check_plain($_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_403', ''));
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) || $return == MENU_NOT_FOUND || $return == MENU_ACCESS_DENIED) {
drupal_set_title(t('Access denied'));
menu_set_active_item('');
$return = t('You are not authorized to access this page.');
}
print theme('page', $return);
}