Browse Source

Merge branch '3-1-0' into 'master'

3.1.0 Update

Closes #535, #428, #397, #565, #549, #561, #562, #560, #531, #395, #405, #456, #353, #551, #559, #557, #556, #524, #523, #527, #528, #525, #339, and #522

See merge request !62
tags/3.1.0
Mike Koch 2 years ago
parent
commit
535e48225d
100 changed files with 5818 additions and 625 deletions
  1. 6
    1
      .gitignore
  2. 330
    207
      admin/admin_settings.php
  3. 136
    3
      admin/admin_settings_save.php
  4. 22
    5
      admin/admin_ticket.php
  5. 3
    31
      admin/api_settings.php
  6. 11
    28
      admin/assign_owner.php
  7. 21
    33
      admin/calendar.php
  8. 1
    1
      admin/edit_post.php
  9. 179
    171
      admin/index.php
  10. 11
    28
      admin/knowledgebase_private.php
  11. 162
    57
      admin/manage_categories.php
  12. 275
    0
      admin/manage_custom_nav_elements.php
  13. 1
    0
      admin/manage_email_templates.php
  14. 13
    30
      admin/manage_knowledgebase.php
  15. 1
    1
      admin/manage_statuses.php
  16. 11
    28
      admin/move_category.php
  17. 1
    1
      admin/new_ticket.php
  18. 1
    0
      admin/view_message_log.php
  19. 142
    0
      api/ApplicationContext.php
  20. 21
    0
      api/BusinessLogic/Attachments/Attachment.php
  21. 475
    0
      api/BusinessLogic/Attachments/AttachmentHandler.php
  22. 50
    0
      api/BusinessLogic/Attachments/AttachmentRetriever.php
  23. 9
    0
      api/BusinessLogic/Attachments/AttachmentType.php
  24. 9
    0
      api/BusinessLogic/Attachments/CreateAttachmentForTicketModel.php
  25. 21
    0
      api/BusinessLogic/Attachments/CreateAttachmentModel.php
  26. 12
    0
      api/BusinessLogic/Attachments/TicketAttachment.php
  27. 63
    0
      api/BusinessLogic/Categories/Category.php
  28. 33
    0
      api/BusinessLogic/Categories/CategoryRetriever.php
  29. 21
    0
      api/BusinessLogic/Emails/Addressees.php
  30. 75
    0
      api/BusinessLogic/Emails/BasicEmailSender.php
  31. 43
    0
      api/BusinessLogic/Emails/EmailBuilder.php
  32. 21
    0
      api/BusinessLogic/Emails/EmailSender.php
  33. 74
    0
      api/BusinessLogic/Emails/EmailSenderHelper.php
  34. 27
    0
      api/BusinessLogic/Emails/EmailTemplate.php
  35. 331
    0
      api/BusinessLogic/Emails/EmailTemplateParser.php
  36. 65
    0
      api/BusinessLogic/Emails/EmailTemplateRetriever.php
  37. 71
    0
      api/BusinessLogic/Emails/MailgunEmailSender.php
  38. 33
    0
      api/BusinessLogic/Emails/ParsedEmailProperties.php
  39. 10
    0
      api/BusinessLogic/Exceptions/AccessViolationException.php
  40. 25
    0
      api/BusinessLogic/Exceptions/ApiFriendlyException.php
  41. 17
    0
      api/BusinessLogic/Exceptions/EmailTemplateNotFoundException.php
  42. 10
    0
      api/BusinessLogic/Exceptions/InternalUseOnlyException.php
  43. 12
    0
      api/BusinessLogic/Exceptions/InvalidAuthenticationTokenException.php
  44. 16
    0
      api/BusinessLogic/Exceptions/InvalidEmailTemplateException.php
  45. 11
    0
      api/BusinessLogic/Exceptions/MissingAuthenticationTokenException.php
  46. 16
    0
      api/BusinessLogic/Exceptions/SessionNotActiveException.php
  47. 21
    0
      api/BusinessLogic/Exceptions/ValidationException.php
  48. 29
    0
      api/BusinessLogic/Helpers.php
  49. 30
    0
      api/BusinessLogic/Navigation/CustomNavElement.php
  50. 70
    0
      api/BusinessLogic/Navigation/CustomNavElementHandler.php
  51. 10
    0
      api/BusinessLogic/Navigation/CustomNavElementPlace.php
  52. 9
    0
      api/BusinessLogic/Navigation/Direction.php
  53. 52
    0
      api/BusinessLogic/Security/BanRetriever.php
  54. 26
    0
      api/BusinessLogic/Security/BannedEmail.php
  55. 36
    0
      api/BusinessLogic/Security/BannedIp.php
  56. 110
    0
      api/BusinessLogic/Security/UserContext.php
  57. 87
    0
      api/BusinessLogic/Security/UserContextBuilder.php
  58. 16
    0
      api/BusinessLogic/Security/UserContextNotifications.php
  59. 15
    0
      api/BusinessLogic/Security/UserContextPreferences.php
  60. 17
    0
      api/BusinessLogic/Security/UserPrivilege.php
  61. 50
    0
      api/BusinessLogic/Security/UserToTicketChecker.php
  62. 21
    0
      api/BusinessLogic/Settings/ApiChecker.php
  63. 86
    0
      api/BusinessLogic/Settings/SettingsRetriever.php
  64. 11
    0
      api/BusinessLogic/Statuses/Closable.php
  65. 30
    0
      api/BusinessLogic/Statuses/DefaultStatusForAction.php
  66. 72
    0
      api/BusinessLogic/Statuses/Status.php
  67. 20
    0
      api/BusinessLogic/Statuses/StatusRetriever.php
  68. 21
    0
      api/BusinessLogic/Tickets/Attachment.php
  69. 47
    0
      api/BusinessLogic/Tickets/Autoassigner.php
  70. 80
    0
      api/BusinessLogic/Tickets/CreateTicketByCustomerModel.php
  71. 17
    0
      api/BusinessLogic/Tickets/CreatedTicketModel.php
  72. 18
    0
      api/BusinessLogic/Tickets/CustomFields/CustomFieldValidator.php
  73. 30
    0
      api/BusinessLogic/Tickets/EditTicketModel.php
  74. 12
    0
      api/BusinessLogic/Tickets/Exceptions/UnableToGenerateTrackingIdException.php
  75. 132
    0
      api/BusinessLogic/Tickets/NewTicketValidator.php
  76. 62
    0
      api/BusinessLogic/Tickets/Reply.php
  77. 14
    0
      api/BusinessLogic/Tickets/StageTicket.php
  78. 359
    0
      api/BusinessLogic/Tickets/Ticket.php
  79. 194
    0
      api/BusinessLogic/Tickets/TicketCreator.php
  80. 59
    0
      api/BusinessLogic/Tickets/TicketDeleter.php
  81. 137
    0
      api/BusinessLogic/Tickets/TicketEditor.php
  82. 10
    0
      api/BusinessLogic/Tickets/TicketGatewayGeneratedFields.php
  83. 77
    0
      api/BusinessLogic/Tickets/TicketRetriever.php
  84. 30
    0
      api/BusinessLogic/Tickets/TicketValidators.php
  85. 137
    0
      api/BusinessLogic/Tickets/TrackingIdGenerator.php
  86. 27
    0
      api/BusinessLogic/Tickets/VerifiedEmailChecker.php
  87. 14
    0
      api/BusinessLogic/ValidationModel.php
  88. 123
    0
      api/BusinessLogic/Validators.php
  89. 70
    0
      api/Controllers/Attachments/StaffTicketAttachmentsController.php
  90. 31
    0
      api/Controllers/Categories/CategoryController.php
  91. 23
    0
      api/Controllers/InternalApiController.php
  92. 16
    0
      api/Controllers/JsonRetriever.php
  93. 101
    0
      api/Controllers/Navigation/CustomNavElementController.php
  94. 17
    0
      api/Controllers/Settings/SettingsController.php
  95. 17
    0
      api/Controllers/Statuses/StatusController.php
  96. 71
    0
      api/Controllers/Tickets/CustomerTicketController.php
  97. 72
    0
      api/Controllers/Tickets/ResendTicketEmailToCustomerController.php
  98. 68
    0
      api/Controllers/Tickets/StaffTicketController.php
  99. 16
    0
      api/Core/Constants/CustomField.php
  100. 0
    0
      api/Core/Constants/Priority.php

+ 6
- 1
.gitignore View File

@@ -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

+ 330
- 207
admin/admin_settings.php View File

