F:\WEBSITES\testbed\zipped\yabb_svn_new\branches\2.5.2\cgi-bin\yabb2\AdminIndex.pl F:\WEBSITES\testbed\zipped\yabb_svn_new\trunk\cgi-bin\yabb2\AdminIndex.pl
#!/usr/bin/perl -- #!/usr/bin/perl --
  # $Id: YaBB AdminIndex$
  # $HeadURL: YaBB $
  # $Source: /AdminIndex.pl $
############################################################################### ###############################################################################
# AdminIndex.pl                                                               # # AdminIndex.pl                                                               #
  # $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.                      #
############################################################################### ###############################################################################
  no warnings qw(uninitialized once redefine);
  use CGI::Carp qw(fatalsToBrowser);
  use English qw(-no_match_vars);
  our $VERSION = '2.6.12';
   
### Version Info ### ### Version Info ###
$YaBBversion = 'YaBB 2.5.2';  $YaBBversion     = 'YaBB 2.6.12'; 
$adminindexplver = 'YaBB 2.5.2 $Revision: 1.3 $'; $adminindexplver = 'YaBB 2.6.12 $Revision: 1651 $';
   
# use CGI::Carp qw(fatalsToBrowser); # used only for tests  
   
# Make sure the module path is present # Make sure the module path is present
push(@INC, "./Modules");  push @INC, './Modules'; 
   
if ($ENV{'SERVER_SOFTWARE'} =~ /IIS/) { if ( $ENV{'SERVER_SOFTWARE'} =~ /IIS/sm ) {
     $yyIIS = 1;    $yyIIS = 1;
     $0 =~ m~(.*)(\\|/)~;     if ( $PROGRAM_NAME =~ m{(.*)(\\|/)}xsm ) { 
     $yypath = $1;        $yypath = $1;
     $yypath =~ s~\\~/~g;     } 
     chdir($yypath);     $yypath =~ s/\\/\//gxsm; 
     push(@INC, $yypath);     chdir $yypath; 
     push @INC, $yypath;
} }
   
$adminscreen = 1; $adminscreen = 1;
   
$yyexec = "YaBB";  $yyexec      = 'YaBB'; 
$script_root = $ENV{'SCRIPT_FILENAME'}; $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/\/AdminIndex\.(pl|cgi)//ig;  $script_root =~ s/\/AdminIndex\.(pl|cgi)//igxsm; 
   
require "Paths.pl";  require Paths; 
require "$vardir/Settings.pl";  require Variables::Settings; 
   
# Check allways for Time::HiRes # Check always for Time::HiRes
eval { require Time::HiRes; import Time::HiRes qw(time); }; eval { require Time::HiRes; import Time::HiRes qw(time); };
$START_TIME = time();  $START_TIME = time; 
   
if ($settings_file_version ne $YaBBversion) { # If upgrading  
     require "$vardir/advsettings.txt" if -e "$vardir/advsettings.txt";  
     require "$vardir/secsettings.txt" if -e "$vardir/secsettings.txt";  
     require "$vardir/membergroups.txt" if -e "$vardir/membergroups.txt";  
}  
   
require "$sourcedir/Subs.pl";  require './Sources/Subs.pm'; 
require "$sourcedir/System.pl";  require Sources::System; 
require "$sourcedir/DateTime.pl";  require Sources::DateTime; 
require "$sourcedir/Load.pl";  require Sources::Load; 
   
&LoadCookie;       # Load the user's cookie (or set to guest) LoadCookie();          # Load the user's cookie (or set to guest)
&LoadUserSettings; # Load user settings LoadUserSettings();    # Load user settings
&WriteLog;         # write into the logfile WriteLog();            # write into the logfile
&WhatTemplate;     # Figure out which template to be using. WhatTemplate();        # Figure out which template to be using.
&WhatLanguage;     # Figure out which language file we should be using! WhatLanguage();        # Figure out which language file we should be using!
  get_micon();
   
  if ($debug) { require Sources::Debug; }
  if ($referersecurity) {
     referer_check();
  }                      # Check if the action is allowed from an external domain
   
if ($debug) { require "$sourcedir/Debug.pl"; }  require Sources::Security; 
if ($referersecurity) { &referer_check; } # Check if the action is allowed from an external domain  banning();             # Check for banned people 
   
require "$sourcedir/Security.pl";  if ( !$maintenance && -e "$vardir/maintenance.lock" ) { $maintenance = 2; } 
&banning;          # Check for banned people  
   
