Example #1
0
function print_start()
{
    global $hesk_settings, $hesklang;
    if ($hesk_settings['kb_enable']) {
        require HESK_PATH . 'inc/knowledgebase_functions.inc.php';
    }
    // Connect to database
    hesk_load_database_functions();
    hesk_dbConnect();
    /* Print header */
    require_once HESK_PATH . 'inc/header.inc.php';
    ?>

<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($hesk_settings['hesk_title']);
    ?>
</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 $hesk_settings['hesk_title'];
    ?>
</span>
</td>

	<?php 
    // Print small search box
    if ($hesk_settings['kb_enable']) {
        hesk_kbSearchSmall();
    }
    ?>
    
</tr>
</table>

</td>
</tr>
<tr>
<td>

	<?php 
    // Print large search box
    if ($hesk_settings['kb_enable']) {
        hesk_kbSearchLarge();
    } else {
        echo '&nbsp;';
    }
    // 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);
    }
    ?>

<table border="0" width="50%" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="50%">
<!-- START SUBMIT -->
	<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 width="100%" border="0" cellspacing="0" cellpadding="0">
	    <tr>
	    	<td width="1"><img src="img/newticket.png" alt="" width="60" height="60" /></td>
	        <td>
	        <p><b><a href="index.php?a=add"><?php 
    echo $hesklang['sub_support'];
    ?>
</a></b><br />
            <?php 
    echo $hesklang['open_ticket'];
    ?>
</p>
	        </td>
	    </tr>
	    </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>
<!-- END SUBMIT -->
</td>
</tr>
<tr><td width="1"><img src="img/blank.gif" width="5" height="10" alt="" /></td></tr>
<tr>
<td width="50%">
<!-- START VIEW -->
	<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 width="100%" border="0" cellspacing="0" cellpadding="0">
	    <tr>
	    	<td width="1"><img src="img/existingticket.png" alt="" width="60" height="60" /></td>
	        <td>
	        <p><b><a href="ticket.php"><?php 
    echo $hesklang['view_existing'];
    ?>
</a></b><br />
            <?php 
    echo $hesklang['vet'];
    ?>
</p>
	        </td>
	    </tr>
	    </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>
<!-- END VIEW -->
</td>
</tr>
</table>

