--- a/branches/2.5.4/cgi-bin/yabb2/Sources/Load.pm
+++ b/branches/2.5.4/cgi-bin/yabb2/Sources/Load.pm
@@ -1,21 +1,21 @@
 ###############################################################################
 # Load.pm                                                                     #
-# $Date: 01.01.13 $                                                           #
+# $Date: 2013-06-25 15:33:13 +0000 (Tue, 25 Jun 2013) $
 ###############################################################################
 # YaBB: Yet another Bulletin Board                                            #
 # Open-Source Community Software for Webmasters                               #
 # Version:        YaBB 2.5.4                                                  #
-# Packaged:       January 1, 2013                                             #
+# Packaged:       July 1, 2013                                                #
 # Distributed by: http://www.yabbforum.com                                    #
 # =========================================================================== #
-# Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved.     #
+# Copyright (c) 2000-2013 YaBB (www.yabbforum.com) - All Rights Reserved.     #
 # Software by:  The YaBB Development Team                                     #
 #               with assistance from the YaBB community.                      #
 ###############################################################################
 use CGI::Carp qw(fatalsToBrowser);
 our $VERSION = '2.5.4';
 
-$loadpmver = 'YaBB 2.5.4 $Revision: 1078 $';
+$loadpmver = 'YaBB 2.5.4 $Revision: 1081 $';
 
 sub LoadBoardControl {
     $binboard = q{};
@@ -23,11 +23,11 @@
 
     fopen( FORUMCONTROL, "$boardsdir/forum.control" )
       || fatal_error( 'cannot_open', "$boardsdir/forum.control", 1 );
-	my @boardcontrols = <FORUMCONTROL>;
-	fclose(FORUMCONTROL);
-	$maxboards = $#boardcontrols;
-
-	foreach my $boardline (@boardcontrols) {
+    my @boardcontrols = <FORUMCONTROL>;
+    fclose(FORUMCONTROL);
+    $maxboards = $#boardcontrols;
+
+    foreach my $boardline (@boardcontrols) {
         $boardline =~ s/[\r\n]//gxsm;    # Built in chomp
         my (
             $cntcat,         $cntboard,        $cntpic,
@@ -37,29 +37,30 @@
             $cntrbin,        $cntattperms,     $cntminageperms,
             $cntmaxageperms, $cntgenderperms,  $cntcanpost,
             $cntparent,      $rules,           $rulestitle,
-            $rulesdesc,      $rulescollapse,   $brdpasswr, $brdpassw
+            $rulesdesc,      $rulescollapse,   $brdpasswr,
+            $brdpassw
         ) = split /\|/xsm, $boardline;
-		## create a global boards array
+        ## create a global boards array
         push @allboards, $cntboard;
 
         $cntdescription =~ s/\&/\&amp;/gxsm;
 
-		%{ $uid . $cntboard } = (
-			'cat'          => $cntcat,
-			'description'  => $cntdescription,
-			'pic'          => $cntpic,
-			'mods'         => $cntmods,
-			'modgroups'    => $cntmodgroups,
-			'topicperms'   => $cnttopicperms,
-			'replyperms'   => $cntreplyperms,
-			'pollperms'    => $cntpollperms,
-			'zero'         => $cntzero,
-			'membergroups' => $cntmembergroups,
-			'ann'          => $cntann,
-			'rbin'         => $cntrbin,
-			'attperms'     => $cntattperms,
-			'minageperms'  => $cntminageperms,
-			'maxageperms'  => $cntmaxageperms,
+        %{ $uid . $cntboard } = (
+            'cat'           => $cntcat,
+            'description'   => $cntdescription,
+            'pic'           => $cntpic,
+            'mods'          => $cntmods,
+            'modgroups'     => $cntmodgroups,
+            'topicperms'    => $cnttopicperms,
+            'replyperms'    => $cntreplyperms,
+            'pollperms'     => $cntpollperms,
+            'zero'          => $cntzero,
+            'membergroups'  => $cntmembergroups,
+            'ann'           => $cntann,
+            'rbin'          => $cntrbin,
+            'attperms'      => $cntattperms,
+            'minageperms'   => $cntminageperms,
+            'maxageperms'   => $cntmaxageperms,
             'genderperms'   => $cntgenderperms,
             'canpost'       => $cntcanpost,
             'parent'        => $cntparent,
@@ -67,12 +68,12 @@
             'rulestitle'    => $rulestitle,
             'rulesdesc'     => $rulesdesc,
             'rulescollapse' => $rulescollapse,
-			'brdpasswr'     => $brdpasswr,
-			'brdpassw'      => $brdpassw,
+            'brdpasswr'     => $brdpasswr,
+            'brdpassw'      => $brdpassw,
         );
-		if ($cntann == 1)  { $annboard = $cntboard; }
-		if ($cntrbin == 1) { $binboard = $cntboard; }
-	}
+        if ( $cntann == 1 )  { $annboard = $cntboard; }
+        if ( $cntrbin == 1 ) { $binboard = $cntboard; }
+    }
     return;
 }
 
@@ -80,20 +81,19 @@
     return
       if ( $iamguest
         || $PM_level == 0
-        || ( $maintenance && !$iamadmin )
+        || ( $maintenance   && !$iamadmin )
         || ( $PM_level == 2 && ( !$staff ) )
         || ( $PM_level == 4 && ( !$iamadmin && !$iamgmod && !$iamymod ) )
-        || ( $PM_level == 3 && ( !$iamadmin && !$iamgmod ) )
-         );
+        || ( $PM_level == 3 && ( !$iamadmin && !$iamgmod ) ) );
 
     if ( !exists ${$username}{'PMmnum'} ) { buildIMS( $username, 'load' ); }
 
-	my $imnewtext;
+    my $imnewtext;
     if ( ${$username}{'PMimnewcount'} == 1 ) {
         $imnewtext =
 qq~<a href="$scripturl?action=imshow;caller=1;id=-1">1 $load_txt{'155'}</a>~;
     }
-	elsif (!${$username}{'PMimnewcount'}) { $imnewtext = $load_txt{'nonew'}; }
+    elsif ( !${$username}{'PMimnewcount'} ) { $imnewtext = $load_txt{'nonew'}; }
     else {
         $imnewtext =
 qq~<a href="$scripturl?action=imshow;caller=1;id=-1">${$username}{'PMimnewcount'} $load_txt{'154'}</a>~;
@@ -127,26 +127,26 @@
     }
     fopen( CENSOR, "$langdir/$language/censor.txt" )
       || fatal_error( 'cannot_open', "$langdir/$language/censor.txt", 1 );
-	while (chomp($buffer = <CENSOR>)) {
+    while ( chomp( $buffer = <CENSOR> ) ) {
         $buffer =~ s/\r(?=\n*)//gxsm;
         if ( $buffer =~ m/\~/sm ) {
             ( $tmpa, $tmpb ) = split /\~/xsm, $buffer;
-			$tmpc = 0;
+            $tmpc = 0;
         }
         else {
             ( $tmpa, $tmpb ) = split /=/xsm, $buffer;
-			$tmpc = 1;
-		}
+            $tmpc = 1;
+        }
         push @censored, [ $tmpa, $tmpb, $tmpc ];
-	}
-	fclose(CENSOR);
+    }
+    fclose(CENSOR);
     return;
 }
 
 sub LoadUserSettings {
     LoadBoardControl();
-	$iamguest = $username eq 'Guest' ? 1 : 0;
-	if ($username ne 'Guest') {
+    $iamguest = $username eq 'Guest' ? 1 : 0;
+    if ( $username ne 'Guest' ) {
         LoadUser($username);
         if ( !$maintenance
             || ${ $uid . $username }{'position'} eq 'Administrator' )
@@ -159,21 +159,21 @@
             {
                 $staff = 1;
             }
-			else { $staff = 0; }
-			$sessionvalid = 1;
-			if ($sessions == 1 && $staff == 1) {
+            else { $staff = 0; }
+            $sessionvalid = 1;
+            if ( $sessions == 1 && $staff == 1 ) {
                 $cursession = encode_password($user_ip);
-				chomp $cursession;
+                chomp $cursession;
                 if (   ${ $uid . $username }{'session'} ne $cursession
                     || ${ $uid . $username }{'session'} ne $cookiesession )
                 {
                     $sessionvalid = 0;
                 }
-			}
-			$spass = ${$uid.$username}{'password'};
-
-			# Make sure that if the password doesn't match you get FULLY Logged out
-			if ($spass && $spass ne $password && $action ne 'logout') {
+            }
+            $spass = ${ $uid . $username }{'password'};
+
+         # Make sure that if the password doesn't match you get FULLY Logged out
+            if ( $spass && $spass ne $password && $action ne 'logout' ) {
                 $yySetLocation =
                   $guestaccess ? qq~$scripturl~ : qq~$scripturl?action=login~;
                 UpdateCookie('delete');
@@ -191,21 +191,21 @@
                   && $sessionvalid == 1 ) ? 1 : 0;
             if ( $sessionvalid == 1 ) {
                 ${ $uid . $username }{'session'} = $cursession;
-			}
+            }
             CalcAge( $username, 'calc' );
 
-			# Set the order how Topic summaries are displayed
+            # Set the order how Topic summaries are displayed
             if ( !$adminscreen && $ttsureverse ) {
                 $ttsreverse = ${ $uid . $username }{'reversetopic'};
             }
-			return;
-		}
-	}
+            return;
+        }
+    }
 
     FormatUserName(q{});
     UpdateCookie('delete');
