#!/usr/local/bin/perl 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 "mods.file"; require "UltBB.setup"; require "Date.pl"; require "ubb_library.pl"; require "ubb_library2.pl"; require "Styles.file"; }; if ($@) { print "Error including required files: $@\n"; print "Make sure these files exist, permissions are set properly, and paths are set correctly."; exit; } &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 "Password") { $Password = $Value; } 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 "number") { $number = $Value; } if ($Name eq "topic") { $topic = $Value; } } # end FOREACH $row if ($VariablesPath eq "") { $VariablesPath = $CGIPath; } #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( |
Archive $ThisNumber is currently being updated. Please wait while we continue updating!
We just finished updating topics $StartPoint through $LastOne in Archive $ThisNumber ); $ForwardURL = "$CGIURL/archive.cgi?action=ContinueArchiveUpdate&ArchiveRow=$ArchRow&TotalArchives=$TotalArchie&StartWith=$NextStart&Cycle=$Cycle"; &ContinueThis($ForwardURL, $ActionWording); } sub ArchiveCenter { &VerifyAdmin($in{'UserNameCheck'}, $in{'PasswordCheck'}); if ($Proceed eq "true") { if ($in{'ArchiveOption'} eq "Create") { #validate fields if ( ($in{'ArchiveName'} eq "") || ($in{'ArchiveName'} !~ /[a-zA-Z0-9]/) || ($in{'UserNameCheck'} eq "") || ($in{'PasswordCheck'} eq "") ) { &StandardHTML("We could not process your request. You did not properly complete all fields. Please go back and try again."); exit; } if ( ($in{'ArchiveName'} =~ /\|\#\|/) || ($in{'ArchiveDesc'} =~ /\|\#\|/) ) { &StandardHTML("We could not process your request. You may not include a |#| sequence in your archive name or description! Please go back and try again."); exit; } #add archive directory if necessary unless (-e "$NonCGIPath/Archives") { mkdir ("$NonCGIPath/Archives", 0777); chmod(0777, "$NonCGIPath/Archives"); } #add new archive #get current archive facts if (-e "$NonCGIPath/Archives/archives.pl") { @archiveinfo = &OpenFile("$NonCGIPath/Archives/archives.pl"); @sortarch = sort(@archiveinfo); @reversearch = reverse(@sortarch); $LastArch = $reversearch[0]; @thisarch = split(/\|\#\|/, $LastArch); $LastNumber = $thisarch[0]; } else { $LastNumber = "000000"; } $LastNumber++; #add 1 to last post number $ArchNum = sprintf("%6d", $LastNumber); $ArchNum =~tr/ /0/; mkdir ("$NonCGIPath/Archives/Archive-$ArchNum", 0777); chmod(0777, "$NonCGIPath/Archives/Archive-$ArchNum"); $ArchiveName = $in{'ArchiveName'}; $ArchiveName =~ s/<.+?>//g; $ArchiveDesc = $in{'ArchiveDesc'}; $ArchiveDesc =~ s/"/"/g; $ArchiveDesc =~ s/\n\r\n//g; $ArchiveDesc =~ s/\n//g; $ArchiveDesc =~ s/\r//g; $ArchiveDesc =~ s/ / /g; $ArchiveDesc =~ s/\|/|/sg; $ArchiveName =~ s/\|/|/sg; $NewArchive = "$ArchNum|#|$ArchiveName|#|$ArchiveDesc"; #append archives.pl file &Lock("lock.file"); open(ARCHIVES, ">>$NonCGIPath/Archives/archives.pl"); print ARCHIVES "$NewArchive\n"; close(ARCHIVES); &Unlock("lock.file"); chmod(0777, "$NonCGIPath/Archives/archives.pl"); &EndUpdate("A R C H I V E A D D E D", "Thank you! We have added the archive that you requested."); } else { #process all actions (archives already exist) #get current archive info-- @archiveinfo = &OpenFile("$NonCGIPath/Archives/archives.pl"); @sortarch = sort(@archiveinfo); @reversearch = reverse(@sortarch); $ArchiveTotal = @reversearch; $LastArch = $reversearch[0]; @thisarch = split(/\|\#\|/, $LastArch); $LastNumber = $thisarch[0]; if ($LastNumber eq "") { $LastNumber = 0; } #Figure Next Number, for use in adding archives $LastNumber++; #add 1 to last post number $NextNum = sprintf("%6d", $LastNumber); $NextNum =~tr/ /0/; #check names $ArchiveCount = 0; foreach $row(@in) { ($Name, $Value) = split ("=", $row); $Name = &decodeURL($Name); $Value = &decodeURL($Value); if ($Name =~ m/ThisArchiveName/) { ($Trash, $ThisNumber) = split(/\:/, $Name); $Value =~ s/<.+?>//g; $Value =~ s/\|/|/sg; $Combine = ("$ThisNumber" . "|#|" . "$Value"); push (@ArchNames, $Combine); $ArchiveCount++; } if ($Name eq "NewArchiveName") { $Value =~ s/<.+?>//g; $Value =~ s/\|/|/sg; if (($Value ne "") && ($Value =~ /[a-zA-Z0-9]/)) { $NewOne = ("$NextNum" . "|#|" . "$Value"); $AddNew = "true"; push (@ArchNames, $NewOne); #create directory! mkdir ("$NonCGIPath/Archives/Archive-$NextNum", 0777); chmod(0777, "$NonCGIPath/Archives/Archive-$NextNum"); } } if ($Name =~ m/Delete/) { push(@deletelist, $Value); } #check for double pipestems- don't allow if ($Value =~ /\|\#\|/) { &StandardHTML("You are attempting to use an Archive Name or Description that contains a |#| sequence, which is not permitted. Please go back and try again."); exit; } } # end foreach $row if ($ArchiveTotal ne "$ArchiveCount") { &StandardHTML("You are trying to submit an incomplete archive summary. Perhaps you used your back button prior to submitting this page. Please try again, by identifying yourself first."); exit; } if (@deletelist) { foreach $uno(@deletelist) { chomp($uno); foreach $one(@ArchNames) { chomp($one); unless ($one =~ /^$uno/) { push(@AdjustNames, $one); } } } } else { @AdjustNames = @ArchNames; } #Now add archive descriptions-- foreach $row(@in) { ($Name, $Value) = split ("=", $row); $Name = &decodeURL($Name); $Value = &decodeURL($Value); if ($Name =~ m/ThisArchiveDesc/) { ($Trash, $ThisNumber) = split(/\:/, $Name); foreach $check(@AdjustNames) { chomp($check); if ($check =~ /^$ThisNumber/) { $Value =~ s/"/"/g; $Value =~ s/\n\r\n//g; $Value =~ s/\n//g; $Value =~ s/\r//g; $Value =~ s/ / /g; $Value =~ s/\|/|/sg; $NewLine = ("$check" . "|#|$Value"); push(@FinalArch, $NewLine); } } } if ($AddNew eq "true") { if ($Name eq "NewArchiveDesc") { foreach $check2(@AdjustNames) { chomp($check2); if ($check2 =~ /^$NextNum/) { $Value =~ s/"/"/g; $Value =~ s/\n\r\n//g; $Value =~ s/\n//g; $Value =~ s/\r//g; $Value =~ s/ / /g; $Value =~ s/\|/|/sg; $AddLine = ("$check2" . "|#|$Value"); push (@FinalArch, $AddLine); } } } } } # end foreach $row @SortFinal = sort(@FinalArch); #adjust archives.pl file-- &Lock("lock.file"); open(ARCHIVES, ">$NonCGIPath/Archives/archives.pl"); foreach $iota(@SortFinal) { chomp($iota); print ARCHIVES "$iota\n"; } close(ARCHIVES); &Unlock("lock.file"); chmod(0777, "$NonCGIPath/Archives/archives.pl"); &EndUpdate("A R C H I V E S U P D A T E D", "