<?php 
    if ($hesk_settings['kb_enable']) {
        ?>
	<br />

	<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>

        <p><span class="homepageh3"><?php 
        echo $hesklang['kb_text'];
        ?>
</span></p>

        <?php 
        /* Get list of top articles */
        hesk_kbTopArticles($hesk_settings['kb_index_popart']);
        /* Get list of latest articles */
        hesk_kbLatestArticles($hesk_settings['kb_index_latest']);
        ?>

        <p>&raquo; <b><a href="knowledgebase.php"><?php 
        echo $hesklang['viewkb'];
        ?>
</a></b></p>

		</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>

    <br />
	<?php 
    } else {
        ?>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<?php 
    }
    // Show a link to admin panel?
    /*if ($hesk_settings['alink'])
    	{
    		?>
    		<p style="text-align:center"><a href="<?php echo $hesk_settings['admin_dir']; ?>/" class="smaller"><?php echo $hesklang['ap']; ?></a></p>
    		<?php
    	}*/
}
Example #2
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);
    }
}
Example #3
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();
}
Example #4
0
function print_start()
{
    global $hesk_settings, $hesklang;
    if ($hesk_settings['kb_enable']) {
        require HESK_PATH . 'inc/knowledgebase_functions.inc.php';
    }
    // Connect to database
    hesk_dbConnect();
    /* Print header */
    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 class="active"><?php 
    echo $hesk_settings['hesk_title'];
    ?>
</li>
</ol>
    <?php 
    // Service messages
    $res = hesk_dbQuery('SELECT `title`, `message`, `style`, `icon` FROM `' . hesk_dbEscape($hesk_settings['db_pfix']) . "service_messages` WHERE `type`='0' ORDER BY `order` ASC");
    if (hesk_dbNumRows($res) > 0) {
        ?>
    <div class="row">
        <div class="col-md-12">
            <?php 
        while ($sm = hesk_dbFetchAssoc($res)) {
            hesk_service_message($sm);
        }
        ?>
        </div>
    </div>
    <?php 
    }
    ?>
	<div class="row">
		<div class="col-md-4">
            <div class="panel panel-default">
                <div class="panel-heading"><?php 
    echo $hesklang['view_ticket'];
    ?>
</div>
                <div class="panel-body">
                    <form role="form" class="viewTicketSidebar" action="ticket.php" method="get" name="form2">
                        <div class="form-group">
                            <br/>
                            <label for="ticketID"><?php 
    echo $hesklang['ticket_trackID'];
    ?>
:</label>
                            <input type="text" class="form-control" name="track" id="ticketID" maxlength="20" size="35" value="" placeholder="<?php 
    echo htmlspecialchars($hesklang['ticket_trackID']);
    ?>
">
                        </div>
                        <?php 
    $tmp = '';
    if ($hesk_settings['email_view_ticket']) {
        $tmp = 'document.form1.email.value=document.form2.e.value;';
        ?>
                        <div class="form-group">
                            <label for="emailAddress"><?php 
        echo $hesklang['email'];
        ?>
:</label>
                            <?php 
        $my_email = '';
        $do_remember = '';
        if (isset($_COOKIE['hesk_myemail'])) {
            $my_email = $_COOKIE['hesk_myemail'];
            $do_remember = 'checked';
        }
        ?>
                            <input type="text" class="form-control" name="e" id="emailAddress" size="35" value="<?php 
        echo $my_email;
        ?>
" placeholder="<?php 
        echo htmlspecialchars($hesklang['email']);
        ?>
"/>
                        </div>
                        <div class="checkbox">
                            <label for="r">
                                <input type="checkbox" name="r" value="Y" <?php 
        echo $do_remember;
        ?>
> <?php 
        echo $hesklang['rem_email'];
        ?>
                            </label>
                        </div>
                        <?php 
    }
    ?>
                        <input type="submit" value="<?php 
    echo $hesklang['view_ticket'];
    ?>
" class="btn btn-default" /><input type="hidden" name="Refresh" value="<?php 
    echo rand(10000, 99999);
    ?>
"><input type="hidden" name="f" value="1">
                    </form>
                </div>
            </div>
		</div>
		<div class="col-md-8">
				<?php 
    // Print small search box
    if ($hesk_settings['kb_enable']) {
        hesk_kbSearchSmall();
        hesk_kbSearchLarge();
    } else {
        echo '&nbsp;';
    }
    ?>
            <div class="row default-row-margins">
                <div class="col-sm-6 col-xs-12">
                    <a href="index.php?a=add" class="button-link">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <div class="row">
                                    <div class="col-xs-1">
                                        <img src="img/newTicket.png" alt="<?php 
    echo $hesklang['sub_support'];
    ?>
">
                                    </div>
                                    <div class="col-xs-11">
                                        <b><?php 
    echo $hesklang['sub_support'];
    ?>
</b><br>
                                        <?php 
    echo $hesklang['open_ticket'];
    ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </a>
                </div>
                <div class="col-sm-6 col-xs-12">
                    <a href="ticket.php" class="button-link">
                        <div class="panel panel-default">
                            <div class="panel-body">
                                <div class="row">
                                    <div class="col-xs-1">
                                        <img src="img/viewTicket.png" alt="<?php 
    echo $hesklang['view_existing'];
    ?>
">
                                    </div>
                                    <div class="col-xs-11">
                                        <b><?php 
    echo $hesklang['view_existing'];
    ?>
</b><br>
                                        <?php 
    echo $hesklang['vet'];
    ?>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </a>
                </div>
            </div>
            <?php 
    if ($hesk_settings['kb_enable']) {
        ?>
                <div class="row default-row-margins">
                    <div class="col-sm-6 col-xs-12">
                        <a href="knowledgebase.php" class="button-link">
                            <div class="panel panel-default">
                                <div class="panel-body">
                                    <div class="row">
                                        <div class="col-xs-1">
                                            <img src="img/knowledgebase.png" alt="<?php 
        echo $hesklang['kb_text'];
        ?>
">
                                        </div>
                                        <div class="col-xs-11">
                                            <b><?php 
        echo $hesklang['kb_text'];
        ?>
</b><br>
                                            <?php 
        echo $hesklang['viewkb'];
        ?>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </a>
                    </div>
                </div>
            <?php 
        hesk_kbTopArticles($hesk_settings['kb_index_popart']);
        hesk_kbLatestArticles($hesk_settings['kb_index_latest']);
    }
    ?>
		</div>
	</div>
	<div class="blankSpace"></div>
	<div class="footerWithBorder"></div>
	<div class="blankSpace"></div>
</div>

<?php 
    // Show a link to admin panel?
    if ($hesk_settings['alink']) {
        ?>
		<p style="text-align:center"><a href="<?php 
        echo $hesk_settings['admin_dir'];
        ?>
/" ><?php 
        echo $hesklang['ap'];
        ?>
</a></p>
		<?php 
    }
}
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 
}
function print_start()
{
    global $hesk_settings, $hesklang;
    // Connect to database
    hesk_load_database_functions();
    hesk_dbConnect();
    /* Print header */
    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>
	</nav>
	
<?php 
    if (isset($_SESSION['loggedin']) && $_SESSION['loggedin']) {
        ?>
	<nav class="row navbar userMenu">
      <div class="container">
        <div class="collapse navbar-collapse">
          <ul class="nav navbar-nav">		  	
			<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>
<?php 
    }
    ?>
	

	<br/>
	<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;
			<?php 
    echo 'Help Desk';
    ?>
</span>
		</div>
	</div><!-- end siteUrl-title-indexPhp -->

<br/>
<br/>


<!--</td>
</tr>-->

<!--start in this page end somewhere....
<tr>
<td>-->

	<?php 
    // 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);
    }
    ?>

	