-	$username           = 'Guest';
-	$iamguest           = '1';
+    $username = 'Guest';
+    $iamguest = '1';
     $iamadmin = q{};
     $iamgmod  = q{};
     $iamymod  = q{};
@@ -218,17 +218,17 @@
 
 sub FormatUserName {
     my ($user) = @_;
-	return if $useraccount{$user};
+    return if $useraccount{$user};
     $useraccount{$user} = $do_scramble_id ? cloak($user) : $user;
     return;
 }
 
 sub LoadUser {
-	my ($user,$userextension) = @_;
-	return 1 if exists ${$uid.$user}{'realname'};
+    my ( $user, $userextension ) = @_;
+    return 1 if exists ${ $uid . $user }{'realname'};
     return 0 if $user eq q{} || $user eq 'Guest';
 
-	if (!$userextension){ $userextension = 'vars'; }
+    if ( !$userextension ) { $userextension = 'vars'; }
     if ( ( $regtype == 1 || $regtype == 2 ) && -e "$memberdir/$user.pre" ) {
         $userextension = 'pre';
     }
@@ -236,13 +236,13 @@
         $userextension = 'wait';
     }
 
-	if (-e "$memberdir/$user.$userextension") {
-		if ($user ne $username) {
+    if ( -e "$memberdir/$user.$userextension" ) {
+        if ( $user ne $username ) {
             fopen( LOADUSER, "$memberdir/$user.$userextension" )
               || fatal_error( 'cannot_open', "$memberdir/$user.$userextension",
                 1 );
-			my @settings = <LOADUSER>;
-			fclose(LOADUSER);
+            my @settings = <LOADUSER>;
+            fclose(LOADUSER);
             foreach (@settings) {
                 if ( $_ =~ /'(.*?)',"(.*?)"/xsm ) {
                     ${ $uid . $user }{$1} = $2;
@@ -253,55 +253,58 @@
             fopen( LOADUSER, "+<$memberdir/$user.$userextension" )
               || fatal_error( 'cannot_open', "$memberdir/$user.$userextension",
                 1 );
-			my @settings = <LOADUSER>;
+            my @settings = <LOADUSER>;
             for my $i ( 0 .. ( @settings - 1 ) ) {
                 if ( $settings[$i] =~ /'(.*?)',"(.*?)"/xsm ) {
-					${$uid.$user}{$1} = $2;
-                    if ( $1 eq 'lastonline' && $INFO{'action'} ne 'login2' && !${$uid.$user}{'stealth'} ) {
-						${$uid.$user}{$1} = $date;
-						$settings[$i] = qq~'lastonline',"$date"\n~;
-					}
-				}
-			}
-			seek LOADUSER, 0, 0;
-			truncate LOADUSER, 0;
+                    ${ $uid . $user }{$1} = $2;
+                    if (   $1 eq 'lastonline'
+                        && $INFO{'action'} ne 'login2'
+                        && !${ $uid . $user }{'stealth'} )
+                    {
+                        ${ $uid . $user }{$1} = $date;
+                        $settings[$i] = qq~'lastonline',"$date"\n~;
+                    }
+                }
+            }
+            seek LOADUSER, 0, 0;
+            truncate LOADUSER, 0;
             print {LOADUSER} @settings or croak 'cannot print LOADUSER';
-			fclose(LOADUSER);
-		}
+            fclose(LOADUSER);
+        }
 
         ToChars( ${ $uid . $user }{'realname'} );
         FormatUserName($user);
         LoadMiniUser($user);
 
-		return 1;
-	}
-
-	return 0; # user not found
+        return 1;
+    }
+
+    return 0;    # user not found
 }
 
 sub is_moderator {
     my ( $user, $brd ) = @_;
-	my @checkboards;
+    my @checkboards;
     if   ($brd) { @checkboards = ($brd); }
-	else { @checkboards = @allboards; }
-
-	foreach (@checkboards) {
-
-		# check if user is in the moderator list
+    else        { @checkboards = @allboards; }
+
+    foreach (@checkboards) {
+
+        # check if user is in the moderator list
         foreach ( split /, ?/sm, ${ $uid . $_ }{'mods'} ) {
-			if ($_ eq $user) { return 1; }
-		}
-
-		# check if user is member of a moderatorgroup
+            if ( $_ eq $user ) { return 1; }
+        }
+
+        # check if user is member of a moderatorgroup
         foreach my $testline ( split /, /sm, ${ $uid . $_ }{'modgroups'} ) {
-			if ($testline eq ${$uid.$user}{'position'}) { return 1; }
+            if ( $testline eq ${ $uid . $user }{'position'} ) { return 1; }
 
             foreach ( split /,/xsm, ${ $uid . $user }{'addgroups'} ) {
-				if ($testline eq $_) { return 1; }
-			}
-		}
-	}
-	return 0;
+                if ( $testline eq $_ ) { return 1; }
+            }
+        }
+    }
+    return 0;
 }
 
 sub is_moderator_b {
@@ -331,18 +334,18 @@
     my (
         $cntcat,       $cntboard,     $cntpic,        $cntdescription,
         $cntmods,      $cntmodgroups, $cnttopicperms, $cntreplyperms,
-        $cntpollperms, $cntzero,      undef,         undef,
-        undef,        $cnttotals,    @boardcontrol
+        $cntpollperms, $cntzero,      undef,          undef,
+        undef,         $cnttotals,    @boardcontrol
     );
     fopen( FORUMCONTROL, "+<$boardsdir/forum.control" )
       || fatal_error( 'cannot_open', "$boardsdir/forum.control", 1 );
-	@oldcontrols = <FORUMCONTROL>;
-
-	my @newmods;
+    @oldcontrols = <FORUMCONTROL>;
+
+    my @newmods;
     foreach my $boardline (@oldcontrols) {
-		chomp $boardline;
+        chomp $boardline;
         if ( $boardline ne q{} ) {
-			@newmods = ();
+            @newmods = ();
             (
                 $cntcat,         $cntboard,       $cntpic,
                 $cntdescription, $cntmods,        $cntmodgroups,
@@ -350,21 +353,22 @@
                 $cntzero,        $cntpassword,    $cnttotals,
                 $cntattperms,    $spare,          $cntminageperms,
                 $cntmaxageperms, $cntgenderperms, $rules,
-                $rulestitle,     $rulesdesc,      $rulescollapse, $brdpasswr, $brdpassw
+                $rulestitle,     $rulesdesc,      $rulescollapse,
+                $brdpasswr,      $brdpassw
             ) = split /\|/xsm, $boardline;
             foreach ( split /, /sm, $cntmods ) {
                 if ( $killmod ne $_ ) { push @newmods, $_; }
-			}
+            }
             $cntmods = join q{, }, @newmods;
             push @boardcontrol,
 "$cntcat|$cntboard|$cntpic|$cntdescription|$cntmods|$cntmodgroups|$cnttopicperms|$cntreplyperms|$cntpollperms|$cntzero|$cntpassword|$cnttotals|$cntattperms|$spare|$cntminageperms|$cntmaxageperms|$cntgenderperms|$rules|$rulestitle|$rulesdesc|$rulescollapse|$brdpasswr|$brdpassw\n";
-		}
-	}
-	seek FORUMCONTROL, 0, 0;
-	truncate FORUMCONTROL, 0;
+        }
+    }
+    seek FORUMCONTROL, 0, 0;
+    truncate FORUMCONTROL, 0;
     @boardcontrol = undupe(@boardcontrol);
     print {FORUMCONTROL} @boardcontrol or croak 'cannot print FORUMCONTROL';
-	fclose(FORUMCONTROL);
+    fclose(FORUMCONTROL);
     return;
 }
 
