getName(); if ($my->id > 0) { $my_name = $sbConfig['username'] ? $my->username : $my->name; $my_email= $my->email; } else { $my_name = ''; $my_email= ''; } // permissions check switch (sb_has_post_permission($database,$catid,$replyto,$my->id,$sbConfig['pubwrite'],$is_moderator)) { case 0: echo "
";
echo _POST_NO_PUBACCESS1."
";
echo _POST_NO_PUBACCESS2."
";
if ($sbConfig['cb_profile']) {
echo ''._POST_NO_PUBACCESS3.'
' . _GEN_TOPIC ._POST_LOCKED.'
';
echo _POST_NO_NEW.'
' . _GEN_FORUM ._POST_LOCKED.'
';
echo _POST_NO_NEW.'
'._SUBMIT_CANCEL." "; echo ''; } else { if ($do=="quote") {//reply do quote $parentid=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); //$message->message=smile::smileReplace($message->message,0); $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; } } ?> "; } else if ($do == "editpostnow") { $database->setQuery("SELECT userid FROM #__sb_messages WHERE id='$id'"); $userid=$database->loadResult(); // Check permission $allowEdit=0; if ($is_moderator) { $allowEdit=1; } elseif ($sbConfig['useredit']==1 && $my->id >0 && $my->id == $userid ) { $allowEdit=1; } if (!$allowEdit) { echo ' Hacking attempt! '; return; } if ($attachfile != '' ) { include JB_ABSPATH.'/file_upload.php'; } if ($attachimage != '' ) { include JB_ABSPATH.'/image_upload.php'; } $message = isset($_POST['message']) ? trim($_POST['message']) : ''; $message=trim(htmlspecialchars(addslashes($message))); if ($sbConfig['editMarkUp']) { $posttime=time()+($sbConfig['board_ofset']*3600); $message = $message.""._EDIT_BY." ".$my_name.", "._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 "\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 "\n"; } } echo ''; } else echo _POST_ERROR_MESSAGE_OCCURED; } else { echo _POST_INVALID; } } 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) { ?> '; echo 'Could not promote children in post hierarchy. Nothing deleted.'; break; case -2: echo _POST_ERROR_TOPIC.' '; echo 'Could not delete the post(s) - nothing else deleted'; break; case -3: echo _POST_ERROR_TOPIC.' '; echo 'Could not delete the texts of the post(s). Update the database manually (mesid='.$id.').'; break; case -4: echo _POST_ERROR_TOPIC.' '; echo 'Everything deleted, but failed to update user post stats!'; break; case -5: echo _POST_ERROR_TOPIC.' '; echo 'Could not delete the poll. Update the database manually.'; break; default: echo ' '._POST_SUCCESS_DELETE.' ';
echo '';
break;
}
}//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();
?>
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())
{
// insert 'moved topic' notification in old forum if needed
if ($bool_leaveGhost) {
$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); }
}
else
echo ''; if ($do=='deletepostnow') echo ''._POST_SUCCESS_VIEW.' '; echo ''._POST_SUCCESS_FORUM.' '; echo ' '._POST_GHOST_FAILED.' '; } //move succeeded echo ''; ?> setQuery("INSERT INTO #__sb_subscriptions (thread,userid) VALUES ('$sb_thread','$my_id')"); if ($database->query()){ echo _POST_SUBSCRIBED_TOPIC.""; }else{ echo _POST_NO_SUBSCRIBED_TOPIC." "; } echo ''; ?> setQuery("update #__sb_messages set ordering=1 where id=$id"); if ($database->query()){ echo ' '._POST_STICKY_SET.' '._POST_STICKY_NOT_SET.' '._POST_STICKY_UNSET.' '._POST_STICKY_NOT_UNSET.' '._POST_LOCK_SET.' '._POST_LOCK_NOT_SET.' '._POST_LOCK_UNSET.' '._POST_LOCK_NOT_UNSET.' |
| name);?> |
message);
$sb_message_txt = str_replace(" ","", $sb_message_txt ); //Long Words Wrap: $sb_message_txt = smile::htmlwrap($sb_message_txt, $sbConfig['wrap']); echo $sb_message_txt; ?> |