#!/usr/bin/perl # ### FREEWARE UBB SCRIPT ## # # Ultimate Bulletin Board is copyright Infopop Corporation, 1998-1999. # # ------------ cpanel2.cgi ------------- # # This file contains functionality for the Freeware UBB. # # 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. These "powered by" and copyright notices MUST # remain visible when the pages are viewed on the Internet. # # You may not SELL this script. You may offer it freely to others. # It is freeware. You may not alter the code and then call it another # name. You may not alter the code and then resell it under another # name, either. # # For more info on the Ultimate BB, including licensing info, # 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 "mods.file"; require "Date.pl"; require "UltBB.setup"; 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 "ViewEntire") { $ViewEntire = $Value; } if ($Name eq "NN") { $SearchName = $Value; $SearchName =~tr/A-Z/a-z/; } if ($Name eq "BGColor2") { $BGColor2 = $Value; $BGColor2 =~ s/@/\\@/; } if ($Name eq "FontFace2") { $FontFace2 = $Value; $FontFace2 =~ s/@/\\@/; } if ($Name eq "TextColor2") { $TextColor2 = $Value; $TextColor2 =~ s/@/\\@/; } if ($Name eq "LinkColor2") { $LinkColor2 = $Value; $LinkColor2 =~ s/@/\\@/; } if ($Name eq "VisitedLinkColor2") { $VisitedLinkColor2 = $Value; $VisitedLinkColor2 =~ s/@/\\@/; } if ($Name eq "TableStripTextColor2") { $TableStripTextColor2 = $Value; $TableStripTextColor2 =~ s/@/\\@/; } if ($Name eq "AltColumnColor12") { $AltColumnColor12 = $Value; $AltColumnColor12 =~ s/@/\\@/; } if ($Name eq "AltColumnColor22") { $AltColumnColor22 = $Value; $AltColumnColor22 =~ s/@/\\@/; } if ($Name eq "BBTitle2") { $BBTitle2 = $Value; $BBTitle2 =~ s/@/\\@/; } if ($Name eq "CopyrightTextColor2") { $CopyrightTextColor2 = $Value; $CopyrightTextColor2 =~ s/@/\\@/; } if ($Name eq "TableColorStrip2") { $TableColorStrip2 = $Value; $TableColorStrip2 =~ s/@/\\@/; } if ($Name eq "BBTitleFontColor2") { $BBTitleFontColor2 = $Value; $BBTitleFontColor2 =~ s/@/\\@/; } if ($Name eq "BBEmail") { $BBEmail = $Value; $BBEmail =~ s/@/\\@/; } if ($Name eq "Forum1") { $Forum1 = $Value; $Forum1 =~ s/"/"/g; } if ($Name eq "BBRules") { $BBRules = $Value; $BBRules =~ s/"/"/g; $BBRules =~ s/\@/\\@/g; $BBRules = &ConvertReturns($BBRules); } if ($Name eq "ForumStatus1") { $ForumStatus1 = $Value; } if ($Name eq "MyHomePage") { $MyHomePage = $Value; } if ($Name eq "HomePageURL") { $HomePageURL = $Value; } if ($Name eq "number") { $number = $Value; } if ($Name eq "UpdateType") { $UpdateType = $Value; } if ($Name eq "TotalForums") { $TotalForums = $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 "MembersCGIPath") { $MembersCGIPath = $Value; } if ($Name eq "NonCGIPath") { $NonCGIPath = $Value; } if ($Name eq "CGIURL") { $CGIURL = $Value; } if ($Name eq "NonCGIURL") { $NonCGIURL = $Value; } if ($Name eq "UserNameCheck") { $UserNameCheck = $Value; $UserNameCheckFile = $UserNameCheck; $UserNameCheckFile =~ s/ /_/g; #remove spaces } if ($Name eq "UserName") { $UserName = $Value; $UserNameFile = $UserName; $UserNameFile =~ s/ /_/g; #remove spaces } if ($Name eq "Password") { $Password = $Value; } if ($Name eq "PasswordCheck") { $PasswordCheck = $Value; } if ($Name eq "action") { $action = $Value; } } #end foreach loop if ($VariablesPath eq "") { $VariablesPath = "$CGIPath"; } if ($action eq "mods") { &Mods; } if ($action eq "doupdate") { ##verify that this user is an administrator $NameFound = "no"; if (-e "$MembersPath/$UserNameFile.cgi") { $NameFound = "yes"; } if ($NameFound eq "yes") { @profilestats = &OpenProfile("$UserName.cgi"); if ($Password eq "$profilestats[1]") { $Permission = "$profilestats[4]"; &CheckPermissions; if ($AdminPermission eq "true") { #determine number of total forums open (FORUMFILE, "$VariablesPath/forums.cgi"); @forums = ; close (FORUMFILE); @forums = grep(/\|/, @forums); $TotalForums = @forums; &ConvertForums2HTML("1", "$TotalForums", "0"); } else { &StandardHTML("Sorry, but you are not an administrator."); } } else { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } else { &StandardHTML("Sorry, but we couldn't find a record for the UserName you entered. Please try again. Use your Back button."); } ##END IF/ELSE NAME CHECK BLOCK } #end do update (threads) sr if ($action eq "setgenvars") { &SetGenVars; } if ($action eq "ContinueUpdate") { &ConvertForums2HTML("$number", "$TotalForums", "$in{'StartWith'}"); } if ($action eq "getmatches") { &GetMatches; } if ($action eq "updatepermiss") { &UpdatePermiss; } if ($action eq "sendvarID") { &SendVarID; } if ($action eq "style") { &style; } if ($action eq "setstylevars") { &setstylevars; } if ($action eq "DoGenVars") { &DoGenVars; } sub SendVarID { ### CHECK USERNAME - must be an admin ##verify that this user is an administrator $NameFound = "no"; if (-e "$MembersPath/$UserNameFile.cgi") { $NameFound = "yes"; } if ($NameFound eq "yes") { @theprofile = &OpenProfile("$UserName.cgi"); if ($Password eq "$theprofile[1]") { $Permission = "$theprofile[4]"; &CheckPermissions; if ($AdminPermission eq "true") { &DoGenVars; } else { &StandardHTML("Sorry, but you are not an administrator."); } } else { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } else { &StandardHTML("Sorry, but we couldn't find a record for the UserName you entered. Please try again. Use your Back button."); } ##END IF/ELSE NAME CHECK BLOCK } # end SendVarsID sr sub DoGenVars { $BBRules =~ s/"/"/ig; $BBRules =~ s/
/\n/ig; $BBRules =~ s/

