2006-08-20 01:05:11 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("./inc/funktion_jabber.php");
|
|
|
|
|
|
|
|
// global array for collected error_messages
|
|
|
|
$error_messages = array();
|
|
|
|
|
|
|
|
// general error handler collecting all messages in an array
|
|
|
|
function Error_Handler($error_number, $error_string, $error_file, $error_line, $error_context)
|
|
|
|
{
|
|
|
|
global $error_messages;
|
|
|
|
array_push($error_messages, "Error Number: ".$error_number."\nError String: ".$error_string."\nError File: ".$error_file."\nError Line: ".$error_line."\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
// register error handler
|
|
|
|
set_error_handler("Error_Handler");
|
2006-11-27 20:37:16 +01:00
|
|
|
|
2006-11-27 20:27:28 +01:00
|
|
|
ini_set( "error_reporting", E_ALL);
|
2006-11-27 20:37:16 +01:00
|
|
|
ini_set( "display_errors", "On");
|
|
|
|
ini_set( "display_startup_errors", "On");
|
|
|
|
ini_set( "html_errors", "On");
|
2006-11-27 20:27:28 +01:00
|
|
|
|
2006-08-20 01:05:11 +02:00
|
|
|
// send errors
|
|
|
|
function send_errors()
|
|
|
|
{
|
|
|
|
global $error_messages;
|
|
|
|
|
|
|
|
if (!$error_messages) return;
|
|
|
|
|
|
|
|
$url = $_SERVER['PHP_SELF'];
|
|
|
|
|
|
|
|
$message = "";
|
|
|
|
foreach($error_messages as $value)
|
|
|
|
$message .= $value."\n";
|
2006-08-29 14:42:35 +02:00
|
|
|
$message .= "\n\n\n\n\n";
|
|
|
|
|
|
|
|
if( isset( $_SESSION))
|
|
|
|
foreach ($_SESSION as $k => $v )
|
|
|
|
$message .= "_SESSION: $k = $v\n";
|
|
|
|
if( isset( $_SESSION['CVS']))
|
|
|
|
foreach ($_SESSION['CVS'] as $k => $v )
|
|
|
|
if( strlen($k)>3 )
|
|
|
|
$message .= "_SESSION['CVS']: $k = $v\n";
|
2006-08-20 01:05:11 +02:00
|
|
|
foreach ($_SERVER as $k => $v )
|
|
|
|
$message .= "_SERVER: $k = $v\n";
|
|
|
|
if( isset( $_POST))
|
|
|
|
foreach ($_POST as $k => $v )
|
2006-08-29 15:46:38 +02:00
|
|
|
$message .= "_POST: $k = ". ( $k!="password"? $v : "???..."). "\n";
|
2006-08-20 01:05:11 +02:00
|
|
|
if( isset( $_GET))
|
|
|
|
foreach ($_GET as $k => $v )
|
2006-08-29 14:42:35 +02:00
|
|
|
$message .= "_GET: $k = $v\n";
|
2006-08-20 01:05:11 +02:00
|
|
|
|
|
|
|
send_message($message);
|
|
|
|
|
|
|
|
// display error messages on screen too for developers
|
|
|
|
if ($_SESSION['CVS']['admin/debug.php']=='Y')
|
|
|
|
{
|
|
|
|
echo "<pre id='error'>\n".$message."</pre>";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
register_shutdown_function("send_errors");
|
|
|
|
|
|
|
|
// send jabber message and email
|
|
|
|
function send_message(&$message)
|
|
|
|
{
|
|
|
|
chdir(dirname(__FILE__));
|
2006-11-23 18:39:05 +01:00
|
|
|
require_once('../inc/config_jabber.php');
|
2006-08-20 01:05:11 +02:00
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|