Merge pull request #342 from mkoch227/move-settings-to-db

Move MFH Settings to Database
merge-requests/2/head
Mike Koch 9 years ago
commit 868deff525

2
.gitignore vendored

@ -1,8 +1,6 @@
admin/admin_suggest_articles.php admin/admin_suggest_articles.php
admin/archive.php admin/archive.php
admin/assign_owner.php
admin/generate_spam_question.php admin/generate_spam_question.php
admin/move_category.php
admin/priority.php admin/priority.php
admin/test_connection.php admin/test_connection.php
attachments/index.htm attachments/index.htm

@ -40,7 +40,6 @@ if (is_dir(HESK_PATH . 'install')) {die('Please delete the <b>install</b> folder
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/status_functions.inc.php'); require(HESK_PATH . 'inc/status_functions.inc.php');

@ -37,7 +37,6 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
@ -90,6 +89,7 @@ $message = hesk_input(hesk_POST('message'));
// Submit as customer? // Submit as customer?
$submit_as_customer = isset($_POST['submit_as_customer']) ? true : false; $submit_as_customer = isset($_POST['submit_as_customer']) ? true : false;
$modsForHesk_settings = mfh_getSettings();
if (strlen($message)) if (strlen($message))
{ {
// Save message for later and ignore the rest? // Save message for later and ignore the rest?
@ -388,13 +388,13 @@ if ($submit_as_customer)
{ {
if ($ticket['owner'] && $ticket['owner'] != $_SESSION['id']) 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? // Notify customer?
elseif ( ! isset($_POST['no_notify']) || intval( hesk_POST('no_notify') ) != 1) 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 // Delete any existing drafts from this owner for this ticket

@ -42,7 +42,6 @@ if (is_dir(HESK_PATH . 'install')) {die('Please delete the <b>install</b> folder
// Get all the required files and functions // Get all the required files and functions
require(HESK_PATH . 'hesk_settings.inc.php'); 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 // Save the default language for the settings page before choosing user's preferred one
$hesk_settings['language_default'] = $hesk_settings['language']; $hesk_settings['language_default'] = $hesk_settings['language'];
@ -254,25 +253,6 @@ if ( defined('HESK_DEMO') )
?> ?>
</td> </td>
</tr> </tr>
<tr>
<td class="text-right">
/modsForHesk_settings.inc.php
</td>
<?php
$modsForHeskIsWritable = is_writable(HESK_PATH . 'modsForHesk_settings.inc.php');
$cellClass = $modsForHeskIsWritable ? 'success' : 'danger';
?>
<td style="padding-left: 10px" class="<?php echo $cellClass; ?>">
<?php
if ($modsForHeskIsWritable) {
$enable_save_settings=1;
echo '<span class="success">'.$hesklang['exists'].'</span>, <span class="success">'.$hesklang['writable'].'</span>';
} else {
echo '<span class="success">'.$hesklang['exists'].'</span>, <span class="error">'.$hesklang['not_writable'].'</span><br />'.$hesklang['e_mfh_settings'];
}
?>
</td>
</tr>
</table> </table>
</div> </div>
</div> </div>
@ -348,6 +328,7 @@ if ( defined('HESK_DEMO') )
$hesklang['err_custname'] = addslashes($hesklang['err_custname']); $hesklang['err_custname'] = addslashes($hesklang['err_custname']);
$modsForHesk_settings = mfh_getSettings();
?> ?>
<script language="javascript" type="text/javascript"><!-- <script language="javascript" type="text/javascript"><!--
function hesk_checkFields() function hesk_checkFields()
@ -2711,7 +2692,7 @@ function hesk_cacheMfhLatestVersion($latest)
function hesk_testLanguage($return_options = 0) function hesk_testLanguage($return_options = 0)
{ {
global $hesk_settings, $hesklang, $modsForHesk_settings; global $hesk_settings, $hesklang;
/* Get a list of valid emails */ /* Get a list of valid emails */
include_once(HESK_PATH . 'inc/email_functions.inc.php'); include_once(HESK_PATH . 'inc/email_functions.inc.php');

@ -43,15 +43,16 @@ if ( function_exists('opcache_reset') )
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/email_functions.inc.php');
require(HESK_PATH . 'inc/setup_functions.inc.php'); require(HESK_PATH . 'inc/setup_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
hesk_session_start(); hesk_session_start();
hesk_dbConnect(); hesk_dbConnect();
require(HESK_PATH . 'inc/email_functions.inc.php');
hesk_isLoggedIn(); hesk_isLoggedIn();
// Check permissions for this feature // Check permissions for this feature
@ -535,6 +536,7 @@ $set['mfh_attachments'] = empty($_POST['email_attachments']) ? 0 : 1;
$set['show_number_merged'] = empty($_POST['show_number_merged']) ? 0 : 1; $set['show_number_merged'] = empty($_POST['show_number_merged']) ? 0 : 1;
$set['request_location'] = empty($_POST['request_location']) ? 0 : 1; $set['request_location'] = empty($_POST['request_location']) ? 0 : 1;
$set['category_order_column'] = empty($_POST['category_order_column']) ? 'cat_order' : 'name'; $set['category_order_column'] = empty($_POST['category_order_column']) ? 'cat_order' : 'name';
$rich_text_setting = hesk_POST('rich_text_for_tickets', 0); $rich_text_setting = hesk_POST('rich_text_for_tickets', 0);
if ($rich_text_setting == 0) { if ($rich_text_setting == 0) {
$set['rich_text_for_tickets'] = 0; $set['rich_text_for_tickets'] = 0;
@ -546,6 +548,7 @@ if ($rich_text_setting == 0) {
$set['rich_text_for_tickets'] = 1; $set['rich_text_for_tickets'] = 1;
$set['rich_text_for_tickets_for_customers'] = 1; $set['rich_text_for_tickets_for_customers'] = 1;
} }
$set['statuses_order_column'] = empty($_POST['statuses_order_column']) ? 'sort' : 'name'; $set['statuses_order_column'] = empty($_POST['statuses_order_column']) ? 'sort' : 'name';
$set['kb_attach_dir'] = hesk_POST('kb_attach_dir', 'attachments'); $set['kb_attach_dir'] = hesk_POST('kb_attach_dir', 'attachments');
@ -565,77 +568,32 @@ $set['dropdownItemTextColor'] = hesk_input(hesk_POST('dropdownItemTextColor'));
$set['dropdownItemTextHoverColor'] = hesk_input(hesk_POST('dropdownItemTextHoverColor')); $set['dropdownItemTextHoverColor'] = hesk_input(hesk_POST('dropdownItemTextHoverColor'));
$set['questionMarkColor'] = hesk_input(hesk_POST('questionMarkColor')); $set['questionMarkColor'] = hesk_input(hesk_POST('questionMarkColor'));
$set['dropdownItemTextHoverBackgroundColor'] = hesk_input(hesk_POST('dropdownItemTextHoverBackgroundColor')); $set['dropdownItemTextHoverBackgroundColor'] = hesk_input(hesk_POST('dropdownItemTextHoverBackgroundColor'));
$modsForHesk_file_content='<?php mfh_updateSetting('rtl', $set['rtl']);
mfh_updateSetting('show_icons', $set['show-icons']);
//-- Mods For Hesk Theme Color Settings mfh_updateSetting('custom_field_setting', $set['custom-field-setting']);
$modsForHesk_settings[\'navbarBackgroundColor\'] = \''.$set['navbarBackgroundColor'].'\'; mfh_updateSetting('customer_email_verification_required', $set['customer-email-verification-required']);
$modsForHesk_settings[\'navbarBrandColor\'] = \''.$set['navbarBrandColor'].'\'; mfh_updateSetting('html_emails', $set['html_emails']);
$modsForHesk_settings[\'navbarBrandHoverColor\'] = \''.$set['navbarBrandHoverColor'].'\'; mfh_updateSetting('use_bootstrap_theme', $set['use_bootstrap_theme']);
$modsForHesk_settings[\'navbarItemTextColor\'] = \''.$set['navbarItemTextColor'].'\'; mfh_updateSetting('new_kb_article_visibility', $set['new_kb_article_visibility']);
$modsForHesk_settings[\'navbarItemTextHoverColor\'] = \''.$set['navbarItemTextHoverColor'].'\'; mfh_updateSetting('attachments', $set['mfh_attachments']);
$modsForHesk_settings[\'navbarItemTextSelectedColor\'] = \''.$set['navbarItemTextSelectedColor'].'\'; mfh_updateSetting('show_number_merged', $set['show_number_merged']);
$modsForHesk_settings[\'navbarItemSelectedBackgroundColor\'] = \''.$set['navbarItemSelectedBackgroundColor'].'\'; mfh_updateSetting('request_location', $set['request_location']);
$modsForHesk_settings[\'dropdownItemTextColor\'] = \''.$set['dropdownItemTextColor'].'\'; mfh_updateSetting('category_order_column', $set['category_order_column'], true);
$modsForHesk_settings[\'dropdownItemTextHoverColor\'] = \''.$set['dropdownItemTextHoverColor'].'\'; mfh_updateSetting('rich_text_for_tickets', $set['rich_text_for_tickets']);
$modsForHesk_settings[\'dropdownItemTextHoverBackgroundColor\'] = \''.$set['dropdownItemTextHoverBackgroundColor'].'\'; mfh_updateSetting('rich_text_for_tickets_for_customers', $set['rich_text_for_tickets_for_customers']);
$modsForHesk_settings[\'questionMarkColor\'] = \''.$set['questionMarkColor'].'\'; mfh_updateSetting('statuses_order_column', $set['statuses_order_column'], true);
mfh_updateSetting('kb_attach_dir', $set['kb_attach_dir'], true);
//-- Set this to 1 for right-to-left text. mfh_updateSetting('navbarBackgroundColor', $set['navbarBackgroundColor'], true);
$modsForHesk_settings[\'rtl\'] = '.$set['rtl'].'; mfh_updateSetting('navbarBrandColor', $set['navbarBrandColor'], true);
mfh_updateSetting('navbarBrandHoverColor', $set['navbarBrandHoverColor'], true);
//-- Set this to 1 to show icons next to navigation menu items mfh_updateSetting('navbarItemTextColor', $set['navbarItemTextColor'], true);
$modsForHesk_settings[\'show_icons\'] = '.$set['show-icons'].'; mfh_updateSetting('navbarItemTextHoverColor', $set['navbarItemTextHoverColor'], true);
mfh_updateSetting('navbarItemTextSelectedColor', $set['navbarItemTextSelectedColor'], true);
//-- Set this to 1 to enable custom field names as keys mfh_updateSetting('navbarItemSelectedBackgroundColor', $set['navbarItemSelectedBackgroundColor'], true);
$modsForHesk_settings[\'custom_field_setting\'] = '.$set['custom-field-setting'].'; mfh_updateSetting('dropdownItemTextColor', $set['dropdownItemTextColor'], true);
mfh_updateSetting('dropdownItemTextHoverColor', $set['dropdownItemTextHoverColor'], true);
//-- Set this to 1 to enable email verification for new customers mfh_updateSetting('questionMarkColor', $set['questionMarkColor'], true);
$modsForHesk_settings[\'customer_email_verification_required\'] = '.$set['customer-email-verification-required'].'; mfh_updateSetting('dropdownItemTextHoverBackgroundColor', $set['dropdownItemTextHoverBackgroundColor'], true);
//-- Set this to 1 to enable HTML-formatted emails.
$modsForHesk_settings[\'html_emails\'] = '.$set['html_emails'].';
//-- Mailgun Settings
$modsForHesk_settings[\'use_mailgun\'] = '.$set['use_mailgun'].';
$modsForHesk_settings[\'mailgun_api_key\'] = \''.$set['mailgun_api_key'].'\';
$modsForHesk_settings[\'mailgun_domain\'] = \''.$set['mailgun_domain'].'\';
//-- Set this to 1 to enable bootstrap-theme.css
$modsForHesk_settings[\'use_bootstrap_theme\'] = '.$set['use_bootstrap_theme'].';
//-- Default value for new Knowledgebase article: 0 = Published, 1 = Private, 2 = Draft
$modsForHesk_settings[\'new_kb_article_visibility\'] = '.$set['new_kb_article_visibility'].';
//-- Setting for adding attachments to email messages. Either 0 for default-HESK behavior, or 1 to send as attachments
$modsForHesk_settings[\'attachments\'] = '.$set['mfh_attachments'].';
//-- Setting for showing number of merged tickets in the ticket search screen. 0 = Disable, 1 = Enable
$modsForHesk_settings[\'show_number_merged\'] = '.$set['show_number_merged'].';
//-- Setting for requesting user\'s location. 0 = Disable, 1 = Enable
$modsForHesk_settings[\'request_location\'] = '.$set['request_location'].';
//-- Column to sort categories by. Can be either \'name\' or \'cat_order\'
$modsForHesk_settings[\'category_order_column\'] = \''.$set['category_order_column'].'\';
//-- Setting for using rich-text editor for tickets. 0 = Disable, 1 = Enable
$modsForHesk_settings[\'rich_text_for_tickets\'] = '.$set['rich_text_for_tickets'].';
//-- Column to sort statuses by. Can be either \'sort\' or \'name\'
$modsForHesk_settings[\'statuses_order_column\'] = \''.$set['statuses_order_column'].'\';
//-- Directory to store knowledgebase articles in.
$modsForHesk_settings[\'kb_attach_dir\'] = \''.$set['kb_attach_dir'].'\';
//-- Setting for using rich-text editor for customers. 0 = Disable, 1 = Enable
$modsForHesk_settings[\'rich_text_for_tickets_for_customers\'] = '.$set['rich_text_for_tickets_for_customers'].';';
// Write the file
if ( ! file_put_contents(HESK_PATH . 'modsForHesk_settings.inc.php', $modsForHesk_file_content) )
{
hesk_error($hesklang['err_modsForHesk_settings']);
}
// Prepare settings file and save it // Prepare settings file and save it
$settings_file_content='<?php $settings_file_content='<?php
@ -876,6 +834,13 @@ exit();
/** FUNCTIONS **/ /** FUNCTIONS **/
function mfh_updateSetting($key, $value, $isString = false) {
global $hesk_settings;
$formattedValue = $isString ? "'".hesk_dbEscape($value)."'" : intval($value);
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = ".$formattedValue." WHERE `Key` = '".$key."'");
}
function hesk_checkMinMax($myint,$min,$max,$defval) function hesk_checkMinMax($myint,$min,$max,$defval)
{ {

@ -37,7 +37,6 @@ define('HESK_PATH','../');
// Get all the required files and functions // Get all the required files and functions
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
@ -48,6 +47,7 @@ require(HESK_PATH . 'inc/posting_functions.inc.php');
hesk_session_start(); hesk_session_start();
hesk_dbConnect(); hesk_dbConnect();
hesk_isLoggedIn(); hesk_isLoggedIn();
$modsForHesk_settings = mfh_getSettings();
// We only allow POST requests from the HESK form to this file // We only allow POST requests from the HESK form to this file
if ( $_SERVER['REQUEST_METHOD'] != 'POST' ) if ( $_SERVER['REQUEST_METHOD'] != 'POST' )
@ -287,7 +287,7 @@ $ticket = hesk_newTicket($tmpvar);
// Notify the customer about the ticket? // Notify the customer about the ticket?
if ($notify) if ($notify)
{ {
hesk_notifyCustomer(); hesk_notifyCustomer($modsForHesk_settings);
} }
// If ticket is assigned to someone notify them? // If ticket is assigned to someone notify them?
@ -296,18 +296,18 @@ if ($ticket['owner'] && $ticket['owner'] != intval($_SESSION['id']))
// If we don't have info from auto-assign get it from database // If we don't have info from auto-assign get it from database
if ( ! isset($autoassign_owner['email']) ) if ( ! isset($autoassign_owner['email']) )
{ {
hesk_notifyAssignedStaff(false, 'ticket_assigned_to_you'); hesk_notifyAssignedStaff(false, 'ticket_assigned_to_you', $modsForHesk_settings);
} }
else else
{ {
hesk_notifyAssignedStaff($autoassign_owner, 'ticket_assigned_to_you'); hesk_notifyAssignedStaff($autoassign_owner, 'ticket_assigned_to_you', $modsForHesk_settings);
} }
} }
// Ticket unassigned, notify everyone that selected to be notified about unassigned tickets // Ticket unassigned, notify everyone that selected to be notified about unassigned tickets
elseif ( ! $ticket['owner']) elseif ( ! $ticket['owner'])
{ {
hesk_notifyStaff('new_ticket_staff', " `id` != ".intval($_SESSION['id'])." AND `notify_new_unassigned` = '1' "); hesk_notifyStaff('new_ticket_staff', " `id` != ".intval($_SESSION['id'])." AND `notify_new_unassigned` = '1' ", $modsForHesk_settings);
} }
// Unset temporary variables // Unset temporary variables

@ -38,7 +38,6 @@ define('WYSIWYG',1);
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/status_functions.inc.php'); require(HESK_PATH . 'inc/status_functions.inc.php');
@ -51,6 +50,8 @@ hesk_isLoggedIn();
/* Check permissions for this feature */ /* Check permissions for this feature */
hesk_checkPermission('can_view_tickets'); hesk_checkPermission('can_view_tickets');
$modsForHesk_settings = mfh_getSettings();
$can_del_notes = hesk_checkPermission('can_del_notes',0); $can_del_notes = hesk_checkPermission('can_del_notes',0);
$can_reply = hesk_checkPermission('can_reply_tickets',0); $can_reply = hesk_checkPermission('can_reply_tickets',0);
$can_delete = hesk_checkPermission('can_del_tickets',0); $can_delete = hesk_checkPermission('can_del_tickets',0);
@ -456,14 +457,14 @@ if (isset($_POST['notemsg']) && hesk_token_check('POST'))
/* Format email subject and message for staff */ /* Format email subject and message for staff */
$subject = hesk_getEmailSubject('new_note',$ticket); $subject = hesk_getEmailSubject('new_note',$ticket);
$message = hesk_getEmailMessage('new_note',$ticket,1); $message = hesk_getEmailMessage('new_note',$ticket,$modsForHesk_settings,1);
$htmlMessage = hesk_getHtmlMessage('new_note',$ticket,1); $htmlMessage = hesk_getHtmlMessage('new_note',$ticket,$modsForHesk_settings, 1);
$hasMessage = hesk_doesTemplateHaveTag('new_note', '%%MESSAGE%%'); $hasMessage = hesk_doesTemplateHaveTag('new_note', '%%MESSAGE%%', $modsForHesk_settings);
/* Send email to staff */ /* Send email to staff */
while ($user = hesk_dbFetchAssoc($users)) { while ($user = hesk_dbFetchAssoc($users)) {
hesk_mail($user['email'], $subject, $message, $htmlMessage, array(), array(), $hasMessage); hesk_mail($user['email'], $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage);
} }
} }
} }

@ -0,0 +1,160 @@
<?php
/*******************************************************************************
* Title: Help Desk Software HESK
* Version: 2.6.1 from 26th February 2015
* Author: Klemen Stirn
* Website: http://www.hesk.com
********************************************************************************
* COPYRIGHT AND TRADEMARK NOTICE
* Copyright 2005-2015 Klemen Stirn. All Rights Reserved.
* HESK is a registered trademark of Klemen Stirn.
* The HESK may be used and modified free of charge by anyone
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
* By using this code you agree to indemnify Klemen Stirn from any
* liability that might arise from it's use.
* Selling the code for this program, in part or full, without prior
* written consent is expressly forbidden.
* Using this code, in part or full, to create derivate work,
* new scripts or products is expressly forbidden. Obtain permission
* before redistributing this software over the Internet or in
* any other medium. In all cases copyright and header must remain intact.
* This Copyright is in full effect in any country that has International
* Trade Agreements with the United States of America or
* with the European Union.
* Removing any of the copyright notices without purchasing a license
* is expressly forbidden. To remove HESK copyright notice you must purchase
* a license for this script. For more information on how to obtain
* a license please visit the page below:
* https://www.hesk.com/buy.php
*******************************************************************************/
define('IN_SCRIPT',1);
define('HESK_PATH','../');
/* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions();
require(HESK_PATH . 'inc/email_functions.inc.php');
hesk_session_start();
hesk_dbConnect();
hesk_isLoggedIn();
$modsForHesk_settings = mfh_getSettings();
$can_assign_others = hesk_checkPermission('can_assign_others',0);
if ($can_assign_others)
{
$can_assign_self = TRUE;
}
else
{
$can_assign_self = hesk_checkPermission('can_assign_self',0);
}
/* A security check */
hesk_token_check();
/* Ticket ID */
$trackingID = hesk_cleanID() or die($hesklang['int_error'].': '.$hesklang['no_trackID']);
$res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `trackid`='".hesk_dbEscape($trackingID)."' LIMIT 1");
if (hesk_dbNumRows($res) != 1)
{
hesk_error($hesklang['ticket_not_found']);
}
$ticket = hesk_dbFetchAssoc($res);
$_SERVER['PHP_SELF'] = 'admin_ticket.php?track='.$trackingID.'&Refresh='.rand(10000,99999);
/* New owner ID */
$owner = intval( hesk_REQUEST('owner') );
/* If ID is -1 the ticket will be unassigned */
if ($owner == -1)
{
$revision = sprintf($hesklang['thist2'],hesk_date(),'<i>'.$hesklang['unas'].'</i>',$_SESSION['name'].' ('.$_SESSION['user'].')');
$res = hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `owner`=0 , `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') WHERE `trackid`='".hesk_dbEscape($trackingID)."' LIMIT 1");
hesk_process_messages($hesklang['tunasi2'],$_SERVER['PHP_SELF'],'SUCCESS');
}
elseif ($owner < 1)
{
hesk_process_messages($hesklang['nose'],$_SERVER['PHP_SELF'],'NOTICE');
}
/* Verify the new owner and permissions */
$res = hesk_dbQuery("SELECT `id`,`user`,`name`,`email`,`isadmin`,`categories`,`notify_assigned` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`='{$owner}' LIMIT 1");
$row = hesk_dbFetchAssoc($res);
/* Has new owner access to the category? */
if ( ! $row['isadmin'])
{
$row['categories']=explode(',',$row['categories']);
if (!in_array($ticket['category'],$row['categories']))
{
hesk_error($hesklang['unoa']);
}
}
/* Assigning to self? */
if ($can_assign_others || ($owner == $_SESSION['id'] && $can_assign_self))
{
$revision = sprintf($hesklang['thist2'],hesk_date(),$row['name'].' ('.$row['user'].')',$_SESSION['name'].' ('.$_SESSION['user'].')');
$res = hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `owner`={$owner} , `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') WHERE `trackid`='".hesk_dbEscape($trackingID)."' LIMIT 1");
if ($owner != $_SESSION['id'] && !hesk_checkPermission('can_view_ass_others',0))
{
$_SERVER['PHP_SELF']='admin_main.php';
}
}
else
{
hesk_error($hesklang['no_permission']);
}
$ticket['owner'] = $owner;
/* --> Prepare message */
// 1. Generate the array with ticket info that can be used in emails
$info = array(
'email' => $ticket['email'],
'category' => $ticket['category'],
'priority' => $ticket['priority'],
'owner' => $ticket['owner'],
'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'],
);
// 2. Add custom fields to the array
foreach ($hesk_settings['custom_fields'] as $k => $v)
{
$info[$k] = $v['use'] ? $ticket[$k] : '';
}
// 3. Make sure all values are properly formatted for email
$ticket = hesk_ticketToPlain($info, 1, 0);
/* Notify the new owner? */
if ($ticket['owner'] != intval($_SESSION['id']))
{
hesk_notifyAssignedStaff(false, 'ticket_assigned_to_you', $modsForHesk_settings);
}
$tmp = ($owner == $_SESSION['id']) ? $hesklang['tasy'] : $hesklang['taso'];
hesk_process_messages($tmp,$_SERVER['PHP_SELF'],'SUCCESS');
?>

@ -44,6 +44,7 @@ hesk_load_database_functions();
hesk_session_start(); hesk_session_start();
hesk_dbConnect(); hesk_dbConnect();
hesk_isLoggedIn(); hesk_isLoggedIn();
$modsForHesk_settings = mfh_getSettings();
/* Check permissions for this feature */ /* Check permissions for this feature */
if (!isset($_REQUEST['isManager']) || !$_REQUEST['isManager']) { if (!isset($_REQUEST['isManager']) || !$_REQUEST['isManager']) {
@ -103,7 +104,7 @@ if ($statusRow['IsClosed']) // Closed
// Notify customer // Notify customer
require(HESK_PATH . 'inc/email_functions.inc.php'); require(HESK_PATH . 'inc/email_functions.inc.php');
hesk_notifyCustomer('ticket_closed'); hesk_notifyCustomer($modsForHesk_settings,'ticket_closed');
} }
// Log who marked the ticket resolved // Log who marked the ticket resolved

@ -44,6 +44,7 @@ hesk_load_database_functions();
hesk_session_start(); hesk_session_start();
hesk_dbConnect(); hesk_dbConnect();
hesk_isLoggedIn(); hesk_isLoggedIn();
$modsForHesk_settings = mfh_getSettings();
/* Set correct return URL */ /* Set correct return URL */
if (isset($_SERVER['HTTP_REFERER'])) if (isset($_SERVER['HTTP_REFERER']))
@ -311,7 +312,7 @@ else
$ticket['dt'] = hesk_date($ticket['dt'], true); $ticket['dt'] = hesk_date($ticket['dt'], true);
$ticket['lastchange'] = hesk_date($ticket['lastchange'], true); $ticket['lastchange'] = hesk_date($ticket['lastchange'], true);
$ticket = hesk_ticketToPlain($ticket, 1, 0); $ticket = hesk_ticketToPlain($ticket, 1, 0);
hesk_notifyCustomer('ticket_closed'); hesk_notifyCustomer($modsForHesk_settings,'ticket_closed');
} }
} }

@ -38,7 +38,6 @@ define('WYSIWYG',1);
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
@ -52,6 +51,7 @@ if (!isset($_REQUEST['isManager']) || !$_REQUEST['isManager']) {
hesk_checkPermission('can_view_tickets'); hesk_checkPermission('can_view_tickets');
hesk_checkPermission('can_edit_tickets'); hesk_checkPermission('can_edit_tickets');
} }
$modsForHesk_settings = mfh_getSettings();
/* Ticket ID */ /* Ticket ID */
$trackingID = hesk_cleanID() or die($hesklang['int_error'].': '.$hesklang['no_trackID']); $trackingID = hesk_cleanID() or die($hesklang['int_error'].': '.$hesklang['no_trackID']);

@ -36,7 +36,6 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/reporting_functions.inc.php'); require(HESK_PATH . 'inc/reporting_functions.inc.php');
@ -49,6 +48,7 @@ hesk_isLoggedIn();
// Check permissions for this feature // Check permissions for this feature
hesk_checkPermission('can_export'); hesk_checkPermission('can_export');
$modsForHesk_settings = mfh_getSettings();
// Set default values // Set default values
define('CALENDAR',1); define('CALENDAR',1);

@ -39,6 +39,7 @@ define('HESK_PATH','../');
require(HESK_PATH . 'hesk_settings.inc.php'); require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php'); require(HESK_PATH . 'inc/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/status_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
hesk_session_start(); hesk_session_start();
@ -66,7 +67,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<tr> <tr>
<td> <td>
<div class="row" style="padding-top: 20px"> <div class="row" style="padding-top: 20px">
<div class="col-md-10 col-md-offset-1"> <div class="col-md-12">
<div class="panel panel-default"> <div class="panel panel-default">
<div class="panel-heading"> <div class="panel-heading">
<h4><?php echo $hesklang['tickets_found']; ?> <span style="float: right; margin-top: -7px;"><a href="new_ticket.php" class="btn btn-success"><?php echo $hesklang['nti']; ?></a></span></h4> <h4><?php echo $hesklang['tickets_found']; ?> <span style="float: right; margin-top: -7px;"><a href="new_ticket.php" class="btn btn-success"><?php echo $hesklang['nti']; ?></a></span></h4>
@ -99,7 +100,8 @@ LEFT(`message`, 400) AS `message`,
`lastreplier`, `lastreplier`,
`replierid`, `replierid`,
`archive`, `archive`,
`locked` `locked`,
`merged`
"; ";
foreach ($hesk_settings['custom_fields'] as $k=>$v) foreach ($hesk_settings['custom_fields'] as $k=>$v)

@ -43,6 +43,7 @@ hesk_load_database_functions();
hesk_session_start(); hesk_session_start();
hesk_dbConnect(); hesk_dbConnect();
$modsForHesk_settings = mfh_getSettings();
/* What should we do? */ /* What should we do? */
$action = hesk_REQUEST('a'); $action = hesk_REQUEST('a');
@ -70,7 +71,7 @@ exit();
/*** START FUNCTIONS ***/ /*** START FUNCTIONS ***/
function do_login() function do_login()
{ {
global $hesk_settings, $hesklang; global $hesk_settings, $hesklang, $modsForHesk_settings;
$hesk_error_buffer = array(); $hesk_error_buffer = array();
@ -285,7 +286,7 @@ function do_login()
$ticket['dt'] = hesk_date($ticket['dt'], true); $ticket['dt'] = hesk_date($ticket['dt'], true);
$ticket['lastchange'] = hesk_date($ticket['lastchange'], true); $ticket['lastchange'] = hesk_date($ticket['lastchange'], true);
$ticket = hesk_ticketToPlain($ticket, 1, 0); $ticket = hesk_ticketToPlain($ticket, 1, 0);
hesk_notifyCustomer('ticket_closed'); hesk_notifyCustomer($modsForHesk_settings,'ticket_closed');
} }
} }
} }

@ -44,6 +44,7 @@ hesk_load_database_functions();
hesk_session_start(); hesk_session_start();
hesk_dbConnect(); hesk_dbConnect();
hesk_isLoggedIn(); hesk_isLoggedIn();
$modsForHesk_settings = mfh_getSettings();
/* Check permissions for this feature */ /* Check permissions for this feature */
hesk_checkPermission('can_view_tickets'); hesk_checkPermission('can_view_tickets');
@ -98,7 +99,7 @@ else
$ticket['dt'] = hesk_date($ticket['dt'], true); $ticket['dt'] = hesk_date($ticket['dt'], true);
$ticket['lastchange'] = hesk_date($ticket['lastchange'], true); $ticket['lastchange'] = hesk_date($ticket['lastchange'], true);
hesk_notifyCustomer('ticket_closed'); hesk_notifyCustomer($modsForHesk_settings, 'ticket_closed');
} }
} }
} }

@ -37,16 +37,17 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
require(HESK_PATH . 'inc/email_functions.inc.php');
hesk_session_start(); hesk_session_start();
hesk_dbConnect(); hesk_dbConnect();
require(HESK_PATH . 'inc/email_functions.inc.php');
hesk_isLoggedIn(); hesk_isLoggedIn();
$modsForHesk_settings = mfh_getSettings();
/* List of staff */ /* List of staff */
$admins = array(); $admins = array();
$res = hesk_dbQuery("SELECT `id`,`name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` ORDER BY `name` ASC"); $res = hesk_dbQuery("SELECT `id`,`name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` ORDER BY `name` ASC");
@ -289,7 +290,7 @@ function mail_get_ids()
function mail_send() function mail_send()
{ {
global $hesk_settings, $hesklang; global $hesk_settings, $hesklang, $modsForHesk_settings;
/* A security check */ /* A security check */
hesk_token_check('POST'); hesk_token_check('POST');
@ -362,12 +363,12 @@ function mail_send()
/* Format email subject and message for recipient */ /* Format email subject and message for recipient */
$subject = hesk_getEmailSubject('new_pm',$pm,0); $subject = hesk_getEmailSubject('new_pm',$pm,0);
$message = hesk_getEmailMessage('new_pm',$pm,1,0); $message = hesk_getEmailMessage('new_pm',$pm,$modsForHesk_settings,1,0);
$htmlMessage = hesk_getHtmlMessage('new_pm',$pm,1,0); $htmlMessage = hesk_getHtmlMessage('new_pm',$pm,$modsForHesk_settings,1,0);
$hasMessage = hesk_doesTemplateHaveTag('new_pm','%%MESSAGE%%'); $hasMessage = hesk_doesTemplateHaveTag('new_pm','%%MESSAGE%%', $modsForHesk_settings);
/* Send e-mail */ /* Send e-mail */
hesk_mail($pm_recipient['email'], $subject, $message, $htmlMessage, array(), array(), $hasMessage); hesk_mail($pm_recipient['email'], $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage);
} }
unset($_SESSION['mail']); unset($_SESSION['mail']);

@ -37,7 +37,6 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
@ -60,6 +59,8 @@ if ( $action = hesk_REQUEST('a') )
elseif ($action == 'order') {order_saved();} elseif ($action == 'order') {order_saved();}
} }
$modsForHesk_settings = mfh_getSettings();
/* Print header */ /* Print header */
require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); require_once(HESK_PATH . 'inc/headerAdmin.inc.php');

@ -37,7 +37,6 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
@ -72,6 +71,8 @@ if ( $action = hesk_REQUEST('a') )
elseif ($action == 'manager') {change_manager();} elseif ($action == 'manager') {change_manager();}
} }
$modsForHesk_settings = mfh_getSettings();
/* Print header */ /* Print header */
require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); require_once(HESK_PATH . 'inc/headerAdmin.inc.php');

@ -37,7 +37,6 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
@ -374,6 +373,7 @@ if (!isset($_SESSION['hide']['new_article']))
$selectedIndex = -1; $selectedIndex = -1;
} else } else
{ {
$modsForHesk_settings = mfh_getSettings();
$selectedIndex = $modsForHesk_settings['new_kb_article_visibility']; $selectedIndex = $modsForHesk_settings['new_kb_article_visibility'];
} }
?> ?>

@ -37,7 +37,6 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
@ -75,7 +74,9 @@ else {return false;}
//--> //-->
</script> </script>
<?php <?php
$modsForHesk_settings = mfh_getSettings();
$res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."permission_templates` ORDER BY `name` ASC"); $res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."permission_templates` ORDER BY `name` ASC");
$templates = array(); $templates = array();
while ($row = hesk_dbFetchAssoc($res)) { while ($row = hesk_dbFetchAssoc($res)) {

@ -5,7 +5,6 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/status_functions.inc.php'); require(HESK_PATH . 'inc/status_functions.inc.php');
@ -29,6 +28,8 @@ if (isset($_REQUEST['a'])) {
elseif ($_REQUEST['a'] == 'save') { save(); } elseif ($_REQUEST['a'] == 'save') { save(); }
} }
$modsForHesk_settings = mfh_getSettings();
/* Print header */ /* Print header */
require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); require_once(HESK_PATH . 'inc/headerAdmin.inc.php');
@ -148,7 +149,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<i class="fa fa-pencil icon-link" style="color: orange" <i class="fa fa-pencil icon-link" style="color: orange"
data-toggle="tooltip" title="<?php echo $hesklang['edit']; ?>"></i> data-toggle="tooltip" title="<?php echo $hesklang['edit']; ?>"></i>
</span> </span>
<?php echoArrows($j, $numberOfStatuses, $row['ID']); ?> <?php echoArrows($j, $numberOfStatuses, $row['ID'], $modsForHesk_settings); ?>
<?php <?php
// Only show the delete button if (1) it's not a default action and (2) no tickets are set to that status // Only show the delete button if (1) it's not a default action and (2) no tickets are set to that status
$delete = canStatusBeDeleted($row['ID']); $delete = canStatusBeDeleted($row['ID']);
@ -379,8 +380,8 @@ function buildConfirmDeleteModal($statusId) {
<?php <?php
} }
function echoArrows($index, $numberOfStatuses, $statusId) { function echoArrows($index, $numberOfStatuses, $statusId, $modsForHesk_settings) {
global $hesklang, $modsForHesk_settings; global $hesklang;
if ($modsForHesk_settings['statuses_order_column'] == 'name') { if ($modsForHesk_settings['statuses_order_column'] == 'name') {
return; return;

@ -37,7 +37,6 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
@ -46,6 +45,8 @@ hesk_session_start();
hesk_dbConnect(); hesk_dbConnect();
hesk_isLoggedIn(); hesk_isLoggedIn();
$modsForHesk_settings = mfh_getSettings();
/* Check permissions for this feature */ /* Check permissions for this feature */
hesk_checkPermission('can_man_ticket_tpl'); hesk_checkPermission('can_man_ticket_tpl');
@ -66,6 +67,7 @@ if ( $action = hesk_REQUEST('a') )
elseif ($action == 'order') {order_saved();} elseif ($action == 'order') {order_saved();}
} }
/* Print header */ /* Print header */
require_once(HESK_PATH . 'inc/headerAdmin.inc.php'); require_once(HESK_PATH . 'inc/headerAdmin.inc.php');

@ -37,7 +37,6 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/profile_functions.inc.php'); require(HESK_PATH . 'inc/profile_functions.inc.php');
@ -93,6 +92,7 @@ $default_userdata = array(
'notify_note_unassigned' => 1, 'notify_note_unassigned' => 1,
); );
$modsForHesk_settings = mfh_getSettings();
/* A list of all categories */ /* A list of all categories */
$orderBy = $modsForHesk_settings['category_order_column']; $orderBy = $modsForHesk_settings['category_order_column'];
$hesk_settings['categories'] = array(); $hesk_settings['categories'] = array();

@ -0,0 +1,212 @@
<?php
/*******************************************************************************
* Title: Help Desk Software HESK
* Version: 2.6.1 from 26th February 2015
* Author: Klemen Stirn
* Website: http://www.hesk.com
********************************************************************************
* COPYRIGHT AND TRADEMARK NOTICE
* Copyright 2005-2015 Klemen Stirn. All Rights Reserved.
* HESK is a registered trademark of Klemen Stirn.
* The HESK may be used and modified free of charge by anyone
* AS LONG AS COPYRIGHT NOTICES AND ALL THE COMMENTS REMAIN INTACT.
* By using this code you agree to indemnify Klemen Stirn from any
* liability that might arise from it's use.
* Selling the code for this program, in part or full, without prior
* written consent is expressly forbidden.
* Using this code, in part or full, to create derivate work,
* new scripts or products is expressly forbidden. Obtain permission
* before redistributing this software over the Internet or in
* any other medium. In all cases copyright and header must remain intact.
* This Copyright is in full effect in any country that has International
* Trade Agreements with the United States of America or
* with the European Union.
* Removing any of the copyright notices without purchasing a license
* is expressly forbidden. To remove HESK copyright notice you must purchase
* a license for this script. For more information on how to obtain
* a license please visit the page below:
* https://www.hesk.com/buy.php
*******************************************************************************/
define('IN_SCRIPT',1);
define('HESK_PATH','../');
/* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php');
hesk_load_database_functions();
require(HESK_PATH . 'inc/email_functions.inc.php');
hesk_session_start();
hesk_dbConnect();
hesk_isLoggedIn();
$modsForHesk_settings = mfh_getSettings();
/* Check permissions for this feature */
hesk_checkPermission('can_change_cat');
/* A security check */
hesk_token_check('POST');
/* Ticket ID */
$trackingID = hesk_cleanID() or die($hesklang['int_error'].': '.$hesklang['no_trackID']);
/* Category ID */
$category = intval( hesk_POST('category', -1) );
if ($category < 1)
{
hesk_process_messages($hesklang['incat'],'admin_ticket.php?track='.$trackingID.'&Refresh='.rand(10000,99999),'NOTICE');
}
/* Get new category details */
$res = hesk_dbQuery("SELECT `name`,`autoassign` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE `id`='{$category}' LIMIT 1");
if (hesk_dbNumRows($res) != 1)
{
hesk_error("$hesklang[int_error]: $hesklang[kb_cat_inv].");
}
$row = hesk_dbFetchAssoc($res);
/* Should tickets in new category be auto-assigned if necessary? */
if ( ! $row['autoassign'])
{
$hesk_settings['autoassign'] = false;
}
/* Is user allowed to view tickets in new category? */
$category_ok = hesk_okCategory($category,0);
/* Get details about the original ticket */
$res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` WHERE `trackid`='".hesk_dbEscape($trackingID)."' LIMIT 1");
if (hesk_dbNumRows($res) != 1)
{
hesk_error($hesklang['ticket_not_found']);
}
$ticket = hesk_dbFetchAssoc($res);
/* Log that ticket is being moved */
$history = sprintf($hesklang['thist1'],hesk_date(),$row['name'],$_SESSION['name'].' ('.$_SESSION['user'].')');
/* Is the ticket assigned to someone? If yes, check that the user has access to category or change to unassigned */
$need_to_reassign = 0;
if ($ticket['owner'])
{
if ($ticket['owner'] == $_SESSION['id'] && ! $category_ok )
{
$need_to_reassign = 1;
}
else
{
$res = hesk_dbQuery("SELECT `isadmin`,`categories` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` WHERE `id`='".intval($ticket['owner'])."' LIMIT 1");
if (hesk_dbNumRows($res) != 1)
{
$need_to_reassign = 1;
}
else
{
$tmp = hesk_dbFetchAssoc($res);
if ( ! hesk_okCategory($category,0,$tmp['isadmin'], explode(',',$tmp['categories']) ) )
{
$need_to_reassign = 1;
}
}
}
}
/* Reassign automatically if possible */
if ($need_to_reassign || ! $ticket['owner'])
{
$need_to_reassign = 1;
$autoassign_owner = hesk_autoAssignTicket($category);
if ($autoassign_owner)
{
$ticket['owner'] = $autoassign_owner['id'];
$history .= sprintf($hesklang['thist10'],hesk_date(),$autoassign_owner['name'].' ('.$autoassign_owner['user'].')');
}
else
{
$ticket['owner'] = 0;
}
}
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `category`='".intval($category)."', `owner`='".intval($ticket['owner'])."' , `history`=CONCAT(`history`,'".hesk_dbEscape($history)."') WHERE `trackid`='".hesk_dbEscape($trackingID)."' LIMIT 1");
$ticket['category'] = $category;
/* --> Prepare message */
// 1. Generate the array with ticket info that can be used in emails
$info = array(
'email' => $ticket['email'],
'category' => $ticket['category'],
'priority' => $ticket['priority'],
'owner' => $ticket['owner'],
'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'],
);
// 2. Add custom fields to the array
foreach ($hesk_settings['custom_fields'] as $k => $v)
{
$info[$k] = $v['use'] ? $ticket[$k] : '';
}
// 3. Make sure all values are properly formatted for email
$ticket = hesk_ticketToPlain($info, 1, 0);
/* Need to notify any staff? */
/* --> From autoassign? */
if ($need_to_reassign && ! empty($autoassign_owner['email']) )
{
hesk_notifyAssignedStaff($autoassign_owner, 'ticket_assigned_to_you', $modsForHesk_settings);
}
/* --> No autoassign, find and notify appropriate staff */
elseif ( ! $ticket['owner'] )
{
hesk_notifyStaff('category_moved', "`notify_new_unassigned`='1' AND `id`!=".intval($_SESSION['id']), $modsForHesk_settings);
}
/* Is the user allowed to view tickets in the new category? */
if ($category_ok)
{
/* Ticket has an owner */
if ($ticket['owner'])
{
/* Staff is owner or can view tickets assigned to others */
if ($ticket['owner'] == $_SESSION['id'] || hesk_checkPermission('can_view_ass_others',0) )
{
hesk_process_messages($hesklang['moved_to'],'admin_ticket.php?track='.$trackingID.'&Refresh='.rand(10000,99999),'SUCCESS');
}
else
{
hesk_process_messages($hesklang['moved_to'],'admin_main.php','SUCCESS');
}
}
/* Ticket is unassigned, staff can view unassigned tickets */
elseif (hesk_checkPermission('can_view_unassigned',0))
{
hesk_process_messages($hesklang['moved_to'],'admin_ticket.php?track='.$trackingID.'&Refresh='.rand(10000,99999),'SUCCESS');
}
/* Ticket is unassigned, staff cannot view unassigned tickets */
else
{
hesk_process_messages($hesklang['moved_to'],'admin_main.php','SUCCESS');
}
}
else
{
hesk_process_messages($hesklang['moved_to'],'admin_main.php','SUCCESS');
}
?>

@ -37,9 +37,15 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
// Connect to database and check for brute force attempts
hesk_load_database_functions();
hesk_dbConnect();
hesk_limitBfAttempts();
$modsForHesk_settings = mfh_getSettings();
// Is the password reset function enabled? // Is the password reset function enabled?
if ( ! $hesk_settings['reset_pass']) if ( ! $hesk_settings['reset_pass'])
{ {
@ -133,11 +139,6 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST')
} }
} }
// Connect to database and check for brute force attempts
hesk_load_database_functions();
hesk_dbConnect();
hesk_limitBfAttempts();
// Get email // Get email
$email = hesk_validateEmail( hesk_POST('email'), 'ERR', 0) or $hesk_error_buffer['email']=$hesklang['enter_valid_email']; $email = hesk_validateEmail( hesk_POST('email'), 'ERR', 0) or $hesk_error_buffer['email']=$hesklang['enter_valid_email'];
@ -180,8 +181,8 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST')
require(HESK_PATH . 'inc/email_functions.inc.php'); require(HESK_PATH . 'inc/email_functions.inc.php');
// Get the email message // Get the email message
$msg = hesk_getEmailMessage('reset_password',array(),1,0,1); $msg = hesk_getEmailMessage('reset_password',array(),$modsForHesk_settings,1,0,1);
$htmlMsg = hesk_getHtmlMessage('reset_password',array(),1,0,1); $htmlMsg = hesk_getHtmlMessage('reset_password',array(),$modsForHesk_settings,1,0,1);
// Replace message special tags // Replace message special tags
$msg = str_replace('%%NAME%%', hesk_msgToPlain($row['name'],1,1), $msg); $msg = str_replace('%%NAME%%', hesk_msgToPlain($row['name'],1,1), $msg);
@ -194,7 +195,7 @@ if ($_SERVER['REQUEST_METHOD'] == 'POST')
$htmlMsg = str_replace('%%PASSWORD_RESET%%', $hesk_settings['hesk_url'].'/'.$hesk_settings['admin_dir'].'/password.php?h='.$hash, $htmlMsg); $htmlMsg = str_replace('%%PASSWORD_RESET%%', $hesk_settings['hesk_url'].'/'.$hesk_settings['admin_dir'].'/password.php?h='.$hash, $htmlMsg);
// Send email // Send email
hesk_mail($email, $hesklang['reset_password'], $msg, $htmlMsg); hesk_mail($email, $hesklang['reset_password'], $msg, $htmlMsg, $modsForHesk_settings);
// Show success // Show success
hesk_process_messages($hesklang['pemls'],'NOREDIRECT','SUCCESS'); hesk_process_messages($hesklang['pemls'],'NOREDIRECT','SUCCESS');

@ -37,7 +37,6 @@ define('HESK_PATH','../');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php'); require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/status_functions.inc.php'); require(HESK_PATH . 'inc/status_functions.inc.php');

@ -1,23 +1,3 @@
<?php
header("Content-type: text/css; charset: UTF-8");
require_once('../modsForHesk_settings.inc.php');
$navbarBackgroundColor = $modsForHesk_settings['navbarBackgroundColor'];
$navbarBrandColor = $modsForHesk_settings['navbarBrandColor'];
$navbarBrandHoverColor = $modsForHesk_settings['navbarBrandHoverColor'];
$navbarItemTextColor = $modsForHesk_settings['navbarItemTextColor'];
$navbarItemTextHoverColor = $modsForHesk_settings['navbarItemTextHoverColor'];
$navbarItemTextSelectedColor = $modsForHesk_settings['navbarItemTextSelectedColor'];
$navbarItemSelectedBackgroundColor = $modsForHesk_settings['navbarItemSelectedBackgroundColor'];
$dropdownItemTextColor = $modsForHesk_settings['dropdownItemTextColor'];
$dropdownItemTextHoverColor = $modsForHesk_settings['dropdownItemTextHoverColor'];
$dropdownItemTextHoverBackgroundColor = $modsForHesk_settings['dropdownItemTextHoverBackgroundColor'];
$questionMarkColor = $modsForHesk_settings['questionMarkColor'];
?>
.nu-rtlFloatLeft { .nu-rtlFloatLeft {
/* Don't do anything; the pager looks good already */ /* Don't do anything; the pager looks good already */
} }
@ -89,47 +69,6 @@
.navbar { .navbar {
margin-bottom: 0; margin-bottom: 0;
} }
.navbar-default {
background-color: <?php echo $navbarBackgroundColor; ?>;
background-image: none;
filter: none;
}
.navbar-default .navbar-brand {
color: <?php echo $navbarBrandColor; ?>;
}
.navbar-default .navbar-brand:focus, .navbar-default .navbar-brand:hover {
color: <?php echo $navbarBrandHoverColor; ?>;
background-color: transparent;
}
.navbar-default .navbar-nav>li>a {
color: <?php echo $navbarItemTextColor; ?>;
}
.navbar-default .navbar-nav>li>a:focus, .navbar-default .navbar-nav>li>a:hover {
color: <?php echo $navbarItemTextHoverColor; ?>;
background-color: transparent;
}
.dropdown-menu>li>a {
color: <?php echo $dropdownItemTextColor; ?>;
}
.dropdown-menu>li>a:focus, .dropdown-menu>li>a:hover {
color: <?php echo $dropdownItemTextHoverColor; ?>;
text-decoration: none;
background-color: <?php echo $dropdownItemTextHoverBackgroundColor; ?>;
}
.navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:focus, .navbar-default .navbar-nav>.open>a:hover {
color: <?php echo $navbarItemTextSelectedColor; ?>;
background-color: <?php echo $navbarItemSelectedBackgroundColor; ?>;
background-image: none;
}
.settingsquestionmark {
color: <?php echo $questionMarkColor; ?>;
font-size: 14px;
cursor: pointer;
}
.h3questionmark {
color: <?php echo $questionMarkColor; ?>;
font-size: 14px;
}
.h3questionmark:hover { .h3questionmark:hover {
text-decoration: underline; text-decoration: underline;
} }

@ -1,6 +1,5 @@
<?php <?php
header("Content-type: text/css; charset: UTF-8"); header("Content-type: text/css; charset: UTF-8");
require_once('../modsForHesk_settings.inc.php');
$navbarBackgroundColor = $modsForHesk_settings['navbarBackgroundColor']; $navbarBackgroundColor = $modsForHesk_settings['navbarBackgroundColor'];
$navbarBrandColor = $modsForHesk_settings['navbarBrandColor']; $navbarBrandColor = $modsForHesk_settings['navbarBrandColor'];

@ -37,7 +37,6 @@ define('HESK_PATH','./');
// Get all the required files and functions // Get all the required files and functions
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
@ -141,6 +140,7 @@ else
// Path of the file on the server // Path of the file on the server
$realpath = $hesk_settings['attach_dir'] . '/' . $file['saved_name']; $realpath = $hesk_settings['attach_dir'] . '/' . $file['saved_name'];
if (isset($_GET['kb_att'])) { if (isset($_GET['kb_att'])) {
$modsForHesk_settings = mfh_getSettings();
$realpath = $modsForHesk_settings['kb_attach_dir'] . '/' . $file['saved_name']; $realpath = $modsForHesk_settings['kb_attach_dir'] . '/' . $file['saved_name'];
} }

@ -498,7 +498,8 @@ function hesk_autoLogin($noredirect=0)
$ticket['dt'] = hesk_date($ticket['dt'], true); $ticket['dt'] = hesk_date($ticket['dt'], true);
$ticket['lastchange'] = hesk_date($ticket['lastchange'], true); $ticket['lastchange'] = hesk_date($ticket['lastchange'], true);
$ticket = hesk_ticketToPlain($ticket, 1, 0); $ticket = hesk_ticketToPlain($ticket, 1, 0);
hesk_notifyCustomer('ticket_closed'); $modsForHesk_settings = mfh_getSettings();
hesk_notifyCustomer($modsForHesk_settings, 'ticket_closed');
} }
} }
} }

@ -1988,4 +1988,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)); $res = hesk_dbQuery('SELECT `download_count` FROM `'.hesk_dbEscape($hesk_settings['db_pfix'].$table)."` WHERE `att_id` = ".intval($att_id));
$rec = hesk_dbFetchAssoc($res); $rec = hesk_dbFetchAssoc($res);
return $rec['download_count']; 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` <> 'modsForHeskVersion'");
while ($row = hesk_dbFetchAssoc($res)) {
$settings[$row['Key']] = $row['Value'];
}
return $settings;
} }

@ -35,12 +35,6 @@
/* Check if this is a valid include */ /* Check if this is a valid include */
if (!defined('IN_SCRIPT')) {die('Invalid attempt');} if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
// Include modsForHesk_settings.inc.php if it hasn't been included already
if (!isset($modsForHesk_settings))
{
include(HESK_PATH . 'modsForHesk_settings.inc.php');
}
/* Get includes for SMTP */ /* Get includes for SMTP */
if ($hesk_settings['smtp']) if ($hesk_settings['smtp'])
{ {
@ -51,7 +45,7 @@ if ($hesk_settings['smtp'])
} }
} }
function hesk_notifyCustomerForVerifyEmail($email_template = 'verify_email', $activationKey) function hesk_notifyCustomerForVerifyEmail($email_template = 'verify_email', $activationKey, $modsForHesk_settings)
{ {
global $hesk_settings, $ticket; global $hesk_settings, $ticket;
@ -62,14 +56,14 @@ function hesk_notifyCustomerForVerifyEmail($email_template = 'verify_email', $ac
// Format email subject and message // Format email subject and message
$subject = hesk_getEmailSubject($email_template, $ticket); $subject = hesk_getEmailSubject($email_template, $ticket);
$message = hesk_getEmailMessage($email_template, $ticket); $message = hesk_getEmailMessage($email_template, $ticket, $modsForHesk_settings);
$htmlMessage = hesk_getHtmlMessage($email_template, $ticket); $htmlMessage = hesk_getHtmlMessage($email_template, $ticket, $modsForHesk_settings);
$activationUrl = $hesk_settings['hesk_url'] . '/verifyemail.php?key=%%ACTIVATIONKEY%%'; $activationUrl = $hesk_settings['hesk_url'] . '/verifyemail.php?key=%%ACTIVATIONKEY%%';
$message = str_replace('%%VERIFYURL%%', $activationUrl, $message); $message = str_replace('%%VERIFYURL%%', $activationUrl, $message);
$htmlMessage = str_replace('%%VERIFYURL%%', $activationUrl, $htmlMessage); $htmlMessage = str_replace('%%VERIFYURL%%', $activationUrl, $htmlMessage);
$message = str_replace('%%ACTIVATIONKEY%%', $activationKey, $message); $message = str_replace('%%ACTIVATIONKEY%%', $activationKey, $message);
$htmlMessage = str_replace('%%ACTIVATIONKEY%%', $activationKey, $htmlMessage); $htmlMessage = str_replace('%%ACTIVATIONKEY%%', $activationKey, $htmlMessage);
$hasMessage = hesk_doesTemplateHaveTag($email_template, '%%MESSAGE%%'); $hasMessage = hesk_doesTemplateHaveTag($email_template, '%%MESSAGE%%', $modsForHesk_settings);
// Add Cc / Bcc recipents if needed // Add Cc / Bcc recipents if needed
$ccEmails = array(); $ccEmails = array();
@ -88,11 +82,11 @@ function hesk_notifyCustomerForVerifyEmail($email_template = 'verify_email', $ac
} }
} }
hesk_mail($ticket['email'], $subject, $message, $htmlMessage, $ccEmails, $bccEmails, $hasMessage); hesk_mail($ticket['email'], $subject, $message, $htmlMessage, $modsForHesk_settings, $ccEmails, $bccEmails, $hasMessage);
} }
function hesk_notifyCustomer($email_template = 'new_ticket') function hesk_notifyCustomer($modsForHesk_settings, $email_template = 'new_ticket')
{ {
global $hesk_settings, $hesklang, $ticket; global $hesk_settings, $hesklang, $ticket;
@ -112,9 +106,9 @@ function hesk_notifyCustomer($email_template = 'new_ticket')
// Format email subject and message // Format email subject and message
$subject = hesk_getEmailSubject($email_template,$ticket); $subject = hesk_getEmailSubject($email_template,$ticket);
$message = hesk_getEmailMessage($email_template,$ticket); $message = hesk_getEmailMessage($email_template,$ticket,$modsForHesk_settings);
$htmlMessage = hesk_getHtmlMessage($email_template,$ticket); $htmlMessage = hesk_getHtmlMessage($email_template,$ticket, $modsForHesk_settings);
$hasMessage = hesk_doesTemplateHaveTag($email_template,'%%MESSAGE%%'); $hasMessage = hesk_doesTemplateHaveTag($email_template,'%%MESSAGE%%', $modsForHesk_settings);
// Add Cc / Bcc recipents if needed // Add Cc / Bcc recipents if needed
$ccEmails = array(); $ccEmails = array();
@ -132,7 +126,7 @@ function hesk_notifyCustomer($email_template = 'new_ticket')
} }
// Send e-mail // Send e-mail
hesk_mail($ticket['email'], $subject, $message, $htmlMessage, $ccEmails, $bccEmails, $hasMessage); hesk_mail($ticket['email'], $subject, $message, $htmlMessage, $modsForHesk_settings, $ccEmails, $bccEmails, $hasMessage);
// Reset the language if it was changed // Reset the language if it was changed
hesk_resetLanguage(); hesk_resetLanguage();
@ -142,7 +136,7 @@ function hesk_notifyCustomer($email_template = 'new_ticket')
} // END hesk_notifyCustomer() } // END hesk_notifyCustomer()
function hesk_notifyAssignedStaff($autoassign_owner, $email_template, $type = 'notify_assigned') function hesk_notifyAssignedStaff($autoassign_owner, $email_template, $modsForHesk_settings, $type = 'notify_assigned')
{ {
global $hesk_settings, $hesklang, $ticket; global $hesk_settings, $hesklang, $ticket;
@ -174,12 +168,12 @@ function hesk_notifyAssignedStaff($autoassign_owner, $email_template, $type = 'n
/* Format email subject and message for staff */ /* Format email subject and message for staff */
$subject = hesk_getEmailSubject($email_template,$ticket); $subject = hesk_getEmailSubject($email_template,$ticket);
$message = hesk_getEmailMessage($email_template,$ticket,1); $message = hesk_getEmailMessage($email_template,$ticket,$modsForHesk_settings,1);
$htmlMessage = hesk_getHtmlMessage($email_template,$ticket,1); $htmlMessage = hesk_getHtmlMessage($email_template,$ticket,$modsForHesk_settings,1);
$hasMessage = hesk_doesTemplateHaveTag($email_template,'%%MESSAGE%%'); $hasMessage = hesk_doesTemplateHaveTag($email_template,'%%MESSAGE%%', $modsForHesk_settings);
/* Send email to staff */ /* Send email to staff */
hesk_mail($autoassign_owner['email'], $subject, $message, $htmlMessage, array(), array(), $hasMessage); hesk_mail($autoassign_owner['email'], $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage);
/* Reset language to original one */ /* Reset language to original one */
hesk_resetLanguage(); hesk_resetLanguage();
@ -189,7 +183,7 @@ function hesk_notifyAssignedStaff($autoassign_owner, $email_template, $type = 'n
} // END hesk_notifyAssignedStaff() } // END hesk_notifyAssignedStaff()
function hesk_notifyStaff($email_template,$sql_where,$is_ticket=1) function hesk_notifyStaff($email_template,$sql_where,$modsForHesk_settings,$is_ticket=1)
{ {
global $hesk_settings, $hesklang, $ticket; global $hesk_settings, $hesklang, $ticket;
@ -225,7 +219,7 @@ function hesk_notifyStaff($email_template,$sql_where,$is_ticket=1)
/* Make sure each user gets email in his/her preferred language */ /* Make sure each user gets email in his/her preferred language */
$current_language = 'NONE'; $current_language = 'NONE';
$recipients = array(); $recipients = array();
$hasMessage = hesk_doesTemplateHaveTag($email_template,'%%MESSAGE%%'); $hasMessage = hesk_doesTemplateHaveTag($email_template,'%%MESSAGE%%', $modsForHesk_settings);
/* Loop through staff */ /* Loop through staff */
foreach ($admins as $admin) foreach ($admins as $admin)
@ -248,7 +242,7 @@ function hesk_notifyStaff($email_template,$sql_where,$is_ticket=1)
if ($current_language != 'NONE') if ($current_language != 'NONE')
{ {
/* Send e-mail to staff */ /* Send e-mail to staff */
hesk_mail(implode(',',$recipients), $subject, $message, $htmlMessage, array(), array(), $hasMessage); hesk_mail(implode(',',$recipients), $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage);
/* Reset list of email addresses */ /* Reset list of email addresses */
$recipients = array(); $recipients = array();
@ -259,9 +253,9 @@ function hesk_notifyStaff($email_template,$sql_where,$is_ticket=1)
/* Format staff email subject and message for this language */ /* Format staff email subject and message for this language */
$subject = hesk_getEmailSubject($email_template,$ticket); $subject = hesk_getEmailSubject($email_template,$ticket);
$message = hesk_getEmailMessage($email_template,$ticket,$is_ticket); $message = hesk_getEmailMessage($email_template,$ticket,$modsForHesk_settings,$is_ticket);
$htmlMessage = hesk_getHtmlMessage($email_template,$ticket,$is_ticket); $htmlMessage = hesk_getHtmlMessage($email_template,$ticket,$modsForHesk_settings,$is_ticket);
$hasMessage = hesk_doesTemplateHaveTag($email_template, '%%MESSAGE%%'); $hasMessage = hesk_doesTemplateHaveTag($email_template, '%%MESSAGE%%', $modsForHesk_settings);
/* Add email to the recipients list */ /* Add email to the recipients list */
$recipients[] = $admin['email']; $recipients[] = $admin['email'];
@ -272,7 +266,7 @@ function hesk_notifyStaff($email_template,$sql_where,$is_ticket=1)
} }
/* Send email messages to the remaining staff */ /* Send email messages to the remaining staff */
hesk_mail(implode(',',$recipients), $subject, $message, $htmlMessage, array(), array(), $hasMessage); hesk_mail(implode(',',$recipients), $subject, $message, $htmlMessage, $modsForHesk_settings, array(), array(), $hasMessage);
/* Reset language to original one */ /* Reset language to original one */
hesk_resetLanguage(); hesk_resetLanguage();
@ -334,9 +328,9 @@ function hesk_validEmails()
} // END hesk_validEmails() } // END hesk_validEmails()
function hesk_mail($to,$subject,$message,$htmlMessage,$cc=array(),$bcc=array(),$hasMessageTag = false) function hesk_mail($to,$subject,$message,$htmlMessage,$modsForHesk_settings,$cc=array(),$bcc=array(),$hasMessageTag = false)
{ {
global $hesk_settings, $hesklang, $modsForHesk_settings, $ticket; global $hesk_settings, $hesklang, $ticket;
// Are we in demo mode or are all email fields blank? If so, don't send an email. // Are we in demo mode or are all email fields blank? If so, don't send an email.
if ( defined('HESK_DEMO') if ( defined('HESK_DEMO')
@ -624,9 +618,9 @@ function hesk_getEmailSubject($eml_file, $ticket='', $is_ticket=1, $strip=0)
} // hesk_getEmailSubject() } // hesk_getEmailSubject()
function hesk_getHtmlMessage($eml_file, $ticket, $is_admin=0, $is_ticket=1, $just_message=0) function hesk_getHtmlMessage($eml_file, $ticket, $modsForHesk_settings, $is_admin=0, $is_ticket=1, $just_message=0)
{ {
global $hesk_settings, $hesklang, $modsForHesk_settings; global $hesk_settings, $hesklang;
// Demo mode // Demo mode
if ( defined('HESK_DEMO') || !$modsForHesk_settings['html_emails']) if ( defined('HESK_DEMO') || !$modsForHesk_settings['html_emails'])
@ -655,11 +649,11 @@ function hesk_getHtmlMessage($eml_file, $ticket, $is_admin=0, $is_ticket=1, $jus
} }
//Perform logic common between hesk_getEmailMessage and hesk_getHtmlMessage //Perform logic common between hesk_getEmailMessage and hesk_getHtmlMessage
$msg = hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message, true); $msg = hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message, $modsForHesk_settings, true);
return $msg; return $msg;
} }
function hesk_getEmailMessage($eml_file, $ticket, $is_admin=0, $is_ticket=1, $just_message=0) function hesk_getEmailMessage($eml_file, $ticket, $modsForHesk_settings, $is_admin=0, $is_ticket=1, $just_message=0)
{ {
global $hesk_settings, $hesklang; global $hesk_settings, $hesklang;
@ -690,14 +684,14 @@ function hesk_getEmailMessage($eml_file, $ticket, $is_admin=0, $is_ticket=1, $ju
hesk_error($hesklang['emfm'].': '.$eml_file); hesk_error($hesklang['emfm'].': '.$eml_file);
} }
$msg = hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message); $msg = hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message, $modsForHesk_settings);
return $msg; return $msg;
} // END hesk_getEmailMessage } // END hesk_getEmailMessage
function hesk_doesTemplateHaveTag($eml_file, $tag) function hesk_doesTemplateHaveTag($eml_file, $tag, $modsForHesk_settings)
{ {
global $hesk_settings, $modsForHesk_settings; global $hesk_settings;
$path = 'language/' . $hesk_settings['languages'][$hesk_settings['language']]['folder'] . '/emails/'. $eml_file .'.txt'; $path = 'language/' . $hesk_settings['languages'][$hesk_settings['language']]['folder'] . '/emails/'. $eml_file .'.txt';
$htmlHasTag = false; $htmlHasTag = false;
if ($modsForHesk_settings['html_emails']) { if ($modsForHesk_settings['html_emails']) {
@ -709,9 +703,9 @@ function hesk_doesTemplateHaveTag($eml_file, $tag)
return !(strpos($emailContents, $tag) === false) || $htmlHasTag; return !(strpos($emailContents, $tag) === false) || $htmlHasTag;
} }
function hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message, $isForHtml = 0) function hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message, $modsForHesk_settings, $isForHtml = 0)
{ {
global $hesk_settings, $hesklang, $modsForHesk_settings; global $hesk_settings, $hesklang;
/* Return just the message without any processing? */ /* Return just the message without any processing? */
if ($just_message) if ($just_message)
@ -833,7 +827,6 @@ function hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message
} }
// Add direct links to any attachments at the bottom of the email message OR add them as attachments, depending on the settings // Add direct links to any attachments at the bottom of the email message OR add them as attachments, depending on the settings
// if ($modsForHesk_settings['attachments'] == 'inline' (other is 'attachment') {...}
if ($hesk_settings['attachments']['use'] && isset($ticket['attachments']) && strlen($ticket['attachments']) ) if ($hesk_settings['attachments']['use'] && isset($ticket['attachments']) && strlen($ticket['attachments']) )
{ {
if (!$modsForHesk_settings['attachments']) { if (!$modsForHesk_settings['attachments']) {

@ -34,7 +34,11 @@
/* Check if this is a valid include */ /* Check if this is a valid include */
if (!defined('IN_SCRIPT')) {die('Invalid attempt');} 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();
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"> <html xmlns="http://www.w3.org/1999/xhtml">
@ -42,7 +46,7 @@ require(HESK_PATH . 'modsForHesk_settings.inc.php');
<title><?php echo (isset($hesk_settings['tmp_title']) ? $hesk_settings['tmp_title'] : $hesk_settings['hesk_title']); ?></title> <title><?php echo (isset($hesk_settings['tmp_title']) ? $hesk_settings['tmp_title'] : $hesk_settings['hesk_title']); ?></title>
<meta http-equiv="Content-Type" content="text/html;charset=<?php echo $hesklang['ENCODING']; ?>" /> <meta http-equiv="Content-Type" content="text/html;charset=<?php echo $hesklang['ENCODING']; ?>" />
<meta name="viewport" content="width=device-width, user-scalable=no"> <meta name="viewport" content="width=device-width, user-scalable=no">
<meta name="theme-color" content="<?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>"> <meta name="theme-color" content="<?php echo '#414a5c'; ?>">
<?php if ($modsForHesk_settings['rtl']) { ?> <?php if ($modsForHesk_settings['rtl']) { ?>
<link href="<?php echo HESK_PATH; ?>hesk_style_RTL.css?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" /> <link href="<?php echo HESK_PATH; ?>hesk_style_RTL.css?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" />
<?php } else { ?> <?php } else { ?>
@ -55,7 +59,7 @@ require(HESK_PATH . 'modsForHesk_settings.inc.php');
<link href="<?php echo HESK_PATH; ?>css/bootstrap-rtl.min.css?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" /> <link href="<?php echo HESK_PATH; ?>css/bootstrap-rtl.min.css?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" />
<link href="<?php echo HESK_PATH; ?>css/hesk_newStyleRTL.php?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" /> <link href="<?php echo HESK_PATH; ?>css/hesk_newStyleRTL.php?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" />
<?php } else { ?> <?php } else { ?>
<link href="<?php echo HESK_PATH; ?>css/hesk_newStyle.php?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" /> <link href="<?php echo HESK_PATH; ?>css/hesk_newStyle.css?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" />
<?php } ?> <?php } ?>
<link href="<?php echo HESK_PATH; ?>css/bootstrap-iconpicker.min.css" rel="stylesheet"> <link href="<?php echo HESK_PATH; ?>css/bootstrap-iconpicker.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet"> <link href="//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
@ -70,6 +74,47 @@ require(HESK_PATH . 'modsForHesk_settings.inc.php');
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-octicon-2.1.2.js"></script> <script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-octicon-2.1.2.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script> <script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
<style>
.navbar-default {
background-color: <?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>;
background-image: none;
filter: none;
}
.navbar-default .navbar-brand {
color: <?php echo $modsForHesk_settings['navbarBrandColor']; ?>;
}
.navbar-default .navbar-brand:focus, .navbar-default .navbar-brand:hover {
color: <?php echo $modsForHesk_settings['navbarBrandHoverColor']; ?>;
background-color: transparent;
}
.navbar-default .navbar-nav>li>a {
color: <?php echo $modsForHesk_settings['navbarItemTextColor']; ?>;
}
.navbar-default .navbar-nav>li>a:focus, .navbar-default .navbar-nav>li>a:hover {
color: <?php echo $modsForHesk_settings['navbarItemTextHoverColor']; ?>;
background-color: transparent;
}
.dropdown-menu>li>a {
color: <?php echo $modsForHesk_settings['dropdownItemTextColor']; ?>;
}
.dropdown-menu>li>a:focus, .dropdown-menu>li>a:hover {
color: <?php echo $modsForHesk_settings['dropdownItemTextHoverColor']; ?>;
text-decoration: none;
background-color: <?php echo $modsForHesk_settings['dropdownItemTextHoverBackgroundColor']; ?>;
}
.navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:focus, .navbar-default .navbar-nav>.open>a:hover {
color: <?php echo $modsForHesk_settings['navbarItemTextSelectedColor']; ?>;
background-color: <?php echo $modsForHesk_settings['navbarItemSelectedBackgroundColor']; ?>;
background-image: none;
}
.settingsquestionmark {
color: <?php echo $modsForHesk_settings['questionMarkColor']; ?>;
cursor: pointer;
}
.h3questionmark {
color: <?php echo $modsForHesk_settings['questionMarkColor']; ?>;
}
</style>
<?php <?php

@ -34,7 +34,8 @@
/* Check if this is a valid include */ /* Check if this is a valid include */
if (!defined('IN_SCRIPT')) {die('Invalid attempt');} if (!defined('IN_SCRIPT')) {die('Invalid attempt');}
require(HESK_PATH . 'modsForHesk_settings.inc.php');
$modsForHesk_settings = mfh_getSettings();
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
@ -42,7 +43,7 @@ require(HESK_PATH . 'modsForHesk_settings.inc.php');
<title><?php echo (isset($hesk_settings['tmp_title']) ? $hesk_settings['tmp_title'] : $hesk_settings['hesk_title']); ?></title> <title><?php echo (isset($hesk_settings['tmp_title']) ? $hesk_settings['tmp_title'] : $hesk_settings['hesk_title']); ?></title>
<meta http-equiv="Content-Type" content="text/html;charset=<?php echo $hesklang['ENCODING']; ?>" /> <meta http-equiv="Content-Type" content="text/html;charset=<?php echo $hesklang['ENCODING']; ?>" />
<meta name="viewport" content="width=device-width, user-scalable=no"> <meta name="viewport" content="width=device-width, user-scalable=no">
<meta name="theme-color" content="<?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>"> <meta name="theme-color" content="<?php echo '#414a5c'; ?>">
<?php if ($modsForHesk_settings['rtl']) { ?> <?php if ($modsForHesk_settings['rtl']) { ?>
<link href="<?php echo HESK_PATH; ?>hesk_style_RTL.css?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" /> <link href="<?php echo HESK_PATH; ?>hesk_style_RTL.css?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" />
<?php } else { ?> <?php } else { ?>
@ -55,7 +56,7 @@ require(HESK_PATH . 'modsForHesk_settings.inc.php');
<link href="<?php echo HESK_PATH; ?>css/bootstrap-rtl.min.css?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" /> <link href="<?php echo HESK_PATH; ?>css/bootstrap-rtl.min.css?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" />
<link href="<?php echo HESK_PATH; ?>css/hesk_newStyleRTL.php?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" /> <link href="<?php echo HESK_PATH; ?>css/hesk_newStyleRTL.php?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" />
<?php } else { ?> <?php } else { ?>
<link href="<?php echo HESK_PATH; ?>css/hesk_newStyle.php?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" /> <link href="<?php echo HESK_PATH; ?>css/hesk_newStyle.css?v=<?php echo $hesk_settings['hesk_version']; ?>" type="text/css" rel="stylesheet" />
<?php } ?> <?php } ?>
<link href="<?php echo HESK_PATH; ?>css/bootstrap-iconpicker.min.css" rel="stylesheet"> <link href="<?php echo HESK_PATH; ?>css/bootstrap-iconpicker.min.css" rel="stylesheet">
<link href="//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet"> <link href="//netdna.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css" rel="stylesheet">
@ -70,6 +71,47 @@ require(HESK_PATH . 'modsForHesk_settings.inc.php');
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-octicon-2.1.2.js"></script> <script type="text/javascript" src="<?php echo HESK_PATH; ?>js/iconset-octicon-2.1.2.js"></script>
<script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script> <script type="text/javascript" src="<?php echo HESK_PATH; ?>js/bootstrap-iconpicker.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script> <script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/leaflet/0.7.3/leaflet.js"></script>
<style>
.navbar-default {
background-color: <?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>;
background-image: none;
filter: none;
}
.navbar-default .navbar-brand {
color: <?php echo $modsForHesk_settings['navbarBrandColor']; ?>;
}
.navbar-default .navbar-brand:focus, .navbar-default .navbar-brand:hover {
color: <?php echo $modsForHesk_settings['navbarBrandHoverColor']; ?>;
background-color: transparent;
}
.navbar-default .navbar-nav>li>a {
color: <?php echo $modsForHesk_settings['navbarItemTextColor']; ?>;
}
.navbar-default .navbar-nav>li>a:focus, .navbar-default .navbar-nav>li>a:hover {
color: <?php echo $modsForHesk_settings['navbarItemTextHoverColor']; ?>;
background-color: transparent;
}
.dropdown-menu>li>a {
color: <?php echo $modsForHesk_settings['dropdownItemTextColor']; ?>;
}
.dropdown-menu>li>a:focus, .dropdown-menu>li>a:hover {
color: <?php echo $modsForHesk_settings['dropdownItemTextHoverColor']; ?>;
text-decoration: none;
background-color: <?php echo $modsForHesk_settings['dropdownItemTextHoverBackgroundColor']; ?>;
}
.navbar-default .navbar-nav>.open>a, .navbar-default .navbar-nav>.open>a:focus, .navbar-default .navbar-nav>.open>a:hover {
color: <?php echo $modsForHesk_settings['navbarItemTextSelectedColor']; ?>;
background-color: <?php echo $modsForHesk_settings['navbarItemSelectedBackgroundColor']; ?>;
background-image: none;
}
.settingsquestionmark {
color: <?php echo $modsForHesk_settings['questionMarkColor']; ?>;
cursor: pointer;
}
.h3questionmark {
color: <?php echo $modsForHesk_settings['questionMarkColor']; ?>;
}
</style>
<?php <?php
/* Prepare Javascript that browser should load on page load */ /* Prepare Javascript that browser should load on page load */

@ -43,7 +43,6 @@ require(HESK_PATH . 'inc/htmLawed.php');
require(HESK_PATH . 'inc/mail/rfc822_addresses.php'); require(HESK_PATH . 'inc/mail/rfc822_addresses.php');
require(HESK_PATH . 'inc/mail/mime_parser.php'); require(HESK_PATH . 'inc/mail/mime_parser.php');
require(HESK_PATH . 'inc/mail/email_parser.php'); require(HESK_PATH . 'inc/mail/email_parser.php');
require(HESK_PATH . 'modsForHesk_settings.inc.php');
/*** FUNCTIONS ***/ /*** FUNCTIONS ***/
@ -301,12 +300,13 @@ function hesk_email2ticket($results, $pop3 = 0, $set_category = 1, $set_priority
// --> If ticket is assigned just notify the owner // --> If ticket is assigned just notify the owner
if ($ticket['owner']) if ($ticket['owner'])
{ {
hesk_notifyAssignedStaff(false, 'new_reply_by_customer', 'notify_reply_my'); $modsForHesk_settings = mfh_getSettings();
hesk_notifyAssignedStaff(false, 'new_reply_by_customer', $modsForHesk_settings, 'notify_reply_my');
} }
// --> No owner assigned, find and notify appropriate staff // --> No owner assigned, find and notify appropriate staff
else else
{ {
hesk_notifyStaff('new_reply_by_customer',"`notify_reply_unassigned`='1'"); hesk_notifyStaff('new_reply_by_customer',"`notify_reply_unassigned`='1'", $modsForHesk_settings);
} }
return $ticket['trackid']; return $ticket['trackid'];
@ -363,7 +363,7 @@ function hesk_email2ticket($results, $pop3 = 0, $set_category = 1, $set_priority
// SPAM tags not found or not checked, send email // SPAM tags not found or not checked, send email
if ($possible_SPAM === false) if ($possible_SPAM === false)
{ {
hesk_notifyCustomer(); hesk_notifyCustomer($modsForHesk_settings);
} }
} }
@ -371,12 +371,12 @@ function hesk_email2ticket($results, $pop3 = 0, $set_category = 1, $set_priority
// --> From autoassign? // --> From autoassign?
if ($tmpvar['owner'] && $autoassign_owner['notify_assigned']) 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 // --> No autoassign, find and notify appropriate staff
elseif ( ! $tmpvar['owner'] ) elseif ( ! $tmpvar['owner'] )
{ {
hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' "); hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' ", $modsForHesk_settings);
} }
return $ticket['trackid']; return $ticket['trackid'];

@ -41,7 +41,7 @@ if ( ! isset($status) )
//-- We don't want to check statuses that are considered "closed" //-- We don't want to check statuses that are considered "closed"
foreach ($allStatuses as $row) foreach ($allStatuses as $row)
{ {
if ($status['IsClosed'] == 1) { if ($row['IsClosed'] == 1) {
continue; continue;
} }

@ -38,16 +38,18 @@ define('WYSIWYG',1);
// Get all the required files and functions // Get all the required files and functions
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
hesk_load_database_functions();
hesk_dbConnect();
// Are we in maintenance mode? // Are we in maintenance mode?
hesk_check_maintenance(); hesk_check_maintenance();
hesk_load_database_functions();
// Are we in "Knowledgebase only" mode? // Are we in "Knowledgebase only" mode?
hesk_check_kb_only(); hesk_check_kb_only();
$modsForHesk_settings = mfh_getSettings();
// What should we do? // What should we do?
$action = hesk_REQUEST('a'); $action = hesk_REQUEST('a');
@ -1273,7 +1275,7 @@ function print_start()
function forgot_tid() function forgot_tid()
{ {
global $hesk_settings, $hesklang; global $hesk_settings, $hesklang, $modsForHesk_settings;
require(HESK_PATH . 'inc/email_functions.inc.php'); require(HESK_PATH . 'inc/email_functions.inc.php');
@ -1337,18 +1339,18 @@ function forgot_tid()
$html_tid_list .= '</ul>'; $html_tid_list .= '</ul>';
/* Get e-mail message for customer */ /* Get e-mail message for customer */
$msg = hesk_getEmailMessage('forgot_ticket_id','',0,0,1); $msg = hesk_getEmailMessage('forgot_ticket_id','',$modsForHesk_settings,0,0,1);
$msg = processEmail($msg, $name, $num, $tid_list); $msg = processEmail($msg, $name, $num, $tid_list);
// Get HTML message for customer // Get HTML message for customer
$htmlMsg = hesk_getHtmlMessage('forgot_ticket_id','',0,0,1); $htmlMsg = hesk_getHtmlMessage('forgot_ticket_id','', $modsForHesk_settings, 0,0,1);
$htmlMsg = processEmail($htmlMsg, $name, $num, $html_tid_list); $htmlMsg = processEmail($htmlMsg, $name, $num, $html_tid_list);
$subject = hesk_getEmailSubject('forgot_ticket_id'); $subject = hesk_getEmailSubject('forgot_ticket_id');
/* Send e-mail */ /* Send e-mail */
hesk_mail($email, $subject, $msg, $htmlMsg); hesk_mail($email, $subject, $msg, $htmlMsg, $modsForHesk_settings);
/* Show success message */ /* Show success message */
$tmp = '<b>'.$hesklang['tid_sent'].'!</b>'; $tmp = '<b>'.$hesklang['tid_sent'].'!</b>';

@ -65,24 +65,6 @@ hesk_dbConnect();
<td>CREATE, ALTER, DROP Permissions:</td> <td>CREATE, ALTER, DROP Permissions:</td>
<td class="warning"><i class="fa fa-exclamation-triangle"></i> Please check before continuing!*</td> <td class="warning"><i class="fa fa-exclamation-triangle"></i> Please check before continuing!*</td>
</tr> </tr>
<tr>
<td>
modsForHesk_settings.inc.php
</td>
<?php
$fileperm = substr(sprintf('%o', fileperms(HESK_PATH.'modsForHesk_settings.inc.php')), -4);
$class = (intval($fileperm) < 666) ? 'class="danger"' : 'class="success"';
?>
<td <?php echo $class; ?>>
<?php if ($class == 'class="success"') {
echo '<i class="fa fa-check-circle"></i> Success';
} else {
echo '<i class="fa fa-times-circle"></i> CHMOD to 0666, yours is '.$fileperm;
$allowInstallation = false;
}
?>
</td>
</tr>
<tr> <tr>
<td colspan="2"> <td colspan="2">
* Mods for HESK is unable to check database permissions automatically. * Mods for HESK is unable to check database permissions automatically.

@ -686,4 +686,108 @@ function execute242Scripts() {
hesk_dbConnect(); hesk_dbConnect();
executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.4.2' WHERE `Key` = 'modsForHeskVersion'"); 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;
} }

@ -1,64 +0,0 @@
<?php
//-- Mods For Hesk Theme Color Settings
$modsForHesk_settings['navbarBackgroundColor'] = '#414a5c';
$modsForHesk_settings['navbarBrandColor'] = '#d4dee7';
$modsForHesk_settings['navbarBrandHoverColor'] = '#ffffff';
$modsForHesk_settings['navbarItemTextColor'] = '#d4dee7';
$modsForHesk_settings['navbarItemTextHoverColor'] = '#ffffff';
$modsForHesk_settings['navbarItemTextSelectedColor'] = '#ffffff';
$modsForHesk_settings['navbarItemSelectedBackgroundColor'] = '#2d3646';
$modsForHesk_settings['dropdownItemTextColor'] = '#333333';
$modsForHesk_settings['dropdownItemTextHoverColor'] = '#262626';
$modsForHesk_settings['dropdownItemTextHoverBackgroundColor'] = '#f5f5f5';
$modsForHesk_settings['questionMarkColor'] = '#000000';
//-- Set this to 1 for right-to-left text.
$modsForHesk_settings['rtl'] = 0;
//-- Set this to 1 to show icons next to navigation menu items
$modsForHesk_settings['show_icons'] = 0;
//-- Set this to 1 to enable custom field names as keys
$modsForHesk_settings['custom_field_setting'] = 0;
//-- Set this to 1 to enable email verification for new customers
$modsForHesk_settings['customer_email_verification_required'] = 0;
//-- Set this to 1 to enable HTML-formatted emails.
$modsForHesk_settings['html_emails'] = 1;
//-- Mailgun Settings
$modsForHesk_settings['use_mailgun'] = 0;
$modsForHesk_settings['mailgun_api_key'] = '';
$modsForHesk_settings['mailgun_domain'] = '';
//-- Set this to 1 to enable bootstrap-theme.css
$modsForHesk_settings['use_bootstrap_theme'] = 1;
//-- Default value for new Knowledgebase article: 0 = Published, 1 = Private, 2 = Draft
$modsForHesk_settings['new_kb_article_visibility'] = 0;
//-- Setting for adding attachments to email messages. Either 0 for default-HESK behavior, or 1 to send as attachments
$modsForHesk_settings['attachments'] = 0;
//-- Setting for showing number of merged tickets in the ticket search screen. 0 = Disable, 1 = Enable
$modsForHesk_settings['show_number_merged'] = 1;
//-- Setting for requesting user's location. 0 = Disable, 1 = Enable
$modsForHesk_settings['request_location'] = 0;
//-- Column to sort categories by. Can be either 'name' or 'cat_order'
$modsForHesk_settings['category_order_column'] = 'cat_order';
//-- Setting for using rich-text editor for tickets. 0 = Disable, 1 = Enable
$modsForHesk_settings['rich_text_for_tickets'] = 0;
//-- Column to sort statuses by. Can be either 'sort' or 'name'
$modsForHesk_settings['statuses_order_column'] = 'sort';
//-- Directory to store knowledgebase articles in.
$modsForHesk_settings['kb_attach_dir'] = 'attachments';
//-- Setting for using rich-text editor for customers. 0 = Disable, 1 = Enable
$modsForHesk_settings['rich_text_for_tickets_for_customers'] = 0;

@ -37,12 +37,12 @@ define('HESK_PATH','./');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
hesk_session_start(); hesk_session_start();
/* Get the tracking ID */ /* Get the tracking ID */
$trackingID = hesk_cleanID() or die("$hesklang[int_error]: $hesklang[no_trackID]"); $trackingID = hesk_cleanID() or die("$hesklang[int_error]: $hesklang[no_trackID]");
@ -91,6 +91,8 @@ $category = hesk_dbFetchAssoc($res);
/* Get replies */ /* Get replies */
$res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` WHERE `replyto`='{$ticket['id']}' ORDER BY `id` ASC"); $res = hesk_dbQuery("SELECT * FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."replies` WHERE `replyto`='{$ticket['id']}' ORDER BY `id` ASC");
$replies = hesk_dbNumRows($res); $replies = hesk_dbNumRows($res);
$modsForHesk_settings = mfh_getSettings();
?> ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html> <html>

@ -37,7 +37,6 @@ define('HESK_PATH','./');
/* Get all the required files and functions */ /* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
// Are we in maintenance mode? // Are we in maintenance mode?
@ -66,6 +65,9 @@ hesk_session_start();
/* A security check */ /* A security check */
# hesk_token_check('POST'); # hesk_token_check('POST');
/* Connect to database */
hesk_dbConnect();
$hesk_error_buffer = array(); $hesk_error_buffer = array();
// Tracking ID // 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)); 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 // 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"); $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) 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"); $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 // Insert reply into database
$modsForHesk_settings = mfh_getSettings();
$html = $modsForHesk_settings['rich_text_for_tickets_for_customers']; $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."')"); 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 is assigned just notify the owner
if ($ticket['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 // --> No owner assigned, find and notify appropriate staff
else 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 */ /* Clear unneeded session variables */

@ -44,7 +44,6 @@ if ( ! isset($_POST['hx']) || $_POST['hx'] != 3 || ! isset($_POST['hy']) || $_PO
// Get all the required files and functions // Get all the required files and functions
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
// Are we in maintenance mode? // Are we in maintenance mode?
@ -272,6 +271,7 @@ if ($tmpvar['category'])
} }
// Custom fields // Custom fields
$modsForHesk_settings = mfh_getSettings();
foreach ($hesk_settings['custom_fields'] as $k=>$v) foreach ($hesk_settings['custom_fields'] as $k=>$v)
{ {
if ($v['use']) 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`) hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."pending_verification_emails` (`Email`, `ActivationKey`)
VALUES ('".$escapedEmail."', '".$escapedKey."')"); VALUES ('".$escapedEmail."', '".$escapedKey."')");
hesk_notifyCustomerForVerifyEmail('verify_email', $key); hesk_notifyCustomerForVerifyEmail('verify_email', $key, $modsForHesk_settings);
$createTicket = false; $createTicket = false;
} }
} }
@ -484,19 +484,19 @@ if ($createTicket)
// Notify the customer // Notify the customer
if ($hesk_settings['notify_new']) if ($hesk_settings['notify_new'])
{ {
hesk_notifyCustomer(); hesk_notifyCustomer($modsForHesk_settings);
} }
// Need to notify staff? // Need to notify staff?
// --> From autoassign? // --> From autoassign?
if ($tmpvar['owner'] && $autoassign_owner['notify_assigned']) 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 // --> No autoassign, find and notify appropriate staff
elseif ( ! $tmpvar['owner'] ) elseif ( ! $tmpvar['owner'] )
{ {
hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' "); hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' ", $modsForHesk_settings);
} }
} }

@ -48,6 +48,9 @@ hesk_check_maintenance();
hesk_load_database_functions(); hesk_load_database_functions();
hesk_session_start(); hesk_session_start();
/* Connect to database */
hesk_dbConnect();
$modsForHesk_settings = mfh_getSettings();
$hesk_error_buffer = array(); $hesk_error_buffer = array();
$do_remember = ''; $do_remember = '';
@ -101,8 +104,6 @@ elseif ( empty($trackingID) || ( $hesk_settings['email_view_ticket'] && empty($m
print_form(); print_form();
} }
/* Connect to database */
hesk_dbConnect();
/* Limit brute force attempts */ /* Limit brute force attempts */
hesk_limitBfAttempts(); hesk_limitBfAttempts();

@ -4,7 +4,6 @@ define('HESK_PATH','./');
// Get all the required files and functions // Get all the required files and functions
require(HESK_PATH . 'hesk_settings.inc.php'); 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/common.inc.php');
hesk_load_database_functions(); hesk_load_database_functions();
require(HESK_PATH . 'inc/posting_functions.inc.php'); require(HESK_PATH . 'inc/posting_functions.inc.php');
@ -46,7 +45,8 @@ require_once(HESK_PATH . 'inc/header.inc.php');
{ {
$ticket = hesk_newTicket($innerResult); $ticket = hesk_newTicket($innerResult);
// Notify the customer // Notify the customer
hesk_notifyCustomer(); $modsForHesk_settings = mfh_getSettings();
hesk_notifyCustomer($modsForHesk_settings);
// Need to notify staff? // Need to notify staff?
// --> From autoassign? // --> From autoassign?
@ -54,12 +54,12 @@ require_once(HESK_PATH . 'inc/header.inc.php');
$autoassign_owner = $getOwnerRs->fetch_assoc(); $autoassign_owner = $getOwnerRs->fetch_assoc();
if ($ticket['owner'] && $autoassign_owner['notify_assigned']) 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 // --> No autoassign, find and notify appropriate staff
elseif ( ! $ticket['owner'] ) 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']); array_push($submittedTickets, $innerResult['trackid']);

Loading…
Cancel
Save