/\n\n/ig; if ($ForumDescriptions eq "yes") { $ForumDescriptionsOn = "CHECKED"; } else { $ForumDescriptionsOff = "CHECKED"; } if ($TimeFormat eq "24HR") { $Time24HR = "CHECKED"; } else { $TimeAMPM = "CHECKED"; } if ($DateFormat eq "Euro") { $DateEuro = "CHECKED"; } else { $DateUS = "CHECKED"; } if ($EmailCheck eq "true") { $EmailTrue = "CHECKED"; } else { $EmailFalse = "CHECKED"; } if ($CGIPath eq "") { @cgipath = split(/\//, $ENV{'SCRIPT_FILENAME'}); pop(@cgipath); $CGIPath = join("\/", @cgipath); $VariablesPath = $CGIPath; $MembersPath = ("$CGIPath" . "/Members"); } if ($NonCGIPath eq "") { $NonCGIPath = "$ENV{'DOCUMENT_ROOT'}/ubb"; $ForumsPath = "$ENV{'DOCUMENT_ROOT'}/ubb"; } if ($NonCGIURL eq "") { $NonCGIURL = "http://$ENV{'HTTP_HOST'}/ubb"; $CGIURL = "http://$ENV{'HTTP_HOST'}"; $HomePageURL = "http://$ENV{'HTTP_HOST'}"; $BBEmail = "$ENV{'SERVER_ADMIN'}"; } if ($MemberMinimum eq "") { $MemberMinimum = "31"; } if ($EmailBlock eq "ON") { $EmailBlockOn = "CHECKED"; } else { $EmailBlockOff = "CHECKED"; } if ($TimeZoneOffset eq "") { $TimeZoneOffset = "0"; } $PageTitle = "Set Variables"; &HEADERHTML; print<click here.


General Settings

absolute paths
Absolute paths reflect the physical locations of directories on a server. They are the complete locations, not the locations from the web root, but from the server root. Absolute paths on Win32/NT servers are displayed differently than on UNIX system s. For instance, note the following samples for UNIX and NT:

For UNIX servers:     /usr/home/yourdomain/www/cgi-bin
For Win32/NT servers:     C:/home/yourdomain/cgi-bin

Note: the paths listed above are examples, not your actual paths.

If you are installing on Win32/NT, be sure to use the format above for your absolute paths (note the forward slashes, rather than backward slashes).
If you are installing for the first time, the UBB will attempt to provide complete or partial absolute paths for you. These paths may not be accurate or complete, but they will give you a headstart. All absolute path fields MUST be provided for your UBB to run.

Absolute Path for your UBB CGI DIRECTORY
Absolute Path of your UBB NON CGI Directory
Absolute Path to Members Directory
This path should end in /Members (as in "/usr/home/yourdomain/www/cgi-bin/Members")
Absolute Path to Directory Where Your Custom Variable Files Reside
You should use the same absolute path that you used for your CGI directory above. If for some reason you cannot write to files in your CGI directory, however, you should place these files (Ul tBB .setup, forums.cgi, mods.file, Styles.file) in a directory below the web root so that they cannot be accessed by anyone from the browser.

URLs
Please provide the following complete hyperlinks. Use complete hyperlinks, such as http://www.yourdomain.com/cgi-bin, rather than relative links such as "/cgi-bin"
URL for your UBB CGI Directory
URL for your UBB Non-CGI Directory
Your Home Page URL
The complete URL for your home page (not the bulletin board). This will be used for links back to your homepage.

Display Options
Please complete the following fields, which provide information such as your BB Name, the name of your home page, the email address to be displayed, headers and footers to use on each page, etc.
Your Email Address
This is email address that will be shown so that users can contact you
Name of Your Bulletin Board
Name of Your Home Page
The name of your homepage, which will listed for links back to your homepage.
Display Forum Descriptions?
If you have many forums, you may not want to display your forum descriptions. If not, check no.
yes no
Bulletin Board Rules
You can customize the exact wording for your bulletin board's rules. Just edit the wording in the box to the right.
$BBName Rule Wording:
Block Public Display of User Email Addresses?
The default option is to have registered user's email addresses viewable on the pages for which the user has posted a note. You may prevent all user email addresses from being displayed by selecting "B lock Email Address Display" in the field to the right. These addresses will still be available to you if you check the user's info in the "User Info/Permissions" area of the Control Panel.
Block Public Display of User Email Addresses
Show User Email Addresses

Date/Time Display Options
The UBB can display dates and times in a number of different formats. Remember that the times listed are based on the location of your web server, which may be different than the time zone where you reside/work. You can change the time zone displayed by using the Time Zone Offset field. For instance, if you are on the East Coast of the US, but your server is on the West Coast of the US, you could use EST as your Time Zone to display, but you would have to offset the server time to reflect that (by t yping a 3 in the Time Zone Offset field, reflecting the 3 hours difference). If the Time Zone difference is negative, use a begative number (as in -2).
Time Zone
The time of each posting is based on the time zone where your server is located. If you want your users to know the time zone, provide it here (e.g., ET, CT, PT, etc.). You may also leave this blan k i f you would prefer not to show a time zone. You may type a different time zone than your server uses, but if you do so be sure to provide a time zone offset in the next field.
Server Time Zone Offset
You can offset the time drawn from your web server. For instance, if your server time is EST (US), but you want all time to reflect Pacific Time (US), you would have to offset your server time by pl aci ng the time zone difference in this field (for this example, that would be -3. You would place -3 in this field). The default is for there to be no server time zone offset (0).
Date Format
European Format is DD-MM-YR, while US format is MM-DD-YR.
US Format (Month-Day-Year)
European Format (Day-Month-Year)
Time Format
You can have time displayed in AM/PM format, or in 24-hour format.
Use AM/PM Time Format
User 24-Hour Format Time (eg, 23:15)

Miscellaneous Options
Below are numerous configuration options for your UBB.
Email Duplicate Check
The default option is to require unique email addresses for each registered user. This means that no two users can have the same email address. You can disable this requirement by checking the "Uniq ue Email Not Required" box.
Unique Email Required
Unique Email Not Required


Enter your UserName & Password:

(NOTE: if you are configuring your BB for the first time, type your default UserName and Password here)

UserName:      Password

THIS } sub UpdatePermiss { @theprofile = &OpenProfile("$UserNameCheck.cgi"); if ($in{'PasswordCheck'} eq "$theprofile[1]") { $Status = "$theprofile[8]"; &CheckStatus; if ($AdminStatus eq "true") { &UpdateThePermissions; } else { &StandardHTML("Sorry, but you are not authorized to perform this function. Use your Back button."); } #end if adminstatus is true } else { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } ## END UPdatePermiss SR ### sub GetMatches { ##verify that this user is an administrator $NameFound = "no"; if (-e "$MembersPath/$UserNameFile.cgi") { $NameFound = "yes"; } if ($NameFound eq "yes") { @theprofile = &OpenProfile("$UserName.cgi"); if ($Password eq "$theprofile[1]") { $Permission = "$theprofile[4]"; &CheckPermissions; if ($AdminPermission eq "true") { if ($ViewEntire eq "Yes") { &GetAll; } else { &DoSearch; } } else { &StandardHTML("Sorry, but you are not an administrator."); } } else { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } else { &StandardHTML("Sorry, but we couldn't find a record for the UserName you entered. Please try again. Use your Back button."); } ##END IF/ELSE NAME CHECK BLOCK ## if admin priviledges, conduct search sub GetAll { &GetMemberListArray; #returns @members array @members = sort(@members); $TotalProfiles = @members; if ($TotalProfiles > 0) { print < Ultimate Bulletin Board - Set Permissions - All Members
Ultimate Bulletin Board
Set Permissions

There are currently $TotalProfiles registered bulletin board members. Make any changes necessary and then click on "Submit" to modify any/all user records. Check the delete box on the left for all registrations you want deleted.

HTML_TOP for $line(@members) { @searchrow = &OpenProfile("$line"); $UNCoded = $searchrow[0]; $UNCoded =~ tr/ /+/; $Posts = $searchrow[7]; $Permission = $searchrow[4]; &CheckPermissions; $DateReg = $searchrow[10]; $WriteYes = ""; $WriteNo = ""; $AdminYes=""; $AdminNo=""; if ($AdminWrite eq "true") { $WriteYes = "CHECKED"; } else { $WriteNo = "CHECKED"; } if ($AdminPermission eq "true") { $AdminYes = "CHECKED"; } else { $AdminNo = "CHECKED"; } #### if ($AltColor eq "") { $AltColor = "#dedfdf"; } if ($AltColor eq "#f7f7f7") { $AltColor = "#dedfdf"; } else { $AltColor = "#f7f7f7"; } print < GUTS #### } #end FOREACH print <
For security reasons, re-enter your UserName & Password:
UserName:      Password



Powered by: Ultimate Bulletin Board
© Infopop Corporation, 1998-2000.

.
ENDHTML } else { &StandardHTML("Sorry, but we couldn't find any users that matched your search criteria. Please go back and try again!"); } } ## END GET ALL SR ## sub DoSearch { &GetMemberListArray; #returns @members array $TotalMembers = @members; $CheckEmail = "$in{'Email'}"; $Search = 0; foreach $member(@members) { @searchfile = &OpenProfile("$member"); $bad = "no"; #start UserName check block if ($SearchName ne "") { unless ($searchfile[0] =~ /$SearchName/i) { $bad = "yes"; } } if (($CheckEmail ne "") && ($bad ne "yes")) { unless ($searchfile[2] =~ /$CheckEmail/i) { $bad = "yes"; } } # Check number of posts if (($in{'Posts'} ne "") && ($bad ne "yes")) { $PostNumber = $searchfile[7]; $Math = $in{'Math'}; if ($Math eq "GT") { unless ($PostNumber >= $in{'Posts'}) { $bad = "yes"; } } if ($Math eq "LT") { unless ($PostNumber <= $in{'Posts'}) { $bad = "yes"; } } if ($Math eq "EQ") { unless ($PostNumber == $in{'Posts'}) { $bad = "yes"; } } } #start validation block if ($bad ne "yes") { $Search++; $line = ("$searchfile[0]" . "|" . "$searchfile[2]" . "|" . "$searchfile[4]" . "|" . "$searchfile[8]" . "|" . "$searchfile[7]" . "|" . "$searchfile[10]"); push (@final, $line); } #close validation block } #end FOREACH $member if ($Search > 0) { @final = sort(@final); print < Ultimate Bulletin Board - Set Permissions - All Members
Ultimate Bulletin Board
Set Permissions

Total Registered Users: $TotalMembers
Search Matches: $Search

Make any changes necessary and then click on "Submit" to modify any/all user records. Check the delete box on the left for all registrations you want deleted.

Delete? User Name
Date Registered
Able to post notes? Authorized Administrator? Status Total Posts
$searchrow[0]
$DateReg
Yes    No Yes    No $searchrow[8] $searchrow[7]
HTML_TOP foreach $line2(@final) { @searchrow = split (/\|/, $line2); $UNCoded = $searchrow[0]; $UNCoded =~ tr/ /+/; $Permission = $searchrow[2]; $DateReg = $searchrow[5]; &CheckPermissions; $WriteYes = ""; $WriteNo = ""; $AdminYes=""; $AdminNo=""; if ($AdminWrite eq "true") { $WriteYes = "CHECKED"; } else { $WriteNo = "CHECKED"; } if ($AdminPermission eq "true") { $AdminYes = "CHECKED"; } else { $AdminNo = "CHECKED"; } if ($AltColor eq "") { $AltColor = "#dedfdf"; } if ($AltColor eq "#f7f7f7") { $AltColor = "#dedfdf"; } else { $AltColor = "#f7f7f7" } print < GUTS } #end FOREACH print <
For security reasons, re-enter your UserName & Password:
UserName:      Password



Powered by: Ultimate Bulletin Board
© Infopop Corporation, 1998-2000.

.
ENDHTML } else { &StandardHTML("Sorry, but we couldn't find any users that matched your search criteria. Please go back and try again!"); } } ##END DOSEARCH SR ### } #end GetMatches SR ### sub SetGenVars { ### CHECK USERNAME - must be an admin ##verify that this user is an administrator $NameFound = "no"; if (-e "$MembersPath/$UserNameCheckFile.cgi") { $NameFound = "yes"; } if ($NameFound eq "yes") { @profilestats = &OpenProfile("$UserNameCheck.cgi"); if ($in{'PasswordCheck'} eq "$profilestats[1]") { $Permission = "$profilestats[4]"; &CheckPermissions; if ($AdminPermission eq "true") { &DoProcessGenVars; } else { &StandardHTML("Sorry, but you are not an administrator."); } } else { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } else { &StandardHTML("Sorry, but we couldn't find a record for the UserName you entered. Please try again.

