Exemplo n.º 1
0
		<div id="skip_notify" style="margin-left:25px;display:<?php 
echo $hesk_settings['notify_new'] ? 'block' : 'none';
?>
">
		<p><label><input type="checkbox" name="s_notify_skip_spam" value="1" <?php 
if ($hesk_settings['notify_skip_spam']) {
    echo 'checked="checked"';
}
?>
/> <?php 
echo $hesklang['enn'];
?>
</label><br />
		<textarea name="s_notify_spam_tags" rows="5" cols="40" style="margin-left:25px;" /><?php 
echo hesk_htmlspecialchars(implode("\n", $hesk_settings['notify_spam_tags']));
?>
</textarea></p>
		</div>

		</td>
		</tr>
		<tr>
		<td style="text-align:right" width="200">&nbsp;</td>
		<td><label><input type="checkbox" name="s_notify_closed" value="1" <?php 
if ($hesk_settings['notify_closed']) {
    echo 'checked="checked"';
}
?>
/> <?php 
echo $hesklang['notclo'];
Exemplo n.º 2
0
require HESK_PATH . 'inc/setup_functions.inc.php';
$spam_question = hesk_generate_SPAM_question();
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header('Content-type: text/plain');
?>
<a href="Javascript:void(0)" onclick="Javascript:hesk_rate('generate_spam_question.php','question')"><?php 
echo $hesklang['genq'];
?>
</a><br />

<?php 
echo $hesklang['q_q'];
?>
:<br />
<textarea name="s_question_ask" rows="3" cols="40"><?php 
echo addslashes(hesk_htmlspecialchars($spam_question[0]));
?>
</textarea><br />

<?php 
echo $hesklang['q_a'];
?>
:<br />
<input type="text" name="s_question_ans" value="<?php 
echo addslashes(hesk_htmlspecialchars($spam_question[1]));
?>
" size="10" />
<?php 
exit;
function edit_article()
{
    global $hesk_settings, $hesklang, $listBox;
    $hesk_error_buffer = array();
    $id = intval(hesk_GET('id')) or hesk_process_messages($hesklang['kb_art_id'], './manage_knowledgebase.php');
    /* Get article details */
    $result = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `id`='" . intval($id) . "' LIMIT 1");
    if (hesk_dbNumRows($result) != 1) {
        hesk_process_messages($hesklang['kb_art_id'], './manage_knowledgebase.php');
    }
    $article = hesk_dbFetchAssoc($result);
    if ($hesk_settings['kb_wysiwyg'] || $article['html']) {
        $article['content'] = hesk_htmlspecialchars($article['content']);
    } else {
        $article['content'] = hesk_msgToPlain($article['content']);
    }
    $catid = $article['catid'];
    if (isset($_SESSION['edit_article'])) {
        $_SESSION['edit_article'] = hesk_stripArray($_SESSION['edit_article']);
        $article['type'] = $_SESSION['edit_article']['type'];
        $article['html'] = $_SESSION['edit_article']['html'];
        $article['subject'] = $_SESSION['edit_article']['subject'];
        $article['content'] = $_SESSION['edit_article']['content'];
        $article['keywords'] = $_SESSION['edit_article']['keywords'];
        $article['catid'] = $_SESSION['edit_article']['catid'];
        $article['sticky'] = $_SESSION['edit_article']['sticky'];
    }
    /* Get categories */
    $result = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'kb_categories` ORDER BY `parent` ASC, `cat_order` ASC');
    $kb_cat = array();
    while ($cat = hesk_dbFetchAssoc($result)) {
        $kb_cat[] = $cat;
        if ($cat['id'] == $article['catid']) {
            $this_cat = $cat;
            $this_cat['parent'] = $article['catid'];
        }
    }
    /* Translate main category "Knowledgebase" if needed */
    $kb_cat[0]['name'] = $hesklang['kb_text'];
    require HESK_PATH . 'inc/treemenu/TreeMenu.php';
    $icon = HESK_PATH . 'img/folder.gif';
    $expandedIcon = HESK_PATH . 'img/folder-expanded.gif';
    $menu = new HTML_TreeMenu();
    $thislevel = array('0');
    $nextlevel = array();
    $i = 1;
    $j = 1;
    while (count($kb_cat) > 0) {
        foreach ($kb_cat as $k => $cat) {
            if (in_array($cat['parent'], $thislevel)) {
                $up = $cat['parent'];
                $my = $cat['id'];
                $type = $cat['type'] ? '*' : '';
                $text_short = $cat['name'] . $type . ' (' . $cat['articles'] . ', ' . $cat['articles_private'] . ', ' . $cat['articles_draft'] . ')';
                if (isset($node[$up])) {
                    $node[$my] =& $node[$up]->addItem(new HTML_TreeNode(array('hesk_parent' => $this_cat['parent'], 'text' => 'Text', 'text_short' => $text_short, 'hesk_catid' => $cat['id'], 'hesk_select' => 'option' . $j, 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true)));
                } else {
                    $node[$my] = new HTML_TreeNode(array('hesk_parent' => $this_cat['parent'], 'text' => 'Text', 'text_short' => $text_short, 'hesk_catid' => $cat['id'], 'hesk_select' => 'option' . $j, 'icon' => $icon, 'expandedIcon' => $expandedIcon, 'expanded' => true));
                }
                $nextlevel[] = $cat['id'];
                $j++;
                unset($kb_cat[$k]);
            }
        }
        $thislevel = $nextlevel;
        $nextlevel = array();
        /* Break after 20 recursions to avoid hang-ups in case of any problems */
        if ($i > 20) {
            break;
        }
        $i++;
    }
    $menu->addItem($node[1]);
    // Create the presentation class
    $listBox =& ref_new(new HTML_TreeMenu_Listbox($menu));
    /* Print header */
    require_once HESK_PATH . 'inc/header.inc.php';
    /* Print main manage users page */
    require_once HESK_PATH . 'inc/show_admin_nav.inc.php';
    ?>

	 <div class="container new-manage-kb-title"><a href="manage_knowledgebase.php" class="smaller"><b><?php 
    echo $hesklang['kb'];
    ?>
</a></b> &gt;
    <a href="manage_knowledgebase.php?a=manage_cat&amp;catid=<?php 
    echo $catid;
    ?>
" class="smaller"><?php 
    echo $hesklang['kb_cat_man'];
    ?>
</a> &gt; <?php 
    echo $hesklang['kb_art_edit'];
    ?>
</div>

	<?php 
    /* This will handle error, success and notice messages */
    hesk_handle_messages();
    ?>
	
