diff --git a/CHANGELOG.md b/CHANGELOG.md index e1dac91d5..421781b6e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ This file documents all notable changes made to ITFlow. ### Upgrading to 26.12.3 -Update from Maintenance > Update as usual - this release has two database changes: 4.2.2 adds a table for passkeys and a setting to turn them on or off, and 4.2.3 lets a document keep the Markdown it was written in. Nothing else is required: passkeys are on, and no one has one until they add it. A passkey is made for your ITFlow's address (the one in config.php) and only works there, over HTTPS - if you move ITFlow to a new address, everyone adds theirs again. +Update from Maintenance > Update as usual - this release has three database changes: 4.2.2 adds a table for passkeys and a setting to turn them on or off, 4.2.3 lets a document keep the Markdown it was written in, and 4.2.4 lets a ticket keep its pictures as files. Nothing else is required: passkeys are on, and no one has one until they add it. Pictures already inside tickets move to files in the background afterwards - the new Ticket Pictures job in Maintenance > Cron does a batch a minute, so an install with years of emailed screenshots may take a while, and tickets work as usual meanwhile. A passkey is made for your ITFlow's address (the one in config.php) and only works there, over HTTPS - if you move ITFlow to a new address, everyone adds theirs again. ### New Features & Updates @@ -20,6 +20,10 @@ Update from Maintenance > Update as usual - this release has two database change - Markdown files: the menu beside Upload on a client's Files has Import Markdown Files, which makes a document from each .md file picked, named by the heading it starts with or its file name. A document's page has a Markdown button beside PDF, which downloads it as a .md file - rich text documents too. - Markdown pasted into a document's rich text editor - copied from GitHub, VS Code, Obsidian or an AI chat - goes in as formatting. Ctrl+Shift+V pastes it as it is. - A document's page is easier to read: headings in proportion to the text with room between sections, and tables, code and quotes that look part of it. Under its name are its folder, its template, Markdown when it's written in it, and its review - due, or when it's next due - whose menu has Mark Reviewed and how often. The buttons are Edit, Share and Export (PDF, Markdown or Print), with the rest in the ⋮ menu, now including Template. Beside it, Contents marks the section you're reading, and Linked, Versions and History are tabs of one card: Linked shows each kind of record with its count, opening to the list. +- Pictures in tickets are kept as files: a screenshot pasted or dropped into a ticket, a reply or a note - by your team, in the client portal or through the API - and the pictures in a client's email are kept with the ticket as files instead of inside its text. A ticket full of screenshots opens quickly, and so do the tickets list and the client portal. Pictures show where they were put and stay out of the ticket's list of files, and emails carry them as before. +- Pictures already inside tickets move to files in the background - the new Ticket Pictures job in Maintenance > Cron does a batch every minute until every ticket is done, then keeps an eye on new ones. +- Taking a picture out of a reply or the ticket's details when editing it, or redacting it, deletes it - it no longer opens from an old link. +- A picture from an internal note put in a reply the client sees, or from a ticket merged into another, is copied, so it shows for the client and stays when the other is deleted. ### Bug Fixes @@ -38,6 +42,10 @@ Update from Maintenance > Update as usual - this release has two database change - agent/ajax.php markdown_to_html and html_to_markdown back js/document_markdown.js (loaded in includes/footer.php): the form's Rich text / Markdown switch, Write / Preview, pasted pictures held as pasted:N until Preview or Save, the remembered format for New Document, and the Markdown paste handler for .tinymce and .tinymce-page editors. New handlers export_document_markdown and import_markdown_documents in agent/post/document.php; versions, version restore, documentCopy() and the API's document create and update carry the Markdown (document_markdown in the API), and the API's create and update escape each value once. - The document page (agent/document.php): .itflow-prose in css/itflow_custom.css styles what it says; linkGroupsHtml() (functions/links.php) takes $compact - groups that open to their rows, open already with five links or fewer, no Link per group or empty groups - and $total; js/document_contents.js marks the section in view and opens a tab of the side card from a[data-document-tab]. - The Markdown box's toolbar ([data-markdown-toolbar] in agent/modals/document/document_form.php, data-md on each button) and its keys are in js/document_markdown.js; edits go in with document.execCommand('insertText'), falling back to setRangeText(), so the browser's undo keeps them. +- Database 4.2.4: ticket_attachments.ticket_attachment_inline (tinyint, 1 for a picture shown in a ticket's details or a reply), and settings.config_ticket_pictures_ticket_id and config_ticket_pictures_reply_id (how far the sweep has got). Nothing is moved by the update itself. +- functions/ticket_pictures.php: ticketPicturesSaveText() (ticketPicturesSaveTicket() / ticketPicturesSaveReply()) makes data: pictures in a ticket's details or a reply its files under uploads/tickets//, as ticket_attachments rows with ticket_attachment_inline = 1, and points the at /agent/ticket_attachment.php?attachment_id=N&action=view - with 'adopt' it copies pictures of another reply or ticket of the same client (merges: any), with 'prune' it deletes the text's pictures it no longer shows. It keeps the row's updated time. Called after the saves in agent/post/ticket.php (new ticket, edit, reply, edit reply, redact, bulk reply, bulk asset tickets, split), ticketMergeInto(), client/post.php (new ticket, reply), cron/ticket_email_parser.php and the API's tickets and ticket_replies create and update; anything else is picked up by the sweep. +- ticketPicturesHtml() points the pictures at /client/ticket_attachment.php in the portal, /guest/guest_ticket_attachment.php on the guest page and at the files in a client export; ticketPicturesAsData() puts a ticket's pictures back as data for an email and the task approval page. emailQueue() takes opts ticket_id (the pictures the client can see), and ticketAgentEmailContent() sets $email['ticket_pictures'] for agents' emails (internal notes' too), which emailInlineImages() turns into inline cid: pictures as before. ticketAttachmentsListedSql() keeps inline pictures out of the attachment lists; opening one isn't audit logged. +- New cron job ticket_pictures (cron/ticket_pictures.php, every minute): ticketPicturesSweep() goes through tickets then replies whose text has data:image/, 500 ids at a time, for up to 25 seconds a run. ## [26.12.2] diff --git a/admin/database_updates/4.2.4.php b/admin/database_updates/4.2.4.php new file mode 100644 index 000000000..b0a8f9274 --- /dev/null +++ b/admin/database_updates/4.2.4.php @@ -0,0 +1,31 @@ + 'client']); + // Raised about a service - from the service page's "Report a problem" foreach (array_unique(array_map('intval', (array) ($_POST['service_ids'] ?? []))) as $service_id) { $service = serviceRow($service_id); @@ -328,6 +331,8 @@ if (isset($_POST['edit_ticket'])) { } mysqli_query($mysqli, "UPDATE tickets SET $set WHERE ticket_id = $ticket_id"); + // Pictures pasted in kept as its files, and any taken out deleted (functions/ticket_pictures.php) + ticketPicturesSaveTicket($ticket_id, ['adopt' => 'client', 'prune' => true]); // Out of a project, its SLA counts from now (functions/project_tickets.php) projectTicketLeft($ticket_id, $row['ticket_project_id']); applyTicketSla($ticket_id); @@ -927,6 +932,8 @@ if (isset($_POST['bulk_ticket_reply'])) { $reply = mysqli_real_escape_string($mysqli, $reply_text); mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = '$reply', ticket_reply_time_worked = '$time_worked', ticket_reply_type = '$reply_type', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id"); $bulk_reply_id = mysqli_insert_id($mysqli); + // Its pictures each ticket's own files (functions/ticket_pictures.php) + ticketPicturesSaveReply($bulk_reply_id, ['adopt' => 'client']); cannedResponseRecordUses($canned_response_ids, $ticket_id, $session_user_id); // The files of the canned responses that went into it, on each ticket and in its email $bulk_attachments = filterEmailableAttachments(cannedResponseAttachFiles($canned_response_file_ids, $ticket_id, $bulk_reply_id, $session_user_id)); @@ -1081,6 +1088,7 @@ if (isset($_POST['bulk_add_asset_ticket'])) { if ($template) { ticketTemplateFinish($ticket_id, $ticket_template_id, true, true, $fill_in_answers); } + ticketPicturesSaveTicket($ticket_id, ['adopt' => 'client']); logAudit("Ticket", "Create", "$session_name created ticket $ticket_prefix$ticket_number - $subject", $client_id, $ticket_id); triggerCustomAction('ticket_create', $ticket_id); @@ -1185,6 +1193,12 @@ if (isset($_POST['add_ticket_reply'])) { mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = '$ticket_reply', ticket_reply_time_worked = '$ticket_reply_time_worked' $work_sql, ticket_reply_type = '$ticket_reply_type', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $ticket_id"); $ticket_reply_id = mysqli_insert_id($mysqli); + // Pictures pasted into it kept as the ticket's files, not inside the reply - and the reply as it + // now is for the mentions (functions/ticket_pictures.php) + if (ticketPicturesSaveReply($ticket_reply_id, ['adopt' => 'client']) && $ticket_reply_type === 'Internal') { + $ticket_reply_html = (string) getFieldById('ticket_replies', $ticket_reply_id, 'ticket_reply'); + } + // Store any attached files against this reply before the email is built, so // a public reply can carry them - the canned responses' that went into it too $emailable_attachments = filterEmailableAttachments(array_merge(saveTicketAttachments($ticket_id, $ticket_reply_id), @@ -1402,6 +1416,10 @@ if (isset($_POST['edit_ticket_reply'])) { } mysqli_query($mysqli, "UPDATE ticket_replies SET ticket_reply = '$ticket_reply', ticket_reply_type = '$ticket_reply_type', ticket_reply_time_worked = '$ticket_reply_time_worked' $work_sql WHERE ticket_reply_id = $ticket_reply_id"); + // Pictures pasted in kept as the ticket's files, and any taken out deleted (functions/ticket_pictures.php) + if (ticketPicturesSaveReply($ticket_reply_id, ['adopt' => 'client', 'prune' => true])) { + $ticket_reply_html = (string) getFieldById('ticket_replies', $ticket_reply_id, 'ticket_reply'); + } // Only the agents it mentions now that it didn't before are told $told = ticketMentionsTell($row, $ticket_reply_id, $ticket_reply_html, ticketMentionsSync($ticket_reply_id, $mentioned)); @@ -1429,6 +1447,8 @@ if (isset($_POST['redact_ticket_reply'])) { mysqli_query($mysqli, "UPDATE ticket_replies SET ticket_reply = '$ticket_reply' WHERE ticket_reply_id = $ticket_reply_id"); ticketMentionsSync($ticket_reply_id, $mentioned); + // A picture redacted away is gone, file and all (functions/ticket_pictures.php) + ticketPicturesSaveReply($ticket_reply_id, ['prune' => true]); logAudit("Ticket", "Reply", "$session_name redacted a reply on ticket " . escapeSql(ticketReference($row)), $client_id, intval($row['ticket_id'])); @@ -1534,6 +1554,9 @@ if (isset($_POST['split_ticket_reply'])) { } } + // Its pictures went with it - any still kept as data in it made the new ticket's files (functions/ticket_pictures.php) + ticketPicturesSaveTicket($new_id); + // The reply leaves this ticket, and a note says where it went mysqli_query($mysqli, "UPDATE ticket_replies SET ticket_reply_archived_at = NOW() WHERE ticket_reply_id = $ticket_reply_id"); $new_url = escapeSql(ticketUrl($new_id, $client_id)); diff --git a/agent/ticket.php b/agent/ticket.php index 13ccfefd3..cd224aa4e 100644 --- a/agent/ticket.php +++ b/agent/ticket.php @@ -300,7 +300,7 @@ if (isset($_GET['ticket_id'])) { $sql_all_attachments = mysqli_query( $mysqli, "SELECT ticket_attachment_id, ticket_attachment_name, ticket_attachment_reply_id - FROM ticket_attachments WHERE ticket_attachment_ticket_id = $ticket_id" + FROM ticket_attachments WHERE ticket_attachment_ticket_id = $ticket_id" . ticketAttachmentsListedSql() ); while ($attachment_row = mysqli_fetch_assoc($sql_all_attachments)) { $attachment_reply_id = intval($attachment_row['ticket_attachment_reply_id']); diff --git a/agent/ticket_attachment.php b/agent/ticket_attachment.php index 53df0f69f..330b1c106 100644 --- a/agent/ticket_attachment.php +++ b/agent/ticket_attachment.php @@ -99,8 +99,8 @@ if ((isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH' exit; } -// Audit log - skip thumbnail loads -if (!$thumb) { +// Audit log - skip thumbnail loads, and a picture in the ticket's text, which opening the ticket shows (functions/ticket_pictures.php) +if (!$thumb && !ticketAttachmentIsPicture($row)) { logAudit("Ticket", "Download", "$session_name viewed ticket attachment $attachment_name_escaped", $client_id); } diff --git a/api/v1/ticket_replies/create.php b/api/v1/ticket_replies/create.php index a8ce2edd5..9feaed183 100644 --- a/api/v1/ticket_replies/create.php +++ b/api/v1/ticket_replies/create.php @@ -98,6 +98,9 @@ if (!empty($ticket_id) && !empty($reply)) { if ($insert_sql) { $insert_id = mysqli_insert_id($mysqli); + // Pictures in it as data kept as the ticket's files (functions/ticket_pictures.php) + ticketPicturesSaveReply($insert_id); + // Optional status change alongside the reply if (!empty($reply_ticket_status)) { // Out of Resolved into a working status is a reopen - the resolved time goes and the resolution clock runs again diff --git a/api/v1/ticket_replies/update.php b/api/v1/ticket_replies/update.php index 3b7b5c709..e5491c9a2 100644 --- a/api/v1/ticket_replies/update.php +++ b/api/v1/ticket_replies/update.php @@ -65,6 +65,9 @@ if (!empty($ticket_reply_id)) { // A reply saved as it was still counts as edited $update_count = max(1, mysqli_affected_rows($mysqli)); + // Pictures in it as data kept as the ticket's files, and any taken out deleted (functions/ticket_pictures.php) + ticketPicturesSaveReply($ticket_reply_id, ['prune' => true]); + // Only the agents it mentions now that it didn't before are told $told = ticketMentionsTell($ticket_reply_row, $ticket_reply_id, $reply_html, ticketMentionsSync($ticket_reply_id, $mentioned)); if ($told) { diff --git a/api/v1/tickets/create.php b/api/v1/tickets/create.php index dc134fbc7..8ffda946e 100644 --- a/api/v1/tickets/create.php +++ b/api/v1/tickets/create.php @@ -145,6 +145,9 @@ if (!empty($subject) && $client_exists) { ticketTemplateFinish($insert_id, $template['ticket_template_id'], true, true, $fill_in_answers, "Raised by the API ($api_key_name) from template " . $template['ticket_template_name']); } + // Pictures in its details as data kept as its files (functions/ticket_pictures.php) + ticketPicturesSaveTicket($insert_id); + // Part of a project $project = $ticket_project_id ? projectRow($ticket_project_id) : null; if ($project) { diff --git a/api/v1/tickets/update.php b/api/v1/tickets/update.php index fab0cda1c..6010962f2 100644 --- a/api/v1/tickets/update.php +++ b/api/v1/tickets/update.php @@ -28,6 +28,9 @@ if (!empty($ticket_id)) { if ($update_sql) { $update_count = mysqli_affected_rows($mysqli); + // Pictures in its details as data kept as its files, and any taken out deleted (functions/ticket_pictures.php) + ticketPicturesSaveTicket($ticket_id, ['prune' => true]); + logTicketHistory($ticket_id, "Edited via the API ($api_key_name)"); // A new priority can mean another SLA - as the priority picker on the ticket page diff --git a/client/post.php b/client/post.php index f8051802e..c5f0cccdd 100644 --- a/client/post.php +++ b/client/post.php @@ -126,8 +126,10 @@ if (isset($_POST['add_ticket'])) { $ticket_id = mysqli_insert_id($mysqli); applyTicketSla($ticket_id); - // Screenshots and files sent with it belong to the ticket itself + // Screenshots and files sent with it belong to the ticket itself - pictures pasted into it too, + // as its files rather than inside its text (functions/ticket_pictures.php) saveTicketAttachments($ticket_id, null, 'file'); + ticketPicturesSaveTicket($ticket_id); // The new-ticket address (Admin > Ticket), when there is one ticketMailNewTicketAddress($ticket_id, 'portal'); @@ -214,6 +216,9 @@ if (isset($_POST['add_ticket_comment'])) { $ticket_reply_id = mysqli_insert_id($mysqli); + // Pictures pasted into it kept as the ticket's files, not inside the reply (functions/ticket_pictures.php) + ticketPicturesSaveReply($ticket_reply_id); + // Update Ticket Last Response Field & set ticket to open as client has replied $original_row = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ticket_status FROM tickets WHERE ticket_id = $ticket_id LIMIT 1")); $original_ticket_status = intval($original_row['ticket_status'] ?? 0); diff --git a/client/ticket.php b/client/ticket.php index be3d04aec..95fbc2e8e 100644 --- a/client/ticket.php +++ b/client/ticket.php @@ -74,7 +74,7 @@ $sql = mysqli_query($mysqli, "SELECT ticket_attachment_id, ticket_attachment_nam LEFT JOIN ticket_replies ON ticket_reply_id = ticket_attachment_reply_id WHERE ticket_attachment_ticket_id = $ticket_id AND (ticket_attachment_reply_id IS NULL OR (ticket_reply_type != 'Internal' AND ticket_reply_archived_at IS NULL)) - AND ticket_attachment_name != 'Original-parsed-email.eml' + AND ticket_attachment_name != 'Original-parsed-email.eml'" . ticketAttachmentsListedSql() . " ORDER BY ticket_attachment_id ASC"); while ($row = mysqli_fetch_assoc($sql)) { $attachments[intval($row['ticket_attachment_reply_id'])][] = $row; @@ -181,7 +181,7 @@ $reply_by = portalTicketReplyBy($ticket_id);
- purify($ticket['ticket_details']), + purify(ticketPicturesHtml($ticket['ticket_details'], 'client')), $attachments[0] ?? [], intval($ticket['ticket_contact_id']) === $session_contact_id, false) ?> purify($reply['ticket_reply']), + echo portalMessageHtml($name, $photo, $reply['ticket_reply_created_at'], $purifier->purify(ticketPicturesHtml($reply['ticket_reply'], 'client')), $attachments[intval($reply['ticket_reply_id'])] ?? [], $mine, !$client_reply); } ?>
diff --git a/client/ticket_attachment.php b/client/ticket_attachment.php index fac675185..3f2bb173c 100644 --- a/client/ticket_attachment.php +++ b/client/ticket_attachment.php @@ -97,8 +97,8 @@ if ((isset($_SERVER['HTTP_IF_NONE_MATCH']) && trim($_SERVER['HTTP_IF_NONE_MATCH' exit; } -// Audit log - not for an agent viewing as the contact -if (!portalViewingAs()) { +// Audit log - not for an agent viewing as the contact, nor a picture in the ticket's text, which opening the ticket shows (functions/ticket_pictures.php) +if (!portalViewingAs() && !ticketAttachmentIsPicture($row)) { logAudit("Ticket", "Download", "Client contact $session_contact_name viewed ticket attachment $attachment_name_escaped via portal", $session_client_id); } diff --git a/cron/ticket_email_parser.php b/cron/ticket_email_parser.php index 7c37f0bc8..c2d98aa29 100644 --- a/cron/ticket_email_parser.php +++ b/cron/ticket_email_parser.php @@ -69,7 +69,7 @@ $allowed_extensions = array('jpg', 'jpeg', 'gif', 'png', 'webp', 'pdf', 'txt', ' // Processing limits $max_emails_per_run = 50; // Cap per cron run to bound memory usage (cron catches up on the next run) $max_attachment_bytes = 15728640; // 15 MB - larger attachments are skipped & logged -$max_inline_embed_bytes = 2097152; // 2 MB - larger inline images are saved as regular attachments instead of base64-embedded in the ticket body +$max_inline_embed_bytes = 2097152; // 2 MB - larger inline images are saved as regular attachments instead of shown in the ticket's text (kept as its files - functions/ticket_pictures.php) /** ------------------------------------------------------------------ * Ticket / Reply helpers (unchanged) @@ -114,6 +114,9 @@ function addTicket($contact_id, $contact_name, $contact_email, $client_id, $date $id = mysqli_insert_id($mysqli); applyTicketSla($id); + // The email's pictures kept as the ticket's files, not inside its text (functions/ticket_pictures.php) + ticketPicturesSaveTicket($id); + // Logging logAudit("Ticket", "Create", "Email parser: Client contact $contact_email_esc created ticket $ticket_prefix_esc$ticket_number ($subject) ($id)", $client_id, $id); @@ -279,6 +282,9 @@ function addReply($from_email, $date, $subject, $ticket_number, $message, $attac mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = '$message_esc', ticket_reply_type = '$ticket_reply_type', ticket_reply_time_worked = '00:00:00', ticket_reply_by = $ticket_reply_contact, ticket_reply_ticket_id = $ticket_id"); $reply_id = mysqli_insert_id($mysqli); + // The email's pictures kept as the ticket's files, not inside the reply (functions/ticket_pictures.php) + ticketPicturesSaveReply($reply_id); + $ticket_dir = "../uploads/tickets/" . $ticket_id . "/"; mkdirMissing($ticket_dir); @@ -739,7 +745,8 @@ foreach ($messages as $message) { continue; } - // Embed small inline images as data URIs; oversized inline images fall through and are saved as regular attachments + // Embed small inline images as data URIs - made the ticket's files once the reply or ticket is saved + // (ticketPicturesSaveReply()); oversized inline images fall through and are saved as regular attachments $is_inline = false; if ($dispo === 'inline' && $cid && $content !== '' && $size <= $max_inline_embed_bytes) { $cid_trim = trim($cid, '<>'); diff --git a/cron/ticket_pictures.php b/cron/ticket_pictures.php new file mode 100644 index 000000000..75e113d42 --- /dev/null +++ b/cron/ticket_pictures.php @@ -0,0 +1,40 @@ + $ticket) { $path = clientExportUniquePath('tickets', clientExportSafeName($ticket['number'] . ' - ' . $ticket['subject']) . '.html', $used); $files_html = ''; + // The pictures in its text, pointed at where they are in the export (functions/ticket_pictures.php) + $pictures = []; foreach ($attachments[$ticket['id']] ?? [] as $attachment) { $dir = realpath(__DIR__ . '/../uploads/tickets/' . $ticket['id']); $source = $dir ? realpath($dir . '/' . basename((string) $attachment['ticket_attachment_reference_name'])) : false; @@ -1775,7 +1777,12 @@ function clientExportArchive($client_id, $options, &$error = '') { continue; } $target = clientExportUniquePath('tickets/attachments/' . clientExportSafeName($ticket['number']), clientExportSafeName($attachment['ticket_attachment_name']), $used); - if ($add_file($target, $source)) { + if (!$add_file($target, $source)) { + continue; + } + if (ticketAttachmentIsPicture($attachment)) { + $pictures[intval($attachment['ticket_attachment_id'])] = '../' . $target; + } else { $files_html .= '
  • ' . escapeHtml($attachment['ticket_attachment_name']) . '
  • '; } } @@ -1804,13 +1811,13 @@ function clientExportArchive($client_id, $options, &$error = '') { $label = $type === 'Internal' ? 'Internal note' : ($type === 'Client' ? 'Client' : 'Reply'); $thread .= '
    ' . escapeHtml($by ?: 'Unknown') . ' · ' . escapeHtml($label) . ' · ' . escapeHtml(date('M j, Y g:i A', strtotime($reply['ticket_reply_created_at']))) . ($worked !== '' ? ' · ' . escapeHtml($worked) . ' worked' : '') - . '
    ' . documentHtmlPurify($reply['ticket_reply']) . '
    '; + . '
    ' . documentHtmlPurify(ticketPicturesHtml($reply['ticket_reply'], $pictures)) . '
    '; } $add_string($path, clientExportHtmlPage($ticket['number'] . ' - ' . $ticket['subject'], '
    ' . escapeHtml($ticket['number']) . ($ticket['archived'] !== '' ? ' · Archived' : '') . '
    ' . '

    ' . escapeHtml($ticket['subject']) . '

    ' . $badges . '
    ' . '
    ' . $facts_html . '
    ' - . '

    Details

    ' . documentHtmlPurify($details) . '
    ' + . '

    Details

    ' . documentHtmlPurify(ticketPicturesHtml($details, $pictures)) . '
    ' . ($thread !== '' ? '

    Conversation

    ' . $thread . '
    ' : '') . ($files_html !== '' ? '

    Attachments

    ' : ''), '../')); $rows['tickets'][$i]['path'] = $path; diff --git a/functions/email.php b/functions/email.php index 7b10866b2..2dd1f0d2c 100644 --- a/functions/email.php +++ b/functions/email.php @@ -409,11 +409,16 @@ function emailReplyHasText($html) { * shows no picture carried as data, and the queue keeps each picture once rather than a copy in * every email. [html, [['path', 'name', 'cid'], ...]]. A tag at a time, as a scan through a * large picture's data runs out of PCRE's backtracking (emailMessageHtml()); a picture that isn't - * one, or can't be saved, stays as it was. + * one, or can't be saved, stays as it was. With $ticket ['id' => ticket id, 'internal' => bool] + * the ticket's own pictures, kept as its files, go in too (ticketPicturesAsData()) - only those + * its client can see, unless 'internal' (an email to agents). */ -function emailInlineImages($html) { +function emailInlineImages($html, array $ticket = []) { $images = []; $html = (string) $html; + if (!empty($ticket['id'])) { + $html = ticketPicturesAsData($html, intval($ticket['id']), !empty($ticket['internal'])); + } if (stripos($html, 'data:image/') === false) { return [$html, []]; } @@ -463,6 +468,10 @@ function emailInlineImages($html) { * sensitive it carries a link or code that opens something - a shared login, an * invite, a password link, a signing or approval link - so the mail queue * clears what it said once it has gone (email_queue.email_sensitive) + * ticket_id the ticket its message comes from - the pictures the ticket's client can + * see go in it (emailInlineImages()). An email to agents built by + * ticketAgentEmailContent() says its own ticket, in $email['ticket_pictures'], + * and has an internal note's pictures too * Who it was queued to, "Name (email)". Nothing is queued without mail set up. */ function emailQueue(array $recipients, $subject, array $email, array $opts = []) { @@ -473,6 +482,9 @@ function emailQueue(array $recipients, $subject, array $email, array $opts = []) $from = $opts['from'] ?? emailFrom(); $queued_at = !empty($opts['queued_at']) && strtotime((string) $opts['queued_at']) ? date('Y-m-d H:i:s', strtotime((string) $opts['queued_at'])) : ''; $attachments = array_values(array_filter((array) ($opts['attachments'] ?? []))); + // The ticket whose pictures its message may carry (functions/ticket_pictures.php) + $pictures = !empty($opts['ticket_id']) ? ['id' => intval($opts['ticket_id']), 'internal' => false] : (array) ($email['ticket_pictures'] ?? []); + unset($email['ticket_pictures']); $data = []; $sent = []; foreach ($recipients as $recipient) { @@ -491,7 +503,7 @@ function emailQueue(array $recipients, $subject, array $email, array $opts = []) continue; } // Its pictures attached inline, not carried as data - [$html, $images] = emailInlineImages($html); + [$html, $images] = emailInlineImages($html, $pictures); $data[] = [ 'from' => mysqli_real_escape_string($mysqli, (string) $from['email']), 'from_name' => mysqli_real_escape_string($mysqli, (string) $from['name']), diff --git a/functions/ticket.php b/functions/ticket.php index 3345c5ec7..ae4a05099 100644 --- a/functions/ticket.php +++ b/functions/ticket.php @@ -386,6 +386,8 @@ function ticketMergeInto($child, $parent, $comment, $move_replies = false) { setTicketResolutionSlaMet($ticket_id); mysqli_query($mysqli, "INSERT INTO ticket_replies SET ticket_reply = 'Ticket $child_reference was merged into this ticket with comment: $comment.

    $child_subject
    $child_details', ticket_reply_time_worked = '00:00:00', ticket_reply_type = 'Internal', ticket_reply_by = $session_user_id, ticket_reply_ticket_id = $parent_id"); + // The merged ticket's pictures copied with its details, so they stay with this one (functions/ticket_pictures.php) + ticketPicturesSaveReply(mysqli_insert_id($mysqli), ['adopt' => 'any']); mysqli_query($mysqli, "UPDATE tickets SET ticket_updated_at = NOW() WHERE ticket_id = $parent_id"); // Its tags go with it - not archived ones, which aren't put on more tickets @@ -711,7 +713,7 @@ function ticketMailSend($ticket_id, $subject, array $email, array $opts = []) { } } return count(emailQueue($recipients, $subject, $email, ['from' => ticketEmailFrom(), 'attachments' => $opts['attachments'] ?? [], 'cal_str' => $opts['cal_str'] ?? '', - 'ticket_reply_id' => intval($opts['ticket_reply_id'] ?? 0)])); + 'ticket_reply_id' => intval($opts['ticket_reply_id'] ?? 0), 'ticket_id' => intval($ticket_id)])); } /** Whether a ticket's contact gets an email of this $kind - no 'created' or 'closed' email for one who asked for replies only. */ @@ -785,7 +787,7 @@ function ticketMailColleaguesNew($ticket_id) { 'button' => ['label' => $colleague['portal'] ? 'View it in the portal' : 'View the ticket', 'url' => $url], 'contact' => ticketEmailContactLine(), 'office' => officeTicketFoot($ticket), - ], ['from' => ticketEmailFrom()])); + ], ['from' => ticketEmailFrom(), 'ticket_id' => $ticket_id])); } return $sent; } @@ -974,6 +976,8 @@ function ticketAgentEmailContent(array $row, $kind, array $opts = []) { 'kind' => 'Ticket', 'tone' => 'primary', 'title' => $subject, 'preview' => "$reference - $subject", 'summary' => ['Client' => $client, 'Ticket' => $reference, 'Priority' => (string) $row['ticket_priority'], 'Status' => (string) ($row['ticket_status_name'] ?? '')], 'button' => ['label' => 'Open in ITFlow', 'url' => ticketAgentUrl($row)], + // Its pictures go in, an internal note's too - it is for agents (emailQueue()) + 'ticket_pictures' => ['id' => intval($row['ticket_id'] ?? 0), 'internal' => true], ]; if ($kind === 'new') { $how = ['portal' => ' in the client portal', 'email' => ' by email', 'text' => ' by text', 'api' => ' through the API', 'scheduled' => ', as scheduled', 'rmm' => ' by an RMM alert', 'managed' => ' by a problem on a managed instance'][$opts['how'] ?? ''] ?? ''; diff --git a/functions/ticket_pictures.php b/functions/ticket_pictures.php new file mode 100644 index 000000000..7643d5f49 --- /dev/null +++ b/functions/ticket_pictures.php @@ -0,0 +1,378 @@ +/) marked inline, and the text points at it: + * + * + * + * Kept inside the text as data, a few screenshots made a reply megabytes long, and every page + * that read the ticket - the tickets list too - slowed with it. An inline picture shows where it + * was put, and is left out of the ticket's list of files (ticketAttachmentsListedSql()). + * + * The text keeps the agent's address for a picture, which the agent's pages show as it is. The + * client portal and the guest page put their own in its place (ticketPicturesHtml()), and an + * email carries the picture itself (ticketPicturesAsData(), emailInlineImages()). Pictures kept + * as data from before - or by something that doesn't make them files, a recurring ticket's or a + * template's - move to files a batch a minute (ticketPicturesSweep(), cron/ticket_pictures.php). + * + * All of it once the 4.2.4 update has made ticket_attachments.ticket_attachment_inline - before + * that, pictures stay as data, as they were. + */ + +/* The kinds of picture kept as files - any other (an SVG, say) stays as it was */ +const TICKET_PICTURE_TYPES = [IMAGETYPE_PNG => 'png', IMAGETYPE_JPEG => 'jpg', IMAGETYPE_GIF => 'gif', IMAGETYPE_WEBP => 'webp']; + +/* Has the 4.2.4 update made ticket_attachments.ticket_attachment_inline? */ +function ticketPicturesReady() { + global $mysqli; + static $ready = null; + if ($ready === null) { + if (defined('CURRENT_DATABASE_VERSION')) { + $version = CURRENT_DATABASE_VERSION; + } else { + $result = mysqli_query($mysqli, "SELECT config_current_database_version FROM settings WHERE company_id = 1"); + $version = $result && ($row = mysqli_fetch_row($result)) ? (string) $row[0] : '0'; + } + $ready = version_compare($version, '4.2.4', '>='); + } + return $ready; +} + +/* For a query of the files a ticket lists - not its inline pictures */ +function ticketAttachmentsListedSql() { + return ticketPicturesReady() ? ' AND ticket_attachment_inline = 0' : ''; +} + +/* Is this attachment row (with ticket_attachment_inline, when there is one) a picture in a ticket's text? */ +function ticketAttachmentIsPicture(array $row) { + return ticketPicturesReady() && intval($row['ticket_attachment_inline'] ?? 0) === 1; +} + +/* A picture's address in a ticket's text, as it goes in the HTML */ +function ticketPictureUrl($attachment_id) { + return '/agent/ticket_attachment.php?attachment_id=' . intval($attachment_id) . '&action=view'; +} + +/* A picture's address, matched - relative, or with this ITFlow's address in front, never another site's - id in [1] */ +function ticketPicturePattern() { + global $config_base_url; + $site = !empty($config_base_url) ? '|https?://' . preg_quote((string) $config_base_url, '#') : ''; + return '#(?:(?<=["\'\s=])' . $site . ')/agent/ticket_attachment\.php\?attachment_id=(\d+)(?:&(?:amp;)?(?:action|thumb)=[a-z0-9]*)*#i'; +} + +/* The attachment ids of the pictures a text points at */ +function ticketPictureIds($html) { + $html = (string) $html; + if (stripos($html, 'ticket_attachment.php') === false || !preg_match_all(ticketPicturePattern(), $html, $m)) { + return []; + } + return array_values(array_unique(array_map('intval', $m[1]))); +} + +/* + * The pictures in $html kept as data made the ticket's files - against $reply_id, or the ticket + * itself when null - each pointing at its file instead. A tag at a time, as a scan through + * a large picture's data runs out of PCRE's backtracking (emailInlineImages()); one that isn't a + * picture of a kind kept (TICKET_PICTURE_TYPES), or can't be saved, stays as it was. [html, how many]. + */ +function ticketPicturesFromData($html, $ticket_id, $reply_id = null) { + global $mysqli; + $html = (string) $html; + $ticket_id = intval($ticket_id); + if (!$ticket_id || stripos($html, 'data:image/') === false) { + return [$html, 0]; + } + $dir = dirname(__DIR__) . "/uploads/tickets/$ticket_id/"; + $reply_sql = $reply_id ? intval($reply_id) : 'NULL'; + $saved = 0; + $out = preg_replace_callback('/]*>/i', function ($tag) use ($dir, $ticket_id, $reply_sql, &$saved, $mysqli) { + if (!preg_match('/\ssrc\s*=\s*(["\'])data:image\/[a-z0-9+.-]+;base64,([A-Za-z0-9+\/=\s]+)\1/i', $tag[0], $m)) { + return $tag[0]; + } + $data = base64_decode(preg_replace('/\s+/', '', $m[2]), true); + $info = $data !== false ? @getimagesizefromstring($data) : false; + $ext = $info ? (TICKET_PICTURE_TYPES[$info[2]] ?? '') : ''; + if ($ext === '' || (!is_dir($dir) && !@mkdir($dir, 0775, true))) { + return $tag[0]; + } + $reference = randomString(32) . ".$ext"; + if (@file_put_contents($dir . $reference, $data) === false) { + return $tag[0]; + } + $name = 'picture-' . substr(hash('sha256', $data), 0, 8) . ".$ext"; + mysqli_query($mysqli, "INSERT INTO ticket_attachments SET ticket_attachment_name = '$name', ticket_attachment_reference_name = '$reference', + ticket_attachment_inline = 1, ticket_attachment_reply_id = $reply_sql, ticket_attachment_ticket_id = $ticket_id"); + $saved++; + return str_replace($m[0], ' src=' . $m[1] . ticketPictureUrl(mysqli_insert_id($mysqli)) . $m[1], $tag[0]); + }, $html); + return $out === null ? [$html, 0] : [$out, $saved]; +} + +/* + * Each picture's given alt text - one without any, or with the address that HTMLPurifier + * puts in when there is none (copied from a page that showed it), says Picture. That is what an + * email shows while its pictures are off. + */ +function ticketPicturesAlt($html) { + $html = (string) $html; + if (stripos($html, 'ticket_attachment.php') === false) { + return $html; + } + $out = preg_replace_callback('/]*>/i', function ($tag) { + if (stripos($tag[0], 'ticket_attachment.php') === false) { + return $tag[0]; + } + if (preg_match('/\salt\s*=\s*(["\'])[^"\']*ticket_attachment\.php[^"\']*\1/i', $tag[0], $m)) { + return str_replace($m[0], ' alt="Picture"', $tag[0]); + } + return preg_match('/\salt\s*=/i', $tag[0]) ? $tag[0] : preg_replace('/^ + * address] for a copy kept elsewhere (a client export) - its pictures pointing at that place's + * own address for them. Before HTMLPurifier, which keeps them. + */ +function ticketPicturesHtml($html, $for, array $ticket = []) { + $html = (string) $html; + if (stripos($html, 'ticket_attachment.php') === false) { + return $html; + } + $out = preg_replace_callback(ticketPicturePattern(), function ($m) use ($for, $ticket) { + $id = intval($m[1]); + if (is_array($for)) { + return isset($for[$id]) ? escapeHtml($for[$id]) : $m[0]; + } + if ($for === 'client') { + return '/client/ticket_attachment.php?attachment_id=' . $id . '&action=view'; + } + if ($for === 'guest') { + return '/guest/guest_ticket_attachment.php?ticket_id=' . intval($ticket['ticket_id'] ?? 0) . '&url_key=' . rawurlencode((string) ($ticket['ticket_url_key'] ?? '')) + . '&attachment_id=' . $id . '&action=view'; + } + return $m[0]; + }, $html); + return $out ?? $html; +} + +/* + * A ticket's text with its own pictures in it as data - for an email (emailInlineImages() makes + * them its inline pictures) or a page that can't link to them (a task approval). Only the ticket's + * pictures, and with $internal false only those the client can see: on the ticket itself or a + * reply that isn't an internal note or archived. Any other stays as it was. + */ +function ticketPicturesAsData($html, $ticket_id, $internal = false) { + global $mysqli; + $ids = ticketPictureIds($html); + $ticket_id = intval($ticket_id); + if (!$ids || !$ticket_id || !ticketPicturesReady()) { + return (string) $html; + } + $sql = mysqli_query($mysqli, "SELECT ticket_attachment_id, ticket_attachment_reference_name FROM ticket_attachments + LEFT JOIN ticket_replies ON ticket_reply_id = ticket_attachment_reply_id + WHERE ticket_attachment_id IN (" . implode(',', $ids) . ") AND ticket_attachment_ticket_id = $ticket_id AND ticket_attachment_inline = 1" + . ($internal ? '' : " AND (ticket_attachment_reply_id IS NULL OR (ticket_reply_type != 'Internal' AND ticket_reply_archived_at IS NULL))")); + $dir = realpath(dirname(__DIR__) . "/uploads/tickets/$ticket_id"); + $data = []; + while ($row = mysqli_fetch_assoc($sql)) { + $file = $dir ? realpath($dir . '/' . basename((string) $row['ticket_attachment_reference_name'])) : false; + $info = $file && strpos($file, $dir . DIRECTORY_SEPARATOR) === 0 ? @getimagesize($file) : false; + if ($info && isset(TICKET_PICTURE_TYPES[$info[2]])) { + $data[intval($row['ticket_attachment_id'])] = 'data:' . $info['mime'] . ';base64,' . base64_encode((string) file_get_contents($file)); + } + } + if (!$data) { + return (string) $html; + } + $out = preg_replace_callback(ticketPicturePattern(), function ($m) use ($data) { + return $data[intval($m[1])] ?? $m[0]; + }, (string) $html); + return $out ?? (string) $html; +} + +/* + * Pictures still kept as data in tickets' details and replies made files - the tickets, then the + * replies, in order, from where the last run got to (settings.config_ticket_pictures_ticket_id and + * config_ticket_pictures_reply_id), for up to $seconds. Once through, each run looks at what is + * newer, so a picture something kept as data - a recurring ticket's, say - is a file a minute + * later. ['moved' => pictures, 'texts' => details and replies changed, 'behind' => more to do]. + */ +function ticketPicturesSweep($seconds = 25) { + global $mysqli; + if (!ticketPicturesReady()) { + return null; + } + $deadline = microtime(true) + $seconds; + $state = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT config_ticket_pictures_ticket_id, config_ticket_pictures_reply_id FROM settings WHERE company_id = 1")); + $moved = $texts = 0; + $behind = false; + foreach ([ + 'ticket' => ['tickets', 'ticket_id', 'ticket_details', 'config_ticket_pictures_ticket_id'], + 'reply' => ['ticket_replies', 'ticket_reply_id', 'ticket_reply', 'config_ticket_pictures_reply_id'], + ] as $kind => [$table, $key, $column, $setting]) { + $from = intval($state[$setting] ?? 0); + $last = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(MAX($key), 0) FROM $table"))[0] ?? 0); + // Past the newest there is - the table was emptied (a demo's reset, say) - so from the start + if ($from > $last) { + $from = 0; + } + while ($from < $last && microtime(true) < $deadline) { + $to = min($from + 500, $last); + $sql = mysqli_query($mysqli, "SELECT $key FROM $table WHERE $key > $from AND $key <= $to AND $column LIKE '%data:image/%' ORDER BY $key"); + while ($row = mysqli_fetch_row($sql)) { + if (microtime(true) >= $deadline) { + // Back to just before the one there was no time for + $to = intval($row[0]) - 1; + break; + } + $moved += ticketPicturesSaveText($kind, intval($row[0])); + $texts++; + } + $from = $to; + mysqli_query($mysqli, "UPDATE settings SET $setting = $from WHERE company_id = 1"); + } + if ($from < $last) { + $behind = true; + } + } + return ['moved' => $moved, 'texts' => $texts, 'behind' => $behind]; +} diff --git a/guest/guest_approve_ticket_task.php b/guest/guest_approve_ticket_task.php index 3c8671e7b..ed5c71cee 100644 --- a/guest/guest_approve_ticket_task.php +++ b/guest/guest_approve_ticket_task.php @@ -38,7 +38,7 @@ $approval_id = intval($_GET['task_approval_id']); $url_key = escapeSql($_GET['url_key']); $task_row = mysqli_fetch_assoc(mysqli_query($mysqli, - "SELECT approval_status, task_id, task_name, ticket_details, + "SELECT approval_status, task_id, task_name, ticket_id, ticket_details, ticket_number, ticket_prefix, ticket_priority, ticket_status_name, ticket_subject FROM task_approvals LEFT JOIN tasks ON approval_task_id = task_id LEFT JOIN tickets on task_ticket_id = ticket_id @@ -64,7 +64,8 @@ $ticket_number = intval($task_row['ticket_number']); $ticket_status = escapeHtml($task_row['ticket_status_name']); $ticket_priority = escapeHtml($task_row['ticket_priority']); $ticket_subject = escapeHtml($task_row['ticket_subject']); -$ticket_details = $purifier->purify($task_row['ticket_details']); +// Its pictures in it - this page gives no way to the ticket's own (functions/ticket_pictures.php) +$ticket_details = $purifier->purify(ticketPicturesAsData($task_row['ticket_details'], intval($task_row['ticket_id']))); // Same priority colours the agent ticket list uses, so a ticket reads the same // to the client as it does to the tech looking at it diff --git a/guest/guest_ticket_attachment.php b/guest/guest_ticket_attachment.php index b458feadd..f7ff81364 100644 --- a/guest/guest_ticket_attachment.php +++ b/guest/guest_ticket_attachment.php @@ -28,7 +28,7 @@ $ticket = ticketByGuestKey($_GET['ticket_id'] ?? 0, $_GET['url_key'] ?? ''); $ticket_id = $ticket ? intval($ticket['ticket_id']) : 0; $attachment_id = intval($_GET['attachment_id'] ?? 0); -$row = $ticket_id && $attachment_id ? mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ticket_attachment_name, ticket_attachment_reference_name FROM ticket_attachments +$row = $ticket_id && $attachment_id ? mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT ticket_attachment_name, ticket_attachment_reference_name" . (ticketPicturesReady() ? ', ticket_attachment_inline' : '') . " FROM ticket_attachments LEFT JOIN ticket_replies ON ticket_reply_id = ticket_attachment_reply_id WHERE ticket_attachment_id = $attachment_id AND ticket_attachment_ticket_id = $ticket_id AND ticket_attachment_name != 'Original-parsed-email.eml' AND (ticket_attachment_reply_id IS NULL OR (ticket_reply_type != 'Internal' AND ticket_reply_archived_at IS NULL)) @@ -51,7 +51,10 @@ $inline = ($_GET['action'] ?? '') === 'view' && in_array($mime, getInlineViewabl $name = str_replace(['"', "\r", "\n"], '', basename((string) $row['ticket_attachment_name'])); $ascii = preg_replace('/[^\x20-\x7E]/', '_', $name); -logAudit("Ticket", "Download", "Guest " . ($inline ? 'viewed' : 'downloaded') . " ticket attachment " . escapeSql($name) . " on " . escapeSql(ticketReference($ticket)) . " via its guest link", intval($ticket['ticket_client_id']), $ticket_id); +// Not a picture in the ticket's text, which opening the page shows (functions/ticket_pictures.php) +if (!ticketAttachmentIsPicture($row)) { + logAudit("Ticket", "Download", "Guest " . ($inline ? 'viewed' : 'downloaded') . " ticket attachment " . escapeSql($name) . " on " . escapeSql(ticketReference($ticket)) . " via its guest link", intval($ticket['ticket_client_id']), $ticket_id); +} header("Content-Type: $mime"); header('Content-Disposition: ' . ($inline ? 'inline' : 'attachment') . '; filename="' . $ascii . '"; filename*=UTF-8\'\'' . rawurlencode($name)); diff --git a/guest/guest_view_ticket.php b/guest/guest_view_ticket.php index bdc2cebb3..353b12adf 100644 --- a/guest/guest_view_ticket.php +++ b/guest/guest_view_ticket.php @@ -85,6 +85,8 @@ $closed = !empty($ticket['ticket_closed_at']); $open = !$resolved && !$closed; $url_key = (string) $ticket['ticket_url_key']; $query = "ticket_id=$ticket_id&url_key=" . rawurlencode($url_key); +// The pictures in its text, from this page's own address for them (functions/ticket_pictures.php) +$picture_ticket = ['ticket_id' => $ticket_id, 'ticket_url_key' => $url_key]; $page_title = escapeHtml("Ticket $number"); // Replying: by email when the ticket mailbox is read (Admin > Mail), with the number in the subject so it lands on @@ -112,7 +114,7 @@ if ($open) { $attachments = []; $sql = mysqli_query($mysqli, "SELECT ticket_attachment_id, ticket_attachment_name, ticket_attachment_reply_id FROM ticket_attachments LEFT JOIN ticket_replies ON ticket_reply_id = ticket_attachment_reply_id - WHERE ticket_attachment_ticket_id = $ticket_id AND ticket_attachment_name != 'Original-parsed-email.eml' + WHERE ticket_attachment_ticket_id = $ticket_id AND ticket_attachment_name != 'Original-parsed-email.eml'" . ticketAttachmentsListedSql() . " AND (ticket_attachment_reply_id IS NULL OR (ticket_reply_type != 'Internal' AND ticket_reply_archived_at IS NULL)) ORDER BY ticket_attachment_id ASC"); while ($row = mysqli_fetch_assoc($sql)) { @@ -240,7 +242,7 @@ $urgent = $open && $company_phone !== '' && in_array($ticket['ticket_priority'],
    - purify($ticket['ticket_details']), + purify(ticketPicturesHtml($ticket['ticket_details'], 'guest', $picture_ticket)), $attachments[0] ?? [], true, $query) ?> purify($reply['ticket_reply']), + echo guestTicketMessageHtml($name, $photo, $reply['ticket_reply_created_at'], $purifier->purify(ticketPicturesHtml($reply['ticket_reply'], 'guest', $picture_ticket)), $attachments[intval($reply['ticket_reply_id'])] ?? [], $client_reply, $query); } ?>
    diff --git a/includes/cron_jobs.php b/includes/cron_jobs.php index 6f72f762b..54419e770 100644 --- a/includes/cron_jobs.php +++ b/includes/cron_jobs.php @@ -164,6 +164,15 @@ function cronJobRegistry(): array 'schedule' => 'Interval', 'interval_minutes' => 15, ], + [ + 'name' => 'ticket_pictures', + 'label' => 'Ticket Pictures', + 'icon' => 'fa-image', + 'script' => 'ticket_pictures.php', + 'description' => 'Moves pictures still kept inside tickets\' text - from before the update, or put there by a recurring ticket or a template - into each ticket\'s files, a batch each run, so long tickets open quickly. Once it has been through every ticket it only looks at new ones.', + 'schedule' => 'Interval', + 'interval_minutes' => 1, + ], [ 'name' => 'domain_refresher', 'label' => 'Domain Refresher',