Bootswatch, Summernote, and Captcheck mods for Mods for HESK (mods-for-hesk.com). In use at support.netsyms.com.
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775
  1. <?php
  2. /**
  3. *
  4. * This file is part of HESK - PHP Help Desk Software.
  5. *
  6. * (c) Copyright Klemen Stirn. All rights reserved.
  7. * https://www.hesk.com
  8. *
  9. * For the full copyright and license agreement information visit
  10. * https://www.hesk.com/eula.php
  11. *
  12. */
  13. define('IN_SCRIPT', 1);
  14. define('HESK_PATH', './');
  15. define('HESK_NO_ROBOTS', 1);
  16. define('WYSIWYG', 1);
  17. define('VALIDATOR', 1);
  18. define('PAGE_TITLE', 'CUSTOMER_TICKET');
  19. /* Get all the required files and functions */
  20. require(HESK_PATH . 'hesk_settings.inc.php');
  21. require(HESK_PATH . 'inc/common.inc.php');
  22. require(HESK_PATH . 'inc/view_attachment_functions.inc.php');
  23. hesk_load_database_functions();
  24. /* Connect to database */
  25. hesk_dbConnect();
  26. // Are we in maintenance mode?
  27. hesk_check_maintenance();
  28. hesk_session_start();
  29. $modsForHesk_settings = mfh_getSettings();
  30. $hesk_error_buffer = array();
  31. $do_remember = '';
  32. $display = 'none';
  33. /* A message from ticket reminder? */
  34. if ( ! empty($_GET['remind']) )
  35. {
  36. $display = 'block';
  37. print_form();
  38. }
  39. // Do we have parameters in query string? If yes, store them in session and redirect
  40. if ( isset($_GET['track']) || isset($_GET['e']) || isset($_GET['f']) || isset($_GET['r']) )
  41. {
  42. $_SESSION['t_track'] = hesk_GET('track');
  43. $_SESSION['t_email'] = hesk_getCustomerEmail(1);
  44. $_SESSION['t_form'] = hesk_GET('f');
  45. $_SESSION['t_remember'] = strlen($do_remember) ? 'Y' : hesk_GET('r');
  46. header('Location: ticket.php');
  47. die();
  48. }
  49. /* Was this accessed by the form or link? */
  50. $is_form = hesk_SESSION('t_form');
  51. /* Get the tracking ID */
  52. $trackingID = hesk_cleanID('', hesk_SESSION('t_track'));
  53. /* Email required to view ticket? */
  54. $my_email = hesk_getCustomerEmail(1, 't_email');
  55. /* Remember email address? */
  56. $do_remember = strlen($do_remember) || strlen(hesk_SESSION('t_remember')) ? ' checked="checked" ' : '';
  57. /* Clean ticket parameters from the session data, we don't need them anymore */
  58. hesk_cleanSessionVars( array('t_track', 't_email', 't_form', 't_remember') );
  59. /* Any errors? Show the form */
  60. if ($is_form) {
  61. if (empty($trackingID)) {
  62. $hesk_error_buffer[] = $hesklang['eytid'];
  63. }
  64. if ($hesk_settings['email_view_ticket'] && empty($my_email)) {
  65. $hesk_error_buffer[] = $hesklang['enter_valid_email'];
  66. }
  67. $tmp = count($hesk_error_buffer);
  68. if ($tmp == 1) {
  69. $hesk_error_buffer = implode('', $hesk_error_buffer);
  70. hesk_process_messages($hesk_error_buffer, 'NOREDIRECT');
  71. print_form();
  72. } elseif ($tmp == 2) {
  73. $hesk_error_buffer = $hesklang['pcer'] . '<br /><br /><ul><li>' . $hesk_error_buffer[0] . '</li><li>' . $hesk_error_buffer[1] . '</li></ul>';
  74. hesk_process_messages($hesk_error_buffer, 'NOREDIRECT');
  75. print_form();
  76. }
  77. } elseif (empty($trackingID) || ($hesk_settings['email_view_ticket'] && empty($my_email))) {
  78. print_form();
  79. }
  80. /* Limit brute force attempts */
  81. hesk_limitBfAttempts();
  82. require_once(HESK_PATH . 'inc/custom_fields.inc.php');
  83. /* Get ticket info */
  84. $res = hesk_dbQuery("SELECT `t1`.* , `t2`.name AS `repliername`, `ticketStatus`.`IsClosed` AS `isClosed`, `ticketStatus`.`Key` AS `statusKey` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` AS `t1` INNER JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` AS `ticketStatus` ON `t1`.`status` = `ticketStatus`.`ID` LEFT JOIN `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` AS `t2` ON `t1`.`replierid` = `t2`.`id` WHERE `trackid`='" . hesk_dbEscape($trackingID) . "' LIMIT 1");
  85. /* Ticket found? */
  86. if (hesk_dbNumRows($res) != 1) {
  87. /* Ticket not found, perhaps it was merged with another ticket? */
  88. $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` WHERE `merged` LIKE '%#" . hesk_dbEscape($trackingID) . "#%' LIMIT 1");
  89. if (hesk_dbNumRows($res) == 1) {
  90. /* OK, found in a merged ticket. Get info */
  91. $ticket = hesk_dbFetchAssoc($res);
  92. /* If we require e-mail to view tickets check if it matches the one from merged ticket */
  93. if (hesk_verifyEmailMatch($ticket['trackid'], $my_email, $ticket['email'], 0)) {
  94. hesk_process_messages(sprintf($hesklang['tme'], $trackingID, $ticket['trackid']), 'NOREDIRECT', 'NOTICE');
  95. $trackingID = $ticket['trackid'];
  96. } else {
  97. hesk_process_messages(sprintf($hesklang['tme1'], $trackingID, $ticket['trackid']) . '<br /><br />' . sprintf($hesklang['tme2'], $ticket['trackid']), 'NOREDIRECT', 'NOTICE');
  98. $trackingID = $ticket['trackid'];
  99. print_form();
  100. }
  101. } else {
  102. /* Nothing found, error out */
  103. hesk_process_messages($hesklang['ticket_not_found'], 'NOREDIRECT');
  104. print_form();
  105. }
  106. } else {
  107. /* We have a match, get ticket info */
  108. $ticket = hesk_dbFetchAssoc($res);
  109. /* If we require e-mail to view tickets check if it matches the one in database */
  110. hesk_verifyEmailMatch($trackingID, $my_email, $ticket['email']);
  111. }
  112. /* Ticket exists, clean brute force attempts */
  113. hesk_cleanBfAttempts();
  114. /* Remember email address? */
  115. if ($is_form) {
  116. if ( strlen($do_remember) ) {
  117. hesk_setcookie('hesk_myemail', $my_email, strtotime('+1 year'));
  118. } elseif (isset($_COOKIE['hesk_myemail'])) {
  119. hesk_setcookie('hesk_myemail', '');
  120. }
  121. }
  122. /* Set last replier name */
  123. if ($ticket['lastreplier']) {
  124. if (empty($ticket['repliername'])) {
  125. $ticket['repliername'] = $hesklang['staff'];
  126. }
  127. } else {
  128. $ticket['repliername'] = $ticket['name'];
  129. }
  130. // If IP is unknown (tickets via email pipe/pop3 fetching) assume current visitor IP as customer IP
  131. if ($ticket['ip'] == '' || $ticket['ip'] == 'Unknown' || $ticket['ip'] == $hesklang['unknown']) {
  132. hesk_dbQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."tickets` SET `ip` = '".hesk_dbEscape(hesk_getClientIP())."' WHERE `id`=".intval($ticket['id']));
  133. }
  134. /* Get category name and ID */
  135. $result = hesk_dbQuery("SELECT `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='" . intval($ticket['category']) . "' LIMIT 1");
  136. /* If this category has been deleted use the default category with ID 1 */
  137. if (hesk_dbNumRows($result) != 1) {
  138. $result = hesk_dbQuery("SELECT `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `id`='1' LIMIT 1");
  139. }
  140. $category = hesk_dbFetchAssoc($result);
  141. /* Get replies */
  142. $result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` WHERE `replyto`='" . intval($ticket['id']) . "' ORDER BY `id` " . ($hesk_settings['new_top'] ? 'DESC' : 'ASC'));
  143. $replies = hesk_dbNumRows($result);
  144. $unread_replies = array();
  145. // Demo mode
  146. if (defined('HESK_DEMO')) {
  147. $ticket['email'] = 'hidden@demo.com';
  148. }
  149. /* Print header */
  150. require_once(HESK_PATH . 'inc/header.inc.php');
  151. ?>
  152. <ol class="breadcrumb">
  153. <li><a href="<?php echo $hesk_settings['site_url']; ?>"><?php echo $hesk_settings['site_title']; ?></a></li>
  154. <li><a href="<?php echo $hesk_settings['hesk_url']; ?>"><?php echo $hesk_settings['hesk_title']; ?></a></li>
  155. <li><a href="ticket.php"><?php echo $hesklang['view_ticket_nav']; ?></a></li>
  156. <li class="active"><?php hesk_showTopBar($hesklang['cid'] . ': ' . $trackingID); ?></li>
  157. </ol>
  158. <?php
  159. $columnWidth = 'col-md-8';
  160. $showRs = hesk_dbQuery("SELECT `show` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` WHERE `id` = 3");
  161. $show = hesk_dbFetchAssoc($showRs);
  162. if (!$show['show']) {
  163. $columnWidth = 'col-md-10 col-md-offset-1';
  164. }
  165. ?>
  166. <div class="row">
  167. <?php if ($columnWidth == 'col-md-8'): ?>
  168. <div align="left" class="col-md-4">
  169. <div class="panel panel-default">
  170. <div class="panel-heading"><?php echo $hesklang['quick_help']; ?></div>
  171. <div class="panel-body">
  172. <p><?php echo $hesklang['quick_help_ticket']; ?></p>
  173. </div>
  174. </div>
  175. </div>
  176. <?php endif; ?>
  177. <div class="<?php echo $columnWidth; ?>">
  178. <?php
  179. /* This will handle error, success and notice messages */
  180. hesk_handle_messages();
  181. /*
  182. * If the ticket has been reopened by customer:
  183. * - show the "Add a reply" form on top
  184. * - and ask them why the form has been reopened
  185. */
  186. if (isset($_SESSION['force_form_top'])) {
  187. hesk_printCustomerReplyForm(1);
  188. echo ' <p>&nbsp;</p> ';
  189. unset($_SESSION['force_form_top']);
  190. }
  191. ?>
  192. <h3 align="left"><?php echo $hesklang['view_ticket']; ?>: <?php
  193. if ($hesk_settings['sequential']) {
  194. echo $trackingID . ' (' . $hesklang['seqid'] . ': ' . $ticket['id'] . ')';
  195. } else {
  196. echo $trackingID;
  197. }
  198. ?></h3>
  199. <div class="footerWithBorder"></div>
  200. <div class="blankSpace"></div>
  201. <div class="table-bordered">
  202. <div class="row">
  203. <div class="col-md-10">
  204. <h2><?php echo $ticket['subject']; ?></h2>
  205. </div>
  206. <div class="col-md-2 pull-right pad-down-20">
  207. <a href="ticket.php?track=<?php echo $trackingID.$hesk_settings['e_query']; ?>">
  208. <i class="fa fa-refresh"></i>
  209. <?php echo $hesklang['refresh_page']; ?>
  210. </a>
  211. </div>
  212. </div>
  213. <div class="row">
  214. <div class="col-md-3 col-sm-12">
  215. <p><?php echo $hesklang['created_on']; ?>: <?php echo hesk_date($ticket['dt'], true); ?></p>
  216. </div>
  217. <div class="col-md-3 col-sm-12">
  218. <p><?php echo $hesklang['last_update']; ?>
  219. : <?php echo hesk_date($ticket['lastchange'], true); ?></p>
  220. </div>
  221. <div class="col-md-2 col-md-offset-4 col-sm-12 close-ticket">
  222. <p><?php
  223. $statusRS = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'statuses` WHERE `ID` = ' . intval($ticket['status']));
  224. $status = hesk_dbFetchAssoc($statusRS);
  225. $isClosable = $status['Closable'] == 'yes' || $status['Closable'] == 'conly';
  226. $random = rand(10000, 99999);
  227. if (!$ticket['locked']) {
  228. if ($ticket['isClosed'] == true && $hesk_settings['custopen']) {
  229. echo '<a href="change_status.php?track=' . $trackingID . $hesk_settings['e_query'] . '&amp;s=2&amp;Refresh=' . $random . '&amp;token=' . hesk_token_echo(0) . '" title="' . $hesklang['open_action'] . '">' . $hesklang['open_action'] . '</a>';
  230. } elseif ($hesk_settings['custclose'] && $isClosable) {
  231. echo '<a href="change_status.php?track=' . $trackingID . $hesk_settings['e_query'] . '&amp;s=3&amp;Refresh=' . $random . '&amp;token=' . hesk_token_echo(0) . '" title="' . $hesklang['close_action'] . '">' . $hesklang['close_action'] . '</a>';
  232. }
  233. }
  234. ?>
  235. </p>
  236. </div>
  237. </div>
  238. <div class="row medLowPriority">
  239. <?php //This entire conditional is all just for priority
  240. if ($hesk_settings['cust_urgency']) {
  241. $repliesColumnWidth = 2;
  242. echo '<div class="col-md-2 col-sm-12 ticket-cell ';
  243. if ($ticket['priority'] == 0) {
  244. echo 'criticalPriority">';
  245. } elseif ($ticket['priority'] == 1) {
  246. echo 'highPriority">';
  247. } else {
  248. echo 'medLowPriority">';
  249. }
  250. echo '<p class="ticketPropertyTitle">' . $hesklang['priority'] . '</p>';
  251. if ($ticket['priority'] == 0) {
  252. echo '<p class="ticketPropertyText">' . $hesklang['critical'] . '</p>';
  253. } elseif ($ticket['priority'] == 1) {
  254. echo '<p class="ticketPropertyText">' . $hesklang['high'] . '</p>';
  255. } elseif ($ticket['priority'] == 2) {
  256. echo '<p class="ticketPropertyText">' . $hesklang['medium'] . '</p>';
  257. } else {
  258. echo '<p class="ticketPropertyText">' . $hesklang['low'] . '</p>';
  259. }
  260. echo '</div>';
  261. } else {
  262. $repliesColumnWidth = 3;
  263. }
  264. echo '<div class="col-md-3 col-sm-12 ticket-cell"><p class="ticketPropertyTitle">' . $hesklang['status'] . '</p>';
  265. echo '<p class="ticketPropertyText">' . mfh_getDisplayTextForStatusId($status['ID']) . '</p>';
  266. echo '</div>';
  267. echo '<div class="col-md-3 col-sm-12 ticket-cell"><p class="ticketPropertyTitle">' . $hesklang['last_replier'] . '</p>
  268. <p class="ticketPropertyText">' . $ticket['repliername'] . '</p></div>';
  269. echo '<div class="col-md-' . $repliesColumnWidth . ' col-sm-12 ticket-cell"><p class="ticketPropertyTitle">' . $hesklang['category'] . '</p>
  270. <p class="ticketPropertyText">' . $category['name'] . '</p></div>';
  271. echo '<div class="col-md-' . $repliesColumnWidth . ' col-sm-12 ticket-cell"><p class="ticketPropertyTitle">' . $hesklang['replies'] . '</p>
  272. <p class="ticketPropertyText">' . $replies . '</p></div>';
  273. ?>
  274. </div>
  275. </div>
  276. <div class="blankSpace"></div>
  277. <!-- REPLIES -->
  278. <?php
  279. // Print "Submit a reply" form?
  280. if ($ticket['locked'] != 1 && $ticket['status'] != 3 && $hesk_settings['reply_top'] == 1) {
  281. hesk_printCustomerReplyForm();
  282. }
  283. if ($hesk_settings['new_top']) {
  284. $i = hesk_printCustomerTicketReplies() ? 0 : 1;
  285. } else {
  286. $i = 1;
  287. }
  288. /* Make sure original message is in correct color if newest are on top */
  289. $color = 'class="ticketMessageContainer"';
  290. ?>
  291. <div class="row ticketMessageContainer">
  292. <div class="col-md-3 col-xs-12">
  293. <div class="ticketName"><?php echo $ticket['name']; ?></div>
  294. <?php if ($ticket['email'] != '') { ?>
  295. <div class="ticketEmail"><a href="mailto:<?php echo $ticket['email']; ?>"><?php echo $ticket['email']; ?></a></div>
  296. <?php } ?>
  297. </div>
  298. <div class="col-md-9 col-xs-12 pushMarginLeft">
  299. <div class="ticketMessageTop withBorder">
  300. <!-- Date and Action buttons -->
  301. <p><?php echo $hesklang['date']; ?>: <?php echo hesk_date($ticket['dt'], true); ?><span
  302. class="nu-floatRight"><?php echo hesk_getCustomerButtons($i); ?></span></p>
  303. <!-- Custom Fields Before Message -->
  304. <?php
  305. foreach ($hesk_settings['custom_fields'] as $k => $v) {
  306. if ($v['use'] == 1 && $v['place'] == 0 && hesk_is_custom_field_in_category($k, $ticket['category'])) {
  307. echo '<p>' . $v['name'] . ': ';
  308. switch ($v['type'])
  309. {
  310. case 'email':
  311. $ticket[$k] = '<a href="mailto:'.$ticket[$k].'">'.$ticket[$k].'</a>';
  312. break;
  313. case 'date':
  314. $ticket[$k] = hesk_custom_date_display_format($ticket[$k], $v['value']['date_format']);
  315. break;
  316. }
  317. echo $ticket[$k].'</p>';
  318. }
  319. }
  320. ?>
  321. </div>
  322. <div class="ticketMessageBottom">
  323. <?php if ($ticket['message'] != '') { ?>
  324. <!-- Message -->
  325. <p><b><?php echo $hesklang['message']; ?>:</b></p>
  326. <div class="message">
  327. <?php if ($ticket['html']) {
  328. echo hesk_html_entity_decode($ticket['message']);
  329. } else {
  330. echo $ticket['message'];
  331. }
  332. ?>
  333. </div>
  334. <?php } ?>
  335. </div>
  336. <div class="ticketMessageTop">
  337. <!-- Custom Fields after Message -->
  338. <?php
  339. foreach ($hesk_settings['custom_fields'] as $k => $v) {
  340. if ($v['use'] == 1 && $v['place'] && hesk_is_custom_field_in_category($k, $ticket['category'])) {
  341. echo '<p>' . $v['name'] . ': ';
  342. switch ($v['type'])
  343. {
  344. case 'email':
  345. $ticket[$k] = '<a href="mailto:'.$ticket[$k].'">'.$ticket[$k].'</a>';
  346. break;
  347. case 'date':
  348. $ticket[$k] = hesk_custom_date_display_format($ticket[$k], $v['value']['date_format']);
  349. break;
  350. }
  351. echo $ticket[$k].'</p>';
  352. }
  353. }
  354. /* Attachments */
  355. mfh_listAttachments($ticket['attachments'], $i, false);
  356. ?>
  357. </div>
  358. </div>
  359. </div>
  360. <?php
  361. if (!$hesk_settings['new_top']) {
  362. hesk_printCustomerTicketReplies();
  363. }
  364. ?>
  365. <!-- END REPLIES -->
  366. <?php
  367. /* Print "Submit a reply" form? */
  368. if ($ticket['locked'] != 1 && $ticket['status'] != 3 && !$hesk_settings['reply_top']) {
  369. hesk_printCustomerReplyForm();
  370. }
  371. /* If needed update unread replies as read for staff to know */
  372. if (count($unread_replies)) {
  373. hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "replies` SET `read` = '1' WHERE `id` IN ('" . implode("','", $unread_replies) . "')");
  374. }
  375. ?>
  376. </div>
  377. <!-- End col-md-7 -->
  378. </div> <!-- End row -->
  379. <?php
  380. /* Clear unneeded session variables */
  381. hesk_cleanSessionVars('ticket_message');
  382. require_once(HESK_PATH . 'inc/footer.inc.php');
  383. /*** START FUNCTIONS ***/
  384. function print_form()
  385. {
  386. global $hesk_settings, $hesklang;
  387. global $hesk_error_buffer, $my_email, $trackingID, $do_remember, $display;
  388. /* Print header */
  389. $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['view_ticket'];
  390. require_once(HESK_PATH . 'inc/header.inc.php');
  391. ?>
  392. <ol class="breadcrumb">
  393. <li><a href="<?php echo $hesk_settings['site_url']; ?>"><?php echo $hesk_settings['site_title']; ?></a></li>
  394. <li><a href="<?php echo $hesk_settings['hesk_url']; ?>"><?php echo $hesk_settings['hesk_title']; ?></a></li>
  395. <li class="active"><?php echo $hesklang['view_ticket_nav']; ?></li>
  396. </ol>
  397. <?php
  398. hesk_dbConnect();
  399. $columnWidth = 'col-md-8';
  400. $showRs = hesk_dbQuery("SELECT `show` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` WHERE `id` = 2");
  401. $show = hesk_dbFetchAssoc($showRs);
  402. if (!$show['show']) {
  403. $columnWidth = 'col-md-10 col-md-offset-1';
  404. }
  405. ?>
  406. <div class="row">
  407. <?php if ($columnWidth == 'col-md-8'): ?>
  408. <div align="left" class="col-md-4">
  409. <div class="panel panel-default">
  410. <div class="panel-heading">
  411. <?php echo $hesklang['quick_help']; ?>
  412. </div>
  413. <div class="panel-body">
  414. <p><?php echo $hesklang['quick_help_view_ticket']; ?></p>
  415. </div>
  416. </div>
  417. </div>
  418. <?php endif; ?>
  419. <div class="<?php echo $columnWidth; ?>">
  420. <?php
  421. /* This will handle error, success and notice messages */
  422. hesk_handle_messages();
  423. ?>
  424. <h3 align="left"><?php echo $hesklang['view_existing']; ?></h3>
  425. <div class="footerWithBorder"></div>
  426. <div class="blankSpace"></div>
  427. <form data-toggle="validator" action="ticket.php" class="form-horizontal" role="form" method="get" name="form2">
  428. <div class="form-group">
  429. <label for="track" class="col-sm-3 control-label"><?php echo $hesklang['ticket_trackID']; ?></label>
  430. <div class="col-sm-9">
  431. <input type="text" class="form-control" name="track" id="track" maxlength="20" size="35"
  432. value="<?php echo $trackingID; ?>"
  433. placeholder="<?php echo htmlspecialchars($hesklang['ticket_trackID']); ?>"
  434. data-error="<?php echo htmlspecialchars($hesklang['eytid']); ?>" required>
  435. <div class="help-block with-errors"></div>
  436. </div>
  437. </div>
  438. <?php
  439. $tmp = '';
  440. if ($hesk_settings['email_view_ticket']) {
  441. $tmp = 'document.form1.email.value=document.form2.e.value;';
  442. ?>
  443. <div class="form-group">
  444. <label for="e" class="col-sm-3 control-label"><?php echo $hesklang['email']; ?></label>
  445. <div class="col-sm-9">
  446. <input type="text" class="form-control" id="e" name="e" size="35"
  447. value="<?php echo $my_email; ?>"
  448. placeholder="<?php echo htmlspecialchars($hesklang['email']); ?>"
  449. data-error="<?php echo htmlspecialchars($hesklang['enter_valid_email']); ?>" required>
  450. <div class="help-block with-errors"></div>
  451. </div>
  452. </div>
  453. <div align="left" class="form-group">
  454. <div class="col-sm-offset-3 col-sm-9">
  455. <div class="checkbox">
  456. <label>
  457. <input type="checkbox" name="r"
  458. value="Y" <?php echo $do_remember; ?> /> <?php echo $hesklang['rem_email']; ?>
  459. </label>
  460. </div>
  461. </div>
  462. </div>
  463. <?php } ?>
  464. <div align="left" class="form-group">
  465. <div class="col-sm-offset-3 col-sm-9">
  466. <button type="submit" class="btn btn-default"
  467. value="<?php echo $hesklang['view_ticket']; ?>"><?php echo $hesklang['view_ticket']; ?></button>
  468. <input type="hidden" name="Refresh" value="<?php echo rand(10000, 99999); ?>"><input
  469. type="hidden" name="f" value="1">
  470. <div class="blankSpace"></div>
  471. <a href="Javascript:void(0)"
  472. onclick="javascript:hesk_toggleLayerDisplay('forgot');<?php echo $tmp; ?>"><?php echo $hesklang['forgot_tid']; ?></a>
  473. </div>
  474. </div>
  475. </form>
  476. <div align="left" id="forgot" class="alert alert-info" style="display: <?php echo $display; ?>;">
  477. <p><?php echo $hesklang['tid_mail']; ?></p>
  478. <div class="blankSpace"></div>
  479. <form data-toggle="validator" action="index.php" method="post" class="form-horizontal" name="form1">
  480. <div class="form-group">
  481. <label for="email" class="col-sm-3 control-label"><?php echo $hesklang['email']; ?></label>
  482. <div class="col-sm-9">
  483. <input type="text" id="email" class="form-control" name="email" size="35"
  484. value="<?php echo $my_email; ?>"
  485. placeholder="<?php echo htmlspecialchars($hesklang['email']); ?>"
  486. data-error="<?php echo htmlspecialchars($hesklang['enter_valid_email']); ?>" required>
  487. <div class="help-block with-errors"></div>
  488. <input type="hidden" name="a" value="forgot_tid"/>
  489. </div>
  490. </div>
  491. <div class="form-group">
  492. <div class="col-sm-9 col-sm-offset-3">
  493. <div class="radio">
  494. <label>
  495. <input type="radio" name="open_only"
  496. value="1" <?php echo $hesk_settings['open_only'] ? 'checked="checked"' : ''; ?> /><?php echo $hesklang['oon1']; ?>
  497. </label>
  498. </div>
  499. <div class="radio">
  500. <label>
  501. <input type="radio" name="open_only"
  502. value="0" <?php echo !$hesk_settings['open_only'] ? 'checked="checked"' : ''; ?> /><?php echo $hesklang['oon2']; ?>
  503. </label>
  504. </div>
  505. </div>
  506. </div>
  507. <div class="form-group">
  508. <div class="col-sm-offset-3 col-sm-9">
  509. <button type="submit" class="btn btn-default"
  510. value="<?php echo $hesklang['tid_send']; ?>"><?php echo $hesklang['tid_send']; ?></button>
  511. </div>
  512. </div>
  513. </form>
  514. </div>
  515. </div>
  516. </div>
  517. <?php
  518. require_once(HESK_PATH . 'inc/footer.inc.php');
  519. exit();
  520. } // End print_form()
  521. function hesk_printCustomerReplyForm($reopen = 0)
  522. {
  523. global $hesklang, $hesk_settings, $trackingID, $my_email, $modsForHesk_settings;
  524. // Already printed?
  525. if (defined('REPLY_FORM')) {
  526. return '';
  527. }
  528. ?>
  529. <h3 class="text-left"><?php echo $hesklang['add_reply']; ?></h3>
  530. <div class="footerWithBorder"></div>
  531. <div class="blankSpace"></div>
  532. <?php
  533. $onsubmit = '';
  534. if ($modsForHesk_settings['rich_text_for_tickets_for_customers']) {
  535. $onsubmit = 'onclick="return validateRichText(\'message-help-block\', \'message-group\', \'message\', \''.htmlspecialchars($hesklang['this_field_is_required']).'\')"';
  536. }
  537. ?>
  538. <form data-toggle="validator" role="form" class="form-horizontal" method="post" action="reply_ticket.php"
  539. enctype="multipart/form-data" <?php echo $onsubmit; ?>>
  540. <div class="form-group" id="message-group">
  541. <label for="message" class="col-sm-3 control-label"><?php echo $hesklang['message']; ?>: <span
  542. class="important">*</span></label>
  543. <div class="col-sm-9">
  544. <textarea name="message" class="form-control htmlEditor" rows="12"
  545. cols="60" data-error="<?php echo htmlspecialchars($hesklang['enter_message']); ?>" required><?php if (isset($_SESSION['ticket_message'])) {
  546. echo stripslashes(hesk_input($_SESSION['ticket_message']));
  547. } ?></textarea>
  548. <div class="help-block with-errors" id="message-help-block"></div>
  549. <?php if ($modsForHesk_settings['rich_text_for_tickets_for_customers']): ?>
  550. <script type="text/javascript">
  551. /* <![CDATA[ */
  552. tinyMCE.init({
  553. mode: "textareas",
  554. editor_selector: "htmlEditor",
  555. elements: "content",
  556. theme: "advanced",
  557. convert_urls: false,
  558. plugins: "autolink",
  559. theme_advanced_buttons1: "cut,copy,paste,|,undo,redo,|,formatselect,fontselect,fontsizeselect,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull",
  560. theme_advanced_buttons2: "sub,sup,|,charmap,|,bullist,numlist,|,outdent,indent,insertdate,inserttime,preview,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,link,unlink,anchor,image,cleanup",
  561. theme_advanced_buttons3: "",
  562. theme_advanced_toolbar_location: "top",
  563. theme_advanced_toolbar_align: "left",
  564. theme_advanced_statusbar_location: "bottom",
  565. theme_advanced_resizing: true
  566. });
  567. /* ]]> */
  568. </script>
  569. <?php endif; ?>
  570. </div>
  571. </div>
  572. <?php
  573. /* attachments */
  574. if ($hesk_settings['attachments']['use']) {
  575. ?>
  576. <div class="form-group">
  577. <label for="attachments" class="col-sm-3 control-label"><?php echo $hesklang['attachments']; ?>
  578. :</label>
  579. <div align="left" class="col-sm-9">
  580. <?php build_dropzone_markup(); ?>
  581. </div>
  582. </div>
  583. <?php
  584. display_dropzone_field(HESK_PATH . 'internal-api/ticket/upload-attachment.php');
  585. }
  586. ?>
  587. <input type="hidden" name="token" value="<?php hesk_token_echo(); ?>"/>
  588. <input type="hidden" name="orig_track" value="<?php echo $trackingID; ?>"/>
  589. <?php
  590. if ($hesk_settings['email_view_ticket']) {
  591. echo '<input type="hidden" name="e" value="' . $my_email . '" />';
  592. }
  593. if ($reopen) {
  594. echo '<input type="hidden" name="reopen" value="1" />';
  595. }
  596. ?>
  597. <div class="form-group">
  598. <div class="col-sm-9 col-sm-offset-3">
  599. <input type="submit" value="<?php echo $hesklang['submit_reply']; ?>" class="btn btn-default">
  600. </div>
  601. </div>
  602. </form>
  603. <?php
  604. // Make sure the form is only printed once per page
  605. define('REPLY_FORM', true);
  606. } // End hesk_printCustomerReplyForm()
  607. function hesk_printCustomerTicketReplies()
  608. {
  609. global $hesklang, $hesk_settings, $result, $reply, $trackingID, $unread_replies;
  610. $i = $hesk_settings['new_top'] ? 0 : 1;
  611. while ($reply = hesk_dbFetchAssoc($result)) {
  612. $color = 'class="ticketMessageContainer"';
  613. /* Store unread reply IDs for later */
  614. if ($reply['staffid'] && !$reply['read']) {
  615. $unread_replies[] = $reply['id'];
  616. }
  617. $reply['dt'] = hesk_date($reply['dt'], true);
  618. ?>
  619. <div class="row ticketMessageContainer">
  620. <div class="col-md-3 col-xs-12">
  621. <div class="ticketName"><?php echo $reply['name']; ?></div>
  622. </div>
  623. <div class="col-md-9 col-xs-12 pushMarginLeft">
  624. <div class="ticketMessageTop withBorder">
  625. <p><?php echo $hesklang['date']; ?>: <?php echo $reply['dt']; ?><span
  626. style="float: right;"><?php echo hesk_getCustomerButtons($i); ?></span></p>
  627. <?php
  628. /* Staff rating */
  629. if ($hesk_settings['rating'] && $reply['staffid']) {
  630. if ($reply['rating'] == 1) {
  631. echo '<p class="rate">' . $hesklang['rnh'] . '</p>';
  632. } elseif ($reply['rating'] == 5) {
  633. echo '<p class="rate">' . $hesklang['rh'] . '</p>';
  634. } else {
  635. echo '
  636. <div id="rating' . $reply['id'] . '" class="rate">
  637. ' . $hesklang['r'] . '
  638. <a href="Javascript:void(0)" onclick="Javascript:hesk_rate(\'rate.php?rating=5&amp;id=' . $reply['id'] . '&amp;track=' . $trackingID . '\',\'rating' . $reply['id'] . '\')">' . strtolower($hesklang['yes']) . '</a> /
  639. <a href="Javascript:void(0)" onclick="Javascript:hesk_rate(\'rate.php?rating=1&amp;id=' . $reply['id'] . '&amp;track=' . $trackingID . '\',\'rating' . $reply['id'] . '\')">' . strtolower($hesklang['no']) . '</a>
  640. </div>
  641. ';
  642. }
  643. }
  644. ?>
  645. </div>
  646. <div class="ticketMessageBottom">
  647. <!-- Message -->
  648. <p><b><?php echo $hesklang['message']; ?>:</b></p>
  649. <div class="message">
  650. <?php
  651. if ($reply['html']) {
  652. echo hesk_html_entity_decode($reply['message']);
  653. } else {
  654. echo $reply['message'];
  655. }
  656. ?>
  657. </div>
  658. </div>
  659. <div class="ticketMessageTop">
  660. <?php mfh_listAttachments($reply['attachments'], $i, false); ?>
  661. </div>
  662. </div>
  663. </div>
  664. <?php
  665. }
  666. return $i;
  667. } // End hesk_printCustomerTicketReplies()
  668. function hesk_getCustomerButtons($white = 1)
  669. {
  670. global $hesk_settings, $hesklang, $trackingID;
  671. $options = '';
  672. /* Style and mousover/mousout */
  673. $tmp = $white ? 'White' : 'Blue';
  674. $style = 'class="option' . $tmp . 'OFF" onmouseover="this.className=\'option' . $tmp . 'ON\'" onmouseout="this.className=\'option' . $tmp . 'OFF\'"';
  675. /* Print ticket button */
  676. $options .= '<a href="print.php?track=' . $trackingID . $hesk_settings['e_query'] . '" title="' . $hesklang['printer_friendly'] . '"><span class="glyphicon glyphicon-print"></span> ' . $hesklang['printer_friendly'] . ' </a> ';
  677. /* Return generated HTML */
  678. return $options;
  679. } // END hesk_getCustomerButtons()
  680. ?>