$maintenance = 2 if !$maintenance && -e "$vardir/maintenance.lock";  
   
# some maintenance stuff will stop after $max_process_time # some maintenance stuff will stop after $max_process_time
# in seconds, than the browser will call the script again # in seconds, than the browser will call the script again
# until all is done. Don't put it too high or you will run # until all is done. Don't put it too high or you will run
# into server or browser timeout. # into server or browser timeout.
$max_process_time = 20; $max_process_time = 20;
   
$action = $INFO{'action'}; $action = $INFO{'action'};
$SIG{__WARN__} = sub { &admin_fatal_error("error_occurred","@_"); }; local $SIG{__WARN__} = sub { fatal_error( 'error_occurred', "@_" ); };
eval { &yymain; }; eval { yymain(); };
if ($@) { &admin_fatal_error("untrapped",":<br />$@"); } if ($@) { fatal_error( 'untrapped', ":<br />$@" ); }
   
sub yymain { sub yymain {
     # Choose what to do based on the form action  
     if ($maintenance && $action eq 'login2') { require "$sourcedir/LogInOut.pl"; &Login2; }  
   
     # Do Sessions Checking     # Choose what to do based on the form action 
     if (!$iamguest && $sessions == 1 && $sessionvalid != 1) {    if ( $maintenance && $action eq 'login2' ) {
           $yySetLocation = qq~$scripturl?action=revalidatesession~;         require Sources::LogInOut; 
           &redirectexit;         Login2(); 
     }    }
   
     # Other users can do nothing here.     # Do Sessions Checking 
     if (!$iamadmin && !$iamgmod) {    if ( !$iamguest && $sessions == 1 && $sessionvalid != 1 ) {
           if ($maintenance) { require "$sourcedir/LogInOut.pl"; &InMaintenance; }         $yySetLocation = qq~$scripturl?action=revalidatesession~; 
         redirectexit();
     }
   
     # Other users can do nothing here.
     if ( !$iamadmin && !$iamgmod ) {
         if ($maintenance) { require Sources::LogInOut; InMaintenance(); }
         $yySetLocation = qq~$scripturl~;
         redirectexit();
     }
   
     if ($iamgmod) {
         require "$vardir/gmodsettings.txt";
         if ( !$allow_gmod_admin ) {
           $yySetLocation = qq~$scripturl~;            $yySetLocation = qq~$scripturl~;
           &redirectexit;             redirectexit(); 
     }        }
     }
     if ($iamgmod) {  
           require "$vardir/gmodsettings.txt";     if ( $action ne q{} ) { 
           if (!$allow_gmod_admin) {        if ( $action eq $randaction ) {
                 $yySetLocation = qq~$scripturl~;             require Sources::Decoder; 
                 &redirectexit;             convert(); 
         }
         else {
             require Admin::AdminSubList;
             if ( $director{$action} ) {
                 my @act = split /&/xsm, $director{$action};
                 require "$admindir/$act[0]";
                 &{ $act[1] };
           }            }
     }             else { 
                 require Admin::Admin;
     if ($action ne "") {                 Admin(); 
           if ($action eq $randaction) {  
                 require "$sourcedir/Decoder.pl"; &convert;  
           } else {  
                 require "$admindir/AdminSubList.pl";  
                 if ($director{$action}) {  
                       my @act = split(/&/, $director{$action});  
                       if ($action =~ /^ext_/) {  
                             require "$sourcedir/$act[0]";  
                       } else {  
                             require "$admindir/$act[0]";  
                       }  
                       &{$act[1]};  
                } else {  
                       require "$admindir/Admin.pl";  
                       &Admin;  
                 }  
           }            }
     } else {         } 
           &TrackAdminLogins;     } 
           require "$admindir/Admin.pl";     else { 
           &Admin;         TrackAdminLogins(); 
     }         require Admin::Admin; 
         Admin();
     }
     return;
} }
   
