#!/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(
); $BorderBottom = 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:

$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.

Use your Back button.
"); } else { &EditPost; } } #end editpost check if ($in{'action'} eq "submitedit") { &SubmitEdit; } sub ForwardWithCookies { my $URLwc = shift; my $TEXTwc = shift; &GetCookieInfo; if ($SetCookies eq "DirectorySpecific") { $ExtraInfo = qq(domain=$TheDomain;path=/$ThePath;); } else { $ExtraInfo = ""; } print < $HeaderInsert

CONFIRM } ## END Forward With Cookies sr sub Reply { if ($in{'replyto'} =~ /[a-zA-Z\.]/) { &StandardHTML("Sorry, you seem to be trying to hack this board. This action is not permitted."); exit; } #open thread message @threadguts = &OpenThread("$topic"); $statline = $threadguts[0]; @stats = split(/\|\|/, $statline); # if thread is closed, say so if ($stats[1] =~ /X/) { &StandardHTML("Sorry, but this thread is closed. No additional replies are permitted on this topic. You are free to start a new topic, however.

Use your back button to return."); } else { @thisforum = &GetForumRecord($number); $CustomTitle = $thisforum[9]; $PostPermissions = $thisforum[6]; $PrivateMax = $thisforum[13]; chomp($PrivateMax); $UBBCodeAllow = $thisforum[5]; if (($PostPermissions ne "private") && ($PostPermissions !~ /\&/)) { &StandardHTML("We can not allow any new topics until your bulletin board administrator resets all forum variables. This board has not been completely updated yet."); exit; } if ($PostPermissions eq "private") { $ReplyRestrict = "restrict"; } else { ($junk, $ReplyRestrict) = split("&", $PostPermissions); } if ($ReplyRestrict eq "none") { &StandardHTML("Sorry, replies to topics are not permitted in this forum. Use your back button to return to the forum."); exit; } #chomp the last field to remove carriage returns $UBBImages = "$thisforum[10]"; if ($CustomTitle eq "") { $CustomTitle = "$BBTitle"; } &CheckCoding; if ($ReplyRestrict eq "all") { $RegistrationWording = qq(Registration is recommended, but not required, in order to post messages in this forum. Unless registered, you will not be able to edit messages after they are submitted.); $RegistrationOffWording = qq(If you are not registered, leave the password field below blank.); } else { $RegistrationWording = qq(You must be registered in order to post a topic or reply in this forum.); $RegistrationOffWording = ""; } if ($DisplayRegistration eq "NO") { $RegistrationOffWording = ""; } if (($AllowSignature eq "YES") && ($DisplayRegistration ne "NO")) { $ShowSignature = qq(
Show Signature: include your profile signature. Only registered users may have signatures.); } else { $ShowSignature = ""; } #check for direct reply if ($in{'replyto'}) { $ReplyNumber = $in{'replyto'}; $PostLine = $threadguts[$ReplyNumber]; @PostFields = split(/\|\|/, $PostLine); $PostMess = $PostFields[6]; $PostAuth = $PostFields[2]; $CleanPostMess = &PrepForEdit($PostMess); ## Get Rid of Previous Quotes $CleanPostMess =~ s/(\[QUOTE\])(.*)(\[\/QUOTE\]\n\r\n)//isg; ## Strip off the Sig $CleanPostMess =~ s/------------------(.*)//isg; chomp($CleanPostMess); $InsertPostMess = "\[QUOTE\]Originally posted by $PostAuth:\n\[B\]$CleanPostMess\[/B\]\[/QUOTE\]"."\n\n"; } else { $InsertPostMess = ""; } #check to see if this forum is has restrictions on who can post to it- if ($ReplyRestrict eq "restrict") { $LWADisclaimer = qq(Only administrators, moderators, and authorized registered users.); $LWAField = qq(If you are an administrator or moderator, you do not need to type a forum password. If you are not, you must supply the forum password in order to post a message in this forum, unless you have been given specific permission by your administrator.Forum Password:); &ReplyFormHTML; } else { if ($ReplyRestrict eq "all") { $LWADisclaimer = "Anyone may post a reply."; $LWAField = ""; } if ($ReplyRestrict eq "allreg") { $LWADisclaimer = "Any registered users may post a reply."; $LWAField = ""; } &ReplyFormHTML; } ($topicnum, $junk) = split(/\./, $topic); if (($PostPermissions eq "private") && ($PrivateMax eq "yes")) { $GoTo = "$CGIURL/forumdisplay.cgi?action=displayprivate&number=$number&topic=$topicnum"; } else { $GoTo = "$NonCGIURL/$ExactPath/HTML/$topicnum.html"; } &ReplyFormBottom; } #end if/else thread is closed } ## END Reply SR ##### sub PrepForEdit { my $Preppie = shift; &UNHTMLIFY($Preppie); $Preppie =~ s/

/\n\r\n/isg; $Preppie =~ s/
/\n/isg; $Preppie =~ s//:\)/isg; $Preppie =~ s//:\(/isg; $Preppie =~ s//\:D/isg; $Preppie =~ s//\;\)/isg; $Preppie =~ s//\:o/isg; $Preppie =~ s//:p/isg; $Preppie =~ s//:cool:/isg; $Preppie =~ s//:rolleyes:/isg; $Preppie =~ s//:mad:/isg; $Preppie =~ s//:eek:/isg; $Preppie =~ s//:confused:/isg; if ($UBBCodeAllow eq "is") { #convert UBB Code $Preppie = &EditUBBConvert("$Preppie"); } return($Preppie); } sub PostReply { @thisforum = &GetForumRecord($number); $ThisForumName = $thisforum[1]; $LWA = $thisforum[6]; $PrivateMax = $thisforum[13]; chomp($PrivateMax); $LWAPW = $thisforum[7]; $UBBCodeAllow = $thisforum[5]; $HTMLAllow = $thisforum[4]; $UBBImages = $thisforum[10]; $ModNotify = $thisforum[11]; $ForumStatus = $thisforum[3]; chomp($ModNotify); $CheckSubject = &decodeURL($in{'TopicSubject'}); if ($CheckSubject =~ /Please feel free to email us at $BBEmail if you have any questions."); exit; } } } #if IPBan list is not empty if ($LWA eq "private") { $ReplyRestrict = "restrict"; &get_cookie; #retrieves all current cookies $PasswordPrivate = "$cookie{PasswordPrivate}"; $UserNamePrivate = "$cookie{UserNamePrivate}"; $NumbersPrivate = "$cookie{ForumNumberPrivate}"; &VerifyID; if ($ProceedNow ne "true") { &StandardHTML("This is a private forum and you have not been properly authorized to post to this forum."); exit; } } else { ($junk, $ReplyRestrict) = split("&", $LWA); } if ($ReplyRestrict eq "none") { &StandardHTML("Sorry, but replies are not permitted in this forum. Use your back button to return to the forum."); exit; } #verify that forum fields are complete if (($in{'UserName'} eq "") || ($in{'ReplyMessage'} eq "") || ($topic eq "")) { &StandardHTML("You did not complete all required form fields! Please go back and re-enter."); } elsif (($ReplyRestrict ne "all") && ($in{'Password'} eq "")) { &StandardHTML("You did not complete all required form fields! Please go back and re-enter."); } else { ## See if this is an LWA Forum if ($ReplyRestrict eq "restrict") { $NameFound = "no"; $ProfileNumber = &GetUserNumber($in{'UserName'}); if ($ProfileNumber ne "") { $NameFound = "yes"; } else { $NameFound = "no"; } if ($NameFound eq "yes") { @theprofile = &OpenProfile("$ProfileNumber.cgi"); if ($in{'Password'} eq "$theprofile[1]") { $Permission = "$theprofile[4]"; ($GenPerms, $SpecificPerms) = split(/\&/, $Permission); $Status = $theprofile[8]; $EmailView = $theprofile[11]; &CheckTheStatus; &CheckPermissions; $UserName = &decodeURL("$in{'UserName'}"); &CheckModStatus("Forum$number", "$UserName"); if ($SpecificPerms ne "") { chomp($specificPerms); @accessarray = split(",", $SpecificPerms); foreach $uno(@accessarray) { if ($uno eq "$number") { $PermissionGranted = "true"; } } } #check forumpassword if (($in{'ForumPassword'} eq "$thisforum[12]") && ($thisforum[12] ne "")) { $PermissionGranted = "true"; } if (($AdminPermission eq "true") || ($ModMatch eq "yes")) { &DoPostTheReply; } elsif ($PermissionGranted eq "true") { &DoPostTheReply; } else { &StandardHTML("Sorry, but you are not authorized to post a reply in this particular forum. Only moderators, administrators, and users granted proper permission may post replies in this forum."); } } else { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } else { &StandardHTML("Sorry, but we couldn't find a record for the UserName you entered. Please try again. Use your Back button."); } ##END IF/ELSE NAME CHECK BLOCK } else { &DoPostTheReply; }#end if/else LWA = yes } #end if/else field check } ## END Post Reply SR sub DoPostTheReply { #get current date/time &GetDateTime; ##verify user name/password if necessary $match = "no"; $verified = "false"; if (($ReplyRestrict eq "all") && ($in{'Password'} eq "")) { #check to make sure they aren't using a registered name &GetMemberListArray; $lcthename = lc($UserName); $_ = $lcthename; if ((m/^\s/) || (m/\s$/) || (m/_{2,}/) || (m/\|\!/)) { &StandardHTML("The User Name you attempted to use is illegal for one of the following reasons:

