/*
# UBB.threads, Version 6
# Official Release Date for UBB.threads Version6: 06/05/2002
# First version of UBB.threads created July 30, 1996 (by Rick Baker).
# This entire program is copyright Groupee, Inc., 2005.
# For more info on UBB.threads and other Groupee Services
# visit http://www.groupee.com/ & http://www.ubbcentral.com/
# Program Author: Rick Baker.
# File Version 6.5.5
# You may not distribute this program in any manner, modified or otherwise,
# without the express, written written consent from Groupee, Inc..
# Note: if you modify ANY code within UBB.threads, we at Groupee, Inc.
# cannot offer you support-- thus modify at your own peril :)
# ---------------------------------------------------------------------------
*/
// Require the library
require ("./includes/main.inc.php");
require ("languages/{$_SESSION['myprefs']['language']}/newreply.php");
// -------------
// Get the input
$Cat = get_input("Cat","get","cat");
$Board = get_input("Board","get","alphanum");
$Number = get_input("Number","get","int");
$page = get_input("page","get","int");
$what = get_input("what","get","alpha");
$fpart = get_input("fpart","get","alphanum");
$vc = get_input("vc","get","int");
$q = get_input("q","get","int");
// ------------------------
// Predefine some variables
$choosename = "";
$Pselected = "";
$canattach = "";
// -----------------
// Get the user info
$userob = new user;
$user = $userob -> authenticate("U_EReplies,U_TextCols,U_TextRows,U_Preview,U_Groups,U_FloodControl,U_LastPostTime");
$Username = $user['U_Username'];
if (!$_SESSION['myprefs']['language']) {
$_SESSION['myprefs']['language']= $config['language'];
}
// ------------------
// Check for any bans
$html = new html;
$userob -> check_ban();
// Flood control settings
if (!empty($user['U_FloodControl'])) {
if ($user['U_FloodControl'] == "-1") {
$floodcontrol = $config['floodcontrol'];
}
else {
$floodcontrol = $user['U_FLoodControl'];
}
}
// ----------------------------------------------
// Let's get the groups and default flood control
if (!$user['U_Groups']) {
$user['U_Groups'] = "-4-";
$floodcontrol = $config['floodcontrol'];
$lastposttime = get_input("lastposttime","cookie");
}
// Check if they can make a post yet
if ($user['U_Status'] != "Administrator" && $user['U_Status'] != "Moderator") {
if (($html->get_date() - $lastposttime) < $floodcontrol) {
$ubbt_lang['FLOODCONTROL'] = sprintf($ubbt_lang['FLOODCONTROL'],$config['floodcontrol']);
$html->not_right($ubbt_lang['FLOODCONTROL']);
}
}
// -----------------------------------------------------
// Let's find out if they get the default preview or not.
$Preview = "";
isset($user['U_Preview']) && $Preview = $user['U_Preview'];
if (!$Preview) {
$Preview = $config['preview'];
}
if ( ($Preview == 1) || ($Preview == "on") ){
$Pselected = "checked=\"checked\"";
}
!empty($user['U_TextCols']) && $TextCols = $user['U_TextCols'];
!empty($user['U_TextRows']) && $TextRows = $user['U_TextRows'];
if (!isset($TextCols)) { $TextCols = $theme['TextCols']; }
if (!isset($TextRows)) { $TextRows = $theme['TextRows']; }
// -----------------
// Get the post info
$Number = addslashes($Number);
$query = "
SELECT t2.U_Username,t1.B_Main,t1.B_Subject,t1.B_Body,t1.B_Approved,t2.U_Number,t1.B_Board
FROM {$config['tbprefix']}Posts AS t1,
{$config['tbprefix']}Users AS t2
WHERE t1.B_Number = '$Number'
AND t2.U_Number = t1.B_Posterid
";
$sth = $dbh -> do_query($query,__LINE__,__FILE__);
// ---------------
// Assign the stuff
list($ResUsername,$Main,$Subject,$Body,$Approved,$ParentUser,$Board) = $dbh -> fetch_array($sth);
$Board_q = addslashes($Board);
$dbh -> finish_sth($sth);
if (!$Subject && $Subject != "0") {
exit;
}
// Check to see if they can reply to this thread
$query = "
SELECT B_Sticky,B_Status
FROM {$config['tbprefix']}Posts
WHERE B_Number='$Main'
";
$sth = $dbh->do_query($query,__LINE__,__FILE__);
list($issticky,$bstatus) = $dbh->fetch_array($sth);
if ($issticky == "2" && ($user['U_Status'] != "Administrator")) {
$html->not_right($ubbt_lang['NO_R_ANNOUNCE'],$Cat);
}
// ---------------------------------------------------------------------------
// If this thread is locked and they are not a admin or mod they can't proceed
if ( ($bstatus != "O" && $bstatus != "") && ($user['U_Status'] != "Administrator") && ($user['U_Status'] != "Moderator") ){
$html -> not_right($ubbt_lang['LOCKED'],$Cat);
}
if ($ResUsername == "**DONOTDELETE**") {
$ResUsername = $ubbt_lang['ANON_TEXT'];
}
// -----------------------------------------------------
// Make sure we only put one Re: in front of the subject
if (!preg_match("/^Re:/",$Subject)){
$Subject = "Re: ".$Subject;
}
// ---------------------------------------------------------------
// If we are quoting then we need to wrap the body in quote markup
$QuoteBody = "";
if ($q == 1) {
$QuoteBody = $html -> undo_markup($Body);
$QuoteBody = str_replace("
","\n",$QuoteBody);
$QuoteBody = "[{$ubbt_lang['TEXT_QUOTE']}]$QuoteBody [/{$ubbt_lang['TEXT_QUOTE']}]";
}
// ----------------------
// Convert "'s to "
$Subject = str_replace("\"",""",$Subject);
$Body = str_replace("\"",""",$Body);
// --------------------------------------------------------------
// Let's make sure they are supposed to be making replies here
$Grouparray = split("-",$user['U_Groups']);
$gsize = sizeof($Grouparray);
$groupquery = "AND (";
$g = 0;
for ($i=0; $i<=$gsize;$i++) {
if (!isset($Grouparray[$i])) { continue; }
if (!preg_match("/[0-9]/",$Grouparray[$i])) { continue; };
$g++;
if ($g > 1) {
$groupquery .= " OR ";
}
$groupquery .= "Bo_Reply_Perm LIKE '%-$Grouparray[$i]-%'";
}
$groupquery .= ")";
// ------------------
// Get the board info
$query = "
SELECT Bo_Title,Bo_HTML,Bo_Markup,Bo_Read_Perm,Bo_SpecialHeader,Bo_StyleSheet
FROM {$config['tbprefix']}Boards
WHERE Bo_Keyword = '$Board_q'
AND Bo_Active = '1'
$groupquery
";
$sth = $dbh -> do_query($query,__LINE__,__FILE__);
// ----------------
// Assign the stuff
list($Title,$HTML,$Markup,$ReadPerm,$fheader,$fstyle) = $dbh -> fetch_array($sth);
$dbh -> finish_sth($sth);
// -------------------------------------------------
// Here we need to figure out what stylesheet to use
$mystyle = "";
isset($user['U_StyleSheet']) && $mystyle = $user['U_StyleSheet'];
if (!$mystyle) { $mystyle = "usedefault"; }
if ($mystyle == "usedefault") {
$mystyle = $fstyle;
if ($mystyle == "usedefault") {
$mystyle = $theme['stylesheet'];
}
}
// fstyle will now be a global variable to use in send_header
$fstyle = $mystyle;
// ----------------------------------------------------------
// Find out if they are supposed to be replying on this board
if (!$Title) {
$html -> not_right($ubbt_lang['READ_PERM'],$Cat);
}
if (isset(${$config['cookieprefix']."ubbt_pass"})) {
if (${$config['cookieprefix']."ubbt_pass"} == "invalid") {
if (!$config['under13']) {
$html -> not_right($ubbt_lang['UNDERAGE'],$Cat);
} else {
$html -> not_right($ubbt_lang['NO_COPPA'],$Cat);
}
}
}
// ------------------------------------------------------
// IF This post isn't approved yet, you can't reply to it
if ($Approved == "no") {
$html -> not_right($ubbt_lang['NOT_APP'],$Cat);
}
// ---------------
// Send the header
$Extra = $Number. "_SEP_" .$Subject;
$html -> send_header("{$ubbt_lang['REPLY_HEAD']} ($Subject)",$Cat,0,$user,$Board,$ReadPerm,'0',$Extra);
// -------------------------------
// Check if HTML is enabled or not
if($HTML == "Off") {
$htmlstatus = " {$ubbt_lang['NO_HTML']}";
}
else {
$htmlstatus = " {$ubbt_lang['YES_HTML']}";
}
// --------------------------------------------
// Markup is disabled, so we better let them know
if($Markup == "Off"){
$markupstatus = " {$ubbt_lang['NO_MARKUP']}";
}
else {
$markupstatus = " {$ubbt_lang['YES_MARKUP']} {$ubbt_lang['MARK_POSTS']}.";
}
// -------------------------------------------------------------------------
// If we are allowing anonymous users to choose a name to post under, we let
// them know here.
if ( ($config['anonnames']) && (!$Username) ) {
$choosename = " {$ubbt_lang['CHOOSE_NAME']}";
}
// ----------------------------------------------------------------------
// If The Guest group can post here then we set the Username to Anonymous
// and we set the reged flag to "n";
$Reged = 'y';
if (!$Username) {
$postername = $ubbt_lang['ANON_TEXT'];
$Reged = 'n';
}
else {
$postername = $user['U_Username'];
}
// ---------------------
// Can they post a poll?
if ( ($config['allowpolls'] == 1) || ($user['U_Status'] == "Administrator") || ($user['U_Status'] == "Moderator") ) {
$makepoll = "
{$ubbt_lang['ADDPOLL']}
";
}
$addtofav = "";
if ($postername != $ubbt_lang['ANON_TEXT']) {
$addtofav = "
{$ubbt_lang['ADDTOFAV']}
";
}
if ( ($postername == $ubbt_lang['ANON_TEXT']) && ($config['anonnames']) ) {
$postname = "";
}
else {
$postname = "$postername";
$postname .= "";
}
$iconselect = $html -> icon_select();
$instant_ubbcode = $html -> instant_ubbcode();
// -------------------------------------
// What options do they have for posting
if ( ($config['markupoption'] == 1) || ($user['U_Status'] == "Administrator") || ($user['U_Status'] == "Moderator") ) {
$markupselect = "{$ubbt_lang['MAKE_POST']}
";
$markupselect .= "
";
}
// ------------------------------------
// No options, we use the board default
else {
if ( ($HTML == "Off") && ($Markup == "On") ) {
$markupselect = "";
}
elseif ( ($HTML == "On") && ($Markup == "On") ) {
$markupselect ="";
}
elseif ( ($HTML == "Off") && ($Markup == "Off") ) {
$markupselect ="";
}
else {
$markupselect = "";
}
}
$formmethod = "