If you are configuring your bulletin board for the first time, this is probably due to the fact that you did not set the proper variable for your CGI D irectory absolute path.

Use your Back button to try again."); } ##END IF/ELSE NAME CHECK BLOCK } ##END Set Gen Vars sub DoProcessGenVars { $variable1=('$BBEmail = ' . '"' . $BBEmail . '";'); $variable2=('$MembersPath = ' . '"' . $in{'MembersPath'} . '";'); $variable3=('$MyHomePage = ' . '"' . $MyHomePage . '";'); $variable4=('$HomePageURL = ' . '"' . $HomePageURL . '";'); $variable5=('$BBName = ' . '"' . $BBName . '";'); $variable6=('$ForumsPath = ' . '"' . $in{'NonCGIPath'} . '";'); $variable7=('$CGIPath = ' . '"' . $in{'CGIPath'} . '";'); $variable8=('$NonCGIPath = ' . '"' . $in{'NonCGIPath'} . '";'); $variable9=('$CGIURL = ' . '"' . $in{'CGIURL'} . '";'); $variable10=('$NonCGIURL = ' . '"' . $in{'NonCGIURL'} . '";'); $variable11=('$EmailCheck = ' . '"' . $in{'EmailCheck'} . '";'); $variable12=('$TimeZone = ' . '"' . &decodeURL($in{'TimeZone'}) . '";'); $variable13=('$BBRules = ' . '"' . $BBRules . '";'); $variable14=('$ForumDescriptions = ' . '"' . $in{'ForumDescriptions'} . '";'); $variable15=('$DateFormat = ' . '"' . $in{'DateFormat'} . '";'); $variable16=('$TimeZoneOffset = ' . '"' . $in{'TimeZoneOffset'} . '";'); $variable17=('$TimeFormat = ' . '"' . $in{'TimeFormat'} . '";'); $variable18=('$VariablesPath = ' . '"' . $VariablesPath . '";'); $variable19=('$EmailBlock = ' . '"' . $in{'EmailBlock'} . '";'); open (FILE, ">$VariablesPath/UltBB.setup") or die(&StandardHTML("Unable to open UltBB.setup file for writing
Error: $!

