if ($stype == "p") {
$result = dbquery(
"SELECT ta.*,tac.* FROM ".$db_prefix."articles2 ta
INNER JOIN ".$db_prefix."article_cats2 tac ON ta.article_cat=tac.article_cat_id
WHERE ".groupaccess('article_cat_access')." AND (article_subject LIKE '%$stext%' || article_article LIKE '%$stext%')"
);
$rows = dbrows($result);
if ($rows != 0) {
echo $rows." ".($rows == 1 ? $locale['410'] : $locale['411']).$locale['422'].":
\n";
$result = dbquery(
"SELECT ta.*,tac.*, tu.user_id,user_name FROM ".$db_prefix."articles2 ta
INNER JOIN ".$db_prefix."article_cats2 tac ON ta.article_cat=tac.article_cat_id
LEFT JOIN ".$db_prefix."users tu ON ta.article_name=tu.user_id
WHERE ".groupaccess('article_cat_access')." AND (article_subject LIKE '%$stext%' || article_article LIKE '%$stext%')
ORDER BY article_datestamp DESC LIMIT $rowstart,10"
);
while ($data = dbarray($result)) {
if (eregi($stext, $data['article_subject']) && eregi($stext, $data['article_article'])) {
$subj_c = substr_count(strtolower($data['article_subject']), strtolower($stext));
$text_c = substr_count(strtolower($data['article_article']), strtolower($stext));
echo "".$data['article_subject']."
\n";
echo "".$locale['040']."".$data['user_name']."\n";
echo $locale['041'].showdate("longdate", $data['article_datestamp'])."
\n";
echo "".$subj_c." ".($subj_c == 1 ? "Match" : "Matches").$locale['432'].$locale['433'].", ";
echo $text_c." ".($text_c == 1 ? "Match" : "Matches").$locale['432'].$locale['434']."
";
} elseif (eregi($stext, $data['article_article'])) {
$text_c = substr_count(strtolower($data['article_article']), strtolower($stext));
echo "".$data['article_subject']."
\n";
echo "".$locale['040']."".$data['user_name']."\n";
echo $locale['041'].showdate("longdate", $data['article_datestamp'])."
\n";
echo "".$text_c." ".($text_c == 1 ? "Match" : "Matches").$locale['432'].$locale['434']."
";
} elseif (eregi($stext, $data['article_subject'])) {
$subj_c = substr_count(strtolower($data['article_subject']), strtolower($stext));
echo "".$data['article_subject']."
\n";
echo "".$locale['040']."".$data['user_name']."\n";
echo $locale['041'].showdate("longdate", $data['article_datestamp'])."
\n";
echo "".$subj_c." ".($subj_c == 1 ? "Match" : "Matches").$locale['432'].$locale['433']."
";
}