@@ -531,7 +531,7 @@ $modsForHesk_settings = mfh_getSettings();
onclick="javascript:alert('<?php echo hesk_makeJsString($hesklang['settings_intro']) . '\n\n' . hesk_makeJsString($hesklang['all_req']); ?>')"><i
class="fa fa-question-circle settingsquestionmark"></i></a>
</h2>
<form method="post" action="admin_settings_save.php" name="form1" onsubmit="return hesk_checkFields()"
<form method="post" enctype="multipart/form-data" action="admin_settings_save.php" name="form1" onsubmit="return hesk_checkFields()"
class="form-horizontal" role="form">

<!-- General Settings -->
@@ -3426,27 +3426,6 @@ $modsForHesk_settings = mfh_getSettings();
value="<?php echo $hesk_settings['online_min']; ?>"/>
</div>
</div>
<div class="form-group">
<label for="rtl" class="col-sm-4 col-xs-12 control-label">
<span class="label label-primary"
data-toggle="tooltip"
title="<?php echo $hesklang['added_in_mods_for_hesk'] ?>"><?php echo $hesklang['mods_for_hesk_acronym']; ?></span>
<?php echo $hesklang['displayRtl']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo $hesklang['displayRtl']; ?>"
data-content="<?php echo $hesklang['displayRtlHelp']; ?>"></i>
</label>

<div class="col-sm-8 col-xs-12">
<div class="checkbox">
<label>
<input id="rtl" name="rtl" type="checkbox" <?php if ($modsForHesk_settings['rtl']) {
echo 'checked';
} ?>> <?php echo $hesklang['display_rtl']; ?>
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="show-icons" class="col-sm-4 col-xs-12 control-label">
<span class="label label-primary"
@@ -3527,7 +3506,7 @@ $modsForHesk_settings = mfh_getSettings();
</div>
</div>
<div class="box-body">
<h4>Common Properties</h4>
<h4><?php echo $hesklang['common_properties']; ?></h4>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
@@ -3548,246 +3527,359 @@ $modsForHesk_settings = mfh_getSettings();
</div>
</div>

<h4>Customer View</h4>
<h4><?php echo $hesklang['customer_view']; ?></h4>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarBackgroundColor"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarBackgroundColor']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['navbarBackgroundColor']; ?>"
data-content="<?php echo $hesklang['navbarBackgroundColorHelp']; ?>"></i>
</label>

<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarBackgroundColor" name="navbarBackgroundColor"
class="form-control"
value="<?php echo $modsForHesk_settings['navbarBackgroundColor']; ?>">
</div>
</div>
<?php
buildColorSchemeColorpicker('navbarBackgroundColor', 'navbarBackgroundColor', $modsForHesk_settings['navbarBackgroundColor'], 'Help');
?>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarBrandColor"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarBrandColor']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['navbarBrandColor']; ?>"
data-content="<?php echo $hesklang['navbarBrandColorHelp']; ?>"></i>
</label>

<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarBrandColor" name="navbarBrandColor"
class="form-control"
value="<?php echo $modsForHesk_settings['navbarBrandColor']; ?>">
</div>
</div>
<?php
buildColorSchemeColorpicker('navbarBrandColor', 'navbarBrandColor', $modsForHesk_settings['navbarBrandColor'], 'Help');
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarBrandHoverColor"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarBrandHoverColor']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['navbarBrandHoverColor']; ?>"
data-content="<?php echo $hesklang['navbarBrandHoverColorHelp']; ?>"></i>
</label>

<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarBrandHoverColor" name="navbarBrandHoverColor"
class="form-control"
value="<?php echo $modsForHesk_settings['navbarBrandHoverColor']; ?>">
</div>
</div>
<?php
buildColorSchemeColorpicker('navbarBrandHoverColor', 'navbarBrandHoverColor', $modsForHesk_settings['navbarBrandHoverColor'], 'Help');
?>
</div>
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('navbarItemTextColor', 'navbarItemTextColor', $modsForHesk_settings['navbarItemTextColor'], 'Help');
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('navbarItemTextHoverColor', 'navbarItemTextHoverColor', $modsForHesk_settings['navbarItemTextHoverColor'], 'Help');
?>
</div>
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('navbarItemTextSelectedColor', 'navbarItemTextSelectedColor', $modsForHesk_settings['navbarItemTextSelectedColor'], 'Help');
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('navbarItemSelectedBackgroundColor', 'navbarItemSelectedBackgroundColor', $modsForHesk_settings['navbarItemSelectedBackgroundColor'], 'Help');
?>
</div>
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('dropdownItemTextColor', 'dropdownItemTextColor', $modsForHesk_settings['dropdownItemTextColor'], 'Help');
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('dropdownItemTextHoverColor', 'dropdownItemTextHoverColor', $modsForHesk_settings['dropdownItemTextHoverColor'], 'Help');
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('dropdownItemTextHoverBackgroundColor', 'dropdownItemTextHoverBackgroundColor', $modsForHesk_settings['dropdownItemTextHoverBackgroundColor'], 'Help');
?>
</div>
</div>
<h4><?php echo $hesklang['admin_panel']; ?></h4>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label for="navbarItemTextColor"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarItemTextColor']; ?>
<label for="admin-color-scheme"
class="col-sm-3 col-xs-5 control-label"><?php echo $hesklang['color_preset']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['navbarItemTextColor']; ?>"
data-content="<?php echo $hesklang['navbarItemTextColorHelp']; ?>"></i>
title="<?php echo $hesklang['color_preset']; ?>"
data-content="<?php echo $hesklang['color_preset_help']; ?>"></i>
</label>

<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarItemTextColor" name="navbarItemTextColor"
class="form-control"
value="<?php echo $modsForHesk_settings['navbarItemTextColor']; ?>">
<div class="col-sm-9 col-xs-7">
<select name="admin-color-scheme" id="admin-color-scheme" class="form-control">
<option value="SELECT"><?php echo $hesklang['select_a_preset']; ?></option>
<option value="blue"><?php echo $hesklang['preset_blue']; ?></option>
<option value="blue-light"><?php echo $hesklang['preset_blue_light']; ?></option>
<option value="yellow"><?php echo $hesklang['preset_yellow']; ?></option>
<option value="yellow-light"><?php echo $hesklang['preset_yellow_light']; ?></option>
<option value="green"><?php echo $hesklang['preset_green']; ?></option>
<option value="green-light"><?php echo $hesklang['preset_green_light']; ?></option>
<option value="purple"><?php echo $hesklang['preset_purple']; ?></option>
<option value="purple-light"><?php echo $hesklang['preset_purple_light']; ?></option>
<option value="red"><?php echo $hesklang['preset_red']; ?></option>
<option value="red-light"><?php echo $hesklang['preset_red_light']; ?></option>
<option value="black"><?php echo $hesklang['preset_black']; ?></option>
<option value="black-light"><?php echo $hesklang['preset_black_light']; ?></option>
</select>
</div>
<script>
$('select[name="admin-color-scheme"]').change(function() {
var val = $(this).val();

if (val === 'SELECT') {
return;
}

var lightTheme = val.match(/.+-light/i);

$('#cpadmin-sidebar-background-color').colorpicker('setValue', lightTheme ? '#f9fafc' : '#222d32');
$('#cpadmin-sidebar-header-background-color').colorpicker('setValue', lightTheme ? '#f9fafc' : '#1a2226');
$('#cpadmin-sidebar-text-color').colorpicker('setValue', lightTheme ? '#444' : '#b8c7ce');
$('#cpadmin-sidebar-header-text-color').colorpicker('setValue', lightTheme ? '#848484' : '#4b646f');
$('#cpadmin-sidebar-text-hover-color').colorpicker('setValue', lightTheme ? '#444' : '#fff');
$('#cpadmin-sidebar-background-hover-color').colorpicker('setValue', lightTheme ? '#f4f4f5' : '#1e282c');
$('input[name="admin-sidebar-font-weight"]').val(lightTheme ? ['bold'] : ['normal']);

$('#cpadmin-navbar-text-color').colorpicker('setValue', '#fff');
$('#cpadmin-navbar-text-hover-color').colorpicker('setValue', '#fff');
$('#cpadmin-navbar-brand-text-color').colorpicker('setValue', '#fff');
$('#cpadmin-navbar-brand-text-hover-color').colorpicker('setValue', '#fff');
if (val.match(/blue.*/i)) {
$('#cpadmin-navbar-background-color').colorpicker('setValue', '#3c8dbc');
$('#cpadmin-navbar-background-hover-color').colorpicker('setValue', '#367fa9');

$('#cpadmin-navbar-brand-background-color').colorpicker('setValue', lightTheme ? '#3c8dbc' : '#367fa9');
$('#cpadmin-navbar-brand-background-hover-color').colorpicker('setValue', lightTheme ? '#3b8ab8' : '#357ca5');
} else if (val.match(/yellow.*/i)) {
$('#cpadmin-navbar-background-color').colorpicker('setValue', '#f39c12');
$('#cpadmin-navbar-background-hover-color').colorpicker('setValue', '#da8c10');

$('#cpadmin-navbar-brand-background-color').colorpicker('setValue', lightTheme ? '#f39c12' : '#e08e0b');
$('#cpadmin-navbar-brand-background-hover-color').colorpicker('setValue', lightTheme ? '#f39a0d' : '#db8b0b');
} else if (val.match(/green.*/i)) {
$('#cpadmin-navbar-background-color').colorpicker('setValue', '#00a65a');
$('#cpadmin-navbar-background-hover-color').colorpicker('setValue', '#009551');

$('#cpadmin-navbar-brand-background-color').colorpicker('setValue', lightTheme ? '#00a65a' : '#008d4c');
$('#cpadmin-navbar-brand-background-hover-color').colorpicker('setValue', lightTheme ? '#00a157' : '#008749');
} else if (val.match(/purple.*/i)) {
$('#cpadmin-navbar-background-color').colorpicker('setValue', '#605ca8');
$('#cpadmin-navbar-background-hover-color').colorpicker('setValue', '#565397');

$('#cpadmin-navbar-brand-background-color').colorpicker('setValue', lightTheme ? '#605ca8' : '#555299');
$('#cpadmin-navbar-brand-background-hover-color').colorpicker('setValue', lightTheme ? '#5d59a6' : '#545096');
} else if (val.match(/red.*/i)) {
$('#cpadmin-navbar-background-color').colorpicker('setValue', '#dd4b39');
$('#cpadmin-navbar-background-hover-color').colorpicker('setValue', '#c64333');

$('#cpadmin-navbar-brand-background-color').colorpicker('setValue', lightTheme ? '#dd4b39' : '#d73925');
$('#cpadmin-navbar-brand-background-hover-color').colorpicker('setValue', lightTheme ? '#dc4735' : '#d33724');
} else {
//-- Black
$('#cpadmin-navbar-background-color').colorpicker('setValue', '#fff');
$('#cpadmin-navbar-background-hover-color').colorpicker('setValue', '#eee');

$('#cpadmin-navbar-brand-background-color').colorpicker('setValue', '#fff');
$('#cpadmin-navbar-brand-background-hover-color').colorpicker('setValue', '#fcfcfc');
}
});
</script>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarItemTextHoverColor"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarItemTextHoverColor']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['navbarItemTextHoverColor']; ?>"
data-content="<?php echo $hesklang['navbarItemTextHoverColorHelp']; ?>"></i>
</label>