@@ -373,18 +377,18 @@
     my (
         $cntcat,       $cntboard,     $cntpic,        $cntdescription,
         $cntmods,      $cntmodgroups, $cnttopicperms, $cntreplyperms,
-        $cntpollperms, $cntzero,      undef,         undef,
-        undef,        $cnttotals,    @boardcontrol
+        $cntpollperms, $cntzero,      undef,          undef,
+        undef,         $cnttotals,    @boardcontrol
     );
     fopen( FORUMCONTROL, "+<$boardsdir/forum.control" )
       || fatal_error( 'cannot_open', "$boardsdir/forum.control", 1 );
-	@oldcontrols = <FORUMCONTROL>;
-
-	my @newmods;
+    @oldcontrols = <FORUMCONTROL>;
+
+    my @newmods;
     foreach my $boardline (@oldcontrols) {
-		chomp $boardline;
+        chomp $boardline;
         if ( $boardline ne q{} ) {
-			@newmods = ();
+            @newmods = ();
             (
                 $cntcat,         $cntboard,       $cntpic,
                 $cntdescription, $cntmods,        $cntmodgroups,
@@ -392,35 +396,36 @@
                 $cntzero,        $cntpassword,    $cnttotals,
                 $cntattperms,    $spare,          $cntminageperms,
                 $cntmaxageperms, $cntgenderperms, $rules,
-                $rulestitle,     $rulesdesc,      $rulescollapse, $brdpasswr, $brdpassw
+                $rulestitle,     $rulesdesc,      $rulescollapse,
+                $brdpasswr,      $brdpassw
             ) = split /\|/xsm, $boardline;
             foreach ( split /, /sm, $cntmodgroups ) {
                 if ( $killmod ne $_ ) { push @newmods, $_; }
-			}
+            }
             $cntmodgroups = join q{, }, @newmods;
             push @boardcontrol,
 "$cntcat|$cntboard|$cntpic|$cntdescription|$cntmods|$cntmodgroups|$cnttopicperms|$cntreplyperms|$cntpollperms|$cntzero|$cntpassword|$cnttotals|$cntattperms|$spare|$cntminageperms|$cntmaxageperms|$cntgenderperms|$rules|$rulestitle|$rulesdesc|$rulescollapse|$brdpasswr|$brdpassw\n";
-		}
-	}
-	seek FORUMCONTROL, 0, 0;
-	truncate FORUMCONTROL, 0;
+        }
+    }
+    seek FORUMCONTROL, 0, 0;
+    truncate FORUMCONTROL, 0;
     @boardcontrol = undupe(@boardcontrol);
     print {FORUMCONTROL} @boardcontrol or croak 'cannot print FORUMCONTROL';
-	fclose(FORUMCONTROL);
+    fclose(FORUMCONTROL);
     return;
 }
 
 sub LoadUserDisplay {
     my ($user) = @_;
-	if (exists ${$uid.$user}{'password'}) {
-		if ($yyUDLoaded{$user}) { return 1; }
-	}
+    if ( exists ${ $uid . $user }{'password'} ) {
+        if ( $yyUDLoaded{$user} ) { return 1; }
+    }
     else {
         LoadUser($user);
     }
     LoadCensorList();
 
-    if (!$minlinkweb) { $minlinkweb = 0; }
+    if ( !$minlinkweb ) { $minlinkweb = 0; }
     ${ $uid . $user }{'weburl'} =
       (
         ${ $uid . $user }{'weburl'}
@@ -433,20 +438,20 @@
       . ( $sm ? $img{'website_sm'} : $img{'website'} ) . '</a>'
       : q{};
 
-	$displayname = ${$uid.$user}{'realname'};
-	if (${$uid.$user}{'signature'}) {
-		$message = ${$uid.$user}{'signature'};
-
-		if ($enable_ubbc) {
+    $displayname = ${ $uid . $user }{'realname'};
+    if ( ${ $uid . $user }{'signature'} ) {
+        $message = ${ $uid . $user }{'signature'};
+
+        if ($enable_ubbc) {
             enable_yabbc();
             DoUBBC(1);
-		}
+        }
 
         ToChars($message);
 
         ${ $uid . $user }{'signature'} = Censor($message);
 
-		# use height like code boxes do. Set to 200px at > 15 newlines
+        # use height like code boxes do. Set to 200px at > 15 newlines
         if ( 15 < ${ $uid . $user }{'signature'} =~ /<br \/>|<tr>/gsm ) {
             ${ $uid . $user }{'signature'} =
 qq~<div style="float: left; font-size: 10px; font-family: verdana, sans-serif; overflow: auto; max-height: 200px; height: 200px; width: 99%;">${$uid.$user}{'signature'}</div>~;
@@ -454,11 +459,11 @@
         else {
             ${ $uid . $user }{'signature'} =
 qq~<div style="float: left; font-size: 10px; font-family: verdana, sans-serif; overflow: auto; max-height: 200px; width: 99%;">${$uid.$user}{'signature'}</div>~;
-		}
-	}
-
-	$thegtalkuser = $user;
-	$thegtalkname = ${$uid.$user}{'realname'};
+        }
+    }
+
+    $thegtalkuser = $user;
+    $thegtalkname = ${ $uid . $user }{'realname'};
 
     if ( !$UseMenuType ) {
         $UseMenuType = $MenuType;
@@ -466,21 +471,21 @@
 
     get_micon();
 
-    $yimimg      = SetImage('yim',$UseMenuType);
-    $aimimg      = SetImage('aim',$UseMenuType);
-    $skypeimg    = SetImage('skype',$UseMenuType);
-    $myspaceimg  = SetImage('myspace',$UseMenuType);
-    $facebookimg = SetImage('facebook',$UseMenuType);
-    $gtalkimg    = SetImage('gtalk',$UseMenuType);
-    $icqimg      = SetImage('icq',$UseMenuType);
-    $twitterimg  = SetImage('twitter',$UseMenuType);
-    $youtubeimg  = SetImage('youtube',$UseMenuType);
+    $yimimg      = SetImage( 'yim',      $UseMenuType );
+    $aimimg      = SetImage( 'aim',      $UseMenuType );
+    $skypeimg    = SetImage( 'skype',    $UseMenuType );
+    $myspaceimg  = SetImage( 'myspace',  $UseMenuType );
+    $facebookimg = SetImage( 'facebook', $UseMenuType );
+    $gtalkimg    = SetImage( 'gtalk',    $UseMenuType );
+    $icqimg      = SetImage( 'icq',      $UseMenuType );
+    $twitterimg  = SetImage( 'twitter',  $UseMenuType );
+    $youtubeimg  = SetImage( 'youtube',  $UseMenuType );
 
     $icqad{$user} =
       $icqad{$user}
       ? qq~<a href="http://web.icq.com/${$uid.$user}{'icq'}" onclick="target='_blank';">$load_con{'icqadd'}</a>~
       : q{};
-      $icqad{$user} =~ s/{yabb usericq}/${$uid.$user}{'icq'}/gsm;
+    $icqad{$user} =~ s/{yabb usericq}/${$uid.$user}{'icq'}/gsm;
 
     ${ $uid . $user }{'icq'} =
       ${ $uid . $user }{'icq'}
@@ -531,20 +536,21 @@
       ? qq~<a href="http://edit.yahoo.com/config/send_webmesg?.target=${$uid.$user}{'yim'}" onclick="target='_blank';">$yimimg</a>~
       : q{};
 
-	if ($showgenderimage && ${$uid.$user}{'gender'}) {
+    if ( $showgenderimage && ${ $uid . $user }{'gender'} ) {
         ${ $uid . $user }{'gender'} =
           ${ $uid . $user }{'gender'} =~ m/Female/ixsm ? 'female' : 'male';
         $genderTitle = ${ $uid . $user }{'gender'};
         ${ $uid . $user }{'gender'} =
           ${ $uid . $user }{'gender'}
-          ? qq~$load_txt{'231'}: $load_con{'gender'}<br />~ 
+          ? qq~$load_txt{'231'}: $load_con{'gender'}<br />~
           : q{};
-         ${ $uid . $user }{'gender'} =~ s/{yabb gender}/$genderTitle/sm;
-         ${ $uid . $user }{'gender'} =~ s/{yabb genderTitle}/$load_txt{$genderTitle}/gsm;
+        ${ $uid . $user }{'gender'} =~ s/{yabb gender}/$genderTitle/sm;
+        ${ $uid . $user }{'gender'} =~
+          s/{yabb genderTitle}/$load_txt{$genderTitle}/gsm;
     }
     else {
         ${ $uid . $user }{'gender'} = q{};
-	}
+    }
 
     if ( $showusertext && ${ $uid . $user }{'usertext'} )
     {    # Censor the usertext and wrap it
@@ -553,42 +559,45 @@
     }
     else {
         ${ $uid . $user }{'usertext'} = q{};
-	}
-
-	# Create the userpic / avatar html
-	if ($showuserpic && $allowpics) {
-		${$uid.$user}{'userpic'} ||= $my_blank_avatar;
+    }
+
+    # Create the userpic / avatar html
+    if ( $showuserpic && $allowpics ) {
+        ${ $uid . $user }{'userpic'} ||= $my_blank_avatar;
         ${ $uid . $user }{'userpic'} = q~<img src="~
           . (
               ${ $uid . $user }{'userpic'} =~ m/\A[\s\n]*https?:\/\//ism
             ? ${ $uid . $user }{'userpic'}
-            : ( $default_avatar && ${$uid.$user}{'userpic'} eq $my_blank_avatar )
+            : ( $default_avatar
+                  && ${ $uid . $user }{'userpic'} eq $my_blank_avatar )
             ? "$imagesdir/$default_userpic"
             : "$facesurl/${$uid.$user}{'userpic'}"
-          )
-          . q~" id="avatar_img_resize" alt="" style="display:none" />~;
-          if ( !$iamguest ) { ${ $uid . $user }{'userpic'} = qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}">${ $uid . $user }{'userpic'}</a>~; }
-          ${ $uid . $user }{'userpic'} .= q~<br />~; 
+          ) . q~" id="avatar_img_resize" alt="" style="display:none" />~;
+        if ( !$iamguest ) {
+            ${ $uid . $user }{'userpic'} =
+qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}">${ $uid . $user }{'userpic'}</a>~;
+        }
+        ${ $uid . $user }{'userpic'} .= q~<br />~;
     }
     else {
         ${ $uid . $user }{'userpic'} = q~<br />~;
-	}
+    }
 
     LoadMiniUser($user);
 