1. You may not begin or end a User Name with a space. You may not have two or more consecutive spaces.

2. You may not use a name with a pipestem followed by an exclamation point.

Use your back button to try again.
"); exit; } foreach $regname(@members) { $lcregname = lc($regname); if ($lcthename eq "$lcregname") { &StandardHTML("Sorry, but the name you attempted to use has been reserved by a registered member. You do not have to register, but you must use a different name. Please use your back button to try again."); exit; } } $match = "yes"; $verified = "true"; $PermissionToWrite = "true"; $UserNameRegister = "false"; } else { $ProfileNumber = &GetUserNumber($UserName); if ($ProfileNumber ne "") { $match = "yes"; } else { $match = "no"; } if ($match eq "yes") { @profilestats2 = &OpenProfile("$ProfileNumber.cgi"); if ($profilestats2[1] eq "$in{'Password'}") { $verified = "true"; $Email = "$profilestats2[2]"; $Status = "$profilestats2[8]"; $TotalPosts = "$profilestats2[7]"; $Permission = "$profilestats2[4]"; $EmailView = "$profilestats2[11]"; $Signature = "$profilestats2[12]"; } #END IF profilestats } #END IF match eq yes if ($match eq "no") { &StandardHTML("Sorry, but we have no one registered with the UserName you typed ($UserName). Please try again. Use your Back button."); } if ($match eq "yes" && $verified eq "false") { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } #end if/else lwa =includenonreg if (($match eq "yes") && ($verified eq "true")) { if ($in{'Password'} ne "") { &CheckPermissions; } if ($PermissionToWrite eq "true") { if ($FloodCheck eq "ON") { #floodcheck courtesy of Michael Farris &floodcheck unless (($Status eq "Administrator") || ($Status eq "Moderator")); } ##create filenumber for reply @replier = &OpenThread("$topic"); @revreplier = reverse(@replier); $statline = $replier[0]; $fatherline = $replier[1]; @papa = split(/\|\|/, $fatherline); @stats = split(/\|\|/, $statline); if ($stats[1] eq "X") { &StandardHTML("You are attempting to post a reply to a thread that is now closed."); exit; } $replytotal = $stats[2]; $replytotal++; #add one to reply total $lastpost = $revreplier[0]; @lastpost = split(/\|\|/, $lastpost); $lastnumber = $lastpost[1]; $lastnumber++; #add 1 to last post number $newreplynum = sprintf("%6d", $lastnumber); $newreplynum =~tr/ /0/; #now we have to add the new message to the thread file ## IF HTML is not allowed, render HTML useless if ($HTMLAllow eq "is not") { $ReplyMessage =~ s//>/g; } else { #don't allow HTML SCRIPT TAGS $ReplyMessage =~ s/<.*SCRIPT.*?<\/SCRIPT>//ig; } $ReplyMessage = &CensorCheck("$ReplyMessage"); $ReplyMessage2 = "$ReplyMessage"; $ReplyMessage = &Truncate("$ReplyMessage"); #Smiley/Frown conversion--- if ($in{'DisableSmilies'} ne "yes") { $ReplyMessage = &Smilies("$ReplyMessage"); } #UBB Code-ify (if allowed) if ($UBBCodeAllow eq "is") { $ReplyMessage = &UBBCode("$ReplyMessage"); } #END UBB CODE #convert newlines/carriage returns to HTML $ReplyMessage = &ConvertReturns("$ReplyMessage"); #Check for Signature if ($UserNameRegister ne "false") { if (($AllowSignature eq "YES") && ($in{'Signature'} eq "yes")) { $ReplyMessage .= ("