<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarItemTextHoverColor" name="navbarItemTextHoverColor"
class="form-control"
value="<?php echo $modsForHesk_settings['navbarItemTextHoverColor']; ?>">
</div>
<div class="col-sm-5 col-sm-offset-7 col-xs-12">
<h4><?php echo $hesklang['navbar']; ?></h4>
</div>
<?php
buildColorSchemeColorpicker('admin-navbar-background-color', 'background_color', $modsForHesk_settings['admin_navbar_background']);
?>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarItemTextSelectedColor"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarItemTextSelectedColor']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['navbarItemTextSelectedColor']; ?>"
data-content="<?php echo $hesklang['navbarItemTextSelectedColorHelp']; ?>"></i>
</label>

<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarItemTextSelectedColor"
name="navbarItemTextSelectedColor" class="form-control"
value="<?php echo $modsForHesk_settings['navbarItemTextSelectedColor']; ?>">
</div>
<div class="col-sm-5 col-sm-offset-7 col-xs-12">
<h4><?php echo $hesklang['navbar_brand']; ?></h4>
</div>
<?php
buildColorSchemeColorpicker('admin-navbar-brand-background-color', 'background_color', $modsForHesk_settings['admin_navbar_brand_background']);
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarItemSelectedBackgroundColor"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarItemSelectedBackgroundColor']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['navbarItemSelectedBackgroundColor']; ?>"
data-content="<?php echo $hesklang['navbarItemSelectedBackgroundColorHelp']; ?>"></i>
</label>

<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarItemSelectedBackgroundColor"
name="navbarItemSelectedBackgroundColor" class="form-control"
value="<?php echo $modsForHesk_settings['navbarItemSelectedBackgroundColor']; ?>">
</div>
<?php
buildColorSchemeColorpicker('admin-navbar-text-color', 'text_color', $modsForHesk_settings['admin_navbar_text']);
?>
</div>
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('admin-navbar-brand-text-color', 'text_color', $modsForHesk_settings['admin_navbar_brand_text']);
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('admin-navbar-text-hover-color', 'text_hover_color', $modsForHesk_settings['admin_navbar_text_hover']);
?>
</div>
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('admin-navbar-brand-text-hover-color', 'text_hover_color', $modsForHesk_settings['admin_navbar_brand_text_hover']);
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('admin-navbar-background-hover-color', 'background_hover_color', $modsForHesk_settings['admin_navbar_background_hover']);
?>
</div>
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('admin-navbar-brand-background-hover-color', 'background_hover_color', $modsForHesk_settings['admin_navbar_brand_background_hover']);
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="col-sm-5 col-sm-offset-7 col-xs-12">
<h4><?php echo $hesklang['sidebar']; ?></h4>
</div>
<?php
buildColorSchemeColorpicker('admin-sidebar-background-color', 'background_color', $modsForHesk_settings['admin_sidebar_background']);
?>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="dropdownItemTextColor"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['dropdownItemTextColor']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['dropdownItemTextColor']; ?>"
data-content="<?php echo $hesklang['dropdownItemTextColorHelp']; ?>"></i>
</label>

<div class="col-sm-5 col-xs-12">
<input type="text" id="dropdownItemTextColor" name="dropdownItemTextColor"
class="form-control"
value="<?php echo $modsForHesk_settings['dropdownItemTextColor']; ?>">
</div>
<div class="col-sm-5 col-sm-offset-7 col-xs-12">
<h4><?php echo $hesklang['sidebar_header']; ?></h4>
</div>
<?php
buildColorSchemeColorpicker('admin-sidebar-header-background-color', 'background_color', $modsForHesk_settings['admin_sidebar_header_background']);
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('admin-sidebar-text-color', 'text_color', $modsForHesk_settings['admin_sidebar_text']);
?>
</div>
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('admin-sidebar-header-text-color', 'text_color', $modsForHesk_settings['admin_sidebar_header_text']);
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('admin-sidebar-text-hover-color', 'text_hover_color', $modsForHesk_settings['admin_sidebar_text_hover']);
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<?php
buildColorSchemeColorpicker('admin-sidebar-background-hover-color', 'background_hover_color', $modsForHesk_settings['admin_sidebar_background_hover']);
?>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="dropdownItemTextHoverColor"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['dropdownItemTextHoverColor']; ?>
<label for="admin-sidebar-font-weight"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['font_weight']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['dropdownItemTextHoverColor']; ?>"
data-content="<?php echo $hesklang['dropdownItemTextHoverColorHelp']; ?>"></i>
data-placement="top"
title="<?php echo $hesklang['font_weight']; ?>"
data-content="<?php echo $hesklang['font_weight_help']; ?>"></i>
</label>

<div class="col-sm-5 col-xs-12">
<input type="text" id="dropdownItemTextHoverColor" name="dropdownItemTextHoverColor"
class="form-control"
value="<?php echo $modsForHesk_settings['dropdownItemTextHoverColor']; ?>">
<div class="col-sm-5 col-xs-12 form-inline">
<div class="radio">
<label>
<input type="radio" name="admin-sidebar-font-weight" value="normal"
<?php echo $modsForHesk_settings['admin_sidebar_font_weight'] == 'normal' ? 'checked' : ''; ?>>
<?php echo $hesklang['normal']; ?>
</label>
</div><br>
<div class="radio">
<label>
<input type="radio" name="admin-sidebar-font-weight" value="bold"
<?php echo $modsForHesk_settings['admin_sidebar_font_weight'] == 'bold' ? 'checked' : ''; ?>>
<?php echo $hesklang['bold']; ?>
</label>
</div>
</div>
</div>
</div>
</div>
<h4><?php echo $hesklang['login_page']; ?></h4>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="col-xs-12">
<div class="form-group">
<label for="dropdownItemTextHoverBackgroundColor"
class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['dropdownItemTextHoverBackgroundColor']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['dropdownItemTextHoverBackgroundColor']; ?>"
data-content="<?php echo $hesklang['dropdownItemTextHoverBackgroundColorHelp']; ?>"></i>
<label for="login-background" class="col-sm-3 col-xs-5 control-label">
<?php echo $hesklang['login_background']; ?>
</label>

