#!/usr/bin/perl # ### PRIMARY UBB SCRIPT ## # # Ultimate Bulletin Board is copyright Infopop Corporation, 1998-2000. # # ------------ forumdisplay.cgi ------------- # # This file contains the functionality for the UBB # individual forum page display. # # Infopop Corporation 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 # ############################################################### # iCentric modifications: (done) # 8/16/2001 # iCentric - switcher to block listed IP's (ss) # 10/21/2000 # Rate this topic 2.1 (ss) (done) # 10/20/2000 # ubb hack SSI Counting Version 1.1 (ss) (disabled) # 9/26/2000 # * Include IClib2.pl to required files # * Added js window open function # * Called IC2ForumNotes(#) within sub TopicTopHTML # * Added Meta no-cache to sub TopicTopHTML ############################################################### # #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"; 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 "Date.pl"; require "mods.file"; require "ubb_library.pl"; # ubb hack SSI Counting Version 1.1 (ss) require "Count_Extension.cgi"; # iCentric libraries require "IClib2.pl"; }; ############################################################### ### iCentric QQAdditions ############################################################### ### iCentric Begin ### iCentric ############################################################### print ("Content-type: text/html\n\n"); &ReadParse; 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; $CategoryName = &GetCatName($category); } if ($Name eq "PasswordConfirm") { $PasswordConfirm = $Value; } if ($Name eq "number") { $number = $Value; unless($number =~ /^A:\d{6}$/i) { $number =~ s/\D//sg; } } if ($Name eq "DaysPrune") { $DaysPrune = $Value; } if ($Name eq "topic") { $topic = $Value; } if ($Name eq "TotalPosts") { $TotalPosts = $Value; } if ($Name eq "sendto") { $sendto = $Value; } } # end FOREACH $row if ($VariablesPath eq "") { $VariablesPath = $CGIPath; } if (-e "$ForumsPath/Forum$number/forumstyles.file") { require "$ForumsPath/Forum$number/forumstyles.file"; $use_forum_styles++; } else { require "$VariablesPath/Styles.file"; } $infopopcopy =~ s/\"\"/\"$CopyrightTextColor\"/; # fix missing copyright text color in custom styles my $RegLinkHere = ""; unless ($DisplayRegistration eq "NO") { $RegLinkHere = qq(home | profile | register |); } if ($AllowSearch eq "FALSE") { $SearchOption = ""; } else { $SearchOption = qq(| search); } if ($use_forum_styles) { # set above with -e $Header = $ForumHeader unless ($ForumHeader eq ''); $Footer = $ForumFooter unless ($ForumFooter eq ''); } if( ($Header ne "") || ($Footer ne "") ) { #create random numbers for headers/footers $RandomNumber = &MakeRandomNumber; $RandomNumber2 = $RandomNumber + 100074; 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( |
$Forum (moderated by $ModeratorLine) $AnnouncementBlock |
![]() $FolderLine
$RegLinkHere preferences | faq $SearchOption
|
$TopicLegend $ReplyLegend |
$!");
$topic_counter =
TrueTopicBottom
&PageBottomHTML;
}
sub TopicBottom2NonJShtml {
if ($HotIcons eq "ON") {
$YellowHot = "(
TrueTopicBottom
&PageBottomHTML;
}
sub idcheck {
#open member file to see if user can access private forum
if (($in{'UserName'} eq "") || ($in{'Password'} eq "")) {
&StandardHTML("You did not complete all required form fields! Please go back and re-enter.");
} else {
#open registration file, if possible
$NameFound = "no";
$ProfileNumber = &GetUserNumber($in{'UserName'});
if ($ProfileNumber ne "") {
$NameFound = "yes";
} else {
$NameFound = "no";
}
$AllowedToEnter = "";
if ($NameFound eq "yes") {
@theprofile = &OpenProfile("$ProfileNumber.cgi");
if ($in{'Password'} eq "$theprofile[1]") {
$Permission = $theprofile[4];
$Status = $theprofile[8];
if ($Permission =~ /\&/) {
($junk, $forumnumbers) = split(/\&/, $Permission);
chomp($forumnumbers);
if ($forumnumbers =~ /,/) {
@forumnums = split(",", $forumnumbers);
} else {
@forumnums = "$forumnumbers";
}
}
#check against forum password, if necessary
@thisforum = &GetForumRecord($in{'forumnumber'});
if ($thisforum[12] ne "") {
if ($in{'ForumPassword'} eq "$thisforum[12]") {
$PasswordCheck = "true";
}
}
my $PermissionCheck = "false";
CHECKPERM: foreach $theesone(@forumnums) {
if ($theesone eq "$in{'forumnumber'}") {
$PermissionCheck = "true";
last CHECKPERM;
}
}
$ThisNumber = $in{'forumnumber'};
$UserName = &decodeURL("$in{'UserName'}");
&CheckModStatus("Forum$in{'forumnumber'}", "$UserName");
if (($Status eq "Administrator") || ($PermissionCheck eq "true") || ($ModMatch eq "yes") || ($PasswordCheck eq "true")) {
&GrantAccess;
} else {
&StandardHTML("Sorry, but you are not permitted to access this forum.");
}
} else {
&StandardHTML("The password you entered was not correct. Please use your back button to try again.");
}
} else {
&StandardHTML("We have no record of anyone registered with the name you entered. Please use your back button to try again.");
}
}
} # end id check
sub ConfirmIdentity {
if ($ForumPW ne "") {
$FPWWording = qq(
$Footer
CONFIRM
}
sub GrantAccess {
&GetCookieInfo;
if ($SetCookies eq "DirectorySpecific") {
$ExtraInfo = qq(domain=$TheDomain;path=/$ThePath;);
} else {
$ExtraInfo = "";
}
#get private forum dir
@forumarray = &GetForumRecord($in{'forumnumber'});
$PFDir = $forumarray[7];
print<
$ArchiveName
$MoreTopicsW
NearBottom
&PageBottomHTML;
}
##########
# iCentric Addition
##########
# iCentric - switcher to block listed IP's
sub ICipblocker
{
my $IPNumber = $ENV{'REMOTE_ADDR'}; # the IP address
my @IPbanlist2 = &OpenFile("$MembersPath/icentric/ICipblocker_list.cgi");
my $IPnum = "";
my $DateLog = &GetDateTime;
#check for private cookies to see if we can proceed immediately
&get_cookie; #retrieves all current cookies
my $UserName = "$cookie{UserName}";
my $UserNamePrivate = "$cookie{UserNamePrivate}";
if ($IPbanlist2[0] ne "")
{
foreach $IPnum (@IPbanlist2) {
if ($IPnum =~ /$IPNumber/) {
&StandardHTML("Sorry, but we are having some technical difficulties at this time. Please post again later. Thank you.");
open (ICFD, ">>$MembersPath/icentric/ICipblocker_log.cgi");
print ICFD ("$DateLog;$IPNumber;$UserName;$UserNamePrivate;$in{'UserName'};$ENV{'QUERY_STRING'}\n");
close (ICFD);
chmod (0666, "$MembersPath/icentric/ICipblocker_log.cgi");
exit;
} # end if
} # end foreach
} # end if
} # end ICipblocker
#
##########
exit(0); # comply with SafePerl
$FolderIcon
$IconField
$threadinfo[2]
$threadinfo[4]
$threadinfo[3]
$topic_counter
$ForumRating2
$TheDate $FormatTime
GUTS
# iCentric Begin
# ubb hack SSI Counting Version 1.1 (ss)
# added code above
#
#$topic_counter
#
# iCentric End
# iCentric Begin
# Rate this topic 2.1
$ForumRating2
# iCentric End
} ## END Guts HTML for Topic Page
sub TopicBottomHTML {
print<
$MoreTopicsW
All times are $TimeZone. $DateWording
Contains new posts since the last time you logged on $RedHot.
No new posts since the last time you logged on $YellowHot.
A Closed thread - no new replies accepted.
More than $HotCount replies)";
} else {
$YellowHot = "";
}
print<
An Open Thread $YellowHot.
A Closed thread - no new replies accepted.
If you are not an administrator or moderator and have not been given specific permission to access this forum but know the forum password, you must enter the password below in order to gain access. );
} else {
$FPWWording = "";
}
print <
Forum Password:
To return to Forum Summary, click here.
Thank you! We have confirmed your identity and are granting you access to the forum. You will be forwarded to the forum automatically within a few seconds.
Click here if you do not want to wait any longer (or if your browser does not automatically forward you).
$Footer
ForwardHTML
} #end GrantAccess
sub DisplayPrivate {
#verify permission to view
#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}";
if ($PasswordPrivate ne "") {
my @theforum = &GetForumRecord($number);
$DIRPW = "$theforum[7]";
&VerifyID;
} else {
&StandardHTML("Sorry, you have to view this topic by entering the forum first.");
exit;
}
if ($ProceedNow eq "true") {
@thisforum = &GetForumRecord($in{'number'});
#open file
my @thisfile = &OpenFile("$ForumsPath/Forum$in{'number'}/private-$thisforum[7]/HTML/$in{'topic'}.cgi");
foreach $row(@thisfile) {
print "$row";
}
exit;
} else {
&StandardHTML("You do not have permission to view this topic.");
exit;
}
}
sub VerifyID {
##check ID using username set as cookie
$NameFound = "no";
$ProfileNumber = &GetUserNumber($UserNamePrivate);
if ($NumbersPrivate ne "") {
if ($NumbersPrivate =~ /\:\:/) {
@CheckAccess = split(/\:\:/, $NumbersPrivate);
} else {
@CheckAccess = $NumbersPrivate;
}
CHECKER: foreach $checker(@CheckAccess) {
chomp($checker);
($checknum, $checkdir) = split(/\:/, $checker);
if ($checknum eq "$number") {
if ($checkdir eq "$DIRPW") {
$ProceedNow = "true";
last CHECKER;
} else {
&StandardHTML("We cannot confirm your identity.");
exit;
} #if checkdir
}# if checknum
} #foreach
} #if np
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);
$Moderator = ("Forum" . "$number" . "Moderator");
$Moderator = $$Moderator;
#split up Mod var
@mods = split(/\|\|\^\|\|/, $Moderator);
$ModMatch = "";
foreach $unomod(@mods) {
if ($unomod eq "$UserNamePrivate") {
$ModMatch = "true";
}
}
if (($Status eq "Administrator") || ($ModMatch eq "true")) {
$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 DisplayArchive {
my $ThisArchive = shift;
if (-e "$NonCGIPath/Archives/archives.pl") {
@archives = &OpenFile("$NonCGIPath/Archives/archives.pl");
foreach $uno(@archives) {
if ($uno =~ /^$ThisArchive/) {
($ArchiveNum, $ArchiveName, $ArchiveDescription) = split(/\|\#\|/, $uno);
$ArchiveDescription =~ s/"/"/isg;
$ArchiveDescription =~ s/|/\|/isg;
}
}
if ($ArchiveName eq "") {
&StandardHTML("We could not find that archive. Perhaps it has recently been deleted. Please your back button to return.");
exit;
}
} else {
&StandardHTML("No archives currently exist.");
exit;
}
if (-e "$NonCGIPath/Archives/Archive-$ArchiveNum/archives.thread") {
@thisarchive2 = &OpenFile("$NonCGIPath/Archives/Archive-$ArchiveNum/archives.thread");
} else {
@thisarchive2 = @blank;
}
@goodarray2 = sort {lc($a) cmp lc($b) } @thisarchive2;
$TotalGood2 = @goodarray2;
$TotalGood = $TotalGood2 - 1 ;
my $ADMax = 50;
$Sections = $TotalGood2 / $ADMax;
$Sections = "$Sections";
if ($Sections =~ /\./) {
($Whole, $junk) = split(/\./, $Sections);
$Sections = $Whole;
} else {
$Sections = $Sections - 1;
}
if ($in{'startpoint'} eq "") {
$StartPoint = 0;
$ArrayStop = $ADMax - 1;
if ($TotalGood <= $ArrayStop) {
$MoreTopicsWording = "";
$ArrayStop = $TotalGood;
} else {
for ($Section = 0; $Section <= $Sections; $Section++) {
$Starting = $Section * $ADMax;
$Block = $Section + 1;
if ($Block == 1) {
$MoreTopicsWording .= qq($Block );
} else {
$MoreTopicsWording .= qq($Block );
}
}
}
} else {
$StartPoint = $in{'startpoint'};
$ArrayStop = $StartPoint + $ADMax;
$ArrayStop--;
if ($TotalGood <= $ArrayStop) {
$ArrayStop = $TotalGood;
}
for ($Section = 0; $Section <= $Sections; $Section++) {
$Starting = $Section * $ADMax;
$Block = $Section + 1;
if ($StartPoint == $Starting) {
$MoreTopicsWording .= qq($Block );
} else {
$MoreTopicsWording .= qq($Block );
}
}
}
if ($MoreTopicsWording ne "") {
$MoreTopicsW = ("Page: $MoreTopicsWording");
}
@goodarray3 = @goodarray2[$StartPoint... $ArrayStop];
print<
$ArchiveDescription
$BBName
$ArchiveName
$BorderTop
Archive Topics are listed alphabetically below.
TOP
$AltColor = "$AltColumnColor1";
if (@goodarray3) {
foreach $one(@goodarray3) {
@thisone = split(/\|\#\|/, $one);
chomp($thisone[3]);
($theDate, $junk, $junk2) = split(/-/, $thisone[1]);
my $ThisYear = substr($theDate, 0, 4);
my $ThisMonth = substr($theDate, 4, 2);
my $ThisDay = substr($theDate, 6, 2);
my $StoredDate = "$ThisMonth-$ThisDay-$ThisYear";
if ($DateFormat eq "US") {
$FormatDate = $StoredDate;
$DateSize = "$TextSize";
}
elsif ($DateFormat eq "Euro") {
$FormatDate = &DateFormat("$StoredDate", "Euro");
$DateSize = "$TextSize";
}
elsif ($DateFormat eq "USX") {
$FormatDate = &DateFormat("$StoredDate", "USExpanded");
$DateSize = "1";
} else {
$FormatDate = &DateFormat("$StoredDate", "EuroExpanded");
$DateSize = "1";
}
print<Archive Topics Topic Starter Date Archived $thisone[0] $thisone[2] $FormatDate
GUTS
if ($AltColor eq "$AltColumnColor1") {
$AltColor = "$AltColumnColor2";
} else {
$AltColor = "$AltColumnColor1";
}
}
} else {
print<This archive is currently empty!
GUTS
}
print<
This is an archive. All archives are strictly read-only. To post messages, visit one of our forums.