------------------
$Signature"); } } $ReplyMessage= &PipeCleaner("$ReplyMessage"); #check for excess images- if ($ReplyMessage =~ m/(IMG SRC){16,}/i) { &StandardHTML("We cannot process your posting, because you have exceeded the maximum number of images allowed per post. The current maximum is 15. "); exit; } ($ThreadNo, $junk) = split(/\./, $topic); ## if email should not be displayed, don't if (($EmailBlock eq "ON") || ($EmailView eq "no") || ($UserNameRegister eq "false")) { $PostEmail = ""; } else { $PostEmail = "$Email"; } #Get IP Number if IP logging is on if (($IP eq "ON") || ($IP eq "LOGONLY")) { $IPNumber = $ENV{'REMOTE_ADDR'}; } if (($ReplyRestrict eq "all") && ($UserNameRegister eq "true")) { $RegStatus = "reg"; } elsif (($ReplyRestrict eq "all") && ($UserNameRegister eq "false")) { $RegStatus = "unreg"; } else { $RegStatus = "reg"; } ## ICONS IDEA PROVIDED BY KOMBAT03- Thanks KOMBAT! # ICON GRAPHICS AND SOME CODE PROVIDED BY KOMBAT03 my $MsgIcon = $in{'MsgIcon'}; if ($MsgIcon !~ /(\d|\d\d)/) { $MsgIcon = ""; } $ReplyLine = ("Z||$newreplynum||$UserName||$HyphenDate||$Time||$PostEmail||$ReplyMessage||$IPNumber||$RegStatus||$MsgIcon"); push(@replier, $ReplyLine); foreach $line(@replier) { chomp($line); if ($line =~ /^A/) { chomp($stats[4]); chomp($stats[5]); chomp($stats[6]); chomp($stats[7]); $newstats = "A||$stats[1]||$replytotal||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]"; push(@updated, $newstats); } else { push(@updated, $line); } } #check to make sure files are writeable!! if ($RegStatus eq "reg") { unless (-w "$MembersPath/$ProfileNumber.cgi") { chmod (0777, "$MembersPath/$ProfileNumber.cgi"); } } unless (-w "$ForumsPath/$ExactPath/$topic") { chmod (0777, "$ForumsPath/$ExactPath/$topic"); } if (-w "$ForumsPath/$ExactPath/$topic") { #if topic file is writeable--- if (($LWA eq "private") && ($PrivateMax eq "yes")) { $GoTo = "$CGIURL/forumdisplay.cgi?action=displayprivate&number=$number&topic=$ThreadNo"; $FileExt = "cgi"; } else { $GoTo = "$NonCGIURL/$ExactPath/HTML/$ThreadNo.html"; $FileExt = "html"; } &ForwardWithCookies("$GoTo", "Thanks for posting your message, $UserName! We are now sending you back automatically to this topic."); &Lock("lock.file"); open (REPLY, ">$ForumsPath/$ExactPath/$topic"); foreach $post(@updated) { chomp($post); print REPLY ("$post\n"); } close (REPLY); &Unlock("lock.file"); chmod (0666, "$ForumsPath/$ExactPath/$topic"); if ($RegStatus eq "reg") { ##Add reply to user's profile (total posts) $TotalPosts++; #Bump user up to Member if Total Posts reaches $MemberMinimum if (($TotalPosts >= $MemberMinimum) && ($Status eq "Junior Member")) { $profilestats2[8] = "Member"; } $profilestats2[7] = $TotalPosts; &Lock("lock.file"); open (MEMBERSHIP, ">$MembersPath/$ProfileNumber.cgi") or die("Unable to open Members directory."); foreach $instance(@profilestats2) { chomp($instance); print MEMBERSHIP ("$instance\n"); } close (MEMBERSHIP); &Unlock("lock.file"); chmod (0777, "$MembersPath/$ProfileNumber.cgi"); } #update last time file &Lock("lock.file"); open (LASTTIME, ">$ForumsPath/$ExactPath/lasttime.file") or die("Unable to open LastTime.file"); print LASTTIME ("$HyphenDate\n"); print LASTTIME ("$Time\n"); close (LASTTIME); &Unlock("lock.file"); chmod (0666, "$ForumsPath/$ExactPath/lasttime.file"); #update threads summary file &CurrentDate; if (-e "$ForumsPath/$ExactPath/forum$number.threads") { &UpdateForumSummary($number, $topic); } else { &ForumSummary($number); } ##CREATE HTML FILE FOR NEW THREAD &CreateThreadHTML("Forum$number", "$topic", "0", "1"); ## UPDATE INDEX $Message = "$ReplyMessage"; if ($ForumStatus eq "On") { if ($LWA eq "private") { &AppendPrivateIndex("$number", "$topic", "$LWAPW"); } else { if ($IndexMethod eq "ONEFILE") { &AppendIndex("$number", "$topic"); } else { &AppendIndex2("$number", "$topic"); } } } ##determine last topic number and increment by 1 @forumcounter = &OpenFile("$ForumsPath/$ExactPath/lastnumber.file"); $lastthreadnum = $forumcounter[0]; chomp($lastthreadnum); $totthreadcount = $forumcounter[1]; chomp($totthreadcount); $totpostcount = $forumcounter[2]; chomp($totpostcount); $totpostcount++; &Lock("lock.file"); open (FORUMCOUNT, ">$ForumsPath/$ExactPath/lastnumber.file"); print FORUMCOUNT ("$lastthreadnum\n"); print FORUMCOUNT ("$totthreadcount\n"); print FORUMCOUNT ("$totpostcount\n"); close (FORUMCOUNT); &Unlock("lock.file"); chmod (0666, "$ForumsPath/$ExactPath/lastnumber.file"); ($topicnum, $junk) = split(/\./, $topic); # If Forum is set to Moderator Notify, # need to send notification to forum moderator if ($ModNotify eq "yes") { $ModName = ("Forum" . "$number" . "Moderator"); $ModName = $$ModName; #split up Mod var @mods = split(/\|\|\^\|\|/, $ModName); foreach $unomod(@mods) { if ($unomod ne "") { chomp($unomod); $ProfNumber = &GetUserNumber($unomod); @ModProfile = &OpenProfile("$ProfNumber.cgi"); $sendto = $ModProfile[2]; chomp($sendto); $subject = "Moderator Notification: New Post in $Forum"; if ($sendto =~ /\S+\@\S+\.\S+/) { $ReplyMessage =~ s/
/\n/ig; $ReplyMessage =~ s/

