diff --git a/api/v1/validate_api_key.php b/api/v1/validate_api_key.php index f553588d..010bab0a 100644 --- a/api/v1/validate_api_key.php +++ b/api/v1/validate_api_key.php @@ -17,8 +17,8 @@ header('Content-Type: application/json'); $_POST = json_decode(file_get_contents('php://input'), true); // Get IP & UA -$ip = santizeInput(getIP()); -$user_agent = santizeInput($_SERVER['HTTP_USER_AGENT']); +$ip = sanitizeInput(getIP()); +$user_agent = sanitizeInput($_SERVER['HTTP_USER_AGENT']); // Setup return array $return_arr = array(); @@ -56,15 +56,15 @@ if (!isset($_GET['api_key']) && !isset($_POST['api_key'])) { // Set API key variable if (isset($_GET['api_key'])) { - $api_key = santizeInput($_GET['api_key']); + $api_key = sanitizeInput($_GET['api_key']); } if (isset($_POST['api_key'])) { - $api_key = santizeInput($_POST['api_key']); + $api_key = sanitizeInput($_POST['api_key']); } // Validate API key if (isset($api_key)) { - $api_key = santizeInput($api_key); + $api_key = sanitizeInput($api_key); $sql = mysqli_query($mysqli, "SELECT * FROM api_keys WHERE api_key_secret = '$api_key' AND api_key_expire > NOW() LIMIT 1"); diff --git a/cron_ticket_email_parser.php b/cron_ticket_email_parser.php index 02937d76..5b1c3c8b 100644 --- a/cron_ticket_email_parser.php +++ b/cron_ticket_email_parser.php @@ -61,10 +61,11 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date mysqli_query($mysqli, "UPDATE settings SET config_ticket_next_number = $new_config_ticket_next_number WHERE company_id = 1"); // Prep ticket details - $message = nl2br(htmlentities(strip_tags($message))); - $message = trim(mysqli_real_escape_string($mysqli, "Email from: $contact_email at $date:-

$message")); - - mysqli_query($mysqli, "INSERT INTO tickets SET ticket_prefix = '$config_ticket_prefix', ticket_number = $ticket_number, ticket_subject = '$subject', ticket_details = '$message', ticket_priority = 'Low', ticket_status = 'Open', ticket_created_by = '0', ticket_contact_id = $contact_id, ticket_client_id = $client_id"); + //$message = nl2br(htmlentities(strip_tags($message))); + $message = mysqli_real_escape_string($mysqli, nl2br($message)); + $message = mysqli_real_escape_string($mysqli, "Email from: $contact_email at $date:-

$message"); + + mysqli_query($mysqli, "INSERT INTO tickets SET ticket_prefix = '$config_ticket_prefix', ticket_number = $ticket_number, ticket_subject = '$subject', ticket_details = '$message', ticket_priority = 'Low', ticket_status = 'Open', ticket_created_by = 0, ticket_contact_id = $contact_id, ticket_client_id = $client_id"); $id = mysqli_insert_id($mysqli); // Logging @@ -234,8 +235,14 @@ if ($emails) { $subject = sanitizeInput($parser->getHeader('subject')); $date = trim(mysqli_real_escape_string($mysqli, htmlentities(strip_tags($parser->getHeader('date'))))); - + + $message = $parser->getMessageBody('text'); + //$message .= $parser->getMessageBody('htmlEmbedded'); + + //$text = "Some Text"; + //$message = str_replace("", "

{$text}

", $message); + // Check if we can identify a ticket number (in square brackets) diff --git a/portal/tickets.php b/portal/tickets.php index b9e85c1f..4aeb34b3 100644 --- a/portal/tickets.php +++ b/portal/tickets.php @@ -45,7 +45,7 @@ $total_tickets = intval($row['total_tickets']);
- " alt="..." height="50" width="50" class="img-circle img-responsive"> + " alt="..." height="50" width="50" class="img-circle img-responsive">