diff --git a/www-ssl/inc/error_handler.php b/www-ssl/inc/error_handler.php new file mode 100755 index 00000000..95a2ea84 --- /dev/null +++ b/www-ssl/inc/error_handler.php @@ -0,0 +1,86 @@ + $v ) + $message .= "_SERVER: $k = $v\n"; + if( isset( $_POST)) + foreach ($_POST as $k => $v ) + $message .= "_POST: $k = $v\n"; + if( isset( $_GET)) + foreach ($_GET as $k => $v ) + $message .= "_GET: $k = $v\n"; + + send_message($message); + + // display error messages on screen too for developers + if ($_SESSION['CVS']['admin/debug.php']=='Y') + { + echo "
\n".$message.""; + } + +} + + register_shutdown_function("send_errors"); + + // send jabber message and email + function send_message(&$message) + { + chdir(dirname(__FILE__)); + require_once('../inc/jabber.php'); + + if (isset($jabber_recipient) && count($jabber_recipient)) { + $jabber = new Jabber($server, $port, $username, $password, $resource); + if ($jabber->Connect() && $jabber->SendAuth()) { + foreach($jabber_recipient as $value) + { + $jabber->SendMessage($value, "normal", NULL, array("body" => $message, "subject" => "Error in Pentabarf"), NULL); + } + $jabber->Disconnect(); + } else { + array_push($message, "Couldn't connect to Jabber Server."); + } + } + + if (isset($mail_recipient) && count($mail_recipient)) { + foreach($mail_recipient as $to) { + mail($to, isset($mail_subject) ? $mail_subject : "Pentabarf Error", $message); + } + } + } + +?>