/\n\r\n/ig; $ReplyMessage =~ s/<.+?>//g; $message = "Hello, $unomod! \n\r\n$UserName has just replied to the topic entitled - $TopicSubject - in the $Forum forum of $BBName. \n\r\nThis topic is located at $GoTo\n\r\nHere is what the user posted:\n\r\n$ReplyMessage"; if ($SMTPEmail eq "On") { &SendEmail; } else { &send_mail("$BBEmail", "$sendto", "$subject", "$message"); } } } #if email is in valid format } # end moderator name check- if blank, do not send email } #end mod notify block ## IF TOPIC SET TO NOTIFY, THEN WE NEED TO GENERATE AN ## EMAIL MESSAGE TO SEND TO THE AUTHOR OF THE TOPIC if ($stats[1] =~ /N/) { $TopicWriter = $papa[2]; #don't send if person replying is same as topic writer if ($TopicWriter ne "$UserName") { $ProfNum = &GetUserNumber($TopicWriter); @topicw = &OpenProfile("$ProfNum.cgi"); $sendto = "$topicw[2]"; chomp($sendto); $subject = "Notification: Reply to Your BB Topic"; $message = "Hello, \n\r\n $UserName has just replied to your topic entitled - $TopicSubject - in the $Forum forum of $BBName. \n\r\n This topic is located at $GoTo"; if ($sendto =~ /\S+\@\S+\.\S+/) { if ($SMTPEmail eq "On") { &SendEmail; } else { &send_mail("$BBEmail", "$sendto", "$subject", "$message"); } } } #end if topic writer ne username } # end if extension = n } else { #if topic file is still not writeable, # then web host may be preventing writing new files-- don't process then &StandardHTML("Sorry, we could not post your reply to this topic. Contact your bulletin board administrator and inform them that they may have may run out of available disk space. Their web host may be preventing them from posting new files."); } } else { &StandardHTML("Sorry, but you no longer have permission to post a note on the bulletin board. Either the administrator of the BB or one of the moderators has removed your posting privileges."); } #END Check Permission block } } # end Do Post The Reply sub NewTopic { @thisforum = &GetForumRecord($number); $CustomTitle = "$thisforum[9]"; $UBBImages = "$thisforum[10]"; $PostPermissions = $thisforum[6]; if ($PostPermissions eq "private") { $TopicRestrict = "restrict"; } else { ($TopicRestrict, $junk) = split(/\&/, $PostPermissions); } if (($PostPermissions ne "private") && ($PostPermissions !~ /\&/)) { &StandardHTML("We can not allow any new topics until your bulletin board administrator resets all forum variables. This board has not been completely updated yet."); exit; } if ($CustomTitle eq "") { $CustomTitle = "$BBTitle"; } &CheckCoding; if ($TopicRestrict eq "all") { $RegistrationWording = qq(Registration is recommended, but not required, in order to post messages in this forum. Unless registered, you will not be able to edit messages after they are submitted.); $RegistrationOffWording = qq(If you are not registered, leave the password field below blank.); } else { $RegistrationWording = qq(You must be registered in order to post a topic or reply in this forum.); $RegistrationOffWording = ""; } if ($DisplayRegistration eq "NO") { $RegistrationOffWording = ""; } ## if email is enabled, show notification wording if (($UseEmail eq "ON") && ($DisplayRegistration ne "NO")) { $EmailNotificationHTML = qq( Email Notification: emails sent to you whenever someone replies. Only registered users are eligible.); } else { $EmailNotificationHTML = ""; } if (($AllowSignature eq "YES") && ($DisplayRegistration ne "NO")) { $ShowSignature = qq(
Show Signature: include your profile signature. Only registered users may have signatures.); } else { $ShowSignature = ""; } #check to see if this forum is there are posting restrictions if ($TopicRestrict eq "restrict") { $LWADisclaimer = qq(Only administrators, moderators, and authorized registered users.); $LWAField = qq(If you are an administrator or moderator, you do not need to type a forum password. If you are not, you must supply the forum password in order to post a message in this forum, unless you have been given specific permission by your administrator.Forum Password:); } else { if ($TopicRestrict eq "all") { $LWADisclaimer = "Anyone may post a topic."; $LWAField = ""; } if ($TopicRestrict eq "allreg") { $LWADisclaimer = "Any registered users may post a topic."; $LWAField = ""; } } &TopicFormHTML; } ## END NEWTOPIC SR ## sub PostTopic { if ($in{'TopicSubject'} !~ /[a-zA-Z0-9]/) { &StandardHTML("We cannot post your topic because it does not contain at least one letter or number. Use your back button to try again."); exit; } if ($in{'TopicSubject'} =~ /<.*>/) { &StandardHTML("We cannot post your topic because the subject contains < and >. Subjects may not contain both of those characters. Use your back button to try again."); exit; } @thisforum = &GetForumRecord($number); $ThisForumName = $thisforum[1]; $LWA = $thisforum[6]; $LWAPassword = &decodeURL($thisforum[7]); $UBBCodeAllow = $thisforum[5]; $HTMLAllow = $thisforum[4]; $UBBImages = $thisforum[10]; $ModNotify = $thisforum[11]; $ForumStatus = $thisforum[3]; $PrivateMax = $thisforum[13]; chomp($PrivateMax); $CheckName = &decodeURL($in{'forum'}); $CheckName =~ s/"/"/g; if ($CheckName ne "$ThisForumName") { &StandardHTML("We cannot post your topic because the Forum Name being submitted does not match the forum name we have listed in our records. Use your back button to try again."); exit; } #set proper path if forum is private if ($LWA eq "private") { $ThisPath = "Forum$number/private-$LWAPassword"; } else { $ThisPath = "Forum$number"; } if ($LWA eq "private") { $TopicRestrict = "restrict"; &get_cookie; #retrieves all current cookies $PasswordPrivate = "$cookie{PasswordPrivate}"; $UserNamePrivate = "$cookie{UserNamePrivate}"; $NumbersPrivate = "$cookie{ForumNumberPrivate}"; &VerifyID; if ($ProceedNow ne "true") { &StandardHTML("This is a private forum and you have not been properly authorized to post to this forum."); exit; } } else { ($TopicRestrict, $junk) = split("&", $LWA); } #Check IP Ban List-- #get user's IP number: my $IPNumber = $ENV{'REMOTE_ADDR'}; my @IPbanlist = &OpenFile("$NonCGIPath/BanLists/IPBan.cgi"); if ($IPbanlist[0] ne "") { my $bannum = ""; CheckIPBanList: for $bannum(@IPbanlist) { chomp($bannum); $bannum2 = quotemeta($bannum); if ($IPNumber =~ m/$bannum2/i) { &StandardHTML("Sorry, but your IP Number is currently banned in our forums. You may not post or register on our site. Your IP Number is: $IPNumber.

