if ((isset($GLOBALS['ctracker_last_insert_id'])) && ($GLOBALS['ctracker_last_insert_id'] > 0)) {
// All fine, so prepare the link between ticket<->data
$data = array(
- 'ctracker_ticket' => $GLOBALS['ctracker_last_insert_id'],
- 'ctracker_data_id' => $GLOBALS['ctracker_last_suspicious_entry']['id']
+ 'ctracker_ticket_id' => $GLOBALS['ctracker_last_insert_id'],
+ 'ctracker_data_id' => $GLOBALS['ctracker_last_suspicious_entry']['id']
);
// And insert it as well
crackerTrackerInsertArray('ctracker_ticket_data', $data);
+ // Add ticket id again
+ $GLOBALS['ctracker_ticket'] = $data['ctracker_ticket_id'];
+
// Merge all data for emails
$GLOBALS['ctracker_last_ticket'] = array_merge($GLOBALS['ctracker_last_ticket'], $data);
);
// Load email header
- $GLOBALS['ctracker_header'] = crackerTrackerLoadEmaiLTemplate('header');
+ $GLOBALS['ctracker_header'] = crackerTrackerLoadEmailTemplate('header');
}
// Checks for worms
crackerTrackerDie();
}
+// Sends the ticket emails out
+function sendCrackerTrackerTicketMails () {
+ // Load user template
+ $mail = crackerTrackerLoadEmailTemplate('user_add_ticket', $GLOBALS['ctracker_last_ticket']);
+
+ // Send email to the user
+ crackerTrackerSendMail($mail, $GLOBALS['ctracker_last_ticket']['ctracker_ticket_email'], getCrackerTrackerLocalized('user_add_ticket_subject'));
+
+ // Load webmaster template
+ $mail = crackerTrackerLoadEmailTemplate('webmaster_add_ticket', $GLOBALS['ctracker_last_ticket'], getCrackerTrackerConfig('ctracker_language'));
+
+ // Send email to the user
+ crackerTrackerSendMail($mail, null, getCrackerTrackerLocalized('webmaster_add_ticket_subject'));
+}
+
// Sends a mail out
function crackerTrackerSendMail ($mail, $recipient = null, $subject = null) {
// Construct dummy array
if (!isCrackerTrackerDebug()) sleep(mt_rand(10,30));
// Bye, bye...
- print '<pre>';
- debug_print_backtrace();
- die('</pre>');
- die();
+ if (isCrackerTrackerDebug()) {
+ // With debug backtrace
+ print '<pre>';
+ debug_print_backtrace();
+ die('</pre>');
+ } else {
+ // Simple die()
+ die();
+ }
}
// Logs the attack attempt
} elseif (isset($_POST['ctracker_add_ticket'])) {
// Add the ticket
addCrackerTrackerTicket($_POST);
+
+ // Send the email out
+ sendCrackerTrackerTicketMails();
} else {
// Display the form for new ticket
crackerTrackerLoadTemplate('add_ticket');