#!/usr/local/bin/perl
#
### PRIMARY UBB SCRIPT ##
#
# Ultimate Bulletin Board is copyright Infopop Corporation (formerly Madrona Park, Inc.), 1998.
#
# ------------ postings.cgi -------------
#
# This file contains the functionality for the UBB
# postings (new topics, replies, etc.).
#
# Infopop Corporation (formerly Madrona Park, Inc.) offers no
# warranties on this script. The owner/licensee of the script is
# solely responsible for any problems caused by installation of
# the script or use of the script, including messages that may be
# posted on the BB.
#
# All copyright notices regarding the Ultimate Bulletin Board
# must remain intact on the scripts and in the HTML
# for the scripts.
#
# For more info on the Ultimate BB,
# see http://www.UltimateBB.com
#
###############################################################
#
#If you are running UBB on IIS,
#you may need to add the following line
#if so, just remove the "#" sign before the print line below
#print "HTTP/1.0 200 OK\n";
print ("Content-type: text/html\n\n");
eval {
($0 =~ m,(.*)/[^/]+,) && unshift (@INC, "$1"); # Get the script location: UNIX / or Windows /
($0 =~ m,(.*)\\[^\\]+,) && unshift (@INC, "$1"); # Get the script location: Windows \
#substitute all require files here for the file
require "UltBB.setup";
require "cookie-lib.pl";
require "Date.pl";
require "mail-lib.pl";
require "mods.file";
require "ubb_library.pl";
require "ubb_library2.pl";
};
if ($@) {
print "Error including required files: $@\n";
print "Make sure these files exist, permissions are set properly, and paths are set correctly.";
exit;
}
use Socket;
&ReadParse;
$DisableSmiliesWording = qq(
Disable Smilies in This Post.);
$SmiliesLink = qq(Smilies Legend);
foreach $row(@in) {
($Name, $Value) = split ("=", $row);
$Name = &decodeURL($Name);
$Value = &decodeURL($Value);
if ($Name eq "forum") {
$Forum = $Value;
$Forum =~ s/\/\\//g;
$ForumCoded = &HTMLIFY($Forum);
$ForumCoded =~ tr/ /+/;
$Forum = &UNHTMLIFY($Forum);
}
if ($Name eq "TopicSubject") {
$TopicSubject = $Value;
$TopicSubject =~ s/<.+?>//g;
$TopicSubject = &UNHTMLIFY($TopicSubject);
}
if ($Name eq "UserName") {
$UserName = $Value;
$UserNameFile = $UserName;
$UserNameFile =~ s/ /_/g; #remove spaces
}
if ($Name eq "BypassCookie") {
$BypassCookie = $Value;
}
if ($Name eq "category") {
$category = $Value;
}
if ($Name eq "PasswordConfirm") {
$PasswordConfirm = $Value;
}
if ($Name eq "number") {
$number = $Value;
}
if ($Name eq "DaysPrune") {
$DaysPrune = $Value;
}
if ($Name eq "topic") {
$topic = $Value;
}
if ($Name eq "Email") {
$Email = $Value;
$Email =~tr/A-Z/a-z/;
}
if ($Name eq "URL") {
$URL = &CleanThis($Value);
$URL = &PipeCleaner($URL);
}
if ($Name eq "Permissions") {
$Permissions = $Value;
}
if ($Name eq "Occupation") {
$Occupation = &CleanThis($Value);
$Occupation = &PipeCleaner($Occupation);
}
if ($Name eq "Location") {
$Location = &CleanThis($Value);
$Location = &PipeCleaner($Location);
}
if ($Name eq "TotalPosts") {
$TotalPosts = $Value;
}
if ($Name eq "Status") {
$Status = $Value;
}
if ($Name eq "Interests") {
$Interests = &CleanThis($Value);
$Interests = &PipeCleaner($Value);
}
if ($Name eq "sendto") {
$sendto = $Value;
}
} # end FOREACH $row
if ($VariablesPath eq "") {
$VariablesPath = $CGIPath;
}
if ($in{'action'} eq "doupdate") {
if ($in{'UpdateForumChoice'} eq "ALL") {
$number = 1;
} else {
$number = $in{'UpdateForumChoice'};
}
}
if (-e "$ForumsPath/Forum$number/forumstyles.file") {
require "$ForumsPath/Forum$number/forumstyles.file";
} else {
require "$VariablesPath/Styles.file";
}
#create random numbers for headers/footers
$RandomNumber = &MakeRandomNumber;
$RandomNumber2 = $RandomNumber + 100074;
if (-e "$ForumsPath/Forum$number/forumstyles.file") {
if ($ForumHeader ne "") {
$Header = $ForumHeader;
$Header =~ s/UBBrandomX/$RandomNumber/isg;
$Header =~ s/UBBrandomY/$RandomNumber2/isg;
} else {
if ($Header ne "") {
$Header =~ s/UBBrandomX/$RandomNumber/isg;
$Header =~ s/UBBrandomY/$RandomNumber2/isg;
}
}
if ($ForumFooter ne "") {
$Footer = $ForumFooter;
$Footer =~ s/UBBrandomX/$RandomNumber/isg;
$Footer =~ s/UBBrandomY/$RandomNumber2/isg;
} else {
if ($Footer ne "") {
$Footer =~ s/UBBrandomX/$RandomNumber/isg;
$Footer =~ s/UBBrandomY/$RandomNumber2/isg;
}
}
} else {
if ($Header ne "") {
$Header =~ s/UBBrandomX/$RandomNumber/isg;
$Header =~ s/UBBrandomY/$RandomNumber2/isg;
}
if ($Footer ne "") {
$Footer =~ s/UBBrandomX/$RandomNumber/isg;
$Footer =~ s/UBBrandomY/$RandomNumber2/isg;
}
}
#adjust bgcolor variables
if ($BGColor ne ""){
$BGColor = qq(bgcolor="$BGColor");
}
if ($AltColumnColor1 ne ""){
$AltColumnColor1 = qq(bgcolor="$AltColumnColor1");
}
if ($AltColumnColor2 ne ""){
$AltColumnColor2 = qq(bgcolor="$AltColumnColor2");
}
if ($CategoryStripColor ne ""){
$CategoryStripColor = qq(bgcolor="$CategoryStripColor");
}
if ($TableColorStrip ne ""){
$TableColorStrip = qq(bgcolor="$TableColorStrip");
}
if ($PageBackground ne ""){
$PageBackground = qq(background="$NonCGIURL/$PageBackground");
}
if ($TableBorderColor ne ""){
$TableWidth2 = "100%";
$BorderTop = qq(
);
} else {
$TableWidth2 = $TableWidth;
$BorderTop = "";
$BorderBottom = "";
}
if ($in{'action'} eq "doupdate") {
&VerifyAdmin($UserName, $in{'Password'});
if ($Proceed eq "true") {
#determine number of total forums
@theforums = &OpenForumsFile;
$TotalForums = @theforums;
&ConvertForums2HTML("$number", "$TotalForums", "0");
}
} #end do update (threads) sr
if ($in{'action'} eq "ContinueUpdate") {
$number = $in{'number'};
$TotalForums = $in{'TotalForums'};
&ConvertForums2HTML("$number", "$TotalForums", "$in{'StartWith'}");
exit;
}
if ($BBStatus eq "OFF") {
&StandardHTML("Sorry, this bulletin board is temporarily unavailable, while we perform some routine maintenance. Please try back again later. Feel free to email us at $BBEmail.");
exit;
}
$ReplyMessage = $in{'ReplyMessage'};
$Message = $in{'Message'};
@censored = split(/ /, $censorwords);
$TopicSubject = &CensorCheck("$TopicSubject");
$SubjectCoded = &HTMLIFY($TopicSubject);
$SubjectCoded =~ tr/ /+/;
if ($in{'action'} eq "reply") {
&Reply;
}
if ($in{'action'} eq "postreply") {
&PostReply;
}
if ($in{'action'} eq "redoHTML") {
@checkforprivate = &GetForumRecord($number);
$LWA = $checkforprivate[6];
$PrivateMax = $checkforprivate[13];
$Forum = $checkforprivate[1];
$Forum =~ s/\/\\//g;
$ForumCoded = &HTMLIFY($Forum);
$ForumCoded =~ tr/ /+/;
$Forum = &UNHTMLIFY($Forum);
&CreateThreadHTML("Forum$number", "$topic", "0", "1");
$OldNumber = $in{'OldNumber'};
@checkforprivateOLD = &GetForumRecord($OldNumber);
$ForumOLD = $checkforprivateOLD[1];
&StandardHTML("Thank you! We have transferred the topic as you requested. You may proceed to either the original forum or the forum to which you transferred the topic. Choose one:);
$BorderBottom = qq(
$ForumOLD | $Forum"); exit; } if ($in{'action'} eq "deletepost") { &DeletePost; } if ($in{'action'} eq "newtopic") { &NewTopic; } if ($in{'action'} eq "posttopic") { &PostTopic; } if ($in{'action'} eq "closethread") { &OpenCloseThread("close"); } if ($in{'action'} eq "openthread") { &OpenCloseThread("open"); } if ($in{'action'} eq "processclose") { &ProcessClose; } if ($in{'action'} eq "editpost") { @mess = &OpenThread("$topic"); $stats = $mess[0]; @statline = split(/\|\|/, $stats); if ($statline[1] =~ /X/) { &StandardHTML("Sorry, but this thread is closed... you may not edit any posts in a closed thread.