#!/usr/bin/perl
#
### CONTROL PANEL SCRIPT FOR ULTIMATE BULLETIN BOARD ##
#
# Ultimate Bulletin Board is copyright Infopop Corporation, 1997, 1998, 1999, 2000.
#
# ------------ cpanel2.cgi -------------
#
# This file contains some of the control panel functionality for
# the UBB. It is called from the controlpanel pages (cp.html).
#
# NOTE: you MAY NOT distribute this script under any
# circumstance. This means that you may not sell, trade, or in
# any other way give this script to another user who is not
# licensed to use it. 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";
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 "UltBB.setup";
require "mods.file";
require "Date.pl";
require "Styles.file";
require "ubb_library.pl";
require "ubb_library2.pl";
};
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 "action") {
$action = $Value;
}
if ($action eq 'setgenvars') { # only process for this routine
&checkpathlock; # see if paths are locked
if ($Name eq "BBEmail") {
$BBEmail = $Value;
$BBEmail =~ s/@/\\@/;
}
if ($Name eq "BBRules") {
$BBRules = $Value;
$BBRules =~ s/"/"/g;
$BBRules =~ s/\@/\\@/g;
$BBRules = &ConvertReturns($BBRules);
}
if ($Name eq "COPPAWording") {
$COPPAWording = $Value;
$COPPAWording =~ s/"/"/g;
$COPPAWording =~ s/\@/\\@/g;
$COPPAWording = &ConvertReturns($COPPAWording);
}
if ($Name eq "COPPAInstructions") {
$COPPAInstructions = $Value;
$COPPAInstructions =~ s/"/"/g;
$COPPAInstructions =~ s/\@/\\@/g;
$COPPAInstructions = &ConvertReturns($COPPAInstructions);
}
if ($Name eq "BBClosedMessage") {
$BBClosedMessage = $Value;
$BBClosedMessage =~ s/"/"/g;
$BBClosedMessage =~ s/\@/\\@/g;
$BBClosedMessage = &ConvertReturns($BBClosedMessage);
}
if ($Name eq "censorwords") {
$censorwords = $Value;
$censorwords = &EliminateReturns($censorwords);
$censorwords =~ s/
//ig;
$censorwords =~ s/
//ig;
$censorwords =~ s/"/"/g;
$censorwords =~ s/\@/\\@/g;
}
if ($Name eq "EmailBan") {
$EmailBan = $Value;
$EmailBan = &EliminateReturns($EmailBan);
$EmailBan =~ s/
//ig;
$EmailBan =~ s/
//ig;
$EmailBan =~ s/"/"/g;
$EmailBan =~ s/\@/\\@/g;
}
if ($Name eq "YourCopyrightNotice") {
$YourCopyrightNotice = $Value;
$YourCopyrightNotice = &EliminateReturns($YourCopyrightNotice);
$YourCopyrightNotice =~ s/"/"/g;
$YourCopyrightNotice =~ s/
//ig;
$YourCopyrightNotice =~ s/
//ig; $YourCopyrightNotice =~ s/\@/\\@/g; } if ($Name eq "Header") { $Header = $Value; $Header = &LimitReturns($Header); } if ($Name eq "Footer") { $Footer = $Value; $Footer = &LimitReturns($Footer); } if ($Name eq "MyHomePage") { $MyHomePage = $Value; } if ($Name eq "HomePageURL") { $HomePageURL = $Value; } if ($Name eq "BBName") { $BBName = $Value; } if ($Name eq "ForumsPath") { $ForumsPath = $Value; } if ($Name eq "MembersPath") { $MembersPath = $Value; } if ($Name eq "CGIPath") { $CGIPath = $Value; } if ($Name eq "VariablesPath") { $VariablesPath = $Value; } if ($Name eq "NonCGIPath") { $NonCGIPath = $Value; } if ($Name eq "CGIURL") { $CGIURL = $Value; } if ($Name eq "NonCGIURL") { $NonCGIURL = $Value; } } # end if action = setgenvars if ($Name eq "UserNameCheck") { $UserNameCheck = $Value; $UserNameCheckFile = $UserNameCheck; $UserNameCheckFile =~ s/ /_/g; #remove spaces } if ($Name eq "UserName") { $UserName = $Value; $UserName = &UNHTMLIFY($UserName); $UserNameFile = $UserName; $UserNameFile =~ s/ /_/g; #remove spaces $UserNameCoded = $UserName; $UserNameCoded = &HTMLIFY($UserNameCoded); $UserNameCoded =~ tr/ /+/; } if ($Name eq "Password") { $Password = $Value; $PasswordCoded = $Password; $PasswordCoded =~ tr/ /+/; } if ($Name eq "PasswordCheck") { $PasswordCheck = $Value; $PasswordCheckCoded = $PasswordCheck; $PasswordCheckCoded =~ tr/ /+/; } if ($Name eq "number") { $number = $Value; $number =~ s/\D//sg; } if ($Name eq "UpdateType") { $UpdateType = $Value; } if ($Name eq "TotalForums") { $TotalForums = $Value; } } #end foreach loop #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( |
/\n\n/ig;
$COPPAWording =~ s/"/"/ig;
$COPPAWording =~ s/
/\n/ig;
$COPPAWording =~ s/
/\n\n/ig;
$COPPAInstructions =~ s/"/"/ig;
$COPPAInstructions =~ s/
/\n/ig;
$COPPAInstructions =~ s/
/\n\n/ig;
$Header =~ s/\\@/\@/sg;
#$Header =~ s/\\"/\"/sg;
$Footer =~ s/\\@/\@/sg;
#$Footer =~ s/\\"/\"/sg;
$BBClosedMessage =~ s/"/"/ig;
$BBClosedMessage =~ s/
/\n/ig;
$BBClosedMessage =~ s/
/\n\n/ig;
if ($ForumDisplayMax eq "") {
$FDM40 = "SELECTED";
}
elsif ($ForumDisplayMax == 25) {
$FDM25 = "SELECTED";
}
elsif ($ForumDisplayMax == 35) {
$FDM35 = "SELECTED";
}
elsif ($ForumDisplayMax == 40) {
$FDM40 = "SELECTED";
}
elsif ($ForumDisplayMax == 50) {
$FDM50 = "SELECTED";
}
elsif ($ForumDisplayMax == 75) {
$FDM75 = "SELECTED";
} else {
$FDMNONE = "SELECTED";
}
if ($HTMLDisplayMax eq "") {
$HDM40 = "SELECTED";
}
elsif ($HTMLDisplayMax == 15) {
$HDM15 = "SELECTED";
}
elsif ($HTMLDisplayMax == 25) {
$HDM25 = "SELECTED";
}
elsif ($HTMLDisplayMax == 35) {
$HDM35 = "SELECTED";
}
elsif ($HTMLDisplayMax == 40) {
$HDM40 = "SELECTED";
}
elsif ($HTMLDisplayMax == 50) {
$HDM50 = "SELECTED";
}
elsif ($HTMLDisplayMax == 75) {
$HDM75 = "SELECTED";
} else {
$HDMNONE = "SELECTED";
}
if ($DaysPruneDefault eq "") {
$Days20 = "SELECTED";
}
elsif ($DaysPruneDefault == 1) {
$Days1 = "SELECTED";
}
elsif ($DaysPruneDefault == 2) {
$Days2 = "SELECTED";
}
elsif ($DaysPruneDefault == 5) {
$Days5 = "SELECTED";
}
elsif ($DaysPruneDefault == 10) {
$Days10 = "SELECTED";
}
elsif ($DaysPruneDefault == 20) {
$Days20 = "SELECTED";
}
elsif ($DaysPruneDefault == 30) {
$Days30 = "SELECTED";
}
elsif ($DaysPruneDefault == 45) {
$Days45 = "SELECTED";
}
elsif ($DaysPruneDefault == 60) {
$Days60 = "SELECTED";
}
elsif ($DaysPruneDefault == 75) {
$Days75 = "SELECTED";
}
elsif ($DaysPruneDefault == 100) {
$Days100 = "SELECTED";
}
elsif ($DaysPruneDefault == 1000) {
$Days1000 = "SELECTED";
} else {
$Days365 = "SELECTED";
}
if ($CategoryView eq "yes") {
$CategoryViewOn = "CHECKED";
} else {
$CategoryViewOff = "CHECKED";
}
if ($AllowSearch eq "FALSE") {
$AllowSearchOff = "CHECKED";
} else {
$AllowSearchOn = "CHECKED";
}
if ($showcopytype eq "text") {
$showcopytypeTEXT = "CHECKED";
} else {
$showcopytypeIMAGE = "CHECKED";
}
if ($AllowTotalSearch eq "FALSE") {
$AllowTotalSearchOff = "CHECKED";
} else {
$AllowTotalSearchOn = "CHECKED";
}
if ($IndexMethod eq "ONEFILE") {
$IndexMethodOne = "CHECKED";
} else {
$IndexMethodPer = "CHECKED";
}
if ($AllowIcons eq "TRUE") {
$IconsOn = "CHECKED";
} else {
$IconsOff = "CHECKED";
}
if ($ReplyQuote eq "NO") {
$ReplyQuoteOff = "CHECKED";
} else {
$ReplyQuoteOn = "CHECKED";
}
if ($InlineFrame eq "TRUE") {
$InlineOn = "CHECKED";
} else {
$InlineOff = "CHECKED";
}
if ($CategoriesOnly eq "true") {
$CategoriesOnlyOn = "CHECKED";
} else {
$CategoriesOnlyOff = "CHECKED";
}
if ($EmailVerify eq "ON") {
$EmailVerifyOn = "CHECKED";
} else {
$EmailVerifyOff = "CHECKED";
}
if ($EditOption eq "ON") {
$EditOptionOn = "CHECKED";
}
elsif ($EditOption eq "OFF") {
$EditOptionOff = "CHECKED";
} else {
$EditOptionND = "CHECKED";
}
if ($ForumDescriptions eq "yes") {
$ForumDescriptionsOn = "CHECKED";
} else {
$ForumDescriptionsOff = "CHECKED";
}
if ($IP eq "ON") {
$IPOn = "CHECKED";
}
elsif ($IP eq "LOGONLY") {
$IPLO = "CHECKED";
} else {
$IPOff = "CHECKED";
}
if ($log_admin_activity eq 'YES') {
$log_admin_activityON = 'CHECKED';
}else {
$log_admin_activityOFF = 'CHECKED';
}
if ($Censor eq "ON") {
$CensorOn = "CHECKED";
} else {
$CensorOff = "CHECKED";
}
if ($FloodCheck eq "ON") {
$FloodOn = "CHECKED";
} else {
$FloodOff = "CHECKED";
}
if ($FloodCheckSpan eq "") {
$FloodCheckSpan = "60";
}
if ($AdminTitle eq "") {
$AdminTitle = "Administrator";
}
if ($ModeratorTitle eq "") {
$ModeratorTitle = "Moderator";
}
if ($MemberTitle eq "") {
$MemberTitle = "Member";
}
if ($JrMemberTitle eq "") {
$JrMemberTitle = "Junior Member";
}
if ($DisplayMemberTotal eq "true") {
$MemberTotalOn = "CHECKED";
} else {
$MemberTotalOff = "CHECKED";
}
if ($BBStatus eq "OFF") {
$BBStatusOff = "CHECKED";
} else {
$BBStatusOn = "CHECKED";
}
if ($BBClosedMessage eq '') {
$BBClosedMessage = "Sorry, this bulletin board is temporarily unavailable, while we perform some routine maintenance. Please try back again later.";
}
if ($SetCookies eq "DirectorySpecific") {
$COOKIESDS = "CHECKED";
} else {
$COOKIESBroad = "CHECKED";
}
if ($SuspendRegister eq "true") {
$SRTrue = "CHECKED";
} else {
$SRFalse = "CHECKED";
}
if ($ForumTotalOption eq "Both") {
$FTOBoth = "CHECKED";
}
elsif ($ForumTotalOption eq "Topics"){
$FTOTopics = "CHECKED";
} else {
$FTOPosts = "CHECKED";
}
if ($DisplayRegistration eq "NO") {
$DisplayRegNo = "CHECKED";
} else {
$DisplayRegYes = "CHECKED";
}
if ($AllowSignature eq "YES") {
$AllowSigYes = "CHECKED";
} else {
$AllowSigNo = "CHECKED";
}
if ($AllowSignatureImage eq "YES") {
$AllowSigImageYes = "CHECKED";
} else {
$AllowSigImageNo = "CHECKED";
}
if ($UseEmail eq "ON") {
$EmailOn = "CHECKED";
} else {
$EmailOff = "CHECKED";
}
if ($HotIcons eq "OFF") {
$HotIconsOff = "CHECKED";
} else {
$HotIconsOn = "CHECKED";
}
if ($HotCount eq "") {
$HotCount = "15";
}
if ($EmailBlock eq "ON") {
$EmailBlockOn = "CHECKED";
} else {
$EmailBlockOff = "CHECKED";
}
if ($EnglishSubjectCheck eq "ON") {
$ESCON = "CHECKED";
} else {
$ESCOFF = "CHECKED";
}
if ($ReverseThreads eq "TRUE") {
$ReverseThreadOn = "CHECKED";
} else {
$ReverseThreadOff = "CHECKED";
}
if ($TimeFormat eq "24HR") {
$Time24HR = "CHECKED";
} else {
$TimeAMPM = "CHECKED";
}
if ($DateFormat eq "Euro") {
$DateEuro = "CHECKED";
}
elsif ($DateFormat eq "EuroX") {
$DateEuroX = "CHECKED";
}
elsif ($DateFormat eq "USX") {
$DateUSX = "CHECKED";
} else {
$DateUS = "CHECKED";
}
if ($AuthorColumn eq "Location") {
$LocationAC = "CHECKED";
}
elsif ($AuthorColumn eq "PostTotal") {
$PostTotalAC = "CHECKED";
} else {
$MinimumAC = "CHECKED";
}
if ($EmailCheck eq "true") {
$EmailTrue = "CHECKED";
} else {
$EmailFalse = "CHECKED";
}
if ($CGIPath eq '') {
if($ENV{'SCRIPT_FILENAME'}){ #*nix
$thiscgipath = $ENV{'SCRIPT_FILENAME'};
} elsif ($ENV{'PATH_TRANSLATED'}) { # Win32
$thiscgipath = $ENV{'PATH_TRANSLATED'};
$thiscgipath =~ s/\\/\//g;
}
@cgipath = split(/\//, $thiscgipath);
pop(@cgipath);
$CGIPath = join("\/", @cgipath);
$VariablesPath = $CGIPath;
$MembersPath = ("$CGIPath" . "/Members");
$cgiext = pop(@cgipath);
}
if ($NonCGIPath eq '') {
$NonCGIPath = "$ENV{'DOCUMENT_ROOT'}/ubb";
$ForumsPath = "$ENV{'DOCUMENT_ROOT'}/ubb";
}
if ($NonCGIURL eq '') {
$NonCGIURL = "http://$ENV{'HTTP_HOST'}/ubb";
}
if ($CGIURL eq '') {
$CGIURL = "http://$ENV{'HTTP_HOST'}/$cgiext";
}
if ($HomePageURL eq '') {
$HomePageURL = "http://$ENV{'HTTP_HOST'}";
}
if ($BBEmail eq '') {
$BBEmail = "$ENV{'SERVER_ADMIN'}";
}
if ($MemberMinimum eq "") {
$MemberMinimum = "31";
}
if ($TimeZoneOffset eq "") {
$TimeZoneOffset = "0";
}
#new options 03-03-00
if ($UBBFriendUSE eq "OFF") {
$UBBFriendOFF = "CHECKED";
}
elsif ($UBBFriendUSE eq "RegUsers") {
$UBBFriendREGONLY = "CHECKED";
} else {
$UBBFriendON = "CHECKED";
}
if ($ModerateRegs eq "ON") {
$ModerateRegsON = "CHECKED";
}
elsif ($MemberNotify eq "COPPA") {
$ModerateRegsCOPPA = "CHECKED";
} else {
$ModerateRegsOFF = "CHECKED";
}
if ($COPPACheck eq "ON") {
$COPPACheckON = "CHECKED";
}
else {
$COPPACheckOFF = "CHECKED";
}
if ($OnRegsNotifyAdmin eq "ON") {
$OnRegsNotifyAdminON = "CHECKED";
}
elsif ($OnRegsNotifyAdmin eq "COPPA") {
$OnRegsNotifyAdminCOPPA = "CHECKED";
}
else {
$OnRegsNotifyAdminOFF = "CHECKED";
}
if ($ShowPrivacyLink eq 'ON'){
$ShowPrivacyLinkON = 'CHECKED';
}
else {
$ShowPrivacyLinkOFF = 'CHECKED';
}
if ($COPPAWording eq '') {
$COPPAWording = "You must supply a description of your own COPPA policy.";
}
if ($COPPAInstructions eq '') {
$COPPAInstructions = "Your need to supply exact instructions for how to mail or fax the COPPA permission form to you";
}
# check email availability and default to sendmail on *nix
if ($SendMailLocation eq "") {
if (-e "/usr/bin/sendmail") {
$SendMailLocation = "/usr/bin/sendmail";
}
elsif (-e "/usr/sbin/sendmail") {
$SendMailLocation = "/usr/sbin/sendmail";
}
elsif (-e "/usr/lib/sendmail") {
$SendMailLocation = "/usr/lib/sendmail";
}
}
if ($SMTPEmail eq "On") {
$SMTPOn = "CHECKED";
}
elsif ($SendMailLocation ne '') {
$SMTPOff = "CHECKED"; # this means sendmail is on
}
else {
$SMTPOn = "CHECKED";
}
if (-e "$MembersPath/emailfile.cgi") {
$DiagnosticWording = qq[ Check here to rebuild the forum thread files, recount topics and replies and reset the last post times. This is not necessary unless you think your forums do not show correct lists of topics or have incorrect counts.];
$EmailFile = "";
} else {
$EmailFile = qq();
$DiagnosticWording = "";
}
$PageTitle = "G E N E R A L S E T T I N G S";
&HEADERHTML;
print<
Socket Test: To check to see if the Socket module is included on the Perl installation on your web server, click here. If you receive an error or a blank page, then Socket may not be installed (Read This, if Socket is not installed.)