-	$yyUDLoaded{$user} = 1;
-	return 1;
+    $yyUDLoaded{$user} = 1;
+    return 1;
 }
 
 sub LoadMiniUser {
     my ($user) = @_;
     my $load   = q{};
     my $key    = q{};
-	$g = 0;
-	my $dg = 0;
+    $g = 0;
+    my $dg = 0;
     my $tempgroup;
-	my $noshow = 0;
-	my $bold   = 0;
+    my $noshow = 0;
+    my $bold   = 0;
 
     $tempgroupcheck = ${ $uid . $user }{'position'} || q{};
 
@@ -598,10 +607,10 @@
             $noshow,    $viewperms, $topicperms, $replyperms,
             $pollperms, $attachperms
         ) = split /\|/xsm, $Group{$tempgroupcheck};
-		$temptitle = $title;
-		$tempgroup = $Group{$tempgroupcheck};
-		if ($noshow == 0) { $bold = 1; }
-		$memberunfo{$user} = $tempgroupcheck;
+        $temptitle = $title;
+        $tempgroup = $Group{$tempgroupcheck};
+        if ( $noshow == 0 ) { $bold = 1; }
+        $memberunfo{$user} = $tempgroupcheck;
     }
     elsif ( $moderators{$user} ) {
         (
@@ -609,9 +618,9 @@
             $noshow,    $viewperms, $topicperms, $replyperms,
             $pollperms, $attachperms
         ) = split /\|/xsm, $Group{'Moderator'};
-		$temptitle         = $title;
-		$tempgroup         = $Group{'Moderator'};
-		$memberunfo{$user} = $tempgroupcheck;
+        $temptitle         = $title;
+        $tempgroup         = $Group{'Moderator'};
+        $memberunfo{$user} = $tempgroupcheck;
     }
     elsif ( exists $NoPost{$tempgroupcheck} && $tempgroupcheck ne q{} ) {
         (
@@ -619,74 +628,74 @@
             $noshow,    $viewperms, $topicperms, $replyperms,
             $pollperms, $attachperms
         ) = split /\|/xsm, $NoPost{$tempgroupcheck};
-		$temptitle         = $title;
-		$tempgroup         = $NoPost{$tempgroupcheck};
-		$memberunfo{$user} = $tempgroupcheck;
-	}
-
-	if (!$tempgroup) {
+        $temptitle         = $title;
+        $tempgroup         = $NoPost{$tempgroupcheck};
+        $memberunfo{$user} = $tempgroupcheck;
+    }
+
+    if ( !$tempgroup ) {
         foreach my $postamount ( reverse sort { $a <=> $b } keys %Post ) {
-			if (${$uid.$user}{'postcount'} >= $postamount) {
+            if ( ${ $uid . $user }{'postcount'} >= $postamount ) {
                 (
                     $title,     $stars,     $starpic,    $color,
                     $noshow,    $viewperms, $topicperms, $replyperms,
                     $pollperms, $attachperms
                 ) = split /\|/xsm, $Post{$postamount};
-				$tempgroup = $Post{$postamount};
-				last;
-			}
-		}
-		$memberunfo{$user} = $title;
-	}
-
-	if ($noshow == 1) {
-		$temptitle = $title;
+                $tempgroup = $Post{$postamount};
+                last;
+            }
+        }
+        $memberunfo{$user} = $title;
+    }
+
+    if ( $noshow == 1 ) {
+        $temptitle = $title;
         foreach my $postamount ( reverse sort { $a <=> $b } keys %Post ) {
-			if (${$uid.$user}{'postcount'} > $postamount) {
+            if ( ${ $uid . $user }{'postcount'} > $postamount ) {
                 ( $title, $stars, $starpic, $color, undef ) =
                   split /\|/xsm, $Post{$postamount}, 5;
-				last;
-			}
-		}
-	}
-
-	if (!$tempgroup) {
+                last;
+            }
+        }
+    }
+
+    if ( !$tempgroup ) {
         $temptitle   = 'no group';
         $title       = q{};
-		$stars       = 0;
+        $stars       = 0;
         $starpic     = q{};
         $color       = q{};
-		$noshow      = 1;
+        $noshow      = 1;
         $viewperms   = q{};
         $topicperms  = q{};
         $replyperms  = q{};
         $pollperms   = q{};
         $attachperms = q{};
-	}
-
-	# The following puts some new has variables in if this user is the user browsing the board
-	if ($user eq $username) {
-		if ($tempgroup) {
+    }
+
+# The following puts some new has variables in if this user is the user browsing the board
+    if ( $user eq $username ) {
+        if ($tempgroup) {
             (
                 $trash,     $trash,     $trash,      $trash,
                 $trash,     $viewperms, $topicperms, $replyperms,
                 $pollperms, $attachperms
             ) = split /\|/xsm, $tempgroup;
-		}
+        }
         ${ $uid . $user }{'perms'} =
           "$viewperms|$topicperms|$replyperms|$pollperms|$attachperms";
-	}
-
-	$userlink = ${$uid.$user}{'realname'} || $user;
-	$userlink = qq~<b>$userlink</b>~;
-	if (!$scripturl) { $scripturl = qq~$boardurl/$yyexec.$yyext~; }
-	if ($bold != 1) { $memberinfo{$user} = qq~$title~; }
-	else { $memberinfo{$user} = qq~<b>$title</b>~; }
+    }
+
+    $userlink = ${ $uid . $user }{'realname'} || $user;
+    $userlink = qq~<b>$userlink</b>~;
+    if   ( !$scripturl ) { $scripturl         = qq~$boardurl/$yyexec.$yyext~; }
+    if   ( $bold != 1 )  { $memberinfo{$user} = qq~$title~; }
+    else                 { $memberinfo{$user} = qq~<b>$title</b>~; }
 
     if ( $color ne q{} ) {
         $link{$user} =
 qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}" style="color:$color;">$userlink</a>~;
-		$format{$user}    = qq~<span style="color: $color;">$userlink</span>~;
+        $format{$user} = qq~<span style="color: $color;">$userlink</span>~;
         $format_unbold{$user} =
           qq~<span style="color: $color;">${$uid.$user}{'realname'}</span>~;
         $col_title{$user} =
@@ -695,10 +704,10 @@
     else {
         $link{$user} =
 qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}">$userlink</a>~;
-		$format{$user}    = qq~$userlink~;
+        $format{$user}        = qq~$userlink~;
         $format_unbold{$user} = qq~${$uid.$user}{'realname'}~;
