$fieldsvar = "";
         }
     }
 }
 if ($fieldsvar) {
     $result = dbquery("SELECT tp.forum_id, tp.thread_id, tp.post_id, tp.post_message, tt.thread_subject,\r\n\t\t\ttf.forum_access FROM " . DB_POSTS . " tp\r\n\t\t\tLEFT JOIN " . DB_FORUMS . " tf ON tf.forum_id = tp.forum_id\r\n\t\t\tLEFT JOIN " . DB_THREADS . " tt ON tt.thread_id = tp.thread_id\t\t\t\r\n\t\t\tWHERE " . groupaccess('forum_access') . ($_GET['forum_id'] != 0 ? " AND tf.forum_id=" . $_GET['forum_id'] : "") . "\r\n\t\t\tAND " . $fieldsvar . ($_GET['datelimit'] != 0 ? " AND post_datestamp>=" . (time() - $_GET['datelimit']) : ""));
     $rows = dbrows($result);
 } else {
     $rows = 0;
 }
 if ($rows) {
     $items_count .= THEME_BULLET . "&nbsp;<a href='" . FUSION_SELF . "?stype=forums&amp;stext=" . $_GET['stext'] . "&amp;" . $composevars . "'>" . $rows . " " . ($rows == 1 ? $locale['f402'] : $locale['f403']) . " " . $locale['522'] . "</a><br  />\n";
     $result = dbquery("SELECT tp.forum_id, tp.thread_id, tp.post_id, tp.post_message, tp.post_datestamp, tt.thread_subject,\r\n\t\t\ttt.thread_sticky, tf.forum_access, tu.user_id, tu.user_name, tu.user_status FROM " . DB_POSTS . " tp\r\n\t\t\tLEFT JOIN " . DB_THREADS . " tt ON tp.thread_id = tt.thread_id\r\n\t\t\tLEFT JOIN " . DB_FORUMS . " tf ON tp.forum_id = tf.forum_id\r\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON tp.post_author=tu.user_id\r\n\t\t\tWHERE " . groupaccess('forum_access') . ($_GET['forum_id'] != 0 ? " AND tf.forum_id=" . $_GET['forum_id'] : "") . "\r\n\t\t\tAND " . $fieldsvar . ($_GET['datelimit'] != 0 ? " AND post_datestamp>=" . (time() - $_GET['datelimit']) : "") . "\r\n\t\t\tORDER BY " . $sortby . " " . ($_GET['order'] == 1 ? "ASC" : "DESC") . ($_GET['stype'] != "all" ? " LIMIT " . $_GET['rowstart'] . ",10" : ""));
     while ($data = dbarray($result)) {
         $search_result = "";
         $text_all = search_striphtmlbbcodes(iADMIN ? $data['post_message'] : preg_replace("#\\[hide\\](.*)\\[/hide\\]#si", "", $data['post_message']));
         $text_frag = search_textfrag($text_all);
         $subj_c = search_stringscount($data['thread_subject']);
         $text_c = search_stringscount($data['post_message']);
         // $text_frag = highlight_words($swords, $text_frag);
         $search_result .= ($data['thread_sticky'] == 1 ? "<strong>" . $locale['f404'] . "</strong> " : "") . "<a href='" . FORUM . "viewthread.php?thread_id=" . $data['thread_id'] . "&amp;highlight=" . urlencode($_GET['stext']) . "&amp;pid=" . $data['post_id'] . "#post_" . $data['post_id'] . "'>" . $data['thread_subject'] . "</a>" . "<br  /><br  />\n";
         // $search_result .= ($data['thread_sticky'] == 1 ? "<strong>".$locale['f404']."</strong> " : "")."<a href='".FORUM."viewthread.php?thread_id=".$data['thread_id']."&amp;highlight=".urlencode($_GET['stext'])."&amp;pid=".$data['post_id']."#post_".$data['post_id']."'>".highlight_words($swords, $data['thread_subject'])."</a>"."<br  /><br  />\n";
         $search_result .= "<div class='quote' style='width:auto;height:auto;overflow:auto'>" . $text_frag . "</div><br  />";
         $search_result .= "<span class='small2'>" . $locale['global_070'] . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "\n";
         $search_result .= $locale['global_071'] . showdate("longdate", $data['post_datestamp']) . "</span><br  />\n";
         $search_result .= "<span class='small'>" . $subj_c . " " . ($subj_c == 1 ? $locale['520'] : $locale['521']) . " " . $locale['f406'] . " " . $locale['f407'] . ", ";
         $search_result .= $text_c . " " . ($text_c == 1 ? $locale['520'] : $locale['521']) . " " . $locale['f406'] . " " . $locale['f408'] . "</span><br  /><br  />\n";
         search_globalarray($search_result);
     }
 } else {
     $items_count .= THEME_BULLET . "&nbsp;0 " . $locale['f403'] . " " . $locale['522'] . "<br  />\n";
             $fieldsvar = "";
         }
     }
 }
 if ($fieldsvar) {
     $result = dbquery("SELECT ta.*,tac.* FROM " . DB_ARTICLES . " ta\r\n\t\t\tINNER JOIN " . DB_ARTICLE_CATS . " tac ON ta.article_cat=tac.article_cat_id\r\n\t\t\tWHERE " . groupaccess('article_cat_access') . " AND " . $fieldsvar . "\r\n\t\t\t" . ($_GET['datelimit'] != 0 ? " AND article_datestamp>=" . (time() - $_GET['datelimit']) : ""));
     $rows = dbrows($result);
 } else {
     $rows = 0;
 }
 if ($rows != 0) {
     $items_count .= THEME_BULLET . "&nbsp;<a href='" . FUSION_SELF . "?stype=articles&amp;stext=" . $_GET['stext'] . "&amp;" . $composevars . "'>" . $rows . " " . ($rows == 1 ? $locale['a401'] : $locale['a402']) . " " . $locale['522'] . "</a><br />\n";
     $result = dbquery("SELECT ta.*,tac.*, tu.user_id, tu.user_name, tu.user_status FROM " . DB_ARTICLES . " ta\r\n\t\t\tINNER JOIN " . DB_ARTICLE_CATS . " tac ON ta.article_cat=tac.article_cat_id\r\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON ta.article_name=tu.user_id\r\n\t\t\tWHERE " . groupaccess('article_cat_access') . " AND " . $fieldsvar . "\r\n\t\t\t" . ($_GET['datelimit'] != 0 ? " AND article_datestamp>=" . (time() - $_GET['datelimit']) : "") . "\r\n\t\t\tORDER BY " . $sortby . " " . ($_GET['order'] != 1 ? "ASC" : "DESC") . ($_GET['stype'] != "all" ? " LIMIT " . $_GET['rowstart'] . ",10" : ""));
     while ($data = dbarray($result)) {
         $search_result = "";
         $text_all = search_striphtmlbbcodes($data['article_snippet'] . " " . $data['article_article']);
         $text_frag = search_textfrag($text_all);
         $subj_c = search_stringscount($data['article_subject']);
         $text_c = search_stringscount($data['article_snippet'] . " " . $data['article_article']);
         $text_frag = highlight_words($swords, $text_frag);
         $search_result .= "<a href='articles.php?article_id=" . $data['article_id'] . "'>" . highlight_words($swords, $data['article_subject']) . "</a>" . "<br /><br />\n";
         $search_result .= "<div class='quote' style='width:auto;height:auto;overflow:auto'>" . $text_frag . "</div><br />";
         $search_result .= "<span class='small2'>" . $locale['global_070'] . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "\n";
         $search_result .= $locale['global_071'] . showdate("longdate", $data['article_datestamp']) . "</span><br />\n";
         $search_result .= "<span class='small'>" . $subj_c . " " . ($subj_c == 1 ? $locale['520'] : $locale['521']) . " " . $locale['522'] . " " . $locale['a404'] . ", ";
         $search_result .= $text_c . " " . ($text_c == 1 ? $locale['520'] : $locale['521']) . " " . $locale['522'] . " " . $locale['a405'] . "</span><br /><br />\n";
         search_globalarray($search_result);
     }
 } else {
     $items_count .= THEME_BULLET . "&nbsp;0 " . $locale['a402'] . " " . $locale['522'] . "<br />\n";
 }
             $fieldsvar = "";
         }
     }
 }
 if ($fieldsvar) {
     $rows = dbcount("(news_id)", DB_NEWS, groupaccess('news_visibility') . " AND " . $fieldsvar . " AND (news_start='0'||news_start<=" . time() . ") AND (news_end='0'||news_end>=" . time() . ") " . ($_GET['datelimit'] != 0 ? " AND news_datestamp>=" . (time() - $_GET['datelimit']) : ""));
 } else {
     $rows = 0;
 }
 if ($rows != 0) {
     $items_count .= THEME_BULLET . "&nbsp;<a href='" . FUSION_SELF . "?stype=news&amp;stext=" . $_GET['stext'] . "&amp;" . $composevars . "'>" . $rows . " " . ($rows == 1 ? $locale['n401'] : $locale['n402']) . " " . $locale['522'] . "</a><br />\n";
     $result = dbquery("SELECT tn.*, tu.user_id, tu.user_name, tu.user_status FROM " . DB_NEWS . " tn\r\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON tn.news_name=tu.user_id\r\n\t\t\tWHERE " . groupaccess('news_visibility') . " AND (news_start='0'||news_start<=" . time() . ")\r\n\t\t\tAND (news_end='0'||news_end>=" . time() . ") AND " . $fieldsvar . "\r\n\t\t\t" . ($_GET['datelimit'] != 0 ? " AND news_datestamp>=" . (time() - $_GET['datelimit']) : "") . "\r\n\t\t\tORDER BY " . $sortby . " " . ($_GET['order'] == 1 ? "ASC" : "DESC") . ($_GET['stype'] != "all" ? " LIMIT " . $_GET['rowstart'] . ",10" : ""));
     while ($data = dbarray($result)) {
         $search_result = "";
         $text_all = $data['news_news'] . " " . $data['news_extended'];
         $text_all = search_striphtmlbbcodes($text_all);
         $text_frag = search_textfrag($text_all);
         // $text_frag = highlight_words($swords, $text_frag);
         $subj_c = search_stringscount($data['news_subject']);
         $text_c = search_stringscount($data['news_news']);
         $text_c2 = search_stringscount($data['news_extended']);
         $search_result .= "<a href='news.php?readmore=" . $data['news_id'] . "'>" . $data['news_subject'] . "</a>" . "<br /><br />\n";
         // $search_result .= "<a href='news.php?readmore=".$data['news_id']."'>".highlight_words($swords, $data['news_subject'])."</a>"."<br /><br />\n";
         $search_result .= "<div class='quote' style='width:auto;height:auto;overflow:auto'>" . $text_frag . "</div><br />";
         $search_result .= "<span class='small2'>" . $locale['global_070'] . profile_link($data['user_id'], $data['user_name'], $data['user_status']) . "\n";
         $search_result .= $locale['global_071'] . showdate("longdate", $data['news_datestamp']) . "</span><br />\n";
         $search_result .= "<span class='small'>" . $subj_c . " " . ($subj_c == 1 ? $locale['520'] : $locale['521']) . " " . $locale['n403'] . " " . $locale['n404'] . ", ";
         $search_result .= $text_c . " " . ($text_c == 1 ? $locale['520'] : $locale['521']) . " " . $locale['n403'] . " " . $locale['n405'] . ", ";
         $search_result .= $text_c2 . " " . ($text_c2 == 1 ? $locale['520'] : $locale['521']) . " " . $locale['n403'] . " " . $locale['n406'] . "</span><br /><br />\n";
         search_globalarray($search_result);
     }
             $fieldsvar = "";
         }
     }
 }
 if ($fieldsvar) {
     $result = dbquery("SELECT tp.forum_id, tp.thread_id, tp.post_id, tp.post_message, tt.thread_subject,\n\t\t\ttf.forum_access FROM " . DB_POSTS . " tp\n\t\t\tLEFT JOIN " . DB_FORUMS . " tf ON tf.forum_id = tp.forum_id\n\t\t\tLEFT JOIN " . DB_THREADS . " tt ON tt.thread_id = tp.thread_id\t\t\t\n\t\t\tWHERE " . groupaccess('forum_access') . ($_GET['forum_id'] != 0 ? " AND tf.forum_id=" . $_GET['forum_id'] : "") . "\n\t\t\tAND " . $fieldsvar . ($_GET['datelimit'] != 0 ? " AND post_datestamp>=" . (time() - $_GET['datelimit']) : ""));
     $rows = dbrows($result);
 } else {
     $rows = 0;
 }
 if ($rows) {
     $items_count .= THEME_BULLET . "&nbsp;<a href='" . FUSION_SELF . "?stype=forums&amp;stext=" . $_GET['stext'] . "&amp;" . $composevars . "'>" . $rows . " " . ($rows == 1 ? $locale['f402'] : $locale['f403']) . " " . $locale['522'] . "</a><br  />\n";
     $result = dbquery("SELECT tp.forum_id, tp.thread_id, tp.post_id, tp.post_message, tp.post_datestamp, tp.post_alias, tt.thread_subject,\n\t\t\ttt.thread_sticky, tf.forum_access, tu.user_id, tu.user_name, tu.user_status, tu.user_aliases FROM " . DB_POSTS . " tp\n\t\t\tLEFT JOIN " . DB_THREADS . " tt ON tp.thread_id = tt.thread_id\n\t\t\tLEFT JOIN " . DB_FORUMS . " tf ON tp.forum_id = tf.forum_id\n\t\t\tLEFT JOIN " . DB_USERS . " tu ON tp.post_author=tu.user_id\n\t\t\tWHERE " . groupaccess('forum_access') . ($_GET['forum_id'] != 0 ? " AND tf.forum_id=" . $_GET['forum_id'] : "") . "\n\t\t\tAND " . $fieldsvar . ($_GET['datelimit'] != 0 ? " AND post_datestamp>=" . (time() - $_GET['datelimit']) : "") . "\n\t\t\tORDER BY " . $sortby . " " . ($_GET['order'] == 1 ? "ASC" : "DESC") . ($_GET['stype'] != "all" ? " LIMIT " . $_GET['rowstart'] . ",10" : ""));
     while ($data = dbarray($result)) {
         $search_result = "";
         $text_all = search_striphtmlbbcodes($data['post_message']);
         $text_frag = search_textfrag($text_all);
         $subj_c = search_stringscount($data['thread_subject']);
         $text_c = search_stringscount($data['post_message']);
         // $text_frag = highlight_words($swords, $text_frag);
         $search_result .= ($data['thread_sticky'] == 1 ? "<strong>" . $locale['f404'] . "</strong> " : "") . "<a href='" . FORUM . "viewthread.php?thread_id=" . $data['thread_id'] . "&amp;highlight=" . urlencode($_GET['stext']) . "&amp;pid=" . $data['post_id'] . "#post_" . $data['post_id'] . "'>" . $data['thread_subject'] . "</a>" . "<br  /><br  />\n";
         // $search_result .= ($data['thread_sticky'] == 1 ? "<strong>".$locale['f404']."</strong> " : "")."<a href='".FORUM."viewthread.php?thread_id=".$data['thread_id']."&amp;highlight=".urlencode($_GET['stext'])."&amp;pid=".$data['post_id']."#post_".$data['post_id']."'>".highlight_words($swords, $data['thread_subject'])."</a>"."<br  /><br  />\n";
         $search_result .= "<div class='quote' style='width:auto;height:auto;overflow:auto'>" . $text_frag . "</div><br  />";
         $search_result .= "<span class='small2'>" . $locale['global_070'] . alias2($data['post_alias'], alias1($data['user_aliases']), $data['user_id'], $data['user_name'], $data['user_status']) . "\n";
         $search_result .= $locale['global_071'] . showdate("longdate", $data['post_datestamp']) . "</span><br  />\n";
         $search_result .= "<span class='small'>" . $subj_c . " " . ($subj_c == 1 ? $locale['520'] : $locale['521']) . " " . $locale['f406'] . " " . $locale['f407'] . ", ";
         $search_result .= $text_c . " " . ($text_c == 1 ? $locale['520'] : $locale['521']) . " " . $locale['f406'] . " " . $locale['f408'] . "</span><br  /><br  />\n";
         search_globalarray($search_result);
     }
 } else {
     $items_count .= THEME_BULLET . "&nbsp;0 " . $locale['f403'] . " " . $locale['522'] . "<br  />\n";