本文整理汇总了PHP中hesk_error函数的典型用法代码示例。如果您正苦于以下问题:PHP hesk_error函数的具体用法?PHP hesk_error怎么用?PHP hesk_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hesk_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: hesk_show_kb_category
function hesk_show_kb_category($catid, $is_search = 0)
{
global $hesk_settings, $hesklang;
$res = hesk_dbQuery("SELECT `name`,`parent` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` WHERE `id`='{$catid}' AND `type`='0' LIMIT 1");
$thiscat = hesk_dbFetchAssoc($res) or hesk_error($hesklang['kb_cat_inv']);
if ($is_search == 0) {
/* Print header */
$hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . hesk_htmlspecialchars($thiscat['name']);
require_once HESK_PATH . 'inc/header.inc.php';
hesk_kb_header($hesk_settings['kb_link']);
}
// If we are in "Knowledgebase only" mode show system messages
if ($catid == 1 && hesk_check_kb_only(false)) {
// Service messages
$res = hesk_dbQuery('SELECT `title`, `message`, `style` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` WHERE `type`='0' ORDER BY `order` ASC");
while ($sm = hesk_dbFetchAssoc($res)) {
hesk_service_message($sm);
}
}
if ($thiscat['parent']) {
$link = $thiscat['parent'] == 1 ? 'knowledgebase.php' : 'knowledgebase.php?category=' . $thiscat['parent'];
echo '<h3 class="text-left"><a href="javascript:history.go(-1)"><i class="fa fa-arrow-circle-left" data-toggle="tooltip" data-placement="top" title="' . $hesklang['back'] . '"></i></a> ' . $hesklang['kb_cat'] . ': ' . $thiscat['name'] . ' </h3>
<div class="footerWithBorder blankSpace"></div>
<div class="blankSpace"></div>
';
}
$result = hesk_dbQuery("SELECT `id`,`name`,`articles` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` WHERE `parent`='{$catid}' AND `type`='0' ORDER BY `cat_order` ASC");
if (hesk_dbNumRows($result) > 0) {
?>
<div class="panel panel-default">
<div class="panel-heading">
<h4 class="text-left"><?php
echo $hesklang['kb_cat_sub'];
?>
</h4>
</div>
<table class="table table-striped">
<?php
$per_col = $hesk_settings['kb_cols'];
$i = 1;
while ($cat = hesk_dbFetchAssoc($result)) {
if ($i == 1) {
echo '<tr>';
}
echo '
<td width="50%" valign="top">
<table border="0">
<tr><td><i class="fa fa-folder"></i> <a href="knowledgebase.php?category=' . $cat['id'] . '">' . $cat['name'] . '</a></td></tr>
';
/* Print most popular/sticky articles */
if ($hesk_settings['kb_numshow'] && $cat['articles']) {
$res = hesk_dbQuery("SELECT `id`,`subject`, `sticky` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$cat['id']}' AND `type`='0' ORDER BY `sticky` DESC, `views` DESC, `art_order` ASC LIMIT " . (intval($hesk_settings['kb_numshow']) + 1));
$num = 1;
while ($art = hesk_dbFetchAssoc($res)) {
$icon = 'glyphicon glyphicon-file';
$style = '';
if ($art['sticky']) {
$icon = 'glyphicon glyphicon-pushpin';
$style = 'style="color: #FF0000"';
}
echo '
<tr>
<td ' . $style . '> <span class="' . $icon . '"></span>
<a href="knowledgebase.php?article=' . $art['id'] . '" class="article">' . $art['subject'] . '</a></td>
</tr>';
if ($num == $hesk_settings['kb_numshow']) {
break;
} else {
$num++;
}
}
if (hesk_dbNumRows($res) > $hesk_settings['kb_numshow']) {
echo '<tr><td>» <a href="knowledgebase.php?category=' . $cat['id'] . '"><i>' . $hesklang['m'] . '</i></a></td></tr>';
}
}
echo '
</table>
</td>
';
if ($i == $per_col) {
echo '</tr>';
$i = 0;
}
$i++;
}
/* Finish the table if needed */
if ($i != 1) {
for ($j = 1; $j <= $per_col; $j++) {
echo '<td width="50%"> </td>';
if ($i == $per_col) {
echo '</tr>';
break;
}
$i++;
}
}
?>
</table>
//.........这里部分代码省略.........
示例2: hesk_session_start
hesk_session_start();
/* Get the tracking ID */
$trackingID = hesk_cleanID() or die("{$hesklang['int_error']}: {$hesklang['no_trackID']}");
/* Connect to database */
hesk_dbConnect();
// Perform additional checks for customers
if (empty($_SESSION['id'])) {
// Are we in maintenance mode?
hesk_check_maintenance();
// Verify email address match
hesk_verifyEmailMatch($trackingID);
}
/* Get ticket info */
$res = hesk_dbQuery("SELECT `t1`.* , `t2`.name AS `repliername`\n\t\t\t\t\tFROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` AS `t1` LEFT JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` AS `t2` ON `t1`.`replierid` = `t2`.`id`\n\t\t\t\t\tWHERE `trackid`='" . hesk_dbEscape($trackingID) . "' LIMIT 1");
if (hesk_dbNumRows($res) != 1) {
hesk_error($hesklang['ticket_not_found']);
}
$ticket = hesk_dbFetchAssoc($res);
// Demo mode
if (defined('HESK_DEMO')) {
$ticket['email'] = 'hidden@demo.com';
$ticket['ip'] = '127.0.0.1';
}
/* Get category name and ID */
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='{$ticket['category']}' LIMIT 1");
/* If this category has been deleted use the default category with ID 1 */
if (hesk_dbNumRows($res) != 1) {
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='1' LIMIT 1");
}
$category = hesk_dbFetchAssoc($res);
/* Get replies */
示例3: hesk_checkPermission
function hesk_checkPermission($feature, $showerror = 1)
{
global $hesklang;
/* Admins have full access to all features */
if (isset($_SESSION['isadmin']) && $_SESSION['isadmin']) {
return true;
}
/* Check other staff for permissions */
if (isset($_SESSION['heskprivileges']) && strpos($_SESSION['heskprivileges'], $feature) === false) {
if ($showerror) {
hesk_error($hesklang['no_permission'] . '<p> </p><p align="center"><a href="index.php">' . $hesklang['click_login'] . '</a>');
} else {
return false;
}
} else {
return true;
}
}
示例4: glob
// Do we have the export directory?
if (is_dir($export_dir) || @mkdir($export_dir, 0777) && is_writable($export_dir)) {
// Cleanup old files
$files = glob($export_dir . '*', GLOB_NOSORT);
if (is_array($files) && count($files)) {
foreach ($files as $file) {
hesk_unlink($file, 86400);
}
}
} else {
hesk_error($hesklang['ede']);
}
// Make sure the file can be saved and written to
@file_put_contents($save_to, '');
if (!file_exists($save_to)) {
hesk_error($hesklang['eef']);
}
// Start generating the report message and generating the export
$flush_me = '<br /><br />';
$flush_me .= hesk_date() . " | {$hesklang['inite']} ";
if ($date_from == $date_to) {
$flush_me .= "(" . hesk_dateToString($date_from, 0) . ")<br />\n";
} else {
$flush_me .= "(" . hesk_dateToString($date_from, 0) . " - " . hesk_dateToString($date_to, 0) . ")<br />\n";
}
// Start generating file contents
$tmp = '<?xml version="1.0" encoding="UTF-8"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
示例5: toggle_type
function toggle_type()
{
global $hesk_settings, $hesklang;
/* A security check */
hesk_token_check();
$catid = intval(hesk_GET('catid')) or hesk_error($hesklang['cat_move_id']);
$_SESSION['selcat2'] = $catid;
if (intval(hesk_GET('s'))) {
$type = 1;
$tmp = $hesklang['cpriv'];
} else {
$type = 0;
$tmp = $hesklang['cpub'];
}
/* Update auto-assign settings */
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `type`='{$type}' WHERE `id`='" . intval($catid) . "' LIMIT 1");
if (hesk_dbAffectedRows() != 1) {
hesk_process_messages($hesklang['int_error'] . ': ' . $hesklang['cat_not_found'], './manage_categories.php');
}
hesk_process_messages($tmp, './manage_categories.php', 'SUCCESS');
}
示例6: hesk_dbQuery
function hesk_dbQuery($query)
{
global $hesk_last_query;
global $hesk_db_link;
global $hesklang, $hesk_settings;
if (!$hesk_db_link && !hesk_dbConnect()) {
return false;
}
$hesk_last_query = $query;
#echo "<p>EXPLAIN $query</p>\n";
if ($res = @mysqli_query($hesk_db_link, $query)) {
return $res;
} elseif ($hesk_settings['debug_mode']) {
hesk_error("{$hesklang['cant_sql']}: {$query}</p><p>{$hesklang['mysql_said']}:<br />" . mysqli_error($hesk_db_link) . "</p>");
} else {
hesk_error("{$hesklang['cant_sql']}</p><p>{$hesklang['contact_webmsater']} <a href=\"mailto:{$hesk_settings['webmaster_mail']}\">{$hesk_settings['webmaster_mail']}</a></p>");
}
}
示例7: hesk_dbQuery
// 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);
$ticket['dt'] = hesk_date($ticket['dt'], true);
$ticket['lastchange'] = hesk_date($ticket['lastchange'], true);
$ticket = hesk_ticketToPlain($ticket, 1, 0);
// Notify customer
require HESK_PATH . 'inc/email_functions.inc.php';
hesk_notifyCustomer('ticket_closed');
}
// Log who marked the ticket resolved
$closedby_sql = ' , `closedat`=NOW(), `closedby`=' . intval($_SESSION['id']) . ' ';
} elseif ($status == 1 || $status == 2 || $status == 4 || $status == 5) {
$action = sprintf($hesklang['tsst'], $status_options[$status]);
$revision = sprintf($hesklang['thist9'], hesk_date(), $status_options[$status], $_SESSION['name'] . ' (' . $_SESSION['user'] . ')');
// Ticket is not resolved
$closedby_sql = ' , `closedat`=NULL, `closedby`=NULL ';
} else {
$action = $hesklang['ticket_been'] . ' ' . $hesklang['opened'];
$revision = sprintf($hesklang['thist4'], hesk_date(), $_SESSION['name'] . ' (' . $_SESSION['user'] . ')');
// Ticket is not resolved
$closedby_sql = ' , `closedat`=NULL, `closedby`=NULL ';
}
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `status`='{$status}', `locked`='{$locked}' {$closedby_sql} , `history`=CONCAT(`history`,'" . hesk_dbEscape($revision) . "') WHERE `trackid`='" . hesk_dbEscape($trackingID) . "' LIMIT 1");
if (hesk_dbAffectedRows() != 1) {
hesk_error("{$hesklang['int_error']}: {$hesklang['trackID_not_found']}.");
}
hesk_process_messages($action, 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . rand(10000, 99999), 'SUCCESS');
示例8: hesk_session_start
function hesk_session_start()
{
session_name('HESK' . sha1(dirname(__FILE__) . '$r^k*Zkq|w1(G@!-D?3%'));
session_cache_limiter('nocache');
if (@session_start()) {
if (!isset($_SESSION['token'])) {
$_SESSION['token'] = hesk_token_hash();
}
header('P3P: CP="CAO DSP COR CURa ADMa DEVa OUR IND PHY ONL UNI COM NAV INT DEM PRE"');
return true;
} else {
global $hesk_settings, $hesklang;
hesk_error("{$hesklang['no_session']} {$hesklang['contact_webmaster']} {$hesk_settings['webmaster_mail']}");
}
}
示例9: hesk_dbFetchAssoc
}
$file = hesk_dbFetchAssoc($res);
// Is ticket ID valid for this attachment?
if ($file['ticket_id'] != $tic_id) {
hesk_error($hesklang['trackID_not_found']);
}
// Verify email address match if needed
if (empty($_SESSION['id'])) {
hesk_verifyEmailMatch($tic_id);
}
}
// Path of the file on the server
$realpath = $hesk_settings['attach_dir'] . '/' . $file['saved_name'];
// Perhaps the file has been deleted?
if (!file_exists($realpath)) {
hesk_error($hesklang['attdel']);
}
// Send the file as an attachment to prevent malicious code from executing
header("Pragma: ");
# To fix a bug in IE when running https
header("Cache-Control: ");
# To fix a bug in IE when running https
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Length: ' . $file['size']);
header('Content-Disposition: attachment; filename=' . $file['real_name']);
// For larger files use chunks, smaller ones can be read all at once
$chunksize = 1048576;
// = 1024 * 1024 (1 Mb)
if ($file['size'] > $chunksize) {
$handle = fopen($realpath, 'rb');
示例10: intval
$m = intval(hesk_POST('m'));
$s = intval(hesk_POST('s'));
/* Get time worked in proper format */
$time_worked = hesk_getTime($h . ':' . $m . ':' . $s);
/* Update database */
$revision = sprintf($hesklang['thist14'], hesk_date(), $time_worked, $_SESSION['name'] . ' (' . $_SESSION['user'] . ')');
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `time_worked`='" . hesk_dbEscape($time_worked) . "', `history`=CONCAT(`history`,'" . hesk_dbEscape($revision) . "') WHERE `trackid`='" . hesk_dbEscape($trackingID) . "' LIMIT 1");
/* Show ticket */
hesk_process_messages($hesklang['twu'], 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . mt_rand(10000, 99999), 'SUCCESS');
}
/* Delete attachment action */
if (isset($_GET['delatt']) && hesk_token_check()) {
if (!$can_delete || !$can_edit) {
hesk_process_messages($hesklang['no_permission'], 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . mt_rand(10000, 99999));
}
$att_id = intval(hesk_GET('delatt')) or hesk_error($hesklang['inv_att_id']);
$reply = intval(hesk_GET('reply', 0));
if ($reply < 1) {
$reply = 0;
}
$note = intval(hesk_GET('note', 0));
if ($note < 1) {
$note = 0;
}
/* Get attachment info */
$res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` WHERE `att_id`='" . intval($att_id) . "' LIMIT 1");
if (hesk_dbNumRows($res) != 1) {
hesk_process_messages($hesklang['id_not_valid'] . ' (att_id)', 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . mt_rand(10000, 99999));
}
$att = hesk_dbFetchAssoc($res);
/* Is ticket ID valid for this attachment? */
示例11: hesk_show_kb_category
function hesk_show_kb_category($catid, $is_search = 0)
{
global $hesk_settings, $hesklang;
$res = hesk_dbQuery("SELECT `name`,`parent` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` WHERE `id`='{$catid}' AND `type`='0' LIMIT 1");
$thiscat = hesk_dbFetchAssoc($res) or hesk_error($hesklang['kb_cat_inv']);
if ($is_search == 0) {
/* Print header */
$hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . hesk_htmlspecialchars($thiscat['name']);
require_once HESK_PATH . 'inc/header.inc.php';
hesk_kb_header($hesk_settings['kb_link']);
// If we are in "Knowledgebase only" mode show system messages
if ($catid == 1 && hesk_check_kb_only(false)) {
// Service messages
$res = hesk_dbQuery('SELECT `title`, `message`, `style` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` WHERE `type`='0' ORDER BY `order` ASC");
while ($sm = hesk_dbFetchAssoc($res)) {
hesk_service_message($sm);
}
}
}
if ($thiscat['parent']) {
$link = $thiscat['parent'] == 1 ? 'knowledgebase.php' : 'knowledgebase.php?category=' . $thiscat['parent'];
echo '<span class="homepageh3">» ' . $hesklang['kb_cat'] . ': ' . $thiscat['name'] . '</span>
(<a href="javascript:history.go(-1)">' . $hesklang['back'] . '</a>)
';
}
$result = hesk_dbQuery("SELECT `id`,`name`,`articles` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` WHERE `parent`='{$catid}' AND `type`='0' ORDER BY `cat_order` ASC");
if (hesk_dbNumRows($result) > 0) {
?>
<p>» <b><?php
echo $hesklang['kb_cat_sub'];
?>
:</b></p>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="7" height="7"><img src="img/roundcornerslt.jpg" width="7" height="7" alt="" /></td>
<td class="roundcornerstop"></td>
<td><img src="img/roundcornersrt.jpg" width="7" height="7" alt="" /></td>
</tr>
<tr>
<td class="roundcornersleft"> </td>
<td>
<table border="0" cellspacing="1" cellpadding="3" width="100%">
<?php
$per_col = $hesk_settings['kb_cols'];
$i = 1;
while ($cat = hesk_dbFetchAssoc($result)) {
if ($i == 1) {
echo '<tr>';
}
echo '
<td width="50%" valign="top">
<table border="0">
<tr><td><img src="img/folder.gif" width="20" height="20" alt="" style="vertical-align:middle" /><a href="knowledgebase.php?category=' . $cat['id'] . '">' . $cat['name'] . '</a></td></tr>
';
/* Print most popular/sticky articles */
if ($hesk_settings['kb_numshow'] && $cat['articles']) {
$res = hesk_dbQuery("SELECT `id`,`subject` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$cat['id']}' AND `type`='0' ORDER BY `sticky` DESC, `views` DESC, `art_order` ASC LIMIT " . (intval($hesk_settings['kb_numshow']) + 1));
$num = 1;
while ($art = hesk_dbFetchAssoc($res)) {
echo '
<tr>
<td><img src="img/article_text.png" width="16" height="16" border="0" alt="" style="vertical-align:middle" />
<a href="knowledgebase.php?article=' . $art['id'] . '" class="article">' . $art['subject'] . '</a></td>
</tr>';
if ($num == $hesk_settings['kb_numshow']) {
break;
} else {
$num++;
}
}
if (hesk_dbNumRows($res) > $hesk_settings['kb_numshow']) {
echo '<tr><td>» <a href="knowledgebase.php?category=' . $cat['id'] . '"><i>' . $hesklang['m'] . '</i></a></td></tr>';
}
}
echo '
</table>
</td>
';
if ($i == $per_col) {
echo '</tr>';
$i = 0;
}
$i++;
}
/* Finish the table if needed */
if ($i != 1) {
for ($j = 1; $j <= $per_col; $j++) {
echo '<td width="50%"> </td>';
if ($i == $per_col) {
echo '</tr>';
break;
}
$i++;
}
}
?>
//.........这里部分代码省略.........
示例12: remove_contract
function remove_contract()
{
global $hesk_settings, $hesklang;
hesk_token_check();
$_SERVER['PHP_SELF'] = 'contracts.php#tab_edit-cont';
$con = intval(hesk_GET('id'));
hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "contracts` WHERE NOT EXISTS\n\t(SELECT NULL FROM`" . hesk_dbEscape($hesk_settings['db_pfix']) . "contractforclient` as `cc` WHERE `cc`.`contract_Id`='" . intval($con) . "') && `id`='" . intval($con) . "' LIMIT 1");
if (hesk_dbAffectedRows() != 1) {
hesk_error("{$hesklang['con_req']}.");
}
hesk_process_messages($hesklang['con_removed_db'], $_SERVER['PHP_SELF'], 'SUCCESS');
}
示例13: error_reporting
#############################
# DO NOT EDIT BELOW #
#############################
$hesk_settings[\'hesk_version\']=\'' . $set['hesk_version'] . '\';
if ($hesk_settings[\'debug_mode\'])
{
error_reporting(E_ALL);
}
else
{
error_reporting(0);
}
if (!defined(\'IN_SCRIPT\')) {die(\'Invalid attempt!\');}';
// Write to the settings file
if (!file_put_contents(HESK_PATH . 'hesk_settings.inc.php', $settings_file_content)) {
hesk_error($hesklang['err_openset']);
}
// Any settings problems?
$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"> <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"> <br /><textarea name="log" rows="10" cols="60">' . $pop3_log . '</textarea></div>';
}
// Show the settings page and display any notices or success
if (count($tmp)) {
$errors = implode('<br /><br />', $tmp);
hesk_process_messages($hesklang['sns'] . '<br /><br />' . $errors, 'admin_settings.php', 'NOTICE');
} else {
hesk_process_messages($hesklang['set_were_saved'], 'admin_settings.php', 'SUCCESS');
示例14: hesk_getEmailMessage
function hesk_getEmailMessage($eml_file, $ticket, $is_admin = 0, $is_ticket = 1, $just_message = 0)
{
global $hesk_settings, $hesklang;
// Demo mode
if (defined('HESK_DEMO')) {
return '';
}
/* Get list of valid emails */
$valid_emails = hesk_validEmails();
/* Verify this is a valid email include */
if (!isset($valid_emails[$eml_file])) {
hesk_error($hesklang['inve']);
}
/* Get email template */
$eml_file = 'language/' . $hesk_settings['languages'][$hesk_settings['language']]['folder'] . '/emails/' . $eml_file . '.txt';
if (file_exists(HESK_PATH . $eml_file)) {
$msg = file_get_contents(HESK_PATH . $eml_file);
} else {
hesk_error($hesklang['emfm'] . ': ' . $eml_file);
}
/* 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'])) {
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 */
switch ($ticket['status']) {
case 1:
$ticket['status'] = $hesklang['wait_reply'];
break;
case 2:
$ticket['status'] = $hesklang['replied'];
break;
case 3:
$ticket['status'] = $hesklang['closed'];
break;
case 4:
$ticket['status'] = $hesklang['in_progress'];
break;
case 5:
$ticket['status'] = $hesklang['on_hold'];
break;
default:
$ticket['status'] = $hesklang['open'];
}
/* 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 */
//.........这里部分代码省略.........
示例15: hesk_makeURL
$tmpvar[$k] = hesk_makeURL(nl2br(hesk_input(hesk_POST($k))));
if (!strlen($tmpvar[$k])) {
$hesk_error_buffer[$k] = $hesklang['fill_all'] . ': ' . $v['name'];
}
$_SESSION["c_{$k}"] = hesk_POST($k);
} else {
$tmpvar[$k] = hesk_makeURL(nl2br(hesk_input(hesk_POST($k))));
$_SESSION["c_{$k}"] = hesk_POST($k);
}
} else {
$tmpvar[$k] = '';
}
}
// Check bans
if (!isset($hesk_error_buffer['email']) && hesk_isBannedEmail($tmpvar['email']) || hesk_isBannedIP($_SERVER['REMOTE_ADDR'])) {
hesk_error($hesklang['baned_e']);
}
// Check maximum open tickets limit
$below_limit = true;
if ($hesk_settings['max_open'] && !isset($hesk_error_buffer['email'])) {
$res = hesk_dbQuery("SELECT COUNT(*) FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE `status` IN ('0', '1', '2', '4', '5') AND " . hesk_dbFormatEmail($tmpvar['email']));
$num = hesk_dbResult($res);
if ($num >= $hesk_settings['max_open']) {
$hesk_error_buffer = array('max_open' => sprintf($hesklang['maxopen'], $num, $hesk_settings['max_open']));
$below_limit = false;
}
}
// If we reached max tickets let's save some resources
if ($below_limit) {
// Generate tracking ID
$tmpvar['trackid'] = hesk_createID();