Please check that absolute paths are correct in the control panel and the permissions are set properly.")); print FILE ("$variable0\n"); print FILE ("$variable1\n"); print FILE ("$variable2\n"); print FILE ("$variable3\n"); print FILE ("$variable4\n"); print FILE ("$variable5\n"); print FILE ("$variable6\n"); print FILE ("$variable7\n"); print FILE ("$variable8\n"); print FILE ("$variable9\n"); print FILE ("$variable10\n"); print FILE ("$variable11\n"); print FILE ("$variable12\n"); print FILE ("$variable13\n"); print FILE ("$variable14\n"); print FILE ("$variable15\n"); print FILE ("$variable16\n"); print FILE ("$variable17\n"); print FILE ("$variable18\n"); print FILE ("$variable19\n"); print FILE ("1;\n"); close (FILE); # create forum directories and set permissions on directories unless (-e "$in{'NonCGIPath'}/Forum2") { chmod(0777, "$in{'NonCGIPath'}"); chmod(0755, "$in{'CGIPath'}"); chmod(0777, "$in{'MembersPath'}"); chmod(0777, "$in{'MembersPath'}/Admin5.cgi"); mkdir ("$in{'NonCGIPath'}/Forum1", 0777) or die(&StandardHTML("Unable to make new forum directory
Error: $!