Please feel free to email us at $BBEmail if you have any questions."); exit; } } } #if IPBan list is not empty ## Verify form input if (($in{'UserName'} eq "") || ($in{'TopicSubject'} eq "") || ($in{'Message'} eq "")) { &StandardHTML("You did not complete all required form fields! Please go back and re-enter."); } elsif (($TopicRestrict ne "all") && ($in{'Password'} eq "")) { &StandardHTML("You did not complete all required form fields! Please go back and re-enter."); } else { if ($TopicRestrict eq "restrict") { $NameFound = "no"; $ProfileNumber = &GetUserNumber($in{'UserName'}); if ($ProfileNumber ne "") { $NameFound = "yes"; } else { $NameFound = "no"; } if ($NameFound eq "yes") { @theprofile = &OpenProfile("$ProfileNumber.cgi"); if ($in{'Password'} eq "$theprofile[1]") { $Permission = "$theprofile[4]"; ($GenPerms, $SpecificPerms) = split(/\&/, $Permission); $Status = $theprofile[8]; $EmailView = $theprofile[11]; &CheckTheStatus; &CheckPermissions; $UserName = &decodeURL("$in{'UserName'}"); &CheckModStatus("Forum$number", "$UserName"); if ($SpecificPerms ne "") { chomp($specificPerms); @accessarray = split(",", $SpecificPerms); foreach $uno(@accessarray) { if ($uno eq "$number") { $PermissionGranted = "true"; } } } #check forumpassword if (($in{'ForumPassword'} eq "$thisforum[12]") && ($thisforum[12] ne "")) { $PermissionGranted = "true"; } if (($AdminPermission eq "true") || ($ModMatch eq "yes")) { &DoPostTheTopic; } elsif ($PermissionGranted eq "true") { &DoPostTheTopic; } else { &StandardHTML("Sorry, but you are not authorized to post a new topic in this particular forum. Only moderators, administrators, and authorized users may post new topics in this forum."); } } else { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } else { &StandardHTML("Sorry, but we couldn't find a record for the UserName you entered. Please try again. Use your Back button."); } ##END IF/ELSE NAME CHECK BLOCK } else { &DoPostTheTopic; }#end if/else LWA = yes } #end if/else field check } ## END POST TOPIC SR ### sub DoPostTheTopic { ##get current date/time &GetDateTime; ##verify user name/password if necessary $match = "no"; $verified = "false"; if (($TopicRestrict eq "all") && ($in{'Password'} eq "")) { #check to make sure they aren't using a registered name &GetMemberListArray; $lcthename = lc($UserName); $_ = $lcthename; if ((m/^\s/) || (m/\s$/) || (m/_{2,}/) || (m/\|\!/)) { &StandardHTML("The User Name you attempted to use is illegal for one of the following reasons:

1. You may not begin or end a User Name with a space. You may not have two or more consecutive spaces.

2. You may not use a name with a pipestem followed by an exclamation point.

Use your back button to try again.
"); exit; } foreach $regname(@members) { $lcregname = lc($regname); if ($lcthename eq "$lcregname") { &StandardHTML("Sorry, but the name you attempted to use has been reserved by a registered member. You do not have to register, but you must use a different name. Please use your back button to try again."); exit; } } $match = "yes"; $verified = "true"; $PermissionToWrite = "true"; $UserNameRegister = "false"; } else { $ProfileNumber = &GetUserNumber($in{'UserName'}); if ($ProfileNumber ne "") { $match = "yes"; } else { $match = "no"; } if ($match eq "yes") { @profilestats2 = &OpenProfile("$ProfileNumber.cgi"); chomp($profilestats2[1]); if ($profilestats2[1] eq "$in{'Password'}") { $verified = "true"; $Email = "$profilestats2[2]"; $Status = "$profilestats2[8]"; $EmailView = "$profilestats2[11]"; $TotalPosts = "$profilestats2[7]"; $Permission = "$profilestats2[4]"; $EmailView = "$profilestats2[11]"; $Signature = "$profilestats2[12]"; } #END IF profilestats } #END IF match eq yes if ($match eq "no") { &StandardHTML("Sorry, but we have no one registered with the UserName you typed. Please try again. Use your Back button."); } if ($match eq "yes" && $verified eq "false") { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } #end if/else if (($match eq "yes") && ($verified eq "true")) { if ($in{'Password'} ne "") { &CheckPermissions; } if ($PermissionToWrite eq "true") { if ($FloodCheck eq "ON") { #floodcheck courtesy of Michael Farris &floodcheck unless (($Status eq "Administrator") || ($Status eq "Moderator")); } ##determine last topic number and increment by 1 if (-e "$ForumsPath/$ThisPath/lastnumber.file") { @forumcounter = &OpenFile("$ForumsPath/$ThisPath/lastnumber.file"); $lastthreadnum = $forumcounter[0]; chomp($lastthreadnum); $totthreadcount = $forumcounter[1]; chomp($totthreadcount); $totpostcount = $forumcounter[2]; chomp($totpostcount); } else { $lastthreadnum = 0; $totthreadcount = 0; $totpostcount = 0; } $count = $lastthreadnum + 0; if (($in{'EmailNotification'} eq "yes") && ($UserNameRegister ne "false")) { $Notes = "N"; } else { $Notes = ""; } if ($count > 0) { $lastthreadnum++; $newtopic = sprintf("%6d", $lastthreadnum); $newtopic =~tr/ /0/; } else { $newtopic = "000001"; } ##create filenumber for new topic $newtopicfile = ("$newtopic.cgi"); #now we have to add the message to the forum directory ## IF HTML is not allowed, render HTML useless if ($HTMLAllow eq "is not") { $Message =~ s//>/g; } else { #don't allow HTML SCRIPT TAGS $Message =~ s/<.*SCRIPT.*?<\/SCRIPT>//ig; } $Message = &CensorCheck("$Message"); $Message = &Truncate("$Message"); if ($in{'DisableSmilies'} ne "yes") { $Message = &Smilies("$Message"); } #UBB Code-ify (if allowed) if ($UBBCodeAllow eq "is") { $Message = &UBBCode("$Message"); } #end if UBB Code allowed #convert newlines/carriage returns to
and

html tags $Message = &ConvertReturns("$Message"); #Check for Signature if ($UserNameRegister ne "false") { if (($AllowSignature eq "YES") && ($in{'Signature'} eq "yes")) { $Message .= ("

------------------
$Signature"); } } $Message= &PipeCleaner("$Message"); #check for excess images- if ($Message =~ m/(IMG SRC){16,}/i) { &StandardHTML("We cannot process your posting, because you have exceeded the maximum number of images allowed per post. The current maximum is 15. "); exit; } ## if email should not be displayed, don't if (($EmailBlock eq "ON") || ($EmailView eq "no") || ($TopicRestrict eq "any" && $UserNameRegister eq "false")) { $PostEmail = ""; } else { $PostEmail = "$Email"; } $TopicSubject =~ s/\|/|/sg; #Get IP Number if IP logging is on if (($IP eq "ON") || ($IP eq "LOGONLY")) { $IPNumber = $ENV{'REMOTE_ADDR'}; } ## ICONS IDEA PROVIDED BY KOMBAT03- Thanks KOMBAT! # ICON GRAPHICS AND SOME CODE PROVIDED BY KOMBAT03 $MsgIcon = $in{'MsgIcon'}; if ($MsgIcon !~ /(\d|\d\d)/) { $MsgIcon = ""; } #create file lines $StatsLine = "A||$Notes||0||$UserName||$TopicSubject||||$MsgIcon||"; if (($TopicRestrict eq "all") && ($UserNameRegister eq "true")) { $RegStatus = "reg"; } elsif (($TopicRestrict eq "all") && ($UserNameRegister eq "false")) { $RegStatus = "unreg"; } else { $RegStatus = "reg"; } $FatherLine = "Z||000000||$UserName||$HyphenDate||$Time||$PostEmail||$Message||$IPNumber||$RegStatus||$MsgIcon"; ### test to make sure member file is writeable! if ($RegStatus eq "reg") { unless (-w "$MembersPath/$ProfileNumber.cgi") { chmod (0777, "$MembersPath/$ProfileNumber.cgi"); } } &ForwardWithCookies("$CGIURL/forumdisplay.cgi?action=topics&forum=$ForumCoded&number=$number&DaysPrune=$DaysPrune", "Thanks for posting your message, $UserName! We are now taking you back automatically to the topic list for $Forum."); &Lock("lock.file"); open (FORUM, ">$ForumsPath/$ThisPath/$newtopicfile"); print FORUM ("$StatsLine\n"); print FORUM ("$FatherLine\n"); close (FORUM); &Unlock("lock.file"); chmod (0666, "$ForumsPath/$ThisPath/$newtopicfile"); if ($RegStatus ne "unreg") { ##Add reply to user's profile (total posts) $TotalPosts++; #Bump user up to Member if Total Posts reaches $MemberMinimum if (($TotalPosts == $MemberMinimum) && ($Status eq "Junior Member")) { $profilestats2[8] = "Member"; } $profilestats2[7] = $TotalPosts; &Lock("lock.file"); open (MEMBERS, ">$MembersPath/$ProfileNumber.cgi") or die("Unable to open Members directory."); foreach $instance(@profilestats2) { chomp($instance); print MEMBERS ("$instance\n"); } close (MEMBERS); &Unlock("lock.file"); chmod (0777, "$MembersPath/$ProfileNumber.cgi"); } # end includenonreg check ##CREATE HTML FILE FOR NEW THREAD &CreateThreadHTML("Forum$number", "$newtopicfile", "0", "1"); #update last time file &Lock("lock.file"); open (LASTTIME, ">$ForumsPath/$ThisPath/lasttime.file") or die("Unable to open LastTime.file"); print LASTTIME ("$HyphenDate\n"); print LASTTIME ("$Time\n"); close (LASTTIME); &Unlock ("lock.file"); chmod (0666, "$ForumsPath/$ThisPath/lasttime.file"); #update last number file for forum $totthreadcount++; $totpostcount++; &Lock("lock.file"); open (FORUMCOUNT, ">$ForumsPath/$ThisPath/lastnumber.file"); print FORUMCOUNT ("$newtopic\n"); print FORUMCOUNT ("$totthreadcount\n"); print FORUMCOUNT ("$totpostcount\n"); close (FORUMCOUNT); &Unlock ("lock.file"); chmod (0666, "$ForumsPath/$ThisPath/lastnumber.file"); #update threads summary file &CurrentDate; if (-e "$ForumsPath/$ThisPath/forum$number.threads") { @checkthis = &OpenFile("$ForumsPath/$ThisPath/forum$number.threads"); $TotalCheck = @checkthis; $PreCount = $totthreadcount - 1; if ($TotalCheck == $PreCount) { &AppendForumSummary($number, $newtopicfile); } else { &ForumSummary($number); } } else { &ForumSummary($number); } ## UPDATE INDEX if ($ForumStatus eq "On") { if ($LWA eq "private") { &AppendPrivateIndex("$number", "$newtopicfile", "$LWAPassword"); } else { if ($IndexMethod eq "ONEFILE") { &AppendIndex("$number", "$newtopicfile"); } else { &AppendIndex2("$number", "$newtopicfile"); } } } # If Forum is set to Moderator Notify, # need to send notification to forum moderator if ($ModNotify eq "yes") { $ModName = ("Forum" . "$number" . "Moderator"); $ModName = $$ModName; #split up Mod var @mods = split(/\|\|\^\|\|/, $ModName); foreach $unomod(@mods) { if ($unomod ne "") { chomp($unomod); $ProfNumber = &GetUserNumber($unomod); @ModProfile = &OpenProfile("$ProfNumber.cgi"); $sendto = $ModProfile[2]; chomp($sendto); $subject = "Moderator Notification: New Topic in $Forum"; $message = "Hello, $unomod! \n\r\n$UserName has just created a new topic entitled - $TopicSubject - in the $Forum forum of $BBName. \n\r\n This BB is located at $CGIURL/Ultimate.cgi"; if ($SMTPEmail eq "On") { &SendEmail; } else { &send_mail("$BBEmail", "$sendto", "$subject", "$message"); } } # end check for moderator name } #end mod notify block } } else { &StandardHTML("Sorry, but you do not have permission to post this topic. Either your posting privileges have been removed or you are trying to post to a forum that has limitations on the types of members that can post to it."); } } } #end do post the topic sr sub SubmitEdit { #verify that forum fields are complete if (($in{'UserName'} eq "") || ($in{'Password'} eq "") || ($in{'EditedMessage'} eq "")) { &StandardHTML("You did not complete all required form fields! Remember that only registered users may edit their own posts. Please go back and re-enter."); } else { ## check UBB and HTML status for this forum @thisforum = &GetForumRecord($number); $ThisForumName = $thisforum[1]; chomp($thisforum[10]); ## $UBBCodeAllow = $thisforum[5]; $HTMLAllow = $thisforum[4]; $UBBImages = $thisforum[10]; ## $ForumStatus = "$thisforum[3]"; $LWA = $thisforum[6]; $PrivateMax = $thisforum[13]; chomp($PrivateMax); $CheckSubject = &decodeURL($in{'TopicSubject'}); if ($CheckSubject =~ /$ForumsPath/$ExactPath/$in{'topic'}"); for $theline(@newthread) { chomp($theline); print NEWBIE "$theline\n"; } close(NEWBIE); &Unlock("lock.file"); ##CREATE HTML FILE FOR Revised THREAD &CreateThreadHTML("Forum$number", "$topic", "0", "1"); #update forum summary file and threads file &UpdateForumDetails($number); #update total post total on lastnumber.file &UpdateForumTotals("$number", 0, 1, "no"); } #print to screen &Forward("$GoTo", "Thanks for deleting the post, $UserName! We are now sending you back automatically to the page you just modified."); } elsif ($in{'IPDisplay'} eq "yes") { unless ( ($ModMatch eq "true") || ($profileinfo[4] =~ m/Admin/)) { &StandardHTML("Sorry, you are not permitted to view IP Numbers."); exit; } @thistopic = &OpenFile("$ForumsPath/$ExactPath/$topic"); foreach $uno(@thistopic) { @thisline = split(/\|\|/, $uno); if ($thisline[1] eq "$in{'ReplyNum'}") { $ThisIP = "$thisline[7]"; $ThisName = "$thisline[2]"; $ThisMessage = "$thisline[6]"; } } if ($ThisIP eq "") { &StandardHTML("Sorry, we could not find a record for that post. Perhaps someone recently deleted it."); exit; } print<IP Display $HeaderInsert $Header

I P      D I S P L A Y

Return to: Forum | Topic

$BorderTop
Here is the requested IP number:
IP Number $ThisIP
Post: posted by $ThisName
$ThisMessage
$BorderBottom



$Footer
CLOSE } else { ## format the edited message $EditedMessage = $in{'EditedMessage'}; ## IF HTML is not allowed, render HTML useless if ($HTMLAllowed eq "no") { $EditedMessage =~ s//>/g; } else { #don't allow HTML SCRIPT TAGS $EditedMessage =~ s///ig; } $EditedMessage = &CensorCheck("$EditedMessage"); #truncate extra long words $EditedMessage = &Truncate("$EditedMessage"); #Smiley/Frown conversion--- if ($DisableSmilies ne "yes") { $EditedMessage = &Smilies("$EditedMessage"); } #UBB Code-ify (if allowed) if ($UBBCodeAllow eq "is") { $EditedMessage = &UBBCode("$EditedMessage"); } #END UBB CODE #convert newlines/carriage returns to HTML $EditedMessage = &ConvertReturns("$EditedMessage"); &GetDateTime; if ($DateFormat eq "US") { $EditDate = $HyphenDate; } elsif ($DateFormat eq "Euro") { $EditDate = "$EuroDate" } elsif ($DateFormat eq "USX") { $EditDate = &DateFormat("$HyphenDate", "USExpanded"); } else { $EditDate = &DateFormat("$HyphenDate", "EuroExpanded"); } # append edit note to the message $EditedMessage .= qq(

[This message has been edited by $UserName (edited $EditDate).]); $EditedMessage= &PipeCleaner("$EditedMessage"); #check for excess images- if ($EditedMessage =~ m/(IMG SRC){16,}/i) { &StandardHTML("We cannot process your posting, because you have exceeded the maximum number of images allowed per post. The current maximum is 15. "); exit; } $EditLine = "Z||$in{'ReplyNum'}||$postUserName||$postdate||$posttime||$postemail||$EditedMessage||$IPnum||$regstatus||$MsgIcon"; foreach $one(@editthread) { chomp($one); if ($one =~ /^Z\|\|$in{'ReplyNum'}/) { push (@revised, $EditLine); } else { push (@revised, $one); } } #open thread for writing &Lock("lock.file"); open (POST, ">$ForumsPath/$ExactPath/$topic"); foreach $thisone(@revised) { chomp($thisone); print POST ("$thisone\n"); } close(POST); &Unlock("lock.file"); ($TopicNum, $junk) = split(/\./, $topic); &Forward("$GoTo", "Thanks for editing the message, $UserName! We are now sending you back automatically to the thread list for this topic."); chomp($origmessage); $OrigText = &Indexify("$origmessage"); ##CREATE HTML FILE FOR Revised THREAD &CreateThreadHTML("Forum$number", "$topic", "0", "1"); } #end if/else } # end DoTheEdit sr sub ReplyFormHTML { if ($DisplayRegistration eq "NO") { $WantRegWording = ""; $ForgetPW = ""; $ForgotPW2 = ""; $RegWordingField = ""; $PWField = ""; $CookieStuff = qq%document.REPLIER.UserName.focus();%; } else { $WantRegWording = qq(Want to register?); $ForgetPW = qq(Forget your password?); $ForgotPW2 = qq(If you have previously registered, but forgotten your password, click here.); $RegWordingField = qq( About Registration $RegistrationWording); $PWField = qq( Your Password:   $ForgetPW); $CookieStuff = qq%document.REPLIER.UserName.value = getCookie("UserName"); document.REPLIER.Password.value = getCookie("Password"); document.REPLIER.ReplyMessage.focus();%; } if ($AllowIcons eq "TRUE") { $IconWording = &IconFieldHTML; } else { $IconWording = ""; } print <$BBName - Reply to Topic $HeaderInsert $Header
Forum:$Forum
Topic:$TopicSubject
$WantRegWording