sub ParseNavArray { sub ParseNavArray {
     foreach $element (@_) {     my @x = @_; 
     foreach my $element (@x) {
           chomp $element;        chomp $element;
           ($action_to_take, $vistext, $whatitdoes, $isheader) = split(/\|/, $element);         ( $action_to_take, $vistext, $whatitdoes, $isheader ) = 
           split /\|/xsm, $element;
           if ($action_area eq $action_to_take) {  
                 $currentclass = "class=\"current\"";         if ( $action_area eq $action_to_take ) { 
           } else {             $currentclass = 'class="current"'; 
                 $currentclass = "";         } 
           }         else { 
             $currentclass = q{};
           if ($isheader) {         } 
                 $started_ul = 1;  
                 $leftmenu .= qq~        <h3><a href="javascript:toggleList('$isheader')" title="$whatitdoes">$vistext</a></h3>  
             <ul id="$isheader">  
~;  
                 next;  
           }  
   
           if ($iamgmod && $gmod_access{$action_to_take} ne "on") {  
                 next;  
           }  
   
           if ($action_to_take ne "#") {        if ($isheader) {
                 $leftmenu .= qq~             $started_ul = 1; 
                 <li><a href="$adminurl?action=$action_to_take" title="$whatitdoes" $currentclass>$vistext</a></li>~;             $leftmenu .= qq~ 
           } else {         <h3><a href="javascript:toggleList('$isheader')" title="$whatitdoes">$vistext</a></h3> 
                 $leftmenu .= qq~         <ul id="$isheader">~; 
                 <li><a name="none" title="none">$vistext</a></li>~;             next; 
           }        }
     }  
         if ( $iamgmod && $gmod_access{$action_to_take} ne 'on' ) {
             next;
         }
   
     if ($started_ul) {        if ( $action_to_take ne q{#} ) {
           $leftmenu .= qq~            $leftmenu .= qq~
             </ul>             <li><a href="$adminurl?action=$action_to_take" title="$whatitdoes" $currentclass>$vistext</a></li>~; 
~;         } 
     }         else { 
             $leftmenu .= qq~
             <li><a title="none">$vistext</a></li>~;
         }
     }
   
     if ($started_ul) {
         $leftmenu .= q~
         </ul>~;
     }
     return;
} }
   
sub AdmImgLoc { sub AdmImgLoc {
     if (!-e "$forumstylesdir/$useimages/$_[0]") { $thisimgloc = qq~img src="$forumstylesurl/default/$_[0]"~; }     my ($img) = @_; 
     else { $thisimgloc = qq~img src="$imagesdir/$_[0]"~; }     if ( !-e "$htmldir/Templates/Forum/$useimages/$img" ) { 
     return $thisimgloc;         $thisimgloc = qq~img src="$yyhtml_root/Templates/Forum/default/$img"~; 
     }
     else { $thisimgloc = qq~img src="$imagesdir/$img"~; }
     return $thisimgloc;
} }
   
sub AdmImgLoc2 { sub AdmImgLoc2 {
     if (!-e "$forumstylesdir/$useimages/$_[0]") { $thisimgloc = qq~$forumstylesurl/default/$_[0]~; }     my ($img) = @_; 
     else { $thisimgloc = qq~$imagesdir/$_[0]~; }     if ( !-e "$htmldir/Templates/Forum/$useimages/$img" ) { 
     return $thisimgloc;         $thisimgloc = qq~$yyhtml_root/Templates/Forum/default/$img~; 
     }
     else { $thisimgloc = qq~$imagesdir/$img~; }
     return $thisimgloc;
} }
   
sub AdminTemplate { sub AdminTemplate {
     $admin_template = ${ $uid . $username }{'template'};    $admin_template = ${ $uid . $username }{'template'};
     if (!-d "$adminstylesdir/$admin_template" || $admin_template eq "") { $admin_template = "default"; }     if ( !-d "$htmldir/Templates/Admin/$admin_template" 
         || $admin_template eq q{} )
     $adminstyle = qq~<link rel="stylesheet" href="$adminstylesurl/$admin_template.css" type="text/css" />~;     { 
     $adminstyle =~ s~$admin_template\/~~g;         $admin_template = 'default'; 
     }
     $adminimages = qq~$adminstylesurl/$admin_template~;  
     $adminimages =~ s~$admin_template\/~~g;     $adminstyle = 
     require "$templatesdir/$admin_template/AdminCentre.template";  qq~<link rel="stylesheet" href="$yyhtml_root/Templates/Admin/$admin_template.css" type="text/css" />~; 
     require "$vardir/gmodsettings.txt";     $adminstyle =~ s/$admin_template\///gxsm; 
   
     @forum_settings = (     $adminimages = qq~$yyhtml_root/Templates/Admin/$admin_template~; 
     "|$admintxt{'a1_title'}|$admintxt{'a1_label'} - $admintxt{'34'}|a1",     $adminimages =~ s/$admin_template\///gxsm; 
     "newsettings;page=main|$admintxt{'a1_sub1'}|$admintxt{'a1_label1'}|",     require "$templatesdir/$admin_template/AdminCentre.template"; 
     "newsettings;page=advanced|$admintxt{'a1_sub2'}|$admintxt{'a1_label2'}|",     require "$vardir/gmodsettings.txt"; 
     "editpaths|$admintxt{'a1_sub3'}|$admintxt{'a1_label3'}|",  
     "editbots|$admintxt{'a1_sub4'}|$admintxt{'a1_label4'}|",     @forum_settings = ( 
     );         "|$admintxt{'a1_title'}|$admintxt{'a1_label'} - $admintxt{'34'}|a1", 
     if ($extendedprofiles) {         "newsettings;page=main|$admintxt{'a1_sub1'}|$admintxt{'a1_label1'}|", 
           splice(@forum_settings,3,0,"ext_admin|$admintxt{'a1_sub_ex'}|$admintxt{'a1_label_ex'}|")         "newsettings;page=advanced|$admintxt{'a1_sub2'}|$admintxt{'a1_label2'}|", 
     }         "editpaths|$admintxt{'a1_sub3'}|$admintxt{'a1_label3'}|", 
         "editbots|$admintxt{'a1_sub4'}|$admintxt{'a1_label4'}|",
     @general_controls = (     ); 
     "|$admintxt{'a2_title'}|$admintxt{'a2_label'} - $admintxt{'34'}|a2",     if ($extendedprofiles) { 
     "newsettings;page=news|$admintxt{'a2_sub1'}|$admintxt{'a2_label1'}|",         splice @forum_settings, 3, 0, 
     "smilies|$admintxt{'a2_sub2'}|$admintxt{'a2_label2'}|",           "ext_admin|$admintxt{'a1_sub_ex'}|$admintxt{'a1_label_ex'}|"; 
     "setcensor|$admintxt{'a2_sub3'}|$admintxt{'a2_label3'}|",     } 
     "modagreement|$admintxt{'a2_sub4'}|$admintxt{'a2_label4'}|",  
     "gmodaccess|$admintxt{'a2_sub5'}|$admintxt{'a2_label5'}|",     @general_controls = ( 
     );         "|$admintxt{'a2_title'}|$admintxt{'a2_label'} - $admintxt{'34'}|a2", 
         "newsettings;page=news|$admintxt{'a2_sub1'}|$admintxt{'a2_label1'}|",
     @security_settings = (         "smilies|$admintxt{'a2_sub2'}|$admintxt{'a2_label2'}|", 
     "|$admintxt{'a3_title'}|$admintxt{'a3_label'} - $admintxt{'34'}|a3",         "setcensor|$admintxt{'a2_sub3'}|$admintxt{'a2_label3'}|", 
     "newsettings;page=security|$admintxt{'a3_sub2'}|$admintxt{'a3_label2'}|",         "modagreement|$admintxt{'a2_sub4'}|$admintxt{'a2_label4'}|", 
     "referer_control|$admintxt{'a3_sub1'}|$admintxt{'a3_label1'}|",         "gmodaccess|$admintxt{'a2_sub5'}|$admintxt{'a2_label5'}|", 
     "setup_guardian|$admintxt{'a3_sub3'}|$admintxt{'a3_label3'}|",         "eventcal_set|$admintxt{'a2_sub6'}|$admintxt{'a2_label6'}|", 
     "newsettings;page=antispam|$admintxt{'a3_sub4'}|$admintxt{'a3_label4'}|",         "bookmarks|$admintxt{'bookmarks'}|$admintxt{'bookmarks1'}|" 
     "spam_questions|$admintxt{'a3_sub6'}|$admintxt{'a3_label6'}|",     ); 
     );  
     @security_settings = (
     @forum_controls = (         "|$admintxt{'a3_title'}|$admintxt{'a3_label'} - $admintxt{'34'}|a3", 
     "|$admintxt{'a4_title'}|$admintxt{'a4_label'} - $admintxt{'34'}|a4",         "newsettings;page=security|$admintxt{'a3_sub2'}|$admintxt{'a3_label2'}|", 
     "managecats|$admintxt{'a4_sub1'}|$admintxt{'a4_label1'}|",         "referer_control|$admintxt{'a3_sub1'}|$admintxt{'a3_label1'}|", 
     "manageboards|$admintxt{'a4_sub2'}|$admintxt{'a4_label2'}|",         "setup_guardian|$admintxt{'a3_sub3'}|$admintxt{'a3_label3'}|", 
     "helpadmin|$admintxt{'a4_sub3'}|$admintxt{'a4_label3'}|",         "newsettings;page=antispam|$admintxt{'a3_sub4'}|$admintxt{'a3_label4'}|", 
     "editemailtemplates|$admintxt{'a4_sub4'}|$admintxt{'a4_label4'}|",         "spam_questions|$admintxt{'a3_sub6'}|$admintxt{'a3_label6'}|", 
     );         "setreserve|$admintxt{'a6_sub6'}|$admintxt{'a6_label6'}|", 
     );
     @forum_layout = (  
     "|$admintxt{'a5_title'}|$admintxt{'a5_label'} - $admintxt{'34'}|a5",     @forum_controls = ( 
     "modskin|$admintxt{'a5_sub1'}|$admintxt{'a5_label1'}|",         "|$admintxt{'a4_title'}|$admintxt{'a4_label'} - $admintxt{'34'}|a4", 
     "modcss|$admintxt{'a5_sub2'}|$admintxt{'a5_label2'}|",         "managecats|$admintxt{'a4_sub1'}|$admintxt{'a4_label1'}|", 
     "modtemp|$admintxt{'a5_sub3'}|$admintxt{'a5_label3'}|",         "manageboards|$admintxt{'a4_sub2'}|$admintxt{'a4_label2'}|", 
     );         "helpadmin|$admintxt{'a4_sub3'}|$admintxt{'a4_label3'}|", 
         "editemailtemplates|$admintxt{'a4_sub4'}|$admintxt{'a4_label4'}|",
     @member_controls = (     ); 
     "|$admintxt{'a6_title'}|$admintxt{'a6_label'} - $admintxt{'34'}|a6",  
     "addmember|$admintxt{'a6_sub1'}|$admintxt{'a6_label1'}|",     @forum_layout = ( 
     "viewmembers|$admintxt{'a6_sub2'}|$admintxt{'a6_label2'}|",         "|$admintxt{'a5_title'}|$admintxt{'a5_label'} - $admintxt{'34'}|a5", 
     "modmemgr|$admintxt{'a6_sub3'}|$admintxt{'a6_label3'}|",         "modskin|$admintxt{'a5_sub1'}|$admintxt{'a5_label1'}|", 
     "mailing|$admintxt{'a6_sub4'}|$admintxt{'a6_label4'}|",         "modcss|$admintxt{'a5_sub2'}|$admintxt{'a5_label2'}|", 
     "ipban|$admintxt{'a6_sub5'}|$admintxt{'a6_label5'}|",     ); 
     "setreserve|$admintxt{'a6_sub6'}|$admintxt{'a6_label6'}|",  
     );     @member_controls = ( 
         "|$admintxt{'a6_title'}|$admintxt{'a6_label'} - $admintxt{'34'}|a6",
     @maintence_controls = (         "addmember|$admintxt{'a6_sub1'}|$admintxt{'a6_label1'}|", 
     "|$admintxt{'a7_title'}|$admintxt{'a7_label'} - $admintxt{'34'}|a7",         "view_reglog|$admintxt{'a8_sub5'}|$admintxt{'a8_label5'}|", 
     "newsettings;page=maintenance|$admin_txt{'67'}|$admin_txt{'67'}|",         "viewmembers|$admintxt{'a6_sub2'}|$admintxt{'a6_label2'}|", 
     "rebuildmesindex|$admintxt{'a7_sub2a'}|$admintxt{'a7_label2a'}|",         "modmemgr|$admintxt{'a6_sub3'}|$admintxt{'a6_label3'}|", 
     "boardrecount|$admintxt{'a7_sub2'}|$admintxt{'a7_label2'}|",         "mailing|$admintxt{'a6_sub4'}|$admintxt{'a6_label4'}|", 
     "rebuildmemlist|$admintxt{'a7_sub4'}|$admintxt{'a7_label4'}|",         "ipban|$admintxt{'a6_sub5'}|$admintxt{'a6_label5'}|", 
     "membershiprecount|$admintxt{'a7_sub3'}|$admintxt{'a7_label3'}|",     ); 
     "rebuildmemhist|$admintxt{'a7_sub4a'}|$admintxt{'a7_label4a'}|",  
     "rebuildnotifications|$admintxt{'a7_sub4b'}|$admintxt{'a7_label4b'}|",     @maintence_controls = ( 
     "clean_log|$admintxt{'a7_sub1'}|$admintxt{'a7_label1'}|",         "|$admintxt{'a7_title'}|$admintxt{'a7_label'} - $admintxt{'34'}|a7", 
     "deleteoldthreads|$admintxt{'a7_sub5'}|$admintxt{'a7_label5'}|",         "newsettings;page=maintenance|$admin_txt{'67'}|$admin_txt{'67'}|", 
     "manageattachments|$admintxt{'a7_sub6'}|$admintxt{'a7_label6'}|",         "backupsettings|$admintxt{'a3_sub5'}|$admintxt{'a3_label5'}|", 
     "backupsettings|$admintxt{'a3_sub5'}|$admintxt{'a3_label5'}|",         "rebuildmesindex|$admintxt{'a7_sub2a'}|$admintxt{'a7_label2a'}|", 
     );         "boardrecount|$admintxt{'a7_sub2'}|$admintxt{'a7_label2'}|", 
         "rebuildmemlist|$admintxt{'a7_sub4'}|$admintxt{'a7_label4'}|",
     @forum_stats = (         "membershiprecount|$admintxt{'a7_sub3'}|$admintxt{'a7_label3'}|", 
     "|$admintxt{'a8_title'}|$admintxt{'a8_label'} - $admintxt{'34'}|a8",         "rebuildmemhist|$admintxt{'a7_sub4a'}|$admintxt{'a7_label4a'}|", 
     "detailedversion|$admintxt{'a8_sub1'}|$admintxt{'a8_label1'}|",         "rebuildnotifications|$admintxt{'a7_sub4b'}|$admintxt{'a7_label4b'}|", 
     "stats|$admintxt{'a8_sub2'}|$admintxt{'a8_label2'}|",         "clean_log|$admintxt{'a7_sub1'}|$admintxt{'a7_label1'}|", 
     "showclicks|$admintxt{'a8_sub3'}|$admintxt{'a8_label3'}|",         "deleteoldthreads|$admintxt{'a7_sub5'}|$admintxt{'a7_label5'}|", 
     "errorlog|$admintxt{'a8_sub4'}|$admintxt{'a8_label4'}|",         "manageattachments|$admintxt{'a7_sub6'}|$admintxt{'a7_label6'}|", 
     "view_reglog|$admintxt{'a8_sub5'}|$admintxt{'a8_label5'}|",     ); 
     );  
     @forum_stats = (
     @boardmod_mods = (         "|$admintxt{'a8_title'}|$admintxt{'a8_label'} - $admintxt{'34'}|a8", 
     "|$admintxt{'a9_title'}|$admintxt{'a9_label'} - $admintxt{'34'}|a9",         "detailedversion|$admintxt{'a8_sub1'}|$admintxt{'a8_label1'}|", 
     "modlist|$mod_list{'6'}|$mod_list{'7'}|",         "stats|$admintxt{'a8_sub2'}|$admintxt{'a8_label2'}|", 
     );         "showclicks|$admintxt{'a8_sub3'}|$admintxt{'a8_label3'}|", 
         "errorlog|$admintxt{'a8_sub4'}|$admintxt{'a8_label4'}|",
     # To add new items for your mods settings, add a new row below here, pushing     ); 
     # your item onto the @boardmod_mods array. Example below:  
     #     $my_mod = "action_to_take|Name_Displayed|Tooltip_Title|";     @boardmod_mods = ( 
     #     push (@boardmod_mods, "$my_mod");         "|$admintxt{'a9_title'}|$admintxt{'a9_label'} - $admintxt{'34'}|a9", 
     # before the first pipe character is the action that will appear in the URL         "modlist|$mod_list{'6'}|$mod_list{'7'}|", 
     # Next is the text that is displayed in the admin centre     ); 
     # Finally, you have the tooltip text, necessary for XHTML compliance  
     # To add new items for your mods settings, add a new row below here, pushing
     # Also note, you should pick a unique name instead of "$my_mod".     # your item onto the @boardmod_mods array. Example below: 
     # If you mod is called "SuperMod For Doing Cool Things"     #     $my_mod = "action_to_take|Name_Displayed|Tooltip_Title|"; 
     # You could use "$SuperMod_CoolThings"     #     push (@boardmod_mods, "$my_mod"); 
     # before the first pipe character is the action that will appear in the URL
     # Next is the text that is displayed in the admin centre
     # Finally, you have the tooltip text, necessary for XHTML compliance
   
     # Also note, you should pick a unique name instead of "$my_mod".
     # If you mod is called "SuperMod For Doing Cool Things"
     # You could use "$SuperMod_CoolThings"
   
### BOARDMOD ANCHOR ### ### BOARDMOD ANCHOR ###
### END BOARDMOD ANCHOR ### ### END BOARDMOD ANCHOR ###
   
     &ParseNavArray(@forum_settings);     ParseNavArray(@member_controls); 
     &ParseNavArray(@general_controls);     ParseNavArray(@maintence_controls); 
     &ParseNavArray(@security_settings);     ParseNavArray(@forum_settings); 
     &ParseNavArray(@forum_controls);     ParseNavArray(@general_controls); 
     &ParseNavArray(@forum_layout);     ParseNavArray(@security_settings); 
     &ParseNavArray(@member_controls);     ParseNavArray(@forum_controls); 
     &ParseNavArray(@maintence_controls);     ParseNavArray(@forum_layout); 
     &ParseNavArray(@forum_stats);     ParseNavArray(@forum_stats); 
     &ParseNavArray(@boardmod_mods);     ParseNavArray(@boardmod_mods); 
   
     $topmenu_one  = qq~<a href="$boardurl/$yyexec.$yyext">$admintxt{'15'}</a>~;     $topmenu_one = qq~<a href="$boardurl/$yyexec.$yyext">$admintxt{'15'} $mbname</a>~; 
     $topmenu_two  = qq~<a href="$adminurl">$admintxt{'33'}</a>~;    $topmenu_two = qq~<a href="$adminurl">$admintxt{'33'}</a>~;
     $topmenu_tree = qq~<a href="$scripturl?action=help;section=admin">$admintxt{'35'}</a>~;     $topmenu_tree = 
     $topmenu_four = qq~<a href="http://www.yabbforum.com">$admintxt{'36'}</a>~;       qq~<a href="$scripturl?action=help;section=admin">$admintxt{'35'}</a>~; 
     $topmenu_four = qq~<a href="http://www.yabbforum.com" target="_blank">$admintxt{'36'}</a>~;
     if ($maintenance) {  
           $yyadmin_alert .= qq~<br /><span style="font-size: 12px; background-color: #FFFF33;"><b>$load_txt{'616'}</b></span><br /><br />~;     if ($maintenance && $action ne 'detailedversion') { 
     }         $yyadmin_alert .= 
     if ($iamadmin && $rememberbackup) {  qq~<br /><span style="font-size: 12px; background-color: #FFFF33;"><b>$load_txt{'616a'}</b></span><br /><br />~; 
           if ($lastbackup && $date > $rememberbackup + $lastbackup) {     } 
                 require "$sourcedir/DateTime.pl";     if ( $iamadmin && $rememberbackup && $action ne 'detailedversion' ) { 
                 $yyadmin_alert .= qq~<br /><span style="font-size: 12px; background-color: #FFFF33;"><b>$load_txt{'617'} ~ . &timeformat($lastbackup) . qq~</b></span>~;         if ( $lastbackup && $date > $rememberbackup + $lastbackup ) { 
           }             require Sources::DateTime; 
     }             $yyadmin_alert .= 
  qq~<br /><span style="font-size: 12px; background-color: #FFFF33;"><b>$load_txt{'617'} ~
     &print_output_header;               . timeformat($lastbackup) 
               . q~</b></span>~;
         }
     }
   
     print_output_header();
   
     my $yytitle = qq~$mbname $admin_txt{'208'}: $yytitle~;
     $header =~ s/({|<)yabb\ title(}|>)/$yytitle/gxsm;
     $header =~ s/({|<)yabb\ style(}|>)/$adminstyle/gxsm;
     $header =~ s/({|<)yabb\ charset(}|>)/$yymycharset/gxsm;
     $header =~ s/({|<)yabb\ javascript(}|>)/$yyjavascript/gxsm;
   
     $leftmenutop =~ s/({|<)yabb\ images(}|>)/$adminimages/gxsm;
     $leftmenutop =~ s/({|<)yabb\ maintenance(}|>)/$yyadmin_alert/gxsm;
     $topnav      =~ s/({|<)yabb\ topmenu_one(}|>)/$topmenu_one/xsm;
     $topnav      =~ s/({|<)yabb\ topmenu_two(}|>)/$topmenu_two/xsm;
     $topnav      =~ s/({|<)yabb\ topmenu_tree(}|>)/$topmenu_tree/xsm;
     $topnav      =~ s/({|<)yabb\ topmenu_four(}|>)/$topmenu_four/xsm;
     $topnav      =~ s/({|<)yabb\ brdname(}|>)/$mbname/xsm;
   
     if ($debug) { Debug(); }
     $mainbody =~ s/({|<)yabb\ main(}|>)/$yymain/gxsm;
     $mainbody =~ s/({|<)yabb_admin\ debug(}|>)/$yydebug/gxsm;
   
     $mainbody =~ s/img src\=\"$imagesdir\/(.+?)\"/AdmImgLoc($1)/eisgm;
     $mainbody =~
  s/img src\=\&quot\;$imagesdir\/(.+?)\&quot;/"img src\=\&quot;" . AdmImgLoc2($1) . "\&quot;"/eisgm;
   
     # For the template editing Javascript images
   
     $output =
         $header
       . $leftmenutop
       . $leftmenu
       . $leftmenubottom
       . $topnav
       . $mainbody;
   
     my $yytitle = qq~$admin_txt{'208'}: $yytitle~;     image_resize(); 
     $header =~ s/({|<)yabb title(}|>)/$yytitle/g;  
     $header =~ s/({|<)yabb style(}|>)/$adminstyle/g;  
     $header =~ s/({|<)yabb charset(}|>)/$yycharset/g;  
     $header =~ s/({|<)yabb javascript(}|>)/$yyjavascript/g;  
   
     $leftmenutop =~ s/({|<)yabb images(}|>)/$adminimages/g;     print_HTML_output_and_finish(); 
     $leftmenutop =~ s/({|<)yabb maintenance(}|>)/$yyadmin_alert/g;     return; 
     $topnav      =~ s/({|<)yabb topmenu_one(}|>)/$topmenu_one/;  
     $topnav      =~ s/({|<)yabb topmenu_two(}|>)/$topmenu_two/;  
     $topnav      =~ s/({|<)yabb topmenu_tree(}|>)/$topmenu_tree/;  
     $topnav      =~ s/({|<)yabb topmenu_four(}|>)/$topmenu_four/;  
   
     &Debug if $debug;  
     $mainbody =~ s/({|<)yabb main(}|>)/$yymain/g;  
     $mainbody =~ s/({|<)yabb_admin debug(}|>)/$yydebug/g;  
   
     $mainbody =~ s~img src\=\"$imagesdir\/(.+?)\"~&AdmImgLoc($1)~eisg;  
     $mainbody =~ s~img src\=\&quot\;$imagesdir\/(.+?)\&quot;~"img src\=\&quot;" . &AdmImgLoc2($1) . "\&quot;"~eisg; # For the template editing Javascript images  
   
     $output = $header . $leftmenutop . $leftmenu . $leftmenubottom . $topnav . $mainbody;  
   
     &print_HTML_output_and_finish;  
} }
   
sub TrackAdminLogins { sub TrackAdminLogins {
     if (-e "$vardir/adminlog.txt") {    if ( -e "$vardir/adminlog_new.txt" ) {
           fopen(ADMINLOG, "$vardir/adminlog.txt");         fopen( ADMINLOG, "$vardir/adminlog_new.txt" ); 
           @adminlog = <ADMINLOG>;        @adminlog = <ADMINLOG>;
           fclose(ADMINLOG);        fclose(ADMINLOG);
     }         @adminlog = reverse sort @adminlog; 
     fopen(ADMINLOG, ">$vardir/adminlog.txt");     } 
     print ADMINLOG qq~$username|$user_ip|$date\n~;     $maxadminlog = $maxadminlog || 5; 
     for ($i = 0; $i < 4; $i++) {     fopen( ADMINLOG, ">$vardir/adminlog_new.txt" ); 
           if ($adminlog[$i]) {     print {ADMINLOG} qq~$date|$username|$user_ip\n~ 
                 chomp $adminlog[$i];       or croak 'cannot print ADMINLOG'; 
                 print ADMINLOG qq~$adminlog[$i]\n~;     for my $i ( 0 .. ( $maxadminlog - 2 ) ) { 
           }         if ( $adminlog[$i] ) { 
     }             chomp $adminlog[$i]; 
     fclose(ADMINLOG);             print {ADMINLOG} qq~$adminlog[$i]\n~ 
}               or croak 'cannot print ADMINLOG'; 
         }
     }
   
     fclose(ADMINLOG);
     return;
  }