<div class="col-sm-5 col-xs-12">
<input type="text" id="dropdownItemTextHoverBackgroundColor"
name="dropdownItemTextHoverBackgroundColor" class="form-control"
value="<?php echo $modsForHesk_settings['dropdownItemTextHoverBackgroundColor']; ?>">
<div class="col-sm-9 col-xs-7 form-inline">
<div class="radio">
<label>
<input type="radio" name="login-background"
data-activate="input[name='login-background-color']" data-deactivate="input[name='login-background-image']"
value="color" <?php if ($modsForHesk_settings['login_background_type'] == 'color') { echo 'checked'; } ?>>
<?php echo $hesklang['solid_color']; ?>
</label>
</div>&nbsp;&nbsp;&nbsp;
<input title="<?php echo $hesklang['login_background_color']; ?>" type="text"
name="login-background-color" class="form-control"
<?php if ($modsForHesk_settings['login_background_type'] == 'image') { echo 'disabled'; } ?>>
<br>
<div class="radio">
<label>
<input type="radio" name="login-background"
data-activate="input[name='login-background-image']" data-deactivate="input[name='login-background-color']"
value="image" <?php if ($modsForHesk_settings['login_background_type'] == 'image') { echo 'checked'; } ?>>
<?php echo $hesklang['image']; ?>
</label>
</div>
<input title="<?php echo $hesklang['login_background_image']; ?>" type="file" name="login-background-image" style="display: inline;vertical-align: bottom" <?php if ($modsForHesk_settings['login_background_type'] == 'color') { echo 'disabled'; } ?>>
<?php if ($modsForHesk_settings['login_background_type'] == 'image'): ?>
<br>
<img src="<?php echo HESK_PATH . $hesk_settings['cache_dir']; ?>/lb_<?php echo $modsForHesk_settings['login_background']; ?>" alt="<?php echo $hesklang['login_background']; ?>" title="<?php echo $hesklang['login_background']; ?>" height="125" width="125" class="push-down-10">
<?php endif; ?>
<script type="text/javascript">
$('input[name="login-background-color"]').colorpicker({
format: 'hex',
color: <?php if ($modsForHesk_settings['login_background_type'] == 'color') { echo "'{$modsForHesk_settings['login_background']}'"; } else { echo 'false'; } ?>
});
</script>
</div>
</div>
</div>
</div>
<h4>Admin Panel</h4>
<div class="row">
<div class="col-xs-12">
<div class="form-group">
<label for="admin-color-scheme"
class="col-sm-3 col-xs-5 control-label"><?php echo $hesklang['color_scheme']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="left"
title="<?php echo $hesklang['color_scheme']; ?>"
data-content="<?php echo $hesklang['color_scheme_help']; ?>"></i>
<label for="login-box-header" class="col-sm-3 col-xs-5 control-label">
<?php echo $hesklang['login_box_header']; ?>
</label>

<div class="col-sm-9 col-xs-7">
<select name="admin-color-scheme" class="form-control">
<option value="skin-blue"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-blue') { echo 'selected'; } ?>>Blue</option>
<option value="skin-blue-light"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-blue-light') { echo 'selected'; } ?>>Blue (Light)</option>
<option value="skin-yellow"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-yellow') { echo 'selected'; } ?>>Yellow</option>
<option value="skin-yellow-light"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-yellow-light') { echo 'selected'; } ?>>Yellow (Light)</option>
<option value="skin-green"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-green') { echo 'selected'; } ?>>Green</option>
<option value="skin-green-light"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-green-light') { echo 'selected'; } ?>>Green (Light)</option>
<option value="skin-purple"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-purple') { echo 'selected'; } ?>>Purple</option>
<option value="skin-purple-light"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-purple-light') { echo 'selected'; } ?>>Purple (Light)</option>
<option value="skin-red"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-red') { echo 'selected'; } ?>>Red</option>
<option value="skin-red-light"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-red-light') { echo 'selected'; } ?>>Red (Light)</option>
<option value="skin-black"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-black') { echo 'selected'; } ?>>Black</option>
<option value="skin-black-light"
<?php if ($modsForHesk_settings['admin_color_scheme'] == 'skin-black-light') { echo 'selected'; } ?>>Black (Light)</option>
</select>
<div class="col-sm-9 col-xs-7 form-inline">
<div class="radio">
<label>
<input type="radio" name="login-box-header" value="helpdesk-title" data-deactivate="input[name='login-box-header-image']" <?php if ($modsForHesk_settings['login_box_header'] == 'helpdesk-title') { echo 'checked'; } ?>>
<?php echo $hesklang['hesk_title']; ?>
</label>
</div><br>
<div class="radio">
<label>
<input type="radio" name="login-box-header" value="image" data-activate="input[name='login-box-header-image']" <?php if ($modsForHesk_settings['login_box_header'] == 'image') { echo 'checked'; } ?>>
<?php echo $hesklang['image']; ?>
</label>
<input title="<?php echo $hesklang['login_header_image']; ?>" type="file" name="login-box-header-image" style="display: inline;vertical-align: bottom" <?php if ($modsForHesk_settings['login_box_header'] == 'helpdesk-title') { echo 'disabled'; } ?>>
<?php if ($modsForHesk_settings['login_box_header'] == 'image'): ?>
<br>
<img src="<?php echo HESK_PATH . $hesk_settings['cache_dir']; ?>/lbh_<?php echo $modsForHesk_settings['login_box_header_image']; ?>" title="<?php echo $modsForHesk_settings['login_box_header_image']; ?>" alt="<?php echo $modsForHesk_settings['login_box_header_image']; ?>" style="height: 75px" class="push-down-10">
<?php endif; ?>
</div>
</div>
<script>
$('select[name="admin-color-scheme"]').change(function() {
$('body').removeClass('skin-blue')
.removeClass('skin-blue-light')
.removeClass('skin-yellow')
.removeClass('skin-yellow-light')
.removeClass('skin-green')
.removeClass('skin-green-light')
.removeClass('skin-purple')
.removeClass('skin-purple-light')
.removeClass('skin-red')
.removeClass('skin-red-light')
.removeClass('skin-black')
.removeClass('skin-black-light')
.addClass($(this).val());
});
</script>
</div>
</div>
</div>
@@ -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 '
<div class="form-group">
<label for="admin-navbar-background-color"
class="col-sm-7 col-xs-12 control-label">'. $hesklang[$label_key] . '
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
data-placement="top"
title="' . htmlspecialchars($hesklang[$label_key]) . '"
data-content="' . htmlspecialchars($hesklang[$label_key . $help_suffix]) . '"></i>
</label>

<div class="col-sm-5 col-xs-12">
<div id="cp' . $field_name . '" class="input-group">
<input type="text" id="' . $field_name . '" name="' . $field_name . '"
class="form-control"
value="' . $color . '">
<span class="input-group-addon"><i></i></span>
</div>
</div>
</div>
<script>
$("#cp' . $field_name . '").colorpicker({
color: "' . $color . '",
format: "hex"
});
</script>
';
}


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: <?php if ($modsForHesk_settings['rtl']) { echo 'right'; } else { echo 'left'; } ?>;
text-align: left;
}

p {

+ 136
- 3
admin/admin_settings_save.php View File

@@ -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 = '<?php
// Settings file for HESK ' . $set['hesk_version'] . '

+ 22
- 5
admin/admin_ticket.php View File

@@ -17,7 +17,7 @@ define('WYSIWYG', 1);
define('VALIDATOR', 1);
define('MFH_PAGE_LAYOUT', 'TOP_AND_SIDE');

define('EXTRA_JS', '<script src="'.HESK_PATH.'internal-api/js/admin-ticket.js"></script>');
define('EXTRA_JS', '<script src="'.HESK_PATH.'internal-api/js/admin-ticket.js"></script><script src="'.HESK_PATH.'js/jquery.dirtyforms.min.js"></script>');

/* 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');
<?php build_dropzone_markup(true, 'notesFiledrop'); ?>
</div>
</div>
<?php display_dropzone_field($hesk_settings['hesk_url'] . '/internal-api/ticket/upload-attachment.php', 'notesFiledrop'); ?>
<?php display_dropzone_field(HESK_PATH . 'internal-api/ticket/upload-attachment.php', 'notesFiledrop'); ?>
<div class="text-right">
<i><?php echo $hesklang['nhid']; ?></i>&nbsp;
<div class="btn-group">
@@ -1500,6 +1500,22 @@ function hesk_getAdminButtonsInTicket($reply = 0, $white = 1)

$options = $reply ? '' : '<div class="pull-right">';

// Resend email notification
$replyDataAttribute = '';
if ($reply) {
$replyDataAttribute = 'data-reply-id="' . $reply['id'] . '"';
}

if ($ticket['email'] !== '') {
$options .= '
<button class="btn btn-default" data-action="resend-email-notification" ' . $replyDataAttribute . ' data-ticket-id="' . $ticket['id'] . '">
<i class="fa fa-envelope navy-blue"></i> ' . $hesklang['resend_email_notification'] . '
</button>
<span id="lang_email_notification_sent" style="display: none">' . $hesklang['email_notification_sent'] . '</span>
<span id="lang_email_notification_resend_failed" style="display: none">' . $hesklang['email_notification_resend_failed'] . '</span>
';
}

/* Edit post */
if ($can_edit) {
$tmp = $reply ? '&amp;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']).'\')"';
}
?>
<form role="form" data-toggle="validator" class="form-horizontal" method="post" action="admin_reply_ticket.php"
<form id="reply-form" role="form" data-toggle="validator" class="form-horizontal" method="post" action="admin_reply_ticket.php"
enctype="multipart/form-data" name="form1" <?php echo $onsubmit; ?>>
<?php