Please check the path to the NonCGI directory in the control panel.

Also check the directory permissions again."));; chmod(0777, "$in{'NonCGIPath'}/Forum1"); mkdir ("$in{'NonCGIPath'}/Forum2", 0777); chmod(0777, "$in{'NonCGIPath'}/Forum2"); mkdir ("$in{'NonCGIPath'}/Forum3", 0777); chmod(0777, "$in{'NonCGIPath'}/Forum3"); mkdir ("$in{'NonCGIPath'}/Forum4", 0777); chmod(0777, "$in{'NonCGIPath'}/Forum4"); mkdir ("$in{'NonCGIPath'}/Forum5", 0777); chmod(0777, "$in{'NonCGIPath'}/Forum5"); mkdir ("$in{'NonCGIPath'}/Forum6", 0777); chmod(0777, "$in{'NonCGIPath'}/Forum6"); mkdir ("$in{'NonCGIPath'}/Forum7", 0777); chmod(0777, "$in{'NonCGIPath'}/Forum7"); mkdir ("$in{'NonCGIPath'}/Forum8", 0777); chmod(0777, "$in{'NonCGIPath'}/Forum8"); mkdir ("$in{'NonCGIPath'}/Forum9", 0777); chmod(0777, "$in{'NonCGIPath'}/Forum9"); $SkipConversion = "true"; } ############################################### ## Perform diagnostic checks/update if necessary if (-e "$NonCGIPath/ubbdiagnostic.file") { open(DIAG, "$NonCGIPath/ubbdiagnostic.file"); @diag = ; close(DIAG); foreach $diagline(@diag) { if ($diagline =~ m/SetLastTimes/) { $SLT = "true"; } if ($diagline =~ m/ConvertToUBBFiles/) { $CTUF = "true"; } if ($diagline =~ m/CreateLastForumNums/) { $CLFN = "true"; } } if ($CTUF ne "true") { &RenameMess; } if ($SLT ne "true") { &SetLastTimes; } if ($CLFN ne "true") { &SetLastThreadNums; } } else { if ($SkipConversion ne "true") { #convert message files to ubb files &RenameMess; #reset last time files &SetLastTimes; #create last thread number file in each forum &SetLastThreadNums; } #create ubbdiagnostic file-- open(DIAG, ">$NonCGIPath/ubbdiagnostic.file"); print DIAG ("SetLastTimes\n"); print DIAG ("ConvertToUBBFiles\n"); print DIAG ("CreateLastForumNums\n"); close(DIAG); chmod (0777, "$NonCGIPath/ubbdiagnostic.file"); } ## END DIAGNOSTIC CHECK/UPDATE $UserName = "$UserNameCheck"; $UserName =~ tr/ /+/; $Password = "$PasswordCheck"; $Password =~ tr/ /+/; $ConfirmLine = "The Ultimate Bulletin Board General Variables have been updated.

If you are setting up your UBB for the first time, be sure to also make your Style and Forum settings next!

If you are changing previous settings, you need to update those threads. You can do this using the \"Update Threads\" control panel option. Depending on the number of threads you have stored on your system, the updating process can be time-consuming. I t is thus recommended that you do not update your threads until after you have made all control panel setting changes.