-		$col_title{$user} = qq~$memberinfo{$user}~;
-	}
+        $col_title{$user}     = qq~$memberinfo{$user}~;
+    }
     $addmembergroup{$user} = '<br />';
     foreach my $addgrptitle ( split /,/xsm, ${ $uid . $user }{'addgroups'} ) {
         foreach my $key ( sort { $a <=> $b } keys %NoPost ) {
@@ -707,85 +716,85 @@
                 $anoshow,    $aviewperms, $atopicperms, $areplyperms,
                 $apollperms, $aattachperms
             ) = split /\|/xsm, $NoPost{$key};
-			if ($addgrptitle eq $key && $atitle ne $title) {
-				if ($user eq $username && !$iamadmin) {
-					if ($aviewperms == 1)   { $viewperms   = 1; }
-					if ($atopicperms == 1)  { $topicperms  = 1; }
-					if ($areplyperms == 1)  { $replyperms  = 1; }
-					if ($apollperms == 1)   { $pollperms   = 1; }
-					if ($aattachperms == 1) { $attachperms = 1; }
+            if ( $addgrptitle eq $key && $atitle ne $title ) {
+                if ( $user eq $username && !$iamadmin ) {
+                    if ( $aviewperms == 1 )   { $viewperms   = 1; }
+                    if ( $atopicperms == 1 )  { $topicperms  = 1; }
+                    if ( $areplyperms == 1 )  { $replyperms  = 1; }
+                    if ( $apollperms == 1 )   { $pollperms   = 1; }
+                    if ( $aattachperms == 1 ) { $attachperms = 1; }
                     ${ $uid . $user }{'perms'} =
 "$viewperms|$topicperms|$replyperms|$pollperms|$attachperms";
-				}
+                }
                 if (
                     $anoshow
                     && ( $iamadmin
                         || ( $iamgmod && $gmod_access2{'profileAdmin'} ) )
                   )
                 {
-					$addmembergroup{$user} .= qq~($atitle)<br />~;
+                    $addmembergroup{$user} .= qq~($atitle)<br />~;
                 }
                 elsif ( !$anoshow ) {
-					$addmembergroup{$user} .= qq~$atitle<br />~;
-				}
-			}
-		}
-	}
+                    $addmembergroup{$user} .= qq~$atitle<br />~;
+                }
+            }
+        }
+    }
     $addmembergroup{$user} =~ s/<br \/>\Z//sm;
 
     if ( $username eq 'Guest' ) { $memberunfo{$user} = 'Guest'; }
 
     $topicstart{$user} = q{};
     $viewnum = q{};
-	if ($INFO{'num'} || $FORM{'threadid'} && $user eq $username) {
-		if ($INFO{'num'}) {
-			$viewnum = $INFO{'num'};
+    if ( $INFO{'num'} || $FORM{'threadid'} && $user eq $username ) {
+        if ( $INFO{'num'} ) {
+            $viewnum = $INFO{'num'};
         }
         elsif ( $FORM{'threadid'} ) {
-			$viewnum = $FORM{'threadid'};
-		}
+            $viewnum = $FORM{'threadid'};
+        }
         if ( $viewnum =~ m{/}xsm ) {
             ( $viewnum, undef ) = split /\//xsm, $viewnum;
         }
 
-		# No need to open the message file so many times.
-		# Opening it once is enough to do the access checks.
+        # No need to open the message file so many times.
+        # Opening it once is enough to do the access checks.
         if ( !$topicstarter ) {
-			if (-e "$datadir/$viewnum.txt") {
+            if ( -e "$datadir/$viewnum.txt" ) {
                 if ( !ref $thread_arrayref{$viewnum} ) {
-					fopen(TOPSTART, "$datadir/$viewnum.txt");
-					@{$thread_arrayref{$viewnum}} = <TOPSTART>;
-					fclose(TOPSTART);
-				}
+                    fopen( TOPSTART, "$datadir/$viewnum.txt" );
+                    @{ $thread_arrayref{$viewnum} } = <TOPSTART>;
+                    fclose(TOPSTART);
+                }
                 ( undef, undef, undef, undef, $topicstarter, undef ) =
                   split /\|/xsm, ${ $thread_arrayref{$viewnum} }[0], 6;
-			}
-		}
+            }
+        }
 
         if ( $user eq $topicstarter ) { $topicstart{$user} = 'Topic Starter'; }
-	}
-	$memberaddgroup{$user} = ${$uid.$user}{'addgroups'};
-
-	my $starnum = $stars;
+    }
+    $memberaddgroup{$user} = ${ $uid . $user }{'addgroups'};
+
+    my $starnum        = $stars;
     my $memberstartemp = q{};
     if ( $starpic !~ /\//xsm ) { $starpic = "$imagesdir/$starpic"; }
-	while ($starnum-- > 0) {
+    while ( $starnum-- > 0 ) {
         $memberstartemp .= qq~<img src="$starpic" alt="*" />~;
-	}
+    }
     $memberstar{$user} = $memberstartemp ? "$memberstartemp<br />" : q{};
     return;
 }
 
 sub QuickLinks {
     my ( $user, $online ) = @_;
-	my $lastonline;
+    my $lastonline;
     if ($iamguest) {
         return ( $online ? $format_unbold{$user} : $format{$user} );
     }
 
-	if ($iamadmin || $iamgmod || $lastonlineinlink) {
-		if(${$uid.$user}{'lastonline'}) {
-			$lastonline = $date - ${$uid.$user}{'lastonline'};
+    if ( $iamadmin || $iamgmod || $lastonlineinlink ) {
+        if ( ${ $uid . $user }{'lastonline'} ) {
+            $lastonline = $date - ${ $uid . $user }{'lastonline'};
             my $days  = int( $lastonline / 86_400 );
             my $hours = sprintf '%02d',
               int( ( $lastonline - ( $days * 86_400 ) ) / 3600 );
@@ -799,28 +808,28 @@
                   ( $days * 86_400 ) -
                   ( $hours * 3600 ) -
                   ( $mins * 60 ) );
-			if (!$mins) {
-				$lastonline = "00:00:$secs";
+            if ( !$mins ) {
+                $lastonline = "00:00:$secs";
             }
             elsif ( !$hours ) {
-				$lastonline = "00:$mins:$secs";
+                $lastonline = "00:$mins:$secs";
             }
             elsif ( !$days ) {
-				$lastonline = "$hours:$mins:$secs";
+                $lastonline = "$hours:$mins:$secs";
             }
             else {
-				$lastonline = "$days $maintxt{'11'} $hours:$mins:$secs";
-			}
+                $lastonline = "$days $maintxt{'11'} $hours:$mins:$secs";
+            }
             $lastonline =
               qq~ title="$maintxt{'10'} $lastonline $maintxt{'12'}."~;
         }
         else {
-			$lastonline = qq~ title="$maintxt{'13'}."~;
-		}
-	}
+            $lastonline = qq~ title="$maintxt{'13'}."~;
+        }
+    }
     my $quicklinks;
