forum);
$category = getCategory($forum->category);
$first_post = getFirstPost($thread->id);
$title = stripslashes($thread->title);
$where = $category->is_helpdesk?"Questions and answers":"Message boards";
$top_url = $category->is_helpdesk?"help_desk.php":"index.php";
$excerpt = sub_sentence(stripslashes($first_post->content), ' ', EXCERPT_LENGTH, true);
$posted = time_diff_str($thread->create_time, time());
$last = time_diff_str($thread->timestamp, time());
$m = $n%2;
echo "
$n) Posted $posted
Last response $last
|
$where : $category->name :
id>$forum->title :
id>$title
$excerpt
|
";
}
function show_post2($post, $n) {
$thread = getThread($post->thread);
$forum = getForum($thread->forum);
$category = getCategory($forum->category);
$where = $category->is_helpdesk?"Questions and answers":"Message boards";
$top_url = $category->is_helpdesk?"help_desk.php":"index.php";
$content = nl2br(stripslashes($post->content));
$when = time_diff_str($post->timestamp, time());
$user = lookup_user_id($post->user);
$title = stripslashes($thread->title);
$m = $n%2;
echo "
$n) $where : $category->name :
id>$forum->title :
id>$title
Posted $when by $user->name
$content
|
";
}
if ($_GET['titles']) {
echo "Titles containing '$search_string'
\n";
$q = "select * from thread where match(title) against ('$search_string') limit $offset,$count";
$result = mysql_query($q);
echo "";
$n = 0;
while ($thread = mysql_fetch_object($result)) {
show_thread($thread, $n+$offset+1);
$n += 1;
}
echo "
";
mysql_free_result($result);
if ($offset==0 && $n==0) {
echo "No titles found containing '$search_string'";
}
}
if ($_GET['bodies']) {
echo "Messages containing '$search_string'
\n";
$q = "select * from post where match(content) against ('$search_string') limit $offset,$count";
$result = mysql_query($q);
echo "";
$n = 0;
while ($post = mysql_fetch_object($result)) {
show_post2($post, $n+$offset+1);
$n += 1;
}
echo "
";
mysql_free_result($result);
if ($offset==0 && $n==0) {
echo "No messages found containing '$search_string'";
}
}
if ($n==$count) {
$s = urlencode($search_string);
$offset += $count;
echo "
Next $count
";
}
page_tail();
?>