/[drupal]/contributions/modules/customerror/customerror.module
ViewVC logotype

Diff of /contributions/modules/customerror/customerror.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.17.2.5, Mon Mar 16 18:39:05 2009 UTC revision 1.17.2.6, Thu Mar 19 16:07:59 2009 UTC
# Line 1  Line 1 
1  <?php  <?php
2    
3  //$Id: customerror.module,v 1.17.2.4 2008/10/06 01:03:09 kbahey Exp $  //$Id: customerror.module,v 1.17.2.5 2009/03/16 18:39:05 kbahey Exp $
4    
5  // Copyright 2005 Khalid Baheyeldin http://2bits.com  // Copyright 2005 Khalid Baheyeldin http://2bits.com
6    
# Line 147  function customerror_simpletest() { Line 147  function customerror_simpletest() {
147      drupal_get_path('module', 'customerror') . '/tests', '\.test$'));      drupal_get_path('module', 'customerror') . '/tests', '\.test$'));
148  }  }
149    
 /**  
  * Implementation of hook_page().  
  */  
150  function customerror_page() {  function customerror_page() {
151    $code = arg(1);    $code = arg(1);
152    $_SESSION['destination'] = $_REQUEST['destination'];    $_SESSION['destination'] = $_REQUEST['destination'];
# Line 157  function customerror_page() { Line 154  function customerror_page() {
154    switch($code) {    switch($code) {
155      case 403:      case 403:
156      case 404:      case 404:
157          // Check if we should redirect
158        customerror_check_redirect();        customerror_check_redirect();
159    
160          // Make sure that we sent an appropriate header
161          customerror_header($code);
162    
163        drupal_set_title(variable_get('customerror_'. $code .'_title', _customerror_fetch_error($code)));        drupal_set_title(variable_get('customerror_'. $code .'_title', _customerror_fetch_error($code)));
164        $output = theme('customerror', $code, variable_get('customerror_' . $code, _customerror_fetch_error($code)));        $output = theme('customerror', $code, variable_get('customerror_' . $code, _customerror_fetch_error($code)));
165        $output = (variable_get('customerror_' . $code . '_php', FALSE)) ? drupal_eval($output) : $output;        $output = (variable_get('customerror_' . $code . '_php', FALSE)) ? drupal_eval($output) : $output;
# Line 170  function customerror_page() { Line 172  function customerror_page() {
172    return $output;    return $output;
173  }  }
174    
175    function customerror_header($code) {
176      switch($code) {
177        case 403:
178          drupal_set_header('HTTP/1.1 403 Forbidden');
179          break;
180        case 404:
181          drupal_set_header('HTTP/1.1 404 Not Found');
182          break;
183      }
184    }
185    
186  /**  /**
187   * Implementation of hook_theme().   * Implementation of hook_theme().
188   */   */

Legend:
Removed from v.1.17.2.5  
changed lines
  Added in v.1.17.2.6

  ViewVC Help
Powered by ViewVC 1.1.2