$forumList) {
$seen = 0;
foreach ($forumList as $f) {
if (!Forums::check_forumperm($f['ID'])) {
continue;
}
if ($f['ID'] == DONOR_FORUM) {
$f['Description'] = donorForumDescription();
}
$forum->setForum($f['ID']);
$userLastRead = $forum->userLastRead($LoggedUser['ID'], $LoggedUser['PostsPerPage'] ?? POSTS_PER_PAGE);
if (isset($userLastRead[$f['LastPostTopicID']])) {
$lastReadPage = (int)$userLastRead[$f['LastPostTopicID']]['Page'];
$lastReadPost = $userLastRead[$f['LastPostTopicID']]['PostID'];
$catchup = $userLastRead[$f['LastPostTopicID']]['PostID'] >= $f['LastPostID']
|| $LoggedUser['CatchupTime'] >= strtotime($f['LastPostTime']);
$isRead = true;
} else {
$lastReadPage = null;
$lastReadPost = null;
$catchup = $LoggedUser['CatchupTime'] >= strtotime($f['LastPostTime']);
$isRead = false;
}
$iconClass = ((!$f['IsLocked'] || $f['IsSticky']) && $catchup ? 'read' : 'unread')
. ($f['IsLocked'] ? '_locked' : '')
. ($f['IsSticky'] ? '_sticky' : '');
echo G::$Twig->render('forum/main.twig', [
'creator' => $f['MinClassCreate'] <= $LoggedUser['Class'],
'category' => $category,
'cut_title' => Format::cut_string($f['Title'], 50, 1),
'description' => $f['Description'],
'forum_id' => $f['ID'],
'icon_class' => $iconClass,
'id' => $f['LastPostTopicID'],
'is_read' => $isRead,
'last_post_diff' => time_diff($f['LastPostTime'], 1),
'last_post_user' => Users::format_username($f['LastPostAuthorID'], false, false, false),
'last_read_page' => $lastReadPage,
'last_read_post' => $lastReadPost,
'name' => $f['Name'],
'num_posts' => $f['NumPosts'],
'num_topics' => $f['NumTopics'],
'seen' => ++$seen, // $seen == 1 implies
needs to be emitted
'threads' => $f['NumPosts'] > 0,
'title' => $f['Title'],
'tooltip' => $f['ID'] == DONOR_FORUM ? 'tooltip_gold' : 'tooltip',
]);
}
/* close the opened in first call to render() above */
if ($seen) { ?>