Skip to content

Commit e3e7c2e

Browse files
committed
Add Signature in ticket reply POST dont add a signature if Internal
1 parent 27e1d6a commit e3e7c2e

File tree

3 files changed

+9
-2
lines changed

3 files changed

+9
-2
lines changed

agent/post/ticket.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1567,7 +1567,7 @@
15671567
enforceUserPermission('module_support', 2);
15681568

15691569
$ticket_id = intval($_POST['ticket_id']);
1570-
$ticket_reply = mysqli_real_escape_string($mysqli, $_POST['ticket_reply']);
1570+
$ticket_reply = $_POST['ticket_reply']; // Reply is SQL escaped below
15711571
$ticket_status = intval($_POST['status']);
15721572
$client_id = intval($_POST['client_id']);
15731573

@@ -1588,6 +1588,12 @@
15881588
} else {
15891589
$ticket_reply_type = 'Internal';
15901590
}
1591+
// Add Signature to the end of the ticket reply if not Internal and if there is reply
1592+
if ($ticket_reply !== '' && $ticket_reply_type !== 'Internal') {
1593+
$ticket_reply .= getFieldById('user_settings',$session_user_id,'user_config_signature', 'raw');
1594+
}
1595+
1596+
$ticket_reply = mysqli_escape_string($mysqli, $ticket_reply); // SQL Escape Ticket Reply
15911597

15921598
// Update Ticket Status & updated at (in case status didn't change)
15931599
mysqli_query($mysqli, "UPDATE tickets SET ticket_status = $ticket_status, ticket_updated_at = NOW() WHERE ticket_id = $ticket_id");

agent/ticket.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@ class="ajax-modal"
620620
<textarea
621621
class="form-control tinymceTicket" name="ticket_reply"
622622
placeholder="Type a response">
623-
<?php echo getFieldById('user_settings',$session_user_id,'user_config_signature','html'); ?>
624623
</textarea>
625624
</div>
626625

functions.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,8 @@ function getFieldById($table, $id, $field, $escape_method = 'sql') {
16071607

16081608
// Apply the desired escaping method or auto-detect integer type if using SQL escaping
16091609
switch ($escape_method) {
1610+
case 'raw':
1611+
return $value; // Return as-is from the database
16101612
case 'html':
16111613
return htmlspecialchars($value ?? '', ENT_QUOTES, 'UTF-8'); // Escape for HTML
16121614
case 'json':

0 commit comments

Comments
 (0)