#!/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";
};
&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("情報フォーラムはメンテナンス中です。今しばらくお待ちください。");
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;
}
} # end FOREACH $row
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;
}
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("この機能は、現在使用できません。「戻る」をクリックしてフォーラムに戻ってください。");
}
}
## 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 = "
前回利用日以降の新しい投稿があります
前回利用日以降の新しい投稿はありません";
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 = ("前回の利用日: $FormatDate $FormatTime");
} else {
$LastLoginTime = "";
}
## check other display options--
if ($DisplayMemberTotal eq "true") {
&GetMemberListArray;
my $TotalMembers = @members;
$MemberLine = "登録メンバー: $TotalMembers";
}
else
{
$MemberLine = ""
}
if ($category ne "") {
$CategoriesOnly = "false";
}
if ($CategoriesOnly ne "true") {
# check Forum Total option--
if ($ForumTotalOption eq "Topics") {
$TopRow = qq(
トピック
| );
$TheColSpan = "5";
}
elsif ($ForumTotalOption eq "Posts") {
$TopRow = qq(
投稿
| );
$TheColSpan = "5";
} else {
$TopRow = qq(
トピック
|
投稿
| );
$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 = "すべての日付は MM-DD-YY 形式です。";
$Breaker = "";
$DateSize = "2";
}
elsif ($DateFormat eq "Euro") {
$TheDate = &DateFormat("$LastDate", "Euro");
$DateWording = "すべての日付は DD-MM-YY 形式です。";
$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 = "";
}
# 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(すべてのフォーラム・カテゴリを\表\示);
$ForumHeader = "カテゴリ: $category";
$LastLoginTime = $MemberLine;
} else {
$ForumHeader = "フォーラム";
$CategoryLine = $MemberLine;
}
print<
|
$CategoryLine |
$BorderTop
|
$ForumHeader
|
$TopRow
前回の投稿
|
管理
|
TableTop1
}
sub ForumTableTop2 {
print<
$LastLoginTime
|
カテゴリ
|
フォーラム
|
TableTop2
}
sub ForumsGutsHTML {
print <
$NewStuffIcon |
$ForumName
$ForumDesc
|
$GutsRow
ForumSummary
} ## END FORUMS GUTS HTML
sub ForumsBottomHTML {
print <
$BorderBottom
すべての時間は $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<
以下に入力した電子メールアドレスに、ユーザー名とパスワード情報をお送りします。