diff --git a/.gitignore b/.gitignore index 1aafcd90..70d3d8c3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,8 @@ +# Mods for HESK-specific files +api/vendor +api/Tests/integration_test_mfh_settings.php + +# HESK Files admin/admin_suggest_articles.php admin/archive.php admin/custom_statuses.php @@ -265,7 +270,7 @@ readme.html robots.txt .idea/ attachments/__latest.txt -attachments +/attachments img/ban.png img/banned.png img/ico_tools.png diff --git a/admin/admin_settings.php b/admin/admin_settings.php index 88b93bcb..6f686d97 100644 --- a/admin/admin_settings.php +++ b/admin/admin_settings.php @@ -531,7 +531,7 @@ $modsForHesk_settings = mfh_getSettings(); onclick="javascript:alert('')"> -
@@ -3426,27 +3426,6 @@ $modsForHesk_settings = mfh_getSettings(); value=""/> -
- - -
-
- -
-
-
-

Common Properties

+

@@ -3548,246 +3527,359 @@ $modsForHesk_settings = mfh_getSettings();
-

Customer View

+

-
- - -
- -
-
+
-
- - -
- -
-
+
-
- - -
- -
-
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+

+
+
-
-
- - -
- -
+
+

+
-
- - -
- -
+
+

+
-
- - -
- -
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
+

+
-
- - -
- -
+
+

+ +
+
+
+
+ +
+
+ +
+
+
+
+ +
+
+
+
+
-
+

-
+
-
-

Admin Panel

