本文整理汇总了PHP中hesk_dbFetchAssoc函数的典型用法代码示例。如果您正苦于以下问题:PHP hesk_dbFetchAssoc函数的具体用法?PHP hesk_dbFetchAssoc怎么用?PHP hesk_dbFetchAssoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hesk_dbFetchAssoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hesk_processMessage
function hesk_processMessage($msg, $ticket, $is_admin, $is_ticket, $just_message, $isForHtml = 0)
{
global $hesk_settings, $hesklang, $modsForHesk_settings;
/* Return just the message without any processing? */
if ($just_message) {
return $msg;
}
// Convert any entities in site title to plain text
$hesk_settings['site_title'] = hesk_msgToPlain($hesk_settings['site_title'], 1);
/* If it's not a ticket-related mail (like "a new PM") just process quickly */
if (!$is_ticket) {
$trackingURL = $hesk_settings['hesk_url'] . '/' . $hesk_settings['admin_dir'] . '/mail.php?a=read&id=' . intval($ticket['id']);
$msg = str_replace('%%NAME%%', $ticket['name'], $msg);
$msg = str_replace('%%SUBJECT%%', $ticket['subject'], $msg);
$msg = str_replace('%%TRACK_URL%%', $trackingURL, $msg);
$msg = str_replace('%%SITE_TITLE%%', $hesk_settings['site_title'], $msg);
$msg = str_replace('%%SITE_URL%%', $hesk_settings['site_url'], $msg);
if (isset($ticket['message'])) {
if ($isForHtml) {
$htmlMessage = nl2br($ticket['message']);
return str_replace('%%MESSAGE%%', $htmlMessage, $msg);
}
return str_replace('%%MESSAGE%%', $ticket['message'], $msg);
} else {
return $msg;
}
}
// Is email required to view ticket (for customers only)?
$hesk_settings['e_param'] = $hesk_settings['email_view_ticket'] ? '&e=' . rawurlencode($ticket['email']) : '';
/* Generate the ticket URLs */
$trackingURL = $hesk_settings['hesk_url'];
$trackingURL .= $is_admin ? '/' . $hesk_settings['admin_dir'] . '/admin_ticket.php' : '/ticket.php';
$trackingURL .= '?track=' . $ticket['trackid'] . ($is_admin ? '' : $hesk_settings['e_param']) . '&Refresh=' . rand(10000, 99999);
/* Set category title */
$ticket['category'] = hesk_msgToPlain(hesk_getCategoryName($ticket['category']), 1);
/* Set priority title */
switch ($ticket['priority']) {
case 0:
$ticket['priority'] = $hesklang['critical'];
break;
case 1:
$ticket['priority'] = $hesklang['high'];
break;
case 2:
$ticket['priority'] = $hesklang['medium'];
break;
default:
$ticket['priority'] = $hesklang['low'];
}
/* Get owner name */
$ticket['owner'] = hesk_msgToPlain(hesk_getOwnerName($ticket['owner']), 1);
/* Set status */
$statusRs = hesk_dbQuery("SELECT `Key` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` WHERE `ID` = " . $ticket['status']);
$row = hesk_dbFetchAssoc($statusRs);
$ticket['status'] = $hesklang[$row['Key']];
/* Replace all special tags */
$msg = str_replace('%%NAME%%', $ticket['name'], $msg);
$msg = str_replace('%%SUBJECT%%', $ticket['subject'], $msg);
$msg = str_replace('%%TRACK_ID%%', $ticket['trackid'], $msg);
$msg = str_replace('%%TRACK_URL%%', $trackingURL, $msg);
$msg = str_replace('%%SITE_TITLE%%', $hesk_settings['site_title'], $msg);
$msg = str_replace('%%SITE_URL%%', $hesk_settings['site_url'], $msg);
$msg = str_replace('%%CATEGORY%%', $ticket['category'], $msg);
$msg = str_replace('%%PRIORITY%%', $ticket['priority'], $msg);
$msg = str_replace('%%OWNER%%', $ticket['owner'], $msg);
$msg = str_replace('%%STATUS%%', $ticket['status'], $msg);
$msg = str_replace('%%EMAIL%%', $ticket['email'], $msg);
$msg = str_replace('%%CREATED%%', $ticket['dt'], $msg);
$msg = str_replace('%%UPDATED%%', $ticket['lastchange'], $msg);
$msg = str_replace('%%ID%%', $ticket['id'], $msg);
/* All custom fields */
foreach ($hesk_settings['custom_fields'] as $k => $v) {
if ($v['use']) {
if ($v['type'] == 'checkbox') {
$ticket[$k] = str_replace("<br />", "\n", $ticket[$k]);
}
$msg = str_replace('%%' . strtoupper($k) . '%%', stripslashes($ticket[$k]), $msg);
} else {
$msg = str_replace('%%' . strtoupper($k) . '%%', '', $msg);
}
}
// Is message tag in email template?
if (strpos($msg, '%%MESSAGE%%') !== false) {
// Replace message
if ($isForHtml) {
$htmlMessage = nl2br($ticket['message']);
$msg = str_replace('%%MESSAGE%%', $htmlMessage, $msg);
} else {
$msg = str_replace('%%MESSAGE%%', $ticket['message'], $msg);
}
// Add direct links to any attachments at the bottom of the email message OR add them as attachments, depending on the settings
// if ($modsForHesk_settings['attachments'] == 'inline' (other is 'attachment') {...}
if ($hesk_settings['attachments']['use'] && isset($ticket['attachments']) && strlen($ticket['attachments'])) {
if (!$modsForHesk_settings['attachments']) {
if ($isForHtml) {
$msg .= "<br><br><br>" . $hesklang['fatt'];
} else {
$msg .= "\n\n\n" . $hesklang['fatt'];
}
$att = explode(',', substr($ticket['attachments'], 0, -1));
//.........这里部分代码省略.........
示例2: hesk_isLoggedIn
hesk_isLoggedIn();
/* Check permissions */
$can_view_tickets = hesk_checkPermission('can_view_tickets', 0);
$can_reply_tickets = hesk_checkPermission('can_reply_tickets', 0);
$can_view_unassigned = hesk_checkPermission('can_view_unassigned', 0);
/* Update profile? */
if (!empty($_POST['action'])) {
// Demo mode
if (defined('HESK_DEMO')) {
hesk_process_messages($hesklang['sdemo'], 'profile.php', 'NOTICE');
}
// Update profile
update_profile();
} else {
$res = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `id` = '" . intval($_SESSION['id']) . "' LIMIT 1");
$tmp = hesk_dbFetchAssoc($res);
foreach ($tmp as $k => $v) {
if ($k == 'pass') {
if ($v == '499d74967b28a841c98bb4baaabaad699ff3c079') {
define('WARN_PASSWORD', true);
}
continue;
} elseif ($k == 'categories') {
continue;
}
$_SESSION['new'][$k] = $v;
}
}
if (!isset($_SESSION['new']['username'])) {
$_SESSION['new']['username'] = '';
}
示例3: hesk_printCustomerTicketReplies
function hesk_printCustomerTicketReplies()
{
global $hesklang, $hesk_settings, $result, $reply, $trackingID, $unread_replies;
$i = $hesk_settings['new_top'] ? 0 : 1;
while ($reply = hesk_dbFetchAssoc($result)) {
if ($i) {
$color = 'class="ticketrow"';
$i = 0;
} else {
$color = 'class="ticketalt"';
$i = 1;
}
/* Store unread reply IDs for later */
if ($reply['staffid'] && !$reply['read']) {
$unread_replies[] = $reply['id'];
}
$reply['dt'] = hesk_date($reply['dt']);
?>
<tr>
<td <?php
echo $color;
?>
>
<table border="0" cellspacing="0" cellpadding="0" width="100%">
<tr>
<td valign="top">
<table border="0" cellspacing="1">
<tr>
<td><?php
echo $hesklang['date'];
?>
:</td>
<td><?php
echo $reply['dt'];
?>
</td>
</tr>
<tr>
<td><?php
echo $hesklang['name'];
?>
:</td>
<td><?php
echo $reply['name'];
?>
</td>
</tr>
</table>
</td>
<td style="text-align:right; vertical-align:top;">
<?php
echo hesk_getCustomerButtons($i);
?>
</td>
</tr>
</table>
<p><b><?php
echo $hesklang['message'];
?>
:</b></p>
<p><?php
echo $reply['message'];
?>
</p>
<?php
/* Attachments */
hesk_listAttachments($reply['attachments'], $i);
/* Staff rating */
if ($hesk_settings['rating'] && $reply['staffid']) {
if ($reply['rating'] == 1) {
echo '<p class="rate">' . $hesklang['rnh'] . '</p>';
} elseif ($reply['rating'] == 5) {
echo '<p class="rate">' . $hesklang['rh'] . '</p>';
} else {
echo '
<div id="rating' . $reply['id'] . '" class="rate">
' . $hesklang['r'] . '
<a href="Javascript:void(0)" onclick="Javascript:hesk_rate(\'rate.php?rating=5&id=' . $reply['id'] . '&track=' . $trackingID . '\',\'rating' . $reply['id'] . '\')">' . strtolower($hesklang['yes']) . '</a> /
<a href="Javascript:void(0)" onclick="Javascript:hesk_rate(\'rate.php?rating=1&id=' . $reply['id'] . '&track=' . $trackingID . '\',\'rating' . $reply['id'] . '\')">' . strtolower($hesklang['no']) . '</a>
</div>
';
}
}
?>
</td>
</tr>
<?php
}
return $i;
}
示例4: sprintf
} else {
$status = 1;
$tmp = $hesklang['tlock'];
$revision = sprintf($hesklang['thist5'], hesk_date(), $_SESSION['name'] . ' (' . $_SESSION['user'] . ')');
$closedby_sql = ' , `closedat`=NOW(), `closedby`=' . intval($_SESSION['id']) . ' ';
// Notify customer of closed ticket?
if ($hesk_settings['notify_closed']) {
// Get ticket info
$result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE `trackid`='" . hesk_dbEscape($trackingID) . "' LIMIT 1");
if (hesk_dbNumRows($result) != 1) {
hesk_error($hesklang['ticket_not_found']);
}
$ticket = hesk_dbFetchAssoc($result);
$closedStatusRS = hesk_dbQuery('SELECT `ID` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'statuses` WHERE `IsClosed` = 1');
$ticketIsOpen = true;
while ($row = hesk_dbFetchAssoc($closedStatusRS)) {
if ($ticket['status'] == $row['ID']) {
$ticketIsOpen = false;
}
}
// Notify customer, but only if ticket is not already closed
if ($ticketIsOpen) {
require HESK_PATH . 'inc/email_functions.inc.php';
$ticket['dt'] = hesk_date($ticket['dt'], true);
$ticket['lastchange'] = hesk_date($ticket['lastchange'], true);
hesk_notifyCustomer('ticket_closed');
}
}
}
/* Update database */
$statusSql = 'SELECT `ID` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'statuses` WHERE `LockedTicketStatus` = 1';
示例5: hesk_unhortenUrl
?>
:</td>
<td><?php
echo hesk_unhortenUrl($ticket[$k]);
?>
</td>
</tr>
<?php
}
}
// Close ticket head table
echo '</table>';
// Print initial ticket message
echo '<p>' . hesk_unhortenUrl($ticket['message']) . '</p>';
// Print replies
while ($reply = hesk_dbFetchAssoc($res)) {
$reply['dt'] = hesk_date($reply['dt'], true);
echo '
<hr />
<table border="0">
<tr>
<td>' . $hesklang['date'] . ':</td>
<td>' . $reply['dt'] . '</td>
</tr>
<tr>
<td>' . $hesklang['name'] . ':</td>
<td>' . $reply['name'] . '</td>
</tr>
</table>
示例6: hesk_error
hesk_error($hesklang['ticket_not_found']);
}
$ticket = hesk_dbFetchAssoc($result);
// Demo mode
if (defined('HESK_DEMO')) {
$ticket['email'] = 'hidden@demo.com';
}
/* Is this user allowed to view tickets inside this category? */
hesk_okCategory($ticket['category']);
if (hesk_isREQUEST('reply')) {
$tmpvar['id'] = intval(hesk_REQUEST('reply')) or die($hesklang['id_not_valid']);
$result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` WHERE `id`='{$tmpvar['id']}' AND `replyto`='" . intval($ticket['id']) . "' LIMIT 1");
if (hesk_dbNumRows($result) != 1) {
hesk_error($hesklang['id_not_valid']);
}
$reply = hesk_dbFetchAssoc($result);
$ticket['message'] = $reply['message'];
$is_reply = 1;
}
if (isset($_POST['save'])) {
/* A security check */
hesk_token_check('POST');
$hesk_error_buffer = array();
if ($is_reply) {
$tmpvar['message'] = hesk_input(hesk_POST('message')) or $hesk_error_buffer[] = $hesklang['enter_message'];
if (count($hesk_error_buffer)) {
$myerror = '<ul>';
foreach ($hesk_error_buffer as $error) {
$myerror .= "<li>{$error}</li>\n";
}
$myerror .= '</ul>';
示例7: forgot_tid
function forgot_tid()
{
global $hesk_settings, $hesklang;
require HESK_PATH . 'inc/email_functions.inc.php';
$email = hesk_validateEmail(hesk_POST('email'), 'ERR', 0) or hesk_process_messages($hesklang['enter_valid_email'], 'ticket.php?remind=1');
if (isset($_POST['open_only'])) {
$hesk_settings['open_only'] = $_POST['open_only'] == 1 ? 1 : 0;
}
/* Prepare ticket statuses */
$my_status = array(0 => $hesklang['open'], 1 => $hesklang['wait_staff_reply'], 2 => $hesklang['wait_cust_reply'], 3 => $hesklang['closed'], 4 => $hesklang['in_progress'], 5 => $hesklang['on_hold']);
/* Get ticket(s) from database */
hesk_load_database_functions();
hesk_dbConnect();
// Get tickets from the database
$res = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'tickets` FORCE KEY (`statuses`) WHERE ' . ($hesk_settings['open_only'] ? "`status` IN ('0','1','2','4','5') AND " : '') . ' ' . hesk_dbFormatEmail($email) . ' ORDER BY `status` ASC, `lastchange` DESC ');
$num = hesk_dbNumRows($res);
if ($num < 1) {
if ($hesk_settings['open_only']) {
hesk_process_messages($hesklang['noopen'], 'ticket.php?remind=1&e=' . $email);
} else {
hesk_process_messages($hesklang['tid_not_found'], 'ticket.php?remind=1&e=' . $email);
}
}
$tid_list = '';
$name = '';
$email_param = $hesk_settings['email_view_ticket'] ? '&e=' . rawurlencode($email) : '';
while ($my_ticket = hesk_dbFetchAssoc($res)) {
$name = $name ? $name : hesk_msgToPlain($my_ticket['name'], 1, 0);
$tid_list .= "\n{$hesklang['trackID']}: " . $my_ticket['trackid'] . "\n{$hesklang['subject']}: " . hesk_msgToPlain($my_ticket['subject'], 1, 0) . "\n{$hesklang['status']}: " . $my_status[$my_ticket['status']] . "\n{$hesk_settings['hesk_url']}/ticket.php?track={$my_ticket['trackid']}{$email_param}\n";
}
/* Get e-mail message for customer */
$msg = hesk_getEmailMessage('forgot_ticket_id', '', 0, 0, 1);
$msg = str_replace('%%NAME%%', $name, $msg);
$msg = str_replace('%%NUM%%', $num, $msg);
$msg = str_replace('%%LIST_TICKETS%%', $tid_list, $msg);
$msg = str_replace('%%SITE_TITLE%%', hesk_msgToPlain($hesk_settings['site_title'], 1), $msg);
$msg = str_replace('%%SITE_URL%%', $hesk_settings['site_url'], $msg);
$subject = hesk_getEmailSubject('forgot_ticket_id');
/* Send e-mail */
hesk_mail($email, $subject, $msg);
/* Show success message */
$tmp = '<b>' . $hesklang['tid_sent'] . '!</b>';
$tmp .= '<br /> <br />' . $hesklang['tid_sent2'] . '.';
$tmp .= '<br /> <br />' . $hesklang['check_spambox'];
hesk_process_messages($tmp, 'ticket.php?e=' . $email, 'SUCCESS');
exit;
}
示例8: hesk_dbQuery
$selected = $row['id'] == $category ? 'selected="selected"' : '';
$category_options .= '<option value="' . $row['id'] . '" ' . $selected . '>' . $row['name'] . '</option>';
}
} else {
$res2 = hesk_dbQuery('SELECT `id`, `name` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` WHERE ' . hesk_myCategories('id') . ' ORDER BY `cat_order` ASC');
while ($row = hesk_dbFetchAssoc($res2)) {
$row['name'] = strlen($row['name']) > 30 ? substr($row['name'], 0, 30) . '...' : $row['name'];
$selected = $row['id'] == $category ? 'selected="selected"' : '';
$category_options .= '<option value="' . $row['id'] . '" ' . $selected . '>' . $row['name'] . '</option>';
}
}
/* List of staff */
if ($can_view_ass_others && !isset($admins)) {
$admins = array();
$res2 = hesk_dbQuery("SELECT `id`,`name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` ORDER BY `name` ASC");
while ($row = hesk_dbFetchAssoc($res2)) {
$admins[$row['id']] = $row['name'];
}
}
$more = empty($_GET['more']) ? 0 : 1;
$more2 = empty($_GET['more2']) ? 0 : 1;
#echo "SQL: $sql";
?>
<!-- ** START SHOW TICKET FORM ** -->
<div class="panel panel-default">
<div class="panel-heading">
<h4><?php
echo $hesklang['show_tickets'];
?>
</h4>
示例9: hesk_ticketsByDay
function hesk_ticketsByDay()
{
global $hesk_settings, $hesklang, $date_from, $date_to, $can_run_reports_full;
$tickets = array();
$totals = array('all' => 0, 'resolved' => 0, 'worked' => 0);
$dt = DateArray($date_from, $date_to);
// Pre-populate date values
foreach ($dt as $day) {
$tickets[$day] = array('all' => 0, 'resolved' => 0, 'worked' => '');
}
// SQL query for all
$res = hesk_dbQuery("SELECT DATE(`dt`) AS `mydt`, COUNT(*) AS `cnt`" . ($hesk_settings['time_worked'] ? ", SUM( TIME_TO_SEC(`time_worked`) ) AS `seconds_worked`" : '') . " FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE " . ($can_run_reports_full ? '1' : "`owner` = '" . intval($_SESSION['id']) . "'") . " AND {$hesk_settings['dt_sql']} GROUP BY `mydt`");
// Update ticket values
while ($row = hesk_dbFetchAssoc($res)) {
if (!$hesk_settings['time_worked']) {
$row['seconds_worked'] = 0;
}
$tickets[$row['mydt']]['all'] += $row['cnt'];
$tickets[$row['mydt']]['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($row['seconds_worked']) : 0;
$totals['all'] += $row['cnt'];
$totals['worked'] += $row['seconds_worked'];
}
// SQL query for resolved
$res = hesk_dbQuery("SELECT DATE(`dt`) AS `mydt`, COUNT(*) AS `cnt` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE " . ($can_run_reports_full ? '1' : "`owner` = '" . intval($_SESSION['id']) . "'") . " AND `status`='3' AND {$hesk_settings['dt_sql']} GROUP BY `mydt`");
// Update ticket values
while ($row = hesk_dbFetchAssoc($res)) {
$tickets[$row['mydt']]['resolved'] += $row['cnt'];
$totals['resolved'] += $row['cnt'];
}
// Convert total seconds worked to HH:MM:SS
$totals['worked'] = $hesk_settings['time_worked'] ? hesk_SecondsToHHMMSS($totals['worked']) : 0;
?>
<table width="100%" cellpadding="5" style="text-align:justify;border-collapse:collapse;padding:10px;">
<tr style="border-bottom:1px solid #000000;">
<td><?php
echo $hesklang['date'];
?>
</td>
<td><?php
echo $hesklang['atik'];
?>
</td>
<td><?php
echo $hesklang['topen'];
?>
</td>
<td><?php
echo $hesklang['closed'];
?>
</td>
<?php
if ($hesk_settings['time_worked']) {
echo '<td>' . $hesklang['ts'] . '</td>';
}
?>
</tr>
<?php
$num_tickets = count($tickets);
if ($num_tickets > 10) {
?>
<tr style="border-bottom:1px solid #000000;">
<td><b><?php
echo $hesklang['totals'];
?>
</b></td>
<td><b><?php
echo $totals['all'];
?>
</b></td>
<td><b><?php
echo $totals['all'] - $totals['resolved'];
?>
</b></td>
<td><b><?php
echo $totals['resolved'];
?>
</b></td>
<?php
if ($hesk_settings['time_worked']) {
echo '<td><b>' . $totals['worked'] . '</b></td>';
}
?>
</tr>
<?php
}
$cls = '';
foreach ($tickets as $k => $d) {
$cls = $cls ? '' : 'style="background:#EEEEE8;"';
?>
<tr <?php
echo $cls;
?>
>
<td><?php
echo hesk_dateToString($k);
?>
</td>
<td><?php
echo $d['all'];
//.........这里部分代码省略.........
示例10: print_login
function print_login()
{
global $hesk_settings, $hesklang;
// Tell header to load reCaptcha API if needed
if ($hesk_settings['recaptcha_use'] == 2) {
define('RECAPTCHA', 1);
}
$hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['admin_login'];
require_once HESK_PATH . 'inc/header.inc.php';
if (hesk_isREQUEST('notice')) {
hesk_process_messages($hesklang['session_expired'], 'NOREDIRECT');
}
if (!isset($_SESSION['a_iserror'])) {
$_SESSION['a_iserror'] = array();
}
?>
<div class="loginError"><?php
/* This will handle error, success and notice messages */
hesk_handle_messages();
?>
</div>
<div>
<div class="panel panel-default form-signin">
<div class="panel-heading">
<h4><span <?php
echo $iconDisplay;
?>
><span class="mega-octicon octicon-sign-in"></span> </span><?php
echo $hesklang['admin_login'];
?>
</a></h4>
</div>
<div class="panel-body">
<form class="form-signin form-horizontal" role="form" action="index.php" method="post" name="form1">
<?php
if (in_array('pass', $_SESSION['a_iserror'])) {
echo '<div class="form-group has-error">';
} else {
echo '<div class="form-group">';
}
?>
<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="checked"';
} elseif (isset($_COOKIE['hesk_username']) || $remember_user == 'JUSTUSER') {
$is_2 = 'checked="checked"';
} else {
$is_3 = 'checked="checked"';
}
if ($hesk_settings['list_users']) {
echo '<select class="form-control" name="user">';
$res = hesk_dbQuery('SELECT `user` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'users` ORDER BY `user` ASC');
while ($row = hesk_dbFetchAssoc($res)) {
$sel = strtolower($savedUser) == strtolower($row['user']) ? 'selected="selected"' : '';
echo '<option value="' . $row['user'] . '" ' . $sel . '>' . $row['user'] . '</option>';
}
echo '</select>';
} else {
echo '<input class="form-control" type="text" name="user" size="35" placeholder="' . htmlspecialchars($hesklang['username']) . '" value="' . $savedUser . '" />';
}
?>
</div>
</div>
<?php
if (in_array('pass', $_SESSION['a_iserror'])) {
echo '<div class="form-group has-error">';
} else {
echo '<div class="form-group">';
}
?>
<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'];
//.........这里部分代码省略.........
示例11: hesk_email2ticket
function hesk_email2ticket($results, $pop3 = 0, $set_category = 1, $set_priority = -1)
{
global $hesk_settings, $hesklang, $hesk_db_link, $ticket;
// Process "Reply-To:" or "From:" email
$tmpvar['email'] = isset($results['reply-to'][0]['address']) ? hesk_validateEmail($results['reply-to'][0]['address'], 'ERR', 0) : hesk_validateEmail($results['from'][0]['address'], 'ERR', 0);
// Email missing, invalid or banned?
if (!$tmpvar['email'] || hesk_isBannedEmail($tmpvar['email'])) {
return hesk_cleanExit();
}
// Process "Reply-To:" or "From:" name, convert to UTF-8, set to "[Customer]" if not set
if (isset($results['reply-to'][0]['name']) && strlen($results['reply-to'][0]['name'])) {
$tmpvar['name'] = $results['reply-to'][0]['name'];
if (!empty($results['reply-to'][0]['encoding'])) {
$tmpvar['name'] = hesk_encodeUTF8($tmpvar['name'], $results['reply-to'][0]['encoding']);
}
} else {
$tmpvar['name'] = isset($results['from'][0]['name']) ? $results['from'][0]['name'] : $hesklang['pde'];
if (!empty($results['from'][0]['encoding'])) {
$tmpvar['name'] = hesk_encodeUTF8($tmpvar['name'], $results['from'][0]['encoding']);
}
}
$tmpvar['name'] = hesk_input($tmpvar['name'], '', '', 1, 50) or $tmpvar['name'] = $hesklang['pde'];
// Process "To:" email (not yet implemented, for future use)
// $tmpvar['to_email'] = hesk_validateEmail($results['to'][0]['address'],'ERR',0);
// Process email subject, convert to UTF-8, set to "[Piped email]" if none set
$tmpvar['subject'] = isset($results['subject']) ? $results['subject'] : $hesklang['pem'];
if (!empty($results['subject_encoding'])) {
$tmpvar['subject'] = hesk_encodeUTF8($tmpvar['subject'], $results['subject_encoding']);
}
$tmpvar['subject'] = hesk_input($tmpvar['subject'], '', '', 1, 70) or $tmpvar['subject'] = $hesklang['pem'];
// Process email message, convert to UTF-8
$tmpvar['message'] = isset($results['message']) ? $results['message'] : '';
if (!empty($results['encoding'])) {
$tmpvar['message'] = hesk_encodeUTF8($tmpvar['message'], $results['encoding']);
}
$tmpvar['message'] = hesk_input($tmpvar['message'], '', '', 1);
// Message missing?
if (strlen($tmpvar['message']) == 0) {
// Message required? Ignore this email.
if ($hesk_settings['eml_req_msg']) {
return hesk_cleanExit();
}
// Message not required? Assign a default message
$tmpvar['message'] = $hesklang['def_msg'];
// Track duplicate emails based on subject
$message_hash = md5($tmpvar['subject']);
} else {
$message_hash = md5($tmpvar['message']);
}
// Strip quoted reply from email
$tmpvar['message'] = hesk_stripQuotedText($tmpvar['message']);
// Convert URLs to links, change newlines to <br />
$tmpvar['message'] = hesk_makeURL($tmpvar['message']);
$tmpvar['message'] = nl2br($tmpvar['message']);
# For debugging purposes
# die( bin2hex($tmpvar['message']) );
# die($tmpvar['message']);
// Try to detect "delivery failed" and "noreply" emails - ignore if detected
if (hesk_isReturnedEmail($tmpvar)) {
return hesk_cleanExit();
}
// Check for email loops
if (hesk_isEmailLoop($tmpvar['email'], $message_hash)) {
return hesk_cleanExit();
}
// OK, everything seems OK. Now determine if this is a reply to a ticket or a new ticket
if (preg_match('/\\[#([A-Z0-9]{3}\\-[A-Z0-9]{3}\\-[A-Z0-9]{4})\\]/', str_replace(' ', '', $tmpvar['subject']), $matches)) {
// We found a possible tracking ID
$tmpvar['trackid'] = $matches[1];
// Does it match one in the database?
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE `trackid`='" . hesk_dbEscape($tmpvar['trackid']) . "' LIMIT 1");
if (hesk_dbNumRows($res)) {
$ticket = hesk_dbFetchAssoc($res);
// Do email addresses match?
if (strpos(strtolower($ticket['email']), strtolower($tmpvar['email'])) === false) {
$tmpvar['trackid'] = '';
}
// Is this ticket locked? Force create a new one if it is
if ($ticket['locked']) {
$tmpvar['trackid'] = '';
}
} else {
$tmpvar['trackid'] = '';
}
}
// If tracking ID is empty, generate a new one
if (empty($tmpvar['trackid'])) {
$tmpvar['trackid'] = hesk_createID();
$is_reply = 0;
} else {
$is_reply = 1;
}
// Process attachments
$tmpvar['attachmment_notices'] = '';
$tmpvar['attachments'] = '';
$num = 0;
if ($hesk_settings['attachments']['use'] && isset($results['attachments'][0])) {
foreach ($results['attachments'] as $k => $v) {
// Clean attachment names
$myatt['real_name'] = hesk_cleanFileName($v['orig_name']);
//.........这里部分代码省略.........
示例12: elseif
<select class="form-control contact-newTicket" id="new-ticket-category" name="category" <?php
if (in_array('category', $_SESSION['iserror'])) {
echo ' class="isError" ';
} elseif (in_array('category', $_SESSION['isnotice'])) {
echo ' class="isNotice" ';
}
?>
>
<?php
// Show the "Click to select"?
if ($hesk_settings['select_cat']) {
echo '<option value="">' . $hesklang['select'] . '</option>';
}
// List categories
$result = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'categories` ORDER BY `cat_order` ASC');
while ($row = hesk_dbFetchAssoc($result)) {
if (isset($_SESSION['as_category']) && $_SESSION['as_category'] == $row['id']) {
$selected = ' selected="selected"';
} else {
$selected = '';
}
echo '<option value="' . $row['id'] . '"' . $selected . '>' . $row['name'] . '</option>';
}
?>
</select>
</div>
<div class="form-inline new-ticket-contact-row">
<label class="col-sm-2 control-label" for="new-ticket-priority"><?php
echo $hesklang['priority'];
?>
示例13: hesk_fullyDeleteTicket
function hesk_fullyDeleteTicket()
{
global $hesk_settings, $hesklang, $ticket;
/* Delete attachment files */
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` WHERE `ticket_id`='" . hesk_dbEscape($ticket['trackid']) . "'");
if (hesk_dbNumRows($res)) {
$hesk_settings['server_path'] = dirname(dirname(__FILE__));
while ($file = hesk_dbFetchAssoc($res)) {
hesk_unlink($hesk_settings['server_path'] . '/' . $hesk_settings['attach_dir'] . '/' . $file['saved_name']);
}
}
/* Delete attachments info from the database */
hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` WHERE `ticket_id`='" . hesk_dbEscape($ticket['trackid']) . "'");
/* Delete the ticket */
hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE `id`='" . intval($ticket['id']) . "'");
/* Delete replies to the ticket */
hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` WHERE `replyto`='" . intval($ticket['id']) . "'");
/* Delete ticket notes */
hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` WHERE `ticket`='" . intval($ticket['id']) . "'");
return true;
}
示例14: implode
$ulist = implode(',', $u);
$u_emails = hesk_dbQuery("SELECT `email` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `id` IN (" . $ulist . ")");
//ndertojme template e emailit ne rastin kur SKA probleme
$email_body = "<p> Përshendetje,</p>" . "<p> U Hap Ceshtja: " . hesk_POST('subject') . " me ID: " . $ticket['id'] . "</p>";
$email_body .= "<div style='color:blue'>" . hesk_POST('message') . "</div>";
$email_body .= "<p>Cështja u hap nga useri: " . hesk_POST('name') . "</p>";
$email_body .= "<p>Ju do te njoftoheni me nje email per zgjidhjen e ceshtjes.</p>";
$email_body .= "<p>Faleminderit!</p>";
$email_body .= "<p>Stafi Commprog!</p>";
//ndertojme template e emailit ne rastin kur KA probleme
$email_body2 = "<p> Përshendetje,</p>" . "<p> U Hap Ceshtja: " . hesk_POST('subject') . " me ID: " . $ticket['id'] . "</p>";
$email_body2 .= "<div style='color:blue'>" . hesk_POST('message') . "</div>";
$email_body2 .= "<p>Cështja u hap nga useri: " . hesk_POST('name') . "</p>";
$email_body2 .= "<p>KUJDES! Cështja nuk eshte e lidhur me nje projekt ne Impro. Beni lidhjen!</p>";
$email_body2 .= "<p>Faleminderit!</p>";
while ($u_email = hesk_dbFetchAssoc($u_emails)) {
if (!empty($data)) {
// Notify the customer
hesk_notifyCustomer();
hesk_mail($u_email['email'], hesk_POST('subject'), $email_body);
} else {
hesk_mail($u_email['email'], hesk_POST('subject'), $email_body2);
}
}
}
// Need to notify staff?
// --> From autoassign?
if ($tmpvar['owner'] && $autoassign_owner['notify_assigned']) {
hesk_notifyAssignedStaff($autoassign_owner, 'ticket_assigned_to_you');
} elseif (!$tmpvar['owner']) {
hesk_notifyStaff('new_ticket_staff', " `notify_new_unassigned` = '1' ");
示例15: hesk_kbLatestArticles
function hesk_kbLatestArticles($how_many, $index = 1)
{
global $hesk_settings, $hesklang;
// Index page or KB main page?
if ($index) {
// Disabled?
if (!$hesk_settings['kb_index_latest']) {
return true;
}
// Show title in italics
$font_weight = 'i';
} else {
// Disabled?
if (!$hesk_settings['kb_latest']) {
return true;
}
// Show title in bold
$font_weight = 'b';
// Print a line for spacing if we don't show popular articles
if (!$hesk_settings['kb_popart']) {
echo '<hr />';
}
}
?>
<table border="0" width="100%">
<tr>
<td>» <<?php
echo $font_weight;
?>
><?php
echo $hesklang['latart'];
?>
</<?php
echo $font_weight;
?>
></td>
<?php
/* Show number of views? */
if ($hesk_settings['kb_date']) {
echo '<td style="text-align:right"><i>' . $hesklang['dta'] . '</i></td>';
}
?>
</tr>
</table>
<?php
/* Get list of articles from the database */
$res = hesk_dbQuery("SELECT `t1`.`id`,`t1`.`subject`,`t1`.`dt` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` AS `t1`\r\n\t\t\tLEFT JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` AS `t2` ON `t1`.`catid` = `t2`.`id`\r\n\t\t\tWHERE `t1`.`type`='0' AND `t2`.`type`='0'\r\n\t\t\tORDER BY `t1`.`dt` DESC LIMIT " . intval($how_many));
/* If no results found end here */
if (hesk_dbNumRows($res) == 0) {
echo '<p><i>' . $hesklang['noa'] . '</i><br /> </p>';
return true;
}
/* We have some results, print them out */
?>
<div align="center">
<table border="0" cellspacing="1" cellpadding="3" width="100%">
<?php
while ($article = hesk_dbFetchAssoc($res)) {
echo '
<tr>
<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="1" valign="top"><img src="img/article_text.png" width="16" height="16" border="0" alt="" style="vertical-align:middle" /></td>
<td valign="top"> <a href="knowledgebase.php?article=' . $article['id'] . '">' . $article['subject'] . '</a></td>
';
if ($hesk_settings['kb_date']) {
echo '<td valign="top" style="text-align:right" width="200">' . hesk_date($article['dt'], true) . '</td>';
}
echo '
</tr>
</table>
</td>
</tr>
';
}
?>
</table>
</div>
<?php
}