From f02af695b84f30d37cc74c8937b93371fce7212b Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 17 May 2018 18:57:21 -0400 Subject: [PATCH] privacy_functions modified to work with MfH --- admin/admin_ticket.php | 3 +++ inc/common.inc.php | 15 +++++++++++++++ inc/privacy_functions.inc.php | 9 +++++++-- language/en/text-mfh.php | 6 ++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index 8c233ee4..1e9fec93 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -2077,6 +2077,9 @@ function mfh_print_audit_record($record) { case 'audit_unlinked_ticket': $font_icon = 'fa fa-chain-broken'; break; + case 'audit_anonymized': + $font_icon = 'fa fa-shield'; + break; default: $font_icon = 'fa-question-circle'; break; diff --git a/inc/common.inc.php b/inc/common.inc.php index db8564d5..0dba9eee 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -2286,6 +2286,21 @@ function mfh_insert_audit_trail_record($entity_id, $entity_type, $language_key, return $audit_id; } +function mfh_anonymize_audit_trail_records($entity_id, $entity_type, $ticket_name) { + global $hesk_settings, $hesklang; + + hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail_to_replacement_values` + SET `replacement_value` = REPLACE(`replacement_value`, '" . hesk_dbEscape($ticket_name) . "', '" . hesk_dbEscape($hesklang['anon_name']) . "') + WHERE `audit_trail_id` IN ( + SELECT `id` + FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "audit_trail` + WHERE `entity_id` = " . intval($entity_id) . " + AND `entity_type` = '" . hesk_dbEscape($entity_type) . "')"); + mfh_insert_audit_trail_record($entity_id, $entity_type, 'audit_anonymized', hesk_date(), array( + 0 => $_SESSION['name'] . ' (' . $_SESSION['user'] . ')' + )); +} + function mfh_can_customer_change_status($status) { global $hesk_settings; diff --git a/inc/privacy_functions.inc.php b/inc/privacy_functions.inc.php index b39fe807..2ad9ff93 100644 --- a/inc/privacy_functions.inc.php +++ b/inc/privacy_functions.inc.php @@ -67,6 +67,11 @@ function hesk_anonymizeTicket($id, $trackingID = null, $have_ticket = false) `subject` = '".hesk_dbEscape($hesklang['anon_subject'])."', `message` = '".hesk_dbEscape($hesklang['anon_message'])."', `ip` = '".hesk_dbEscape($hesklang['anon_IP'])."', + `latitude`= 'E-6', + `longitude`='E-6', + `user_agent`= '" . hesk_dbEscape($hesklang['anon_user_agent']) . "', + `screen_resolution_width`= '" . hesk_dbEscape($hesklang['anon_screen_resolution']) . "', + `screen_resolution_height`= '" . hesk_dbEscape($hesklang['anon_screen_resolution']) . "', "; for($i=1; $i<=50; $i++) { @@ -74,10 +79,10 @@ function hesk_anonymizeTicket($id, $trackingID = null, $have_ticket = false) } $sql .= " attachments='', - `history`=REPLACE(`history`, ' ".hesk_dbEscape(addslashes($ticket['name']))."', ' ".hesk_dbEscape($hesklang['anon_name'])."'), - `history`=CONCAT(`history`,'".hesk_dbEscape(sprintf($hesklang['thist18'],hesk_date(),$_SESSION['name'].' ('.$_SESSION['user'].')'))."') + `history`=REPLACE(`history`, ' ".hesk_dbEscape(addslashes($ticket['name']))."', ' ".hesk_dbEscape($hesklang['anon_name'])."') WHERE `id`='".intval($ticket['id'])."'"; hesk_dbQuery($sql); + mfh_anonymize_audit_trail_records($ticket['id'],'TICKET', $ticket['name']); // Anonymize replies hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` SET `name` = '".hesk_dbEscape($hesklang['anon_name'])."', `message` = '".hesk_dbEscape($hesklang['anon_message'])."', attachments='' WHERE `replyto`='".intval($ticket['id'])."'"); diff --git a/language/en/text-mfh.php b/language/en/text-mfh.php index 3202b5c8..cc7dd461 100644 --- a/language/en/text-mfh.php +++ b/language/en/text-mfh.php @@ -683,5 +683,11 @@ $hesklang['emails_to_receive'] = 'Emails to receive'; $hesklang['emails_sent_to_staff'] = 'Emails sent to staff'; $hesklang['emails_sent_to_customer'] = 'Emails sent to customer'; +// Added or modified in Mods for HESK 4.0.0 +$hesklang['audit_anonymized'] = '%s anonymized ticket'; +$hesklang['location_unavailable_6'] = "This ticket was anonymized, so location information has been removed."; +$hesklang['anon_user_agent'] = '[User Agent]'; +$hesklang['anon_screen_resolution'] = '0'; + // DO NOT CHANGE BELOW if (!defined('IN_SCRIPT')) die('PHP syntax OK!'); \ No newline at end of file