#!/usr/bin/perl
#
### PRIMARY UBB SCRIPT ##
#
# Ultimate Bulletin Board is copyright Madrona Park, Inc., 1998.
#
# ------------ Ultimate.cgi -------------
#
# This file contains intro functionality for the UBB.
#
# 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";
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 "Styles.file";
require "cookie-lib.pl";
require "ubb_library.pl";
########################
# Added by setup.cgi
require "private.pl";
##################
};
&ReadParse;
if ($in{'action'} eq "Redirect") {
print "Location: $in{'GoTo'}\n\n";
exit;
} #end Redirect check
print ("Content-type: text/html\n\n");
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;
}
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;
$category =~ s/\/\\//g;
$categoryCoded = &HTMLIFY($category);
$categoryCoded =~ tr/ /+/;
$category = &UNHTMLIFY($category);
}
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;
}
if ($Name eq "client") {
$client = $Value;
}
} # end FOREACH $row
if ($client eq "") {
require "UltBB.setup";
require "Styles.file";
} else {
require "client$client.pl";
}
if ($VariablesPath eq "") {
$VariablesPath = $CGIPath;
}
#set Random Number- for use in Banner Ads, etc.
$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(
);
} else {
$TableWidth2 = $TableWidth;
$BorderTop = "";
$BorderBottom = "";
}
$ReplyMessage = $in{'ReplyMessage'};
$Message = $in{'Message'};
$SubjectCoded = &HTMLIFY($TopicSubject);
$SubjectCoded =~ tr/ /+/;
if (@in == 0) {
&Intro;
exit;
}
#########################
# Added by setup.cgi
if ($in{'action'} eq "verifyprivate") {
&VerifyPrivate;
}
if ($in{'action'} eq "composeprivate") {
&ComposePrivate;
}
if ($in{'action'} eq "deleteprivate") {
&DeletePrivate;
}
if ($in{'action'} eq "postprivate") {
&PostPrivate;
}
if ($in{'action'} eq "checkprivate") {
&CheckPrivate;
}
# End Addons
################################
if ($in{'action'} eq "intro") {
&Intro;
exit;
}
if ($in{'action'} eq "agree") {
&Agree;
}
if ($in{'action'} eq "email") {
&DoEmail($in{'ToWhom'});
}
if ($in{'action'} eq "register") {
&Register;
}
if ($in{'action'} eq "rules") {
&Rules;
exit;
}
if ($in{'action'} eq "lostpw") {
if ($UseEmail eq "ON") {
&LostPW;
} else {
&StandardHTML("Sorry, but this feature is not available, per your administrator's directions. Use your back button to return to the BB.");
}
}
## INTRO PAGE SUBROUTINES ####
sub Intro {
&get_cookie; #retrieves all current cookies
#check for Digests
if (-e "$NonCGIPath/digests/digestsummary.cgi") {
$DigestWording = qq(Subscribe to a Digest);
}
if ($cookie{DaysPrune}) {
$DaysPrune = "$cookie{DaysPrune}";
} else {
$DaysPrune = $DaysPruneDefault;
}
if ($BypassCookie eq "true") {
$NoNewLogin = "true";
$SessionLogin = "$cookie{sessionLogin}";
} else {
$NoNewLogin = "false";
$SessionLogin = "$cookie{lastLogin}";
$SessionLoginDT = "$cookie{LastLoginDT}";
}
&decodeURL($SessionLoginDT);
&GetDateTime;
if ($cookie{LastLoginDT}) {
$Legend = "
New Posts Since Your Last Visit
No New Posts Since Your Last Visit";
if ($cookie{sessionLoginDT}) {
$UseDT = $cookie{sessionLoginDT};
} else {
$UseDT = $cookie{LastLoginDT};
}
#split the d/t string
($StoredDate, $StoredTime, $TheAMPM) = split(/ /, $UseDT);
my $FormatDate = "";
my $FormatTime = "";
#format date-----------------------------------
if ($DateFormat eq "US") {
$FormatDate = $StoredDate;
}
elsif ($DateFormat eq "Euro") {
$FormatDate = &DateFormat("$StoredDate", "Euro");
}
elsif ($DateFormat eq "USX") {
$FormatDate = &DateFormat("$StoredDate", "USExpanded");
} else {
$FormatDate = &DateFormat("$StoredDate", "EuroExpanded");
}
#format time--------------------------------
if ($TimeFormat eq "AMPM") {
$FormatTime = "$StoredTime $TheAMPM";
} else {
($gethr, $getmin) = split(/:/, $StoredTime);
&ConvertTo24Hour;
$FormatTime = "$gethr:$getmin";
}
#combine date/time line
$LastLoginTime = "Last Visit: $FormatDate at $FormatTime";
############################################
# Get whether there are new private messages
if ($cookie{UserName}) {
$NameFound = "no";
$UsrNum = &GetUserNumber($cookie{UserName});
if ($UsrNum ne "") {
$NameFound = "yes";
} else {
$NameFound = "no";
}
if ($NameFound eq "yes") {
# Get the private messages
open(FILE, "$CGIPath/Private/$UsrNum.cgi");
@crap = ;
close(FILE);
$crap = join('',@crap);
chomp($crap);
@crap = split(/\n/,$crap);
$howmany = 0;
$mtotal = 0;
foreach $stuff(@crap) {
@stuff = split(/\|\|/,);
if ($stuff[5] !~ /X/) {
$howmany++;
}
$mtotal++;
}
if (($howmany > 0) && ($mtotal > 0)) {
$PrivateMsg = "You have $mtotal message(s), $howmany new";
} elsif ($mtotal > 0) {
$PrivateMsg = "You have $mtotal message(s), none new";
} else {
$PrivateMsg = "You have no messages";
}
} else {
$PrivateMsg = "You are not logged in";
}
} else {
$PrivateMsg = "You are not logged in";
}
############################################
} else {
$LastLoginTime = "No previous login";
$PrivateMsg = "You are not logged in";
}
## check other display options--
if ($DisplayMemberTotal eq "true") {
&GetMemberListArray;
my $TotalMembers = @members;
$MemberLine = "Registered Members: $TotalMembers";
}
if ($category ne "") {
$CategoriesOnly = "false";
}
if ($CategoriesOnly ne "true") {
# check Forum Total option--
if ($ForumTotalOption eq "Topics") {
$TopRow = qq(
Topics
| );
$TheColSpan = "5";
}
elsif ($ForumTotalOption eq "Posts") {
$TopRow = qq(
Posts
| );
$TheColSpan = "5";
} else {
$TopRow = qq(
Topics
|
Posts
| );
$TheColSpan = "6";
}
&ForumsTopHTML;
&ForumTableTop1;
&get_cookie; #retrieves all current cookies
@forums = &OpenForumsFile;
if ($category ne "") {
for $forumline(@forums) {
@forumfacts = split(/\|/, $forumline);
if ($forumfacts[0] eq "$category") {
push(@sortforums, $forumline);
}
}
} else {
if ($CategoryView eq "yes") {
@sortforums = sort(@forums); #sorts forums by category
} else {
@sortforums = @forums;
} #end if/else categoryview eq yes
} #end category limitation check
$forumcategory = "";
for (@sortforums) {
@thisforuminfo = split(/\|/, $_);
chomp($thisforuminfo[8]);
$x = "$thisforuminfo[8]";
if ($thisforuminfo[6] eq "private") {
$ExactPath = "Forum$x/private-$thisforuminfo[7]";
} else {
$ExactPath = "Forum$x";
}
$GetHour = "";
$GetMinute = "";
$MilHour = "";
$TheDate = "";
$LatestTime = "";
if ($CategoryView eq "yes") {
$thisforumcategory = &decodeURL($thisforuminfo[0]);
if ($in{'category'} eq "") {
if ($thisforumcategory ne "$forumcategory") {
print<
$thisforumcategory
|
CategoryHeader
}
}
$forumcategory = "$thisforumcategory";
} # end if categoryview eq yes
## Get Forum Data from lastnumber.file(s)
open (FORUMDATA, "$ForumsPath/$ExactPath/lastnumber.file");
my @data = ;
close (FORUMDATA);
$TotalTopics = $data[1];
chomp($TotalTopics);
$TotalPosts = $data[2];
chomp($TotalPosts);
if ($TotalTopics eq "") {
$TotalTopics = "0";
}
if ($TotalPosts eq "") {
$TotalPosts = "0";
}
if ($TotalTopics > 0) {
#open lasttime.file for forum
open (LTime, "$ForumsPath/$ExactPath/lasttime.file");
@lasttime = ;
close (LTime);
$LastDate = $lasttime[0];
$LastTime = $lasttime[1];
chomp($LastDate);
chomp($LastTime);
#split time
($GetHour, $GetMinute) = split(/:/, $LastTime);
($GetMinute, $AMpm) = split(/ /, $GetMinute);
chomp($AMpm);
($GetMonth, $GetDate, $GetYear) = split(/-/, $LastDate);
&MilitaryTime2;
$MilTime = "$MilHour:$GetMinute";
if ($TimeFormat eq "24HR") {
$LatestTime = "$MilTime";
} else {
$LatestTime = "$LastTime";
}
if ($DateFormat eq "US") {
$TheDate = $LastDate;
$DateWording = "All dates are in MM-DD-YY format.";
$Breaker = "";
$DateSize = "2";
}
elsif ($DateFormat eq "Euro") {
$TheDate = &DateFormat("$LastDate", "Euro");
$DateWording = "All dates are in DD-MM-YY format.";
$Breaker = "";
$DateSize = "2";
}
elsif ($DateFormat eq "USX") {
$TheDate = &DateFormat("$LastDate", "USExpanded");
$Breaker = "
";
$DateSize = "1";
} else {
$TheDate = &DateFormat("$LastDate", "EuroExpanded");
$Breaker ="
";
$DateSize = "1";
}
} else {
$GetMonth = "";
$GetDate= "";
$GetYear = "";
$LatestTime = "";
$TheDate = "";
}
$ForumName = $thisforuminfo[1];
$Moderator = ("Forum" . "$x" . "Moderator");
$Moderator = $$Moderator;
$ForumDesc = $thisforuminfo[2];
$OnOff = $thisforuminfo[3];
chomp($OnOff);
$ForumName =~ s/\/\\//g;
$ForumCoded = &HTMLIFY($ForumName);
$ForumCoded =~ tr/ /+/;
$ForumDesc =~ s/"/"/g;
$ForumName = &UNHTMLIFY($ForumName);
###
if ($ForumDescriptions eq "no") {
$ForumDesc = "";
}
if ($GetMonth ne "") {
# Compare Last Login Time to Last Post Time..
$LPMonth = $GetMonth;
if ($GetYear > 96) {
$JYear = ("19" . "$GetYear");
} else {
$JYear = ("20" . "$GetYear");
}
$LastPostJulian = &jday($LPMonth, $GetDate, $JYear);
$LPTime = ("$MilHour" . "$GetMinute");
$LastPostJulian = ($LastPostJulian + ($LPTime * 0.0001));
if ($LastPostJulian > $SessionLogin) {
$NewStuffIcon = "
";
} else {
$NewStuffIcon = "
";
}
} else {
$NewStuffIcon = "
";
} # end if/else month ne ""
unless ($cookie{lastLogin}) {
$NewStuffIcon = "";
$Legend = "";
}
if ($LatestTime eq "") {
$LatestTime = " ";
}
if ($Moderator eq "") {
$Moderator = " ";
}
# check Forum Total option--
if ($ForumTotalOption eq "Topics") {
$GutsRow = qq(
$TotalTopics
|
$TheDate $Breaker$LatestTime
|
$Moderator | );
}
elsif ($ForumTotalOption eq "Posts") {
$GutsRow = qq(
$TotalPosts
|
$TheDate $Breaker$LatestTime
|
$Moderator | );
} else {
$GutsRow = qq(
$TotalTopics
|
$TotalPosts
|
$TheDate $Breaker$LatestTime
|
$Moderator | );
}
if ($OnOff eq "On") {
&ForumsGutsHTML;
} ## End IF ONOFF Conditional
}
&ForumsBottomHTML;
} else { ## CATEGORIES ONLY VIEW
&ForumsTopHTML;
&ForumTableTop2;
#open Forums variable file
@theforums = &OpenForumsFile;
@forums = sort(@theforums);
my $ThisCategory = "";
my $ThatCategory = "";
my $CatCount = 1;
my $CategoryColor = "$AltColumnColor1";
foreach $one(@forums) {
@forumarray = split(/\|/, $one);
$ThisCategory = $forumarray[0];
if ($forumarray[3] eq "On") {
if ($ThisCategory eq "$ThatCategory") {
$CatCount++;
} else {
unless ($ThatCategory eq "") {
if ($CategoryColor eq "$AltColumnColor1") {
$CategoryColor = "$AltColumnColor2";
} else {
$CategoryColor = "$AltColumnColor1";
}
$ThatCategory =~ s/\/\\//g;
$ThatCategoryCoded = &HTMLIFY($ThatCategory);
$ThatCategoryCoded =~ tr/ /+/;
print<$ThatCategory | $CatCount |
CatInfo
$CatCount = 1;
$FirstTwo = "";
}
}
$ThatCategory = $ThisCategory;
} #if forum is ON
}
$ThatCategory =~ s/\/\\//g;
$ThatCategoryCoded = &HTMLIFY($ThatCategory);
$ThatCategoryCoded =~ tr/ /+/;
if ($CategoryColor eq "$AltColumnColor1") {
$CategoryColor = "$AltColumnColor2";
} else {
$CategoryColor = "$AltColumnColor1";
}
#print last set
print<$ThatCategory | $CatCount |
CatInfo
&ForumsBottom2HTML;
} #end if/else categories only view
} #END INTRO SR ###
sub ForumsTopHTML {
print <
$BBName
$Header
INTROHTML
} ## END FORUMS TOP HTML
sub ForumTableTop1 {
if ($BypassCookie eq "true") {
$LastLoginTime = "";
}
if ($category ne "") {
$CategoryLine = qq(View All Forum Categories);
$ForumHeader = "Category: $category";
$LastLoginTime = $MemberLine;
} else {
$ForumHeader = "Forum";
$CategoryLine = $MemberLine;
}
print<Today's Active Topics (all public forums)
|
$LastLoginTime
|
$CategoryLine |
$BorderTop
| |
$ForumHeader
|
$TopRow
Last Post
|
Moderator
|
TableTop1
}
sub ForumTableTop2 {
print<
|
$LastLoginTime
|
|
Category
|
Forums
|
TableTop2
}
sub ForumsGutsHTML {
print <
$NewStuffIcon |
$ForumName
$ForumDesc
|
$GutsRow
ForumSummary
} ## END FORUMS GUTS HTML
sub ForumsBottomHTML {
print <
$BorderBottom
All times are $TimeZone. $DateWording
$Legend
BOTTOMhtml
&PageBottomHTML;
} ## END Forums Bottom HTML subroutine
sub ForumsBottom2HTML {
print <
BOTTOMhtml
&PageBottomHTML;
} ## END Forums Bottom2 HTML subroutine
### END Intro Page Subroutines ####
sub LostPW {
&StandardTopHTML;
print<
You can have your username and password emailed to you by providing your email address. We will then email the username and password info we have associated with the email address you provide. This information will be sent to the email address you type below.