-	if ($usertools) {
-		$qlcount++;
+    if ($usertools) {
+        $qlcount++;
         my $modcol = is_moderator_b($user);
         if ( $modcol == 1 ) {
             (
@@ -841,7 +850,7 @@
                 <li>~
           . userOnLineStatus($user)
           . qq~<a href="javascript:closeLinks('$useraccount{$user}$qlcount')" style="position:absolute;right:3px"><b>X</b></a></li>\n~;
-		if ($user ne $username) {
+        if ( $user ne $username ) {
             $quicklinks .=
 qq~             <li><a href="$scripturl?action=viewprofile;username=$useraccount{$user}">$maintxt{'2'} ${$uid.$user}{'realname'}$maintxt{'3'}</a></li>\n~;
             CheckUserPM_Level($user);
@@ -858,22 +867,22 @@
             {
                 $quicklinks .=
 qq~             <li><a href="$scripturl?action=imsend;to=$useraccount{$user}">$maintxt{'0'} ${$uid.$user}{'realname'}</a></li>\n~;
-			}
-			if (!${$uid.$user}{'hidemail'} || $iamadmin) {
+            }
+            if ( !${ $uid . $user }{'hidemail'} || $iamadmin ) {
                 $quicklinks .= '                <li>'
                   . enc_eMail(
                     "$maintxt{'1'} ${$uid.$user}{'realname'}",
                     ${ $uid . $user }{'email'},
                     q{}, q{}
                   ) . "</li>\n";
-			}
+            }
             if ( !%mybuddie ) { loadMyBuddy(); }
-			if ($buddyListEnabled && !$mybuddie{$user}) {
+            if ( $buddyListEnabled && !$mybuddie{$user} ) {
                 $quicklinks .=
 qq~             <li><a href="$scripturl?action=addbuddy;name=$useraccount{$user}">$maintxt{'4'} ${$uid.$user}{'realname'} $maintxt{'5'}</a></li>\n~;
-			}
-
-		}
+            }
+
+        }
         else {
 
             $quicklinks .=
@@ -887,7 +896,8 @@
     else {
         $quicklinks =
 qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}"$lastonline><span class="small">~
-          . ( $online ? $format_unbold{$user} : $format{$user} ) . q~</span></a>~;
+          . ( $online ? $format_unbold{$user} : $format{$user} )
+          . q~</span></a>~;
     }
 
     return $quicklinks;
@@ -904,7 +914,7 @@
 
     foreach my $i ( 0 .. $#buttons ) {
         $tools[$i] = SetImage( $buttons[$i], 3 );
-	}
+    }
 
     foreach my $i ( 0 .. $#tools ) {
         my ( $img_url, $img_txt ) = split /\|/xsm, $tools[$i];
@@ -948,21 +958,22 @@
     foreach ( split /; /sm, $ENV{'HTTP_COOKIE'} ) {
         $_ =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack('C', hex($1))/egxsm;
         ( $cookie, $value ) = split /=/xsm;
-		$yyCookies{$cookie} = $value;
-	}
-	if ($yyCookies{$cookiepassword}) {
-		$password      = $yyCookies{$cookiepassword};
-		$username      = $yyCookies{$cookieusername} || 'Guest';
-		$cookiesession = $yyCookies{$session_id};
+        $yyCookies{$cookie} = $value;
+    }
+    if ( $yyCookies{$cookiepassword} ) {
+        $password      = $yyCookies{$cookiepassword};
+        $username      = $yyCookies{$cookieusername} || 'Guest';
+        $cookiesession = $yyCookies{$session_id};
     }
     else {
         $password = q{};
-		$username = 'Guest';
-	}
+        $username = 'Guest';
+    }
     if (   $yyCookies{'guestlanguage'}
         && !$FORM{'guestlang'}
         && $enable_guestlanguage )
-    {   opendir DIR, $langdir;
+    {
+        opendir DIR, $langdir;
         my @langDir = readdir DIR;
         closedir DIR;
         @lang = ();
@@ -978,17 +989,18 @@
         }
 
         $ccheck = 0;
-        $clang = q{};
+        $clang  = q{};
         for my $lng (@lang) {
-           if ( $yyCookies{'guestlanguage'} eq $lng ) {
-               $clang = $lng;
-               $ccheck = 1; last;
-           }
-        }
-        if ($ccheck == 1) {
-		$language = $guestLang = $clang;
-        }
-	}
+            if ( $yyCookies{'guestlanguage'} eq $lng ) {
+                $clang  = $lng;
+                $ccheck = 1;
+                last;
+            }
+        }
+        if ( $ccheck == 1 ) {
+            $language = $guestLang = $clang;
+        }
+    }
     return;
 }
 
@@ -1011,86 +1023,90 @@
 }
 
 sub UpdateCookie {
-	my ($what, $user, $passw, $sessionval, $pathval, $expire) = @_;
-	my ($valid, $expiration);
+    my ( $what, $user, $passw, $sessionval, $pathval, $expire ) = @_;
+    my ( $valid, $expiration );
     if ( $what eq 'delete' ) {
         $expiration = 'Thursday, 01-Jan-1970 00:00:00 GMT';
         if ( $pathval eq q{} ) { $pathval = q~/~; }
-		if ($iamguest && $FORM{'guestlang'} && $enable_guestlanguage) {
+        if ( $iamguest && $FORM{'guestlang'} && $enable_guestlanguage ) {
             if ( $FORM{'guestlang'} && !$guestLang ) {
                 $guestLang = qq~$FORM{'guestlang'}~;
             }
-			$language = qq~$guestLang~;
+            $language       = qq~$guestLang~;
             $cookiepassword = 'guestlanguage';
-			$passw = qq~$language~;
+            $passw          = qq~$language~;
             $expire         = 'persistent';
-		}
-		$valid = 1;
+        }
+        $valid = 1;
     }
     elsif ( $what eq 'write' ) {
-		$expiration = $expire;
+        $expiration = $expire;
         if ( $pathval eq q{} ) { $pathval = q~/~; }
-		$valid = 1;
-	}
-
-	if ($valid) {
+        $valid = 1;
+    }
+
+    if ($valid) {
         if ( $expire eq 'persistent' ) {
             $expiration = 'Sunday, 17-Jan-2038 00:00:00 GMT';
         }
         $yySetCookies1 = write_cookie(
-			-name    => "$cookieusername",
-			-value   => "$user",
-			-path    => "$pathval",
+            -name    => "$cookieusername",
+            -value   => "$user",
+            -path    => "$pathval",
             -expires => "$expiration"
         );
         $yySetCookies2 = write_cookie(
-			-name    => "$cookiepassword",
-			-value   => "$passw",
-			-path    => "$pathval",
+            -name    => "$cookiepassword",
+            -value   => "$passw",
+            -path    => "$pathval",
             -expires => "$expiration"
         );
         $yySetCookies3 = write_cookie(
-			-name    => "$cookiesession_name",
-			-value   => "$sessionval",
-			-path    => "$pathval",
+            -name    => "$cookiesession_name",
+            -value   => "$sessionval",
+            -path    => "$pathval",
             -expires => "$expiration"
         );
 
-		foreach my $catid (@categoryorder) {
-		    if( !$catid ) { next; }
-		    my $boardlist = $cat{$catid};
-		    my @bdlist = split /\,/xsm, $boardlist;
-			foreach my $curboard (@bdlist) {
-				chomp $curboard;
-				my $tsortcookie = "$cookietsort$curboard$username";
-				if ($yyCookies{$tsortcookie}) {
-					push @otherCookies, write_cookie(
-						-name    =>   "$tsortcookie",
-						-value   =>   q{},
-						-path    =>   q{/},
-						-expires =>   'Thursday, 01-Jan-1970 00:00:00 GMT');
-					$yyCookies{$tsortcookie} = q{};
-				}
-				my $cookiename = "$cookiepassword$curboard$username";
-				if ($yyCookies{$cookiename}) {
-					push @otherCookies, write_cookie(
-						-name    =>   "$cookiename",
-						-value   =>   q{},
-						-path    =>   q{/},
-						-expires =>   "Thursday, 01-Jan-1970 00:00:00 GMT");
-					$yyCookies{$cookiename} = q{};
-				}
-			}
-		}
-	}
+        foreach my $catid (@categoryorder) {
+            if ( !$catid ) { next; }
+            my $boardlist = $cat{$catid};
+            my @bdlist = split /\,/xsm, $boardlist;
+            foreach my $curboard (@bdlist) {
+                chomp $curboard;
+                my $tsortcookie = "$cookietsort$curboard$username";
+                if ( $yyCookies{$tsortcookie} ) {
+                    push @otherCookies,
+                      write_cookie(
+                        -name    => "$tsortcookie",
+                        -value   => q{},
+                        -path    => q{/},
+                        -expires => 'Thursday, 01-Jan-1970 00:00:00 GMT'
+                      );
+                    $yyCookies{$tsortcookie} = q{};
+                }
+                my $cookiename = "$cookiepassword$curboard$username";
+                if ( $yyCookies{$cookiename} ) {
+                    push @otherCookies,
+                      write_cookie(
+                        -name    => "$cookiename",
+                        -value   => q{},
+                        -path    => q{/},
+                        -expires => 'Thursday, 01-Jan-1970 00:00:00 GMT'
+                      );
+                    $yyCookies{$cookiename} = q{};
+                }
+            }
+        }
+    }
     return;
 }
 
 sub LoadAccess {
-	$yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'808'}<br />";
+    $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'808'}<br />";
     $noaccesses = q{};
 
-	# Reply Check
+    # Reply Check
     my $rcaccess = AccessCheck( $currentboard, 2 ) || 0;
     if ( $rcaccess eq 'granted' ) {
         $yesaccesses .=
@@ -1101,7 +1117,7 @@
           "$load_txt{'805'} $load_txt{'807'} $load_txt{'809'}<br />";
     }
 
-	# Topic Check
+    # Topic Check
     my $tcaccess = AccessCheck( $currentboard, 1 ) || 0;
     if ( $tcaccess eq 'granted' ) {
         $yesaccesses .=
@@ -1112,7 +1128,7 @@
           "$load_txt{'805'} $load_txt{'807'} $load_txt{'810'}<br />";
     }
 
