function theme_forum_topic_list($tid, $topics, $sortby, $forum_per_page) {
global $forum_topic_list_header;
/* jasper add */
global $user
if (empty($comments_per_page)) {
$comments_per_page = $user->comments_per_page ? $user->comments_per_page : ($_SESSION['comment_comments_per_page'] ? $_SESSION['comment_comments_per_page'] : variable_get('comment_default_per_page', '50'));
}
if (empty($order)) {
$order = $user->sort ? $user->sort : ($_SESSION['comment_sort'] ? $_SESSION['comment_sort'] : variable_get('comment_default_order', 1));
}
/* jasper end */
if ($topics) {
foreach ($topics as $topic) {
/* jasper add */
$numpages = $topic->num_comments/$comments_per_page;
$nim = floor($numpages);
$frompage = $nim * $comments_per_page;
/* jasper end */
// folder is new if topic is new or there are new comments since last visit
if ($topic->tid != $tid) {
$rows[] = array(
array('data' => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
array('data' => $topic->title, 'class' => 'title'),
array('data' => l(t('This topic has been moved'), "forum/$topic->tid"), 'colspan' => '3')
);
}
else {
/* jasper add */
if($order==2){
$rows[] = array(
array('data' => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'),
array('data' => $topic->num_comments . ($topic->new_replies ? '
'. l(t('%a new', array('%a' => $topic->new_replies)), "node/$topic->nid?from=$frompage&comments_per_page=$comments_per_page", NULL, NULL, 'new') : ''), 'class' => 'replies'),
array('data' => _forum_format($topic), 'class' => 'created'),
array('data' => _forum_format($topic->last_reply), 'class' => 'last-reply')
);
}else{
/* jasper end */
$rows[] = array(
array('data' => _forum_icon($topic->new, $topic->num_comments, $topic->comment_mode, $topic->sticky), 'class' => 'icon'),
array('data' => l($topic->title, "node/$topic->nid"), 'class' => 'topic'),
array('data' => $topic->num_comments . ($topic->new_replies ? '
'. l(t('%a new', array('%a' => $topic->new_replies)), "node/$topic->nid", NULL, NULL, 'new') : ''), 'class' => 'replies'),
array('data' => _forum_format($topic), 'class' => 'created'),
array('data' => _forum_format($topic->last_reply), 'class' => 'last-reply')
);
/* jasper add */
}
/* jasper end */
}
}
if ($pager = theme('pager', NULL, $forum_per_page, 0, tablesort_pager())) {
$rows[] = array(array('data' => $pager, 'colspan' => '5', 'class' => 'pager'));
}
}
$output .= theme('table', $forum_topic_list_header, $rows);
return $output;
}