@@ -1963,7 +1979,7 @@ function hesk_printReplyForm()
</div>
</div>
<?php
display_dropzone_field($hesk_settings['hesk_url'] . '/internal-api/ticket/upload-attachment.php');
display_dropzone_field(HESK_PATH . 'internal-api/ticket/upload-attachment.php');
}
?>
<div class="form-group">
@@ -2046,6 +2062,7 @@ function hesk_printReplyForm()
</div>
</div>
</form>
<script>$('form#reply-form').dirtyForms();</script>
</div>
</div>
<!-- END REPLY FORM -->

+ 3
- 31
admin/api_settings.php View File

@@ -1,37 +1,9 @@
<?php
/*******************************************************************************
* Title: Help Desk Software HESK
* Version: 2.6.5 from 28th August 2015
* Author: Klemen Stirn
* Website: https://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', '../');
define('PAGE_TITLE', 'ADMIN_SETTINGS');
define('MFH_PAGE_LAYOUT', 'TOP_AND_SIDE');
define('PAGE_TITLE', 'ADMIN_API_SETTINGS');
define('MFH_PAGE_LAYOUT', 'TOP_ONLY');

// Make sure the install folder is deleted
if (is_dir(HESK_PATH . 'install')) {
@@ -120,7 +92,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
<ul class="nav nav-tabs">
<li class="active"><a href="#general" data-toggle="tab"><?php echo $hesklang['tab_1']; ?></a></li>
<li><a href="#user-security" data-toggle="tab"><?php echo $hesklang['user_security']; ?></a></li>
<li><a href="#" target="_blank"><?php echo $hesklang['api_documentation']; ?> <i class="fa fa-external-link"></i></a></li>
<li><a href="https://mods-for-hesk.readme.io/reference" target="_blank"><?php echo $hesklang['api_documentation']; ?> <i class="fa fa-external-link"></i></a></li>
</ul>
<div class="tab-content summaryList tabPadding">
<div class="tab-pane fade in active" id="general">

+ 11
- 28
admin/assign_owner.php View File

@@ -1,32 +1,15 @@
<?php
/*******************************************************************************
* Title: Help Desk Software HESK
* Version: 2.6.1 from 26th February 2015
* Author: Klemen Stirn
* Website: https://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
*******************************************************************************/
/**
*
* This file is part of HESK - PHP Help Desk Software.
*
* (c) Copyright Klemen Stirn. All rights reserved.
* https://www.hesk.com
*
* For the full copyright and license agreement information visit
* https://www.hesk.com/eula.php
*
*/

define('IN_SCRIPT', 1);
define('HESK_PATH', '../');

+ 21
- 33
admin/calendar.php View File

@@ -1,32 +1,4 @@
<?php
/*******************************************************************************
* Title: Help Desk Software HESK
* Version: 2.6.5 from 28th August 2015
* Author: Klemen Stirn
* Website: https://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('VALIDATOR', 1);
@@ -61,14 +33,26 @@ if ($modsForHesk_settings['enable_calendar'] == '0') {

// Get categories for the dropdown
$order_by = $modsForHesk_settings['category_order_column'];
$rs = hesk_dbQuery("SELECT `id`, `name`, `color` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `usage` <> 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');
<?php foreach ($categories as $category): ?>
<li>
<div class="ticket-info">
<div class="hide-on-overflow no-wrap event-category background-volatile"
<div class="hide-on-overflow no-wrap event-category <?php echo $category['background_volatile']; ?>"
data-select-toggle="category-toggle" data-name="category-toggle" data-category-value="<?php echo $category['id']; ?>"
data-checked="1"
data-toggle="tooltip"
@@ -223,7 +207,9 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
echo '<option value="">'.$hesklang['select'].'</option>';
}
foreach ($categories as $category): ?>
<option value="<?php echo $category['id']; ?>" data-color="<?php echo htmlspecialchars($category['color']); ?>">
<option value="<?php echo $category['id']; ?>" data-background-color="<?php echo htmlspecialchars($category['background_color']); ?>"
data-foreground-color="<?php echo htmlspecialchars($category['foreground_color']); ?>"
data-display-border="<?php echo htmlspecialchars($category['display_border_outline']); ?>">
<?php echo $category['name']; ?>
</option>
<?php endforeach; ?>
@@ -393,7 +379,9 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
echo '<option value="">'.$hesklang['select'].'</option>';
}
foreach ($categories as $category): ?>
<option value="<?php echo $category['id']; ?>" data-color="<?php echo $category['color']; ?>">
<option value="<?php echo $category['id']; ?>" data-background-color="<?php echo htmlspecialchars($category['background_color']); ?>"
data-foreground-color="<?php echo htmlspecialchars($category['foreground_color']); ?>"
data-display-border="<?php echo htmlspecialchars($category['display_border_outline']); ?>">
<?php echo $category['name']; ?>
</option>
<?php endforeach; ?>

+ 1
- 1
admin/edit_post.php View File

@@ -608,7 +608,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
</div>
</div>
<?php
display_dropzone_field($hesk_settings['hesk_url'] . '/internal-api/ticket/upload-attachment.php',
display_dropzone_field(HESK_PATH . 'internal-api/ticket/upload-attachment.php',
'filedrop',
$hesk_settings['attachments']['max_number'] - $number_of_attachments);
endif; ?>

+ 179
- 171
admin/index.php View File

@@ -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()

?>
<div class="login-box">
<div class="login-logo">
<?php echo $hesk_settings['hesk_title']; ?>
</div>
<div class="login-box-body">
<div class="loginError">
<?php
/* This will handle error, success and notice messages */
hesk_handle_messages();
?>
</div>
<h4 class="login-box-msg">
<?php echo $hesklang['staff_login_title']; ?>
</h4>
<form class="form-horizontal" role="form" action="index.php" method="post" name="form1">
<?php
$has_error = '';
if (in_array('pass',$_SESSION['a_iserror'])) {
$has_error = 'has-error';
}
?>
<div class="form-group <?php echo $has_error; ?>">
<label for="user" class="col-sm-4 control-label">
<?php echo $hesklang['username']; ?>
</label>
<div class="col-sm-8">
<div class="login-box-container">
<div class="login-box-background"></div>
<div class="login-box-body">
<div class="loginError">
<?php
/* This will handle error, success and notice messages */
hesk_handle_messages();
?>
</div>
<div class="login-logo">
<?php if ($modsForHesk_settings['login_box_header'] == 'image'): ?>
<img src="<?php echo HESK_PATH . $hesk_settings['cache_dir'] . '/lbh_' . $modsForHesk_settings['login_box_header_image']; ?>"
style="height: 75px">
<?php else:
echo $hesk_settings['hesk_title'];
endif; ?>
</div>
<h4 class="login-box-msg">
<?php echo $hesklang['staff_login_title']; ?>
</h4>
<form class="form-horizontal" role="form" action="index.php" method="post" name="form1">
<?php
$has_error = '';
if (in_array('pass',$_SESSION['a_iserror'])) {
$has_error = 'has-error';
}
?>
<div class="form-group <?php echo $has_error; ?>">
<label for="user" class="col-sm-4 control-label">
<?php echo $hesklang['username']; ?>
</label>
<div class="col-sm-8">
<?php
if (defined('HESK_USER')) {
$savedUser = HESK_USER;
} else {
$savedUser = hesk_htmlspecialchars(hesk_COOKIE('hesk_username'));
}

$is_1 = '';
$is_2 = '';
$is_3 = '';

