本文整理汇总了PHP中hesk_msgToPlain函数的典型用法代码示例。如果您正苦于以下问题:PHP hesk_msgToPlain函数的具体用法?PHP hesk_msgToPlain怎么用?PHP hesk_msgToPlain使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了hesk_msgToPlain函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
}
break;
/* Large text box */
/* Large text box */
case 'textarea':
$size = explode('#', $v['value']);
$size[0] = empty($size[0]) ? 5 : intval($size[0]);
$size[1] = empty($size[1]) ? 30 : intval($size[1]);
$k_value = hesk_msgToPlain($k_value, 0, 0);
echo $v['name'] . ': <textarea name="' . $k . '" rows="' . $size[0] . '" cols="' . $size[1] . '">' . $k_value . '</textarea>';
break;
/* Default text input */
/* Default text input */
default:
if (strlen($k_value) != 0) {
$k_value = hesk_msgToPlain($k_value, 0, 0);
$v['value'] = $k_value;
}
echo $v['name'] . ': <input type="text" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" />';
}
}
}
?>
</div><!-- end edit-post-info-table -->
</div>
<?php
}
?>
<div class="form-inline">
<label class="col-sm-2"><?php
示例2: 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;
}
示例3: hesk_dbQuery
} else {
// Get user data from the database
$res = hesk_dbQuery("SELECT `id`, `name`, `pass` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `email` LIKE '" . hesk_dbEscape($email) . "' LIMIT 1");
if (hesk_dbNumRows($res) != 1) {
hesk_process_messages($hesklang['noace'], 'NOREDIRECT');
} else {
$row = hesk_dbFetchAssoc($res);
$hash = sha1(microtime() . $_SERVER['REMOTE_ADDR'] . mt_rand() . $row['id'] . $row['name'] . $row['pass']);
// Insert the verification hash into the database
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "reset_password` (`user`, `hash`, `ip`) VALUES (" . intval($row['id']) . ", '{$hash}', '" . hesk_dbEscape($_SERVER['REMOTE_ADDR']) . "') ");
// Prepare and send email
require HESK_PATH . 'inc/email_functions.inc.php';
// Get the email message
$msg = hesk_getEmailMessage('reset_password', array(), 1, 0, 1);
// Replace message special tags
$msg = str_replace('%%NAME%%', hesk_msgToPlain($row['name'], 1, 1), $msg);
$msg = str_replace('%%SITE_URL%%', $hesk_settings['site_url'], $msg);
$msg = str_replace('%%SITE_TITLE%%', $hesk_settings['site_title'], $msg);
$msg = str_replace('%%PASSWORD_RESET%%', $hesk_settings['hesk_url'] . '/' . $hesk_settings['admin_dir'] . '/password.php?h=' . $hash, $msg);
// Send email
hesk_mail($email, $hesklang['reset_password'], $msg);
// Show success
hesk_process_messages($hesklang['pemls'], 'NOREDIRECT', 'SUCCESS');
}
}
} elseif (isset($_GET['h'])) {
// Get the hash
$hash = preg_replace('/[^a-zA-Z0-9]/', '', $_GET['h']);
// Connect to database
hesk_load_database_functions();
hesk_dbConnect();
示例4: hesk_msgToPlain
<Cell ss:StyleID="s62"><Data ss:Type="DateTime">' . $ticket['dt'] . '</Data></Cell>
<Cell ss:StyleID="s62"><Data ss:Type="DateTime">' . $ticket['lastchange'] . '</Data></Cell>
<Cell><Data ss:Type="String"><![CDATA[' . hesk_msgToPlain($ticket['name'], 1) . ']]></Data></Cell>
<Cell><Data ss:Type="String"><![CDATA[' . $ticket['email'] . ']]></Data></Cell>
<Cell><Data ss:Type="String"><![CDATA[' . $my_cat[$ticket['category']] . ']]></Data></Cell>
<Cell><Data ss:Type="String"><![CDATA[' . $ticket['priority'] . ']]></Data></Cell>
<Cell><Data ss:Type="String"><![CDATA[' . $ticket['status'] . ']]></Data></Cell>
<Cell><Data ss:Type="String"><![CDATA[' . $ticket['subject'] . ']]></Data></Cell>
<Cell><Data ss:Type="String"><![CDATA[' . $ticket['message'] . ']]></Data></Cell>
<Cell><Data ss:Type="String"><![CDATA[' . $ticket['owner'] . ']]></Data></Cell>
<Cell><Data ss:Type="String"><![CDATA[' . $ticket['time_worked'] . ']]></Data></Cell>
';
// Add custom fields
foreach ($hesk_settings['custom_fields'] as $k => $v) {
if ($v['use']) {
$tmp .= '<Cell><Data ss:Type="String"><![CDATA[' . hesk_msgToPlain($ticket[$k], 1) . ']]></Data></Cell> ' . "\n";
}
}
$tmp .= "</Row>\n";
// Write every 100 rows into the file
if ($this_round >= $save_after) {
file_put_contents($save_to, $tmp, FILE_APPEND);
$this_round = 0;
$tmp = '';
usleep(1);
}
$tickets_exported++;
$this_round++;
}
// End of while loop
// Append any remaining rows into the file
示例5: hesk_email2ticket
//.........这里部分代码省略.........
// Generate a random file name
$useChars = 'AEUYBDGHJLMNPQRSTVWXZ123456789';
$tmp = $useChars[mt_rand(0, 29)];
for ($j = 1; $j < 10; $j++) {
$tmp .= $useChars[mt_rand(0, 29)];
}
$myatt['saved_name'] = substr($tmpvar['trackid'] . '_' . md5($tmp . $myatt['real_name']), 0, 200) . $ext;
// Rename the temporary file
rename($v['stored_name'], HESK_PATH . $hesk_settings['attach_dir'] . '/' . $myatt['saved_name']);
// Insert into database
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "attachments` (`ticket_id`,`saved_name`,`real_name`,`size`) VALUES ('" . hesk_dbEscape($tmpvar['trackid']) . "','" . hesk_dbEscape($myatt['saved_name']) . "','" . hesk_dbEscape($myatt['real_name']) . "','" . intval($myatt['size']) . "')");
$tmpvar['attachments'] .= hesk_dbInsertID() . '#' . $myatt['real_name'] . ',';
$num++;
}
if (strlen($tmpvar['attachmment_notices'])) {
$tmpvar['message'] .= "<br /><br />" . hesk_input($hesklang['attrem'], '', '', 1) . "<br />" . nl2br(hesk_input($tmpvar['attachmment_notices'], '', '', 1));
}
}
// Delete the temporary files
deleteAll($results['tempdir']);
// If this is a reply add a new reply
if ($is_reply) {
// Set last replier name to customer name
$ticket['lastreplier'] = $tmpvar['name'] == $hesklang['pde'] ? $tmpvar['email'] : $tmpvar['name'];
// If staff hasn't replied yet, keep ticket status "New", otherwise set it to "Waiting reply from staff"
$ticket['status'] = $ticket['status'] ? 1 : 0;
// Update ticket as necessary
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` SET `lastchange`=NOW(),`status`='{$ticket['status']}',`replies`=`replies`+1,`lastreplier`='0' WHERE `id`='" . intval($ticket['id']) . "' LIMIT 1");
// If customer replied, we assume staff replies have been read (no way to be sure if ticket.php hasn't been opened)
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` SET `read` = '1' WHERE `replyto` = '" . intval($ticket['id']) . "' AND `staffid` != '0' ");
// Insert reply into database
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` (`replyto`,`name`,`message`,`dt`,`attachments`) VALUES ('" . intval($ticket['id']) . "','" . hesk_dbEscape($ticket['lastreplier']) . "','" . hesk_dbEscape($tmpvar['message']) . "',NOW(),'" . hesk_dbEscape($tmpvar['attachments']) . "')");
// --> Prepare reply message
// 1. Generate the array with ticket info that can be used in emails
$info = array('email' => $ticket['email'], 'category' => $ticket['category'], 'priority' => $ticket['priority'], 'owner' => $ticket['owner'], 'trackid' => $ticket['trackid'], 'status' => $ticket['status'], 'name' => $ticket['name'], 'lastreplier' => $ticket['lastreplier'], 'subject' => $ticket['subject'], 'message' => stripslashes($tmpvar['message']), 'attachments' => $tmpvar['attachments'], 'dt' => hesk_date($ticket['dt'], true), 'lastchange' => hesk_date($ticket['lastchange'], true), 'id' => $ticket['id']);
// 2. Add custom fields to the array
foreach ($hesk_settings['custom_fields'] as $k => $v) {
$info[$k] = $v['use'] ? $ticket[$k] : '';
}
// 3. Make sure all values are properly formatted for email
$ticket = hesk_ticketToPlain($info, 1, 0);
// --> Process custom fields before sending
foreach ($hesk_settings['custom_fields'] as $k => $v) {
$ticket[$k] = $v['use'] ? hesk_msgToPlain($ticket[$k], 1) : '';
}
// --> If ticket is assigned just notify the owner
if ($ticket['owner']) {
hesk_notifyAssignedStaff(false, 'new_reply_by_customer', 'notify_reply_my');
} else {
hesk_notifyStaff('new_reply_by_customer', "`notify_reply_unassigned`='1'");
}
return $ticket['trackid'];
}
// END REPLY
// Not a reply, but a new ticket. Add it to the database
$tmpvar['category'] = $set_category;
$tmpvar['priority'] = $set_priority < 0 ? hesk_getCategoryPriority($tmpvar['category']) : $set_priority;
$_SERVER['REMOTE_ADDR'] = $hesklang['unknown'];
// Auto assign tickets if aplicable
$tmpvar['owner'] = 0;
$tmpvar['history'] = $pop3 ? sprintf($hesklang['thist16'], hesk_date()) : sprintf($hesklang['thist11'], hesk_date());
$tmpvar['openedby'] = $pop3 ? -2 : -1;
$autoassign_owner = hesk_autoAssignTicket($tmpvar['category']);
#print_r($autoassign_owner);
if ($autoassign_owner) {
$tmpvar['owner'] = $autoassign_owner['id'];
$tmpvar['history'] .= sprintf($hesklang['thist10'], hesk_date(), $autoassign_owner['name'] . ' (' . $autoassign_owner['user'] . ')');
}
// Custom fields will be empty as there is no reliable way of detecting them
foreach ($hesk_settings['custom_fields'] as $k => $v) {
$tmpvar[$k] = '';
}
// Insert ticket to database
$ticket = hesk_newTicket($tmpvar);
// Notify the customer
if ($hesk_settings['notify_new']) {
$possible_SPAM = false;
// Do we need to check subject for SPAM tags?
if ($hesk_settings['notify_skip_spam']) {
foreach ($hesk_settings['notify_spam_tags'] as $tag) {
if (strpos($tmpvar['subject'], $tag) !== false) {
$possible_SPAM = true;
break;
}
}
}
// SPAM tags not found or not checked, send email
if ($possible_SPAM === false) {
hesk_notifyCustomer();
}
}
// 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' ");
}
return $ticket['trackid'];
}
示例6: mail_send
function mail_send()
{
global $hesk_settings, $hesklang;
/* A security check */
hesk_token_check('POST');
$hesk_error_buffer = '';
/* Recipient */
$_SESSION['mail']['to'] = intval(hesk_POST('to'));
/* Valid recipient? */
if (empty($_SESSION['mail']['to'])) {
$hesk_error_buffer .= '<li>' . $hesklang['m_rec'] . '</li>';
} elseif ($_SESSION['mail']['to'] == $_SESSION['id']) {
$hesk_error_buffer .= '<li>' . $hesklang['m_inr'] . '</li>';
} else {
$res = hesk_dbQuery("SELECT `name`,`email`,`notify_pm` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` WHERE `id`='" . intval($_SESSION['mail']['to']) . "' LIMIT 1");
$num = hesk_dbNumRows($res);
if (!$num) {
$hesk_error_buffer .= '<li>' . $hesklang['m_inr'] . '</li>';
} else {
$pm_recipient = hesk_dbFetchAssoc($res);
}
}
/* Subject */
$_SESSION['mail']['subject'] = hesk_input(hesk_POST('subject')) or $hesk_error_buffer .= '<li>' . $hesklang['m_esu'] . '</li>';
/* Message */
$_SESSION['mail']['message'] = hesk_input(hesk_POST('message')) or $hesk_error_buffer .= '<li>' . $hesklang['enter_message'] . '</li>';
/* Any errors? */
if (strlen($hesk_error_buffer)) {
$_SESSION['hide']['list'] = 1;
$hesk_error_buffer = $hesklang['rfm'] . '<br /><br /><ul>' . $hesk_error_buffer . '</ul>';
hesk_process_messages($hesk_error_buffer, 'NOREDIRECT');
} else {
$_SESSION['mail']['message'] = hesk_makeURL($_SESSION['mail']['message']);
$_SESSION['mail']['message'] = nl2br($_SESSION['mail']['message']);
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mail` (`from`,`to`,`subject`,`message`,`dt`,`read`) VALUES ('" . intval($_SESSION['id']) . "','" . intval($_SESSION['mail']['to']) . "','" . hesk_dbEscape($_SESSION['mail']['subject']) . "','" . hesk_dbEscape($_SESSION['mail']['message']) . "',NOW(),'0')");
/* Notify receiver via e-mail? */
if (isset($pm_recipient) && $pm_recipient['notify_pm']) {
$pm_id = hesk_dbInsertID();
$pm = array('name' => hesk_msgToPlain(addslashes($_SESSION['name']), 1, 1), 'subject' => hesk_msgToPlain($_SESSION['mail']['subject'], 1, 1), 'message' => hesk_msgToPlain($_SESSION['mail']['message'], 1, 1), 'id' => $pm_id);
/* Format email subject and message for recipient */
$subject = hesk_getEmailSubject('new_pm', $pm, 0);
$message = hesk_getEmailMessage('new_pm', $pm, 1, 0);
/* Send e-mail */
hesk_mail($pm_recipient['email'], $subject, $message);
}
unset($_SESSION['mail']);
hesk_process_messages($hesklang['m_pms'], './mail.php', 'SUCCESS');
}
}
示例7: edit_article
function edit_article()
{
global $hesk_settings, $hesklang, $listBox;
$hesk_error_buffer = array();
$id = intval(hesk_GET('id')) or hesk_process_messages($hesklang['kb_art_id'], './manage_knowledgebase.php');
/* Get article details */
$result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `id`='" . intval($id) . "' LIMIT 1");
if (hesk_dbNumRows($result) != 1) {
hesk_process_messages($hesklang['kb_art_id'], './manage_knowledgebase.php');
}
$article = hesk_dbFetchAssoc($result);
if ($hesk_settings['kb_wysiwyg'] || $article['html']) {
$article['content'] = hesk_htmlspecialchars($article['content']);
} else {
$article['content'] = hesk_msgToPlain($article['content']);
}
$catid = $article['catid'];
if (isset($_SESSION['edit_article'])) {
$_SESSION['edit_article'] = hesk_stripArray($_SESSION['edit_article']);
$article['type'] = $_SESSION['edit_article']['type'];
$article['html'] = $_SESSION['edit_article']['html'];
$article['subject'] = $_SESSION['edit_article']['subject'];
$article['content'] = $_SESSION['edit_article']['content'];
$article['keywords'] = $_SESSION['edit_article']['keywords'];
$article['catid'] = $_SESSION['edit_article']['catid'];
$article['sticky'] = $_SESSION['edit_article']['sticky'];
}
/* Get categories */
$result = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'kb_categories` ORDER BY `parent` ASC, `cat_order` ASC');
$kb_cat = array();
while ($cat = hesk_dbFetchAssoc($result)) {
$kb_cat[] = $cat;
if ($cat['id'] == $article['catid']) {
$this_cat = $cat;
$this_cat['parent'] = $article['catid'];
}
}
/* Translate main category "Knowledgebase" if needed */
$kb_cat[0]['name'] = $hesklang['kb_text'];
require HESK_PATH . 'inc/treemenu/TreeMenu.php';
$icon = HESK_PATH . 'img/folder.gif';
$expandedIcon = HESK_PATH . 'img/folder-expanded.gif';
$menu = new HTML_TreeMenu();
$thislevel = array('0');
$nextlevel = array();
$i = 1;
$j = 1;
while (count($kb_cat) > 0) {
foreach ($kb_cat as $k => $cat) {
if (in_array($cat['parent'], $thislevel)) {
$up = $cat['parent'];
$my = $cat['id'];
$type = $cat['type'] ? '*' : '';
$text_short = $cat['name'] . $type . ' (' . $cat['articles'] . ', ' . $cat['articles_private'] . ', ' . $cat['articles_draft'] . ')';
if (isset($node[$up])) {
$node[$my] =& $node[$up]->addItem(new HTML_TreeNode(array('hesk_parent' => $this_cat['parent'], 'text' => 'Text', 'text_short' => $text_short, 'hesk_catid' => $cat['id'], 'hesk_select' => 'option' . $j, 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true)));
} else {
$node[$my] = new HTML_TreeNode(array('hesk_parent' => $this_cat['parent'], 'text' => 'Text', 'text_short' => $text_short, 'hesk_catid' => $cat['id'], 'hesk_select' => 'option' . $j, 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true));
}
$nextlevel[] = $cat['id'];
$j++;
unset($kb_cat[$k]);
}
}
$thislevel = $nextlevel;
$nextlevel = array();
/* Break after 20 recursions to avoid hang-ups in case of any problems */
if ($i > 20) {
break;
}
$i++;
}
$menu->addItem($node[1]);
// Create the presentation class
$listBox =& ref_new(new HTML_TreeMenu_Listbox($menu));
/* Print header */
require_once HESK_PATH . 'inc/header.inc.php';
/* Print main manage users page */
require_once HESK_PATH . 'inc/show_admin_nav.inc.php';
?>
<div class="container new-manage-kb-title"><a href="manage_knowledgebase.php" class="smaller"><b><?php
echo $hesklang['kb'];
?>
</a></b> >
<a href="manage_knowledgebase.php?a=manage_cat&catid=<?php
echo $catid;
?>
" class="smaller"><?php
echo $hesklang['kb_cat_man'];
?>
</a> > <?php
echo $hesklang['kb_art_edit'];
?>
</div>
<?php
/* This will handle error, success and notice messages */
hesk_handle_messages();
?>
//.........这里部分代码省略.........
示例8: 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));
//.........这里部分代码省略.........
示例9: hesk_token_check
if (isset($_POST['save'])) {
// A security check
hesk_token_check('POST');
// Get message
$tmpvar['message'] = nl2br(hesk_makeURL(hesk_input(hesk_POST('message'))));
// If we have message or attachments do the update
if (strlen($tmpvar['message']) || strlen($note['attachments'])) {
hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` SET `message`='" . hesk_dbEscape($tmpvar['message']) . "' WHERE `id`={$noteID}");
hesk_process_messages($hesklang['ednote2'], 'admin_ticket.php?track=' . $trackingID . '&Refresh=' . mt_rand(10000, 99999), 'SUCCESS');
} else {
hesk_dbQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "notes` WHERE `id`={$noteID}");
header('Location: admin_ticket.php?track=' . $trackingID . '&Refresh=' . mt_rand(10000, 99999));
exit;
}
}
$note['message'] = hesk_msgToPlain($note['message'], 0, 0);
/* Print header */
require_once HESK_PATH . 'inc/header.inc.php';
/* Print admin navigation */
require_once HESK_PATH . 'inc/show_admin_nav.inc.php';
?>
<!--
</td>
</tr>-->
<!-- start in this page end somewhere...
<tr>
<td>
-->
示例10: 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');
/* 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 .= "\r\n{$hesklang['trackID']}: " . $my_ticket['trackid'] . "\r\n{$hesklang['subject']}: " . hesk_msgToPlain($my_ticket['subject'], 1, 0) . "\r\n{$hesklang['status']}: " . $my_status[$my_ticket['status']] . "\r\n{$hesk_settings['hesk_url']}/ticket.php?track={$my_ticket['trackid']}{$email_param}\r\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;
/* Print header */
$hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['tid_sent'];
require_once HESK_PATH . 'inc/header.inc.php';
?>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="3"><img src="img/headerleftsm.jpg" width="3" height="25" alt="" /></td>
<td class="headersm"><?php
hesk_showTopBar($hesklang['tid_sent']);
?>
</td>
<td width="3"><img src="img/headerrightsm.jpg" width="3" height="25" alt="" /></td>
</tr>
</table>
<table width="100%" border="0" cellspacing="0" cellpadding="3">
<tr>
<td><span class="smaller"><a href="<?php
echo $hesk_settings['site_url'];
?>
" class="smaller"><?php
echo $hesk_settings['site_title'];
?>
</a> >
<a href="<?php
echo $hesk_settings['hesk_url'];
?>
" class="smaller"><?php
echo $hesk_settings['hesk_title'];
?>
</a>
> <?php
echo $hesklang['tid_sent'];
?>
</span></td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<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>
<p> </p>
<p align="center"><?php
echo $hesklang['tid_sent2'];
//.........这里部分代码省略.........
示例11: hesk_ticketToPlain
function hesk_ticketToPlain($ticket, $specialchars = 0, $strip = 1)
{
if (is_array($ticket)) {
foreach ($ticket as $key => $value) {
$ticket[$key] = is_array($ticket[$key]) ? hesk_ticketToPlain($value, $specialchars, $strip) : hesk_msgToPlain($value, $specialchars, $strip);
}
return $ticket;
} else {
return hesk_msgToPlain($ticket, $specialchars, $strip);
}
}
示例12: 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 */
//.........这里部分代码省略.........
示例13: processEmail
function processEmail($msg, $name, $num, $tid_list)
{
global $hesk_settings;
$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);
return $msg;
}