setQuery("SELECT userid FROM #__sb_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 ($sbSession->allowed != "na" && ! $new_sb_user) { $allow_forum=explode(',',$sbSession->allowed); } else { //get only the public accessible forums.. $database->setQuery( "SELECT id FROM #__sb_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 #__sb_categories where id='$catid'"); $row=$database->loadObjectList(); //Do user identification based upon the ACL $letPass=0; $letPass=sb_auth::validate_user($row[0], $allow_forum, $aro_group->group_id, $acl); } if ($letPass || $is_Mod) { $threads_per_page=$sbConfig['threads_per_page']; if ($catid <= 0 ) { //make sure we got a valid category id $catid=1; } $view=$view==""?$settings[current_view]:$view; setcookie("sboard_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 #__sb_messages WHERE parent = '0' AND catid= '$catid' AND hold = '0' "); $total=(int)$database->loadResult(); $database->setQuery("SELECT a. * , MAX( b.time ) AS lastpost FROM #__sb_messages AS a LEFT JOIN #__sb_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,$row_count"); 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, moved FROM #__sb_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 #__sb_messages where catid='$catid' and hold=1"); $numPending=$database->loadResult(); //@rsort($messages[0]); ?>
' : _HOME; ?>
' : _GEN_MYPROFILE; ?>
';
echo $sbIcons['threadedview'] ? ' ';
//post new topic
echo " | |||||||
| ";
if ((($sbConfig['pubwrite']==0 && $my_id != 0)||$sbConfig['pubwrite']==1) && ($topicLock==0 || ($topicLock==1 && $is_moderator))) {
//this user is allowed to post a new topic:
if ($sbIcons['new_topic']){
echo ' | |||||||
| '; //pagination 1 if (count($messages[0]) > 0) { echo _PAGE; if (($page-2) > 1) { echo '1 '; echo "... "; } 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 ''.$i.' '; } } if ($page+2 < ceil($total/$threads_per_page)) { echo "... "; echo ''.ceil($total/$threads_per_page).''; } } echo " | "; echo "|||||||
'._GEN_PATHWAY;
echo '';
echo $sbIcons['forumlist'] ? ' '.$objCatParentInfo->name.' '.$objCatInfo->name.' ';
*/
if ($forumLocked)
{
echo $sbIcons['forumlocked'] ? ' | |||||||
| ";
//get time of last visit
if ($settings[prevvisit]==0 && $previousVisit !=0)
{ $prevCheck= $previousVisit;}else{$prevCheck=$settings[prevvisit];}
//get all readTopics in an array
$readTopics="";
$database->setQuery("SELECT readtopics FROM #__sb_sessions WHERE userid=$my->id");
$readTopics=$database->loadResult();
if ( count ($readTopics) == 0 ) { $readTopics = "0"; } //make sure at least something is in there..
//make it into an array
$read_topics=explode(',',$readTopics);
if (count($messages) > 0)
{
if ($view=="flat")
include_once($sbp.'/flat.php');
else
include_once($sbp.'/thread.php');
}
else
{
echo " ";
echo ' |
|||||||
|
0)
{
echo _PAGE;
if (($page-2) > 1)
{
echo '1 ';
echo "... ";
}
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 ''.$i.' ';
}
}
if ($page+2 < ceil($total/$threads_per_page))
{
echo "... ";
echo ''.ceil($total/$threads_per_page).'';
}
} ?>
|
|||||||
| '._GEN_POST_NEW_TOPIC.' | '; } }?>|||||||
| ';
echo $sbIcons['markThisForumRead'] ? ' | |||||||
| ';
echo '';
echo $sbIcons['unreadmessage'] ? ' '; echo $sbIcons['readmessage'] ? ' | |||||||
|
- '._GEN_LOCKED_TOPIC.' ': ' '; } if ($topicSticky) { echo $sbIcons['topicsticky'] ? ' |
|||||||
|
- '._GEN_LOCKED_FORUM.' ' : ' '; }else{echo "";} if ($moderatedForum==1) { echo $sbIcons['forummoderated'] ? ' '._GEN_MODERATORS.": "; foreach ($modslist as $mod) { echo " $mod->username "; } } ?> |
|||||||