$remember_user = hesk_POST('remember_user');

if ($hesk_settings['autologin'] && (isset($_COOKIE['hesk_p']) || $remember_user == 'AUTOLOGIN')) {
$is_1 = 'checked';
} elseif (isset($_COOKIE['hesk_username']) || $remember_user == 'JUSTUSER') {
$is_2 = 'checked';
} else {
$is_3 = 'checked';
}

if ($hesk_settings['list_users']) :
$res = hesk_dbQuery("SELECT `user` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `active` = '1' ORDER BY `user` ASC");
?>
<select class="form-control" name="user">
<?php
while ($row = hesk_dbFetchAssoc($res)):
$sel = (strtolower($savedUser) == strtolower($row['user'])) ? 'selected' : '';
?>
<option value="<?php echo $row['user']; ?>" <?php echo $sel; ?>>
<?php echo $row['user']; ?>
</option>
<?php endwhile; ?>
</select>
<?php else: ?>
<input class="form-control" type="text" name="user" size="35"
placeholder="<?php echo htmlspecialchars($hesklang['username']); ?>"
value="<?php echo $savedUser; ?>">
<?php endif; ?>
</div>
</div>
<?php
$has_error = '';
if (in_array('pass',$_SESSION['a_iserror'])) {
$has_error = 'has-error';
}
?>
<div class="form-group <?php echo $has_error; ?>">
<label for="pass" class="col-sm-4 control-label">
<?php echo $hesklang['pass']; ?>
</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="pass" name="pass" size="35" placeholder="<?php echo htmlspecialchars($hesklang['pass']); ?>">
</div>
</div>
<?php
if ($hesk_settings['secimg_use'] == 2)
{

// SPAM prevention verified for this session
if (isset($_SESSION['img_a_verified']))
{
echo '<img src="'.HESK_PATH.'img/success.png" width="16" height="16" border="0" alt="" style="vertical-align:text-bottom" /> '.$hesklang['vrfy'];
}
// Not verified yet, should we use Recaptcha?
elseif ($hesk_settings['recaptcha_use'] == 1)
{
?>
<script type="text/javascript">
var RecaptchaOptions = {
theme : '<?php echo ( isset($_SESSION['a_iserror']) && in_array('mysecnum',$_SESSION['a_iserror']) ) ? 'red' : 'white'; ?>',
custom_translations : {
visual_challenge : "<?php echo hesk_slashJS($hesklang['visual_challenge']); ?>",
audio_challenge : "<?php echo hesk_slashJS($hesklang['audio_challenge']); ?>",
refresh_btn : "<?php echo hesk_slashJS($hesklang['refresh_btn']); ?>",
instructions_visual : "<?php echo hesk_slashJS($hesklang['instructions_visual']); ?>",
instructions_context : "<?php echo hesk_slashJS($hesklang['instructions_context']); ?>",
instructions_audio : "<?php echo hesk_slashJS($hesklang['instructions_audio']); ?>",
help_btn : "<?php echo hesk_slashJS($hesklang['help_btn']); ?>",
play_again : "<?php echo hesk_slashJS($hesklang['play_again']); ?>",
cant_hear_this : "<?php echo hesk_slashJS($hesklang['cant_hear_this']); ?>",
incorrect_try_again : "<?php echo hesk_slashJS($hesklang['incorrect_try_again']); ?>",
image_alt_text : "<?php echo hesk_slashJS($hesklang['image_alt_text']); ?>"
}
};
</script>
<?php
if (defined('HESK_USER')) {
$savedUser = HESK_USER;
} else {
$savedUser = hesk_htmlspecialchars(hesk_COOKIE('hesk_username'));
require_once(HESK_PATH . 'inc/recaptcha/recaptchalib.php');
echo '<div class="form-group"><div class="col-md-8 col-md-offset-4">';
echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true);
echo '</div></div>';
}

$is_1 = '';
$is_2 = '';
$is_3 = '';

$remember_user = hesk_POST('remember_user');

if ($hesk_settings['autologin'] && (isset($_COOKIE['hesk_p']) || $remember_user == 'AUTOLOGIN')) {
$is_1 = 'checked';
} elseif (isset($_COOKIE['hesk_username']) || $remember_user == 'JUSTUSER') {
$is_2 = 'checked';
} else {
$is_3 = 'checked';
// Use reCaptcha API v2?
elseif ($hesk_settings['recaptcha_use'] == 2)
{
?>
<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<div class="g-recaptcha" data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?>"></div>
</div>
</div>
<?php
}
// At least use some basic PHP generated image (better than nothing)
else
{
echo '<div class="form-group"><div class="col-md-8 col-md-offset-4">';
$cls = in_array('mysecnum',$_SESSION['a_iserror']) ? ' class="isError" ' : '';

if ($hesk_settings['list_users']) :
$res = hesk_dbQuery("SELECT `user` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `active` = '1' ORDER BY `user` ASC");
?>
<select class="form-control" name="user">
<?php
while ($row = hesk_dbFetchAssoc($res)):
$sel = (strtolower($savedUser) == strtolower($row['user'])) ? 'selected' : '';
?>
<option value="<?php echo $row['user']; ?>" <?php echo $sel; ?>>
<?php echo $row['user']; ?>
</option>
<?php endwhile; ?>
</select>
<?php else: ?>
<input class="form-control" type="text" name="user" size="35"
placeholder="<?php echo htmlspecialchars($hesklang['username']); ?>"
value="<?php echo $savedUser; ?>">
<?php endif; ?>
</div>
</div>
<?php
$has_error = '';
if (in_array('pass',$_SESSION['a_iserror'])) {
$has_error = 'has-error';
}
?>
<div class="form-group <?php echo $has_error; ?>">
<label for="pass" class="col-sm-4 control-label">
<?php echo $hesklang['pass']; ?>
</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="pass" name="pass" size="35" placeholder="<?php echo htmlspecialchars($hesklang['pass']); ?>">
</div>
</div>
<?php
if ($hesk_settings['secimg_use'] == 2)
{
echo $hesklang['sec_enter'].'<br><br><img src="'.HESK_PATH.'print_sec_img.php?'.rand(10000,99999).'" width="150" height="40" alt="'.$hesklang['sec_img'].'" title="'.$hesklang['sec_img'].'" border="1" name="secimg" style="vertical-align:text-bottom"> '.
'<a href="javascript:void(0)" onclick="javascript:document.form1.secimg.src=\''.HESK_PATH.'print_sec_img.php?\'+ ( Math.floor((90000)*Math.random()) + 10000);"><img src="'.HESK_PATH.'img/reload.png" height="24" width="24" alt="'.$hesklang['reload'].'" title="'.$hesklang['reload'].'" border="0" style="vertical-align:text-bottom"></a>'.
'<br><br><input type="text" name="mysecnum" size="20" maxlength="5" '.$cls.'>';
echo '</div></div>';
}
} // End if $hesk_settings['secimg_use'] == 2

// SPAM prevention verified for this session
if (isset($_SESSION['img_a_verified']))
{
echo '<img src="'.HESK_PATH.'img/success.png" width="16" height="16" border="0" alt="" style="vertical-align:text-bottom" /> '.$hesklang['vrfy'];
}
// Not verified yet, should we use Recaptcha?
elseif ($hesk_settings['recaptcha_use'] == 1)
if ($hesk_settings['autologin'])
{
?>
<script type="text/javascript">
var RecaptchaOptions = {
theme : '<?php echo ( isset($_SESSION['a_iserror']) && in_array('mysecnum',$_SESSION['a_iserror']) ) ? 'red' : 'white'; ?>',
custom_translations : {
visual_challenge : "<?php echo hesk_slashJS($hesklang['visual_challenge']); ?>",
audio_challenge : "<?php echo hesk_slashJS($hesklang['audio_challenge']); ?>",
refresh_btn : "<?php echo hesk_slashJS($hesklang['refresh_btn']); ?>",
instructions_visual : "<?php echo hesk_slashJS($hesklang['instructions_visual']); ?>",
instructions_context : "<?php echo hesk_slashJS($hesklang['instructions_context']); ?>",
instructions_audio : "<?php echo hesk_slashJS($hesklang['instructions_audio']); ?>",
help_btn : "<?php echo hesk_slashJS($hesklang['help_btn']); ?>",
play_again : "<?php echo hesk_slashJS($hesklang['play_again']); ?>",
cant_hear_this : "<?php echo hesk_slashJS($hesklang['cant_hear_this']); ?>",
incorrect_try_again : "<?php echo hesk_slashJS($hesklang['incorrect_try_again']); ?>",
image_alt_text : "<?php echo hesk_slashJS($hesklang['image_alt_text']); ?>"
}
};
</script>
<?php
require_once(HESK_PATH . 'inc/recaptcha/recaptchalib.php');
echo '<div class="form-group"><div class="col-md-8 col-md-offset-4">';
echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true);
echo '</div></div>';
}
// Use reCaptcha API v2?
elseif ($hesk_settings['recaptcha_use'] == 2)
{
?>
<div class="form-group">
<div class="col-md-8 col-md-offset-4">
<div class="g-recaptcha" data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?>"></div>
<div class="col-md-offset-4 col-md-8">
<div class="radio">
<label><input type="radio" name="remember_user" value="AUTOLOGIN" <?php echo $is_1; ?>> <?php echo $hesklang['autologin']; ?></label>
</div>
<div class="radio">
<label><input type="radio" name="remember_user" value="JUSTUSER" <?php echo $is_2; ?>> <?php echo $hesklang['just_user']; ?></label>
</div>
<div class="radio">
<label><input type="radio" name="remember_user" value="NOTHANKS" <?php echo $is_3; ?>> <?php echo $hesklang['nothx']; ?></label>
</div>
</div>
</div>
<?php
}
// At least use some basic PHP generated image (better than nothing)
else
{
echo '<div class="form-group"><div class="col-md-8 col-md-offset-4">';
$cls = in_array('mysecnum',$_SESSION['a_iserror']) ? ' class="isError" ' : '';

echo $hesklang['sec_enter'].'<br><br><img src="'.HESK_PATH.'print_sec_img.php?'.rand(10000,99999).'" width="150" height="40" alt="'.$hesklang['sec_img'].'" title="'.$hesklang['sec_img'].'" border="1" name="secimg" style="vertical-align:text-bottom"> '.
'<a href="javascript:void(0)" onclick="javascript:document.form1.secimg.src=\''.HESK_PATH.'print_sec_img.php?\'+ ( Math.floor((90000)*Math.random()) + 10000);"><img src="'.HESK_PATH.'img/reload.png" height="24" width="24" alt="'.$hesklang['reload'].'" title="'.$hesklang['reload'].'" border="0" style="vertical-align:text-bottom"></a>'.
'<br><br><input type="text" name="mysecnum" size="20" maxlength="5" '.$cls.'>';
echo '</div></div>';
}
} // End if $hesk_settings['secimg_use'] == 2

