This repository has been archived on 2024-11-28. You can view files and clone it, but cannot push or open issues or pull requests.
MatritumCantat_Web/www/components/com_simpleboard/view.php

872 lines
44 KiB
PHP
Raw Permalink Normal View History

<?php
//
// Copyright (C) 2004 Jan de Graaff
// All rights reserved.
//
// Modified to use template.php by Derrick Sobodash (07/29/2004)
//
// This program uses parts of the original Simpleboard Application
// 0.7.0b written by Josh Levine; http://www.joshlevine.net
//
// This source file is part of the SimpleBoard Component, a Mambo 4.5
// custom Component By Jan de Graaff - http://tsmf.jigsnet.com
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License (GPL)
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// Please note that the GPL states that any headers in files and
// Copyright notices as well as credits in headers, source files
// and output (screens, prints, etc.) can not be removed.
// You can extend them with your own credits, though...
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
// The "GNU General Public License" (GPL) is available at
// http://www.gnu.org/copyleft/gpl.html.
//
// Dont allow direct linking
defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );
global $acl;
//securing form elements
$catid=(int)$catid;
$id=(int)$id;
$Itemid=(int)$Itemid;
//ob_start();
$showedEdit=0;
require_once ( 'components/com_simpleboard/forum.conf' );
require_once ( $sbp.'/sb_auth.php' );
require_once ( $sbp.'/sb_statsbar.php' );
//require_once( $map.'/classes/gacl.class.php' );
//require_once( $map.'/classes/gacl_api.class.php' );
// Check if need to include class for bad word filtering
if ($sbConfig['badwords']) { require_once( 'components/com_badword/class.badword.php' ); }
$is_Mod=0;
if (!$is_admin)
{
$database->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,'/');
?>
<link rel="stylesheet" href="components/com_simpleboard/template/<?php echo $sbConfig['template']; ?>/forum.css" type="text/css" />
<?php
$id=(int)$id;
$database->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 '<p align="center">'._MODERATION_INVALID_ID.'</p>\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
?>
<table border="0" cellspacing="0" cellpadding="0" width="100%" align="center">
<tr>
<td align="center">
<table border="0" width="100%">
<?php include ($sbp.'/searchbox.php');?>
<tr>
<td align="center">
<b><font size="2"><?php echo $board_title;?></font></b>
<?php echo $sbConfig['board_offline'] ? '<br /><font color="red">' ._FORUM_IS_OFFLINE.'</font>' : '&nbsp;' ;?>
</td>
</tr>
</table>
<br />
<div align="center">
<?php echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid).'">';?>
<?php echo $sbIcons['home'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['home'].'" border="0" alt="'._HOME.'" title="'._HOME.'"/>' : _HOME; ?>
</a>
<?php
if ($my_id != 0) {
echo $sbIcons['profile'] ?'':'| ';?><a href="<?php if ($sbConfig['cb_profile']) { echo sefRelToAbs('index.php?option=com_comprofiler&amp;Itemid='.$cbitemid); } else { echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=userprofile&amp;do=show'); }?>">
<?php echo $sbIcons['profile'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['profile'].'" border="0" alt="'._GEN_MYPROFILE.'" title="'._GEN_MYPROFILE.'"/>' : _GEN_MYPROFILE; ?>
</a>
<?php
}
echo $sbIcons['menureply'] ?'':'| '; echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=reply&amp;replyto='.$thread.'&amp;catid='.$catid).'">';
echo $sbIcons['menureply'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['menureply'].'" border="0" alt="'._GEN_POST_REPLY.'" title="'._GEN_POST_REPLY.'"/>' : _GEN_POST_REPLY;?>
</a>
<?php
if ($view=="flat"){
echo $sbIcons['threadedview'] ?'':'| '; echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&amp;view=threaded&amp;id='.$id.'&amp;catid='.$catid).'">';
echo $sbIcons['threadedview'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['threadedview'].'" border="0" alt="'._GEN_THREADED_VIEW.'" title="'._GEN_THREADED_VIEW.'"/>' : _GEN_THREADED_VIEW;
echo '</a>';
}
else {
echo $sbIcons['flatview'] ?'':'| '; echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&amp;id='.$id.'&amp;view=flat&amp;catid='.$catid).'">';
echo $sbIcons['flatview'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['flatview'].'" border="0" alt="'._GEN_FLAT_VIEW.'" title="'._GEN_FLAT_VIEW.'"/>' : _GEN_FLAT_VIEW;
echo "</a>";
}
if ($sbConfig['enablePDF'] && $PDF==1 ) { //if $PDF==0 we're on Mambo 4.5.0 and PDF doesn't work there
?>
|
<a href="<?php echo $mls;?>/index.php?option=com_simpleboard&id=<?php echo $id;?>&catid=<?php echo $catid;?>&func=sb_pdf" target="_blank" border="0">
<?php echo $useIcons ? '<img src="'.$mls.'/images/M_images/pdf_button.png" height="16" width="16" alt="PDF" border="0" title="'._GEN_PDFA.'" />' : _GEN_PDF; ?>
</a>
<?php } ?>
<!--
| <a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=faq');?>">
<?php echo $sbIcons['help'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['help'].'" border="0" alt="'._GEN_HELP.'" title="'._GEN_HELP.'" />' : _GEN_HELP; ?>
</a>-->
<?php
// add lines for new rules menu item
if ( $sbConfig['enableRulesPage'] ){
echo $sbIcons['rules'] ?'':' | ';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=rules').'">';
echo $sbIcons['rules'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['rules'].'" border="0" alt="'._GEN_RULES.'" title="'._GEN_RULES.'"/>' : _GEN_RULES;
echo '</a>';
}?>
</div>
<br />
</td>
</tr>
<tr>
<td>
<table width="100%">
<tr>
<td><!--
<div class="pathway">
<?php echo _GEN_PATHWAY;?>
<a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid);?>" class="pathway">
<?php echo $sbIcons['forumlist'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['forumlist'].'" border="0" alt="'._GEN_FORUMLIST.'" title="'._GEN_FORUMLIST.'">' : _GEN_FORUMLIST; ?>
</a>
<img src="<?php echo $mls;?>/images/M_images/arrow.png" alt="" border="0" />
<a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=listcat&amp;catid='.$objCatParentInfo->id);?>" class="pathway">
<?php echo $objCatParentInfo->name;?>
</a>
<img src="<?php echo $mls;?>/images/M_images/arrow.png" alt="" border="0" />
<a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&amp;catid='.$catid);?>" class="pathway">
<?php echo $objCatInfo->name;?>
</a>
</div>-->
</td>
<td align="right">
<?php
//post new topic
//echo "</td></tr><tr><td>";
if ((($sbConfig['pubwrite']==0 && $my_id != 0)||$sbConfig['pubwrite']==1) && ($topicLock==0 || ($topicLock==1 && $is_moderator))) {
if ($sbIcons['new_topic']){
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=reply&amp;catid='.$catid).'"><img src="modules/mod_sbicons/'.$sbIcons['new_topic'].'" alt="'._GEN_POST_NEW_TOPIC.'" title="'._GEN_POST_NEW_TOPIC.'" border="0" /></a>';
}
else{
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=reply&amp;catid='.$catid).'">'._GEN_POST_NEW_TOPIC.'</a>';
}
}?>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<?php
if ($total != 0)
{
?>
<table border="0" cellspacing="1" cellpadding="3" width="100%" class="contentpane">
<tr>
<td class="sectiontableheader" align="center" colspan="2">
<?php
echo $pageNav->writePagesLinks( "index.php?option=com_simpleboard&amp;Itemid=$Itemid&amp;func=view&amp;id=$id&amp;catid=$catid" );
?>
</td>
</tr>
</table>
<?php
}
$tabclass = array("sectiontableentry1", "sectiontableentry2");
$k=0;
// Set up a list of moderators for this category (limits amount of queries)
$database->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'?"<a href=\"mailto:".stripslashes($fmessage->email)."\">".stripslashes($sb_username)."</a>":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 = '<span class="sb_avatar"><img src="'.$mls.'/components/com_mypms/pictures/'.$avatar.'" /></span>';
}
}
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 = '<span class="sb_avatar"><img src="'.$imgpath.'" /></span>';
//added or modified by mambojoe
}
}
else {
$avatar=$userinfo->avatar;
if ($avatar != '') {
$msg_avatar = '<span class="sb_avatar"><img src="'.$sbs.'/avatars/'.$avatar.'" /></span>';
}
}
}
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 = '<img src="'.$rImg.'" alt="" />';}
$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 <TD> 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 = "<strong>"._KARMA.":</strong> $karmaPoints";
if($my->id != '0' && $my->id != $fmessage->userid ) {
$msg_karmaminus = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=karma&amp;do=decrease&userid='.$fmessage->userid.'&pid='.$fmessage->id.'&amp;catid='.$catid.'') . "\"><img src=\"";
if($sbIcons['karmaminus']) {
$msg_karmaminus .= "$mls/modules/mod_sbicons/" . $sbIcons['karmaminus'];
}
else {
$msg_karmaminus .= "$mls/components/com_simpleboard/emoticons/karmaminus.gif";
}
$msg_karmaminus .= "\" alt=\"Karma-\" border=\"0\" title=\"" . _KARMA_SMITE . "\" align=\"middle\" /></a>";
$msg_karmaplus = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=karma&amp;do=increase&userid='.$fmessage->userid.'&pid='.$fmessage->id.'&amp;catid='.$catid.'') . "\"><img src=\"";
if($sbIcons['karmaplus']) {
$msg_karmaplus .= "$mls/modules/mod_sbicons/" . $sbIcons['karmaplus'];
}
else {
$msg_karmaplus .= "$mls/components/com_simpleboard/emoticons/karmaplus.gif";
}
$msg_karmaplus .= "\" alt=\"Karma+\" border=\"0\" title=\"" . _KARMA_APPLAUD . "\" align=\"middle\" /></a>";
}
}
/*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 = "<a href=\"" . sefRelToAbs('index.php?option=com_pms&page=new&amp;id='.$PMSName.'&title='.$fmessage->subject) . "\"><img src=\"";
if($sbIcons['pms']) {
$msg_pms .= "$mls/modules/mod_sbicons/" . $sbIcons['pms'];
} else {
$msg_pms .= "$mls/components/com_simpleboard/emoticons/sendpm.gif";
}
$msg_pms .= "\" alt=\"" . _VIEW_PMS . "\" border=\"0\" title=\"" . _VIEW_PMS . "\" /></a>";
}
/*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 = "<a href=\"" . sefRelToAbs('index.php?option=com_mypms&task=new&amp;to='.$PMSName.'&title='.$fmessage->subject) . "\"><img src=\"";
if($sbIcons['pms']) {
$msg_pms .= "$mls/modules/mod_sbicons/" . $sbIcons['pms'];
} else {
$msg_pms .= "$mls/components/com_mypms/images/folders/compose.gif";
}
$msg_pms .= "\" alt=\"" . _VIEW_PMS . "\" border=\"0\" title=\"" . _VIEW_PMS . "\" /></a>";
//mypms pro profile link
$msg_profile = "<a href=\"" . sefRelToAbs('index.php?option=com_mypms&task=showprofile&amp;user='.$PMSName). "\"><img src=\"";
if($sbIcons['userprofile']) {
$msg_profile .= "$mls/modules/mod_sbicons/" . $sbIcons['userprofile'];
} else {
$msg_profile .= "$mls/components/com_mypms/images/folders/profile.gif";
}
$msg_profile .= "\" alt=\"" . _VIEW_PROFILE . "\" border=\"0\" title=\"" . _VIEW_PROFILE . "\" /></a>";
//mypms add buddy link
$msg_buddy = "<a href=\"" . sefRelToAbs('index.php?option=com_mypms&user='.$PMSName.'&task=addbuddy') . "\"><img src=\"";
if($sbIcons['pms2buddy']) {
$msg_buddy .= "$mls/modules/mod_sbicons/" . $sbIcons['pms2buddy'];
} else {
$msg_buddy .= "$mls/components/com_mypms/images/messages/addbuddy.gif";
}
$msg_buddy .= "\" alt=\"" . _VIEW_ADDBUDDY . "\" border=\"0\" title=\"" . _VIEW_ADDBUDDY . "\" /></a>";
$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 = "<a href=\"aim:goim?screenname=" . str_replace(" ", "+", $mostables->aim) . "\"><img src=\"/components/com_simpleboard/emoticons/aim.png\" border=0></a>";
if($mostables->icq)
$msg_icq = "<a href=\"http://www.icq.com/whitepages/wwp.php?uin=" . $mostables->icq . "\"><img src=\"/components/com_simpleboard/emoticons/icq.png\" border=0></a>";
if($mostables->msn)
$msg_msn = "<a href=\"" . sefRelToAbs('index.php?option=com_mypms&task=showprofile&amp;user='.$PMSName). "\"><img src=\"/components/com_simpleboard/emoticons/msn.png\" border=0></a>";
if($mostables->ym)
$msg_yahoo = "<a href=\"http://edit.yahoo.com/config/send_webmesg?.target=" . $mostables->ym . "&.src=pg\"><img src=\"http://opi.yahoo.com/online?u=" . $mostables->ym . "&m=g&t=0\" border=0></a>";
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 = "<a href=\"" . sefRelToAbs('index.php?option=com_comprofiler&task=userProfile&user='.$fmessage->userid). "\"><img src=\"";
if($sbIcons['userprofile']) {
$msg_profile .= "$mls/modules/mod_sbicons/" . $sbIcons['userprofile'];
} else {
$msg_profile .= "$mls/components/com_comprofiler/images/profiles.gif";
}
$msg_profile .= "\" alt=\"" . _VIEW_PROFILE . "\" border=\"0\" title=\"" . _VIEW_PROFILE . "\" /></a>";
}
//Show admins the IP address of the user:
if ($is_admin || $is_moderator) {
$msg_ip = 'IP: '.$fmessage->ip;
$msg_ip_link='<a href="http://openrbl.org/dnsbl?i='.$fmessage->ip.'&f=2" target="_blank">';
}
$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","<br />",$sb_message_txt);
//$sb_message_txt = nl2br($sb_message_txt);
//$sb_message_txt = str_replace("<P>&nbsp;</P><br />","",$sb_message_txt);
//$sb_message_txt = str_replace("</P><br />","</P>",$sb_message_txt);
//$sb_message_txt = str_replace("<P><br />","<P>",$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","<br />",$signature);
$signature = str_replace("<P>&nbsp;</P><br />","",$signature);
$signature = str_replace("</P><br />","</P>",$signature);
$signature = str_replace("<P><br />","<P>",$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 = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=reply&amp;replyto='.$fmessage->id.'&amp;catid='.$catid) . "\">";
if($sbIcons['reply']) {
$msg_reply .= "<img src=\"$mls/modules/mod_sbicons/" . $sbIcons['reply'] . "\" alt=\"Reply\" border=\"0\" title=\"" . _VIEW_REPLY . "\" />";
}
else {
$msg_reply .= _GEN_REPLY;
}
$msg_reply .= "</a>";
$msg_quote = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=quote&amp;replyto='.$fmessage->id.'&amp;catid='.$catid) . "\">";
if($sbIcons['quote']) {
$msg_quote .= "<img src=\"$mls/modules/mod_sbicons/" . $sbIcons['quote'] . "\" alt=\"Quote\" border=\"0\" title=\"" . _VIEW_QUOTE . "\" />";
}
else {
$msg_quote .= _GEN_QUOTE;
}
$msg_quote .= "</a>";
}
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 = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=delete&amp;id='.$fmessage->id.'&amp;catid='.$catid) . "\">";
if($sbIcons['delete']) {
$msg_delete .= "<img src=\"$mls/modules/mod_sbicons/" . $sbIcons['delete'] . "\" alt=\"Delete\" border=\"0\" title=\"" . _VIEW_DELETE . "\" />";
}
else {
$msg_delete .= _GEN_DELETE;
}
$msg_delete .= "</a>";
}
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 = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=edit&amp;id='.$fmessage->id.'&amp;catid='.$catid) . "\">";
if($sbIcons['edit']) {
$msg_edit .= "<img src=\"$mls/modules/mod_sbicons/" . $sbIcons['edit'] . "\" alt=\"Edit\" border=\"0\" title=\"" . _VIEW_EDIT . "\" />";
$showedEdit=1;
}
else {
$msg_edit .= _GEN_EDIT;
$showedEdit=1;
}
$msg_edit .= "</a>";
}
}
if ( $is_moderator && $showedEdit != 1) {
//Offer a moderator always the edit link except when it is already showing..
$msg_edit = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=edit&amp;id='.$fmessage->id.'&amp;catid='.$catid) . "\">";
if($sbIcons['edit']) {
$msg_edit .= "<img src=\"$mls/modules/mod_sbicons/" . $sbIcons['edit'] . "\" alt=\"Edit\" border=\"0\" title=\"" . _VIEW_EDIT . "\" />";
}
else {
$msg_edit .= _GEN_EDIT;
}
$msg_edit .= "</a>";
}
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 = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=move&amp;id='.$fmessage->id.'&amp;catid='.$catid.'&name='.$fmessage->name) . "\">";
if($sbIcons['move']) {
$msg_move .= "<img src=\"$mls/modules/mod_sbicons/" . $sbIcons['move'] . "\" alt=\"Move\" border=\"0\" title=\"" . _VIEW_MOVE . "\" />";
}
else {
$msg_move .= _GEN_MOVE;
}
$msg_move .= "</a>";
if ($fmessage->ordering==0) {
$msg_sticky = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=sticky&amp;id='.$fmessage->id.'&amp;catid='.$catid) . "\">";
if($sbIcons['sticky']) {
$msg_sticky .= "<img src=\"$mls/modules/mod_sbicons/" . $sbIcons['sticky'] . "\" alt=\"Sticky\" border=\"0\" title=\"" . _VIEW_STICKY . "\" />";
}
else {
$msg_sticky .= _GEN_STICKY;
}
$msg_sticky .= "</a>";
}
else {
$msg_sticky = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=unsticky&amp;id='.$fmessage->id.'&amp;catid='.$catid) . "\">";
if($sbIcons['unsticky']) {
$msg_sticky .= "<img src=\"$mls/modules/mod_sbicons/" . $sbIcons['unsticky'] . "\" alt=\"Unsticky\" border=\"0\" title=\"" . _VIEW_UNSTICKY . "\" />";
}
else {
$msg_sticky .= _GEN_UNSTICKY;
}
$msg_sticky .= "</a>";
}
if ($fmessage->locked==0) {
$msg_lock = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=lock&amp;id='.$fmessage->id.'&amp;catid='.$catid) . "\">";
if($sbIcons['lock']) {
$msg_lock .= "<img src=\"$mls/modules/mod_sbicons/" . $sbIcons['lock'] . "\" alt=\"Lock\" border=\"0\" title=\"" . _VIEW_LOCK . "\" />";
}
else {
$msg_lock .= _GEN_LOCK;
}
$msg_lock .= "</a>";
}
else {
$msg_lock = "<a href=\"" . sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=unlock&amp;id='.$fmessage->id.'&amp;catid='.$catid) . "\">";
if($sbIcons['unlock']) {
$msg_lock .= "<img src=\"$mls/modules/mod_sbicons/" . $sbIcons['unlock'] . "\" alt=\"Unlock\" border=\"0\" title=\"" . _VIEW_UNLOCK . "\" />";
}
else {
$msg_lock .= _GEN_UNLOCK;
}
$msg_lock .= "</a>";
}
}
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
?>
</td>
</tr>
<?php if ($view!="flat") { ?>
<tr>
<td>
<br />
<?php include 'components/com_simpleboard/thread.php'; ?>
</td>
</tr>
<?php } ?>
</table>
<?php if ($total != 0){?>
<table width="100%">
<tr>
<td class="sectiontableheader" align="center" colspan="2">
<?php echo $pageNav->writePagesLinks( "index.php?option=com_simpleboard&amp;Itemid=$Itemid&amp;func=view&amp;id=$id&amp;catid=$catid" );?>
</td>
</tr>
</table>
<?php }?>
<table width="100%">
<tr>
<td>
<!--<div class="pathway">
<?php echo _GEN_PATHWAY;?>
<a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid);?>" class="pathway">
<?php echo $sbIcons['forumlist'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['forumlist'].'" border="0" alt="'._GEN_FORUMLIST.'" title="'._GEN_FORUMLIST.'">' : _GEN_FORUMLIST; ?>
</a>
<img src="<?php echo $mls;?>/images/M_images/arrow.png" alt="" border="0" />
<a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=listcat&amp;catid='.$objCatParentInfo->id);?>" class="pathway">
<?php echo $objCatParentInfo->name;?>
</a>
<img src="<?php echo $mls;?>/images/M_images/arrow.png" alt="" border="0" />
<a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&amp;catid='.$catid);?>" class="pathway">
<?php echo $objCatInfo->name;?>
</a>
</div>-->
</td>
</tr>
<tr>
<td >
<?php
if($sbConfig['allowsubscriptions']==1 && (""!=$my_id || 0!=$my_id)){
//$sb_thread==0 ? $check_thread=$catid : $check_thread=$sb_thread;
$database->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 ) {?>
<a href="<?php echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=subscribe&amp;catid='.$catid.'&amp;id='.$id.'&amp;sb_thread='.$sb_thread);?>">
<?php echo $sbIcons['subscribe'] ?'<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['subscribe'].'" border="0" title="'._VIEW_SUBSCRIBETXT.'" alt="'._VIEW_SUBSCRIBETXT.'" />' : _VIEW_SUBSCRIBE;?></a>
<?php
}?>
</td>
<td align="right">
<?php
//post new topic
//echo "</td></tr><tr><td align=\"right\">";
if ((($sbConfig['pubwrite']==0 && $my_id != 0)||$sbConfig['pubwrite']==1) && ($topicLock==0 || ($topicLock==1 && $is_moderator))) {
if ($sbIcons['new_topic']){
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=reply&amp;catid='.$catid).'"><img src="modules/mod_sbicons/'.$sbIcons['new_topic'].'" alt="'._GEN_POST_NEW_TOPIC.'" title="'._GEN_POST_NEW_TOPIC.'" border="0" /></a>';
}
else {
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=post&amp;do=reply&amp;catid='.$catid).'">'._GEN_POST_NEW_TOPIC.'</a>';
}
}?>
</td>
</tr>
</table>
<?php
}
}
else{
echo "You do not have access to this Forum";
}
function formatdate($date){
global $mosConfig_offset;
if ( $date && ereg("([0-9]{4})-([0-9]{2})-([0-9]{2})[ ]([0-9]{2}):([0-9]{2}):([0-9]{2})", $date, $regs ) ) {
$date = mktime( $regs[4], $regs[5], $regs[6], $regs[2], $regs[3], $regs[1] );
$date = $date > -1 ? strftime( "%d %B %Y %H:%M", $date + ($mosConfig_offset*60*60) ) : '-';
}
return $date;
}
?>