HESK v3.2.4

This commit is contained in:
Luke Tainton
2021-11-20 10:45:31 +00:00
parent fd87e36f6b
commit 2c117f14cb
180 changed files with 12764 additions and 12390 deletions

View File

@@ -57,7 +57,7 @@ if (hesk_checkPermission('can_view_tickets',0))
$_SESSION['default_list'] = '';
}
/* Get default settings */
else
elseif (empty($_GET))
{
parse_str($_SESSION['default_list'],$defaults);
$_GET = isset($_GET) && is_array($_GET) ? array_merge($_GET, $defaults) : $defaults;

View File

@@ -105,8 +105,9 @@ if (strlen($message))
$message = convert_html_to_text($message_html);
$message = fix_newlines($message);
// Re-encode the message
// Prepare plain message for storage as HTML
$message = hesk_htmlspecialchars($message);
// nl2br done after adding signature
} elseif ($hesk_settings['staff_ticket_formatting'] == 0) {
$message_html = hesk_makeURL($message_html);
$message_html = nl2br($message_html);

View File

@@ -349,7 +349,7 @@ hesk_handle_messages();
</div>
</a>
</label>
<input type="text" class="form-control" name="s_db_user" id="m3" maxlength="255" value="<?php echo $hesk_settings['db_user']; ?>" autocomplete="off">
<input type="text" class="form-control" name="s_db_user" id="m3" maxlength="255" value="<?php echo str_replace('&', '&amp;', $hesk_settings['db_user']); ?>" autocomplete="off">
</div>
<div class="form-group">
<label>
@@ -362,7 +362,7 @@ hesk_handle_messages();
</div>
</a>
</label>
<input type="password" class="form-control" name="s_db_pass" id="m4" maxlength="255" value="<?php echo $hesk_settings['db_pass'] ; ?>" autocomplete="off">
<input type="password" class="form-control" name="s_db_pass" id="m4" maxlength="255" value="<?php echo str_replace('&', '&amp;', $hesk_settings['db_pass']); ?>" autocomplete="off">
</div>
<div class="form-group">
<label>

View File

@@ -545,7 +545,6 @@ $hesk_settings[\'db_name\']=\'' . hesk_getProperty($set, 'db_name') . '\';
$hesk_settings[\'db_user\']=\'' . hesk_getProperty($set, 'db_user') . '\';
$hesk_settings[\'db_pass\']=\'' . hesk_getProperty($set, 'db_pass') . '\';
$hesk_settings[\'db_pfix\']=\'' . hesk_getProperty($set, 'db_pfix') . '\';
$hesk_settings[\'db_vrsn\']=' . hesk_getProperty($set, 'db_vrsn') . ';
// ==> HELP DESK
@@ -747,12 +746,12 @@ $tmp = array();
if ( ! $smtp_OK)
{
$tmp[] = '<span style="color:red; font-weight:bold">'.$hesklang['sme'].':</span> '.$smtp_error.'<br /><br /><a href="Javascript:void(0)" onclick="Javascript:hesk_toggleLayerDisplay(\'smtplog\')">'.$hesklang['scl'].'</a><div id="smtplog" style="display:none">&nbsp;<br /><textarea name="log" rows="10" cols="60">'.$smtp_log.'</textarea></div>';
$tmp[] = '<span class="text-danger">'.$hesklang['sme'].':</span> '.$smtp_error.'<br /><br /><a href="Javascript:void(0)" onclick="Javascript:hesk_toggleLayerDisplay(\'smtplog\')">'.$hesklang['scl'].'</a><div id="smtplog" style="display:none">&nbsp;<br /><textarea name="log" rows="10" cols="60">'.$smtp_log.'</textarea></div>';
}
if ( ! $pop3_OK)
{
$tmp[] = '<span style="color:red; font-weight:bold">'.$hesklang['pop3e'].':</span> '.$pop3_error.'<br /><br /><a href="Javascript:void(0)" onclick="Javascript:hesk_toggleLayerDisplay(\'pop3log\')">'.$hesklang['pop3log'].'</a><div id="pop3log" style="display:none">&nbsp;<br /><textarea name="log" rows="10" cols="60">'.$pop3_log.'</textarea></div>';
$tmp[] = '<span class="text-danger">'.$hesklang['pop3e'].':</span> '.$pop3_error.'<br /><br /><a href="Javascript:void(0)" onclick="Javascript:hesk_toggleLayerDisplay(\'pop3log\')">'.$hesklang['pop3log'].'</a><div id="pop3log" style="display:none">&nbsp;<br /><textarea name="log" rows="10" cols="60">'.$pop3_log.'</textarea></div>';
}
// Clear the cache folder

View File

@@ -412,8 +412,9 @@ if ($hesk_settings['staff_ticket_formatting'] == 2) {
$tmpvar['message'] = convert_html_to_text($tmpvar['message_html']);
$tmpvar['message'] = fix_newlines($tmpvar['message']);
// Re-encode the message
// Prepare plain message for storage as HTML
$tmpvar['message'] = hesk_htmlspecialchars($tmpvar['message']);
$tmpvar['message'] = nl2br($tmpvar['message']);
} else {
// `message` already contains a HTML friendly version. May as well just re-use it
$tmpvar['message'] = hesk_makeURL($tmpvar['message']);

View File

@@ -694,9 +694,9 @@ $options = array(
<?php endif; ?>
<?php echo $ticket['subject']; ?>
</h3>
<div>
<a href="javascript:" onclick="hesk_toggleLayerDisplay('notesformTop')" style="text-decoration: none; color: #959eb0;">
<svg class="icon icon-note" style="fill: #959eb0;">
<div class="note__link">
<a href="javascript:" onclick="hesk_toggleLayerDisplay('notesformTop')">
<svg class="icon icon-note">
<use xlink:href="<?php echo HESK_PATH; ?>img/sprite.svg#icon-note"></use>
</svg>&nbsp;&nbsp;
<?php echo $hesklang['addnote']; ?>
@@ -740,7 +740,7 @@ $options = array(
<div class="note__description">
<p><?php echo $note['message']; ?></p>
</div>
<div class="note__attachments" style="color: #9c9c9c;">
<div class="note__attachments">
<?php
// Attachments
if ( $hesk_settings['attachments']['use'] && strlen($note['attachments']) )
@@ -976,7 +976,7 @@ $options = array(
echo '
<div>
<span style="color: #959eb0">'.$v['name:'].'</span>
<span class="custom-field-title">'.$v['name:'].'</span>
<span>'.$ticket[$k].'</span>
</div>';
}
@@ -1005,7 +1005,7 @@ $options = array(
echo '
<div>
<span style="color: #959eb0">'.$v['name:'].'</span>
<span class="custom-field-title">'.$v['name:'].'</span>
<span>'.$ticket[$k].'</span>
</div>';
}
@@ -1091,7 +1091,7 @@ $options = array(
<div class="note__description">
<p><?php echo $note['message']; ?></p>
</div>
<div class="note__attachments" style="color: #9c9c9c;">
<div class="note__attachments">
<?php
// Attachments
if ( $hesk_settings['attachments']['use'] && strlen($note['attachments']) )
@@ -1499,7 +1499,7 @@ $options = array(
} else {
?>
<div class="value">
<?php echo $ticket['due_date']; ?>
<?php echo $due_date; ?>
</div>
<?php
}
@@ -1568,7 +1568,7 @@ function hesk_listAttachments($attachments='', $reply=0, $white=1)
/* List attachments */
$att=explode(',',substr($attachments, 0, -1));
echo '<div class="block--uploads" style="display: block; color: #9c9c9c;">';
echo '<div class="block--uploads" style="display: block;">';
foreach ($att as $myatt)
{
list($att_id, $att_name) = explode('#', $myatt);
@@ -2133,15 +2133,15 @@ function hesk_printReplyForm() {
});
$('#reset_btn').click(function() {
$('#pause_btn').find('svg').css('fill', '#002d73');
$('#pause_btn').find('svg').addClass('playing');
r();
});
function updatePauseButton() {
if (!timer_running()) {
$('#pause_btn').find('svg').css('fill', '#002d73');
$('#pause_btn').find('svg').addClass('playing');
} else {
$('#pause_btn').find('svg').css('fill', '#959eb0');
$('#pause_btn').find('svg').removeClass('playing');
}
}
@@ -2403,6 +2403,7 @@ function hesk_printCanned()
myMsg = myMsg.replace(/%%HESK_FIRST_NAME%%/g, '<?php echo hesk_jsString(hesk_full_name_to_first_name($ticket['name'])); ?>');
myMsg = myMsg.replace(/%%HESK_EMAIL%%/g, '<?php echo hesk_jsString($ticket['email']); ?>');
myMsg = myMsg.replace(/%%HESK_OWNER%%/g, '<?php echo hesk_jsString( isset($admins[$ticket['owner']]) ? $admins[$ticket['owner']] : ''); ?>');
myMsg = myMsg.replace(/%%HESK_DUE_DATE%%/g, '<?php echo hesk_jsString(hesk_format_due_date($ticket['due_date'])); ?>');
<?php
for ($i=1; $i<=50; $i++)

View File

@@ -155,8 +155,7 @@ if ($reached_status_limit && $action !== 'edit_status') {
</a>
<?php if ($status['tickets'] > 0): ?>
<a onclick="alert('<?php echo hesk_makeJsString($hesklang['status_not_empty']); ?>');"
style="cursor: not-allowed"
class="delete tooltip"
class="delete tooltip not-allowed"
title="<?php echo $hesklang['status_not_empty']; ?>">
<svg class="icon icon-delete">
<use xlink:href="<?php echo HESK_PATH; ?>img/sprite.svg#icon-delete"></use>

View File

@@ -124,6 +124,10 @@ if (isset($_POST['save']))
$tmpvar['message'] = convert_html_to_text($tmpvar['message_html']);
$tmpvar['message'] = fix_newlines($tmpvar['message']);
// Prepare plain message for storage as HTML
$tmpvar['message'] = hesk_htmlspecialchars($tmpvar['message']);
$tmpvar['message'] = nl2br($tmpvar['message']);
} else {
// `message` already contains a HTML friendly version. May as well just re-use it
$tmpvar['message'] = hesk_makeURL($tmpvar['message']);
@@ -202,8 +206,9 @@ if (isset($_POST['save']))
$tmpvar['message'] = convert_html_to_text($tmpvar['message_html']);
$tmpvar['message'] = fix_newlines($tmpvar['message']);
// Re-encode the message
// Prepare plain message for storage as HTML
$tmpvar['message'] = hesk_htmlspecialchars($tmpvar['message']);
$tmpvar['message'] = nl2br($tmpvar['message']);
} else {
// `message` already contains a HTML friendly version. May as well just re-use it
$tmpvar['message'] = hesk_makeURL($tmpvar['message']);

View File

@@ -121,10 +121,10 @@ if ($action != 'edit') {
<?php
if (!file_exists($eml_file)) {
$all_files = false;
echo '<span style="color:red">'.$hesklang['no_exists'].'</span>';
echo '<span class="text-danger">'.$hesklang['no_exists'].'</span>';
} elseif (!is_writable($eml_file)) {
$all_writable = false;
echo '<span style="color:red">'.$hesklang['not_writable'].'</span>';
echo '<span class="text-danger">'.$hesklang['not_writable'].'</span>';
} else {
?>
<a title="<?php echo $hesklang['edit']; ?>" href="email_templates.php?a=edit&amp;id=<?php echo $email; ?>&amp;edit_language=<?php echo urlencode($hesk_settings['edit_language']); ?>" class="edit tooltip">

View File

@@ -483,7 +483,7 @@ if (isset($success_msg))
?>
<div class="checkbox-custom">
<input type="checkbox" name="s_ot" id="s_ot" value="1" <?php if ($s_ot[1]) echo 'checked'; ?>>
<label for="reportCheck14"><?php echo $hesklang['s_ot']; ?></label>
<label for="s_ot"><?php echo $hesklang['s_ot']; ?></label>
</div>
<?php
}

View File

@@ -25,6 +25,7 @@ hesk_dbConnect();
hesk_isLoggedIn();
define('CALENDAR',1);
define('AUTO_RELOAD',1);
$_SESSION['hide']['ticket_list'] = true;
/* Check permissions for this feature */

View File

@@ -441,13 +441,12 @@ function show_message($actually_show = true)
if ($actually_show) {
?>
<div class="email__list_article"
style="background: #fff; margin-top: 24px; border-radius: 2px; box-shadow: 0 2px 8px 0 rgba(38,40,42,.1)">
<div class="email__list_article">
<div class="email__list_descr">
<div class="head">
<button type="button" class="btn btn-empty btn-hide-article">
<svg class="icon icon-back">
<use xlink:href="./img/sprite.svg#icon-back"></use>
<use xlink:href="<?php echo HESK_PATH; ?>img/sprite.svg#icon-back"></use>
</svg>
</button>
<div>
@@ -681,7 +680,7 @@ function show_new_form()
global $hesk_settings, $hesklang, $admins;
?>
<h2 style="margin-top: 20px"><?php echo $hesklang['new_mail']; ?></h2>
<div class="new-message" style="background: #fff; margin-top: 24px; border-radius: 2px; box-shadow: 0 2px 8px 0 rgba(38,40,42,.1)">
<div class="new-message">
<form action="mail.php" method="post" name="form2" class="form">
<div class="form-group">
<label for="email-create-destination"><?php echo $hesklang['m_to']; ?></label>

View File

@@ -60,35 +60,14 @@ if (confirm('<?php echo hesk_makeJsString($hesklang['delete_saved']); ?>')) {ret
else {return false;}
}
function hesk_insertTag(tag) {
function hesk_insertRichTag(tag) {
var text_to_insert = '%%'+tag+'%%';
var msg = '';
<?php if ($hesk_settings['staff_ticket_formatting'] == 2): ?>
msg = tinymce.get("canned_message").getContent();
tinymce.get("canned_message").setContent('');
tinymce.get("canned_message").execCommand('mceInsertRawHTML', false, msg + text_to_insert);
tinymce.get("canned_message").execCommand('mceInsertContent', false, text_to_insert);
<?php else: ?>
msg = document.getElementById('canned_message').value;
document.getElementById('canned_message').value = msg + text_to_insert;
hesk_insertAtCursor(document.getElementById('canned_message'), text_to_insert);
document.getElementById('canned_message').focus();
<?php endif; ?>
document.form1.msg.focus();
}
function hesk_insertAtCursor(myField, myValue) {
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
}
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}
}
//-->
</script>
@@ -275,28 +254,31 @@ $num = hesk_dbNumRows($result);
<div class="template--tags">
<label><?php echo $hesklang['insert_special']; ?></label>
<div class="tag-list">
<a href="javascript:" onclick="hesk_insertTag('HESK_ID')">
<a href="javascript:" onclick="hesk_insertRichTag('HESK_ID')">
<?php echo $hesklang['seqid']; ?>
</a>
<a href="javascript:" onclick="hesk_insertTag('HESK_TRACK_ID')">
<a href="javascript:" onclick="hesk_insertRichTag('HESK_TRACK_ID')">
<?php echo $hesklang['trackID']; ?>
</a>
<a href="javascript:" onclick="hesk_insertTag('HESK_NAME')">
<a href="javascript:" onclick="hesk_insertRichTag('HESK_NAME')">
<?php echo $hesklang['name']; ?>
</a>
<a href="javascript:" onclick="hesk_insertTag('HESK_FIRST_NAME')">
<a href="javascript:" onclick="hesk_insertRichTag('HESK_FIRST_NAME')">
<?php echo $hesklang['fname']; ?>
</a>
<a href="javascript:" onclick="hesk_insertTag('HESK_EMAIL')">
<a href="javascript:" onclick="hesk_insertRichTag('HESK_EMAIL')">
<?php echo $hesklang['email']; ?>
</a>
<a href="javascript:" onclick="hesk_insertTag('HESK_OWNER')">
<a href="javascript:" onclick="hesk_insertRichTag('HESK_OWNER')">
<?php echo $hesklang['owner']; ?>
</a>
<a href="javascript:" onclick="hesk_insertRichTag('HESK_DUE_DATE')">
<?php echo $hesklang['due_date']; ?>
</a>
<?php
foreach ($hesk_settings['custom_fields'] as $k=>$v) {
if ($v['use']) {
echo '<a href="javascript:" onclick="hesk_insertTag(\'HESK_'.$k.'\')">'.$v['name'].'</a>';
echo '<a href="javascript:" onclick="hesk_insertRichTag(\'HESK_'.$k.'\')">'.$v['name'].'</a>';
}
}
?>

View File

@@ -310,7 +310,7 @@ if (hesk_dbNumRows($res) > 0)
if ($hesk_settings['online']) {
if (isset($hesk_settings['users_online'][$myuser['id']])) {
$myuser['name'] = '
<svg class="icon icon-assign" style="fill: #000; margin-right: 10px;">
<svg class="icon icon-assign is-online">
<use xlink:href="' . HESK_PATH . 'img/sprite.svg#icon-assign"></use>
</svg>' .
$myuser['name'];
@@ -318,7 +318,7 @@ if (hesk_dbNumRows($res) > 0)
else
{
$myuser['name'] = '
<svg class="icon icon-assign-no" style="fill: #C5CAD4; margin-right: 10px;">
<svg class="icon icon-assign-no is-offline">
<use xlink:href="' . HESK_PATH . 'img/sprite.svg#icon-assign-no"></use>
</svg>' .
$myuser['name'];

View File

@@ -38,6 +38,25 @@ if ($hesk_settings['staff_ticket_formatting'] == 2) {
}
// Pre-populate fields
// First, reset data if any query string value is present
if (isset($_REQUEST['name']) ||
isset($_REQUEST['email']) ||
isset($_REQUEST['priority']) ||
isset($_REQUEST['subject']) ||
isset($_REQUEST['message']) ||
isset($_REQUEST['due_date']) ||
isset($_REQUEST['ticket_language'])
) {
hesk_new_ticket_reset_data();
}
foreach ($hesk_settings['custom_fields'] as $k=>$v) {
if ($v['use'] && isset($_REQUEST[$k])) {
hesk_new_ticket_reset_data();
}
}
// Customer name
if (isset($_REQUEST['name'])) {
$_SESSION['as_name'] = $_REQUEST['name'];
@@ -79,6 +98,16 @@ foreach ($hesk_settings['custom_fields'] as $k=>$v) {
}
}
// Due date
if (isset($_REQUEST['due_date']) && preg_match("/^[0-9]{2}\/[0-9]{2}\/[0-9]{4}$/", $_REQUEST['due_date'])) {
$_SESSION['as_due_date'] = $_REQUEST['due_date'];
}
// Ticket language
if (isset($_REQUEST['ticket_language'])) {
$_SESSION['as_language'] = $_REQUEST['ticket_language'];
}
/* Varibles for coloring the fields in case of errors */
if (!isset($_SESSION['iserror'])) {
$_SESSION['iserror'] = array();
@@ -980,17 +1009,16 @@ function print_select_category($number_of_categories)
hesk_process_messages($hesklang['sel_app_cat'],'NOREDIRECT','NOTICE');
}
/* This will handle error, success and notice messages */
hesk_handle_messages();
?>
<div class="main__content categories">
<div class="table-wrap">
<h3><?php echo $hesklang['select_category_staff']; ?></h3>
<div class="select_category">
<?php
// Print a select box if number of categories is large
if ($number_of_categories > $hesk_settings['cat_show_select']) {
?>
/* This will handle error, success and notice messages */
hesk_handle_messages();
?>
<div class="main__content categories">
<?php
// Print a select box if number of categories is large
if ($number_of_categories > $hesk_settings['cat_show_select']) {
?>
<div class="table-wrap">
<h2 class="select__title-alt"><?php echo $hesklang['select_category_staff']; ?></h2>
<form action="new_ticket.php" method="get" class="form">
<select class="form-control" name="category" id="select_category">
<?php
@@ -1011,59 +1039,33 @@ hesk_handle_messages();
$('#select_category').selectize();
});
</script>
<?php
}
// Otherwise print quick links
else
{
?>
<ul id="ul_category">
<?php
foreach ($hesk_settings['categories'] as $k=>$v)
{
echo '<li><a ripple="ripple" href="new_ticket.php?a=add&amp;category='.$k.'">'.$v['name'].'</a></li>';
}
?>
</ul>
<?php
}
</div>
<?php
}
// Otherwise print quick links
else
{
?>
</div>
<h2 class="select__title"><?php echo $hesklang['select_category_staff']; ?></h2>
<div class="nav">
<?php foreach ($hesk_settings['categories'] as $k => $v): ?>
<a href="new_ticket.php?a=add&amp;category=<?php echo $k; ?>" class="navlink <?php if ($number_of_categories > 8) echo "navlink-condensed"; ?>">
<div class="icon-in-circle">
<svg class="icon icon-chevron-right">
<use xlink:href="<?php echo HESK_PATH; ?>img/sprite.svg#icon-chevron-right"></use>
</svg>
</div>
<div>
<h5 class="navlink__title"><!--[if IE]> &raquo; <![endif]--><?php echo $v['name']; ?></h5>
</div>
</a>
<?php endforeach; ?>
</div>
<?php
}
?>
</div>
</div>
<style>
#ul_category {
list-style-type: none;
margin: 0;
padding: 0;
margin-top: 10px;
}
#ul_category li:first-child {
border-top: 1px solid #d1d5d7;
}
#ul_category li {
border: 1px solid #d1d5d7;
border-top: none;
border-radius: 2px;
}
#ul_category li:hover {
background: rgba(0,0,0,.05);
}
#ul_category li a {
display: block;
font-size: 14px;
padding: 0.75em 0.75em;
text-decoration: none;
transition: all 0.12s ease;
word-wrap: break-word;
}
</style>
<?php
<?php
hesk_cleanSessionVars('iserror');
hesk_cleanSessionVars('isnotice');
@@ -1072,3 +1074,34 @@ hesk_handle_messages();
require_once(HESK_PATH . 'inc/footer.inc.php');
exit();
} // END print_select_category()
function hesk_new_ticket_reset_data()
{
global $hesk_settings;
// Already reset
if (isset($hesk_settings['POPULATE_DATA_RESET'])) {
return true;
}
hesk_cleanSessionVars('as_name');
hesk_cleanSessionVars('as_email');
hesk_cleanSessionVars('as_category');
hesk_cleanSessionVars('as_priority');
hesk_cleanSessionVars('as_subject');
hesk_cleanSessionVars('as_message');
hesk_cleanSessionVars('as_owner');
hesk_cleanSessionVars('as_notify');
hesk_cleanSessionVars('as_show');
hesk_cleanSessionVars('as_due_date');
hesk_cleanSessionVars('as_language');
foreach ($hesk_settings['custom_fields'] as $k=>$v) {
hesk_cleanSessionVars("as_$k");
}
$hesk_settings['POPULATE_DATA_RESET'] = true;
return true;
} // END hesk_new_ticket_reset_data()