Index: includes/common.inc =================================================================== RCS file: /cvs/drupal/drupal/includes/common.inc,v retrieving revision 1.788 diff -u -p -r1.788 common.inc --- includes/common.inc 21 Aug 2008 19:36:36 -0000 1.788 +++ includes/common.inc 1 Sep 2008 00:20:03 -0000 @@ -336,16 +336,27 @@ function drupal_site_offline() { */ function drupal_not_found() { drupal_set_header('HTTP/1.1 404 Not Found'); - watchdog('page not found', check_plain($_GET['q']), NULL, WATCHDOG_WARNING); + $return = ''; + + if (variable_get('site_404_message_display', TRUE)) { + $message = variable_get('site_404_message', t('

The requested content was not found on this site. The content might have been removed or had its location changed.

+')); + drupal_set_message(filter_xss_admin($message)); + } + // 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']) { + if (!empty($path) && $path != $_GET['q']) { // Set the active item in case there are tabs to display, or other // dependencies on the path. menu_set_active_item($path); @@ -368,13 +379,25 @@ 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. + $return = ''; + + if (variable_get('site_403_message_display', TRUE)) { + $message = variable_get('site_403_message', t('

You do not have permission to view this content.

+')); + drupal_set_message(filter_xss_admin($message)); + } + + // 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']) { + if (!empty($path) && $path != $_GET['q']) { // Set the active item in case there are tabs to display or other // dependencies on the path. menu_set_active_item($path); Index: modules/system/system.admin.inc =================================================================== RCS file: /cvs/drupal/drupal/modules/system/system.admin.inc,v retrieving revision 1.86 diff -u -p -r1.86 system.admin.inc --- modules/system/system.admin.inc 30 Aug 2008 09:49:43 -0000 1.86 +++ modules/system/system.admin.inc 1 Sep 2008 00:20:04 -0000 @@ -1284,23 +1284,66 @@ function system_site_information_setting */ function system_error_reporting_settings() { - $form['site_403'] = array( + $form['403'] = array( + '#type' => 'fieldset', + '#title' => t('Access denied page'), + '#description' => t('These settings apply when the requested document is denied to the current user, i.e. a 403 error.'), + ); + $form['403']['site_403'] = array( '#type' => 'textfield', - '#title' => t('Default 403 (access denied) page'), + '#title' => t('Page to display'), '#default_value' => variable_get('site_403', ''), '#size' => 40, '#description' => t('This page is displayed when the requested document is denied to the current user. If unsure, specify nothing.'), '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=') ); + $form['403']['site_403_message_display'] = array( + '#type' => 'checkbox', + '#title' => t('Display error message'), + '#description' => t('Enabling this feature will display the message below when the requested document is denied to the current user, even if "Page to display" is set.'), + '#default_value' => variable_get('site_403_message_display', TRUE), + ); + $form['403']['site_403_message'] = array( + '#type' => 'textarea', + '#title' => t('Message'), + '#default_value' => variable_get('site_403_message', t('

You do not have permission to view this content.

+')), + ); - $form['site_404'] = array( + $form['404'] = array( + '#type' => 'fieldset', + '#title' => t('File not found page'), + '#description' => t('These settings apply when the requested document could not be found, i.e. a 404 error.'), + ); + $form['404']['site_404'] = array( '#type' => 'textfield', - '#title' => t('Default 404 (not found) page'), + '#title' => t('Ppage to display'), '#default_value' => variable_get('site_404', ''), '#size' => 40, '#description' => t('This page is displayed when no other content matches the requested document. If unsure, specify nothing.'), '#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q=') ); + $form['404']['site_404_message_display'] = array( + '#type' => 'checkbox', + '#title' => t('Display error message'), + '#description' => t('Enabling this feature will display the message below when the requested document could not be found, even if "Page to display" is set.'), + '#default_value' => variable_get('site_404_message_display', TRUE), + ); + $form['404']['site_404_message'] = array( + '#type' => 'textarea', + '#title' => t('Message'), + '#default_value' => variable_get('site_404_message', t('

The requested content was not found on this site. The content might have been removed or had its location changed.

+')), + ); $form['error_level'] = array( '#type' => 'select', '#title' => t('Error reporting'), '#default_value' => variable_get('error_level', 1),