?> ", play_again : "<?php echo hesk_slashJS($hesklang['play_again']); ?> ", cant_hear_this : "<?php echo hesk_slashJS($hesklang['cant_hear_this']); ?> ", incorrect_try_again : "<?php echo hesk_slashJS($hesklang['incorrect_try_again']); ?> ", image_alt_text : "<?php echo hesk_slashJS($hesklang['image_alt_text']); ?> ", }, }; </script> <?php require_once HESK_PATH . 'inc/recaptcha/recaptchalib.php'; echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true); } elseif ($hesk_settings['recaptcha_use'] == 2) { ?> <div class="g-recaptcha" data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?> "></div> <?php
function print_add_ticket() { global $hesk_settings, $hesklang; // Auto-focus first empty or error field define('AUTOFOCUS', true); // Pre-populate fields // Customer name if (isset($_REQUEST['name'])) { $_SESSION['c_name'] = $_REQUEST['name']; } // Customer email address if (isset($_REQUEST['email'])) { $_SESSION['c_email'] = $_REQUEST['email']; $_SESSION['c_email2'] = $_REQUEST['email']; } // Category ID if (isset($_REQUEST['catid'])) { $_SESSION['c_category'] = intval($_REQUEST['catid']); } if (isset($_REQUEST['category'])) { $_SESSION['c_category'] = intval($_REQUEST['category']); } // Priority if (isset($_REQUEST['priority'])) { $_SESSION['c_priority'] = intval($_REQUEST['priority']); } // Subject if (isset($_REQUEST['subject'])) { $_SESSION['c_subject'] = $_REQUEST['subject']; } // Message if (isset($_REQUEST['message'])) { $_SESSION['c_message'] = $_REQUEST['message']; } // Custom fields foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use'] && isset($_REQUEST[$k])) { $_SESSION['c_' . $k] = $_REQUEST[$k]; } } // Varibles for coloring the fields in case of errors if (!isset($_SESSION['iserror'])) { $_SESSION['iserror'] = array(); } if (!isset($_SESSION['isnotice'])) { $_SESSION['isnotice'] = array(); } if (!isset($_SESSION['c_category']) && !$hesk_settings['select_cat']) { $_SESSION['c_category'] = 0; } hesk_cleanSessionVars('already_submitted'); // Tell header to load reCaptcha API if needed if ($hesk_settings['recaptcha_use'] == 2) { define('RECAPTCHA', 1); } // Print header $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['submit_ticket']; require_once HESK_PATH . 'inc/header.inc.php'; //box hijau ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="3"><img src="img/headerleftsm.jpg" width="3" height="25" alt="" /></td> <td class="headersm"><?php hesk_showTopBar($hesklang['submit_ticket']); ?> </td> <td width="3"><img src="img/headerrightsm.jpg" width="3" height="25" alt="" /></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td><span class="smaller"><a href="<?php echo $hesk_settings['site_url']; ?> " class="smaller"><?php echo $hesk_settings['site_title']; ?> </a> > <a href="<?php echo $hesk_settings['hesk_url']; ?> " class="smaller"><?php echo $hesk_settings['hesk_title']; ?> </a> > <?php echo $hesklang['submit_ticket']; ?> </span></td> </tr> </table> </td> </tr> <tr> <td> <?php // This will handle error, success and notice messages hesk_handle_messages(); //table ni yang box untuk form ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="7" height="7"><img src="img/roundcornerslt.jpg" width="7" height="7" alt="" /></td> <td class="roundcornerstop"></td> <td><img src="img/roundcornersrt.jpg" width="7" height="7" alt="" /></td> </tr> <tr> <td class="roundcornersleft"> </td> <td> <!-- START FORM --> <p style="text-align:center"><?php echo $hesklang['use_form_below']; ?> <font class="important"> *</font></p> <form method="post" action="submit_ticket.php?submit=1" name="form1" enctype="multipart/form-data"> <!-- Contact info --> <table border="0" width="100%"> <tr> <td style="text-align:right" width="150"><?php echo $hesklang['name']; ?> : <font class="important">*</font></td> <td width="80%"><input type="text" name="name" size="40" maxlength="30" value="<?php if (isset($_SESSION['c_name'])) { echo stripslashes(hesk_input($_SESSION['c_name'])); } ?> " <?php if (in_array('name', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> /></td> </tr> <tr> <td style="text-align:right" width="150"><?php echo $hesklang['email']; ?> : <font class="important">*</font></td> <td width="80%"><input type="text" name="email" size="40" maxlength="1000" value="<?php if (isset($_SESSION['c_email'])) { echo stripslashes(hesk_input($_SESSION['c_email'])); } ?> " <?php if (in_array('email', $_SESSION['iserror'])) { echo ' class="isError" '; } elseif (in_array('email', $_SESSION['isnotice'])) { echo ' class="isNotice" '; } ?> <?php if ($hesk_settings['detect_typos']) { echo ' onblur="Javascript:hesk_suggestEmail(0)"'; } ?> /></td> </tr> <?php if ($hesk_settings['confirm_email']) { ?> <tr> <td style="text-align:right" width="150"><?php echo $hesklang['confemail']; ?> : <font class="important">*</font></td> <td width="80%"><input type="text" name="email2" size="40" maxlength="1000" value="<?php if (isset($_SESSION['c_email2'])) { echo stripslashes(hesk_input($_SESSION['c_email2'])); } ?> " <?php if (in_array('email2', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> /></td> </tr> <?php } // End if $hesk_settings['confirm_email'] ?> </table> <div id="email_suggestions"></div> <hr /> <!-- Department and priority --> <?php $is_table = 0; hesk_load_database_functions(); // Get categories hesk_dbConnect(); $res = hesk_dbQuery("SELECT `id`, `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `type`='0' ORDER BY `cat_order` ASC"); if (hesk_dbNumRows($res) == 1) { // Only 1 public category, no need for a select box $row = hesk_dbFetchAssoc($res); echo '<input type="hidden" name="category" value="' . $row['id'] . '" />'; } elseif (hesk_dbNumRows($res) < 1) { // No public categories, set it to default one echo '<input type="hidden" name="category" value="1" />'; } else { // List available categories $is_table = 1; ?> <table border="0" width="100%"> <tr> <td style="text-align:right" width="150"><?php echo $hesklang['category']; ?> : <font class="important">*</font></td> <td width="80%"><select name="category" <?php if (in_array('category', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> > <?php // Show the "Click to select"? if ($hesk_settings['select_cat']) { echo '<option value="">' . $hesklang['select'] . '</option>'; } // List categories while ($row = hesk_dbFetchAssoc($res)) { echo '<option value="' . $row['id'] . '"' . ($_SESSION['c_category'] == $row['id'] ? ' selected="selected"' : '') . '>' . $row['name'] . '</option>'; } ?> </select></td> </tr> <?php } /* Can customer assign urgency? */ if ($hesk_settings['cust_urgency']) { if (!$is_table) { echo '<table border="0" width="100%">'; $is_table = 1; } ?> <tr> <td style="text-align:right" width="150"><?php echo $hesklang['priority']; ?> : <font class="important">*</font></td> <td width="80%"><select name="priority" <?php if (in_array('priority', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> > <?php // Show the "Click to select"? if ($hesk_settings['select_pri']) { echo '<option value="">' . $hesklang['select'] . '</option>'; } ?> <option value="3" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 3) { echo 'selected="selected"'; } ?> ><?php echo $hesklang['low']; ?> </option> <option value="2" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 2) { echo 'selected="selected"'; } ?> ><?php echo $hesklang['medium']; ?> </option> <option value="1" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 1) { echo 'selected="selected"'; } ?> ><?php echo $hesklang['high']; ?> </option> </select></td> </tr> <?php } /* Need to close the table? */ if ($is_table) { echo '</table> <hr />'; } ?> <!-- START CUSTOM BEFORE --> <?php /* custom fields BEFORE comments */ $print_table = 0; foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use'] && $v['place'] == 0) { if ($print_table == 0) { echo '<table border="0" width="100%">'; $print_table = 1; } $v['req'] = $v['req'] ? '<font class="important">*</font>' : ''; if ($v['type'] == 'checkbox') { $k_value = array(); if (isset($_SESSION["c_{$k}"]) && is_array($_SESSION["c_{$k}"])) { foreach ($_SESSION["c_{$k}"] as $myCB) { $k_value[] = stripslashes(hesk_input($myCB)); } } } elseif (isset($_SESSION["c_{$k}"])) { $k_value = stripslashes(hesk_input($_SESSION["c_{$k}"])); } else { $k_value = ''; } switch ($v['type']) { /* Radio box */ case 'radio': echo ' <tr> <td style="text-align:right" width="150" valign="top">' . $v['name'] . ': ' . $v['req'] . '</td> <td width="80%">'; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (strlen($k_value) == 0 || $k_value == $option) { $k_value = $option; $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label><input type="radio" name="' . $k . '" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo '</td> </tr> '; break; /* Select drop-down box */ /* Select drop-down box */ case 'select': $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo ' <tr> <td style="text-align:right" width="150">' . $v['name'] . ': ' . $v['req'] . '</td> <td width="80%"><select name="' . $k . '" ' . $cls . '>'; // Show "Click to select"? $v['value'] = str_replace('{HESK_SELECT}', '', $v['value'], $num); if ($num) { echo '<option value="">' . $hesklang['select'] . '</option>'; } $options = explode('#HESK#', $v['value']); foreach ($options as $option) { if ($k_value == $option) { $k_value = $option; $selected = 'selected="selected"'; } else { $selected = ''; } echo '<option ' . $selected . '>' . $option . '</option>'; } echo '</select></td> </tr> '; break; /* Checkbox */ /* Checkbox */ case 'checkbox': echo ' <tr> <td style="text-align:right" width="150" valign="top">' . $v['name'] . ': ' . $v['req'] . '</td> <td width="80%">'; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (in_array($option, $k_value)) { $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label><input type="checkbox" name="' . $k . '[]" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo '</td> </tr> '; break; /* Large text box */ /* Large text box */ case 'textarea': $size = explode('#', $v['value']); $size[0] = empty($size[0]) ? 5 : intval($size[0]); $size[1] = empty($size[1]) ? 30 : intval($size[1]); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo ' <tr> <td style="text-align:right" width="150" valign="top">' . $v['name'] . ': ' . $v['req'] . '</td> <td width="80%"><textarea name="' . $k . '" rows="' . $size[0] . '" cols="' . $size[1] . '" ' . $cls . '>' . $k_value . '</textarea></td> </tr> '; break; /* Default text input */ /* Default text input */ default: if (strlen($k_value) != 0) { $v['value'] = $k_value; } $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo ' <tr> <td style="text-align:right" width="150">' . $v['name'] . ': ' . $v['req'] . '</td> <td width="80%"><input type="text" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" ' . $cls . ' /></td> </tr> '; } } } /* If table was started we need to close it */ if ($print_table) { echo '</table> <hr />'; $print_table = 0; } ?> <!-- END CUSTOM BEFORE --> <!-- ticket info --> <table border="0" width="100%"> <tr> <td style="text-align:right" width="150"><?php echo $hesklang['subject']; ?> : <font class="important">*</font></td> <td width="80%"><input type="text" name="subject" size="40" maxlength="40" value="<?php if (isset($_SESSION['c_subject'])) { echo stripslashes(hesk_input($_SESSION['c_subject'])); } ?> " <?php if (in_array('subject', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> /></td> </tr> <tr> <td style="text-align:right" width="150" valign="top"><?php echo $hesklang['message']; ?> : <font class="important">*</font></td> <td width="80%"><textarea name="message" rows="12" cols="60" <?php if (in_array('message', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> ><?php if (isset($_SESSION['c_message'])) { echo stripslashes(hesk_input($_SESSION['c_message'])); } ?> </textarea> <!-- START KNOWLEDGEBASE SUGGEST --> <?php if ($hesk_settings['kb_enable'] && $hesk_settings['kb_recommendanswers']) { ?> <div id="kb_suggestions" style="display:none"> <br /> <br /> <img src="img/loading.gif" width="24" height="24" alt="" border="0" style="vertical-align:text-bottom" /> <i><?php echo $hesklang['lkbs']; ?> </i> </div> <script language="Javascript" type="text/javascript"><!-- hesk_suggestKB(); //--> </script> <?php } ?> <!-- END KNOWLEDGEBASE SUGGEST --> </td> </tr> </table> <!-- START CUSTOM AFTER --> <?php /* custom fields AFTER comments */ $print_table = 0; foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use'] && $v['place']) { if ($print_table == 0) { echo ' <hr /> <table border="0" width="100%"> '; $print_table = 1; } $v['req'] = $v['req'] ? '<font class="important">*</font>' : ''; if ($v['type'] == 'checkbox') { $k_value = array(); if (isset($_SESSION["c_{$k}"]) && is_array($_SESSION["c_{$k}"])) { foreach ($_SESSION["c_{$k}"] as $myCB) { $k_value[] = stripslashes(hesk_input($myCB)); } } } elseif (isset($_SESSION["c_{$k}"])) { $k_value = stripslashes(hesk_input($_SESSION["c_{$k}"])); } else { $k_value = ''; } switch ($v['type']) { /* Radio box */ case 'radio': echo ' <tr> <td style="text-align:right" width="150" valign="top">' . $v['name'] . ': ' . $v['req'] . '</td> <td width="80%">'; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (strlen($k_value) == 0 || $k_value == $option) { $k_value = $option; $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label><input type="radio" name="' . $k . '" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo '</td> </tr> '; break; /* Select drop-down box */ /* Select drop-down box */ case 'select': $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo ' <tr> <td style="text-align:right" width="150">' . $v['name'] . ': ' . $v['req'] . '</td> <td width="80%"><select name="' . $k . '" ' . $cls . '>'; // Show "Click to select"? $v['value'] = str_replace('{HESK_SELECT}', '', $v['value'], $num); if ($num) { echo '<option value="">' . $hesklang['select'] . '</option>'; } $options = explode('#HESK#', $v['value']); foreach ($options as $option) { if ($k_value == $option) { $k_value = $option; $selected = 'selected="selected"'; } else { $selected = ''; } echo '<option ' . $selected . '>' . $option . '</option>'; } echo '</select></td> </tr> '; break; /* Checkbox */ /* Checkbox */ case 'checkbox': echo ' <tr> <td style="text-align:right" width="150" valign="top">' . $v['name'] . ': ' . $v['req'] . '</td> <td width="80%">'; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (in_array($option, $k_value)) { $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label><input type="checkbox" name="' . $k . '[]" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo '</td> </tr> '; break; /* Large text box */ /* Large text box */ case 'textarea': $size = explode('#', $v['value']); $size[0] = empty($size[0]) ? 5 : intval($size[0]); $size[1] = empty($size[1]) ? 30 : intval($size[1]); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo ' <tr> <td style="text-align:right" width="150" valign="top">' . $v['name'] . ': ' . $v['req'] . '</td> <td width="80%"><textarea name="' . $k . '" rows="' . $size[0] . '" cols="' . $size[1] . '" ' . $cls . '>' . $k_value . '</textarea></td> </tr> '; break; /* Default text input */ /* Default text input */ default: if (strlen($k_value) != 0) { $v['value'] = $k_value; } $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo ' <tr> <td style="text-align:right" width="150">' . $v['name'] . ': ' . $v['req'] . '</td> <td width="80%"><input type="text" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" ' . $cls . ' /></td> </tr> '; } } } /* If table was started we need to close it */ if ($print_table) { echo '</table>'; $print_table = 0; } ?> <!-- END CUSTOM AFTER --> <?php /* attachments */ if ($hesk_settings['attachments']['use']) { ?> <hr /> <table border="0" width="100%"> <tr> <td style="text-align:right" width="150" valign="top"><?php echo $hesklang['attachments']; ?> :</td> <td width="80%" valign="top"> <?php for ($i = 1; $i <= $hesk_settings['attachments']['max_number']; $i++) { $cls = $i == 1 && in_array('attachments', $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<input type="file" name="attachment[' . $i . ']" size="50" ' . $cls . ' /><br />'; } ?> <a href="file_limits.php" target="_blank" onclick="Javascript:hesk_window('file_limits.php',250,500);return false;"><?php echo $hesklang['ful']; ?> </a> </td> </tr> </table> <?php } if ($hesk_settings['question_use'] || $hesk_settings['secimg_use']) { ?> <hr /> <!-- Security checks --> <table border="0" width="100%"> <?php if ($hesk_settings['question_use']) { ?> <tr> <td style="text-align:right;vertical-align:top" width="150"><?php echo $hesklang['verify_q']; ?> <font class="important">*</font></td> <td width="80%"> <?php $value = ''; if (isset($_SESSION['c_question'])) { $value = stripslashes(hesk_input($_SESSION['c_question'])); } $cls = in_array('question', $_SESSION['iserror']) ? ' class="isError" ' : ''; echo $hesk_settings['question_ask'] . '<br /><input type="text" name="question" size="20" value="' . $value . '" ' . $cls . ' />'; ?> <br /> </td> </tr> <?php } if ($hesk_settings['secimg_use']) { ?> <tr> <td style="text-align:right;vertical-align:top" width="150"><?php echo $hesklang['verify_i']; ?> <font class="important">*</font></td> <td width="80%"> <?php // SPAM prevention verified for this session if (isset($_SESSION['img_verified'])) { echo '<img src="' . HESK_PATH . 'img/success.png" width="16" height="16" border="0" alt="" style="vertical-align:text-bottom" /> ' . $hesklang['vrfy']; } elseif ($hesk_settings['recaptcha_use'] == 1) { ?> <script type="text/javascript"> var RecaptchaOptions = { theme : '<?php echo isset($_SESSION['iserror']) && in_array('mysecnum', $_SESSION['iserror']) ? 'red' : 'white'; ?> ', custom_translations : { visual_challenge : "<?php echo hesk_slashJS($hesklang['visual_challenge']); ?> ", audio_challenge : "<?php echo hesk_slashJS($hesklang['audio_challenge']); ?> ", refresh_btn : "<?php echo hesk_slashJS($hesklang['refresh_btn']); ?> ", instructions_visual : "<?php echo hesk_slashJS($hesklang['instructions_visual']); ?> ", instructions_context : "<?php echo hesk_slashJS($hesklang['instructions_context']); ?> ", instructions_audio : "<?php echo hesk_slashJS($hesklang['instructions_audio']); ?> ", help_btn : "<?php echo hesk_slashJS($hesklang['help_btn']); ?> ", play_again : "<?php echo hesk_slashJS($hesklang['play_again']); ?> ", cant_hear_this : "<?php echo hesk_slashJS($hesklang['cant_hear_this']); ?> ", incorrect_try_again : "<?php echo hesk_slashJS($hesklang['incorrect_try_again']); ?> ", image_alt_text : "<?php echo hesk_slashJS($hesklang['image_alt_text']); ?> ", }, }; </script> <?php require HESK_PATH . 'inc/recaptcha/recaptchalib.php'; echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true); } elseif ($hesk_settings['recaptcha_use'] == 2) { ?> <div class="g-recaptcha" data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?> "></div> <?php } else { $cls = in_array('mysecnum', $_SESSION['iserror']) ? ' class="isError" ' : ''; echo $hesklang['sec_enter'] . '<br /> <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" /> ' . '<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>' . '<br /> <br /><input type="text" name="mysecnum" size="20" maxlength="5" ' . $cls . ' />'; } ?> </td> </tr> <?php } ?> </table> <?php } ?> <!-- Submit --> <?php if ($hesk_settings['submit_notice']) { ?> <hr /> <div align="center"> <table border="0"> <tr> <td> <b><?php echo $hesklang['before_submit']; ?> </b> <ul> <li><?php echo $hesklang['all_info_in']; ?> .</li> <li><?php echo $hesklang['all_error_free']; ?> .</li> </ul> <b><?php echo $hesklang['we_have']; ?> :</b> <ul> <li><?php echo hesk_htmlspecialchars($_SERVER['REMOTE_ADDR']) . ' ' . $hesklang['recorded_ip']; ?> </li> <li><?php echo $hesklang['recorded_time']; ?> </li> </ul> <p align="center"><input type="hidden" name="token" value="<?php hesk_token_echo(); ?> " /> <input type="submit" value="<?php echo $hesklang['sub_ticket']; ?> " class="orangebutton" onmouseover="hesk_btn(this,'orangebuttonover');" onmouseout="hesk_btn(this,'orangebutton');" /></p> </td> </tr> </table> </div> <?php } else { ?> <br /> <br /> <table border="0" width="100%"> <tr> <td style="text-align:right" width="150"> </td> <td width="80%"><input type="hidden" name="token" value="<?php hesk_token_echo(); ?> " /> <input type="submit" value="<?php echo $hesklang['sub_ticket']; ?> " class="orangebutton" onmouseover="hesk_btn(this,'orangebuttonover');" onmouseout="hesk_btn(this,'orangebutton');" /><br /> <br /> </td> </tr> </table> <?php } // End ELSE submit_notice ?> <!-- Do not delete or modify the code below, it is used to detect simple SPAM bots --> <input type="hidden" name="hx" value="3" /><input type="hidden" name="hy" value="" /> <!-- > <input type="text" name="phone" value="3" /> < --> </form> <!-- END FORM --> </td> <td class="roundcornersright"> </td> </tr> <tr> <td><img src="img/roundcornerslb.jpg" width="7" height="7" alt="" /></td> <td class="roundcornersbottom"></td> <td width="7" height="7"><img src="img/roundcornersrb.jpg" width="7" height="7" alt="" /></td> </tr> </table> <?php hesk_cleanSessionVars('iserror'); hesk_cleanSessionVars('isnotice'); }
function print_login() { global $hesk_settings, $hesklang; // Tell header to load reCaptcha API if needed if ($hesk_settings['recaptcha_use'] == 2) { define('RECAPTCHA', 1); } $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['admin_login']; require_once HESK_PATH . 'inc/header.inc.php'; if (hesk_isREQUEST('notice')) { hesk_process_messages($hesklang['session_expired'], 'NOREDIRECT'); } if (!isset($_SESSION['a_iserror'])) { $_SESSION['a_iserror'] = array(); } ?> <div class="loginError"><?php /* This will handle error, success and notice messages */ hesk_handle_messages(); ?> </div> <div> <div class="panel panel-default form-signin"> <div class="panel-heading"> <h4><span <?php echo $iconDisplay; ?> ><span class="mega-octicon octicon-sign-in"></span> </span><?php echo $hesklang['admin_login']; ?> </a></h4> </div> <div class="panel-body"> <form class="form-signin form-horizontal" role="form" action="index.php" method="post" name="form1"> <?php if (in_array('pass', $_SESSION['a_iserror'])) { echo '<div class="form-group has-error">'; } else { echo '<div class="form-group">'; } ?> <label for="user" class="col-sm-4 control-label"><?php echo $hesklang['username']; ?> :</label> <div class="col-sm-8"> <?php if (defined('HESK_USER')) { $savedUser = HESK_USER; } else { $savedUser = hesk_htmlspecialchars(hesk_COOKIE('hesk_username')); } $is_1 = ''; $is_2 = ''; $is_3 = ''; $remember_user = hesk_POST('remember_user'); if ($hesk_settings['autologin'] && (isset($_COOKIE['hesk_p']) || $remember_user == 'AUTOLOGIN')) { $is_1 = 'checked="checked"'; } elseif (isset($_COOKIE['hesk_username']) || $remember_user == 'JUSTUSER') { $is_2 = 'checked="checked"'; } else { $is_3 = 'checked="checked"'; } if ($hesk_settings['list_users']) { echo '<select class="form-control" name="user">'; $res = hesk_dbQuery('SELECT `user` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'users` ORDER BY `user` ASC'); while ($row = hesk_dbFetchAssoc($res)) { $sel = strtolower($savedUser) == strtolower($row['user']) ? 'selected="selected"' : ''; echo '<option value="' . $row['user'] . '" ' . $sel . '>' . $row['user'] . '</option>'; } echo '</select>'; } else { echo '<input class="form-control" type="text" name="user" size="35" placeholder="' . htmlspecialchars($hesklang['username']) . '" value="' . $savedUser . '" />'; } ?> </div> </div> <?php if (in_array('pass', $_SESSION['a_iserror'])) { echo '<div class="form-group has-error">'; } else { echo '<div class="form-group">'; } ?> <label for="pass" class="col-sm-4 control-label"><?php echo $hesklang['pass']; ?> :</label> <div class="col-sm-8"> <input type="password" class="form-control" id="pass" name="pass" size="35" placeholder="<?php echo htmlspecialchars($hesklang['pass']); ?> " /> </div> </div> <?php if ($hesk_settings['secimg_use'] == 2) { // SPAM prevention verified for this session if (isset($_SESSION['img_a_verified'])) { echo '<img src="' . HESK_PATH . 'img/success.png" width="16" height="16" border="0" alt="" style="vertical-align:text-bottom" /> ' . $hesklang['vrfy']; } elseif ($hesk_settings['recaptcha_use'] == 1) { ?> <script type="text/javascript"> var RecaptchaOptions = { theme : '<?php echo isset($_SESSION['a_iserror']) && in_array('mysecnum', $_SESSION['a_iserror']) ? 'red' : 'white'; ?> ', custom_translations : { visual_challenge : "<?php echo hesk_slashJS($hesklang['visual_challenge']); ?> ", audio_challenge : "<?php echo hesk_slashJS($hesklang['audio_challenge']); ?> ", refresh_btn : "<?php echo hesk_slashJS($hesklang['refresh_btn']); ?> ", instructions_visual : "<?php echo hesk_slashJS($hesklang['instructions_visual']); ?> ", instructions_context : "<?php echo hesk_slashJS($hesklang['instructions_context']); ?> ", instructions_audio : "<?php echo hesk_slashJS($hesklang['instructions_audio']); ?> ", help_btn : "<?php echo hesk_slashJS($hesklang['help_btn']); ?> ", play_again : "<?php echo hesk_slashJS($hesklang['play_again']); ?> ", cant_hear_this : "<?php echo hesk_slashJS($hesklang['cant_hear_this']); ?> ", incorrect_try_again : "<?php echo hesk_slashJS($hesklang['incorrect_try_again']); ?> ", image_alt_text : "<?php echo hesk_slashJS($hesklang['image_alt_text']); ?> " } }; </script> <?php require_once HESK_PATH . 'inc/recaptcha/recaptchalib.php'; echo '<div class="form-group"><div class="col-md-8 col-md-offset-4">'; echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true); echo '</div></div>'; } elseif ($hesk_settings['recaptcha_use'] == 2) { ?> <div class="form-group"> <div class="col-md-8 col-md-offset-4"> <div class="g-recaptcha" data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?> "></div> </div> </div> <?php } else { echo '<div class="form-group"><div class="col-md-8 col-md-offset-4">'; $cls = in_array('mysecnum', $_SESSION['a_iserror']) ? ' class="isError" ' : ''; echo $hesklang['sec_enter'] . '<br /> <br /><img src="' . HESK_PATH . '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" /> ' . '<a href="javascript:void(0)" onclick="javascript:document.form1.secimg.src=\'' . HESK_PATH . 'print_sec_img.php?\'+ ( Math.floor((90000)*Math.random()) + 10000);"><img src="' . HESK_PATH . 'img/reload.png" height="24" width="24" alt="' . $hesklang['reload'] . '" title="' . $hesklang['reload'] . '" border="0" style="vertical-align:text-bottom" /></a>' . '<br /> <br /><input type="text" name="mysecnum" size="20" maxlength="5" ' . $cls . ' />'; echo '</div></div>'; } } // End if $hesk_settings['secimg_use'] == 2 if ($hesk_settings['autologin']) { ?> <div class="form-group"> <div class="col-md-offset-4 col-md-8"> <div class="radio"> <label><input type="radio" name="remember_user" value="AUTOLOGIN" <?php echo $is_1; ?> /> <?php echo $hesklang['autologin']; ?> </label> </div> <div class="radio"> <label><input type="radio" name="remember_user" value="JUSTUSER" <?php echo $is_2; ?> /> <?php echo $hesklang['just_user']; ?> </label> </div> <div class="radio"> <label><input type="radio" name="remember_user" value="NOTHANKS" <?php echo $is_3; ?> /> <?php echo $hesklang['nothx']; ?> </label> </div> </div> </div> <?php } else { ?> <div class="form-group"> <div class="col-md-offset-4 col-md-8"> <div class="checkbox"> <label><input type="checkbox" name="remember_user" value="JUSTUSER" <?php echo $is_2; ?> /> <?php echo $hesklang['remember_user']; ?> </label> </div> </div> </div> <?php } // End if $hesk_settings['autologin'] ?> <div class="form-group"> <div class="col-md-offset-4 col-md-8"> <input type="submit" value="<?php echo $hesklang['click_login']; ?> " class="btn btn-default" /> <input type="hidden" name="a" value="do_login" /> <?php if (hesk_isREQUEST('goto') && ($url = hesk_REQUEST('goto'))) { echo '<input type="hidden" name="goto" value="' . $url . '" />'; } // Do we allow staff password reset? if ($hesk_settings['reset_pass']) { echo '<br /> <br /><a href="password.php" class="smaller">' . $hesklang['fpass'] . '</a>'; } ?> </div> </div> </form> </div> </div> </div> <p> </p> <?php hesk_cleanSessionVars('a_iserror'); require_once HESK_PATH . 'inc/footer.inc.php'; exit; }
function print_login() { global $hesk_settings, $hesklang; $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['admin_login']; require_once HESK_PATH . 'inc/header.inc.php'; if (hesk_isREQUEST('notice')) { hesk_process_messages($hesklang['session_expired'], 'NOREDIRECT'); } if (!isset($_SESSION['a_iserror'])) { $_SESSION['a_iserror'] = array(); } ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="3"><img src="../img/headerleftsm.jpg" width="3" height="25" alt="" /></td> <td class="headersm"><?php echo $hesklang['login']; ?> </td> <td width="3"><img src="../img/headerrightsm.jpg" width="3" height="25" alt="" /></td> </tr> </table> <table width="100%" border="0" cellspacing="0" cellpadding="3"> <tr> <td><span class="smaller"><a href="<?php echo $hesk_settings['site_url']; ?> " class="smaller"><?php echo $hesk_settings['site_title']; ?> </a> > <?php echo $hesklang['admin_login']; ?> </span></td> </tr> </table> </td> </tr> <tr> <td> <br /> <?php /* This will handle error, success and notice messages */ hesk_handle_messages(); ?> <br /> <div align="center"> <table border="0" cellspacing="0" cellpadding="0" width="<?php echo $hesk_settings['secimg_use'] == 2 ? '60' : '50'; ?> % "> <tr> <td width="7" height="7"><img src="../img/roundcornerslt.jpg" width="7" height="7" alt="" /></td> <td class="roundcornerstop"></td> <td><img src="../img/roundcornersrt.jpg" width="7" height="7" alt="" /></td> </tr> <tr> <td class="roundcornersleft"> </td> <td> <form action="index.php" method="post" name="form1"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td width="60" style="text-align:center"><img src="../img/login.png" alt="" width="24" height="24" /></td> <td> <p><b><?php echo $hesklang['admin_login']; ?> </a></b></p> </td> </tr> <tr> <td width="60"> </td> <td> </td> </tr> <tr> <td width="60"> </td> <td><?php echo $hesklang['username']; ?> :<br /> <?php $cls = in_array('user', $_SESSION['a_iserror']) ? ' class="isError" ' : ''; if (defined('HESK_USER')) { $savedUser = HESK_USER; } else { $savedUser = hesk_htmlspecialchars(hesk_COOKIE('hesk_username')); } $is_1 = ''; $is_2 = ''; $is_3 = ''; $remember_user = hesk_POST('remember_user'); if ($hesk_settings['autologin'] && (isset($_COOKIE['hesk_p']) || $remember_user == 'AUTOLOGIN')) { $is_1 = 'checked="checked"'; } elseif (isset($_COOKIE['hesk_username']) || $remember_user == 'JUSTUSER') { $is_2 = 'checked="checked"'; } else { $is_3 = 'checked="checked"'; } if ($hesk_settings['list_users']) { echo '<select name="user" ' . $cls . '>'; $res = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'users` ORDER BY `user` ASC'); while ($row = hesk_dbFetchAssoc($res)) { $sel = strtolower($savedUser) == strtolower($row['user']) ? 'selected="selected"' : ''; echo '<option value="' . $row['user'] . '" ' . $sel . '>' . $row['user'] . '</option>'; } echo '</select>'; } else { echo '<input type="text" name="user" size="35" value="' . $savedUser . '" ' . $cls . ' />'; } ?> </td> </tr> <tr> <td width="60"> </td> <td> </td> </tr> <tr> <td width="60"> </td> <td><?php echo $hesklang['pass']; ?> :<br /><input type="password" name="pass" size="35" <?php if (in_array('pass', $_SESSION['a_iserror'])) { echo ' class="isError" '; } ?> /></td> </tr> <?php if ($hesk_settings['secimg_use'] == 2) { ?> <tr> <td width="60"> </td> <td> <hr /> <?php // SPAM prevention verified for this session if (isset($_SESSION['img_a_verified'])) { echo '<img src="' . HESK_PATH . 'img/success.png" width="16" height="16" border="0" alt="" style="vertical-align:text-bottom" /> ' . $hesklang['vrfy']; } elseif ($hesk_settings['recaptcha_use']) { ?> <script type="text/javascript"> var RecaptchaOptions = { theme : '<?php echo isset($_SESSION['a_iserror']) && in_array('mysecnum', $_SESSION['a_iserror']) ? 'red' : 'white'; ?> ', custom_translations : { visual_challenge : "<?php echo hesk_slashJS($hesklang['visual_challenge']); ?> ", audio_challenge : "<?php echo hesk_slashJS($hesklang['audio_challenge']); ?> ", refresh_btn : "<?php echo hesk_slashJS($hesklang['refresh_btn']); ?> ", instructions_visual : "<?php echo hesk_slashJS($hesklang['instructions_visual']); ?> ", instructions_context : "<?php echo hesk_slashJS($hesklang['instructions_context']); ?> ", instructions_audio : "<?php echo hesk_slashJS($hesklang['instructions_audio']); ?> ", help_btn : "<?php echo hesk_slashJS($hesklang['help_btn']); ?> ", play_again : "<?php echo hesk_slashJS($hesklang['play_again']); ?> ", cant_hear_this : "<?php echo hesk_slashJS($hesklang['cant_hear_this']); ?> ", incorrect_try_again : "<?php echo hesk_slashJS($hesklang['incorrect_try_again']); ?> ", image_alt_text : "<?php echo hesk_slashJS($hesklang['image_alt_text']); ?> ", }, }; </script> <?php require_once HESK_PATH . 'inc/recaptcha/recaptchalib.php'; echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, $hesk_settings['recaptcha_ssl']); } else { $cls = in_array('mysecnum', $_SESSION['a_iserror']) ? ' class="isError" ' : ''; echo $hesklang['sec_enter'] . '<br /> <br /><img src="' . HESK_PATH . '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" /> ' . '<a href="javascript:void(0)" onclick="javascript:document.form1.secimg.src=\'' . HESK_PATH . 'print_sec_img.php?\'+ ( Math.floor((90000)*Math.random()) + 10000);"><img src="' . HESK_PATH . 'img/reload.png" height="24" width="24" alt="' . $hesklang['reload'] . '" title="' . $hesklang['reload'] . '" border="0" style="vertical-align:text-bottom" /></a>' . '<br /> <br /><input type="text" name="mysecnum" size="20" maxlength="5" ' . $cls . ' />'; } ?> <hr /> </td> </tr> <?php } else { ?> <tr> <td width="60"> </td> <td> </td> </tr> <?php } // End if $hesk_settings['secimg_use'] == 2 if ($hesk_settings['autologin']) { ?> <tr> <td width="60"> </td> <td><label><input type="radio" name="remember_user" value="AUTOLOGIN" <?php echo $is_1; ?> /> <?php echo $hesklang['autologin']; ?> </label><br /> <label><input type="radio" name="remember_user" value="JUSTUSER" <?php echo $is_2; ?> /> <?php echo $hesklang['just_user']; ?> </label><br /> <label><input type="radio" name="remember_user" value="NOTHANKS" <?php echo $is_3; ?> /> <?php echo $hesklang['nothx']; ?> </label></td> </tr> <?php } else { ?> <tr> <td width="60"> </td> <td><label><input type="checkbox" name="remember_user" value="JUSTUSER" <?php echo $is_2; ?> /> <?php echo $hesklang['remember_user']; ?> </label></td> </tr> <?php } // End if $hesk_settings['autologin'] ?> <tr> <td width="60"> </td> <td> </td> </tr> <tr> <td width="60"> </td> <td><input type="submit" value="<?php echo $hesklang['click_login']; ?> " class="orangebutton" onmouseover="hesk_btn(this,'orangebuttonover');" onmouseout="hesk_btn(this,'orangebutton');" /> <input type="hidden" name="a" value="do_login" /> <?php if (hesk_isREQUEST('goto') && ($url = hesk_REQUEST('goto'))) { echo '<input type="hidden" name="goto" value="' . $url . '" />'; } ?> <br /> </td> </tr> </table> </form> </td> <td class="roundcornersright"> </td> </tr> <tr> <td><img src="../img/roundcornerslb.jpg" width="7" height="7" alt="" /></td> <td class="roundcornersbottom"></td> <td width="7" height="7"><img src="../img/roundcornersrb.jpg" width="7" height="7" alt="" /></td> </tr> </table> </div> <p> </p> <?php hesk_cleanSessionVars('a_iserror'); require_once HESK_PATH . 'inc/footer.inc.php'; exit; }
function print_add_ticket() { global $hesk_settings, $hesklang; // Auto-focus first empty or error field define('AUTOFOCUS', true); // Pre-populate fields // Customer name if (isset($_REQUEST['name'])) { $_SESSION['c_name'] = $_REQUEST['name']; } // Customer email address if (isset($_REQUEST['email'])) { $_SESSION['c_email'] = $_REQUEST['email']; $_SESSION['c_email2'] = $_REQUEST['email']; } // Category ID if (isset($_REQUEST['catid'])) { $_SESSION['c_category'] = intval($_REQUEST['catid']); } if (isset($_REQUEST['category'])) { $_SESSION['c_category'] = intval($_REQUEST['category']); } // Priority if (isset($_REQUEST['priority'])) { $_SESSION['c_priority'] = intval($_REQUEST['priority']); } // Subject if (isset($_REQUEST['subject'])) { $_SESSION['c_subject'] = $_REQUEST['subject']; } // Message if (isset($_REQUEST['message'])) { $_SESSION['c_message'] = $_REQUEST['message']; } // Custom fields foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use'] && isset($_REQUEST[$k])) { $_SESSION['c_' . $k] = $_REQUEST[$k]; } } // Varibles for coloring the fields in case of errors if (!isset($_SESSION['iserror'])) { $_SESSION['iserror'] = array(); } if (!isset($_SESSION['isnotice'])) { $_SESSION['isnotice'] = array(); } if (!isset($_SESSION['c_category']) && !$hesk_settings['select_cat']) { $_SESSION['c_category'] = 0; } // Tell header to load reCaptcha API if needed if ($hesk_settings['recaptcha_use'] == 2) { define('RECAPTCHA', 1); } // Print header $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['submit_ticket']; require_once HESK_PATH . 'inc/header.inc.php'; ?> <nav class="row navbar navbar-default" id="showTopBar-indexPhp"> <div class="menu-wrapper"> <div class="container showTopBar"><?php hesk_showTopBar($hesk_settings['hesk_title']); ?> </div> </div><!-- end showTopBar-indexPhp --> </nav> <nav class="row navbar userMenu"> <div class="container"> <div class="collapse navbar-collapse"> <ul class="nav navbar-nav"> <li id="userMenu-home"><a href="index.php"><?php echo $hesklang['main_page']; ?> </a></li> <li id="userMenu-submitTicket"><a href="index.php?a=add"><?php echo $hesklang['submit_tick']; ?> </a></li> <li id="client-username"><a href="client_profile.php"><?php echo $hesklang['hello']; if (isset($_SESSION['id']['user']) && $_SESSION['id']['user']) { echo $_SESSION['id']['user']; } ?> </a></li> <li id="userMenu-logout"><a href="logout.php"><?php echo $hesklang['logout']; ?> </a></li> </ul> </div><!--/.nav-collapse --> </div> </nav> <div class="container siteUrl-title-indexPhp"> <div class="container form-inline"> <span><a href="<?php echo $hesk_settings['site_url']; ?> " class="smaller" style="text-decoration: none;"><?php echo $hesk_settings['site_title']; ?> </a> > <a href="<?php echo $hesk_settings['hesk_url']; ?> " class="smaller"><?php echo 'Help Desk'; ?> </a> > <?php echo $hesklang['submit_ticket']; ?> </span> </div> </div><!-- end siteUrl-title-indexPhp --> <br/> <br/> <!--</td> </tr>--> <!--start in this page end in line 947 <tr> <td>--> <?php // This will handle error, success and notice messages hesk_handle_messages(); ?> <div class="container" id="view-submitTicket"> <img src="img/existingticket.jpg" alt="existingticket"/><span><?php echo $hesklang['submit_ticket']; ?> </span></div> <br/> <div class="container form-submit-support-request"> <br/> <div><?php echo $hesklang['use_form_below']; ?> <font class="important"> *</font></div><br/> <!-- START FORM --> <form class="form-horizontal" method="post" action="submit_ticket.php?submit=1" name="form1" enctype="multipart/form-data" autocomplete="off"> <!-- Contact info --> <div class="form-group" style="margin-bottom: 5px;"> <label class="col-sm-2" for="name-contact-info-support-request"><?php echo $hesklang['name']; ?> : <font class="important">*</font></label> <div class="col-sm-4"><input type="text" class="form-control contact-support-request" id="name-contact-info-support-request" name="name" value="<?php if (isset($_SESSION['id']['user'])) { echo $_SESSION['id']['user']; } ?> " <?php if (in_array('name', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> readonly></div> </div> <div class="form-group" style="margin-bottom: 5px;"> <label class="col-sm-2" for="email-contact-info-support-request"><?php echo $hesklang['email']; ?> : <font class="important">*</font></label> <div class="col-sm-4"><input type="text" class="form-control contact-support-request" id="email-contact-info-support-request" name="email" value="<?php if (isset($_SESSION['id']['email'])) { echo $_SESSION['id']['email']; } ?> " <?php if (in_array('email', $_SESSION['iserror'])) { echo ' class="isError" '; } elseif (in_array('email', $_SESSION['isnotice'])) { echo ' class="isNotice" '; } ?> <?php if ($hesk_settings['detect_typos']) { echo ' onblur="Javascript:hesk_suggestEmail(0)"'; } ?> readonly></div> </div> <?php if ($hesk_settings['confirm_email']) { ?> <div class="form-group" style="margin-bottom: 5px;"> <label class="col-sm-2" for="confemail-contact-info-support-request"><?php echo $hesklang['confemail']; ?> : <font class="important">*</font></label> <div class="col-sm-4"><input type="text" class="form-control contact-support-request" id="confemail-contact-info-support-request" name="email2" value="<?php if (isset($_SESSION['c_email2'])) { echo stripslashes(hesk_input($_SESSION['c_email2'])); } ?> " <?php if (in_array('email2', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> /></div> </div> <?php } // End if $hesk_settings['confirm_email'] ?> <?php hesk_load_database_functions(); hesk_dbConnect(); ?> <div class="form-group" style="margin-bottom: 5px;"> <label class="col-sm-2" for="select-cont"><?php echo $hesklang['contract']; ?> : <font class="important">*</font></label> <div class="col-sm-4"><select class="form-control contact-support-request" required="required" title="Required field" id="select-cont" name="contract_name"> <option></option> <?php $res_client = hesk_dbQuery('SELECT contract_Id FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'contractforclient` WHERE `client_Id`=' . $_SESSION["id"]["id"]); $i = 1; while ($row_client = mysqli_fetch_array($res_client)) { $result_contract = hesk_dbQuery('SELECT id, contract_name FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'contracts` WHERE id=' . $row_client['contract_Id']); $cont_result = mysqli_fetch_array($result_contract); echo '<option value="' . $cont_result['id'] . '">' . $cont_result['contract_name'] . '</option>'; } ?> </select></div> <?php ?> </div> <?php $result_client = hesk_dbQuery('SELECT contract_Id FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . "contractforclient` WHERE `client_Id`='" . $_SESSION["id"]["id"] . "' LIMIT 1"); $row_client = mysqli_fetch_array($result_client); $result_client = hesk_dbQuery('SELECT company_id FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . "contracts` WHERE `id`='" . $row_client['contract_Id'] . "' LIMIT 1"); if ($row_client = mysqli_fetch_array($result_client)) { $result_company = hesk_dbQuery('SELECT id, company_name FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'companies` WHERE id=' . $row_client['company_id']); $company_result = mysqli_fetch_array($result_company); echo '<input type="hidden" class="form-control" name="company_name" value="' . $company_result['id'] . '" size="40" maxlength="1000" />'; } ?> <!-- Department and priority --> <?php $is_table = 0; // Get categories $res = hesk_dbQuery("SELECT `id`, `categ_impro_id`, `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `type`='0' AND `active`='1' ORDER BY `cat_order` ASC"); /*if (hesk_dbNumRows($res) == 1) { // Only 1 public category, no need for a select box $row = hesk_dbFetchAssoc($res); echo '<input type="hidden" name="category" value="'.$row['id'].'" />'; } /*elseif (hesk_dbNumRows($res) < 1) { // No public categories, set it to default one echo '<input type="hidden" name="category" value="1" />'; }*/ /*else {*/ // List available categories $is_table = 1; ?> <!-- start table here end in line 304 --> <div class="form-group" style="margin-bottom: 5px;"> <label class="col-sm-2" for="category-department-priority-support-request"><?php echo $hesklang['category']; ?> : <font class="important">*</font></label> <div class="col-sm-4"><select class="form-control contact-support-request" required="required" title="Required field" id="category-department-priority-support-request" name="category" <?php if (in_array('category', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> > <option></option> <?php // Show the "Click to select"? if ($hesk_settings['select_cat']) { echo '<option value="">' . $hesklang['select'] . '</option>'; } // List categories while ($row = hesk_dbFetchAssoc($res)) { echo '<option value="' . $row['id'] . '"' . ($_SESSION['c_category'] == $row['id'] ? ' selected="selected"' : '') . '>' . $row['name'] . '</option>'; } ?> </select></div> </div> <?php /*}*/ /* Can customer assign urgency? */ if ($hesk_settings['cust_urgency']) { if (!$is_table) { echo '<div class="form-group department-priority-support-request">'; $is_table = 1; } ?> <div class="form-group" style="margin-bottom: 5px;"> <label class="col-sm-2" for="priority-department-priority-support-request"><?php echo $hesklang['priority']; ?> : <font class="important">*</font></label> <div class="col-sm-4"><select class="form-control contact-support-request" required="required" title="Required field" id="priority-department-priority-support-request" name="priority" <?php if (in_array('priority', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> > <option></option> <?php // Show the "Click to select"? if ($hesk_settings['select_pri']) { echo '<option value="">' . $hesklang['select'] . '</option>'; } ?> <option value="3" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 3) { echo 'selected="selected"'; } ?> ><?php echo $hesklang['low']; ?> </option> <option value="2" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 2) { echo 'selected="selected"'; } ?> ><?php echo $hesklang['medium']; ?> </option> <option value="1" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 1) { echo 'selected="selected"'; } ?> ><?php echo $hesklang['high']; ?> </option> </select></div> </div> <?php } /* Need to close the table? */ if ($is_table) { echo ''; } ?> <!-- START CUSTOM BEFORE --> <?php /* custom fields BEFORE comments */ $print_table = 0; foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use'] && $v['place'] == 0) { if ($print_table == 0) { echo '<div class="custom-before-support-request">'; /* start table in line 317-486*/ $print_table = 1; } $v['req'] = $v['req'] ? '<font class="important">*</font>' : ''; if ($v['type'] == 'checkbox') { $k_value = array(); if (isset($_SESSION["c_{$k}"]) && is_array($_SESSION["c_{$k}"])) { foreach ($_SESSION["c_{$k}"] as $myCB) { $k_value[] = stripslashes(hesk_input($myCB)); } } } elseif (isset($_SESSION["c_{$k}"])) { $k_value = stripslashes(hesk_input($_SESSION["c_{$k}"])); } else { $k_value = ''; } switch ($v['type']) { /* Radio box */ case 'radio': /*start tr in line 348-375*/ echo ' <div class="form-inline "> <label>' . $v['name'] . ': ' . $v['req'] . '</label> '; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (strlen($k_value) == 0 || $k_value == $option) { $k_value = $option; $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label><input type="radio" name="' . $k . '" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo ' </div> '; break; /* Select drop-down box */ /* Select drop-down box */ case 'select': $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; /*start tr in line 382-414*/ echo ' <div class="form-inline"> <label>' . $v['name'] . ': ' . $v['req'] . '</label> <select name="' . $k . '" ' . $cls . '>'; // Show "Click to select"? $v['value'] = str_replace('{HESK_SELECT}', '', $v['value'], $num); if ($num) { echo '<option value="">' . $hesklang['select'] . '</option>'; } $options = explode('#HESK#', $v['value']); foreach ($options as $option) { if ($k_value == $option) { $k_value = $option; $selected = 'selected="selected"'; } else { $selected = ''; } echo '<option ' . $selected . '>' . $option . '</option>'; } echo '</select> </div> '; break; /* Checkbox */ /* Checkbox */ case 'checkbox': /*start tr in line 418-444*/ echo ' <div class="form-inline"> <label>' . $v['name'] . ': ' . $v['req'] . '</label> '; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (in_array($option, $k_value)) { $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label><input type="checkbox" name="' . $k . '[]" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo ' </div> '; break; /* Large text box */ /* Large text box */ case 'textarea': $size = explode('#', $v['value']); $size[0] = empty($size[0]) ? 5 : intval($size[0]); $size[1] = empty($size[1]) ? 30 : intval($size[1]); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; /*start tr in line 454-460*/ echo ' <div class="form-inline"> <label>' . $v['name'] . ': ' . $v['req'] . '</label> <textarea name="' . $k . '" rows="' . $size[0] . '" cols="' . $size[1] . '" ' . $cls . '>' . $k_value . '</textarea> </div> '; break; /* Default text input */ /* Default text input */ default: if (strlen($k_value) != 0) { $v['value'] = $k_value; } $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; /*start tr in line 471-477*/ echo ' <div class="form-inline"> <label>' . $v['name'] . ': ' . $v['req'] . '</label> <input type="text" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" ' . $cls . ' /> </div> '; } } } /* If table was started we need to close it */ if ($print_table) { echo '</div> <br/><br/>'; /*end custom-before-support-request table*/ $print_table = 0; } ?> <!-- END CUSTOM BEFORE --> <!-- ticket info --> <div class=""> <div class="form-group" style="padding-right: 0px; margin-bottom: 5px;"> <label class="col-sm-2" for="subject-ticket-info-support-request"><?php echo $hesklang['subject']; ?> : <font class="important">*</font></label> <div class="col-sm-4"><input class="form-control contact-support-request" required="required" title="Required field" type="text" id="subject-ticket-info-support-request" name="subject" size="40" maxlength="40" value="<?php if (isset($_SESSION['c_subject'])) { echo stripslashes(hesk_input($_SESSION['c_subject'])); } ?> " <?php if (in_array('subject', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> /></div> </div> <div class="form-group" style="margin-bottom: 5px;"> <div> <label class="col-sm-2" for="message-ticket-info-support-request" ><?php echo $hesklang['message']; ?> : <font class="important">*</font></label> <div class="col-sm-4"><textarea class="form-control contact-support-request" required="required" title="Required field" id="message-ticket-info-support-request" name="message" rows="12" cols="60" <?php if (in_array('message', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> ><?php if (isset($_SESSION['c_message'])) { echo stripslashes(hesk_input($_SESSION['c_message'])); } ?> </textarea></div> </div> </div> </div><!-- ticket-info-support-request --> <!-- START CUSTOM AFTER --> <?php /* custom fields AFTER comments */ $print_table = 0; foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use'] && $v['place']) { if ($print_table == 0) { /*start table in line 534-705*/ echo ' <br/><br/> <div class="custom-after-support-request"> '; $print_table = 1; } $v['req'] = $v['req'] ? '<font class="important">*</font>' : ''; if ($v['type'] == 'checkbox') { $k_value = array(); if (isset($_SESSION["c_{$k}"]) && is_array($_SESSION["c_{$k}"])) { foreach ($_SESSION["c_{$k}"] as $myCB) { $k_value[] = stripslashes(hesk_input($myCB)); } } } elseif (isset($_SESSION["c_{$k}"])) { $k_value = stripslashes(hesk_input($_SESSION["c_{$k}"])); } else { $k_value = ''; } switch ($v['type']) { /* Radio box */ case 'radio': /*start tr in line 567-594*/ echo ' <div class="form-inline"> <label>' . $v['name'] . ': ' . $v['req'] . '</label> '; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (strlen($k_value) == 0 || $k_value == $option) { $k_value = $option; $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label><input type="radio" name="' . $k . '" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo ' </div> '; break; /* Select drop-down box */ /* Select drop-down box */ case 'select': $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; /*start tr in line 601-633*/ echo ' <div class="form-inline"> <label>' . $v['name'] . ': ' . $v['req'] . '</label> <select name="' . $k . '" ' . $cls . '>'; // Show "Click to select"? $v['value'] = str_replace('{HESK_SELECT}', '', $v['value'], $num); if ($num) { echo '<option value="">' . $hesklang['select'] . '</option>'; } $options = explode('#HESK#', $v['value']); foreach ($options as $option) { if ($k_value == $option) { $k_value = $option; $selected = 'selected="selected"'; } else { $selected = ''; } echo '<option ' . $selected . '>' . $option . '</option>'; } echo '</select> </div> '; break; /* Checkbox */ /* Checkbox */ case 'checkbox': /*start tr in line 637-663*/ echo ' <div class="form-inline"> <label>' . $v['name'] . ': ' . $v['req'] . '</label> '; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (in_array($option, $k_value)) { $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label><input type="checkbox" name="' . $k . '[]" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo ' </div> '; break; /* Large text box */ /* Large text box */ case 'textarea': $size = explode('#', $v['value']); $size[0] = empty($size[0]) ? 5 : intval($size[0]); $size[1] = empty($size[1]) ? 30 : intval($size[1]); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; /*start tr in line 673-679*/ echo ' <div class="form-inline"> <label>' . $v['name'] . ': ' . $v['req'] . '</label> <textarea name="' . $k . '" rows="' . $size[0] . '" cols="' . $size[1] . '" ' . $cls . '>' . $k_value . '</textarea> </div> '; break; /* Default text input */ /* Default text input */ default: if (strlen($k_value) != 0) { $v['value'] = $k_value; } $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; /*start tr in line 690-696*/ echo ' <div> <label>' . $v['name'] . ': ' . $v['req'] . '</label> <input type="text" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" ' . $cls . ' /> </div> '; } } } /* If table was started we need to close it */ if ($print_table) { echo '</div>'; /*end custom-after-support-request*/ $print_table = 0; } ?> <!-- END CUSTOM AFTER --> <?php /* attachments */ if ($hesk_settings['attachments']['use']) { ?> <br/><br/> <div class=""> <div class="form-group"> <label class="col-sm-2" style="vertical-align: top;"><?php echo $hesklang['attachments']; ?> :</label> <div class="col-sm-4 contact-support-request"> <?php for ($i = 1; $i <= $hesk_settings['attachments']['max_number']; $i++) { $cls = $i == 1 && in_array('attachments', $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<input type="file" name="attachment[' . $i . ']" size="50" ' . $cls . ' style="margin-bottom: 10px;"/>'; } ?> <a href="file_limits.php" target="_blank" onclick="Javascript:hesk_window('file_limits.php',250,500);return false;"><?php echo $hesklang['ful']; ?> </a> </div> </div> </div><!-- end attachments-support-request --> <?php } if ($hesk_settings['question_use'] || $hesk_settings['secimg_use']) { ?> <br/><br/> <!-- Security checks --> <div class="security-checks-support-request"> <?php if ($hesk_settings['question_use']) { ?> <div class="form-group"> <label class="col-sm-2 control-label" style="text-align:right;vertical-align:top" width="150"><?php echo $hesklang['verify_q']; ?> <font class="important">*</font></label> <?php $value = ''; if (isset($_SESSION['c_question'])) { $value = stripslashes(hesk_input($_SESSION['c_question'])); } $cls = in_array('question', $_SESSION['iserror']) ? ' class="isError" ' : ''; echo $hesk_settings['question_ask'] . '<br /><input class="form-control" type="text" name="question" size="20" value="' . $value . '" ' . $cls . ' />'; ?> <br /> </div> <?php } if ($hesk_settings['secimg_use']) { ?> <div class="form-group"> <label class="col-sm-2 control-label" style="text-align:right;vertical-align:top" width="150"><?php echo $hesklang['verify_i']; ?> <font class="important">*</font></label> <?php // SPAM prevention verified for this session if (isset($_SESSION['img_verified'])) { echo '<img src="' . HESK_PATH . 'img/success.png" width="16" height="16" border="0" alt="" style="vertical-align:text-bottom" /> ' . $hesklang['vrfy']; } elseif ($hesk_settings['recaptcha_use'] == 1) { ?> <script type="text/javascript"> var RecaptchaOptions = { theme : '<?php echo isset($_SESSION['iserror']) && in_array('mysecnum', $_SESSION['iserror']) ? 'red' : 'white'; ?> ', custom_translations : { visual_challenge : "<?php echo hesk_slashJS($hesklang['visual_challenge']); ?> ", audio_challenge : "<?php echo hesk_slashJS($hesklang['audio_challenge']); ?> ", refresh_btn : "<?php echo hesk_slashJS($hesklang['refresh_btn']); ?> ", instructions_visual : "<?php echo hesk_slashJS($hesklang['instructions_visual']); ?> ", instructions_context : "<?php echo hesk_slashJS($hesklang['instructions_context']); ?> ", instructions_audio : "<?php echo hesk_slashJS($hesklang['instructions_audio']); ?> ", help_btn : "<?php echo hesk_slashJS($hesklang['help_btn']); ?> ", play_again : "<?php echo hesk_slashJS($hesklang['play_again']); ?> ", cant_hear_this : "<?php echo hesk_slashJS($hesklang['cant_hear_this']); ?> ", incorrect_try_again : "<?php echo hesk_slashJS($hesklang['incorrect_try_again']); ?> ", image_alt_text : "<?php echo hesk_slashJS($hesklang['image_alt_text']); ?> ", }, }; </script> <?php require HESK_PATH . 'inc/recaptcha/recaptchalib.php'; echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true); } elseif ($hesk_settings['recaptcha_use'] == 2) { ?> <div class="g-recaptcha" data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?> "></div> <?php } else { $cls = in_array('mysecnum', $_SESSION['iserror']) ? ' class="isError" ' : ''; echo $hesklang['sec_enter'] . '<br /> <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" /> ' . '<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>' . '<br /> <br /><input type="text" name="mysecnum" size="20" maxlength="5" ' . $cls . ' />'; } ?> </div> <?php } ?> </div><!-- end security-checks-support-request --> <?php } ?> <!-- Submit --> <?php /*if ($hesk_settings['submit_notice']) { ?> <br/><br/> <div align="center"> <div class="submit-notice-support-request"> <div> <div> <b><?php echo $hesklang['before_submit']; ?></b> <ul> <li><?php echo $hesklang['all_info_in']; ?>.</li> <li><?php echo $hesklang['all_error_free']; ?>.</li> </ul> <b><?php echo $hesklang['we_have']; ?>:</b> <ul> <li><?php echo hesk_htmlspecialchars($_SERVER['REMOTE_ADDR']).' '.$hesklang['recorded_ip']; ?></li> <li><?php echo $hesklang['recorded_time']; ?></li> </ul> <div class="col-sm-7 col-sm-offset-5"><input type="hidden" name="token" value="<?php hesk_token_echo(); ?>" /> <input type="submit" value="<?php echo $hesklang['sub_ticket']; ?>" class="btn btn-default submit-ticket-btn" /></div> </div> </div> </div><!-- end submit-notice-support-request --> </div> <?php } // End IF submit_notice else {*/ ?> <div class="else-submit-notice-support-request form-group"> <div class="col-sm-offset-2 col-sm-3"> <input type="hidden" name="token" value="<?php hesk_token_echo(); ?> " /> <input type="submit" value="<?php echo $hesklang['sub_ticket']; ?> " class="btn btn-default submit-ticket-btn" /> </div> </div><!-- end else-submit-notice-support-request --> <?php /*}*/ // End ELSE submit_notice ?> <!-- Do not delete or modify the code below, it is used to detect simple SPAM bots --> <input type="hidden" name="hx" value="3" /><input type="hidden" name="hy" value="" /> <!-- > <input type="text" name="phone" value="3" /> < --> </form> <!-- END FORM --> </div><!-- end form-submit-support-request --> <!-- Go back --> <div class="container"><a href="javascript:history.go(-1)"> <button type="submit" class="btn btn-default goback-btn"><?php echo $hesklang['back']; ?> </button></a></div> <?php hesk_cleanSessionVars('iserror'); hesk_cleanSessionVars('isnotice'); }
function print_login() { global $hesk_settings, $hesklang; // Tell header to load reCaptcha API if needed if ($hesk_settings['recaptcha_use'] == 2) { define('RECAPTCHA', 1); } $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['admin_login']; require_once HESK_PATH . 'inc/header.inc.php'; if (hesk_isREQUEST('notice')) { hesk_process_messages($hesklang['session_expired'], 'NOREDIRECT'); } if (!isset($_SESSION['a_iserror'])) { $_SESSION['a_iserror'] = array(); } ?> <nav class="row navbar navbar-default" id="showTopBar-indexPhp"> <div class="menu-wrapper"> <div class="container showTopBar"><?php hesk_showTopBar($hesk_settings['hesk_title']); ?> </div> </div><!-- end showTopBar-indexPhp --> </nav> <div class="container siteUrl-title-admin-indexPhp"> <div class="form-inline"> <span><a href="<?php echo $hesk_settings['site_url']; ?> " class="smaller"><?php echo $hesk_settings['site_title']; ?> </a></span> > <span><?php echo $hesklang['admin_login']; ?> </span> </div> </div> <!-- </td> </tr>--> <!-- start in this page end somewhere... <tr> <td>--> <br/> <br/> <br/> <?php /* This will handle error, success and notice messages */ hesk_handle_messages(); ?> <div class="container"> <div class="col-sm-5 admin-login-top-latest-kb"> <div class="form-group admin-login"> <br/> <div class="container form-group"> <form action="index.php" method="post" name="form1"> <div id="ad-log"><b><?php echo $hesklang['admin_login']; ?> </a></b></div> </br> <div class="form-inline"> <h4><label class="control-label" for="username-admin"><?php echo $hesklang['username']; ?> :</label></h4> <?php $cls = in_array('user', $_SESSION['a_iserror']) ? ' class="isError" ' : ''; if (defined('HESK_USER')) { $savedUser = HESK_USER; } else { $savedUser = hesk_htmlspecialchars(hesk_COOKIE('hesk_username')); } $is_1 = ''; $is_2 = ''; $is_3 = ''; $remember_user = hesk_POST('remember_user'); if ($hesk_settings['autologin'] && (isset($_COOKIE['hesk_p']) || $remember_user == 'AUTOLOGIN')) { $is_1 = 'checked="checked"'; } elseif (isset($_COOKIE['hesk_username']) || $remember_user == 'JUSTUSER') { $is_2 = 'checked="checked"'; } else { $is_3 = 'checked="checked"'; } if ($hesk_settings['list_users']) { echo '<select name="user" ' . $cls . '>'; $res = hesk_dbQuery('SELECT `user` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'users` ORDER BY `user` ASC'); while ($row = hesk_dbFetchAssoc($res)) { $sel = strtolower($savedUser) == strtolower($row['user']) ? 'selected="selected"' : ''; echo '<option value="' . $row['user'] . '" ' . $sel . '>' . $row['user'] . '</option>'; } echo '</select>'; } else { echo '<input class="form-control" id="username-admin" type="text" name="user" size="35" value="' . $savedUser . '" ' . $cls . ' />'; } ?> </div> <br/> <div class="form-inline"> <h4><label class="control-label" for="password-admin"><?php echo $hesklang['pass']; ?> :</h4><input class="form-control" id="password-admin" type="password" name="pass" size="35" <?php if (in_array('pass', $_SESSION['a_iserror'])) { echo ' class="isError" '; } ?> /> </div> <?php if ($hesk_settings['secimg_use'] == 2) { ?> <br/><br/> <?php // SPAM prevention verified for this session if (isset($_SESSION['img_a_verified'])) { echo '<img src="' . HESK_PATH . 'img/success.png" width="16" height="16" border="0" alt="" style="vertical-align:text-bottom" /> ' . $hesklang['vrfy']; } elseif ($hesk_settings['recaptcha_use'] == 1) { ?> <script type="text/javascript"> var RecaptchaOptions = { theme : '<?php echo isset($_SESSION['a_iserror']) && in_array('mysecnum', $_SESSION['a_iserror']) ? 'red' : 'white'; ?> ', custom_translations : { visual_challenge : "<?php echo hesk_slashJS($hesklang['visual_challenge']); ?> ", audio_challenge : "<?php echo hesk_slashJS($hesklang['audio_challenge']); ?> ", refresh_btn : "<?php echo hesk_slashJS($hesklang['refresh_btn']); ?> ", instructions_visual : "<?php echo hesk_slashJS($hesklang['instructions_visual']); ?> ", instructions_context : "<?php echo hesk_slashJS($hesklang['instructions_context']); ?> ", instructions_audio : "<?php echo hesk_slashJS($hesklang['instructions_audio']); ?> ", help_btn : "<?php echo hesk_slashJS($hesklang['help_btn']); ?> ", play_again : "<?php echo hesk_slashJS($hesklang['play_again']); ?> ", cant_hear_this : "<?php echo hesk_slashJS($hesklang['cant_hear_this']); ?> ", incorrect_try_again : "<?php echo hesk_slashJS($hesklang['incorrect_try_again']); ?> ", image_alt_text : "<?php echo hesk_slashJS($hesklang['image_alt_text']); ?> ", }, }; </script> <?php require_once HESK_PATH . 'inc/recaptcha/recaptchalib.php'; echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true); } elseif ($hesk_settings['recaptcha_use'] == 2) { ?> <div class="g-recaptcha" data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?> "></div> <?php } else { $cls = in_array('mysecnum', $_SESSION['a_iserror']) ? ' class="isError" ' : ''; echo $hesklang['sec_enter'] . '<br /> <br /><img src="' . HESK_PATH . '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" /> ' . '<a href="javascript:void(0)" onclick="javascript:document.form1.secimg.src=\'' . HESK_PATH . 'print_sec_img.php?\'+ ( Math.floor((90000)*Math.random()) + 10000);"><img src="' . HESK_PATH . 'img/reload.png" height="24" width="24" alt="' . $hesklang['reload'] . '" title="' . $hesklang['reload'] . '" border="0" style="vertical-align:text-bottom" /></a>' . '<br /> <br /><input type="text" name="mysecnum" size="20" maxlength="5" ' . $cls . ' />'; } ?> <br/><br/> <?php } else { ?> <?php } // End if $hesk_settings['secimg_use'] == 2 if ($hesk_settings['autologin']) { ?> <br/> <div class="radios" style="text-align: -webkit-auto; display: inline-block;"> <div class=""> <span> <input type="checkbox" name="remember_user" id="optionsRadios1" value="kot" <?php echo $is_1; ?> checked="checked" /> <?php echo $hesklang['remember_user']; ?> <br /> </span> </div> <div class="radio"> <span> <input type="hidden" name="remember_user" id="optionsRadios2" value="AUTOLOGIN" <?php echo $is_2; ?> checked="checked" /><br /> </span> </div> </div> <?php } else { ?> <label><input type="checkbox" name="remember_user" value="JUSTUSER" class="form-control"<?php echo $is_2; ?> /> <?php echo $hesklang['remember_user']; ?> </label> <?php } // End if $hesk_settings['autologin'] ?> <br/><br/> <button type="submit" class="btn btn-default" id="submit-login"><?php echo $hesklang['click_login']; ?> </button> <input type="hidden" name="a" value="do_login" /> <?php if (hesk_isREQUEST('goto') && ($url = hesk_REQUEST('goto'))) { echo '<input type="hidden" name="goto" value="' . $url . '" />'; } // Do we allow staff password reset? if ($hesk_settings['reset_pass']) { echo '<br /> <br /><div id="forgotpassw"><a href="password.php" class="smaller">' . $hesklang['fpass'] . '</a></div>'; } ?> <br /> </form> </div> </div> <div class="form-inline top-latest-kb-button"> <a href="http://localhost/support/knowledgebase.php#tab_home" target="_blank"><button type="submit" class="btn btn-default" id="top-kb-button" onmouseover="hesk_btn(this,'btn btn-defaultover');" onmouseout="hesk_btn(this,'btn btn-default');">Top Knowledgebase <br/> articles</button></a> <a href="http://localhost/support/knowledgebase.php#tab_profile" target="_blank"><button type="submit" class="btn btn-default" id="latest-kb-button" onmouseover="hesk_btn(this,'btn btn-defaultover');" onmouseout="hesk_btn(this,'btn btn-default');">Latest Knowledgebase <br/> articles</button></a> </div> </div> <div class="col-sm-7 help-staf"><img src="../img/help.jpg" alt="help" /></div> </div> <?php hesk_cleanSessionVars('a_iserror'); require_once HESK_PATH . 'inc/footer.inc.php'; exit; }
function print_add_ticket() { global $hesk_settings, $hesklang, $modsForHesk_settings; // Auto-focus first empty or error field define('AUTOFOCUS', true); // Pre-populate fields // Customer name if (isset($_REQUEST['name'])) { $_SESSION['c_name'] = $_REQUEST['name']; } // Customer email address if (isset($_REQUEST['email'])) { $_SESSION['c_email'] = $_REQUEST['email']; $_SESSION['c_email2'] = $_REQUEST['email']; } // Category ID if (isset($_REQUEST['catid'])) { $_SESSION['c_category'] = intval($_REQUEST['catid']); } if (isset($_REQUEST['category'])) { $_SESSION['c_category'] = intval($_REQUEST['category']); } // Priority if (isset($_REQUEST['priority'])) { $_SESSION['c_priority'] = intval($_REQUEST['priority']); } // Subject if (isset($_REQUEST['subject'])) { $_SESSION['c_subject'] = $_REQUEST['subject']; } // Message if (isset($_REQUEST['message'])) { $_SESSION['c_message'] = $_REQUEST['message']; } // Custom fields foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use'] && isset($_REQUEST[$k])) { $_SESSION['c_' . $k] = $_REQUEST[$k]; } } // Variables for coloring the fields in case of errors if (!isset($_SESSION['iserror'])) { $_SESSION['iserror'] = array(); } if (!isset($_SESSION['isnotice'])) { $_SESSION['isnotice'] = array(); } if (!isset($_SESSION['c_category']) && !$hesk_settings['select_cat']) { $_SESSION['c_category'] = 0; } hesk_cleanSessionVars('already_submitted'); // Tell header to load reCaptcha API if needed if ($hesk_settings['recaptcha_use'] == 2) { define('RECAPTCHA', 1); } // Print header $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . $hesklang['submit_ticket']; require_once HESK_PATH . 'inc/header.inc.php'; ?> <ol class="breadcrumb"> <li><a href="<?php echo $hesk_settings['site_url']; ?> "><?php echo $hesk_settings['site_title']; ?> </a></li> <li><a href="<?php echo $hesk_settings['hesk_url']; ?> "><?php echo $hesk_settings['hesk_title']; ?> </a></li> <li class="active"><?php echo $hesklang['sub_support']; ?> </li> </ol> <!-- START MAIN LAYOUT --> <?php $columnWidth = 'col-md-8'; hesk_dbConnect(); $showRs = hesk_dbQuery("SELECT `show` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "quick_help_sections` WHERE `id` = 1"); $show = hesk_dbFetchAssoc($showRs); if (!$show['show']) { $columnWidth = 'col-md-10 col-md-offset-1'; } ?> <div class="row"> <?php if ($columnWidth == 'col-md-8') { ?> <div align="left" class="col-md-4"> <div class="panel panel-default"> <div class="panel-heading"><?php echo $hesklang['quick_help']; ?> </div> <div class="panel-body"> <p><?php echo $hesklang['quick_help_submit_ticket']; ?> </p> </div> </div> </div> <?php } ?> <div class="<?php echo $columnWidth; ?> "> <?php // This will handle error, success and notice messages hesk_handle_messages(); ?> <!-- START FORM --> <div class="form"> <h2><?php hesk_showTopBar($hesklang['submit_ticket']); ?> </h2> <small><?php echo $hesklang['use_form_below']; ?> </small> <div class="blankSpace"></div> <div align="left" class="h3"><?php echo $hesklang['add_ticket_general_information']; ?> </div> <div class="footerWithBorder"></div> <div class="blankSpace"></div> <form class="form-horizontal" role="form" method="post" action="submit_ticket.php?submit=1" name="form1" enctype="multipart/form-data"> <!-- Contact info --> <div class="form-group"> <label for="name" class="col-sm-3 control-label"><?php echo $hesklang['name']; ?> : <font class="important">*</font></label> <div class="col-sm-9"> <input type="text" class="form-control" id="name" name="name" size="40" maxlength="30" value="<?php if (isset($_SESSION['c_name'])) { echo stripslashes(hesk_input($_SESSION['c_name'])); } ?> " <?php if (in_array('name', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> placeholder="<?php echo htmlspecialchars($hesklang['name']); ?> " /> </div> </div> <div class="form-group"> <label for="email" class="col-sm-3 control-label"><?php echo $hesklang['email']; ?> : <font class="important">*</font></label> <div class="col-sm-9"> <input type="text" class="form-control" id="email" name="email" size="40" maxlength="1000" value="<?php if (isset($_SESSION['c_email'])) { echo stripslashes(hesk_input($_SESSION['c_email'])); } ?> " <?php if (in_array('email', $_SESSION['iserror'])) { echo ' class="isError" '; } elseif (in_array('email', $_SESSION['isnotice'])) { echo ' class="isNotice" '; } ?> <?php if ($hesk_settings['detect_typos']) { echo ' onblur="Javascript:hesk_suggestEmail(0)"'; } ?> placeholder="<?php echo htmlspecialchars($hesklang['email']); ?> " /> </div> </div> <?php if ($hesk_settings['confirm_email']) { ?> <div class="form-group"> <label for="email2" class="col-sm-3 control-label"><?php echo $hesklang['confemail']; ?> : <font class="important">*</font></label> <div class="col-sm-9"> <input type="text" id="email2" class="form-control" name="email2" size="40" maxlength="1000" value="<?php if (isset($_SESSION['c_email2'])) { echo stripslashes(hesk_input($_SESSION['c_email2'])); } ?> " <?php if (in_array('email2', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> placeholder="<?php echo htmlspecialchars($hesklang['confemail']); ?> " /> </div> </div> <?php } ?> <div id="email_suggestions"></div> <!-- Department and priority --> <?php $is_table = 0; // Get categories hesk_dbConnect(); $orderBy = $modsForHesk_settings['category_order_column']; $res = hesk_dbQuery("SELECT `id`, `name` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `type`='0' ORDER BY `" . $orderBy . "` ASC"); if (hesk_dbNumRows($res) == 1) { // Only 1 public category, no need for a select box $row = hesk_dbFetchAssoc($res); echo '<input type="hidden" name="category" value="' . $row['id'] . '" />'; } elseif (hesk_dbNumRows($res) < 1) { // No public categories, set it to default one echo '<input type="hidden" name="category" value="1" />'; } else { // List available categories $is_table = 1; ?> <div class="form-group"> <label for="category" class="col-sm-3 control-label"><?php echo $hesklang['category']; ?> : <font class="important">*</font></label> <div class="col-sm-9"> <select name="category" id="category" class="form-control" <?php if (in_array('category', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> ><?php // Show the "Click to select"? if ($hesk_settings['select_cat']) { echo '<option value="">' . $hesklang['select'] . '</option>'; } // List categories while ($row = hesk_dbFetchAssoc($res)) { echo '<option value="' . $row['id'] . '"' . ($_SESSION['c_category'] == $row['id'] ? ' selected="selected"' : '') . '>' . $row['name'] . '</option>'; } ?> </select> </div> </div> <?php } /* Can customer assign urgency? */ if ($hesk_settings['cust_urgency']) { ?> <div class="form-group"> <label for="priority" class="col-sm-3 control-label"><?php echo $hesklang['priority']; ?> : <font class="important">*</font></label> <div class="col-sm-9"> <select id="priority" class="form-control" name="priority" <?php if (in_array('priority', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> > <?php // Show the "Click to select"? if ($hesk_settings['select_pri']) { echo '<option value="">' . $hesklang['select'] . '</option>'; } ?> <option value="3" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 3) { echo 'selected="selected"'; } ?> ><?php echo $hesklang['low']; ?> </option> <option value="2" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 2) { echo 'selected="selected"'; } ?> ><?php echo $hesklang['medium']; ?> </option> <option value="1" <?php if (isset($_SESSION['c_priority']) && $_SESSION['c_priority'] == 1) { echo 'selected="selected"'; } ?> ><?php echo $hesklang['high']; ?> </option> </select> </div> </div> <?php } ?> <!-- START CUSTOM BEFORE --> <?php /* custom fields BEFORE comments */ foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use'] && $v['place'] == 0) { if ($modsForHesk_settings['custom_field_setting']) { $v['name'] = $hesklang[$v['name']]; } $v['req'] = $v['req'] ? '<font class="important">*</font>' : ''; if ($v['type'] == 'checkbox') { $k_value = array(); if (isset($_SESSION["c_{$k}"]) && is_array($_SESSION["c_{$k}"])) { foreach ($_SESSION["c_{$k}"] as $myCB) { $k_value[] = stripslashes(hesk_input($myCB)); } } } elseif (isset($_SESSION["c_{$k}"])) { $k_value = stripslashes(hesk_input($_SESSION["c_{$k}"])); } else { $k_value = ''; } switch ($v['type']) { /* Radio box */ case 'radio': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); echo '<div class="form-group"><label class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label><div align="left" class="col-sm-9">'; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (strlen($k_value) == 0 || $k_value == $option) { $k_value = $option; $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label style="font-weight: normal;"><input type="radio" id="' . $formattedId . '" name="' . $k . '" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo '</div></div>'; break; /* Select drop-down box */ /* Select drop-down box */ case 'select': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="form-group"><label for="' . $v['name'] . '" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"><select class="form-control" id="' . $formattedId . '" name="' . $k . '" ' . $cls . '>'; // Show "Click to select"? $v['value'] = str_replace('{HESK_SELECT}', '', $v['value'], $num); if ($num) { echo '<option value="">' . $hesklang['select'] . '</option>'; } $options = explode('#HESK#', $v['value']); foreach ($options as $option) { if ($k_value == $option) { $k_value = $option; $selected = 'selected="selected"'; } else { $selected = ''; } echo '<option ' . $selected . '>' . $option . '</option>'; } echo '</select></div></div>'; break; /* Checkbox */ /* Checkbox */ case 'checkbox': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); echo '<div class="form-group"><label class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label><div align="left" class="col-sm-9">'; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (in_array($option, $k_value)) { $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label style="font-weight: normal;"><input id="' . $formattedId . '" type="checkbox" name="' . $k . '[]" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo '</div></div>'; break; /* Large text box */ /* Large text box */ case 'textarea': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); $size = explode('#', $v['value']); $size[0] = empty($size[0]) ? 5 : intval($size[0]); $size[1] = empty($size[1]) ? 30 : intval($size[1]); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="form-group"> <label for="' . $v['name'] . '" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"><textarea class="form-control" id="' . $formattedId . '" name="' . $k . '" rows="' . $size[0] . '" cols="' . $size[1] . '" ' . $cls . '>' . $k_value . '</textarea></div> </div>'; break; case 'multiselect': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="form-group"><label for="' . $v['name'] . '[]" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"><select class="form-control" id="' . $formattedId . '" name="' . $k . '[]" ' . $cls . ' multiple>'; $options = explode('#HESK#', $v['value']); foreach ($options as $option) { if ($k_value == $option) { $k_value = $option; $selected = 'selected="selected"'; } else { $selected = ''; } echo '<option ' . $selected . '>' . $option . '</option>'; } echo '</select> <div class="btn-group" role="group"> <button type="button" class="btn btn-default" onclick="selectAll(\'' . $formattedId . '\')">Select All</button> <button type="button" class="btn btn-default" onclick="deselectAll(\'' . $formattedId . '\')">Deselect All</button> </div> </div></div>'; break; case 'date': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); if (strlen($k_value) != 0) { $v['value'] = $k_value; } $cls = in_array($k, $_SESSION['iserror']) ? ' isError ' : ''; echo ' <div class="form-group"> <label for="' . $v['name'] . '" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"> <input type="text" class="datepicker form-control white-readonly ' . $cls . '" placeholder="' . htmlspecialchars($v['name']) . '" id="' . $formattedId . '" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" readonly/> <span class="help-block">' . $hesklang['date_format'] . '</span> </div> </div>'; break; case 'email': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); if (strlen($k_value) != 0) { $v['value'] = $k_value; } if ($v['value'] == 'cc' || $v['value'] == 'bcc') { // (b)cc isn't a valid email but is the "value" used by settings. Just remove it. $v['value'] = ''; } $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="form-group"> <label for="' . $v['name'] . '" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"><input type="text" class="form-control" id="' . $formattedId . '" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" ' . $cls . ' /></div> </div>'; break; /* Default text input */ /* Default text input */ default: //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); if (strlen($k_value) != 0) { $v['value'] = $k_value; } $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="form-group"> <label for="' . $v['name'] . '" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"><input type="text" class="form-control" id="' . $formattedId . '" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" ' . $cls . ' /></div> </div>'; } } } ?> <!-- END CUSTOM BEFORE --> <div class="blankSpace"></div> <div align="left" class="h3"><?php echo $hesklang['add_ticket_your_message']; ?> </div> <div class="footerWithBorder"></div> <div class="blankSpace"></div> <!-- ticket info --> <div class="form-group"> <label for="subject" class="col-sm-3 control-label"><?php echo $hesklang['subject']; ?> : <font class="important">*</font></label> <div class="col-sm-9"> <input type="text" id="subject" class="form-control" name="subject" size="40" maxlength="40" value="<?php if (isset($_SESSION['c_subject'])) { echo stripslashes(hesk_input($_SESSION['c_subject'])); } ?> " <?php if (in_array('subject', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> placeholder="<?php echo htmlspecialchars($hesklang['subject']); ?> "/> </div> </div> <div class="form-group"> <div class="col-sm-12"> <textarea placeholder="<?php echo htmlspecialchars($hesklang['message']); ?> " name="message" id="message" class="form-control" rows="12" cols="60" <?php if (in_array('message', $_SESSION['iserror'])) { echo ' class="isError" '; } ?> ><?php if (isset($_SESSION['c_message'])) { echo stripslashes(hesk_input($_SESSION['c_message'])); } ?> </textarea> </div> </div> <!-- START KNOWLEDGEBASE SUGGEST --> <?php if ($hesk_settings['kb_enable'] && $hesk_settings['kb_recommendanswers']) { ?> <div id="kb_suggestions" style="display:none"> <br /> <br /> <img src="img/loading.gif" width="24" height="24" alt="" border="0" style="vertical-align:text-bottom" /> <i><?php echo $hesklang['lkbs']; ?> </i> </div> <script language="Javascript" type="text/javascript"><!-- hesk_suggestKB(); //--> </script> <?php } ?> <!-- END KNOWLEDGEBASE SUGGEST --> <!-- START CUSTOM AFTER --> <?php /* custom fields AFTER comments */ foreach ($hesk_settings['custom_fields'] as $k => $v) { if ($v['use'] && $v['place']) { if ($modsForHesk_settings['custom_field_setting']) { $v['name'] = $hesklang[$v['name']]; } $v['req'] = $v['req'] ? '<font class="important">*</font>' : ''; if ($v['type'] == 'checkbox') { $k_value = array(); if (isset($_SESSION["c_{$k}"]) && is_array($_SESSION["c_{$k}"])) { foreach ($_SESSION["c_{$k}"] as $myCB) { $k_value[] = stripslashes(hesk_input($myCB)); } } } elseif (isset($_SESSION["c_{$k}"])) { $k_value = stripslashes(hesk_input($_SESSION["c_{$k}"])); } else { $k_value = ''; } switch ($v['type']) { /* Radio box */ case 'radio': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); echo '<div class="form-group"><label class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label><div align="left" class="col-sm-9">'; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (strlen($k_value) == 0 || $k_value == $option) { $k_value = $option; $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label style="font-weight: normal;"><input type="radio" id="' . $formattedId . '" name="' . $k . '" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo '</div></div>'; break; /* Select drop-down box */ /* Select drop-down box */ case 'select': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="form-group"><label for="' . $v['name'] . '" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"><select class="form-control" id="' . $formattedId . '" name="' . $k . '" ' . $cls . '>'; // Show "Click to select"? $v['value'] = str_replace('{HESK_SELECT}', '', $v['value'], $num); if ($num) { echo '<option value="">' . $hesklang['select'] . '</option>'; } $options = explode('#HESK#', $v['value']); foreach ($options as $option) { if ($k_value == $option) { $k_value = $option; $selected = 'selected="selected"'; } else { $selected = ''; } echo '<option ' . $selected . '>' . $option . '</option>'; } echo '</select></div></div>'; break; /* Checkbox */ /* Checkbox */ case 'checkbox': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); echo '<div class="form-group"><label class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label><div align="left" class="col-sm-9">'; $options = explode('#HESK#', $v['value']); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; foreach ($options as $option) { if (in_array($option, $k_value)) { $checked = 'checked="checked"'; } else { $checked = ''; } echo '<label style="font-weight: normal;"><input id="' . $formattedId . '" type="checkbox" name="' . $k . '[]" value="' . $option . '" ' . $checked . ' ' . $cls . ' /> ' . $option . '</label><br />'; } echo '</div></div>'; break; /* Large text box */ /* Large text box */ case 'textarea': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); $size = explode('#', $v['value']); $size[0] = empty($size[0]) ? 5 : intval($size[0]); $size[1] = empty($size[1]) ? 30 : intval($size[1]); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="form-group"> <label for="' . $v['name'] . '" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"><textarea class="form-control" id="' . $formattedId . '" name="' . $k . '" rows="' . $size[0] . '" cols="' . $size[1] . '" ' . $cls . '>' . $k_value . '</textarea></div> </div>'; break; case 'multiselect': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="form-group"><label for="' . $v['name'] . '[]" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"><select class="form-control" id="' . $formattedId . '" name="' . $k . '[]" ' . $cls . ' multiple>'; $options = explode('#HESK#', $v['value']); foreach ($options as $option) { if ($k_value == $option) { $k_value = $option; $selected = 'selected="selected"'; } else { $selected = ''; } echo '<option ' . $selected . '>' . $option . '</option>'; } echo '</select> <div class="btn-group" role="group"> <button type="button" class="btn btn-default" onclick="selectAll(\'' . $formattedId . '\')">Select All</button> <button type="button" class="btn btn-default" onclick="deselectAll(\'' . $formattedId . '\')">Deselect All</button> </div></div></div>'; break; case 'date': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); if (strlen($k_value) != 0) { $v['value'] = $k_value; } $cls = in_array($k, $_SESSION['iserror']) ? ' isError ' : ''; echo ' <div class="form-group"> <label for="' . $v['name'] . '" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"> <input type="text" class="datepicker form-control white-readonly ' . $cls . '" placeholder="' . htmlspecialchars($v['name']) . '" id="' . $formattedId . '" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" readonly/> <span class="help-block">' . $hesklang['date_format'] . '</span> </div> </div>'; break; case 'email': //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); if (strlen($k_value) != 0) { $v['value'] = $k_value; } if ($v['value'] == 'cc' || $v['value'] == 'bcc') { // (b)cc isn't a valid email but is the "value" used by settings. Just remove it. $v['value'] = ''; } $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="form-group"> <label for="' . $v['name'] . '" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"><input type="text" class="form-control" id="' . $formattedId . '" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" ' . $cls . ' /></div> </div>'; break; /* Default text input */ /* Default text input */ default: //Clean up multiple dashes or whitespaces $formattedId = preg_replace("/[\\s-]+/", " ", $v['name']); $formattedId = preg_replace("/[\\s_]/", "-", $formattedId); if (strlen($k_value) != 0) { $v['value'] = $k_value; } $cls = in_array($k, $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="form-group"> <label for="' . $v['name'] . '" class="col-sm-3 control-label">' . $v['name'] . ': ' . $v['req'] . '</label> <div class="col-sm-9"><input type="text" class="form-control" id="' . $formattedId . '" name="' . $k . '" size="40" maxlength="' . $v['maxlen'] . '" value="' . $v['value'] . '" ' . $cls . ' /></div> </div>'; } } } ?> <!-- END CUSTOM AFTER --> <?php /* attachments */ if ($hesk_settings['attachments']['use']) { ?> <div class="form-group"> <label for="attachments" class="col-sm-3 control-label"><?php echo $hesklang['attachments']; ?> :</label> <div align="left" class="col-sm-9"> <?php for ($i = 1; $i <= $hesk_settings['attachments']['max_number']; $i++) { $cls = $i == 1 && in_array('attachments', $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<input type="file" name="attachment[' . $i . ']" size="50" ' . $cls . ' /><br />'; } ?> <a href="file_limits.php" target="_blank" onclick="Javascript:hesk_window('file_limits.php',250,500);return false;"><?php echo $hesklang['ful']; ?> </a> </div> </div> <?php } if ($hesk_settings['question_use'] || $hesk_settings['secimg_use']) { ?> <!-- Security checks --> <?php if ($hesk_settings['question_use']) { ?> <div class="form-group"> <label for="question" class="col-sm-3 control-label"><?php echo $hesklang['verify_q']; ?> <span class="important">*</span></label> <?php $value = ''; if (isset($_SESSION['c_question'])) { $value = stripslashes(hesk_input($_SESSION['c_question'])); } $cls = in_array('question', $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div class="col-md-9">' . $hesk_settings['question_ask'] . '<br /><input class="form-control" id="question" type="text" name="question" size="20" value="' . $value . '" ' . $cls . ' /></div>'; ?> </div> <?php } if ($hesk_settings['secimg_use']) { ?> <div class="form-group"> <label for="secimage" class="col-sm-3 control-label"><?php echo $hesklang['verify_i']; ?> <font class="important">*</font></label> <?php // SPAM prevention verified for this session if (isset($_SESSION['img_verified'])) { echo '<img src="' . HESK_PATH . 'img/success.png" width="16" height="16" border="0" alt="" style="vertical-align:text-bottom" /> ' . $hesklang['vrfy']; } elseif ($hesk_settings['recaptcha_use'] == 1) { ?> <script type="text/javascript"> var RecaptchaOptions = { theme : '<?php echo isset($_SESSION['iserror']) && in_array('mysecnum', $_SESSION['iserror']) ? 'red' : 'white'; ?> ', custom_translations : { visual_challenge : "<?php echo hesk_slashJS($hesklang['visual_challenge']); ?> ", audio_challenge : "<?php echo hesk_slashJS($hesklang['audio_challenge']); ?> ", refresh_btn : "<?php echo hesk_slashJS($hesklang['refresh_btn']); ?> ", instructions_visual : "<?php echo hesk_slashJS($hesklang['instructions_visual']); ?> ", instructions_context : "<?php echo hesk_slashJS($hesklang['instructions_context']); ?> ", instructions_audio : "<?php echo hesk_slashJS($hesklang['instructions_audio']); ?> ", help_btn : "<?php echo hesk_slashJS($hesklang['help_btn']); ?> ", play_again : "<?php echo hesk_slashJS($hesklang['play_again']); ?> ", cant_hear_this : "<?php echo hesk_slashJS($hesklang['cant_hear_this']); ?> ", incorrect_try_again : "<?php echo hesk_slashJS($hesklang['incorrect_try_again']); ?> ", image_alt_text : "<?php echo hesk_slashJS($hesklang['image_alt_text']); ?> " } }; </script> <div class="col-md-9"> <?php require HESK_PATH . 'inc/recaptcha/recaptchalib.php'; echo recaptcha_get_html($hesk_settings['recaptcha_public_key'], null, true); ?> </div> <?php } elseif ($hesk_settings['recaptcha_use'] == 2) { ?> <div class="col-md-9"> <div class="g-recaptcha" data-sitekey="<?php echo $hesk_settings['recaptcha_public_key']; ?> "></div> </div> <?php } else { $cls = in_array('mysecnum', $_SESSION['iserror']) ? ' class="isError" ' : ''; echo '<div align="left" class="col-sm-9">'; echo $hesklang['sec_enter'] . '<br /> <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" /> ' . '<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>' . '<br /> <br /><input type="text" name="mysecnum" size="20" maxlength="5" ' . $cls . ' />'; } echo '</div></div>'; } ?> <?php } if ($modsForHesk_settings['request_location']) { ?> <div class="form-group"> <label for="location" class="col-md-3 control-label"><?php echo $hesklang['location_colon']; ?> </label> <div class="col-sm-9"> <p id="console"><?php echo $hesklang['requesting_location_ellipsis']; ?> </p> <div id="map" style="height: 300px; display:none"> </div> </div> </div> <!-- Submit --> <?php } if ($hesk_settings['submit_notice']) { ?> <div class="row"> <div class="col-md-12"> <div class="alert alert-info"> <b><?php echo $hesklang['before_submit']; ?> </b> <ul> <li><?php echo $hesklang['all_info_in']; ?> .</li> <li><?php echo $hesklang['all_error_free']; ?> .</li> </ul> <b><?php echo $hesklang['we_have']; ?> :</b> <ul> <li><?php echo hesk_htmlspecialchars($_SERVER['REMOTE_ADDR']) . ' ' . $hesklang['recorded_ip']; ?> </li> <li><?php echo $hesklang['recorded_time']; ?> </li> </ul> </div> </div> </div> <div class="row"> <div class="col-md-9 col-md-offset-3"> <input type="hidden" id="latitude" name="latitude" value="E-0"> <input type="hidden" id="longitude" name="longitude" value="E-0"> <input type="hidden" name="token" value="<?php hesk_token_echo(); ?> "> <input type="submit" value="<?php echo $hesklang['sub_ticket']; ?> " class="btn btn-default"> </div> </div> <?php } else { ?> <div class="row"> <div class="col-md-9 col-md-offset-3"> <input type="hidden" id="latitude" name="latitude" value="E-0"> <input type="hidden" id="longitude" name="longitude" value="E-0"> <input type="hidden" name="token" value="<?php hesk_token_echo(); ?> "> <input class="btn btn-default" type="submit" value="<?php echo $hesklang['sub_ticket']; ?> "> </div> </div> <?php } // End ELSE submit_notice ?> <!-- Do not delete or modify the code below, it is used to detect simple SPAM bots --> <input type="hidden" name="hx" value="3" /><input type="hidden" name="hy" value="" /> <!-- > <input type="text" name="phone" value="3" /> < --> </form> </div> </div> <?php if ($columnWidth == 'col-md-10 col-md-offset-1') { ?> <div class="col-md-1"> </div></div> <?php } ?> <!-- END FORM --> <?php // Request for the users location if enabled if ($modsForHesk_settings['request_location']) { echo ' <script> requestUserLocation("' . $hesklang['your_current_location'] . '", "' . $hesklang['unable_to_determine_location'] . '"); </script> '; } hesk_cleanSessionVars('iserror'); hesk_cleanSessionVars('isnotice'); }