Bootswatch, Summernote, and Captcheck mods for Mods for HESK (mods-for-hesk.com). In use at support.netsyms.com.
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

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