$BorderTop $RegWordingField $RegistrationOffWording $PWField $LWAField $IconWording
Who Can Post? $LWADisclaimer
Your UserName:
Your Reply:


$ISHTML
$ISUBB
$UBBImagesWording

$SmiliesLink

Options $DisableSmiliesWording $ShowSignature
$BorderBottom

$ForgotPW2

*If HTML and/or UBB Code are enabled, this means you can use HTML and/or UBB Code in your message.
REPLYFORM } # end ReplyFormHTML sub ReplyFormBottom { $IFRAMEalt = &BuildTopicReview; if ($InlineFrame eq "TRUE") { $IFRAME = qq(); } else { $IFRAME = $IFRAMEalt; } print< $IFRAME

REPLYFORMBOTTOM &PageBottomHTML; } ## END Reply Form Bottom sr sub BuildTopicReview { @thistopic = &OpenFile("$ForumsPath/Forum$number/$topic"); @sorttopic = sort(@thistopic); $TotalPosts = @sorttopic; if (($TotalPosts > 26) || ($PostPermissions eq "private")) { $Summary = qq( *** Click here to review this topic. ***); } else { $Summary = qq($BorderTop); foreach $row(@sorttopic) { if ($row !~ /^A/) { @posted = split(/\|\|/, $row); $Summary .= qq(); } } $Summary .= "
T O P I C     R E V I E W
$posted[2]$posted[6]
$BorderBottom"; } return($Summary); } sub TopicFormHTML { if ($DisplayRegistration eq "NO") { $WantRegWording = ""; $ForgotPWWording = ""; $LostPWWording = ""; $PWField = ""; $RegWordingField = ""; $CookieStuff = qq%document.PostTopic.UserName.focus();%; } else { $WantRegWording = qq(Want to register?); $ForgotPWWording = qq(If you have previously registered, but forgotten your password, click here.); $LostPWWording = qq(Forget your password?); $PWField = qq( Your Password:  $LostPWWording); $RegWordingField = qq( About Registration $RegistrationWording); $CookieStuff = qq%document.PostTopic.UserName.value = getCookie("UserName"); document.PostTopic.Password.value = getCookie("Password"); document.PostTopic.TopicSubject.focus();%; } if ($AllowIcons eq "TRUE") { $IconWording = &IconFieldHTML; } else { $IconWording = ""; } print < $BBName - Post New Topic $HeaderInsert $Header
Post New Topic for Forum:
   $Forum