"; &ConfirmHTML2; } ## END DO PROCESS GENERAL VARS SR sub Mods { ##verify that this user is an administrator $NameFound = "no"; if (-e "$MembersPath/$UserNameFile.cgi") { $NameFound = "yes"; } if ($NameFound eq "yes") { @profilestats = &OpenProfile("$UserName.cgi"); if ($Password eq "$profilestats[1]") { $Permission = "$profilestats[4]"; &CheckPermissions; if ($AdminPermission eq "true") { &DoProcess; } else { &StandardHTML("Sorry, but you are not an administrator."); } } else { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } else { &StandardHTML("Sorry, but we couldn't find a record for the UserName you entered. Please try again. Use your Back button."); } ##END IF/ELSE NAME CHECK BLOCK sub DoProcess { &GetMemberListArray; #returns @members array ## now we have our current Member list (in filename format) foreach $row(@in) { ($Name, $Value) = split ("=", $row); if ($Name =~ m/NewMod/) { ($Trash, $Number) = split(/Mod/, $Name); $Combine = ("$Number" . "::" . "$Value"); push (@GoodMods, $Combine); } } # end foreach $row # for (@GoodMods2) { # ($Trash, $ModSplit) = split(/::/, $_); # push (@GoodMods, $ModSplit); # } #now Moderator names are in order for (@GoodMods) { $modmatch = "false"; ($ForumNumber, $ModName) = split(/::/, $_); if (($ModName ne "none") && ($ModName ne "")) { $ModCoded = "$ModName"; $ModCoded =~ s/ /_/g; #convert spaces for $matcher(@members) { if ($matcher eq "$ModCoded.cgi") { $modmatch = "true"; $modline = ('$Forum' . "$ForumNumber" . 'Moderator = "' . "$ModName" . '"' . ";\n"); push(@modarray, $modline); } #end if modcoded } #end for $matcher if ($modmatch ne "true") { $error = "true"; $errorline = ("$errorline" . "The moderator name \"$_\" is not a valid UserName.
"); } # end if $modmatch } # if not "none" } # end for if ($error ne "true") { open (MODS, ">$VariablesPath/mods.file") or die(&StandardHTML("Unable to write to mods.file $!")); print MODS (@modarray); print MODS ("1;\n"); close (MODS); ## UPDATE MEMBER PROFILES FOR ALL MODERATORS for (@GoodMods) { ($ForumNumber, $ModName) = split(/::/, $_); if (($ModName ne "none") && ($ModName ne "")) { $ModCoded = "$ModName"; $ModCoded =~ s/ /_/g; #convert spaces @modprof = &OpenProfile("$ModName.cgi"); $Status = $modprof[8]; &CheckStatus; if ($AdminStatus ne "true") { open (UPDATE, ">$MembersPath/$ModCoded.cgi"); print UPDATE ("$modprof[0]|"); print UPDATE ("$modprof[1]|"); print UPDATE ("$modprof[2]|"); print UPDATE ("$modprof[3]|"); print UPDATE ("$modprof[4]|"); print UPDATE ("$modprof[5]|"); print UPDATE ("$modprof[6]|"); print UPDATE ("$modprof[7]|"); print UPDATE ("Moderator|"); print UPDATE ("$modprof[9]|"); print UPDATE ("$modprof[10]|"); print UPDATE ("$modprof[11]|"); print UPDATE ("$modprof[12]\n"); close (UPDATE); } ## END IF madprof } # END if not "none" } # end for ## Delete Moderator status from users who are no longer Moderators foreach $row(@in) { ($Name, $Value) = split ("=", $row); if ($Name =~ m/OldMod/) { push (@OldMods, $Value); } } # end foreach $row for $oldie(@OldMods) { $SaveOldie = "no"; for $checkthis(@GoodMods) { ($ForumNum, $TheGoodModName) = split(/::/, $checkthis); if ($oldie eq "$TheGoodModName") { $SaveOldie = "yes"; } } if (($SaveOldie ne "yes") && ($oldie ne "none") && ($oldie ne "")) { $OldieFile = "$oldie"; $OldieFile =~ s/ /_/g; #remove spaces @oldmod = &OpenProfile("$oldie.cgi"); #only change $Status = $oldmod[8]; $TotalPosts = $oldmod[7]; &CheckStatus; if ($AdminStatus ne "true") { if ($TotalPosts < $MemberMinimum) { $Status = "Junior Member"; } else { $Status = "Member"; } ### open (UPDATE, ">$MembersPath/$OldieFile.cgi"); print UPDATE ("$oldmod[0]|"); print UPDATE ("$oldmod[1]|"); print UPDATE ("$oldmod[2]|"); print UPDATE ("$oldmod[3]|"); print UPDATE ("$oldmod[4]|"); print UPDATE ("$oldmod[5]|"); print UPDATE ("$oldmod[6]|"); print UPDATE ("$oldmod[7]|"); print UPDATE ("$Status|"); print UPDATE ("$oldmod[9]|"); print UPDATE ("$oldmod[10]|"); print UPDATE ("$oldmod[11]|"); print UPDATE ("$oldmod[12]\n"); close (UPDATE); } ## END IF ADMIN status ne true } } $ConfirmLine = "The forum moderators have been successfully updated."; &ConfirmHTML2; } else { print<

Sorry, we could not process the Moderator updates, due to the following error(s).

$errorline

Use your back button to go back to the Moderator page, or use the links below.

Return to:

Error }#end if/else error ne true } ## END DO PROCESS SR } # END MODS SR sub CheckStatus { if ($Status =~ m/Administrator/) { $AdminStatus = "true"; } else { $AdminStatus = "false"; } if ($Status =~ m/Moderator/) { $ModStatus = "true"; } else { $ModStatus = "false"; } if ($Permission =~ m/Write/) { $AdminWrite = "true"; } else { $AdminWrite = "false"; } } #end CheckStatus sub HEADERHTML { print< $BBName
$PageTitle

HEADER } #end HEADERHTML sr sub HEADER2HTML { print< $BBName

$PageTitle

