-
-
-
-
-
-
-
-
-
-
+
- ()
-
-
- '.$hesklang['nosr'].'';
- hesk_show_kb_category(1,1);
- }
- else
- {
-?>
-
-
-
-
-
- ';
- }
- else
- {
- $rat = '';
- }
-
- echo '
+
+
+
+
+ '.$hesklang['nosr'].'';
+ $show_default_category = true;
+ } else {
+ ?>
+
+ ' . mfh_get_stars($article['rating']) . '';
+ }
+ else
+ {
+ $rat = '';
+ }
+
+ echo '
@@ -207,18 +203,16 @@ function hesk_kb_search($query)
';
- }
- ?>
-
-
- |
-
-
-
-
+ }
+ ?>
+
+
+
+
+
+
'.$article['subject'].'
-
+?>
+
+
+
+
+
+ '.$hesklang['as'].'
- '. $article['content'];
+ // Get relevant articles from the database
+ $res = hesk_dbQuery("SELECT `id`, `subject`, MATCH(`subject`,`content`,`keywords`) AGAINST ('{$query}') AS `score` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `type` IN ('0','1') AND MATCH(`subject`,`content`,`keywords`) AGAINST ('{$query}') LIMIT ".intval($hesk_settings['kb_related']+1));
- if ( ! empty($article['attachments']))
- {
- echo ' '.$hesklang['attachments'].': ';
- $att=explode(',',substr($article['attachments'], 0, -1));
- foreach ($att as $myatt)
- {
- list($att_id, $att_name) = explode('#', $myatt);
- echo ' '.$att_name.' ';
- }
- echo ' ';
- }
+ // Array with related articles
+ $related_articles = array();
+ while ($related = hesk_dbFetchAssoc($res))
+ {
+ // Get base match score from the first (this) article
+ if ( ! isset($base_score) )
+ {
+ $base_score = $related['score'];
+ }
+ // Ignore this article
+ if ($related['id'] == $artid)
+ {
+ continue;
+ }
- if ($article['catid']==1)
- {
- $link = 'knowledgebase_private.php';
- }
- else
- {
- $link = 'knowledgebase_private.php?category='.$article['catid'];
- }
- ?>
-
-
-
-
-
-
-
-
- : |
- |
-
-
- : |
- |
-
-
- : |
- |
-
-
- : |
- |
-
-
-
-
-
-
-
+ // Stop when articles reach less than 10% of base score
+ if ($related['score'] / $base_score < 0.10)
+ {
+ break;
+ }
-
-
-
-
-
+
+
+
+
+
+
+ : |
+ |
+
+
+ : |
+ |
+
+
+ : |
+ |
+
+
+ : |
+ |
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+'.$hesklang['kb_cat'].': '.$thiscat['name'].'
- '.$hesklang['back'].'
- ';
- }
-
- $result = hesk_dbQuery("SELECT `id`,`name`,`articles`,`type` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_categories` WHERE `parent`='".intval($catid)."' ORDER BY `parent` ASC, `cat_order` ASC");
- if (hesk_dbNumRows($result) > 0)
- {
- ?>
-
-
-
-
-
-
-
-
-
-
+?>
+
+
+
+
+
+
+
';
- }
+ endif;
- $private = ($cat['type'] == 1) ? ' *' : '';
+ $result = hesk_dbQuery("SELECT `id`,`name`,`articles`,`type` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_categories` WHERE `parent`='".intval($catid)."' ORDER BY `parent` ASC, `cat_order` ASC");
- echo '
+ if (hesk_dbNumRows($result) > 0) {
+ ?>
+
+
+
+
+ ';
+ }
+
+ $private = ($cat['type'] == 1) ? ' *' : '';
+
+ echo '
'.$cat['name'].''.$private.' |
';
- /* Print most popular/sticky articles */
- if ($hesk_settings['kb_numshow'] && $cat['articles'])
- {
- $res = hesk_dbQuery("SELECT `id`,`subject`,`type` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `catid`='".intval($cat['id'])."' AND `type` IN ('0','1') ORDER BY `sticky` DESC, `views` DESC, `art_order` ASC LIMIT " . (intval($hesk_settings['kb_numshow']) + 1) );
- $num = 1;
- while ($art = hesk_dbFetchAssoc($res))
- {
- $private = ($art['type'] == 1) ? ' *' : '';
- echo '
+ /* Print most popular/sticky articles */
+ if ($hesk_settings['kb_numshow'] && $cat['articles'])
+ {
+ $res = hesk_dbQuery("SELECT `id`,`subject`,`type` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."kb_articles` WHERE `catid`='".intval($cat['id'])."' AND `type` IN ('0','1') ORDER BY `sticky` DESC, `views` DESC, `art_order` ASC LIMIT " . (intval($hesk_settings['kb_numshow']) + 1) );
+ $num = 1;
+ while ($art = hesk_dbFetchAssoc($res))
+ {
+ $private = ($art['type'] == 1) ? ' *' : '';
+ echo '
'.$art['subject'].''.$private.' |
';
- if ($num == $hesk_settings['kb_numshow'])
- {
- break;
- }
- else
- {
- $num++;
- }
- }
- if (hesk_dbNumRows($res) > $hesk_settings['kb_numshow'])
- {
- echo '» '.$hesklang['m'].' | ';
- }
- }
-
- echo '
+ if ($num == $hesk_settings['kb_numshow'])
+ {
+ break;
+ }
+ else
+ {
+ $num++;
+ }
+ }
+ if (hesk_dbNumRows($res) > $hesk_settings['kb_numshow'])
+ {
+ echo '» '.$hesklang['m'].' | ';
+ }
+ }
+
+ echo '
|
';
- if ($i == $per_col)
- {
- echo '';
- $i = 0;
- }
- $i++;
- }
- /* Finish the table if needed */
- if ($i != 1)
- {
- for ($j=1;$j<=$per_col;$j++)
- {
- echo ' | ';
- if ($i == $per_col)
- {
- echo '';
- break;
- }
- $i++;
- }
- }
-
- ?>
-
-
-
-
-
-
- 0
- ?>
-
-
-
-
-
-
-
-
- '.$hesklang['noac'].'';
- }
- else
- {
- echo '';
- while ($article = hesk_dbFetchAssoc($res))
- {
- $private = ($article['type'] == 1) ? ' *' : '';
+ if ($i == $per_col)
+ {
+ echo '';
+ $i = 0;
+ }
+ $i++;
+ }
+ /* Finish the table if needed */
+ if ($i != 1)
+ {
+ for ($j=1;$j<=$per_col;$j++)
+ {
+ echo ' | ';
+ if ($i == $per_col)
+ {
+ echo '';
+ break;
+ }
+ $i++;
+ }
+ }
+
+ ?>
+
+
+
+
+
+
+
+
+ '.$hesklang['noac'].'';
+ }
+ else
+ {
+ echo ' ';
+ while ($article = hesk_dbFetchAssoc($res))
+ {
+ $private = ($article['type'] == 1) ? ' *' : '';
- $txt = hesk_kbArticleContentPreview($article['content']);
+ $txt = hesk_kbArticleContentPreview($article['content']);
- echo '
+ echo '
@@ -528,14 +556,16 @@ function hesk_show_kb_category($catid, $is_search = 0) {
|
';
- }
- echo ' ';
- }
- ?>
-
- |
-
-
+ }
+ echo ' | ';
+ }
+ ?>
+
+
+
+
-
-
-
-
-
- ' . $hesk_settings['mailtmp']['inbox'] . '
- - ' . $hesk_settings['mailtmp']['outbox'] . '
- - ' . $hesk_settings['mailtmp']['new'] . '
';
- ?>
-
+
+
-
-
-
-
-
-
+
+
+
- /* Show new message form */
- show_new_form();
+
+ /* Clean unneeded session variables */
+ hesk_cleanSessionVars('hide');
+ hesk_cleanSessionVars('mail');
+ ?>
+
-
+
'.$admins[$pm[$hesk_settings['mailtmp']['other']]].'' : (($pm['from'] == 9999) ? ' HESK.com' : $hesklang['e_udel']);
-
- echo $pm['dt'];
$pm['dt'] = hesk_dateToString($pm['dt'],0,1,0,true);
?>
-
-
-
-
-
-
-
-
-
-
- |
- |
-
-
- |
- |
-
-
- |
- |
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
- ';
- $folder = '';
- }
- echo '';
- ?>
-
- |
-
-
-
-
-
- |
-
-
-
-
-
+
+
+
+
| |
|
- |
+ |
@@ -620,78 +646,89 @@ function show_new_form()
{
global $hesk_settings, $hesklang, $admins;
?>
-
+
| |