2015-07-27 20:14:18 +00:00
|
|
|
<?php
|
2017-09-18 19:19:49 +00:00
|
|
|
function sendMail() {
|
|
|
|
$to = 'dk@doktorkraus.de';
|
|
|
|
$headers = "From: \"zaaReloaded\" <dk@doktorkraus.de>";
|
|
|
|
$reportId = $_POST['report_id'];
|
|
|
|
$info = print_r( $_POST, true ); // this will be a string, not an array!
|
|
|
|
$body = <<<EOF
|
|
|
|
zaaReloaded hat einen Fehler ausgelöst.
|
|
|
|
|
|
|
|
-----
|
|
|
|
|
|
|
|
Benutzerkommentar:
|
|
|
|
|
2015-07-27 20:14:18 +00:00
|
|
|
{$_POST['comment']}
|
|
|
|
|
2017-09-18 19:19:49 +00:00
|
|
|
-----
|
2015-07-27 20:14:18 +00:00
|
|
|
|
2017-09-18 19:19:49 +00:00
|
|
|
Technische Info: $info
|
2015-07-27 20:14:18 +00:00
|
|
|
|
2017-09-18 19:19:49 +00:00
|
|
|
--
|
|
|
|
www.doktorkraus.de/zaareloaded
|
2015-07-27 20:14:18 +00:00
|
|
|
EOF;
|
|
|
|
|
2017-09-18 19:19:49 +00:00
|
|
|
if ( $_POST['ccUser'] ) {
|
|
|
|
$validMail = filter_var( $_POST['usersMail'], FILTER_VALIDATE_EMAIL );
|
|
|
|
$validUser = filter_var( $_POST['usersName'], FILTER_SANITIZE_STRING );
|
|
|
|
if ( $validUser ) {
|
|
|
|
$validUser = "\"$validUser\" "; // space character deliberately placed
|
|
|
|
};
|
|
|
|
if ( $validMail ) {
|
|
|
|
$headers .= "\r\nCc: $validUser<$validMail>";
|
|
|
|
};
|
|
|
|
};
|
|
|
|
mail($to, "Exception report [$reportId]", $body, $headers);
|
2015-07-27 20:14:18 +00:00
|
|
|
}
|
2017-09-18 19:19:49 +00:00
|
|
|
|
|
|
|
// =============================================================
|
|
|
|
// Begin main script
|
|
|
|
// =============================================================
|
|
|
|
|
|
|
|
if (!isset($_POST['report_id'])) {
|
|
|
|
http_response_code(400);
|
|
|
|
exit;
|
2015-07-27 20:14:18 +00:00
|
|
|
}
|
2017-09-18 19:19:49 +00:00
|
|
|
|
|
|
|
sendMail();
|
|
|
|
// Return the report ID and the issue URL to signal all is well.
|
|
|
|
$reportId = $_POST['report_id'];
|
|
|
|
$load = "{\"ReportId\": \"$reportId\", \"IssueUrl\": \"https://www.doktorkraus.de/zaareloaded\"}";
|
|
|
|
error_log( __FILE__ . ": Load = $load" );
|
|
|
|
header('Content-Type: application/json');
|
|
|
|
echo $load;
|