Bootswatch, Summernote, and Captcheck mods for Mods for HESK (mods-for-hesk.com). In use at support.netsyms.com.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1516 lines
69 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
7 years ago
7 years ago
5 years ago
7 years ago
5 years ago
7 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
7 years ago
7 years ago
5 years ago
7 years ago
5 years ago
7 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  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('WYSIWYG', 1);
  16. define('VALIDATOR', 1);
  17. // Get all the required files and functions
  18. require(HESK_PATH . 'hesk_settings.inc.php');
  19. require(HESK_PATH . 'inc/common.inc.php');
  20. require(HESK_PATH . 'inc/view_attachment_functions.inc.php');
  21. hesk_load_database_functions();
  22. hesk_dbConnect();
  23. // Are we in maintenance mode?
  24. hesk_check_maintenance();
  25. // Are we in "Knowledgebase only" mode?
  26. hesk_check_kb_only();
  27. $modsForHesk_settings = mfh_getSettings();
  28. // What should we do?
  29. $action = hesk_REQUEST('a');
  30. switch ($action) {
  31. case 'add':
  32. hesk_session_start();
  33. print_add_ticket();
  34. break;
  35. case 'forgot_tid':
  36. hesk_session_start();
  37. forgot_tid();
  38. break;
  39. default:
  40. print_start();
  41. }
  42. // Print footer
  43. require_once(HESK_PATH . 'inc/footer.inc.php');
  44. exit();
  45. /*** START FUNCTIONS ***/
  46. function print_select_category($number_of_categories)
  47. {
  48. global $hesk_settings, $hesklang;
  49. // Print header
  50. $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['select_category'];
  51. require_once(HESK_PATH . 'inc/header.inc.php');
  52. // A categoy needs to be selected
  53. if (isset($_GET['category']) && empty($_GET['category']))
  54. {
  55. hesk_process_messages($hesklang['sel_app_cat'],'NOREDIRECT','NOTICE');
  56. }
  57. ?>
  58. <ol class="breadcrumb">
  59. <li><a href="<?php echo $hesk_settings['site_url']; ?>"><?php echo $hesk_settings['site_title']; ?></a></li>
  60. <li><a href="<?php echo $hesk_settings['hesk_url']; ?>"><?php echo $hesk_settings['hesk_title']; ?></a></li>
  61. <li class="active"><?php echo $hesklang['submit_ticket']; ?></li>
  62. </ol>
  63. <?php
  64. /* This will handle error, success and notice messages */
  65. hesk_handle_messages();
  66. ?>
  67. <div style="text-align: center">
  68. <h3><?php echo $hesklang['select_category_text']; ?></h3>
  69. <div class="select_category">
  70. <?php
  71. // Print a select box if number of categories is large
  72. if ($number_of_categories > $hesk_settings['cat_show_select'])
  73. {
  74. ?>
  75. <form action="index.php" method="get">
  76. <select name="category" id="select_category" class="form-control">
  77. <?php
  78. if ($hesk_settings['select_cat'])
  79. {
  80. echo '<option value="">'.$hesklang['select'].'</option>';
  81. }
  82. foreach ($hesk_settings['categories'] as $k=>$v)
  83. {
  84. echo '<option value="'.$k.'">'.$v.'</option>';
  85. }
  86. ?>
  87. </select>
  88. &nbsp;<br />
  89. <div style="text-align:center">
  90. <input type="submit" value="<?php echo $hesklang['c2c']; ?>" class="btn btn-default">
  91. <input type="hidden" name="a" value="add" />
  92. </div>
  93. </form>
  94. <?php
  95. }
  96. // Otherwise print quick links
  97. else
  98. {
  99. $new_row = 1;
  100. foreach ($hesk_settings['categories'] as $k=>$v):
  101. if ($new_row == 1) {
  102. echo '<div class="row">';
  103. $new_row = -1;
  104. }
  105. ?>
  106. <div class="col-md-5 col-sm-10 col-md-offset-1 col-sm-offset-1">
  107. <a href="index.php?a=add&category=<?php echo $k; ?>" class="button-link">
  108. <div class="panel panel-default">
  109. <div class="panel-body">
  110. <div class="row">
  111. <div class="col-xs-12">
  112. <?php echo $v; ?>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. </a>
  118. </div>
  119. <?php
  120. $new_row++;
  121. if ($new_row == 1) {
  122. echo '</div>';
  123. }
  124. endforeach;
  125. }
  126. ?>
  127. </div>
  128. </div>
  129. <?php
  130. return true;
  131. } // END print_select_category()
  132. function print_add_ticket()
  133. {
  134. global $hesk_settings, $hesklang, $modsForHesk_settings;
  135. // Connect to the database
  136. hesk_load_database_functions();
  137. hesk_dbConnect();
  138. // Load custom fields
  139. require_once(HESK_PATH . 'inc/custom_fields.inc.php');
  140. // Load calendar JS and CSS
  141. define('CALENDAR',1);
  142. // Auto-focus first empty or error field
  143. define('AUTOFOCUS', true);
  144. // Pre-populate fields
  145. // Customer name
  146. if (isset($_REQUEST['name'])) {
  147. $_SESSION['c_name'] = $_REQUEST['name'];
  148. }
  149. // Customer email address
  150. if (isset($_REQUEST['email'])) {
  151. $_SESSION['c_email'] = $_REQUEST['email'];
  152. $_SESSION['c_email2'] = $_REQUEST['email'];
  153. }
  154. // Priority
  155. if (isset($_REQUEST['priority'])) {
  156. $_SESSION['c_priority'] = intval($_REQUEST['priority']);
  157. }
  158. // Subject
  159. if (isset($_REQUEST['subject'])) {
  160. $_SESSION['c_subject'] = $_REQUEST['subject'];
  161. }
  162. // Message
  163. if (isset($_REQUEST['message'])) {
  164. $_SESSION['c_message'] = $_REQUEST['message'];
  165. }
  166. // Custom fields
  167. foreach ($hesk_settings['custom_fields'] as $k => $v) {
  168. if ($v['use']==1 && isset($_REQUEST[$k])) {
  169. $_SESSION['c_' . $k] = $_REQUEST[$k];
  170. }
  171. }
  172. // Variables for coloring the fields in case of errors
  173. if (!isset($_SESSION['iserror'])) {
  174. $_SESSION['iserror'] = array();
  175. }
  176. if (!isset($_SESSION['isnotice'])) {
  177. $_SESSION['isnotice'] = array();
  178. }
  179. hesk_cleanSessionVars('already_submitted');
  180. // Tell header to load reCaptcha API if needed
  181. if ($hesk_settings['recaptcha_use'] == 2) {
  182. define('RECAPTCHA', 1);
  183. }
  184. define('PAGE_TITLE', 'CUSTOMER_TICKET');
  185. // Get categories
  186. $hesk_settings['categories'] = array();
  187. $res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE `type`='0' ORDER BY `cat_order` ASC");
  188. while ($row=hesk_dbFetchAssoc($res)) {
  189. $hesk_settings['categories'][$row['id']] = $row['name'];
  190. }
  191. $number_of_categories = count($hesk_settings['categories']);
  192. if ($number_of_categories == 0) {
  193. $category = 1;
  194. } elseif ($number_of_categories == 1) {
  195. $category = current(array_keys($hesk_settings['categories']));
  196. } else {
  197. $category = isset($_GET['catid']) ? hesk_REQUEST('catid'): hesk_REQUEST('category');
  198. // Force the customer to select a category?
  199. if (!isset($hesk_settings['categories'][$category])) {
  200. return print_select_category($number_of_categories);
  201. }
  202. }
  203. // Print header
  204. $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['submit_ticket'];
  205. require_once(HESK_PATH . 'inc/header.inc.php');
  206. ?>
  207. <ol class="breadcrumb">
  208. <li><a href="<?php echo $hesk_settings['site_url']; ?>"><?php echo $hesk_settings['site_title']; ?></a></li>
  209. <li><a href="<?php echo $hesk_settings['hesk_url']; ?>"><?php echo $hesk_settings['hesk_title']; ?></a></li>
  210. <?php if ($number_of_categories > 1) { ?>
  211. <li>
  212. <a href="index.php?a=add">
  213. <?php echo $hesklang['sub_support']; ?>
  214. </a>
  215. </li>
  216. <li class="active"><?php echo $hesk_settings['categories'][$category]; ?></li>
  217. <?php } else { ?>
  218. <li class="active"><?php echo $hesklang['sub_support']; ?></li>
  219. <?php } ?>
  220. </ol>
  221. <!-- START MAIN LAYOUT -->
  222. <?php
  223. $columnWidth = 'col-md-8';
  224. hesk_dbConnect();
  225. $showRs = hesk_dbQuery("SELECT `show` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` WHERE `id` = 1");
  226. $show = hesk_dbFetchAssoc($showRs);
  227. if (!$show['show']) {
  228. $columnWidth = 'col-md-10 col-md-offset-1';
  229. }
  230. ?>
  231. <div class="row">
  232. <?php if ($columnWidth == 'col-md-8'): ?>
  233. <div align="left" class="col-md-4">
  234. <div class="panel panel-default">
  235. <div class="panel-heading"><?php echo $hesklang['quick_help']; ?></div>
  236. <div class="panel-body">
  237. <p><?php echo $hesklang['quick_help_submit_ticket']; ?></p>
  238. </div>
  239. </div>
  240. </div>
  241. <?php endif; ?>
  242. <div class="<?php echo $columnWidth; ?>">
  243. <?php
  244. // This will handle error, success and notice messages
  245. hesk_handle_messages();
  246. ?>
  247. <!-- START FORM -->
  248. <div class="form">
  249. <h2><?php hesk_showTopBar($hesklang['submit_ticket']); ?></h2>
  250. <small><?php echo $hesklang['use_form_below']; ?></small>
  251. <div class="blankSpace"></div>
  252. <div align="left" class="h3"><?php echo $hesklang['add_ticket_general_information']; ?></div>
  253. <div class="footerWithBorder"></div>
  254. <div class="blankSpace"></div>
  255. <?php
  256. $onsubmit = '';
  257. if ($modsForHesk_settings['rich_text_for_tickets_for_customers']) {
  258. $onsubmit = 'onsubmit="return validateRichText(\'message-help-block\', \'message-group\', \'message\', \''.htmlspecialchars($hesklang['this_field_is_required']).'\')"';
  259. }
  260. ?>
  261. <form class="form-horizontal" role="form" method="post" action="submit_ticket.php?submit=1" name="form1"
  262. enctype="multipart/form-data" <?php echo $onsubmit; ?>>
  263. <!-- Contact info -->
  264. <div class="form-group">
  265. <label for="name" class="col-sm-3 control-label"><?php echo $hesklang['name']; ?> <span
  266. class="important">*</span></label>
  267. <div class="col-sm-9">
  268. <input type="text" class="form-control" id="name" name="name" size="40" maxlength="30"
  269. value="<?php if (isset($_SESSION['c_name'])) {
  270. echo stripslashes(hesk_input($_SESSION['c_name']));
  271. } ?>" <?php if (in_array('name', $_SESSION['iserror'])) {
  272. echo ' class="isError" ';
  273. } ?> placeholder="<?php echo htmlspecialchars($hesklang['name']); ?>"
  274. data-error="<?php echo htmlspecialchars($hesklang['enter_your_name']); ?>" required>
  275. <div class="help-block with-errors"></div>
  276. </div>
  277. </div>
  278. <div class="form-group">
  279. <label for="email" class="col-sm-3 control-label"><?php echo $hesklang['email'] .
  280. ($hesk_settings['require_email'] ? ' <span class="important">*</span>' : ''); ?></label>
  281. <div class="col-sm-9">
  282. <input type="text" class="form-control" id="email" name="email" size="40" maxlength="1000"
  283. value="<?php if (isset($_SESSION['c_email'])) {
  284. echo stripslashes(hesk_input($_SESSION['c_email']));
  285. } ?>" <?php if (in_array('email', $_SESSION['iserror'])) {
  286. echo ' class="isError" ';
  287. } elseif (in_array('email', $_SESSION['isnotice'])) {
  288. echo ' class="isNotice" ';
  289. } ?> <?php if ($hesk_settings['detect_typos']) {
  290. echo ' onblur="Javascript:hesk_suggestEmail(\'email\', \'email_suggestions\', 1, 0)"';
  291. } ?> placeholder="<?php echo htmlspecialchars($hesklang['email']); ?>"
  292. data-error="<?php echo htmlspecialchars($hesklang['enter_valid_email']); ?>" required>
  293. <div class="help-block with-errors"></div>
  294. </div>
  295. </div>
  296. <?php
  297. if ($hesk_settings['confirm_email']) {
  298. ?>
  299. <div class="form-group">
  300. <label for="email2" class="col-sm-3 control-label"><?php echo $hesklang['confemail']; ?>
  301. <?php echo $hesk_settings['require_email'] ? ' <span class="important">*</span>' : ''; ?></label>
  302. <div class="col-sm-9">
  303. <input type="text" id="email2" class="form-control" name="email2" size="40"
  304. maxlength="1000"
  305. value="<?php if (isset($_SESSION['c_email2'])) {
  306. echo stripslashes(hesk_input($_SESSION['c_email2']));
  307. } ?>" <?php if (in_array('email2', $_SESSION['iserror'])) {
  308. echo ' class="isError" ';
  309. } ?> placeholder="<?php echo htmlspecialchars($hesklang['confemail']); ?>"
  310. data-match="#email"
  311. data-error="<?php echo htmlspecialchars($hesklang['confemaile']); ?>" required>
  312. <div class="help-block with-errors"></div>
  313. </div>
  314. </div>
  315. <?php
  316. } ?>
  317. <div id="email_suggestions"></div>
  318. <!-- Priority -->
  319. <?php
  320. /* Can customer assign urgency? */
  321. if ($hesk_settings['cust_urgency']) {
  322. ?>
  323. <div class="form-group">
  324. <label for="priority" class="col-sm-3 control-label"><?php echo $hesklang['priority']; ?> <span
  325. class="important">*</span></label>
  326. <div class="col-sm-9">
  327. <select id="priority" class="form-control"
  328. pattern="[0-9]+"
  329. data-error="<?php echo htmlspecialchars($hesklang['sel_app_priority']); ?>"
  330. name="priority" <?php if (in_array('priority', $_SESSION['iserror'])) {
  331. echo ' class="isError" ';
  332. } ?> required>
  333. <?php
  334. // Show the "Click to select"?
  335. if ($hesk_settings['select_pri']) {
  336. echo '<option value="">' . $hesklang['select'] . '</option>';
  337. }
  338. ?>
  339. <option
  340. value="3" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 3) {
  341. echo 'selected="selected"';
  342. } ?>><?php echo $hesklang['low']; ?></option>
  343. <option
  344. value="2" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 2) {
  345. echo 'selected="selected"';
  346. } ?>><?php echo $hesklang['medium']; ?></option>
  347. <option
  348. value="1" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 1) {
  349. echo 'selected="selected"';
  350. } ?>><?php echo $hesklang['high']; ?></option>
  351. </select>
  352. <div class="help-block with-errors"></div>
  353. </div>
  354. </div>
  355. <?php
  356. }
  357. ?>
  358. <!-- START CUSTOM BEFORE -->
  359. <?php
  360. /* custom fields BEFORE comments */
  361. $hidden_cf_buffer = '';
  362. foreach ($hesk_settings['custom_fields'] as $k=>$v)
  363. {
  364. if ($v['use']==1 && $v['place']==0 && hesk_is_custom_field_in_category($k, $category) )
  365. {
  366. if ($v['req']) {
  367. $v['req']= '<span class="important">*</span>';
  368. $required_attribute = 'data-error="' . $hesklang['this_field_is_required'] . '" required';
  369. } else {
  370. $v['req'] = '';
  371. $required_attribute = '';
  372. }
  373. if ($v['type'] == 'checkbox')
  374. {
  375. $k_value = array();
  376. if (isset($_SESSION["c_$k"]) && is_array($_SESSION["c_$k"]))
  377. {
  378. foreach ($_SESSION["c_$k"] as $myCB)
  379. {
  380. $k_value[] = stripslashes(hesk_input($myCB));
  381. }
  382. }
  383. }
  384. elseif (isset($_SESSION["c_$k"]))
  385. {
  386. $k_value = stripslashes(hesk_input($_SESSION["c_$k"]));
  387. }
  388. else
  389. {
  390. $k_value = '';
  391. }
  392. switch ($v['type'])
  393. {
  394. /* Radio box */
  395. case 'radio':
  396. $cls = in_array($k,$_SESSION['iserror']) ? ' class="isError" ' : '';
  397. echo '
  398. <div class="form-group '.$cls.'">
  399. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  400. <div class="col-sm-9">';
  401. foreach ($v['value']['radio_options'] as $option) {
  402. if (strlen($k_value) == 0) {
  403. $k_value = $option;
  404. $checked = empty($v['value']['no_default']) ? 'checked' : '';
  405. } elseif ($k_value == $option) {
  406. $k_value = $option;
  407. $checked = 'checked';
  408. } else {
  409. $checked = '';
  410. }
  411. echo '<div class="radio"><label><input type="radio" name="'.$k.'" value="'.$option.'" '.$checked.' ' . $required_attribute . '> '.$option.'</label></div>';
  412. }
  413. echo '
  414. <div class="help-block with-errors"></div>
  415. </div>
  416. </div>';
  417. break;
  418. /* Select drop-down box */
  419. case 'select':
  420. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  421. echo '
  422. <div class="form-group '.$cls.'">
  423. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  424. <div class="col-sm-9">
  425. <select name="'.$k.'" class="form-control" ' . $required_attribute . '>';
  426. // Show "Click to select"?
  427. if ( ! empty($v['value']['show_select']))
  428. {
  429. echo '<option value="">'.$hesklang['select'].'</option>';
  430. }
  431. foreach ($v['value']['select_options'] as $option)
  432. {
  433. if ($k_value == $option)
  434. {
  435. $k_value = $option;
  436. $selected = 'selected';
  437. }
  438. else
  439. {
  440. $selected = '';
  441. }
  442. echo '<option '.$selected.'>'.$option.'</option>';
  443. }
  444. echo '</select>
  445. <div class="help-block with-errors"></div>
  446. </div>
  447. </div>';
  448. break;
  449. /* Checkbox */
  450. case 'checkbox':
  451. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  452. echo '
  453. <div class="form-group '.$cls.'">
  454. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  455. <div class="col-sm-9">';
  456. foreach ($v['value']['checkbox_options'] as $option)
  457. {
  458. if (in_array($option,$k_value))
  459. {
  460. $checked = 'checked';
  461. }
  462. else
  463. {
  464. $checked = '';
  465. }
  466. echo '<div class="checkbox"><label><input type="checkbox" name="'.$k.'[]" value="'.$option.'" '.$checked.' '.$required_attribute.'> '.$option.'</label></div>';
  467. }
  468. echo '
  469. <div class="help-block with-errors"></div>
  470. </div>
  471. </div>';
  472. break;
  473. /* Large text box */
  474. case 'textarea':
  475. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  476. echo '
  477. <div class="form-group '.$cls.'">
  478. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  479. <div class="col-sm-9">
  480. <textarea class="form-control" name="'.$k.'" rows="'.intval($v['value']['rows']).'" cols="'.intval($v['value']['cols']).'" '.$required_attribute.'>'.$k_value.'</textarea>
  481. <div class="help-block with-errors"></div>
  482. </div>
  483. </div>';
  484. break;
  485. // Date
  486. case 'date':
  487. if ($required_attribute != '') {
  488. $required_attribute .= ' pattern="[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])"';
  489. }
  490. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  491. echo '
  492. <div class="form-group '.$cls.'">
  493. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  494. <div class="col-sm-9">
  495. <input type="text" name="'.$k.'" value="'.$k_value.'" class="form-control datepicker" size="10" ' . $required_attribute . '>
  496. <div class="help-block with-errors"></div>
  497. </div>
  498. </div>';
  499. break;
  500. // Email
  501. case 'email':
  502. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  503. $suggest = $hesk_settings['detect_typos'] ? 'onblur="Javascript:hesk_suggestEmail(\''.$k.'\', \''.$k.'_suggestions\', 0, 0'.($v['value']['multiple'] ? ',1' : '').')"' : '';
  504. echo '
  505. <div class="form-group '.$cls.'">
  506. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  507. <div class="col-sm-9">
  508. <input type="text" name="'.$k.'" id="'.$k.'" value="'.$k_value.'" size="40" class="form-control" '.$suggest.' '.$required_attribute.'>
  509. <div class="help-block with-errors"></div>
  510. </div>
  511. <div id="'.$k.'_suggestions"></div>
  512. </div>';
  513. break;
  514. // Hidden
  515. case 'hidden':
  516. if (strlen($k_value) != 0 || isset($_SESSION["c_$k"]))
  517. {
  518. $v['value']['default_value'] = $k_value;
  519. }
  520. $hidden_cf_buffer .= '<input type="hidden" name="'.$k.'" value="'.$v['value']['default_value'].'" />';
  521. break;
  522. // Readonly
  523. case 'readonly':
  524. if (strlen($k_value) != 0 || isset($_SESSION["c_$k"]))
  525. {
  526. $v['value']['default_value'] = $k_value;
  527. }
  528. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  529. echo '
  530. <div class="form-group '.$cls.'">
  531. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  532. <div class="col-sm-9">
  533. <input type="text" class="form-control white-readonly" name="'.$k.'" size="40" value="'.$v['value']['default_value'].'" readonly>
  534. </div>
  535. </div>';
  536. break;
  537. /* Default text input */
  538. default:
  539. if (strlen($k_value) != 0 || isset($_SESSION["c_$k"]))
  540. {
  541. $v['value']['default_value'] = $k_value;
  542. }
  543. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  544. echo '
  545. <div class="form-group '.$cls.'">
  546. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  547. <div class="col-sm-9">
  548. <input type="text" class="form-control" name="'.$k.'" size="40" maxlength="'.intval($v['value']['max_length']).'" value="'.$v['value']['default_value'].'" '.$required_attribute.'>
  549. <div class="help-block with-errors"></div>
  550. </div>
  551. </div>';
  552. }
  553. }
  554. }
  555. ?>
  556. <!-- END CUSTOM BEFORE -->
  557. <?php
  558. if ($hesk_settings['require_subject'] != -1 || $hesk_settings['require_message'] != -1) {
  559. ?>
  560. <div class="blankSpace"></div>
  561. <div align="left" class="h3"><?php echo $hesklang['add_ticket_your_message']; ?></div>
  562. <div class="footerWithBorder"></div>
  563. <div class="blankSpace"></div>
  564. <!-- ticket info -->
  565. <?php if ($hesk_settings['require_subject'] != -1) { ?>
  566. <div class="form-group">
  567. <label for="subject" class="col-sm-3 control-label"><?php echo $hesklang['subject']; ?>
  568. <?php echo $hesk_settings['require_subject'] ? '<span class="important">*</span>' : ''; ?>
  569. </label>
  570. <div class="col-sm-9">
  571. <input type="text" id="subject" class="form-control" name="subject" size="40"
  572. maxlength="40"
  573. value="<?php if (isset($_SESSION['c_subject'])) {
  574. echo stripslashes(hesk_input($_SESSION['c_subject']));
  575. } ?>" <?php if (in_array('subject', $_SESSION['iserror'])) {
  576. echo ' class="isError" ';
  577. } ?> placeholder="<?php echo htmlspecialchars($hesklang['subject']); ?>"
  578. data-error="<?php echo htmlspecialchars($hesklang['enter_subject']); ?>"
  579. required>
  580. <div class="help-block with-errors"></div>
  581. </div>
  582. </div>
  583. <?php
  584. }
  585. if ($hesk_settings['require_message'] != -1) {
  586. ?>
  587. <div class="form-group" id="message-group">
  588. <label for="message" class="col-sm-3 control-label">
  589. <?php echo $hesklang['message']; ?>
  590. <?php echo $hesk_settings['require_message'] ? '<span class="important">*</span>' : ''; ?>
  591. </label>
  592. <div class="col-sm-9">
  593. <textarea placeholder="<?php echo htmlspecialchars($hesklang['message']); ?>" name="message"
  594. id="message" class="form-control htmlEditor" rows="12"
  595. cols="60" <?php if (in_array('message', $_SESSION['iserror'])) {
  596. echo ' class="isError" ';
  597. } ?> data-error="<?php echo htmlspecialchars($hesklang['enter_message']); ?>"
  598. required><?php if (isset($_SESSION['c_message'])) {
  599. echo stripslashes(hesk_input($_SESSION['c_message']));
  600. } ?></textarea>
  601. <div class="help-block with-errors" id="message-help-block"></div>
  602. <?php if ($modsForHesk_settings['rich_text_for_tickets_for_customers']): ?>
  603. <script type="text/javascript">
  604. /* <![CDATA[ */
  605. tinyMCE.init({
  606. mode: "textareas",
  607. editor_selector: "htmlEditor",
  608. elements: "content",
  609. theme: "advanced",
  610. convert_urls: false,
  611. theme_advanced_buttons1: "cut,copy,paste,|,undo,redo,|,formatselect,fontselect,fontsizeselect,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull",
  612. theme_advanced_buttons2: "sub,sup,|,charmap,|,bullist,numlist,|,outdent,indent,insertdate,inserttime,preview,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,link,unlink,anchor,image,cleanup",
  613. theme_advanced_buttons3: "",
  614. theme_advanced_toolbar_location: "top",
  615. theme_advanced_toolbar_align: "left",
  616. theme_advanced_statusbar_location: "bottom",
  617. theme_advanced_resizing: true
  618. });
  619. /* ]]> */
  620. </script>
  621. <?php endif; ?>
  622. </div>
  623. </div>
  624. <?php
  625. }
  626. }
  627. ?>
  628. <!-- START KNOWLEDGEBASE SUGGEST -->
  629. <?php
  630. if ($hesk_settings['kb_enable'] && $hesk_settings['kb_recommendanswers']) {
  631. ?>
  632. <div id="kb_suggestions" style="display:none">
  633. <br/>&nbsp;<br/>
  634. <img src="img/loading.gif" width="24" height="24" alt="" border="0"
  635. style="vertical-align:text-bottom"/> <i><?php echo $hesklang['lkbs']; ?></i>
  636. </div>
  637. <script language="Javascript" type="text/javascript"><!--
  638. hesk_suggestKB();
  639. //-->
  640. </script>
  641. <?php
  642. }
  643. ?>
  644. <!-- END KNOWLEDGEBASE SUGGEST -->
  645. <!-- START CUSTOM AFTER -->
  646. <?php
  647. /* custom fields AFTER comments */
  648. foreach ($hesk_settings['custom_fields'] as $k=>$v)
  649. {
  650. if ($v['use']==1 && $v['place']==1 && hesk_is_custom_field_in_category($k, $category) )
  651. {
  652. if ($v['req']) {
  653. $v['req']= '<span class="important">*</span>';
  654. $required_attribute = 'data-error="' . $hesklang['this_field_is_required'] . '" required';
  655. } else {
  656. $v['req'] = '';
  657. $required_attribute = '';
  658. }
  659. if ($v['type'] == 'checkbox')
  660. {
  661. $k_value = array();
  662. if (isset($_SESSION["c_$k"]) && is_array($_SESSION["c_$k"]))
  663. {
  664. foreach ($_SESSION["c_$k"] as $myCB)
  665. {
  666. $k_value[] = stripslashes(hesk_input($myCB));
  667. }
  668. }
  669. }
  670. elseif (isset($_SESSION["c_$k"]))
  671. {
  672. $k_value = stripslashes(hesk_input($_SESSION["c_$k"]));
  673. }
  674. else
  675. {
  676. $k_value = '';
  677. }
  678. switch ($v['type'])
  679. {
  680. /* Radio box */
  681. case 'radio':
  682. $cls = in_array($k,$_SESSION['iserror']) ? ' class="isError" ' : '';
  683. echo '
  684. <div class="form-group '.$cls.'">
  685. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  686. <div class="col-sm-9">';
  687. foreach ($v['value']['radio_options'] as $option) {
  688. if (strlen($k_value) == 0) {
  689. $k_value = $option;
  690. $checked = empty($v['value']['no_default']) ? 'checked' : '';
  691. } elseif ($k_value == $option) {
  692. $k_value = $option;
  693. $checked = 'checked';
  694. } else {
  695. $checked = '';
  696. }
  697. echo '<div class="radio"><label><input type="radio" name="'.$k.'" value="'.$option.'" '.$checked.' '.$required_attribute.'> '.$option.'</label></div>';
  698. }
  699. echo '
  700. <div class="help-block with-errors"></div>
  701. </div>
  702. </div>';
  703. break;
  704. /* Select drop-down box */
  705. case 'select':
  706. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  707. echo '
  708. <div class="form-group '.$cls.'">
  709. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  710. <div class="col-sm-9">
  711. <select name="'.$k.'" class="form-control" '.$required_attribute.'>';
  712. // Show "Click to select"?
  713. if ( ! empty($v['value']['show_select']))
  714. {
  715. echo '<option value="">'.$hesklang['select'].'</option>';
  716. }
  717. foreach ($v['value']['select_options'] as $option)
  718. {
  719. if ($k_value == $option)
  720. {
  721. $k_value = $option;
  722. $selected = 'selected';
  723. }
  724. else
  725. {
  726. $selected = '';
  727. }
  728. echo '<option '.$selected.'>'.$option.'</option>';
  729. }
  730. echo '</select>
  731. <div class="help-block with-errors"></div>
  732. </div>
  733. </div>';
  734. break;
  735. /* Checkbox */
  736. case 'checkbox':
  737. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  738. echo '
  739. <div class="form-group '.$cls.'">
  740. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  741. <div class="col-sm-9">';
  742. foreach ($v['value']['checkbox_options'] as $option)
  743. {
  744. if (in_array($option,$k_value))
  745. {
  746. $checked = 'checked';
  747. }
  748. else
  749. {
  750. $checked = '';
  751. }
  752. echo '<div class="checkbox"><label><input type="checkbox" name="'.$k.'[]" value="'.$option.'" '.$checked.' '.$required_attribute.'> '.$option.'</label></div>';
  753. }
  754. echo '
  755. <div class="help-block with-errors"></div>
  756. </div>
  757. </div>';
  758. break;
  759. /* Large text box */
  760. case 'textarea':
  761. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  762. echo '
  763. <div class="form-group '.$cls.'">
  764. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  765. <div class="col-sm-9">
  766. <textarea class="form-control" name="'.$k.'" rows="'.intval($v['value']['rows']).'" cols="'.intval($v['value']['cols']).'" '.$required_attribute.'>'.$k_value.'</textarea>
  767. <div class="help-block with-errors"></div>
  768. </div>
  769. </div>';
  770. break;
  771. // Date
  772. case 'date':
  773. if ($required_attribute != '') {
  774. $required_attribute .= ' pattern="[0-9]{4}-(0[1-9]|1[0-2])-(0[1-9]|[1-2][0-9]|3[0-1])"';
  775. }
  776. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  777. echo '
  778. <div class="form-group '.$cls.'">
  779. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  780. <div class="col-sm-9">
  781. <input type="text" name="'.$k.'" value="'.$k_value.'" class="form-control datepicker" size="10" '.$required_attribute.'>
  782. <div class="help-block with-errors"></div>
  783. </div>
  784. </div>';
  785. break;
  786. // Email
  787. case 'email':
  788. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  789. $suggest = $hesk_settings['detect_typos'] ? 'onblur="Javascript:hesk_suggestEmail(\''.$k.'\', \''.$k.'_suggestions\', 0, 0'.($v['value']['multiple'] ? ',1' : '').')"' : '';
  790. echo '
  791. <div class="form-group '.$cls.'">
  792. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  793. <div class="col-sm-9">
  794. <input type="text" name="'.$k.'" id="'.$k.'" value="'.$k_value.'" size="40" class="form-control" '.$suggest.' '.$required_attribute.'>
  795. <div class="help-block with-errors"></div>
  796. </div>
  797. <div id="'.$k.'_suggestions"></div>
  798. </div>';
  799. break;
  800. // Hidden
  801. case 'hidden':
  802. if (strlen($k_value) != 0 || isset($_SESSION["c_$k"]))
  803. {
  804. $v['value']['default_value'] = $k_value;
  805. }
  806. $hidden_cf_buffer .= '<input type="hidden" name="'.$k.'" value="'.$v['value']['default_value'].'" />';
  807. break;
  808. // Readonly
  809. case 'readonly':
  810. if (strlen($k_value) != 0 || isset($_SESSION["c_$k"]))
  811. {
  812. $v['value']['default_value'] = $k_value;
  813. }
  814. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  815. echo '
  816. <div class="form-group '.$cls.'">
  817. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  818. <div class="col-sm-9">
  819. <input type="text" class="form-control white-readonly" name="'.$k.'" size="40" value="'.$v['value']['default_value'].'" readonly>
  820. </div>
  821. </div>';
  822. break;
  823. /* Default text input */
  824. default:
  825. if (strlen($k_value) != 0 || isset($_SESSION["c_$k"]))
  826. {
  827. $v['value']['default_value'] = $k_value;
  828. }
  829. $cls = in_array($k,$_SESSION['iserror']) ? 'isError' : '';
  830. echo '
  831. <div class="form-group '.$cls.'">
  832. <label for="'.$k.'" class="col-sm-3 control-label">'.$v['name'].' '.$v['req'].'</label>
  833. <div class="col-sm-9">
  834. <input type="text" class="form-control" name="'.$k.'" size="40" maxlength="'.intval($v['value']['max_length']).'" value="'.$v['value']['default_value'].'" ' . $required_attribute . '>
  835. <div class="help-block with-errors"></div>
  836. </div>
  837. </div>';
  838. }
  839. }
  840. }
  841. ?>
  842. <!-- END CUSTOM AFTER -->
  843. <?php
  844. /* attachments */
  845. if ($hesk_settings['attachments']['use']) {
  846. ?>
  847. <div class="form-group">
  848. <label for="attachments" class="col-sm-3 control-label"><?php echo $hesklang['attachments']; ?>
  849. :</label>
  850. <div align="left" class="col-sm-9">
  851. <?php build_dropzone_markup(); ?>
  852. </div>
  853. </div>
  854. <?php
  855. display_dropzone_field($hesk_settings['hesk_url'] . '/internal-api/ticket/upload-attachment.php');
  856. }
  857. if ($hesk_settings['question_use'] || $hesk_settings['secimg_use'])
  858. {
  859. ?>
  860. <!-- Security checks -->
  861. <?php
  862. if ($hesk_settings['question_use']) {
  863. ?>
  864. <div class="form-group">
  865. <label for="question" class="col-sm-3 control-label"><?php echo $hesklang['verify_q']; ?> <span
  866. class="important">*</span></label>
  867. <?php
  868. $value = '';
  869. if (isset($_SESSION['c_question'])) {
  870. $value = stripslashes(hesk_input($_SESSION['c_question']));
  871. }
  872. $cls = in_array('question', $_SESSION['iserror']) ? ' class="isError" ' : '';
  873. echo '<div class="col-md-9">' . $hesk_settings['question_ask'] . '<br />
  874. <input class="form-control" id="question" type="text" name="question"
  875. data-error="'.htmlspecialchars($hesklang['this_field_is_required']).'"
  876. size="20" value="' . $value . '" ' . $cls . ' required>
  877. <div class="help-block with-errors"></div>
  878. </div>';
  879. ?>
  880. </div>
  881. <?php
  882. }
  883. if ($hesk_settings['secimg_use'])
  884. {
  885. ?>
  886. <div class="form-group">
  887. <label for="secimage" class="col-sm-3 control-label"><?php echo $hesklang['verify_i']; ?> <span
  888. class="important">*</span></label>
  889. <?php
  890. // SPAM prevention verified for this session
  891. if (isset($_SESSION['img_verified'])) {
  892. echo '<img src="' . HESK_PATH . 'img/success.png" width="16" height="16" border="0" alt="" style="vertical-align:text-bottom" /> ' . $hesklang['vrfy'];
  893. } // Not verified yet, should we use Recaptcha?
  894. elseif ($hesk_settings['recaptcha_use'] == 1) {
  895. ?>
  896. <script type="text/javascript">
  897. var RecaptchaOptions = {
  898. theme: '<?php echo ( isset($_SESSION['iserror']) && in_array('mysecnum',$_SESSION['iserror']) ) ? 'red' : 'white'; ?>',
  899. custom_translations: {
  900. visual_challenge: "<?php echo hesk_slashJS($hesklang['visual_challenge']); ?>",
  901. audio_challenge: "<?php echo hesk_slashJS($hesklang['audio_challenge']); ?>",
  902. refresh_btn: "<?php echo hesk_slashJS($hesklang['refresh_btn']); ?>",
  903. instructions_visual: "<?php echo hesk_slashJS($hesklang['instructions_visual']); ?>",
  904. instructions_context: "<?php echo hesk_slashJS($hesklang['instructions_context']); ?>",
  905. instructions_audio: "<?php echo hesk_slashJS($hesklang['instructions_audio']); ?>",
  906. help_btn: "<?php echo hesk_slashJS($hesklang['help_btn']); ?>",
  907. play_again: "<?php echo hesk_slashJS($hesklang['play_again']); ?>",
  908. cant_hear_this: "<?php echo hesk_slashJS($hesklang['cant_hear_this']); ?>",
  909. incorrect_try_again: "<?php echo hesk_slashJS($hesklang['incorrect_try_again']); ?>",
  910. image_alt_text: "<?php echo hesk_slashJS($hesklang['image_alt_text']); ?>"
  911. }
  912. };
  913. </script>
  914. <div class="col-md-9">
  915. <?php
  916. require(HESK_PATH . 'inc/recaptcha/recaptchalib.php');
  917. echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true);
  918. ?>
  919. </div>
  920. <?php
  921. }
  922. // Use reCaptcha API v2?
  923. elseif ($hesk_settings['recaptcha_use'] == 2)
  924. {
  925. ?>
  926. <div class="col-md-9">
  927. <div class="g-recaptcha"
  928. data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?>">
  929. </div>
  930. </div>
  931. <?php
  932. }
  933. // At least use some basic PHP generated image (better than nothing)
  934. else {
  935. $cls = in_array('mysecnum', $_SESSION['iserror']) ? ' class="isError" ' : '';
  936. echo '<div align="left" class="col-sm-9">';
  937. echo $hesklang['sec_enter'] . '<br />&nbsp;<br /><img src="print_sec_img.php?' . rand(10000, 99999) . '" width="150" height="40" alt="' . $hesklang['sec_img'] . '" title="' . $hesklang['sec_img'] . '" border="1" name="secimg" style="vertical-align:text-bottom" /> ' .
  938. '<a href="javascript:void(0)" onclick="javascript:document.form1.secimg.src=\'print_sec_img.php?\'+ ( Math.floor((90000)*Math.random()) + 10000);"><img src="img/reload.png" height="24" width="24" alt="' . $hesklang['reload'] . '" title="' . $hesklang['reload'] . '" border="0" style="vertical-align:text-bottom" /></a>' .
  939. '<br />&nbsp;<br /><input type="text" name="mysecnum" size="20" maxlength="5" ' . $cls . ' /></div>';
  940. }
  941. echo '</div>';
  942. }
  943. ?>
  944. <?php
  945. }
  946. if ($modsForHesk_settings['request_location']):
  947. ?>
  948. <div class="form-group">
  949. <label for="location"
  950. class="col-md-3 control-label"><?php echo $hesklang['location_colon']; ?></label>
  951. <div class="col-sm-9">
  952. <p id="console"><?php echo $hesklang['requesting_location_ellipsis']; ?></p>
  953. <div id="map" style="height: 300px; display:none">
  954. </div>
  955. </div>
  956. </div>
  957. <!-- Submit -->
  958. <?php
  959. endif;
  960. if ($hesk_settings['submit_notice']) {
  961. ?>
  962. <div class="row">
  963. <div class="col-md-12">
  964. <div class="alert alert-info">
  965. <b><?php echo $hesklang['before_submit']; ?></b>
  966. <ul>
  967. <li><?php echo $hesklang['all_info_in']; ?>.</li>
  968. <li><?php echo $hesklang['all_error_free']; ?>.</li>
  969. </ul>
  970. <b><?php echo $hesklang['we_have']; ?>:</b>
  971. <ul>
  972. <li><?php echo hesk_htmlspecialchars($_SERVER['REMOTE_ADDR']) . ' ' . $hesklang['recorded_ip']; ?></li>
  973. <li><?php echo $hesklang['recorded_time']; ?></li>
  974. </ul>
  975. </div>
  976. </div>
  977. </div>
  978. <div class="row">
  979. <div class="col-md-9 col-md-offset-3">
  980. <input type="hidden" id="latitude" name="latitude" value="E-0">
  981. <input type="hidden" id="longitude" name="longitude" value="E-0">
  982. <input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
  983. <input type="hidden" id="screen-resolution-height" name="screen_resolution_height">
  984. <input type="hidden" id="screen-resolution-width" name="screen_resolution_width">
  985. <input type="submit" value="<?php echo $hesklang['sub_ticket']; ?>"
  986. class="btn btn-default">
  987. </div>
  988. </div>
  989. <script>
  990. $('#screen-resolution-height').prop('value', screen.height);
  991. $('#screen-resolution-width').prop('value', screen.width);
  992. </script>
  993. <?php
  994. } // End IF submit_notice
  995. else {
  996. ?>
  997. <div class=" row">
  998. <div class="col-md-9 col-md-offset-3">
  999. <input type="hidden" id="latitude" name="latitude" value="E-0">
  1000. <input type="hidden" id="longitude" name="longitude" value="E-0">
  1001. <input type="hidden" id="screen-resolution-height" name="screen_resolution_height">
  1002. <input type="hidden" id="screen-resolution-width" name="screen_resolution_width">
  1003. <input type="hidden" name="token" value="<?php hesk_token_echo(); ?>">
  1004. <input class="btn btn-default" type="submit"
  1005. value="<?php echo $hesklang['sub_ticket']; ?>">
  1006. <script>
  1007. $('#screen-resolution-height').prop('value', screen.height);
  1008. $('#screen-resolution-width').prop('value', screen.width);
  1009. </script>
  1010. </div>
  1011. </div>
  1012. <?php
  1013. } // End ELSE submit_notice
  1014. // Print custom hidden fields
  1015. echo $hidden_cf_buffer;
  1016. ?>
  1017. <input type="hidden" name="category" value="<?php echo $category; ?>">
  1018. <!-- Do not delete or modify the code below, it is used to detect simple SPAM bots -->
  1019. <input type="hidden" name="hx" value="3"/><input type="hidden" name="hy" value=""/>
  1020. <!-- >
  1021. <input type="text" name="phone" value="3" />
  1022. < -->
  1023. </form>
  1024. <script>
  1025. buildValidatorForTicketSubmission("form1",
  1026. "<?php echo addslashes($hesklang['select_at_least_one_value']); ?>");
  1027. </script>
  1028. </div>
  1029. </form>
  1030. <?php if ($columnWidth == 'col-md-10 col-md-offset-1'): ?>
  1031. <div class="col-md-1">&nbsp;</div></div>
  1032. <?php endif; ?>
  1033. <!-- END FORM -->
  1034. <?php
  1035. // Request for the users location if enabled
  1036. if ($modsForHesk_settings['request_location']) {
  1037. echo '
  1038. <script>
  1039. requestUserLocation("' . $hesklang['your_current_location'] . '", "' . $hesklang['unable_to_determine_location'] . '");
  1040. </script>
  1041. ';
  1042. }
  1043. hesk_cleanSessionVars('iserror');
  1044. hesk_cleanSessionVars('isnotice');
  1045. } // End print_add_ticket()
  1046. function print_start()
  1047. {
  1048. global $hesk_settings, $hesklang;
  1049. if ($hesk_settings['kb_enable'])
  1050. {
  1051. require(HESK_PATH . 'inc/knowledgebase_functions.inc.php');
  1052. }
  1053. // Connect to database
  1054. hesk_dbConnect();
  1055. define('PAGE_TITLE', 'CUSTOMER_HOME');
  1056. /* Print header */
  1057. require_once(HESK_PATH . 'inc/header.inc.php');
  1058. ?>
  1059. <ol class="breadcrumb">
  1060. <li><a href="<?php echo $hesk_settings['site_url']; ?>"><?php echo $hesk_settings['site_title']; ?></a></li>
  1061. <li class="active"><?php echo $hesk_settings['hesk_title']; ?></li>
  1062. </ol>
  1063. <?php
  1064. // Service messages
  1065. $res = hesk_dbQuery('SELECT `title`, `message`, `style`, `icon` FROM `'.hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` WHERE `type`='0' ORDER BY `order` ASC");
  1066. if (hesk_dbNumRows($res) > 0)
  1067. {
  1068. ?>
  1069. <div class="row">
  1070. <div class="col-md-12">
  1071. <?php
  1072. while ($sm=hesk_dbFetchAssoc($res))
  1073. {
  1074. hesk_service_message($sm);
  1075. }
  1076. ?>
  1077. </div>
  1078. </div>
  1079. <?php } ?>
  1080. <div class="row">
  1081. <div class="col-md-4">
  1082. <div class="panel panel-default">
  1083. <div class="panel-heading"><?php echo $hesklang['view_ticket']; ?></div>
  1084. <div class="panel-body">
  1085. <form data-toggle="validator" role="form" class="viewTicketSidebar" action="ticket.php" method="get" name="form2">
  1086. <div class="form-group">
  1087. <br/>
  1088. <label for="ticketID"><?php echo $hesklang['ticket_trackID']; ?>:</label>
  1089. <input type="text" class="form-control" name="track" id="ticketID" maxlength="20" size="35" value=""
  1090. data-error="<?php echo htmlspecialchars($hesklang['enter_id']); ?>"
  1091. placeholder="<?php echo htmlspecialchars($hesklang['ticket_trackID']); ?>" required>
  1092. <div class="help-block with-errors"></div>
  1093. </div>
  1094. <?php
  1095. $tmp = '';
  1096. if ($hesk_settings['email_view_ticket'])
  1097. {
  1098. $tmp = 'document.form1.email.value=document.form2.e.value;';
  1099. ?>
  1100. <div class="form-group">
  1101. <label for="emailAddress"><?php echo $hesklang['email']; ?>:</label>
  1102. <?php
  1103. $my_email = '';
  1104. $do_remember = '';
  1105. if (isset($_COOKIE['hesk_myemail']))
  1106. {
  1107. $my_email = $_COOKIE['hesk_myemail'];
  1108. $do_remember = 'checked';
  1109. }
  1110. ?>
  1111. <input type="text" class="form-control" name="e" id="emailAddress" size="35" value="<?php echo $my_email; ?>"
  1112. data-error="<?php echo htmlspecialchars($hesklang['enter_valid_email']); ?>"
  1113. placeholder="<?php echo htmlspecialchars($hesklang['email']); ?>" required>
  1114. <div class="help-block with-errors"></div>
  1115. </div>
  1116. <div class="checkbox">
  1117. <label for="r">
  1118. <input type="checkbox" name="r" value="Y" <?php echo $do_remember; ?>> <?php echo $hesklang['rem_email']; ?>
  1119. </label>
  1120. </div>
  1121. <?php
  1122. }
  1123. ?>
  1124. <input type="submit" value="<?php echo $hesklang['view_ticket']; ?>" class="btn btn-default" /><input type="hidden" name="Refresh" value="<?php echo rand(10000,99999); ?>"><input type="hidden" name="f" value="1">
  1125. </form>
  1126. </div>
  1127. </div>
  1128. </div>
  1129. <div class="col-md-8">
  1130. <?php
  1131. // Print small search box
  1132. if ($hesk_settings['kb_enable'])
  1133. {
  1134. hesk_kbSearchSmall();
  1135. hesk_kbSearchLarge();
  1136. }
  1137. else
  1138. {
  1139. echo '&nbsp;';
  1140. }
  1141. ?>
  1142. <div class="row default-row-margins">
  1143. <div class="col-sm-6 col-xs-12">
  1144. <a href="index.php?a=add" class="button-link">
  1145. <div class="panel panel-default">
  1146. <div class="panel-body">
  1147. <div class="row">
  1148. <div class="col-xs-1">
  1149. <img src="img/newTicket.png" alt="<?php echo $hesklang['sub_support']; ?>">
  1150. </div>
  1151. <div class="col-xs-11">
  1152. <b><?php echo $hesklang['sub_support']; ?></b><br>
  1153. <?php echo $hesklang['open_ticket']; ?>
  1154. </div>
  1155. </div>
  1156. </div>
  1157. </div>
  1158. </a>
  1159. </div>
  1160. <div class="col-sm-6 col-xs-12">
  1161. <a href="ticket.php" class="button-link">
  1162. <div class="panel panel-default">
  1163. <div class="panel-body">
  1164. <div class="row">
  1165. <div class="col-xs-1">
  1166. <img src="img/viewTicket.png" alt="<?php echo $hesklang['view_existing']; ?>">
  1167. </div>
  1168. <div class="col-xs-11">
  1169. <b><?php echo $hesklang['view_existing']; ?></b><br>
  1170. <?php echo $hesklang['vet']; ?>
  1171. </div>
  1172. </div>
  1173. </div>
  1174. </div>
  1175. </a>
  1176. </div>
  1177. </div>
  1178. <div class="row default-row-margins">
  1179. <?php
  1180. if ($hesk_settings['kb_enable'])
  1181. {
  1182. ?>
  1183. <div class="col-sm-6 col-xs-12">
  1184. <a href="knowledgebase.php" class="button-link">
  1185. <div class="panel panel-default">
  1186. <div class="panel-body">
  1187. <div class="row">
  1188. <div class="col-xs-1">
  1189. <img src="img/knowledgebase.png" alt="<?php echo $hesklang['kb_text']; ?>">
  1190. </div>
  1191. <div class="col-xs-11">
  1192. <b><?php echo $hesklang['kb_text']; ?></b><br>
  1193. <?php echo $hesklang['viewkb']; ?>
  1194. </div>
  1195. </div>
  1196. </div>
  1197. </div>
  1198. </a>
  1199. </div>
  1200. <?php } if ($modsForHesk_settings['enable_calendar'] == 1): ?>
  1201. <div class="col-sm-6 col-xs-12">
  1202. <a href="calendar.php" class="button-link">
  1203. <div class="panel panel-default">
  1204. <div class="panel-body">
  1205. <div class="row">
  1206. <div class="col-xs-1">
  1207. <i class="fa fa-calendar black" style="font-size: 32px"
  1208. title="<?php echo $hesklang['calendar_title_case']; ?>"></i>
  1209. </div>
  1210. <div class="col-xs-11">
  1211. <b><?php echo $hesklang['calendar_title_case']; ?></b><br>
  1212. <?php echo $hesklang['calendar_index']; ?>
  1213. </div>
  1214. </div>
  1215. </div>
  1216. </div>
  1217. </a>
  1218. </div>
  1219. <?php endif; ?>
  1220. </div>
  1221. <?php
  1222. if ($hesk_settings['kb_enable'])
  1223. {
  1224. hesk_kbTopArticles($hesk_settings['kb_index_popart']);
  1225. hesk_kbLatestArticles($hesk_settings['kb_index_latest']);
  1226. }
  1227. ?>
  1228. </div>
  1229. </div>
  1230. <div class="blankSpace"></div>
  1231. <div class="footerWithBorder"></div>
  1232. <div class="blankSpace"></div>
  1233. </div>
  1234. <?php
  1235. // Show a link to admin panel?
  1236. if ($hesk_settings['alink'])
  1237. {
  1238. ?>
  1239. <p class="text-center"><a href="<?php echo $hesk_settings['admin_dir']; ?>/" ><?php echo $hesklang['ap']; ?></a></p>
  1240. <?php
  1241. }
  1242. } // End print_start()
  1243. function forgot_tid()
  1244. {
  1245. global $hesk_settings, $hesklang, $modsForHesk_settings;
  1246. require(HESK_PATH . 'inc/email_functions.inc.php');
  1247. /* Get ticket(s) from database */
  1248. hesk_dbConnect();
  1249. $email = hesk_validateEmail(hesk_POST('email'), 'ERR', 0) or hesk_process_messages($hesklang['enter_valid_email'], 'ticket.php?remind=1');
  1250. if (isset($_POST['open_only'])) {
  1251. $hesk_settings['open_only'] = $_POST['open_only'] == 1 ? 1 : 0;
  1252. }
  1253. /* Prepare ticket statuses */
  1254. $myStatusSQL = hesk_dbQuery("SELECT `ID`, `Key` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses`");
  1255. $my_status = array();
  1256. while ($myStatusRow = hesk_dbFetchAssoc($myStatusSQL)) {
  1257. $my_status[$myStatusRow['ID']] = $hesklang[$myStatusRow['Key']];
  1258. }
  1259. // Get tickets from the database
  1260. $res = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'tickets` FORCE KEY (`statuses`) WHERE ' . ($hesk_settings['open_only'] ? "`status` IN (SELECT `ID` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "statuses` WHERE `IsClosed` = 0) AND " : '') . ' ' . hesk_dbFormatEmail($email) . ' ORDER BY `status` ASC, `lastchange` DESC ');
  1261. $num = hesk_dbNumRows($res);
  1262. if ($num < 1) {
  1263. if ($hesk_settings['open_only']) {
  1264. hesk_process_messages($hesklang['noopen'], 'ticket.php?remind=1&e=' . $email);
  1265. } else {
  1266. hesk_process_messages($hesklang['tid_not_found'], 'ticket.php?remind=1&e=' . $email);
  1267. }
  1268. }
  1269. $tid_list = '';
  1270. $html_tid_list = '<ul>';
  1271. $name = '';
  1272. $email_param = $hesk_settings['email_view_ticket'] ? '&e=' . rawurlencode($email) : '';
  1273. while ($my_ticket = hesk_dbFetchAssoc($res)) {
  1274. $name = $name ? $name : hesk_msgToPlain($my_ticket['name'], 1, 0);
  1275. $tid_list .= "
  1276. $hesklang[trackID]: " . $my_ticket['trackid'] . "
  1277. $hesklang[subject]: " . hesk_msgToPlain($my_ticket['subject'], 1, 0) . "
  1278. $hesklang[status]: " . $my_status[$my_ticket['status']] . "
  1279. $hesk_settings[hesk_url]/ticket.php?track={$my_ticket['trackid']}{$email_param}
  1280. ";
  1281. $html_tid_list .= "<li>
  1282. $hesklang[trackID]: " . $my_ticket['trackid'] . " <br>
  1283. $hesklang[subject]: " . hesk_msgToPlain($my_ticket['subject'], 1, 0) . " <br>
  1284. $hesklang[status]: " . $my_status[$my_ticket['status']] . " <br>
  1285. $hesk_settings[hesk_url]/ticket.php?track={$my_ticket['trackid']}{$email_param}
  1286. </li>";
  1287. }
  1288. $html_tid_list .= '</ul>';
  1289. /* Get e-mail message for customer */
  1290. $msg = hesk_getEmailMessage('forgot_ticket_id', '', $modsForHesk_settings, 0, 0, 1);
  1291. $msg = processEmail($msg, $name, $num, $tid_list);
  1292. // Get HTML message for customer
  1293. $htmlMsg = hesk_getHtmlMessage('forgot_ticket_id', '', $modsForHesk_settings, 0, 0, 1);
  1294. $htmlMsg = processEmail($htmlMsg, $name, $num, $html_tid_list);
  1295. $subject = hesk_getEmailSubject('forgot_ticket_id');
  1296. /* Send e-mail */
  1297. hesk_mail($email, $subject, $msg, $htmlMsg, $modsForHesk_settings);
  1298. /* Show success message */
  1299. $tmp = '<b>' . $hesklang['tid_sent'] . '!</b>';
  1300. $tmp .= '<br />&nbsp;<br />' . $hesklang['tid_sent2'] . '.';
  1301. $tmp .= '<br />&nbsp;<br />' . $hesklang['check_spambox'];
  1302. hesk_process_messages($tmp, 'ticket.php?e=' . $email, 'SUCCESS');
  1303. exit();
  1304. /* Print header */
  1305. $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['tid_sent'];
  1306. require_once(HESK_PATH . 'inc/header.inc.php');
  1307. ?>
  1308. <ol class="breadcrumb">
  1309. <li><a href="<?php echo $hesk_settings['site_url']; ?>"><?php echo $hesk_settings['site_title']; ?></a></li>
  1310. <li><a href="<?php echo $hesk_settings['hesk_url']; ?>"><?php echo $hesk_settings['hesk_title']; ?></a></li>
  1311. <li class="active"><?php echo $hesklang['tid_sent']; ?></li>
  1312. </ol>
  1313. <tr>
  1314. <td>
  1315. <?php
  1316. } // End forgot_tid()
  1317. function processEmail($msg, $name, $num, $tid_list)
  1318. {
  1319. global $hesk_settings;
  1320. $msg = str_replace('%%NAME%%', $name, $msg);
  1321. $msg = str_replace('%%NUM%%', $num, $msg);
  1322. $msg = str_replace('%%LIST_TICKETS%%', $tid_list, $msg);
  1323. $msg = str_replace('%%SITE_TITLE%%', hesk_msgToPlain($hesk_settings['site_title'], 1), $msg);
  1324. $msg = str_replace('%%SITE_URL%%', $hesk_settings['site_url'], $msg);
  1325. return $msg;
  1326. }
  1327. ?>