F:\WEBSITES\testbed\zipped\yabb_svn_new\branches\2.5.2\cgi-bin\yabb2\Setup.pl F:\WEBSITES\testbed\zipped\yabb_svn_new\trunk\cgi-bin\yabb2\Setup.pl
#!/usr/bin/perl -- #!/usr/bin/perl --
# $Id: yabb setup $ # $Id: YaBB Setup $
# $HeadURL: testbed $ # $HeadURL: YaBB $
# $Revision: 2012 $  
# $Source: /Setup.pl $ # $Source: /Setup.pl $
   
############################################################################### ###############################################################################
# Setup.pl                                                                    # # Setup.pl                                                                    #
# $Date: 9/22/2012 $                                                          # # $Date: 01.05.16 $                                                           #
############################################################################### ###############################################################################
# YaBB: Yet another Bulletin Board                                            # # YaBB: Yet another Bulletin Board                                            #
# Open-Source Community Software for Webmasters                               # # Open-Source Community Software for Webmasters                               #
# Version:        YaBB 2.5.2                                                  # # Version:        YaBB 2.6.12                                                 #
# Packaged:       October 21, 2012                                            # # Packaged:       January 5, 2016                                             #
# Distributed by: http://www.yabbforum.com                                    # # Distributed by: http://www.yabbforum.com                                    #
# =========================================================================== # # =========================================================================== #
# Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved.     # # Copyright (c) 2000-2016 YaBB (www.yabbforum.com) - All Rights Reserved.     #
# Software by:  The YaBB Development Team                                     # # Software by:  The YaBB Development Team                                     #
#               with assistance from the YaBB community.                      # #               with assistance from the YaBB community.                      #
############################################################################### ###############################################################################
# use strict; # use strict;
#use warnings; # use warnings;
#no warnings qw(uninitialized once redefine); no warnings qw(uninitialized once redefine);
use CGI::Carp qw(fatalsToBrowser); use CGI::Carp qw(fatalsToBrowser);
our $VERSION = 1.7;  use English qw(-no_match_vars); 
  our $VERSION = '2.6.12';
   
$setupplver = 'YaBB 2.5.2 $Revision: 1.8 $'; $setupplver  = 'YaBB 2.6.12 $Revision: 1654 $';
  $yymycharset = 'UTF-8';
   
# conversion will stop after $max_process_time # conversion will stop after $max_process_time
# in seconds, than the browser will call the script # in seconds, than the browser will call the script
# again until all is done. Don't put it too high # again until all is done. Don't put it too high
# or you will run into server or browser timeout # or you will run into server or browser timeout
$max_process_time = 20; $max_process_time = 20;
$time_to_jump = time() + $max_process_time; $time_to_jump     = time() + $max_process_time;
   
if ($ENV{'SERVER_SOFTWARE'} =~ /IIS/) { if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/sm ) {
     $yyIIS = 1;    $yyIIS = 1;
     $0 =~ m~(.*)(\\|/)~;     $PROGRAM_NAME =~ m{(.*)(\\|/)}xsm; 
     $yypath = $1;    $yypath = $1;
     $yypath =~ s~\\~/~g;     $yypath =~ s/\\/\//gxsm; 
     chdir($yypath);     chdir $yypath; 
     push(@INC, $yypath);     push @INC, $yypath; 
} }
   
### Requirements and Errors ### ### Requirements and Errors ###
$script_root = $ENV{'SCRIPT_FILENAME'}; my $script_root = $ENV{'SCRIPT_FILENAME'};
if( ! $script_root ) { if ( !$script_root ) {
   $script_root = $ENV{'PATH_TRANSLATED'};    $script_root = $ENV{'PATH_TRANSLATED'};
   $script_root =~ s/\\/\//gxsm;  } 
}  $script_root =~ s/\\/\//gxsm; 
$script_root =~ s/\/Setup\.(pl|cgi)//ig;  $script_root =~ s/\/Setup[.](pl|cgi)//igxsm; 
   
if (-e "./Paths.pl") { require "./Paths.pl"; } if    ( -e './Paths.pm' )            { require Paths; }
elsif (-e "$script_root/Paths.pl") { require "$script_root/Paths.pl"; } elsif ( -e "$script_root/Paths.pm" ) { require "$script_root/Paths.pm"; }
elsif (-e "$script_root/Variables/Paths.pl") { require "$script_root/Variables/Paths.pl"; }  elsif ( -e "$script_root/Variables/Paths.pm" ) { 
     require "$script_root/Variables/Paths.pm";
# Check if it's blank Paths.pl or filled in one  } 
unless ($lastsaved) {  
     $boardsdir = "./Boards";  # Check if it's blank Paths.pm or filled in one 
     $sourcedir = "./Sources";  if ( !$lastsaved ) { 
     $memberdir = "./Members";     $boardsdir = './Boards'; 
     $vardir    = "./Variables";     $sourcedir = './Sources'; 
}     $memberdir = './Members'; 
     $vardir    = './Variables';
if (-e 'YaBB.cgi') { $yyext = 'cgi'; } }
else { $yyext = 'pl'; }  
if ($boardurl) { $set_cgi = "$boardurl/Setup.$yyext"; } if   ( -e 'YaBB.cgi' ) { $yyext = 'cgi'; }
else { $set_cgi = "Setup.$yyext"; } else                   { $yyext = 'pl'; }
  if   ($boardurl) { $set_cgi = "$boardurl/Setup.$yyext"; }
  else             { $set_cgi = "Setup.$yyext"; }
   
# Make sure the module path is present # Make sure the module path is present
push(@INC, "./Modules");  push @INC, './Modules'; 
   
require "$sourcedir/Subs.pl";  require Sources::Subs; 
require "$sourcedir/System.pl";  require Sources::System; 
require "$sourcedir/Load.pl";  require Sources::Load; 
require "$sourcedir/DateTime.pl";  require Sources::DateTime; 
   
$windowbg = '#FEFEFE';  $windowbg    = '#dee4ec'; 
$windowbg2 = '#DDE3EB';  $windowbg2   = '#edeff4'; 
$header = '#6699CC';  $header      = '#3673b3'; 
$catbg = '#ADC7E1';  $catbg       = '#195392'; 
$maintext_23 = 'Unable to open'; $maintext_23 = 'Unable to open';
   
$yymenu = '';  $yymenu    = q{}; 
$yytabmenu = q~ ~; $yytabmenu = q~ ~;
$px = 'px';  
   
#############################################  
# Conversion starts here                    #  
#############################################  
   
# Conversion was rewritten and fixed for xx-large  
# forums by Detlef Pilzecker (deti) in June 2008  
   
# The 'our' function is avaliable sincee Perl v5.6.0  
# If your Perl version is lower, then comment the 'our'-lines out and use this:  
# use vars qw(@categoryorder,@catboards,@catdata,@boarddata,@allboards,%catinfo,%cat,%board,%boarddata,$catfile,$boardfile,$key,$value,$cnt);  
our (@categoryorder, @catboards, @catdata, @boarddata, @allboards);  
our (%catinfo, %cat, %board, %boarddata);  
our ($catfile, $boardfile, $key, $value, $cnt);  
our (%fixed_users);  
   
if (-e "$vardir/Setup.lock") {  
     &FoundConvLock if -e "$vardir/Converter.lock";  
   
     if (-e "$vardir/fixusers.txt") {  
           fopen(FIXUSER, "$vardir/fixusers.txt") || &setup_fatal_error("$maintext_23 $vardir/fixusers.txt: ", 1);  
           my @fixed = <FIXUSER>;  
           fclose(FIXUSER);  
           foreach (@fixed) {  
                 my ($user, $fixedname, undef, $displayedname, undef) = split(/\|/, $_);  
                 @{$fixed_users{$user}} = ($fixedname,$displayedname);  
           }  
     }  
   
     &tempstarter;  
     &tabmenushow;  
   
     if ($action && !$INFO{'convert'}) {  
           # needed for: sub conv_stringtotime  
           require Time::Local;  
           import Time::Local 'timelocal';  
   
     } elsif (!$action || $INFO{'convert'}) {  
           $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3 . $NavLink4 . $NavLink5 . $NavLink6;  
   
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
     <form action="$set_cgi?action=prepare" method="post">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td class="windowbg2" align="left" style="font-size: 11px;">  
                 Make sure your YaBB 2.5.2 installation is running and that it has all the correct folder paths and URLs.<br />  
                 Proceed through the following steps to convert your YaBB 1 Gold - SP 1.x forum to YaBB 2.5.2!<br /><br />  
                 <b>If</b> your YaBB 1 Gold - SP 1.x forum is located on the same server as your YaBB 2.5.2 installation:  
                 <ol>  
                 <li>Insert the path to your YaBB 1 Gold - SP 1.x forum in the input field below</li>  
                 <li>Click on the 'Continue' button</li>  
                 </ol>  
                 <b>Else</b> if your YaBB 1 Gold - SP 1.x forum is located on a different server than your YaBB 2.5.2 installation or if you do not know the path to your SP 1.x forum:  
                 <ol>  
                 <li>Copy all files in the /Boards, /Members, and /Messages folders from your YaBB 1 Gold - SP 1.x installation, to the corresponding Convert/Boards,  
                 Convert/Members, and Convert/Messages folders of your YaBB 2.5.2 installation, and chmod them 777.</li>  
                 <li>Copy cat.txt from the /Variables folder of your YaBB 1 Gold - SP 1.x installation to the Convert/Variables folder of your YaBB 2.5.2 installation, and chmod it 666.</li>  
                 <li>If you have 'Add More Membergroups' installed on your YaBB 1 Gold - SP 1.x, copy MemberStats.txt from the /Variables folder of your YaBB 1 Gold - SP 1.x installation to the Convert/Variables folder of your YaBB 2.5.2 installation, and chmod it 666.</li>  
   
                 <li>Click on the 'Continue' button</li>  
                 </ol>  
                 <div style="width: 100%; text-align: center;">  
                 <b>Path to your YaBB 1 Gold - SP 1.x files: </b> <input type="text" name="convertdir" value="$convertdir" size="50" />  
                 </div>  
                 <br />  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="catbg" align="center">  
                 <input type="submit" value="Continue" />  
                 </td>  
           </tr>  
           </table>  
     </form>  
     </div>  
           ~;  
     }  
   
     if ($action eq "prepare") {  
           &UpdateCookie("delete");  
   
           $username = 'Guest';  
           $iamguest = '1';  
           $iamadmin = '';  
           $iamgmod = '';  
           $password = '';  
           $yyim = '';  
           $ENV{'HTTP_COOKIE'} = '';  
           $yyuname = '';  
   
           $convertdir = $FORM{'convertdir'};  
   
           if (!-d "$convertdir/Boards") { &setup_fatal_error("Directory: $convertdir/Boards", 1); }  
           else { $convboardsdir = "$convertdir/Boards"; }  
           if (!-e "$convertdir/Members/memberlist.txt") { &setup_fatal_error("Directory: $convertdir/Members", 1); }  
           else { $convmemberdir = "$convertdir/Members"; }  
           if (!-d "$convertdir/Messages") { &setup_fatal_error("Directory: $convertdir/Messages", 1); }  
           else { $convdatadir = "$convertdir/Messages"; }  
           if (!-e "$convertdir/Variables/cat.txt") { &setup_fatal_error("Directory: $convertdir/Variables", 1); }  
           else { $convvardir = "$convertdir/Variables"; }  
   
   
           my $setfile = << "EOF";  
\$convertdir = qq~$convertdir~;  
\$convboardsdir = qq~$convertdir/Boards~;  
\$convmemberdir = qq~$convertdir/Members~;  
\$convdatadir = qq~$convertdir/Messages~;  
\$convvardir = qq~$convertdir/Variables~;  
   
1;  
EOF  
   
           fopen(SETTING, ">$vardir/ConvSettings.txt") || &setup_fatal_error("$maintext_23 $vardir/ConvSettings.txt: ", 1);  
           print SETTING &nicely_aligned_file($setfile);  
           fclose(SETTING);  
   
           $yytabmenu = $NavLink1a . $NavLink2 . $NavLink3 . $NavLink4 . $NavLink5 . $NavLink6;  
   
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 <ul>  
                 <li>Members info found in: <b>$convmemberdir</b></li>  
                 <li>Board and Category info found in: <b>$convboardsdir</b></li>  
                 <li>Messages info found in: <b>$convdatadir</b></li>  
                 <li>cat.txt found in: <b>$convvardir</b></li>  
                 </ul>  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 - Conversion can take a long time depending on the size of your forum (30 seconds to a couple hours).<br />  
                 - Your browser will be refreshed automaticly every $max_process_time seconds and you will see the ongoing process in the status bar.<br />  
                 - Some internet connections refresh their IP-Address automaticly every 24 hours.<br />  
                 &nbsp; Make sure that your IP-Address will not change during conversion, or you must restart the conversion after that! <br />  
                 - Your forum will be set to maintenance while converting.  
                 <p id="memcontinued">Click on 'Members' in the menu to start.<br />&nbsp;</p>  
                 </td>  
           </tr>  
           </table>  
     </div>  
   
     <script type="text/javascript">  
     <!--  
           function PleaseWait() {  
                 document.getElementById("memcontinued").innerHTML = '<font color="red"><b>Converting - please wait!<br />If you want to stop \\'Members\\' conversion, click here on STOP before this red message appears again on next page.</b></font>';  
           }  
     // -->  
     </script>  
           ~;  
   
   
     } elsif ($action eq "members") {  
           unless (exists $INFO{'mstart1'}) { &PrepareConv; }  
   
           $INFO{'mstart2'} ? &ConvertMembers2 : &ConvertMembers1;  
   
           $yytabmenu = $NavLink1 . $NavLink2a . $NavLink3 . $NavLink4 . $NavLink5 . $NavLink6;  
   
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left">  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Member Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Board and Category Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Message Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Date & Time Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Final Cleanup.</div>  
                 $ConvNotDone  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 New User data files have been created.<br />  
                 Password encryption is done for each user the first time he/she logs in.<br />  
                 <br />  
                 You are converting <i>~ . int(($INFO{'st'} + 60)/60) . qq~ minutes</i>.<br />  
                 <br />  
                 <p id="memcontinued">Click on 'Boards & Categories' in the menu to continue.<br />  
                 If you do not do that the script will continue itself in 5 Minutes.</p>  
                 </td>  
           </tr>  
           </table>  
     </div>  
   
     <script type="text/javascript">  
     <!--  
           function PleaseWait() {  
                 document.getElementById("memcontinued").innerHTML = '<font color="red"><b>Converting - please wait!<br />If you want to stop \\'Boards & Categories\\' conversion, click here on STOP before this red message appears again on next page.</b></font>';  
           }  
   
           function membtick() {  
                  PleaseWait();  
                  location.href="$set_cgi?action=cats;st=$INFO{'st'}";  
           }  
   
           setTimeout("membtick()",300000);  
     // -->  
     </script>  
           ~;  
   
           if (-e "$vardir/fixusers.txt") {  
   
                 fopen(FIXUSER, "$vardir/fixusers.txt") || &setup_fatal_error("$maintext_23 $vardir/fixusers.txt: ", 1);  
                 my @fixed = <FIXUSER>;  
                 fclose(FIXUSER);  
                 chomp(@fixed);  
   
                 $yymain .= qq~  
     <br />  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
     <table width="100%" cellspacing="1" cellpadding="4">  
           <tr>  
           <td align="left" class="windowbg" colspan="5">  
            Member(s) with illegal username(s) were found and converted to legal name(s).<br />  
            You can find this information in the <i>$vardir/fixusers.txt</i> file. If you do not need it, you can delete it later.  
           </td>  
           <tr>  
           <td align="center" class="catbg">Invalid name</td>  
           <td align="center" class="catbg">Fixed name</td>  
           <td align="center" class="catbg">Reg. date</td>  
           <td align="center" class="catbg">Displayed name</td>  
           <td align="center" class="catbg">E-mail</td>  
           </tr>  
                 ~;  
                 foreach $userfixed (@fixed) {  
                       ($inname, $fxname, $rgdate, $dspname, $tmail) = split(/\|/, $userfixed);  
                       $yymain .= qq~  
           <tr>  
           <td align="left" class="windowbg2">$inname</td>  
           <td align="left" class="windowbg2">$fxname</td>  
           <td align="left" class="windowbg2">$rgdate</td>  
           <td align="left" class="windowbg2">$dspname</td>  
           <td align="left" class="windowbg2">$tmail</td>  
           </tr>  
                       ~;  
                 }  
                 $yymain .= qq~  
     </table>  
     </div>  
                 ~;  
           }  
   
   
     } elsif ($action eq "members2") {  
           &setup_fatal_error("Member conversion (members2) 'mstart1' ($INFO{'mstart1'}), 'mstart2' ($INFO{'mstart2'}) error!") if $INFO{'mstart1'} <= 0 || $INFO{'mstart2'} < 0;  
   
           $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3 . $NavLink4 . $NavLink5 . $NavLink6;  
   
           my $mwidth = int((($INFO{'mstart2'} + $INFO{'mstart1'}) / 2) / $INFO{'mtotal'} * 100);  
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left">  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Member Conversion.</div>  
                 <div style="float: left; width: 102px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $mwidth$px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">$mwidth %</div><br />  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Board and Category Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Message Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Date & Time Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Final Cleanup.</div>  
                 $ConvNotDone  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 To prevent server time-out due to the amount of members to be converted, the conversion is split into more steps.<br />  
                 <br />  
                 The time-step (\$max_process_time) is set to <i>$max_process_time seconds</i>.<br />  
                 The last step took <i>~ . ($time_to_jump - $INFO{'starttime'}) . qq~ seconds</i>.<br />  
                 You are converting <i>~ . int(($INFO{'st'} + 60)/60) . qq~ minutes</i>.<br />  
                 <br />  
                 There are <b>~ . int($INFO{'mtotal'} - (($INFO{'mstart2'} + $INFO{'mstart1'}) / 2)) . qq~/$INFO{'mtotal'}</b> Members left to be converted.<br />  
   
                 <p id="memcontinued">If nothing happens in 5 seconds <a href="$set_cgi?action=members;st=$INFO{'st'};mstart1=$INFO{'mstart1'};mstart2=$INFO{'mstart2'}" onclick="PleaseWait();">click here to continue</a>...<br />If you want to <a href="javascript:stoptick();">STOP 'Members' conversion click here</a>. Then copy the actual browser address and type it in when you are going to continue the conversion.</p>  
                 </td>  
           </tr>  
           </table>  
     </div>  
   
     <script type="text/javascript">  
     <!--  
           function PleaseWait() {  
                 document.getElementById("memcontinued").innerHTML = '<font color="red"><b>Converting - please wait!<br />If you want to stop \\'Members\\' conversion, click here on STOP before this red message appears again on next page.</b></font>';  
           }  
   
           function stoptick() { stop = 1; }  
   
           stop = 0;  
           function membtick() {  
                 if (stop != 1) {  
                       PleaseWait();  
                       location.href="$set_cgi?action=members;st=$INFO{'st'};mstart1=$INFO{'mstart1'};mstart2=$INFO{'mstart2'}";  
                 }  
           }  
   
           setTimeout("membtick()",2000);  
     // -->  
     </script>  
           ~;  
   
   
     } elsif ($action eq "cats") {  
           unless (exists $INFO{'bstart'} && exists $INFO{'bfstart'}) {  
                 &GetCats;  
                 &CreateControl;  
           }  
           &ConvertBoards;  
   
           $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3a . $NavLink4 . $NavLink5 . $NavLink6;  
   
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left">  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Member Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Board and Category Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Message Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Date & Time Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Final Cleanup.</div>  
                 $ConvNotDone  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 New forum.master file has been created.<br />  
                 New forum.control file has been created.<br />  
                 All dates in files have been converted to timestamps.<br />  
                 All threads have been converted.<br />  
                 <br />  
                 You are converting <i>~ . int(($INFO{'st'} + 60)/60) . qq~ minutes</i>.<br />  
                 <br />  
                 <p id="memcontinued">Click on 'Messages' in the menu to continue.<br />  
                 If you do not do that the script will continue by itself in 5 minutes.</p>  
                 </td>  
           </tr>  
           </table>  
     </div>  
   
     <script type="text/javascript">  
     <!--  
           function PleaseWait() {  
                 document.getElementById("memcontinued").innerHTML = '<font color="red"><b>Converting - please wait!<br />If you want to stop \\'Messages\\' conversion, click here on STOP before this red message appears again on next page.</b></font>';  
           }  
   
           function membtick() {  
                  PleaseWait();  
                  location.href="$set_cgi?action=messages;st=$INFO{'st'}";  
           }  
   
           setTimeout("membtick()",300000);  
     // -->  
     </script>  
           ~;  
   
   
     } elsif ($action eq "cats2") {  
           &setup_fatal_error("Boards conversion (cats2) 'bstart' ($INFO{'bstart'}) or 'bfstart' ($INFO{'bfstart'}) error!") if (!$INFO{'bstart'} && !$INFO{'bfstart'}) || $INFO{'bstart'} < 0 || $INFO{'bfstart'} < 0;  
   
           $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3 . $NavLink4 . $NavLink5 . $NavLink6;  
   
           my $bwidth = int($INFO{'bstart'} / $INFO{'btotal'} * 100);  
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left">  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Member Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Board and Category Conversion.</div>  
                 <div style="float: left; width: 102px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $bwidth$px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">$bwidth %</div><br />  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Message Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Date & Time Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Final Cleanup.</div>  
                 $ConvNotDone  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 <div>  
                 To prevent server time-out due to the amount of boards to be converted, the conversion is split into more steps.<br />  
                 <br />  
                 The time-step (\$max_process_time) is set to <i>$max_process_time seconds</i>.<br />  
                 The last step took <i>~ . ($time_to_jump - $INFO{'starttime'}) . qq~ seconds</i>.<br />  
                 You are converting <i>~ . int(($INFO{'st'} + 60)/60) . qq~ minutes</i>.<br />  
                 <br />  
                 There are <b>~ . ($INFO{'btotal'} - $INFO{'bstart'}) . qq~/$INFO{'btotal'}</b> Boards left to be converted.<br />  
                 </div>  
                 <p id="memcontinued">If nothing happens in 5 seconds <a href="$set_cgi?action=cats;st=$INFO{'st'};bstart=$INFO{'bstart'};bfstart=$INFO{'bfstart'}" onclick="PleaseWait();">click here to continue</a>...<br />If you want to <a href="javascript:stoptick();">STOP 'Boards & Categories' conversion click here</a>. Then copy the actual browser address and type it in when you are going to continue the conversion.</p>  
                 </td>  
           </tr>  
           </table>  
     </div>  
   
     <script type="text/javascript">  
     <!--  
           function PleaseWait() {  
                 document.getElementById("memcontinued").innerHTML = '<font color="red"><b>Converting - please wait!<br />If you want to stop \\'Boards & Categories\\' conversion, click here on STOP before this red message appears again on next page.</b></font>';  
           }  
   
           function stoptick() { stop = 1; }  
   
           stop = 0;  
           function membtick() {  
                 if (stop != 1) {  
                       PleaseWait();  
                       location.href="$set_cgi?action=cats;st=$INFO{'st'};bstart=$INFO{'bstart'};bfstart=$INFO{'bfstart'}";  
                 }  
           }  
   
           setTimeout("membtick()",2000);  
     // -->  
     </script>  
           ~;  
   
   
     } elsif ($action eq "messages") {  
           &ConvertMessages;  
   
           $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3 . $NavLink4a . $NavLink5 . $NavLink6;  
   
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left">  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Member Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Board and Category Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Message Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Date & Time Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Final Cleanup.</div>  
                 $ConvNotDone  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 New style message files have been created.<br />  
                 <br />  
                 <i>$INFO{'total_threads'}</i> Threads have been converted.<br />  
                 <i>$INFO{'total_mess'}</i> Messages have been converted.<br />  
                 <br />  
                 You are converting <i>~ . int(($INFO{'st'} + 60)/60) . qq~ minutes</i>.<br />  
                 <br />  
                 <p id="memcontinued">Click on 'Date & Time' in the menu to continue.<br />  
                 If you do not do that the script will continue by itself in 5 minutes.</p>  
                 </td>  
           </tr>  
           </table>  
     </div>  
   
     <script type="text/javascript">  
     <!--  
           function PleaseWait() {  
                 document.getElementById("memcontinued").innerHTML = '<font color="red"><b>Converting - please wait!<br />If you want to stop \\'Date & Time\\' conversion, click here on STOP before this red message appears again on next page.</b></font>';  
           }  
   
           function membtick() {  
                  PleaseWait();  
                  location.href="$set_cgi?action=dates;st=$INFO{'st'}";  
           }  
   
           setTimeout("membtick()",300000);  
     // -->  
     </script>  
           ~;  
   
   
     } elsif ($action eq "messages2") {  
           &setup_fatal_error("Message conversion (messages2) 'count' ($INFO{'count'}) or 'tcount' ($INFO{'tcount'}) error!", 1) if (!$INFO{'count'} && !$INFO{'tcount'}) || $INFO{'count'} < 0 || $INFO{'tcount'} < 0;  
   
           my $bwidth = int($INFO{'count'} / $INFO{'totboard'} * 100);  
           my $mwidth = $INFO{'totmess'} ? int($INFO{'tcount'} / $INFO{'totmess'} * 100) : 0;  
   
           $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3 . $NavLink4 . $NavLink5 . $NavLink6;  
   
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left">  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Member Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Board and Category Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Message Conversion.</div>  
                 <div style="float: left; width: 102px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $bwidth$px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">$bwidth %</div><br />  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Date & Time Conversion.</div>  
                 $ConvNotDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Final Cleanup.</div>  
                 $ConvNotDone  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 To prevent server time-out due to the amount of messages to be converted, the conversion is split into more steps.<br />  
                 <br />  
                 The time-step (\$max_process_time) is set to <i>$max_process_time seconds</i>.<br />  
                 The last step took <i>~ . ($time_to_jump - $INFO{'starttime'}) . qq~ seconds</i>.<br />  
                 You are converting <i>~ . int(($INFO{'st'} + 60)/60) . qq~ minutes</i>.<br />  
                 <br />  
                 <i>$INFO{'total_threads'}</i> Threads where converted until now.<br />  
                 <i>$INFO{'total_mess'}</i> Messages where converted until now.<br />  
                 <br />  
                 There are <b>~ . ($INFO{'totboard'} - $INFO{'count'}) . qq~/$INFO{'totboard'}</b> Boards left, to convert the Messages in.<br />  
                 <div style="float: left;">There are <b>~ . ($INFO{'totmess'} - $INFO{'tcount'}) . qq~/$INFO{'totmess'}</b> Threads left in the actual Board to be converted. &nbsp; </div>  
                 <div style="float: left; width: 100px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $mwidth$px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">$mwidth %</div><br />  
   
                 <p id="memcontinued">If nothing happens in 5 seconds <a href="$set_cgi?action=messages;st=$INFO{'st'};count=$INFO{'count'};tcount=$INFO{'tcount'};total_mess=$INFO{'total_mess'};total_threads=$INFO{'total_threads'}" onclick="PleaseWait();">click here to continue</a>...<br />If you want to <a href="javascript:stoptick();">STOP 'Messages' conversion click here</a>. Then copy the actual browser address and type it in when you are going to continue the conversion.</p>  
                 </td>  
           </tr>  
           </table>  
     </div>  
   
     <script type="text/javascript">  
     <!--  
           function PleaseWait() {  
                 document.getElementById("memcontinued").innerHTML = '<font color="red"><b>Converting - please wait!<br />If you want to stop \\'Messages\\' conversion, click here on STOP before this red message appears again on next page.</b></font>';  
           }  
   
           function stoptick() { stop = 1; }  
   
           stop = 0;  
           function membtick() {  
                 if (stop != 1) {  
                       PleaseWait();  
                       location.href="$set_cgi?action=messages;st=$INFO{'st'};count=$INFO{'count'};tcount=$INFO{'tcount'};total_mess=$INFO{'total_mess'};total_threads=$INFO{'total_threads'}";  
                 }  
           }  
   
           setTimeout("membtick()",2000);  
     // -->  
     </script>  
           ~;  
   
   
     } elsif ($action eq "dates") {  
           &ConvertTimeToString;  
   
           $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3 . $NavLink4 . $NavLink5a . $NavLink6;  
   
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left">  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Member Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Board and Category Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Message Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Date & Time Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Final Cleanup.</div>  
                 $ConvNotDone  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 New style timestamps have been created throughout the board. All old style dates have been converted.<br />  
                 <br />  
                 You are converting <i>~ . int(($INFO{'st'} + 60)/60) . qq~ minutes</i>.<br />  
                 <br />  
                 <p id="memcontinued">Click on 'Clean Up' in the menu to continue.<br />  
                 If you do not do that the script will continue by itself in 5 minutes.</p>  
                 </td>  
           </tr>  
           </table>  
     </div>  
   
     <script type="text/javascript">  
     <!--  
           function PleaseWait() {  
                 document.getElementById("memcontinued").innerHTML = '<font color="red"><b>Converting - please wait!<br />If you want to stop \\'Clean Up\\', click here on STOP before this red message appears again on next page.</b></font>';  
           }  
   
           function membtick() {  
                  PleaseWait();  
                  location.href="$set_cgi?action=cleanup;st=$INFO{'st'}";  
           }  
   
           setTimeout("membtick()",300000);  
     // -->  
     </script>  
           ~;  
   
   
     } elsif ($action eq "dates2") {  
           &setup_fatal_error("Date & Time conversion (dates2) error! pollfile($INFO{'pollfile'}), polledfile($INFO{'polledfile'})", 1) if $INFO{'pollfile'} <= 0 && $INFO{'polledfile'} <= 0;  
   
           my $pollwidth = ($INFO{'totalpolls'} && $INFO{'pollfile'}) ? int($INFO{'pollfile'} / $INFO{'totalpolls'} * 100) : 100;  
           $INFO{'pollfile'} = $INFO{'pollfile'} ? $INFO{'pollfile'} : $INFO{'totalpolls'};  
           my $polledwidth = ($INFO{'totalpolled'} && $INFO{'polledfile'}) ? int($INFO{'polledfile'} / $INFO{'totalpolled'} * 100) : 0;  
           $INFO{'polledfile'} = $INFO{'polledfile'} ? $INFO{'polledfile'} : $INFO{'totalpolled'};  
   
           $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3 . $NavLink4 . $NavLink5 . $NavLink6;  
   
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left">  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Member Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Board and Category Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Message Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Date & Time Conversion.</div>  
                 <div style="float: left; width: 102px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 10px;text-align :center;">  
                 See info below!  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">--- %</div><br />  
                 <div style="float: left; width: 250px; height: 14px; color: #bbbbbb;">Final Cleanup.</div>  
                 $ConvNotDone  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 To prevent server time-out due to the amount of Date & Time conversion, the conversion is split into more steps.<br />  
                 <br />  
                 The time-step (\$max_process_time) is set to <i>$max_process_time seconds</i>.<br />  
                 The last step took <i>~ . ($time_to_jump - $INFO{'starttime'}) . qq~ seconds</i>.<br />  
                 You are converting <i>~ . int(($INFO{'st'} + 60)/60) . qq~ minutes</i>.<br />  
                 <br />  
   
                 <div style="float: left; width: 350px; height: 14px;">There are <b>~ . ($INFO{'totalpolls'} - $INFO{'pollfile'}) . qq~/$INFO{'totalpolls'}</b> Polls left to be converted. &nbsp; </div>  
                 <div style="float: left; width: 100px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $pollwidth$px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">$pollwidth %</div>  
                 </div><br /><br />  
   
                 <div style="float: left; width: 350px; height: 14px;">There are <b>~ . ($INFO{'totalpolled'} - $INFO{'polledfile'}) . qq~/$INFO{'totalpolled'}</b> Polled-Files left to be converted. &nbsp; </div>  
                 <div style="float: left; width: 100px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $polledwidth$px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">$polledwidth %</div>  
                 </div><br /><br />  
   
                 <p id="memcontinued">If nothing happens in 5 seconds <a href="$set_cgi?action=dates;st=$INFO{'st'};timeconv=$INFO{'timeconv'};pollfile=$INFO{'pollfile'};totalpolls=$INFO{'totalpolls'};polledfile=$INFO{'polledfile'}" onclick="PleaseWait();">click here to continue</a>...<br />If you want to <a href="javascript:stoptick();">STOP 'Date & Time' conversion click here</a>. Then copy the actual browser address and type it in when you are going to continue the conversion.</p>  
                 </td>  
           </tr>  
           </table>  
     </div>  
   
     <script type="text/javascript">  
     <!--  
           function PleaseWait() {  
                 document.getElementById("memcontinued").innerHTML = '<font color="red"><b>Converting - please wait!<br />If you want to stop \\'Date & Time\\' conversion, click here on STOP before this red message appears again on next page.</b></font>';  
           }  
   
           function stoptick() { stop = 1; }  
   
           stop = 0;  
           function membtick() {  
                 if (stop != 1) {  
                       PleaseWait();  
                       location.href="$set_cgi?action=dates;st=$INFO{'st'};timeconv=$INFO{'timeconv'};pollfile=$INFO{'pollfile'};totalpolls=$INFO{'totalpolls'};polledfile=$INFO{'polledfile'}";  
                 }  
           }  
   
           setTimeout("membtick()",2000);  
     // -->  
     </script>  
           ~;  
   
   
     } elsif ($action eq "cleanup") {  
           require "$boardsdir/forum.master";  
   
           if (!$INFO{'clean'}) {  
                 fopen(FORUMTOTALS, ">>$boardsdir/forum.totals") || &setup_fatal_error("Can not open $boardsdir/forum.totals", 1);  
                 foreach my $testboard (@allboards) {  
                       chomp $testboard;  
                       if (-e "$convboardsdir/$testboard.ttl") {  
                             fopen(BOARDTTL, "$convboardsdir/$testboard.ttl") || &setup_fatal_error("Can not open $convboardsdir/$testboard.ttl", 1);  
                             my $line = <BOARDTTL>;  
                             fclose(BOARDTTL);  
                             chomp $line;  
                             print FORUMTOTALS "$testboard|$line|\n";  
                             #unlink "$convboardsdir/$testboard.ttl";  
                       }  
                 }  
                 print FORUMTOTALS "recycle|0|0|N/A|N/A||||\n";  
                 print FORUMTOTALS "announcements|0|0|N/A|N/A||||\n";  
                 fclose(FORUMTOTALS);  
   
                 $yySetLocation = qq~$set_cgi?action=cleanup2;st=~ . int($INFO{'st'} + time() - $time_to_jump + $max_process_time) . qq~;starttime=$time_to_jump;clean=1;pass_error=1;total_boards=~ . @allboards;  
                 &redirectexit;  
           }  
           &MyReCountTotals if $INFO{'clean'} == 1;  
   
           &MyMemberIndex if $INFO{'clean'} == 2;  
           &MyMailNotify if $INFO{'clean'} == 3;  
           &FixNopost if $INFO{'clean'} == 4;  
   
           if ($INFO{'tmp_firstforum'} > $INFO{'firstforum'}) {  
                 $setforumstart  = &timeformat($INFO{'tmp_firstforum'});  
                 $firstmember    = &timeformat($INFO{'firstforum'});  
                 $forumstarttext = qq~The Forum Start date was set to $setforumstart but the first member was registered $firstmember. So we changed the Forum Start Date to $firstmember.~;  
           }  
   
           $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3 . $NavLink4 . $NavLink5 . $NavLink6a;  
   
           $formsession = &cloak("$mbname$username");  
   
           if (-e "Convert/Members/admin.dat") {  
                 $convtext .= qq~<br /><br />After you have tested your forum and made sure everything was converted correctly you can go to your Admin Center and delete /Convert/Boards, /Convert/Members, /Convert/Messages and /Convert/Variables folders and their contents.~;  
           }  
   
           if (-e "$vardir/fixusers.txt") {  
                 $convtext .= qq~<br /><br />There were some illegal usernames. Their names were changed. Please inform them. You can find the list in the $vardir/fixusers.txt~;  
           }  
   
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left">  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Member Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Board and Category Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Message Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Date & Time Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Final Cleanup.</div>  
                 $ConvDone  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 $forumstarttext  
                 $convtext<br />  
                 <br />  
                 The conversion took <i>~ . int(($INFO{'st'} + 60)/60) . qq~ minutes</i>.<br />  
                 <br />  
                 <br />  
                 <font color"red">We recommend you delete the file "$ENV{'SCRIPT_NAME'}". This is to prevent someone else running the converter and damaging your files.<br />  
                 <br />  
                 Further more, we strongly recomend to run the following "Maintenance Controls" in the "Admin Center" before you start doing other things:<br />  
                 - Rebuild Message Index<br />  
                 - Recount Board Totals<br />  
                 - Rebuild Members List<br />  
                 - Recount Membership<br />  
                 - Rebuild Members History<br />  
                 - Rebuild Notifications Files<br />  
                 - Clean Users Online Log<br />  
                 - Attachment Functions => Rebuild Attachments<br /></font>  
                 <br />  
                 <br />  
                 You may now login to your forum. Enjoy using YaBB 2.5.2!  
                 </td>  
           </tr>  
           <tr>  
                 <td width="100%" class="catbg" colspan="2" align="center">  
                 <form action="YaBB.$yyext" method="post" style="display: inline;">  
                       <input type="submit" value="Start" />  
                       <input type="hidden" name="formsession" value="$formsession" />  
                 </form>  
                 </td>  
           </tr>  
           </table>  
     </div>~;  
   
           &CreateConvLock;  
   
   
     } elsif ($action eq "cleanup2") {  
           &setup_fatal_error("Clean Up (cleanup2) error! pass_error($INFO{'pass_error'}), my_re_tot($INFO{'my_re_tot'}), memb_index($INFO{'memb_index'}), my_mail_n($INFO{'my_mail_n'})", 1) if (!$INFO{'pass_error'} && $INFO{'my_re_tot'} <= 0) && $INFO{'memb_index'} <= 0 && $INFO{'my_mail_n'} <= 0 && $INFO{'fix_nopost'} <= 1;  
   
           my $re_tot_width = ($INFO{'total_re_tot'} && $INFO{'my_re_tot'}) ? int($INFO{'my_re_tot'} / $INFO{'total_re_tot'} * 100) : ($INFO{'total_re_tot'} ? 100 : 0);  
           $INFO{'my_re_tot'} = $INFO{'my_re_tot'} ? $INFO{'my_re_tot'} : $INFO{'total_re_tot'};  
           my $memb_index_width = ($INFO{'total_memb'} && $INFO{'memb_index'}) ? int($INFO{'memb_index'} / $INFO{'total_memb'} * 100) : ($INFO{'total_memb'} ? 100 : 0);  
           $INFO{'memb_index'} = $INFO{'memb_index'} ? $INFO{'memb_index'} : $INFO{'total_memb'};  
           my $mail_not_width = ($INFO{'total_mail_n'} && $INFO{'my_mail_n'}) ? int($INFO{'my_mail_n'} / $INFO{'total_mail_n'} * 100) : ($INFO{'total_mail_n'} ? 100 : 0);  
           $INFO{'my_mail_n'} = $INFO{'my_mail_n'} ? $INFO{'my_mail_n'} : $INFO{'total_mail_n'};  
           my $nopost_width = $INFO{'total_nopost'} ? int($INFO{'fix_nopost'} / $INFO{'total_nopost'} * 100) : 0;  
   
           $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3 . $NavLink4 . $NavLink5 . $NavLink6;  
   
           $yymain = qq~  
     <div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
           <table width="100%" cellspacing="1" cellpadding="4">  
           <tr valign="middle">  
                 <td width="100%" colspan="2" class="titlebg" align="left">  
                 YaBB 2.5.2 Converter  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/thread.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left">  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Member Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Board and Category Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Message Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Date & Time Conversion.</div>  
                 $ConvDone  
                 <div style="float: left; width: 250px; height: 14px; color: #FF3333;">Final Cleanup.</div>  
                 <div style="float: left; width: 102px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 10px;text-align :center;">  
                 See info below!  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">--- %</div>  
                 </td>  
           </tr>  
           <tr valign="middle">  
                 <td width="5%" class="windowbg" align="center">  
                 <img src="$imagesdir/info.gif" alt="" />  
                 </td>  
                 <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
                 To prevent server time-out due to the amount to Clean Up, the Cleanup is split into more steps.<br />  
                 <br />  
                 The time-step (\$max_process_time) is set to <i>$max_process_time seconds</i>.<br />  
                 The last step took <i>~ . ($time_to_jump - $INFO{'starttime'}) . qq~ seconds</i>.<br />  
                 You are converting <i>~ . int(($INFO{'st'} + 60)/60) . qq~ minutes</i>.<br />  
                 <br />  
   
                 <div style="float: left; width: 350px; height: 14px;">There are <b>0/$INFO{'total_boards'}</b> Boards (1) left to be recounted. &nbsp; </div>  
                 <div style="float: left; width: 100px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $100px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">100 %</div>  
                 </div><br /><br />  
   
                 <div style="float: left; width: 350px; height: 14px;">There are <b>~ . ($INFO{'total_re_tot'} - $INFO{'my_re_tot'}) . qq~/$INFO{'total_re_tot'}</b> Boards (2) left to be recounted. &nbsp; </div>  
                 <div style="float: left; width: 100px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $re_tot_width$px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">$re_tot_width %</div>  
                 </div><br /><br />  
   
                 <div style="float: left; width: 350px; height: 14px;">There are <b>~ . ($INFO{'total_memb'} - $INFO{'memb_index'}) . qq~/$INFO{'total_memb'}</b> Members left to be recounted. &nbsp; </div>  
                 <div style="float: left; width: 100px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $memb_index_width$px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">$memb_index_width %</div>  
                 </div><br /><br />  
   
                 <div style="float: left; width: 350px; height: 14px;">There are <b>~ . ($INFO{'total_mail_n'} - $INFO{'my_mail_n'}) . qq~/$INFO{'total_mail_n'}</b> Notifications left to be written new. &nbsp; </div>  
                 <div style="float: left; width: 100px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $mail_not_width$px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">$mail_not_width %</div>  
                 </div><br /><br />  
   
                 <div style="float: left; width: 350px; height: 14px;">There are <b>~ . ($INFO{'total_nopost'} - $INFO{'fix_nopost'}) . qq~/$INFO{'total_nopost'}</b> NoPost-Membergroups left to be updated. &nbsp; </div>  
                 <div style="float: left; width: 100px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">  
                 <div style="position: relative; top: 0px; left: 0px; width: $nopost_width$px; height: 10px; margin: 0px; background-color: #6699cc; border: 0px; font-size: 5px;">&nbsp;</div>  
                 </div>  
                 <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">$nopost_width %</div>  
                 </div><br /><br />  
   
                 <p id="memcontinued">If nothing happens in 5 seconds <a href="$set_cgi?action=cleanup;st=$INFO{'st'};clean=$INFO{'clean'};total_boards=$INFO{'total_boards'};total_re_tot=$INFO{'total_re_tot'};my_re_tot=$INFO{'my_re_tot'};tmp_firstforum=$INFO{'tmp_firstforum'};firstforum=$INFO{'firstforum'};siglength=$INFO{'siglength'};total_memb=$INFO{'total_memb'};memb_index=$INFO{'memb_index'};total_mail_n=$INFO{'total_mail_n'};my_mail_n=$INFO{'my_mail_n'};total_nopost=$INFO{'total_nopost'};fix_nopost=$INFO{'fix_nopost'}" onclick="PleaseWait();">click here to continue</a>...<br />If you want to <a href="javascript:stoptick();">STOP 'Clean Up' conversion click here</a>. Then copy the actual browser address and type it in when you are going to continue the conversion.</p>  
                 </td>  
           </tr>  
           </table>  
     </div>  
   
     <script type="text/javascript">  
     <!--  
           function PleaseWait() {  
                 document.getElementById("memcontinued").innerHTML = '<font color="red"><b>Converting - please wait!<br />If you want to stop \\'Clean Up\\', click here on STOP before this red message appears again on next page.</b></font>';  
           }  
   
           function stoptick() { stop = 1; }  
   
           stop = 0;  
           function membtick() {  
                 if (stop != 1) {  
                       PleaseWait();  
                       location.href="$set_cgi?action=cleanup;st=$INFO{'st'};clean=$INFO{'clean'};total_boards=$INFO{'total_boards'};total_re_tot=$INFO{'total_re_tot'};my_re_tot=$INFO{'my_re_tot'};tmp_firstforum=$INFO{'tmp_firstforum'};firstforum=$INFO{'firstforum'};siglength=$INFO{'siglength'};total_memb=$INFO{'total_memb'};memb_index=$INFO{'memb_index'};total_mail_n=$INFO{'total_mail_n'};my_mail_n=$INFO{'my_mail_n'};total_nopost=$INFO{'total_nopost'};fix_nopost=$INFO{'fix_nopost'}";  
                 }  
           }  
   
           setTimeout("membtick()",2000);  
     // -->  
     </script>  
           ~;  
     }  
   
     $yyim    = 'You are running the YaBB 2.5.2 Converter.';  
     $yytitle = 'YaBB 2.5.2 Converter';  
     &SetupTemplate;  
}  
   
   
# Prepare Conversion ##  
   
sub PrepareConv {  
     fopen(FILE, ">$boardsdir/dummy.testfile") || &setup_fatal_error("The CHMOD of the $boardsdir is not set correctly! Cannot write this directory!", 1);  
     print FILE "dummy testfile\n";  
     fclose(FILE);  
     opendir(BDIR, $boardsdir) || &setup_fatal_error("The CHMOD of the $boardsdir is not set correctly! Cannot read this directory! ", 1);  
     @boardlist = readdir(BDIR);  
     closedir(BDIR);  
   
     fopen(FILE, ">$memberdir/dummy.testfile") || &setup_fatal_error("The CHMOD of the $memberdir is not set correctly! Cannot write this directory!", 1);  
     print FILE "dummy testfile\n";  
     fclose(FILE);  
     opendir(MBDIR, $memberdir) || &setup_fatal_error("The CHMOD of the $memberdir is not set correctly! Cannot read this directory! ", 1);  
     @memblist = readdir(MBDIR);  
     closedir(MBDIR);  
   
     fopen(FILE, ">$datadir/dummy.testfile") || &setup_fatal_error("The CHMOD of the $datadir is not set correctly! Cannot write this directory!", 1);  
     print FILE "dummy testfile\n";  
     fclose(FILE);  
     opendir(MSDIR, $datadir) || &setup_fatal_error("The CHMOD of the $datadir is not set correctly! Cannot read this directory! ", 1);  
     @msglist = readdir(MSDIR);  
     closedir(MSDIR);  
   
     &automaintenance('on');  
   
     unlink "$vardir/fixusers.txt";  
   
     foreach $file (@boardlist) {  
           unless ($file eq ".htaccess" || $file eq "index.html" || $file eq "forum.control" || $file eq "." || $file eq "..") { unlink "$boardsdir/$file"; }  
     }  
     foreach $file (@memblist) {  
           unless ($file eq ".htaccess" || $file eq "index.html" || $file eq "admin.vars" || $file eq "." || $file eq "..") { unlink "$memberdir/$file"; }  
     }  
     foreach $file (@msglist) {  
           unless ($file eq ".htaccess" || $file eq "index.html" || $file eq "." || $file eq "..") { unlink "$datadir/$file"; }  
     }  
}  
   
# / Prepare Conversion ##  
   
   
# Member Conversion ##  
   
sub ConvertMembers1 {  
     fopen(MEMDIR, "$convmemberdir/memberlist.txt") || &setup_fatal_error("$maintext_23 $convmemberdir/memberlist.txt: ", 1);  
     my @memlist = <MEMDIR>;  
     fclose(MEMDIR);  
   
     for (my $i = ($INFO{'mstart1'} || 0); $i < @memlist; $i++) {  
           $uname = $memlist[$i];  
           chomp $uname;  
   
           next if !-e "$convmemberdir/$uname.dat";  
   
           if ($uname =~ /[^\w\+\-\.\@]|guest/i) {  
                 &IllegalUser($uname);  
           } else {  
                 &MyUpdateUser($uname);  
           }  
   
           if (time() > $time_to_jump && ($i + 1) < @memlist) {  
                 $yySetLocation = qq~$set_cgi?action=members2;st=~ . int($INFO{'st'} + time() - $time_to_jump + $max_process_time) . qq~;starttime=$time_to_jump;mtotal=~ . @memlist . qq~;mstart1=~ . ($i + 1);  
                 &redirectexit;  
           }  
     }  
   
     $INFO{'mstart1'} = @memlist;  
   
     if (-e "$convvardir/MemberStats.txt") { &groupconvert; }  
   
     if (-e "$vardir/fixusers.txt") {  
           fopen(FIXUSER, "$vardir/fixusers.txt") || &setup_fatal_error("$maintext_23 $vardir/fixusers.txt: ", 1);  
           my @fixed = <FIXUSER>;  
           fclose(FIXUSER);  
           foreach (@fixed) {  
                 my ($user, $fixedname, undef, $displayedname, undef) = split(/\|/, $_);  
                 @{$fixed_users{$user}} = ($fixedname,$displayedname);  
           }  
     }  
   
     &ConvertMembers2;  
}  
   
sub IllegalUser {  
     my $user = $_[0];  
   
     my $fixeduser = $user;  
     $fixeduser =~ s/[^\w\+\-\.\@]|guest//gi;  
     if (!$fixeduser) { $fixeduser = "fixeduser"; }  
     $fixeduser = &check_existence($memberdir, "$fixeduser.vars");  
     $fixeduser =~ s/(\S+?)(\.\S+$)/$1/;  
   
     fopen(LOADOLDUSER, "$convmemberdir/$user.dat") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.dat: ", 1);  
     my @settings = <LOADOLDUSER>;  
     fclose(LOADOLDUSER);  
     chomp(@settings);  
   
     my ($pmignorelist, $pmnotify, $pmpopup, $pmspop);  
     if (-e "$convmemberdir/$user.imconfig") {  
           fopen(PMUSER, "$convmemberdir/$user.imconfig") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.imconfig: ", 1);  
           @pmconfics = <PMUSER>;  
           fclose(PMUSER);  
           chomp($pmconfics[0], $pmconfics[1], $pmconfics[3], $pmconfics[5]);  
           $pmignorelist = $pmconfics[0];  
           $pmnotify = $pmconfics[1] ? 3 : 0;  
           $pmpopup = $pmconfics[3];  
           $pmspop = $pmconfics[5];  
     }  
   
     my $msnaddress = "";  
     if (-e "$convmemberdir/$user.om") {  
           fopen(MSNFILE, "$convmemberdir/$user.om") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.om: ", 1);  
           my @msnsettings = <MSNFILE>;  
           fclose(MSNFILE);  
           chomp $msnsettings[0];  
           $msnaddress = $msnsettings[0];  
     }  
   
     my ($lastonline, $lastpost, $lastim);  
     if (-e "$convmemberdir/$user.ll") {  
           fopen(LLFILE, "$convmemberdir/$user.ll") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.ll: ", 1);  
           ($lastonline, $lastpost, $lastim) = <LLFILE>;  
           fclose(LLFILE);  
           chomp($lastonline, $lastpost, $lastim);  
           $lastonline =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~eis;  
           $lastpost =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~eis;  
           $lastim =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~eis;  
     }  
   
     if (-e "$convmemberdir/$user.yam") {  
           fopen(YAMFILE, "$convmemberdir/$user.yam") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.yam: ", 1);  
           my @ipsettings = <YAMFILE>;  
           fclose(YAMFILE);  
           chomp $ipsettings[1];  
           ($c_ip_one, $c_ip_two, $c_ip_three) = split (/\|/, $ipsettings[1]);  
           if ($c_ip_one eq '0') { $c_ip_one = ''; }  
           if ($c_ip_two eq '0') { $c_ip_two = ''; }  
           if ($c_ip_three eq '0') { $c_ip_three = ''; }  
     }  
   
     $settings[14] = &format_timestring($settings[14]);  
   
     $regitime = "$settings[14]";  
     $regitime =~ s~(\d{2}\/\d{2}\/\d{2,4}).*?(\d{2}\:\d{2}\:\d{2})~&conv_stringtotime("$1 at $2")~eis;  
   
     if ($default_template) { $new_template = $default_template; }  
     else { $new_template = qq~Forum default~; }  
   
     if ($settings[1] eq "") { $settings[1] = $user; }  
   
     if ($settings[5]) {  
           $settings[5] =~ s/&&/&amp;&amp;/g;  
           $settings[5] =~ s/\"/&quot;/g; #";  
           $settings[5] =~ s~\[size=([+-]?\d)\](.*?)\[/size\]~ "\[size=" . &conv_size($1) . "\]$2\[/size\]" ~ige;  
           $settings[5] =~ s~<br>~<br />~ig;  
     }  
   
     my @location = split(/,|\|/, $settings[15]);  
     shift(@location);  
   
     %{$uid.$fixeduser} = (  
           'password'      => "$settings[0]",  
           'realname'      => "$settings[1]",  
           'email'         => "$settings[2]",  
           'webtitle'      => "$settings[3]",  
           'weburl'        => (($settings[4] && $settings[4] !~ m~\Ahttps?://~) ? "http://" : "") . $settings[4],  
           'signature'     => "$settings[5]",  
           'postcount'     => "$settings[6]",  
           'position'      => "$settings[7]",  
           'icq'           => "$settings[8]",  
           'aim'           => "$settings[9]",  
           'yim'           => "$settings[10]",  
           'gender'        => "$settings[11]",  
           'usertext'      => "$settings[12]",  
           'userpic'       => "$settings[13]",  
           'regdate'       => "$settings[14]",  
           'regtime'       => "$regitime",  
           'location'      => join(', ', grep($_, @location)),  
           'bday'          => "$settings[16]",  
           'timeselect'    => "$settings[17]",  
           'timeoffset'    => "$timeoffset",  
           'hidemail'      => ($settings[19] ? 1 : 0),  
           'msn'           => "$msnaddress",  
           'gtalk'         => "$settings[32]",  
           'template'      => "$new_template",  
           'language'      => "$language",  
           'lastonline'    => "$lastonline",  
           'lastpost'      => "$lastpost",  
           'lastim'        => "$lastim",  
           'im_ignorelist' => "$pmignorelist",  
           'notify_me'     => "$pmnotify",  
           'im_popup'      => ($pmpopup ? 1 : 0),  
           'im_imspop'     => ($pmspop ? 1 : 0),  
           'cathide'       => "$settings[30]",  
           'postlayout'    => ($settings[31] ? "$settings[31]|0" : ''),  
           'dsttimeoffset' => "$dstoffset",  
           'pageindex'     => "1|1|1",  
           'lastips'       => "$c_ip_one|$c_ip_two|$c_ip_three",  
     );  
   
     &UserAccount($fixeduser,"update");  
   
     fopen(FIXUSER, ">>$vardir/fixusers.txt") || &setup_fatal_error("$maintext_23 $vardir/fixusers.txt: ", 1);  
     print FIXUSER "$user|$fixeduser|$settings[14]|$settings[1]|$settings[2]\n";  
     fclose(FIXUSER);  
   
     undef %{$uid.$fixeduser} if $fixeduser ne $username;  
}  
   
sub MyUpdateUser {  
     my $user = $_[0];  
   
     fopen(LOADOLDUSER, "$convmemberdir/$user.dat") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.dat: ", 1);  
     my @settings = <LOADOLDUSER>;  
     fclose(LOADOLDUSER);  
     chomp(@settings);  
   
     my ($pmignorelist, $pmnotify, $pmpopup, $pmspop);  
     if (-e "$convmemberdir/$user.imconfig") {  
           fopen(PMUSER, "$convmemberdir/$user.imconfig") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.imconfig: ", 1);  
           @pmconfics = <PMUSER>;  
           fclose(PMUSER);  
           chomp($pmconfics[0], $pmconfics[1], $pmconfics[3], $pmconfics[5]);  
           $pmignorelist = $pmconfics[0];  
           $pmnotify = $pmconfics[1] ? 3 : 0;  
           $pmpopup = $pmconfics[3];  
           $pmspop = $pmconfics[5];  
     }  
   
     my $msnaddress = "";  
     if (-e "$convmemberdir/$user.om") {  
           fopen(MSNFILE, "$convmemberdir/$user.om") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.om: ", 1);  
           my @msnsettings = <MSNFILE>;  
           fclose(MSNFILE);  
           chomp $msnsettings[0];  
           $msnaddress = $msnsettings[0];  
     }  
   
     my ($lastonline, $lastpost, $lastim);  
     if (-e "$convmemberdir/$user.ll") {  
           fopen(LLFILE, "$convmemberdir/$user.ll") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.ll: ", 1);  
           ($lastonline, $lastpost, $lastim) = <LLFILE>;  
           fclose(LLFILE);  
           chomp($lastonline, $lastpost, $lastim);  
           $lastonline =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~eis;  
           $lastpost =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~eis;  
           $lastim =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~eis;  
     }  
   
     if (-e "$convmemberdir/$user.yam") {  
           fopen(YAMFILE, "$convmemberdir/$user.yam") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.yam: ", 1);  
           my @ipsettings = <YAMFILE>;  
           fclose(YAMFILE);  
           chomp $ipsettings[1];  
           ($c_ip_one, $c_ip_two, $c_ip_three) = split (/\|/, $ipsettings[1]);  
           if ($c_ip_one eq '0') { $c_ip_one = ''; }  
           if ($c_ip_two eq '0') { $c_ip_two = ''; }  
           if ($c_ip_three eq '0') { $c_ip_three = ''; }  
     }  
   
     $settings[14] = &format_timestring($settings[14]);  
   
     $regitime = "$settings[14]";  
     $regitime =~ s~(\d{2}\/\d{2}\/\d{2,4}).*?(\d{2}\:\d{2}\:\d{2})~&conv_stringtotime("$1 at $2")~eis;  
   
     if ($default_template) { $new_template = $default_template; }  
     else { $new_template = qq~Forum default~; }  
   
     if ($settings[1] eq "") { $settings[1] = $user; }  
   
     if ($settings[5]) {  
           $settings[5] =~ s/&&/&amp;&amp;/g;  
           $settings[5] =~ s/\"/&quot;/g;  
           $settings[5] =~ s~\[size=([+-]?\d)\](.*?)\[/size\]~ "\[size=" . &conv_size($1) . "\]$2\[/size\]" ~ige;  
           $settings[5] =~ s~<br>~<br />~ig;  
     }  
   
     my @location = split(/,|\|/, $settings[15]);  
     shift(@location);  
   
     %{$uid.$user} = (  
           'password'      => "$settings[0]",  
           'realname'      => "$settings[1]",  
           'email'         => "$settings[2]",  
           'webtitle'      => "$settings[3]",  
           'weburl'        => (($settings[4] && $settings[4] !~ m~\Ahttps?://~) ? "http://" : "") . $settings[4],  
           'signature'     => "$settings[5]",  
           'postcount'     => "$settings[6]",  
           'position'      => "$settings[7]",  
           'icq'           => "$settings[8]",  
           'aim'           => "$settings[9]",  
           'yim'           => "$settings[10]",  
           'gender'        => "$settings[11]",  
           'usertext'      => "$settings[12]",  
           'userpic'       => "$settings[13]",  
           'regdate'       => "$settings[14]",  
           'regtime'       => "$regitime",  
           'location'      => join(', ', grep($_, @location)),  
           'bday'          => "$settings[16]",  
           'timeselect'    => "$settings[17]",  
           'timeoffset'    => "$timeoffset",  
           'hidemail'      => ($settings[19] ? 1 : 0),  
           'msn'           => "$msnaddress",  
           'gtalk'         => "$settings[32]",  
           'template'      => "$new_template",  
           'language'      => "$language",  
           'lastonline'    => "$lastonline",  
           'lastpost'      => "$lastpost",  
           'lastim'        => "$lastim",  
           'im_ignorelist' => "$pmignorelist",  
           'notify_me'     => "$pmnotify",  
           'im_popup'      => ($pmpopup ? 1 : 0),  
           'im_imspop'     => ($pmspop ? 1 : 0),  
           'cathide'       => "$settings[30]",  
           'postlayout'    => "$settings[31]|0",  
           'dsttimeoffset' => "$dstoffset",  
           'pageindex'     => "1|1|1",  
           'lastips'       => "$c_ip_one|$c_ip_two|$c_ip_three",  
     );  
   
     &UserAccount($user,"update");  
   
     undef %{$uid.$user} if $user ne $username;  if ( -e "$vardir/Setup.lock" ) { 
     FoundSetupLock();
} }
   
sub groupconvert {  
     require "$convvardir/MemberStats.txt";  
     my $i = 0;  
     my $z = 1;  
     undef %Post;  
   
     $Post{'-1'} = qq~$MemStatNewbie|$MemStarNumNewbie|$MemStarPicNewbie|$MemTypeColNewbie|0|0|0|0|0|0~;  
   
     while ($MemStat[$i]) {  
           if ($MemPostNum[$i] eq "x") {  
                 $NoPost{$z} = qq~$MemStat[$i]|$MemStarNum[$i]|$MemStarPic[$i]|$MemTypeCol[$i]|0|0|0|0|0|0~;  
                 push @nopostorder, $z;  
                 $z++;  
           } else {  
                 $Post{$MemPostNum[$i]} = qq~$MemStat[$i]|$MemStarNum[$i]|$MemStarPic[$i]|$MemTypeCol[$i]|0|0|0|0|0|0~;  
           }  
           $i++;  
     }  
   
     foreach my $key (keys %Group) {  
           my $value = $Group{$key};  
           $value =~ s~'~&#39;~g;  
           $Group{'$key'} = $value;  
     }  
     foreach my $key (keys %NoPost) {  
           my $value = $NoPost{$key};  
           $value =~ s~'~&#39;~g;  
           $NoPost{'$key'} = $value;  
     }  
     foreach my $key (keys %Post) {  
           my $value = $Post{$key};  
           $value =~ s~'~&#39;~g; #';  
           $Post{'$key'} = $value;  
     }  
     require "$admindir/NewSettings.pl";  
     &SaveSettingsTo('Settings.pl'); # save %Group, %NoPost and %Post  
}  
   
sub ConvertMembers2 {  
     fopen(MEMDIR, "$convmemberdir/memberlist.txt") || &setup_fatal_error("$maintext_23 $convmemberdir/memberlist.txt: ", 1);  
     my @memlist = <MEMDIR>;  
     fclose(MEMDIR);  
   
     for (my $i = ($INFO{'mstart2'} || 0); $i < @memlist; $i++) {  
           my $user = $memlist[$i];  
           chomp $user;  
   
           next if !-e "$convmemberdir/$user.dat";  
   
           my $newuser = exists $fixed_users{$user} ? ${$fixed_users{$user}}[0] : $user;  
   
           my @xtn = qw(msg ims imstore log outbox);  
           for (my $cnt = 0; $cnt < @xtn; $cnt++) {  
                 if (-e "$convmemberdir/$user.$xtn[$cnt]") {  
                       fopen(FILEUSER, "$convmemberdir/$user.$xtn[$cnt]") || &setup_fatal_error("$maintext_23 $convmemberdir/$user.$xtn[$cnt]: ", 1);  
                       my @divfiles = <FILEUSER>;  
                       fclose(FILEUSER);  
   
                       if ($cnt == 0 || $cnt == 2 || $cnt == 4) { # msg || imstore || outbox  
                             chomp(@divfiles);  
                             for (my $i = 0; $i < @divfiles; $i++) {  
                                   if ($cnt == 2) { # imstore  
                                         my ($name, $subject, $date, $message, $id, $ip, $read_flag, $folder) = split(/\|/, $divfiles[$i]);  
                                         $name = exists $fixed_users{$name} ? ${$fixed_users{$name}}[0] : $name;  
                                         $date =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~ei;  
                                         $message =~ s~<br>~<br />~ig;  
                                         if ($folder eq 'outbox') {  
                                               $folder = 'out';  
                                               if (!$read_flag) { $read_flag = 'u'; }  
                                               elsif ($read_flag == 1) { $read_flag = 'r'; }  
                                               $divfiles[$i] = "$id|$newuser|$name|||$subject|$date|$message|$id|0|$ip|s|$read_flag|$folder|\n";  
                                         } elsif ($folder eq 'inbox') {  
                                               $folder = 'in';  
                                               if ($read_flag == 1) { $read_flag = 'u'; }  
                                               elsif ($read_flag == 2) { $read_flag = 'r'; }  
                                               $divfiles[$i] = "$id|$name|$newuser|||$subject|$date|$message|$id|0|$ip|s|$read_flag|$folder|\n";  
                                         }  
   
                                   } else  { # msg || outbox  
                                         my ($name, $subject, $date, $message, $id, $ip, $read_flag) = split(/\|/, $divfiles[$i]);  
                                         $name = exists $fixed_users{$name} ? ${$fixed_users{$name}}[0] : $name;  
                                         $date =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~ei;  
                                         $message =~ s~<br>~<br />~ig;  
                                         if ($id < 101 || $id eq '') { $id = $date; }  
                                         if ($cnt == 0) { # msg  
                                               if ($read_flag == '1') { $read_flag = 'u' ; } # u(nread)  
                                               elsif ($read_flag == '2') { $read_flag = 'r'; } # r(eplied)  
                                               $divfiles[$i] = "$id|$name|$newuser|||$subject|$date|$message|$id|0|$ip|s|$read_flag||\n";  
                                         } else { # outbox  
                                               if (!$read_flag) { $read_flag = 'u' ; } # u(rgent)  
                                               elsif ($read_flag == 1) { $read_flag = 's'; } # s(tandard)  
                                               $divfiles[$i] = "$id|$newuser|$name|||$subject|$date|$message|$id|0|$ip|s|$read_flag||\n";  
                                         }  
                                   }  
                             }  
                       }  
   
                       fopen(FILEUSER, ">$memberdir/$newuser.$xtn[$cnt]") || &setup_fatal_error("$maintext_23 $memberdir/$newuser.$xtn[$cnt]: ", 1);  
                       print FILEUSER @divfiles;  
                       fclose(FILEUSER);  
                 }  
           }  
   
           if (time() > $time_to_jump && ($i + 1) < @memlist) {  
                 $yySetLocation = qq~$set_cgi?action=members2;st=~ . int($INFO{'st'} + time() - $time_to_jump + $max_process_time) . qq~;starttime=$time_to_jump;mtotal=~ . @memlist . qq~;mstart1=$INFO{'mstart1'};mstart2=~ . ($i + 1);  
                 &redirectexit;  
           }  
     }  
}  
   
# / Member Conversion ##  
   
   
# Board + Category Conversion ##  
   
sub GetCats {  
     fopen(VDIR, "$convvardir/cat.txt") || &setup_fatal_error("$maintext_23 $convvardir/cat.txt: ", 1);  
     @categoryorder = <VDIR>;  
     fclose(VDIR);  
     chomp(@categoryorder);  
   
     my @allboards;  
     foreach $fcat (@categoryorder) {  
           fopen(VCAT, "$convboardsdir/$fcat.cat") || &setup_fatal_error("$maintext_23 $convboardsdir/$fcat.cat: ", 1);  
           @catdata = <VCAT>;  
           fclose(VCAT);  
           chomp(@catdata);  
   
           $catinfo{$fcat} = qq~$catdata[0]|$catdata[1]|1~;  
   
           my @catboards = ();  
           for ($cnt = 2; $cnt < @catdata; $cnt++) {  
                 unless (!$catdata[$cnt]) { push(@catboards, $catdata[$cnt]); }  
           }  
           push(@allboards, @catboards);  
           $cat{$fcat} = join(',', @catboards);  
     }  
     foreach $fboard (@allboards) {  
           fopen(VBRD, "$convboardsdir/$fboard.dat") || &setup_fatal_error("$maintext_23 $convboardsdir/$fboard.dat: ", 1);  
           @bdata = <VBRD>;  
           fclose(VBRD);  
           chomp $bdata[0];  
   
           # get board access data  
           if (-e "$convboardsdir/$fboard.mbo") {  
                 require "$convboardsdir/$fboard.mbo";  
           }  
           $board{$fboard} = qq~$bdata[0]|$view_groups{$fboard}|$showprivboards{$fboard}~;  
     }  
   
     # add trash if not exists  
     unless (exists $cat{'staff'}) {  
           push(@categoryorder, 'staff');  
       $cat{'staff'} = "announcements,recycle";  
           $catinfo{'staff'} = "Forum Staff|Administrator, Global Moderator|0";  
     } else {  
           my @temp;  
           foreach (split(/,/, $cat{'staff'})) {  
                 push(@temp, $_) if $_ ne 'recycle' && $_ ne 'announcements';  
           }  
           push(@temp, 'recycle');  
           push(@temp, 'announcements');  
           $cat{'staff'} = join(',', @temp);  
     }  
     $board{'recycle'} = "Recycle Bin||" unless exists $board{'recycle'};  
     $board{'announcements'} = "Global Announcements||" unless exists $board{'announcements'};  
   
     @temparray = ();  
     while (($key, $value) = each(%cat)) {  
           # Strip membergroups with a ~ from them  
           $value =~ s/~//g;  
           push(@temparray, qq~\$cat{'$key'} = qq\~$value\~;\n~);  
     }  
     while (($key, $value) = each(%catinfo)) {  
           # Strip membergroups with a ~ from them  
           $value =~ s/~//g;  
           $value =~ s/,/, /g;  
           push(@temparray, qq~\$catinfo{'$key'} = qq\~$value\~;\n~);  
     }  
     while (($key, $value) = each(%board)) {  
           # Strip membergroups with a ~ from them  
           $value =~ s/~//g;  
           $value =~ s/,/, /g;  
           push(@temparray, qq~\$board{'$key'} = qq\~$value\~;\n~);  
     }  
     fopen(FILE, ">$boardsdir/forum.master") || &setup_fatal_error("$maintext_23 $boardsdir/forum.master: ", 1);  
     print FILE qq~\$mloaded = 1;\n~, qq~\@categoryorder = qw(@categoryorder);\n~, @temparray, "\n1;";  
     fclose(FILE);  
}  
   
sub CreateControl {  
     require "$boardsdir/forum.master";  
   
     foreach $foundboard (keys %board) {  
           # get category  
           fopen("CINFO", "$convboardsdir/$foundboard.ctb");  
           @category = <CINFO>;  
           fclose("CINFO");  
           chomp $category[0];  
           $cntcat = $category[0];  
   
           # get boardinfo  
           fopen("BINFO", "$convboardsdir/$foundboard.dat");  
           @boardinfo = <BINFO>;  
           fclose("BINFO");  
           chomp(@boardinfo);  
   
           $boardinfo[2]   =~ s/^\||\|$//g;  
           $boardinfo[2]   =~ s/\|(\S?)/,$1/g;  
           $cntmods        = join(',', grep { exists $fixed_users{$_} ? ${$fixed_users{$_}}[0] : $_; } split(/,/, $boardinfo[2]));  
           $cntpic         = "";  
           $cntdescription = $boardinfo[1];  
   
           # get board access data  
           if (-e "$convboardsdir/$foundboard.mbo") {  
                 require "$convboardsdir/$foundboard.mbo";  
           }  
   
           $cntstartperms = "$start_groups{$foundboard}";  
           $cntreplyperms = "$reply_groups{$foundboard}";  
           $cntpollperms  = "";  
           $cntstartperms =~ s/,/, /g;  
           $cntreplyperms =~ s/,/, /g;  
           $cntpollperms  =~ s/,/, /g;  
           $cntpic        = "$boardpic{$foundboard}";  
           $cntzero       = "";  
           $cntpassword   = "";  
           $cnttotals     = "";  
           $cntattperms   = "";  
           $spare         = "";  
   
           if ($cntcat && $foundboard) {  
                 push(@boardcontrol, "$cntcat|$foundboard|$cntpic|$cntdescription|$cntmods|$cntmodgroups|$cntstartperms|$cntreplyperms|$cntpollperms|$cntzero|$cntpassword|$cnttotals|$cntattperms|$spare|||\n");  
           } elsif (!$cntcat && $foundboard eq 'recycle') { # add trash if not exists  
                 push(@boardcontrol, qq{staff|recycle||If the Recycle Bin is turned on, removed topics will be moved to this board. This will allow you to recover them if it is necessary. You should purge messages in this board frequently to keep it clean.|admin|||||1|||1||||\n"});  
                 if (!-e "$convboardsdir/recycle.txt") {  
                       fopen(BOARDFILE, ">$convboardsdir/recycle.txt") || &setup_fatal_error("$maintext_23 $convboardsdir/recycle.txt: ", 1);  
                       print BOARDFILE '';  
                       fclose(BOARDFILE);  
                 }  
           } elsif (!$cntcat && $foundboard eq 'announcements') { # add announcements  
                 push(@boardcontrol, qq{staff|announcements||Topics you place in this board will display as a "Global Announcement" on the top of all other boards. Use this for things such as forum rules, top news articles, or important statements.|admin||Administrator|||0||1|||||\n});  
                 if (!-e "$convboardsdir/announcements.txt") {  
                       fopen(BOARDFILE, ">$convboardsdir/announcements.txt") || &setup_fatal_error("$maintext_23 $convboardsdir/announcements.txt: ", 1);  
                       print BOARDFILE '';  
                       fclose(BOARDFILE);  
                 }  
           }  
     }  
   
     fopen(CONTROL, ">$boardsdir/forum.control") || &setup_fatal_error("$maintext_23 $boardsdir/forum.control: ", 1);  
     @boardcontrol = sort(@boardcontrol);  
     print CONTROL @boardcontrol;  
     fclose(CONTROL);  
}  
   
sub ConvertBoards {  
     require "$boardsdir/forum.master";  
   
     my %stickies;  
     if (open(DATADIR, "$convboardsdir/sticky.stk")) {  
           my @stickies = <DATADIR>;  
           close(DATADIR);  
           chomp(@stickies);  
           foreach (@stickies) { $stickies{$_} = 1; }  
     }  
   
     @boards = sort(keys %board);  
   
     for (my $i = ($INFO{'bstart'} || 0); $i < @boards; $i++) {  
           fopen(BOARDFILE, "$convboardsdir/$boards[$i].txt") || &setup_fatal_error("$maintext_23 $convboardsdir/$boards[$i].txt: ", 1);  
           @boardfile = <BOARDFILE>;  
           fclose(BOARDFILE);  
   
           @temparray = ();  
           for (my $j = ($INFO{'bfstart'} || 0); $j < @boardfile; $j++) {  
                 my $line = $boardfile[$j];  
                 chomp $line;  
                 my ($mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate) = split(/\|/, $line);  
   
                 next if (!-e "$convdatadir/$mnum.txt" || -s "$convdatadir/$mnum.txt" < 35);  
   
                 $mname = exists $fixed_users{$mname} ? ${$fixed_users{$mname}}[1] : $mname;  
                 $musername = exists $fixed_users{$musername} ? ${$fixed_users{$musername}}[0] : $musername;  
                 $mdate =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~eis;  
                 $mstate =~ s/1/l/;  
                 $mstate .= "s" if exists $stickies{$mnum};  
                 push(@temparray, "$mnum|$msub|$mname|$memail|$mdate|$mreplies|$musername|$micon|$mstate\n");  
   
                 if (time() > $time_to_jump && ($j + 1) < @boardfile) {  
                             fopen(BOARDFILE, ">>$boardsdir/$boards[$i].txt") || &setup_fatal_error("$maintext_23 $boardsdir/$boards[$i].txt: ", 1);  
                             print BOARDFILE @temparray;  
                             fclose(BOARDFILE);  
                             $yySetLocation = qq~$set_cgi?action=cats2;st=~ . int($INFO{'st'} + time() - ($time_to_jump - $max_process_time)) . qq~;starttime=$time_to_jump;bfstart=~ . ($j + 1) . qq~;bstart=$i;btotal=~ . @boards;  
                             &redirectexit;  
                 }  
           }  
           fopen(BOARDFILE, ">>$boardsdir/$boards[$i].txt") || &setup_fatal_error("$maintext_23 $boardsdir/$boards[$i].txt: ", 1);  
           print BOARDFILE @temparray;  
           fclose(BOARDFILE);  
   
           if (time() > $time_to_jump && ($i + 1) < @boards) {  
                 $yySetLocation = qq~$set_cgi?action=cats2;st=~ . int($INFO{'st'} + time() - $time_to_jump + $max_process_time) . qq~;starttime=$time_to_jump;mtotal=~ . @memlist . qq~;bfstart=0;bstart=~ . ($i + 1);  
                 &redirectexit;  
           }  
           $INFO{'bfstart'} = 0;  
     }  
}  
   
# / Board + Category Conversion ##  
   
   
# Message Conversion ##  
   
sub ConvertMessages {  
     require "$boardsdir/forum.master";  
   
     ${$uid.$username}{'timeformat'} = 'SDT, DD MM YYYY HH:mm:ss zzz'; # the .ctb time format  
     ${$uid.$username}{'timeselect'} = 7;  
     my $ctbtime = &timeformat($date,1,"rfc");  
   
     my %stickies;  
     if (open(DATADIR, "$convboardsdir/sticky.stk")) {  
           my @stickies = <DATADIR>;  
           close(DATADIR);  
           chomp(@stickies);  
           foreach (@stickies) { $stickies{$_} = 1; }  
     }  
   
     my @boards = sort(keys %board);  
   
     my $totalbdr = @boards;  
     for (my $next_board = ($INFO{'count'} || 0); $next_board < $totalbdr; $next_board++) {  
           my $boardname = $boards[$next_board];  
   
           fopen(BRDFILE, "$boardsdir/$boardname.txt") || &setup_fatal_error("$maintext_23 $boardsdir/$boardname.txt: ", 1);  
           my @brdmessageline = <BRDFILE>;  
           fclose(BRDFILE);  
   
           my %newreply = ();  
           my $totalmess = @brdmessageline;  
           for (my $tops = ($INFO{'tcount'} || 0); $tops < $totalmess; $tops++) {  
                 ($thread,undef,undef,undef,undef,$replies,undef) = split(/\|/, $brdmessageline[$tops], 7);  
   
                 fopen(MSGFILE, "$convdatadir/$thread.txt") || &setup_fatal_error("$maintext_23 $convdatadir/$thread.txt: ", 1);  
                 @messagelines = <MSGFILE>;  
                 fclose(MSGFILE);  
                 chomp(@messagelines);  
   
                 $INFO{'total_mess'} += @messagelines;  
                 $INFO{'total_threads'}++;  
   
                 @temparray = ();  
                 my ($subject, $name, $email, $mdate, $musername, $icon, $dummy, $user_ip, $message, $ns, $editdate, $editby, $attachment);  
                 foreach $msgline (@messagelines) {  
                       ($subject, $name, $email, $mdate, $musername, $icon, $dummy, $user_ip, $message, $ns, $editdate, $editby, undef, $attachment) = split(/\|/, $msgline);  
                       $name = exists $fixed_users{$name} ? ${$fixed_users{$name}}[1] : $name;  
                       $musername = exists $fixed_users{$musername} ? ${$fixed_users{$musername}}[0] : $musername;  
                       $editby = exists $fixed_users{$editby} ? ${$fixed_users{$editby}}[0] : $editby;  
                       if ($message =~ /\[[qgs]/i) { # too many RegExpr take too much time!!!  
                             $message =~ s~\[quote(\s+author=(.*?)\s+link=(.*?)\s+date=(.*?)\s*)?\](.*?)\[/quote\]~&QuoteFix($2,$3,$4,$5)~eig;  
                             $message =~ s~\[(glow|shadow)=.*?\](.*?)\[/(glow|shadow)\]~\[glb\]$2\[/glb\]~ig;  
                             $message =~ s~\[size=([+-]?\d)\](.*?)\[/size\]~ "\[size=" . &conv_size($1) . "\]$2\[/size\]" ~ige;  
                       }  
                       $message  =~ s~<br>~<br />~ig;  
                       $mdate    =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2}).*~&conv_stringtotime("$1 at $2")~ei;  
                       $editdate =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2}).*~&conv_stringtotime("$1 at $2")~ei;  
                       push(@temparray, "$subject|$name|$email|$mdate|$musername|$icon|$dummy|$user_ip|$message|$ns|$editdate|$editby|$attachment\n");  
                       if ($musername ne "Guest") {  
                             ${$uid.$thread}{$musername}++;  
                             ${$uid.$thread.'time'}{$musername} = $mdate;  
                       }  
                 }  
                 fopen(MSGFILE, ">$datadir/$thread.txt") || &setup_fatal_error("$maintext_23 $datadir/$thread.txt: ", 1);  
                 print MSGFILE @temparray;  
                 fclose(MSGFILE);  
   
                 # do the .ctb  
                 my $views = 1;  
                 if (-e "$convdatadir/$thread.data") {  
                       fopen(DATA, "$convdatadir/$thread.data") || &setup_fatal_error("$maintext_23 $convdatadir/$thread.data: ", 1);  
                       $data = <DATA>;  
                       fclose(DATA);  
                       chomp $data;  
                       ($views, undef) = split(/\|/, $data, 2);  
                 }  
   
                 my $trstate = exists $stickies{$thread} ? "s" : "";  
                 $lastposter = $musername eq "Guest" ? "Guest-$name" : $musername;  
   
                 fopen(CTB, ">$datadir/$thread.ctb") || &setup_fatal_error("$maintext_23 $datadir/$thread.ctb: ", 1);  
                 print CTB qq~### ThreadID: $thread, LastModified: $ctbtime ###\n\n'board',"$boardname"\n'replies',"$#messagelines"\n'views',"$views"\n'lastposter',"$lastposter"\n'lastpostdate',"$mdate"\n'threadstatus',"$trstate"\n'repliers',""\n~;  
                 fclose(CTB);  
   
                 if ($replies != $#messagelines) {  
                       $newreply{$tops} = $#messagelines;  
                 }  
   
                 if (time() > $time_to_jump && ($tops + 1) < $totalmess) {  
                             &writerecentlog(($INFO{'tcount'} || 0),$totalmess,\@brdmessageline);  
   
                             if (%newreply) { # fix reply display  
                                   foreach (keys %newreply) {  
                                         my @temp = split(/\|/, $brdmessageline[$_]);  
                                         $temp[5] = $newreply{$_};  
                                         $brdmessageline[$_] = join('|', @temp);  
                                   }  
   
                                   fopen(BOARDFILE, ">$boardsdir/$boardname.txt") || &setup_fatal_error("$maintext_23 $boardsdir/$boardname.txt: ", 1);  
                                   print BOARDFILE @brdmessageline;  
                                   fclose(BOARDFILE);  
                             }  
   
                             $yySetLocation = qq~$set_cgi?action=messages2;st=~ . int($INFO{'st'} + time() - ($time_to_jump - $max_process_time)) . qq~;starttime=$time_to_jump;count=$next_board;tcount=~ . ($tops + 1) . qq~;total_mess=$INFO{'total_mess'};total_threads=$INFO{'total_threads'};totboard=$totalbdr;totmess=$totalmess~;  
                             &redirectexit;  
                 }  
           }  
   
           &writerecentlog(($INFO{'tcount'} || 0),$totalmess,\@brdmessageline);  
   
           if (%newreply) { # fix reply display  
                 foreach (keys %newreply) {  
                       my @temp = split(/\|/, $brdmessageline[$_]);  
                       $temp[5] = $newreply{$_};  
                       $brdmessageline[$_] = join('|', @temp);  
                 }  
   
                 fopen(BOARDFILE, ">$boardsdir/$boardname.txt") || &setup_fatal_error("$maintext_23 $boardsdir/$boardname.txt: ", 1);  
                 print BOARDFILE @brdmessageline;  
                 fclose(BOARDFILE);  
           }  
   
           if (time() > $time_to_jump && ($next_board + 1) < $totalbdr) {  
                 $yySetLocation = qq~$set_cgi?action=messages2;st=~ . int($INFO{'st'} + time() - ($time_to_jump - $max_process_time)) . qq~;starttime=$time_to_jump;count=~ . ($next_board + 1) . qq~;tcount=0;total_mess=$INFO{'total_mess'};total_threads=$INFO{'total_threads'};totboard=$totalbdr;totmess=0~;  
                 &redirectexit;  
           }  
           $INFO{'tcount'} = 0;  
     }  
}  
   
sub QuoteFix {  
     my ($qauthor, $qlink, $qdate, $qmessage) = @_;  
     if ($qauthor eq "" || $qlink eq "" || $qdate eq "") {  
           "\[quote\]$qmessage\[/quote\]";  
     } else {  
           $qdate = &conv_stringtotime($qdate);  
           (undef, $threadlink, $start) = split(/;/, $qlink);  
           (undef, $num)   = split(/=/, $threadlink);  
           (undef, $start) = split(/=/, $start);  
           "\[quote author=$qauthor link=$num/$start date=$qdate\]$qmessage\[/quote\]";  
     }  
}  
   
sub conv_size {  
     my $size = shift;  
     if    ($size eq '1' || $size eq '-2') { $size = 10; }  
     elsif ($size eq '2' || $size eq '-1') { $size = 13; }  
     elsif ($size eq '3')                  { $size = 16; }  
     elsif ($size eq '4' || $size eq '+1') { $size = 18; }  
     elsif ($size eq '5' || $size eq '+2') { $size = 24; }  
     elsif ($size eq '6' || $size eq '+3') { $size = 32; }  
     elsif ($size eq '7' || $size eq '+4') { $size = 48; }  
     $size;  
}  
   
sub writerecentlog {  
     my ($start,$total,$messageref) = @_;  
   
     for (my $t = $start; $t < $total; $t++) {  
           ($thread, undef) = split(/\|/, ${$messageref}[$t], 2);  
           foreach my $user (keys %{$uid.$thread}) {  
                 fopen(RLOG, ">>$memberdir/$user.rlog") || &setup_fatal_error("$maintext_23 $memberdir/$user.rlog: ", 1);  
                 print RLOG "$thread\t${$uid.$thread}{$user},${$uid.$thread.'time'}{$user}\n";  
                 fclose(RLOG);  
           }  
           undef %{$uid.$thread};  
           undef %{$uid.$thread.'time'};  
     }  
}  
   
# / Message Conversion ##  
   
   
# Date Conversion ##  
   
sub ConvertTimeToString {  
     if ($INFO{'timeconv'} < 1) {  
           opendir(DATADIR, $convdatadir) || &setup_fatal_error("Directory: $convdatadir: ", 1);  
           my @polls = sort( grep { /\.poll$/ } readdir(DATADIR) );  
           closedir(DATADIR);  
   
           my $totalpolls = @polls;  
           for (my $i = ($INFO{'pollfile'} || 0); $i < $totalpolls; $i++) {  
                 $file = $polls[$i];  
                 fopen("POLLFILE", "$convdatadir/$file") || &setup_fatal_error("$maintext_23 $convdatadir/$file: ", 1);  
                 @pollsfile = <POLLFILE>;  
                 fclose("POLLFILE");  
   
                 chomp($pollsfile[0]);  
                 my ($dummy1, $dummy2, $polluname, $dummy4, $dummy5, $pdate, $dummy6, $dummy7, $dummy8, $epdate, $dummy10, $dummy11) = split(/\|/, shift(@pollsfile));  
                 $polluname = exists $fixed_users{$polluname} ? ${$fixed_users{$polluname}}[0] : $polluname;  
                 $pdate  =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~ei;  
                 $epdate =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2}).*~&conv_stringtotime("$1 at $2")~ei;  
   
                 fopen("POLLFILE", ">$datadir/$file") || &setup_fatal_error("$maintext_23 $datadir/$file: ", 1);  
                 print POLLFILE "$dummy1|$dummy2|$polluname|$dummy4|$dummy5|$pdate|$dummy6|$dummy7|$dummy8|$epdate|$dummy10|$dummy11\n", @pollsfile;  
                 fclose("POLLFILE");  
   
                 if (time() > $time_to_jump && ($i + 1) < $totalpolls) {  
                       $yySetLocation = qq~$set_cgi?action=dates2;st=~ . int($INFO{'st'} + time() - $time_to_jump + $max_process_time) . qq~;starttime=$time_to_jump;timeconv=0;totalpolls=$totalpolls;pollfile=~ . ($i + 1);  
                       &redirectexit;  
                 }  
           }  
           $INFO{'totalpolls'} = $totalpolls;  
     }  
   
     if ($INFO{'timeconv'} < 2) {  
           opendir(DATADIR, $convdatadir) || &setup_fatal_error("Directory: $convdatadir: ", 1);  
           my @polled = sort( grep { /\.polled$/ } readdir(DATADIR) );  
           closedir(DATADIR);  
   
           my $totalpolled = @polled;  
           for (my $i = ($INFO{'polledfile'} || 0); $i < $totalpolled; $i++) {  
                 $file = $polled[$i];  
                 fopen("POLLEDFILE", "$convdatadir/$file") || &setup_fatal_error("$maintext_23 $convdatadir/$file: ", 1);  
                 @polledfile = <POLLEDFILE>;  
                 fclose("POLLEDFILE");  
                 chomp(@polledfile);  
   
                 @temparray = ();  
                 foreach $line (@polledfile) {  
                       my ($dummy1, $pollername, $dummy3, $pdate) = split(/\|/, $line);  
                       $pollername = exists $fixed_users{$pollername} ? ${$fixed_users{$pollername}}[0] : $pollername;  
                       $pdate =~ s~(\d{1,2}\/\d{1,2}\/\d{2,4}).*?(\d{1,2}\:\d{1,2}\:\d{1,2})~&conv_stringtotime("$1 at $2")~ei;  
                       push(@temparray, "$dummy1|$pollername|$dummy3|$pdate\n");  
                 }  
                 fopen("POLLEDFILE", ">$datadir/$file") || &setup_fatal_error("$maintext_23 $datadir/$file: ", 1);  
                 print POLLEDFILE @temparray;  
                 fclose("POLLEDFILE");  
   
                 if (time() > $time_to_jump && ($i + 1) < $totalpolled) {  
                       $yySetLocation = qq~$set_cgi?action=dates2;st=~ . int($INFO{'st'} + time() - $time_to_jump + $max_process_time) . qq~;starttime=$time_to_jump;timeconv=1;totalpolls=$INFO{'totalpolls'};totalpolled=$totalpolled;polledfile=~ . ($i + 1);  
                       &redirectexit;  
                 }  
           }  
     }  
}  
   
# / Date Conversion ##  
   
   
# Cleanup ##  
   
sub MyReCountTotals {  
     @boards = sort( keys %board );  
   
     my $totalboards = @boards;  
     for (my $j = ($INFO{'my_re_tot'} || 0); $j < $totalboards; $j++) {  
           my $cntboard = $boards[$j];  
           next unless $cntboard;  
   
           fopen(BOARD, "$boardsdir/$cntboard.txt") || &setup_fatal_error("$maintext_23 $boardsdir/$cntboard.txt: ", 1);  
           my @threads = <BOARD>;  
           fclose(BOARD);  
   
           my $threadcount  = @threads;  
           my $messagecount = $threadcount;  
           if ($threadcount) {  
                 for (my $i = 0; $i < @threads; $i++) {  
                       $messagecount += (split(/\|/, $threads[$i]))[5];  
                 }  
           }  
           &BoardTotals("load", $cntboard);  
           ${ $uid . $cntboard }{'threadcount'}  = $threadcount;  
           ${ $uid . $cntboard }{'messagecount'} = $messagecount;  
           # &BoardTotals("update", ...) is done in &BoardSetLastInfo  
           &BoardSetLastInfo($cntboard,\@threads);  
   
           if (time() > $time_to_jump && ($j + 1) < $totalboards) {  
                 $yySetLocation = qq~$set_cgi?action=cleanup2;st=~ . int($INFO{'st'} + time() - $time_to_jump + $max_process_time) . qq~;starttime=$time_to_jump;clean=1;total_boards=$INFO{'total_boards'};total_re_tot=$totalboards;my_re_tot=~ . ($j + 1);  
                 &redirectexit;  
           }  
     }  
     $INFO{'total_re_tot'} = $totalboards;  
     $INFO{'clean'} = 2;  
}  
   
sub MyMemberIndex {  
     if ($INFO{'memb_index'} > 0) {  
           &ManageMemberlist("load");  
           &ManageMemberinfo("load");  
           $siglength = $INFO{'siglength'};  
     } else {  
           $INFO{'tmp_firstforum'} = $INFO{'firstforum'} = &conv_stringtotime($forumstart);  
           $siglength = 200;  
     }  
   
     opendir(MEMBERS, $memberdir) || &setup_fatal_error("Directory: $memberdir: ", 1);  
     @members = sort( grep { /.\.vars$/ } readdir(MEMBERS) );  
     closedir(MEMBERS);  
   
     $totalmemb = @members;  
     for (my $j = ($INFO{'memb_index'} || 0); $j < $totalmemb; $j++) {  
           $member = $members[$j];  
           $member =~ s/\.vars$//g;  
   
           &LoadUser($member);  
   
           &Recent_Load($member);  
           ${$uid.$member}{'postcount'} = 0;  
           foreach (keys %recent) {  
                 ${$uid.$member}{'postcount'} += ${$recent{$_}}[0];  
           }  
   
           if ($INFO{'firstforum'} > ${$uid.$member}{'regtime'}) { $INFO{'firstforum'} = ${$uid.$member}{'regtime'}; }  
   
           if (length(${$uid.$member}{'signature'}) > $siglength) { $siglength = length(${$uid.$member}{'signature'}); }  
   
           if (${$uid.$member}{'position'}) {  
                 foreach my $key (keys %NoPost) {  
                       ($NoPostname, undef) = split(/\|/, $NoPost{$key}, 2);  
                       if (${$uid.$member}{'position'} eq $NoPostname) { ${$uid.$member}{'position'} = $key; last; }  
                 }  
           }  
           if (!${$uid.$member}{'position'}) { ${$uid.$member}{'position'} = &MyMemberPostGroup(${$uid.$member}{'postcount'}); }  
   
           if (${$uid.$member}{'addgroups'}) {  
                 my $newaddigrp = "";  
                 foreach $addigrp (split(/, ?/, ${$uid.$member}{'addgroups'})) {  
                       foreach my $key (keys %NoPost) {  
                             ($NoPostname, undef) = split(/\|/, $NoPost{$key}, 2);  
                             if ($addigrp eq $NoPostname) { $addigrp = $key; last; }  
                       }  
                       $newaddigrp .= qq~$addigrp,~;  
                 }  
                 $newaddigrp =~ s/,$//;  
                 ${$uid.$member}{'addgroups'} = $newaddigrp;  
           }  
   
           &UserAccount($member, "update");  
   
           $memberlist{$member} = sprintf("%010d", ${$uid.$member}{'regtime'});  
           $memberinf{$member}  = qq~${$uid.$member}{'realname'}|${$uid.$member}{'email'}|${$uid.$member}{'position'}|${$uid.$member}{'postcount'}~;  
   
           if (time() > $time_to_jump && ($j + 1) < $totalmemb) {  
                 &ManageMemberlist("save");  
                 &ManageMemberinfo("save");  
                 $yySetLocation = qq~$set_cgi?action=cleanup2;st=~ . int($INFO{'st'} + time() - $time_to_jump + $max_process_time) . qq~;starttime=$time_to_jump;clean=2;total_boards=$INFO{'total_boards'};total_re_tot=$INFO{'total_re_tot'};tmp_firstforum=$INFO{'tmp_firstforum'};firstforum=$INFO{'firstforum'};siglength=$siglength;total_memb=$totalmemb;memb_index=~ . ($j + 1);  
                 &redirectexit;  
           }  
     }  
     &ManageMemberlist("save");  
     &ManageMemberinfo("save");  
   
     $INFO{'total_memb'} = $totalmemb;  
     $INFO{'clean'} = 3;  
   
     fopen(MEMBERLISTREAD, "$memberdir/memberlist.txt") || &setup_fatal_error("$maintext_23 $memberdir/memberlist.txt: ", 1);  
     my @num = <MEMBERLISTREAD>;  
     fclose(MEMBERLISTREAD);  
     my $membertotal = @num;  
   
     ($latestmember, undef) = split(/\t/, $num[$#num], 2);  
   
     fopen(MEMTTL, ">$memberdir/members.ttl") || &setup_fatal_error("$maintext_23 $memberdir/members.ttl: ", 1);  
     print MEMTTL qq~$membertotal|$latestmember~;  
     fclose(MEMTTL);  
   
     if ($INFO{'tmp_firstforum'} > $INFO{'firstforum'} || $siglength > 200) { &SetInstall2; }  
}  
   
sub MyMemberPostGroup {  
     $userpostcnt = $_[0];  
     $grtitle     = "";  
     foreach $postamount (sort { $b <=> $a } keys %Post) {  
           if ($userpostcnt >= $postamount) {  
                 ($grtitle, undef) = split(/\|/, $Post{$postamount}, 2);  
                 last;  
           }  
     }  
     return $grtitle;  
}  
   
sub MyMailNotify {  
     require "$sourcedir/Notify.pl";  
     &ManageMemberinfo("load");  
   
     opendir(DIRECTORY, $convdatadir) || &setup_fatal_error("Directory: $convdatadir: ", 1);  
     my @files = sort( grep { /\.mail$/ } readdir(DIRECTORY) );  
     closedir(DIRECTORY);  
   
     my $totalfiles = @files;  
     my ($j,$filename,@mailaddresses,$mailaddress,$curuser,$value);  
     for ($j = ($INFO{'my_mail_n'} || 0); $j < $totalfiles; $j++) {  
           $filename = (split(/\./, $files[$j], 2))[0];  
   
           fopen(MAILFILE, "$convdatadir/$filename.mail") || &setup_fatal_error("$maintext_23 $convdatadir/$filename.mail: ", 1);  
           @mailaddresses = <MAILFILE>;  
           fclose(MAILFILE);  
           chomp(@mailaddresses);  
   
           foreach $mailaddress (@mailaddresses) {  
                 while (($curuser, $value) = each(%memberinf)) {  
                       if ($mailaddress eq (split(/\|/, $value, 3))[1]) {  
                             &ManageThreadNotify("add", $filename, $curuser, $language, 1, 1);  
                             undef %{$uid.$curuser} if $curuser ne $username;  
                             last;  
                       }  
                 }  
           }  
   
           if (time() > $time_to_jump && ($j + 1) < $totalfiles) {  
                 $yySetLocation = qq~$set_cgi?action=cleanup2;st=~ . int($INFO{'st'} + time() - $time_to_jump + $max_process_time) . qq~;starttime=$time_to_jump;clean=3;total_boards=$INFO{'total_boards'};total_re_tot=$INFO{'total_re_tot'};total_memb=$INFO{'total_memb'};tmp_firstforum=$INFO{'tmp_firstforum'};firstforum=$INFO{'firstforum'};total_mail_n=$totalfiles;my_mail_n=~ . ($j + 1);  
                 &redirectexit;  
           }  
     }  
   
     $INFO{'total_mail_n'} = $totalfiles;  
     $INFO{'clean'} = 4;  
}  
   
sub FixNopost {  
     if ($NoPost{'1'}) {  
           fopen(FORUMCONTROL, "$boardsdir/forum.control") || &setup_fatal_error("$maintext_23 $boardsdir/forum.control: ", 1);  
           @boardcontrols = <FORUMCONTROL>;  
           fclose(FORUMCONTROL);  
           chomp(@boardcontrols);  
   
           my $totalnoposts = keys %NoPost;  
           for (my $i = ($INFO{'fix_nopost'} || 1); $i <= $totalnoposts; $i++) {  
                 ($grptitle, undef) = split(/\|/, $NoPost{$i}, 2);  
   
                 foreach my $key (keys %catinfo) {  
                       ($catname, $catperms, $catcol) = split(/\|/, $catinfo{$key}, 3);  
                       $newperm = "";  
                       foreach $theperm (split(/, /, $catperms)) {  
                             if ($theperm eq $grptitle) { $theperm = $i; }  
                             $newperm .= qq~$theperm, ~;  
                       }  
                       $newperm =~ s/, $//;  
                       $catinfo{$key} = qq~$catname|$newperm|$catcol~;  
                 }  
                 foreach my $key (keys %board) {  
                       ($boardname, $boardperms, $boardshow) = split(/\|/, $board{$key}, 3);  
                       $newperm = "";  
                       foreach $theperm (split(/, /, $boardperms)) {  
                             if ($theperm eq $grptitle) { $theperm = $i; }  
                             $newperm .= qq~$theperm, ~;  
                       }  
                       $newperm =~ s/, $//;  
                       $board{$key} = qq~$boardname|$newperm|$boardshow~;  
                 }  
                 for ($j = 0; $j < @boardcontrols; $j++) {  
                       ($cntcat, $cntboard, $cntpic, $cntdescription, $cntmods, $cntmodgroups, $cnttopicperms, $cntreplyperms, $cntpollperms, $cntzero, $cntmembergroups, $cntann, $cntrbin, $cntattperms, $cntminageperms, $cntmaxageperms, $cntgenderperms) = split(/\|/, $boardcontrols[$j]);  
   
                       $newmodgroups = "";  
                       foreach my $theperm (split(/, /, $cntmodgroups)) {  
                             if ($theperm eq $grptitle) { $theperm = $i; }  
                             $newmodgroups .= qq~$theperm, ~;  
                       }  
                       $newmodgroups =~ s/, $//;  
   
                       $newtopicperms = "";  
                       foreach my $theperm (split(/, /, $cnttopicperms)) {  
                             if ($theperm eq $grptitle) { $theperm = $i; }  
                             $newtopicperms .= qq~$theperm, ~;  
                       }  
                       $newtopicperms =~ s/, $//;  
   
                       $newreplyperms = "";  
                       foreach my $theperm (split(/, /, $cntreplyperms)) {  
                             if ($theperm eq $grptitle) { $theperm = $i; }  
                             $newreplyperms .= qq~$theperm, ~;  
                       }  
                       $newreplyperms =~ s/, $//;  
   
                       $newpollperms = "";  
                       foreach my $theperm (split(/, /, $cntpollperms)) {  
                             if ($theperm eq $grptitle) { $theperm = $i; }  
                             $newpollperms .= qq~$theperm, ~;  
                       }  
                       $newpollperms =~ s/, $//;  
   
                       $boardcontrols[$j] = qq~$cntcat|$cntboard|$cntpic|$cntdescription|$cntmods|$newmodgroups|$newtopicperms|$newreplyperms|$newpollperms|$cntzero|$cntmembergroups|$cntann|$cntrbin|$cntattperms|$cntminageperms|$cntmaxageperms|$cntgenderperms\n~;  
                 }  
   
                 if (time() > $time_to_jump && ($i + 1) < $totalnoposts) {  
                       &Write_ForumMaster;  
   
                       fopen(FORUMCONTROL, ">$boardsdir/forum.control") || &setup_fatal_error("$maintext_23 $boardsdir/forum.control: ", 1);  
                       print FORUMCONTROL @boardcontrols;  
                       fclose(FORUMCONTROL);  
   
                       $yySetLocation = qq~$set_cgi?action=cleanup2;st=~ . int($INFO{'st'} + time() - $time_to_jump + $max_process_time) . qq~;starttime=$time_to_jump;clean=4;total_boards=$INFO{'total_boards'};total_re_tot=$INFO{'total_re_tot'};total_memb=$INFO{'total_memb'};tmp_firstforum=$INFO{'tmp_firstforum'};firstforum=$INFO{'firstforum'};total_mail_n=$INFO{'total_mail_n'};total_nopost=$totalnoposts;fix_nopost=~ . ($i + 1);  
                       &redirectexit;  
                 }  
           }  
           &Write_ForumMaster;  
   
           fopen(FORUMCONTROL, ">$boardsdir/forum.control") || &setup_fatal_error("$maintext_23 $boardsdir/forum.control: ", 1);  
           print FORUMCONTROL @boardcontrols;  
           fclose(FORUMCONTROL);  
     }  
}  
   
# / Cleanup ##  
   
   
sub format_timestring {  
     $time_string = $_[0];  
   
     if($time_string !~ m~(\d{1,2})\/(\d{1,2})\/(\d{2,4}).*?(\d{1,2})\:(\d{1,2})\:(\d{1,2})~is) {  
           $time_string = "$forumstart";  
     }  
   
     $time_string =~ m~(\d{1,2})\/(\d{1,2})\/(\d{2,4}).*?(\d{1,2})\:(\d{1,2})\:(\d{1,2})~is;  
   
     $dr_month = $1;  
     $dr_day = $2;  
     $dr_year = $3;  
     $dr_hour = $4;  
     $dr_minute = $5;  
     $dr_secund = $6;  
   
     if($dr_month > 12) { $dr_month = 12; }  
     if($dr_month < 1) { $dr_month = 1; }  
     if($dr_day > 31) { $dr_day = 31; }  
     if($dr_day < 1) { $dr_day = 1; }  
     if(length($dr_year) > 2) { $dr_year = substr($dr_year , length($dr_year) - 2, 2); }  
     if($dr_year < 90 && $dr_year > 20) { $dr_year = 90; }  
     if($dr_year > 20 && $dr_year < 90) { $dr_year = 20; }  
     if($dr_hour > 23) { $dr_hour = 23; }  
     if($dr_minute > 59) { $dr_minute = 59; }  
     if($dr_secund > 59) { $dr_secund = 59; }  
   
     if($dr_month == 4 || $dr_month == 6 || $dr_month == 9 || $dr_month == 11) {  
           $max_days = 30;  
     }  
     elsif($dr_month == 2 && $dr_year % 4 == 0) {  
           $max_days = 29;  
     }  
     elsif($dr_month == 2 && $dr_year % 4 != 0) {  
           $max_days = 28;  
     }  
     else {  
           $max_days = 31;  
     }  
     if($dr_day > $max_days) { $dr_day = $max_days; }  
   
     $dr_month = sprintf("%02d", $dr_month);  
     $dr_day = sprintf("%02d", $dr_day);  
     $dr_year = sprintf("%02d", $dr_year);  
     $dr_hour = sprintf("%02d", $dr_hour);  
     $dr_minute = sprintf("%02d", $dr_minute);  
     $dr_secund = sprintf("%02d", $dr_secund);  
     qq~$dr_month/$dr_day/$dr_year $maintxt{'107'} $dr_hour:$dr_minute:$dr_secund~;  
}  
   
sub conv_stringtotime {  
     unless ($_[0]) { return 0; }  
     $splitvar = $_[0];  
     $splitvar =~ m~(\d{1,2})\/(\d{1,2})\/(\d{2,4}).*?(\d{1,2})\:(\d{1,2})\:(\d{1,2})~;  
     $amonth = int($1) || 1;  
     $aday   = int($2) || 1;  
     $ayear  = int($3) || 0;  
     $ahour  = int($4) || 0;  
     $amin   = int($5) || 0;  
     $asec   = int($6) || 0;  
   
     if    ($ayear >= 36 && $ayear <= 99) { $ayear += 1900; }  
     elsif ($ayear >= 00 && $ayear <= 35) { $ayear += 2000; }  
     if    ($ayear < 1904) { $ayear = 1904; }  
     elsif ($ayear > 2036) { $ayear = 2036; }  
   
     if    ($amonth < 1)  { $amonth = 0; }  
     elsif ($amonth > 12) { $amonth = 11; }  
     else { --$amonth; }  
   
     if($amonth == 3 || $amonth == 5 || $amonth == 8 || $amonth == 10) { $max_days = 30; }  
     elsif($amonth == 1 && $ayear % 4 == 0) { $max_days = 29; }  
     elsif($amonth == 1 && $ayear % 4 != 0) { $max_days = 28; }  
     else { $max_days = 31; }  
     if($aday > $max_days) { $aday = $max_days; }  
   
     if    ($ahour < 1)  { $ahour = 0; }  
     elsif ($ahour > 23) { $ahour = 23; }  
     if    ($amin < 1)   { $amin  = 0; }  
     elsif ($amin > 59)  { $amin  = 59; }  
     if    ($asec < 1)   { $asec  = 0; }  
     elsif ($asec > 59)  { $asec  = 59; }  
   
     timelocal($asec, $amin, $ahour, $aday, $amonth, $ayear);  
}  
   
   
############################################# #############################################
# Setup starts here                         # # Setup starts here                         #
############################################# #############################################
   
if (!$action) { if ( !$action ) {
     $rand_integer   = int(rand(99999));     $rand_integer   = int rand 99_999; 
     $rand_cook_user = "Y2User-$rand_integer";    $rand_cook_user = "Y2User-$rand_integer";
     $rand_cook_pass = "Y2Pass-$rand_integer";    $rand_cook_pass = "Y2Pass-$rand_integer";
     $rand_cook_sess = "Y2Sess-$rand_integer";    $rand_cook_sess = "Y2Sess-$rand_integer";
     $rand_cook_sort = "Y2tsort-$rand_integer";
     fopen(COOKFILE, ">$vardir/cook.txt") || &setup_fatal_error("$maintext_23 $vardir/cook.txt: ", 1);     $rand_cook_view = "Y2view-$rand_integer"; 
     print COOKFILE "$rand_cook_user\n";  
     print COOKFILE "$rand_cook_pass\n";     my $cookfile = 
     print COOKFILE "$rand_cook_sess\n";  qq~$rand_cook_user\n$rand_cook_pass\n$rand_cook_sess\n$rand_cook_sort\n$rand_cook_view\n~; 
     fclose(COOKFILE);     open $COOKFILE, '>', "$vardir/cook.txt" 
       || setup_fatal_error( "$maintext_23 $vardir/cook.txt: ", 1 );
     &adminlogin;     print {$COOKFILE} $cookfile or croak 'cannot print cook.txt'; 
}     close $COOKFILE or croak 'cannot close cook.txt'; 
   
fopen(COOKFILE, "$vardir/cook.txt") || &setup_fatal_error("$maintext_23 $vardir/cook.txt: ", 1);     adminlogin(); 
@cookinfo = <COOKFILE>;  } 
fclose(COOKFILE);  
  open $COOKFILE, '<', "$vardir/cook.txt" 
   || setup_fatal_error( "$maintext_23 $vardir/cook.txt: ", 1 );
  @cookinfo = <$COOKFILE>;
  close $COOKFILE or croak 'cannot close cook.txt';
chomp @cookinfo; chomp @cookinfo;
   
$cookieusername = "$cookinfo[0]"; $cookieusername     = "$cookinfo[0]";
$cookiepassword = "$cookinfo[1]"; $cookiepassword     = "$cookinfo[1]";
$cookiesession_name = "$cookinfo[2]"; $cookiesession_name = "$cookinfo[2]";
  $cookietsort        = "$cookinfo[3]";
  $cookieview         = "$cookinfo[4]";
  if    ( $action eq 'adminlogin2' ) { adminlogin2(); }
  elsif ( $action eq 'setup1' )      { autoconfig(); }
  elsif ( $action eq 'setup2' ) {
     BrdInstall();
     MemInstall();
     MesInstall();
     VarInstall();
     save_paths();
  }
  elsif ( $action eq 'checkmodules' ) { SetInstall2(); checkmodules(); }
  elsif ( $action eq 'setinstall' )   { SetInstall(); }
  elsif ( $action eq 'setinstall2' )  { SetInstall2(); }
  elsif ( $action eq 'setup3' )       { CheckInstall(); }
  elsif ( $action eq 'ready' )        { ready(); }
   
if    ($action eq "adminlogin2") { &adminlogin2; }  $yymain = qq~End of script reached without action: $action~; 
elsif ($action eq "setup1")      { &autoconfig; }  SimpleOutput(); 
elsif ($action eq "setup2")      {  
     &BrdInstall;  
     &MemInstall;  
     &MesInstall;  
     &VarInstall;  
     &save_paths;  
}  
elsif ($action eq "checkmodules") { &SetInstall2; &checkmodules; }  
elsif ($action eq "setinstall")   { &SetInstall; }  
elsif ($action eq "setinstall2")  { &SetInstall2; }  
elsif ($action eq "setup3")       { &CheckInstall; }  
elsif ($action eq "ready")        { &ready; }  
   
$yymain = "End of script reached without action: $action";  
&SimpleOutput;  
   
   
############################################# #############################################
# setup subroutines start here              # # setup subroutines start here              #
############################################# #############################################
   
sub adminlogin { sub adminlogin {
     $yymain .= qq~     open $LICENSE, '<', 'license.txt' or croak 'cannot load License.'; 
     <br /><br /><br /><form action="$set_cgi?action=adminlogin2" method="post" name="loginform"><center>     my $license = do { local $/; <$LICENSE>; }; 
     <table width="20%" border="0" bgcolor= "#000000" cellspacing="1" cellpadding="0">     close $LICENSE or croak 'cannot close License'; 
     <tr><td>  
     <table width="100%" border="0" bgcolor= "$windowbg" cellspacing="1" cellpadding="3">     $yymain .= qq~ 
     <tr>     <div id="license" style="width:50em; height:40em; overflow:auto; margin:2em auto 0 auto; border:thin #000 solid; padding:1em; background-color:#fff">$license</div> 
           <td width="100%" align="center">     <form action="$set_cgi?action=adminlogin2" method="post" name="loginform"> 
           <label for="password"><span style="font-family: Arial; font-size: 13px; color: #000000;">     <div style="width:25em; border: thin #000 solid; margin:2em auto; padding:1em; text-align:center; background-color:#fff"> 
           Enter the password for user <b>admin</b><br />to gain access to the Setup Utility         <label for="password">Enter the password for user <b>admin</b> to acknowledge acceptance of the above license and to gain access to the Setup Utility</label> 
           </span></label>         <p><input type="password" name="password" id="password" size="30" /> 
           </td>          <input type="hidden" name="username" value="admin" /> 
     </tr>          <input type="hidden" name="cookielength" value="1500" /></p> 
     <tr>         <p><input type="submit" value="Submit" /></p> 
           <td width="100%" align="center">     </div> 
           <span style="font-family: Arial; font-size: 13px; color: #000000;">     </form> 
           <input type="password" name="password" id="password" size="30" />     <script type="text/javascript"> 
           <input type="hidden" name="username" value="admin" />         document.loginform.password.focus(); 
           <input type="hidden" name="cookielength" value="1500" />     </script> 
           </span>  
           </td>  
     </tr>  
     <tr>  
           <td width="100%" align="center">  
           <span style="font-family: Arial; font-size: 13px; color: #000000;">  
           <input type="submit" value="Submit" />  
           </span>  
           </td>  
     </tr>  
     </table>  
     </td></tr>  
     </table>  
     </center></form>  
     <script language="JavaScript1.2" type="text/javascript">  
           <!--  
                 document.loginform.password.focus();  
           //-->  
     </script>  
     ~;      ~;
   
     &SimpleOutput;     return SimpleOutput(); 
} }
   
sub adminlogin2 { sub adminlogin2 {
     if ($FORM{'password'} eq "") { &setup_fatal_error("Setup Error: You should fill in your password!"); }     if ( $FORM{'password'} eq q{} ) { 
         setup_fatal_error('Setup Error: You should fill in your password!');
     # No need to pass a form variable setup is only used by user: admin     } 
     $username = "admin";  
     # No need to pass a form variable setup is only used by user: admin
     if (-e "$memberdir/$username.vars") {     $username = 'admin'; 
           $Group{'Administrator'} = "YaBB Administrator|5|staradmin.gif|red|0|0|0|0|0|0";  
           &LoadUser($username);     if ( -e "$memberdir/$username.vars" ) { 
           my $spass = ${$uid.$username}{'password'};         $Group{'Administrator'} = 
           $cryptpass = &encode_password($FORM{'password'});           'Forum Administrator|5|staradmin.png|red|0|0|0|0|0|0'; 
           if ($spass ne $cryptpass && $spass ne $FORM{'password'}) {  &setup_fatal_error("Setup Error: Login Failed!"); }         LoadUser($username); 
     } else {         my $spass = ${ $uid . $username }{'password'}; 
           &setup_fatal_error("Setup Error: Could not find the admin data file in $memberdir! Please check your access rights.");         $cryptpass = encode_password( $FORM{'password'} ); 
     }         if ( $spass ne $cryptpass && $spass ne $FORM{'password'} ) { 
             setup_fatal_error('Setup Error: Login Failed!');
     if ($FORM{'cookielength'} < 1 || $FORM{'cookielength'} > 9999) { $FORM{'cookielength'} = $Cookie_Length; }        }
     if (!$FORM{'cookieneverexp'}) { $ck{'len'} = "\+$FORM{'cookielength'}m"; }    }
     else { $ck{'len'} = 'Sunday, 17-Jan-2038 00:00:00 GMT'; }     else { 
     $password = &encode_password("$FORM{'password'}");         setup_fatal_error( 
     ${$uid.$username}{'session'} = &encode_password($user_ip);  qq~Setup Error: Could not find the admin data file in $memberdir. Please check your access rights.~ 
     chomp ${$uid.$username}{'session'};         ); 
     }
     # check if forum.control can be open (needed in &LoadBoardControl used by &LoadUserSettings)  
     fopen(FORUMCONTROL, "$boardsdir/forum.control") || &setup_fatal_error("$maintext_23 $boardsdir/forum.control: ", 1);     if ( $FORM{'cookielength'} < 1 || $FORM{'cookielength'} > 9999 ) { 
     fclose(FORUMCONTROL);         $FORM{'cookielength'} = $Cookie_Length; 
     }
     &UpdateCookie("write", "$username", "$password", "${$uid.$username}{'session'}", "/", "$ck{'len'}");     if ( !$FORM{'cookieneverexp'} ) { $ck{'len'} = "\+$FORM{'cookielength'}m"; } 
     &LoadUserSettings;     else { $ck{'len'} = 'Sunday, 17-Jan-2038 00:00:00 GMT'; } 
     $yymain .= qq~     $password = encode_password("$FORM{'password'}"); 
     <br /><br /><br /><form action="$set_cgi?action=setup1" method="post"><center>     ${ $uid . $username }{'session'} = encode_password($user_ip); 
     <table width="50%" border="0" bgcolor= "#000000" cellspacing="1" cellpadding="0">     chomp ${ $uid . $username }{'session'}; 
     <tr><td>  
     <table width="100%" border="0" bgcolor= "$windowbg" cellspacing="1" cellpadding="3">  # check if forum.control can be open (needed in &LoadBoardControl used by &LoadUserSettings) 
     <tr>     open $FORUMCONTROL, '<', "$boardsdir/forum.control" 
           <td width="100%" align="center">       || setup_fatal_error( "$maintext_23 $boardsdir/forum.control: ", 1 ); 
           <span style="font-family: Arial; font-size: 13px; color: #000000;">     close $FORUMCONTROL or croak 'cannot close forum.control'; 
           You are now logged in, <i>${$uid.$username}{'realname'}</i>!<br />Click Continue to proceed with the Setup.  
           </span>     UpdateCookie( 
           </td>         'write',     "$username", 
     </tr>         "$password", "${$uid.$username}{'session'}", 
     <tr>         q{/},        "$ck{'len'}" 
           <td width="100%" align="center">     ); 
           <span style="font-family: Arial; font-size: 13px; color: #000000;">     LoadUserSettings(); 
           <input type="submit" value="Continue Set Up" />     $yymain .= qq~ 
           </span>     <form action="$set_cgi?action=setup1" method="post"> 
           </td>     <div style="width:50em; border: thin #000 solid; margin:2em auto; padding:1em; text-align:center; background-color:#fff"> 
     </tr>         You are now logged in, <i>${$uid.$username}{'realname'}</i>.<br />Click 'Continue Set Up' to proceed with the Setup. 
     </table>         <p><input type="submit" value="Continue Set Up" /></p> 
     </td></tr></table></center></form>     </div> 
     ~;     </form> 
  ~;
   
     &SimpleOutput;     return SimpleOutput(); 
} }
   
sub autoconfig { sub autoconfig {
     &LoadCookie; # Load the user's cookie (or set to guest)    LoadCookie();    # Load the user's cookie (or set to guest)
     &LoadUserSettings;     LoadUserSettings(); 
     if (!$iamadmin) { &setup_fatal_error(qq~Setup Error: You have no access rights to this function. Only user "admin" has if logged in!~); }     if ( !$iamadmin ) { 
     # do some fancy auto sensing         setup_fatal_error( 
     $template   = "default";  q~Setup Error: You have no access rights to this function. Only user "admin" has this right, if logged in.~ 
     #$forumstyle = "Forum";         ); 
     #$adminstyle = "Admin";     } 
     $yabbfiles  = "yabbfiles";  
     # do some fancy auto sensing
     # find the script url     $template = 'default'; 
     # Getting the last known url one way or another  
     if ($ENV{HTTP_REFERER}) {     $yabbfiles = 'yabbfiles'; 
           $tempboardurl = $ENV{HTTP_REFERER};  
     } elsif ($ENV{HTTP_HOST} && $ENV{REQUEST_URI}) {     # find the script url 
           $tempboardurl = qq~http://$ENV{HTTP_HOST}$ENV{REQUEST_URI}~;     # Getting the last known url one way or another 
     }     if ( $ENV{HTTP_REFERER} ) { 
     $lastslash = rindex($tempboardurl, "/");         $tempboardurl = $ENV{HTTP_REFERER}; 
     $foundboardurl = substr($tempboardurl, 0, $lastslash);     } 
     elsif ( $ENV{HTTP_HOST} && $ENV{REQUEST_URI} ) {
     ## find the webroot ##         $tempboardurl = qq~http://$ENV{HTTP_HOST}$ENV{REQUEST_URI}~; 
     if ($ENV{'SERVER_SOFTWARE'} =~ /IIS/) {     } 
           $this_script = "$ENV{'SCRIPT_NAME'}";     $lastslash = rindex $tempboardurl, q{/}; 
           $_ = $0;     $foundboardurl = substr $tempboardurl, 0, $lastslash; 
           s~\\~/~g;  
           s~$this_script~~;     ## find the webroot ## 
           $searchroot = $_ . '/';     if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/sm ) { 
     } else {         $this_script = "$ENV{'SCRIPT_NAME'}"; 
           $searchroot = $ENV{'DOCUMENT_ROOT'};         $_           = $PROGRAM_NAME; 
           s~\\~/~g;         s/\\/\//gxsm; 
     }         s/$this_script//xsm; 
     $firstslash = index($tempboardurl, "/", 8);         $searchroot = $_ . q{/}; 
     $html_baseurl = substr($tempboardurl, 0, $firstslash);     } 
     else {
     # try to find the yabb html basedir directly         $searchroot = $ENV{'DOCUMENT_ROOT'}; 
     if (-d "$searchroot/$yabbfiles") {         s/\\/\//gxsm; 
           $fnd_html_root = "$html_baseurl/$yabbfiles";     } 
           $fnd_htmldir = "$searchroot/$yabbfiles";     $firstslash = index $tempboardurl, q{/}, 8; 
           $fnd_htmldir =~ s~//~/~g;     $html_baseurl = substr $tempboardurl, 0, $firstslash; 
           opendir(HTMLDIR, $fnd_htmldir);  
           @contents = readdir(HTMLDIR);     # try to find the yabb html basedir directly 
           closedir(HTMLDIR);     if ( -d "$searchroot/$yabbfiles" ) { 
           foreach $name (@contents) {         $fnd_html_root = "$html_baseurl/$yabbfiles"; 
                 if (lc($name) eq "avatars" && -d "$fnd_htmldir/$name") {         $fnd_htmldir   = "$searchroot/$yabbfiles"; 
                       $fnd_facesdir = "$fnd_htmldir/$name";         $fnd_htmldir =~ s/\/\//\//gxsm; 
                       $fnd_facesurl = "$fnd_html_root/$name"; }         opendir HTMLDIR, $fnd_htmldir; 
                 #if (lc($name) eq "modimages" && -d "$fnd_htmldir/$name") {         @contents = readdir HTMLDIR; 
                 #     $fnd_modimgdir = "$fnd_htmldir/$name";         closedir HTMLDIR; 
                 #     $fnd_modimgurl = "$fnd_html_root/$name"; }         foreach my $name (@contents) { 
                 #if (lc($name) eq "templates" && -d "$fnd_htmldir/$name/$forumstyle") {            if ( lc($name) eq 'avatars' && -d "$fnd_htmldir/$name" ) {
                 #     $fnd_forumstylesdir = "$fnd_htmldir/$name/$forumstyle";                 $fnd_facesdir = "$fnd_htmldir/$name"; 
                 #     $fnd_forumstylesurl = "$fnd_html_root/$name/$forumstyle"; }                 $fnd_facesurl = "$fnd_html_root/$name"; 
                 #if (lc($name) eq "templates" && -d "$fnd_htmldir/$name/$adminstyle") {             } 
                 #$fnd_adminstylesdir = "$fnd_htmldir/$name/$adminstyle";  
                 #     $fnd_adminstylesurl = "$fnd_html_root/$name/$adminstyle"; }             if ( lc($name) eq 'attachments' && -d "$fnd_htmldir/$name" ) { 
                 #if (lc($name) eq "smilies" && -d "$fnd_htmldir/$name") {                 $fnd_uploaddir = "$fnd_htmldir/$name"; 
                 #     $fnd_smiliesdir = "$fnd_htmldir/$name";                 $fnd_uploadurl = "$fnd_html_root/$name"; 
                 #     $fnd_smiliesurl = "$fnd_html_root/$name"; }            }
                 if (lc($name) eq "attachments" && -d "$fnd_htmldir/$name") {  
                       $fnd_uploaddir = "$fnd_htmldir/$name";             if ( lc($name) eq 'pmattachments' && -d "$fnd_htmldir/$name" ) { 
                       $fnd_uploadurl = "$fnd_html_root/$name"; }                 $fnd_pmuploaddir = "$fnd_htmldir/$name"; 
                 #if (-d "$fnd_forumstylesdir/$template") { $fnd_imagesdir   = "$fnd_forumstylesurl/$template"; }                 $fnd_pmuploadurl = "$fnd_html_root/$name"; 
           }            }
     } else {            if ( lc($name) eq 'modimages' && -d "$fnd_htmldir/$name" ) {
           opendir(HTMLDIR, $searchroot);                 $fnd_modimgdir = "$fnd_htmldir/$name"; 
           @contents = readdir(HTMLDIR);                 $fnd_modimgurl = "$fnd_html_root/$name"; 
           closedir(HTMLDIR);             } 
           foreach $name (@contents) {         } 
                 if (-d "$searchroot/$name") {     } 
                       opendir(HTMLDIR, "$searchroot/$name");     else { 
                       @subcontents = readdir(HTMLDIR);         opendir HTMLDIR, $searchroot; 
                       closedir(HTMLDIR);         @contents = readdir HTMLDIR; 
                       foreach $subname (@subcontents) {         closedir HTMLDIR; 
                             if (lc($subname) eq lc($yabbfiles) && (-d "$searchroot/$name/$subname")) {        foreach my $name (@contents) {
                                   $fnd_htmldir = "$searchroot/$name/$subname";             if ( -d "$searchroot/$name" ) { 
                                   $fnd_htmldir =~ s~//~/~g;                 opendir HTMLDIR, "$searchroot/$name"; 
                                   $fnd_html_root = "$html_baseurl/$name/$subname";                 @subcontents = readdir HTMLDIR; 
                             }                 closedir HTMLDIR; 
                       }                 foreach my $subname (@subcontents) { 
                 }                     if ( lc($subname) eq lc($yabbfiles) 
           }                         && ( -d "$searchroot/$name/$subname" ) ) 
           opendir(HTMLDIR, $fnd_htmldir);                     { 
           @tcontents = readdir(HTMLDIR);                         $fnd_htmldir = "$searchroot/$name/$subname"; 
           closedir(HTMLDIR);                         $fnd_htmldir =~ s/\/\//\//gxsm; 
           foreach $tname (@tcontents) {                         $fnd_html_root = "$html_baseurl/$name/$subname"; 
                 if (lc($tname) eq "avatars" && -d "$fnd_htmldir/$tname") {                     } 
                       $fnd_facesdir = "$fnd_htmldir/$tname";                 } 
                       $fnd_facesurl = "$fnd_html_root/$tname"; }            }
                 #if (lc($tname) eq "modimages"   && -d "$fnd_htmldir/$tname") {         } 
                 #     $fnd_modimgdir = "$fnd_htmldir/$tname";         opendir HTMLDIR, $fnd_htmldir; 
                 #     $fnd_modimgurl = "$fnd_html_root/$tname"; }         @tcontents = readdir HTMLDIR; 
                 #if (lc($tname) eq "templates"   && -d "$fnd_htmldir/$tname/$forumstyle") {         closedir HTMLDIR; 
                 #     $fnd_forumstylesdir = "$fnd_htmldir/$tname/$forumstyle";         for my $tname (@tcontents) { 
                 #     $fnd_forumstylesurl = "$fnd_html_root/$tname/$forumstyle"; }             if ( lc($tname) eq 'avatars' && -d "$fnd_htmldir/$tname" ) { 
                 #if (lc($tname) eq "templates"   && -d "$fnd_htmldir/$tname/$adminstyle") {                 $fnd_facesdir = "$fnd_htmldir/$tname"; 
                 #     $fnd_adminstylesdir = "$fnd_htmldir/$tname/$adminstyle";                 $fnd_facesurl = "$fnd_html_root/$tname"; 
                 #     $fnd_adminstylesurl = "$fnd_html_root/$tname/$adminstyle"; }            }
                 #if (lc($tname) eq "smilies" && -d "$fnd_htmldir/$tname") {  
                 #     $fnd_smiliesdir = "$fnd_htmldir/$tname";             if ( lc($tname) eq 'attachments' && -d "$fnd_htmldir/$tname" ) { 
                 #     $fnd_smiliesurl = "$fnd_html_root/$tname"; }                 $fnd_uploaddir = "$fnd_htmldir/$tname"; 
                 if (lc($tname) eq "attachments" && -d "$fnd_htmldir/$tname") {                 $fnd_uploadurl = "$fnd_html_root/$tname"; 
                       $fnd_uploaddir = "$fnd_htmldir/$tname";             } 
                       $fnd_uploadurl = "$fnd_html_root/$tname"; }             if ( lc($tname) eq 'pmattachments' && -d "$fnd_htmldir/$tname" ) { 
                 #if (-d "$fnd_forumstylesdir/$template") { $fnd_imagesdir   = "$fnd_forumstylesurl/$template"; }                 $fnd_pmuploaddir = "$fnd_htmldir/$tname"; 
           }                 $fnd_pmuploadurl = "$fnd_html_root/$tname"; 
     }            }
     $fnd_boardurl = $foundboardurl;             if ( lc($tname) eq 'modimages' && -d "$fnd_htmldir/$tname" ) { 
     $fnd_boarddir = ".";                 $fnd_modimgdir = "$fnd_htmldir/$tname"; 
     if (-d "$fnd_boarddir/Boards")    { $fnd_boardsdir    = "$fnd_boarddir/Boards"; }                 $fnd_modimgurl = "$fnd_html_root/$tname"; 
     if (-d "$fnd_boarddir/Messages")  { $fnd_datadir      = "$fnd_boarddir/Messages"; }            }
     if (-d "$fnd_boarddir/Members")   { $fnd_memberdir    = "$fnd_boarddir/Members"; }        }
     if (-d "$fnd_boarddir/Sources")   { $fnd_sourcedir    = "$fnd_boarddir/Sources"; }    }
     if (-d "$fnd_boarddir/Admin")     { $fnd_admindir     = "$fnd_boarddir/Admin"; }     $fnd_boardurl = $foundboardurl; 
     if (-d "$fnd_boarddir/Variables") { $fnd_vardir       = "$fnd_boarddir/Variables"; }     $fnd_boarddir = q{.}; 
     if (-d "$fnd_boarddir/Languages") { $fnd_langdir      = "$fnd_boarddir/Languages"; }     if ( -d "$fnd_boarddir/Boards" ) { 
     if (-d "$fnd_boarddir/Help")      { $fnd_helpfile     = "$fnd_boarddir/Help"; }         $fnd_boardsdir = "$fnd_boarddir/Boards"; 
     if (-d "$fnd_boarddir/Templates") { $fnd_templatesdir = "$fnd_boarddir/Templates"; }    }
     if ( -d "$fnd_boarddir/Messages" ) {
     unless ($lastsaved) {         $fnd_datadir = "$fnd_boarddir/Messages"; 
           $boardurl       = $fnd_boardurl;     } 
           $boarddir       = $fnd_boarddir;     if ( -d "$fnd_boarddir/Members" ) { 
           $htmldir        = $fnd_htmldir;         $fnd_memberdir = "$fnd_boarddir/Members"; 
           $uploaddir      = $fnd_uploaddir;     } 
           $uploadurl      = $fnd_uploadurl;     if ( -d "$fnd_boarddir/Sources" ) { 
           $yyhtml_root    = $fnd_html_root;         $fnd_sourcedir = "$fnd_boarddir/Sources"; 
           $datadir        = $fnd_datadir;     } 
           $boardsdir      = $fnd_boardsdir;     if ( -d "$fnd_boarddir/Admin" ) { $fnd_admindir = "$fnd_boarddir/Admin"; } 
           $memberdir      = $fnd_memberdir;     if ( -d "$fnd_boarddir/Variables" ) { 
           $sourcedir      = $fnd_sourcedir;         $fnd_vardir = "$fnd_boarddir/Variables"; 
           $admindir       = $fnd_admindir;     } 
           $vardir         = $fnd_vardir;     if ( -d "$fnd_boarddir/Languages" ) { 
           $langdir        = $fnd_langdir;         $fnd_langdir = "$fnd_boarddir/Languages"; 
           $helpfile       = $fnd_helpfile;     } 
           $templatesdir   = $fnd_templatesdir;     if ( -d "$fnd_boarddir/Help" ) { $fnd_helpfile = "$fnd_boarddir/Help"; } 
           #$forumstylesdir = $fnd_forumstylesdir;     if ( -d "$fnd_boarddir/Templates" ) { 
           #$forumstylesurl = $fnd_forumstylesurl;         $fnd_templatesdir = "$fnd_boarddir/Templates"; 
           #$adminstylesdir = $fnd_adminstylesdir;     } 
           #$adminstylesurl = $fnd_adminstylesurl;  
           $facesdir       = $fnd_facesdir;     if ( !$lastsaved ) { 
           $facesurl       = $fnd_facesurl;         $boardurl     = $fnd_boardurl; 
           #$smiliesdir     = $fnd_smiliesdir;         $boarddir     = $fnd_boarddir; 
           #$smiliesurl     = $fnd_smiliesurl;         $htmldir      = $fnd_htmldir; 
           #$modimgdir      = $fnd_modimgdir;         $uploaddir    = $fnd_uploaddir; 
           #$modimgurl      = $fnd_modimgurl;         $uploadurl    = $fnd_uploadurl; 
     }         $pmuploaddir  = $fnd_pmuploaddir; 
         $pmuploadurl  = $fnd_pmuploadurl;
     # Simple output of env variables, for troubleshooting         $yyhtml_root  = $fnd_html_root; 
     if    ($ENV{'SCRIPT_FILENAME'} ne "") { $support_env_path = $ENV{'SCRIPT_FILENAME'}; }         $datadir      = $fnd_datadir; 
     elsif ($ENV{'PATH_TRANSLATED'} ne "") { $support_env_path = $ENV{'PATH_TRANSLATED'}; }         $boardsdir    = $fnd_boardsdir; 
         $memberdir    = $fnd_memberdir;
     # Remove Setupl.pl and cgi - and also nph- for buggy IIS.         $sourcedir    = $fnd_sourcedir; 
     $support_env_path =~ s~(nph-)?Setup.(pl|cgi)~~ig;         $admindir     = $fnd_admindir; 
     $support_env_path =~ s~\/\Z~~;         $vardir       = $fnd_vardir; 
         $langdir      = $fnd_langdir;
     # replace \'s with /'s for Windows Servers         $helpfile     = $fnd_helpfile; 
     $support_env_path =~ s~\\~/~g;         $templatesdir = $fnd_templatesdir; 
   
         $facesdir  = $fnd_facesdir;
     # Generate Screen         $facesurl  = $fnd_facesurl; 
     if (-e "$langdir/$language/Main.lng") {         $modimgdir = $fnd_modimgdir; 
           require "$langdir/$use_lang/Main.lng";         $modimgurl = $fnd_modimgurl; 
     } elsif (-e "$langdir/$lang/Main.lng") {     } 
           require "$langdir/$lang/Main.lng";  
     } elsif (-e "$langdir/English/Main.lng") {     # Simple output of env variables, for troubleshooting 
           require "$langdir/English/Main.lng";     if ( $ENV{'SCRIPT_FILENAME'} ne q{} ) { 
     }         $support_env_path = $ENV{'SCRIPT_FILENAME'}; 
     }
     elsif ( $ENV{'PATH_TRANSLATED'} ne q{} ) {
         $support_env_path = $ENV{'PATH_TRANSLATED'};
     }
   
     # Remove Setup.pl and cgi - and also nph- for buggy IIS.
     $support_env_path =~ s/(nph-)?Setup.(pl|cgi)//igsm;
     $support_env_path =~ s/\/\Z//xsm;
   
     # replace \ with / for Windows Servers
     $support_env_path =~ s/\\/\//gxsm;
   
     # Generate Screen
     if ( -e "$langdir/$language/Main.lng" ) {
         require "$langdir/$use_lang/Main.lng";
     }
     elsif ( -e "$langdir/$lang/Main.lng" ) {
         require "$langdir/$lang/Main.lng";
     }
     elsif ( -e "$langdir/English/Main.lng" ) {
         require "$langdir/English/Main.lng";
     }
   
     $mylastdate = &timeformat($lastdate);     $mylastdate = timeformat($lastdate); 
   
     $yymain .= qq~    $yymain .= qq~
<form action="$set_cgi?action=setup2" method="post" name="auto_settings" style="display: inline;"> <form action="$set_cgi?action=setup2" method="post" name="auto_settings" style="display: inline;">
<script language="JavaScript1.2" type="text/javascript"> <script type="text/javascript">
<!--  
function abspathfill(brddir) { function abspathfill(brddir) {
     document.auto_settings.preboarddir.value = brddir;      document.auto_settings.preboarddir.value = brddir;
} }
function autofill() { function autofill() {
     var boardurl = document.auto_settings.preboardurl.value || "$boardurl";      var boardurl = document.auto_settings.preboardurl.value || "$boardurl";
     var boarddir = document.auto_settings.preboarddir.value || ".";      var boarddir = document.auto_settings.preboarddir.value || ".";
     var htmldir = document.auto_settings.prehtmldir.value || "";      var htmldir = document.auto_settings.prehtmldir.value || "";
     var htmlurl = document.auto_settings.prehtml_root.value || "";      var htmlurl = document.auto_settings.prehtml_root.value || "";
     if(!htmldir) {return 0;}      if(!htmldir) {return 0;}
     if(!htmlurl) {return 0;}      if(!htmlurl) {return 0;}
     var confirmvalue = confirm("Do autofill the forms in the right colum below (Saved:) with the basic values in here?");      var confirmvalue = confirm("Do autofill the forms in the right column below (Saved:) with the basic values in here?");
     if(!confirmvalue) {return 0;}      if(!confirmvalue) {return 0;}
     else {      else {
           // Board URL            // Board URL
           document.auto_settings.boardurl.value = boardurl;            document.auto_settings.boardurl.value = boardurl;
   
           // cgi Directories            // cgi Directories
           document.auto_settings.boarddir.value = boarddir;            document.auto_settings.boarddir.value = boarddir;
           document.auto_settings.boardsdir.value = boarddir + "/Boards";            document.auto_settings.boardsdir.value = boarddir + "/Boards";
           document.auto_settings.datadir.value = boarddir + "/Messages";            document.auto_settings.datadir.value = boarddir + "/Messages";
           document.auto_settings.vardir.value = boarddir + "/Variables";            document.auto_settings.vardir.value = boarddir + "/Variables";
           document.auto_settings.memberdir.value = boarddir + "/Members";            document.auto_settings.memberdir.value = boarddir + "/Members";
           document.auto_settings.sourcedir.value = boarddir + "/Sources";            document.auto_settings.sourcedir.value = boarddir + "/Sources";
           document.auto_settings.admindir.value = boarddir + "/Admin";            document.auto_settings.admindir.value = boarddir + "/Admin";
           document.auto_settings.langdir.value = boarddir + "/Languages";            document.auto_settings.langdir.value = boarddir + "/Languages";
           document.auto_settings.templatesdir.value = boarddir + "/Templates";            document.auto_settings.templatesdir.value = boarddir + "/Templates";
           document.auto_settings.helpfile.value = boarddir + "/Help";            document.auto_settings.helpfile.value = boarddir + "/Help";
   
           // HTML URLs            // HTML URLs
           document.auto_settings.html_root.value = htmlurl;            document.auto_settings.html_root.value = htmlurl;
           //document.auto_settings.forumstylesurl.value = htmlurl + "/Templates/Forum";  
           //document.auto_settings.adminstylesurl.value = htmlurl + "/Templates/Admin";  
           document.auto_settings.uploadurl.value = htmlurl + "/Attachments";            document.auto_settings.uploadurl.value = htmlurl + "/Attachments";
             document.auto_settings.pmuploadurl.value = htmlurl + "/PMAttachments";
           document.auto_settings.facesurl.value = htmlurl + "/avatars";            document.auto_settings.facesurl.value = htmlurl + "/avatars";
           //document.auto_settings.smiliesurl.value = htmlurl + "/Smilies";             document.auto_settings.modimgurl.value = htmlurl + "/ModImages"; 
           //document.auto_settings.modimgurl.value = htmlurl + "/ModImages";  
   
           // HTML Directories            // HTML Directories
           document.auto_settings.uploaddir.value = htmldir + "/Attachments";  
           document.auto_settings.htmldir.value = htmldir;            document.auto_settings.htmldir.value = htmldir;
           //document.auto_settings.forumstylesdir.value = htmldir + "/Templates/Forum";             document.auto_settings.uploaddir.value = htmldir + "/Attachments"; 
           //document.auto_settings.adminstylesdir.value = htmldir + "/Templates/Admin";             document.auto_settings.pmuploaddir.value = htmldir + "/PMAttachments"; 
           document.auto_settings.facesdir.value = htmldir + "/avatars";            document.auto_settings.facesdir.value = htmldir + "/avatars";
           //document.auto_settings.smiliesdir.value = htmldir + "/Smilies";             document.auto_settings.modimgdir.value = htmldir + "/ModImages"; 
           //document.auto_settings.modimgdir.value = htmldir + "/ModImages";  
     }      }
} }
//-->  
</script> </script>
  <div id="folderfind">
     <table width="80%" bgcolor="#000000" border="0" cellspacing="1" cellpadding="3" align="center">     <table> 
     <tr>         <col style="width:43%" /> 
           <td colspan="2" bgcolor="$header" align="left">         <col style="width:57%" /> 
           <span style="font-family: arial; font-size: 13px; color: #fefefe;">&nbsp;<b>Absolute Path to the main script directory</b></span>       <tr> 
           </td>             <td class="header" colspan="2"> 
     </tr>                 <span style="color: #fefefe;">&nbsp;<b>Absolute Path to the main script directory</b></span> 
     <tr>             </td> 
           <td width="43%" bgcolor= "$windowbg2" align="left">         </tr><tr> 
                 <div style="float: left; width: 80%; text-align: left; font-family: Arial; font-size: 11px; color: #000000;">Only click on the insert button if your server needs the absolute path to the YaBB main script</div>             <td class="windowbg2"> 
                 <div style="float: left; width: 80%; text-align: left; font-size: 11px;">Only click on the insert button if your server needs the absolute path to the YaBB main script</div>
                 <div style="float: left; width: 20%; text-align: right;"><input type="button" onclick="abspathfill('$support_env_path')" value="Insert" style="font-size: 11px;" /></div>                  <div style="float: left; width: 20%; text-align: right;"><input type="button" onclick="abspathfill('$support_env_path')" value="Insert" style="font-size: 11px;" /></div>
           </td>            </td>
           <td width="57%" bgcolor="$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$support_env_path</span></td>             <td class="windowbg2">$support_env_path</td> 
     </tr>         </tr><tr> 
     <tr>             <td class="header" colspan="2"> 
           <td colspan="2" bgcolor= "$header" align="left">                 <span style="color: #fefefe;">&nbsp;<b>Change this form if changes are necessary.</b></span> 
           <span style="font-family: Arial; font-size: 13px; color: #fefefe;">&nbsp;<b>Change this form if changes are necessary.</b></span>             </td> 
           </td>         </tr><tr> 
     </tr>             <td class="windowbg2"> 
     <tr>                 <label for="preboarddir"> 
           <td width="43%" bgcolor= "$windowbg2" align="left">  
                 <label for="preboarddir"><span style="font-family: Arial; font-size: 13px; color: #000000;">  
                 Main Script Directory:                  Main Script Directory:
                 </span><br />                <br />
                 <span style="font-family: Arial; font-size: 11px; color: #000000;">                 <span style="font-size: 11px;"> 
                 The server path to the board's folder (usually can be left as '.')                    The server path to the board&#39;s folder (usually can be left as '.')
                 </span></label>                 </span> 
                 </label>
           </td>            </td>
           <td width="57%" bgcolor= "$windowbg" align="left">             <td class="windowbg2"> 
                 <input type="text" size="60" name ="preboarddir" id ="preboarddir" value="$boarddir" />                  <input type="text" size="60" name ="preboarddir" id ="preboarddir" value="$boarddir" />
           </td>            </td>
     </tr>         </tr><tr> 
     <tr>             <td class="windowbg2"> 
           <td width="43%" bgcolor= "$windowbg2" align="left">                 <label for="preboardurl">Board URL: 
                 <label for="preboardurl"><span style="font-family: Arial; font-size: 13px; color: #000000;">                 <br /> 
                 Board URL:                 <span style="font-size: 11px;"> 
                 </span><br />                 URL of your board&#39;s folder (without trailing '/') 
                 <span style="font-family: Arial; font-size: 11px; color: #000000;">  
                 URL of your board's folder (without trailing '/')  
                 </span></label>                  </span></label>
           </td>            </td>
           <td width="57%" bgcolor= "$windowbg" align="left">             <td class="windowbg2"> 
                 <input type="text" size="60" name ="preboardurl" id ="preboardurl" value="$boardurl" />                  <input type="text" size="60" name ="preboardurl" id ="preboardurl" value="$boardurl" />
           </td>            </td>
     </tr>         </tr><tr> 
     <tr>             <td class="windowbg2"> 
           <td width="43%" bgcolor= "$windowbg2" align="left">                 <label for="prehtmldir">HTML Root Directory: 
                 <label for="prehtmldir"><span style="font-family: Arial; font-size: 13px; color: #000000;">                 <br /> 
                 HTML Root Directory:                 <span style="font-size: 11px;"> 
                 </span><br />  
                 <span style="font-family: Arial; font-size: 11px; color: #000000;">  
                 Base Path for all /html/css files and folders                  Base Path for all /html/css files and folders
                 </span></label>                  </span></label>
           </td>            </td>
           <td width="57%" bgcolor= "$windowbg" align="left">             <td class="windowbg2"> 
                 <input type="text" size="60" name ="prehtmldir" id ="prehtmldir" value="$htmldir" />                  <input type="text" size="60" name ="prehtmldir" id ="prehtmldir" value="$htmldir" />
           </td>            </td>
     </tr>         </tr><tr> 
     <tr>             <td class="windowbg2"> 
           <td width="43%" bgcolor= "$windowbg2" align="left">                 <label for="prehtml_root"> 
                 <label for="prehtml_root"><span style="font-family: Arial; font-size: 13px; color: #000000;">  
                 HTML Root URL:                  HTML Root URL:
                 </span><br />                <br />
                 <span style="font-family: Arial; font-size: 11px; color: #000000;">                 <span style="font-size: 11px;"> 
                 Base URL for all /html/css files and folders                  Base URL for all /html/css files and folders
                 </span></label>                  </span></label>
           </td>            </td>
           <td width="57%" bgcolor= "$windowbg" align="left">             <td class="windowbg2"> 
                 <input type="text" size="60" name ="prehtml_root" id ="prehtml_root" value="$yyhtml_root" />                  <input type="text" size="60" name ="prehtml_root" id ="prehtml_root" value="$yyhtml_root" />
           </td>            </td>
     </tr>         </tr><tr> 
     <tr>             <td style="background-color:$catbg; text-align:center; padding:15px 3px 30px 3px" colspan="2"> 
           <td colspan="2" bgcolor= "$catbg" align="center">  
                 <br />  
                 <input type="button" onclick="autofill()" value="Autofill the forms below" style="width: 200px;" />                  <input type="button" onclick="autofill()" value="Autofill the forms below" style="width: 200px;" />
                 <br /><br />  
           </td>            </td>
     </tr>      </tr>
</table> </table>
<br /><br />     <table style="margin-top:1em"> 
         <col style="width:20%" />
<table width="80%" bgcolor="#000000" border="0" cellspacing="1" cellpadding="3" align="center">         <col style="width:35%" /> 
         <col style="width:10%" />
         <col style="width:35%" />
     <tr>      <tr>
           <td colspan="4" bgcolor= "$header" width="100%" align="left">             <td class="header" colspan="4"> 
           <input type="hidden" name="lastsaved" value="${$uid.$username}{'realname'}" />            <input type="hidden" name="lastsaved" value="${$uid.$username}{'realname'}" />
           <input type="hidden" name="lastdate" value="$date" />            <input type="hidden" name="lastdate" value="$date" />
           <span style="font-family: Arial; font-size: 13px; color: #fefefe;">&nbsp;<b>These are the settings detected on your server and the last saved settings.</b></span>                <span style="color: #fefefe;">&nbsp;<b>These are the settings detected on your server and the last saved settings.</b></span>
           </td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$catbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">&nbsp;</span></td>  
           <td width="35%" bgcolor= "$catbg" align="center"><span style="font-family: arial; font-size: 13px; color: #000000;"><b>Detected Values</b></span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><span style="font-family: arial; font-size: 13px; color: #000000;"><b>Transfer</b></span></td>  
           <td width="35%" bgcolor= "$catbg" align="center"><span style="font-family: arial; font-size: 13px; color: #000000;"><b>Saved: $mylastdate</b></span></td>  
     </tr>  
     <tr>  
           <td colspan="4" bgcolor= "$header" width="100%" align="left">  
           <span style="font-family: arial; font-size: 13px; color: #fefefe;">&nbsp; <b>CGI-BIN Settings</b></span>  
           </td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Board URL:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_boardurl</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.boardurl.value = '$fnd_boardurl';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="boardurl" value="$boardurl" /></span></td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Main Script Dir.:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_boarddir</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.boarddir.value = '$fnd_boarddir';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="boarddir" value="$boarddir" /></span></td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Admin Dir.:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_admindir</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.admindir.value = '$fnd_admindir';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="admindir" value="$admindir" /></span></td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Boards Dir.:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_boardsdir</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.boardsdir.value = '$fnd_boardsdir';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="boardsdir" value="$boardsdir" /></span></td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Help Dir.:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_helpfile</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.helpfile.value = '$fnd_helpfile';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="helpfile" value="$helpfile" /></span></td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Languages Dir.:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_langdir</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.langdir.value = '$fnd_langdir';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="langdir" value="$langdir" /></span></td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Member Dir.:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_memberdir</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.memberdir.value = '$fnd_memberdir';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="memberdir" value="$memberdir" /></span></td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Message Dir.:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_datadir</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.datadir.value = '$fnd_datadir';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="datadir" value="$datadir" /></span></td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Sources Dir.:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_sourcedir</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.sourcedir.value = '$fnd_sourcedir';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="sourcedir" value="$sourcedir" /></span></td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Template Dir.:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_templatesdir</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.templatesdir.value = '$fnd_templatesdir';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="templatesdir" value="$templatesdir" /></span></td>  
     </tr>  
     <tr>  
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Variables Dir.:</span></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_vardir</span></td>  
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.vardir.value = '$fnd_vardir';return false;" value="->" /></td>  
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="vardir" value="$vardir" /></span></td>  
     </tr>  
     <tr>  
           <td colspan="4" bgcolor= "$header" width="100%" align="left">  
           <span style="font-family: arial; font-size: 13px; color: #fefefe;">&nbsp; <b>HTML Settings</b></span>  
           </td>            </td>
     </tr>         </tr><tr> 
     <tr>             <td class="catbg">&nbsp;</td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">HTML Root Dir.:</span></td>             <td class="catbg"><b>Detected Values</b></td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_htmldir</span></td>             <td class="catbg"><b>Transfer</b></td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.htmldir.value = '$fnd_htmldir';return false;" value="->" /></td>             <td class="catbg"><b>Saved: $mylastdate</b></td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="htmldir" value="$htmldir" /></span></td>         </tr><tr> 
     </tr>             <td class="header" colspan="4"> 
     <tr>             <span style="color: #fefefe;">&nbsp; <b>CGI-BIN Settings</b></span> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">HTML Root URL:</span></td>             </td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_html_root</span></td>         </tr><tr> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.html_root.value = '$fnd_html_root';return false;" value="->" /></td>             <td class="windowbg2">Board URL:</td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="html_root" value="$yyhtml_root" /></span></td>             <td class="windowbg">$fnd_boardurl</td> 
     </tr>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.boardurl.value = '$fnd_boardurl';return false;" value="->" /></td> 
     <tr>             <td class="windowbg"><input type="text" size="60" name ="boardurl" value="$boardurl" /></td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Attachment Dir.:</span></td>         </tr><tr> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_uploaddir</span></td>             <td class="windowbg2">Main Script Dir.:</td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.uploaddir.value = '$fnd_uploaddir';return false;" value="->" /></td>             <td class="windowbg">$fnd_boarddir</td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="uploaddir" value="$uploaddir" /></span></td>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.boarddir.value = '$fnd_boarddir';return false;" value="->" /></td> 
     </tr>             <td class="windowbg"><input type="text" size="60" name ="boarddir" value="$boarddir" /></td> 
     <tr>         </tr><tr> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Attachment URL:</span></td>             <td class="windowbg2">Admin Dir.:</td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_uploadurl</span></td>             <td class="windowbg">$fnd_admindir</td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.uploadurl.value = '$fnd_uploadurl';return false;" value="->" /></td>            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.admindir.value = '$fnd_admindir';return false;" value="->" /></td>
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="uploadurl" value="$uploadurl" /></span></td>             <td class="windowbg"><input type="text" size="60" name ="admindir" value="$admindir" /></td> 
     </tr>         </tr><tr> 
     <tr>             <td class="windowbg2">Boards Dir.:</td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Avatar Dir.:</span></td>             <td class="windowbg">$fnd_boardsdir</td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_facesdir</span></td>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.boardsdir.value = '$fnd_boardsdir';return false;" value="->" /></td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.facesdir.value = '$fnd_facesdir';return false;" value="->" /></td>            <td class="windowbg"><input type="text" size="60" name ="boardsdir" value="$boardsdir" /></td>
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="facesdir" value="$facesdir" /></span></td>         </tr><tr> 
     </tr>             <td class="windowbg2">Help Dir.:</td> 
     <tr>             <td class="windowbg">$fnd_helpfile</td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Avatar URL:</span></td>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.helpfile.value = '$fnd_helpfile';return false;" value="->" /></td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_facesurl</span></td>             <td class="windowbg"><input type="text" size="60" name ="helpfile" value="$helpfile" /></td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.facesurl.value = '$fnd_facesurl';return false;" value="->" /></td>         </tr><tr> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="facesurl" value="$facesurl" /></span></td>             <td class="windowbg2">Languages Dir.:</td> 
     </tr>             <td class="windowbg">$fnd_langdir</td> 
     <!-- <tr>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.langdir.value = '$fnd_langdir';return false;" value="->" /></td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Mod Images Dir.:</span></td>             <td class="windowbg"><input type="text" size="60" name ="langdir" value="$langdir" /></td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_modimgdir</span></td>         </tr><tr> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.modimgdir.value = '$fnd_modimgdir';return false;" value="->" /></td>             <td class="windowbg2">Member Dir.:</td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="modimgdir" value="$modimgdir" /></span></td>             <td class="windowbg">$fnd_memberdir</td> 
     </tr>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.memberdir.value = '$fnd_memberdir';return false;" value="->" /></td> 
     <tr>             <td class="windowbg"><input type="text" size="60" name ="memberdir" value="$memberdir" /></td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Mod Images URL:</span></td>         </tr><tr> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_modimgurl</span></td>             <td class="windowbg2">Message Dir.:</td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.modimgurl.value = '$fnd_modimgurl';return false;" value="->" /></td>             <td class="windowbg">$fnd_datadir</td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="modimgurl" value="$modimgurl" /></span></td>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.datadir.value = '$fnd_datadir';return false;" value="->" /></td> 
     </tr> -->             <td class="windowbg"><input type="text" size="60" name ="datadir" value="$datadir" /></td> 
     <!-- <tr>         </tr><tr> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Smilies Dir.:</span></td>             <td class="windowbg2">Sources Dir.:</td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_smiliesdir</span></td>             <td class="windowbg">$fnd_sourcedir</td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.smiliesdir.value = '$fnd_smiliesdir';return false;" value="->" /></td>            <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.sourcedir.value = '$fnd_sourcedir';return false;" value="->" /></td>
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="smiliesdir" value="$smiliesdir" /></span></td>             <td class="windowbg"><input type="text" size="60" name ="sourcedir" value="$sourcedir" /></td> 
     </tr>         </tr><tr> 
     <tr>             <td class="windowbg2">Template Dir.:</td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Smilies URL:</span></td>             <td class="windowbg">$fnd_templatesdir</td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_smiliesurl</span></td>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.templatesdir.value = '$fnd_templatesdir';return false;" value="->" /></td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.smiliesurl.value = '$fnd_smiliesurl';return false;" value="->" /></td>            <td class="windowbg"><input type="text" size="60" name ="templatesdir" value="$templatesdir" /></td>
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="smiliesurl" value="$smiliesurl" /></span></td>         </tr><tr> 
     </tr> -->             <td class="windowbg2">Variables Dir.:</td> 
     <!-- <tr>             <td class="windowbg">$fnd_vardir</td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Admin Style Dir.:</span></td>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.vardir.value = '$fnd_vardir';return false;" value="->" /></td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_adminstylesdir</span></td>             <td class="windowbg"><input type="text" size="60" name ="vardir" value="$vardir" /></td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.adminstylesdir.value = '$fnd_adminstylesdir';return false;" value="->" /></td>         </tr><tr> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="adminstylesdir" value="$adminstylesdir" /></span></td>             <td class="header" style="color: #fefefe;" colspan="4">&nbsp; <b>HTML Settings</b></td> 
     </tr>         </tr><tr> 
     <tr>             <td class="windowbg2">HTML Root Dir.:</td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Admin Style URL:</span></td>             <td class="windowbg">$fnd_htmldir</td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_adminstylesurl</span></td>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.htmldir.value = '$fnd_htmldir';return false;" value="->" /></td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.adminstylesurl.value = '$fnd_adminstylesurl';return false;" value="->" /></td>            <td class="windowbg"><input type="text" size="60" name ="htmldir" value="$htmldir" /></td>
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="adminstylesurl" value="$adminstylesurl" /></span></td>         </tr><tr> 
     </tr> -->             <td class="windowbg2">HTML Root URL:</td> 
     <!-- <tr>             <td class="windowbg">$fnd_html_root</td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Forum Style Dir.:</span></td>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.html_root.value = '$fnd_html_root';return false;" value="->" /></td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_forumstylesdir</span></td>             <td class="windowbg"><input type="text" size="60" name ="html_root" value="$yyhtml_root" /></td> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.forumstylesdir.value = '$fnd_forumstylesdir';return false;" value="->" /></td>         </tr><tr> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="forumstylesdir" value="$forumstylesdir" /></span></td>             <td class="windowbg2">Attachment Dir.:</td> 
     </tr>             <td class="windowbg">$fnd_uploaddir</td> 
     <tr>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.uploaddir.value = '$fnd_uploaddir';return false;" value="->" /></td> 
           <td width="20%" bgcolor= "$windowbg2" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">Forum Style URL:</span></td>             <td class="windowbg"><input type="text" size="60" name ="uploaddir" value="$uploaddir" /></td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;">$fnd_forumstylesurl</span></td>         </tr><tr> 
           <td width="10%" bgcolor= "$catbg" align="center"><input type="button" OnClick="javascript: document.auto_settings.forumstylesurl.value = '$fnd_forumstylesurl';return false;" value="->" /></td>             <td class="windowbg2">Attachment URL:</td> 
           <td width="35%" bgcolor= "$windowbg" align="left"><span style="font-family: arial; font-size: 13px; color: #000000;"><input type="text" size="40" name ="forumstylesurl" value="$forumstylesurl" /></span></td>             <td class="windowbg">$fnd_uploadurl</td> 
     </tr> -->             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.uploadurl.value = '$fnd_uploadurl';return false;" value="->" /></td> 
     <tr>             <td class="windowbg"><input type="text" size="60" name ="uploadurl" value="$uploadurl" /></td> 
           <td colspan="4" bgcolor= "$catbg" width="100%" align="center">         </tr><tr> 
           <br />             <td class="windowbg2">PMAttachment Dir.:</td> 
           <span style="font-family: arial; font-size: 13px; color: #000000;">             <td class="windowbg">$fnd_pmuploaddir</td> 
           <input type="submit" value="Save Settings" />             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.pmuploaddir.value = '$fnd_pmuploaddir';return false;" value="->" /></td> 
           </span>             <td class="windowbg"><input type="text" size="60" name ="pmuploaddir" value="$pmuploaddir" /></td> 
           <br />         </tr><tr> 
           <br />             <td class="windowbg2">PMAttachment URL:</td> 
           </td>             <td class="windowbg">$fnd_pmuploadurl</td> 
     </tr>             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.pmuploadurl.value = '$fnd_pmuploadurl';return false;" value="->" /></td> 
</table>             <td class="windowbg"><input type="text" size="60" name ="pmuploadurl" value="$pmuploadurl" /></td> 
         </tr><tr>
             <td class="windowbg2">Avatar Dir.:</td>
             <td class="windowbg">$fnd_facesdir</td>
             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.facesdir.value = '$fnd_facesdir';return false;" value="->" /></td>
             <td class="windowbg"><input type="text" size="60" name ="facesdir" value="$facesdir" /></td>
         </tr><tr>
             <td class="windowbg2">Avatar URL:</td>
             <td class="windowbg">$fnd_facesurl</td>
             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.facesurl.value = '$fnd_facesurl';return false;" value="->" /></td>
             <td class="windowbg"><input type="text" size="60" name ="facesurl" value="$facesurl" /></td>
         </tr><tr>
             <td class="windowbg2">Mod Images Dir.:</td>
             <td class="windowbg">$fnd_modimgdir</td>
             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.modimgdir.value = '$fnd_modimgdir';return false;" value="->" /></td>
             <td class="windowbg"><input type="text" size="60" name ="modimgdir" value="$modimgdir" /></td>
         </tr><tr>
             <td class="windowbg2">Mod Images URL:</td>
             <td class="windowbg">$fnd_modimgurl</td>
             <td class="catbg"><input type="button" onclick="javascript: document.auto_settings.modimgurl.value = '$fnd_modimgurl';return false;" value="->" /></td>
             <td class="windowbg"><input type="text" size="60" name ="modimgurl" value="$modimgurl" /></td>
         </tr><tr>
             <td class="catbg" style="margin-top:.5em; margin-bottom:1em;" colspan="4"><input type="submit" value="Save Settings" /></td>
         </tr>
     </table>
  </div>
</form> </form>
<br />  
<br />  
     ~;      ~;
     $yytitle = "Results of Auto-Sensing";     $yytitle = 'Results of Auto-Sensing'; 
     &SimpleOutput;     SimpleOutput(); 
     return;
} }
   
sub save_paths { sub save_paths {
     &LoadCookie; # Load the user's cookie (or set to guest)    LoadCookie();    # Load the user's cookie (or set to guest)
     &LoadUserSettings;     LoadUserSettings(); 
     if (!$iamadmin) { &setup_fatal_error(qq~Setup Error: You have no access rights to this function. Only user "admin" has if logged in!~); }     if ( !$iamadmin ) { 
         setup_fatal_error(
     $lastsaved      = $FORM{'lastsaved'};  q~Setup Error: You have no access rights to this function. Only user "admin" has rights, if logged in.~ 
     $lastdate       = $FORM{'lastdate'};         ); 
     $boardurl       = $FORM{'boardurl'};     } 
     $boarddir       = $FORM{'boarddir'};  
     $htmldir        = $FORM{'htmldir'};     $lastsaved    = $FORM{'lastsaved'}; 
     $uploaddir      = $FORM{'uploaddir'};     $lastdate     = $FORM{'lastdate'}; 
     $uploadurl      = $FORM{'uploadurl'};     $boardurl     = $FORM{'boardurl'}; 
     $yyhtml_root    = $FORM{'html_root'};     $boarddir     = $FORM{'boarddir'}; 
     $datadir        = $FORM{'datadir'};     $htmldir      = $FORM{'htmldir'}; 
     $boardsdir      = $FORM{'boardsdir'};     $uploaddir    = $FORM{'uploaddir'}; 
     $memberdir      = $FORM{'memberdir'};     $uploadurl    = $FORM{'uploadurl'}; 
     $sourcedir      = $FORM{'sourcedir'};     $pmuploaddir  = $FORM{'pmuploaddir'}; 
     $admindir       = $FORM{'admindir'};     $pmuploadurl  = $FORM{'pmuploadurl'}; 
     $vardir         = $FORM{'vardir'};     $yyhtml_root  = $FORM{'html_root'}; 
     $langdir        = $FORM{'langdir'};     $datadir      = $FORM{'datadir'}; 
     $helpfile       = $FORM{'helpfile'};     $boardsdir    = $FORM{'boardsdir'}; 
     $templatesdir   = $FORM{'templatesdir'};     $memberdir    = $FORM{'memberdir'}; 
     #$forumstylesdir = $FORM{'forumstylesdir'};     $sourcedir    = $FORM{'sourcedir'}; 
     #$forumstylesurl = $FORM{'forumstylesurl'};     $admindir     = $FORM{'admindir'}; 
     #$adminstylesdir = $FORM{'adminstylesdir'};     $vardir       = $FORM{'vardir'}; 
     #$adminstylesurl = $FORM{'adminstylesurl'};     $langdir      = $FORM{'langdir'}; 
     $facesdir       = $FORM{'facesdir'};     $helpfile     = $FORM{'helpfile'}; 
     $facesurl       = $FORM{'facesurl'};     $templatesdir = $FORM{'templatesdir'}; 
     #$smiliesdir     = $FORM{'smiliesdir'};  
     #$smiliesurl     = $FORM{'smiliesurl'};     $facesdir  = $FORM{'facesdir'}; 
     #$modimgdir      = $FORM{'modimgdir'};     $facesurl  = $FORM{'facesurl'}; 
     #$modimgurl      = $FORM{'modimgurl'};     $modimgdir = $FORM{'modimgdir'}; 
     $modimgurl = $FORM{'modimgurl'};
   
     my $setfile = << "EOF";    my $setfile = << "EOF";
############################################################################### ###############################################################################
# Paths.pl                                                                    # # Paths.pm                                                                    #
############################################################################### ###############################################################################
# YaBB: Yet another Bulletin Board                                            # # YaBB: Yet another Bulletin Board                                            #
# Open-Source Community Software for Webmasters                               # # Open-Source Community Software for Webmasters                               #
# Version:        YaBB 2.5.2                                                  # # Version:        YaBB 2.6.12                                                 #
# Packaged:       September 30, 2012                                          # # Packaged:       December 2, 2014                                            #
# Distributed by: http://www.yabbforum.com                                    # # Distributed by: http://www.yabbforum.com                                    #
# =========================================================================== # # =========================================================================== #
# Copyright (c) 2000-2012  YaBB (www.yabbforum.com) - All Rights Reserved.    # # Copyright (c) 2000-2016  YaBB (www.yabbforum.com) - All Rights Reserved.    #
# Software by:  The YaBB Development Team                                     # # Software by:  The YaBB Development Team                                     #
#               with assistance from the YaBB community.                      # #               with assistance from the YaBB community.                      #
############################################################################### ###############################################################################
   
\$lastsaved = "$lastsaved"; \$lastsaved = "$lastsaved";
\$lastdate = "$lastdate"; \$lastdate = "$lastdate";
   
########## Directories ########## ########## Directories ##########
   
\$boardurl = "$boardurl";                                         # URL of your board's folder (without trailing '/') \$boardurl = "$boardurl";                                         # URL of your board's folder (without trailing '/')
\$boarddir = "$boarddir";                                         # The server path to the board's folder (usually can be left as '.') \$boarddir = "$boarddir";                                         # The server path to the board's folder (usually can be left as '.')
\$boardsdir = "$boardsdir";                                       # Directory with board data files \$boardsdir = "$boardsdir";                                       # Directory with board data files
\$datadir = "$datadir";                                           # Directory with messages \$datadir = "$datadir";                                           # Directory with messages
\$memberdir = "$memberdir";                                       # Directory with member files \$memberdir = "$memberdir";                                       # Directory with member files
\$sourcedir = "$sourcedir";                                       # Directory with YaBB source files \$sourcedir = "$sourcedir";                                       # Directory with YaBB source files
\$admindir = "$admindir";                                         # Directory with YaBB admin source files \$admindir = "$admindir";                                         # Directory with YaBB admin source files
\$vardir = "$vardir";                                             # Directory with variable files \$vardir = "$vardir";                                             # Directory with variable files
\$langdir = "$langdir";                                           # Directory with Language files and folders \$langdir = "$langdir";                                           # Directory with Language files and folders
\$helpfile = "$helpfile";                                         # Directory with Help files and folders \$helpfile = "$helpfile";                                         # Directory with Help files and folders
\$templatesdir = "$templatesdir";                                 # Directory with template files and folders \$templatesdir = "$templatesdir";                                 # Directory with template files and folders
\$htmldir = "$htmldir";                                           # Base Path for all public-html files and folders \$htmldir = "$htmldir";                                           # Base Path for all public-html files and folders
\$facesdir = "$facesdir";                                         # Base Path for all avatar files \$facesdir = "$facesdir";                                         # Base Path for all avatar files
\$uploaddir = "$uploaddir";                                       # Base Path for all attachment files \$uploaddir = "$uploaddir";                                       # Base Path for all attachment files
  \$pmuploaddir = "$pmuploaddir";                                   # Base Path for all PM attachment files
  \$modimgdir = "$modimgdir";                                       # Base Path for all mod images
   
########## URL's ########## ########## URLs ##########
   
\$yyhtml_root = "$yyhtml_root";                                   # Base URL for all html/css files and folders \$yyhtml_root = "$yyhtml_root";                                   # Base URL for all html/css files and folders
\$facesurl = "$facesurl";                                         # Base URL for all avatar files \$facesurl = "$facesurl";                                         # Base URL for all avatar files
\$uploadurl = "$uploadurl";                                       # Base URL for all attachment files \$uploadurl = "$uploadurl";                                       # Base URL for all attachment files
  \$pmuploadurl = "$pmuploadurl";                                   # Base URL for all PM attachment files
########## Old Path Settings ################################  \$modimgurl = "$modimgurl";                                       # Base URL for all mod images 
########## The following variables are deprecated! ##########  
########## Don't use them for new code! #####################  
   
\$forumstylesdir = \$htmldir . "/Templates/Forum";                # Directory with forum style files and folders  
\$adminstylesdir = \$htmldir . "/Templates/Admin";                # Directory with admin style files and folders  
\$smiliesdir = \$htmldir . "/Smilies";                            # Base Path for all smilie files  
\$modimgdir = \$htmldir . "/ModImages";                           # Base Path for all mod images  
   
\$forumstylesurl = \$yyhtml_root . "/Templates/Forum";            # Default Forum Style Directory  
\$adminstylesurl = \$yyhtml_root . "/Templates/Admin";            # Default Admin Style Directory  
\$smiliesurl = \$yyhtml_root . "/Smilies";                        # Base URL for all smilie files  
\$modimgurl = \$yyhtml_root . "/ModImages";                       # Base URL for all mod images  
   
1; 1;
EOF EOF
   
     fopen(FILE, ">./Paths.pl") || &setup_fatal_error("$maintext_23 ./Paths.pl: ", 1);     open $FILE, '>', './Paths.pm' 
     print FILE &nicely_aligned_file($setfile);       || setup_fatal_error( "$maintext_23 ./Paths.pm: ", 1 ); 
     fclose(FILE);     print {$FILE} nicely_aligned_file($setfile) 
       or croak 'cannot print nicely aligned Paths.pm';
     if (-e "$vardir/Paths.pl") { unlink "$vardir/Paths.pl"; }     close $FILE or croak 'cannot close Paths.pm'; 
   
     $yySetLocation = qq~$set_cgi?action=checkmodules~;     if ( -e "$vardir/Paths.pm" ) { unlink "$vardir/Paths.pm"; } 
     &redirectexit;  
     $yySetLocation = qq~$set_cgi?action=checkmodules~;
     redirectexit();
     return;
} }
   
sub BrdInstall { sub BrdInstall {
     $no_brddir = 0;    $no_brddir = 0;
     if (!-d "$boardsdir") { $no_brddir = "1"; return 1; }    if ( !-d "$boardsdir" ) { $no_brddir = 1; return 1; }
} }
   
sub MesInstall { sub MesInstall {
     $no_mesdir = 0;    $no_mesdir = 0;
     if (!-d "$datadir") { $no_mesdir = "1"; return 1; }    if ( !-d "$datadir" ) { $no_mesdir = 1; return 1; }
} }
   
sub MemInstall { sub MemInstall {
     $no_memdir = 0;    $no_memdir = 0;
     if (!-d "$memberdir") { $no_memdir = "1"; return 1; }    if ( !-d "$memberdir" ) { $no_memdir = 1; return 1; }
} }
   
sub VarInstall { sub VarInstall {
     my $varsdir = "$vardir";    my $varsdir = "$vardir";
     $no_vardir = 0;    $no_vardir = 0;
   
     if (!-d "$varsdir") { $no_vardir = "1"; return 1; }  
   
     if (!-e "$varsdir/adminlog.txt") {  
           fopen(ADMLOGFILE, ">$varsdir/adminlog.txt") || &setup_fatal_error("$maintext_23 $varsdir/adminlog.txt: ", 1);  
           print ADMLOGFILE "";  
           fclose(ADMLOGFILE);  
     }  
   
     if (!-e "$varsdir/ConvSettings.txt") {     if ( !-d "$varsdir" ) { $no_vardir = 1; return 1; } 
           my $setfile = << "EOF";  
\$convertdir = qq~./Convert~;  
\$convboardsdir = qq~./Convert/Boards~;  
\$convmemberdir = qq~./Convert/Members~;  
\$convdatadir = qq~./Convert/Messages~;  
\$convvardir = qq~./Convert/Variables~;  
   
1;     if ( !-e "$varsdir/adminlog_new.txt" ) { 
EOF         open $ADMLOGFILE, '>', "$varsdir/adminlog_new.txt" 
           || setup_fatal_error( "$maintext_23 $varsdir/adminlog_new.txt: ", 1 );
           fopen(SETTING, ">$vardir/ConvSettings.txt") || &setup_fatal_error("$maintext_23 $vardir/ConvSettings.txt: ", 1);         print {$ADMLOGFILE} q{} or croak 'cannot print ADMLOGFILE'; 
           print SETTING &nicely_aligned_file($setfile);         close $ADMLOGFILE or croak 'cannot close adminlog_new.txt'; 
           fclose(SETTING);     } 
     }  
     if ( !-e "$varsdir/allowed.txt" ) {
     if (!-e "$varsdir/allowed.txt") {         my $allowed = q~login 
           fopen(ALLOWFILE, ">$varsdir/allowed.txt") || &setup_fatal_error("$maintext_23 $varsdir/allowed.txt: ", 1);  logout 
           print ALLOWFILE "login\n";  display 
           print ALLOWFILE "logout\n";  messageindex
           print ALLOWFILE "display\n";  pages 
           print ALLOWFILE "messageindex\n";  profile 
           print ALLOWFILE "pages\n";  register 
           print ALLOWFILE "profile\n";  resetpass 
           print ALLOWFILE "register\n";  viewprofile 
           print ALLOWFILE "resetpass\n";  ~; 
           print ALLOWFILE "viewprofile";         open $ALLOWFILE, '>', "$varsdir/allowed.txt" 
           fclose(ALLOWFILE);           || setup_fatal_error( "$maintext_23 $varsdir/allowed.txt: ", 1 ); 
     }         print {$ALLOWFILE} $allowed or croak 'cannot print ALLOWFILE'; 
         close $ALLOWFILE or croak 'cannot close ALLOWFILE';
     if (!-e "$varsdir/attachments.txt") {     } 
           fopen(ATTFILE, ">$varsdir/attachments.txt") || &setup_fatal_error("$maintext_23 $varsdir/attachments.txt: ", 1);  
           print ATTFILE "";     if ( !-e "$varsdir/attachments.txt" ) { 
           fclose(ATTFILE);         open $ATTFILE, '>', "$varsdir/attachments.txt" 
     }           || setup_fatal_error( "$maintext_23 $varsdir/attachments.txt: ", 1 ); 
         print {$ATTFILE} q{} or croak 'cannot print ATTFILE';
     if (!-e "$varsdir/ban_log.txt") {         close $ATTFILE or croak 'cannot print ATTFILE'; 
           fopen(BANFILE, ">$varsdir/ban_log.txt") || &setup_fatal_error("$maintext_23 $varsdir/ban_log.txt: ", 1);     } 
           print BANFILE "";     if ( !-e "$varsdir/pm.attachments" ) { 
           fclose(BANFILE);         open $PMATTFILE, '>', "$varsdir/pm.attachments" 
     }           || setup_fatal_error( "$maintext_23 $varsdir/pm.attachments: ", 1 ); 
         print {$PMATTFILE} q{} or croak 'cannot print PMATTFILE';
     if (!-e "$varsdir/clicklog.txt") {         close $PMATTFILE or croak 'cannot close PMATTFILE'; 
           fopen(CLICKFILE, ">$varsdir/clicklog.txt") || &setup_fatal_error("$maintext_23 $varsdir/clicklog.txt: ", 1);     } 
           print CLICKFILE "";  
           fclose(CLICKFILE);     if ( !-e "$varsdir/ban_log.txt" ) { 
     }         open $BANFILE, '>', "$varsdir/ban_log.txt" 
           || setup_fatal_error( "$maintext_23 $varsdir/ban_log.txt: ", 1 );
     if (!-e "$varsdir/errorlog.txt") {         print {$BANFILE} q{} or croak 'cannot print ban_log.txt'; 
           fopen(ERRORFILE, ">$varsdir/errorlog.txt") || &setup_fatal_error("$maintext_23 $varsdir/errorlog.txt: ", 1);         close $BANFILE or croak 'cannot close ban_log.txt'; 
           print ERRORFILE "";     } 
           fclose(ERRORFILE);  
     }     if ( !-e "$varsdir/banlist.txt" ) { 
         open $BANLIST, '>', "$varsdir/banlist.txt" 
     if (!-e "$varsdir/flood.txt") {           || setup_fatal_error( "$maintext_23 $varsdir/banlist.txt: ", 1 ); 
           fopen(FLOODFILE, ">$varsdir/flood.txt") || &setup_fatal_error("$maintext_23 $varsdir/flood.txt: ", 1);         print {$BANLIST} q{} or croak 'cannot print banlist.txt'; 
           print FLOODFILE "255.255.255.255|1119313741";         close $BANLIST or croak 'cannot close banlist.txt'; 
           fclose(FLOODFILE);     } 
     }     if ( !-e "$varsdir/clicklog.txt" ) { 
         open $CLICKFILE, '>', "$varsdir/clicklog.txt" 
           || setup_fatal_error( "$maintext_23 $varsdir/clicklog.txt: ", 1 );
         print {$CLICKFILE} q{} or croak 'cannot print clicklog.txt';
         close $CLICKFILE or croak 'cannot close clicklog.txt';
     }
   
     if ( !-e "$varsdir/errorlog.txt" ) {
         open $ERRORFILE, '>', "$varsdir/errorlog.txt" 
           || setup_fatal_error( "$maintext_23 $varsdir/errorlog.txt: ", 1 );
         print {$ERRORFILE} q{} or croak 'cannot print errorlog.txt';
         close $ERRORFILE or croak 'cannot close errorlog.txt';
     }
   
     if ( !-e "$varsdir/flood.txt" ) {
         open $FLOODFILE, '>', "$varsdir/flood.txt" 
           || setup_fatal_error( "$maintext_23 $varsdir/flood.txt: ", 1 );
         print {$FLOODFILE} '255.255.255.255|1119313741' 
           or croak 'cannot print flood.txt';
         close $FLOODFILE or croak 'cannot close flood.txt';
     }
   
     if (!-e "$varsdir/gmodsettings.txt") {    if ( !-e "$varsdir/gmodsettings.txt" ) {
           my $setfile = << "EOF";         my $setfile = <<EOF; 
### Gmod Related Setttings ### ### Gmod Related Setttings ###
   
\$allow_gmod_admin = "on"; # \$allow_gmod_admin = "on"; #
\$gmod_newfile = "on"; # \$gmod_newfile = "on"; #
   
### Areas Gmods can Access ### ### Areas Gmods can Access ###
   
\%gmod_access = ( \%gmod_access = (
'ext_admin',"", 'ext_admin',"",
   
'newsettings;page=main',"", 'newsettings;page=main',"",
'newsettings;page=advanced',"on", 'newsettings;page=advanced',"on",
'editbots', "", 'editbots', "",
   
'newsettings;page=news',"on", 'newsettings;page=news',"on",
'smilies',"on", 'smilies',"on",
'setcensor',"on", 'setcensor',"on",
'modagreement',"on", 'modagreement',"on",
  'eventcal_set',"",
  'bookmarks',"",
   
'referer_control',"", 'referer_control',"",
'newsettings;page=security',"", 'newsettings;page=security',"",
'setup_guardian',"", 'setup_guardian',"",
'newsettings;page=antispam',"", 'newsettings;page=antispam',"",
  'spam_questions',"",
  'honeypot',"",
   
'managecats',"", 'managecats',"",
'manageboards',"", 'manageboards',"",
'helpadmin',"on", 'helpadmin',"on",
'editemailtemplates',"", 'editemailtemplates',"",
   
'addmember',"", 'addmember',"",
'viewmembers',"on", 'viewmembers',"on",
'modmemgr',"", 'modmemgr',"",
'mailing',"on", 'mailing',"on",
'ipban',"on", 'ipban',"on",
'setreserve',"on", 'setreserve',"on",
   
'modskin',"", 'modskin',"",
'modcss',"", 'modcss',"",
'modtemp',"", 'modtemp',"",
   
'clean_log',"on", 'clean_log',"on",
'boardrecount',"", 'boardrecount',"",
'rebuildmesindex',"", 'rebuildmesindex',"",
'membershiprecount',"", 'membershiprecount',"",
'rebuildmemlist',"", 'rebuildmemlist',"",
'rebuildmemhist',"", 'rebuildmemhist',"",
'deleteoldthreads',"", 'deleteoldthreads',"",
'manageattachments',"on", 'manageattachments',"on",
  'backupsettings',"",
   
'detailedversion',"on", 'detailedversion',"on",
'stats',"on", 'stats',"on",
'showclicks',"on", 'showclicks',"on",
'errorlog',"on", 'errorlog',"on",
'view_reglog',"on", 'view_reglog',"on",
   
'modlist',"", 'modlist',"",
); );
   
\%gmod_access2 = ( \%gmod_access2 = (
admin => "on", admin => "on",
   
newsettings => "on", newsettings => "on",
newsettings2 => "on", newsettings2 => "on",
   
  eventcal_set2 => "",
  eventcal_set3 => "",
  bookmarks2 => "",
  bookmarks_add => "",
  bookmarks_add2 => "",
  bookmarks_edit => "",
  bookmarks_edit2 => "",
  bookmarks_delete => "",
  bookmarks_delete2 => "",
  spam_questions2 => "",
  spam_questions_add => "",
  spam_questions_add2 => "",
  spam_questions_edit => "",
  spam_questions_edit2 => "",
  spam_questions_delete => "",
  spam_questions_delete2 => "",
  honeypot2 => "",
  honeypot_add => "",
  honeypot_add2 => "",
  honeypot_edit => "",
  honeypot_edit2 => "",
  honeypot_delete => "",
  honeypot_delete2 => "",
   
deleteattachment => "on", deleteattachment => "on",
manageattachments2 => "on", manageattachments2 => "on",
removeoldattachments => "on", removeoldattachments => "on",
removebigattachments => "on", removebigattachments => "on",
rebuildattach => "on", rebuildattach => "on",
remghostattach => "on", remghostattach => "on",
   
profile => "", profile => "",
profile2 => "", profile2 => "",
profileAdmin => "", profileAdmin => "",
profileAdmin2 => "", profileAdmin2 => "",
profileContacts => "", profileContacts => "",
profileContacts2 => "", profileContacts2 => "",
profileIM => "", profileIM => "",
profileIM2 => "", profileIM2 => "",
profileOptions => "", profileOptions => "",
profileOptions2 => "", profileOptions2 => "",
   
ext_edit => "", ext_edit => "",
ext_edit2 => "", ext_edit2 => "",
ext_create => "", ext_create => "",
ext_reorder => "", ext_reorder => "",
ext_convert => "", ext_convert => "",
   
myprofileAdmin => "", myprofileAdmin => "",
myprofileAdmin2 => "", myprofileAdmin2 => "",
   
delgroup => "", delgroup => "",
editgroup => "", editgroup => "",
editAddGroup2 => "", editAddGroup2 => "",
modmemgr2 => "", modmemgr2 => "",
assigned => "", assigned => "",
assigned2 => "", assigned2 => "",
   
reordercats => "", reordercats => "",
modifycatorder => "", modifycatorder => "",
modifycat => "", modifycat => "",
createcat => "", createcat => "",
catscreen => "", catscreen => "",
reordercats2 => "", reordercats2 => "",
addcat => "", addcat => "",
addcat2 => "", addcat2 => "",
   
modtemplate2 => "", modtemplate2 => "",
modtemp2 => "", modtemp2 => "",
modstyle => "", modstyle => "",
modstyle2 => "", modstyle2 => "",
modcss => "", modcss => "",
modcss2 => "", modcss2 => "",
   
modifyboard => "", modifyboard => "",
addboard => "", addboard => "",
addboard2 => "", addboard2 => "",
reorderboards2 => "", reorderboards2 => "",
boardscreen => "", boardscreen => "",
   
smilieput => "on", smilieput => "on",
smilieindex => "on", smilieindex => "on",
smiliemove => "on", smiliemove => "on",
addsmilies => "on", addsmilies => "on",
   
addmember => "on", addmember => "on",
addmember2 => "on", addmember2 => "on",
deletemultimembers => "on", deletemultimembers => "on",
ml => "on", ml => "on",
   
mailmultimembers => "on", mailmultimembers => "on",
mailing2 => "on", mailing2 => "on",
   
activate => "on", activate => "on",
admin_descision => "on", admin_descision => "on",
apr_regentry => "on", apr_regentry => "on",
del_regentry => "on", del_regentry => "on",
rej_regentry => "on", rej_regentry => "on",
view_regentry => "on", view_regentry => "on",
clean_reglog => "on", clean_reglog => "on",
   
cleanerrorlog => "on", cleanerrorlog => "on",
deleteerror => "on", deleteerror => "on",
   
modagreement2 => "on", modagreement2 => "on",
modsettings2 => "on", modsettings2 => "on",
advsettings2 => "on", advsettings2 => "on",
referer_control2 => "", referer_control2 => "",
removeoldthreads => "", removeoldthreads => "",
ipban2 => "on", ipban2 => "on",
ipban3 => "on", ipban3 => "on",
setcensor2 => "on", setcensor2 => "on",
setreserve2 => "on", setreserve2 => "on",
   
editbots2 => "", editbots2 => "",
); );
   
1; 1;
EOF EOF
   
           fopen(SETTING, ">$varsdir/gmodsettings.txt") || &setup_fatal_error("$maintext_23 $varsdir/gmodsettings.txt: ", 1);         open $SETTING, '>', "$varsdir/gmodsettings.txt" 
           print SETTING &nicely_aligned_file($setfile);           || setup_fatal_error( "$maintext_23 $varsdir/gmodsettings.txt: ", 1 ); 
           fclose(SETTING);         print {$SETTING} nicely_aligned_file($setfile) 
     }           or croak 'cannot print gmodsetting.txt'; 
         close $SETTING or croak 'cannot close gmodsetting.txt';
     if (!-e "$varsdir/log.txt") {     } 
           fopen(LOGFILE, ">$varsdir/log.txt") || &setup_fatal_error("$maintext_23 $varsdir/log.txt: ", 1);  
           print LOGFILE "admin|1105634411|127.0.0.1|";     if ( !-e "$varsdir/log.txt" ) { 
           fclose(LOGFILE);         open $LOGFILE, '>', "$varsdir/log.txt" 
     }           || setup_fatal_error( "$maintext_23 $varsdir/log.txt: ", 1 ); 
         print {$LOGFILE} 'admin|1105634411|127.0.0.1|' 
     if (!-e "$varsdir/modlist.txt") {           or croak 'cannot print log.txt'; 
           fopen(MODSFILE, ">$varsdir/modlist.txt") || &setup_fatal_error("$maintext_23 $varsdir/modlist.txt: ", 1);         close $LOGFILE or croak 'cannot close log.txt'; 
           print MODSFILE "admin\n";     } 
           fclose(MODSFILE);  
     }     if ( !-e "$varsdir/news.txt" ) { 
         my $news = <<NEWS;
     if (!-e "$varsdir/news.txt") {  We've upgraded to YaBB 2.6.12! 
           fopen(NEWSFILE, ">$varsdir/news.txt") || &setup_fatal_error("$maintext_23 $varsdir/news.txt: ", 1);  Visit [url=http://www.yabbforum.com]YaBB[/url] today ;) 
           print NEWSFILE "Welcome to our forum.\n";  Signup for free on our forum and benefit from new features! 
           print NEWSFILE "We've upgraded to YaBB 2.5.2!\n";  Latest info can be found on the [url=http://www.yabbforum.com/community/]YaBB Chat and Support Community[/url]. 
           print NEWSFILE "Visit [url=http://www.yabbforum.com]YaBB[/url] today \;\)\n";  NEWS 
           print NEWSFILE "Signup for free on our forum and benefit from new features!\n";         open $NEWSFILE, '>', "$varsdir/news.txt" 
           print NEWSFILE "Latest info can be found on the [url=http://www.yabbforum.com/community/]YaBB Chat and Support Community[/url].\n";           || setup_fatal_error( "$maintext_23 $varsdir/news.txt: ", 1 ); 
           fclose(NEWSFILE);         print {$NEWSFILE} $news or croak 'cannot print news.txt'; 
     }         close $NEWSFILE or croak 'cannot close news.txt'; 
     }
     if (!-e "$varsdir/oldestmes.txt") {  
           fopen(OLDFILE, ">$varsdir/oldestmes.txt") || &setup_fatal_error("$maintext_23 $varsdir/oldestmes.txt: ", 1);     if ( !-e "$varsdir/oldestmes.txt" ) { 
           print OLDFILE "1\n";         open $OLDFILE, '>', "$varsdir/oldestmes.txt" 
           fclose(OLDFILE);           || setup_fatal_error( "$maintext_23 $varsdir/oldestmes.txt: ", 1 ); 
     }         print {$OLDFILE} "1\n" or croak 'cannot print oldestmes.txt'; 
         close $OLDFILE or croak 'cannot close oldestmes.txt';
     if (!-e "$varsdir/registration.log") {     } 
           fopen(REGLOG, ">$varsdir/registration.log") || &setup_fatal_error("$maintext_23 $varsdir/registration.log: ", 1);  
           print REGLOG "";     if ( !-e "$varsdir/registration.log" ) { 
           fclose(REGLOG);         open $REGLOG, '>', "$varsdir/registration.log" 
     }           || setup_fatal_error( "$maintext_23 $varsdir/registration.log: ", 1 ); 
         print {$REGLOG} q{} or croak 'cannot print registration.log';
     if (!-e "$varsdir/reserve.txt") {         close $REGLOG or croak 'cannot close registration.log'; 
           fopen(RESERVEFILE, ">$varsdir/reserve.txt") || &setup_fatal_error("$maintext_23 $varsdir/reserve.txt: ", 1);     } 
           print RESERVEFILE "yabb\n";  
           print RESERVEFILE "YaBBadmin\n";     if ( !-e "$varsdir/reserve.txt" ) { 
           print RESERVEFILE "administrator\n";         my $reserve = <<RES; 
           print RESERVEFILE "admin\n";  yabb 
           print RESERVEFILE "y2\n";  YaBBadmin 
           print RESERVEFILE "yabb2\n";  administrator 
           print RESERVEFILE "yabbforum\n";  admin 
           fclose(RESERVEFILE);  y2 
     }  xnull 
  yabb2
     if (!-e "$varsdir/reservecfg.txt") {  XIMinc
           fopen(RESERVEFILE, ">$varsdir/reservecfg.txt") || &setup_fatal_error("$maintext_23 $varsdir/reservecfg.txt: ", 1);  yabbforum 
           print RESERVEFILE "checked\n";  RES 
           print RESERVEFILE "\n";         open $RESERVEFILE, '>', "$varsdir/reserve.txt" 
           print RESERVEFILE "checked\n";           || setup_fatal_error( "$maintext_23 $varsdir/reserve.txt: ", 1 ); 
           print RESERVEFILE "checked\n";         print {$RESERVEFILE} $reserve or croak 'cannot print reserve.txt'; 
           fclose(RESERVEFILE);         close $RESERVEFILE or croak 'cannot print reserve.txt'; 
     }    }
   
     if ( !-e "$varsdir/reservecfg.txt" ) {
         my $reschk = <<RES;
  checked
   
  checked
  checked
   
  RES
         open $RESERVEFILE, '>', "$varsdir/reservecfg.txt" 
           || setup_fatal_error( "$maintext_23 $varsdir/reservecfg.txt: ", 1 );
         print {$RESERVEFILE} $reschk or croak 'cannot print reservecfg.txt';
         close $RESERVEFILE or croak 'cannot close reservecfg.txt';
     }
     return;
} }
   
sub checkmodules { sub checkmodules {
     LoadLanguage("Admin");     LoadLanguage('Admin'); 
     tempstarter();
     &tempstarter;  
   
     $yymain .= qq~  
<form action="$set_cgi?action=setinstall" method="post">~;  
   
     require "$admindir/ModuleChecker.pl";  
     $yymain =~ s/float: left; |<\/div>$//g;  
   
     if ($dont_continue_setup) {     $yymain .= qq~ 
           $yymain .= qq~  <form action="$set_cgi?action=setinstall" method="post"> 
     <table width="100%" cellspacing="1" cellpadding="4">  <p class="none"><strong>If this page is on a white background, go back and check your path settings - the url for yabbfiles is configured wrong or yabbfiles/Templates/Forum/default.css is missing.</strong></p>~; 
     <tr valign="middle">  
           <td width="100%" class="windowbg2" align="center">     require Admin::ModuleChecker; 
                 <br />     $yymain =~ s/float: left; |<\/div>$//gsm; 
                 <font color="red" size="+2">Sorry, you cannot continue until you have installed at least the "Digest::MD5" module.</font><br />  
                 <br />     if ($dont_continue_setup) { 
         $yymain .= q~
     <table class="border-space pad-cell">
         <tr>
             <td class="windowbg2 center" style="margin-top:.5em; margin-bottom:1em; color:red; font-size:large;">
                 Sorry, you cannot continue until you have installed at least the "Digest::MD5" module.
           </td>            </td>
     </tr>      </tr>
     </table>~;      </table>~;
     } else {     } 
           $yymain .= qq~     else { 
     <table width="100%" cellspacing="1" cellpadding="4">         $yymain .= q~ 
     <tr valign="middle">     <table class="border-space pad-cell"> 
           <td width="100%" class="catbg" align="center">         <tr > 
                 <br />             <td class="catbg center" style="margin-top:.5em; margin-bottom:1em"> 
                 You can always see the above information on the start page of your AdminCenter.<br />                  You can always see the above information on the start page of your AdminCenter.<br />
                 Therefore you can continue now and install missing modules later if you really need them.<br />                  Therefore you can continue now and install missing modules later if you really need them.<br />
                 <br />                  <br />
                 <input type="submit" value="Continue" /><br />                <input type="submit" value="Continue" />
                 <br />  
           </td>            </td>
     </tr>      </tr>
     </table>~;      </table>~;
     }    }
   
     $yymain .= qq~     $yymain .= q~ 
</div> </div>
</form> </form>
~; ~;
   
     $yyim    = "You are running YaBB 2.5.2 Setup.";     $yyim    = 'You are running YaBB 2.6.12 Setup.'; 
     $yytitle = "YaBB 2.5.2 Setup";     $yytitle = 'YaBB 2.6.12 Setup'; 
     &SetupTemplate;     SetupTemplate(); 
     return;
} }
   
sub SetInstall { sub SetInstall {
     LoadLanguage("Admin");     LoadLanguage('Admin'); 
     tempstarter();
     &tempstarter;  
   
     # show avaliable languages    # show available languages
     opendir(DIR, $langdir) || &setup_fatal_error("Directory: $langdir: ", 1);     opendir DIR, $langdir 
     my @lfilesanddirs = readdir(DIR);       || setup_fatal_error( "Directory: $langdir: ", 1 ); 
     close(DIR);     my @lfilesanddirs = readdir DIR; 
     my $drawnldirs;     closedir DIR; 
     foreach my $fld (sort {lc($a) cmp lc($b)} @lfilesanddirs) {     my $drawnldirs; 
           if (-d "$langdir/$fld" && -e "$langdir/$fld/Main.lng" && $fld =~ m^\A[0-9a-zA-Z_\#\%\-\:\+\?\$\&\~\,\@/]+\Z^) {     foreach my $fld ( sort { lc($a) cmp lc $b } @lfilesanddirs ) { 
                 if ('English' eq $fld) { $drawnldirs .= qq~<option value="$fld" selected="selected">$fld</option>\n~; }         if (   -d "$langdir/$fld" 
                 else { $drawnldirs .= qq~<option value="$fld">$fld</option>\n~; }             && -e "$langdir/$fld/Main.lng" 
           }             && $fld =~ m{\A[0-9a-zA-Z_\#\%\-\:\+\?\$\&\~\,\@/]+\Z}sm ) 
     }         { 
             if ( 'English' eq $fld ) {
                 $drawnldirs .=
                   qq~<option value="$fld" selected="selected">$fld</option>\n~;
             }
             else { $drawnldirs .= qq~<option value="$fld">$fld</option>\n~; }
         }
     }
   
     $yymain .= qq~    $yymain .= qq~
<form action="$set_cgi?action=setinstall2" method="post"> <form action="$set_cgi?action=setinstall2" method="post">
<div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  <div class="bordercolor borderbox"> 
  <table width="100%" cellspacing="1" cellpadding="4">     <table class="tabtitle"> 
     <tr valign="middle">         <tr> 
           <td width="100%" class="titlebg" align="left">             <td style="padding-left:1%">System Setup</td> 
           System Setup         </tr> 
           </td>     </table> 
     </tr><tr valign="middle">     <table class="border-space pad-cell"> 
           <td width="100%" class="windowbg" align="left">         <tr> 
           Here you can set some of the default settings for your new YaBB 2.5.2 forum.<br />             <td class="windowbg"> 
           After finishing the setup procedure, you should login to your forum and go to your 'Admin Center' -&gt; 'Forum Settings' where you can modify this and other settings.                 Here you can set some of the default settings for your new YaBB 2.6.12 forum.<br /> 
           </td>                 After finishing the setup procedure, you should login to your forum and go to your 'Admin Center' -&gt; 'Forum Settings' where you can modify this and other settings. 
     </tr><tr valign="middle">             </td> 
           <td width="100%" class="windowbg2" align="left">         </tr><tr> 
           <div style="float: left; font-family: verdana; width: 45%; text-align: left; font-size: 12px; padding-top: 2px; padding-bottom: 2px;">             <td class="windowbg2"> 
           <label for="mbname">Message Board Name</label>                 <div class="div45"> 
           </div>                     <label for="mbname">Message Board Name</label> 
           <div style="float: left; font-family: verdana; width: 55%; text-align: left; font-size: 12px; padding-top: 2px; padding-bottom: 2px;">                 </div> 
           <input type="text" name="mbname" id="mbname" size="35" value="My Perl YaBB Forum" />                 <div class="div55"> 
           </div>                     <input type="text" name="mbname" id="mbname" size="35" value="My Perl YaBB Forum" /> 
     <br />                 </div> 
           <div style="float: left; font-family: verdana; width: 45%; text-align: left; font-size: 12px; padding-top: 2px; padding-bottom: 2px;">                 <br style="clear:both" /> 
           <label for="webmaster_email">Webmaster E-mail Address</label>                 <div class="div45"> 
                     <label for="webmaster_email">Webmaster E-mail Address</label>
                 </div>
                 <div class="div55">
                     <input type="text" name="webmaster_email" id="webmaster_email" size="35" value="webmaster\@mysite.com" />
                 </div>
                 <br style="clear:both" />
                 <div class="div45">
                     <label for="defaultlanguage">Admin Language / Forum Default Language</label>
                 </div>
                 <div class="div55">
                     <select name="defaultlanguage" id="defaultlanguage">$drawnldirs</select>
                 </div>
                 <br style="clear:both" />
                 <div class="div45">
                     <label for="defaultencoding">Default Forum Character Encoding
                     <br /><span class="small"><b>Note</b>: If you are going to import an older forum choose 'ISO-8859-1'.</span></label>
                 </div>
                 <div class="div55">
                     <select name="defaultencoding" id="defaultencoding" size="1">
                         <option value="UTF-8">UTF-8</option>
                         <option value="ISO-8859-1">ISO-8859-1</option>
                     </select>
                 </div>
                 <br style="clear:both" />
                 <div class="div45">
                     <label for="timeselect">Default Time Format</label>
                 </div>
                 <div class="div55">
                     <select name="timeselect" id="timeselect" size="1">
                         <option value="1">01/31/01 at 13:15:17</option>
                         <option value="5">01/31/01 at 1:15pm</option>
                         <option value="4" selected="selected">Jan 12th, 2001 at 1:15pm</option>
                         <option value="8"> 12th Jan, 2001 at 1:15pm</option>
                         <option value="2">31.01.01 at 13:15:17</option>
                         <option value="3">31.01.2001 at 13:15:17</option>
                         <option value="6">31. Jan at 13:15</option>
                     </select>
                 </div>
                 <br style="clear:both" />
                 <div class="div45">
                     Forum Time: (Your actual displayed UTC time). The Forum Time Zone can be changed in the Admin Center.
                 </div>
                 <div class="div55">
                     <b>~
       . timeformat( $date, 4 ) . q~</b>
           </div>            </div>
           <div style="float: left; font-family: verdana; width: 55%; text-align: left; font-size: 12px; padding-top: 2px; padding-bottom: 2px;">  
           <input type="text" name="webmaster_email" id="webmaster_email" size="35" value="webmaster\@mysite.com" />  
           </div>  
     <br />  
           <div style="float: left; font-family: verdana; width: 45%; text-align: left; font-size: 12px; padding-top: 2px; padding-bottom: 2px;">  
           <label for="defaultlanguage">Admin Language / Forum Default Language</label>  
           </div>  
           <div style="float: left; font-family: verdana; width: 55%; text-align: left; font-size: 12px; padding-top: 2px; padding-bottom: 2px;">  
           <select name="defaultlanguage" id="defaultlanguage">$drawnldirs</select>  
           </div>  
     <br />  
           <div style="float: left; font-family: verdana; width: 45%; text-align: left; font-size: 12px; padding-top: 2px; padding-bottom: 2px;">  
           <label for="timeselect">Default Time Format</label>  
           </div>  
           <div style="float: left; font-family: verdana; width: 55%; text-align: left; font-size: 12px; padding-top: 2px; padding-bottom: 2px;">  
           <select name="timeselect" id="timeselect" size="1">  
                 <option value="1">01/31/01 at 13:15:17</option>  
                 <option value="5">01/31/01 at 1:15pm</option>  
                 <option value="4" selected="selected">Jan 12th, 2001 at 1:15pm</option>  
                 <option value="8"> 12th Jan, 2001 at 1:15pm</option>  
                 <option value="2">31.01.01 at 13:15:17</option>  
                 <option value="3">31.01.2001 at 13:15:17</option>  
                 <option value="6">31. Jan at 13:15</option>  
           </select>  
           </div>  
     <br />  
           <div style="float: left; font-family: verdana; width: 45%; text-align: left; font-size: 12px; padding-top: 2px; padding-bottom: 2px;">  
           Forum Time Zone<br />  
           <span style="font-size:small">If the time displayed here differs from your local time, then adjust it by changing the settings.</span>  
           </div>  
           <div style="float: left; font-family: verdana; width: 55%; text-align: left; font-size: 12px; padding-top: 2px; padding-bottom: 2px;">  
                 <span style="font-size:small">Your actually displayed local time:<br /><b>~ . &timeformat($date,4) . qq~<br /><br /></span><select name="usertimesign"><option value="">+</option><option value="-">-</option></select>  
                 <select name="usertimehour">~;  
     for (my $i = 0; 15 > $i; $i++) {  
           $i = sprintf("%02d", $i);  
           $yymain .= qq~<option value="$i">$i</option>~;  
     }  
     $yymain .= qq~</select> : <select name="usertimemin">~;  
     for (my $i = 0; 60 > $i; $i++) {  
           my $j = $i / 60;  
           $j = (split(/\./, $j))[1] || 0;  
           $yymain .= qq~<option value="$j">~ . sprintf("%02d", $i) . qq~</option>~;  
     }  
     $yymain .= qq~</select>  
           </div>  
           <input type="hidden" name="dstoffset" value="1" />  
     <br />  
           </td>            </td>
     </tr>     </tr><tr> 
     <tr valign="middle">         <td class="catbg center"> 
           <td width="100%" class="catbg" align="center">  
           <input type="submit" value="Continue" />            <input type="submit" value="Continue" />
           </td>            </td>
     </tr>      </tr>
     </table>      </table>
</div> </div>
</form> </form>
~; ~;
   
     $yyim    = "You are running YaBB 2.5.2 Setup.";     $yyim    = 'You are running YaBB 2.6.12 Setup.'; 
     $yytitle = "YaBB 2.5.2 Setup";     $yytitle = 'YaBB 2.6.12 Setup'; 
     &SetupTemplate;     SetupTemplate(); 
     return;
} }
   
sub SetInstall2 { sub SetInstall2 {
     if ($action eq "checkmodules" || $action eq "setinstall2") {    if ( $action eq 'checkmodules' || $action eq 'setinstall2' ) {
           $settings_file_version = "YaBB 0.0.0";         $settings_file_version = 'YaBB 2.6.12'; 
           $maintenance = 1;         $yymycharset           = $FORM{'defaultencoding'} || 'UTF-8'; 
           $rememberbackup = 0;         $maintenance           = 1; 
           $guestaccess = 1;         $rememberbackup        = 0; 
           $mbname = $FORM{'mbname'} || 'My Perl YaBB Forum';         $guestaccess           = 1; 
           $mbname =~ s/\"/\'/g; #'" make my syntax checker happy;         $mbname                = $FORM{'mbname'} || 'My Perl YaBB Forum'; 
           $forumstart = &timetostring(int(time));         $mbname =~ s/\x22/\x27/gxsm; 
           $Cookie_Length = 1;         $forumstart            = timetostring( int time ); 
           $regtype = 3;         $Cookie_Length         = 1; 
           $RegAgree = 1;         $regtype               = 3; 
           $RegReasonSymbols = 500;         $RegAgree              = 1; 
           $preregspan = 24;         $RegReasonSymbols      = 500; 
           $emailpassword = 0;         $preregspan            = 24; 
           $emailnewpass = 0;        $emailpassword         = 0;
           $emailwelcome = 0;        $emailnewpass          = 0;
           $name_cannot_be_userid = 1;         $emailwelcome          = 0; 
           $gender_on_reg = 0;         $name_cannot_be_userid = 1; 
           $lang = $FORM{'defaultlanguage'} || 'English';         $gender_on_reg         = 0; 
           $default_template = 'Forum default';         $lang                  = $FORM{'defaultlanguage'} || 'English'; 
           $mailprog = '/usr/sbin/sendmail';         $default_template      = 'Forum default'; 
           $smtp_server = "127.0.0.1";         $mailprog              = '/usr/sbin/sendmail'; 
           $smtp_auth_required  = 1;         $smtp_server           = '127.0.0.1'; 
           $authuser = q^admin^;         $smtp_auth_required    = 1; 
           $authpass = q^admin^;         $authuser              = q~admin~; 
           $webmaster_email = $FORM{'webmaster_email'} || 'webmaster@mysite.com';         $authpass              = q~admin~; 
           $mailtype = 0;         $webmaster_email = $FORM{'webmaster_email'} || 'webmaster@mysite.com'; 
           $maintenancetext = 'We are currently upgrading our forum again. Please check back shortly!';         $mailtype        = 0; 
           $MenuType = 2;         $maintenancetext = 
           $profilebutton = 0;  'We are currently upgrading our forum again. Please check back shortly!'; 
           $allow_hide_email = 1;         $MenuType               = 2; 
           $showlatestmember = 1;        $profilebutton          = 1;
           $shownewsfader = 0;         $allow_hide_email       = 1; 
           $Show_RecentBar = 1;        $showlatestmember       = 1;
           $showmodify = 1;         $shownewsfader          = 0; 
           $ShowBDescrip = 1;        $Show_RecentBar         = 1;
           $showuserpic = 1;        $showmodify             = 1;
           $showusertext = 1;        $ShowBDescrip           = 1;
           $showtopicviewers = 1;        $showuserpic            = 1;
           $showtopicrepliers = 1;        $showusertext           = 1;
           $showgenderimage = 1;        $showtopicviewers       = 1;
           $showyabbcbutt = 1;        $showtopicrepliers      = 1;
           $nestedquotes = 1;        $showgenderimage        = 1;
           $parseflash = 0;         $showyabbcbutt          = 1; 
           $enableclicklog = 0;         $nestedquotes           = 1; 
           $showimageinquote = 0;        $parseflash             = 0;
           $enable_ubbc = 1;         $enableclicklog         = 0; 
           $enable_news = 1;         $showimageinquote       = 0; 
           $allowpics = 1;        $enable_ubbc            = 1;
           $upload_useravatar = 0;         $enable_news            = 1; 
           $upload_avatargroup = '';         $allowpics              = 1; 
           $avatar_limit = 100;         $upload_useravatar      = 0; 
           $avatar_dirlimit = 10000;         $upload_avatargroup     = q{}; 
           $enable_guestposting = 0;         $avatar_limit           = 100; 
           $ML_Allowed = 1;         $avatar_dirlimit        = 10_000; 
           $enable_quickpost = 0;        $enable_guestposting    = 0;
           $enable_quickreply = 0;         $ML_Allowed             = 1; 
           $enable_quickjump = 0;        $enable_quickpost       = 0;
           $enable_markquote = 0;        $enable_quickreply      = 0;
           $quick_quotelength = 1000;         $enable_quickjump       = 0; 
           $enable_quoteuser = 0;        $enable_markquote       = 0;
           $quoteuser_color = "#0033cc";         $quick_quotelength      = 1000; 
           $guest_media_disallowed = 0;        $enable_quoteuser       = 0;
           $enable_guestlanguage = 1;         $quoteuser_color        = '#0033cc'; 
           $enable_notifications = 0;        $guest_media_disallowed = 0;
           $NewNotificationAlert = 0;         $enable_guestlanguage   = 1; 
           $autolinkurls = 1;         $enable_notifications   = 0; 
           $forumnumberformat = $FORM{'forumnumberformat'} || 1;         $NewNotificationAlert   = 0; 
           $timeselected = $FORM{'timeselect'} || 0;         $autolinkurls           = 1; 
           $timecorrection = 0;         $forumnumberformat      = $FORM{'forumnumberformat'} || 1; 
           $timeoffset = "$FORM{'usertimesign'}$FORM{'usertimehour'}.$FORM{'usertimemin'}";         $timeselected           = $FORM{'timeselect'} || 0; 
           $dstoffset = $FORM{'dstoffset'} || 0;        $timecorrection         = 0;
           $dynamic_clock = 1;         $enabletz               = 0; 
           $TopAmmount = 15;         $default_tz             = 'UTC'; 
           $maxdisplay = 20;         $dynamic_clock          = 1; 
           $maxfavs = 20;         $TopAmmount             = 15; 
           $maxrecentdisplay = 25;         $maxdisplay             = 20; 
           $maxsearchdisplay = 15;         $maxfavs                = 20; 
           $maxmessagedisplay = 15;         $maxrecentdisplay       = 25; 
           $MaxMessLen = 5500;         $maxrecentdisplay_t     = 25; 
           $fontsizemin = 6;         $maxsearchdisplay       = 15; 
           $fontsizemax = 32;         $maxmessagedisplay      = 15; 
           $MaxSigLen = 200;         $MaxMessLen             = 5000; 
           $MaxAwayLen = 200;         $AdMaxMessLen           = 5000; 
           $ClickLogTime = 100;         $MaxIMMessLen           = 2000; 
           $max_log_days_old = 90;         $AdMaxIMMessLen         = 3000; 
           $fadertime = 1000;         $MaxCalMessLen          = 200; 
           $defaultusertxt = 'I Love YaBB 2.5.2!';         $AdMaxCalMessLen        = 300; 
           $timeout = 5;         $fontsizemin            = 6; 
           $HotTopic = 10;         $fontsizemax            = 32; 
           $VeryHotTopic = 25;         $MaxSigLen              = 200; 
           $barmaxdepend = 0;         $MaxAwayLen             = 200; 
           $barmaxnumb = 500;         $ClickLogTime           = 100; 
           $defaultml = 'regdate';         $max_log_days_old       = 90; 
           $max_avatar_width = 65;         $fadertime              = 1000; 
           $max_avatar_height = 65;         $defaultusertxt         = 'I Love YaBB 2.6.12!'; 
           $fix_avatar_img_size = 0;         $timeout                = 5; 
           $max_post_img_width = 0;         $HotTopic               = 10; 
           $max_post_img_height = 0;         $VeryHotTopic           = 25; 
           $fix_post_img_size = 0;        $barmaxdepend           = 0;
           $max_signat_img_width = 0;         $barmaxnumb             = 500; 
           $max_signat_img_height = 0;         $defaultml              = 'regdate'; 
           $fix_signat_img_size = 0;         $max_avatar_width       = 65; 
           $max_attach_img_width = 0;         $max_avatar_height      = 65; 
           $max_attach_img_height = 0;        $fix_avatar_img_size    = 0;
           $fix_attach_img_size = 0;         $max_avatarml_width     = 65; 
           $img_greybox = 1;         $max_avatarml_height    = 65; 
           $extendedprofiles = 0;        $fix_avatarml_img_size  = 0;
           $enable_freespace_check = 0;         $max_post_img_width     = 400; 
           if (-e "/bin/gzip" && open(GZIP, "| gzip -f")) {         $max_post_img_height    = 0; 
                 $gzcomp = 1;         $fix_post_img_size      = 0; 
           } else {         $max_signat_img_width   = 300; 
                 eval { require Compress::Zlib; Compress::Zlib::memGzip("test"); };         $max_signat_img_height  = 0; 
                 $gzcomp = $@ ? 0 : 2;         $fix_signat_img_size    = 0; 
           }         $max_attach_img_width   = 200; 
           $gzforce = 0;        $max_attach_img_height  = 0;
           $cachebehaviour = 0;        $fix_attach_img_size    = 0;
           $use_flock = 1;         $max_brd_img_width      = 50; 
           $faketruncation = 0;         $max_brd_img_height     = 50; 
           $debug = 0;        $fix_brd_img_size       = 0;
         $img_greybox            = 1;
           $checkallcaps = 6;         $extendedprofiles       = 0; 
           $set_subjectMaxLength = 50;         $enable_freespace_check = 0; 
           $MaxMessLen = 2000;         $enableguestsearch      = 1; 
           $honeypot = 1;        $enableguestquicksearch = 1;
           $spamfruits = 0;         $showregdate            = 1; 
           $speedpostdetection = 1;        $addtab_on              = 1;
           $spd_detention_time = 300;         $bm_subcut              = 50; 
           $min_post_speed = 2;         $maxadminlog            = 5; 
           $post_speed_count = 3;  
           $minlinkpost = 0;         if ( -e '/bin/gzip' && open GZIP, '|, gzip -f' ) { 
           $minlinksig = 0;             $gzcomp = 1; 
           $minlinkweb = 0;         } 
         else {
           $maxsteps = 40;             eval { require Compress::Zlib; Compress::Zlib::memGzip('test'); }; 
           $stepdelay = 75;             $gzcomp = $@ ? 0 : 2; 
           $fadelinks = 0;         } 
         $gzforce        = 0;
           # Let's generate them a masterkey at setup time.         $cachebehaviour = 0; 
           my @chars = ('A' .. 'Z', 'a' .. 'z', 0 .. 9);         $use_flock      = 0; 
           $masterkey .= $chars[rand @chars] for 1 .. 24;         $faketruncation = 0; 
         $debug          = 0;
     } else {  
           $forumstart = &timetostring($INFO{'firstforum'});         $checkallcaps           = 0; 
           $MaxSigLen  = $siglength || 200;         $set_subjectMaxLength   = 50; 
           $fadertime  = 1000;         $honeypot               = 1; 
     }         $speedpostdetection     = 1; 
         $spd_detention_time     = 300;
         $min_post_speed         = 2;
         $post_speed_count       = 3;
         $minlinkpost            = 0;
         $minlinksig             = 0;
         $minlinkweb             = 0;
         $showsearchboxnum       = 31;
         $showregdate            = 1;
         $enableguestsearch      = 1;
         $enableguestquicksearch = 1;
         $maxsteps               = 40;
         $stepdelay              = 75;
         $fadelinks              = 0;
         $cookieviewtime         = 525_600;
   
         # Let's generate a masterkey at setup time.
         my @chars = ( 'A' .. 'Z', 'a' .. 'z', 0 .. 9 );
         for ( 1 .. 24 ) { $masterkey .= $chars[ rand @chars ]; }
   
     }
     else {
         $forumstart = timetostring( $INFO{'firstforum'} );
         $MaxSigLen  = $siglength || 200;
         $fadertime  = 1000;
     }
   
     my $setfile = << "EOF";     my $setfile = <<EOF; 
############################################################################### ###############################################################################
# Settings.pl                                                                 # # Settings.pm                                                                 #
############################################################################### ###############################################################################
# YaBB: Yet another Bulletin Board                                            # # YaBB: Yet another Bulletin Board                                            #
# Open-Source Community Software for Webmasters                               # # Open-Source Community Software for Webmasters                               #
# Version:        YaBB 2.5.2                                                  # # Version:        YaBB 2.6.12                                                 #
# Packaged:       September 30, 2012                                          # # Packaged:       December 2, 2014                                            #
# Distributed by: http://www.yabbforum.com                                    # # Distributed by: http://www.yabbforum.com                                    #
# =========================================================================== # # =========================================================================== #
# Copyright (c) 2000-2012  YaBB (www.yabbforum.com) - All Rights Reserved.    # # Copyright (c) 2000-2016  YaBB (www.yabbforum.com) - All Rights Reserved.    #
# Software by:  The YaBB Development Team                                     # # Software by:  The YaBB Development Team                                     #
#               with assistance from the YaBB community.                      # #               with assistance from the YaBB community.                      #
############################################################################### ###############################################################################
   
########## Board Info ########## ########## Board Info ##########
# Note: these settings must be properly changed for YaBB to work # Note: these settings must be properly changed for YaBB to work
   
\$settings_file_version = "$settings_file_version"; # If not equal actual YaBBversion then the updating process is run through \$settings_file_version = "$settings_file_version"; # If not equal actual YaBBversion then the updating process is run through
  \$yymycharset = "$yymycharset";                        # character encoding (usually ISO-8859-1 for older forums)
                                             # or 'UTF-8';
\%templateset = ( \%templateset = (
'Forum default' => "default|default|default|default|default|default|default|", 'Forum default' => "default|default|default|default|default|default|default|",
'Old YaBB 2.1 style' => "yabb21|yabb21|yabb21|yabb21|yabb21|yabb21|yabb21|",  
'Old YaBB 2.5 style' => "yabb25|yabb25|yabb25|yabb25|yabb25|yabb25|yabb25|",  
'Blue_1' => "blue_1|blue_1|blue_1|blue_1|blue_1|blue_1|blue_1|",  
);                                                  # Forum templates settings );                                                  # Forum templates settings
   
\$maintenance = $maintenance;                       # Set to 1 to enable Maintenance mode \$maintenance = $maintenance;                       # Set to 1 to enable Maintenance mode
\$rememberbackup = $rememberbackup;                 # seconds past since last backup until alert is displayed \$rememberbackup = $rememberbackup;                 # seconds past since last backup until alert is displayed
\$guestaccess = $guestaccess;                       # Set to 0 to disallow guests from doing anything but login or register \$guestaccess = $guestaccess;                       # Set to 0 to disallow guests from doing anything but login or register
   
\$mbname = q^$mbname^;                              # The name of your YaBB forum \$mbname = q^$mbname^;                              # The name of your YaBB forum
\$forumstart = "$forumstart";                       # The start date of your YaBB Forum \$forumstart = "$forumstart";                       # The start date of your YaBB Forum
\$Cookie_Length = $Cookie_Length;                   # Default minutes to set login cookies to stay for \$Cookie_Length = $Cookie_Length;                   # Default to set login cookies to stay for
\$cookieusername = "$cookieusername";               # Name of the username cookie \$cookieusername = "$cookieusername";               # Name of the username cookie
\$cookiepassword = "$cookiepassword";               # Name of the password cookie \$cookiepassword = "$cookiepassword";               # Name of the password cookie
\$cookiesession_name = "$cookiesession_name";       # Name of the Session cookie \$cookiesession_name = "$cookiesession_name";       # Name of the Session cookie
  \$cookietsort = "$cookietsort";                     # Name of the Topic Sort
  \$cookieview = "$cookieview";                       # Name of the Guest Message Limit cookie
  \$cookieviewtime = "$cookieviewtime";
  \$screenlogin = $screenlogin;                # allow members to login using their screen name.
   
\$regtype = $regtype;                               # 0 = registration closed (only admin can register), \$regtype = $regtype;                               # 0 = registration closed (only admin can register),
                                                   # 1 = pre registration with admin approval,                                                    # 1 = pre registration with admin approval,
                                                   # 2 = pre registration and email activation, 3 = open registration                                                    # 2 = pre registration and email activation, 3 = open registration
   
\$RegAgree = $RegAgree;                             # Set to 1 to display the registration agreement when registering \$RegAgree = $RegAgree;                             # Set to 1 to display the registration agreement when registering
\$RegReasonSymbols = $RegReasonSymbols;             # Maximum allowed symbols in User reason(s) for registering \$RegReasonSymbols = $RegReasonSymbols;             # Maximum allowed symbols in User reason(s) for registering
\$preregspan = $preregspan;                         # Time span in hours for users to account activation before cleanup. \$preregspan = $preregspan;                         # Time span in hours for users to account activation before cleanup.
\$pwstrengthmeter_scores = "10,15,30,40";           # Password-Strength-Meter Scores \$pwstrengthmeter_scores = "10,15,30,40";           # Password-Strength-Meter Scores
\$pwstrengthmeter_common = qq~"123","123456"~;      # Password-Strength-Meter common words \$pwstrengthmeter_common = qq~"123","123456"~;      # Password-Strength-Meter common words
\$pwstrengthmeter_minchar = 5;                      # Password-Strength-Meter minimum characters \$pwstrengthmeter_minchar = 5;                      # Password-Strength-Meter minimum characters
\$emailpassword = $emailpassword;                   # 0 - instant registration. 1 - password emailed to new members \$emailpassword = $emailpassword;                   # 0 - instant registration. 1 - password emailed to new members
\$emailnewpass = $emailnewpass;                     # Set to 1 to email a new password to members if \$emailnewpass = $emailnewpass;                     # Set to 1 to email a new password to members if
                                                   # they change their email address                                                    # they change their email address
\$emailwelcome = $emailwelcome;                     # Set to 1 to email a welcome message to users even \$emailwelcome = $emailwelcome;                     # Set to 1 to email a welcome message to users even
                                                   # when you have mail password turned off                                                    # when you have mail password turned off
\$name_cannot_be_userid = $name_cannot_be_userid;   # Set to 1 to require users to have different usernames and display names \$name_cannot_be_userid = $name_cannot_be_userid;   # Set to 1 to require users to have different usernames and display names
   
\$gender_on_reg = $gender_on_reg;                   # 0: do not ask for gender on registration \$gender_on_reg = $gender_on_reg;                   # 0: do not ask for gender on registration
                                                   # 1: ask for gender, no input required                                                    # 1: ask for gender, no input required
                                                   # 2: ask for gender, input required                                                    # 2: ask for gender, input required
\$lang = "$lang";                                   # Default Forum Language \$lang = "$lang";                                   # Default Forum Language
\$default_template = "$default_template";           # Default Forum Template \$default_template = "$default_template";           # Default Forum Template
   
\$mailprog = "$mailprog";                           # Location of your sendmail program \$mailprog = "$mailprog";                           # Location of your sendmail program
\$smtp_server = "$smtp_server";                     # Address of your SMTP-Server (for Net::SMTP::TLS, specify the port number with a ":<portnumber>" at the end) \$smtp_server = "$smtp_server";                     # Address of your SMTP-Server (for Net::SMTP::TLS, specify the port number with a ":<portnumber>" at the end)
\$smtp_auth_required = $smtp_auth_required;         # Set to 1 if the SMTP server requires Authorisation \$smtp_auth_required = $smtp_auth_required;         # Set to 1 if the SMTP server requires Authorisation
\$authuser = q^$authuser^;                          # Username for SMTP authorisation \$authuser = q^$authuser^;                          # Username for SMTP authorisation
\$authpass = q^$authpass^;                          # Password for SMTP authorisation \$authpass = q^$authpass^;                          # Password for SMTP authorisation
\$webmaster_email = q^$webmaster_email^;            # Your email address. (eg: \$webmaster_email = q^admin\@host.com^;) \$webmaster_email = q^$webmaster_email^;            # Your email address. (eg: \$webmaster_email = q^admin\@host.com^;)
\$mailtype = $mailtype;                             # Mail program to use: 0 = sendmail, 1 = SMTP, 2 = Net::SMTP, 3 = Net::SMTP::TLS \$mailtype = $mailtype;                             # Mail program to use: 0 = sendmail, 1 = SMTP, 2 = Net::SMTP, 3 = Net::SMTP::TLS
   
\$UseHelp_Perms = 1;                                # Help Center: 1 == use permissions, 0 == do not use permissions \$UseHelp_Perms = 1;                                # Help Center: 1 == use permissions, 0 == do not use permissions
   
########## MemberGroups ########## ########## MemberGroups ##########
   
\$Group{'Administrator'} = "YaBB Administrator|5|staradmin.gif|red|0|0|0|0|0|0";  \$Group{'Administrator'} = 'Forum Administrator|5|staradmin.png|#FF0000|0|0|0|0|0|0|0'; 
\$Group{'Global Moderator'} = "Global Moderator|5|stargmod.gif|blue|0|0|0|0|0|0";  \$Group{'Global Moderator'} = 'Global Moderator|5|stargmod.png|#0000FF|0|0|0|0|0|0|0'; 
\$Group{'Moderator'} = "YaBB Moderator|5|starmod.gif|green|0|0|0|0|0|0";  \$Group{'Mid Moderator'} = 'Forum Moderator|5|starfmod.png|#008080|0|0|0|0|0|0|0'; 
\$Post{'500'} = "God Member|5|starsilver.gif||0|0|0|0|0|0";  \$Group{'Moderator'} = 'Board Moderator|5|starmod.png|#008000|0|0|0|0|0|0|0'; 
\$Post{'250'} = "Senior Member|4|stargold.gif||0|0|0|0|0|0";  \$Post{'500'} = "God Member|5|starsilver.png||0|0|0|0|0|0"; 
\$Post{'100'} = "Full Member|3|starblue.gif||0|0|0|0|0|0";  \$Post{'250'} = "Senior Member|4|stargold.png||0|0|0|0|0|0"; 
\$Post{'50'} = "Junior Member|2|stargold.gif||0|0|0|0|0|0";  \$Post{'100'} = "Full Member|3|starblue.png||0|0|0|0|0|0"; 
\$Post{'-1'} = "YaBB Newbies|1|stargold.gif||0|0|0|0|0|0";  \$Post{'50'} = "Junior Member|2|stargold.png||0|0|0|0|0|0"; 
  \$Post{'-1'} = "New Member|1|stargold.png||0|0|0|0|0|0";
   
########## Layout ########## ########## Layout ##########
   
\$maintenancetext = "$maintenancetext";             # User-defined text for Maintenance mode (leave blank for default text) \$maintenancetext = "$maintenancetext";             # User-defined text for Maintenance mode (leave blank for default text)
\$MenuType = $MenuType;                             # 1 for text menu or anything else for images menu \$MenuType = $MenuType;                             # 1 for text menu or anything else for images menu
\$profilebutton = $profilebutton;                   # 1 to show view profile button under post, or 0 for blank \$profilebutton = $profilebutton;                   # 1 to show view profile button under post, or 0 for blank
\$allow_hide_email = $allow_hide_email;             # Allow users to hide their email from public. Set 0 to disable \$allow_hide_email = $allow_hide_email;             # Allow users to hide their email from public. Set 0 to disable
\$showlatestmember = $showlatestmember;             # Set to 1 to display "Welcome Newest Member" on the Board Index \$showlatestmember = $showlatestmember;             # Set to 1 to display "Welcome Newest Member" on the Board Index
\$shownewsfader = $shownewsfader;                   # 1 to allow or 0 to disallow NewsFader javascript on the Board Index \$shownewsfader = $shownewsfader;                   # 1 to allow or 0 to disallow NewsFader javascript on the Board Index
                                                   # If 0, you'll have no news at all unless you put <yabb news> tag                                                    # If 0, you'll have no news at all unless you put in a {yabb news} tag
                                                   # back into template.html!!!                                                    # back into template.html!!!
\$Show_RecentBar = $Show_RecentBar;                 # Set to 1 to display the Recent Post on Board Index \$Show_RecentBar = $Show_RecentBar;                 # Set to 1 to display the Recent Post on Board Index
\$showmodify = $showmodify;                         # Set to 1 to display "Last modified: Realname - Date" under each message \$showmodify = $showmodify;                         # Set to 1 to display "Last modified: Realname - Date" under each message
\$ShowBDescrip = $ShowBDescrip;                     # Set to 1 to display board descriptions on the topic (message) index for each board \$ShowBDescrip = $ShowBDescrip;                     # Set to 1 to display board descriptions on the topic (message) index for each board
\$showuserpic = $showuserpic;                       # Set to 1 to display each member's picture in the \$showuserpic = $showuserpic;                       # Set to 1 to display each member's picture in the
                                                   # message view (by the ICQ.. etc.)                                                    # message view (by the ICQ.. etc.)
\$showusertext = $showusertext;                     # Set to 1 to display each member's personal text \$showusertext = $showusertext;                     # Set to 1 to display each member's personal text
                                                   # in the message view (by the ICQ.. etc.)                                                    # in the message view (by the ICQ.. etc.)
\$showtopicviewers = $showtopicviewers;             # Set to 1 to display members viewing a topic \$showtopicviewers = $showtopicviewers;             # Set to 1 to display members viewing a topic
\$showtopicrepliers = $showtopicrepliers;           # Set to 1 to display members replying to a topic \$showtopicrepliers = $showtopicrepliers;           # Set to 1 to display members replying to a topic
\$showgenderimage = $showgenderimage;               # Set to 1 to display each member's gender in the \$showgenderimage = $showgenderimage;               # Set to 1 to display each member's gender in the
                                                   # message view (by the ICQ.. etc.)                                                    # message view (by the ICQ.. etc.)
\$showyabbcbutt = $showyabbcbutt;                   # Set to 1 to display the yabbc buttons on Posting and IM Send Pages \$showyabbcbutt = $showyabbcbutt;                   # Set to 1 to display the yabbc buttons on Posting and IM Send Pages
\$nestedquotes = $nestedquotes;                     # Set to 1 to allow quotes within quotes \$nestedquotes = $nestedquotes;                     # Set to 1 to allow quotes within quotes
                                                   # (0 will filter out quotes within a quoted message)                                                    # (0 will filter out quotes within a quoted message)
\$parseflash = $parseflash;                         # Set to 1 to parse the flash tag \$parseflash = $parseflash;                         # Set to 1 to parse the flash tag
\$enableclicklog = $enableclicklog;                 # Set to 1 to track stats in Clicklog (this may slow your board down) \$enableclicklog = $enableclicklog;                 # Set to 1 to track stats in Clicklog (this may slow your board down)
\$showimageinquote = $showimageinquote;             # Set to 1 to shows images in quotes, 0 displays a link to the image \$showimageinquote = $showimageinquote;             # Set to 1 to shows images in quotes, 0 displays a link to the image
  \$showregdate = $showregdate;                       # Set to 1 to show date of registration.
\@pallist = ("#ff0000","#00ff00","#0000ff","#00ffff","#ff00ff","#ffff00"); # color settings of the palette \@pallist = ("#ff0000","#00ff00","#0000ff","#00ffff","#ff00ff","#ffff00"); # color settings of the palette
   
########## Feature Settings ########## ########## Feature Settings ##########
   
\$enable_ubbc = $enable_ubbc;                       # Set to 1 if you want to enable UBBC (Uniform Bulletin Board Code) \$enable_ubbc = $enable_ubbc;                       # Set to 1 if you want to enable UBBC (Uniform Bulletin Board Code)
\$enable_news = $enable_news;                       # Set to 1 to turn news on, or 0 to set news off \$enable_news = $enable_news;                       # Set to 1 to turn news on, or 0 to set news off
\$allowpics = $allowpics;                           # set to 1 to allow members to choose avatars in their profile \$allowpics = $allowpics;                           # set to 1 to allow members to choose avatars in their profile
\$upload_useravatar = $upload_useravatar;           # set to 1 to allow members to upload avatars for their profile \$upload_useravatar = $upload_useravatar;           # set to 1 to allow members to upload avatars for their profile
\$upload_avatargroup = '$upload_avatargroup';       # membergroups allowed to upload avatars for their profile, '' == all members \$upload_avatargroup = '$upload_avatargroup';       # membergroups allowed to upload avatars for their profile, '' == all members
\$avatar_limit = $avatar_limit;                     # set to the maximum size of the uploaded avatar, 0 == no limit \$avatar_limit = $avatar_limit;                     # set to the maximum size of the uploaded avatar, 0 == no limit
\$avatar_dirlimit = $avatar_dirlimit;               # set to the maximum size of the upload avatar directory, 0 == no limit \$avatar_dirlimit = $avatar_dirlimit;               # set to the maximum size of the upload avatar directory, 0 == no limit
  \$default_avatar = $default_avatar;                 # Set to 1 to show a default avatar if the member hasn't added a picture
  \$default_userpic = "\Q$default_userpic\E";         # Set the file name for the default avatar
   
\$enable_guestposting = $enable_guestposting;       # Set to 0 if do not allow 1 is allow. \$enable_guestposting = $enable_guestposting;       # Set to 0 if do not allow 1 is allow.
\$guest_media_disallowed = $guest_media_disallowed; # disallow browsing guests to see media files or \$guest_media_disallowed = $guest_media_disallowed; # disallow browsing guests to see media files or
                                                   # have clickable auto linked urls in messages.                                                    # have clickable auto linked urls in messages.
\$enable_guestlanguage = $enable_guestlanguage;     # allow browsing guests to select their language \$enable_guestlanguage = $enable_guestlanguage;     # allow browsing guests to select their language
                                                   # - requires more than one language pack!                                                    # - requires more than one language pack!
                                                   # - Set to 0 if do not allow 1 is allow.                                                    # - Set to 0 if do not allow 1 is allow.
   
\$enable_notifications = $enable_notifications;     # - Allow e-mail notification for boards/threads \$enable_notifications = $enable_notifications;     # - Allow e-mail notification for boards/threads
                                                   #   listed in "My Notifications" => value == 1                                                    #   listed in "My Notifications" => value == 1
                                                   # - Allow e-mail notification when new PM comes in                                                    # - Allow e-mail notification when new PM comes in
                                                   #   => value == 2                                                    #   => value == 2
                                                   # - value == 0 => both disabled | value == 3 => both enabled                                                    # - value == 0 => both disabled | value == 3 => both enabled
   
\$NewNotificationAlert = $NewNotificationAlert;     # enable notification alerts (popup) for new notifications \$NewNotificationAlert = $NewNotificationAlert;     # enable notification alerts (popup) for new notifications
\$autolinkurls = $autolinkurls;                     # Set to 1 to turn URLs into links, or 0 for no auto-linking. \$autolinkurls = $autolinkurls;                     # Set to 1 to turn URLs into links, or 0 for no auto-linking.
   
\$forumnumberformat = $forumnumberformat;           # Select your preferred output Format for Numbers \$forumnumberformat = $forumnumberformat;           # Select your preferred output Format for Numbers
\$timeselected = $timeselected;                     # Select your preferred output Format of Time and Date \$timeselected = $timeselected;                     # Select your preferred output Format of Time and Date
\$timecorrection = $timecorrection;                 # Set time correction for server time in seconds \$timecorrection = $timecorrection;                 # Set time correction for server time in seconds
\$timeoffset = "$timeoffset";                       # Time Offset to GMT/UTC (0 for GMT/UTC)  \$enabletz = $enabletz;                             # Allow for timezone selection 
\$dstoffset = $dstoffset;                           # Time Offset (for daylight savings time, 0 to disable DST)  \$default_tz = "$default_tz";                       # default forum timezone 
\$dynamic_clock = $dynamic_clock;                   # Set to a value enables the dynamic clock at the top of the page \$dynamic_clock = $dynamic_clock;                   # Set to a value enables the dynamic clock at the top of the page
\$TopAmmount = $TopAmmount;                         # No. of top posters to display on the top members list \$TopAmmount = $TopAmmount;                         # No. of top posters to display on the top members list
\$maxdisplay = $maxdisplay;                         # Maximum of topics to display \$maxdisplay = $maxdisplay;                         # Maximum of topics to display
\$maxfavs = $maxfavs;                               # Maximum of favorite topics to save in a profile \$maxfavs = $maxfavs;                               # Maximum of favorite topics to save in a profile
\$maxrecentdisplay = $maxrecentdisplay;             # Maximum of topics to display on recent posts by a user (-1 to disable) \$maxrecentdisplay = $maxrecentdisplay;             # Maximum of topics to display on recent posts by a user (-1 to disable)
  \$maxrecentdisplay_t = $maxrecentdisplay_t;         # Maximum of topics to display on recent topics (-1 to disable)
\$maxsearchdisplay = $maxsearchdisplay;             # Maximum of messages to display in a search query  (-1 to disable search) \$maxsearchdisplay = $maxsearchdisplay;             # Maximum of messages to display in a search query  (-1 to disable search)
\$maxmessagedisplay = $maxmessagedisplay;           # Maximum of messages to display \$maxmessagedisplay = $maxmessagedisplay;           # Maximum of messages to display
\$MaxMessLen = $MaxMessLen;                         # Maximum Allowed Characters in a Posts \$MaxMessLen = $MaxMessLen;                         # Maximum Allowed Characters in a Posts
  \$AdMaxMessLen = $AdMaxMessLen;                     # Maximum Allowed Characters in a Posts for Admins
  \$MaxIMMessLen = $MaxIMMessLen;                     # Maximum Allowed Characters in a PM
  \$AdMaxIMMessLen = $AdMaxIMMessLen;                 # Maximum Allowed Characters in a PM for Admins
  \$MaxCalMessLen = $MaxCalMessLen;                   # Maximum Allowed Characters in a Cal event
  \$AdMaxCalMessLen = $AdMaxCalMessLen;               # Maximum Allowed Characters in a Cal Event for Admins
\$fontsizemin = $fontsizemin;                       # Minimum Allowed Font height in pixels \$fontsizemin = $fontsizemin;                       # Minimum Allowed Font height in pixels
\$fontsizemax = $fontsizemax;                       # Maximum Allowed Font height in pixels \$fontsizemax = $fontsizemax;                       # Maximum Allowed Font height in pixels
\$checkallcaps = $checkallcaps;                     # Set to 0 to allow ALL CAPS in posts (subject and message) or set to a value > 0 to open a JS-alert if more characters in ALL CAPS were there. \$checkallcaps = $checkallcaps;                     # Set to 0 to allow ALL CAPS in posts (subject and message) or set to a value > 0 to open a JS-alert if more characters in ALL CAPS were there.
\$set_subjectMaxLength = $set_subjectMaxLength;     # Maximum Allowed Characters in a Posts Subject \$set_subjectMaxLength = $set_subjectMaxLength;     # Maximum Allowed Characters in a Posts Subject
\$MaxMessLen = $MaxMessLen;                         # Maximum Allowed Characters in a Posts  \$honeypot = $honeypot;                                            # Set to 1 to activate Honeypot spam deterrent 
\$honeypot = $honeypot;                        # Set to 1 to activate Honeypot spam deterrent  
\$spamfruits = $spamfruits;                    # Set to 1 to activate SpamFruits spam deterrent  
\$speedpostdetection = $speedpostdetection;         # Set to 1 to detect speedposters and delay their spam actions \$speedpostdetection = $speedpostdetection;         # Set to 1 to detect speedposters and delay their spam actions
\$spd_detention_time = $spd_detention_time;         # Time in seconds before a speedposting ban is lifted again \$spd_detention_time = $spd_detention_time;         # Time in seconds before a speedposting ban is lifted again
\$min_post_speed = $min_post_speed;                 # Minimum time in seconds between entering a post form and submitting a post \$min_post_speed = $min_post_speed;                 # Minimum time in seconds between entering a post form and submitting a post
\$minlinkpost = $minlinkpost;                       # Minimum amount of posts a member needs to post links and images \$minlinkpost = $minlinkpost;                       # Minimum amount of posts a member needs to post links and images
\$minlinksig = $minlinksig;                         # Minimum amount of posts a member needs to create links and images in signature \$minlinksig = $minlinksig;                         # Minimum amount of posts a member needs to create links and images in signature
\$minlinkweb = $minlinkweb; \$minlinkweb = $minlinkweb;
\$post_speed_count = $post_speed_count;             # Maximum amount of abuses befor a user gets banned \$post_speed_count = $post_speed_count;             # Maximum amount of abuses befor a user gets banned
\$MaxSigLen = $MaxSigLen;                           # Maximum Allowed Characters in Signatures \$MaxSigLen = $MaxSigLen;                           # Maximum Allowed Characters in Signatures
\$MaxAwayLen = $MaxAwayLen;                         # Maximum Allowed Characters in Away message \$MaxAwayLen = $MaxAwayLen;                         # Maximum Allowed Characters in Away message
\$ClickLogTime = $ClickLogTime;                     # Time in minutes to log every click to your forum \$ClickLogTime = $ClickLogTime;                     # Time in minutes to log every click to your forum
                                                   # (longer time means larger log file size)                                                    # (longer time means larger log file size)
\$max_log_days_old = $max_log_days_old;             # If an entry in the user's log is older than ... days remove it \$max_log_days_old = $max_log_days_old;             # If an entry in the user's log is older than ... days remove it
   
\$maxsteps = $maxsteps;                             # Number of steps to take to change from start color to endcolor \$maxsteps = $maxsteps;                             # Number of steps to take to change from start color to endcolor
\$stepdelay = $stepdelay;                           # Time in miliseconds of a single step \$stepdelay = $stepdelay;                           # Time in miliseconds of a single step
\$fadelinks = $fadelinks;                           # Fade links as well as text? \$fadelinks = $fadelinks;                           # Fade links as well as text?
   
\$defaultusertxt = qq~$defaultusertxt~;             # The dafault usertext visible in users posts \$defaultusertxt = qq~$defaultusertxt~;             # The dafault usertext visible in users posts
\$timeout = $timeout;                               # Minimum time between 2 postings from the same IP \$timeout = $timeout;                               # Minimum time between 2 postings from the same IP
\$HotTopic = $HotTopic;                             # Number of posts needed in a topic for it to be classed as "Hot" \$HotTopic = $HotTopic;                             # Number of posts needed in a topic for it to be classed as "Hot"
\$VeryHotTopic = $VeryHotTopic;                     # Number of posts needed in a topic for it to be classed as "Very Hot" \$VeryHotTopic = $VeryHotTopic;                     # Number of posts needed in a topic for it to be classed as "Very Hot"
\$barmaxdepend = $barmaxdepend;                     # Set to 1 to let bar-max-length depend on top poster \$barmaxdepend = $barmaxdepend;                     # Set to 1 to let bar-max-length depend on top poster
                                                   # or 0 to depend on a number of your choise                                                    # or 0 to depend on a number of your choise
\$barmaxnumb = $barmaxnumb;                         # Select number of post for max. bar-length in memberlist \$barmaxnumb = $barmaxnumb;                         # Select number of post for max. bar-length in memberlist
\$defaultml = "$defaultml"; \$defaultml = "$defaultml";
   
\$ML_Allowed = $ML_Allowed;                         # allow browse MemberList \$ML_Allowed = $ML_Allowed;                         # allow browse MemberList
   
########## Quick Reply configuration ########## ########## Quick Reply configuration ##########
\$enable_quickpost = $enable_quickpost;             # Set to 1 if you want to enable the quick post box \$enable_quickpost = $enable_quickpost;             # Set to 1 if you want to enable the quick post box
\$enable_quickreply = $enable_quickreply;           # Set to 1 if you want to enable the quick reply box \$enable_quickreply = $enable_quickreply;           # Set to 1 if you want to enable the quick reply box
\$enable_quickjump = $enable_quickjump;             # Set to 1 if you want to enable the jump to quick reply box \$enable_quickjump = $enable_quickjump;             # Set to 1 if you want to enable the jump to quick reply box
\$enable_markquote = $enable_markquote;             # Set to 1 if you want to enable the mark&quote feature \$enable_markquote = $enable_markquote;             # Set to 1 if you want to enable the mark&quote feature
\$quick_quotelength = $quick_quotelength;           # Set the max length for Quick Quotes \$quick_quotelength = $quick_quotelength;           # Set the max length for Quick Quotes
\$enable_quoteuser = $enable_quoteuser;             # Set to 1 if you want to enable userquote \$enable_quoteuser = $enable_quoteuser;             # Set to 1 if you want to enable userquote
\$quoteuser_color = "$quoteuser_color";             # Set the default color of @ in userquote \$quoteuser_color = "$quoteuser_color";             # Set the default color of @ in userquote
   
########## MemberPic Settings ########## ########## MemberPic Settings ##########
   
\$max_avatar_width = $max_avatar_width;             # Set maximum pixel width to which the selfselected userpics are resized, \$max_avatar_width = $max_avatar_width;             # Set maximum pixel width to which the selfselected userpics are resized,
                                                   # 0 disables this limit                                                    # 0 disables this limit
\$max_avatar_height = $max_avatar_height;           # Set maximum pixel height to which the selfselected userpics are resized, \$max_avatar_height = $max_avatar_height;           # Set maximum pixel height to which the selfselected userpics are resized,
                                                   # 0 disables this limit                                                    # 0 disables this limit
\$fix_avatar_img_size = $fix_avatar_img_size;       # Set to 1 disable the image resize feature and sets the image size to the \$fix_avatar_img_size = $fix_avatar_img_size;       # Set to 1 disable the image resize feature and sets the image size to the
                                                   # max_... values. If one of the max_... values is 0 the image is shown in his                                                     # max_... values. If one of the max_... values is 0 the image is shown in its 
                                                   # proportions to the other value. If both are 0 the image is shown at his original size.                                                    # proportions to the other value. If both are 0 the image is shown at its original size.
  \$max_avatarml_width = $max_avatarml_width;         # Set maximum pixel width to which the selfselected userpics in member list are resized, 0 disables
                                                     #  this limit
  \$max_avatarml_height = $max_avatarml_height;       #Set maximum pixel height to which the selfselected userpics in member list are resized, 0 disables
                                                     #  this limit
  \$fix_avatarml_img_size = $fix_avatarml_img_size;                       # Set to 1 disable the image resize feature and sets the image size to the max_... values. If one of
                                                     #  the max_... values is 0 the image is shown in its proportions to the other value. If both are 0 the image is shown at its original size.
\$max_post_img_width = $max_post_img_width;         # Set maximum pixel width for images, 0 disables this limit \$max_post_img_width = $max_post_img_width;         # Set maximum pixel width for images, 0 disables this limit
\$max_post_img_height = $max_post_img_height;       # Set maximum pixel height for images, 0 disables this limit \$max_post_img_height = $max_post_img_height;       # Set maximum pixel height for images, 0 disables this limit
\$fix_post_img_size = $fix_post_img_size;           # Set to 1 disable the image resize feature and sets the image size to the \$fix_post_img_size = $fix_post_img_size;           # Set to 1 disable the image resize feature and sets the image size to the
                                                   # max_... values. If one of the max_... values is 0 the image is shown in his                                                     # max_... values. If one of the max_... values is 0 the image is shown in its 
                                                   # proportions to the other value. If both are 0 the image is shown at his original size.                                                    # proportions to the other value. If both are 0 the image is shown at its original size.
\$max_signat_img_width = $max_signat_img_width;     # Set maximum pixel width for images in the signature, 0 disables this limit \$max_signat_img_width = $max_signat_img_width;     # Set maximum pixel width for images in the signature, 0 disables this limit
\$max_signat_img_height = $max_signat_img_height;   # Set maximum pixel height for images in the signature, 0 disables this limit \$max_signat_img_height = $max_signat_img_height;   # Set maximum pixel height for images in the signature, 0 disables this limit
\$fix_signat_img_size = $fix_signat_img_size;       # Set to 1 disable the image resize feature and sets the image size to the \$fix_signat_img_size = $fix_signat_img_size;       # Set to 1 disable the image resize feature and sets the image size to the
                                                   # max_... values. If one of the max_... values is 0 the image is shown in his                                                     # max_... values. If one of the max_... values is 0 the image is shown in its 
                                                   # proportions to the other value. If both are 0 the image is shown at his original size.                                                    # proportions to the other value. If both are 0 the image is shown at its original size.
\$max_attach_img_width = $max_attach_img_width;     # Set maximum pixel width for attached images, 0 disables this limit \$max_attach_img_width = $max_attach_img_width;     # Set maximum pixel width for attached images, 0 disables this limit
\$max_attach_img_height = $max_attach_img_height;   # Set maximum pixel height for attached images, 0 disables this limit \$max_attach_img_height = $max_attach_img_height;   # Set maximum pixel height for attached images, 0 disables this limit
\$fix_attach_img_size = $fix_attach_img_size;       # Set to 1 disable the image resize feature and sets the image size to the \$fix_attach_img_size = $fix_attach_img_size;       # Set to 1 disable the image resize feature and sets the image size to the
                                                   # max_... values. If one of the max_... values is 0 the image is shown in his                                                     # max_... values. If one of the max_... values is 0 the image is shown in its 
                                                   # proportions to the other value. If both are 0 the image is shown at his original size.                                                    # proportions to the other value. If both are 0 the image is shown at its original size.
  \$max_brd_img_width = $max_brd_img_width;                           # Set maximum pixel width to which the Board Images are resized, 0 disables this limit
  \$max_brd_img_height = $max_brd_img_height;                          # Set maximum pixel height to which the Board Images are resized, 0 disables this limit
  \$fix_brd_img_size = $max_brd_img_size;
\$img_greybox = $img_greybox;                       # Set to 0 to disable "greybox" (each image is shown in a new window) \$img_greybox = $img_greybox;                       # Set to 0 to disable "greybox" (each image is shown in a new window)
                                                   # Set to 1 to enable the attachment and post image "greybox" (one image/page)                                                    # Set to 1 to enable the attachment and post image "greybox" (one image/page)
                                                   # Set to 2 to enable the attachment and post image "greybox" =>                                                    # Set to 2 to enable the attachment and post image "greybox" =>
                                                   # attachment images: (all images/page), post images: (one image/page)                                                    # attachment images: (all images/page), post images: (one image/page)
   
########## Extended Profiles ########## ########## Extended Profiles ##########
\$extendedprofiles = $extendedprofiles;             # Set to 1 to enabled 'Extended Profiles'. Turn it off (0) to save server load. \$extendedprofiles = $extendedprofiles;             # Set to 1 to enabled 'Extended Profiles'. Turn it off (0) to save server load.
   
  ########## Event Calendar ##########
   
  # Standard Calendar Setting
  \$Show_EventCal = 0;
  \$Event_TodayColor = '#ff0000';
  \$DisplayEvents = 0;
  \$CalShortEvent = 0;
  \$bm_subcut = $bm_subcut;
########## File Locking ########## ########## File Locking ##########
  \$checkspace = 0;                                                # Set to 1 to enable any freespace checking (should remain disabled on Windows/IIS servers)
\$enable_freespace_check = $enable_freespace_check; # Enable the free disk space check on every pageview? \$enable_freespace_check = $enable_freespace_check; # Enable the free disk space check on every pageview?
\$gzcomp = $gzcomp;                                 # GZip compression: 0 = No Compression, \$gzcomp = $gzcomp;                                 # GZip compression: 0 = No Compression,
                                                   # 1 = External gzip, 2 = Zlib::Compress                                                    # 1 = External gzip, 2 = Zlib::Compress
\$gzforce = $gzforce;                               # Do not try to check whether browser supports GZip \$gzforce = $gzforce;                               # Do not try to check whether browser supports GZip
\$cachebehaviour = $cachebehaviour;                 # Browser Cache Control: 0 = No Cache must revalidate, 1 = Allow Caching \$cachebehaviour = $cachebehaviour;                 # Browser Cache Control: 0 = No Cache must revalidate, 1 = Allow Caching
\$use_flock = $use_flock;                           # Set to 0 if your server doesn't support file locking, \$use_flock = $use_flock;                           # Set to 0 if your server doesn't support file locking,
                                                   # 1 for Unix/Linux and WinNT, and 2 for Windows 95/98/ME                                                    # 1 for Unix/Linux and WinNT, and 2 for Windows 95/98/ME
\$faketruncation = $faketruncation;                 # Enable this option only if YaBB fails with the error: \$faketruncation = $faketruncation;                 # Enable this option only if YaBB fails with the error:
                                                   # "truncate() function not supported on this platform."                                                    # "truncate() function not supported on this platform."
                                                   # 0 to disable, 1 to enable.                                                    # 0 to disable, 1 to enable.
\$debug = $debug;                                   # If set to 1 debug info is added to the template \$debug = $debug;                                   # If set to 1 debug info is added to the template
                                                   # tags are <yabb fileactions> and <yabb filenames>                                                    # tags are <yabb fileactions> and <yabb filenames>
   
  ########## Search Settings ##########
  \$enableguestsearch = $enableguestsearch;       # Set to 1 to enable guests access to advanced search.
  \$enableguestquicksearch = $enableguestquicksearch; # Set to 1 to enable guests access to quick search.
  \$mgqcksearch = "\Q$mgqcksearch\E";
  \$mgadvsearch = "\Q$mgadvsearch\E";
  \$qcksearchtype = "\Q$qcksearchtype\E";
  \$qckage = "\Q$qckage\E";
   
############################################################################### ###############################################################################
# Advanced Settings (old AdvSettings.txt                                      # # Advanced Settings                                                           #
############################################################################### ###############################################################################
   
  ########## RSS Settings ##########
   
  \$rss_disabled = $rss_disabled;         # Set to 1 to disable the RSS feed
  \$rss_limit = $rss_limit;           # Maximum number of topics in the feed
  \$rss_message = $rss_message;           # Message to display in the feed
                             # 0: None
                             # 1: Latest Post
                             # 2: Original Post in the topic
  \$showauthor = $showauthor;         # Show author name
  \$rssemail = '$rssemail';             # default email if author email not shown
  \$showdate = $showdate;             # Show post date
   
########## New Member Notification Settings ########## ########## New Member Notification Settings ##########
\$new_member_notification = 0;                    # Set to 1 to enable the new member notification \$new_member_notification = 0;                    # Set to 1 to enable the new member notification
\$new_member_notification_mail = '';              # Your "New Member Notification"-email address. \$new_member_notification_mail = "\Q$new_member_notification_mail\E";   # Your "New Member Notification"-email address.
   
\$sendtopicmail = 2;                              # Set to 0 for send NO topic email to friend \$sendtopicmail = 2;                              # Set to 0 for send NO topic email to friend
                                                 # Set to 1 to send topic email to friend via YaBB                                                  # Set to 1 to send topic email to friend via YaBB
                                                 # Set to 2 to send topic email to friend via user program                                                  # Set to 2 to send topic email to friend via user program
                                                 # Set to 3 to let user decide between 1 and 2                                                  # Set to 3 to let user decide between 1 and 2
   
########## In-Thread Multi Delete ########## ########## In-Thread Multi Delete ##########
   
\$mdadmin = 1; \$mdadmin = 1;
\$mdglobal = 1; \$mdglobal = 1;
  \$mdfmod = 1;
\$mdmod = 1; \$mdmod = 1;
\$adminbin = 0;                                   # Skip recycle bin step for admins and delete directly \$adminbin = 0;                                   # Skip recycle bin step for admins and delete directly
   
########## Moderation Update ########## ########## Moderation Update ##########
   
\$adminview = 2;                                  # Multi-admin settings for Administrators: \$adminview = 2;                                  # Multi-admin settings for Administrators:
                                                 # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes                                                  # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes
\$gmodview = 2;                                   # Multi-admin settings for Global Moderators: \$gmodview = 2;                                   # Multi-admin settings for Global Moderators:
                                                 # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes                                                  # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes
\$modview = 2;                                    # Multi-admin settings for Moderators: \$fmodview = 2;                                   # Multi-admin settings for Forum Moderators:
                                                   # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes
  \$modview = 2;                                    # Multi-admin settings for Board Moderators:
                                                 # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes                                                  # 0=none, 1=icons 2=single checkbox 3=multiple checkboxes
   
########## Advanced Memberview Plus ##########  \$maxadminlog = $maxadminlog;                                #Maximum number of entries stored in adminlog.txt (oldest entries are deleted). 
  ########## Memberview ##########
   
\$showallgroups = 1; \$showallgroups = 1;
\$OnlineLogTime = 15;                             # Time in minutes before Users are removed from the Online Log \$OnlineLogTime = 15;                             # Time in minutes before Users are removed from the Online Log
\$lastonlineinlink = 0;                           # Show "Last online X days and XX:XX:XX hours ago." to all members == 1 \$lastonlineinlink = 0;                           # Show "Last online X days and XX:XX:XX hours ago." to all members == 1
   
########## Polls ########## ########## Polls ##########
   
\$numpolloptions = 8;                             # Number of poll options \$numpolloptions = 8;                             # Number of poll options
\$maxpq = 60;                                     # Maximum Allowed Characters in a Poll Qestion? \$maxpq = 60;                                     # Maximum Allowed Characters in a Poll Qestion?
\$maxpo = 50;                                     # Maximum Allowed Characters in a Poll Option? \$maxpo = 50;                                     # Maximum Allowed Characters in a Poll Option?
\$maxpc = 0;                                      # Maximum Allowed Characters in a Poll Comment? \$maxpc = 0;                                      # Maximum Allowed Characters in a Poll Comment?
\$useraddpoll = 1;                                # Allow users to add polls to existing threads? (1 = yes) \$useraddpoll = 1;                                # Allow users to add polls to existing threads? (1 = yes)
\$ubbcpolls = 1;                                  # Allow UBBC tags and smilies in polls? (1 = yes) \$ubbcpolls = 1;                                  # Allow UBBC tags and smilies in polls? (1 = yes)
   
########## Advanced Instant Message Box ########## ########## Instant Message ##########
   
\$PM_level = 1; \$PM_level = 1;
\$numposts = 1;                                   # Number of posts required to send Instant Messages \$numposts = 1;                                   # Number of posts required to send Instant Messages
\$imspam = 0;                                     # Percent of Users a user is a allowed to send a message at once \$imspam = 0;                                     # Percent of Users a user is a allowed to send a message at once
\$numibox = 20;                                   # Number of maximum Messages in the IM-Inbox \$numibox = 20;                                   # Number of maximum Messages in the IM-Inbox
\$numobox = 20;                                   # Number of maximum Messages in the IM-Outbox \$numobox = 20;                                   # Number of maximum Messages in the IM-Outbox
\$numstore = 20;                                  # Number of maximum Messages in the Storage box \$numstore = 20;                                  # Number of maximum Messages in the Storage box
\$numdraft = 20;                                  # Number of maximum Messages in the Draft box \$numdraft = 20;                                  # Number of maximum Messages in the Draft box
\$enable_imlimit = 0;                             # Set to 1 to enable limitation of incoming and outgoing im messages \$enable_imlimit = 0;                             # Set to 1 to enable limitation of incoming and outgoing im messages
\$enable_storefolders = 0;                        # enable additonal store folders - in/out are default for all \$enable_storefolders = 0;                        # enable additonal store folders - in/out are default for all
                                                 # 0=no > 1 = number, max 25                                                  # 0=no > 1 = number, max 25
\$imtext = qq~Welcome to my boards~; \$imtext = qq~Welcome to my boards~;
\$sendname = admin; \$sendname = admin;
\$imsubject = "Hey Hey :)"; \$imsubject = "Hey Hey :)";
\$send_welcomeim = 1; \$send_welcomeim = 1;
  \$PMenableBm_level = 3;                            # minimum level to send? 0 = off, 1 = mods, 2 = gmod, 3 = admin
   
########## Topic Summary Cutter ########## ########## Topic Summary Cutter ##########
   
\$cutamount  = "15";                              # Number of posts to list in topic summary \$cutamount  = "15";                              # Number of posts to list in topic summary
\$ttsreverse = 0;                                 # Reverse Topic Summaries in Topic (most recent becomes first) \$ttsreverse = 0;                                 # Reverse Topic Summaries in Topic (most recent becomes first)
\$ttsureverse = 0;                                # Reverse Topic Summaries in Topic (most recent becomes first) allowed as user wishes? Yes == 1 \$ttsureverse = 0;                                # Reverse Topic Summaries in Topic (most recent becomes first) allowed as user wishes? Yes == 1
\$tsreverse = 1;                                  # Reverse Topic Summaries (So most recent is first \$tsreverse = 1;                                  # Reverse Topic Summaries (So most recent is first
   
########## Time Lock ########## ########## Time Lock ##########
   
\$tlnomodflag = 1;                                # Set to 1 limit time users may modify posts \$tlnomodflag = 1;                                # Set to 1 limit time users may modify posts
\$tlnomodtime = 1;                                # Time limit on modifying posts (days) \$tlnomodtime = 1;                                # Time limit on modifying posts (days)
\$tlnodelflag = 1;                                # Set to 1 limit time users may delete posts \$tlnodelflag = 1;                                # Set to 1 limit time users may delete posts
\$tlnodeltime = 5;                                # Time limit on deleting posts (days) \$tlnodeltime = 5;                                # Time limit on deleting posts (days)
\$tllastmodflag = 1;                              # Set to 1 allow users to modify posts up to \$tllastmodflag = 1;                              # Set to 1 allow users to modify posts up to
                                                 # the specified time limit w/o showing "last Edit" message                                                  # the specified time limit w/o showing "last Edit" message
\$tllastmodtime = 60;                             # Time limit to modify posts w/o triggering "last Edit" message (in minutes) \$tllastmodtime = 60;                             # Time limit to modify posts w/o triggering "last Edit" message (in minutes)
   
########## File Attachment Settings ########## ########## File Attachment Settings ##########
   
\$limit = 250;                                    # Set to the maximum number of kilobytes an attachment can be. \$limit = 250;                                    # Set to the maximum number of kilobytes an attachment can be.
                                                 # Set to 0 to disable the file size check.                                                  # Set to 0 to disable the file size check.
\$dirlimit = 10000;                               # Set to the maximum number of kilobytes the attachment directory can hold. \$dirlimit = 10000;                               # Set to the maximum number of kilobytes the attachment directory can hold.
                                                 # Set to 0 to disable the directory size check.                                                  # Set to 0 to disable the directory size check.
\$overwrite = 0;                                  # Set to 0 to auto rename attachments if they exist, \$overwrite = 0;                                  # Set to 0 to auto rename attachments if they exist,
                                                 # 1 to overwrite them or 2 to generate an error if the file exists already.                                                  # 1 to overwrite them or 2 to generate an error if the file exists already.
\@ext = qw(txt doc docx psd pdf bmp jpe jpg jpeg gif png swf zip rar tar); # The allowed file extensions for file attachements. \@ext = qw(txt doc docx psd pdf bmp jpe jpg jpeg gif png swf zip rar tar); # The allowed file extensions for file attachements.
                                                 # The variable should be set in the form of "jpg bmp gif" and so on.                                                  # The variable should be set in the form of "jpg bmp gif" and so on.
\$checkext = 1;                                   # Set to 1 to enable file extension checking, \$checkext = 1;                                   # Set to 1 to enable file extension checking,
                                                 # set to 0 to allow all file types to be uploaded                                                  # set to 0 to allow all file types to be uploaded
\$amdisplaypics = 1;                              # Set to 1 to display attached pictures in posts, \$amdisplaypics = 1;                              # Set to 1 to display attached pictures in posts,
                                                 # set to 0 to only show a link to them.                                                  # set to 0 to only show a link to them.
\$allowattach = 1;                                # Set to the number of maximum files attaching a post, \$allowattach = 1;                                # Set to the number of maximum files attaching a post,
                                                 # set to 0 to disable file attaching.                                                  # set to 0 to disable file attaching.
\$allowguestattach = 0;                           # Set to 1 to allow guests to upload attachments, 0 to disable guest attachment uploading. \$allowguestattach = 0;                           # Set to 1 to allow guests to upload attachments, 0 to disable guest attachment uploading.
   
  \$allowAttachIM = 0;                            # Set the maximum number of file attachments allowed in personal messages, set to 0 to disable file attachments in personal messages.
   
  \@pmAttachExt = qw(txt doc docx psd pdf bmp jpe jpg jpeg gif png swf zip rar tar); # The allowed file extensions for pm file attachments. Variable should be set in the form of "jpg bmp gif" and so on.
  \$pmFileLimit = 250;                # Set to the maximum number of kilobytes a pm attachment can be. Set to 0 to disable the file size check.
  \$pmDirLimit = 10000;               # Set to the maximum number of kilobytes the pm attachment directory can hold. Set to 0 to disable the directory size check.
  \$pmFileOverwrite = 0;              # Set to 0 to auto rename pm attachments if they exist, 1 to overwrite them or 2 to generate an error if the file exists already.
   
########## Error Logger ########## ########## Error Logger ##########
   
\$elmax  = "50";                                  # Max number of log entries before rotation \$elmax  = "50";                                  # Max number of log entries before rotation
\$elenable = 1;                                   # allow for error logging \$elenable = 1;                                   # allow for error logging
\$elrotate = 1;                                   # Allow for log rotation \$elrotate = 1;                                   # Allow for log rotation
   
########## Advanced Tabs ########## ########## Advanced Tabs ##########
   
\@AdvancedTabs = qw(home help search ml admin revalidatesession login register guestpm mycenter logout); # Advanced Tabs order and infos  \$addtab_on = $addtab_on;                         # show advanced tabs on Forum (For admin only.) 
  \@AdvancedTabs = qw(home help search ml admin revalidatesession login register guestpm mycenter logout eventcal birthdaylist ); # Advanced Tabs order and infos
   
########## Smilies ########## ########## Smilies ##########
   
\@SmilieURL = ("exclamation.gif","question.gif"); # Additional Smilies URL \@SmilieURL = ("exclamation.png","question.png"); # Additional Smilies URL
\@SmilieCode = (":exclamation",":question");      # Additional Smilies Code \@SmilieCode = (":exclamation",":question");      # Additional Smilies Code
\@SmilieDescription = ("Exclaim","Questioning");  # Additional Smilies Description \@SmilieDescription = ("Exclaim","Questioning");  # Additional Smilies Description
\@SmilieLinebreak = ("","");                      # Additional Smilies Linebreak \@SmilieLinebreak = ("","");                      # Additional Smilies Linebreak
   
\$smiliestyle = "1";                              # smiliestyle \$smiliestyle = "2";                              # smiliestyle
\$showadded = "2";                                # showadded \$showadded = "2";                                # showadded
\$showsmdir = "2";                                # showsmdir \$showsmdir = "2";                                # showsmdir
\$detachblock = "1";                              # detachblock \$detachblock = "1";                              # detachblock
\$winwidth = "400";                               # winwidth \$winwidth = "400";                               # winwidth
\$winheight = "400";                              # winheight \$winheight = "400";                              # winheight
\$popback = "FFFFFF";                             # popback \$popback = "FFFFFF";                             # popback
\$poptext = "000000";                             # poptext \$poptext = "000000";                             # poptext
   
   
   
############################################################################### ###############################################################################
# Security Settings (old SecSettings.txt)                                     # # Security Settings (old SecSettings.txt)                                     #
############################################################################### ###############################################################################
   
\$regcheck = 0;                             # Set to 1 if you want to enable automatic flood protection enabled \$regcheck = 0;                             # Set to 1 if you want to enable automatic flood protection enabled
\$codemaxchars = 6;                         # Set max length of validation code (15 is max) \$codemaxchars = 6;                         # Set max length of validation code (15 is max)
\$rgb_foreground = "\#0000EE";              # Set hex RGB value for validation image foreground color \$rgb_foreground = "\#0000EE";              # Set hex RGB value for validation image foreground color
\$rgb_shade = "\#999999";                   # Set hex RGB value for validation image shade color \$rgb_shade = "\#999999";                   # Set hex RGB value for validation image shade color
\$rgb_background = "\#FFFFFF";              # Set hex RGB value for validation image background color \$rgb_background = "\#FFFFFF";              # Set hex RGB value for validation image background color
\$translayer = 0;                           # Set to 1 background for validation image should be transparent \$translayer = 0;                           # Set to 1 background for validation image should be transparent
\$randomizer = 0;                           # Set 0 to 3 to create background random noise \$randomizer = 0;                           # Set 0 to 3 to create background random noise
                                           # based on foreground or shade color or both                                            # based on foreground or shade color or both
\$stealthurl = 0;                           # Set to 1 to mask referer url to hosts if a hyperlink is clicked. \$stealthurl = 0;                           # Set to 1 to mask referer url to hosts if a hyperlink is clicked.
\$referersecurity = 0;                      # Set to 1 to activate referer security checking. \$referersecurity = 0;                      # Set to 1 to activate referer security checking.
\$do_scramble_id = 1;                       # Set to 1 scambles all visible links containing user ID's \$do_scramble_id = 1;                       # Set to 1 scambles all visible links containing user ID's
\$sessions = 1;                             # Set to 1 to activate session id protection. \$sessions = 1;                             # Set to 1 to activate session id protection.
\$show_online_ip_admin = 1;                 # Set to 1 to show online IP's to admins. \$show_online_ip_admin = 1;                 # Set to 1 to show online IP's to admins.
\$show_online_ip_gmod = 1;                  # Set to 1 to show online IP's to global moderators. \$show_online_ip_gmod = 1;                  # Set to 1 to show online IP's to global moderators.
  \$show_online_ip_fmod = 1;                  # Set to 1 to show online IP's to forum moderators.
\$masterkey = '$masterkey';                 # Seed for encryption of captcha's \$masterkey = '$masterkey';                 # Seed for encryption of captcha's
  \$ipLookup = 1;                             # Set to 1 to enable IP Lookup.
   
   
############################################################################### ###############################################################################
# Guardian Settings (old Guardian.banned and Guardian.settings)               # # Guardian Settings (old Guardian.banned and Guardian.settings)               #
############################################################################### ###############################################################################
   
\$banned_harvesters = qq~alexibot|asterias|backdoorbot|black.hole|blackwidow|blowfish|botalot|builtbottough|bullseye|bunnyslippers|cegbfeieh|cheesebot|cherrypicker|chinaclaw|copyrightcheck|cosmos |crescent|custo|disco|dittospyder|download demon|ecatch|eirgrabber|emailcollector|emailsiphon|emailwolf|erocrawler|eseek-larbin|express webpictures|extractorpro|eyenetie|fast|flashget|foobot|frontpage|fscrawler|getright|getweb|go!zilla|go-ahead-got-it|grabnet|grafula|gsa-crawler|harvest|hloader|hmview|httplib|httrack|humanlinks|ia_archiver|image stripper|image sucker|indy library|infonavirobot|interget|internet ninja|jennybot|jetcar|joc web spider|kenjin.spider|keyword.density|larbin|leechftp|lexibot|libweb/clshttp|linkextractorpro|linkscan/8.1a.unix|linkwalker|lwp-trivial|mass downloader|mata.hari|microsoft.url|midown tool|miixpc|mister pix|moget|mozilla.*newt|mozilla/3.mozilla/2.01|navroad|nearsite|net vampire|netants|netmechanic|netspider|netzip|nicerspro|npbot|octopus|offline explorer|offline navigator|openfind|pagegrabber|papa foto|pavuk|pcbrowser|propowerbot/2.14|prowebwalker|queryn.metasearch|realdownload|reget|repomonkey|sitesnagger|slysearch|smartdownload|spankbot|spanner |spiderzilla|steeler|superbot|superhttp|surfbot|suzuran|szukacz|takeout|teleport pro|telesoft|the.intraformant|thenomad|tighttwatbot|titan|tocrawl/urldispatcher|true_robot|turingos|turnitinbot|urly.warning|vci|voideye|web image collector|web sucker|web.image.collector|webauto|webbandit|webbandit|webcopier|webemailextrac.*|webenhancer|webfetch|webgo is|webleacher|webmasterworldforumbot|webreaper|websauger|website extractor|website quester|webster.pro|webstripper|webwhacker|webzip|wget|widow|www-collector-e|wwwoffle|xaldon webspider|xenu link sleuth|zeus~; \$banned_harvesters = qq~alexibot|asterias|backdoorbot|black.hole|blackwidow|blowfish|botalot|builtbottough|bullseye|bunnyslippers|cegbfeieh|cheesebot|cherrypicker|chinaclaw|copyrightcheck|cosmos |crescent|custo|disco|dittospyder|download demon|ecatch|eirgrabber|emailcollector|emailsiphon|emailwolf|erocrawler|eseek-larbin|express webpictures|extractorpro|eyenetie|fast|flashget|foobot|frontpage|fscrawler|getright|getweb|go!zilla|go-ahead-got-it|grabnet|grafula|gsa-crawler|harvest|hloader|hmview|httplib|httrack|humanlinks|ia_archiver|image stripper|image sucker|indy library|infonavirobot|interget|internet ninja|jennybot|jetcar|joc web spider|kenjin.spider|keyword.density|larbin|leechftp|lexibot|libweb/clshttp|linkextractorpro|linkscan/8.1a.unix|linkwalker|lwp-trivial|mass downloader|mata.hari|microsoft.url|midown tool|miixpc|mister pix|moget|mozilla.*newt|mozilla/3.mozilla/2.01|navroad|nearsite|net vampire|netants|netmechanic|netspider|netzip|nicerspro|npbot|octopus|offline explorer|offline navigator|openfind|pagegrabber|papa foto|pavuk|pcbrowser|propowerbot/2.14|prowebwalker|queryn.metasearch|realdownload|reget|repomonkey|sitesnagger|slysearch|smartdownload|spankbot|spanner |spiderzilla|steeler|superbot|superhttp|surfbot|suzuran|szukacz|takeout|teleport pro|telesoft|the.intraformant|thenomad|tighttwatbot|titan|tocrawl/urldispatcher|true_robot|turingos|turnitinbot|urly.warning|vci|voideye|web image collector|web sucker|web.image.collector|webauto|webbandit|webbandit|webcopier|webemailextrac.*|webenhancer|webfetch|webgo is|webleacher|webmasterworldforumbot|webreaper|websauger|website extractor|website quester|webster.pro|webstripper|webwhacker|webzip|wget|widow|www-collector-e|wwwoffle|xaldon webspider|xenu link sleuth|zeus~;
\$banned_referers = qq~hotsex.com|porn.com~; \$banned_referers = qq~hotsex.com|porn.com~;
\$banned_requests = qq~~; \$banned_requests = qq~~;
\$banned_strings = qq~pussy|cunt~; \$banned_strings = qq~pussy|cunt~;
\$whitelist = qq~~; \$whitelist = qq~~;
   
\$use_guardian = 1; \$use_guardian = 1;
\$use_htaccess = 0; \$use_htaccess = 0;
   
\$disallow_proxy_on = 0; \$disallow_proxy_on = 0;
\$referer_on = 1; \$referer_on = 1;
\$harvester_on = 0; \$harvester_on = 0;
\$request_on = 0; \$request_on = 0;
\$string_on = 1; \$string_on = 1;
\$union_on = 1; \$union_on = 1;
\$clike_on = 1; \$clike_on = 1;
\$script_on = 1; \$script_on = 1;
   
\$disallow_proxy_notify = 1; \$disallow_proxy_notify = 1;
\$referer_notify = 0; \$referer_notify = 0;
\$harvester_notify = 1; \$harvester_notify = 1;
\$request_notify = 0; \$request_notify = 0;
\$string_notify = 1; \$string_notify = 1;
\$union_notify = 1; \$union_notify = 1;
\$clike_notify = 1; \$clike_notify = 1;
\$script_notify = 1; \$script_notify = 1;
   
   
   
############################################################################### ###############################################################################
# Banning Settings (old ban.txt)                                              # # Banning Settings  Moved to banlist.txt New timed ban settings              #
############################################################################### ###############################################################################
  \@timeban = qw( d w m p );
\$ip_banlist = "";                          # IP banlist  \@bandays = ( 1, 7, 30,  365 ); 
\$email_banlist = "";                       # EMAIL banlist  
\$user_banlist = "";                        # USER banlist  
   
   
   
############################################################################### ###############################################################################
# Backup Settings (old BackupSettings.cgi)                                    # # Backup Settings                                                             #
############################################################################### ###############################################################################
   
\@backup_paths = qw(); \@backup_paths = qw();
\$backupmethod = ''; \$backupmethod = '';
\$compressmethod = ''; \$compressmethod = '';
  \$backupprogusr = '';
  \$backupprogbin = '';
\$backupdir = ''; \$backupdir = '';
\$lastbackup = 0; \$lastbackup = 0;
\$backupsettingsloaded = 0; \$backupsettingsloaded = 0;
   
1; 1;
EOF EOF
   
     fopen(SETTING, ">$vardir/Settings.pl") || &setup_fatal_error("$maintext_23 $vardir/Settings.pl: ", 1);     fopen( SETTING, ">$vardir/Settings.pm" ) 
     print SETTING &nicely_aligned_file($setfile);       || setup_fatal_error( "$maintext_23 $vardir/Settings.pm: ", 1 ); 
     fclose(SETTING);     print {SETTING} nicely_aligned_file($setfile) 
     if ($action eq "setinstall2") {       or croak 'cannot print Settings.pm'; 
           &LoadUser('admin');     fclose(SETTING); 
       ${$uid.'admin'}{'email'} = $webmaster_email;     if ( $action eq 'setinstall2' ) { 
       ${$uid.'admin'}{'timeoffset'} = $timeoffset; # must set before &timetostring($date)         LoadUser('admin'); 
       ${$uid.'admin'}{'regdate'} = &timetostring($date);         ${ $uid . 'admin' }{'email'}      = $webmaster_email; 
       ${$uid.'admin'}{'regtime'} = $date;         ${ $uid . 'admin' }{'regdate'}    = timetostring($date); 
       ${$uid.'admin'}{'timeselect'} = $timeselected;         ${ $uid . 'admin' }{'regtime'}    = $date; 
       ${$uid.'admin'}{'language'} = $lang;         ${ $uid . 'admin' }{'timeselect'} = $timeselected; 
           &UserAccount('admin', "update");         ${ $uid . 'admin' }{'language'}   = $lang; 
           &ManageMemberinfo( 'update', 'admin', 'Administrator', $webmaster_email,'Administrator' );        UserAccount( 'admin', 'update' );
           $yySetLocation = qq~$set_cgi?action=setup3~;         ManageMemberinfo( 'update', 'admin', 'Administrator', $webmaster_email, 
           &redirectexit;             'Forum Administrator' ); 
     }         $yySetLocation = qq~$set_cgi?action=setup3~; 
         redirectexit();
     }
     return;
} }
   
sub tempstarter { sub tempstarter {
     return if !-e "$vardir/Settings.pl";     return if !-e "$vardir/Settings.pm"; 
   
     $YaBBversion = 'YaBB 2.5.2';  
   
     # Make sure the module path is present     $YaBBversion = 'YaBB 2.6.12'; 
     push(@INC, "./Modules");  
   
     if ($ENV{'SERVER_SOFTWARE'} =~ /IIS/) {     # Make sure the module path is present 
           $yyIIS = 1;     push @INC, './Modules'; 
           $0 =~ m~(.*)(\\|/)~;  
           $yypath = $1;  
           $yypath =~ s~\\~/~g;  
           chdir($yypath);  
           push(@INC, $yypath);  
     }  
   
     # Requirements and Errors     if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/sm ) { 
     require "$vardir/Settings.pl";         $yyIIS = 1; 
     if (-e "$vardir/ConvSettings.txt") { require "$vardir/ConvSettings.txt"; }         $PROGRAM_NAME =~ m{(.*)(\\|/)}sm; 
     else { $convertdir = "./Convert"; }         $yypath = $1; 
         $yypath =~ s/\\/\//gxsm;
     &LoadCookie; # Load the user's cookie (or set to guest)         chdir $yypath; 
     &LoadUserSettings;         push @INC, $yypath; 
     &WhatTemplate;     } 
     &WhatLanguage;  
     require "$sourcedir/Security.pl";     # Requirements and Errors 
     &WriteLog;     require Variables::Settings; 
     LoadCookie();    # Load the user's cookie (or set to guest)
     LoadUserSettings();
     WhatTemplate();
     WhatLanguage();
     require Sources::Security;
     WriteLog();
     return;
} }
   
sub CheckInstall { sub CheckInstall {
     &tempstarter;     tempstarter(); 
     my $install_error;
     my $install_error;     my $firstmstime = time(); 
     $windowbg = "#FAFAFA";     $windowbg = '#fafafa'; 
     $header   = "#5488BA";     $header   = '#5488ba'; 
     $catbg    = "#DDDDDD";     $catbg    = '#ddd'; 
   
     $set_missing = "";     $set_missing = q{}; 
     $set_created = "";     $set_created = q{}; 
     if (!-e "$vardir/Settings.pl") { $set_missing = qq~Settings.pl~; }    if   ( !-e "$vardir/Settings.pm" ) { $set_missing = q~Settings.pm~; }
     else { $set_created = qq~Settings.pl~; }    else                               { $set_created = q~Settings.pm~; }
   
     $brd_missing = "";     $brd_missing = q{}; 
     $brd_created = "";     $brd_created = q{}; 
     if (!-e "$boardsdir/forum.control") { $brd_missing .= qq~forum.control, ~; }     if ( !-e "$boardsdir/forum.control" ) { 
     else { $brd_created .= qq~forum.control, ~; }         $brd_missing .= q~forum.control, ~; 
     if (!-e "$boardsdir/forum.master") { $brd_missing .= qq~forum.master, ~; }    }
     else { $brd_created .= qq~forum.master, ~; }    else { $brd_created .= q~forum.control, ~; }
     if (!-e "$boardsdir/forum.totals") { $brd_missing .= qq~forum.totals, ~; }    if ( !-e "$boardsdir/forum.master" ) { $brd_missing .= q~forum.master, ~; }
     else {     else                                 { $brd_created .= q~forum.master, ~; } 
           $brd_created .= qq~forum.totals, ~;     if ( !-e "$boardsdir/forum.totals" ) { $brd_missing .= q~forum.totals, ~; } 
           fopen(FORUMTOT, "$boardsdir/forum.totals") || &setup_fatal_error("$maintext_23 $boardsdir/forum.totals: ", 1);     else { 
           @totboards = <FORUMTOT>;         $brd_created .= q~forum.totals, ~; 
           fclose(FORUMTOT);         open $FORUMTOT, '<', "$boardsdir/forum.totals" 
     }           || setup_fatal_error( "$maintext_23 $boardsdir/forum.totals: ", 1 ); 
     foreach $boardstot (@totboards) {         @totboards = <$FORUMTOT>; 
           chomp $boardstot;         close $FORUMTOT or croak 'cannot close forum.totals'; 
           ($brdname, undef, undef, undef, undef, $msgname, undef) = split(/\|/, $boardstot, 7);     } 
           if (!-e "$boardsdir/$brdname.txt") { $brd_missing .= qq~$brdname.txt, ~; }     for my $boardstot (@totboards) { 
           else { $brd_created .= qq~$brdname.txt, ~; }         chomp $boardstot; 
     }         ( $brdname, undef, undef, undef, undef, $msgname, undef ) = 
     $brd_missing =~ s/, $//;           split /[|]/xsm, $boardstot, 7; 
     $brd_created =~ s/, $//;         if ( !-e "$boardsdir/$brdname.txt" ) { 
             $brd_missing .= qq~$brdname.txt, ~;
     $mem_missing = "";         } 
     $mem_created = "";         else { $brd_created .= qq~$brdname.txt, ~; } 
     if (!-e "$memberdir/admin.outbox") { $mem_missing .= qq~admin.outbox, ~; }  
     else { $mem_created .= qq~admin.outbox, ~; }    }
     if (!-e "$memberdir/admin.vars") { $mem_missing .= qq~admin.vars, ~; }     $brd_missing =~ s/, $//sm; 
     else { $mem_created .= qq~admin.vars, ~; }     $brd_created =~ s/, $//sm; 
     if (!-e "$memberdir/memberlist.txt") { $mem_missing .= qq~memberlist.txt, ~; }     my $brdprint = q{}; 
     else { $mem_created .= qq~memberlist.txt, ~; }     for my $boardstot (@totboards) { 
     if (!-e "$memberdir/memberinfo.txt") { $mem_missing .= qq~memberinfo.txt, ~; }         chomp $boardstot; 
     else { $mem_created .= qq~memberinfo.txt, ~; }         ( $brdname, undef, undef, undef, undef, $msgname, undef ) = 
     if (!-e "$memberdir/members.ttl") { $mem_missing .= qq~members.ttl~; }           split /[|]/xsm, $boardstot; 
     else { $mem_created .= qq~members.ttl~; }         if ( $brdname eq 'general' ) { 
     $mem_missing =~ s/, $//;             $brdprint .= 
     $mem_created =~ s/, $//;  "general|1|1|$firstmstime|admin|$firstmstime|0|Welcome to your new YaBB 2.6.12 forum!|xx|0|\n" 
               or croak 'cannot print FORUMTOTALS';
     $msg_missing = "";         } 
     $msg_created = "";         else { $brdprint .= qq~$boardstot\n~; } 
     }
     if (-e "$boardsdir/forum.totals") {     open $FORUMTOTALS, '>', "$boardsdir/forum.totals" 
           fopen(FORUMTOT, "$boardsdir/forum.totals") || &setup_fatal_error("$maintext_23 $boardsdir/forum.totals: ", 1);       || setup_fatal_error( "$maintext_23 $boardsdir/forum.totals: ", 1 ); 
           @totboards = <FORUMTOT>;     print {$FORUMTOTALS} $brdprint or croak 'cannot print forum.totals'; 
           fclose(FORUMTOT);     close $FORUMTOTALS or croak 'cannot close forum.totals'; 
     }  
     foreach $boardstot (@totboards) {     open $FIRSTMS, '>', "$datadir/$firstmstime.txt" 
           chomp $boardstot;       or croak "cannot open $datadir/$firstmstime.txt"; 
           ($brdname, undef, undef, undef, undef, $msgname, undef) = split(/\|/, $boardstot, 7);     print {$FIRSTMS} 
           next if !$msgname;  qq~Welcome to your New YaBB 2.6.12 Forum!|Administrator|webmaster@mysite.com|$firstmstime|admin|xx|0|127.0.0.1|Welcome to your new YaBB 2.6.12 forum.<br /><br />The YaBB team would like to thank you for choosing Yet another Bulletin Board for your forum needs. We pride ourselves on the cost (FREE), the features, and the security. Visit http://www.yabbforum.com to view the latest development information, read YaBB news, and participate in community discussions.<br /><br />Make sure you login to your new forum as an administrator and visit the Admin Center. From there, you can maintain your forum. You'll want to look at all of the settings, membergroups, categories/boards, and security options to make sure they are set properly according to your needs.||||\n~; 
           if (!-e "$datadir/$msgname.ctb") { $msg_missing .= qq~$msgname.ctb, ~; }     close $FIRSTMS or croak "cannot close $datadir/$firstmstime.txt"; 
           else { $msg_created .= qq~$msgname.ctb, ~; }     require Sources::DateTime; 
           if (!-e "$datadir/$msgname.txt") { $msg_missing .= qq~$msgname.txt, ~; }     $msgdat = timeformat( $firstmstime, 1, 'rfc' ); 
           else { $msg_created .= qq~$msgname.txt~; }     my $frstctb = qq~### ThreadID: $firstmstime, LastModified: $msgdat  ### 
     }  
     $msg_missing =~ s/, $//;  'board',"general" 
     $msg_created =~ s/, $//;  'replies',"0" 
  'views',"1" 
     $var_missing = "";  'lastposter',"admin" 
     $var_created = "";  'lastpostdate',"$firstmstime" 
     if (!-e "$vardir/adminlog.txt") { $var_missing .= qq~adminlog.txt, ~; }  'threadstatus',"0" 
     else { $var_created .= qq~adminlog.txt, ~; }  'repliers',"$firstmstime|admin|0"~; 
     if (!-e "$vardir/allowed.txt") { $var_missing .= qq~allowed.txt, ~; }     open $FIRSTMSC, '>', "$datadir/$firstmstime.ctb" 
     else { $var_created .= qq~allowed.txt, ~; }       or croak "cannot open $datadir/$firstmstime.ctb"; 
     if (!-e "$vardir/attachments.txt") { $var_missing .= qq~attachments.txt, ~; }     print {$FIRSTMSC} $frstctb 
     else { $var_created .= qq~attachments.txt, ~; }       or croak "cannot print $datadir/$firstmstime.ctb"; 
     if (!-e "$vardir/ban_log.txt") { $var_missing .= qq~ban_log.txt, ~; }     close $FIRSTMSC or croak "cannot close $datadir/$firstmstime.ctb"; 
     else { $var_created .= qq~ban_log.txt, ~; }  
     if (!-e "$vardir/clicklog.txt") { $var_missing .= qq~clicklog.txt, ~; }     open $FIRSTBRD, '>>', "$boardsdir/general.txt"; 
     else { $var_created .= qq~clicklog.txt, ~; }     print {$FIRSTBRD} 
     if (!-e "$vardir/errorlog.txt") { $var_missing .= qq~errorlog.txt, ~; }  qq~$firstmstime|Welcome to your New YaBB 2.6 Forum!|Administrator|$webmaster_email|$firstmstime|0|admin|xx|0\n~; 
     else { $var_created .= qq~errorlog.txt, ~; }     close $FIRSTBRD or croak "cannot close general.txt"; 
     if (!-e "$vardir/flood.txt") { $var_missing .= qq~flood.txt, ~; }  
     else { $var_created .= qq~flood.txt, ~; }     $mem_missing = q{}; 
     if (!-e "$vardir/gmodsettings.txt") { $var_missing .= qq~gmodsettings.txt, ~; }     $mem_created = q{}; 
     else { $var_created .= qq~gmodsettings.txt, ~; }    if ( !-e "$memberdir/admin.outbox" ) { $mem_missing .= q~admin.outbox, ~; }
     if (!-e "$vardir/log.txt") { $var_missing .= qq~log.txt, ~; }    else                                 { $mem_created .= q~admin.outbox, ~; }
     else { $var_created .= qq~log.txt, ~; }    if   ( !-e "$memberdir/admin.vars" ) { $mem_missing .= q~admin.vars, ~; }
     if (!-e "$vardir/modlist.txt") { $var_missing .= qq~modlist.txt, ~; }    else                                 { $mem_created .= q~admin.vars, ~; }
     else { $var_created .= qq~modlist.txt, ~; }     if ( !-e "$memberdir/memberlist.txt" ) { 
     if (!-e "$vardir/news.txt") { $var_missing .= qq~news.txt, ~; }         $mem_missing .= q~memberlist.txt, ~; 
     else { $var_created .= qq~news.txt, ~; }    }
     if (!-e "$vardir/oldestmes.txt") { $var_missing .= qq~oldestmes.txt, ~; }    else { $mem_created .= q~memberlist.txt, ~; }
     else { $var_created .= qq~oldestmes.txt, ~; }     if ( !-e "$memberdir/memberinfo.txt" ) { 
     if (!-e "$vardir/registration.log") { $var_missing .= qq~registration.log, ~; }         $mem_missing .= q~memberinfo.txt, ~; 
     else { $var_created .= qq~registration.log, ~; }    }
     if (!-e "$vardir/reserve.txt") { $var_missing .= qq~reserve.txt, ~; }    else { $mem_created .= q~memberinfo.txt, ~; }
     else { $var_created .= qq~reserve.txt, ~; }    if   ( !-e "$memberdir/members.ttl" ) { $mem_missing .= q~members.ttl~; }
     if (!-e "$vardir/reservecfg.txt") { $var_missing .= qq~reservecfg.txt, ~; }    else                                  { $mem_created .= q~members.ttl~; }
     else { $var_created .= qq~reservecfg.txt, ~; }     $mem_missing =~ s/, $//sm; 
     $var_missing =~ s/, $//;     $mem_created =~ s/, $//sm; 
     $var_created =~ s/, $//;  
     $msg_missing = q{};
     $yymain .= qq~     $msg_created = q{}; 
   
     if ( -e "$boardsdir/forum.totals" ) {
         open $FORUMTOT, '<', "$boardsdir/forum.totals" 
           || setup_fatal_error( "$maintext_23 $boardsdir/forum.totals: ", 1 );
         @totboards = <$FORUMTOT>;
         close $FORUMTOT or croak 'cannot close forum.totals';
     }
     for my $boardstot (@totboards) {
         chomp $boardstot;
         ( $brdname, undef, undef, undef, undef, $msgname, undef ) =
           split /[|]/xsm, $boardstot, 7;
         next if !$msgname;
         if ( !-e "$datadir/$msgname.ctb" ) {
             $msg_missing .= qq~$msgname.ctb, ~;
         }
         else { $msg_created .= qq~$msgname.ctb, ~; }
         if ( !-e "$datadir/$msgname.txt" ) {
             $msg_missing .= qq~$msgname.txt, ~;
         }
         else { $msg_created .= qq~$msgname.txt~; }
     }
     $msg_missing =~ s/, $//sm;
     $msg_created =~ s/, $//sm;
   
     $var_missing = q{};
     $var_created = q{};
     if   ( !-e "$vardir/adminlog_new.txt" ) { $var_missing .= q~adminlog_new.txt, ~; }
     else                                { $var_created .= q~adminlog_new.txt, ~; }
     if   ( !-e "$vardir/allowed.txt" ) { $var_missing .= q~allowed.txt, ~; }
     else                               { $var_created .= q~allowed.txt, ~; }
     if ( !-e "$vardir/attachments.txt" ) {
         $var_missing .= q~attachments.txt, ~;
     }
     else { $var_created .= q~attachments.txt, ~; }
     if ( !-e "$vardir/pm.attachments" ) { $var_missing .= q~pm.attachments, ~; }
     else { $var_created .= q~attachments.txt, ~; }
     if   ( !-e "$vardir/ban_log.txt" ) { $var_missing .= q~ban_log.txt, ~; }
     else                               { $var_created .= q~ban_log.txt, ~; }
     if   ( !-e "$vardir/banlist.txt" ) { $var_missing .= q~banlist.txt, ~; }
     else                               { $var_created .= q~banlist.txt, ~; }
     if   ( !-e "$vardir/clicklog.txt" ) { $var_missing .= q~clicklog.txt, ~; }
     else                                { $var_created .= q~clicklog.txt, ~; }
     if   ( !-e "$vardir/errorlog.txt" ) { $var_missing .= q~errorlog.txt, ~; }
     else                                { $var_created .= q~errorlog.txt, ~; }
     if   ( !-e "$vardir/flood.txt" ) { $var_missing .= q~flood.txt, ~; }
     else                             { $var_created .= q~flood.txt, ~; }
   
     if ( !-e "$vardir/gmodsettings.txt" ) {
         $var_missing .= q~gmodsettings.txt, ~;
     }
     else { $var_created .= q~gmodsettings.txt, ~; }
     if   ( !-e "$vardir/log.txt" ) { $var_missing .= q~log.txt, ~; }
     else                           { $var_created .= q~log.txt, ~; }
     if   ( !-e "$vardir/news.txt" ) { $var_missing .= q~news.txt, ~; }
     else                            { $var_created .= q~news.txt, ~; }
     if   ( !-e "$vardir/oldestmes.txt" ) { $var_missing .= q~oldestmes.txt, ~; }
     else                                 { $var_created .= q~oldestmes.txt, ~; }
   
     if ( !-e "$vardir/registration.log" ) {
         $var_missing .= q~registration.log, ~;
     }
     else { $var_created .= q~registration.log, ~; }
     if   ( !-e "$vardir/reserve.txt" ) { $var_missing .= q~reserve.txt, ~; }
     else                               { $var_created .= q~reserve.txt, ~; }
     if ( !-e "$vardir/reservecfg.txt" ) {
         $var_missing .= q~reservecfg.txt, ~;
     }
     else { $var_created .= q~reservecfg.txt, ~; }
     $var_missing =~ s/, $//sm;
     $var_created =~ s/, $//sm;
   
     $yymain .= q~
     <table class="tabtitle">
         <tr>
              <td class="shadow" style="padding-left:1%">Checking System Files</td>
         </tr>
     </table>
<div class="boardcontainer"> <div class="boardcontainer">
     <table width="100%" border="0" cellspacing="1" cellpadding="4">     <table class="border-space pad-cell"> 
     <tr><td width="100%" colspan="2" class="titlebg" align="left">         <col style="width:6%" /> 
     Checking System Files         <col style="width:94%" /> 
     </td></tr>         <tr> 
     <tr><td width="100%" class="catbg" colspan="2" align="left">             <td class="catbg" colspan="2">~; 
     ~;     if ($no_brddir) { 
     if ($no_brddir) {         $install_error = 1; 
           $install_error = 1;         $yymain .= qq~A problem has occurred in the /Boards folder.</td> 
           $yymain .= qq~         </tr><tr> 
     A problem has occurred in the /Boards folder!             <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td> 
     </td></tr>             <td class="windowbg2">No /Boards folder available.</td> 
     <tr><td width="6%" class="windowbg" align="center">         </tr>~; 
     <img src="$imagesdir/a_on.gif" alt="" />     } 
     </td><td width="94%" class="windowbg2" align="left">     else { 
     No /Boards folder available!         if ($brd_missing) { 
     </td></tr>  
           ~;  
     } else {  
           if ($brd_missing) {  
                 $install_error = 1;  
                 $yymain .= qq~  
     A problem has occurred in the /Boards folder!  
     </td></tr>  
     <tr><td width="6%" class="windowbg" align="left">  
     <img src="$imagesdir/a_on.gif" alt="" />  
     </td><td width="94%" class="windowbg2" align="left">  
     <b>Missing: </b><br />  
     $brd_missing  
     </td></tr>  
                 ~;  
           }  
           if ($brd_created) {  
                 if (!$brd_missing) {  
                       $yymain .= qq~  
     Successfully checked the /Boards folder!  
     </td></tr>  
~                       ;  
                 }  
                 $yymain .= qq~  
     <tr><td width="6%" class="windowbg" align="center">  
     <img src="$imagesdir/a_off.gif" alt="" />  
     </td><td width="94%" class="windowbg2" align="left">  
     <b>Installed: </b><br />  
     $brd_created  
     </td></tr>  
                 ~;  
           }  
     }  
     $yymain .= qq~  
     <tr><td width="100%" class="catbg" colspan="2" align="left">  
     ~;  
   
     if ($no_memdir) {  
           $install_error = 1;            $install_error = 1;
           $yymain .= qq~             $yymain .= qq~A problem has occurred in the /Boards folder.</td> 
     A Problem has occurred in the /Members folder!         </tr><tr> 
     </td></tr>             <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td> 
     <tr><td width="6%" class="windowbg" align="center">             <td class="windowbg2"> 
     <img src="$imagesdir/a_on.gif" alt="" />                 <b>Missing: </b> 
     </td><td width="94%" class="windowbg2" align="left">                 <br />$brd_missing 
     No /Members folder available!             </td> 
     </td></tr>         </tr>~; 
           ~;         } 
     } else {        if ($brd_created) {
           if ($mem_missing) {            if ( !$brd_missing ) {
                 $install_error = 1;                 $yymain .= q~Successfully checked the /Boards folder.</td> 
                 $yymain .= qq~         </tr>~; 
     A problem has occurred in the /Members folder!             } 
     </td></tr>             $yymain .= qq~<tr> 
     <tr><td width="6%" class="windowbg" align="center">             <td class="windowbg center"> 
     <img src="$imagesdir/a_on.gif" alt="" />      <img src="$imagesdir/check.png" alt="" />
     </td><td width="94%" class="windowbg2" align="left">             </td> 
     <b>Missing: </b><br />             <td class="windowbg2"><b>Installed: </b><br />$brd_created</td> 
     $mem_missing         </tr>~; 
     </td></tr>         } 
                 ~;     } 
           }     $yymain .= q~<tr> 
           if ($mem_created) {             <td class="catbg" colspan="2">~; 
                 if (!$mem_missing) {  
                       $yymain .= qq~     if ($no_memdir) { 
     Successfully checked the /Members folder!         $install_error = 1; 
     </td></tr>         $yymain .= qq~A Problem has occurred in the /Members folder.</td> 
                       ~;         </tr><tr> 
                 }             <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td> 
                 $yymain .= qq~             <td class="windowbg2">No /Members folder available.</td> 
     <tr><td width="6%" class="windowbg" align="center">         </tr>~; 
     <img src="$imagesdir/a_off.gif" alt="" />     } 
     </td><td width="94%" class="windowbg2" align="left">     else { 
     <b>Installed: </b><br />         if ($mem_missing) { 
     $mem_created  
     </td></tr>  
                 ~;  
           }  
     }  
     $yymain .= qq~  
     <tr><td width="100%" class="catbg" colspan="2" align="left">  
     ~;  
   
     if ($no_mesdir) {  
           $install_error = 1;            $install_error = 1;
           $yymain .= qq~             $yymain .= qq~A problem has occurred in the /Members folder.</td> 
     A problem has occurred in the /Messages folder!         </tr><tr> 
     </td></tr>             <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td> 
     <tr><td width="6%" class="windowbg" align="center">             <td class="windowbg2"><b>Missing: </b><br />$mem_missing</td> 
     <img src="$imagesdir/a_on.gif" alt="" />         </tr>~; 
     </td><td width="94%" class="windowbg2" align="left">         } 
     No /Messages folder available!         if ($mem_created) { 
     </td></tr>             if ( !$mem_missing ) { 
           ~;                 $yymain .= q~Successfully checked the /Members folder.</td> 
     } else {         </tr>~; 
           if ($msg_missing) {             } 
                 $install_error = 1;             $yymain .= qq~<tr> 
                 $yymain .= qq~             <td class="windowbg center"><img src="$imagesdir/check.png" alt="" /></td> 
     A problem has occurred in the /Messages folder!             <td class="windowbg2"><b>Installed: </b><br />$mem_created</td> 
     </td></tr>         </tr>~; 
     <tr><td width="6%" class="windowbg" align="center">         } 
     <img src="$imagesdir/a_on.gif" alt="" />     } 
     </td><td width="94%" class="windowbg2" align="left">     $yymain .= q~<tr> 
     <b>Missing: </b><br />             <td class="catbg" colspan="2">~; 
     $msg_missing  
     </td></tr>     if ($no_mesdir) { 
                 ~;         $install_error = 1; 
           }         $yymain .= qq~A problem has occurred in the /Messages folder.</td> 
           if ($msg_created) {         </tr><tr> 
                 if (!$msg_missing) {             <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td> 
                       $yymain .= qq~             <td class="windowbg2">No /Messages folder available.</td> 
     Successfully checked the /Messages folder!         </tr>~; 
     </td></tr>     } 
                       ~;     else { 
                 }         if ($msg_missing) { 
                 $yymain .= qq~  
     <tr><td width="6%" class="windowbg" align="center">  
     <img src="$imagesdir/a_off.gif" alt="" />  
     </td><td width="94%" class="windowbg2" align="left">  
     <b>Installed: </b><br />  
     $msg_created  
     </td></tr>  
                 ~;  
           }  
     }  
     $yymain .= qq~  
     <tr><td width="100%" class="catbg" colspan="2" align="left">  
     ~;  
     if ($no_vardir) {  
           $install_error = 1;            $install_error = 1;
           $yymain .= qq~             $yymain .= qq~A problem has occurred in the /Messages folder.</td> 
     A problem has occurred in the /Variables folder!         </tr><tr> 
     </td></tr>             <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td> 
     <tr><td width="6%" class="windowbg" align="center">             <td class="windowbg2"><b>Missing: </b><br />$msg_missing</td> 
     <img src="$imagesdir/a_on.gif" alt="" />         </tr>~; 
     </td><td width="94%" class="windowbg2" align="left">         } 
     No /Variables folder available!         if ($msg_created) { 
     </td></tr>             if ( !$msg_missing ) { 
           ~;                 $yymain .= q~Successfully checked the /Messages folder.</td> 
     } else {         </tr>~; 
           if ($var_missing) {             } 
                 $install_error = 1;             $yymain .= qq~<tr> 
                 $yymain .= qq~             <td class="windowbg center"><img src="$imagesdir/check.png" alt="" /></td> 
     A problem has occurred in the /Variables folder!             <td class="windowbg2"><b>Installed: </b><br />$msg_created</td> 
     </td></tr>         </tr>~; 
     <tr><td width="6%" class="windowbg" align="center">         } 
     <img src="$imagesdir/a_on.gif" alt="" />     } 
     </td><td width="94%" class="windowbg2" align="left">     $yymain .= q~<tr> 
     <b>Missing: </b><br />             <td class="catbg" colspan="2">~; 
     $var_missing     if ($no_vardir) { 
     </td></tr>         $install_error = 1; 
                 ~;         $yymain .= qq~A problem has occurred in the /Variables folder.</td> 
           }         </tr><tr> 
           if ($var_created) {             <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td> 
                 if (!$var_missing) {             <td class="windowbg2">No /Variables folder available.</td> 
                       $yymain .= qq~         </tr>~; 
     Successfully checked the /Variables folder!     } 
     </td></tr>     else { 
                       ~;         if ($var_missing) { 
                 }  
                 $yymain .= qq~  
     <tr><td width="6%" class="windowbg" align="center">  
     <img src="$imagesdir/a_off.gif" alt="" />  
     </td><td width="94%" class="windowbg2" align="left">  
     <b>Installed: </b><br />  
     $var_created  
     </td></tr>  
                 ~;  
           }  
     }  
   
     $yymain .= qq~  
     <tr><td width="100%" class="catbg" colspan="2" align="left">  
     ~;  
   
     if ($set_missing) {  
           $install_error = 1;            $install_error = 1;
           $yymain .= qq~             $yymain .= qq~A problem has occurred in the /Variables folder.</td> 
     A problem has occurred while creating Settings.pl!         </tr><tr> 
     </td></tr>             <td class="windowbg center"><img src="$imagesdir/cross.png" alt="" /></td> 
           ~;             <td class="windowbg2"><b>Missing: </b><br />$var_missing</td> 
     }         </tr>~; 
     if ($set_created) {         } 
           $yymain .= qq~         if ($var_created) { 
     Successfully checked Settings.pl!             if ( !$var_missing ) { 
     </td></tr>                 $yymain .= q~Successfully checked the /Variables folder.</td> 
     <tr><td width="6%" class="windowbg" align="center">         </tr>~; 
     <img src="$imagesdir/a_off.gif" alt="" />             } 
     </td><td width="94%" class="windowbg2" align="left">             $yymain .= qq~<tr> 
     Click on 'Continue' and go to your <i>Admin Center - Forum Settings</i> to set the options for your YaBB 2.5.2 forum.<br />             <td class="windowbg center"><img src="$imagesdir/check.png" alt="" /></td> 
     Click on 'Convert' to convert your YaBB 1 Gold - SP 1.x forum to YaBB 2.5.2.             <td class="windowbg2"><b>Installed: </b><br />$var_created</td> 
     </td></tr>         </tr>~; 
           ~;         } 
     }    }
   
     if (!$install_error) {     $yymain .= q~<tr> 
             <td class="catbg" colspan="2">~;
           $yymain .= qq~  
     <tr><td width="100%" class="catbg" colspan="2" align="center">     if ($set_missing) { 
     <form action="$set_cgi?action=ready;nextstep=YaBB" method="post" style="display: inline;">         $install_error = 1; 
         $yymain .= q~A problem has occurred while creating Settings.pm.</td>
         </tr>~;
     }
     if ($set_created) {
         $yymain .= qq~Successfully checked Settings.pm.</td>
         </tr><tr>
             <td class="windowbg center"><img src="$imagesdir/check.png" alt="" /></td>
             <td class="windowbg2">
                 Click on 'Continue' and go to your <i>Admin Center - Forum Settings</i> to set the options for your YaBB 2.6.12 forum.<br />Or to convert a 1x or 2x Forum to 2.6.12
             </td>
         </tr>~;
     }
   
     if ( !$install_error ) {
   
         $yymain .= qq~<tr>
             <td class="catbg center" colspan="2">
             <form action="$set_cgi?action=ready;nextstep=YaBB" method="post" style="display: inline;">
           <input type="submit" value="Continue" />            <input type="submit" value="Continue" />
     </form>            </form>
     &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;             <p class="center">You can access the 1x and 2x Conversion Utilities through the Admin Center</p> 
     <form action="$set_cgi?action=ready;convert=1;nextstep=Setup" method="post" style="display: inline;">             </td> 
           <input type="submit" value="Convert" />         </tr>~; 
     </form>     } 
     </td></tr>     else { 
           ~;         $yymain .= q~<tr> 
     } else {             <td class="titlebg" colspan="2"> 
           $yymain .= qq~                 <div class="div98"><b>One or more errors occurred while checking the system files. The problems must be solved before you can continue.</b></div> 
     <tr><td width="100%" class="catbg" colspan="2" align="left">             </td> 
     <div style="float: left; width: 98%; font-family: verdana; color: #900000; font-size: 11px; padding: 2px;"><b>One or more errors occurred while checking the system files. The problems must be solved before you may continue.</b></div>         </tr>~; 
     </td></tr>     } 
           ~;     $yymain .= q~ 
     }  
     $yymain .= qq~  
     </table>      </table>
</div> </div>
     ~;      ~;
     $yyim    = "You are running YaBB 2.5.2 Setup.";     $yyim    = 'You are running YaBB 2.6.12 Setup.'; 
     $yytitle = "YaBB 2.5.2 Setup";     $yytitle = 'YaBB 2.6.12 Setup'; 
     &SetupTemplate;     SetupTemplate(); 
     return;
} }
   
sub ready { sub ready {
     if ($INFO{'nextstep'} eq 'Setup') { $yySetLocation = qq~$INFO{'nextstep'}.$yyext?convert=1~; }     if ( -e "$INFO{'nextstep'}.$yyext" ) { 
     elsif (-e "$INFO{'nextstep'}.$yyext") { &UpdateCookie("delete"); $yySetLocation = qq~$INFO{'nextstep'}.$yyext?action=revalidatesession~;}         UpdateCookie('delete'); 
         $yySetLocation = qq~$INFO{'nextstep'}.$yyext?action=revalidatesession~;
     &CreateSetupLock;     } 
     unlink "$vardir/cook.txt";  
     &redirectexit;     CreateSetupLock(); 
}     unlink "$vardir/cook.txt"; 
     redirectexit();
sub CreateConvLock {     return; 
     fopen("LOCKFILE", ">$vardir/Converter.lock") || &setup_fatal_error("$maintext_23 $vardir/Converter.lock: ", 1);  
     print LOCKFILE q~This is a lockfile for the Converter.\n~;  
     print LOCKFILE q~It prevents it being run again after it has been run once.\n~;  
     print LOCKFILE q~Delete this file if you want to run the Converter again.~;  
     fclose("LOCKFILE");  
   
     unlink("$vardir/ConvSettings.txt");  
} }
   
sub CreateSetupLock { sub CreateSetupLock {
     fopen("LOCKFILE", ">$vardir/Setup.lock") || &setup_fatal_error("$maintext_23 $vardir/Setup.lock: ", 1);     my $lock = <<LOCK; 
     print LOCKFILE q~This is a lockfile for the Setup Utility.\n~;  This is a lockfile for the Setup Utility. 
     print LOCKFILE q~It prevents it being run again after it has been run once.\n~;  It prevents it being run again after it has been run once. 
     print LOCKFILE q~Delete this file if you want to run the Setup Utility again.~;  Delete this file if you want to run the Setup Utility again. 
     fclose("LOCKFILE");  LOCK 
     open $LOCKFILE, '>', "$vardir/Setup.lock" 
       || setup_fatal_error( "$maintext_23 $vardir/Setup.lock: ", 1 );
     print {$LOCKFILE} $lock or croak 'cannot print to Setup.lock';
     close $LOCKFILE or croak 'cannot close Setup.lock';
     return;
} }
   
sub SetupImgLoc { sub SetupImgLoc {
     if (!-e "$forumstylesdir/$useimages/$_[0]") { $thisimgloc = qq~img src="$forumstylesurl/default/$_[0]"~; }     if ( !-e "$htmldir/Templates/Forum/$useimages/$_[0]" ) { 
     else { $thisimgloc = qq~img src="$imagesdir/$_[0]"~; }         $thisimgloc = qq~img src="$yyhtml_root/Templates/Forum/default/$_[0]"~; 
     return $thisimgloc;     } 
}    else { $thisimgloc = qq~img src="$imagesdir/$_[0]"~; }
     return $thisimgloc;
sub tabmenushow { # used by the converter  
     if (-e "$vardir/Setup.lock") {  
           $tabsep = qq~<img src="$imagesdir/tabsep211.png" border="0" alt="" style="float: left; vertical-align: middle;" />~;  
           $tabfill = qq~<img src="$imagesdir/tabfill.gif" border="0" alt="" style="vertical-align: middle;" />~;  
   
           $NavLink1 = qq~<span>$tabfill Members $tabfill</span>~;  
           $NavLink2 = qq~$tabsep<span>$tabfill Boards & Categories $tabfill</span>~;  
           $NavLink3 = qq~$tabsep<span>$tabfill Messages $tabfill</span>~;  
           $NavLink4 = qq~$tabsep<span>$tabfill Date & Time $tabfill</span>~;  
           $NavLink5 = qq~$tabsep<span>$tabfill Clean Up $tabfill</span>~;  
           $NavLink6 = qq~$tabsep<span>$tabfill Login $tabfill</span>$tabsep&nbsp;~;  
   
           $NavLink1a = qq~<span class="selected"><a href="$set_cgi?action=members;st=$INFO{'st'}" style="color: #FF3333;" class="selected" onClick="PleaseWait();">$tabfill Members $tabfill</a></span>~;  
           $NavLink2a = qq~$tabsep<span class="selected"><a href="$set_cgi?action=cats;st=$INFO{'st'}" style="color: #FF3333;" class="selected" onClick="PleaseWait();">$tabfill Boards & Categories $tabfill</a></span>~;  
           $NavLink3a = qq~$tabsep<span class="selected"><a href="$set_cgi?action=messages;st=$INFO{'st'}" style="color: #FF3333;" class="selected" onClick="PleaseWait();">$tabfill Messages $tabfill</a></span>~;  
           $NavLink4a = qq~$tabsep<span class="selected"><a href="$set_cgi?action=dates;st=$INFO{'st'}" style="color: #FF3333;" class="selected" onClick="PleaseWait();">$tabfill Date & Time $tabfill</a></span>~;  
           $NavLink5a = qq~$tabsep<span class="selected"><a href="$set_cgi?action=cleanup;st=$INFO{'st'}" style="color: #FF3333;" class="selected" onClick="PleaseWait();">$tabfill Clean Up $tabfill</a></span>~;  
           $NavLink6a = qq~$tabsep<span class="selected"><a href="$boardurl/YaBB.$yyext?action=login" style="color: #FF3333;" class="selected">$tabfill Login $tabfill</a></span>$tabsep&nbsp;~;  
   
           $ConvDone = qq~  
           <div style="float: left; width: 102px; height: 10px; margin: 1px; background-color: #6699cc; border: 1px black solid; font-size: 5px;">&nbsp;</div>  
           <div style="float: left; width: 50px; height: 14px; text-align: right; color: #FF3333;">100 %</div><br />  
           ~;  
   
           $ConvNotDone = qq~  
           <div style="float: left; width: 102px; height: 10px; margin: 1px; background-color: #dddddd; border: 1px black solid; font-size: 5px;">&nbsp;</div>  
           <div style="float: left; width: 50px; height: 14px; text-align: right; color: #bbbbbb;">0 %</div><br />  
           ~;  
     }  
}  
   
sub FoundConvLock {  
     &tempstarter;  
     &tabmenushow;  
   
     $yytabmenu = $NavLink1 . $NavLink2 . $NavLink3 . $NavLink4 . $NavLink5 . $NavLink6;  
   
     $formsession = &cloak("$mbname$username");  
   
     $yymain = qq~  
<div class="bordercolor" style="padding: 0px; width: 100%; margin-left: 0px; margin-right: 0px;">  
     <table width="100%" cellspacing="1" cellpadding="4">  
     <tr valign="middle">  
           <td width="100%" colspan="2" class="titlebg" align="left">  
           YaBB 2.5.2 Converter  
           </td>  
     </tr>  
     <tr valign="middle">  
           <td width="5%" class="windowbg" align="center">  
           <img src="$imagesdir/info.gif" alt="" />  
           </td>  
           <td width="95%" class="windowbg2" align="left" style="font-size: 11px;">  
           Setup and Converter has already been run, attempting to run them again will cause damage to your files.<br />  
           <br />  
           To run Setup again, remove the file "$vardir/Setup.lock" then re-visit this page.<br />  
           To run Converter again, remove the file "$vardir/Converter.lock," then re-visit this page.  
           </td>  
     </tr>  
     <tr>  
           <td width="100%" class="catbg" colspan="2" align="center">  
           <form action="$boardurl/YaBB.$yyext" method="post" style="display: inline;">  
                 <input type="submit" value="Go to your Forum" />  
                 <input type="hidden" name="formsession" value="$formsession" />  
           </form>  
           </td>  
     </tr>  
     </table>  
</div>  
     ~;  
   
     $yyim    = "YaBB 2.5.2 Setup and Converter has already been run.";  
     $yytitle = "YaBB 2.5.2 Setup/Converter";  
     &SetupTemplate;  
} }
   
sub setup_fatal_error { sub setup_fatal_error {
     my $e = $_[0];    my $e = $_[0];
     my $v = $_[1];    my $v = $_[1];
     $e .= "\n";    $e .= "\n";
     if ($v) { $e .= $! . "\n"; }    if ($v) { $e .= $OS_ERROR . "\n"; }
   
     $yymenu = qq~Boards & Categories | ~;    $yymenu = qq~Boards & Categories | ~;
     $yymenu .= qq~Members | ~;    $yymenu .= qq~Members | ~;
     $yymenu .= qq~Messages | ~;    $yymenu .= qq~Messages | ~;
     $yymenu .= qq~Date & Time | ~;    $yymenu .= qq~Date & Time | ~;
     $yymenu .= qq~Clean Up | ~;    $yymenu .= qq~Clean Up | ~;
     $yymenu .= qq~Login~;    $yymenu .= qq~Login~;
   
     $yymain .= qq~    $yymain .= qq~
<table border="0" width="80%" cellspacing="1" class="bordercolor" align="center" cellpadding="4">  <table class="bordercolor center border-space pad-cell" width="80%" > 
 <tr>    <tr>
   <td class="titlebg"><span class="text1"><b>An Error Has Occurred!</b></span></td>         <td class="titlebg text1"><b>An Error Has Occurred!</b></td> 
 </tr><tr>  </tr><tr>
   <td class="windowbg"><br /><span class="text1">$e</span><br /><br /></td>         <td class="windowbg text1" style="padding:1em 1em 2em 1em">$e</td> 
 </tr>    </tr>
</table> </table>
<center><br /><a href="javascript:history.go(-1)">Back</a></center>  <p style="text-align:center"><a href="javascript:history.go(-1)">Back</a></p> 
     ~; ~;
     $yyim    = "YaBB 2.5.2 Convertor Error.";    $yyim    = "YaBB 2.6.12 Setup Error.";
     $yytitle = "YaBB 2.5.2 Convertor Error.";    $yytitle = "YaBB 2.6.12 Setup Error.";
   
     &SimpleOutput if !-e "$vardir/Settings.pl";     if ( !-e "$vardir/Settings.pm" ) { SimpleOutput(); } 
   
     &tempstarter;     tempstarter(); 
     &SetupTemplate;     SetupTemplate(); 
} }
   
sub SimpleOutput { sub SimpleOutput {
     $gzcomp = 0;    $gzcomp = 0;
     &print_output_header;     print_output_header(); 
   
     print qq~    print qq~
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">  <!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml">  <html lang='en-US'> 
<head> <head>
<title>YaBB 2.5.2 Setup</title>     <meta charset="utf-8"> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />     <title>YaBB 2.6.12 Setup</title> 
     <style type="text/css">
         html, body {color:#000; font-family:Verdana, Helvetica, Arial, Sans-Serif; font-size:13px; background-color:#eee}
         div#folderfind { margin:1em auto; padding:0 1em}
         #folderfind table {width:100%; background-color:#DDE3EB; margin:0 auto; border-collapse:collapse;}
         #folderfind td {text-align:left; padding:3px; border:thin #000 solid;}
         #folderfind .txt_a {font-size:11px;}
         #folderfind .windowbg {background-color: $windowbg;}
         #folderfind .windowbg2 {background-color: $windowbg2;}
         #folderfind .header {background-color:$header;}
         #folderfind .catbg {background-color:$catbg; text-align:center; color:#fff; }
     </style>
</head> </head>
<body> <body>
   
<!-- Main Content --> <!-- Main Content -->
<div style="height: 40px;">&nbsp;</div>  $yymain 
<center>$yymain</center>  
</body> </body>
</html> </html>
     ~;     ~ or croak 'cannot print page to screen'; 
     exit;    exit;
} }
   
sub SetupTemplate { sub SetupTemplate {
     $gzcomp = fileno GZIP ? 1 : 0;    $gzcomp = fileno GZIP ? 1 : 0;
     &print_output_header;     print_output_header(); 
   
     $yyposition = $yytitle;    $yyposition = $yytitle;
     $yytitle = "$mbname - $yytitle";    $yytitle    = "$mbname - $yytitle";
   
     $yyimages = $imagesdir;    $yyimages        = $imagesdir;
     $yydefaultimages = $defaultimagesdir;    $yydefaultimages = $defaultimagesdir;
     $yystyle = qq~<link rel="stylesheet" href="$forumstylesurl/$usestyle.css" type="text/css" />~;     $yystyle = 
     $yystyle =~ s~$usestyle\/~~g;  qq~<link rel="stylesheet" href="$yyhtml_root/Templates/Forum/$usestyle.css" type="text/css" />\n<link rel="stylesheet" href="$yyhtml_root/Templates/Forum/setup.css" type="text/css" />\n~; 
     $yystyle =~ s/$usestyle\///gxsm;
     $yytemplate = "$templatesdir/$usehead/$usehead.html";  
     fopen(TEMPLATE, "$yytemplate") || &setup_fatal_error("$maintext_23 $yytemplate: ", 1);     $yytemplate = "$templatesdir/$usehead/$usehead.html"; 
     @yytemplate = <TEMPLATE>;     fopen( TEMPLATE, "$yytemplate" ) 
     fclose(TEMPLATE);       || setup_fatal_error( "$maintext_23 $yytemplate: ", 1 ); 
     @yytemplate = <TEMPLATE>;
     my $output = '';     fclose(TEMPLATE); 
     $yyboardname = $mbname;  
     $yytime = &timeformat($date, 1);     my $output = q{}; 
   if    ($hour >= 12 && $hour < 18) { $wmessage = $maintxt{'247a'}; } # Afternoon     $yyboardname = $mbname; 
   elsif ($hour <  12 && $hour >= 0) { $wmessage = $maintxt{'247m'}; } # Morning     $yytime = timeformat( $date, 1 ); 
   else                              { $wmessage = $maintxt{'247e'}; } # Evening     $yyuname = 
     $yyuname = $iamguest ? '' : qq~$wmessage ${$uid.$username}{'realname'}, ~;      $iamguest ? q{} : qq~$maintxt{'247'} ${$uid.$username}{'realname'}, ~;
   
     if ($enable_news) {    if ($enable_news) {
           fopen(NEWS, "$vardir/news.txt");         fopen( NEWS, "$vardir/news.txt" ); 
           @newsmessages = <NEWS>;        @newsmessages = <NEWS>;
           fclose(NEWS);        fclose(NEWS);
     }    }
     for (my $i = 0; $i < @yytemplate; $i++) {    for my $i ( 0 .. $#yytemplate ) {
           $curline = $yytemplate[$i];        $curline = $yytemplate[$i];
           if (!$yycopyin && ($curline =~ m~<yabb copyright>~ || $curline =~ /{yabb copyright}/)) { $yycopyin = 1; }         if ( !$yycopyin && $curline =~ m/{yabb copyright}/sm ) { 
           if ($curline =~ m~<yabb newstitle>~ && $enable_news) {             $yycopyin = 1; 
                 $yynewstitle = qq~<b>$maintxt{'102'}:</b> ~;         } 
           }         if ( $curline =~ m/{yabb newstitle}/sm && $enable_news ) { 
           if ($curline =~ m~<yabb news>~ && $enable_news) {             $yynewstitle = 
                 srand;               qq~<b>$maintxt{'102'}:</b>  <span id="newsdiv"></span>~; 
                 if ($shownewsfader == 1) {         } 
         if ( $curline =~ m/{yabb\ news}/xsm && $enable_news ) {
                       $fadedelay = ($maxsteps * $stepdelay);             srand; 
                       $yynews .= qq~             if ( $shownewsfader == 1 ) { 
                       <script language="JavaScript1.2" type="text/javascript">  
                             <!--                 $fadedelay = ( $maxsteps * $stepdelay ); 
                                   var maxsteps = "$maxsteps";                 $yynews .= qq~ 
                                   var stepdelay = "$stepdelay";                     <script type="text/javascript"> 
                                   var fadelinks = $fadelinks;                         var maxsteps = "$maxsteps"; 
                                   var delay = "$fadedelay";                         var stepdelay = "$stepdelay"; 
                                   var bcolor = "$color{'faderbg'}";                         var fadelinks = $fadelinks; 
                                   var tcolor = "$color{'fadertext'}";                         var delay = "$fadedelay"; 
                                   var fcontent = new Array();                         var bcolor = "$color{'faderbg'}"; 
                                   var begintag = "";                         var tcolor = "$color{'fadertext'}"; 
                       ~;                         var fcontent = new Array(); 
                       fopen(NEWS, "$vardir/news.txt");                         var begintag = ""; 
                       @newsmessages = <NEWS>;                     ~; 
                       fclose(NEWS);                 open $NEWS, '<', "$vardir/news.txt" or croak 'cannot open NEWS'; 
                       for (my $j = 0; $j < @newsmessages; $j++) {                 @newsmessages = <$NEWS>; 
                             $newsmessages[$j] =~ s/\n|\r//g;                 close $NEWS or croak 'cannot close NEWS'; 
                             if ($newsmessages[$j] eq '') { next; }                 for my $j ( 0 .. $#newsmessages ) { 
                             if ($i != 0) { $yymain .= qq~\n~; }                     $newsmessages[$j] =~ s/\n|\r//gxsm; 
                             $message = $newsmessages[$j];                     if ( $newsmessages[$j] eq q{} ) { next; } 
                             if ($enable_ubbc) {                     if ( $i != 0 ) { $yymain .= qq~\n~; } 
                                   if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; }                     $message = $newsmessages[$j]; 
                                   &DoUBBC;                     if ($enable_ubbc) { 
                             }                         enable_yabbc(); 
                             $message =~ s/"/\\"/g;                         DoUBBC(); 
                             $yynews .= qq~                     } 
                     $message =~ s/\x22/\\\x22/gxsm;
                     $yynews .= qq~
                                   fcontent[$j] = "$message";\n                                    fcontent[$j] = "$message";\n
                             ~;                              ~;
                       }                }
                       $yynews .= qq~                 $yynews .= q~ 
                                   var closetag = '';                            var closetag = '';
                             // -->  
                       </script>                        </script>
                       ~;                        ~;
                 } else {  
                       $message = $newsmessages[int rand(@newsmessages)];  
                       if ($enable_ubbc) {  
                             if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; }  
                             &DoUBBC;  
                       }  
                       $yynews = $message;  
                 }  
           }            }
           $yyurl = $scripturl;             else { 
           $curline =~ s~{yabb\s+(\w+)}~${"yy$1"}~g;                 $message = $newsmessages[ int rand @newsmessages ]; 
           $curline =~ s~<yabb\s+(\w+)>~${"yy$1"}~g;                 if ($enable_ubbc) { 
           $curline =~ s~img src\=\"$imagesdir\/(.+?)\"~&SetupImgLoc($1)~eisg;                     enable_yabbc(); 
           $output .= $curline;                     DoUBBC(); 
     }                }
     if ($yycopyin == 0) {                 $message =~ s/\x27/&\x2339;/xsm; 
           $output = q~<h1 style="text-align:center"><b>Sorry, the copyright tag <yabb copyright> must be in the template.<br />Please notify this forum's administrator that this site is using an ILLEGAL copy of YaBB!</b></h1>~; #';                 $yynews = qq~ 
     }             <script type="text/javascript"> 
     if (fileno GZIP) {                 if (ie4 || DOM2) var news = '$message'; 
           $| = 1;                 var div = document.getElementById("newsdiv"); 
           print GZIP $output;                 div.innerHTML = news; 
           close(GZIP);             </script>~; 
     } else {             } 
           print $output;         } 
     }         $yyurl = $scripturl; 
     exit;         $curline =~ s/{yabb\s+(\w+)}/${"yy$1"}/gxsm; 
         $curline =~ s/<yabb\s+(\w+)>/${"yy$1"}/gxsm;
         $curline =~ s/img src\=\"$imagesdir\/(.+?)\"/SetupImgLoc($1)/eigxsm;
         $output .= $curline;
     }
     if ( $yycopyin == 0 ) {
         $output =
  qq~<h1 style="text-align:center"><b>Sorry, the copyright tag &\x23123;yabb copyright&\x23125; must be in the template.<br />Please notify this forum&\x2339;s administrator that this site is using an ILLEGAL copy of YaBB!</b></h1>~;
     }
     if ( fileno GZIP ) {
         $OUTPUT_AUTOFLUSH = 1;
         print {GZIP} $output or croak 'cannot print gzip';
         close GZIP or croak 'cannot close GZIP';
     }
     else {
         print $output or croak 'cannot print output';
     }
     exit;
} }
   
sub nicely_aligned_file { sub nicely_aligned_file {
     my $filler = ' ' x 50; # Make files look nicely aligned. The comment starts after 50 Col     $filler = q{ } x 50; 
   
      local *cut_comment = sub {     # Make files look nicely aligned. The comment starts after 50 Col 
#      sub cut_comment { # line brake of too long comments  
           my ($comment,$length) = ('',120); # 120 Col is the max width of page     my $setfile = shift; 
           my $var_length = length($_[0]);     $setfile =~ s/=\s+;/= 0;/gsm; 
           while ($length < $var_length) { $length += 120; }     $setfile =~ 
           foreach (split(/ +/, $_[1])) {  s/(.+;)[ \t]+(\x23.+$)/ $1 . substr($filler,(length $1 < 50 ? length $1 : 49)) . $2 /gem; 
                 if (($var_length + length($comment) + length($_)) > $length) {     $setfile =~ s/\t+(\x23.+$)/$filler$1/gsm; 
                       $comment =~ s/ $//;  
                       $comment .= "\n$filler#  $_ ";     *cut_comment = sub {    # line break of too long comments 
                       $length += 120;         my @x = @_; 
                 } else { $comment .= "$_ "; }         my ( $comment, $length ) = 
           }           ( q{}, 120 );     # 120 Col is the max width of page 
           $comment =~ s/ $//;         my $var_length = length $x[0]; 
           return $comment;         while ( $length < $var_length ) { $length += 120; } 
     };         foreach ( split / +/sm, $x[1] ) { 
     my $setfile = shift;             if ( ( $var_length + length($comment) + length $_ ) > $length ) { 
     $setfile =~ s~(.+;)[ \t]+(#.+$)~ $1 . substr($filler,(length $1 < 50 ? length $1 : 49)) . $2 ~gem;                 $comment =~ s/ $//sm; 
     $setfile =~ s~\t+(#.+$)~$filler$1~gm;                 $comment .= "\n$filler#  $_ "; 
     $setfile =~ s~(.+)(#.+$)~ $1 . &cut_comment($1,$2) ~gem;                 $length += 120; 
     return $setfile;             } 
             else { $comment .= "$_ "; }
         }
         $comment =~ s/ $//sm;
         return $comment;
     };
     $setfile =~ s/(.+)(#.+$)/ $1 . cut_comment($1,$2) /gem;
     return $setfile;
  }
   
  sub FoundSetupLock {
     tempstarter();
     $scripturl = "$boardurl/YaBB.$yyext";
   
     if ( -e "$vardir/Converter.lock" ) {
         $conv = q{};
         $conv2 =
  qq~The 1x to 2.6.12 Converter has already been run.<br />To run the Converter again, remove the file "$vardir/Converter.lock," then re-visit this page.~;
   
     }
     else {
         $conv =
           qq~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                 <form action="Convert.$yyext" method="post" style="display: inline;">
                     <input type="submit" value="Convert 1x files" />
                 </form>~;
     }
     if ( -e "$vardir/Convert2x.lock" ) {
         $fixa = q{};
         $fixa2 =
  qq~The 2x Conversion Utility has already been run.<br />To run Utility again, remove the file "$vardir/Convert2x.lock," then re-visit this page.~;
   
     }
     else {
         $fixa =
           qq~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                 <form action="Convert2x.$yyext" method="post" style="display: inline;">
                     <input type="submit" value="Convert 2x files" />
                 </form>~;
     }
   
     $yymain = qq~
  <div class="bordercolor borderbox">
     <table class="tabtitle">
         <tr>
             <td style="padding-left:1%; text-shadow: 1px 1px 1px #2d2d2d;">
                 YaBB 2.6.12 Setup
             </td>
         </tr>
     </table>
     <table>
         <col style="width:5%" />
         <col style="width:95%" />
         <tr>
             <td class="windowbg2 center" style="padding: 4px">
                 <img src="$imagesdir/info.png" alt="" />
             </td>
             <td class="windowbg2 center" style="padding: 4px">
                 Setup has already been run.
                 <br />
                 To run Setup again, remove the file "$vardir/Setup.lock" then re-visit this page.<br />
                 $conv2
                 $fixa2
             </td>
         </tr><tr>
             <td class="catbg center"  style="padding: 4px" colspan="2">
                 <form action="$boardurl/YaBB.$yyext" method="post" style="display: inline;">
                     <input type="submit" value="Go to your Forum" />
                 </form>
                 $conv
                 $fixa
             </td>
         </tr>
     </table>
  </div>
       ~;
   
     $yyim    = 'YaBB 2.6.12 Setup has already been run.';
     $yytitle = 'YaBB 2.6.12 Setup';
     template();
     return;
} }
   
1; 1;