HEADER2HTML } #end HEADERHTML2 sr sub UpdateThePermissions { foreach $row2(@in) { ($Name, $Value) = split ("=", $row2); $Name = &decodeURL($Name); $Value = &decodeURL($Value); $matchAW = $row2 =~ m/AdminWrite/; if ($matchAW eq "1") { ($type, $UserName) = split(/::/, $Name); if ($Value eq "true") { $Value = "Write"; } else { $Value = ""; } $changeline = ("$UserName|$Value"); $skippush = "no"; if ($arraylength > 0) { $arrayline = 0; foreach $checker(@changes) { ($this, $that) = split(/\|/, $checker); if ($this eq "$UserName") { $skippush = "yes"; $changes[$arrayline] = ("$UserName|$that$Value"); } $arrayline++; } # foreach checker } ## if array length greater than 0 if ($skippush eq "no") { push(@changes, $changeline); } $arraylength = @changes; } ## IF match = 1 $matchAP = $row2 =~ m/AdminPermission/; if ($matchAP eq "1") { ($type, $UserName) = split(/::/, $Name); if ($Value eq "true") { $Value = "Admin"; } else { $Value = ""; } $changeline = ("$UserName|$Value"); $skippush = "no"; if ($arraylength > 0) { $arrayline = 0; foreach $checker(@changes) { ($this, $that) = split(/\|/, $checker); if ($this eq "$UserName") { $skippush = "yes"; $changes[$arrayline] = ("$UserName|$that$Value"); } $arrayline++; } # foreach checker } ## if array length greater than 0 if ($skippush eq "no") { push(@changes, $changeline); } $arraylength = @changes; } ## IF match = 1 $matchDelete = $row2 =~ m/Delete/; if ($matchDelete eq "1") { ($type, $UserName) = split(/::/, $Name); if ($Value eq "yes") { $Value = "Delete"; } else { $Value = ""; } $changeline = ("$UserName|$Value"); $skippush = "no"; if ($arraylength > 0) { $arrayline = 0; foreach $checker(@changes) { ($this, $that) = split(/\|/, $checker); if ($this eq "$UserName") { $skippush = "yes"; $changes[$arrayline] = ("$UserName|$that$Value"); } $arrayline++; } # foreach checker } ## if array length greater than 0 if ($skippush eq "no") { push(@changes, $changeline); } $arraylength = @changes; } ## IF match = 1 } # end foreach row2 ##have array of changes now ##open each profile to make changes foreach $updatename(@changes) { ($thisname, $Permission) = split(/\|/, $updatename); $thisNameCoded = $thisname; $thisNameCoded =~ s/ /_/g; #remove spaces if ($Permission =~ m/Delete/) { unlink("$MembersPath/$thisNameCoded.cgi"); } else { @theprofile = &OpenProfile("$thisname.cgi"); $Status = "$theprofile[8]"; if ($Permission =~ m/Admin/) { $Status = "Administrator"; } else { open (MODS, "$VariablesPath/mods.file"); @modslist = ; close (MODS); $ModsTotal = @modslist; for ($x = 1; $x <= $ModsTotal; $x++) { $GetModerator = ("Forum" . "$x" . "Moderator"); $Moderator = $$GetModerator; push(@modsarray, $Moderator); } CHECKMODS: foreach (@modsarray) { if ($_ eq "$thisname") { $Status = "Moderator"; $Modfound = "yes"; last CHECKMODS; } } if ($Modfound ne "yes") { if ($theprofile[7] < $MemberMinimum) { $Status = "Junior Member"; } else { $Status = "Member"; } } } # end if/else admin open (MEMBERSHIP, ">$MembersPath/$thisNameCoded.cgi") or die(&StandardHTML("Unable to write a new file in Members directory. $!")); print MEMBERSHIP ("$thisname|"); print MEMBERSHIP ("$theprofile[1]|"); print MEMBERSHIP ("$theprofile[2]|"); print MEMBERSHIP ("$theprofile[3]|"); print MEMBERSHIP ("$Permission|"); print MEMBERSHIP ("$theprofile[5]|"); print MEMBERSHIP ("$theprofile[6]|"); print MEMBERSHIP ("$theprofile[7]|"); print MEMBERSHIP ("$Status|"); print MEMBERSHIP ("$theprofile[9]|"); print MEMBERSHIP ("$theprofile[10]|"); print MEMBERSHIP ("$theprofile[11]|"); print MEMBERSHIP ("$theprofile[12]\n|"); close (MEMBERSHIP); } # END IF match del } ## FOREACH $ConfirmLine = "We have made the changes you requested."; &ConfirmHTML; } # End UpdateThePermissions sr sub RenameMess { open (FORUMFILE, "$VariablesPath/forums.cgi"); @sortforums = ; close (FORUMFILE); for (@sortforums) { @thisforuminfo = split(/\|/, $_); chomp($thisforuminfo[8]); $x = "$thisforuminfo[8]"; opendir (FORUMDIR, "$ForumsPath/Forum$x"); @thesefiles = readdir(FORUMDIR); closedir (FORUMDIR); @files = grep(/\.(n|m)/, @thesefiles); @files = sort(@files); $oldfiletotal = @files; foreach $one(@files) { $Notes = ""; if ($one =~ /^\d\d\d\d\d\d-000000/) { #it is a father open (FATHER, "$ForumsPath/Forum$x/$one"); @father = ; close (FATHER); ($threadnum, $junk, $junk2, $replies) = split(/-/, $one); ($replies, $junk3) = split(/\./, $replies); $TotReplies = substr($replies, 0, 6); $TotReplies = $TotReplies + 0; if ($one =~ /X/) { $Notes = "X"; } if ($one =~ /n/) { $Notes .= "N"; } chomp($father[0]); chomp($father[1]); chomp($father[2]); $Subject = $father[3]; chomp($Subject); $email = $father[4]; chomp($email); chomp($father[5]); $StatsLine = "A||$Notes||$TotReplies||$father[0]||$Subject"; $NewFatherName = "$threadnum.ubb"; $FatherLine = "Z||000000||$father[0]||$father[1]||$father[2]||$email||$father[5]"; open (RENAMEPOP, ">$ForumsPath/Forum$x/$NewFatherName"); print RENAMEPOP ("$StatsLine\n"); print RENAMEPOP ("$FatherLine\n"); close (RENAMEPOP); chmod (0666, "$ForumsPath/Forum$x/$NewFatherName"); unlink "$ForumsPath/Forum$x/$one"; } else { #add to reply file open (REPLY, "$ForumsPath/Forum$x/$one"); @reply = ; close (REPLY); ($threadnum, $replynum, $junk, $junk2) = split(/-/, $one); $NewReplyName = "$threadnum.ubb"; #put reply info on one line $UName = $reply[0]; chomp($UName); $Date = $reply[1]; chomp($Date); $TheTime = $reply[2]; chomp($TheTime); $Subject = $reply[3]; chomp($Subject); $Email = $reply[4]; chomp($Email); $Message = $reply[5]; chomp($Message); $ReplyLine = ("Z||$replynum||$UName||$Date||$TheTime||$Email||$Message"); open (RENAMEPOP, ">>$ForumsPath/Forum$x/$NewReplyName"); print RENAMEPOP ("$ReplyLine\n"); close (RENAMEPOP); chmod (0666, "$ForumsPath/Forum$x/$NewReplyName"); unlink "$ForumsPath/Forum$x/$one"; } } } # end for each forum } # end Rename Mess sr sub SetLastThreadNums { open (FORUMFILE, "$VariablesPath/forums.cgi"); @sortforums = ; close (FORUMFILE); for (@sortforums) { @thisforuminfo = split(/\|/, $_); chomp($thisforuminfo[8]); $x = "$thisforuminfo[8]"; opendir (FORUMDIR, "$ForumsPath/Forum$x"); my @files = readdir(FORUMDIR); closedir (FORUMDIR); my @ubbfiles = grep(/\.ubb/, @files); my $topiccount = @ubbfiles; #sort the ubb files @ubbfiles = sort(@ubbfiles); #reverse array so that largest number is first @ubbfiles = reverse(@ubbfiles); my $lastnumber = $ubbfiles[0]; ($lastnumber, $junk) = split(/\./, $lastnumber); $ThreadTotal = 0; #determine number of total posts foreach $threadfile(@ubbfiles) { open(THREAD, "$ForumsPath/Forum$x/$threadfile"); @countit = ; close(THREAD); @countit = grep(/^Z/, @countit); $ThisTotal = @countit; $ThreadTotal = $ThreadTotal + $ThisTotal; } #print number to lastnumber.file open (UBB, ">$ForumsPath/Forum$x/lastnumber.file"); print UBB ("$lastnumber\n"); print UBB ("$topiccount\n"); print UBB ("$ThreadTotal\n"); close (UBB); chmod (0666, "$ForumsPath/Forum$x/lastnumber.file"); } # end for each forum } #end SetLastThreadNums sr sub style { ### CHECK USERNAME - must be an admin ##verify that this user is an administrator $NameFound = "no"; if (-e "$MembersPath/$UserNameFile.cgi") { $NameFound = "yes"; } if ($NameFound eq "yes") { @theprofile = &OpenProfile("$UserName.cgi"); if ($Password eq "$theprofile[1]") { $Permission = "$theprofile[4]"; &CheckPermissions; if ($AdminPermission eq "true") { &DoStyle; } else { &StandardHTML("Sorry, but you are not an administrator."); } } else { &StandardHTML("Sorry, but the password you entered was not correct. Please try again. Use your Back button."); } } else { &StandardHTML("Sorry, but we couldn't find a record for the UserName you entered. Please try again. Use your Back button."); } ##END IF/ELSE NAME CHECK BLOCK } # end SendVarsID sr sub DoStyle { $PageTitle = "Set Style"; &HEADERHTML; print<

