$pLang = $PORTAL->language; } else { $mailT = LANG_PATH . 'admin-ticket-reply' . ($ret[0] == 'yes' ? '-merged' : '') . '.txt'; } break; } // Send email to original ticket creator.. $MSMAIL->sendMSMail(array('from_email' => $MSTEAM->emailFrom ? $MSTEAM->emailFrom : $MSTEAM->email, 'from_name' => $MSTEAM->nameFrom ? $MSTEAM->nameFrom : $MSTEAM->name, 'to_email' => $PORTAL->email, 'to_name' => $PORTAL->name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($TICKET->id)), $emailSubjects['admin-reply']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $replyToAddr ? $replyToAddr : ($SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email)), 'template' => $mailT, 'language' => isset($pLang) ? $pLang : $SETTINGS->language, 'alive' => 'yes')); // If this is a dispute, notify other users in dispute.. if ($isDispute == 'yes' && $SETTINGS->disputes == 'yes') { $q = mysql_query("SELECT `name`,`email` FROM `" . DB_PREFIX . "disputes`\n\t LEFT JOIN `" . DB_PREFIX . "portal`\n\t\t\tON `" . DB_PREFIX . "disputes`.`visitorID` = `" . DB_PREFIX . "portal`.`id`\n WHERE `" . DB_PREFIX . "disputes`.`ticketID` = '{$TICKET->id}'\n\t\t\tGROUP BY `email`\n\t\t\tORDER BY `name`\n\t\t\t") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); while ($D_USR = mysql_fetch_object($q)) { $pLang = ''; // Check which templates to use based on language.. if ($D_USR->language && file_exists(LANG_BASE_PATH . $D_USR->language . '/mail-templates/admin-dispute-reply.txt')) { $mailT = LANG_BASE_PATH . $D_USR->language . '/mail-templates/admin-dispute-reply.txt'; $pLang = $D_USR->language; } else { $mailT = LANG_PATH . 'admin-dispute-reply.txt'; } $MSMAIL->sendMSMail(array('from_email' => $MSTEAM->emailFrom ? $MSTEAM->emailFrom : $MSTEAM->email, 'from_name' => $MSTEAM->nameFrom ? $MSTEAM->nameFrom : $MSTEAM->name, 'to_email' => $D_USR->email, 'to_name' => $D_USR->name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($ID)), $emailSubjects['admin-reply']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $replyToAddr ? $replyToAddr : ($SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email)), 'template' => $mailT, 'language' => $pLang ? $pLang : $SETTINGS->language, 'alive' => 'yes')); } } } if ($ret[0] == 'no') { $OK = true; } else { $metaReload = '<meta http-equiv="refresh" content="' . MERGE_RELOAD_TIME . ';url=index.php?p=view-ticket&id=' . ltrim($_POST['mergeid'], '0') . '">'; $OK2 = true; } }
$qR = mysql_query("SELECT `ts`,`replyType` FROM `" . DB_PREFIX . "replies` \n WHERE `ticketID` = '{$T->id}' \n\t\t\t\t ORDER BY `id` DESC\n\t\t "); $RP = mysql_fetch_object($qR); // Is this ticket waiting on visitor? if (isset($RP->ts) && $RP->replyType == 'admin') { // Check time of reply.. $f = strtotime(date('Y-m-d', $RP->ts)); $t = strtotime(date('Y-m-d', $now)); $c = ceil(($t - $f) / 86400); // Close duration expired? if ($c >= (int) $SETTINGS->autoClose) { // Close ticket and write history note.. $rows = $MSTICKET->openclose($T->id, 'close'); // If affected rows, actioned ok.. if ($rows > 0) { ++$tCount; $subjects[$V->visitorID][] = array($T->id, $T->isDisputed, $T->department, $T->source, str_replace(array('{ticket}', '{subject}'), array(mswTicketNumber($T->id), $T->subject), $msg_script56)); // History if affected rows.. $MSTICKET->historyLog($T->id, str_replace('{days}', (int) $SETTINGS->autoClose, $msg_ticket_history['ticket-auto-close'])); } } } } // Group and send single email.. if (!empty($subjects[$V->visitorID]) && $SETTINGS->autoCloseMail == 'yes') { $ticketData = array(); foreach ($subjects[$V->visitorID] as $values) { $ticket = $values[0]; $dispute = $values[1]; $dept = $values[2]; $source = $values[3]; $data = $values[4];
$MSMAIL->addTag('{STATUS}', $msg_showticket23); // Convert quoted-printable string to an 8 bit string.. // Helps make message cleaner.. if (function_exists('quoted_printable_decode')) { $comments = quoted_printable_decode($comments); } $MSMAIL->addTag('{COMMENTS}', $MSBB->cleaner($comments)); $MSMAIL->addTag('{ATTACHMENTS}', !empty($attString) ? implode(mswDefineNewline(), $attString) : 'N/A'); $MSMAIL->addTag('{CUSTOM}', 'N/A'); // Anything to send to admin? $MSIMAP->log('Preparing to send spam notification to global admin staff member..'); if (isset($mailTemps['admin'])) { $GLOBAL = mswGetTableData('users', 'id', 1, 'AND `notify` = \'yes\'', '`name`,`email`,`email2`'); if (isset($GLOBAL->name)) { $MSMAIL->addTag('{NAME}', $GLOBAL->name); $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => $SETTINGS->website, 'to_email' => $GLOBAL->email, 'to_name' => $GLOBAL->name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($ID)), $emailSubjects['spam-notify']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => PATH . 'content/language/' . $SETTINGS->language . '/mail-templates/spam-notification.txt', 'language' => $SETTINGS->language, 'add-emails' => $GLOBAL->email2)); $MSIMAP->log('Email sent to ' . $GLOBAL->name . ' <' . $GLOBAL->email . '>'); } else { $MSIMAP->log('Not sent, notifications are disabled. Enable in settings'); } } } } } else { $MSIMAP->log('Blank message, ignore'); } // If spam filter is enabled, and message is spam, are we just deleting? if ($spamBypass == 'yes' && $IMDT->im_spam == 'yes' && defined('B8_LOADED')) { $pipes[6] = ++$pipes[6]; $MSIMAP->flagMessage($mailbox, $i); } else {
$MSAPI->log('[' . strtoupper($MSAPI->handler) . '] No emails sent to staff as ticket is awaiting assignment'); } // Now send to global user.. $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Preparing to send to global admin staff member..'); $GLOBAL = mswGetTableData('users', 'id', 1, 'AND `notify` = \'yes\'', '`name`,`email`,`email2`'); if (isset($GLOBAL->name)) { $MSMAIL->addTag('{NAME}', $GLOBAL->name); $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => $SETTINGS->website, 'to_email' => $GLOBAL->email, 'to_name' => $GLOBAL->name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($ID)), $emailSubjects['new-ticket']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => PATH . 'content/language/' . $SETTINGS->language . '/mail-templates/new-ticket-admin.txt', 'language' => $SETTINGS->language, 'alive' => 'yes', 'add-emails' => $GLOBAL->email2)); $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Email sent to ' . $GLOBAL->name . ' <' . $GLOBAL->email . '>'); } else { $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Not sent, notifications are disabled. Enable in settings'); } // Send email to visitor.. $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Preparing to send new ticket confirmation to visitor..'); $MSMAIL->addTag('{NAME}', $name); $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => $SETTINGS->website, 'to_email' => $email, 'to_name' => $name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($ID)), $emailSubjects['new-ticket-vis']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => $mailR, 'language' => $pLang ? $pLang : $SETTINGS->language)); $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Email sent to ' . $name . ' <' . $email . '>'); } else { $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Fatal error: Ticket could not be created: ' . mysql_error()); } } else { $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Fatal error: User ID not found.'); } } else { $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Fatal error: Department not found for ID ' . $deptID . '. Ticket ignored.'); } } else { $MSAPI->log('[' . strtoupper($MSAPI->handler) . '] Fatal error: Name,Email,Dept,Subject,Comments & Priority are required, check data. Ticket ignored.'); } } // We are done, so add response..
public function exportTicketHistory($dl, $dt) { global $msg_viewticket113; $id = (int) $_GET['exportHistory']; $sepr = ','; $file = PATH . 'export/' . str_replace(array('{ticket}', '{date}'), array(mswTicketNumber($id), $dt->mswDateTimeDisplay(strtotime(date('Ymd H:i:s')), 'dmY-his')), supportTickets::TICKET_HISTORY_FILENAME); $data = $msg_viewticket113 . mswDefineNewline(); $qTH = mysql_query("SELECT * FROM `" . DB_PREFIX . "tickethistory`\n WHERE `ticketID` = '{$id}'\n ORDER BY `ts` DESC\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); while ($HIS = mysql_fetch_object($qTH)) { $data .= mswCleanCSV($dt->mswDateTimeDisplay($HIS->ts, $this->settings->dateformat), $sepr) . $sepr . mswCleanCSV($dt->mswDateTimeDisplay($HIS->ts, $this->settings->timeformat), $sepr) . $sepr . mswCleanCSV($HIS->action, $sepr) . mswDefineNewline(); } if (mysql_num_rows($qTH) > 0) { // Save file to server and download.. $dl->write($file, rtrim($data)); if (file_exists($file)) { $dl->dl($file, 'text/csv'); } } }
$_POST['ticket'] = $_POST['id']; $MSTICKET->deleteTickets(); $OK1 = true; } // Assign.. if (isset($_POST['users'])) { if (!empty($_POST['id'])) { $userNotify = array(); $tickets = array(); foreach ($_POST['id'] as $ID) { if (!empty($_POST['users'][$ID])) { // Ticket information.. $SUPTICK = mswGetTableData('tickets', 'id', $ID); // Array of ticket subjects assigned to users.. foreach ($_POST['users'][$ID] as $userID) { $tickets[$userID][] = str_replace(array('{id}', '{subject}'), array(mswTicketNumber($ID), $SUPTICK->subject), $msg_assign7); $userNotify[] = $userID; } // Update ticket.. $MSTICKET->ticketUserAssign($ID, implode(',', $_POST['users'][$ID]), $msg_ticket_history['assign']); } } } // Email users.. if (!empty($userNotify) && !empty($tickets) && isset($_POST['mail'])) { $q = mysql_query("SELECT `id`,`name`,`email`,`email2` FROM `" . DB_PREFIX . "users`\n WHERE `id` IN(" . implode(',', $userNotify) . ")\n\t\t\t GROUP BY `id`\n ORDER BY `name`\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); while ($USERS = mysql_fetch_object($q)) { $MSMAIL->addTag('{ASSIGNEE}', $MSTEAM->name); $MSMAIL->addTag('{NAME}', $USERS->name); $MSMAIL->addTag('{TICKETS}', trim(implode(mswDefineNewline(), $tickets[$USERS->id]))); // Send mail..
echo mswTicketNumber($TICKET->id); ?> </b>] <?php echo mswSpecialChars($TICKET->subject); ?> </div> <div class="pull-right"> <a href="#" class="nyroModalClose" onclick="mswSelectMerge('<?php echo mswTicketNumber($TICKET->id); ?> ');return false" title="<?php echo mswSpecialChars($msg_merge2); ?> (#<?php echo mswTicketNumber($TICKET->id); ?> )"><i class="icon-plus"></i> <?php echo $msg_viewticket119; ?> </a> </div> <span class="clearfix"></span> </div> <?php } } else { ?> <p class="nodata" style="padding:20px;font-size:11px"><?php
} // Check digit.. mswCheckDigit($_GET['id'], true); // Get ticket data.. $SUPTICK = mswGetTableData('tickets', 'id', $_GET['id']); // Checks.. if (!isset($SUPTICK->id)) { $HEADERS->err404(true); exit; } // Department check.. if (mswDeptPerms($MSTEAM->id, $SUPTICK->department, $userDeptAccess) == 'fail') { $HEADERS->err403(true); } // Edit.. if (isset($_POST['process'])) { $rows = $MSTICKET->updateTicket(); // Log if affected rows.. if ($rows > 0) { $MSTICKET->historyLog($_GET['id'], str_replace(array('{user}'), array($MSTEAM->name), $msg_ticket_history['edit-ticket'])); } $SUPTICK = mswGetTableData('tickets', 'id', $_GET['id']); $OK = true; } $title = str_replace('{ticket}', mswTicketNumber($SUPTICK->id), $msg_viewticket20); $loadJQAPI = true; $loadBBCSS = true; $loadJQAlertify = true; include PATH . 'templates/header.php'; include PATH . 'templates/system/tickets/tickets-edit.php'; include PATH . 'templates/footer.php';
//die('process'); define('TICKET_REPLY', 1); include PATH . 'control/system/tickets/ticket-reply.php'; } // Assign visitor name/email.. $VIS = mswGetTableData('portal', 'id', $SUPTICK->visitorID); $SUPTICK->name = isset($VIS->name) ? $VIS->name : 'N/A'; $SUPTICK->email = isset($VIS->email) ? $VIS->email : 'N/A'; // Update status.. if (isset($_GET['act']) && in_array($_GET['act'], array('open', 'close', 'lock', 'ticket', 'dispute', 'reopen'))) { //echo "========update status====";die('ticketview1'); $action = str_replace('{user}', $MSTEAM->name, $msg_ticket_history['ticket-status-' . $_GET['act']]); $rows = $MSTICKET->updateTicketStatus(); // History if affected rows.. if ($rows > 0) { $MSTICKET->historyLog($_GET['id'], str_replace(array('{user}'), array($MSTEAM->name), $action)); $SUPTICK = mswGetTableData('tickets', 'id', $_GET['id']); $SUPTICK->name = isset($VIS->name) ? $VIS->name : 'N/A'; $SUPTICK->email = isset($VIS->email) ? $VIS->email : 'N/A'; $actionMsg = $msg_ticket_actioned[$_GET['act']]; $OK3 = $_GET['act']; } } $title = str_replace('{ticket}', mswTicketNumber($_GET['id']), $SUPTICK->isDisputed == 'yes' ? $msg_viewticket80 : $msg_viewticket); $loadJQAPI = true; $loadBBCSS = true; $loadJQAlertify = true; $loadJQNyroModal = true; include PATH . 'templates/header.php'; include PATH . 'templates/system/tickets/tickets-view' . ($SUPTICK->isDisputed == 'yes' ? '-disputed' : '') . '.php'; include PATH . 'templates/footer.php';
} } //------------------------------------ // Disputes awaiting visitor response //------------------------------------ if ($SETTINGS->disputes == 'yes') { $q = mysql_query("SELECT `subject`,`priority`,`" . DB_PREFIX . "tickets`.`id` AS `ticketID`,\n\t `" . DB_PREFIX . "portal`.`name` AS `ticketName`,\n\t `" . DB_PREFIX . "tickets`.`ts` AS `ticketStamp`,\n\t `" . DB_PREFIX . "departments`.`name` AS `deptName`,\n\t `" . DB_PREFIX . "levels`.`name` AS `levelName`\n\t FROM `" . DB_PREFIX . "tickets` \n LEFT JOIN `" . DB_PREFIX . "departments`\n\t ON `" . DB_PREFIX . "tickets`.`department` = `" . DB_PREFIX . "departments`.`id`\n\t LEFT JOIN `" . DB_PREFIX . "portal`\n\t ON `" . DB_PREFIX . "tickets`.`visitorID` = `" . DB_PREFIX . "portal`.`id`\n\t LEFT JOIN `" . DB_PREFIX . "levels`\n\t ON `" . DB_PREFIX . "tickets`.`priority` = `" . DB_PREFIX . "levels`.`id`\n\t OR `" . DB_PREFIX . "tickets`.`priority` = `" . DB_PREFIX . "levels`.`marker`\n\t WHERE `replyStatus` IN('visitor') \n AND `ticketStatus` = 'open' \n AND `isDisputed` = 'yes'\n AND `assignedto` != 'waiting'\n\t\t AND `spamFlag` = 'no'\n " . (!empty($dept) ? 'AND (`department` IN(' . implode(',', $dept) . ') OR FIND_IN_SET(\'' . $USERS->id . '\',`assignedto`)>0)' : '') . "\n\t " . ($USERS->id != '1' && empty($dept) && $USERS->assigned == 'yes' ? 'AND FIND_IN_SET(\'' . $USERS->id . '\',`assignedto`)>0' : '') . "\n ORDER BY FIELD(`" . DB_PREFIX . "tickets`.`priority`,'high','medium','low'),`levelName`\n "); if ($q && mysql_num_rows($q) > 0) { while ($T = mysql_fetch_object($q)) { ++$counts[6]; // Hyperlink.. $link = mswDefineNewline(); $link .= $SETTINGS->scriptpath . '/' . $SETTINGS->afolder . '/?ticket=' . $T->ticketID; // Get last reply.. $last = $MSTICKET->getLastReply($T->ticketID); $emailDigest[6] .= str_replace(array('{priority}', '{subject}', '{ticket}'), array(strtoupper($MSYS->levels($T->priority)), mswCleanData($T->subject), mswTicketNumber($T->ticketID)), $msg_edigest3) . mswDefineNewline(); $emailDigest[6] .= str_replace(array('{name}', '{updated}', '{count}'), array(mswCleanData($T->ticketName) . ' (' . $MSDT->mswDateTimeDisplay($T->ticketStamp, $SETTINGS->dateformat) . ' / ' . $MSDT->mswDateTimeDisplay($T->ticketStamp, $SETTINGS->timeformat) . ')', $last[0] != '0' ? mswCleanData($last[0]) . ' (' . $MSDT->mswDateTimeDisplay($last[1], $SETTINGS->dateformat) . ' / ' . $MSDT->mswDateTimeDisplay($last[1], $SETTINGS->timeformat) . ')' : 'N/A', 0), $msg_edigest6) . $link . mswDefineNewline() . mswDefineNewline(); } } else { $emailDigest[6] = $msg_edigest2; } } //------------------------------------------------------------- // Send Mail, but only if there is something to report about //------------------------------------------------------------- if (array_sum($counts) > 0) { for ($i = 0; $i < count($counts); $i++) { $MSMAIL->addTag('{C' . ($i + 1) . '}', @number_format($counts[$i])); $MSMAIL->addTag('{DATA_' . ($i + 1) . '}', rtrim($emailDigest[$i])); } // Additional tags..
if (isset($OK2)) { echo mswActionCompleted(str_replace('{ticket}', mswTicketNumber(ltrim($_POST['mergeid'], '0')), $msg_viewticket90)); } if (isset($OK3)) { echo mswActionCompleted($actionMsg); } // Reload for merge... if (isset($OK2)) { ?> <div class="container-fluid"> <div class="row-fluid"> <div class="well" style="text-align:center;margin-top:10px;padding-top:25px"> <img src="templates/images/loading.gif" alt="" title=""> <p style="margin-top:20px"><?php echo str_replace('{id}', mswTicketNumber(ltrim($_POST['mergeid'], '0')), $msg_viewticket122); ?> </p> </div> <?php // Footer.. include PATH . 'templates/footer-links.php'; ?> </div> </div> <?php } else { ?> <form method="post" action="?p=<?php echo $_GET['p'];
$MSMAIL->sendMSMail(array('from_email' => $MSTEAM->emailFrom ? $MSTEAM->emailFrom : $MSTEAM->email, 'from_name' => $MSTEAM->nameFrom ? $MSTEAM->nameFrom : $MSTEAM->name, 'to_email' => $GLOBAL->email, 'to_name' => $GLOBAL->name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($tID)), $emailSubjects['new-ticket']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => REL_PATH . 'content/language/' . $SETTINGS->language . '/mail-templates/new-ticket-admin.txt', 'language' => $SETTINGS->language, 'alive' => 'yes', 'add-emails' => $GLOBAL->email2)); } } // Notify visitor.. $IDEPT = mswGetTableData('imap', 'im_dept', $ST->department, '', '`im_email`'); if (isset($IDEPT->im_email) && $IDEPT->im_email) { $replyToAddr = $IDEPT->im_email; } if (file_exists(REL_PATH . 'content/language/' . $PORTAL->language . '/mail-templates/new-ticket-visitor.txt')) { $mailT = REL_PATH . 'content/language/' . $PORTAL->language . '/mail-templates/new-ticket-visitor.txt'; $pLang = $PORTAL->language; } else { $mailT = REL_PATH . 'content/language/' . $SETTINGS->language . '/mail-templates/new-ticket-visitor.txt'; } $MSMAIL->addTag('{NAME}', $PORTAL->name); $MSMAIL->sendMSMail(array('from_email' => $MSTEAM->emailFrom ? $MSTEAM->emailFrom : $MSTEAM->email, 'from_name' => $MSTEAM->nameFrom ? $MSTEAM->nameFrom : $MSTEAM->name, 'to_email' => $PORTAL->email, 'to_name' => $PORTAL->name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($tID)), $emailSubjects['new-ticket-vis']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $replyToAddr ? $replyToAddr : ($SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email)), 'template' => $mailT, 'language' => isset($pLang) ? $pLang : $SETTINGS->language)); } } $OK2 = true; } // Call relevant classes.. include_once REL_PATH . 'control/classes/class.tickets.php'; $MSPTICKETS = new tickets(); $MSPTICKETS->settings = $SETTINGS; $MSPTICKETS->datetime = $MSDT; $title = $msg_adheader63; $loadJQAlertify = true; $loadJQNyroModal = true; include PATH . 'templates/header.php'; include PATH . 'templates/system/tickets/tickets-spam.php'; include PATH . 'templates/footer.php';
ms_divHideShow('main_button_area','add_button_area'); break; case 'second': ms_divHideShow('add_button_area','main_button_area'); break; } } //]]> </script> <div class="header"> <h1 class="page-title"><?php echo $msg_disputes8; ?> : #<?php echo mswTicketNumber($_GET['disputeUsers']); ?> </h1> <span class="clearfix"></span> </div> <ul class="breadcrumb"> <li><?php echo $msg_adheader41; ?> <span class="divider">/</span></li> <li><a href="?p=view-dispute&id=<?php echo $_GET['disputeUsers']; ?>
$IMD = mswGetTableData('imap', 'im_dept', $T->department); if (isset($IMD->im_email) && $IMD->im_email) { $replyToAddr = $IMD->im_email; } } // Get all users in this dispute.. $ticketDisputeUsers = $MSTICKET->disputeUsers($T->id); // Add original ticket starter to the mix.. array_push($ticketDisputeUsers, $T->visitorID); // Send, but skip person currently logged in.. if (!empty($ticketDisputeUsers)) { $qDU = mysql_query("SELECT `name`,`email`,`language` FROM `" . DB_PREFIX . "portal`\n WHERE `id` IN(" . implode(',', $ticketDisputeUsers) . ")\n\t\t\t\t AND `id` != '{$LI_ACC->id}'\n\t\t\t\t GROUP BY `email`\n ORDER BY `name`\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); while ($D_USR = mysql_fetch_object($qDU)) { $pLang = ''; $temp = PATH . 'content/language/' . $SETTINGS->language . '/mail-templates/dispute-reply.txt'; // Get correct language file.. if (isset($D_USR->language) && file_exists(PATH . 'content/language/' . $D_USR->language . '/mail-templates/dispute-reply.txt')) { $pLang = $D_USR->language; $temp = PATH . 'content/language/' . $D_USR->language . '/mail-templates/dispute-reply.txt'; } $MSMAIL->addTag('{USER}', $LI_ACC->name); $MSMAIL->addTag('{NAME}', $D_USR->name); $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => $SETTINGS->website, 'to_email' => $D_USR->email, 'to_name' => $D_USR->name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($T->id)), $emailSubjects['dispute-notify']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $replyToAddr ? $replyToAddr : ($SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email)), 'template' => $temp, 'language' => $pLang ? $pLang : $SETTINGS->language, 'alive' => 'yes')); } } } // Finish with message.. $ticketSystemMsg = $msg_showticket8; } } }
foreach ($userList as $k => $v) { $teamID = $k; $name = $v[0]; $email = $v[1]; $email2 = $v[2]; $MSMAIL->addTag('{NAME}', $name); $MSMAIL->sendMSMail(array('from_email' => $MSTEAM->emailFrom ? $MSTEAM->emailFrom : $MSTEAM->email, 'from_name' => $MSTEAM->nameFrom ? $MSTEAM->nameFrom : $MSTEAM->name, 'to_email' => $email, 'to_name' => $name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($ID)), $emailSubjects['new-ticket-team']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => $mailT, 'language' => $SETTINGS->language, 'alive' => 'yes', 'add-emails' => $email2)); } } // Send mail to global user if applicable and if the global user isn`t the one adding the ticket.. // Applies to department level filtering only, not assigned.. if (empty($_POST['assigned']) && $MSTEAM->id > 1) { $GLOBAL = mswGetTableData('users', 'id', '1'); if (isset($GLOBAL->id) && $GLOBAL->notify == 'yes') { $MSMAIL->addTag('{NAME}', $GLOBAL->name); $MSMAIL->sendMSMail(array('from_email' => $MSTEAM->emailFrom ? $MSTEAM->emailFrom : $MSTEAM->email, 'from_name' => $MSTEAM->nameFrom ? $MSTEAM->nameFrom : $MSTEAM->name, 'to_email' => $GLOBAL->email, 'to_name' => $GLOBAL->name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($ID)), $emailSubjects['new-ticket-team']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => $mailT, 'language' => $SETTINGS->language, 'add-emails' => $GLOBAL->email2)); } } } // Log for closed.. if (isset($_POST['closed'])) { $MSTICKET->historyLog($ID, str_replace(array('{user}'), array($MSTEAM->name), $msg_ticket_history['new-ticket-admin-close'])); } $OK = 'ok'; } } } } $title = $msg_open; $loadJQAPI = true; $loadBBCSS = true;
?> <div class="row-fluid homeTicketWrapper<?php echo ++$lp == $T4Rows ? ' nobottomborder' : ''; ?> "> <a href="?p=view-dispute&id=<?php echo $TICKETS->ticketID; ?> "> <?php echo $cutOff > 0 && strlen($TICKETS->subject) > $cutOff ? substr(mswSpecialChars($TICKETS->subject), 0, $cutOff - 2) . '..' : mswSpecialChars($TICKETS->subject); ?> </a> <span class="bar"> <?php echo str_replace(array('{name}', '{priority}', '{date}', '{ticket}', '{count}'), array(mswSpecialChars($TICKETS->ticketName), mswCleanData($TICKETS->levelName), $MSDT->mswDateTimeDisplay($TICKETS->ticketStamp, $SETTINGS->dateformat), mswTicketNumber($TICKETS->ticketID), $TICKETS->disputeCount + 1), $msg_home45); ?> </span> </div> <?php } } else { ?> <p class="nothing_to_see smalltxt"><?php echo $msg_home41; ?> </p> <?php } ?> </div>
$T = mswGetTableData('tickets', 'id', $T->id); $ticketSystemMsg = $msg_public_ticket13; } } // Add reply.. if (isset($_POST['process'])) { define('T_PERMS', 't'); include PATH . 'control/system/accounts/account-ticket-reply.php'; } // Is IP blank? if ($T->ipAddresses == '' && $T->visitorID == $LI_ACC->id) { $MSTICKET->updateIP($T->id); $T->ipAddresses = mswIPAddresses(); } // Variables.. $title = str_replace('{ticket}', mswTicketNumber($_GET['t']), $msg_showticket4); include PATH . 'control/header.php'; $tpl = new Savant3(); $tpl->assign('TICKET', $T); $tpl->assign('TXT', array($title, $msg_header11, $msg_header3, $msg_main11, $MSYS->levels($T->priority), $MSDT->mswDateTimeDisplay($T->ts, $SETTINGS->dateformat), $MSDT->mswDateTimeDisplay($T->ts, $SETTINGS->timeformat), $msg_viewticket75, $MSYS->department($T->department, $msg_script30), str_replace('{url}', 'index.php?t=' . $_GET['t'] . '&lk=yes', $msg_viewticket45), $msg_public_ticket, $msg_open19, $msg_newticket43, $msg_viewticket101, $msg_showticket5, $msg_viewticket78, $msg_newticket37, $msg_newticket38, $attachRestrictions, $bb_code_buttons, $msg_public_ticket3, $msg_public_ticket4, $msg_public_ticket9, $msg_viewticket27, $msg_public_ticket10)); $tpl->assign('COMMENTS', $MSPARSER->mswTxtParsingEngine($T->comments)); $tpl->assign('CUSTOM_FIELD_DATA', $MSFIELDS->display($T->id)); $tpl->assign('ATTACHMENTS', $MSTICKET->attachments($T->id)); $tpl->assign('TICKET_REPLIES', $MSTICKET->replies($T->id, mswSpecialChars($LI_ACC->name))); $tpl->assign('ENTRY_CUSTOM_FIELDS', $MSFIELDS->build('reply', $T->department)); $tpl->assign('SYSTEM_MESSAGE', !empty($eFields) ? str_replace('{count}', count($eFields), $msg_public_ticket8) : $ticketSystemMsg); // Post fields..will populate on refresh.. $tpl->assign('POST', array('comments' => isset($_POST['comments']) ? mswSpecialChars($_POST['comments']) : '')); // Custom fields for form refresh.. $tpl->assign('CFIELDS', isset($_POST['comments']) ? $MSFIELDS->build('reply', $T->department) : ''); // Field flags for errors..
</div> <?php } } } // Show ticket history.. if ($SETTINGS->ticketHistory == 'yes' && $MSTEAM->ticketHistory == 'yes') { $qTH = mysql_query("SELECT * FROM `" . DB_PREFIX . "tickethistory`\n WHERE `ticketID` = '{$_GET['id']}'\n ORDER BY `ts` DESC\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); $historyRows = mysql_num_rows($qTH); ?> <div class="block" style="margin-top:40px"> <p class="block-heading" id="hisblockhead">(<span id="hiscount"><?php echo @number_format($historyRows); ?> </span>) <?php echo strtoupper($msg_viewticket110) . ' (#' . mswTicketNumber($_GET['id']); ?> )<?php echo $historyRows > 0 ? (USER_DEL_PRIV == 'yes' ? ' <a class="toggleFields pull-right" href="#" onclick="confirmMessageExecute(\'' . mswSpecialChars($msg_script_action) . '\',\'history\',\'0##' . $_GET['id'] . '\');return false"><i class="icon-remove"></i> ' . $msg_viewticket118 . '</a> ' : '') . '<a class="toggleFields pull-right" href="index.php?p=view-ticket&exportHistory=' . $_GET['id'] . '"><i class="icon-save"></i> ' . $msg_viewticket112 . '</a>' : ''; ?> </p> <div class="block-body" style="max-height:300px;overflow:auto" id="historyArea"> <?php if ($historyRows > 0) { while ($HIS = mysql_fetch_object($qTH)) { echo '<span class="historyEntry" id="history_entry_' . $HIS->id . '"><i class="icon-caret-right"></i> <span class="highlighter">' . $MSDT->mswDateTimeDisplay($HIS->ts, $SETTINGS->dateformat) . ' - ' . $MSDT->mswDateTimeDisplay($HIS->ts, $SETTINGS->timeformat) . '</span> - ' . mswCleanData($HIS->action) . (USER_DEL_PRIV == 'yes' ? ' <i class="icon-remove" style="cursor:pointer" onclick="mswRemoveHistory(\'' . $HIS->id . '\',\'0\')" title="' . mswSpecialChars($msg_public_history12) . '"></i>' : '') . '</span>'; } } else { ?> <p class="nodata"><?php echo $msg_viewticket111;
public function ticketList($email, $lv, $count = false, $queryAdd = '') { global $msg_portal8, $msg_public_history7, $msg_portal7, $msg_portal21, $msg_showticket23, $msg_showticket24, $msg_script30, $msg_public_dashboard6, $msg_public_dashboard7; $data = ''; $sch = ''; $qft = array(); $oft = 'ORDER BY `' . DB_PREFIX . 'tickets`.`id` DESC'; // Check for search mode.. if (isset($_GET['qt'])) { // Load the skip words array.. include PATH . 'control/skipwords.php'; $chop = array_map('trim', explode(' ', urldecode($_GET['qt']))); if (!empty($chop)) { foreach ($chop as $word) { if (!in_array($word, $searchSkipWords) && strlen($word) > 1) { $word = strtolower($word); $sch .= (!$sch ? '' : 'OR ') . "LOWER(`subject`) LIKE '%" . mswSafeImportString(mswCleanData($word)) . "%' OR LOWER(`comments`) LIKE '%" . mswSafeImportString(mswCleanData($word)) . "%'"; } } if ($sch) { $qft[] = 'AND (' . $sch . ')'; } } } // Order filters.. if (isset($_GET['order'])) { switch ($_GET['order']) { // Subject (ascending).. case 'subject_asc': $oft = 'ORDER BY `subject`'; break; // Subject (descending).. // Subject (descending).. case 'subject_desc': $oft = 'ORDER BY `subject` desc'; break; // TicketID (ascending).. // TicketID (ascending).. case 'id_asc': $oft = 'ORDER BY `ticketID`'; break; // TicketID (descending).. // TicketID (descending).. case 'id_desc': $oft = 'ORDER BY `ticketID` desc'; break; // Priority (ascending).. // Priority (ascending).. case 'pr_asc': $oft = 'ORDER BY `levelName`'; break; // Priority (descending).. // Priority (descending).. case 'pr_desc': $oft = 'ORDER BY `levelName` desc'; break; // Department (ascending).. // Department (ascending).. case 'dept_asc': $oft = 'ORDER BY `deptName`'; break; // Department (descending).. // Department (descending).. case 'dept_desc': $oft = 'ORDER BY `deptName` desc'; break; // Date Updated (ascending).. // Date Updated (ascending).. case 'rev_asc': $oft = 'ORDER BY `lastrevision`'; break; // Date Updated (descending).. // Date Updated (descending).. case 'rev_desc': $oft = 'ORDER BY `lastrevision` desc'; break; // Date Added (ascending).. // Date Added (ascending).. case 'date_asc': $oft = 'ORDER BY `' . DB_PREFIX . 'tickets`.`ts`'; break; // Date Added (descending).. // Date Added (descending).. case 'date_desc': $oft = 'ORDER BY `' . DB_PREFIX . 'tickets`.`ts` desc'; break; } } // Service level and department filters.. if (isset($_GET['filter'])) { $qft[] = 'AND `priority` = \'' . mswSafeImportString($_GET['filter']) . '\''; } if (isset($_GET['dept'])) { $qft[] = 'AND `department` = \'' . mswSafeImportString($_GET['dept']) . '\''; } $lWrap = file_get_contents(PATH . 'content/' . MS_TEMPLATE_SET . '/html/tickets/tickets-last-reply-date.htm'); $q = mysql_query("SELECT SQL_CALC_FOUND_ROWS *,\n `" . DB_PREFIX . "tickets`.`id` AS `ticketID`,\n\t\t `" . DB_PREFIX . "tickets`.`ts` AS `ticketStamp`,\n\t `" . DB_PREFIX . "portal`.`name` AS `ticketName`,\n\t `" . DB_PREFIX . "departments`.`name` AS `deptName`,\n\t `" . DB_PREFIX . "levels`.`name` AS `levelName`\n\t\t FROM `" . DB_PREFIX . "tickets`\n\t\t LEFT JOIN `" . DB_PREFIX . "departments`\n\t ON `" . DB_PREFIX . "tickets`.`department` = `" . DB_PREFIX . "departments`.`id`\n\t\t LEFT JOIN `" . DB_PREFIX . "portal`\n\t ON `" . DB_PREFIX . "tickets`.`visitorID` = `" . DB_PREFIX . "portal`.`id`\n\t LEFT JOIN `" . DB_PREFIX . "levels`\n\t ON `" . DB_PREFIX . "tickets`.`priority` = `" . DB_PREFIX . "levels`.`id`\n\t OR `" . DB_PREFIX . "tickets`.`priority` = `" . DB_PREFIX . "levels`.`marker`\n WHERE `" . DB_PREFIX . "portal`.`email` = '{$email}'\n\t\t AND `isDisputed` = 'no'\n\t\t AND `spamFlag` = 'no'\n\t\t " . $queryAdd . "\n\t\t " . (!empty($qft) ? implode(mswDefineNewline(), $qft) : '') . "\n {$oft}\n\t\t LIMIT " . $lv[0] . "," . $lv[1] . "\n ") or die(mswMysqlErrMsg(mysql_errno(), mysql_error(), __LINE__, __FILE__)); if ($count) { $c = mysql_fetch_object(mysql_query("SELECT FOUND_ROWS() AS `rows`")); return isset($c->rows) ? $c->rows : '0'; } while ($T = mysql_fetch_object($q)) { $last = tickets::getLastReply($T->ticketID); // Ticket starter.. $starter = mswSpecialChars($T->ticketName); $lastRep = ''; $replyBy = '- - - -'; if ($last[0] != '0') { $lastRep = str_replace(array('{date}', '{time}'), array($this->datetime->mswDateTimeDisplay($last[1], $this->settings->dateformat), $this->datetime->mswDateTimeDisplay($last[1], $this->settings->timeformat)), $lWrap); $replyBy = $last[0]; } $data .= str_replace(array('{ticket_id}', '{subject}', '{priority}', '{dept}', '{started_by}', '{url}', '{text_alt}', '{start_date}', '{start_time}', '{last_reply}', '{status}', '{icon}', '{users_in_dispute}', '{view}', '{last_reply_dashboard}'), array(mswTicketNumber($T->ticketID), mswSpecialChars($T->subject), tickets::levels($T->priority), $this->system->department($T->department, $msg_script30), $starter, '?t=' . $T->ticketID, mswCleanData($msg_portal8), $this->datetime->mswDateTimeDisplay($T->ticketStamp, $this->settings->dateformat), $this->datetime->mswDateTimeDisplay($T->ticketStamp, $this->settings->timeformat), $replyBy . $lastRep, $T->ticketStatus == 'open' ? $msg_showticket23 : $msg_showticket24, $T->ticketStatus == 'open' ? 'eye-open' : 'eye-close', '', $msg_public_dashboard6, tickets::dashboardStatus($T, 'no')), file_get_contents(PATH . 'content/' . MS_TEMPLATE_SET . '/html/tickets/' . ($queryAdd ? 'tickets-dashboard' : 'ticket-list-entry') . '.htm')); } return $data ? trim($data) : str_replace('{text}', $sch ? $msg_portal21 : ($queryAdd ? $msg_public_dashboard7 : $msg_portal7), file_get_contents(PATH . 'content/' . MS_TEMPLATE_SET . '/html/tickets/tickets-no-data.htm')); }
} } // If something happened, lets inform the original ticket creator.. if ($count > 0 && !empty($new)) { $pLang = ''; if ($USER->language && file_exists(LANG_BASE_PATH . $USER->language . '/mail-templates/html-wrapper.html')) { $pLang = $USER->language; } $MSMAIL->addTag('{NAME}', $USER->name); $MSMAIL->addTag('{TITLE}', $TICKET->subject); $MSMAIL->addTag('{PEOPLE}', implode(mswDefineNewline(), $new)); $MSMAIL->addTag('{ID}', $tickID); $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => $SETTINGS->website, 'to_email' => $USER->email, 'to_name' => $USER->name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($tickID)), $emailSubjects['dispute-notify']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => LANG_PATH . 'admin-dispute-notification.txt', 'language' => $pLang ? $pLang : $SETTINGS->language, 'alive' => 'yes')); } } $OK1 = true; } // Remove users.. if (isset($_POST['removeusers']) && isset($_GET['disputeUsers']) && USER_DEL_PRIV == 'yes') { $MSTICKET->removeDisputeUsersFromTicket($msg_ticket_history['dis-user-rem']); $OK2 = true; } // Department check.. if (mswDeptPerms($MSTEAM->id, $SUPTICK->department, $userDeptAccess) == 'fail') { $HEADERS->err403(true); } $title = $msg_disputes8 . ' (#' . mswTicketNumber($_GET['disputeUsers']) . ')'; $loadJQAlertify = true; include PATH . 'templates/header.php'; include PATH . 'templates/system/tickets/tickets-dispute-users.php'; include PATH . 'templates/footer.php';
<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]--> <!--[if IE 7 ]> <body class="ie ie7"> <![endif]--> <!--[if IE 8 ]> <body class="ie ie8"> <![endif]--> <!--[if IE 9 ]> <body class="ie ie9"> <![endif]--> <!--[if (gt IE 9)|!(IE)]><!--> <body class=""> <!--<![endif]--> <div class="block"> <p class="block-heading"><?php echo strtoupper($msg_viewticket99); ?> (#<?php echo mswTicketNumber($SUPTICK->id); ?> )</p> <div class="notesPopup"> <textarea name="notes" rows="8" cols="40" id="notes"><?php echo mswSpecialChars($SUPTICK->ticketNotes); ?> </textarea> <div class="btn-toolbar" style="margin-top:0;padding-top:0;text-align:center"> <button class="btn btn-primary" type="button" onclick="ms_updateTicketNotes('<?php echo $SUPTICK->id; ?> ')"><i class="icon-ok"></i> <?php
</thead> <tbody> <?php if (mysql_num_rows($q) > 0) { while ($TICKETS = mysql_fetch_object($q)) { $last = $MSPTICKETS->getLastReply($TICKETS->ticketID); ?> <tr> <td><a href="?p=view-ticket&id=<?php echo $TICKETS->ticketID; ?> " title="<?php echo mswSpecialChars($msg_viewticket11); ?> "><?php echo mswTicketNumber($TICKETS->ticketID); ?> </a> <span class="ticketPriority"><?php echo mswCleanData($TICKETS->levelName); ?> </span> </td> <td onmouseover="jQuery('#icon_panel_<?php echo $TICKETS->ticketID; ?> ').show()" onmouseout="jQuery('#icon_panel_<?php echo $TICKETS->ticketID; ?> ').hide()"><?php echo mswSpecialChars($TICKETS->subject);
if (isset($GLOBAL->name)) { $MSMAIL->addTag('{NAME}', $GLOBAL->name); $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => $SETTINGS->website, 'to_email' => $GLOBAL->email, 'to_name' => $GLOBAL->name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($ID)), $emailSubjects['new-ticket']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => PATH . 'content/language/' . $SETTINGS->language . '/mail-templates/new-ticket-admin.txt', 'language' => $SETTINGS->language, 'alive' => 'yes', 'add-emails' => $GLOBAL->email2)); } // Send auto responder to person who opened ticket.. if (!defined('NEW_ACC_CREATION') && file_exists(LANG_PATH . 'mail-templates/new-ticket-visitor.txt')) { $mailT = LANG_PATH . 'mail-templates/new-ticket-visitor.txt'; $pLang = $LI_ACC->language; } else { $mailT = PATH . 'content/language/' . $SETTINGS->language . '/mail-templates/new-ticket-visitor.txt'; } $MSMAIL->addTag('{NAME}', $name); $MSMAIL->sendMSMail(array('from_email' => $SETTINGS->email, 'from_name' => $SETTINGS->website, 'to_email' => $email, 'to_name' => $name, 'subject' => str_replace(array('{website}', '{ticket}'), array($SETTINGS->website, mswTicketNumber($ID)), $emailSubjects['new-ticket-vis']), 'replyto' => array('name' => $SETTINGS->website, 'email' => $SETTINGS->replyto ? $SETTINGS->replyto : $SETTINGS->email), 'template' => $mailT, 'language' => isset($pLang) ? $pLang : $SETTINGS->language)); // Write history log.. $MSTICKET->historyLog($ID, str_replace(array('{visitor}'), array($name), $msg_ticket_history['new-ticket-visitor'])); // All done..show relevant message.. $title = $msg_main2; include PATH . 'control/header.php'; $tpl = new Savant3(); $tpl->assign('TXT', array($msg_public_ticket4, $msg_newticket13, str_replace(array('{ticket}', '{ticket_long}'), array($ID, mswTicketNumber($ID)), $msg_public_ticket5), $msg_public_ticket6)); $tpl->assign('ADD_TXT', $pass ? str_replace(array('{email}', '{pass}'), array($email, $pass), $msg_public_ticket7) : ''); $tpl->assign('ID', $ID); // Global vars.. include PATH . 'control/lib/global.php'; $tpl->display('content/' . MS_TEMPLATE_SET . '/ticket-create-message.tpl.php'); include PATH . 'control/footer.php'; exit; } } } }