if ($hesk_settings['autologin'])
{
?>
<div class="form-group">
<div class="col-md-offset-4 col-md-8">
<div class="radio">
<label><input type="radio" name="remember_user" value="AUTOLOGIN" <?php echo $is_1; ?>> <?php echo $hesklang['autologin']; ?></label>
</div>
<div class="radio">
<label><input type="radio" name="remember_user" value="JUSTUSER" <?php echo $is_2; ?>> <?php echo $hesklang['just_user']; ?></label>
</div>
<div class="radio">
<label><input type="radio" name="remember_user" value="NOTHANKS" <?php echo $is_3; ?>> <?php echo $hesklang['nothx']; ?></label>
?>
<div class="form-group">
<div class="col-md-offset-4 col-md-8">
<div class="checkbox">
<label><input type="checkbox" name="remember_user" value="JUSTUSER" <?php echo $is_2; ?> /> <?php echo $hesklang['remember_user']; ?></label>
</div>
</div>
</div>
</div>
<?php
}
else
{
<?php
} // End if $hesk_settings['autologin']
?>
<div class="form-group">
<div class="col-md-offset-4 col-md-8">
<div class="checkbox">
<label><input type="checkbox" name="remember_user" value="JUSTUSER" <?php echo $is_2; ?> /> <?php echo $hesklang['remember_user']; ?></label>
</div>
<input type="submit" value="<?php echo $hesklang['click_login']; ?>" class="btn btn-default">
<input type="hidden" name="a" value="do_login">
<?php
if ( hesk_isREQUEST('goto') && $url=hesk_REQUEST('goto') )
{
echo '<input type="hidden" name="goto" value="'.$url.'">';
}

// Do we allow staff password reset?
if ($hesk_settings['reset_pass'])
{
echo '<br><br><a href="password.php" class="smaller">'.$hesklang['fpass'].'</a>';
}
?>
</div>
</div>
<?php
} // End if $hesk_settings['autologin']
?>
<div class="form-group">
<div class="col-md-offset-4 col-md-8">
<input type="submit" value="<?php echo $hesklang['click_login']; ?>" class="btn btn-default">
<input type="hidden" name="a" value="do_login">
<?php
if ( hesk_isREQUEST('goto') && $url=hesk_REQUEST('goto') )
{
echo '<input type="hidden" name="goto" value="'.$url.'">';
}

// Do we allow staff password reset?
if ($hesk_settings['reset_pass'])
{
echo '<br><br><a href="password.php" class="smaller">'.$hesklang['fpass'].'</a>';
}
?>
</div>
</div>
</form>
</form>
</div>
</div>
</div>
<?php

+ 11
- 28
admin/knowledgebase_private.php View File

@@ -1,32 +1,15 @@
<?php
/*******************************************************************************
* Title: Help Desk Software HESK
* Version: 2.6.8 from 10th August 2016
* Author: Klemen Stirn
* Website: https://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
*******************************************************************************/
/**
*
* This file is part of HESK - PHP Help Desk Software.
*
* (c) Copyright Klemen Stirn. All rights reserved.
* https://www.hesk.com
*
* For the full copyright and license agreement information visit
* https://www.hesk.com/eula.php
*
*/

define('IN_SCRIPT',1);
define('HESK_PATH','../');

+ 162
- 57
admin/manage_categories.php View File

@@ -107,8 +107,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
<div class="box-body">
<form action="manage_categories.php" method="post" role="form" class="form-horizontal" data-toggle="validator">
<div class="form-group">
<p class="col-sm-4 control-label" style="font-size: .87em">
<b><?php echo $hesklang['cat_name']; ?></b> (<?php echo $hesklang['max_chars']; ?>)</p>
<label for="name" class="col-sm-4 control-label"><?php echo $hesklang['cat_name']; ?></label>

<div class="col-sm-8">
<input class="form-control"
@@ -121,12 +120,12 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
?>
data-error="<?php echo htmlspecialchars($hesklang['enter_cat_name']); ?>"
required>
<div class="help-block"><?php echo $hesklang['max_chars']; ?></div>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
<label for="priority" class="col-sm-4 control-label"
style="font-size: .87em"><?php echo $hesklang['def_pri']; ?> <a href="#"
<label for="priority" class="col-sm-4 control-label"><?php echo $hesklang['def_pri']; ?> <a href="#"
onclick="alert('<?php echo hesk_makeJsString($hesklang['cat_pri']); ?>')"><i
class="fa fa-question-circle settingsquestionmark"></i> </a> </label>

