/*
# 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']}/newpost.php");
// -------------
// Get the input
$Cat = get_input("Cat","get","cat");
$Board = get_input("Board","get","alphanum");
$page = get_input("page","get","int");
$what = get_input("what","get","alpha");
// -------------------------
// Predefine a few variables
$Pselected = "";
$choosename = "";
$canattach = "";
// -----------------
// Get the user info
$userob = new user;
$user = $userob -> authenticate("U_EReplies,U_TextCols,U_TextRows,U_Preview,U_Groups, U_Display,U_FloodControl,U_LastPostTime");
// If the user is a moderator, grab the mod perms
if ($user['U_Status'] == "Moderator") {
$modperms = $userob->get_mod_perms($user['U_Number']);
}
else {
$modperms = array();
}
$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'];
}
}
$lastposttime = $user['U_LastPostTime'];
// -----------------------------------------------
// Let's get the groups and flood control settings
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.
isset($user['U_Preview']) && $Preview = $user['U_Preview'];
if (!isset($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']; }
// --------------------------------------------------------------
// Let's make sure they are supposed to be making posts 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_Write_Perm LIKE '%-$Grouparray[$i]-%'";
}
$groupquery .= ")";
// ------------------
// Get the board info
$Board_q = addslashes($Board);
$query = "
SELECT Bo_Title,Bo_HTML,Bo_Markup,Bo_SpecialHeader,Bo_StyleSheet
FROM {$config['tbprefix']}Boards
WHERE Bo_Keyword = '$Board_q'
$groupquery
";
$sth = $dbh -> do_query($query,__LINE__,__FILE__);
// ----------------
// Assign the stuff
list($Title,$HTML,$Markup,$fheader,$fstyle) = $dbh -> fetch_array($sth);
$dbh -> finish_sth($sth);
// ----------------------------------
// Grab all moderators for this board
$ismod = "no";
$query = "
SELECT t1.Mod_Uid,t2.U_Username
FROM {$config['tbprefix']}Moderators AS t1,
{$config['tbprefix']}Users AS t2
WHERE t1.Mod_Board='$Board_q'
AND t1.Mod_Uid = t2.U_Number
";
$sth = $dbh -> do_query($query,__LINE__,__FILE__);
$moderatorlist = ",";
while (list($modid,$modname) = $dbh -> fetch_array($sth)) {
$moderator[$modid] = $modname;
$moderatorlist .="$modid,";
}
if ((preg_match("/(,|^){$user['U_Number']}(,|$)/i",$moderatorlist)) &&($user['U_Number'])) {
$ismod = "yes";
}
// -------------------------------------------------
// 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);
}
}
}
// ---------------
// Send the header
$html -> send_header("{$ubbt_lang['MAKENEW_HEAD']} ($Title)",$Cat,0,$user,$Board);
// -------------------------------
// 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 = $Username;
}
$addtofav = "";
$makepoll = "";
$addevent = "";
$selectday = "";
$selectmonth = "";
$selectyear = "";
// ---------------------
// Can they post a poll?
if ( ($config['allowpolls'] == 1) || ($user['U_Status'] == "Administrator") || ($user['U_Status'] == "Moderator") ) {
$makepoll = "
{$ubbt_lang['ADDPOLL']}
";
}
if ($postername != $ubbt_lang['ANON_TEXT']) {
$addtofav = "
{$ubbt_lang['ADDTOFAV']}
";
// ----------------------------------------------------
// Can they add an event to the calendar for this post?
if ( ($config['publicevents'] == 1 && $user['U_Status'] == "Administrator")
|| ($config['publicevents'] == 2 && ($user['U_Status'] == "Administrator" || $user['U_Status'] == "Moderator") )
|| ($config['publicevents'] == 3) ) {
$addevent = "
{$ubbt_lang['ADDEVENT']}
";
$selectday = "";
$selectyear = "
";
}
}
if ( ($postername == $ubbt_lang['ANON_TEXT']) && ($config['anonnames']) ) {
$postname = "";
}
else {
$postname = "$postername";
$postname .= "";
}
$iconselect = $html -> icon_select();
$instant_ubbcode = $html -> instant_ubbcode();
// --------------------------------------
// Can they make this post a sticky post?
$stickyselect = "";
if ( ($user['U_Status'] == "Administrator") || ( ($ismod == "yes") && ($modperms['P_CanStickPosts']) ) ) {
$stickyselect = " {$ubbt_lang['STICKY']}
";
}
$announce = "";
if ($user['U_Status'] == "Administrator") {
$announce = " {$ubbt_lang['ANNOUNCE']}
";
}
// -------------------------------------
// 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 = "