-	# Poll Check
+    # Poll Check
     my $access = AccessCheck( $currentboard, 3 ) || 0;
     if ( $access eq 'granted' ) {
         $yesaccesses .=
@@ -1123,8 +1139,8 @@
           "$load_txt{'805'} $load_txt{'807'} $load_txt{'811'}<br />";
     }
 
-	# Zero Post Check
-	if ($username ne 'Guest') {
+    # Zero Post Check
+    if ( $username ne 'Guest' ) {
         if ( $INFO{'zeropost'} != 1 && $rcaccess eq 'granted' ) {
             $yesaccesses .=
               "$load_txt{'805'} $load_txt{'806'} $load_txt{'812'}<br />";
@@ -1133,31 +1149,31 @@
             $noaccesses .=
               "$load_txt{'805'} $load_txt{'807'} $load_txt{'812'}<br />";
         }
-	}
-
-	$accesses = qq~$yesaccesses<br />$noaccesses~;
+    }
+
+    $accesses = qq~$yesaccesses<br />$noaccesses~;
     return $accesses;
 }
 
 sub WhatTemplate {
-	$found = 0;
+    $found = 0;
     while ( ( $curtemplate, $value ) = each %templateset ) {
         if ( $curtemplate eq $default_template ) {
             $template = $curtemplate;
             $found    = 1;
         }
-	}
-	if (!$found) { $template = 'Forum default'; }
+    }
+    if ( !$found ) { $template = 'Forum default'; }
     if ( ${ $uid . $username }{'template'} ne q{} ) {
-		if (!exists $templateset{${$uid.$username}{'template'}}) {
-			${$uid.$username}{'template'} = 'Forum default';
+        if ( !exists $templateset{ ${ $uid . $username }{'template'} } ) {
+            ${ $uid . $username }{'template'} = 'Forum default';
             UserAccount( $username, 'update' );
-		}
+        }
         while ( ( $curtemplate, $value ) = each %templateset ) {
             if ( $curtemplate eq ${ $uid . $username }{'template'} ) {
                 $template = $curtemplate;
-		    }
-	    }
+            }
+        }
     }
     (
         $usestyle,   $useimages,  $usehead,     $useboard,
@@ -1167,7 +1183,7 @@
     if ( !-e "$htmldir/Templates/Forum/$usestyle.css" ) {
         $usestyle = 'default';
     }
-	if (!-e "$templatesdir/$usehead/$usehead.html") { $usehead = 'default'; }
+    if ( !-e "$templatesdir/$usehead/$usehead.html" ) { $usehead = 'default'; }
     if ( !-e "$templatesdir/$useboard/BoardIndex.template" ) {
         $useboard = 'default';
     }
@@ -1186,24 +1202,28 @@
     if ( -d "$htmldir/Templates/Forum/$useimages" ) {
         $imagesdir = "$yyhtml_root/Templates/Forum/$useimages";
     }
-	else { $imagesdir = "$yyhtml_root/Templates/Forum/default"; }
-	$defaultimagesdir = "$yyhtml_root/Templates/Forum/default";
-
-	$cssbuttons = 0;
-	fopen(CSS, "$yyhtml_root/Templates/Forum/$usestyle.css");
-	@thecss = <CSS>;
-	fclose(CSS);
-	foreach $style_sgl (@thecss) {
-		$style_sgl =~ s/[\n\r]//g;
-		$style_sgl =~ s/\A\s*//;
-		$style_sgl =~ s/\s*\Z//;
-		$style_sgl =~ s/\t//g;
-		$stylestr .= qq~$style_sgl ~;
-	}
-	$stylestr =~ s/\s{2,}/ /g;
-	if ($stylestr =~ /\.buttonleft/ && $stylestr =~ /\.buttonright/ && $stylestr =~ /\.buttonimage/ && $stylestr =~ /\.buttontext/) {
-		$cssbuttons = 1;
-	}
+    else { $imagesdir = "$yyhtml_root/Templates/Forum/default"; }
+    $defaultimagesdir = "$yyhtml_root/Templates/Forum/default";
+
+    $cssbuttons = 0;
+    fopen( CSS, "$yyhtml_root/Templates/Forum/$usestyle.css" );
+    @thecss = <CSS>;
+    fclose(CSS);
+    foreach my $style_sgl (@thecss) {
+        $style_sgl =~ s/[\n\r]//gsm;
+        $style_sgl =~ s/\A\s*//gsm;
+        $style_sgl =~ s/\s*\Z//gsm;
+        $style_sgl =~ s/\t//gsm;
+        $stylestr .= qq~$style_sgl ~;
+    }
+    $stylestr =~ s/\s{2,}/ /gsm;
+    if (   $stylestr =~ /\.buttonleft/sm
+        && $stylestr =~ /\.buttonright/sm
+        && $stylestr =~ /\.buttonimage/sm
+        && $stylestr =~ /\.buttontext/sm )
+    {
+        $cssbuttons = 1;
+    }
     $extpagstyle =~ s/$usestyle\///gxsm;
     $cssbuttons = 1;
     return;
@@ -1211,152 +1231,152 @@
 
 sub WhatLanguage {
     if ( ${ $uid . $username }{'language'} ne q{} ) {
-		$language = ${$uid.$username}{'language'};
+        $language = ${ $uid . $username }{'language'};
     }
     elsif ( $FORM{'guestlang'} && $enable_guestlanguage ) {
-		$language = $FORM{'guestlang'};
+        $language = $FORM{'guestlang'};
     }
     elsif ( $guestLang && $enable_guestlanguage ) {
-		$language = $guestLang;
+        $language = $guestLang;
     }
     else {
-		$language = $lang;
-	}
+        $language = $lang;
+    }
 
     LoadLanguage('Main');
     LoadLanguage('Menu');
 
-	if ($adminscreen) {
+    if ($adminscreen) {
         LoadLanguage('Admin');
         LoadLanguage('FA');
-	}
+    }
     return;
 }
 
 sub buildIMS {
-	my ($builduser,$job) = @_;
+    my ( $builduser, $job ) = @_;
     my ( $incurr, $inunr, $outcurr, $draftcount, @imstore, $storetotal,
         @storefoldersCount, $storeCounts );
 
-	if ($job) {
-		if ($job eq 'load') {
+    if ($job) {
+        if ( $job eq 'load' ) {
             load_IMS($builduser);
         }
         else {
             update_IMS($builduser);
-		}
-		return;
-	}
-
-	## inbox if it exists, either load and count totals or parse and update format.
-	if (-e "$memberdir/$builduser.msg") {
+        }
+        return;
+    }
+
+    ## inbox if it exists, either load and count totals or parse and update format.
+    if ( -e "$memberdir/$builduser.msg" ) {
         fopen( USERMSG, "$memberdir/$builduser.msg" )
           || fatal_error( 'cannot_open', "$memberdir/$builduser.msg", 1 );
 
         # open inbox
-		my @messages = <USERMSG>;
-		fclose(USERMSG);
-
-		# test the data for version. 16 elements in new format, no more than 8 in old.
-			foreach my $message (@messages) {
-
-				# If the message is flagged as u(nopened), add to the new count
+        my @messages = <USERMSG>;
+        fclose(USERMSG);
+
+  # test the data for version. 16 elements in new format, no more than 8 in old.
+        foreach my $message (@messages) {
+
+            # If the message is flagged as u(nopened), add to the new count
             if ( ( split /\|/xsm, $message )[12] =~ /u/sm ) { $inunr++; }
-			}
-			$incurr = @messages;
-
-	}
-
-	## do the outbox
-	if (-e "$memberdir/$builduser.outbox") {
+        }
+        $incurr = @messages;
+
+    }
+
+    ## do the outbox
+    if ( -e "$memberdir/$builduser.outbox" ) {
         fopen( OUTMESS, "$memberdir/$builduser.outbox" )
           || fatal_error( 'cannot_open', "$memberdir/$builduser.outbox", 1 );
-		my @outmessages = <OUTMESS>;
+        my @outmessages = <OUTMESS>;
         fclose(OUTMESS);
-			$outcurr = @outmessages;
-	}
-
-	if (-e "$memberdir/$builduser.imdraft") {
+        $outcurr = @outmessages;
+    }
+
+    if ( -e "$memberdir/$builduser.imdraft" ) {
         fopen( DRAFTMESS, "$memberdir/$builduser.imdraft" )
           || fatal_error( 'cannot_open', "$memberdir/$builduser.imdraft", 1 );
-		my @d = <DRAFTMESS>;
+        my @d = <DRAFTMESS>;
         fclose(DRAFTMESS);
-		$draftcount = @d;
-	}
-
-	## grab the current list of store folders
-	## else, create an entry for the two 'default ones' for the in/out status stuff
+        $draftcount = @d;
+    }
+
+    ## grab the current list of store folders
+    ## else, create an entry for the two 'default ones' for the in/out status stuff
     my $storefolders = ${$builduser}{'PMfolders'} || 'in|out';
     my @currStoreFolders = split /\|/xsm, $storefolders;
-	if (-e "$memberdir/$builduser.imstore") {
+    if ( -e "$memberdir/$builduser.imstore" ) {
         fopen( STOREMESS, "$memberdir/$builduser.imstore" )
           || fatal_error( 'cannot_open', "$memberdir/$builduser.imstore", 1 );
-		@imstore = <STOREMESS>;
-		fclose (STOREMESS);
-		if (@imstore) {
-			my ($storeUpdated,$storeMessLine) = (0,0);
-			foreach my $message (@imstore) {
+        @imstore = <STOREMESS>;
+        fclose(STOREMESS);
+        if (@imstore) {
+            my ( $storeUpdated, $storeMessLine ) = ( 0, 0 );
+            foreach my $message (@imstore) {
                 my @messLine = split /\|/xsm, $message;
-				## look through list for folder name
+                ## look through list for folder name
                 if ( $messLine[13] eq q{} )
                 {    # some folder missing within imstore
                     if ( $messLine[1] ne q{} ) {    # 'from' name so inbox
-						$messLine[13] = 'in';
+                        $messLine[13] = 'in';
                     }
                     else {                          # no 'from' so outbox
-						$messLine[13] = 'out';
-					}
+                        $messLine[13] = 'out';
+                    }
                     $imstore[$storeMessLine] = join q{|}, @messLine;
-					$storeUpdated = 1;
-				}
+                    $storeUpdated = 1;
+                }
                 if ( $storefolders !~ /\b$messLine[13]\b/sm ) {
                     push @currStoreFolders, $messLine[13];
                     $storefolders = join q{|}, @currStoreFolders;
-				}
-				$storeMessLine++;
-			}
-			if ($storeUpdated == 1) {
+                }
+                $storeMessLine++;
+            }
+            if ( $storeUpdated == 1 ) {
                 fopen( STRMESS, "+>$memberdir/$builduser.imstore" )
                   || fatal_error( 'cannot_open',
                     "$memberdir/$builduser.imstore", 1 );
                 print {STRMESS} @imstore or croak 'cannot print STRMESS';
-				fclose(STRMESS);
-			}
-			$storetotal = @imstore;
+                fclose(STRMESS);
+            }
+            $storetotal = @imstore;
             $storefolders = join q{|}, @currStoreFolders;
 
         }
         else {
-			unlink "$memberdir/$builduser.imstore";
-		}
-	}
-	## run through the messages and count against the folder name
+            unlink "$memberdir/$builduser.imstore";
+        }
+    }
+    ## run through the messages and count against the folder name
     for my $y ( 0 .. ( @currStoreFolders - 1 ) ) {
-		$storefoldersCount[$y] = 0;
+        $storefoldersCount[$y] = 0;
         for my $x ( 0 .. ( @imstore - 1 ) ) {
             if ( ( split /\|/xsm, $imstore[$x] )[13] eq $currStoreFolders[$y] )
             {
-				$storefoldersCount[$y]++;
-			}
-		}
-	}
+                $storefoldersCount[$y]++;
+            }
+        }
+    }
     $storeCounts = join q{|}, @storefoldersCount;
 
     LoadBroadcastMessages($builduser);
 
