🚀 HESK v3.1.2

Signed-off-by: Luke Tainton <luke@tainton.uk>
This commit is contained in:
Luke Tainton
2020-08-25 17:24:00 +01:00
parent 77512a09b4
commit 107839166a
171 changed files with 978 additions and 685 deletions

View File

@@ -71,6 +71,9 @@ $message = hesk_input(hesk_POST('message'));
// Submit as customer?
$submit_as_customer = isset($_POST['submit_as_customer']) ? true : false;
// Load statuses
require_once(HESK_PATH . 'inc/statuses.inc.php');
if (strlen($message))
{
// Save message for later and ignore the rest?
@@ -227,45 +230,6 @@ if ($ticket['locked'])
{
$new_status = 3;
}
// -> Submit as: Resolved
elseif ( isset($_POST['submit_as_resolved']) && hesk_checkPermission('can_resolve', 0) )
{
$new_status = 3;
if ($ticket['status'] != $new_status)
{
$revision = sprintf($hesklang['thist3'],hesk_date(),$_SESSION['name'].' ('.$_SESSION['user'].')');
$sql_status = " , `closedat`=NOW(), `closedby`=".intval($_SESSION['id']).", `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') ";
// Lock the ticket if customers are not allowed to reopen tickets
if ($hesk_settings['custopen'] != 1)
{
$sql_status .= " , `locked`='1' ";
}
}
}
// -> Submit as: In Progress
elseif ( isset($_POST['submit_as_in_progress']) )
{
$new_status = 4;
if ($ticket['status'] != $new_status)
{
$revision = sprintf($hesklang['thist9'],hesk_date(),$hesklang['in_progress'],$_SESSION['name'].' ('.$_SESSION['user'].')');
$sql_status = " , `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') ";
}
}
// -> Submit as: On Hold
elseif ( isset($_POST['submit_as_on_hold']) )
{
$new_status = 5;
if ($ticket['status'] != $new_status)
{
$revision = sprintf($hesklang['thist9'],hesk_date(),$hesklang['on_hold'],$_SESSION['name'].' ('.$_SESSION['user'].')');
$sql_status = " , `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') ";
}
}
// -> Submit as Customer reply
elseif ($submit_as_customer)
{
@@ -277,10 +241,53 @@ elseif ($submit_as_customer)
$sql_status = " , `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') ";
}
}
// -> Default: submit as "Replied by staff"
// -> Submitted with a status change?
else
{
$new_status = 2;
$submit_as_status = false;
foreach ($hesk_settings['statuses'] as $id => $data)
{
if ( ! isset($_POST['submit_as-' . $id]))
{
continue;
}
// "Resolved" status needs special care
if ($id == 3)
{
// Permission to resolve?
if ( ! hesk_checkPermission('can_resolve', 0))
{
break;
}
// Lock the ticket if customers are not allowed to reopen tickets
if ($hesk_settings['custopen'] != 1)
{
$sql_status .= " , `locked`='1' ";
}
}
// Set the new status and log revision if modified
$new_status = $id;
if ($ticket['status'] != $new_status && $new_status != 2)
{
$revision = sprintf($hesklang['thist9'],hesk_date(),$data['name'],$_SESSION['name'].' ('.$_SESSION['user'].')');
$sql_status .= " , `history`=CONCAT(`history`,'".hesk_dbEscape($revision)."') ";
}
$submit_as_status = true;
break;
}
// Default: submit as "Replied by staff"
if ( ! $submit_as_status)
{
$new_status = 2;
}
}
$sql = "UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `status`='{$new_status}',";

View File

