You are here

function customerror_page in Customerror 5

Same name and namespace in other branches
  1. 6 customerror.module \customerror_page()
  2. 7 customerror.module \customerror_page()
1 string reference to 'customerror_page'
customerror_menu in ./customerror.module

File

./customerror.module, line 149
Enables custom 404 (not found) and 403 (access denied) pages in Drupal with no need for creating real nodes under taxonomies

Code

function customerror_page() {
  $code = arg(1);
  $_SESSION['destination'] = $_REQUEST['destination'];
  switch ($code) {
    case 403:
    case 404:

      // Check if we should redirect
      customerror_check_redirect();

      // Make sure that we sent an appropriate header
      customerror_header($code);
      drupal_set_title(variable_get('customerror_' . $code . '_title', _customerror_fetch_error($code)));
      $output = theme('customerror', $code, variable_get('customerror_' . $code, _customerror_fetch_error($code)));
      $output = variable_get('customerror_' . $code . '_php', FALSE) ? drupal_eval($output) : $output;
      break;
    default:
      drupal_set_title(t('undefined error: ') . $code);
      $output = _customerror_fetch_error($code);
      break;
  }
  return $output;
}