From a7742614df5c5e4ccd056d25ab01134c19ff2826 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 20 Nov 2017 22:16:46 -0500 Subject: [PATCH] Update pages for HESK 2.7.4 --- admin/admin_reply_ticket.php | 13 ++++++- admin/admin_settings_save.php | 1 + admin/admin_ticket.php | 3 +- admin/assign_owner.php | 3 +- admin/export.php | 2 +- admin/find_tickets.php | 13 ++++--- admin/index.php | 4 +- admin/manage_email_templates.php | 2 + admin/manage_knowledgebase.php | 8 +++- admin/move_category.php | 6 +-- admin/new_ticket.php | 4 +- admin/profile.php | 2 +- admin/reports.php | 2 +- api/BusinessLogic/Emails/BasicEmailSender.php | 4 ++ .../Emails/EmailTemplateParser.php | 16 ++++++++ api/Core/database.inc.php | 2 +- api/Core/database_mysqli.inc.php | 2 +- cron/core/database.inc.php | 2 +- cron/core/database_mysqli.inc.php | 2 +- inc/admin_functions.inc.php | 6 +-- inc/common.inc.php | 38 ++++++++++++++++++- inc/email_functions.inc.php | 36 +++++++++++++++--- inc/pipe_functions.inc.php | 2 +- inc/posting_functions.inc.php | 5 ++- index.php | 4 +- install/install_functions.inc.php | 2 +- internal-api/core/database.inc.php | 2 +- internal-api/core/database_mysqli.inc.php | 2 +- knowledgebase.php | 4 +- .../en/emails/html/new_reply_by_customer.txt | 2 +- .../en/emails/html/new_reply_by_staff.txt | 5 ++- language/en/emails/html/ticket_closed.txt | 2 +- language/en/emails/ticket_closed.txt | 3 +- language/en/text.php | 3 +- reply_ticket.php | 3 +- submit_ticket.php | 2 +- ticket.php | 4 +- 37 files changed, 161 insertions(+), 55 deletions(-) diff --git a/admin/admin_reply_ticket.php b/admin/admin_reply_ticket.php index 29a0d5c8..834ceb6c 100644 --- a/admin/admin_reply_ticket.php +++ b/admin/admin_reply_ticket.php @@ -294,6 +294,15 @@ $sql .= $submit_as_customer ? "`lastreplier`='0', `replierid`='0' " : "`lastrepl if ($time_worked == '00:00:00') { $sql .= ", `lastchange` = NOW() "; } else { + $parts = explode(':', $ticket['time_worked']); + $seconds = ($parts[0] * 3600) + ($parts[1] * 60) + $parts[2]; + + $parts = explode(':', $time_worked); + $seconds += ($parts[0] * 3600) + ($parts[1] * 60) + $parts[2]; + + require(HESK_PATH . 'inc/reporting_functions.inc.php'); + $ticket['time_worked'] = hesk_SecondsToHHMMSS($seconds); + $sql .= ",`time_worked` = ADDTIME(`time_worked`,'" . hesk_dbEscape($time_worked) . "') "; } @@ -363,7 +372,9 @@ $info = array( 'dt' => hesk_date($ticket['dt'], true), 'lastchange' => hesk_date($ticket['lastchange'], true), 'id' => $ticket['id'], - 'language' => $ticket['language'] + 'language' => $ticket['language'], + 'time_worked' => $ticket['time_worked'], + 'last_reply_by' => ($submit_as_customer ? $ticket['name'] : $_SESSION['name']), ); // 2. Add custom fields to the array diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php index 7113cd6f..ee1d8181 100644 --- a/admin/admin_settings_save.php +++ b/admin/admin_settings_save.php @@ -62,6 +62,7 @@ $set['noreply_mail'] = hesk_validateEmail(hesk_POST('s_noreply_mail'), $hesklang $set['noreply_name'] = hesk_input(hesk_POST('s_noreply_name')); $set['noreply_name'] = str_replace(array('\\"', '<', '>'), '', $set['noreply_name']); $set['noreply_name'] = trim(preg_replace('/\s{2,}/', ' ', $set['noreply_name'])); +$set['noreply_name'] = preg_replace("/\n|\r|\t|%0A|%0D|%08|%09/", '', $set['noreply_name']); /* --> Language settings */ $set['can_sel_lang'] = empty($_POST['s_can_sel_lang']) ? 0 : 1; diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index 0210de9d..978f8112 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -423,13 +423,14 @@ if (isset($_POST['notemsg']) && hesk_token_check('POST')) { 'trackid' => $ticket['trackid'], 'status' => $ticket['status'], 'name' => $_SESSION['name'], - 'lastreplier' => $ticket['lastreplier'], 'subject' => $ticket['subject'], 'message' => stripslashes($msg), 'dt' => hesk_date($ticket['dt'], true), 'lastchange' => hesk_date($ticket['lastchange'], true), 'attachments' => $myattachments, 'id' => $ticket['id'], + 'time_worked' => $ticket['time_worked'], + 'last_reply_by' => $ticket['repliername'], ); // 2. Add custom fields to the array diff --git a/admin/assign_owner.php b/admin/assign_owner.php index e875b2a5..e103e8aa 100755 --- a/admin/assign_owner.php +++ b/admin/assign_owner.php @@ -129,13 +129,14 @@ $info = array( 'trackid' => $ticket['trackid'], 'status' => $ticket['status'], 'name' => $ticket['name'], - 'lastreplier' => $ticket['lastreplier'], 'subject' => $ticket['subject'], 'message' => $ticket['message'], 'attachments' => $ticket['attachments'], 'dt' => hesk_date($ticket['dt'], true), 'lastchange' => hesk_date($ticket['lastchange'], true), 'id' => $ticket['id'], + 'time_worked' => $ticket['time_worked'], + 'last_reply_by' => hesk_getReplierName($ticket), ); // 2. Add custom fields to the array diff --git a/admin/export.php b/admin/export.php index 1e4e543e..c0a366e6 100644 --- a/admin/export.php +++ b/admin/export.php @@ -697,7 +697,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); () diff --git a/admin/find_tickets.php b/admin/find_tickets.php index c9bcd812..350bb27b 100644 --- a/admin/find_tickets.php +++ b/admin/find_tickets.php @@ -145,21 +145,21 @@ LEFT(`message`, 400) AS `message`, $sql .= " ( `trackid` = '" . hesk_dbEscape($q) . "' OR `merged` LIKE '%#" . hesk_dbEscape($q) . "#%' ) "; break; case 'name': - $sql .= "`name` LIKE '%" . hesk_dbEscape($q) . "%' COLLATE '" . hesk_dbCollate() . "' "; + $sql .= "`name` LIKE '%".hesk_dbEscape( hesk_dbLike($q) )."%' COLLATE '" . hesk_dbCollate() . "' "; break; case 'email': $sql .= "`email` LIKE '%" . hesk_dbEscape($q) . "%' "; break; case 'subject': - $sql .= "`subject` LIKE '%" . hesk_dbEscape($q) . "%' COLLATE '" . hesk_dbCollate() . "' "; + $sql .= "`subject` LIKE '%".hesk_dbEscape( hesk_dbLike($q) )."%' COLLATE '" . hesk_dbCollate() . "' "; break; case 'message': - $sql .= " ( `message` LIKE '%" . hesk_dbEscape($q) . "%' COLLATE '" . hesk_dbCollate() . "' + $sql .= " ( `message` LIKE '%".hesk_dbEscape( hesk_dbLike($q) )."%' COLLATE '" . hesk_dbCollate() . "' OR `id` IN ( SELECT DISTINCT `replyto` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` - WHERE `message` LIKE '%" . hesk_dbEscape($q) . "%' COLLATE '" . hesk_dbCollate() . "' ) + WHERE `message` LIKE '%".hesk_dbEscape( hesk_dbLike($q) )."%' COLLATE '" . hesk_dbCollate() . "' ) ) "; break; @@ -170,7 +170,7 @@ LEFT(`message`, 400) AS `message`, $sql .= "`id` IN ( SELECT DISTINCT `ticket` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` - WHERE `message` LIKE '%" . hesk_dbEscape($q) . "%' COLLATE '" . hesk_dbCollate() . "' ) + WHERE `message` LIKE '%".hesk_dbEscape( hesk_dbLike($q) )."%' COLLATE '" . hesk_dbCollate() . "' ) "; break; default: @@ -220,6 +220,9 @@ LEFT(`message`, 400) AS `message`, $sql_count .= $sql; $sql = $sql_final . $sql; + // Strip extra slashes + $q = stripslashes($q); + /* Prepare variables used in search and forms */ require_once(HESK_PATH . 'inc/prepare_ticket_search.inc.php'); ?> diff --git a/admin/index.php b/admin/index.php index ba7c4b00..aec1e374 100644 --- a/admin/index.php +++ b/admin/index.php @@ -158,7 +158,7 @@ function do_login() exit(); } - $pass_enc = hesk_Pass2Hash($_SESSION['pass'] . strtolower($user) . $_SESSION['pass']); + $pass_enc = hesk_Pass2Hash($_SESSION['pass'].hesk_mb_strtolower($user).$_SESSION['pass']); /* Check if default password */ if ($_SESSION['pass'] == '499d74967b28a841c98bb4baaabaad699ff3c079') { @@ -330,7 +330,7 @@ function print_login() - '; - $_SESSION['new']['email'] = hesk_validateEmail(hesk_POST('email'), 'ERR', 0) or $hesk_error_buffer = '
  • ' . $hesklang['enter_valid_email'] . '
  • '; + $_SESSION['new']['email'] = hesk_validateEmail( hesk_POST('email'), 'ERR', 0) or $hesk_error_buffer .= '
  • ' . $hesklang['enter_valid_email'] . '
  • '; $_SESSION['new']['signature'] = hesk_input(hesk_POST('signature')); /* Signature */ diff --git a/admin/reports.php b/admin/reports.php index 64d3ba00..e9f341a2 100644 --- a/admin/reports.php +++ b/admin/reports.php @@ -249,7 +249,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); ()
    -  
    ' . $hesklang['rart'] . ' - ' . strtolower($hesklang['yes']) . ' / - ' . strtolower($hesklang['no']) . ' + ' . hesk_mb_strtolower($hesklang['yes']) . ' / + ' . hesk_mb_strtolower($hesklang['no']) . '
    '; } diff --git a/language/en/emails/html/new_reply_by_customer.txt b/language/en/emails/html/new_reply_by_customer.txt index f0eb563d..79cc0a86 100644 --- a/language/en/emails/html/new_reply_by_customer.txt +++ b/language/en/emails/html/new_reply_by_customer.txt @@ -1,6 +1,6 @@

    Hello,

    A customer has just replied to ticket "%%SUBJECT%%".

    -

    You can manage this ticket here: +

    You can read the reply message and manage this ticket here: %%TRACK_URL%%

    Regards,

    %%SITE_TITLE%%
    diff --git a/language/en/emails/html/new_reply_by_staff.txt b/language/en/emails/html/new_reply_by_staff.txt index 1287b2b8..fcf1093a 100644 --- a/language/en/emails/html/new_reply_by_staff.txt +++ b/language/en/emails/html/new_reply_by_staff.txt @@ -1,8 +1,9 @@

    Dear %%NAME%%,

    -

    Our staff has just replied to your ticket "%%SUBJECT%%".

    -

    You can view the ticket here:

    +

    We have just replied to your ticket "%%SUBJECT%%".

    +

    To read the message, submit a reply and view details, please visit:

    %%TRACK_URL%%

    +

    If the above link is not clickable, try copying and pasting it into the address bar of your web browser.

    Sincerely,

    %%SITE_TITLE%%
    diff --git a/language/en/emails/html/ticket_closed.txt b/language/en/emails/html/ticket_closed.txt index f547ba76..10220a1a 100644 --- a/language/en/emails/html/ticket_closed.txt +++ b/language/en/emails/html/ticket_closed.txt @@ -1,8 +1,8 @@

    Dear %%NAME%%,

    Your support ticket "%%SUBJECT%%" has been updated to a closed/resolved status.

    -

    Ticket tracking ID: %%TRACK_ID%%

    You can view the status of your ticket here: %%TRACK_URL%%

    +

    If the above link is not clickable, try copying and pasting it into the address bar of your web browser.

    Sincerely,

    %%SITE_TITLE%%
    %%SITE_URL%% \ No newline at end of file diff --git a/language/en/emails/ticket_closed.txt b/language/en/emails/ticket_closed.txt index 51cfb97c..33a94afd 100644 --- a/language/en/emails/ticket_closed.txt +++ b/language/en/emails/ticket_closed.txt @@ -2,11 +2,10 @@ Dear %%NAME%%, Your support ticket "%%SUBJECT%%" has been updated to a closed/resolved status. -Ticket tracking ID: %%TRACK_ID%% - You can view the status of your ticket here: %%TRACK_URL%% +If the above link is not clickable, try copying and pasting it into the address bar of your web browser. Sincerely, diff --git a/language/en/text.php b/language/en/text.php index d543ccd3..042a2130 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -1239,7 +1239,7 @@ $hesklang['cat_pri_ch']='Category priority has been set to:'; $hesklang['err_dbversion']='Too old MySQL version:'; // %s will be replaced with MySQL version $hesklang['signature_max']='Signature (max 1000 chars)'; $hesklang['signature_long']='User signature is too long! Please limit the signature to 1000 chars'; -$hesklang['ip_whois']='IP whois'; +$hesklang['ip_whois']='IP WHOIS'; $hesklang['ednote']='Edit note message'; $hesklang['ednote2']='Note message saved'; $hesklang['perm_deny']='Permission denied'; @@ -1284,7 +1284,6 @@ $hesklang['click_unban']='Click here to unban.'; $hesklang['banip_intro']='Visitors from banned IP addresses will not be able to view or submit tickets and login into the help desk.'; $hesklang['ipperm']='Permanent IP bans:'; $hesklang['iptemp']='Login failure bans:'; -$hesklang['savebanip']='Ban this IP'; $hesklang['no_banips']='No IPs are being banned.'; $hesklang['bananip']='IP address to ban'; $hesklang['banex']='Examples:'; diff --git a/reply_ticket.php b/reply_ticket.php index 499f3d1f..0760ac06 100644 --- a/reply_ticket.php +++ b/reply_ticket.php @@ -206,13 +206,14 @@ $info = array( 'trackid' => $ticket['trackid'], 'status' => $ticket['status'], 'name' => $ticket['name'], - 'lastreplier' => $ticket['name'], 'subject' => $ticket['subject'], 'message' => stripslashes($message), 'attachments' => $myattachments, 'dt' => hesk_date($ticket['dt'], true), 'lastchange' => hesk_date($ticket['lastchange'], true), 'id' => $ticket['id'], + 'time_worked' => $ticket['time_worked'], + 'last_reply_by' => $ticket['name'], ); // 2. Add custom fields to the array diff --git a/submit_ticket.php b/submit_ticket.php index 06090ef6..d11f5225 100644 --- a/submit_ticket.php +++ b/submit_ticket.php @@ -73,7 +73,7 @@ if ($hesk_settings['question_use']) { if (strlen($question) == 0) { $hesk_error_buffer['question'] = $hesklang['q_miss']; - } elseif (strtolower($question) != strtolower($hesk_settings['question_ans'])) { + } elseif (hesk_mb_strtolower($question) != hesk_mb_strtolower($hesk_settings['question_ans'])) { $hesk_error_buffer['question'] = $hesklang['q_wrng']; } else { $_SESSION['c_question'] = $question; diff --git a/ticket.php b/ticket.php index 2d7197b4..cb7ef11b 100644 --- a/ticket.php +++ b/ticket.php @@ -722,8 +722,8 @@ function hesk_printCustomerTicketReplies() echo '
    ' . $hesklang['r'] . ' - ' . strtolower($hesklang['yes']) . ' / - ' . strtolower($hesklang['no']) . ' + ' . hesk_mb_strtolower($hesklang['yes']) . ' / + ' . hesk_mb_strtolower($hesklang['no']) . '
    '; }