$WantRegWording
$BorderTop $RegWordingField $RegistrationOffWording $PWField $LWAField $IconWording
Who Can Post? $LWADisclaimer
Your UserName:
Subject:
Message:


$ISHTML
$ISUBB
$UBBImagesWording

$SmiliesLink

Options $EmailNotificationHTML
$DisableSmiliesWording $ShowSignature
$BorderBottom


*If HTML and/or UBB Code are enabled, this means you can use HTML and/or UBB Code in your message.

$ForgotPWWording

FORM &PageBottomHTML; } ## END Topic Form LWA HTML sub OpenCloseThread { my $which = shift; my $whichcap = ucfirst($which); if ($whichcap eq "Close") { $TheRunner = qq(C L O S E      T O P I C); } else { $TheRunner = qq(R E - O P E N      T O P I C); } $TheTitle = qq($BBName - Request to $whichcap Thread); $TheIntro = qq(Request to $whichcap Thread: $TopicSubject ); $HiddenStuff = qq(

); &AuthorizeCheck($TheTitle, $TheIntro, $HiddenStuff, $TheRunner); } sub EditPost { #check to make sure edit post is ON if (($EditOption eq "ON") || ($EditOption eq "NODELETE")) { ## check UBB and HTML status for this forum @thisforum = &GetForumRecord($number); $LWA = $thisforum[6]; $UBBCodeAllow = $thisforum[5]; $HTMLAllow = $thisforum[4]; $UBBImages = $thisforum[10]; #if private... do not display without checking to make sure that the user has permission if ($LWA eq "private") { #check for private cookies to see if we can proceed immediately &get_cookie; #retrieves all current cookies $PasswordPrivate = "$cookie{PasswordPrivate}"; $UserNamePrivate = "$cookie{UserNamePrivate}"; $NumbersPrivate = "$cookie{ForumNumberPrivate}"; $DIRPW = "$thisforum[7]"; $ExactPath = "Forum$number/private-$DIRPW"; if ($NumbersPrivate ne "") { &VerifyID; if (($ForumPW ne "") && ($ProceedNow ne "true")) { &ConfirmIdentity; exit; } } else { &StandardHTML("Either your browser does not support cookies or you have turned cookies off in your browser. Unfortunately, we require that cookies be used in order to allow editing of messages in private forums. Thus, we cannot process your request to edit this message."); exit; } } else { $DIRPW = ""; $ExactPath = "Forum$number"; $ProceedNow = "true"; } #### if ($ProceedNow eq "true") { chomp($thisforum[10]); $UBBImages = "$thisforum[10]"; &CheckCoding; ## open thread file @thisthread = &OpenThread("$topic"); ## grab the proper message @matcher = grep(/^Z\|\|$in{'ReplyNum'}/, @thisthread); $matched = $matcher[0]; @thispost = split(/\|\|/, $matched); $message = $thispost[6]; chomp($message); $author = $thispost[2]; chomp($author); $postdate = $thispost[3]; chomp($postdate); $posttime = $thispost[4]; chomp($posttime); $message = &PrepForEdit($message); if ($EditOption eq "NODELETE") { $DeleteWarn = qq%Only forum leaders ($AdminTitle, $ModeratorTitle) or the person that posted this message may edit this message (and only registered users may edit/delete posts)

Note: Only forum leaders may delete posts.%; } else { $DeleteWarn = qq%Only forum leaders ($AdminTitle, $ModeratorTitle) or the person that posted this message may edit or delete this message. Only registered users may edit/delete posts!%; } if ($in{'ReplyNum'} eq "000000") { $WarningWords = "Note: deleting this post will result in the deletion of the entire topic, since this post is the first post in the topic."; } print < $BBName - Edit this post $HeaderInsert $Header

Forum: $Forum
Topic: $TopicSubject

$BorderTop
$DeleteWarn
Delete? To delete this post, check this box.
$WarningWords
$DisableSmiliesWording
Your UserName:
Your Password:   Forget your password?
Message to Edit:

$ISHTML
$ISUBB
$UBBImagesWording

$SmiliesLink

Originally posted by $author on $postdate $posttime
$BorderBottom