Delete? User Name
Date Registered
Able to post notes? Authorized Administrator? Status Total Posts
$searchrow[0]
$DateReg
Yes    No Yes    No $searchrow[3] $searchrow[4]
Background Color
Font
Text Color
Link Color
Visited Link Color
Top of Table Text Color
BG Color for Columns on Table
Alternating BG Color for Columns on Table
Graphic Logo
Copyright Text Color
Top of Table Color
Main Title Color
THIS } sub setstylevars { $variable1=('$BGColor = ' . '"' . $BGColor2 . '";'); $variable2=('$FontFace = ' . '"' . $FontFace2 . '";'); $variable3=('$TextColor = ' . '"' . $TextColor2 . '";'); $variable4=('$LinkColor = ' . '"' . $LinkColor2 . '";'); $variable5=('$VisitedLinkColor = ' . '"' . $VisitedLinkColor2 . '";'); $variable6=('$TableStripTextColor = ' . '"' . $TableStripTextColor2 . '";'); $variable7=('$AltColumnColor1 = ' . '"' . $AltColumnColor12 . '";'); $variable8=('$AltColumnColor2 = ' . '"' . $AltColumnColor22 . '";'); $variablea=('$TextSize = "2";'); $variable9=('$BBTitle = ' . '"' . $BBTitle2 . '";'); $variableb=('$$BBTopic = "topic5.jpg";'); $variablec=('$BBReply = "reply5.jpg";'); $variabled=('$TableWidth = "95%";'); $variablee=('$CategoryStripColor = "#151515";'); $variablef=('$PageBackground = "";'); $variableg=('$ThreadClosed = "threadclose5.jpg";'); $variableh=('$mailgif = "email.gif";'); $variablei=('$profilegif = "profile.gif";'); $variable17=('$CopyrightTextColor = ' . '"' . $CopyrightTextColor2 . '";'); $variable18=('$TableColorStrip = ' . '"' . $TableColorStrip2 . '";'); $variable19=('$BBTitleFontColor = ' . '"' . $BBTitleFontColor2 . '";'); open (FILE, ">$VariablesPath/Styles.file") or die(&StandardHTML("Unable to open Styles.file file for writing
Error: $!

Please check that absolute paths are correct in the control panel and the permissions are set properly.")); print FILE ("$variable0\n"); print FILE ("$variable1\n"); print FILE ("$variable2\n"); print FILE ("$variable3\n"); print FILE ("$variable4\n"); print FILE ("$variable5\n"); print FILE ("$variable6\n"); print FILE ("$variable7\n"); print FILE ("$variable8\n"); print FILE ("$variablea\n"); print FILE ("$variable9\n"); print FILE ("$variableb\n"); print FILE ("$variablec\n"); print FILE ("$variabled\n"); print FILE ("$variablee\n"); print FILE ("$variablef\n"); print FILE ("$variableg\n"); print FILE ("$variableh\n"); print FILE ("$variablei\n"); print FILE ("$variable17\n"); print FILE ("$variable18\n"); print FILE ("$variable19\n"); print FILE ("1;\n"); close (FILE); $ConfirmLine = "The Ultimate Bulletin Board Style Variables have been updated.

If you are changing previous settings, you need to update those threads. You can do this using the \"Update Threads\" control panel option. Depending on the number of threads you have stored on your system, the updating process can be time-consuming. It is thus recommended that you do not update your threads until after you have made all control panel setting changes.

"; &ConfirmHTML2; }