getDatabaseHandler(); // First search thread titles, if we get a hit there it's almost bound to be relevant $thread_ids = $dbhandler->searchThreadTitles($search_list, $forum, $user, $min_timestamp, round($limit/7), $search_sort); // Display the threads while we search for posts //STUB todo if ($thread_ids){ echo "

Perform another search

"; echo "

Threads found matching your search query:

"; start_forum_table(array(tr(FORUM_TOPIC), tr(FORUM_THREADS), tr(FORUM_POSTS), tr(FORUM_AUTHOR), tr(FORUM_VIEWS), "".tr(FORUM_LAST_POST)."")); foreach ($thread_ids as $key => $thread_id){ $thread = new Thread($thread_id); if ($thread->isHidden()) continue; $thread_forum = $thread->getForum(); echo ' '.$thread_forum->getTitle().' '.$thread->getTitle().''; echo ' '.($thread->getPostCount()+1).'
'.re_user_links($thread->getOwner()).'
'.$thread->getViewCount().' '.time_diff_str($thread->getLastTimestamp(), time()).' '; } end_table(); echo "

"; } // Let's see if we can match anything in a post body as well: $post_ids = $dbhandler->searchPosts($search_list, $forum, $user, $min_timestamp, $limit, $search_sort); if ($post_ids){ echo "

Posts found matching your search query:

"; start_forum_table(array(tr(FORUM_TOPIC), tr(FORUM_THREADS), tr(FORUM_AUTHOR),"".tr(FORUM_LAST_POST)."")); if ($logged_in_user){ $options = $logged_in_user->getTextTransformSettings(); } else { $options = new output_options; } foreach ($post_ids as $key => $post_id){ $post = new Post($post_id); $thread = $post->getThread(); if ($thread->isHidden()) continue; if ($post->isHidden()) continue; $options->setHighlightTerms($search_list); $contents = output_transform($post->getContent(),$options); $thread_forum = $thread->getForum(); echo ' '.$thread_forum->getTitle().' '.$thread->getTitle().'
'.re_user_links($post->getOwner()).'
'.time_diff_str($post->getTimestamp(), time()).' '.substr($contents,0,200).'... [Read the rest of this post]   '; } end_table(); } if (!$thread_ids && !$post_ids){ echo "

Sorry, couldn't find anything matching your search query. You can try to broaden your search by using less words (or less specific words).

You can also try the same search on Google.

"; } echo "

Perform another search

"; page_tail(); exit; ?>