@@ -611,23 +611,11 @@ $options = array(
?>
<div class="main__content ticket">
<div class="ticket__body" <?php echo ($hesk_settings['limit_width'] ? 'style="max-width:'.$hesk_settings['limit_width'].'px"' : ''); ?>>
<?php
/* Reply form on top? */
if ($can_reply && $hesk_settings['reply_top'] == 1)
{
hesk_printReplyForm();
}
if ($hesk_settings['new_top'])
{
$i = hesk_printTicketReplies() ? 0 : 1;
}
else
{
$i = 1;
}
?>
<article class="ticket__body_block original-message">
<?php if ($hesk_settings['new_top'] && $ticket['replies']): ?>
<!-- START new replies on top subject line -->
<article class="ticket__body_block original-message" style="padding-bottom: 0px; margin-bottom: 16px; min-height: 48px; border-radius: 2px; box-shadow: 0 2px 8px 0 rgba(38, 40, 42, 0.1);">
<div style="display:flex; justify-content: space-between; flex-wrap: wrap;">
<h3>
<?php if ($ticket['archive']): ?>
<div class="tooltype right out-close">
@@ -657,6 +645,181 @@ $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;">
<use xlink:href="<?php echo HESK_PATH; ?>img/sprite.svg#icon-note"></use>
</svg>&nbsp;&nbsp;
<?php echo $hesklang['addnote']; ?>
</a>
</div>
</div>
<?php
$res = hesk_dbQuery("SELECT t1.*, t2.`name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."notes` AS t1 LEFT JOIN `".hesk_dbEscape($hesk_settings['db_pfix'])."users` AS t2 ON t1.`who` = t2.`id` WHERE `ticket`='".intval($ticket['id'])."' ORDER BY t1.`id` " . ($hesk_settings['new_top'] ? 'DESC' : 'ASC') );
?>
<div class="block--notes" <?php echo hesk_dbNumRows($res) ? 'style="padding-bottom: 15px"' : ''; ?>>
<?php
while ($note = hesk_dbFetchAssoc($res)) {
?>
<div class="note">
<div class="note__head">
<div class="name">
<?php echo $hesklang['noteby']; ?>
<b><?php echo ($note['name'] ? $note['name'] : $hesklang['e_udel']); ?></b>
&raquo;
<time class="timeago tooltip" datetime="<?php echo date("c", strtotime($note['dt'])) ; ?>" title="<?php echo hesk_date($note['dt'], true); ?>"><?php echo hesk_date($note['dt'], true); ?></time>
</div>
<?php
if ($can_del_notes || $note['who'] == $_SESSION['id'])
{
?>
<div class="actions">
<a class="tooltip" href="edit_note.php?track=<?php echo $trackingID; ?>&amp;Refresh=<?php echo mt_rand(10000,99999); ?>&amp;note=<?php echo $note['id']; ?>&amp;token=<?php hesk_token_echo(); ?>" title="<?php echo $hesklang['ednote']; ?>">
<svg class="icon icon-edit-ticket">
<use xlink:href="<?php echo HESK_PATH; ?>img/sprite.svg#icon-edit-ticket"></use>
</svg>
</a>
<a class="tooltip" href="admin_ticket.php?track=<?php echo $trackingID; ?>&amp;Refresh=<?php echo mt_rand(10000,99999); ?>&amp;delnote=<?php echo $note['id']; ?>&amp;token=<?php hesk_token_echo(); ?>" onclick="return hesk_confirmExecute('<?php echo hesk_makeJsString($hesklang['delnote']).'?'; ?>');" title="<?php echo $hesklang['delnote']; ?>">
<svg class="icon icon-delete">
<use xlink:href="<?php echo HESK_PATH; ?>img/sprite.svg#icon-delete"></use>
</svg>
</a>
</div>
<?php } ?>
</div>
<div class="note__description">
<p><?php echo $note['message']; ?></p>
</div>
<div class="note__attachments" style="color: #9c9c9c;">
<?php
// Attachments
if ( $hesk_settings['attachments']['use'] && strlen($note['attachments']) )
{
echo strlen($note['message']) ? '<br>' : '';
$att = explode(',', substr($note['attachments'], 0, -1) );
$num = count($att);
foreach ($att as $myatt)
{
list($att_id, $att_name) = explode('#', $myatt);
// Can edit and delete note (attachments)?
if ($can_del_notes || $note['who'] == $_SESSION['id'])
{
// If this is the last attachment and no message, show "delete ticket" link
if ($num == 1 && strlen($note['message']) == 0)
{
echo '<a class="tooltip" data-ztt_vertical_offset="0" style="margin-right: 8px;" href="admin_ticket.php?delnote='.$note['id'].'&amp;track='.$trackingID.'&amp;Refresh='.mt_rand(10000,99999).'&amp;token='.hesk_token_echo(0).'" onclick="return hesk_confirmExecute(\''.hesk_makeJsString($hesklang['pda']).'\');" title="'.$hesklang['dela'].'">
<svg class="icon icon-delete" style="text-decoration: none; vertical-align: text-bottom;">
<use xlink:href="'. HESK_PATH .'img/sprite.svg#icon-delete"></use>
</svg>
</a> &raquo;';
}
// Show "delete attachment" link
else
{
echo '<a class="tooltip" data-ztt_vertical_offset="0" style="margin-right: 8px;" href="admin_ticket.php?delatt='.$att_id.'&amp;note='.$note['id'].'&amp;track='.$trackingID.'&amp;Refresh='.mt_rand(10000,99999).'&amp;token='.hesk_token_echo(0).'" onclick="return hesk_confirmExecute(\''.hesk_makeJsString($hesklang['pda']).'\');" title="'.$hesklang['dela'].'">
<svg class="icon icon-delete" style="vertical-align: text-bottom;">
<use xlink:href="'. HESK_PATH .'img/sprite.svg#icon-delete"></use>
</svg>
</a> &raquo;';
}
}
echo '
<a href="../download_attachment.php?att_id='.$att_id.'&amp;track='.$trackingID.'" title="'.$hesklang['dnl'].' '.$att_name.'">
<svg class="icon icon-attach" style="vertical-align: text-bottom;">
<use xlink:href="'. HESK_PATH .'img/sprite.svg#icon-attach"></use>
</svg>
</a>
<a class="underline" href="../download_attachment.php?att_id='.$att_id.'&amp;track='.$trackingID.'" title="'.$hesklang['dnl'].' '.$att_name.'">'.$att_name.'</a><br>
';
}
}
?>
</div>
</div>
<?php
}
?>
<div id="notesformTop" style="display:<?php echo isset($_SESSION['note_message']) ? 'block' : 'none'; ?>; margin-top: 20px; padding-bottom: 15px;">
<form method="post" action="admin_ticket.php" class="form" enctype="multipart/form-data">
<i><?php echo $hesklang['nhid']; ?></i><br>
<textarea class="form-control" name="notemsg" rows="6" cols="60" style="height: auto; resize: vertical; transition: none;"><?php echo isset($_SESSION['note_message']) ? stripslashes(hesk_input($_SESSION['note_message'])) : ''; ?></textarea>
<?php
// attachments
if ($hesk_settings['attachments']['use'])
{
echo '<br>';
for ($i=1;$i<=$hesk_settings['attachments']['max_number'];$i++)
{
echo '<input type="file" name="attachment['.$i.']" size="50"><br>';
}
echo '<br>';
}
?>
<button type="submit" class="btn btn-full">
<?php echo $hesklang['s']; ?>
</button>
<input type="hidden" name="track" value="<?php echo $trackingID; ?>">
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
</form>
</div>
</div>
</article>
<!-- END new replies on top subject line -->
<?php endif; ?>
<?php
/* Reply form on top? */
if ($can_reply && $hesk_settings['reply_top'] == 1)
{
hesk_printReplyForm();
}
if ($hesk_settings['new_top'])
{
$i = hesk_printTicketReplies() ? 0 : 1;
}
else
{
$i = 1;
}
?>
<article class="ticket__body_block original-message">
<?php if ( ! $hesk_settings['new_top'] || ($hesk_settings['new_top'] && ! $ticket['replies'])): ?>
<h3>
<?php if ($ticket['archive']): ?>
<div class="tooltype right out-close">
<svg class="icon icon-tag">
<use xlink:href="<?php echo HESK_PATH; ?>img/sprite.svg#icon-tag"></use>
</svg>
<div class="tooltype__content">
<div class="tooltype__wrapper">
<?php echo $hesklang['archived']; ?>
</div>
</div>
</div>
<?php
endif;
if ($ticket['locked']):
?>
<div class="tooltype right out-close">
<svg class="icon icon-lock">
<use xlink:href="<?php echo HESK_PATH; ?>img/sprite.svg#icon-lock"></use>
</svg>
<div class="tooltype__content">
<div class="tooltype__wrapper">
<?php echo $hesklang['loc'].' - '.$hesklang['isloc']; ?>
</div>
</div>
</div>
<?php endif; ?>
<?php echo $ticket['subject']; ?>
</h3>
<?php endif; ?>
<div class="block--head">
<div class="contact">
<span><?php echo $hesklang['contact']; ?>:</span>
@@ -931,8 +1094,15 @@ $options = array(
<?php
}
?>
<button class="btn btn--blue-border" type="button" onclick="hesk_toggleLayerDisplay('notesform')">
<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']; ?>
</button>
<div id="notesform" style="display:<?php echo isset($_SESSION['note_message']) ? 'block' : 'none'; ?>; margin-top: 20px">
<form method="post" action="admin_ticket.php" class="form" enctype="multipart/form-data">
<i><?php echo $hesklang['nhid']; ?></i><br>
<textarea class="form-control" name="notemsg" rows="6" cols="60" style="height: auto; resize: vertical; transition: none;"><?php echo isset($_SESSION['note_message']) ? stripslashes(hesk_input($_SESSION['note_message'])) : ''; ?></textarea>
<?php
// attachments
@@ -950,16 +1120,10 @@ $options = array(
<?php echo $hesklang['s']; ?>
</button>
<input type="hidden" name="track" value="<?php echo $trackingID; ?>">
<i><?php echo $hesklang['nhid']; ?></i>
&nbsp;
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
</form>
</div>
<button class="btn btn--blue-border" type="button" onclick="hesk_toggleLayerDisplay('notesform')">
<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']; ?>
</button>
</div>
</article>
<?php
@@ -1414,7 +1578,7 @@ function hesk_getAdminButtons($isReply=0,$white=1)
// Resend email notification button
$buttons['more'][] = '
<a id="resendemail" href="resend_notification.php?track='.$trackingID.'&amp;reply='.(isset($reply['id']) ? intval($reply['id']) : 0).'&amp;Refresh='.mt_rand(10000,99999).'&amp;token='.hesk_token_echo(0).'" title="'.$hesklang['btn_resend'].'">
<a id="resendemail" href="resend_notification.php?track='.$trackingID.'&amp;reply='.($isReply && isset($reply['id']) ? intval($reply['id']) : 0).'&amp;Refresh='.mt_rand(10000,99999).'&amp;token='.hesk_token_echo(0).'" title="'.$hesklang['btn_resend'].'">
<svg class="icon icon-mail-small">
<use xlink:href="'. HESK_PATH .'img/sprite.svg#icon-mail-small"></use>
</svg>
@@ -2021,15 +2185,28 @@ function hesk_printReplyForm() {
if ( ! $ticket['locked']) {
?>
<input type="hidden" id="submit_as_name" value="1" name="">
<div class="submit-us dropdown-select out-close" data-value="">
<div class="submit-us dropdown-select out-close" data-value="" id="submit-as-div">
<select onchange="document.getElementById('submit_as_name').name = this.value;this.form.submit()">
<option value="" selected><?php echo rtrim($hesklang['submit_as'], ':'); ?></option>
<option value="submit_as_customer"><?php echo $hesklang['sasc']; ?></option>
<?php if ($can_resolve): ?>
<option value="submit_as_resolved"><?php echo $hesklang['closed']; ?></option>
<?php endif; ?>
<option value="submit_as_in_progress"><?php echo $hesklang['in_progress']; ?></option>
<option value="submit_as_on_hold"><?php echo $hesklang['on_hold']; ?></option>
<?php
$echo_options = '';
foreach ($hesk_settings['statuses'] as $k => $v)
{
if ($k == 3)
{
if ($can_resolve)
{
echo '<option value="submit_as-'.$k.'">'.$hesklang['submit_as'].' '.$v['name'].'</option>';
}
}
else
{
$echo_options .= '<option value="submit_as-'.$k.'">'.$hesklang['submit_as'].' '.$v['name'].'</option>';
}
}
echo $echo_options;
?>
</select>
</div>
<?php

View File

@@ -66,7 +66,7 @@ hesk_handle_messages();
<form action="banned_emails.php" method="post" name="form1">
<div class="tools__add-mail form">
<div class="form-group">
<input type="text" name="email" class="form-control" maxlength="255" placeholder="<?php echo htmlspecialchars($hesklang['bananemail']); ?>">
<input type="text" name="email" class="form-control" maxlength="255" placeholder="<?php echo htmlspecialchars($hesklang['bananemail']); ?>" autofocus>
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>" />
<input type="hidden" name="a" value="ban" />
<button type="submit" class="btn btn--blue-border" ripple="ripple"><?php echo $hesklang['savebanemail']; ?></button>

View File

@@ -66,7 +66,7 @@ hesk_handle_messages();
<form action="banned_ips.php" method="post" name="form1">
<div class="tools__add-mail form">
<div class="form-group">
<input type="text" name="ip" maxlength="255" placeholder="<?php echo $hesklang['bananip']; ?>" class="form-control">
<input type="text" name="ip" maxlength="255" placeholder="<?php echo $hesklang['bananip']; ?>" class="form-control" autofocus>
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>" />
<input type="hidden" name="a" value="ban" />
<button type="submit" class="btn btn--blue-border" ripple="ripple"><?php echo $hesklang['savebanip']; ?></button>

View File

@@ -942,7 +942,7 @@ function remove_cf()
hesk_purge_cache('cf');
// Delete custom field data from tickets
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `custom{$id}`=''");
hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `custom{$id}`='', `lastchange`=`lastchange` WHERE `custom{$id}`!=''");
// Show success message
hesk_process_messages($hesklang['cf_deleted'],'./custom_fields.php','SUCCESS');

View File

@@ -446,19 +446,19 @@ if (isset($success_msg))
<h3><?php echo $hesklang['priority']; ?></h3>
<div class="checkbox-custom">
<input type="checkbox" name="p0" id="p0" value="1" <?php if (isset($priority[0])) {echo 'checked';} ?>>
<label for="p0"><?php echo $hesklang['critical']; ?></label>
<label for="p0"><span class="priority0"><?php echo $hesklang['critical']; ?></span></label>
</div>
<div class="checkbox-custom">
<input type="checkbox" name="p1" id="p1" value="1" <?php if (isset($priority[1])) {echo 'checked';} ?>>
<label for="p1"><?php echo $hesklang['high']; ?></label>
<label for="p1"><span class="priority1"><?php echo $hesklang['high']; ?></span></label>
</div>
<div class="checkbox-custom">
<input type="checkbox" name="p2" id="p2" value="1" <?php if (isset($priority[2])) {echo 'checked';} ?>>
<label for="p2"><?php echo $hesklang['medium']; ?></label>
<label for="p2"><span class="priority2"><?php echo $hesklang['medium']; ?></span></label>
</div>
<div class="checkbox-custom">
<input type="checkbox" name="p3" id="p3" value="1" <?php if (isset($priority[3])) {echo 'checked';} ?>>
<label for="p3"><?php echo $hesklang['low']; ?></label>
<label for="p3"><span class="priority3"><?php echo $hesklang['low']; ?></span></label>
</div>
</section>
<section class="reports__checkbox">

View File

@@ -670,7 +670,7 @@ EOC;
} // END if total > 0
else
{
echo '<i>' . $hesklang['npm'] . '</i> <p>&nbsp;</p>';
hesk_show_info($hesklang['npm']);
}
} // END mail_list_messages()

View File

@@ -379,6 +379,7 @@ if (!hesk_SESSION('error')) {
<input type="text"
name="name"
class="form-control"
id="add_cat_name"
<?php if (isset($_SESSION['catname'])): ?>value="<?php echo $_SESSION['catname']; ?>"<?php endif; ?>>
</div>
<?php
@@ -388,7 +389,7 @@ if (!hesk_SESSION('error')) {
?>
<div class="category-create__select">
<span><?php echo $hesklang['def_pri']; ?></span>
<div class="dropdown-select center out-close">
<div class="dropdown-select center out-close priority">
<select name="priority">
<?php foreach ($priorities as $id => $priority): ?>
<option value="<?php echo $priority['value']; ?>" <?php if ($_SESSION['cat_priority'] == $id): ?>selected<?php endif; ?>>

View File

@@ -505,6 +505,7 @@ if (!isset($_SESSION['hide']['new_article']))
<input type="hidden" name="a" value="new_article">
<input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
</form>
<script>$('#add_subject').focus();</script>
</div>
<?php
} // END hide article
@@ -568,6 +569,7 @@ if (!isset($_SESSION['hide']['new_category']))
echo '</div>';
}
?>
<script>$('#add_cat_title').focus();</script>
</div>
<?php
} // END hide new category form

View File

@@ -84,26 +84,6 @@ if (!isset($_SESSION['isnotice'])) {
$_SESSION['isnotice'] = array();
}
/* List of users */
$admins = array();
$result = hesk_dbQuery("SELECT `id`,`name`,`isadmin`,`categories`,`heskprivileges` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` ORDER BY `name` ASC");
while ($row=hesk_dbFetchAssoc($result))
{
/* Is this an administrator? */
if ($row['isadmin'])
{
$admins[$row['id']]=$row['name'];
continue;
}
/* Not admin, is user allowed to view tickets? */
if (strpos($row['heskprivileges'], 'can_view_tickets') !== false)
{
$admins[$row['id']]=$row['name'];
continue;
}
}
/* Print header */
require_once(HESK_PATH . 'inc/header.inc.php');
@@ -115,16 +95,16 @@ $hesk_settings['categories'] = array();
if (hesk_checkPermission('can_submit_any_cat', 0))
{
$res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `cat_order` ASC");
$res = hesk_dbQuery("SELECT `id`, `name`, `priority` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `cat_order` ASC");
}
else
{
$res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE ".hesk_myCategories('id')." ORDER BY `cat_order` ASC");
$res = hesk_dbQuery("SELECT `id`, `name`, `priority` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE ".hesk_myCategories('id')." ORDER BY `cat_order` ASC");
}
while ($row=hesk_dbFetchAssoc($res))
{
$hesk_settings['categories'][$row['id']] = $row['name'];
$hesk_settings['categories'][$row['id']] = array('name' => $row['name'], 'priority' => $row['priority']);
}
$number_of_categories = count($hesk_settings['categories']);
@@ -147,6 +127,38 @@ else
return print_select_category($number_of_categories);
}
}
// List of users whom this ticket can be assigned to
$admins = array();
$res = hesk_dbQuery("SELECT `id`,`name`,`isadmin`,`categories`,`heskprivileges` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."users` ORDER BY `name` ASC");
while ($row = hesk_dbFetchAssoc($res))
{
// Is this an administrator?
if ($row['isadmin'])
{
$admins[$row['id']]=$row['name'];
continue;
}
// Not admin, is user allowed to view tickets?
if (strpos($row['heskprivileges'], 'can_view_tickets') !== false)
{
// Is user allowed to access this category?
$cat = substr($row['categories'], 0);
$row['categories'] = explode(',', $cat);
if (in_array($category, $row['categories']))
{
$admins[$row['id']] = $row['name'];
continue;
}
}
}
// Set the default category priority
if ( ! isset($_SESSION['as_priority']))
{
$_SESSION['as_priority'] = intval($hesk_settings['categories'][$category]['priority']);
}
?>
<div class="main__content categories ticket-create">
<div class="table-wrap">
@@ -184,7 +196,7 @@ else
<div id="email_suggestions"></div>
<div class="form-group">
<label><?php echo $hesklang['priority']; ?>: <span class="important">*</span></label>
<div class="dropdown-select center out-close">
<div class="dropdown-select center out-close priority">
<select name="priority" <?php if (in_array('priority',$_SESSION['iserror'])) {echo ' class="isError" ';} ?> >
<?php
// Show the "Click to select"?
@@ -904,7 +916,7 @@ hesk_handle_messages();
}
foreach ($hesk_settings['categories'] as $k=>$v)
{
echo '<option value="'.$k.'">'.$v.'</option>';
echo '<option value="'.$k.'">'.$v['name'].'</option>';
}
?>
</select>
@@ -925,7 +937,7 @@ hesk_handle_messages();
<?php
foreach ($hesk_settings['categories'] as $k=>$v)
{
echo '<li><a ripple="ripple" href="new_ticket.php?a=add&amp;category='.$k.'">'.$v.'</a></li>';
echo '<li><a ripple="ripple" href="new_ticket.php?a=add&amp;category='.$k.'">'.$v['name'].'</a></li>';
}
?>
</ul>
@@ -971,6 +983,7 @@ hesk_handle_messages();
hesk_cleanSessionVars('iserror');
hesk_cleanSessionVars('isnotice');
hesk_cleanSessionVars('as_priority');
require_once(HESK_PATH . 'inc/footer.inc.php');
exit();

View File

@@ -367,7 +367,7 @@ if ($hesk_settings['kb_wysiwyg'])
<select name="language">
<option value=""><?php echo $hesklang['all']; ?></option>
<?php foreach ($hesk_settings['languages'] as $lang => $v): ?>
<option <?php echo (isset($_SESSION['new_sm']['language']) && $_SESSION['new_sm']['language'] == $lang ? 'selected="selected"' : ''); ?>>
<option value="<?php echo hesk_htmlspecialchars($lang); ?>" <?php echo (isset($_SESSION['new_sm']['language']) && $_SESSION['new_sm']['language'] == $lang ? 'selected="selected"' : ''); ?>>
<?php echo $lang; ?>
</option>
<?php endforeach; ?>
@@ -429,6 +429,11 @@ function save_sm()
}
$type = empty($_POST['type']) ? 0 : 1;
$language = hesk_input( hesk_POST('language') );
if ( ! isset($hesk_settings['languages'][$language]))
{
$language = '';
}
$title = hesk_input( hesk_POST('title') ) or $hesk_error_buffer[] = $hesklang['sm_e_title'];
$message = hesk_getHTML( hesk_POST('message') );
@@ -446,6 +451,7 @@ function save_sm()
'id' => $id,
'style' => $style,
'type' => $type,
'language' => $language,
'title' => $title,
'message' => hesk_input( hesk_POST('message') ),
'errors' => array('title')
@@ -472,6 +478,7 @@ function save_sm()
'id' => $id,
'style' => $style,
'type' => $type,
'language' => $language,
'title' => $title,
'message' => $message
);
@@ -485,6 +492,7 @@ function save_sm()
`author` = '".intval($_SESSION['id'])."',
`title` = '".hesk_dbEscape($title)."',
`message` = '".hesk_dbEscape($message)."',
`language` = ".(strlen($language) ? "'".hesk_dbEscape($language)."'" : 'NULL').",
`style` = '{$style}',
`type` = '{$type}'
WHERE `id`={$id}");