| 1 |
<?php |
<?php |
| 2 |
|
|
| 3 |
// $Id$ |
// $Id: civicrm_error.module,v 1.1 2007/07/20 15:44:34 dalin Exp $ |
| 4 |
|
|
| 5 |
/** |
/** |
| 6 |
* Custom error function |
* Custom error function |
| 17 |
// error details |
// error details |
| 18 |
if (function_exists('error_get_last')) { |
if (function_exists('error_get_last')) { |
| 19 |
$output .= "\n\n***ERROR***\n"; |
$output .= "\n\n***ERROR***\n"; |
| 20 |
$output .= print_r(error_get_last(), true); |
$output .= _civicrm_error_parse_array(error_get_last()); |
| 21 |
|
} |
| 22 |
|
elseif ($php_errormsg) { |
| 23 |
|
$output .= "\n\n***ERROR***\n"; |
| 24 |
|
$output .= _civicrm_error_parse_array($php_errormsg); |
| 25 |
} |
} |
| 26 |
|
|
| 27 |
// user info |
// user info |
| 30 |
$output .= _civicrm_error_parse_array($user); |
$output .= _civicrm_error_parse_array($user); |
| 31 |
|
|
| 32 |
// $_SERVER |
// $_SERVER |
|
global $_SERVER; |
|
| 33 |
$output .= "\n\n***SERVER***\n"; |
$output .= "\n\n***SERVER***\n"; |
| 34 |
$output .= _civicrm_error_parse_array($_SERVER); |
$output .= _civicrm_error_parse_array($_SERVER); |
| 35 |
|
|
| 36 |
|
// $_REQUEST |
| 37 |
|
$output .= "\n\n***REQUEST***\n"; |
| 38 |
|
$output .= _civicrm_error_parse_array($_REQUEST); |
| 39 |
|
|
| 40 |
// backtrace |
// backtrace |
| 41 |
$backtrace = debug_backtrace(); |
$backtrace = debug_backtrace(); |
| 42 |
$output .= "\n\n***BACKTRACE***\n"; |
$output .= "\n\n***BACKTRACE***\n"; |
| 48 |
// send email |
// send email |
| 49 |
$subject = 'CiviCRM error at '. $site; |
$subject = 'CiviCRM error at '. $site; |
| 50 |
$to = variable_get('civicrm_error_to', variable_get("site_mail", ini_get("sendmail_from"))); |
$to = variable_get('civicrm_error_to', variable_get("site_mail", ini_get("sendmail_from"))); |
| 51 |
|
print_r($output); |
| 52 |
|
die; |
| 53 |
drupal_mail('civicrm_error', $to, $subject, $output); |
drupal_mail('civicrm_error', $to, $subject, $output); |
| 54 |
|
|
| 55 |
} |
} |