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="" />  
                 </