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 if (!$is_Mod){ //check Access Level Restrictions but don't bother for Moderators unset($allow_forum); $allow_forum=array(); //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(); if ($sbSession->allowed != "na" && ! $new_sb_user) { $allow_forum=explode(',',$sbSession->allowed); } else { $allow_forum = array(); } //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) { $view=$view==""?$settings[current_view]:$view; setcookie("sboard_settings[current_view]",$view,time()+31536000,'/'); ?> setQuery("SELECT * FROM #__sb_messages AS a LEFT JOIN #__sb_messages_text AS b ON a.id=b.mesid WHERE a.id='$id' and a.hold=0"); $database->query(); if ($database->getNumRows()== 0) { echo '

'._MODERATION_INVALID_ID.'

\n'; } else { $database->loadObject($this_message); $thread = $this_message->parent==0?$this_message->id:$this_message->thread; if ($my->id != 0){ //get time of last visit if ($settings[prevvisit]==0 && $previousVisit !=0) { $prevCheck= $previousVisit;}else{$prevCheck=$settings[prevvisit];} //mark this topic as read $readTopics=""; $database->setQuery("SELECT readtopics FROM #__sb_sessions WHERE userid=$my->id"); $readTopics=$database->loadResult(); if ($readTopics==""){ $readTopics=$thread; $read_topics=array(); $read_topics=("$thread"); } else{ //get all readTopics in an array $read_topics=explode(',',$readTopics); if (!in_array($thread,$read_topics)){ $readTopics=$readTopics.",".$thread; } } $database->setQuery("UPDATE #__sb_sessions set readtopics='$readTopics' WHERE userid=$my->id"); $database->query(); } //update the hits counter for this topic $database->setQuery("UPDATE #__sb_messages SET hits=hits+1 WHERE id=$thread AND parent=0"); $database->query(); // changed to 0 to fix the missing post when the thread splits over multiple pages $i=0; if ($sbConfig['cb_profile'] && $my->id!=0) { $database->setQuery("SELECT sbordering from #__comprofiler where user_id=$my->id"); $sbordering=$database->loadResult(); if ($sbordering == "_UE_SB_ORDERING_OLDEST") { $orderingNum = 0; } else { $orderingNum = 1; } } else { $database->setQuery("SELECT ordering from #__sb_users where userid=$my->id"); $orderingNum=$database->loadResult(); } $ordering = $orderingNum ? 'DESC' : 'ASC'; $database->setQuery("SELECT * FROM #__sb_messages AS a LEFT JOIN #__sb_messages_text AS b ON a.id=b.mesid WHERE (a.thread='$thread' OR a.id='$thread') AND a.hold=0 ORDER BY a.time $ordering"); if ($view != "flat") $flat_messages[]=$this_message; foreach ($database->loadObjectList() as $message) { if ($view == "flat") { $flat_messages[]=$message; if ($id==$message->id){ $idmatch=$i; } $i++; } else { $messages[$message->parent][]=$message; } } if ($view == "flat") { //prepare threading $limit = $sbConfig['messages_per_page']; if ($idmatch > $limit) {$limitstart=(floor( $idmatch/$limit))*$limit;}else{$limitstart=0;} $limitstart = intval( mosGetParam( $_REQUEST, 'limitstart', $limitstart ) ); $total=count($flat_messages); if ($total > $limit) { require_once( "$map/includes/pageNavigation.php" ); $pageNav = new mosPageNav( $total, $limitstart, $limit ); // slice out elements based on limits $flat_messages = array_slice( $flat_messages, $pageNav->limitstart, $pageNav->limit ); } else { $total=0; } } //Get the category name for breadcrumb $database->setQuery("SELECT name, parent from #__sb_categories where id='$catid'"); $database->loadObject($objCatInfo); //Get Parent's cat.name for breadcrumb $database->setQuery("SELECT name,id from #__sb_categories WHERE id='$objCatInfo->parent'"); $database->loadObject($objCatParentInfo); //data ready display now ?>
' ._FORUM_IS_OFFLINE.'' : ' ' ;?>

';?> ' : _HOME; ?> ' : _GEN_MYPROFILE; ?> '; echo $sbIcons['menureply'] ? ''._GEN_POST_REPLY.'' : _GEN_POST_REPLY;?> '; echo $sbIcons['threadedview'] ? ''._GEN_THREADED_VIEW.'' : _GEN_THREADED_VIEW; echo ''; } else { echo $sbIcons['flatview'] ?'':'| '; echo ''; echo $sbIcons['flatview'] ? ''._GEN_FLAT_VIEW.'' : _GEN_FLAT_VIEW; echo ""; } if ($sbConfig['enablePDF'] && $PDF==1 ) { //if $PDF==0 we're on Mambo 4.5.0 and PDF doesn't work there ?> | ' : _GEN_PDF; ?> '; echo $sbIcons['rules'] ? ''._GEN_RULES.'' : _GEN_RULES; echo ''; }?>

"; if ((($sbConfig['pubwrite']==0 && $my_id != 0)||$sbConfig['pubwrite']==1) && ($topicLock==0 || ($topicLock==1 && $is_moderator))) { if ($sbIcons['new_topic']){ echo ''._GEN_POST_NEW_TOPIC.''; } else{ echo ''._GEN_POST_NEW_TOPIC.''; } }?>
writePagesLinks( "index.php?option=com_simpleboard&Itemid=$Itemid&func=view&id=$id&catid=$catid" ); ?>
setQuery("SELECT a.userid FROM #__sb_users AS a" . "\n LEFT JOIN #__sb_moderation AS b" . "\n ON b.userid=a.userid" . "\n WHERE b.catid='$catid'" ); $catModerators=$database->loadResultArray(); foreach($flat_messages as $fmessage) { $k= 1-$k; if($fmessage->parent==0){ $sb_thread=$fmessage->id; } else { $sb_thread=$fmessage->thread; } //filter out clear html $fmessage->name = htmlspecialchars($fmessage->name); $fmessage->email = htmlspecialchars($fmessage->email); $fmessage->subject = htmlspecialchars($fmessage->subject); //set page title if on Mambo 4.5.2+ if ( $bPageTitle && $leaf->parent == 0) { $mainframe->setPageTitle( $fmessage->subject.' - '.$sbConfig['board_title'] ); } //Get userinfo needed later on, this limits the amount of queries $userinfo=""; $database->setQuery("SELECT a.posts,a.karma,a.signature,a.avatar,b.name,b.username,b.gid FROM #__sb_users as a LEFT JOIN #__users as b on b.id=a.userid where a.userid='$fmessage->userid'"); $database->loadObject($userinfo); //get the username: $sb_username=""; if ($sbConfig['username']){$sb_queryName="username";}else{$sb_queryName="name";} $sb_username=$userinfo->$sb_queryName; if ($sb_username=="" || $sbConfig['changename'] ){$sb_username=$fmessage->name;} $msg_id = $fmessage->id; $msg_username = $fmessage->email!=""&&$my_id>0&&$sbConfig['showemail']=='1'?"email)."\">".stripslashes($sb_username)."":stripslashes($sb_username); if($sbConfig['allowAvatar']) { $Avatarname=$userinfo->username; if($sbConfig['avatar_src']=="pmspro") { $database->setQuery("SELECT picture FROM #__mypms_profiles WHERE user='$Avatarname'"); $avatar=$database->loadResult(); if ($avatar != '') { $msg_avatar = ''; } } elseif($sbConfig['avatar_src']=="cb") { $database->setQuery("SELECT avatar FROM #__comprofiler WHERE user_id='$fmessage->userid' AND avatarapproved='1'"); $avatar=$database->loadResult(); if ($avatar != '') { //added or modified by mambojoe //This now has the right path to the upload directory and also handles the thumbnail and gallery photos. $imgpath=$mls.'/images/comprofiler/'; if(eregi("gallery/",$avatar)==false) $imgpath .= "tn".$avatar; else $imgpath .= $avatar; $msg_avatar = ''; //added or modified by mambojoe } } else { $avatar=$userinfo->avatar; if ($avatar != '') { $msg_avatar = ''; } } } if($sbConfig['showstats']) { //user type determination $ugid=$userinfo->gid; $uIsMod=0; $uIsAdm=0; $uIsMod=in_array($fmessage->userid,$catModerators); if($ugid>0) {//only get the groupname from the ACL if we're sure there is one $agrp=strtolower( $acl->get_group_name( $ugid, 'ARO' ) ); } if($ugid==0) { $msg_usertype = _VIEW_VISITOR; } else { if(strtolower($agrp)=="administrator" || strtolower($agrp)=="superadministrator"|| strtolower($agrp)=="super administrator"){$msg_usertype = _VIEW_ADMIN; $uIsAdm=1;} elseif($uIsMod) {$msg_usertype = _VIEW_MODERATOR;} else {$msg_usertype = _VIEW_USER;} } //done usertype determination, phew... //# of post for this user and ranking if ($fmessage->userid) { $numPosts=(int)$userinfo->posts; //ranking $rText=""; $rImg=""; if($sbConfig['showranking']) { if ($numPosts>=0 && $numPosts<(int)$sbConfig['rank1']){$rText=$sbConfig['rank1txt']; $rImg=$sbs.'/ranks/rank1.gif';} if ($numPosts>=(int)$sbConfig['rank1'] && $numPosts<(int)$sbConfig['rank2']){$rText=$sbConfig['rank2txt']; $rImg=$sbs.'/ranks/rank2.gif';} if ($numPosts>=(int)$sbConfig['rank2'] && $numPosts<(int)$sbConfig['rank3']){$rText=$sbConfig['rank3txt']; $rImg=$sbs.'/ranks/rank3.gif';} if ($numPosts>=(int)$sbConfig['rank3'] && $numPosts<(int)$sbConfig['rank4']){$rText=$sbConfig['rank4txt']; $rImg=$sbs.'/ranks/rank4.gif';} if ($numPosts>=(int)$sbConfig['rank4'] && $numPosts<(int)$sbConfig['rank5']){$rText=$sbConfig['rank5txt']; $rImg=$sbs.'/ranks/rank5.gif';} if ($numPosts>=(int)$sbConfig['rank5']){$rText=$sbConfig['rank6txt']; $rImg=$sbs.'/ranks/rank6.gif';} if ($uIsMod){$rText=_RANK_MODERATOR; $rImg=$sbs.'/ranks/rankmod.gif';} if ($uIsAdm){$rText=_RANK_ADMINISTRATOR; $rImg=$sbs.'/ranks/rankadmin.gif';} if($sbConfig['rankimages']){$msg_userrankimg = '';} $msg_userrank = $rText; } $useGraph=0; //initialization if (!$sbConfig['postStats']){ $msg_posts = $numPosts; $useGraph=0; } else { $myGraph = new phpGraph; //$myGraph->SetGraphTitle(_POSTS); $myGraph->AddValue(_POSTS,$numPosts); $myGraph->SetRowSortMode(0); $myGraph->SetBarImg($sbs."/graph/col".$sbConfig['statsColor']."m.png"); $myGraph->SetBarImg2($sbs."/emoticons/graph.gif"); $myGraph->SetMaxVal($maxPosts); $myGraph->SetShowCountsMode(2); $myGraph->SetBarWidth(4); //height of the bar $myGraph->SetBorderColor("#333333"); $myGraph->SetBarBorderWidth(0); $myGraph->SetGraphWidth(64);//should match column width in the
above -5 pixels //$myGraph->BarGraphHoriz(); $useGraph=1; } } } //karma points and buttons if($sbConfig['showkarma'] && $fmessage->userid != '0') { $karmaPoints=$userinfo->karma; $karmaPoints=(int)$karmaPoints; $msg_karma = ""._KARMA.": $karmaPoints"; if($my->id != '0' && $my->id != $fmessage->userid ) { $msg_karmaminus = "userid.'&pid='.$fmessage->id.'&catid='.$catid.'') . "\">\"Karma-\""; $msg_karmaplus = "userid.'&pid='.$fmessage->id.'&catid='.$catid.'') . "\">\"Karma+\""; } } /*let's see if we should use myPMS2 integration */ if ($sbConfig['pm_component']=="pms" && $fmessage->userid && $my->id) { //we should offer the user a PMS link //first get the username of the user to contact $PMSName=$userinfo->username; $msg_pms = "subject) . "\">\"""; } /*let's see if we should use myPMSPro integration */ if ($sbConfig['pm_component']=="pmspro" && $fmessage->userid && $my->id) { //we should offer the user a PMS link //first get the username of the user to contact $PMSName=$userinfo->username; $msg_pms = "subject) . "\">\"""; //mypms pro profile link $msg_profile = "\"""; //mypms add buddy link $msg_buddy = "\"""; $database->setQuery("SELECT icq,ym,msn,aim,website,location FROM #__mypms_profiles WHERE user='" . $PMSName . "'"); $mostables=$database->loadObjectList(); foreach($mostables as $mostables) { if($mostables->aim) $msg_aim = "aim) . "\">"; if($mostables->icq) $msg_icq = "icq . "\">"; if($mostables->msn) $msg_msn = ""; if($mostables->ym) $msg_yahoo = "ym . "&.src=pg\">ym . "&m=g&t=0\" border=0>"; if($mostables->location) $msg_loc = $mostables->location; } unset($mostables); } //Check if the Community Builder settings are on, and set the variables accordingly. if ($sbConfig['cb_profile'] && $fmessage->userid > 0){ $msg_profile = "userid). "\">\"""; } //Show admins the IP address of the user: if ($is_admin || $is_moderator) { $msg_ip = 'IP: '.$fmessage->ip; $msg_ip_link=''; } $sb_subject_txt = $fmessage->subject; $table = array_flip(get_html_translation_table(HTML_ENTITIES)); $sb_subject_txt = strtr($sb_subject_txt, $table); $sb_subject_txt = smile::sbHtmlSafe($sb_subject_txt); $sb_subject_txt = stripslashes($sb_subject_txt); $msg_subject = stripslashes($sb_subject_txt); $msg_date = date(_DATETIME , $fmessage->time); $sb_message_txt = $fmessage->message; $sb_message_txt = stripslashes(smile::smileReplace($sb_message_txt,0, $sbs, $sbConfig['disemoticons'])); $sb_message_txt = str_replace("\n","
",$sb_message_txt); //$sb_message_txt = nl2br($sb_message_txt); //$sb_message_txt = str_replace("

 


","",$sb_message_txt); //$sb_message_txt = str_replace("


","

",$sb_message_txt); //$sb_message_txt = str_replace("


","

",$sb_message_txt); //filter bad words if ($sbConfig['badwords']) { $badwords = Badword::filter($sb_message_txt, $my); } //wordwrap: $sb_message_txt = smile::htmlwrap($sb_message_txt, $sbConfig['wrap']); //this doesn't work for code... need to find something else.. //restore the \n (were replaced with _CTRL_) occurences inside code tags, but only after we have stripslashes; otherwise they will be stripped again $msg_text = str_replace("_CRLF_","\\n",stripslashes($sb_message_txt)); //add notification that the message was filtered for bad words if ($badwords == "true") { $msg_text = _COM_A_BADWORDS_NOTICE ; } if ($sbConfig['cb_profile']) { $database->setQuery("select sbsignature from #__comprofiler where user_id=$fmessage->userid"); $signature=$database->loadResult(); } else { $signature=$userinfo->signature; } if($signature != "") { $signature = stripslashes(smile::smileReplace($signature,0, $sbs, $sbConfig['disemoticons'])); $signature = str_replace("\n","
",$signature); $signature = str_replace("

 


","",$signature); $signature = str_replace("


","

",$signature); $signature = str_replace("


","

",$signature); //wordwrap: $signature = smile::htmlwrap($signature, $sbConfig['wrap']); //restore the \n (were replaced with _CTRL_) occurences inside code tags, but only after we have striplslashes; otherwise they will be stripped again $signature = str_replace("_CRLF_","\\n",stripslashes($signature)); $msg_signature = $signature; } //echo "fmessage=".var_dump($fmessage); //check if topic is locked $database->setQuery("select thread from #__sb_messages where id='$fmessage->id'"); $topicID=$database->loadResult(); if ($topicID != 0) { //message replied to is not the topic post; check if the topic post itself is locked $database->setQuery("select locked from #__sb_messages where id='$topicID'"); $topicLock=$database->loadResult(); $lockedWhat=_TOPIC_NOT_ALLOWED; } else { //message replied to is the topic post; check if that's locked $database->setQuery("select locked from #__sb_messages where id='$fmessage->id'"); $topicLock=$database->loadResult(); $lockedWhat=_TOPIC_NOT_ALLOWED; } if ($topicLock==0) { //topic not locked; check if forum is locked $database->setQuery("select locked from #__sb_categories where id='$fmessage->catid'"); $topicLock=$database->loadResult(); $lockedWhat=_FORUM_NOT_ALLOWED; } if ((($sbConfig['pubwrite']==0 && $my_id != 0)||$sbConfig['pubwrite']==1) && ($topicLock==0 || ($topicLock==1 && $is_moderator))) { //user is allowed to reply/quote $msg_reply = "id.'&catid='.$catid) . "\">"; if($sbIcons['reply']) { $msg_reply .= "\"Reply\""; } else { $msg_reply .= _GEN_REPLY; } $msg_reply .= ""; $msg_quote = "id.'&catid='.$catid) . "\">"; if($sbIcons['quote']) { $msg_quote .= "\"Quote\""; } else { $msg_quote .= _GEN_QUOTE; } $msg_quote .= ""; } else { //user is not allowed to write a post if ($topicLock==1) { $msg_closed = _POST_LOCK_SET; } else { $msg_closed = _VIEW_DISABLED; } } $showedEdit=0;//reset this value //Offer an moderator the delete link if ($is_moderator) { $msg_delete = "id.'&catid='.$catid) . "\">"; if($sbIcons['delete']) { $msg_delete .= "\"Delete\""; } else { $msg_delete .= _GEN_DELETE; } $msg_delete .= ""; } if ($sbConfig['useredit']==1 && $my_id != "" ) { //Now, if the viewer==author and the viewer is allowed to edit his/her own post then offer an 'edit' link if ($my_id == $fmessage->userid ) { $msg_edit = "id.'&catid='.$catid) . "\">"; if($sbIcons['edit']) { $msg_edit .= "\"Edit\""; $showedEdit=1; } else { $msg_edit .= _GEN_EDIT; $showedEdit=1; } $msg_edit .= ""; } } if ( $is_moderator && $showedEdit != 1) { //Offer a moderator always the edit link except when it is already showing.. $msg_edit = "id.'&catid='.$catid) . "\">"; if($sbIcons['edit']) { $msg_edit .= "\"Edit\""; } else { $msg_edit .= _GEN_EDIT; } $msg_edit .= ""; } if ($is_moderator && $fmessage->parent =='0') { // offer the moderator always the move link to relocate a topic to another forum // and the (un)sticky bit links // and the (un)lock links // but ONLY when it is a topic and not a reply $msg_move = "id.'&catid='.$catid.'&name='.$fmessage->name) . "\">"; if($sbIcons['move']) { $msg_move .= "\"Move\""; } else { $msg_move .= _GEN_MOVE; } $msg_move .= ""; if ($fmessage->ordering==0) { $msg_sticky = "id.'&catid='.$catid) . "\">"; if($sbIcons['sticky']) { $msg_sticky .= "\"Sticky\""; } else { $msg_sticky .= _GEN_STICKY; } $msg_sticky .= ""; } else { $msg_sticky = "id.'&catid='.$catid) . "\">"; if($sbIcons['unsticky']) { $msg_sticky .= "\"Unsticky\""; } else { $msg_sticky .= _GEN_UNSTICKY; } $msg_sticky .= ""; } if ($fmessage->locked==0) { $msg_lock = "id.'&catid='.$catid) . "\">"; if($sbIcons['lock']) { $msg_lock .= "\"Lock\""; } else { $msg_lock .= _GEN_LOCK; } $msg_lock .= ""; } else { $msg_lock = "id.'&catid='.$catid) . "\">"; if($sbIcons['unlock']) { $msg_lock .= "\"Unlock\""; } else { $msg_lock .= _GEN_UNLOCK; } $msg_lock .= ""; } } include $map.'/components/com_simpleboard/template/'.$sbConfig['template'].'/'.$sbConfig['template'].'_view.php'; unset($msg_id,$msg_username,$msg_avatar,$msg_usertype,$msg_userrank,$msg_userrankimg,$msg_posts,$msg_move,$msg_karma,$msg_karmaplus,$msg_karmaminus,$msg_ip, $msg_ip_link ,$msg_date,$msg_subject,$msg_text,$msg_signature,$msg_reply,$msg_quote,$msg_edit,$msg_closed,$msg_delete,$msg_sticky,$msg_lock,$msg_aim,$msg_icq,$msg_msn,$msg_yahoo,$msg_buddy,$msg_profile,$msg_pms,$msg_loc,$msg_regdate,$myGraph); $useGraph=0; } // end for ?>


writePagesLinks( "index.php?option=com_simpleboard&Itemid=$Itemid&func=view&id=$id&catid=$catid" );?>
setQuery("SELECT thread from #__sb_subscriptions where userid=$my_id and thread='$sb_thread'"); $sb_subscribed=$database->loadResult(); if ($sb_subscribed == ""){$sb_cansubscribe=1;} else {$sb_cansubscribe=0;} } if($my_id != 0 && $sbConfig['allowsubscriptions'] == 1 && $sb_cansubscribe == 1 ) {?> ' : _VIEW_SUBSCRIBE;?>
"; if ((($sbConfig['pubwrite']==0 && $my_id != 0)||$sbConfig['pubwrite']==1) && ($topicLock==0 || ($topicLock==1 && $is_moderator))) { if ($sbIcons['new_topic']){ echo ''._GEN_POST_NEW_TOPIC.''; } else { echo ''._GEN_POST_NEW_TOPIC.''; } }?>
-1 ? strftime( "%d %B %Y %H:%M", $date + ($mosConfig_offset*60*60) ) : '-'; } return $date; } ?>