diff --git a/agent/ticket.php b/agent/ticket.php index 82572cfd..5837454e 100644 --- a/agent/ticket.php +++ b/agent/ticket.php @@ -561,9 +561,10 @@ if (isset($_GET['ticket_id'])) { $name [View][Download]"; + + echo "
$name [View][Download]"; } ?> @@ -784,8 +785,9 @@ if (isset($_GET['ticket_id'])) { $name | Download | View"; + $ticket_attachment_id = intval($ticket_attachment['ticket_attachment_id']); + + echo "
$name | Download | View"; } ?> diff --git a/agent/ticket_attachment.php b/agent/ticket_attachment.php new file mode 100644 index 00000000..9ece8050 --- /dev/null +++ b/agent/ticket_attachment.php @@ -0,0 +1,126 @@ += $file_mtime) +) { + http_response_code(304); + exit; +} + +// Audit log - skip thumbnail loads +if (!$thumb) { + logAudit("Ticket", "Download", "$session_name viewed ticket attachment $attachment_name_escaped", $client_id); +} + +// Send the file +header("Content-Type: $attachment_mime_type"); +header("Content-Disposition: $disposition; filename=\"$safe_attachment_name\""); +header("Content-Length: " . filesize($file_path)); +header("X-Content-Type-Options: nosniff"); + +// Clear output buffers so large files stream instead of loading into memory +while (ob_get_level()) { + ob_end_clean(); +} + +readfile($file_path); +exit;