### UBB COMMON ROUTINE LIBRARY # UBB Registration Routines Library # # Ultimate Bulletin Board is copyright Infopop Corporation, 1998-2000. # # ------------ ubb_library2.pl ------------- # sub ConvertForums2HTML { my($ForumNumber) = shift; my($ForumTotal) = shift; my($StartWith) = shift; $number = "$ForumNumber"; @thisforum = &GetForumRecord($number); $Forum = $thisforum[1]; $LWA = "$thisforum[6]"; $PrivateMax = "$thisforum[13]"; chomp($PrivateMax); $ForumCoded = &HTMLIFY($Forum); $ForumCoded =~ tr/ /+/; &GetExactPath($number); #retrieve all topics @threads1 = &OpenFile("$ForumsPath/$ExactPath/forum$number.threads"); foreach $finder(@threads1) { @thisline = split(/\|\^\|/, $finder); my $TopicNum = $thisline[1]; if ($TopicNum ne "") { my $Top = "$TopicNum" . ".cgi"; push(@threads2, $Top); } } @threads = sort(@threads2); ($lonumber, @junky) = split(/\./, $threads[0]); $LowNumber = $lonumber + 0; #limit processing to Cycle rate $Cycle = $in{'Cycle'} + 0; $Start = $StartWith + 0; if ($LowNumber > $StartWith) { $Start = $LowNumber; } $End = $Start + $Cycle; #determine highest thread number! @highest = reverse(@threads); ($hinumber, @junk) = split(/\./, $highest[0]); $High = $hinumber + 0; $GoToNextForum = ""; if ($High <= $End) { $End = $High; $GoToNextForum = "true"; } #store select list $ThisSelectList = &GetForumSelectList3; $Stop = ""; my $New = ""; my $Last = ""; CHECKEACH: for $eachthread(@threads) { $ThreadNum = substr($eachthread, 0, 6); $ThreadNumber = $ThreadNum + 0; $Last = $New; if (($ThreadNumber >= $Start) && ($ThreadNumber <= $End)) { chomp($eachthread); unless (-e "$ForumsPath/$ExactPath/$eachthread") { &ConvertToCGI("$ThreadNum.ubb");; } $New = "true"; if (($PrivateMax eq "yes") && ($LWA eq "private")) { unlink("$ForumsPath/$ExactPath/HTML/$ThreadNum.html"); } &CreateThreadHTML("Forum$number", "$eachthread", "0", "1"); } else { $New = "false"; } if (($New eq "false") && ($Last eq "true")) { last CHECKEACH; } } #end for threads loop if ($GoToNextForum eq "true") { $number++; $previous = ($number - 1); $StartWith = 0; } else { $previous = $number; $StartWith = $End + 1; } $UserName =~ tr/ /+/; $Password =~ tr/ /+/; if ($in{'UpdateForumChoice'} =~ /\d/) { $HowProcess = "SINGLE"; } else { $HowProcess = $in{'HowProcess'}; } if (($in{'UpdateForumChoice'} =~ /\d/) || ($HowProcess eq "SINGLE")) { $SingleForumProcess = "true"; } if (($GoToNextForum eq "true") && ($SingleForumProcess eq "true")) { if ($in{'UpdateForumChoice'}) { $UpdateNumber = $in{'UpdateForumChoice'}; } else { $UpdateNumber = $number - 1; } &EndUpdate("T H R E A D S U P D A T E D", "All topic threads in Forum $UpdateNumber have now been updated to reflect your current UBB Control Panel settings."); exit; } if ($number <= $TotalForums) { $ActionWording = qq(We are updating each of your existing threads to reflect all current settings in the control panel.
Forum $previous is currently being updated. Please wait while we continue updating!
We just finished updating threads $Start through $End in Forum $previous
);
$ForwardURL = "$CGIURL/postings.cgi?action=ContinueUpdate&number=$number&TotalForums=$TotalForums&StartWith=$StartWith&Cycle=$Cycle&HowProcess=$HowProcess";
&ContinueThis($ForwardURL, $ActionWording);
exit;
} else {
#check to see if archives exist--
if (-e "$NonCGIPath/Archives/archives.pl") {
@archives = &OpenFile("$NonCGIPath/Archives/archives.pl");
if ($archives[0] ne "") {
$TotalArchives = @archives;
$ActionWording = qq(Please wait while we continue updating... we are now updating archives!);
$ForwardURL = "$CGIURL/archive.cgi?action=ContinueArchiveUpdate&ArchiveRow=1&TotalArchives=$TotalArchives&StartWith=1&Cycle=$Cycle&HowProcess=$HowProcess";
&ContinueThis($ForwardURL, $ActionWording);
exit;
} else {
&EndUpdate("T H R E A D S U P D A T E D", "Thank you for your patience. All topic threads have now been updated to reflect your current UBB Control Panel settings.");
}
} else {
&EndUpdate("T H R E A D S U P D A T E D", "Thank you for your patience. All topic threads have now been updated to reflect your current UBB Control Panel settings.");
}
}
} # end ConvertForums2HTML sr
sub CreateThreadHTML {
my($ForumIs) = shift;
my($ThreadFile) = shift;
my($ArrayStart) = shift;
my($PageNumber) = shift;
$PageNumber = $PageNumber + 0;
$ArrayStart = $ArrayStart + 0;
($trash, $number) = split("Forum", $ForumIs);
$ThreadNumber = substr($ThreadFile, 0, 6);
if ($AllowSearch eq "FALSE") {
$SearchOption = "";
} else {
$SearchOption = qq(| search);
}
#create random numbers for headers/footers
if ($RandomNumber) {
$RandomNumber = $RandomNumber + 2;
$RandomNumber2 = $RandomNumber2 + 2;
} else {
@digit = (0..9);
srand(time);
$num1 = rand(10);
$num2 = rand(10);
$num3 = rand(10);
$num4 = rand(10);
$RandomNumber = ("$digit[$num1]" . "$digit[$num2]" . "$digit[$num3]" . "$digit[$num4]");
$RandomNumber2 = $RandomNumber + 1004;
}
if ($Header ne "") {
$Header2 = $Header;
$Header2 =~ s/UBBrandomX/$RandomNumber/isg;
$Header2 =~ s/UBBrandomY/$RandomNumber2/isg;
}
if ($Footer ne "") {
$Footer2 = $Footer;
$Footer2 =~ s/UBBrandomX/$RandomNumber/isg;
$Footer2 =~ s/UBBrandomY/$RandomNumber2/isg;
}
my @threadinformation = &OpenThread("$ThreadFile");
# ExactPath now set...
if ($FileExt eq "") {
if (($LWA eq "private") && ($PrivateMax eq "yes")) {
$FileExt = "cgi";
} else {
$FileExt = "html";
}
}
my @statarray = split(/\|\|/, $threadinformation[0]);
if ($ReverseThreads eq "TRUE") {
@threadinfo = reverse(@threadinformation);
$ALine = pop(@threadinfo);
chomp($ALine);
unshift(@threadinfo, $ALine);
} else {
@threadinfo = @threadinformation;
}
my $ThisPage = "";
my $TopicPageTotal = "";
my $PostTotal = 0;
my $PageName = "";
#adjust for max post per page, if necessary
if (($HTMLDisplayMax ne "") && ($HTMLDisplayMax ne "NONE")) {
$PostTotal = @threadinfo - 1;
if ($PostTotal > $HTMLDisplayMax) {
$TotalPages = $PostTotal / $HTMLDisplayMax;
if ($TotalPages =~ /\./) {
($Whole, $junk) = split(/\./, $TotalPages);
$TotalPages = $Whole + 1;
} else {
$TotalPages = $TotalPages;
}
$TopicPageTotal = "
This topic is $TotalPages pages long:";
$eachpage = "";
for ($eachpage == 1; $eachpage <= $TotalPages; $eachpage++) {
if ($eachpage == 1) {
$PageName = "$ThreadNumber";
} else {
$PageName = "$ThreadNumber-$eachpage";
}
if ($PageNumber == $eachpage) {
$TopicPageTotal .= qq( $eachpage );
} else {
if ($FileExt eq "cgi") {
$TopicPageTotal .= qq( $eachpage )
} else {
$TopicPageTotal .= qq( $eachpage )
}
}
}
$ThisPage = "(Page $PageNumber)";
if (($ArrayStart eq "") || ($ArrayStart eq "0")) {
$MaxPoint = $HTMLDisplayMax;
@postinfo = @threadinfo[1... $MaxPoint];
$ContinueAt = $MaxPoint + 1;
$NextPage = $PageNumber + 1;
} else {
$MaxPoint = ($ArrayStart + $HTMLDisplayMax) - 1;
if ($MaxPoint >= $#threadinfo) {
$MaxPoint = $#threadinfo;
@postinfo = @threadinfo[$ArrayStart... $MaxPoint];
$ContinueAt = "";
} else {
@postinfo = @threadinfo[$ArrayStart... $MaxPoint];
$ContinueAt = $MaxPoint + 1;
$NextPage = $PageNumber + 1;
}
}
} else {
@postinfo = @threadinfo[1... $#threadinfo];
$ContinueAt = "";
$TotalPages = 1;
}
} else {
@postinfo = @threadinfo[1... $#threadinfo];
$ContinueAt = "";
$TotalPages = 1;
} #end if HTML max display
$UNCoded = $statarray[3];
$UNCoded =~ tr/ /+/;
$TopicSubject = $statarray[4];
chomp($TopicSubject);
$SubjectCoded = &HTMLIFY($TopicSubject);
$SubjectCoded =~ tr/ /+/;
#if Email is ON, display email thread wording
if (($UseEmail eq "ON") && ($ThisRestrict ne "private") && ($UBBFriendUSE ne 'OFF')) {
$UBBFriend = "processed";
$EmailThreadWording = qq(
UBBFriend: Email This Page to Someone!);
} else {
$UBBFriend = "processed";
$EmailThreadWording = "";
}
chomp($statarray[7]);
# Check to see if this thread has been closed...
if ($statarray[1] =~ m/X/) {
$ThisThreadClosed = qq(
Topic Closed);
$CloseTransferWording= qq($statarray[7]);
if (length($statarray[7]) > 8) { # no UBBFriend if transferred
$EmailThreadWording = "
";
}
$CloseOption = qq(Open Topic);
$ReplyButton = qq();
} else {
$ThisThreadClosed = "";
$CloseTransferWording= "";
$CloseOption = qq(Close Topic);
$ReplyButton = qq(
);
}
$ArchiveOption = qq(Archive/Move);
$DeleteOption = qq(Delete Topic);
#PRINT THREAD TOP---
unless (-d "$ForumsPath/$ExactPath/HTML") {
mkdir("$ForumsPath/$ExactPath/HTML", 0777);
chmod (0777, "$ForumsPath/$ExactPath/HTML");
}
if ($ReplyRestrict eq "") {
if ($ThisRestrict eq "private") {
$ReplyRestrict = "";
} else {
($junk, $ReplyRestrict) = split(/&/, $ThisRestrict);
}
}
if ($ReplyRestrict eq "none") {
$ReplyWording = "";
} else {
$ReplyWording = qq($ReplyButton);
}
if ($CustomTitle eq "") {
$CustomTitle = $forumfacts[9];
chomp($CustomTitle);
if ($CustomTitle eq "") {
$CustomTitle = "$BBTitle";
}
}
if ($CategoriesOnly eq "true") {
if ($category eq "") {
$category = $forumfacts[0];
$CategoryName = &GetCatName($category);
} else {
$CategoryName = &GetCatName($category);
}
$FolderLine = qq(
$CategoryName [all categories]

$Forum

$TopicSubject $ThisPage);
} else {
$FolderLine = qq(
$BBName

$Forum

$TopicSubject $ThisPage);
}
if ($DisplayRegistration eq "NO") {
$RegLinkHere = "";
} else {
$RegLinkHere = qq(profile | register |);
}
$ThisThread = qq(
|
$FolderLine
|
| $EmailThreadWording $CloseTransferWording $TopicPageTotal | next newest topic | next oldest topic |
| Author | Topic: $TopicSubject |
|
$thisline[2] $ThisStatus $AuthorExtra |
$ThisIcon
posted $ThisDate $FormatTime
$ProfileString $EmailString $EditLink $DirectReply
$ReplyText $ThisIPWording |
| $TopicPageTotal All times are $TimeZone | next newest topic | next oldest topic |
$YourCopyrightNotice
$infopopcopy
Ultimate Bulletin Board $Version
Thank you. $ConfirmLine
$infopopcopy
Ultimate Bulletin Board $Version