From 0a32415b38b325079ed0cfcbd33ab8c6c74865ba Mon Sep 17 00:00:00 2001 From: johnnyq Date: Sat, 20 Jan 2024 15:11:07 -0500 Subject: [PATCH] Updated ticket mail parser to not escape the entire subject and body of sending emails as this is all done by vars instead --- cron_ticket_email_parser.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/cron_ticket_email_parser.php b/cron_ticket_email_parser.php index 336ef697..29b2a0a5 100644 --- a/cron_ticket_email_parser.php +++ b/cron_ticket_email_parser.php @@ -30,7 +30,7 @@ $config_ticket_from_name = sanitizeInput($config_ticket_from_name); $sql = mysqli_query($mysqli, "SELECT company_name, company_phone FROM companies WHERE company_id = 1"); $row = mysqli_fetch_array($sql); $company_name = sanitizeInput($row['company_name']); -$company_phone = formatPhoneNumber($row['company_phone']); +$company_phone = sanitizeInput(formatPhoneNumber($row['company_phone'])); // Check setting enabled if ($config_ticket_email_parse == 0) { @@ -163,8 +163,8 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date // E-mail client notification that ticket has been created if ($config_ticket_client_general_notifications == 1) { - $subject_email = mysqli_escape_string($mysqli, "Ticket created - [$config_ticket_prefix$ticket_number] - $subject"); - $body = mysqli_escape_string($mysqli, "##- Please type your reply above this line -##

Hello, $contact_name

Thank you for your email. A ticket regarding \"$subject\" has been automatically created for you.

Ticket: $config_ticket_prefix$ticket_number
Subject: $subject
Status: Open
https://$config_base_url/portal/ticket.php?id=$id

~
$company_name
Support Department
$config_ticket_from_email
$company_phone"); + $subject_email = "Ticket created - [$config_ticket_prefix$ticket_number] - $subject"; + $body = "##- Please type your reply above this line -##

Hello $contact_name\,

Thank you for your email. A ticket regarding \"$subject\" has been automatically created for you.

Ticket: $config_ticket_prefix$ticket_number
Subject: $subject
Status: Open
https://$config_base_url/portal/ticket.php?id=$id

--
$company_name - Support
$config_ticket_from_email
$company_phone"; $data[] = [ 'from' => $config_ticket_from_email, @@ -184,8 +184,8 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date $client_row = mysqli_fetch_array($client_sql); $client_name = sanitizeInput($client_row['client_name']); - $email_subject = mysqli_escape_string($mysqli, "ITFlow - New Ticket - $client_name: $subject"); - $email_body = "Hello,

This is a notification that a new ticket has been raised in ITFlow.
Client: $client_name
Priority: Low (email parsed)
Link: https://$config_base_url/ticket.php?ticket_id=$id

--------------------------------

$subject
$details"; + $email_subject = "ITFlow - New Ticket - $client_name: $subject"; + $email_body = "Hello\,

This is a notification that a new ticket has been raised in ITFlow.
Client: $client_name
Priority: Low (email parsed)
Link: https://$config_base_url/ticket.php?ticket_id=$id

--------------------------------

$subject
$details"; $data[] = [ 'from' => $config_ticket_from_email, @@ -240,7 +240,7 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac mysqli_query($mysqli, "INSERT INTO notifications SET notification_type = 'Ticket', notification = 'Email parser: $from_email attempted to re-open ticket $config_ticket_prefix$ticket_number (ID $ticket_id) - check inbox manually to see email', notification_action = 'ticket.php?ticket_id=$ticket_id', notification_client_id = $client_id"); $email_subject = "Action required: This ticket is already closed"; - $email_body = "Hi there,

You've tried to reply to a ticket that is closed - we won't see your response.

Please raise a new ticket by sending a fresh e-mail to our support address.

~
$company_name
Support Department
$config_ticket_from_email
$company_phone"; + $email_body = "Hi there,

You've tried to reply to a ticket that is closed - we won't see your response.

Please raise a new ticket by sending a fresh e-mail to our support address.

--
$company_name
Support Department
$config_ticket_from_email
$company_phone"; $data = [ [ @@ -332,8 +332,8 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac $tech_email = sanitizeInput($tech_row['user_email']); $tech_name = sanitizeInput($tech_row['user_name']); - $subject = mysqli_escape_string($mysqli, "Ticket updated - [$config_ticket_prefix$ticket_number] - $subject"); - $body = mysqli_escape_string($mysqli, "##- Please type your reply above this line -##

Hello, $tech_name

A new reply has been added to the ticket \"$subject\".

Ticket: $config_ticket_prefix$ticket_number
Subject: $subject
Status: Open
https://$config_base_url/portal/ticket.php?id=$ticket_id

~
$company_name
Support Department
$config_ticket_from_email
$company_phone"); + $subject = "Ticket updated - [$config_ticket_prefix$ticket_number] - $subject"; + $body = "##- Please type your reply above this line -##

Hello $tech_name\,

A new reply has been added to the ticket \"$subject\".

Ticket: $config_ticket_prefix$ticket_number
Subject: $subject
Status: Open
https://$config_base_url/portal/ticket.php?id=$ticket_id

--
$company_name - Support Department
$config_ticket_from_email
$company_phone"; $data = [ [ @@ -365,7 +365,7 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac return false; } } -// End Add Reply Function +// END ADD REPLY FUNCTION ------------------------------------------------- // Prepare connection string with encryption (TLS/SSL/) $imap_mailbox = "$config_imap_host:$config_imap_port/imap/$config_imap_encryption";