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/post.php

1136 lines
58 KiB
PHP
Raw Permalink Normal View History

<?php
//
// Copyright (C) 2003 Jan de Graaff
// All rights reserved.
//
// 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://www.tsmf-mambo.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.' );
//ob_start();
$catid=(int)$catid;
$pubwrite=(int)$pubwrite;
//ip for floodprotection, post logging, subscriptions, etcetera
$ip=$_SERVER["REMOTE_ADDR"];
require_once 'components/com_simpleboard/forum.conf';
//reset variables used
$editmode=0;
// $message=mosGetParam($_POST, 'message','',1); // For some reason this just doesn't work like it should
$message=$_REQUEST["message"];
//flood protection
$sbConfig['floodprotection']=(int)$sbConfig['floodprotection'];
if ($sbConfig['floodprotection'] != 0)
{
$database->setQuery("select max(time) from #__sb_messages where ip='$ip'");
$lastPostTime=$database->loadResult();
}
if (($sbConfig['floodprotection'] != 0 && ((($lastPostTime+$sbConfig['floodprotection']) < $systime ) || $do == "edit" || $is_admin)) || $sbConfig['floodprotection'] == 0)
{
//Let's find out who we're dealing with if a registered user wants to make a post
if ($my_id != "")
{
$database->setQuery("SELECT name, username, email FROM #__users WHERE id=$my_id");
$userquery=$database->loadObjectList();
if ($database->query())
{
foreach ($userquery as $user)
{
$my_name= $sbConfig['username'] ? $user->username : $user->name;
$my_email=$user->email;
$registeredUser=1;
}
}
else
{
echo _POST_ERROR."<br />";
echo _POST_EXIT;
return;
}
}
}
else
{
echo _POST_TOPIC_FLOOD1;
echo $sbConfig['floodprotection']." "._POST_TOPIC_FLOOD2."<br />";
echo _POST_TOPIC_FLOOD3;
return;
}
//Now find out the forumname to which the user wants to post (for reference only)
$database->setQuery("SELECT name FROM #__sb_categories WHERE id=$catid");
$catName=$database->loadResult();
?>
<link rel="stylesheet" href="components/com_simpleboard/template/<?php echo $sbConfig['template']; ?>/forum.css" type="text/css" />
<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">
<a href="<?php echo 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;task=userDetails'); } 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
}
?>
| <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
if ( $sbConfig['enableRulesPage'] ) {
echo $sbIcons['rules'] ?'':'| ';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&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>
<?php
if ($action=="post")
{
?>
<table border="0" cellspacing="1" cellpadding="3" width="70%" align="center" class="sb_contentpane"><tr><td>
<?php
$parent=(int)$parentid;
if (empty($sb_authorname))
{
echo _POST_FORGOT_NAME;
}
else if (empty($subject))
{
echo _POST_FORGOT_SUBJECT;
}
else if (empty($message))
{
echo _POST_FORGOT_MESSAGE;
}
else
{
if ($parent == 0)
$thread = $parent = 0;
$database->setQuery("SELECT id,thread,parent FROM #__sb_messages WHERE id='$parent'");
$database->query();
if ($database->getNumRows() == 0)
{
// bad parent, create a new post
$parent = 0;
$thread = 0;
}
else
{
$database->loadObject($m);
$thread = $m->parent==0?$m->id:$m->thread;
}
if ($catid == 0 )
{
$catid = 1; //make sure there's a proper category
}
/*if ($attachfile != '' ) {
$noFileUpload=0;
include $sbp.'/file_upload.php';
if ($rc==0){
$noFileUpload=1;
}
}
if ($attachimage != '' ) {
$noImgUpload=0;
include $sbp.'/image_upload.php';
if ($rc==0){
$noImgUpload=1;
}
}*/
$messagesubject=$subject;//before we add slashes and all... used later in mail
$sb_authorname=trim(addslashes($sb_authorname));
$subject=trim(htmlspecialchars(addslashes($subject)));
$message=trim(htmlspecialchars(addslashes($message)));
if ($contentURL != "empty") { $message= $contentURL.'\n\n'.$message;}
//parse the message for some preliminary bbcode and stripping of HTML
$message = smile::bbencode_first_pass($message);
$subject = smile::bbencode_first_pass($subject);
//--
$email=trim(addslashes($email));
$topic_emoticon=(int)$topic_emoticon;
$topic_emoticon=$topic_emoticon>7?0:$topic_emoticon;
$posttime=time()+($sbConfig['board_ofset']*3600);
//check if the post must be reviewed by a Moderator prior to showing
//doesn't apply to admin/moderator posts ;-)
$holdPost=0;
if (!$is_moderator){
$database->setQuery("SELECT review FROM #__sb_categories WHERE id=$catid");
$holdPost=$database->loadResult();
}
$database->setQuery("INSERT INTO #__sb_messages (parent,thread,catid,name,userid,email,subject,time,ip,topic_emoticon,hold) VALUES('$parent','$thread','$catid','$sb_authorname','$my_id','$email','$subject','$posttime','$ip','$topic_emoticon','$holdPost')");
if ($database->query())
{
$pid=$database->insertId();
$database->setQuery("INSERT INTO #__sb_messages_text (mesid,message) VALUES('$pid','$message')");
$database->query();
if ($thread==0){
//if thread was zero, we now know to which id it belongs, so we can determine the thread and update it
$database->setQuery("UPDATE #__sb_messages SET thread='$pid' WHERE id='$pid'");
$database->query();
}
//update the user posts count
if ($my->id != 0){
$database->setQuery("UPDATE #__sb_users SET posts=posts+1 WHERE userid='$my->id'");
$database->query();
}
//Update the attachments table if an image has been attached
if ( $imagelocation != "" && ! $noImgUpload)
{
$database->setQuery("INSERT INTO #__sb_attachments (mesid, filelocation) values ('$pid','$imageLocation')");
if (!$database->query()){
echo "<script> alert('Storing image failed: ".$database->getErrorMsg()."'); </script>\n";
}
}
//Update the attachments table if an file has been attached
if ( $fileLocation != "" && ! $noFileUpload)
{
$database->setQuery("INSERT INTO #__sb_attachments (mesid, filelocation) values ('$pid','$fileLocation')");
if (!$database->query()){
echo "<script> alert('Storing file failed: ".$database->getErrorMsg()."'); </script>\n";
}
}
//Now manage the subscriptions (only if subscriptions are allowed)
if($sbConfig['allowsubscriptions'] == 1) {//they're allowed
//get the proper user credentials for each subscription to this topic
if ($thread==0){
$querythread=$pid;
} else {
$querythread=$thread;
}
//clean up the message
$mailmessage=smile::purify($message);
$database->setQuery("SELECT * FROM #__sb_subscriptions AS a"
. "\n LEFT JOIN #__users as u"
. "\n ON a.userid=u.id "
. "\n WHERE a.thread= '$querythread'");
$subsList=$database->loadObjectList();
//construct a useable URL
$messageUrl=sefRelToAbs($mosConfig_live_site."/index.php?option=com_simpleboard&Itemid=$Itemid&func=view&catid=$catid&id=$pid")."#$pid";
if(count($subsList)>0){//we got more than 0 subscriptions
require_once($sbp.'/sb_mail.php'); // include sbMail class for mailing
foreach($subsList as $subs){
$mailsubject = "$_COM_A_NOTIFICATION $board_title";
$msg = "$subs->name,\n";
$msg .= "$_COM_A_NOTIFICATION1 $board_title forum\n";
$msg .= "Subject: '".stripslashes($messagesubject)."' in Forum: '".stripslashes($catName)."'\n";
$msg .= "Posted by: ". stripslashes($sb_authorname) . "\n\n";
$msg .= "$_COM_A_NOTIFICATION2\n";
$msg .= "URL: $messageUrl\n\n";
$msg .= "Post:\n";
$msg .= stripslashes($mailmessage);
$msg .= "\n\n";
$msg .= "$_COM_A_NOTIFICATION3\n";
$msg .= "\n\n\n\n\n";
$msg .= "** Mambo Simpleboard Forum Component by Jan de Graaff **\n";
$msg .= "** the Two Shoes Mambo Factory - http://www.tsmf.net **";
if($ip != "127.0.0.1" && $my_id != $subs->id){//don't mail yourself
sbMail::send($sbConfig['email'],"Forum at ". $_SERVER['SERVER_NAME'],$subs->email,$mailsubject,$msg);
}
}
}
}
//Now manage the mail for moderators (only if configured)
if($sbConfig['mailmod'] == '1') {//they're configured
//get the proper user credentials for each moderator for this forum
$database->setQuery("SELECT * FROM #__sb_moderation AS a"
. "\n LEFT JOIN #__users AS u"
. "\n ON a.userid=u.id"
. "\n WHERE a.catid=$catid");
$modsList=$database->loadObjectList();
if(count($modsList)>0){//we got more than 0 moderators eligible for email
require_once($sbp.'/sb_mail.php'); // include sbMail class for mailing
foreach($modsList as $mods){
$mailsubject = "$_COM_A_NOTIFICATION $board_title";
$msg = "$mods->name,\n";
$msg .= "$_COM_A_NOT_MOD1 $board_title forum\n";
$msg .= "Subject: '".stripslashes($messagesubject)."' in Forum: '".stripslashes($catName)."'\n";
$msg .= "Posted by: ". stripslashes($sb_authorname) . "\n\n";
$msg .= "$_COM_A_NOT_MOD2\n";
$msg .= "URL: $messageUrl\n\n";
$msg .= "Post:\n";
$msg .= stripslashes($mailmessage);
$msg .= "\n\n";
$msg .= "$_COM_A_NOTIFICATION3\n";
$msg .= "\n\n\n\n\n";
$msg .= "** Mambo Simpleboard Forum Component by TSMF **\n";
$msg .= "** the Two Shoes Mambo Factory - http://www.tsmf.net **";
if($ip != "127.0.0.1" && $my_id != $mods->id){//don't mail yourself
//Send away
sbMail::send($sbConfig['email'],"Forum at ". $_SERVER['SERVER_NAME'],$mods->email,$mailsubject,$msg);
}
}
}
}
//now try adding any new subscriptions if asked for by the poster
if($subscribeMe == 1){
if ($thread==0){$sb_thread=$pid;}else{$sb_thread=$thread;}
$database->setQuery("INSERT INTO #__sb_subscriptions (thread,userid) VALUES ('$sb_thread','$my_id')");
if ($database->query()){
echo _POST_SUBSCRIBED_TOPIC."<br /><br />";
}else{
echo _POST_NO_SUBSCRIBED_TOPIC."<br /><br />";
}
}
if($holdPost==1){
echo _POST_SUCCES_REVIEW.' <a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._GEN_CONTINUE.'</a>.';
}else{
echo '<div align="center">'._POST_SUCCESS_POSTED.'<br /><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&catid='.$catid.'&amp;id='.$pid).'#'.$pid.'">'._POST_SUCCESS_VIEW.'</a><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._POST_SUCCESS_FORUM.'</a><br />';
echo '</div>';
?>
<script language="javascript">
setTimeout("location='<?php echo sefRelToAbs('index.php?option=com_simpleboard&Itemid='.$Itemid.'&func=view&catid='.$catid.'&id='.$pid).'#'.$pid;?>'",3500);
</script>
<?php
}
}
else
{
echo _POST_ERROR_MESSAGE;
}
}?>
</td></tr></table>
<?php
}
else if ($action=="cancel")
{
echo '<br /><br /><div align="center">'._SUBMIT_CANCEL."</div><br />";
echo '<div align="center">'._SUBMIT_CANCEL.'<br /><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&catid='.$catid.'&amp;id='.$pid).'#'.$pid.'">'._POST_SUCCESS_VIEW.'</a><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._POST_SUCCESS_FORUM.'</a><br />';
echo '</div>';
}
else
{
if ($do=="quote")
{//reply do quote
//check if topic isn't locked
if($replyto != 0)
{
$database->setQuery("select thread from #__sb_messages where id='$replyto'");
$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=_GEN_TOPIC;
}else{ //message replied to is the topic post; check if that's locked
$database->setQuery("select locked from #__sb_messages where id='$replyto'");
$topicLock=$database->loadResult();
$lockedWhat=_GEN_TOPIC;
}
if ($topicLock==0){ //topic not locked; check if forum is locked
$database->setQuery("select locked from #__sb_categories where id='$catid'");
$topicLock=$database->loadResult();
$lockedWhat=_GEN_FORUM;
}
}
if (( ($sbConfig['pubwrite']==0 && $my_id != 0)||$sbConfig['pubwrite']==1) && ($topicLock==0 || ($topicLock==1 && $is_moderator)))
{//user is allowed to make a quote
$parentid=0;
$replyto=(int)$replyto;
if ($replyto > 0)
{
$database->setQuery("SELECT #__sb_messages.*,#__sb_messages_text.message FROM #__sb_messages,#__sb_messages_text WHERE id='$replyto' AND mesid='$replyto'");
$database->query();
if ($database->getNumRows() > 0)
{
$database->loadObject($message);
//$message->message=smile::smileReplace($message->message,0, $sbs);
$table = array_flip(get_html_translation_table(HTML_ENTITIES));
$quote = strtr($message->message, $table);
$htmlText = "[b]".stripslashes($message->name)." "._POST_WROTE.":[/b]\n";
$htmlText .= '[quote]'.$quote."[/quote]";
$quote=smile::sbStripHtmlTags($quote);
//$quote=RTESafe_sb(nl2br($quote));
$resubject = strtr($message->subject, $table);
$resubject = strtolower(substr($resubject,0,strlen(_POST_RE)))==strtolower(_POST_RE)?stripslashes($resubject):_POST_RE.stripslashes($resubject);
//$resubject = htmlspecialchars($resubject);
$resubject=smile::sbStripHtmlTags($resubject);
$parentid = $message->id;
$authorName=$my_name;
}
}
?>
<form action="<?php echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='. $Itemid .'>&amp;func=post'); ?>" method="post" name="postform" enctype="multipart/form-data">
<input type="hidden" name="parentid" value="<?php echo $parentid;?>" />
<input type="hidden" name="catid" value="<?php echo $catid;?>" />
<input type="hidden" name="action" value="post" />
<input type="hidden" name="contentURL" value="empty" />
<?php
//get the writing stuff in:
$no_upload="0";//only edit mode should disallow this
include($map.'/components/com_simpleboard/write.html.php');
//--
//echo "</form>";
}
else
{//user is not allowed to write a quote
if ($sbConfig['pubwrite']==1)
{
echo "<p align=\"center\">$lockedWhat "._POST_LOCKED."<br />";
echo _POST_NO_NEW."<br /><br /></p>";
}else{
echo "<p align=\"center\">";
echo _POST_NO_PUBACCESS1."<br />";
echo _POST_NO_PUBACCESS2."<br /><br />";
if ($sbConfig['cb_profile']) {
echo '<a href="'.sefRelToAbs('index.php?option=com_comprofiler&amp;task=registers').'">'._POST_NO_PUBACCESS3.'</a><br /></p>';
} else {
echo '<a href="'.sefRelToAbs('index.php?option=com_registration&amp;task=register').'">'._POST_NO_PUBACCESS3.'</a><br /></p>';
}
}
}
}
else if ($do=="reply")
{// reply no quote
//check if topic isn't locked
if($replyto != 0)
{
$database->setQuery("select thread from #__sb_messages where id='$replyto'");
$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=_GEN_TOPIC;
}else{ //message replied to is the topic post; check if that's locked
$database->setQuery("select locked from #__sb_messages where id='$replyto'");
$topicLock=$database->loadResult();
$lockedWhat=_GEN_TOPIC;
}
}
if ($topicLock==0){ //topic not locked; check if forum is locked
$database->setQuery("select locked from #__sb_categories where id=$catid");
$topicLock=$database->loadResult();
$lockedWhat=_GEN_FORUM;
}
if ((($sbConfig['pubwrite']==0 && $my_id != 0)||$sbConfig['pubwrite']==1) && ($topicLock==0 || ($topicLock==1 && $is_moderator)))
{//user is allowed to make a post
$parentid=0;
$replyto=(int)$replyto;
$setFocus=0;
if ($replyto > 0)
{
$database->setQuery("SELECT #__sb_messages.*,#__sb_messages_text.message FROM #__sb_messages,#__sb_messages_text WHERE id='$replyto' AND mesid='$replyto'");
$database->query();
if ($database->getNumRows() > 0)
{
$database->loadObject($message);
$table = array_flip(get_html_translation_table(HTML_ENTITIES));
$resubject = htmlspecialchars(strtr($message->subject, $table));
$resubject = strtolower(substr($resubject,0,strlen(_POST_RE)))==strtolower(_POST_RE)?stripslashes($resubject):_POST_RE.stripslashes($resubject);
//$resubject = htmlspecialchars($resubject);
//$resubject=smile::sbStripHtmlTags($resubject);
//$resubject = strtolower(substr($message->subject,0,strlen(_POST_RE)))==strtolower(_POST_RE)?stripslashes($message->subject):_POST_RE.stripslashes($message->subject);
//$resubject = htmlspecialchars($resubject);
$parentid = $message->id;
$htmlText="";
}
}
$authorName=$my_name;
?>
<form action="<?php echo sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid . '&amp;func=post'); ?>" method="post" name="postform" enctype="multipart/form-data">
<input type="hidden" name="parentid" value="<?php echo $parentid;?>" />
<input type="hidden" name="catid" value="<?php echo $catid;?>" />
<input type="hidden" name="action" value="post" />
<input type="hidden" name="contentURL" value="empty" />
<?php
//get the writing stuff in:
$no_upload="0";//only edit mode should disallow this
include($map.'/components/com_simpleboard/write.html.php');
//--
//echo "</form>";
}
else
{//user is not allowed to write a post
if ($sbConfig['pubwrite']==1)
{
echo "<p align=\"center\">$lockedWhat "._POST_LOCKED."<br />";
echo _POST_NO_NEW."<br /><br /></p>";
}else{
echo "<p align=\"center\">";
echo _POST_NO_PUBACCESS1."<br />";
echo _POST_NO_PUBACCESS2."<br /><br />";
if ($sbConfig['cb_profile']) {
echo '<a href="'.sefRelToAbs('index.php?option=com_comprofiler&amp;task=registers').'">'._POST_NO_PUBACCESS3.'</a><br /></p>';
} else {
echo '<a href="'.sefRelToAbs('index.php?option=com_registration&amp;task=register').'">'._POST_NO_PUBACCESS3.'</a><br /></p>';
}
}
}
}
else if ($do=="newFromBot")
{// The Mosbot "discuss on forums" has detected an unexisting thread and wants to create one
if ((($sbConfig['pubwrite']==0 && $my_id != 0)||$sbConfig['pubwrite']==1))
{//user is allowed to make a post
$parentid=0;
$replyto=(int)$replyto;
$setFocus=0;
// $resubject = base64_decode($resubject); //per mf#6100 -- jdg 16/07/2005
$resubject = base64_decode(strtr($resubject, "()", "+/"));
$resubject = str_replace("%20"," ",$resubject);
$resubject = preg_replace('/%32/','&',$resubject);
$resubject = preg_replace('/%33/',';',$resubject);
$resubject = preg_replace("/\'/",'&#039;',$resubject);
$resubject = preg_replace("/\"/",'&quot;',$resubject);
//$table = array_flip(get_html_translation_table(HTML_ENTITIES));
//$resubject = strtr($resubject, $table);
$fromBot=1; //this new topic comes from the discuss mambot
$authorName=htmlspecialchars($my_name);
$rowItemid = mosGetParam( $_REQUEST, 'rowItemid', 0 );
if ( $rowItemid ) {
$contentURL=sefRelToAbs('index.php?option=content&task=view&amp;Itemid='.$rowItemid.'&amp;id='.$rowid);
}
else {
$contentURL=sefRelToAbs('index.php?option=content&task=view&amp;Itemid=1&amp;id='.$rowid);
}
$contentURL= _POST_DISCUSS.': [url='.$contentURL.']'.$resubject.'[/url]';
?>
<form action="<?php echo sefRelToAbs("index.php?option=com_simpleboard&amp;Itemid=$Itemid&amp;func=post");?>" method="post" name="postform" enctype="multipart/form-data">
<input type="hidden" name="parentid" value="<?php echo $parentid;?>" />
<input type="hidden" name="catid" value="<?php echo $catid;?>" />
<input type="hidden" name="action" value="post" />
<input type="hidden" name="contentURL" value="<?php echo $contentURL ;?>" />
<?php
//get the writing stuff in:
$no_upload="0";//only edit mode should disallow this
include($map.'/components/com_simpleboard/write.html.php');
//--
//echo "</form>";
}
else
{//user is not allowed to write a post
if ($sbConfig['pubwrite']==1)
{
echo "<p align=\"center\">$lockedWhat "._POST_LOCKED."<br />";
echo _POST_NO_NEW."<br /><br /></p>";
}else{
echo "<p align=\"center\">";
echo _POST_NO_PUBACCESS1."<br />";
echo _POST_NO_PUBACCESS2."<br /><br />";
if ($sbConfig['cb_profile']) {
echo '<a href="'.sefRelToAbs('index.php?option=com_comprofiler&amp;task=registers').'">'._POST_NO_PUBACCESS3.'</a><br /></p>';
} else {
echo '<a href="'.sefRelToAbs('index.php?option=com_registration&amp;task=register').'">'._POST_NO_PUBACCESS3.'</a><br /></p>';
}
}
}
}
else if ($do == "edit") {
$allowEdit=0;
$id=(int)$id;
$database->setQuery("SELECT * FROM #__sb_messages LEFT JOIN #__sb_messages_text ON #__sb_messages.id=#__sb_messages_text.mesid WHERE #__sb_messages.id='$id'");
$message1=$database->loadObjectList();
foreach($message1 as $mes) {
$userID=$mes->userid;
}
//Check for a moderator or superadmin
if ($is_moderator) {
$allowEdit=1;
}
if ($sbConfig['useredit']==1 && $my_id != "" ) {
//Now, if the author==viewer and the viewer is allowed to edit his/her own post the let them edit
if ($my_id == $userID ) {
$allowEdit=1;
}
}
if ($allowEdit==1) {
//we're now in edit mode
$editmode=1;
foreach($message1 as $mes)
{
$htmlText=smile::sbStripHtmlTags($mes->message);
$table = array_flip(get_html_translation_table(HTML_ENTITIES));
$htmlText = strtr($htmlText, $table);
$htmlText=smile::sbHtmlSafe($htmlText);
$resubject=htmlspecialchars(stripslashes($mes->subject));
$authorName=htmlspecialchars($mes->name);
?>
<form action="<?php echo sefRelToAbs("index.php?option=com_simpleboard&Itemid=$Itemid&catid=$catid&func=post"); ?>" method="post" name="postform" enctype="multipart/form-data" />
<input type="hidden" name="id" value="<?php echo $mes->id;?>" />
<input type="hidden" name="do" value="editpostnow" />
<?php
//get the writing stuff in:
//first check if there is an uploaded image or file already for this post (no new ones allowed)
$no_file_upload=0;
$no_image_upload=0;
$database->setQuery("SELECT filelocation FROM #__sb_attachments WHERE mesid='$id'");
$attachments=$database->loadObjectList();
if (count($attachments > 0) ) {
foreach($attachments as $att) {
if (preg_match("&/uploaded/files/&si", $att->filelocation) ){
$no_file_upload="1";
}
if (preg_match("&/uploaded/images/&si", $att->filelocation) ){
$no_image_upload="1";
}
}
} else {
$no_upload="0";
}
include($map.'/components/com_simpleboard/write.html.php');
//echo "</form>";
}
}
else
{ echo "Hacking attempt!";}
}
else if ($do == "editpostnow") {
$database->setQuery("SELECT * FROM #__sb_messages LEFT JOIN #__sb_messages_text ON #__sb_messages.id=#__sb_messages_text.mesid WHERE #__sb_messages.id='$id'");
$message1=$database->loadObjectList();
foreach($message1 as $mes) {
$userid=$mes->userid;
}
//Check for a moderator or superadmin
if ($is_moderator) {
$allowEdit=1;
}
if ($sbConfig['useredit']==1 && $my_id != "" ) {
//Now, if the author==viewer and the viewer is allowed to edit his/her own post the let them edit
if ($my_id == $userid ) {
$allowEdit=1;
}
}
if ($allowEdit==1) {
if ($attachfile != '' ) {
include $sbp.'/file_upload.php';
}
if ($attachimage != '' ) {
include $sbp.'/image_upload.php';
}
$message=trim(htmlspecialchars(addslashes($message)));
if ($sbConfig['editMarkUp']) {
$posttime=time()+($sbConfig['board_ofset']*3600);
$message = $message."<br><br>"._EDIT_BY." ".$my->username.", "._EDIT_AT." ".date(_DATETIME, $posttime);
}
//parse the message for some preliminary bbcode and stripping of HTML
$message = smile::bbencode_first_pass($message);
$id=(int)$id;
$database->setQuery("SELECT id FROM #__sb_messages WHERE id='$id'");
$database->query();
if ($database->getNumRows() > 0)
{
$database->setQuery("UPDATE #__sb_messages SET name='$sb_authorname', email='".addslashes($email)."', subject='".addslashes($subject)."', topic_emoticon='".((int)$topic_emoticon)."' WHERE id='$id'");
$dbr_nameset=$database->query();
$database->setQuery("UPDATE #__sb_messages_text SET message='$message' WHERE mesid='$id'");
if ($database->query() && $dbr_nameset)
{
//Update the attachments table if an image has been attached
if ( $imageLocation != "" )
{
$database->setQuery("INSERT INTO #__sb_attachments (mesid, filelocation) values ('$id','$imageLocation')");
if (!$database->query()){
echo "<script> alert('Storing image failed: ".$database->getErrorMsg()."'); </script>\n";
}
}
//Update the attachments table if an file has been attached
if ( $fileLocation != "" )
{
$database->setQuery("INSERT INTO #__sb_attachments (mesid, filelocation) values ('$id','$fileLocation')");
if (!$database->query()){
echo "<script> alert('Storing file failed: ".$database->getErrorMsg()."'); </script>\n";
}
}
echo '<div align="center">'._POST_SUCCESS_EDIT.'<br /><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&catid='.$catid.'&amp;id='.$id).'#'.$id.'">'._POST_SUCCESS_VIEW.'</a><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._POST_SUCCESS_FORUM.'</a><br />';
echo '</div>';
}
else
echo _POST_ERROR_MESSAGE_OCCURED;
}
else
{
echo _POST_INVALID;
}
}else{echo ("Hacking attempt");}
}
else if ($do == "delete")
{
if(!$is_moderator){ die("Hacking Attempt!");}
$id=(int)$id;
$database->setQuery("SELECT * FROM #__sb_messages WHERE id=$id");
$message=$database->loadObjectList();
foreach ($message as $mes)
{
?>
<form action="<?php echo sefRelToAbs("index.php?option=com_simpleboard&Itemid=$Itemid&catid=$catid&func=post"); ?>" method="post" name="myform">
<input type="hidden" name="do" value="deletepostnow" />
<input type="hidden" name="id" value="<?php echo $mes->id;?>" />
<?php echo _POST_ABOUT_TO_DELETE;?>: <strong><?php echo stripslashes(htmlspecialchars($mes->subject));?></strong>.<br /><br />
<?php echo _POST_ABOUT_DELETE;?><br /><br />
<input type="checkbox" checked name="delAttachments" value="delAtt" /> <?php echo _POST_DELETE_ATT;?>
<br /><br />
<a href="javascript:document.myform.submit();"><?php echo _GEN_CONTINUE;?></a>
| <a href="<?php echo sefRelToAbs("index.php?option=com_simpleboard&amp;Itemid=$Itemid&amp;func=view&catid=$catid;&amp;id=$id");?>"><?php echo _GEN_CANCEL;?></a>
</form>
<?php
}
}
else if ($do == "deletepostnow")
{
if(!$is_moderator){ die("Hacking Attempt!");}
$sqlError="";
$id=(int)$id;
$database->setQuery("SELECT parent,thread,subject FROM #__sb_messages WHERE id=$id");
$message=$database->loadObjectList();
foreach($message as $mes)
{
$thread=$mes->thread;
$removechildren=(int)$removechildren;
if ($mes->parent==0)
{
// this is the forum topic; if removed, all children must be removed as well.
//first select all children ids that belong to this topic.. we need them later on
//to delete the message bodies belonging to them
$database->setQuery("SELECT id FROM #__sb_messages WHERE thread=$id");
//$childlist=$database->loadObjectList();
$children=implode(",",$database->loadResultArray());
$database->setQuery("DELETE FROM #__sb_messages WHERE id=$id");
if (!$database->query())
$sqlError="Could not delete the Topic post - nothing else deleted";
else
{//Topic post deleted, now the rest
$database->setQuery("DELETE FROM #__sb_messages WHERE thread=$id");
if (!$database->query())
$sqlError="Could not delete child posts, but Topic post was deleted. Update the database manually.";
else
{
$database->setQuery("DELETE FROM #__sb_messages_text WHERE mesid=$id");
if (!$database->query())
$sqlError="Could not delete the text of the Topic post. Update the database manually.";
$database->setQuery("DELETE FROM #__sb_messages_text WHERE mesid IN ($children)");
if (!$database->query())
$sqlError="Could not delete childs posts texts. Everything else deleted. Update the database manually.";
if ($delAttachments=="delAtt")
{//delete all attachments
$query="SELECT filelocation FROM #__sb_attachments WHERE mesid IN ($children)";
$database->setQuery($query);
$fileList=$database->loadObjectList();
if (count($fileList)>0){
foreach ($fileList as $fl){
unlink($fl->filelocation);
}
$database->setQuery("DELETE FROM #__sb_attachments WHERE mesid IN ($children)");
$database->query();
}
}
}
}
} // fi ($mes->parent==0)
else
{//this is not the Topic post, so delete it and promote the direct children one level up in
//the hierarchy
$thread=$mes->thread;
$database->setQuery("UPDATE #__sb_messages SET parent='$mes->parent' WHERE parent='$id'");
if (!$database->query()) {$sqlError="Could not promote children in post hierarchy. Nothing deleted.";}
else {
$database->setQuery("DELETE FROM #__sb_messages WHERE id='$id'");
if (!$database->query()) { $sqlError="Could not delete the post. Try again.";}
else {
$database->setQuery("DELETE FROM #__sb_messages_text WHERE mesid='$id'");
if (!$database->query()) { $sqlError="Could not delete the posts text. Post itself is deleted. Update the database manually.";}
}
if ($delAttachments=="delAtt")
{//delete all attachments
$database->setQuery("SELECT filelocation FROM #__sb_attachments WHERE mesid=$id");
$fileList=$database->loadObjectList();
if (count($fileList)>0){
foreach ($fileList as $fl){
unlink($fl->filelocation);
}
$database->setQuery("DELETE FROM #__sb_attachments WHERE mesid=$id");
$database->query();
}
}
}
}
//Now, check for errors:
if ($sqlError=="")
{
echo '<div align="center">'._POST_SUCCESS_DELETE.'<br /><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&catid='.$catid.'&amp;id='.$thread).'">'._POST_SUCCESS_VIEW.'</a><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._POST_SUCCESS_FORUM.'</a><br />';
echo '</div>';
?>
<script language="javascript">
setTimeout("location='<?php echo $mls;?>/index.php?option=com_simpleboard&Itemid=<?php echo $Itemid;?>&func=showcat&catid=<?=$catid;?>'",3500);
</script>
<?php
}
else
{
echo _POST_ERROR_TOPIC."<br />";
echo "$sqlError";
}
}//foreach($message as $mes
}//fi $do==deletepostnow
else if ($do == "move")
{
if(!$is_moderator){ die("Hacking Attempt!");}
$catid=(int)$catid;
$id=(int)$id;
//get list of available forums
//$database->setQuery("SELECT id,name FROM #__sb_categories WHERE parent != '0'");
$database->setQuery( "SELECT a.*, b.name AS category"
. "\nFROM #__sb_categories AS a"
. "\nLEFT JOIN #__sb_categories AS b ON b.id = a.parent"
. "\nWHERE a.parent != '0'"
. "\nORDER BY parent, ordering");
$catlist=$database->loadObjectList();
// get topic subject:
$database->setQuery("select subject from #__sb_messages where id=$id");
$topicSubject=$database->loadResult();
?>
<form action="<?php echo sefRelToAbs("index.php?option=com_simpleboard&Itemid=$Itemid&func=post"); ?>" method="post" name="myform">
<input type="hidden" name="do" value="domovepost" />
<input type="hidden" name="id" value="<?php echo $id;?>" />
<p><?php echo _GEN_TOPIC;?>: <strong><?php echo $topicSubject;?></strong><br /><br />
<?php echo _POST_MOVE_TOPIC;?>:<br />
<select name="catid" size="4">
<?php
foreach ($catlist as $cat)
{
echo "<OPTION value=\"$cat->id\" > $cat->category/$cat->name </OPTION>";
}?>
</select><br /><br />
<input type="submit" class="button" value="<?php echo _GEN_MOVE;?>" />
</form>
<?php
}
else if ($do == "domovepost")
{
if(!$is_moderator){ die("Hacking Attempt!");}
$catid=(int)$catid;
$id=(int)$id;
//get the some details from the original post for later
$database->setQuery("SELECT `subject`, `catid`, `time` AS timestamp FROM #__sb_messages WHERE `id`='$id'");
$oldRecord=$database->loadObjectList();
$newSubject=_MOVED_TOPIC." ".$oldRecord[0]->subject;
$database->setQuery("SELECT MAX(time) AS timestamp FROM #__sb_messages WHERE `thread`='$id'");
$lastTimestamp=$database->loadResult();
if ($lastTimestamp == "") { $lastTimestamp = $oldRecord[0]->timestamp; }
//perform the actual move
//Move topic post first
$database->setQuery("UPDATE #__sb_messages SET `catid`='$catid' WHERE `id`='$id'");
if ($database->query())
{ //succeeded; move the rest of the thread if exists
$database->setQuery("UPDATE #__sb_messages set `catid`='$catid' WHERE `thread`='$id'");
if ($database->query())
{
//okay, now try to insert a 'Moved topic' notification post entry in the 'old' forum
$database->setQuery("INSERT INTO #__sb_messages (`parent`, `subject`, `time`, `catid`, `moved`) VALUES ('0','$newSubject','".$lastTimestamp."','".$oldRecord[0]->catid."','1')");
if ($database->query() ) {
//determine the new location for link composition
$newId=$database->insertid();
$newURL = "catid=".$catid."&id=".$id;
$database->setQuery("INSERT INTO #__sb_messages_text (`mesid`, `message`) VALUES ('$newId', '$newURL')");
if (! $database->query() ) { $database->stderr(true); }
//and update the thread id on the 'moved' post for the right ordering when viewing the forum..
$database->setQuery("UPDATE #__sb_messages SET `thread`='$newId' WHERE `id`='$newId'");
if (! $database->query() ) { $database->stderr(true); }
}
//move succeeded
echo '<div align="center">'._POST_SUCCESS_MOVE.'<br /><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&catid='.$catid.'&amp;id='.$id).'#'.$id.'">'._POST_SUCCESS_VIEW.'</a><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._POST_SUCCESS_FORUM.'</a><br />';
echo '</div>';
?>
<script language="javascript">
setTimeout("location='<?php echo $mls;?>/index.php?option=com_simpleboard&Itemid=<?php echo $Itemid;?>&func=view&catid=<?=$catid;?>&id=<?=$id;?>'",3500);
</script>
<?php
}
else
{
echo "Severe database error. Update your database manually so the replies to the topic are matched to the new forum as well";
//this is severe.. takes a lot of coding to programatically correct it. Won't do that.
//chances of this happening are very slim. Disclaimer: this is software as-is *lol*;
//go read the GPL and the header of this file..
}
}
else
{?>
<?php echo _POST_TOPIC_NOT_MOVED;?> <a href="index.php?option=com_simpleboard&amp;Itemid=<?php echo $Itemid;?>&amp;func=view&catid=<?php echo $catid;?>&amp;id=<?php echo $id;?>"><?php echo _POST_CLICK;?></a>
<?php
}
}
else if ($do == "subscribe")
{
$catid=(int)$catid;
$id=(int)$id;
$database->setQuery("INSERT INTO #__sb_subscriptions (thread,userid) VALUES ('$sb_thread','$my_id')");
if ($database->query()){
echo _POST_SUBSCRIBED_TOPIC."<br /><br />";
}else{
echo _POST_NO_SUBSCRIBED_TOPIC."<br /><br />";
}
echo '<div align="center">'._POST_SUCCESS_SUBSCRIBE.'<br /><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&catid='.$catid.'&amp;id='.$pid).'#'.$pid.'">'._POST_SUCCESS_VIEW.'</a><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._POST_SUCCESS_FORUM.'</a><br />';
echo '</div>'; ?>
<script language="javascript">
setTimeout("location='<?php echo $mls;?>/index.php?option=com_simpleboard&Itemid=<?php echo $Itemid;?>&func=userprofile&do=show'",3500);
</script>
<?php
}
else if ($do == "sticky")
{
if(!$is_moderator){ die("Hacking Attempt!");}
$database->setQuery("update #__sb_messages set ordering=1 where id=$id");
if ($database->query()){
echo '<p align="center">'._POST_STICKY_SET.'<br /><br />';
}else{
echo '<p align="center">'._POST_STICKY_NOT_SET.'<br /><br />';
}
echo '<div align="center">'._POST_SUCCESS_REQUEST2.'<br /><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&catid='.$catid.'&amp;id='.$id).'#'.$id.'">'._POST_SUCCESS_VIEW.'</a><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._POST_SUCCESS_FORUM.'</a><br />';
echo '</div>';
?>
<script language="javascript">
setTimeout("location='<?php echo $mls;?>/index.php?option=com_simpleboard&Itemid=<?php echo $Itemid;?>&func=view&catid=<?=$catid;?>&id=<?=$id;?>'",3500);
</script>
<?php
}
else if ($do == "unsticky")
{
if(!$is_moderator){ die("Hacking Attempt!");}
$database->setQuery("update #__sb_messages set ordering=0 where id=$id");
if ($database->query()){
echo '<p align="center">'._POST_STICKY_UNSET.'<br /><br />';
}else{
echo '<p align="center">'._POST_STICKY_NOT_UNSET.'<br /><br />';
}
echo '<div align="center">'._POST_SUCCESS_REQUEST2.'<br /><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&catid='.$catid.'&amp;id='.$id).'#'.$id.'">'._POST_SUCCESS_VIEW.'</a><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._POST_SUCCESS_FORUM.'</a><br />';
echo '</div>'; ?>
<script language="javascript">
setTimeout("location='<?php echo $mls;?>/index.php?option=com_simpleboard&Itemid=<?php echo $Itemid;?>&func=view&catid=<?=$catid;?>&id=<?=$id;?>'",3500);
</script>
<?php
}
else if ($do == "lock")
{
if(!$is_moderator){ die("Hacking Attempt!");}
//lock topic post
$database->setQuery("update #__sb_messages set locked=1 where id=$id");
if ($database->query()){
echo '<p align="center">'._POST_LOCK_SET.'<br /><br />';
}else{
echo '<p align="center">'._POST_LOCK_NOT_SET.'<br /><br />';
}
echo '<div align="center">'._POST_SUCCESS_REQUEST2.'<br /><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&catid='.$catid.'&amp;id='.$id).'#'.$id.'">'._POST_SUCCESS_VIEW.'</a><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._POST_SUCCESS_FORUM.'</a><br />';
echo '</div>';
?>
<script language="javascript">
setTimeout("location='<?php echo $mls;?>/index.php?option=com_simpleboard&Itemid=<?php echo $Itemid;?>&func=view&catid=<?=$catid;?>&id=<?=$id;?>'",3500);
</script>
<?php
}
else if ($do == "unlock")
{
if(!$is_moderator){ die("Hacking Attempt!");}
$database->setQuery("update #__sb_messages set locked=0 where id=$id");
if ($database->query()){
echo '<p align="center">'._POST_LOCK_UNSET.'<br /><br />';
}else{
echo '<p align="center">'._POST_LOCK_NOT_UNSET.'<br /><br />';
}
echo '<div align="center">'._POST_SUCCESS_REQUEST2.'<br /><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=view&catid='.$catid.'&amp;id='.$id).'#'.$id.'">'._POST_SUCCESS_VIEW.'</a><br />';
echo '<a href="'.sefRelToAbs('index.php?option=com_simpleboard&amp;Itemid='.$Itemid.'&amp;func=showcat&catid='.$catid).'">'._POST_SUCCESS_FORUM.'</a><br />';
echo '</div>'; ?>
<script language="javascript">
setTimeout("location='<?php echo $mls;?>/index.php?option=com_simpleboard&Itemid=<?php echo $Itemid;?>&func=view&catid=<?=$catid;?>&id=<?=$id;?>'",3500);
</script>
<?php
}
}
?>
</td>
</tr>
</table>
<?php
function listThreadHistory($id,$sbConfig, $database, $sbs)
{
if($id != 0)
{
//get the parent# for the post on which 'reply' or 'quote' is chosen
$database->setQuery("SELECT parent FROM #__sb_messages WHERE id='$id'");
$this_message_parent = $database->loadResult();
//Get the thread# for the same post
$database->setQuery("SELECT thread FROM #__sb_messages WHERE id='$id'");
$this_message_thread = $database->loadResult();
//determine the correct thread# for the entire thread
if ($this_message_parent==0)
{$thread=$id;} else {$thread=$this_message_thread;}
//get all the messages for this thread
$database->setQuery("SELECT * FROM #__sb_messages LEFT JOIN #__sb_messages_text ON #__sb_messages.id=#__sb_messages_text.mesid WHERE thread='$thread' OR id='$thread' AND hold = 0 ORDER BY time DESC LIMIT ".$sbConfig['historyLimit']);
$messages=$database->loadObjectList();
//and the subject of the first thread (for reference)
$database->setQuery("SELECT subject FROM #__sb_messages WHERE id='$thread' and parent=0");
$this_message_subject = $database->loadResult();
echo "<b>"._POST_TOPIC_HISTORY.":</b> ".htmlspecialchars($this_message_subject)." <br />"._POST_TOPIC_HISTORY_MAX." $historyLimit "._POST_TOPIC_HISTORY_LAST."<br />";
?>
<table border="0" cellspacing="1" cellpadding="3" width="100%" class="sb_review_table">
<tr>
<td class="sb_review_header" width="20%" align="center"><strong><?php echo _GEN_AUTHOR;?></strong></td>
<td class="sb_review_header" align="center"><strong><?php echo _GEN_MESSAGE;?></strong></td>
</tr>
<?php
$k=0;
foreach($messages as $mes)
{
$k = 1-$k;
$mes->name = htmlspecialchars($mes->name);
$mes->email = htmlspecialchars($mes->email);
$mes->subject = htmlspecialchars($mes->subject);
$mes->message = smile::smileReplace($mes->message,1, $sbs, $sbConfig['disemoticons']);
?>
<tr>
<td class="sb_review_body<?php echo $k;?>" valign="top"><?php echo stripslashes($mes->name);?></td>
<td class="sb_review_body<?php echo $k;?>">
<?php
$sb_message_txt = stripslashes(nl2br($mes->message));
$sb_message_txt = str_replace("</P><br />","</P>", $sb_message_txt );
//Long Words Wrap:
$sb_message_txt = smile::htmlwrap($sb_message_txt, $sbConfig['wrap']);
if ($sbConfig['badwords']) {
$badwords = Badword::filter($sb_message_txt, $my);
if ($badwords == "true") {
$sb_message_txt = _COM_A_BADWORDS_NOTICE ;
}
}
echo $sb_message_txt;
?>
</td>
</tr>
<?php }
?>
</table><?php
}//else: this is a new topic so there can't be a history
}
?>