getForumSortStyle();
} else {
if (isset($_COOKIE['sorting'])) {
list($sort_style,$thread_style)=explode("|",$_COOKIE['sorting']);
}
}
} else {
// set the sort style
if ($user){
$user->setForumSortStyle($sort_style);
} else {
list($old_style,$thread_style)=explode("|",$_COOKIE['sorting']);
setcookie('sorting', implode("|",array($sort_style,$thread_style)), time()+3600*24*365);
}
}
$Category = $forum->getCategory();
if ($Category->getType()!=0){
page_head(tra("Questions and Answers").' : '.$forum->getTitle());
} else {
page_head(tra("Message boards").' : '.$forum->getTitle());
}
// Allow users with a linktab-browser to get some usefull links
echo '';
show_forum_title($forum, NULL);
echo '
';
show_button("forum_post.php?id=$id", "New thread", "Add a new thread to this forum");
if ($user) {
$return = urlencode(current_url());
$tokens = url_tokens($user->dbObj->authenticator);
$url = "forum_index.php?read=1&$tokens&return=$return";
show_button($url, "Mark all threads as read", "Mark all threads in this forum as 'read'.");
}
echo "
";
echo '
\n
\n";
show_forum($forum, $start, $sort_style, $user);
page_tail();
/**
* This function shows the threadlist for the given forum
* Starting from $start,
* using the given $sort_style (as defined in forum.php)
* and using the features for the logged in user in $user.
**/
function show_forum($forum, $start, $sort_style, $user) {
$gotoStr = "
".show_page_nav($forum,$start)."
";
echo $gotoStr; // Display the navbar
start_forum_table(array("", tra("Threads"), tra("Posts"), tra("Author"), tra("Views"), "".tra("Last post").""));
$sticky_first = !$user || !$user->hasIgnoreStickyPosts();
// Show hidden threads if logged in user is a moderator
$show_hidden = $user && $user->isSpecialUser(S_MODERATOR);
$threads = $forum->getThreads($start, THREADS_PER_PAGE, $sort_style, $show_hidden, $sticky_first);
// Run through the list of threads, displaying each of them
$n = 0; $i=0;
foreach ($threads as $key => $thread) {
$owner = $thread->getOwner();
$timestamp = $thread->getLastTimestamp();
$unread = $user && ($timestamp>$thread->getLastReadTimestamp($user)) && ($timestamp > $user->getReadTimestamp());
if ($thread->getStatus()==1){
// This is an answered helpdesk thread
echo '
';
} else {
// Just a standard thread.
echo '
';
}
echo "
";
if ($user && ($thread->getRating()>$user->getHighRatingThreshold())) {
show_image(EMPHASIZE_IMAGE, "This message has a high average rating");
}
if ($user && ($thread->getRating()<$user->getLowRatingThreshold())) {
show_image(FILTER_IMAGE, "This message has a low average rating");
}
if ($thread->isHidden()) {
echo "X";
}
if ($unread) {
if ($thread->isSticky()) {
if ($thread->isLocked()) {
show_image(NEW_IMAGE_STICKY_LOCKED, "This thread is sticky and locked, and you haven't read it yet");
} else {
show_image(NEW_IMAGE_STICKY, "This thread is sticky and you haven't read it yet");
}
} else {
if ($thread->isLocked()) {
show_image(NEW_IMAGE_LOCKED, "You haven't read this thread yet, and it's locked");
} else {
show_image(NEW_IMAGE, "You haven't read this thread yet");
}
}
} else {
if ($thread->isSticky()) {
if ($thread->isLocked()) {
show_image(IMAGE_STICKY_LOCKED, "This thread is sticky and locked");
} else {
show_image(IMAGE_STICKY, "This thread is sticky");
}
} else {
if ($thread->isLocked()) {
show_image(IMAGE_LOCKED, "This thread is locked");
}
}
}
echo "