-
@@ -3811,6 +3903,37 @@ $modsForHesk_settings = mfh_getSettings(); require_once(HESK_PATH . 'inc/footer.inc.php'); exit(); + function buildColorSchemeColorpicker($field_name, $label_key, $color, $help_suffix = '_help') { + global $hesklang; + + echo ' +
+ + +
+
+ + +
+
+
+ + '; + } + function hesk_checkVersion() { @@ -4064,7 +4187,7 @@ $modsForHesk_settings = mfh_getSettings(); background: #fff; color: black; font: 68.8%/1.5 Verdana, Geneva, Arial, Helvetica, sans-serif; - text-align: ; + text-align: left; } p { diff --git a/admin/admin_settings_save.php b/admin/admin_settings_save.php index 0c3df742..7113cd6f 100644 --- a/admin/admin_settings_save.php +++ b/admin/admin_settings_save.php @@ -39,6 +39,8 @@ hesk_checkPermission('can_manage_settings'); // A security check hesk_token_check('POST'); +$modsForHesk_settings = mfh_getSettings(); + // Demo mode if (defined('HESK_DEMO')) { hesk_process_messages($hesklang['sdemo'], 'admin_settings.php'); @@ -447,7 +449,6 @@ foreach ($postArray as $value) { } // Save the modsForHesk_settings.inc.php file -$set['rtl'] = empty($_POST['rtl']) ? 0 : 1; $set['show-icons'] = empty($_POST['show-icons']) ? 0 : 1; $set['custom-field-setting'] = empty($_POST['custom-field-setting']) ? 0 : 1; $set['customer-email-verification-required'] = empty($_POST['email-verification']) ? 0 : 1; @@ -494,8 +495,115 @@ $set['dropdownItemTextColor'] = hesk_input(hesk_POST('dropdownItemTextColor')); $set['dropdownItemTextHoverColor'] = hesk_input(hesk_POST('dropdownItemTextHoverColor')); $set['questionMarkColor'] = hesk_input(hesk_POST('questionMarkColor')); $set['dropdownItemTextHoverBackgroundColor'] = hesk_input(hesk_POST('dropdownItemTextHoverBackgroundColor')); -$set['admin_color_scheme'] = hesk_input(hesk_POST('admin-color-scheme')); -mfh_updateSetting('rtl', $set['rtl']); +$set['admin_navbar_background'] = hesk_input(hesk_POST('admin-navbar-background-color')); +$set['admin_navbar_background_hover'] = hesk_input(hesk_POST('admin-navbar-background-hover-color')); +$set['admin_navbar_brand_background'] = hesk_input(hesk_POST('admin-navbar-brand-background-color')); +$set['admin_navbar_brand_background_hover'] = hesk_input(hesk_POST('admin-navbar-brand-background-hover-color')); +$set['admin_navbar_brand_text'] = hesk_input(hesk_POST('admin-navbar-brand-text-color')); +$set['admin_navbar_brand_text_hover'] = hesk_input(hesk_POST('admin-navbar-brand-text-hover-color')); +$set['admin_navbar_text'] = hesk_input(hesk_POST('admin-navbar-text-color')); +$set['admin_navbar_text_hover'] = hesk_input(hesk_POST('admin-navbar-text-hover-color')); +$set['admin_sidebar_background'] = hesk_input(hesk_POST('admin-sidebar-background-color')); +$set['admin_sidebar_background_hover'] = hesk_input(hesk_POST('admin-sidebar-header-background-color')); +$set['admin_sidebar_font_weight'] = hesk_input(hesk_POST('admin-sidebar-font-weight')); +$set['admin_sidebar_header_background'] = hesk_input(hesk_POST('admin-sidebar-header-background-color')); +$set['admin_sidebar_header_text'] = hesk_input(hesk_POST('admin-sidebar-header-text-color')); +$set['admin_sidebar_text'] = hesk_input(hesk_POST('admin-sidebar-text-color')); +$set['admin_sidebar_text_hover'] = hesk_input(hesk_POST('admin-sidebar-text-hover-color')); + +$set['login_background_type'] = hesk_input(hesk_POST('login-background')); +$set['login_box_header'] = hesk_input(hesk_POST('login-box-header')); + +$changedBackground = false; +$loadedAttachmentFuncs = false; +if ($set['login_background_type'] == 'color') { + if (file_exists($hesk_settings['cache_dir'] . '/lb_' . $set['login_background'])) { + unlink($hesk_settings['cache_dir'] . '/lb_' . $set['login_background']); + } + $set['login_background'] = hesk_input(hesk_POST('login-background-color')); + if ($set['login_background'] == '') { + $set['login_background'] = '#d2d6de'; + } + + $changedBackground = true; +} else { + if (!$loadedAttachmentFuncs) { + include(HESK_PATH . 'inc/attachments.inc.php'); + include(HESK_PATH . 'inc/posting_functions.inc.php'); + $loadedAttachmentFuncs = true; + } + + + $file_name = hesk_cleanFileName($_FILES['login-background-image']['name']); + + + if (!empty($_FILES['login-background-image']['name'])) { + $file_size = $_FILES['login-background-image']['size']; + if ($file_size > $hesk_settings['attachments']['max_size']) { + return hesk_fileError(sprintf($hesklang['file_too_large'], $file_name)); + } + $ext = strtolower(strrchr($file_name, ".")); + + if (file_exists($hesk_settings['cache_dir'] . '/lb_' . $modsForHesk_settings['login_background'])) { + unlink($hesk_settings['cache_dir'] . '/lb_' . $modsForHesk_settings['login_background']); + } + + $saved_name = 'login-background' . $ext; + + $file_to_move = $_FILES['login-background-image']['tmp_name']; + + + if (!move_uploaded_file($file_to_move, dirname(dirname(__FILE__)) . '/' . $hesk_settings['cache_dir'] . '/lb_' . $saved_name)) { + hesk_error($hesklang['cannot_move_tmp']); + } + + $set['login_background'] = $saved_name; + $changedBackground = true; + } +} +$changedLoginImage = false; +if ($set['login_box_header'] == 'image') { + if (!$loadedAttachmentFuncs) { + include(HESK_PATH . 'inc/attachments.inc.php'); + include(HESK_PATH . 'inc/posting_functions.inc.php'); + $loadedAttachmentFuncs = true; + } + + + $file_name = hesk_cleanFileName($_FILES['login-box-header-image']['name']); + + if (!empty($_FILES['login-box-header-image']['name'])) { + $file_size = $_FILES['login-box-header-image']['size']; + if ($file_size > $hesk_settings['attachments']['max_size']) { + return hesk_fileError(sprintf($hesklang['file_too_large'], $file_name)); + } + $ext = strtolower(strrchr($file_name, ".")); + + if (file_exists($hesk_settings['cache_dir'] . '/lbh_' . $modsForHesk_settings['login_box_header_image'])) { + unlink($hesk_settings['cache_dir'] . '/lbh_' . $modsForHesk_settings['login_box_header_image']); + } + + $saved_name = 'login-box-header-image' . $ext; + + $file_to_move = $_FILES['login-box-header-image']['tmp_name']; + + + if (!move_uploaded_file($file_to_move, dirname(dirname(__FILE__)) . '/' . $hesk_settings['cache_dir'] . '/lbh_' . $saved_name)) { + hesk_error($hesklang['cannot_move_tmp']); + } + + $set['login_box_header_image'] = $saved_name; + $changedLoginImage = true; + } +} else { + if (file_exists($hesk_settings['cache_dir'] . '/lbh_' . $set['login_box_header_image'])) { + unlink($hesk_settings['cache_dir'] . '/lbh_' . $set['login_box_header_image']); + } + + $set['login_box_header_image'] = ''; + $changedLoginImage = true; +} + mfh_updateSetting('show_icons', $set['show-icons']); mfh_updateSetting('custom_field_setting', $set['custom-field-setting']); mfh_updateSetting('customer_email_verification_required', $set['customer-email-verification-required']); @@ -521,6 +629,21 @@ mfh_updateSetting('dropdownItemTextColor', $set['dropdownItemTextColor'], true); mfh_updateSetting('dropdownItemTextHoverColor', $set['dropdownItemTextHoverColor'], true); mfh_updateSetting('questionMarkColor', $set['questionMarkColor'], true); mfh_updateSetting('dropdownItemTextHoverBackgroundColor', $set['dropdownItemTextHoverBackgroundColor'], true); +mfh_updateSetting('admin_navbar_background', $set['admin_navbar_background'], true); +mfh_updateSetting('admin_navbar_background_hover', $set['admin_navbar_background_hover'], true); +mfh_updateSetting('admin_navbar_brand_background', $set['admin_navbar_brand_background'], true); +mfh_updateSetting('admin_navbar_brand_background_hover', $set['admin_navbar_brand_background_hover'], true); +mfh_updateSetting('admin_navbar_brand_text', $set['admin_navbar_brand_text'], true); +mfh_updateSetting('admin_navbar_brand_text_hover', $set['admin_navbar_brand_text_hover'], true); +mfh_updateSetting('admin_navbar_text', $set['admin_navbar_text'], true); +mfh_updateSetting('admin_navbar_text_hover', $set['admin_navbar_text_hover'], true); +mfh_updateSetting('admin_sidebar_background', $set['admin_sidebar_background'], true); +mfh_updateSetting('admin_sidebar_background_hover', $set['admin_sidebar_background_hover'], true); +mfh_updateSetting('admin_sidebar_font_weight', $set['admin_sidebar_font_weight'], true); +mfh_updateSetting('admin_sidebar_header_background', $set['admin_sidebar_header_background'], true); +mfh_updateSetting('admin_sidebar_header_text', $set['admin_sidebar_header_text'], true); +mfh_updateSetting('admin_sidebar_text', $set['admin_sidebar_text'], true); +mfh_updateSetting('admin_sidebar_text_hover', $set['admin_sidebar_text_hover'], true); mfh_updateSetting('display_user_agent_information', $set['display_user_agent_information']); mfh_updateSetting('navbar_title_url', $set['navbar_title_url'], true); if ($set['use_mailgun'] == 1) { @@ -533,6 +656,16 @@ mfh_updateSetting('first_day_of_week', $set['first_day_of_week'], false); mfh_updateSetting('default_calendar_view', $set['default_view'], true); mfh_updateSetting('admin_color_scheme', $set['admin_color_scheme'], true); +mfh_updateSetting('login_background_type', $set['login_background_type'], true); +if ($changedBackground) { + mfh_updateSetting('login_background', $set['login_background'], true); +} + +mfh_updateSetting('login_box_header', $set['login_box_header'], true); +if ($changedLoginImage) { + mfh_updateSetting('login_box_header_image', $set['login_box_header_image'], true); +} + // Prepare settings file and save it $settings_file_content = ''); +define('EXTRA_JS', ''); /* Get all the required files and functions */ require(HESK_PATH . 'hesk_settings.inc.php'); @@ -470,7 +470,7 @@ if (($can_reply || $can_edit) && isset($_POST['childTrackingId'])) { } //-- Check if the ticket is already a child. - $childRs = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'tickets` WHERE `parent` = ' . intval($ticket['id']) . ' AND `trackid` = \'' . hesk_dbEscape(hesk_POST(['childTrackingId'])) . '\''); + $childRs = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'tickets` WHERE `parent` = ' . intval($ticket['id']) . ' AND `trackid` = \'' . hesk_dbEscape(hesk_POST('childTrackingId')) . '\''); if (hesk_dbNumRows($childRs) > 0) { hesk_process_messages(sprintf($hesklang['is_already_linked'], $_POST['childTrackingId']), 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . mt_rand(10000, 99999), 'NOTICE'); } @@ -1167,7 +1167,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
- +
 
@@ -1500,6 +1500,22 @@ function hesk_getAdminButtonsInTicket($reply = 0, $white = 1) $options = $reply ? '' : '
'; + // Resend email notification + $replyDataAttribute = ''; + if ($reply) { + $replyDataAttribute = 'data-reply-id="' . $reply['id'] . '"'; + } + + if ($ticket['email'] !== '') { + $options .= ' + + + + '; + } + /* Edit post */ if ($can_edit) { $tmp = $reply ? '&reply=' . $reply['id'] : ''; @@ -1870,7 +1886,7 @@ function hesk_printReplyForm() $onsubmit = 'onsubmit="force_stop();return validateRichText(\'message-help-block\', \'message-group\', \'message\', \''.htmlspecialchars($hesklang['this_field_is_required']).'\')"'; } ?> - >
@@ -2046,6 +2062,7 @@ function hesk_printReplyForm()
+
diff --git a/admin/api_settings.php b/admin/api_settings.php index 0c777e40..0af4b1b6 100644 --- a/admin/api_settings.php +++ b/admin/api_settings.php @@ -1,37 +1,9 @@
  • -
  • +
  • diff --git a/admin/assign_owner.php b/admin/assign_owner.php index 64a6426d..793bdfdd 100755 --- a/admin/assign_owner.php +++ b/admin/assign_owner.php @@ -1,32 +1,15 @@ 1 ORDER BY `" . hesk_dbEscape($order_by) . "`"); +$rs = hesk_dbQuery("SELECT `id`, `name`, `background_color`, `foreground_color`, `display_border_outline` + FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` + WHERE `usage` <> 1 ORDER BY `" . hesk_dbEscape($order_by) . "`"); $categories = array(); while ($row = hesk_dbFetchAssoc($rs)) { if (!$_SESSION['isadmin'] && !in_array($row['id'], $_SESSION['categories'])) { continue; } - $row['css_style'] = $row['color'] == null ? 'background: white; color: black; border: solid 1px #000;' : 'border: solid 1px ' . $row['color'] . '; background: ' . $row['color']; + $row['css_style'] = "background: {$row['background_color']};"; + $row['background_volatile'] = 'background-volatile'; + if ($row['foreground_color'] != 'AUTO') { + $row['background_volatile'] = ''; + $row['css_style'] .= " color: {$row['foreground_color']};"; + + if ($row['display_border_outline'] == '1') { + $row['css_style'] .= " border: solid 1px {$row['foreground_color']};"; + } + } + $categories[] = $row; } @@ -85,7 +69,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
  • -
    '.$hesklang['select'].''; } foreach ($categories as $category): ?> - @@ -393,7 +379,9 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); echo ''; } foreach ($categories as $category): ?> - diff --git a/admin/edit_post.php b/admin/edit_post.php index 289faf83..ee3a9e19 100644 --- a/admin/edit_post.php +++ b/admin/edit_post.php @@ -608,7 +608,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
    diff --git a/admin/index.php b/admin/index.php index 25f9f651..cef05749 100644 --- a/admin/index.php +++ b/admin/index.php @@ -246,7 +246,7 @@ function do_login() function print_login() { - global $hesk_settings, $hesklang; + global $hesk_settings, $hesklang, $modsForHesk_settings; // Tell header to load reCaptcha API if needed if ($hesk_settings['recaptcha_use'] == 2) @@ -269,197 +269,205 @@ function print_login() ?>
    -

    - ()

    +
    data-error="" required> +
    - @@ -149,15 +148,51 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
    + placeholder="" type="text" + name="background-color" maxlength="7" required> +
    +
    +
    +
    + +
    + +
    +
    +
    + +
    +
    + +
        +
    + +
    @@ -194,10 +229,12 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
  • -
    - - - +
    +
    + + + +
    @@ -277,12 +314,21 @@ while ($mycat = hesk_dbFetchAssoc($res)) { } $tmp = $i ? 'White' : 'Blue'; - $style = ''; - if ($mycat['color'] == null) { - $style .= 'color: black; border: solid 1px #000'; - } else { - $style .= 'background: ' . $mycat['color']; + $style = 'background: ' . $mycat['background_color']; + $backgroundVolatile = 'background-volatile'; + if ($mycat['foreground_color'] != 'AUTO') { + $style .= '; color: ' . $mycat['foreground_color']; + $backgroundVolatile = ''; + + if ($mycat['display_border_outline']) { + $style .= '; border: solid 1px ' . $mycat['foreground_color']; + } } + + if ($mycat['foreground_color'] == 'AUTO') { + $mycat['foreground_color'] = ''; + } + $i = $i ? 0 : 1; /* Number of tickets and graph width */ @@ -319,16 +365,18 @@ while ($mycat = hesk_dbFetchAssoc($res)) { echo ' ' . $mycat['id'] . ' - ' . $mycat['name'] . ' + ' . $mycat['name'] . ' ' . $priorities[$mycat['priority']]['formatted'] . ' ' . $all . '
    - 40% Complete (success)
    @@ -351,7 +399,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) { '; } } - echo ''; + echo ''; echo $remove_code . ' '; @@ -370,34 +418,71 @@ while ($mycat = hesk_dbFetchAssoc($res)) {