From 8719c51a80e042289a11b7f52b7c4229767763ed Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 25 Aug 2015 22:18:27 -0400 Subject: [PATCH 01/29] #327 Add SQL to insert all records to DB --- install/mods-for-hesk/sql/installSql.php | 47 ++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index 226575e9..ac2a6e6e 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -676,4 +676,51 @@ $modsForHesk_settings[\'rich_text_for_tickets_for_customers\'] = 0;'; } return file_put_contents(HESK_PATH.'modsForHesk_settings.inc.php', $file); +} +// END Version 2.4.1 + +// BEGIN Version 2.5.0 +function migrateSettings() { + global $hesk_settings; + + if (file_exists(HESK_PATH . 'modsForHesk_settings.inc.php')) { + require_once(HESK_PATH . 'modsForHesk_settings.inc.php'); + + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('rtl', '".intval($modsForHesk_settings['rtl'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('show_icons', '".intval($modsForHesk_settings['show_icons'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('custom_field_setting', '".intval($modsForHesk_settings['custom_field_setting'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('customer_email_verification_required', '".intval($modsForHesk_settings['customer_email_verification_required'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('html_emails', '".intval($modsForHesk_settings['html_emails'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('use_mailgun', '".intval($modsForHesk_settings['use_mailgun'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('mailgun_api_key', '".intval($modsForHesk_settings['mailgun_api_key'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('mailgun_domain', '".intval($modsForHesk_settings['mailgun_domain'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('use_bootstrap_theme', '".intval($modsForHesk_settings['use_bootstrap_theme'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('new_kb_article_visibility', '".intval($modsForHesk_settings['new_kb_article_visibility'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('attachments', '".intval($modsForHesk_settings['attachments'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('show_number_merged', '".intval($modsForHesk_settings['show_number_merged'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('request_location', '".intval($modsForHesk_settings['request_location'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('category_order_column', '".intval($modsForHesk_settings['category_order_column'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('rich_text_for_tickets', '".intval($modsForHesk_settings['rich_text_for_tickets'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('statuses_order_column', '".intval($modsForHesk_settings['statuses_order_column'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('kb_attach_dir', '".intval($modsForHesk_settings['kb_attach_dir'])."')"); + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) + VALUES ('rich_text_for_tickets_for_customers', '".intval($modsForHesk_settings['rich_text_for_tickets_for_customers'])."')"); + } } \ No newline at end of file From cf6e3819890892d8a9c7808dce1c7f0835888ced Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 27 Aug 2015 16:57:18 -0400 Subject: [PATCH 02/29] #327 Make sure the setting exists. Otherwise give it a default value --- install/mods-for-hesk/sql/installSql.php | 60 +++++++++++++++++------- 1 file changed, 42 insertions(+), 18 deletions(-) diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index ac2a6e6e..d83b7bc2 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -686,41 +686,65 @@ function migrateSettings() { if (file_exists(HESK_PATH . 'modsForHesk_settings.inc.php')) { require_once(HESK_PATH . 'modsForHesk_settings.inc.php'); + $rtl = getSettingValue($modsForHesk_settings, 'rtl', 0); + $show_icons = getSettingValue($modsForHesk_settings, 'show_icons', 0); + $custom_field_setting = getSettingValue($modsForHesk_settings, 'custom_field_setting', 0); + $customer_email_verification_required = getSettingValue($modsForHesk_settings, 'customer_email_verification_required', 0); + $html_emails = getSettingValue($modsForHesk_settings, 'html_emails', 1); + $use_mailgun = getSettingValue($modsForHesk_settings, 'use_mailgun', 0); + $mailgun_api_key = getSettingValue($modsForHesk_settings, 'mailgun_api_key', ''); + $mailgun_domain = getSettingValue($modsForHesk_settings, 'mailgun_domain', ''); + $use_bootstrap_theme = getSettingValue($modsForHesk_settings, 'use_bootstrap_theme', 1); + $new_kb_article_visibility = getSettingValue($modsForHesk_settings, 'new_kb_article_visibility', 0); + $attachments = getSettingValue($modsForHesk_settings, 'attachments', 0); + $show_number_merged = getSettingValue($modsForHesk_settings, 'show_number_merged', 1); + $request_location = getSettingValue($modsForHesk_settings, 'request_location', 0); + $category_order_column = getSettingValue($modsForHesk_settings, 'category_order_column', 'cat_order'); + $rich_text_for_tickets = getSettingValue($modsForHesk_settings, 'rich_text_for_tickets', 0); + $statuses_order_column = getSettingValue($modsForHesk_settings, 'statuses_order_column', 'sort'); + $kb_attach_dir = getSettingValue($modsForHesk_settings, 'kb_attach_dir', 'attachments'); + $rich_text_for_tickets_for_customers = getSettingValue($modsForHesk_settings, 'rich_text_for_tickets_for_customers', 0); + + executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('rtl', '".intval($modsForHesk_settings['rtl'])."')"); + VALUES ('rtl', ".intval($rtl).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('show_icons', '".intval($modsForHesk_settings['show_icons'])."')"); + VALUES ('show_icons', ".intval($show_icons).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('custom_field_setting', '".intval($modsForHesk_settings['custom_field_setting'])."')"); + VALUES ('custom_field_setting', ".intval($custom_field_setting).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('customer_email_verification_required', '".intval($modsForHesk_settings['customer_email_verification_required'])."')"); + VALUES ('customer_email_verification_required', ".intval($customer_email_verification_required).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('html_emails', '".intval($modsForHesk_settings['html_emails'])."')"); + VALUES ('html_emails', ".intval($html_emails).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('use_mailgun', '".intval($modsForHesk_settings['use_mailgun'])."')"); + VALUES ('use_mailgun', ".intval($use_mailgun).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('mailgun_api_key', '".intval($modsForHesk_settings['mailgun_api_key'])."')"); + VALUES ('mailgun_api_key', '".hesk_dbEscape($mailgun_api_key)."')"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('mailgun_domain', '".intval($modsForHesk_settings['mailgun_domain'])."')"); + VALUES ('mailgun_domain', '".hesk_dbEscape($mailgun_domain)."')"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('use_bootstrap_theme', '".intval($modsForHesk_settings['use_bootstrap_theme'])."')"); + VALUES ('use_bootstrap_theme', ".intval($use_bootstrap_theme).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('new_kb_article_visibility', '".intval($modsForHesk_settings['new_kb_article_visibility'])."')"); + VALUES ('new_kb_article_visibility', ".intval($new_kb_article_visibility).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('attachments', '".intval($modsForHesk_settings['attachments'])."')"); + VALUES ('attachments', ".intval($attachments).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('show_number_merged', '".intval($modsForHesk_settings['show_number_merged'])."')"); + VALUES ('show_number_merged', ".intval($show_number_merged).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('request_location', '".intval($modsForHesk_settings['request_location'])."')"); + VALUES ('request_location', ".intval($request_location).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('category_order_column', '".intval($modsForHesk_settings['category_order_column'])."')"); + VALUES ('category_order_column', '".hesk_dbEscape($category_order_column)."')"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('rich_text_for_tickets', '".intval($modsForHesk_settings['rich_text_for_tickets'])."')"); + VALUES ('rich_text_for_tickets', ".intval($rich_text_for_tickets).")"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('statuses_order_column', '".intval($modsForHesk_settings['statuses_order_column'])."')"); + VALUES ('statuses_order_column', '".hesk_dbEscape($statuses_order_column)."')"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('kb_attach_dir', '".intval($modsForHesk_settings['kb_attach_dir'])."')"); + VALUES ('kb_attach_dir', '".hesk_dbEscape($kb_attach_dir)."')"); executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`) - VALUES ('rich_text_for_tickets_for_customers', '".intval($modsForHesk_settings['rich_text_for_tickets_for_customers'])."')"); + VALUES ('rich_text_for_tickets_for_customers', ".intval($rich_text_for_tickets_for_customers).")"); } +} + +function getSettingValue($settings, $setting, $default) { + return isset($settings[$setting]) ? $settings[$setting] : $default; } \ No newline at end of file From 57c3e6aaa649ad37045416f6e4fc341878b13387 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 27 Aug 2015 17:35:17 -0400 Subject: [PATCH 03/29] #327 Remove modsForHesk_settings.inc.php --- modsForHesk_settings.inc.php | 64 ------------------------------------ 1 file changed, 64 deletions(-) delete mode 100644 modsForHesk_settings.inc.php diff --git a/modsForHesk_settings.inc.php b/modsForHesk_settings.inc.php deleted file mode 100644 index ea14f874..00000000 --- a/modsForHesk_settings.inc.php +++ /dev/null @@ -1,64 +0,0 @@ - Date: Fri, 28 Aug 2015 22:04:21 -0400 Subject: [PATCH 04/29] #327 Add method for getting MFH settings --- inc/common.inc.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/inc/common.inc.php b/inc/common.inc.php index 8fe783c0..81b9b2b8 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -1982,4 +1982,15 @@ function mfh_getNumberOfDownloadsForAttachment($att_id, $table='attachments') $res = hesk_dbQuery('SELECT `download_count` FROM `'.hesk_dbEscape($hesk_settings['db_pfix'].$table)."` WHERE `att_id` = ".intval($att_id)); $rec = hesk_dbFetchAssoc($res); return $rec['download_count']; +} + +function mfh_getSettings() { + global $hesk_settings; + + $settings = array(); + $res = hesk_dbQuery("SELECT `Key`, `Value` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` WHERE `Key` <> 'version'"); + while ($row = hesk_dbFetchAssoc($res)) { + $settings[$row['Key']] = $row['Value']; + } + return $settings; } \ No newline at end of file From 6d9362ed4d872d7287190b286f97fe18327fbbab Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Fri, 28 Aug 2015 22:24:25 -0400 Subject: [PATCH 05/29] #327 Fix query, use DB settings on index page --- inc/common.inc.php | 2 +- inc/header.inc.php | 6 +++++- index.php | 4 ++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/inc/common.inc.php b/inc/common.inc.php index 81b9b2b8..e676d214 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -1988,7 +1988,7 @@ function mfh_getSettings() { global $hesk_settings; $settings = array(); - $res = hesk_dbQuery("SELECT `Key`, `Value` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` WHERE `Key` <> 'version'"); + $res = hesk_dbQuery("SELECT `Key`, `Value` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` WHERE `Key` <> 'modsForHeskVersion'"); while ($row = hesk_dbFetchAssoc($res)) { $settings[$row['Key']] = $row['Value']; } diff --git a/inc/header.inc.php b/inc/header.inc.php index 14a67eb0..272e0da1 100644 --- a/inc/header.inc.php +++ b/inc/header.inc.php @@ -34,7 +34,11 @@ /* Check if this is a valid include */ if (!defined('IN_SCRIPT')) {die('Invalid attempt');} -require(HESK_PATH . 'modsForHesk_settings.inc.php'); +if (!function_exists('mfh_getSettings')) { + die('Mods for HESK settings are not accessible!'); +} + +$modsForHesk_settings = mfh_getSettings(); ?> diff --git a/index.php b/index.php index b9344982..5469b558 100644 --- a/index.php +++ b/index.php @@ -38,12 +38,12 @@ define('WYSIWYG',1); // Get all the required files and functions require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); +hesk_load_database_functions(); +hesk_dbConnect(); // Are we in maintenance mode? hesk_check_maintenance(); -hesk_load_database_functions(); // Are we in "Knowledgebase only" mode? hesk_check_kb_only(); From 379d096f88e95ed3cabccc990469de9521c653a0 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 29 Aug 2015 21:29:01 -0400 Subject: [PATCH 06/29] #331 Update admin_settings_save --- admin/admin_settings_save.php | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php index cd9e186c..54f38115 100644 --- a/admin/admin_settings_save.php +++ b/admin/admin_settings_save.php @@ -35,6 +35,12 @@ define('IN_SCRIPT',1); define('HESK_PATH','../'); +// Make sure OPcache is reset when modifying settings +if ( function_exists('opcache_reset') ) +{ + opcache_reset(); +} + /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); require(HESK_PATH . 'modsForHesk_settings.inc.php'); @@ -108,7 +114,7 @@ else /* --> Helpdesk settings */ $set['hesk_title'] = hesk_input( hesk_POST('s_hesk_title'), $hesklang['err_htitle']); $set['hesk_title'] = str_replace('\\"','"',$set['hesk_title']); -$set['hesk_url'] = hesk_input( hesk_POST('s_hesk_url'), $hesklang['err_hurl']); +$set['hesk_url'] = rtrim( hesk_input( hesk_POST('s_hesk_url'), $hesklang['err_hurl']), '/'); // ---> check admin folder $set['admin_dir'] = isset($_POST['s_admin_dir']) && ! is_array($_POST['s_admin_dir']) ? preg_replace('/[^a-zA-Z0-9_-]/', '', $_POST['s_admin_dir']) : 'admin'; @@ -487,6 +493,19 @@ for ($i=1;$i<=20;$i++) { $set['custom_fields'][$this_field]['type'] = 'text'; } + + // Try to detect if field type changed to anything except "select" + if ($set['custom_fields'][$this_field]['type'] != 'select') + { + // If type is "radio" or "checkbox" remove "please select", keep other options + $set['custom_fields'][$this_field]['value'] = str_replace('{HESK_SELECT}', '', $set['custom_fields'][$this_field]['value']); + + // Field type changed to "text" or "textarea", clear default value if it contains "#HESK#" separator + if ( in_array($set['custom_fields'][$this_field]['type'], array('text','textarea')) && ! in_array($hesk_settings['custom_fields'][$this_field]['type'], array('text','textarea')) && strpos($set['custom_fields'][$this_field]['value'], '#HESK#') !== false ) + { + $set['custom_fields'][$this_field]['value'] = ''; + } + } } else { From 3619a4c5075f9680df09dd6ac8fc68a76f8211ce Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 29 Aug 2015 21:29:12 -0400 Subject: [PATCH 07/29] #331 Update password --- admin/password.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/admin/password.php b/admin/password.php index 4811a896..754a5736 100644 --- a/admin/password.php +++ b/admin/password.php @@ -238,6 +238,9 @@ elseif ( isset($_GET['h']) ) // Expire all verification hashes for this user hesk_dbQuery("DELETE FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."reset_password` WHERE `user`=".intval($row['user'])); + // Load additional required functions + require(HESK_PATH . 'inc/admin_functions.inc.php'); + // Get user details $res = hesk_dbQuery('SELECT * FROM `'.$hesk_settings['db_pfix']."users` WHERE `id`=".intval($row['user'])." LIMIT 1"); $row = hesk_dbFetchAssoc($res); @@ -245,6 +248,11 @@ elseif ( isset($_GET['h']) ) { $_SESSION[$k]=$v; } + + // Set a tag that will be used to expire sessions after username or password change + $_SESSION['session_verify'] = hesk_activeSessionCreateTag($_SESSION['user'], $_SESSION['pass']); + + // We don't need the password hash anymore unset($_SESSION['pass']); // Clean brute force attempts From a0958641ff0416f1e8456fc30fa7527f992817af Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 29 Aug 2015 21:29:22 -0400 Subject: [PATCH 08/29] #331 Update admin_functions --- inc/admin_functions.inc.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/inc/admin_functions.inc.php b/inc/admin_functions.inc.php index 03224155..c518dd99 100644 --- a/inc/admin_functions.inc.php +++ b/inc/admin_functions.inc.php @@ -758,13 +758,13 @@ function hesk_checkPermission($feature,$showerror=1) { global $hesklang; /* Admins have full access to all features */ - if ($_SESSION['isadmin']) + if (isset($_SESSION['isadmin']) && $_SESSION['isadmin']) { return true; } /* Check other staff for permissions */ - if (strpos($_SESSION['heskprivileges'], $feature) === false) + if (isset($_SESSION['heskprivileges']) && strpos($_SESSION['heskprivileges'], $feature) === false) { if ($showerror) { From f3d84cf361ab757a3bf6e4e9d7cea36cf1cd9531 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 29 Aug 2015 21:29:35 -0400 Subject: [PATCH 09/29] #331 Update common --- inc/common.inc.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/inc/common.inc.php b/inc/common.inc.php index 8fe783c0..f033a92e 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -37,6 +37,12 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');} #error_reporting(E_ALL); +// Set correct Content-Type header +if ( ! defined('NO_HTTP_HEADER') ) +{ + header('Content-Type: text/html; charset=utf-8'); +} + // Set backslash options if (get_magic_quotes_gpc()) { From b774572766026d01562feb0c94035201f3f9bd55 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 29 Aug 2015 21:30:20 -0400 Subject: [PATCH 10/29] #331 Update email_functions --- inc/email_functions.inc.php | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/inc/email_functions.inc.php b/inc/email_functions.inc.php index fc335c19..134c484d 100644 --- a/inc/email_functions.inc.php +++ b/inc/email_functions.inc.php @@ -104,7 +104,7 @@ function hesk_notifyCustomer($email_template = 'new_ticket') $changedLanguage = false; //Set the user's language according to the ticket. - if ($ticket['language'] !== NULL) + if (isset($ticket['language']) && $ticket['language'] !== NULL) { hesk_setLanguage($ticket['language']); $changedLanguage = true; @@ -135,10 +135,7 @@ function hesk_notifyCustomer($email_template = 'new_ticket') hesk_mail($ticket['email'], $subject, $message, $htmlMessage, $ccEmails, $bccEmails, $hasMessage); // Reset the language if it was changed - if ($changedLanguage) - { - hesk_resetLanguage(); - } + hesk_resetLanguage(); return true; From 39a49b9cf510e6f7db58c8375969c2a7edd86f97 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 29 Aug 2015 21:31:36 -0400 Subject: [PATCH 11/29] #331 Update recaptchalib --- inc/recaptcha/recaptchalib_v2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/recaptcha/recaptchalib_v2.php b/inc/recaptcha/recaptchalib_v2.php index 9b035ada..4fdae35f 100755 --- a/inc/recaptcha/recaptchalib_v2.php +++ b/inc/recaptcha/recaptchalib_v2.php @@ -52,7 +52,7 @@ class ReCaptcha * * @param string $secret shared secret between site and ReCAPTCHA server. */ - function ReCaptcha($secret) + function __construct($secret) { if ($secret == null || $secret == "") { die("To use reCAPTCHA you must get an API key from Date: Sat, 29 Aug 2015 22:10:10 -0400 Subject: [PATCH 14/29] Closes #323 Don't add additional line breaks in HTML messages --- admin/edit_post.php | 6 ++++-- reply_ticket.php | 2 +- submit_ticket.php | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/admin/edit_post.php b/admin/edit_post.php index 2a399819..d2cdaf94 100644 --- a/admin/edit_post.php +++ b/admin/edit_post.php @@ -114,8 +114,10 @@ if (isset($_POST['save'])) hesk_error($myerror); } - $tmpvar['message'] = hesk_makeURL($tmpvar['message']); - $tmpvar['message'] = nl2br($tmpvar['message']); + if (!$modsForHesk_settings['rich_text_for_tickets']) { + $tmpvar['message'] = hesk_makeURL($tmpvar['message']); + $tmpvar['message'] = nl2br($tmpvar['message']); + } hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` SET `message`='".hesk_dbEscape($tmpvar['message'])."' WHERE `id`='".intval($tmpvar['id'])."' AND `replyto`='".intval($ticket['id'])."' LIMIT 1"); } diff --git a/reply_ticket.php b/reply_ticket.php index 435a345b..eaacd090 100644 --- a/reply_ticket.php +++ b/reply_ticket.php @@ -78,7 +78,7 @@ $my_email = hesk_getCustomerEmail(); $message = hesk_input( hesk_POST('message') ); // If the message was entered, further parse it -if ( strlen($message) ) +if ( strlen($message) && !$modsForHesk_settings['rich_text_for_tickets_for_customers'] ) { // Make links clickable $message = hesk_makeURL($message); diff --git a/submit_ticket.php b/submit_ticket.php index 5eedc331..3b10688f 100644 --- a/submit_ticket.php +++ b/submit_ticket.php @@ -412,8 +412,10 @@ if (count($hesk_error_buffer)) hesk_process_messages($hesk_error_buffer, 'index.php?a=add'); } -$tmpvar['message']=hesk_makeURL($tmpvar['message']); -$tmpvar['message']=nl2br($tmpvar['message']); +if (!$modsForHesk_settings['rich_text_for_tickets_for_customers']) { + $tmpvar['message']=hesk_makeURL($tmpvar['message']); + $tmpvar['message']=nl2br($tmpvar['message']); +} // Track suggested knowledgebase articles if ($hesk_settings['kb_enable'] && $hesk_settings['kb_recommendanswers'] && isset($_POST['suggested']) && is_array($_POST['suggested']) ) From 8c3324ead691b636eacbf77af5b39e90a49cffcc Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sat, 29 Aug 2015 22:26:44 -0400 Subject: [PATCH 15/29] #334 Fix escaping on ticket templates page --- admin/manage_ticket_templates.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/admin/manage_ticket_templates.php b/admin/manage_ticket_templates.php index 8ff7d655..caa31ae0 100644 --- a/admin/manage_ticket_templates.php +++ b/admin/manage_ticket_templates.php @@ -133,7 +133,9 @@ $num = hesk_dbNumRows($result); $options .= '>'.$mysaved['title'].''; if ($modsForHesk_settings['rich_text_for_tickets']) { - $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", html_entity_decode($mysaved['message'] ))."';\n"; + $theMessage = html_entity_decode($mysaved['message']); + $theMessage = addslashes($theMessage); + $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", $theMessage)."';\n"; } else { $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved['message']) )."';\n"; } From 63f0199f9ea1450290fd2106ef1ab18599a2e2bb Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 30 Aug 2015 12:03:43 -0400 Subject: [PATCH 16/29] #334 Properly escape quotes in canned responses/ticket templates --- admin/admin_ticket.php | 4 +++- admin/manage_canned.php | 4 +++- admin/new_ticket.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index 35aca09b..6023d5a0 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -1973,7 +1973,9 @@ function hesk_printCanned() { $can_options .= '\n"; if ($modsForHesk_settings['rich_text_for_tickets']) { - echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", hesk_html_entity_decode($mysaved[2]))."';\n"; + $theMessage = hesk_html_entity_decode($mysaved[2]); + $theMessage = addslashes($theMessage); + echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", $theMessage)."';\n"; } else { echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[2]))."';\n"; } diff --git a/admin/manage_canned.php b/admin/manage_canned.php index 19c38d66..b851c67a 100644 --- a/admin/manage_canned.php +++ b/admin/manage_canned.php @@ -161,7 +161,9 @@ function hesk_insertAtCursor(myField, myValue) { $javascript_titles.='myTitle['.$mysaved['id'].']=\''.addslashes($mysaved['title'])."';\n"; if ($modsForHesk_settings['rich_text_for_tickets']) { - $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", hesk_html_entity_decode($mysaved['message']) )."';\n"; + $theMessage = hesk_html_entity_decode($mysaved['message']); + $theMessage = addslashes($theMessage); + $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", $theMessage )."';\n"; } else { $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved['message']) )."';\n"; } diff --git a/admin/new_ticket.php b/admin/new_ticket.php index 6b266304..b50c7b41 100644 --- a/admin/new_ticket.php +++ b/admin/new_ticket.php @@ -572,7 +572,9 @@ if (!$show['show']) { { $can_options .= '\n"; if ($modsForHesk_settings['rich_text_for_tickets']) { - echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", hesk_html_entity_decode($mysaved[2]))."';\n"; + $theMessage = hesk_html_entity_decode($mysaved[2]); + $theMessage = addslashes($theMessage); + echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", $theMessage)."';\n"; } else { echo 'myMsgTxt['.$mysaved[0].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved[2]))."';\n"; } From 6cbd9e7913f7796a6141cc9e9f4993d8d24d7793 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 30 Aug 2015 22:07:41 -0400 Subject: [PATCH 17/29] Update installer --- install/install_functions.inc.php | 2 +- .../ajax/install-database-ajax.php | 2 ++ install/mods-for-hesk/installModsForHesk.php | 6 ++++ install/mods-for-hesk/js/version-scripts.js | 3 ++ install/mods-for-hesk/modsForHesk.php | 35 ++++++++++++------- install/mods-for-hesk/sql/installSql.php | 10 ++++++ 6 files changed, 45 insertions(+), 13 deletions(-) diff --git a/install/install_functions.inc.php b/install/install_functions.inc.php index da8d961a..e1e85b76 100644 --- a/install/install_functions.inc.php +++ b/install/install_functions.inc.php @@ -37,7 +37,7 @@ if (!defined('IN_SCRIPT')) {die('Invalid attempt');} // We will be installing this HESK version: define('HESK_NEW_VERSION','2.6.5'); -define('MODS_FOR_HESK_NEW_VERSION','2.4.1'); +define('MODS_FOR_HESK_NEW_VERSION','2.4.2'); define('REQUIRE_PHP_VERSION','5.0.0'); define('REQUIRE_MYSQL_VERSION','5.0.7'); diff --git a/install/mods-for-hesk/ajax/install-database-ajax.php b/install/mods-for-hesk/ajax/install-database-ajax.php index c401bf4f..dd4a913a 100644 --- a/install/mods-for-hesk/ajax/install-database-ajax.php +++ b/install/mods-for-hesk/ajax/install-database-ajax.php @@ -51,6 +51,8 @@ if ($version == 1) { } elseif ($version == 241) { execute241Scripts(); execute241FileUpdate(); +} elseif ($version == 242) { + execute242Scripts(); } else { $response = 'The version "'.$version.'" was not recognized. Check the value submitted and try again.'; print $response; diff --git a/install/mods-for-hesk/installModsForHesk.php b/install/mods-for-hesk/installModsForHesk.php index ac5ff53d..3aeabd36 100644 --- a/install/mods-for-hesk/installModsForHesk.php +++ b/install/mods-for-hesk/installModsForHesk.php @@ -61,6 +61,12 @@ function echoInitialVersionRows($version) { if ($version < 240) { printRow('v2.4.0'); } + if ($version < 241) { + printRow('v2.4.1'); + } + if ($version < 242) { + printRow('v2.4.2'); + } } function printRow($version) { diff --git a/install/mods-for-hesk/js/version-scripts.js b/install/mods-for-hesk/js/version-scripts.js index d235b9e4..4abe53bb 100644 --- a/install/mods-for-hesk/js/version-scripts.js +++ b/install/mods-for-hesk/js/version-scripts.js @@ -53,6 +53,9 @@ function processUpdates(startingVersion) { } else if (startingVersion < 241) { startVersionUpgrade('241'); executeUpdate(241, '241', '2.4.1'); + } else if (startingVersion < 242) { + startVersionUpgrade('242'); + executeUpdate(242, '242', '2.4.2'); } else { installationFinished(); } diff --git a/install/mods-for-hesk/modsForHesk.php b/install/mods-for-hesk/modsForHesk.php index 9f9e90c8..33b658b6 100644 --- a/install/mods-for-hesk/modsForHesk.php +++ b/install/mods-for-hesk/modsForHesk.php @@ -137,6 +137,17 @@ hesk_dbConnect(); } ?> +
+
-
-
-
+
+
+
-
-
-
+
+
+
-
-
-
-
- v1.4.0 -