<div>
	<?php 
    echo '<div class="container kb_art_edit_title">' . $hesklang['kb_art_edit'] . '</div>';
    ?>

        <?php 
    if ($hesk_settings['kb_wysiwyg']) {
        ?>
			<script type="text/javascript">
			tinyMCE.init({
				mode : "exact",
				elements : "content",
				theme : "advanced",
                convert_urls : false,
                gecko_spellcheck: true,

				theme_advanced_buttons1 : "cut,copy,paste,|,undo,redo,|,formatselect,fontselect,fontsizeselect,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull",
				theme_advanced_buttons2 : "sub,sup,|,charmap,|,bullist,numlist,|,outdent,indent,insertdate,inserttime,preview,|,forecolor,backcolor,|,hr,removeformat,visualaid,|,link,unlink,anchor,image,cleanup,code",
				theme_advanced_buttons3 : "",

				theme_advanced_toolbar_location : "top",
				theme_advanced_toolbar_align : "left",
				theme_advanced_statusbar_location : "bottom",
				theme_advanced_resizing : true
			});
			</script>
	        <?php 
    }
    ?>
	<div class="container kb_art_edit_title_form">
	<br/>
	<form action="manage_knowledgebase.php" method="post" name="form1" enctype="multipart/form-data">
		<div class="form-inline">
			<span class="col-sm-2"><b><?php 
    echo $hesklang['kb_cat'];
    ?>
:</b></span>
			<span><select name="catid"><?php 
    $listBox->printMenu();
    ?>
</select></span>
		</div>
		<br/>
		<div class="form-inline">
			<span class="col-sm-2"><b><?php 
    echo $hesklang['kb_type'];
    ?>
:</b></span>
			<div class="form-group">
				<label><input type="radio" name="type" value="0" <?php 
    if ($article['type'] == 0) {
        echo 'checked="checked"';
    }
    ?>
 /> <b><i><?php 
    echo $hesklang['kb_published'];
    ?>
</i></b></label><br />
				<span><?php 
    echo $hesklang['kb_published2'];
    ?>
</span><br />
				<br/>
				<label><input type="radio" name="type" value="1" <?php 
    if ($article['type'] == 1) {
        echo 'checked="checked"';
    }
    ?>
 /> <b><i><?php 
    echo $hesklang['kb_private'];
    ?>
</i></b></label><br />
				<span><?php 
    echo $hesklang['kb_private2'];
    ?>
</span><br />
				<br/>
				<label><input type="radio" name="type" value="2" <?php 
    if ($article['type'] == 2) {
        echo 'checked="checked"';
    }
    ?>
 /> <b><i><?php 
    echo $hesklang['kb_draft'];
    ?>
</i></b></label><br />
				<span><?php 
    echo $hesklang['kb_draft2'];
    ?>
</span>
			</div>
		</div>
		<br/>
		<div class="form-inline">
			<span class="col-sm-2"><b><?php 
    echo $hesklang['kb_subject'];
    ?>
:</b></span>
			<span><input class="form-control" type="text" name="subject" size="70" maxlength="255" value="<?php 
    echo $article['subject'];
    ?>
" /></span>
		</div>
		<br/>
		<div class="form-inline">
			<span class="col-sm-2"><b><?php 
    echo $hesklang['opt'];
    ?>
:</b></span>
			<div class="form-group">
				<label><input type="checkbox" name="sticky" value="Y" <?php 
    if ($article['sticky']) {
        echo 'checked="checked"';
    }
    ?>
 /> <i><?php 
    echo $hesklang['sticky'];
    ?>