@@ -149,15 +148,51 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
</div>
<div class="form-group">
<label for="color" class="col-sm-4 control-label">
<?php echo $hesklang['category_color']; ?>
<?php echo $hesklang['category_background_color']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo htmlspecialchars($hesklang['category_color']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_color_help']); ?>"></i>
title="<?php echo htmlspecialchars($hesklang['category_background_color']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_background_color_help']); ?>"></i>
</label>
<div class="col-sm-8">
<input class="form-control colorpicker-trigger"
placeholder="<?php echo htmlspecialchars($hesklang['category_color']); ?>" type="text"
name="color" maxlength="7">
placeholder="<?php echo htmlspecialchars($hesklang['category_background_color']); ?>" type="text"
name="background-color" maxlength="7" required>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
<label for="color" class="col-sm-4 control-label">
<?php echo $hesklang['category_foreground_color']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo htmlspecialchars($hesklang['category_foreground_color']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_foreground_color_help']); ?>"></i>
</label>
<div class="col-sm-8">
<input class="form-control colorpicker-trigger"
placeholder="<?php echo htmlspecialchars($hesklang['category_foreground_color']); ?>" type="text"
name="foreground-color" maxlength="7">
</div>
</div>
<div class="form-group">
<label for="display-border" class="col-sm-4 control-label">
<?php echo $hesklang['category_display_border']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="htmlpopover"
title="<?php echo htmlspecialchars($hesklang['category_display_border']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_display_border_help']); ?>"></i>
</label>
<div class="col-sm-8 form-inline">
<div class="radio">
<label>
<input type="radio" name="display-border" value="1">
<?php echo $hesklang['yes']; ?>
</label>
</div>&nbsp;&nbsp;&nbsp;
<div class="radio">
<label>
<input type="radio" name="display-border" value="0" checked>
<?php echo $hesklang['no']; ?>
</label>
</div>
</div>
</div>
<div class="form-group">
@@ -194,10 +229,12 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
</div>
</div>
</div>
<div class="form-group text-center">
<input type="hidden" name="a" value="new"/>
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>"/>
<input type="submit" value="<?php echo $hesklang['create_cat']; ?>" class="btn btn-default"/>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-4">
<input type="hidden" name="a" value="new"/>
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>"/>
<input type="submit" value="<?php echo $hesklang['create_cat']; ?>" class="btn btn-default"/>
</div>
</div>
</form>
</div>
@@ -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 '
<tr data-category-id="' . $mycat['id'] . '" data-name="' . htmlspecialchars($mycat['name']) . '"
data-color="'. htmlspecialchars($mycat['color']) . '" data-priority="' . $mycat['priority'] . '"
data-foreground-color="' . htmlspecialchars($mycat['foreground_color']) . '"
data-border="' . $mycat['display_border_outline'] . '"
data-background-color="'. htmlspecialchars($mycat['background_color']) . '"
data-priority="' . $mycat['priority'] . '"
data-manager="' . $mycat['manager'] . '" data-usage="'. $mycat['usage'] .'">
<td style="display: none">' . $mycat['id'] . '</td>
<td><span class="label background-volatile category-label" style="'.$style.'">' . $mycat['name'] . '</span></td>
<td><span class="label ' . $backgroundVolatile . ' category-label" style="'.$style.'">' . $mycat['name'] . '</span></td>
<td width="1" style="white-space: nowrap;">' . $priorities[$mycat['priority']]['formatted'] . '</td>
<td><a href="show_tickets.php?category=' . $mycat['id'] . '&amp;s_all=1&amp;s_my=1&amp;s_ot=1&amp;s_un=1" alt="' . $hesklang['list_tickets_cat'] . '" title="' . $hesklang['list_tickets_cat'] . '">' . $all . '</a></td>
<td>
<div class="progress" style="width: 160px; margin-bottom: 0" title="' . sprintf($hesklang['perat'], $width_all . '%') . '" data-toggle="tooltip">
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: ' . $width_all . '%">
<span class="sr-only">40% Complete (success)</span>
</div>
</div>
</td>
@@ -351,7 +399,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
';
}
}
echo '<a href="javascript:;" class="category-modal-trigger" data-category-id="' . $mycat['id'] . '"><i class="fa fa-pencil icon-link orange" data-toggle="tooltip" title="Edit"></i></a>';
echo '<a href="javascript:;" class="category-modal-trigger" data-category-id="' . $mycat['id'] . '"><i class="fa fa-pencil icon-link orange" data-toggle="tooltip" title="' . $hesklang['edit'] . '"></i></a>';
echo $remove_code . '</td>
</tr>
';
@@ -370,34 +418,71 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
<div class="modal-content">
<div class="modal-header" style="cursor: move">
<button type="button" class="close cancel-callback" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="myModalLabel">Edit Category</h4>
<h4 class="modal-title" id="myModalLabel"><?php echo $hesklang['edit_category']; ?></h4>
</div>
<form action="manage_categories.php" class="form-horizontal" data-toggle="validator" method="post">
<div class="modal-body">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<label for="name" class="col-sm-3 control-label"><?php echo $hesklang['name']; ?></label>
<label for="name" class="col-sm-3 control-label"><?php echo $hesklang['cat_name']; ?></label>
<div class="col-sm-9">
<input type="text" name="name" class="form-control" placeholder="<?php echo $hesklang['name']; ?>"
<input type="text" name="name" class="form-control" placeholder="<?php echo $hesklang['cat_name']; ?>"
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
required>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
<label for="color" class="col-sm-3 control-label">
<?php echo $hesklang['category_color']; ?>
<label for="background-color" class="col-sm-3 control-label">
<?php echo $hesklang['category_background_color']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo htmlspecialchars($hesklang['category_color']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_color_help']); ?>"></i>
title="<?php echo htmlspecialchars($hesklang['category_background_color']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_background_color_help']); ?>"></i>
</label>
<div class="col-sm-9">
<input type="text" name="color" class="form-control category-colorpicker"
placeholder="<?php echo $hesklang['category_color']; ?>">
<input type="text" name="background-color" class="form-control category-colorpicker"
placeholder="<?php echo $hesklang['category_background_color']; ?>"
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"
required>
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
<label for="foreground-color" class="col-sm-3 control-label">
<?php echo $hesklang['category_foreground_color']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo htmlspecialchars($hesklang['category_foreground_color']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_foreground_color_help']); ?>"></i>
</label>
<div class="col-sm-9">
<input type="text" name="foreground-color" class="form-control category-colorpicker"
placeholder="<?php echo $hesklang['category_foreground_color']; ?>">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
<label for="display-border" class="col-sm-3 control-label">
<?php echo $hesklang['category_display_border']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="htmlpopover"
title="<?php echo htmlspecialchars($hesklang['category_display_border']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_display_border_help']); ?>"></i>
</label>
<div class="col-sm-9 form-inline">
<div class="radio">
<label>
<input type="radio" name="display-border" value="1">
<?php echo $hesklang['yes']; ?>
</label>
</div>&nbsp;&nbsp;&nbsp;
<div class="radio">
<label>
<input type="radio" name="display-border" value="0" checked>
<?php echo $hesklang['no']; ?>
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="priority" class="col-sm-3 control-label">
<?php echo $hesklang['priority']; ?>
@@ -471,7 +556,8 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
var name = tempNameElement.value;

var id = $row.attr('data-category-id');
var color = $row.attr('data-color');
var backgroundColor = $row.attr('data-background-color');
var foregroundColor = $row.attr('data-foreground-color');
var priority = $row.attr('data-priority');
var manager = $row.attr('data-manager');
var usage = $row.attr('data-usage');
@@ -482,29 +568,32 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
.find('select[name="manager"]').val(manager).end()
.find('input[name="id"]').val(id).end()
.find('select[name="usage"]').val(usage).end()
.find('input[name="color"]').val(color).end();

var colorpickerOptions = null;
if (color == '') {
colorpickerOptions = {
format: 'hex'
};
} else {
colorpickerOptions = {
format: 'hex',
color: color
};
}
$modal.find('input[name="color"]')
.find('input[name="background-color"]').val(backgroundColor).end()
.find('input[name="foreground-color"]').val(foregroundColor).end();

var colorpickerOptions = {
format: 'hex',
color: backgroundColor
};
$modal.find('input[name="background-color"]')
.colorpicker(colorpickerOptions).end().modal('show');

if (color == '') {
$modal.find('input[name="color"]').val('');
colorpickerOptions = {
format: 'hex'
};
if (foregroundColor != '') {
colorpickerOptions.color = foregroundColor;
}

$modal.find('input[name="foreground-color"]')
.colorpicker(colorpickerOptions).end().modal('show');
});

$('.cancel-callback').click(function() {
$('#edit-category-modal').find('input[name="color"]').val('').colorpicker('destroy').end();
var $editCategoryModal = $('#edit-category-modal');

$editCategoryModal.find('input[name="background-color"]').val('').colorpicker('destroy').end();
$editCategoryModal.find('input[name="foreground-color"]').val('').colorpicker('destroy').end();
});
});
</script>
@@ -629,9 +718,13 @@ function new_cat()
/* Category name */
$catname = hesk_input(hesk_POST('name'), $hesklang['enter_cat_name'], 'manage_categories.php');

$color = hesk_POST('color', null);
$color = str_replace('#', '', $color);
$color = $color != null ? "'#" . hesk_dbEscape($color) . "'" : 'NULL';
$background_color = hesk_POST('background-color', '#ffffff');
$foreground_color = hesk_POST('foreground-color', '#000000');
$display_border = hesk_POST('display-border', 0);
if ($foreground_color == '') {
$foreground_color = 'AUTO';
$display_border = 0;
}

$usage = hesk_POST('usage', 0);

@@ -647,7 +740,11 @@ function new_cat()
$row = hesk_dbFetchRow($res);
$my_order = $row[0] + 10;

hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` (`name`,`cat_order`,`autoassign`,`type`, `priority`, `color`, `usage`) VALUES ('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "','" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}', {$color}, " . intval($usage) . ")");
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories`
(`name`,`cat_order`,`autoassign`,`type`, `priority`, `background_color`, `foreground_color`, `display_border_outline`, `usage`) VALUES
('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "',
'" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}', '" . hesk_dbEscape($background_color) . "',
'" . hesk_dbEscape($foreground_color) . "', '" . intval($display_border) . "', " . intval($usage) . ")");

hesk_cleanSessionVars('catname');
hesk_cleanSessionVars('cat_au