#!/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
#
###############################################################
#
#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";
};
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(Profil | Registrieren |);
}
if ($AllowSearch eq "FALSE") {
$SearchOption = "";
} else {
$SearchOption = qq(| Suchen);
}
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(
);
} else {
$TableWidth2 = $TableWidth;
$BorderTop = "";
$BorderBottom = "";
}
if ($BBStatus eq "OFF") {
&StandardHTML($BBClosedMessage);
exit;
}
$ReplyMessage = $in{'ReplyMessage'};
$Message = $in{'Message'};
$SubjectCoded = &HTMLIFY($TopicSubject);
$SubjectCoded =~ tr/ /+/;
if (@in == 0) {
&Topics;
exit;
}
if ($in{'action'} eq "topics") {
&Topics;
exit;
}
if ($in{'action'} eq "idcheck") {
#&HackChecker;
&idcheck;
}
if ($in{'action'} eq "displayprivate") {
&DisplayPrivate;
}
sub Topics {
if ($number eq "") {
&StandardHTML("Sie haben kein Forum oder Archiv ausgewählt - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
exit;
}
&get_cookie; #retrieves all current cookies
$SessionLogin = "$cookie{sessionLogin}";
$SessionLoginDT = "$cookie{sessionLoginDT}";
#check to see if forum is private!
if ($number =~ /A/) {
($junk, $ArchiveNumber) = split(/\:/, $number);
&DisplayArchive($ArchiveNumber);
exit;
}
@thisforum = &GetForumRecord($number);
if ($thisforum[8] eq "") {
&StandardHTML("Das von Ihnen gewählte Forum oder Archiv konnte nicht gefunden werden - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
exit;
}
$category = $thisforum[0];
$CategoryName = &GetCatName($category);
$ForumPW = $thisforum[12];
$LWA = $thisforum[6];
if ($LWA eq "private") {
$ReplyRestrict = "restrict";
$TopicRestrict = "restrict";
} else {
($TopicRestrict, $ReplyRestrict) = split("&", $LWA);
}
$Moderator = ("Forum" . "$number" . "Moderator");
$Moderator = $$Moderator;
#split up Mod var
@mods = split(/\|\|\^\|\|/, $Moderator);
if ($LWA eq "private") {
$PrivateMax = $thisforum[13];
chomp($PrivateMax);
#check for private cookies to see if we can proceed immediately
$PasswordPrivate = "$cookie{PasswordPrivate}";
$UserNamePrivate = "$cookie{UserNamePrivate}";
$NumbersPrivate = "$cookie{ForumNumberPrivate}";
$DIRPW = "$thisforum[7]";
$ExactPath = "Forum$number/private-$DIRPW";
if ($PasswordPrivate ne "") {
&VerifyID;
if (($ForumPW ne "") && ($ProceedNow ne "true")) {
&ConfirmIdentity;
exit;
}
} else {
&ConfirmIdentity;
exit;
}
} else {
$DIRPW = "";
$ExactPath = "Forum$number";
$ProceedNow = "true";
}
if ($ProceedNow eq "true") {
if ($DaysPrune eq "") {
$DaysPrune = "$cookie{DaysPrune}";
}
if ($DaysPrune eq "") {
$DaysPrune = $DaysPruneDefault;
}
if ($in{'start'} eq "here") {
$AddNewSessionLogin = "true";
}
$Forum = $thisforum[1];
$CustomTitle = $thisforum[9];
chomp($CustomTitle);
if ($CustomTitle eq "") {
$CustomTitle = "$BBTitle";
}
if ($TopicRestrict eq "restrict") {
$TopicLegend = "Neue Beiträge: Nur autorisierte Benutzer können neue Beiträge in diesem Forum erstellen.";
}
elsif ($TopicRestrict eq "allreg") {
$TopicLegend = "Neue Beiträge: Alle registrierten Benutzer können Beiträge in diesem Forum erstellen.";
} else {
$TopicLegend = "Neue Beiträge: Alle Benutzer (auch unregistrierte Besucher) können Beiträge in diesem Forum erstellen.";
}
if ($ReplyRestrict eq "restrict") {
$ReplyLegend = "Antworten: Nur autorisierte Benutzer können Antworten in diesem Forum erstellen.";
}
elsif ($ReplyRestrict eq "allreg") {
$ReplyLegend = "Antworten: Alle registrierten Benutzer können Antworten in diesem Forum erstellen.";
}
elsif ($ReplyRestrict eq "all") {
$ReplyLegend = "Antworten: Alle Benutzer (auch unregistrierte Besucher) können Antworten in diesem Forum erstellen.";
} else {
$ReplyLegend = "Antworten: In diesem Forum können keine Antworten erstellt werden.";
}
$ForumCoded = &HTMLIFY($Forum);
$ForumCoded =~ tr/ /+/;
foreach $unomod(@mods) {
chomp($unomod);
$ModNumber = &GetUserNumber($unomod);
if ($ModNumber ne "") {
@theprofile = &OpenProfile("$ModNumber.cgi");
$ModeratorEmail = "$theprofile[2]";
if ($ModeratorLine ne "") {
$ModeratorLine .= qq(, $unomod);
} else {
$ModeratorLine = qq($unomod);
}
}
}
#are icons allowed? - ICON CONCEPT BY KOMBAT03!
if ($AllowIcons eq "TRUE") {
$IconFieldHeader = qq(
GUTS
} ## END Guts HTML for Topic Page
sub TopicBottomHTML {
print<
$BorderBottom
$MoreTopicsW
Alle Zeiten werden im $TimeZone - Format dargestellt. $DateWording
Neue Beiträge seit Ihrem letzten Besuch vorhanden $RedHot.
Keine neuen Beiträge seit Ihrem letzten Besuch vorhanden $YellowHot.
Beitrag geschlossen - keine Antworten möglich.
TrueTopicBottom
&PageBottomHTML;
}
sub idcheck {
#open member file to see if user can access private forum
if (($in{'UserName'} eq "") || ($in{'Password'} eq "")) {
&StandardHTML("Sie müssen Ihren Benutzernamen und Ihr Kennwort eingeben!");
} 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("Sie sind für den Zugriff auf dieses Forum nicht autorisiert.");
}
} else {
&StandardHTML("Das von Ihnen eingegebene Kennwort ist falsch - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
}
} else {
&StandardHTML("Der von Ihnen eingegebene Benutzername ist dem System nicht bekannt - bitte benutzen Sie die ZURÜCK-Funktion Ihres Browsers und versuchen Sie es erneut!");
}
}
} # end id check
sub ConfirmIdentity {
if ($ForumPW ne "") {
$FPWWording = qq(
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.