setQuery("SELECT userid FROM #__fb_moderation WHERE catid='$catid' and userid='$my->id'");
if ($database->loadResult()) {
$is_Mod = 1;
}
}
else {
$is_Mod = 1;
} //superadmins always are
unset($allow_forum);
$allow_forum = array ();
//get the db data with allowed forums and turn it into an array
if ($fbSession->allowed != "na" && !$new_fb_user) {
$allow_forum = explode(',', $fbSession->allowed);
}
else
{
//get only the publicly accessible forums..
$database->setQuery("SELECT id FROM #__fb_categories WHERE published='1' AND pub_access='0'");
$allowed_forums = $database->loadObjectList();
$i = 0;
foreach ($allowed_forums as $af)
{
if (count($allow_forum) == 0) {
$allow_forum[0] = $af->id;
}
else
{
$allow_forum[$i] = $af->id;
$i++;
}
}
}
if (!$is_Mod)
{
//check Access Level Restrictions but don't bother for Moderators
//get all the info on this forum:
$database->setQuery("SELECT id,pub_access,pub_recurse,admin_access,admin_recurse FROM #__fb_categories where id='$catid'");
$row = $database->loadObjectList();
//Do user identification based upon the ACL
$letPass = 0;
$letPass = fb_auth::validate_user($row[0], $allow_forum, $aro_group->group_id, $acl);
}
if ($letPass || $is_Mod)
{
$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;
$database->setQuery("Select count(*) FROM #__fb_messages WHERE parent = '0' AND catid= '$catid' AND hold = '0' ");
$total = (int)$database->loadResult();
$database->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 LIMIT $offset,$threads_per_page");
foreach ($database->loadObjectList()as $message)
{
$threadids[] = $message->id;
$messages[$message->parent][] = $message;
$last_reply[$message->id] = $message;
$hits[$message->id] = $message->hits;
}
if (count($threadids) > 0)
{
$idstr = @join("','", $threadids);
$database->setQuery("SELECT id,parent,thread,catid,subject,name,time,topic_emoticon,locked,ordering,userid moved FROM #__fb_messages WHERE thread IN ('$idstr') AND id NOT IN ('$idstr') and hold=0");
foreach ($database->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
$database->setQuery("select count(*) from #__fb_messages where catid='$catid' and hold=1");
$numPending = $database->loadResult();
//@rsort($messages[0]);
?>
setQuery("SELECT * from #__fb_categories where id = {$catid}");
$database->loadObject($objCatInfo);
//Get the Category's parent category name for breadcrumb
$database->setQuery("SELECT name,id FROM #__fb_categories WHERE id = {$objCatInfo->parent}");
$database->loadObject($objCatParentInfo);
// set page title
//$mainframe->setPageTitle( $objCatParentInfo->name.' - '.$objCatInfo->name.' - '.$fbConfig['board_title'] );
//check if this forum is locked
$forumLocked = $objCatInfo->locked;
//check if this forum is subject to review
$forumReviewed = $objCatInfo->review;
/* echo '';
echo $fbIcons['forumlist'] ? ' > ' : _GEN_FORUMLIST;
echo ' ';
if (file_exists($mosConfig_absolute_path.'/templates/'.$mainframe->getTemplate().'/images/arrow.png')) {
echo '
';
} else {
echo '
';
}
echo ' '.$objCatParentInfo->name.' ';
if (file_exists($mosConfig_absolute_path.'/templates/'.$mainframe->getTemplate().'/images/arrow.png')) {
echo '
';
} else {
echo '
';
}*/
// echo ' '.$objCatInfo->name.' ';
?>
headerdesc) { ?>
';
echo $fbIcons['bottomarrow'] ? ' | ';
//pagination 1
if (count($messages[0]) > 0)
{
echo '
|
";
echo '
' . _SHOWCAT_NO_TOPICS;
echo "
';
echo $fbIcons['toparrow'] ? ' | ';
//pagination 1
if (count($messages[0]) > 0)
{
echo '
|
id != 0)
{
echo '';
echo $fbIcons['markThisForumRead']
? '
userid).'">'.$mod->username.' ';
} ?>
|
|
---|---|
id != 0)
{
echo $fbIcons['unreadmessage'] ? ' id != 0) { echo $fbIcons['readmessage'] ? ' - ' . _GEN_MODERATED . '' : ' ![]() |
- ' . _GEN_LOCKED_TOPIC . '' : '![]() - ' . _GEN_ISSTICKY . '' : ' ![]() - ' . _GEN_LOCKED_FORUM . '' : ' ![]() '; } else { echo ""; } ?> |