diff --git a/.gitignore b/.gitignore
index e4ef0e68..274e3a3f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,6 @@
admin/admin_suggest_articles.php
admin/archive.php
-admin/assign_owner.php
admin/generate_spam_question.php
-admin/move_category.php
admin/priority.php
admin/test_connection.php
attachments/index.htm
diff --git a/admin/admin_main.php b/admin/admin_main.php
index c6bb29ce..d80ecf5a 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 71ce4992..7c2805a6 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();
@@ -90,6 +89,7 @@ $message = hesk_input(hesk_POST('message'));
// Submit as customer?
$submit_as_customer = isset($_POST['submit_as_customer']) ? true : false;
+$modsForHesk_settings = mfh_getSettings();
if (strlen($message))
{
// Save message for later and ignore the rest?
@@ -388,13 +388,13 @@ if ($submit_as_customer)
{
if ($ticket['owner'] && $ticket['owner'] != $_SESSION['id'])
{
- hesk_notifyAssignedStaff(false, 'new_reply_by_customer', 'notify_reply_my');
+ hesk_notifyAssignedStaff(false, 'new_reply_by_customer', $modsForHesk_settings, 'notify_reply_my');
}
}
// Notify customer?
elseif ( ! isset($_POST['no_notify']) || intval( hesk_POST('no_notify') ) != 1)
{
- hesk_notifyCustomer('new_reply_by_staff');
+ hesk_notifyCustomer($modsForHesk_settings, 'new_reply_by_staff');
}
// Delete any existing drafts from this owner for this ticket
diff --git a/admin/admin_settings.php b/admin/admin_settings.php
index 51bc8e27..53d5e075 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'];
@@ -254,25 +253,6 @@ if ( defined('HESK_DEMO') )
?>
-
* Mods for HESK is unable to check database permissions automatically.
diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php
index 8d477b71..29629970 100644
--- a/install/mods-for-hesk/sql/installSql.php
+++ b/install/mods-for-hesk/sql/installSql.php
@@ -686,4 +686,108 @@ function execute242Scripts() {
hesk_dbConnect();
executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.4.2' WHERE `Key` = 'modsForHeskVersion'");
+}
+
+// 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');
+
+ $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);
+
+ $navbar_background_color = getSettingValue($modsForHesk_settings, 'navbarBackgroundColor', '#414a5c');
+ $navbar_brand_color = getSettingValue($modsForHesk_settings, 'navbarBrandColor', '#d4dee7');
+ $navbar_brand_hover_color = getSettingValue($modsForHesk_settings, 'navbarBrandHoverColor', '#ffffff');
+ $navbar_item_text_color = getSettingValue($modsForHesk_settings, 'navbarItemTextColor', '#d4dee7');
+ $navbar_item_text_hover_color = getSettingValue($modsForHesk_settings, 'navbarItemTextHoverColor', '#ffffff');
+ $navbar_item_text_selected_color = getSettingValue($modsForHesk_settings, 'navbarItemTextSelectedColor', '#ffffff');
+ $navbar_item_selected_background_color = getSettingValue($modsForHesk_settings, 'navbarItemSelectedBackgroundColor', '#2d3646');
+ $dropdown_item_text_color = getSettingValue($modsForHesk_settings, 'dropdownItemTextColor', '#333333');
+ $dropdown_item_text_hover_color = getSettingValue($modsForHesk_settings, 'dropdownItemTextHoverColor', '#262626');
+ $dropdown_item_text_hover_background_color = getSettingValue($modsForHesk_settings, 'dropdownItemTextHoverBackgroundColor', '#f5f5f5');
+ $question_mark_color = getSettingValue($modsForHesk_settings, 'questionMarkColor', '#000000');
+
+
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('rtl', ".intval($rtl).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('show_icons', ".intval($show_icons).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ 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($customer_email_verification_required).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('html_emails', ".intval($html_emails).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('use_mailgun', ".intval($use_mailgun).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('mailgun_api_key', '".hesk_dbEscape($mailgun_api_key)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('mailgun_domain', '".hesk_dbEscape($mailgun_domain)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ 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($new_kb_article_visibility).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('attachments', ".intval($attachments).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('show_number_merged', ".intval($show_number_merged).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('request_location', ".intval($request_location).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ 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($rich_text_for_tickets).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ 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', '".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($rich_text_for_tickets_for_customers).")");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('navbarBackgroundColor', '".hesk_dbEscape($navbar_background_color)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('navbarBrandColor', '".hesk_dbEscape($navbar_brand_color)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('navbarBrandHoverColor', '".hesk_dbEscape($navbar_brand_hover_color)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('navbarItemTextColor', '".hesk_dbEscape($navbar_item_text_color)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('navbarItemTextHoverColor', '".hesk_dbEscape($navbar_item_text_hover_color)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('navbarItemTextSelectedColor', '".hesk_dbEscape($navbar_item_text_selected_color)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('navbarItemSelectedBackgroundColor', '".hesk_dbEscape($navbar_item_selected_background_color)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('dropdownItemTextColor', '".hesk_dbEscape($dropdown_item_text_color)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('dropdownItemTextHoverColor', '".hesk_dbEscape($dropdown_item_text_hover_color)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('dropdownItemTextHoverBackgroundColor', '".hesk_dbEscape($dropdown_item_text_hover_background_color)."')");
+ executeQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` (`Key`, `Value`)
+ VALUES ('questionMarkColor', '".hesk_dbEscape($question_mark_color)."')");
+ }
+}
+
+function getSettingValue($settings, $setting, $default) {
+ return isset($settings[$setting]) ? $settings[$setting] : $default;
}
\ No newline at end of file
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 @@
-
diff --git a/reply_ticket.php b/reply_ticket.php
index 6c267ee2..f0d4f1d4 100644
--- a/reply_ticket.php
+++ b/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');
// Are we in maintenance mode?
@@ -66,6 +65,9 @@ hesk_session_start();
/* A security check */
# hesk_token_check('POST');
+
+/* Connect to database */
+hesk_dbConnect();
$hesk_error_buffer = array();
// Tracking ID
@@ -135,9 +137,6 @@ if (count($hesk_error_buffer)!=0)
hesk_process_messages($hesk_error_buffer,'ticket.php?track='.$trackingID.$hesk_settings['e_param'].'&Refresh='.rand(10000,99999));
}
-/* Connect to database */
-hesk_dbConnect();
-
// Check if this IP is temporarily locked out
$res = hesk_dbQuery("SELECT `number` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."logins` WHERE `ip`='".hesk_dbEscape($_SERVER['REMOTE_ADDR'])."' AND `last_attempt` IS NOT NULL AND DATE_ADD(`last_attempt`, INTERVAL ".intval($hesk_settings['attempt_banmin'])." MINUTE ) > NOW() LIMIT 1");
if (hesk_dbNumRows($res) == 1)
@@ -205,6 +204,7 @@ $ticket['status'] = $ticket['status'] == $defaultNewTicketStatus['ID'] ? $defaul
$res = hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `lastchange`=NOW(), `status`='{$ticket['status']}', `replies`=`replies`+1, `lastreplier`='0' WHERE `id`='{$ticket['id']}' LIMIT 1");
// Insert reply into database
+$modsForHesk_settings = mfh_getSettings();
$html = $modsForHesk_settings['rich_text_for_tickets_for_customers'];
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` (`replyto`,`name`,`message`,`dt`,`attachments`, `html`) VALUES ({$ticket['id']},'".hesk_dbEscape($ticket['name'])."','".hesk_dbEscape($message)."',NOW(),'".hesk_dbEscape($myattachments)."','".$html."')");
@@ -243,12 +243,12 @@ $ticket = hesk_ticketToPlain($info, 1, 0);
// --> If ticket is assigned just notify the owner
if ($ticket['owner'])
{
- hesk_notifyAssignedStaff(false, 'new_reply_by_customer', 'notify_reply_my');
+ hesk_notifyAssignedStaff(false, 'new_reply_by_customer', $modsForHesk_settings, 'notify_reply_my');
}
// --> No owner assigned, find and notify appropriate staff
else
{
- hesk_notifyStaff('new_reply_by_customer',"`notify_reply_unassigned`='1'");
+ hesk_notifyStaff('new_reply_by_customer',"`notify_reply_unassigned`='1'", $modsForHesk_settings);
}
/* Clear unneeded session variables */
diff --git a/submit_ticket.php b/submit_ticket.php
index 5e1fb7aa..9a763cea 100644
--- a/submit_ticket.php
+++ b/submit_ticket.php
@@ -44,7 +44,6 @@ if ( ! isset($_POST['hx']) || $_POST['hx'] != 3 || ! isset($_POST['hy']) || $_PO
// 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');
// Are we in maintenance mode?
@@ -272,6 +271,7 @@ if ($tmpvar['category'])
}
// Custom fields
+$modsForHesk_settings = mfh_getSettings();
foreach ($hesk_settings['custom_fields'] as $k=>$v)
{
if ($v['use'])
@@ -472,7 +472,7 @@ if ($modsForHesk_settings['customer_email_verification_required'])
hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."pending_verification_emails` (`Email`, `ActivationKey`)
VALUES ('".$escapedEmail."', '".$escapedKey."')");
- hesk_notifyCustomerForVerifyEmail('verify_email', $key);
+ hesk_notifyCustomerForVerifyEmail('verify_email', $key, $modsForHesk_settings);
$createTicket = false;
}
}
@@ -484,19 +484,19 @@ if ($createTicket)
// Notify the customer
if ($hesk_settings['notify_new'])
{
- hesk_notifyCustomer();
+ hesk_notifyCustomer($modsForHesk_settings);
}
// Need to notify staff?
// --> From autoassign?
if ($tmpvar['owner'] && $autoassign_owner['notify_assigned'])
{
- hesk_notifyAssignedStaff($autoassign_owner, 'ticket_assigned_to_you');
+ hesk_notifyAssignedStaff($autoassign_owner, 'ticket_assigned_to_you', $modsForHesk_settings);
}
// --> No autoassign, find and notify appropriate staff
elseif ( ! $tmpvar['owner'] )
{
- hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' ");
+ hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' ", $modsForHesk_settings);
}
}
diff --git a/ticket.php b/ticket.php
index 1d66e1bc..a3649af5 100644
--- a/ticket.php
+++ b/ticket.php
@@ -48,6 +48,9 @@ hesk_check_maintenance();
hesk_load_database_functions();
hesk_session_start();
+/* Connect to database */
+hesk_dbConnect();
+$modsForHesk_settings = mfh_getSettings();
$hesk_error_buffer = array();
$do_remember = '';
@@ -101,8 +104,6 @@ elseif ( empty($trackingID) || ( $hesk_settings['email_view_ticket'] && empty($m
print_form();
}
-/* Connect to database */
-hesk_dbConnect();
/* Limit brute force attempts */
hesk_limitBfAttempts();
diff --git a/verifyemail.php b/verifyemail.php
index c4d28db8..7f5fb934 100644
--- a/verifyemail.php
+++ b/verifyemail.php
@@ -4,7 +4,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');
hesk_load_database_functions();
require(HESK_PATH . 'inc/posting_functions.inc.php');
@@ -46,7 +45,8 @@ require_once(HESK_PATH . 'inc/header.inc.php');
{
$ticket = hesk_newTicket($innerResult);
// Notify the customer
- hesk_notifyCustomer();
+ $modsForHesk_settings = mfh_getSettings();
+ hesk_notifyCustomer($modsForHesk_settings);
// Need to notify staff?
// --> From autoassign?
@@ -54,12 +54,12 @@ require_once(HESK_PATH . 'inc/header.inc.php');
$autoassign_owner = $getOwnerRs->fetch_assoc();
if ($ticket['owner'] && $autoassign_owner['notify_assigned'])
{
- hesk_notifyAssignedStaff($autoassign_owner, 'ticket_assigned_to_you');
+ hesk_notifyAssignedStaff($autoassign_owner, 'ticket_assigned_to_you', $modsForHesk_settings);
}
// --> No autoassign, find and notify appropriate staff
elseif ( ! $ticket['owner'] )
{
- hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' ");
+ hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' ", $modsForHesk_settings);
}
array_push($submittedTickets, $innerResult['trackid']);
|