-	${$builduser}{'PMmnum'} = $incurr || 0;
-	${$builduser}{'PMimnewcount'} = $inunr || 0;
-	${$builduser}{'PMmoutnum'} = $outcurr || 0;
-	${$builduser}{'PMdraftnum'} = $draftcount || 0;
-	${$builduser}{'PMstorenum'} = $storetotal || 0;
-	${$builduser}{'PMfolders'} = $storefolders;
-	${$builduser}{'PMfoldersCount'} = $storeCounts || 0;
+    ${$builduser}{'PMmnum'}         = $incurr      || 0;
+    ${$builduser}{'PMimnewcount'}   = $inunr       || 0;
+    ${$builduser}{'PMmoutnum'}      = $outcurr     || 0;
+    ${$builduser}{'PMdraftnum'}     = $draftcount  || 0;
+    ${$builduser}{'PMstorenum'}     = $storetotal  || 0;
+    ${$builduser}{'PMfolders'}      = $storefolders;
+    ${$builduser}{'PMfoldersCount'} = $storeCounts || 0;
     update_IMS($builduser);
     return;
 }
 
 sub update_IMS {
-	my $builduser = shift;
+    my $builduser = shift;
     my @tag =
       qw(PMmnum PMimnewcount PMmoutnum PMstorenum PMdraftnum PMfolders PMfoldersCount PMbcRead);
 
@@ -1367,25 +1387,25 @@
     for my $cnt ( 0 .. ( @tag - 1 ) ) {
         print {UPDATE_IMS} qq~'$tag[$cnt]',"${$builduser}{$tag[$cnt]}"\n~
           or croak 'cannot update IMS';
-	}
-	fclose(UPDATE_IMS);
+    }
+    fclose(UPDATE_IMS);
     return;
 }
 
 sub load_IMS {
-	my $builduser = shift;
-	my @ims;
-	if (-e "$memberdir/$builduser.ims") {
+    my $builduser = shift;
+    my @ims;
+    if ( -e "$memberdir/$builduser.ims" ) {
         fopen( IMSFILE, "$memberdir/$builduser.ims" )
           || fatal_error( 'cannot_open', "$memberdir/$builduser.ims", 1 );
-		@ims = <IMSFILE>;
+        @ims = <IMSFILE>;
         fclose(IMSFILE);
-	}
+    }
 
     if ( $ims[0] =~ /###/xsm ) {
         foreach (@ims) {
             if ( $_ =~ /'(.*?)',"(.*?)"/xsm ) { ${$builduser}{$1} = $2; }
-	    }
+        }
     }
     else {
         buildIMS( $builduser, q{} );
@@ -1393,36 +1413,35 @@
     return;
 }
 
-sub LoadBroadcastMessages { #check broadcast messages
+sub LoadBroadcastMessages {    #check broadcast messages
     return
       if ( $iamguest
         || $PM_level == 0
-        || ( $maintenance && !$iamadmin )
-        || ( $PM_level == 2 && ( !$staff  ) )
+        || ( $maintenance   && !$iamadmin )
+        || ( $PM_level == 2 && ( !$staff ) )
         || ( $PM_level == 3 && ( !$iamadmin && !$iamgmod ) )
-        || ( $PM_level == 4 && ( !$iamadmin && !$iamgmod && !$iamymod ) )
-         );
-
-	my $builduser = shift;
-	$BCnewMessage = 0;
-	$BCCount = 0;
-	if (-e "$memberdir/broadcast.messages") {
+        || ( $PM_level == 4 && ( !$iamadmin && !$iamgmod && !$iamymod ) ) );
+
+    my $builduser = shift;
+    $BCnewMessage = 0;
+    $BCCount      = 0;
+    if ( -e "$memberdir/broadcast.messages" ) {
         my %PMbcRead;
         map { $PMbcRead{$_} = 1; } split /,/xsm, ${$builduser}{'PMbcRead'};
 
         fopen( BCMESS, "<$memberdir/broadcast.messages" )
           || fatal_error( 'cannot_open', "$memberdir/broadcast.messages", 1 );
-		my @bcmessages = <BCMESS>;
-		fclose(BCMESS);
-		foreach (@bcmessages) {
+        my @bcmessages = <BCMESS>;
+        fclose(BCMESS);
+        foreach (@bcmessages) {
             my ( $mnum, $mfrom, $mto, undef ) = split /\|/xsm, $_, 4;
             if ( $mfrom eq $username ) { $BCCount++; $PMbcRead{$mnum} = 1; }
             elsif ( BroadMessageView($mto) ) {
-				$BCCount++;
+                $BCCount++;
                 if ( exists $PMbcRead{$mnum} ) { $PMbcRead{$mnum} = 1; }
                 else                           { $BCnewMessage++; }
-			}
-		}
+            }
+        }
         ${$builduser}{'PMbcRead'} = q{};
         foreach ( keys %PMbcRead ) {
             if ( $PMbcRead{$_} ) {
@@ -1438,4 +1457,4 @@
     return;
 }
 
-1;+1;