*If HTML and/or UBB Code are enabled, this means you can use HTML and/or UBB Code in your message.

EditFORM &PageBottomHTML; } else { &StandardHTML("Sorry, but the edit option has been disabled by your bulletin board administrator."); } } else { &StandardHTML("Sorry, but you are not authorized to edit any posts in this forum."); } } # end edit display sub CheckCoding { if ($thisforum[4] eq "is") { $ISHTML = "*HTML is ON"; $HTMLAllowed = "yes"; } else { $ISHTML = "*HTML is OFF"; $HTMLAllowed = "no"; } if ($thisforum[5] eq "is") { $ISUBB = "*UBB Code is ON"; $UBBAllowed = "yes"; } else { $ISUBB = "*UBB Code is OFF"; $UBBAllowed = "no"; } if (($UBBImages eq "OFF") && ($UBBAllowed eq "yes")) { $UBBImagesWording = "\[IMG\] UBB Code Not Allowed!"; } } sub VerifyID { ##check ID using username set as cookie $NameFound = "no"; $ProfileNumber = &GetUserNumber($UserNamePrivate); if ($NumbersPrivate ne "") { if ($NumbersPrivate =~ /B/) { @CheckAccess = split("B", $NumbersPrivate); } else { @CheckAccess = $NumbersPrivate; } CHECKER: foreach $checker(@CheckAccess) { chomp($checker); if ($checker eq "$number") { $ProceedNow = "true"; last CHECKER; } } } if ($ProceedNow ne "true") { if ($ProfileNumber ne "") { $NameFound = "yes"; } else { $NameFound = "no"; } @thisprofile = &OpenProfile("$ProfileNumber.cgi"); if ($PasswordPrivate eq "$thisprofile[1]") { $Permission = "$thisprofile[4]"; $Status = $thisprofile[8]; ($GenPerms, $SpecificPerms) = split(/\&/, $Permission); if (($Status eq "Administrator") || ($Status eq "Moderator")) { $ProceedNow = "true"; } if (($SpecificPerms ne "") && ($ProceedNow ne "true")){ chomp($specificPerms); @accessarray = split(",", $SpecificPerms); CHECKARRAY: foreach $uno(@accessarray) { if ($uno eq "$number") { $ProceedNow = "true"; last CHECKARRAY; } } } } } } #end VerifyID sub DeletePost { my $DeleteTitle = qq($BBName - Delete this post); my $DeleteRunner = qq(D E L E T E     T O P I C); my $DeleteIntro = qq(To delete this entire topic, identify yourself below. Do not press the SUBMIT button unless you are positive that you want to delete this entire topic!

Topic: $TopicSubject); $DeleteHidden = qq(

); &AuthorizeCheck($DeleteTitle, $DeleteIntro, $DeleteHidden, $DeleteRunner); } # end delete display sub ProcessClose { if ( ($in{'UserName'} eq "") || ($in{'Password'} eq "") ) { &StandardHTML("You did not complete all required form fields! Please go back and re-enter."); } else { # verify admin or mod status $ProfileNumber = &GetUserNumber($UserName); if ($ProfileNumber ne "") { $NameFound = "yes"; } else { $NameFound = "no"; } if ($NameFound eq "yes") { @profilestats = &OpenProfile("$ProfileNumber.cgi"); if ($in{'Password'} eq "$profilestats[1]") { $Status = "$profilestats[8]"; &CheckTheStatus; #get moderator for this forum $Moderator = ("Forum" . "$number" . "Moderator"); $Moderator = $$Moderator; @mods = split(/\|\|\^\|\|/, $Moderator); $ModMatch = ""; foreach $unomod(@mods) { if ($unomod eq "$UserName") { $ModMatch = "true"; } } if (($AdminStatus eq "true") || ($ModMatch eq "true")) { @thisforum = &GetForumRecord($number); $LWA = $thisforum[6]; $PrivateMax = $thisforum[13]; chomp($PrivateMax); #open ubb file @thisthread = &OpenThread("$topic"); @stats = split(/\|\|/, $thisthread[0]); $Notes = $stats[1]; chomp($stats[4]); chomp($stats[5]); chomp($stats[6]); chomp($stats[7]); if ($Notes =~ /N/) { $AddN = "N"; } else { $AddN = ""; } chomp($stats[7]); #prepare new stats line if ($in{'which'} eq "open") { $StatsLine = "A||$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]"; $about = "reopened"; } else { $StatsLine = "A||X$AddN||$stats[2]||$stats[3]||$stats[4]||$stats[5]||$stats[6]||$stats[7]"; $about = "closed"; } foreach $row(@thisthread) { chomp($row); if ($row =~ m/^A/) { push(@revised, $StatsLine); } else { push(@revised, $row); } } # update ubb file &Lock("lock.file"); open (FORUM, ">$ForumsPath/$ExactPath/$topic"); foreach $ubbline(@revised) { chomp($ubbline); print FORUM ("$ubbline\n"); } close (FORUM); &Unlock("lock.file"); chmod(0666, "$ForumsPath/$ExactPath/$topic"); # Send confirmation screen &Forward("forumdisplay.cgi?action=topics&DaysPrune=$DaysPrune&number=$number&forum=$ForumCoded", "The following thread has been $about:

$TopicSubject

You are being automatically transported to the $Forum forum."); # re-do the HTML page associated with this file &CreateThreadHTML("Forum$number", "$topic", "0", "1"); #update threads summary file &CurrentDate; if (-e "$ForumsPath/$ExactPath/forum$number.threads") { &AdjustForClose($number, $topic, $in{'which'}); } else { &ForumSummary($number); } } else { &StandardHTML("Sorry, but you are not authorized to perform this function. Use your Back button."); } } else { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } else { &StandardHTML("Sorry, but we couldn't find a record for the UserName you entered. Please try again. Use your Back button."); } ##END IF/ELSE NAME CHECK BLOCK } # end missing fields check } # end process close sr sub floodcheck { # blocks multiple posting in a short period #floodcheck sr written by Michael Farris! #$wait_between_posts = "1.0"; # edit in the default number of minutes to wait $lastpost_list_length = 80; # edit in the number of records to keep my $IPNumber = $ENV{'REMOTE_ADDR'}; # the IP address my $this_post_time = time(); # secs since 1970 open(LASTPOST, "$NonCGIPath/BanLists/Floodcheck.cgi"); # don't bother with error code if it doesn't exist @last_post_list = ; close(LASTPOST); foreach (@last_post_list) { # check if this user has posted already if (/^$IPNumber/){ ($junk,$last_post_time) = split(/\|!!\|/,$_); chomp($last_post_time); last; } } # end foreach # $FloodCheckSpan (in seconds) is set in General Settings if ( int(($this_post_time - $last_post_time) < $FloodCheckSpan)){ &StandardHTML("Sorry! We have flood-control activated. You cannot post within $FloodCheckSpan seconds of your last post. Please try again after this period of time elapses."); exit; } else { # add the IP and posting time to the list if (unshift(@last_post_list, "$IPNumber|!!|$this_post_time\n") > $lastpost_list_length){ $#last_post_list = $lastpost_list_length; # limit length of list } open(LASTPOST, ">$NonCGIPath/BanLists/Floodcheck.cgi") || die(&StandardHTML("Permission problem writing new file in BanList Dir $!")); print LASTPOST @last_post_list; close(LASTPOST); } # end else return 1; } # end SR