+
+ v1.4.0 +
diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index 226575e9..8d477b71 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -676,4 +676,14 @@ $modsForHesk_settings[\'rich_text_for_tickets_for_customers\'] = 0;'; } return file_put_contents(HESK_PATH.'modsForHesk_settings.inc.php', $file); +} +// END Version 2.4.1 + +// Version 2.4.2 +function execute242Scripts() { + global $hesk_settings; + + hesk_dbConnect(); + + executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.4.2' WHERE `Key` = 'modsForHeskVersion'"); } \ No newline at end of file From f38bff6e0c7baadb70bd08f3e18d1a3c7be4c142 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 31 Aug 2015 07:57:24 -0400 Subject: [PATCH 18/29] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index fd837659..7e8aab45 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ [![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/mkoch227/Mods-for-HESK/blob/master/LICENSE) [![Join the chat at https://gitter.im/mkoch227/Mods-for-HESK](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mkoch227/Mods-for-HESK?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -Mods for HESK is a set of modifications for [HESK](http://www.hesk.com) v2.6.4, a free and popular helpdesk solution. +Mods for HESK is a set of modifications for [HESK](http://www.hesk.com) v2.6.5, a free and popular helpdesk solution. ## Features From 77489d8eefcae68190495796c7736596bc4fd57f Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Mon, 31 Aug 2015 12:59:37 -0400 Subject: [PATCH 19/29] #330 Add MESSAGE_NO_ATTACHMENTS tag --- admin/manage_email_templates.php | 1 + inc/email_functions.inc.php | 11 +++++++++++ language/en/text.php | 3 +++ 3 files changed, 15 insertions(+) diff --git a/admin/manage_email_templates.php b/admin/manage_email_templates.php index 7adedae1..b22ffa03 100644 --- a/admin/manage_email_templates.php +++ b/admin/manage_email_templates.php @@ -289,6 +289,7 @@ function getSpecialTagMap() { $map['%%EMAIL%%'] = $hesklang['customer_email']; $map['%%SUBJECT%%'] = $hesklang['ticket_subject']; $map['%%MESSAGE%%'] = $hesklang['ticket_message']; + $map['%%MESSAGE_NO_ATTACHMENTS%%'] = $hesklang['ticket_message_no_attachments']; $map['%%CREATED%%'] = $hesklang['ticket_created']; $map['%%UPDATED%%'] = $hesklang['ticket_updated']; $map['%%TRACK_ID%%'] = $hesklang['ticket_trackID']; diff --git a/inc/email_functions.inc.php b/inc/email_functions.inc.php index 6b3ad2ba..474a8cec 100644 --- a/inc/email_functions.inc.php +++ b/inc/email_functions.inc.php @@ -738,8 +738,10 @@ function hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message if ($isForHtml) { $htmlMessage = nl2br($ticket['message']); + $msg = str_replace('%%MESSAGE_NO_ATTACHMENTS%%', $htmlMessage, $msg); return str_replace('%%MESSAGE%%', $htmlMessage, $msg); } + $msg = str_replace('%%MESSAGE_NO_ATTACHMENTS%%', $ticket['message'], $msg); return str_replace('%%MESSAGE%%', $ticket['message'], $msg); } else @@ -863,6 +865,15 @@ function hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message { $msg = $hesklang['EMAIL_HR'] . "\n\n" . $msg; } + } elseif (strpos($msg, '%%MESSAGE_NO_ATTACHMENTS%%') !== false) { + if ($isForHtml) + { + $htmlMessage = nl2br($ticket['message']); + $msg = str_replace('%%MESSAGE_NO_ATTACHMENTS%%', $htmlMessage, $msg); + } else + { + $msg = str_replace('%%MESSAGE_NO_ATTACHMENTS%%',$ticket['message'],$msg); + } } return $msg; diff --git a/language/en/text.php b/language/en/text.php index 017d3845..8b1b0fee 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -21,6 +21,9 @@ $hesklang['_COLLATE']='utf8_unicode_ci'; // This is the email break line that will be used in email piping $hesklang['EMAIL_HR']='------ Reply above this line ------'; +// ADDED OR MODIFIED IN Mods for HESK 2.5.0 +$hesklang['ticket_message_no_attachments'] = 'Ticket/Reply message, however attachments will not be included in the email'; + // ADDED OR MODIFIED IN Mods for HESK 2.4.0 $hesklang['sort_by_user_defined_order'] = 'Sort by user-defined order'; $hesklang['sort_alphabetically'] = 'Sort alphabetically'; From 22465d68dc4a6ebc6a7d2ddb5d21b71e7bd2d80a Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 1 Sep 2015 10:43:38 -0400 Subject: [PATCH 20/29] #327 Some more progress on moving settings to DB --- admin/admin_settings.php | 19 ------------------- admin/admin_settings_save.php | 1 + css/hesk_newStyle.php | 23 +++++++++++------------ download_attachment.php | 2 +- inc/header.inc.php | 2 +- install/mods-for-hesk/modsForHesk.php | 18 ------------------ print.php | 3 ++- 7 files changed, 16 insertions(+), 52 deletions(-) diff --git a/admin/admin_settings.php b/admin/admin_settings.php index d05a2a1b..28c662e1 100644 --- a/admin/admin_settings.php +++ b/admin/admin_settings.php @@ -254,25 +254,6 @@ if ( defined('HESK_DEMO') ) ?> - - - - -
- /modsForHesk_settings.inc.php - - '.$hesklang['exists'].', '.$hesklang['writable'].''; - } else { - echo ''.$hesklang['exists'].', '.$hesklang['not_writable'].'
'.$hesklang['e_mfh_settings']; - } - ?> -
diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php index cd9e186c..569d8819 100644 --- a/admin/admin_settings_save.php +++ b/admin/admin_settings_save.php @@ -504,6 +504,7 @@ foreach ($postArray as $value) { hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."quick_help_sections` SET `show` = '1' WHERE `id` = '".intval($value)."'"); } +//TODO change this to DB calls // Save the modsForHesk_settings.inc.php file $set['rtl'] = empty($_POST['rtl']) ? 0 : 1; $set['show-icons'] = empty($_POST['show-icons']) ? 0 : 1; diff --git a/css/hesk_newStyle.php b/css/hesk_newStyle.php index 0369b512..f758a48a 100644 --- a/css/hesk_newStyle.php +++ b/css/hesk_newStyle.php @@ -1,21 +1,20 @@ .nu-rtlFloatLeft { diff --git a/download_attachment.php b/download_attachment.php index dab63c42..c91ba3ee 100755 --- a/download_attachment.php +++ b/download_attachment.php @@ -37,11 +37,11 @@ define('HESK_PATH','./'); // Get all the required files and functions require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); hesk_load_database_functions(); hesk_session_start(); +$modsForHesk_settings = mfh_getSettings(); // Are we in maintenance mode? (check customers only) if ( empty($SESSION['id']) ) diff --git a/inc/header.inc.php b/inc/header.inc.php index 272e0da1..b5149231 100644 --- a/inc/header.inc.php +++ b/inc/header.inc.php @@ -46,7 +46,7 @@ $modsForHesk_settings = mfh_getSettings(); <?php echo (isset($hesk_settings['tmp_title']) ? $hesk_settings['tmp_title'] : $hesk_settings['hesk_title']); ?> - + diff --git a/install/mods-for-hesk/modsForHesk.php b/install/mods-for-hesk/modsForHesk.php index 9f9e90c8..89725558 100644 --- a/install/mods-for-hesk/modsForHesk.php +++ b/install/mods-for-hesk/modsForHesk.php @@ -65,24 +65,6 @@ hesk_dbConnect(); CREATE, ALTER, DROP Permissions: Please check before continuing!* - - - modsForHesk_settings.inc.php - - - > - Success'; - } else { - echo ' CHMOD to 0666, yours is '.$fileperm; - $allowInstallation = false; - } - ?> - - * Mods for HESK is unable to check database permissions automatically. diff --git a/print.php b/print.php index f3b43b12..a711bafb 100644 --- a/print.php +++ b/print.php @@ -37,17 +37,18 @@ define('HESK_PATH','./'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); hesk_load_database_functions(); hesk_session_start(); + /* Get the tracking ID */ $trackingID = hesk_cleanID() or die("$hesklang[int_error]: $hesklang[no_trackID]"); /* Connect to database */ hesk_dbConnect(); +$modsForHesk_settings = mfh_getSettings(); // Perform additional checks for customers if ( empty($_SESSION['id']) ) From 264c2e028ee1f4477d2e0c7dc9a901f373518bde Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Tue, 1 Sep 2015 12:22:03 -0400 Subject: [PATCH 21/29] #327 Replaced all instances (I think?) of $modsForHesk_settings --- admin/admin_main.php | 1 - admin/admin_reply_ticket.php | 7 +-- admin/admin_settings.php | 81 +++++++++++++-------------- admin/admin_settings_save.php | 1 - admin/admin_submit_ticket.php | 2 +- admin/admin_ticket.php | 3 +- admin/edit_post.php | 2 +- admin/export.php | 2 +- admin/mail.php | 1 - admin/manage_canned.php | 11 ++-- admin/manage_categories.php | 3 +- admin/manage_knowledgebase.php | 3 +- admin/manage_permission_templates.php | 3 +- admin/manage_statuses.php | 5 +- admin/manage_ticket_templates.php | 11 ++-- admin/manage_users.php | 3 +- admin/password.php | 1 - admin/show_tickets.php | 1 - css/hesk_newStyleRTL.php | 1 - download_attachment.php | 3 +- inc/common.inc.php | 11 ++++ inc/email_functions.inc.php | 42 +++++++------- inc/headerAdmin.inc.php | 5 +- inc/pipe_functions.inc.php | 1 - print.php | 5 +- reply_ticket.php | 9 ++- submit_ticket.php | 7 +-- verifyemail.php | 1 - 28 files changed, 108 insertions(+), 118 deletions(-) diff --git a/admin/admin_main.php b/admin/admin_main.php index 111ed08a..29baa6f8 100644 --- a/admin/admin_main.php +++ b/admin/admin_main.php @@ -40,7 +40,6 @@ if (is_dir(HESK_PATH . 'install')) {die('Please delete the install folder /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/status_functions.inc.php'); diff --git a/admin/admin_reply_ticket.php b/admin/admin_reply_ticket.php index 3b317f21..9ddc887a 100644 --- a/admin/admin_reply_ticket.php +++ b/admin/admin_reply_ticket.php @@ -37,7 +37,6 @@ define('HESK_PATH','../'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); hesk_load_database_functions(); @@ -139,14 +138,14 @@ if (strlen($message)) // Attach signature to the message? if ( ! $submit_as_customer && ! empty($_POST['signature'])) { - if ($modsForHesk_settings['rich_text_for_tickets']) { + if (mfh_getSetting('rich_text_for_tickets')) { $message .= "

