allowed <> '')?explode(',', $fbSession->allowed):array(); if (in_array($catid, $allow_forum)) { $threads_per_page = $fbConfig->threads_per_page; if ($catid <= 0) { //make sure we got a valid category id $catid = 1; } $view = $view == "" ? $settings[current_view] : $view; setcookie("fboard_settings[current_view]", $view, time() + 31536000, '/'); /*//////////////// Start selecting messages, prepare them for threading, etc... /////////////////*/ $page = (int)$page; $page = $page < 1 ? 1 : $page; $offset = ($page - 1) * $threads_per_page; $row_count = $page * $threads_per_page; $kunena_db->setQuery("SELECT COUNT(*) FROM #__fb_messages WHERE parent='0' AND catid='{$catid}' AND hold='0'"); $total = (int)$kunena_db->loadResult(); check_dberror("Unable to load messages."); $kunena_db->setQuery( "SELECT a.*, MAX(b.time) AS lastpost FROM #__fb_messages AS a LEFT JOIN #__fb_messages AS b ON b.thread = a.thread WHERE a.parent='0' AND a.catid='{$catid}' AND a.hold='0' GROUP BY id ORDER BY ordering DESC, lastpost DESC", $offset, $threads_per_page); $threadids = array(); $messages = array(); $messages[0] = array(); $thread_counts = array(); foreach ($kunena_db->loadObjectList()as $message) { $threadids[] = $message->id; $messages[$message->parent][] = $message; $last_reply[$message->id] = $message; $hits[$message->id] = $message->hits; $thread_counts[$message->id] = 0; } if (count($threadids) > 0) { $idstr = @join("','", $threadids); $kunena_db->setQuery("SELECT a.* FROM #__fb_messages AS a WHERE thread IN ('$idstr') AND id NOT IN ('$idstr') and hold='0'"); foreach ($kunena_db->loadObjectList()as $message) { $messages[$message->parent][] = $message; $thread_counts[$message->thread]++; $last_reply[$message->thread] = ($last_reply[$message->thread]->time < $message->time) ? $message : $last_reply[$message->thread]; } } //get number of pending messages $kunena_db->setQuery("SELECT COUNT(*) FROM #__fb_messages WHERE catid='{$catid}' AND hold='1'"); $numPending = $kunena_db->loadResult(); check_dberror("Unable to load messages."); //@rsort($messages[0]); //Get the category name for breadcrumb unset($objCatInfo, $objCatParentInfo); $kunena_db->setQuery("SELECT * FROM #__fb_categories WHERE id='{$catid}'"); $objCatInfo = $kunena_db->loadObject(); //Get the Category's parent category name for breadcrumb $kunena_db->setQuery("SELECT name, id FROM #__fb_categories WHERE id='{$objCatInfo->parent}'"); $objCatParentInfo = $kunena_db->loadObject(); //check if this forum is locked $forumLocked = $objCatInfo->locked; //check if this forum is subject to review $forumReviewed = $objCatInfo->review; ?> headerdesc) { ?>
|
';
echo CKunenaLink::GetSamePageAnkerLink('forumbottom', isset($fbIcons['bottomarrow']) ? ' | ';
//pagination 1
if (count($messages[0]) > 0)
{
echo ' '. _PAGE;
if (($page - 2) > 1)
{
echo ' '.CKunenaLink::GetCategoryPageLink('showcat', $catid, 1, 1, $rel='follow', $class='jr-pagenav-nb');
}
for ($i = ($page - 2) <= 0 ? 1 : ($page - 2); $i <= $page + 2 && $i <= ceil($total / $threads_per_page); $i++)
{
if ($page == $i) {
echo " ';
}
?>
$i ";
}
else {
echo ' '.CKunenaLink::GetCategoryPageLink('showcat', $catid, $i, $i, $rel='follow', $class='jr-pagenav-nb');
}
}
if ($page + 2 < ceil($total / $threads_per_page))
{
echo " ... ";
echo ' '.CKunenaLink::GetCategoryPageLink('showcat', $catid, ceil($total / $threads_per_page), ceil($total / $threads_per_page), $rel='follow', $class='jr-pagenav-nb');
}
echo ' |
";
echo '
' . _SHOWCAT_NO_TOPICS;
echo "
|
';
echo CKunenaLink::GetSamePageAnkerLink('forumtop', isset($fbIcons['toparrow']) ? ' | ';
//pagination 2
if (count($messages[0]) > 0)
{
echo ' '. _PAGE;
if (($page - 2) > 1)
{
echo ' '.CKunenaLink::GetCategoryPageLink('showcat', $catid, 1, 1, $rel='follow', $class='jr-pagenav-nb');
}
for ($i = ($page - 2) <= 0 ? 1 : ($page - 2); $i <= $page + 2 && $i <= ceil($total / $threads_per_page); $i++)
{
if ($page == $i) {
echo " ';
}
?>
$i ";
}
else {
echo ' '.CKunenaLink::GetCategoryPageLink('showcat', $catid, $i, $i, $rel='follow', $class='jr-pagenav-nb');
}
}
if ($page + 2 < ceil($total / $threads_per_page))
{
echo " ... ";
echo ' '.CKunenaLink::GetCategoryPageLink('showcat', $catid, ceil($total / $threads_per_page), ceil($total / $threads_per_page), $rel='follow', $class='jr-pagenav-nb');
}
echo ' |
|
id != 0)
{
echo CKunenaLink::GetCategoryLink('markthisread', $catid, isset($fbIcons['markThisForumRead']) ? '
userid, ($fbConfig->username ? $mod->username : $mod->name)).' ';
} ?>
|
enableforumjump) require_once (KUNENA_PATH_LIB .DS. 'kunena.forumjump.php'); ?> |
|---|---|
|
id != 0)
{
echo isset($fbIcons['unreadmessage']) ? ' id != 0) { echo isset($fbIcons['readmessage']) ? ' - ' . _GEN_MODERATED . '' : ' - ' . _GEN_MODERATED . '';
}
else {
echo "";
}
?>
|
- ' . _GEN_LOCKED_TOPIC . '' : ' - ' . _GEN_LOCKED_TOPIC . '';
}
?>
- ' . _GEN_ISSTICKY . '' : ' - ' . _GEN_ISSTICKY . '';
}
?>
- ' . _GEN_LOCKED_FORUM . '' : ' - ' . _GEN_LOCKED_FORUM . '';
echo ''; } else { echo ""; } ?> |