drupal_access_denied

Versions
4.6 – 7
drupal_access_denied()

Generates a 403 error if the request is not allowed.

▾ 12 functions call drupal_access_denied()

book_export_html in modules/book.module
This function is called by book_export() to generate HTML for export.
comment_edit in modules/comment.module
contact_mail_user in modules/contact.module
Personal contact page.
file_download in includes/file.inc
node_page in modules/node.module
Menu callback; dispatches control to the appropriate operation handler.
node_revisions in modules/node.module
Menu callback for revisions related activities.
node_revision_delete in modules/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.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.module
Menu callback; display a list of user information.
tracker_track_user in modules/tracker.module
Menu callback. Prints a listing of active nodes on the site.
user_pass_reset in modules/user.module
Menu callback; process one time login link and redirects to the user page on success.

Code

includes/common.inc, line 313

<?php
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']));

  // 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)) {
    drupal_set_title(t('Access denied'));
    $return = t('You are not authorized to access this page.');
  }
  print theme('page', $return);
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.