</i></label> [<a href="javascript:void(0)" onclick="javascript:alert('<?php 
    echo hesk_makeJsString($hesklang['saa']);
    ?>
')"><b>?</b></a>]<br />
				<label><input type="checkbox" name="resetviews" value="Y" <?php 
    if (isset($_SESSION['edit_article']['resetviews']) && $_SESSION['edit_article']['resetviews'] == 'Y') {
        echo 'checked="checked"';
    }
    ?>
 /> <i><?php 
    echo $hesklang['rv'];
    ?>
</i></label><br />
				<label><input type="checkbox" name="resetvotes" value="Y" <?php 
    if (isset($_SESSION['edit_article']['resetvotes']) && $_SESSION['edit_article']['resetvotes'] == 'Y') {
        echo 'checked="checked"';
    }
    ?>
 /> <i><?php 
    echo $hesklang['rr'];
    ?>
</i></label>
			</div>
		</div>
		<br/>
		<div class="form-inline">
			<?php 
    $displayType = $hesk_settings['kb_wysiwyg'] ? 'none' : 'block';
    $displayWarn = $article['html'] ? 'block' : 'none';
    ?>
			<span class="col-sm-2"><b><?php 
    echo $hesklang['kb_content'];
    ?>
:</b></span>
			<span id="contentType" style="display:<?php 
    echo $displayType;
    ?>
">
				<label><input type="radio" name="html" value="0" <?php 
    if (!$article['html']) {
        echo 'checked="checked"';
    }
    ?>
 onclick="javascript:document.getElementById('kblinks').style.display = 'none'" /> <?php 
    echo $hesklang['kb_dhtml'];
    ?>
</label><br />
				<label><input type="radio" name="html" value="1" <?php 
    if ($article['html']) {
        echo 'checked="checked"';
    }
    ?>
 onclick="javascript:document.getElementById('kblinks').style.display = 'block'" /> <?php 
    echo $hesklang['kb_ehtml'];
    ?>
</label>
				<span id="kblinks" style="display:<?php 
    echo $displayWarn;
    ?>
"><i><?php 
    echo $hesklang['kb_links'];
    ?>
</i></span>
			</span>
			<textarea name="content" rows="25" cols="70" id="content" style="width:48.9%; height:300px"><?php 
    echo $article['content'];
    ?>
</textarea>
		</div>
		<br/>
		<div class="form-inline">
			<span class="col-sm-2"><?php 
    echo $hesklang['kw'];
    ?>
:</b></span>
			<div class="form-group textarea-kw">
				<span><textarea class="form-control" name="keywords" rows="3" cols="70" id="keywords"><?php 
    echo $article['keywords'];
    ?>
</textarea></span><br/>
				<span><?php 
    echo $hesklang['kw1'];
    ?>
</span>
			</div>
		</div>
		<br/>
		<div class="form-inline">
			<span class="col-sm-2"><b><?php 
    echo $hesklang['attachments'];
    ?>
</b></span>
			<div class="form-group">
			<?php 
    if (!empty($article['attachments'])) {
        $att = explode(',', substr($article['attachments'], 0, -1));
        foreach ($att as $myatt) {
            list($att_id, $att_name) = explode('#', $myatt);
            $tmp = 'White';
            $style = 'class="option' . $tmp . 'OFF" onmouseover="this.className=\'option' . $tmp . 'ON\'" onmouseout="this.className=\'option' . $tmp . 'OFF\'"';
            echo '<a href="manage_knowledgebase.php?a=remove_kb_att&amp;id=' . $id . '&amp;kb_att=' . $att_id . '&amp;token=' . hesk_token_echo(0) . '" onclick="return hesk_confirmExecute(\'' . hesk_makeJsString($hesklang['delatt']) . '\');"><img src="../img/delete.png" width="16" height="16" alt="' . $hesklang['dela'] . '" title="' . $hesklang['dela'] . '" ' . $style . ' /></a> ';
            echo '<a href="../download_attachment.php?kb_att=' . $att_id . '"><img src="../img/clip.png" width="16" height="16" alt="' . $hesklang['dnl'] . ' ' . $att_name . '" title="' . $hesklang['dnl'] . ' ' . $att_name . '" ' . $style . ' /></a> ';
            echo '<a href="../download_attachment.php?kb_att=' . $att_id . '">' . $att_name . '</a><br />';
        }
        echo '<br />';
    }
    ?>
			
				<div id="chooseFile-addReply"><input type="file" name="attachment[1]" size="50" /></div>
				<div id="chooseFile-addReply"><input type="file" name="attachment[2]" size="50" /></div>
				<div id="chooseFile-addReply"><input type="file" name="attachment[3]" size="50" /></div>
				<span>(<a href="Javascript:void(0)" onclick="Javascript:hesk_window('../file_limits.php',250,500);return false;"><?php 
    echo $hesklang['ful'];
    ?>
</a>)</span>
			</div>
		</div>
		<br/>
		<div class="container">
			<input type="hidden" name="a" value="save_article" />
			<input type="hidden" name="id" value="<?php 
    echo $id;
    ?>
" />
			<input type="hidden" name="old_type" value="<?php 
    echo $article['type'];
    ?>
" />
			<input type="hidden" name="old_catid" value="<?php 
    echo $catid;
    ?>
" />
			<input type="hidden" name="token" value="<?php 
    hesk_token_echo();
    ?>
" />
			<input type="submit" value="<?php 
    echo $hesklang['kb_save'];
    ?>
" class="btn btn-default save-article-btn" />
			<a href="manage_knowledgebase.php?a=manage_cat&amp;catid=<?php 
    echo $catid;
    ?>
"><input type="submit" value="<?php 
    echo $hesklang['cancel'];
    ?>
" class="btn btn-default cancel-article-btn" /></a>
		</div>
	</form>
	<br/>
	</div>	
</div>
	
    <div class="container revision-history-title"><?php 
    echo $hesklang['revhist'];
    ?>
</div>
	<div class="revision-history">
		<br/>
		<ul><?php 
    echo $article['history'];
    ?>
</ul>
		<br/>
	</div>

	<?php 
    /* Clean unneeded session variables */
    hesk_cleanSessionVars('edit_article');
    require_once HESK_PATH . 'inc/footer.inc.php';
    exit;
}
Exemplo n.º 4
0
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>&nbsp;</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 />&nbsp;<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 />&nbsp;<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 />&nbsp;<br /><a href="password.php" class="smaller">' . $hesklang['fpass'] . '</a>';
    }
    ?>
                </div>
            </div>

            </form>
        </div>
    </div>

    </div>

    <p>&nbsp;</p>

	<?php 
    hesk_cleanSessionVars('a_iserror');
    require_once HESK_PATH . 'inc/footer.inc.php';
    exit;
}
Exemplo n.º 5
0
                    // Parse the incoming email
                    $results = parser($message_file);
                    // Convert email into a ticket (or new reply)
                    if ($id = hesk_email2ticket($results, 1, $set_category, $set_priority)) {
                        echo $hesk_settings['debug_mode'] ? "<pre>Ticket {$id} created/updated.</pre>\n" : '';
                    } else {
                        echo $hesk_settings['debug_mode'] ? "<pre>Ticket NOT inserted - may be duplicate, blocked or an error.</pre>\n" : '';
                    }
                    // Queue message to be deleted on connection close
                    if (!$hesk_settings['pop3_keep']) {
                        $pop3->DeleteMessage($message);
                    }
                    echo $hesk_settings['debug_mode'] ? "<br /><br />\n\n" : '';
                }
            }
            // Disconnect from the server - this also deletes queued messages
            if ($error == "" && ($error = $pop3->Close()) == "") {
                echo $hesk_settings['debug_mode'] ? "<pre>Disconnected from the POP3 server &quot;" . $pop3->hostname . "&quot;.</pre>\n" : '';
            }
        }
    }
}
// Any error messages?
if ($error != '') {
    echo "<h2>Error: " . hesk_htmlspecialchars($error) . "</h2>";
}
// Remove active POP3 fetching log file
if ($hesk_settings['pop3_job_wait']) {
    unlink($job_file);
}
return NULL;
Exemplo n.º 6
0
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> &gt;
	<?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">&nbsp;</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">&nbsp;</td>
                <td>&nbsp;</td>
        </tr>
        <tr>
                <td width="60">&nbsp;</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">&nbsp;</td>
                <td>&nbsp;</td>
        </tr>
        <tr>
                <td width="60">&nbsp;</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">&nbsp;</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 />&nbsp;<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 />&nbsp;<br /><input type="text" name="mysecnum" size="20" maxlength="5" ' . $cls . ' />';
        }
        ?>
                <hr />
				</td>
			</tr>
            <?php 
    } else {
        ?>
	        <tr>
	                <td width="60">&nbsp;</td>
	                <td>&nbsp;</td>
	        </tr>
	        <?php 
    }
    // End if $hesk_settings['secimg_use'] == 2
    if ($hesk_settings['autologin']) {
        ?>
			<tr>
				<td width="60">&nbsp;</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">&nbsp;</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">&nbsp;</td>
                <td>&nbsp;</td>
        </tr>
        <tr>
                <td width="60">&nbsp;</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 />&nbsp;
				</td>
        </tr>
        </table>

        </form>

		</td>
		<td class="roundcornersright">&nbsp;</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>&nbsp;</p>

	<?php 
    hesk_cleanSessionVars('a_iserror');
    require_once HESK_PATH . 'inc/footer.inc.php';
    exit;
}
Exemplo n.º 7
0
function hesk_input($in, $error = 0, $redirect_to = '', $force_slashes = 0, $max_length = 0)
{
    // Strip whitespace
    $in = trim($in);
    // Is value length 0 chars?
    if (strlen($in) == 0) {
        // Do we need to throw an error?
        if ($error) {
            if ($redirect_to == 'NOREDIRECT') {
                hesk_process_messages($error, 'NOREDIRECT');
            } elseif ($redirect_to) {
                hesk_process_messages($error, $redirect_to);
            } else {
                hesk_error($error);
            }
        } else {
            return $in;
        }
    }
    // Sanitize input
    $in = hesk_clean_utf8($in);
    $in = hesk_htmlspecialchars($in);
    $in = preg_replace('/&amp;(\\#[0-9]+;)/', '&$1', $in);
    // Add slashes
    if (HESK_SLASH || $force_slashes) {
        $in = addslashes($in);
    }
    // Check length
    if ($max_length) {
        $in = substr($in, 0, $max_length);
    }
    // Return processed value
    return $in;
}
Exemplo n.º 8
0
function hesk_show_kb_category($catid, $is_search = 0)
{
    global $hesk_settings, $hesklang;
    $res = hesk_dbQuery("SELECT `name`,`parent` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` WHERE `id`='{$catid}' AND `type`='0' LIMIT 1");
    $thiscat = hesk_dbFetchAssoc($res) or hesk_error($hesklang['kb_cat_inv']);
    if ($is_search == 0) {
        /* Print header */
        $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . hesk_htmlspecialchars($thiscat['name']);
        require_once HESK_PATH . 'inc/header.inc.php';
        hesk_kb_header($hesk_settings['kb_link']);
        // If we are in "Knowledgebase only" mode show system messages
        if ($catid == 1 && hesk_check_kb_only(false)) {
            // Service messages
            $res = hesk_dbQuery('SELECT `title`, `message`, `style` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` WHERE `type`='0' ORDER BY `order` ASC");
            while ($sm = hesk_dbFetchAssoc($res)) {
                hesk_service_message($sm);
            }
        }
    }
    if ($thiscat['parent']) {
        $link = $thiscat['parent'] == 1 ? 'knowledgebase.php' : 'knowledgebase.php?category=' . $thiscat['parent'];
        echo '<div class="container homepageh3">' . $hesklang['kb_cat'] . ': ' . $thiscat['name'] . '</div>
        <div class="container"><a href="javascript:history.go(-1)">' . '<button type="submit" class="btn btn-default goback-btn">' . $hesklang['back'] . '</button>' . '</a></div>
		';
    }
    $result = hesk_dbQuery("SELECT `id`,`name`,`articles` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` WHERE `parent`='{$catid}' AND `type`='0' ORDER BY `cat_order` ASC");
    if (hesk_dbNumRows($result) > 0) {
        ?>

	<div class="container"><b><?php 
        echo $hesklang['kb_cat_sub'];
        ?>
:</b></div>
	<br/>
	<div class="container">

		<?php 
        $per_col = $hesk_settings['kb_cols'];
        $i = 1;
        while ($cat = hesk_dbFetchAssoc($result)) {
            if ($i == 1) {
                echo '<div>';
            }
            echo '
			<div class="form-group">
			<div class="form-inline"><img src="img/folder.gif" width="20" height="20" alt="" style="vertical-align:middle" /><a href="knowledgebase.php?category=' . $cat['id'] . '">' . $cat['name'] . '</a></div>
			';
            /* Print most popular/sticky articles */
            if ($hesk_settings['kb_numshow'] && $cat['articles']) {
                $res = hesk_dbQuery("SELECT `id`,`subject` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$cat['id']}' AND `type`='0' ORDER BY `sticky` DESC, `views` DESC, `art_order` ASC LIMIT " . (intval($hesk_settings['kb_numshow']) + 1));
                $num = 1;
                while ($art = hesk_dbFetchAssoc($res)) {
                    echo '
		            <div class="form-inline">
		            <img src="img/article_text.png" width="16" height="16" border="0" alt="" style="vertical-align:middle" />
		            <a href="knowledgebase.php?article=' . $art['id'] . '" class="article">' . $art['subject'] . '</a>
		            </div>';
                    if ($num == $hesk_settings['kb_numshow']) {
                        break;
                    } else {
                        $num++;
                    }
                }
                if (hesk_dbNumRows($res) > $hesk_settings['kb_numshow']) {
                    echo '<div>&raquo; <a href="knowledgebase.php?category=' . $cat['id'] . '"><i>' . $hesklang['m'] . '</i></a></div>';
                }
            }
            echo '
			</div>
			';
            if ($i == $per_col) {
                echo '</div>';
                $i = 0;
            }
            $i++;
        }
        /* Finish the table if needed */
        if ($i != 1) {
            for ($j = 1; $j <= $per_col; $j++) {
                echo '';
                if ($i == $per_col) {
                    echo '</div>';
                    break;
                }
                $i++;
            }
        }
        ?>
	</div>

	<?php 
    }
    // END if NumRows > 0
    if ($catid == 1) {
        print "<div class='col-sm-8 col-sm-offset-2 conatiner kb-popart-latest'>";
        /* Get list of top articles */
        hesk_kbTopArticles($hesk_settings['kb_popart'], 0, false);
        /* Get list of latest articles */
        hesk_kbLatestArticles($hesk_settings['kb_latest'], 0);
        print "</div>";
    }
    ?>
	
<?php 
}
Exemplo n.º 9
0
} elseif (strpos($set['ip_whois'], '{IP}') === false) {
    $set['ip_whois'] .= '{IP}';
}
$set['maintenance_mode'] = empty($_POST['s_maintenance_mode']) ? 0 : 1;
$set['alink'] = empty($_POST['s_alink']) ? 0 : 1;
$set['submit_notice'] = empty($_POST['s_submit_notice']) ? 0 : 1;
$set['online'] = empty($_POST['s_online']) ? 0 : 1;
$set['online_min'] = hesk_checkMinMax(intval(hesk_POST('s_online_min')), 1, 999, 10);
$set['check_updates'] = empty($_POST['s_check_updates']) ? 0 : 1;
/*** CUSTOM FIELDS ***/
for ($i = 1; $i <= 20; $i++) {
    $this_field = 'custom' . $i;
    $set['custom_fields'][$this_field]['use'] = !empty($_POST['s_custom' . $i . '_use']) ? 1 : 0;
    if ($set['custom_fields'][$this_field]['use']) {
        $set['custom_fields'][$this_field]['place'] = empty($_POST['s_custom' . $i . '_place']) ? 0 : 1;
        $set['custom_fields'][$this_field]['type'] = hesk_htmlspecialchars(hesk_POST('s_custom' . $i . '_type', 'text'));
        $set['custom_fields'][$this_field]['req'] = !empty($_POST['s_custom' . $i . '_req']) ? 1 : 0;
        $set['custom_fields'][$this_field]['name'] = hesk_input(hesk_POST('s_custom' . $i . '_name'), $hesklang['err_custname']);
        $set['custom_fields'][$this_field]['maxlen'] = intval(hesk_POST('s_custom' . $i . '_maxlen', 255));
        $set['custom_fields'][$this_field]['value'] = hesk_input(hesk_POST('s_custom' . $i . '_val'));
        if ($set['custom_fields'][$this_field]['type'] == 'email' && $set['custom_fields'][$this_field]['value'] == '') {
            // New custom field without any options set. Default to Cc
            $set['custom_fields'][$this_field]['value'] = 'cc';
        }
        if (!in_array($set['custom_fields'][$this_field]['type'], array('text', 'textarea', 'select', 'radio', 'checkbox', 'date', 'multiselect', 'email'))) {
            $set['custom_fields'][$this_field]['type'] = 'text';
        }
    } else {
        $set['custom_fields'][$this_field] = array('use' => 0, 'place' => 0, 'type' => 'text', 'req' => 0, 'name' => 'Custom field ' . $i, 'maxlen' => 255, 'value' => '');
    }
}
Exemplo n.º 10
0
function hesk_show_kb_category($catid, $is_search = 0)
{
    global $hesk_settings, $hesklang;
    $res = hesk_dbQuery("SELECT `name`,`parent` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` WHERE `id`='{$catid}' AND `type`='0' LIMIT 1");
    $thiscat = hesk_dbFetchAssoc($res) or hesk_error($hesklang['kb_cat_inv']);
    if ($is_search == 0) {
        /* Print header */
        $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . hesk_htmlspecialchars($thiscat['name']);
        require_once HESK_PATH . 'inc/header.inc.php';
        hesk_kb_header($hesk_settings['kb_link']);
        // If we are in "Knowledgebase only" mode show system messages
        if ($catid == 1 && hesk_check_kb_only(false)) {
            // Service messages
            $res = hesk_dbQuery('SELECT `title`, `message`, `style` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` WHERE `type`='0' ORDER BY `order` ASC");
            while ($sm = hesk_dbFetchAssoc($res)) {
                hesk_service_message($sm);
            }
        }
    }
    if ($thiscat['parent']) {
        $link = $thiscat['parent'] == 1 ? 'knowledgebase.php' : 'knowledgebase.php?category=' . $thiscat['parent'];
        echo '<span class="homepageh3">&raquo; ' . $hesklang['kb_cat'] . ': ' . $thiscat['name'] . '</span>
        &nbsp;(<a href="javascript:history.go(-1)">' . $hesklang['back'] . '</a>)
		';
    }
    $result = hesk_dbQuery("SELECT `id`,`name`,`articles` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` WHERE `parent`='{$catid}' AND `type`='0' ORDER BY `cat_order` ASC");
    if (hesk_dbNumRows($result) > 0) {
        ?>

		<p>&raquo; <b><?php 
        echo $hesklang['kb_cat_sub'];
        ?>
:</b></p>

<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">&nbsp;</td>
	<td>

		<table border="0" cellspacing="1" cellpadding="3" width="100%">

		<?php 
        $per_col = $hesk_settings['kb_cols'];
        $i = 1;
        while ($cat = hesk_dbFetchAssoc($result)) {
            if ($i == 1) {
                echo '<tr>';
            }
            echo '
		    <td width="50%" valign="top">
			<table border="0">
			<tr><td><img src="img/folder.gif" width="20" height="20" alt="" style="vertical-align:middle" /><a href="knowledgebase.php?category=' . $cat['id'] . '">' . $cat['name'] . '</a></td></tr>
			';
            /* Print most popular/sticky articles */
            if ($hesk_settings['kb_numshow'] && $cat['articles']) {
                $res = hesk_dbQuery("SELECT `id`,`subject` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$cat['id']}' AND `type`='0' ORDER BY `sticky` DESC, `views` DESC, `art_order` ASC LIMIT " . (intval($hesk_settings['kb_numshow']) + 1));
                $num = 1;
                while ($art = hesk_dbFetchAssoc($res)) {
                    echo '
		            <tr>
		            <td><img src="img/article_text.png" width="16" height="16" border="0" alt="" style="vertical-align:middle" />
		            <a href="knowledgebase.php?article=' . $art['id'] . '" class="article">' . $art['subject'] . '</a></td>
		            </tr>';
                    if ($num == $hesk_settings['kb_numshow']) {
                        break;
                    } else {
                        $num++;
                    }
                }
                if (hesk_dbNumRows($res) > $hesk_settings['kb_numshow']) {
                    echo '<tr><td>&raquo; <a href="knowledgebase.php?category=' . $cat['id'] . '"><i>' . $hesklang['m'] . '</i></a></td></tr>';
                }
            }
            echo '
			</table>
		    </td>
			';
            if ($i == $per_col) {
                echo '</tr>';
                $i = 0;
            }
            $i++;
        }
        /* Finish the table if needed */
        if ($i != 1) {
            for ($j = 1; $j <= $per_col; $j++) {
                echo '<td width="50%">&nbsp;</td>';
                if ($i == $per_col) {
                    echo '</tr>';
                    break;
                }
                $i++;
            }
        }
        ?>
		</table>

	</td>
	<td class="roundcornersright">&nbsp;</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 
    }
    // END if NumRows > 0
    ?>

	<p>&raquo; <b><?php 
    echo $hesklang['ac'];
    ?>
</b></p>

<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">&nbsp;</td>
	<td>

	<?php 
    $res = hesk_dbQuery("SELECT `id`, `subject`, LEFT(`content`, " . max(200, $hesk_settings['kb_substrart'] * 2) . ") AS `content`, `rating` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$catid}' AND `type`='0' ORDER BY `sticky` DESC, `art_order` ASC");
    if (hesk_dbNumRows($res) == 0) {
        echo '<p><i>' . $hesklang['noac'] . '</i></p>';
    } else {
        echo '<div align="center"><table border="0" cellspacing="1" cellpadding="3" width="100%">';
        while ($article = hesk_dbFetchAssoc($res)) {
            $txt = hesk_kbArticleContentPreview($article['content']);
            if ($hesk_settings['kb_rating']) {
                $alt = $article['rating'] ? sprintf($hesklang['kb_rated'], sprintf("%01.1f", $article['rating'])) : $hesklang['kb_not_rated'];
                $rat = '<td width="1" valign="top"><img src="img/star_' . hesk_round_to_half($article['rating']) * 10 . '.png" width="85" height="16" alt="' . $alt . '" title="' . $alt . '" border="0" style="vertical-align:text-bottom" /></td>';
            } else {
                $rat = '';
            }
            echo '
				<tr>
				<td>
	                <table border="0" width="100%" cellspacing="0" cellpadding="1">
	                <tr>
	                <td width="1" valign="top"><img src="img/article_text.png" width="16" height="16" border="0" alt="" style="vertical-align:middle" /></td>
	                <td valign="top"><a href="knowledgebase.php?article=' . $article['id'] . '">' . $article['subject'] . '</a></td>
	                ' . $rat . '
                    </tr>
	                </table>
	                <table border="0" width="100%" cellspacing="0" cellpadding="1">
	                <tr>
	                <td width="1" valign="top"><img src="img/blank.gif" width="16" height="10" style="vertical-align:middle" alt="" /></td>
	                <td><span class="article_list">' . $txt . '</span></td>
                    </tr>
	                </table>
	            </td>
				</tr>';
        }
        echo '</table></div>';
    }
    ?>

	</td>
	<td class="roundcornersright">&nbsp;</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 
    /* On the main KB page print out top and latest articles if needed */
    if ($catid == 1) {
        /* Get list of top articles */
        hesk_kbTopArticles($hesk_settings['kb_popart'], 0);
        /* Get list of latest articles */
        hesk_kbLatestArticles($hesk_settings['kb_latest'], 0);
    }
}
Exemplo n.º 11
0
function hesk_show_kb_category($catid, $is_search = 0)
{
    global $hesk_settings, $hesklang;
    $res = hesk_dbQuery("SELECT `name`,`parent` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` WHERE `id`='{$catid}' AND `type`='0' LIMIT 1");
    $thiscat = hesk_dbFetchAssoc($res) or hesk_error($hesklang['kb_cat_inv']);
    if ($is_search == 0) {
        /* Print header */
        $hesk_settings['tmp_title'] = $hesk_settings['hesk_title'] . ' - ' . hesk_htmlspecialchars($thiscat['name']);
        require_once HESK_PATH . 'inc/header.inc.php';
        hesk_kb_header($hesk_settings['kb_link']);
    }
    // If we are in "Knowledgebase only" mode show system messages
    if ($catid == 1 && hesk_check_kb_only(false)) {
        // Service messages
        $res = hesk_dbQuery('SELECT `title`, `message`, `style` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` WHERE `type`='0' ORDER BY `order` ASC");
        while ($sm = hesk_dbFetchAssoc($res)) {
            hesk_service_message($sm);
        }
    }
    if ($thiscat['parent']) {
        $link = $thiscat['parent'] == 1 ? 'knowledgebase.php' : 'knowledgebase.php?category=' . $thiscat['parent'];
        echo '<h3 class="text-left"><a href="javascript:history.go(-1)"><i class="fa fa-arrow-circle-left" data-toggle="tooltip" data-placement="top" title="' . $hesklang['back'] . '"></i></a>&nbsp;' . $hesklang['kb_cat'] . ': ' . $thiscat['name'] . ' </h3>
        <div class="footerWithBorder blankSpace"></div>
        <div class="blankSpace"></div>
		';
    }
    $result = hesk_dbQuery("SELECT `id`,`name`,`articles` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_categories` WHERE `parent`='{$catid}' AND `type`='0' ORDER BY `cat_order` ASC");
    if (hesk_dbNumRows($result) > 0) {
        ?>

        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="text-left"><?php 
        echo $hesklang['kb_cat_sub'];
        ?>
</h4>
            </div>
            <table class="table table-striped">

                <?php 
        $per_col = $hesk_settings['kb_cols'];
        $i = 1;
        while ($cat = hesk_dbFetchAssoc($result)) {
            if ($i == 1) {
                echo '<tr>';
            }
            echo '
                    <td width="50%" valign="top">
                    <table border="0">
                    <tr><td><i class="fa fa-folder"></i>&nbsp;<a href="knowledgebase.php?category=' . $cat['id'] . '">' . $cat['name'] . '</a></td></tr>
                    ';
            /* Print most popular/sticky articles */
            if ($hesk_settings['kb_numshow'] && $cat['articles']) {
                $res = hesk_dbQuery("SELECT `id`,`subject`, `sticky` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$cat['id']}' AND `type`='0' ORDER BY `sticky` DESC, `views` DESC, `art_order` ASC LIMIT " . (intval($hesk_settings['kb_numshow']) + 1));
                $num = 1;
                while ($art = hesk_dbFetchAssoc($res)) {
                    $icon = 'glyphicon glyphicon-file';
                    $style = '';
                    if ($art['sticky']) {
                        $icon = 'glyphicon glyphicon-pushpin';
                        $style = 'style="color: #FF0000"';
                    }
                    echo '
                            <tr>
                            <td ' . $style . '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span class="' . $icon . '"></span>
                            <a href="knowledgebase.php?article=' . $art['id'] . '" class="article">' . $art['subject'] . '</a></td>
                            </tr>';
                    if ($num == $hesk_settings['kb_numshow']) {
                        break;
                    } else {
                        $num++;
                    }
                }
                if (hesk_dbNumRows($res) > $hesk_settings['kb_numshow']) {
                    echo '<tr><td>&raquo; <a href="knowledgebase.php?category=' . $cat['id'] . '"><i>' . $hesklang['m'] . '</i></a></td></tr>';
                }
            }
            echo '
			</table>
		    </td>
			';
            if ($i == $per_col) {
                echo '</tr>';
                $i = 0;
            }
            $i++;
        }
        /* Finish the table if needed */
        if ($i != 1) {
            for ($j = 1; $j <= $per_col; $j++) {
                echo '<td width="50%">&nbsp;</td>';
                if ($i == $per_col) {
                    echo '</tr>';
                    break;
                }
                $i++;
            }
        }
        ?>
            </table>
        </div>

	<?php 
    }
    // END if NumRows > 0
    ?>

    <div class="panel panel-default">
        <div class="panel-heading">
            <h4 class="text-left"><?php 
    echo $hesklang['ac_no_colon'];
    ?>
</h4>
        </div>
        <table class="table table-striped">
            <tbody>
            <?php 
    $res = hesk_dbQuery("SELECT `id`, `subject`, `sticky`, LEFT(`content`, " . max(200, $hesk_settings['kb_substrart'] * 2) . ") AS `content`, `rating` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "kb_articles` WHERE `catid`='{$catid}' AND `type`='0' ORDER BY `sticky` DESC, `art_order` ASC");
    if (hesk_dbNumRows($res) == 0) {
        echo '<tr><td><i>' . $hesklang['noac'] . '</i></td></tr>';
    } else {
        while ($article = hesk_dbFetchAssoc($res)) {
            $icon = 'fa fa-file';
            $color = '';
            $style = '';
            $txt = hesk_kbArticleContentPreview($article['content']);
            if ($article['sticky']) {
                $icon = 'glyphicon glyphicon-pushpin';
                $style = 'style="color: #FF0000"';
            }
            if ($hesk_settings['kb_rating']) {
                $alt = $article['rating'] ? sprintf($hesklang['kb_rated'], sprintf("%01.1f", $article['rating'])) : $hesklang['kb_not_rated'];
                $rat = '<td><img src="img/star_' . hesk_round_to_half($article['rating']) * 10 . '.png" width="85" height="16" alt="' . $alt . '" title="' . $alt . '" border="0" style="vertical-align:text-bottom" /></td>';
            } else {
                $rat = '';
            }
            echo '
                        <tr>
                            <td>
                                <i class="' . $icon . '" ' . $style . '></i>
                                <a href="knowledgebase.php?article=' . $article['id'] . '">' . $article['subject'] . '</a>
                                <br>
                                <span class="indent-15">' . $txt . '</span>
                            </td>
                            ' . $rat . '
                        </tr>';
        }
    }
    ?>
            </tbody>
        </table>
    </div>

	<?php 
    /* On the main KB page print out top and latest articles if needed */
    if ($catid == 1) {
        /* Get list of top articles */
        hesk_kbTopArticles($hesk_settings['kb_popart'], 0);
        /* Get list of latest articles */
        hesk_kbLatestArticles($hesk_settings['kb_latest'], 0);
    }
    hesk_kbFooter();
}
Exemplo n.º 12
0
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> &gt;
		<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 />&nbsp;<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 />&nbsp;<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 />&nbsp;<br /><div id="forgotpassw"><a href="password.php" class="smaller">' . $hesklang['fpass'] . '</a></div>';
    }
    ?>
					<br />&nbsp;

			</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;
}
Exemplo n.º 13
0
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 />&nbsp;<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 />&nbsp;<br /><img src="print_sec_img.php?' . rand(10000, 99999) . '" width="150" height="40" alt="' . $hesklang['sec_img'] . '" title="' . $hesklang['sec_img'] . '" border="1" name="secimg" style="vertical-align:text-bottom" /> ' . '<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 />&nbsp;<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">&nbsp;</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');
}
Exemplo n.º 14
0
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> &gt;
<a href="<?php 
    echo $hesk_settings['hesk_url'];
    ?>
" class="smaller"><?php 
    echo $hesk_settings['hesk_title'];
    ?>
</a>
&gt; <?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">&nbsp;</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 />&nbsp;<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 />&nbsp;
	        </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 />&nbsp;<br /><img src="print_sec_img.php?' . rand(10000, 99999) . '" width="150" height="40" alt="' . $hesklang['sec_img'] . '" title="' . $hesklang['sec_img'] . '" border="1" name="secimg" style="vertical-align:text-bottom" /> ' . '<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 />&nbsp;<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 {
        ?>
        &nbsp;<br />&nbsp;<br />
		<table border="0" width="100%">
		<tr>
		<td style="text-align:right" width="150">&nbsp;</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 />
	    &nbsp;<br />&nbsp;</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">&nbsp;</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');
}
Exemplo n.º 15
0
function hesk_autoLogin($noredirect = 0)
{
    global $hesk_settings, $hesklang, $hesk_db_link;
    if (!$hesk_settings['autologin']) {
        return false;
    }
    $user = hesk_htmlspecialchars(hesk_COOKIE('hesk_username'));
    $hash = hesk_htmlspecialchars(hesk_COOKIE('hesk_p'));
    define('HESK_USER', $user);
    if (empty($user) || empty($hash)) {
        return false;
    }
    /* Login cookies exist, now lets limit brute force attempts */
    hesk_limitBfAttempts();
    /* Check username */
    $result = hesk_dbQuery('SELECT * FROM `' . $hesk_settings['db_pfix'] . "users` WHERE `user` = '" . hesk_dbEscape($user) . "' LIMIT 1");
    if (hesk_dbNumRows($result) != 1) {
        setcookie('hesk_username', '');
        setcookie('hesk_p', '');
        header('Location: index.php?a=login&notice=1');
        exit;
    }
    $res = hesk_dbFetchAssoc($result);
    foreach ($res as $k => $v) {
        $_SESSION[$k] = $v;
    }
    /* Check password */
    if ($hash != hesk_Pass2Hash($_SESSION['pass'] . strtolower($user) . $_SESSION['pass'])) {
        setcookie('hesk_username', '');
        setcookie('hesk_p', '');
        header('Location: index.php?a=login&notice=1');
        exit;
    }
    /* Check if default password */
    if ($_SESSION['pass'] == '499d74967b28a841c98bb4baaabaad699ff3c079') {
        hesk_process_messages($hesklang['chdp'], 'NOREDIRECT', 'NOTICE');
    }
    unset($_SESSION['pass']);
    /* Login successful, clean brute force attempts */
    hesk_cleanBfAttempts();
    /* Regenerate session ID (security) */
    hesk_session_regenerate_id();
    /* Get allowed categories */
    if (empty($_SESSION['isadmin'])) {
        $_SESSION['categories'] = explode(',', $_SESSION['categories']);
    }
    /* Renew cookies */
    setcookie('hesk_username', "{$user}", strtotime('+1 year'));
    setcookie('hesk_p', "{$hash}", strtotime('+1 year'));
    /* Close any old tickets here so Cron jobs aren't necessary */
    if ($hesk_settings['autoclose']) {
        $revision = sprintf($hesklang['thist3'], hesk_date(), $hesklang['auto']);
        $dt = date('Y-m-d H:i:s', time() - $hesk_settings['autoclose'] * 86400);
        hesk_dbQuery("UPDATE `" . $hesk_settings['db_pfix'] . "tickets` SET `status`='3', `history`=CONCAT(`history`,'" . hesk_dbEscape($revision) . "') WHERE `status` = '2' AND `lastchange` <= '" . hesk_dbEscape($dt) . "' ");
    }
    /* If session expired while a HESK page is open just continue using it, don't redirect */
    if ($noredirect) {
        return true;
    }
    /* Redirect to the destination page */
    if (hesk_isREQUEST('goto') && ($url = hesk_REQUEST('goto'))) {
        $url = str_replace('&amp;', '&', $url);
        header('Location: ' . $url);
    } else {
        header('Location: admin_main.php');
    }
    exit;
}
Exemplo n.º 16
0
function hesk_autoLogin($noredirect = 0)
{
    global $hesk_settings, $hesklang, $hesk_db_link;
    if (!$hesk_settings['autologin']) {
        return false;
    }
    $user = hesk_htmlspecialchars(hesk_COOKIE('hesk_username'));
    $hash = hesk_htmlspecialchars(hesk_COOKIE('hesk_p'));
    define('HESK_USER', $user);
    if (empty($user) || empty($hash)) {
        return false;
    }
    /* Login cookies exist, now lets limit brute force attempts */
    hesk_limitBfAttempts();
    /* Check username */
    $result = hesk_dbQuery('SELECT * FROM `' . $hesk_settings['db_pfix'] . "users` WHERE `user` = '" . hesk_dbEscape($user) . "' LIMIT 1");
    if (hesk_dbNumRows($result) != 1) {
        setcookie('hesk_username', '');
        setcookie('hesk_p', '');
        header('Location: index.php?a=login&notice=1');
        exit;
    }
    $res = hesk_dbFetchAssoc($result);
    /* Check password */
    if ($hash != hesk_Pass2Hash($res['pass'] . strtolower($user) . $res['pass'])) {
        setcookie('hesk_username', '');
        setcookie('hesk_p', '');
        header('Location: index.php?a=login&notice=1');
        exit;
    }
    // Set user details
    foreach ($res as $k => $v) {
        $_SESSION[$k] = $v;
    }
    /* Check if default password */
    if ($_SESSION['pass'] == '499d74967b28a841c98bb4baaabaad699ff3c079') {
        hesk_process_messages($hesklang['chdp'], 'NOREDIRECT', 'NOTICE');
    }
    // Set a tag that will be used to expire sessions after username or password change
    $_SESSION['session_verify'] = hesk_activeSessionCreateTag($user, $_SESSION['pass']);
    // We don't need the password hash anymore
    unset($_SESSION['pass']);
    /* Login successful, clean brute force attempts */
    hesk_cleanBfAttempts();
    /* Regenerate session ID (security) */
    hesk_session_regenerate_id();
    /* Get allowed categories */
    if (empty($_SESSION['isadmin'])) {
        $_SESSION['categories'] = explode(',', $_SESSION['categories']);
    }
    /* Renew cookies */
    setcookie('hesk_username', "{$user}", strtotime('+1 year'));
    setcookie('hesk_p', "{$hash}", strtotime('+1 year'));
    /* Close any old tickets here so Cron jobs aren't necessary */
    if ($hesk_settings['autoclose']) {
        $revision = sprintf($hesklang['thist3'], hesk_date(), $hesklang['auto']);
        $dt = date('Y-m-d H:i:s', time() - $hesk_settings['autoclose'] * 86400);
        // Notify customer of closed ticket?
        if ($hesk_settings['notify_closed']) {
            // Get list of tickets
            $result = hesk_dbQuery("SELECT * FROM `" . $hesk_settings['db_pfix'] . "tickets` WHERE `status` = '2' AND `lastchange` <= '" . hesk_dbEscape($dt) . "' ");
            if (hesk_dbNumRows($result) > 0) {
                global $ticket;
                // Load required functions?
                if (!function_exists('hesk_notifyCustomer')) {
                    require HESK_PATH . 'inc/email_functions.inc.php';
                }
                while ($ticket = hesk_dbFetchAssoc($result)) {
                    $ticket['dt'] = hesk_date($ticket['dt'], true);
                    $ticket['lastchange'] = hesk_date($ticket['lastchange'], true);
                    $ticket = hesk_ticketToPlain($ticket, 1, 0);
                    hesk_notifyCustomer('ticket_closed');
                }
            }
        }
        // Update ticket statuses and history in database
        hesk_dbQuery("UPDATE `" . $hesk_settings['db_pfix'] . "tickets` SET `status`='3', `closedat`=NOW(), `closedby`='-1', `history`=CONCAT(`history`,'" . hesk_dbEscape($revision) . "') WHERE `status` = '2' AND `lastchange` <= '" . hesk_dbEscape($dt) . "' ");
    }
    /* If session expired while a HESK page is open just continue using it, don't redirect */
    if ($noredirect) {
        return true;
    }
    /* Redirect to the destination page */
    header('Location: ' . hesk_verifyGoto());
    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">Home</a></li>
			<li id="userMenu-submitTicket"><a href="index.php?a=add">Submit Ticket</a></li>
			<li id="userMenu-viewTicket"><a href="ticket.php">View Ticket</a></li>
			<li id="client-username"><a href="client_profile.php">Hello, <?php 
    if (isset($_SESSION['id']['user']) && $_SESSION['id']['user']) {
        echo $_SESSION['id']['user'];
    }
    ?>
</a></li>
			<li id="userMenu-logout"><a href="logout.php">Log Out</a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </nav>
	
<div class="container siteUrl-title-indexPhp">
<div class="form-inline">
<span><a href="<?php 
    echo $hesk_settings['site_url'];
    ?>
" class="smaller" style="text-decoration: none;"><?php 
    echo $hesk_settings['site_title'];
    ?>
</a> &gt;
<a href="<?php 
    echo $hesk_settings['hesk_url'];
    ?>
" class="smaller"><?php 
    echo 'Help Desk';
    ?>
</a>
&gt; <?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 form-inline" id="view-submitTicket"> 
<img src="img/existingticket.jpg" alt="existingticket"/><span><?php 
    echo $hesklang['submit_ticket'];
    ?>
</span></div>

<br/>
<div class="conatiner col-sm-8 col-sm-offset-2 form-submit-support-request">
	<div>
		&nbsp;
	<div>
			<!-- START FORM -->

			<p><?php 
    echo $hesklang['use_form_below'];
    ?>
 <font class="important"> *</font></p><br/>

			<form method="post" action="submit_ticket.php?submit=1" name="form1" enctype="multipart/form-data">

			<!-- Contact info -->
			<div class="form-group contact-info-support-request">
				<div class="form-inline" style="margin-bottom: 5px;">
					<label class="col-sm-2 control-label" for="name-contact-info-support-request"><?php 
    echo $hesklang['name'];
    ?>
: <font class="important">*</font></label>
					<input type="text" class="form-control contact-support-request" id="name-contact-info-support-request" name="name" size="40" maxlength="30" value="<?php 
    if (isset($_SESSION['id']['user'])) {
        echo $_SESSION['id']['user'];
    }
    ?>
" <?php 
    if (in_array('name', $_SESSION['iserror'])) {
        echo ' class="isError" ';
    }
    ?>
 readonly>
				</div>

				<div class="form-inline" style="margin-bottom: 5px;">
					<label class="col-sm-2 control-label" for="email-contact-info-support-request"><?php 
    echo $hesklang['email'];
    ?>
: <font class="important">*</font></label>
					<input type="text" class="form-control contact-support-request" id="email-contact-info-support-request" name="email" size="40" maxlength="1000" 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>

				<?php 
    if ($hesk_settings['confirm_email']) {
        ?>
					<div class="form-inline" style="margin-bottom: 5px;">
						<label class="col-sm-2 control-label" for="confemail-contact-info-support-request"><?php 
        echo $hesklang['confemail'];
        ?>
: <font class="important">*</font></label>
						<input type="text" class="form-control contact-support-request" id="confemail-contact-info-support-request" 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" ';
        }
        ?>
 />
					</div>
					<?php 
    }
    // End if $hesk_settings['confirm_email']
    ?>
			</div><!-- end contact-info-support-request -->

			<?php 
    hesk_load_database_functions();
    hesk_dbConnect();
    ?>
			
			<div class="form-inline" style="margin-bottom: 5px;">
				<label class="col-sm-2 control-label" for="select-cont"><?php 
    echo $hesklang['contract'];
    ?>
: <font class="important">*</font></label>
				<select class="form-control" id="select-cont" name="contract_name" style="width: 336px;">
					<option></option>
					<?php 
    $res_client = hesk_dbQuery('SELECT contract_id FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . 'clients` WHERE id=' . $_SESSION["id"]["id"]);
    $i = 1;
    while ($row_client = mysqli_fetch_array($res_client)) {
        $result_contract = hesk_dbQuery('SELECT 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>
				<?php 
    /*var_dump($res_cont);*/
    ?>
			</div>
			
			
			<!-- Department and priority -->
			<?php 
    $is_table = 0;
    // Get categories
    $res = hesk_dbQuery("SELECT `categ_impro_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;
    ?>
				<div class="form-group department-priority-support-request"> <!-- start table here end in line 304 -->
					<div class="form-inline" style="margin-bottom: 5px;">
						<label class="col-sm-2 control-label" for="category-department-priority-support-request"><?php 
    echo $hesklang['category'];
    ?>
: <font class="important">*</font></label>
						<select class="form-control contact-support-request" id="category-department-priority-support-request" 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['categ_impro_id'] . '"' . ($_SESSION['c_category'] == $row['categ_impro_id'] ? ' selected="selected"' : '') . '>' . $row['name'] . '</option>';
    }
    ?>
						</select>
					</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-inline" style="margin-bottom: 5px;">
						<label class="col-sm-2 control-label" for="priority-department-priority-support-request"><?php 
        echo $hesklang['priority'];
        ?>
: <font class="important">*</font></label>
						<select class="form-control contact-support-request" id="priority-department-priority-support-request" 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>
					<?php 
    }
    /* Need to close the table? */
    if ($is_table) {
        echo '</div> <br/><br/>';
    }
    ?>
			<!-- 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="form-group">
				<div  class="form-inline" style="padding-right: 0px; margin-bottom: 5px;">
					<label class="col-sm-2 control-label" for="subject-ticket-info-support-request"><?php 
    echo $hesklang['subject'];
    ?>
: <font class="important">*</font></label>
					<input class="form-control contact-support-request" 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 class="form-inline" style="margin-bottom: 5px;">
					<div>
						<label class="col-sm-2 control-label" for="message-ticket-info-support-request" ><?php 
    echo $hesklang['message'];
    ?>
: <font class="important">*</font></label>
						<textarea class="form-control contact-support-request" 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><!-- 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="form-group">
				<div class="form-inline">
					<label class="col-sm-2 control-label" style="vertical-align: top;"><?php 
        echo $hesklang['attachments'];
        ?>
:</label>
					<div class="form-group 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-inline">
						<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 />&nbsp;

					</div>
					<?php 
        }
        if ($hesk_settings['secimg_use']) {
            ?>
					<div class="form-inline">
						<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 />&nbsp;<br /><img src="print_sec_img.php?' . rand(10000, 99999) . '" width="150" height="40" alt="' . $hesklang['sec_img'] . '" title="' . $hesklang['sec_img'] . '" border="1" name="secimg" style="vertical-align:text-bottom" /> ' . '<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 />&nbsp;<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 
    } else {
        ?>

		</div>
		&nbsp;
	</div>

				
				<div class="else-submit-notice-support-request">
					<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><!-- 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 -->			
<?php 
    hesk_cleanSessionVars('iserror');
    hesk_cleanSessionVars('isnotice');
}