\n";
if (Search_Engine::get_param('stype') == "blog" || Search_Engine::get_param('stype') == "all") {
$sort_by = [
'datestamp' => "blog_datestamp",
'subject' => "blog_subject",
'author' => "blog_name",
];
$order_by = [
'0' => ' DESC',
'1' => ' ASC',
];
$sortby = !empty($_POST['sort']) ? "ORDER BY ".$sort_by[Search_Engine::get_param('sort')].$order_by[Search_Engine::get_param('order')] : "";
$limit = (Search_Engine::get_param('stype') != "all" ? " LIMIT ".Search_Engine::get_param('rowstart').",10" : '');
$date_search = (Search_Engine::get_param('datelimit') != 0 ? ' AND blog_datestamp >='.(TIME - Search_Engine::get_param('datelimit')) : '');
switch (Search_Engine::get_param('fields')) {
case 2:
Search_Engine::search_column('blog_subject', 'blog');
Search_Engine::search_column('blog_blog', 'blog');
Search_Engine::search_column('blog_extended', 'blog');
break;
case 1:
Search_Engine::search_column('blog_blog', 'blog');
Search_Engine::search_column('blog_extended', 'blog');
break;
case 0:
Search_Engine::search_column('blog_subject', 'blog');
break;
}
if (!empty(Search_Engine::get_param('search_param'))) {
$query = "SELECT blog_id FROM ".DB_BLOG."
".(multilang_table('BL') ? "WHERE ".in_group('blog_language', LANGUAGE)." AND " : "WHERE ").groupaccess('blog_visibility')."
AND ".Search_Engine::search_conditions('blog')." AND (blog_start='0'||blog_start<=NOW())".$date_search;
$result = dbquery($query, Search_Engine::get_param('search_param'));
$rows = dbrows($result);
} else {
$rows = 0;
}
if ($rows != 0) {
$item_count = "".$rows." ".($rows == 1 ? $locale['b401'] : $locale['b402'])." ".$locale['522']."
\n";
$query = "
SELECT tn.*, tu.user_id, tu.user_name, tu.user_status, tu.user_avatar, tu.user_joined, tu.user_level
FROM ".DB_BLOG." tn
LEFT JOIN ".DB_USERS." tu ON tn.blog_name=tu.user_id
".(multilang_table("BL") ? "WHERE ".in_group('tn.blog_language', LANGUAGE)." AND " : "WHERE ").groupaccess('blog_visibility')."
AND (blog_start='0'||blog_start<=NOW()) AND (blog_end='0'||blog_end>=NOW()) AND ".Search_Engine::search_conditions('blog')." ".$date_search.$sortby.$limit;
$result = dbquery($query, Search_Engine::get_param('search_param'));
$search_result = '';
while ($data = dbarray($result)) {
$text_all = $data['blog_blog']." ".$data['blog_extended'];
$text_all = Search_Engine::search_striphtmlbbcodes($text_all);
$text_frag = Search_Engine::search_textfrag($text_all);
$subj_c = Search_Engine::search_stringscount($data['blog_subject']);
$text_c = Search_Engine::search_stringscount($data['blog_blog']);
$text_c2 = Search_Engine::search_stringscount($data['blog_extended']);
$context = "