" . nl2br($_SESSION['signature']) . "
"; } else { $message .= "\n\n" . addslashes($_SESSION['signature']) . "\n"; } } - if (!$modsForHesk_settings['rich_text_for_tickets']) { + if (!mfh_getSetting('rich_text_for_tickets')) { // Make links clickable $message = hesk_makeURL($message); @@ -211,7 +210,7 @@ if ($hesk_settings['attachments']['use'] && !empty($attachments)) } // Add reply -$html = $modsForHesk_settings['rich_text_for_tickets']; +$html = mfh_getSetting('rich_text_for_tickets'); if ($submit_as_customer) { hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` (`replyto`,`name`,`message`,`dt`,`attachments`,`html`) VALUES ('".intval($replyto)."','".hesk_dbEscape(addslashes($ticket['name']))."','".hesk_dbEscape($message."

{$hesklang['creb']} {$_SESSION['name']}")."',NOW(),'".hesk_dbEscape($myattachments)."', '".$html."')"); diff --git a/admin/admin_settings.php b/admin/admin_settings.php index 28c662e1..e45844c7 100644 --- a/admin/admin_settings.php +++ b/admin/admin_settings.php @@ -42,7 +42,6 @@ if (is_dir(HESK_PATH . 'install')) {die('Please delete the install folder // Get all the required files and functions require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); // Save the default language for the settings page before choosing user's preferred one $hesk_settings['language_default'] = $hesk_settings['language']; @@ -824,8 +823,8 @@ if ( defined('HESK_DEMO') )
@@ -845,9 +844,9 @@ if ( defined('HESK_DEMO') )
   
    @@ -868,8 +867,8 @@ if ( defined('HESK_DEMO') )
@@ -952,8 +951,8 @@ if ( defined('HESK_DEMO') )
   
'; @@ -1148,7 +1147,7 @@ if ( defined('HESK_DEMO') )
@@ -1274,7 +1273,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -1290,7 +1289,7 @@ if ( defined('HESK_DEMO') )
- +
@@ -1647,7 +1646,7 @@ if ( defined('HESK_DEMO') )
- +
@@ -2064,7 +2063,7 @@ if ( defined('HESK_DEMO') )
@@ -2176,7 +2175,7 @@ if ( defined('HESK_DEMO') )
@@ -2318,7 +2317,7 @@ if ( defined('HESK_DEMO') )
@@ -2336,7 +2335,7 @@ if ( defined('HESK_DEMO') )
@@ -2354,7 +2353,7 @@ if ( defined('HESK_DEMO') )
@@ -2381,7 +2380,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2393,7 +2392,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2407,7 +2406,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2419,7 +2418,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2433,7 +2432,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2445,7 +2444,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2459,7 +2458,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2471,7 +2470,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2485,7 +2484,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2497,7 +2496,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2511,7 +2510,7 @@ if ( defined('HESK_DEMO') ) data-content="">
- +
@@ -2692,7 +2691,7 @@ function hesk_cacheMfhLatestVersion($latest) function hesk_testLanguage($return_options = 0) { - global $hesk_settings, $hesklang, $modsForHesk_settings; + global $hesk_settings, $hesklang; /* Get a list of valid emails */ include_once(HESK_PATH . 'inc/email_functions.inc.php'); @@ -2849,7 +2848,7 @@ function hesk_testLanguage($return_options = 0) background:#fff; color: black; font : 68.8%/1.5 Verdana, Geneva, Arial, Helvetica, sans-serif; - text-align: ; + text-align: ; } p diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php index 569d8819..9fee5bd9 100644 --- a/admin/admin_settings_save.php +++ b/admin/admin_settings_save.php @@ -37,7 +37,6 @@ define('HESK_PATH','../'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/email_functions.inc.php'); diff --git a/admin/admin_submit_ticket.php b/admin/admin_submit_ticket.php index 33f675ff..89310eff 100644 --- a/admin/admin_submit_ticket.php +++ b/admin/admin_submit_ticket.php @@ -37,7 +37,6 @@ define('HESK_PATH','../'); // Get all the required files and functions require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); hesk_load_database_functions(); @@ -48,6 +47,7 @@ require(HESK_PATH . 'inc/posting_functions.inc.php'); hesk_session_start(); hesk_dbConnect(); hesk_isLoggedIn(); +$modsForHesk_settings = mfh_getSettings(); // We only allow POST requests from the HESK form to this file if ( $_SERVER['REQUEST_METHOD'] != 'POST' ) diff --git a/admin/admin_ticket.php b/admin/admin_ticket.php index 35aca09b..999c91af 100644 --- a/admin/admin_ticket.php +++ b/admin/admin_ticket.php @@ -38,7 +38,6 @@ define('WYSIWYG',1); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/status_functions.inc.php'); @@ -51,6 +50,8 @@ hesk_isLoggedIn(); /* Check permissions for this feature */ hesk_checkPermission('can_view_tickets'); +$modsForHesk_settings = mfh_getSettings(); + $can_del_notes = hesk_checkPermission('can_del_notes',0); $can_reply = hesk_checkPermission('can_reply_tickets',0); $can_delete = hesk_checkPermission('can_del_tickets',0); diff --git a/admin/edit_post.php b/admin/edit_post.php index 2a399819..1cef28f8 100644 --- a/admin/edit_post.php +++ b/admin/edit_post.php @@ -38,7 +38,6 @@ define('WYSIWYG',1); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); hesk_load_database_functions(); @@ -52,6 +51,7 @@ if (!isset($_REQUEST['isManager']) || !$_REQUEST['isManager']) { hesk_checkPermission('can_view_tickets'); hesk_checkPermission('can_edit_tickets'); } +$modsForHesk_settings = mfh_getSettings(); /* Ticket ID */ $trackingID = hesk_cleanID() or die($hesklang['int_error'].': '.$hesklang['no_trackID']); diff --git a/admin/export.php b/admin/export.php index 5fd3027d..c3276aa8 100644 --- a/admin/export.php +++ b/admin/export.php @@ -36,7 +36,6 @@ define('HESK_PATH','../'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/reporting_functions.inc.php'); @@ -49,6 +48,7 @@ hesk_isLoggedIn(); // Check permissions for this feature hesk_checkPermission('can_export'); +$modsForHesk_settings = mfh_getSettings(); // Set default values define('CALENDAR',1); diff --git a/admin/mail.php b/admin/mail.php index 4bb4fcc4..96333f90 100644 --- a/admin/mail.php +++ b/admin/mail.php @@ -37,7 +37,6 @@ define('HESK_PATH','../'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); hesk_load_database_functions(); diff --git a/admin/manage_canned.php b/admin/manage_canned.php index 19c38d66..59ca054b 100644 --- a/admin/manage_canned.php +++ b/admin/manage_canned.php @@ -37,7 +37,6 @@ define('HESK_PATH','../'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); hesk_load_database_functions(); @@ -78,7 +77,7 @@ function hesk_insertTag(tag) { var text_to_insert = '%%'+tag+'%%'; var msg = ''; + if (mfh_getSetting('rich_text_for_tickets')) { ?> msg = tinymce.get("message").getContent(); tinymce.get("message").setContent(''); tinymce.get("message").execCommand('mceInsertRawHTML', false, msg + text_to_insert); @@ -160,7 +159,7 @@ function hesk_insertAtCursor(myField, myValue) { $javascript_titles.='myTitle['.$mysaved['id'].']=\''.addslashes($mysaved['title'])."';\n"; - if ($modsForHesk_settings['rich_text_for_tickets']) { + if (mfh_getSetting('rich_text_for_tickets')) { $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", hesk_html_entity_decode($mysaved['message']) )."';\n"; } else { $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved['message']) )."';\n"; @@ -206,7 +205,7 @@ function hesk_insertAtCursor(myField, myValue) { - +
diff --git a/admin/manage_permission_templates.php b/admin/manage_permission_templates.php index 55f0b773..c590b32f 100644 --- a/admin/manage_permission_templates.php +++ b/admin/manage_permission_templates.php @@ -37,7 +37,6 @@ define('HESK_PATH','../'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); hesk_load_database_functions(); @@ -82,7 +81,7 @@ else {return false;} array_push($templates, $row); } $featureArray = hesk_getFeatureArray(); - $orderBy = $modsForHesk_settings['category_order_column']; + $orderBy = mfh_getSetting('category_order_column'); $res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `".$orderBy."` ASC"); $categories = array(); while ($row = hesk_dbFetchAssoc($res)) { diff --git a/admin/manage_statuses.php b/admin/manage_statuses.php index 43a1588c..4247bbef 100644 --- a/admin/manage_statuses.php +++ b/admin/manage_statuses.php @@ -5,7 +5,6 @@ define('HESK_PATH','../'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/status_functions.inc.php'); @@ -380,9 +379,9 @@ function buildConfirmDeleteModal($statusId) { } function echoArrows($index, $numberOfStatuses, $statusId) { - global $hesklang, $modsForHesk_settings; + global $hesklang; - if ($modsForHesk_settings['statuses_order_column'] == 'name') { + if (mfh_getSetting('statuses_order_column') == 'name') { return; } diff --git a/admin/manage_ticket_templates.php b/admin/manage_ticket_templates.php index 8ff7d655..7836d617 100644 --- a/admin/manage_ticket_templates.php +++ b/admin/manage_ticket_templates.php @@ -37,7 +37,6 @@ define('HESK_PATH','../'); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); -require(HESK_PATH . 'modsForHesk_settings.inc.php'); require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php'); hesk_load_database_functions(); @@ -52,7 +51,7 @@ hesk_checkPermission('can_man_ticket_tpl'); // Define required constants define('LOAD_TABS',1); -if ($modsForHesk_settings['rich_text_for_tickets']) { +if (mfh_getSetting('rich_text_for_tickets')) { define('WYSIWYG', 1); } @@ -132,7 +131,7 @@ $num = hesk_dbNumRows($result); $options .= (isset($_SESSION['canned']['id']) && $_SESSION['canned']['id'] == $mysaved['id']) ? ' selected="selected" ' : ''; $options .= '>'.$mysaved['title'].''; - if ($modsForHesk_settings['rich_text_for_tickets']) { + if (mfh_getSetting('rich_text_for_tickets')) { $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", html_entity_decode($mysaved['message'] ))."';\n"; } else { $javascript_messages.='myMsgTxt['.$mysaved['id'].']=\''.str_replace("\r\n","\\r\\n' + \r\n'", addslashes($mysaved['message']) )."';\n"; @@ -243,7 +242,7 @@ $num = hesk_dbNumRows($result);