Removed WebKlex PHP-IMAP Dependency in post as it was spewing errors for people running older version of php below 8.2 - note this is still required for Mail Parser to work

This commit is contained in:
johnnyq 2024-06-27 01:10:00 -04:00
parent 5b3c6f4272
commit 1c618892cc
2 changed files with 11 additions and 21 deletions

View File

@ -80,13 +80,7 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date
$new_config_ticket_next_number = $ticket_number + 1;
mysqli_query($mysqli, "UPDATE settings SET config_ticket_next_number = $new_config_ticket_next_number WHERE company_id = 1");
// Clean up the message
$message = trim($message); // Remove leading/trailing whitespace
$message = preg_replace('/\s+/', ' ', $message); // Replace multiple spaces with a single space
$message = nl2br($message); // Convert newlines to <br>
// Wrap the message in a div with controlled line height
$message = "<i>Email from: $contact_email at $date:-</i> <br><br><div style='line-height:1.5;'>$message</div>";
$message = "<i>Email from: $contact_email at $date:-</i> <br><br>$message";
$ticket_prefix_esc = mysqli_real_escape_string($mysqli, $config_ticket_prefix);
$subject_esc = mysqli_real_escape_string($mysqli, $subject);
@ -152,7 +146,7 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date
$client_name = sanitizeInput($client_row['client_name']);
$email_subject = "$config_app_name - New Ticket - $client_name: $subject";
$email_body = "Hello, <br><br>This is a notification that a new ticket has been raised in ITFlow. <br>Client: $client_name<br>Priority: Low (email parsed)<br>Link: https://$config_base_url/ticket.php?ticket_id=$id <br><br>--------------------------------<br><br><b>$subject</b><br>$message";
$email_body = "Hello, <br><br>This is a notification that a new ticket has been raised in ITFlow. <br>Client: $client_name<br>Priority: Low (email parsed)<br>Link: https://$config_base_url/ticket.php?ticket_id=$id <br><br>--------------------------------<br><br><b>$subject</b><br>$details";
$data[] = [
'from' => $config_ticket_from_email,
@ -174,16 +168,9 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac
global $mysqli, $config_app_name, $company_name, $company_phone, $config_ticket_prefix, $config_base_url, $config_ticket_from_name, $config_ticket_from_email, $config_smtp_host, $config_smtp_port, $config_smtp_encryption, $config_smtp_username, $config_smtp_password, $allowed_extensions;
$ticket_reply_type = 'Client';
// Clean up the message
$message_parts = explode("##- Please type your reply above this line -##", $message);
$message_body = $message_parts[0];
$message_body = trim($message_body); // Remove leading/trailing whitespace
$message_body = preg_replace('/\s+/', ' ', $message_body); // Replace multiple spaces with a single space
$message_body = nl2br($message_body); // Convert newlines to <br>
// Wrap the message in a div with controlled line height
$message = "<i>Email from: $from_email at $date:-</i> <br><br><div style='line-height:1.5;'>$message_body</div>";
$message = explode("##- Please type your reply above this line -##", $message);
//$message = nl2br($message[0]);
$message = "<i>Email from: $from_email at $date:-</i> <br>$message";
$ticket_number_esc = intval($ticket_number);
$message_esc = mysqli_real_escape_string($mysqli, $message);

View File

@ -196,13 +196,13 @@ if (isset($_POST['test_email_smtp'])) {
// Test IMAP
// Autoload Composer dependencies
require_once __DIR__ . '/../plugins/php-imap/vendor/autoload.php';
// require_once __DIR__ . '/../plugins/php-imap/vendor/autoload.php';
// Webklex PHP-IMAP
use Webklex\PHPIMAP\ClientManager;
//use Webklex\PHPIMAP\ClientManager;
if (isset($_POST['test_email_imap'])) {
/*
validateCSRFToken($_POST['csrf_token']);
validateAdminRole();
@ -227,11 +227,14 @@ if (isset($_POST['test_email_imap'])) {
$_SESSION['alert_type'] = "error";
$_SESSION['alert_message'] = "Test IMAP connection failed: " . $e->getMessage();
}
*/
$_SESSION['alert_message'] = "Test is Work In Progress";
header("Location: " . $_SERVER["HTTP_REFERER"]);
}
if (isset($_POST['edit_invoice_settings'])) {
validateCSRFToken($_POST['csrf_token']);