--- includes/common.inc +++ includes/common.inc @@ -386,10 +386,9 @@ function drupal_not_found() { */ function drupal_access_denied() { drupal_set_header('HTTP/1.1 403 Forbidden'); - watchdog('access denied', check_plain($_GET['q']), NULL, WATCHDOG_WARNING); - // Keep old path for reference, and to allow forms to redirect to it. + // Keep old path for reference. if (!isset($_REQUEST['destination'])) { $_REQUEST['destination'] = $_GET['q']; } @@ -403,9 +402,17 @@ function drupal_access_denied() { } if (empty($return) || $return == MENU_NOT_FOUND || $return == MENU_ACCESS_DENIED) { - drupal_set_title(t('Access denied')); - $return = t('You are not authorized to access this page.'); + if ($path && preg_match('/^node\/\d+$/', $path)) { + $nid = preg_replace('/^node\/(\d+)$/', '$1', $path); + $r = db_fetch_object(db_query("SELECT title, body FROM {node_revisions} WHERE nid = %d LIMIT 1;", $nid)); + drupal_set_title(t($r->title)); + $return = t($r->body); + } else { + drupal_set_title(t('Access denied')); + $return = t('You are not authorized to access this page.'); + } } + print theme('page', $return); }