<!-- start session login -->	

<?php 
    if (isset($_SESSION['loggedin']) && $_SESSION['loggedin']) {
        ?>
	<div class="col-sm-12 form-group submit-view-existing-ticket">
		<div class="col-sm-4 col-sm-offset-2 conatiner submit-ticket-col">
				<!-- START SUBMIT -->
				<div class="submit-ticket" id="gradient">
					<a style="text-decoration: none" href="index.php?a=add">
						<div class="form-inline">
							&nbsp;
							<img src="img/newticket.jpg" alt="newticket"/>
							<div class="form-group">
								<span><b><?php 
        echo $hesklang['sub_support'];
        ?>
</b></span><br />
								<span id="op-ticket"><?php 
        echo $hesklang['open_ticket'];
        ?>
</span>
							</div>
							&nbsp;
						</div>
					</a>
				</div><!-- end submit-ticket -->
				<!-- END SUBMIT -->
		</div>
		
			<!--<div><img src="img/blank.gif" width="5" height="1" alt="" /></div>-->
			
		<div class="col-sm-4 view-ticket-col">
				<!-- START VIEW -->
				<div class="view-ticket">
				<a style="text-decoration: none" href="ticket.php">
					<div class="form-inline">
						&nbsp;
						<img src="img/existingticket.jpg" alt="existingticket"/></td>
						<div class="form-group">
							<span><b><?php 
        echo $hesklang['view_existing'];
        ?>
</b></span><br />
							<span id="vw-ticket"><?php 
        echo $hesklang['vet'];
        ?>
</span>
						</div>
						&nbsp;
					</div>
				</a>
				</div><!-- end view-ticket -->
				<!-- END VIEW -->
		</div>
	</div><!-- end submit-view-existing-ticket -->

<br/><br/>

 <div class="container knowledgebase-text">
	<div class="form-inline"><img src="img/knowledgebase.png" alt="knowledgebase"/><span><?php 
        echo $hesklang['kb_text'];
        ?>
</span></div>
	<?php 
        if ($hesk_settings['kb_enable']) {
            ?>
		<br />

		<div class="row kb-top-latest-view-art">
			<div>

				<div style="margin-top: 15px;">

					<?php 
            /* Get list of top articles */
            hesk_kbTopArticles($hesk_settings['kb_index_popart']);
            /* Get list of latest articles */
            hesk_kbLatestArticles($hesk_settings['kb_index_latest']);
            ?>

				</div>

			</div>
		</div><!-- end knowledgebase-text -->

</div>

	<?php 
        } else {
            ?>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<p>&nbsp;</p>
	<?php 
        }
        ?>
<!-- start form login-->	

<?php 
    } else {
        ?>
	<div class="container">
		<div class="container col-sm-5 user-login-help-staf">
			<div class="form-group user-login">
			<?php 
        $login_form = <<<EOD
\t\t\t\t<form class="container form-signin" method="post" action="login.php">
\t\t\t\t\t<div class="form-signin-heading">Login</div>
\t\t\t\t\t<div class="form-group">
\t\t\t\t\t\t<div class="form-inline signin-username">
\t\t\t\t\t\t\t<label for="inputUser">User:</label><br/>
\t\t\t\t\t\t\t<input name="user" type="text" id="inputUser" class="form-control" required autofocus style="width: 301px;">
\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div class="form-inline signin-password">
\t\t\t\t\t\t\t<label for="inputPassword">Password:</label><br/>
\t\t\t\t\t\t\t<input name="pass" type="password" id="inputPassword" class="form-control" required style="width: 301px;">
\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div class="checkbox signin-remember">
\t\t\t\t\t\t\t<label>
\t\t\t\t\t\t\t\t<input type="checkbox" value="remember-me" /> Remember me
\t\t\t\t\t\t\t</label>
\t\t\t\t\t\t</div>
\t\t\t\t\t\t<div>
\t\t\t\t\t\t\t<button class="btn btn-default login-user-btn" type="submit">Click here to login</button>
\t\t\t\t\t\t</div>
\t\t\t\t\t</div>
\t\t\t\t</form>
EOD;
        $msg = isset($_SESSION['message']) ? $_SESSION['message'] : null;
        //GET the message
        if ($msg != '') {
            echo '<div>' . $msg . '</div>';
            unset($_SESSION['message']);
            //If message is set echo it
        }
        echo $login_form;
        ?>
			</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 
    }
    ?>
	

<?php 
    /*	// Show a link to admin panel?
    	if ($hesk_settings['alink'])
    	{
    		?>
    		<p style="text-align:center"><a href="<?php echo $hesk_settings['admin_dir']; ?>/" class="smaller"><?php echo $hesklang['ap']; ?></a></p>
    		<?php
    	}
    */
    /*comment 5/6/2015*/
}