| ############################################################################### |
| ############################################################################### |
| # Load.pl # |
| # Load.pm # |
| |
| # $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 CGI::Carp qw(fatalsToBrowser); |
| |
| our $VERSION = '2.6.12'; |
| |
| |
| $loadplver = 'YaBB 2.5.2 $Revision: 1.0 $'; |
| $loadpmver = 'YaBB 2.6.12 $Revision: 1710 $'; |
| |
| |
| sub LoadBoardControl { |
| sub LoadBoardControl { |
| my ($cntcat, $cntboard, $cntpic, $cntdescription, $cntmods, $cntmodgroups, $cnttopicperms, $cntreplyperms, $cntpollperms, $cntzero, $dummy, $dummy, $dummy, $cnttotals); |
| $binboard = q{}; |
| $binboard = ""; |
| $annboard = q{}; |
| $annboard = ""; |
| |
| |
| |
| fopen(FORUMCONTROL, "$boardsdir/forum.control") || &fatal_error('cannot_open', "$boardsdir/forum.control", 1); |
| |
| my @boardcontrols = <FORUMCONTROL>; |
| |
| fclose(FORUMCONTROL); |
| |
| $maxboards = $#boardcontrols; |
| |
| |
| |
| foreach my $boardline (@boardcontrols) { |
| |
| $boardline =~ s/[\r\n]//g; # Built in chomp |
| |
| |
| |
| ($cntcat, $cntboard, $cntpic, $cntdescription, $cntmods, $cntmodgroups, $cnttopicperms, $cntreplyperms, $cntpollperms, $cntzero, $cntmembergroups, $cntann, $cntrbin, $cntattperms, $cntminageperms, $cntmaxageperms, $cntgenderperms) = split(/\|/, $boardline); |
| |
| ## create a global boards array |
| |
| push(@allboards, $cntboard); |
| |
| |
| |
| $cntdescription =~ s/\&/\&/g; |
| |
| |
| |
| %{ $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,); |
| |
| if ($cntann == 1) { $annboard = $cntboard; } |
| |
| if ($cntrbin == 1) { $binboard = $cntboard; } |
| |
| } |
| |
| } |
| |
| |
| |
| sub LoadIMs { |
| |
| return if ($iamguest || $PM_level == 0 || ($maintenance && !$iamadmin) || ($PM_level == 2 && (!$iamadmin && !$iamgmod && !$iammod)) || ($PM_level == 3 && (!$iamadmin && !$iamgmod))); |
| |
| |
| |
| &buildIMS($username, 'load') unless exists ${$username}{'PMmnum'}; |
| fopen( FORUMCONTROL, "$boardsdir/forum.control" ) |
| |
| or fatal_error( 'cannot_open', "$boardsdir/forum.control", 1 ); |
| my $imnewtext; |
| my @boardcontrols = <FORUMCONTROL>; |
| if (${$username}{'PMimnewcount'} == 1) { $imnewtext = qq~<a href="$scripturl?action=imshow;caller=1;id=-1">1 $load_txt{'155'}</a>~; } |
| fclose(FORUMCONTROL); |
| elsif (!${$username}{'PMimnewcount'}) { $imnewtext = $load_txt{'nonew'}; } |
| $maxboards = $#boardcontrols; |
| else { $imnewtext = qq~<a href="$scripturl?action=imshow;caller=1;id=-1">${$username}{'PMimnewcount'} $load_txt{'154'}</a>~; } |
| |
| |
| foreach my $boardline (@boardcontrols) { |
| |
| $boardline =~ s/[\r\n]//gxsm; # Built in chomp |
| |
| my ( |
| |
| $cntcat, $cntboard, $cntpic, |
| |
| $cntdescription, $cntmods, $cntmodgroups, |
| |
| $cnttopicperms, $cntreplyperms, $cntpollperms, |
| |
| $cntzero, $cntmembergroups, $cntann, |
| |
| $cntrbin, $cntattperms, $cntminageperms, |
| |
| $cntmaxageperms, $cntgenderperms, $cntcanpost, |
| |
| $cntparent, $rules, $rulestitle, |
| |
| $rulesdesc, $rulescollapse, $brdpasswr, |
| |
| $brdpassw, $cntbdrss, |
| |
| ## Mod Hook 1 ## |
| |
| ) = split /\|/xsm, $boardline; |
| |
| ## create a global boards array |
| |
| push @allboards, $cntboard; |
| |
| |
| |
| $cntdescription =~ s/\&\ /\& /gxsm; |
| |
| if ( substr( $cntmods, 0, 2 ) eq ', ' ) { |
| |
| substr( $cntmods, 0, 2 ) = q{}; |
| |
| } |
| |
| if ( substr( $cntmodgroups, 0, 2 ) eq ', ' ) { |
| |
| substr( $cntmodgroups, 0, 2 ) = q{}; |
| |
| } |
| |
| |
| if (${$username}{'PMmnum'} == 1) { $yyim = qq~$load_txt{'152'} <a href="$scripturl?action=im">${$username}{'PMmnum'} $load_txt{'471'}</a>, $imnewtext~; } |
| %{ $uid . $cntboard } = ( |
| elsif (!${$username}{'PMmnum'} && !${$username}{'PMimnewcount'}) { $yyim = qq~$load_txt{'152'} <a href="$scripturl?action=im">${$username}{'PMmnum'} $load_txt{'153'}</a>~; } |
| 'cat' => $cntcat, |
| else { $yyim = qq~$load_txt{'152'} <a href="$scripturl?action=im">${$username}{'PMmnum'} $load_txt{'153'}</a>, $imnewtext~; } |
| '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, |
| |
| 'rules' => $rules, |
| |
| 'rulestitle' => $rulestitle, |
| |
| 'rulesdesc' => $rulesdesc, |
| |
| 'rulescollapse' => $rulescollapse, |
| |
| 'brdpasswr' => $brdpasswr, |
| |
| 'brdpassw' => $brdpassw, |
| |
| 'brdrss' => $cntbdrss, |
| |
| ## Mod Hook 2 ## |
| |
| ); |
| |
| if ( $cntann == 1 ) { $annboard = $cntboard; } |
| |
| if ( $cntrbin == 1 ) { $binboard = $cntboard; } |
| |
| } |
| |
| return; |
| |
| } |
| |
| |
| if (!$user_ip && $iamadmin) { $yyim .= qq~<br /><b>$load_txt{'773'}</b>~; } |
| sub LoadIMs { |
| |
| return |
| |
| if ( $iamguest |
| |
| || $PM_level == 0 |
| |
| || ( $maintenance && !$iamadmin ) |
| |
| || ( $PM_level == 2 && ( !$staff ) ) |
| |
| || ( $PM_level == 4 && ( !$iamadmin && !$iamgmod && !$iamfmod ) ) |
| |
| || ( $PM_level == 3 && ( !$iamadmin && !$iamgmod ) ) ); |
| |
| |
| |
| if ( !exists ${$username}{'PMmnum'} ) { buildIMS( $username, 'load' ); } |
| |
| |
| |
| 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'}; } |
| |
| else { |
| |
| $imnewtext = |
| |
| qq~<a href="$scripturl?action=imshow;caller=1;id=-1">${$username}{'PMimnewcount'} $load_txt{'154'}</a>~; |
| |
| } |
| |
| |
| |
| if ( ${$username}{'PMmnum'} == 1 ) { |
| |
| if ( ${$username}{'PMimnewcount'} == 1 ) { |
| |
| $yyim = qq~$load_txt{'152'} <a href="$scripturl?action=im">${$username}{'PMmnum'} $load_txt{'155b'}</a>~; |
| |
| } |
| |
| else { |
| |
| $yyim = |
| |
| qq~$load_txt{'152'} <a href="$scripturl?action=im">${$username}{'PMmnum'} $load_txt{'471'}</a>, $imnewtext~; |
| |
| } |
| |
| } |
| |
| elsif ( !${$username}{'PMmnum'} && !${$username}{'PMimnewcount'} ) { |
| |
| $yyim = |
| |
| qq~$load_txt{'152'} <a href="$scripturl?action=im">${$username}{'PMmnum'} $load_txt{'153'}</a>~; |
| |
| } |
| |
| elsif ( ${$username}{'PMmnum'} == ${$username}{'PMimnewcount'} ) { |
| |
| $yyim = qq~$load_txt{'152'} <a href="$scripturl?action=im">${$username}{'PMmnum'} $load_txt{'154b'}</a>~; |
| |
| } |
| |
| else { |
| |
| $yyim = |
| |
| qq~$load_txt{'152'} <a href="$scripturl?action=im">${$username}{'PMmnum'} $load_txt{'153'}</a>, $imnewtext~; |
| |
| } |
| |
| |
| |
| if ( !$user_ip && $iamadmin ) { |
| |
| $yyim .= qq~<br /><b>$load_txt{'773'}</b>~; |
| |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub LoadCensorList { |
| sub LoadCensorList { |
| if ($#censored > 0 || -s "$langdir/$language/censor.txt" < 3 || !-e "$langdir/$language/censor.txt") { return; } |
| opendir DIR, $langdir; |
| fopen(CENSOR, "$langdir/$language/censor.txt") || &fatal_error("cannot_open","$langdir/$language/censor.txt", 1); |
| my @langDir = readdir DIR; |
| while (chomp($buffer = <CENSOR>)) { |
| closedir DIR; |
| $buffer =~ s/\r(?=\n*)//g; |
| @lang = (); |
| if ($buffer =~ m/\~/) { |
| foreach my $langitems ( sort { lc($a) cmp lc $b } @langDir ) { |
| ($tmpa, $tmpb) = split(/\~/, $buffer); |
| chomp $langitems; |
| $tmpc = 0; |
| if ( ( $langitems ne q{.} ) |
| } else { |
| && ( $langitems ne q{..} ) |
| ($tmpa, $tmpb) = split(/=/, $buffer); |
| && ( $langitems ne q{.htaccess} ) |
| $tmpc = 1; |
| && ( $langitems ne q{index.html} ) ) |
| } |
| { |
| push(@censored, [$tmpa, $tmpb, $tmpc]); |
| push @lang, $langitems; |
| } |
| } |
| fclose(CENSOR); |
| } |
| |
| |
| |
| if ( $#censored > 0 ) { |
| |
| return; |
| |
| } |
| |
| elsif ( |
| |
| scalar @lang == 1 |
| |
| && ( ( -s "$langdir/$language/censor.txt" ) < 3 |
| |
| || !-e "$langdir/$language/censor.txt" ) |
| |
| ) |
| |
| { |
| |
| return; |
| |
| } |
| |
| for my $langd (@lang) { |
| |
| if ( -e "$langdir/$langd/censor.txt" ) { |
| |
| fopen( CENSOR, "$langdir/$langd/censor.txt" ); |
| |
| while ( chomp( $buffer = <CENSOR> ) ) { |
| |
| $buffer =~ s/\r(?=\n*)//gxsm; |
| |
| if ( $buffer =~ m/\~/sm ) { |
| |
| ( $tmpa, $tmpb ) = split /\~/xsm, $buffer; |
| |
| $tmpc = 0; |
| |
| } |
| |
| else { |
| |
| ( $tmpa, $tmpb ) = split /=/xsm, $buffer; |
| |
| $tmpc = 1; |
| |
| } |
| |
| push @censored, [ $tmpa, $tmpb, $tmpc ]; |
| |
| } |
| |
| fclose(CENSOR); |
| |
| } |
| |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub LoadUserSettings { |
| sub LoadUserSettings { |
| &LoadBoardControl; |
| LoadBoardControl(); |
| $iamguest = $username eq 'Guest' ? 1 : 0; |
| $iamguest = $username eq 'Guest' ? 1 : 0; |
| if ($username ne 'Guest') { |
| if ( $username ne 'Guest' ) { |
| &LoadUser($username); |
| LoadUser($username); |
| if (!$maintenance || ${$uid.$username}{'position'} eq 'Administrator') { |
| if ( !$maintenance |
| $iammod = &is_moderator($username); |
| || ${ $uid . $username }{'position'} eq 'Administrator' ) |
| if (${$uid.$username}{'position'} eq 'Administrator' || ${$uid.$username}{'position'} eq 'Global Moderator' || $iammod) { $staff = 1; } |
| { |
| else { $staff = 0; } |
| $iammod = is_moderator($username); |
| $sessionvalid = 1; |
| if ( ${ $uid . $username }{'position'} eq 'Administrator' |
| if ($sessions == 1 && $staff == 1) { |
| || ${ $uid . $username }{'position'} eq 'Global Moderator' |
| $cursession = &encode_password($user_ip); |
| || ${ $uid . $username }{'position'} eq 'Mid Moderator' |
| chomp $cursession; |
| || $iammod ) |
| if (${$uid.$username}{'session'} ne $cursession || ${$uid.$username}{'session'} ne $cookiesession) { $sessionvalid = 0; } |
| { |
| } |
| $staff = 1; |
| $spass = ${$uid.$username}{'password'}; |
| } |
| |
| else { $staff = 0; } |
| # Make sure that if the password doesn't match you get FULLY Logged out |
| $sessionvalid = 1; |
| if ($spass && $spass ne $password && $action ne 'logout') { |
| if ( $sessions == 1 && $staff == 1 ) { |
| $yySetLocation = $guestaccess ? qq~$scripturl~ : qq~$scripturl?action=login~; |
| $cursession = encode_password($user_ip); |
| &UpdateCookie("delete"); |
| chomp $cursession; |
| &redirectexit; |
| if ( ${ $uid . $username }{'session'} ne $cursession |
| } |
| || ${ $uid . $username }{'session'} ne $cookiesession ) |
| |
| { |
| $iamadmin = (${$uid.$username}{'position'} eq 'Administrator' && $sessionvalid == 1) ? 1 : 0; |
| $sessionvalid = 0; |
| $iamgmod = (${$uid.$username}{'position'} eq 'Global Moderator' && $sessionvalid == 1) ? 1 : 0; |
| } |
| if ($sessionvalid == 1) { ${$uid.$username}{'session'} = $cursession; } |
| } |
| &CalcAge($username, "calc"); |
| $spass = ${ $uid . $username }{'password'}; |
| # Set the order how Topic summaries are displayed |
| |
| $ttsreverse = ${$uid.$username}{'reversetopic'} if !$adminscreen && $ttsureverse; |
| # Make sure that if the password doesn't match you get FULLY Logged out |
| return; |
| if ( $spass && $spass ne $password && $action ne 'logout' ) { |
| } |
| $yySetLocation = |
| } |
| $guestaccess ? qq~$scripturl~ : qq~$scripturl?action=login~; |
| |
| UpdateCookie('delete'); |
| &FormatUserName(''); |
| redirectexit(); |
| &UpdateCookie("delete"); |
| } |
| $username = 'Guest'; |
| |
| $iamguest = '1'; |
| $iamadmin = |
| $iamadmin = ''; |
| ( ${ $uid . $username }{'position'} eq 'Administrator' |
| $iamgmod = ''; |
| && $sessionvalid == 1 ) ? 1 : 0; |
| $password = ''; |
| $iamgmod = |
| $ENV{'HTTP_COOKIE'} = ''; |
| ( ${ $uid . $username }{'position'} eq 'Global Moderator' |
| $yyim = ''; |
| && $sessionvalid == 1 ) ? 1 : 0; |
| $yyuname = ''; |
| $iamfmod = |
| |
| ( ${ $uid . $username }{'position'} eq 'Mid Moderator' |
| |
| && $sessionvalid == 1 ) ? 1 : 0; |
| |
| if ( $sessionvalid == 1 ) { |
| |
| ${ $uid . $username }{'session'} = $cursession; |
| |
| } |
| |
| CalcAge( $username, 'calc' ); |
| |
| |
| |
| # Set the order how Topic summaries are displayed |
| |
| if ( !$adminscreen && $ttsureverse ) { |
| |
| $ttsreverse = ${ $uid . $username }{'reversetopic'}; |
| |
| } |
| |
| return; |
| |
| } |
| |
| } |
| |
| |
| |
| FormatUserName(q{}); |
| |
| UpdateCookie('delete'); |
| |
| $username = 'Guest'; |
| |
| $iamguest = '1'; |
| |
| $iamadmin = q{}; |
| |
| $iamgmod = q{}; |
| |
| $iamfmod = q{}; |
| |
| $password = q{}; |
| |
| local $ENV{'HTTP_COOKIE'} = q{}; |
| |
| $yyim = q{}; |
| |
| $yyuname = q{}; |
| |
| return; |
| } |
| } |
| |
| |
| sub FormatUserName { |
| sub FormatUserName { |
| my $user = $_[0]; |
| my ($user) = @_; |
| return if $useraccount{$user}; |
| return if $useraccount{$user}; |
| $useraccount{$user} = $do_scramble_id ? &cloak($user) : $user; |
| $useraccount{$user} = $do_scramble_id ? cloak($user) : $user; |
| |
| return; |
| } |
| } |
| |
| |
| sub LoadUser { |
| sub LoadUser { |
| my ($user,$userextension) = @_; |
| my ( $user, $userextension, $tst ) = @_; |
| return 1 if exists ${$uid.$user}{'realname'}; |
| return 1 if exists ${ $uid . $user }{'realname'}; |
| return 0 if $user eq '' || $user eq 'Guest'; |
| return 0 if $user eq q{} || $user eq 'Guest'; |
| |
| |
| if (!$userextension){ $userextension = 'vars'; } |
| if ( !$userextension ) { |
| if (($regtype == 1 || $regtype == 2) && -e "$memberdir/$user.pre") { $userextension = 'pre'; } |
| if ( ( $regtype == 1 || $regtype == 2 ) && -e "$memberdir/$user.pre" ) { |
| elsif ($regtype == 1 && -e "$memberdir/$user.wait") { $userextension = 'wait'; } |
| $userextension = 'pre'; |
| |
| } |
| if (-e "$memberdir/$user.$userextension") { |
| elsif ( $regtype == 1 && -e "$memberdir/$user.wait" ) { |
| if ($user ne $username) { |
| $userextension = 'wait'; |
| fopen(LOADUSER, "$memberdir/$user.$userextension") || &fatal_error('cannot_open', "$memberdir/$user.$userextension", 1); |
| } |
| my @settings = <LOADUSER>; |
| else { $userextension = 'vars';} |
| fclose(LOADUSER); |
| } |
| foreach (@settings) { if ($_ =~ /'(.*?)',"(.*?)"/) { ${$uid.$user}{$1} = $2; } } |
| |
| } else { |
| if ( !-e "$memberdir/$user.$userextension" ) { return 0; } # user not found |
| fopen(LOADUSER, "+<$memberdir/$user.$userextension") || &fatal_error('cannot_open', "$memberdir/$user.$userextension", 1); |
| else { |
| my @settings = <LOADUSER>; |
| if ( $user ne $username ) { |
| for (my $i = 0; $i < @settings; $i++) { |
| fopen( LOADUSER, "$memberdir/$user.$userextension" ) |
| if ($settings[$i] =~ /'(.*?)',"(.*?)"/) { |
| or fatal_error( 'cannot_open', "$memberdir/$user.$userextension load 2 $tst", |
| ${$uid.$user}{$1} = $2; |
| 1 ); |
| if($1 eq 'lastonline' && $INFO{'action'} ne "login2") { |
| my @settings = <LOADUSER>; |
| ${$uid.$user}{$1} = $date; |
| fclose(LOADUSER); |
| $settings[$i] = qq~'lastonline',"$date"\n~; |
| foreach (@settings) { |
| } |
| if ( $_ =~ /'(.*?)',"(.*?)"/xsm ) { |
| } |
| ${ $uid . $user }{$1} = $2; |
| } |
| } |
| seek LOADUSER, 0, 0; |
| } |
| truncate LOADUSER, 0; |
| } |
| print LOADUSER @settings; |
| else { |
| fclose(LOADUSER); |
| fopen( LOADUSER, "<$memberdir/$user.$userextension" ) |
| } |
| or fatal_error( 'cannot_open', |
| |
| "$memberdir/$user.$userextension load 1 $tst", 1 ); |
| &ToChars(${$uid.$user}{'realname'}); |
| my @settings = <LOADUSER>; |
| &FormatUserName($user); |
| fclose(LOADUSER); |
| &LoadMiniUser($user); |
| for my $i ( 0 .. $#settings ) { |
| |
| 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~; |
| |
| } |
| |
| } |
| |
| } |
| |
| if ( scalar @settings != 0 ) { |
| |
| fopen( LOADUSER, ">$memberdir/$user.$userextension" ) |
| |
| or fatal_error( 'cannot_open', |
| |
| "$memberdir/$user.$userextension load 3 $tst", 1 ); |
| |
| print {LOADUSER} @settings or croak "$croak{'print'} LOADUSER"; |
| |
| fclose(LOADUSER); |
| |
| } |
| |
| else { |
| |
| fatal_error( 'missingvars', "$memberdir/$user.$userextension", |
| |
| 1 ); |
| |
| } |
| |
| } |
| |
| |
| return 1; |
| ToChars( ${ $uid . $user }{'realname'} ); |
| } |
| FormatUserName($user); |
| |
| LoadMiniUser($user); |
| |
| |
| return 0; # user not found |
| return 1; |
| |
| } |
| } |
| } |
| |
| |
| sub is_moderator { |
| sub is_moderator { |
| my $user = $_[0]; |
| my ( $user, $brd ) = @_; |
| my @checkboards; |
| my @checkboards; |
| if ($_[1]) { @checkboards = ($_[1]); } |
| if ($brd) { @checkboards = ($brd); } |
| else { @checkboards = @allboards; } |
| else { @checkboards = @allboards; } |
| |
| |
| foreach (@checkboards) { |
| foreach (@checkboards) { |
| # check if user is in the moderator list |
| |
| foreach (split(/, ?/, ${$uid.$_}{'mods'})) { |
| # check if user is in the moderator list |
| if ($_ eq $user) { return 1; } |
| foreach ( split /, ?/sm, ${ $uid . $_ }{'mods'} ) { |
| } |
| if ( $_ eq $user ) { return 1; } |
| |
| } |
| # check if user is member of a moderatorgroup |
| |
| foreach my $testline (split(/, /, ${$uid.$_}{'modgroups'})) { |
| # check if user is member of a moderatorgroup |
| if ($testline eq ${$uid.$user}{'position'}) { return 1; } |
| foreach my $testline ( split /, /sm, ${ $uid . $_ }{'modgroups'} ) { |
| |
| if ( $testline eq ${ $uid . $user }{'position'} ) { return 1; } |
| foreach (split(/,/, ${$uid.$user}{'addgroups'})) { |
| |
| if ($testline eq $_) { return 1; } |
| foreach ( split /,/xsm, ${ $uid . $user }{'addgroups'} ) { |
| } |
| if ( $testline eq $_ ) { return 1; } |
| } |
| } |
| } |
| } |
| return 0; |
| } |
| |
| return 0; |
| |
| } |
| |
| |
| |
| sub is_moderator_b { |
| |
| my ($user) = @_; |
| |
| $mybrds = q{ }; |
| |
| |
| |
| foreach my $i (@allboards) { |
| |
| |
| |
| # check if user is in the moderator list |
| |
| foreach ( split /, ?/sm, ${ $uid . $i }{'mods'} ) { |
| |
| if ( $_ eq $user ) { |
| |
| get_forum_master(); |
| |
| ( $boardname, $boardperms, $boardview ) = |
| |
| split /\|/xsm, $board{$i}; |
| |
| $mybrds .= qq~$boardname<br />~; |
| |
| return 1; |
| |
| } |
| |
| } |
| |
| } |
| |
| |
| |
| return 0; |
| } |
| } |
| |
| |
| sub KillModerator { |
| sub KillModerator { |
| my $killmod = $_[0]; |
| my ($killmod) = @_; |
| my ($cntcat, $cntboard, $cntpic, $cntdescription, $cntmods, $cntmodgroups, $cnttopicperms, $cntreplyperms, $cntpollperms, $cntzero, $dummy, $dummy, $dummy, $cnttotals, @boardcontrol); |
| my ( @boardcontrol, @newmods, @boardline ); |
| fopen(FORUMCONTROL, "+<$boardsdir/forum.control") || &fatal_error('cannot_open', "$boardsdir/forum.control", 1); |
| fopen( FORUMCONTROL, "<$boardsdir/forum.control" ) |
| @oldcontrols = <FORUMCONTROL>; |
| or fatal_error( 'cannot_open', "$boardsdir/forum.control", 1 ); |
| |
| @oldcontrols = <FORUMCONTROL>; |
| my @newmods; |
| fclose(FORUMCONTROL); |
| foreach $boardline (@oldcontrols) { |
| |
| chomp $boardline; |
| for my $boardline (@oldcontrols) { |
| if ($boardline ne "") { |
| chomp $boardline; |
| @newmods = (); |
| if ( $boardline ne q{} ) { |
| ($cntcat, $cntboard, $cntpic, $cntdescription, $cntmods, $cntmodgroups, $cnttopicperms, $cntreplyperms, $cntpollperms, $cntzero, $cntpassword, $cnttotals, $cntattperms, $spare, $cntminageperms, $cntmaxageperms, $cntgenderperms) = split(/\|/, $boardline); |
| @newmods = (); |
| foreach (split(/, /, $cntmods)) { |
| @boardline = split /\|/xsm, $boardline; |
| if ($killmod ne $_) { push(@newmods, $_); } |
| foreach ( split /, /sm, $boardline[4] ) { |
| } |
| if ( $killmod ne $_ ) { push @newmods, $_; } |
| $cntmods = join(", ", @newmods); |
| } |
| push(@boardcontrol, "$cntcat|$cntboard|$cntpic|$cntdescription|$cntmods|$cntmodgroups|$cnttopicperms|$cntreplyperms|$cntpollperms|$cntzero|$cntpassword|$cnttotals|$cntattperms|$spare|$cntminageperms|$cntmaxageperms|$cntgenderperms\n"); |
| $boardline[4] = join q{, }, @newmods; |
| } |
| $newboardline = join q{|}, @boardline; |
| } |
| push @boardcontrol, $newboardline . "\n"; |
| seek FORUMCONTROL, 0, 0; |
| } |
| truncate FORUMCONTROL, 0; |
| } |
| @boardcontrol = &undupe(@boardcontrol); |
| @boardcontrol = undupe(@boardcontrol); |
| print FORUMCONTROL @boardcontrol; |
| fopen( FORUMCONTROL, ">$boardsdir/forum.control" ) |
| fclose(FORUMCONTROL); |
| or fatal_error( 'cannot_open', "$boardsdir/forum.control", 1 ); |
| |
| print {FORUMCONTROL} @boardcontrol or croak "$croak{'print'} FORUMCONTROL"; |
| |
| fclose(FORUMCONTROL); |
| |
| return; |
| } |
| } |
| |
| |
| sub KillModeratorGroup { |
| sub KillModeratorGroup { |
| my $killmod = $_[0]; |
| my ($killmod) = @_; |
| my ($cntcat, $cntboard, $cntpic, $cntdescription, $cntmods, $cntmodgroups, $cnttopicperms, $cntreplyperms, $cntpollperms, $cntzero, $dummy, $dummy, $dummy, $cnttotals, @boardcontrol); |
| my ( @boardcontrol, @newmods, @boardline ); |
| fopen(FORUMCONTROL, "+<$boardsdir/forum.control") || &fatal_error('cannot_open', "$boardsdir/forum.control", 1); |
| fopen( FORUMCONTROL, "<$boardsdir/forum.control" ) |
| @oldcontrols = <FORUMCONTROL>; |
| or fatal_error( 'cannot_open', "$boardsdir/forum.control", 1 ); |
| |
| @oldcontrols = <FORUMCONTROL>; |
| my @newmods; |
| fclose(FORUMCONTROL); |
| foreach $boardline (@oldcontrols) { |
| |
| chomp $boardline; |
| foreach my $boardline (@oldcontrols) { |
| if ($boardline ne "") { |
| chomp $boardline; |
| @newmods = (); |
| if ( $boardline ne q{} ) { |
| ($cntcat, $cntboard, $cntpic, $cntdescription, $cntmods, $cntmodgroups, $cnttopicperms, $cntreplyperms, $cntpollperms, $cntzero, $cntpassword, $cnttotals, $cntattperms, $spare, $cntminageperms, $cntmaxageperms, $cntgenderperms) = split(/\|/, $boardline); |
| @newmods = (); |
| foreach (split(/, /, $cntmodgroups)) { |
| @boardline = split /\|/xsm, $boardline; |
| if ($killmod ne $_) { push(@newmods, $_); } |
| foreach ( split /, /sm, $boardline[5] ) { |
| } |
| if ( $killmod ne $_ ) { push @newmods, $_; } |
| $cntmodgroups = join(", ", @newmods); |
| } |
| push(@boardcontrol, "$cntcat|$cntboard|$cntpic|$cntdescription|$cntmods|$cntmodgroups|$cnttopicperms|$cntreplyperms|$cntpollperms|$cntzero|$cntpassword|$cnttotals|$cntattperms|$spare|$cntminageperms|$cntmaxageperms|$cntgenderperms\n"); |
| $boardline[5] = join q{, }, @newmods; |
| } |
| $newboardline = join q{|}, @boardline; |
| } |
| push @boardcontrol, $newboardline . "\n"; |
| seek FORUMCONTROL, 0, 0; |
| } |
| truncate FORUMCONTROL, 0; |
| } |
| @boardcontrol = &undupe(@boardcontrol); |
| @boardcontrol = undupe(@boardcontrol); |
| print FORUMCONTROL @boardcontrol; |
| fopen( FORUMCONTROL, ">$boardsdir/forum.control" ) |
| fclose(FORUMCONTROL); |
| or fatal_error( 'cannot_open', "$boardsdir/forum.control", 1 ); |
| |
| print {FORUMCONTROL} @boardcontrol or croak "$croak{'print'} FORUMCONTROL"; |
| |
| fclose(FORUMCONTROL); |
| |
| return; |
| } |
| } |
| |
| |
| sub LoadUserDisplay { |
| sub LoadUserDisplay { |
| my $user = $_[0]; |
| my ($user) = @_; |
| if (exists ${$uid.$user}{'password'}) { |
| if ( exists ${ $uid . $user }{'password'} ) { |
| if ($yyUDLoaded{$user}) { return 1; } |
| if ( $yyUDLoaded{$user} ) { return 1; } |
| } else { |
| } |
| &LoadUser($user); |
| else { |
| } |
| LoadUser($user); |
| &LoadCensorList; |
| } |
| |
| LoadCensorList(); |
| if (!$minlinkweb) { $minlinkweb = 0; } |
| |
| ${$uid.$user}{'weburl'} = (${$uid.$user}{'weburl'} && (${$uid.$user}{'postcount'} >= $minlinkweb || ${$uid.$user}{'position'} eq 'Administrator' || ${$uid.$user}{'position'} eq 'Global Moderator')) ? qq~<a href="${$uid.$user}{'weburl'}" target="_blank">~ . ($sm ? $img{'website_sm'} : $img{'website'}) . '</a>' : ''; |
| if ( !$minlinkweb ) { $minlinkweb = 0; } |
| |
| ${ $uid . $user }{'weburl'} = |
| $displayname = ${$uid.$user}{'realname'}; |
| ( |
| if (${$uid.$user}{'signature'}) { |
| ${ $uid . $user }{'weburl'} |
| $message = ${$uid.$user}{'signature'}; |
| && ( ${ $uid . $user }{'postcount'} >= $minlinkweb |
| |
| || ${ $uid . $user }{'position'} eq 'Administrator' |
| if ($enable_ubbc) { |
| || ${ $uid . $user }{'position'} eq 'Mid Moderator' |
| if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } |
| || ${ $uid . $user }{'position'} eq 'Global Moderator' ) |
| &DoUBBC(1); |
| ) |
| } |
| ? qq~<a href="${$uid.$user}{'weburl'}" target="_blank">~ |
| |
| . ( $sm ? $img{'website_sm'} : $img{'website'} ) . '</a>' |
| &ToChars($message); |
| : q{}; |
| |
| |
| ${$uid.$user}{'signature'} = &Censor($message); |
| $displayname = ${ $uid . $user }{'realname'}; |
| |
| if ( ${ $uid . $user }{'signature'} ) { |
| # use height like code boxes do. Set to 200px at > 15 newlines |
| $message = ${ $uid . $user }{'signature'}; |
| if (15 < ${$uid.$user}{'signature'} =~ /<br \/>|<tr>/g) { |
| |
| ${$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>~; |
| if ($enable_ubbc) { |
| } else { |
| enable_yabbc(); |
| ${$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>~; |
| DoUBBC(1); |
| } |
| } |
| } |
| |
| |
| ToChars($message); |
| $themsnuser = $user; |
| |
| $themsnname = ${$uid.$user}{'realname'}; |
| ${ $uid . $user }{'signature'} = Censor($message); |
| $thegtalkuser = $user; |
| |
| $thegtalkname = ${$uid.$user}{'realname'}; |
| # use height like code boxes do. Set to 200px at > 15 newlines |
| |
| if ( 15 < ${ $uid . $user }{'signature'} =~ /<br \/>|<tr>/gsm ) { |
| if ($UseMenuType == 0) { |
| ${ $uid . $user }{'signature'} = |
| $yimimg = qq~<img src="$imagesdir/yim.gif" alt="${$uid.$user}{'yim'}" title="${$uid.$user}{'yim'}" border="0" />~; |
| qq~<div class="load_sig">${$uid.$user}{'signature'}</div>~; |
| $aimimg = qq~<img src="$imagesdir/aim.gif" alt="${$uid.$user}{'aim'}" title="${$uid.$user}{'aim'}" border="0" />~; |
| } |
| $skypeimg = qq~<img src="$imagesdir/skype.gif" alt="${$uid.$user}{'skype'}" title="${$uid.$user}{'skype'}" border="0" />~; |
| else { |
| $myspaceimg = qq~<img src="$imagesdir/myspace.gif" alt="${$uid.$user}{'myspace'}" title="${$uid.$user}{'myspace'}" border="0" />~; |
| ${ $uid . $user }{'signature'} = |
| $facebookimg = qq~<img src="$imagesdir/facebook.gif" alt="${$uid.$user}{'facebook'}" title="${$uid.$user}{'facebook'}" border="0" />~; |
| qq~<div class="load_sig_b">${$uid.$user}{'signature'}</div>~; |
| $msnimg = qq~<img src="$imagesdir/msn.gif" style="cursor: pointer" onclick="window.open('$scripturl?action=setmsn;msnname=$themsnuser','','height=80,width=340,menubar=no,toolbar=no,scrollbars=no'); return false" alt="$themsnname" title="$themsnname" border="0" />~; |
| } |
| $gtalkimg = qq~<img src="$imagesdir/gtalk2.gif" style="cursor: pointer" onclick="window.open('$scripturl?action=setgtalk;gtalkname=$thegtalkuser','','height=80,width=340,menubar=no,toolbar=no,scrollbars=no'); return false" alt="$thegtalkname" title="$thegtalkname" border="0" />~; |
| } |
| $icqimg = qq~<img src="http://web.icq.com/whitepages/online?icq=${$uid.$user}{'icq'}&img=5" alt="${$uid.$user}{'icq'}" title="${$uid.$user}{'icq'}" border="0" />~; |
| |
| } elsif ($UseMenuType == 1) { |
| |
| $yimimg = qq~<span class="imgwindowbg">YIM</span>~; |
| |
| $aimimg = qq~<span class="imgwindowbg">AIM</span>~; |
| |
| $skypeimg = qq~<span class="imgwindowbg">Skype/VoIP</span>~; |
| |
| $myspaceimg = qq~<span class="imgwindowbg">MySpace</span>~; |
| |
| $facebookimg = qq~<span class="imgwindowbg">Facebook</span>~; |
| |
| $msnimg = qq~<span class="imgwindowbg" style="cursor: pointer" onclick="window.open('$scripturl?action=setmsn;msnname=$themsnuser','','height=80,width=340,menubar=no,toolbar=no,scrollbars=no'); return false">MSN</span>~; |
| |
| $gtalkimg = qq~<span class="imgwindowbg" style="cursor: pointer" onclick="window.open('$scripturl?action=setgtalk;gtalkname=$thegtalkuser','','height=80,width=340,menubar=no,toolbar=no,scrollbars=no'); return false">GTalk</span>~; |
| |
| $icqimg = qq~<span class="imgwindowbg">ICQ</span>~; |
| |
| } else { |
| |
| $yimimg = qq~<img src="$yyhtml_root/Buttons/$language/yim.png" alt="${$uid.$user}{'yim'}" title="${$uid.$user}{'yim'}" border="0" />~; |
| |
| $aimimg = qq~<img src="$yyhtml_root/Buttons/$language/aim.png" alt="${$uid.$user}{'aim'}" title="${$uid.$user}{'aim'}" border="0" />~; |
| |
| $skypeimg = qq~<img src="$yyhtml_root/Buttons/$language/skype.png" alt="${$uid.$user}{'skype'}" title="${$uid.$user}{'skype'}" border="0" />~; |
| |
| $myspaceimg = qq~<img src="$yyhtml_root/Buttons/$language/myspace.png" alt="${$uid.$user}{'myspace'}" title="${$uid.$user}{'myspace'}" border="0" />~; |
| |
| $facebookimg = qq~<img src="$yyhtml_root/Buttons/$language/facebook.png" alt="${$uid.$user}{'facebook'}" title="${$uid.$user}{'facebook'}" border="0" />~; |
| |
| $msnimg = qq~<img src="$yyhtml_root/Buttons/$language/msn.png" style="cursor: pointer" onclick="window.open('$scripturl?action=setmsn;msnname=$themsnuser','','height=80,width=340,menubar=no,toolbar=no,scrollbars=no'); return false" alt="$themsnname" title="$themsnname" border="0" />~; |
| |
| $gtalkimg = qq~<img src="$yyhtml_root/Buttons/$language/gtalk.png" style="cursor: pointer" onclick="window.open('$scripturl?action=setgtalk;gtalkname=$thegtalkuser','','height=80,width=340,menubar=no,toolbar=no,scrollbars=no'); return false" alt="$thegtalkname" title="$thegtalkname" border="0" />~; |
| |
| $icqimg = qq~<img src="$yyhtml_root/Buttons/$language/icq.png" alt="${$uid.$user}{'icq'}" title="${$uid.$user}{'icq'}" border="0" />~; |
| |
| } |
| |
| |
| |
| $icqad{$user} = $icqad{$user} ? qq~<a href="http://web.icq.com/${$uid.$user}{'icq'}" target="_blank"><img src="$imagesdir/icqadd.gif" alt="${$uid.$user}{'icq'}" title="${$uid.$user}{'icq'}" border="0" /></a>~ : ''; |
| |
| ${$uid.$user}{'icq'} = ${$uid.$user}{'icq'} ? qq~<a href="http://web.icq.com/${$uid.$user}{'icq'}" title="${$uid.$user}{'icq'}" target="_blank">$icqimg</a>~ : ''; |
| |
| ${$uid.$user}{'aim'} = ${$uid.$user}{'aim'} ? qq~<a href="aim:goim?screenname=${$uid.$user}{'aim'}&message=Hi.+Are+you+there?">$aimimg</a>~ : ''; |
| |
| ${$uid.$user}{'skype'} = ${$uid.$user}{'skype'} ? qq~<a href="javascript:void(window.open('callto://${$uid.$user}{'skype'}','skype','height=80,width=340,menubar=no,toolbar=no,scrollbars=no'))">$skypeimg</a>~ : ''; |
| |
| ${$uid.$user}{'myspace'} = ${$uid.$user}{'myspace'} ? qq~<a href="http://www.myspace.com/${$uid.$user}{'myspace'}" target="_blank">$myspaceimg</a>~ : ''; |
| |
| ${$uid.$user}{'facebook'} = ${$uid.$user}{'facebook'} ? qq~<a href="http://www.facebook.com/~ . (${$uid.$user}{'facebook'} !~ /\D/ ? "profile.php?id=" : "") . qq~${$uid.$user}{'facebook'}" target="_blank">$facebookimg</a>~ : ''; |
| |
| ${$uid.$user}{'msn'} = ${$uid.$user}{'msn'} ? $msnimg : ''; |
| |
| ${$uid.$user}{'gtalk'} = ${$uid.$user}{'gtalk'} ? $gtalkimg : ''; |
| |
| $yimon{$user} = $yimon{$user} ? qq~<img src="http://opi.yahoo.com/online?u=${$uid.$user}{'yim'}&m=g&t=0" border="0" alt="" />~ : ''; |
| |
| ${$uid.$user}{'yim'} = ${$uid.$user}{'yim'} ? qq~<a href="http://edit.yahoo.com/config/send_webmesg?.target=${$uid.$user}{'yim'}" target="_blank">$yimimg</a>~ : ''; |
| |
| |
| |
| if ($showgenderimage && ${$uid.$user}{'gender'}) { |
| |
| ${$uid.$user}{'gender'} = ${$uid.$user}{'gender'} =~ m~Female~i ? 'female' : 'male'; |
| |
| ${$uid.$user}{'gender'} = ${$uid.$user}{'gender'} ? qq~$load_txt{'231'}: <img src="$imagesdir/${$uid.$user}{'gender'}.gif" border="0" alt="${$uid.$user}{'gender'}" title="${$uid.$user}{'gender'}" /><br />~ : ''; |
| |
| } else { |
| |
| ${$uid.$user}{'gender'} = ''; |
| |
| } |
| |
| |
| |
| if ($showusertext && ${$uid.$user}{'usertext'}) { # Censor the usertext and wrap it |
| |
| ${$uid.$user}{'usertext'} = &WrapChars(&Censor(${$uid.$user}{'usertext'}),20); |
| |
| } else { |
| |
| ${$uid.$user}{'usertext'} = ""; |
| |
| } |
| |
| |
| |
| # Create the userpic / avatar html |
| |
| if ($showuserpic && $allowpics) { |
| |
| ${$uid.$user}{'userpic'} ||= 'blank.gif'; |
| |
| ${$uid.$user}{'userpic'} = qq~<img src="~ .(${$uid.$user}{'userpic'} =~ m~\A[\s\n]*https?://~i ? ${$uid.$user}{'userpic'} : "$facesurl/${$uid.$user}{'userpic'}") . qq~" name="avatar_img_resize" alt="" border="0" style="display:none" /><br />~; |
| |
| } else { |
| |
| ${$uid.$user}{'userpic'} = '<br />'; |
| |
| } |
| |
| |
| |
| &LoadMiniUser($user); |
| $thegtalkuser = $user; |
| |
| $thegtalkname = ${ $uid . $user }{'realname'}; |
| |
| |
| $yyUDLoaded{$user} = 1; |
| if ( !$UseMenuType ) { |
| return 1; |
| $UseMenuType = $MenuType; |
| |
| } |
| |
| |
| |
| 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 ); |
| |
| |
| |
| $icqad{$user} = |
| |
| $icqad{$user} |
| |
| ? qq~<a href="http://web.icq.com/${$uid.$user}{'icq'}" target="_blank">$load_con{'icqadd'}</a>~ |
| |
| : q{}; |
| |
| $icqad{$user} =~ s/{yabb usericq}/${$uid.$user}{'icq'}/gsm; |
| |
| |
| |
| ${ $uid . $user }{'icq'} = |
| |
| ${ $uid . $user }{'icq'} |
| |
| ? qq~<a href="http://web.icq.com/${$uid.$user}{'icq'}" title="${$uid.$user}{'icq'}" target="_blank">$icqimg</a>~ |
| |
| : q{}; |
| |
| |
| |
| ${ $uid . $user }{'aim'} = |
| |
| ${ $uid . $user }{'aim'} |
| |
| ? qq~<a href="aim:goim?screenname=${$uid.$user}{'aim'}&message=Hi.+Are+you+there?">$aimimg</a>~ |
| |
| : q{}; |
| |
| |
| |
| ${ $uid . $user }{'skype'} = |
| |
| ${ $uid . $user }{'skype'} |
| |
| ? qq~<a href="javascript:void(window.open('callto://${$uid.$user}{'skype'}','skype','height=80,width=340,menubar=no,toolbar=no,scrollbars=no'))">$skypeimg</a>~ |
| |
| : q{}; |
| |
| |
| |
| ${ $uid . $user }{'myspace'} = |
| |
| ${ $uid . $user }{'myspace'} |
| |
| ? qq~<a href="http://www.myspace.com/${$uid.$user}{'myspace'}" target="_blank">$myspaceimg</a>~ |
| |
| : q{}; |
| |
| |
| |
| ${ $uid . $user }{'facebook'} = |
| |
| ${ $uid . $user }{'facebook'} |
| |
| ? q~<a href="http://www.facebook.com/~ |
| |
| . ( ${ $uid . $user }{'facebook'} !~ /\D/xsm ? 'profile.php?id=' : q{} ) |
| |
| . qq~${$uid.$user}{'facebook'}" target="_blank">$facebookimg</a>~ |
| |
| : q{}; |
| |
| |
| |
| ${ $uid . $user }{'twitter'} = |
| |
| ${ $uid . $user }{'twitter'} |
| |
| ? qq~<a href="http://twitter.com/${$uid.$user}{'twitter'}" target="_blank">$twitterimg</a>~ |
| |
| : q{}; |
| |
| |
| |
| ${ $uid . $user }{'youtube'} = |
| |
| ${ $uid . $user }{'youtube'} |
| |
| ? qq~<a href="http://www.youtube.com/${$uid.$user}{'youtube'}" target="_blank">$youtubeimg</a>~ |
| |
| : q{}; |
| |
| |
| |
| ${ $uid . $user }{'gtalk'} = ${ $uid . $user }{'gtalk'} ? $gtalkimg : q{}; |
| |
| |
| |
| $yimon{$user} = |
| |
| $yimon{$user} |
| |
| ? qq~<img src="http://opi.yahoo.com/online?u=${$uid.$user}{'yim'}&m=g&t=0" alt="" />~ |
| |
| : q{}; |
| |
| |
| |
| ${ $uid . $user }{'yim'} = |
| |
| ${ $uid . $user }{'yim'} |
| |
| ? qq~<a href="http://edit.yahoo.com/config/send_webmesg?.target=${$uid.$user}{'yim'}" target="_blank">$yimimg</a>~ |
| |
| : q{}; |
| |
| |
| |
| 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 />~ |
| |
| : q{}; |
| |
| ${ $uid . $user }{'gender'} =~ s/{yabb gender}/$genderTitle/sm; |
| |
| ${ $uid . $user }{'gender'} =~ |
| |
| s/{yabb genderTitle}/$load_txt{$genderTitle}/gsm; |
| |
| } |
| |
| else { |
| |
| ${ $uid . $user }{'gender'} = q{}; |
| |
| } |
| |
| |
| |
| if ($showzodiac && ${ $uid . $user }{'bday'}) { |
| |
| require Sources::EventCalBirthdays; |
| |
| my ($user_bdmon, $user_bdday, undef ) = split /\//xsm, ${ $uid . $user }{'bday'} ; |
| |
| $zodiac = starsign($user_bdday, $user_bdmon); |
| |
| ${ $uid . $user }{'zodiac'} = qq~<span style="vertical-align: middle;">$zodiac_txt{'sign'}:</span> $zodiac<br />~; |
| |
| } |
| |
| else { |
| |
| ${ $uid . $user }{'zodiac'} = q{}; |
| |
| } |
| |
| |
| |
| if ( $showusertext && ${ $uid . $user }{'usertext'} ) |
| |
| { # Censor the usertext and wrap it |
| |
| ${ $uid . $user }{'usertext'} = |
| |
| WrapChars( Censor( ${ $uid . $user }{'usertext'} ), 20 ); |
| |
| } |
| |
| else { |
| |
| ${ $uid . $user }{'usertext'} = q{}; |
| |
| } |
| |
| |
| |
| # 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 ) |
| |
| ? "$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 />~; |
| |
| } |
| |
| else { |
| |
| ${ $uid . $user }{'userpic'} = q~<br />~; |
| |
| } |
| |
| |
| |
| LoadMiniUser($user); |
| |
| |
| |
| $yyUDLoaded{$user} = 1; |
| |
| return 1; |
| } |
| } |
| |
| |
| sub LoadMiniUser { |
| sub LoadMiniUser { |
| my $user = $_[0]; |
| my ($user) = @_; |
| my $load = ''; |
| my $load = q{}; |
| my $key = ''; |
| my $key = q{}; |
| $g = 0; |
| $g = 0; |
| my $dg = 0; |
| my $dg = 0; |
| my ($tempgroup, $temp_postgroup); |
| my $tempgroup; |
| my $noshow = 0; |
| my $bold = 0; |
| my $bold = 0; |
| |
| |
| $tempgroupcheck = ${ $uid . $user }{'position'} || q{}; |
| $tempgroupcheck = ${$uid.$user}{'position'} || ""; |
| |
| |
| my @memstat = (); |
| if (exists $Group{$tempgroupcheck} && $tempgroupcheck ne "") { |
| if ( exists $Group{$tempgroupcheck} && $tempgroupcheck ne q{} ) { |
| ($title, $stars, $starpic, $color, $noshow, $viewperms, $topicperms, $replyperms, $pollperms, $attachperms) = split(/\|/, $Group{$tempgroupcheck}); |
| #( |
| $temptitle = $title; |
| # $title, $stars, $starpic, $color, |
| $tempgroup = $Group{$tempgroupcheck}; |
| # $noshow, $viewperms, $topicperms, $replyperms, |
| if ($noshow == 0) { $bold = 1; } |
| # $pollperms, $attachperms |
| $memberunfo{$user} = $tempgroupcheck; |
| #) |
| } elsif ($moderators{$user}) { |
| @memstat = split /\|/xsm, $Group{$tempgroupcheck}; |
| ($title, $stars, $starpic, $color, $noshow, $viewperms, $topicperms, $replyperms, $pollperms, $attachperms) = split(/\|/, $Group{'Moderator'}); |
| $temptitle = $memstat[0]; |
| $temptitle = $title; |
| $tempgroup = $Group{$tempgroupcheck}; |
| $tempgroup = $Group{'Moderator'}; |
| if ( $memstat[4] == 0 ) { $bold = 1; } |
| $memberunfo{$user} = $tempgroupcheck; |
| $memberunfo{$user} = $tempgroupcheck; |
| } elsif (exists $NoPost{$tempgroupcheck} && $tempgroupcheck ne "") { |
| } |
| ($title, $stars, $starpic, $color, $noshow, $viewperms, $topicperms, $replyperms, $pollperms, $attachperms) = split(/\|/, $NoPost{$tempgroupcheck}); |
| elsif ( $moderators{$user} ) { |
| $temptitle = $title; |
| @memstat = split /\|/xsm, $Group{'Moderator'}; |
| $tempgroup = $NoPost{$tempgroupcheck}; |
| $temptitle = $memstat[0]; |
| $memberunfo{$user} = $tempgroupcheck; |
| $tempgroup = $Group{'Moderator'}; |
| } |
| $memberunfo{$user} = $tempgroupcheck; |
| |
| } |
| if (!$tempgroup) { |
| elsif ( exists $NoPost{$tempgroupcheck} && $tempgroupcheck ne q{} ) { |
| foreach $postamount (sort { $b <=> $a } keys %Post) { |
| @memstat = split /\|/xsm, $NoPost{$tempgroupcheck}; |
| if (${$uid.$user}{'postcount'} >= $postamount) { |
| $temptitle = $memstat[0]; |
| ($title, $stars, $starpic, $color, $noshow, $viewperms, $topicperms, $replyperms, $pollperms, $attachperms) = split(/\|/, $Post{$postamount}); |
| $tempgroup = $NoPost{$tempgroupcheck}; |
| $tempgroup = $Post{$postamount}; |
| $memberunfo{$user} = $tempgroupcheck; |
| last; |
| } |
| } |
| |
| } |
| if ( !$tempgroup ) { |
| $memberunfo{$user} = $title; |
| foreach my $postamount ( reverse sort { $a <=> $b } keys %Post ) { |
| } |
| if ( ${ $uid . $user }{'postcount'} >= $postamount ) { |
| |
| @memstat = split /\|/xsm, $Post{$postamount}; |
| if ($noshow == 1) { |
| $tempgroup = $Post{$postamount}; |
| $temptitle = $title; |
| last; |
| foreach $postamount (sort { $b <=> $a } keys %Post) { |
| } |
| if (${$uid.$user}{'postcount'} > $postamount) { |
| } |
| ($title, $stars, $starpic, $color, undef) = split(/\|/, $Post{$postamount},5); |
| $memberunfo{$user} = $memstat[0]; |
| last; |
| } |
| } |
| |
| } |
| if ( $memstat[4] == 1 ) { |
| } |
| $temptitle = $memstat[0]; |
| |
| foreach my $postamount ( reverse sort { $a <=> $b } keys %Post ) { |
| if (!$tempgroup) { |
| if ( ${ $uid . $user }{'postcount'} > $postamount ) { |
| $temptitle = "no group"; |
| @memstat = split /\|/xsm, $Post{$postamount}, 5; |
| $title = ""; |
| last; |
| $stars = 0; |
| } |
| $starpic = ""; |
| } |
| $color = ""; |
| } |
| $noshow = 1; |
| |
| $viewperms = ""; |
| if ( !$tempgroup ) { |
| $topicperms = ""; |
| $temptitle = 'no group'; |
| $replyperms = ""; |
| @memstat = ( q{}, 0, q{}, q{}, 1, q{}, q{}, q{}, q{}, q{} ); |
| $pollperms = ""; |
| } |
| $attachperms = ""; |
| |
| } |
| # The following puts some new has variables in if this user is the user browsing the board |
| |
| if ( $user eq $username ) { |
| # The following puts some new has variables in if this user is the user browsing the board |
| if ($tempgroup) { |
| if ($user eq $username) { |
| ( |
| if ($tempgroup) { |
| undef, undef, undef, undef, |
| ($trash, $trash, $trash, $trash, $trash, $viewperms, $topicperms, $replyperms, $pollperms, $attachperms) = split(/\|/, $tempgroup); |
| undef, $viewperms, $topicperms, $replyperms, |
| } |
| $pollperms, $attachperms |
| ${$uid.$user}{'perms'} = "$viewperms|$topicperms|$replyperms|$pollperms|$attachperms"; |
| ) = split /\|/xsm, $tempgroup; |
| } |
| } |
| |
| ${ $uid . $user }{'perms'} = |
| $userlink = ${$uid.$user}{'realname'} || $user; |
| "$viewperms|$topicperms|$replyperms|$pollperms|$attachperms"; |
| $userlink = qq~<b>$userlink</b>~; |
| } |
| if (!$scripturl) { $scripturl = qq~$boardurl/$yyexec.$yyext~; } |
| |
| if ($bold != 1) { $memberinfo{$user} = qq~$title~; } |
| $userlink = ${ $uid . $user }{'realname'} || $user; |
| else { $memberinfo{$user} = qq~<b>$title</b>~; } |
| $userlink = qq~<b>$userlink</b>~; |
| |
| if ( !$scripturl ) { $scripturl = qq~$boardurl/$yyexec.$yyext~; } |
| if ($color ne "") { |
| if ( $bold != 1 ) { $memberinfo{$user} = qq~$memstat[0]~; } |
| $link{$user} = qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}" style="color:$color;">$userlink</a>~; |
| else { $memberinfo{$user} = qq~<b>$memstat[0]</b>~; } |
| $format{$user} = qq~<span style="color: $color;">$userlink</span>~; |
| |
| $col_title{$user} = qq~<span style="color: $color;">$memberinfo{$user}</span>~; |
| if ( $memstat[3] ne q{} && !$iamguest ) { |
| } else { |
| $link{$user} = |
| $link{$user} = qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}">$userlink</a>~; |
| qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}" style="color:$memstat[3];">$userlink</a>~; |
| $format{$user} = qq~$userlink~; |
| $format{$user} = qq~<span style="color: $memstat[3];">$userlink</span>~; |
| $col_title{$user} = qq~$memberinfo{$user}~; |
| $format_unbold{$user} = |
| } |
| qq~<span style="color: $memstat[3];">${$uid.$user}{'realname'}</span>~; |
| $addmembergroup{$user} = "<br />"; |
| $col_title{$user} = |
| foreach $addgrptitle (split(/,/, ${$uid.$user}{'addgroups'})) { |
| qq~<span style="color: $memstat[3];">$memberinfo{$user}</span>~; |
| foreach $key (sort { $a <=> $b } keys %NoPost) { |
| } |
| ($atitle, $t, $t, $t, $anoshow, $aviewperms, $atopicperms, $areplyperms, $apollperms, $aattachperms) = split(/\|/, $NoPost{$key}); |
| elsif ( $iamguest ) { |
| if ($addgrptitle eq $key && $atitle ne $title) { |
| if ( $memstat[3] ne q{} ) { |
| if ($user eq $username && !$iamadmin) { |
| $link{$user} = |
| if ($aviewperms == 1) { $viewperms = 1; } |
| qq~<span style="color:$memstat[3];">$userlink</span>~; |
| if ($atopicperms == 1) { $topicperms = 1; } |
| $format{$user} = qq~<span style="color: $memstat[3];">$userlink</span>~; |
| if ($areplyperms == 1) { $replyperms = 1; } |
| $format_unbold{$user} = |
| if ($apollperms == 1) { $pollperms = 1; } |
| qq~<span style="color: $memstat[3];">${$uid.$user}{'realname'}</span>~; |
| if ($aattachperms == 1) { $attachperms = 1; } |
| $col_title{$user} = |
| ${$uid.$user}{'perms'} = "$viewperms|$topicperms|$replyperms|$pollperms|$attachperms"; |
| qq~<span style="color: $memstat[3];">$memberinfo{$user}</span>~; |
| } |
| } |
| if ($anoshow && ($iamadmin || ($iamgmod && $gmod_access2{"profileAdmin"}))) { |
| else { |
| $addmembergroup{$user} .= qq~($atitle)<br />~; |
| $link{$user} = qq~$userlink~; |
| } elsif (!$anoshow) { |
| $format{$user} = qq~$userlink~; |
| $addmembergroup{$user} .= qq~$atitle<br />~; |
| $format_unbold{$user} = qq~${$uid.$user}{'realname'}~; |
| } |
| $col_title{$user} = qq~$memberinfo{$user}~; |
| } |
| } |
| } |
| } |
| } |
| else { |
| $addmembergroup{$user} =~ s/<br \/>\Z//; |
| $link{$user} = |
| |
| qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}">$userlink</a>~; |
| if ($username eq "Guest") { $memberunfo{$user} = "Guest"; } |
| $format{$user} = qq~$userlink~; |
| |
| $format_unbold{$user} = qq~${$uid.$user}{'realname'}~; |
| $topicstart{$user} = ""; |
| $col_title{$user} = qq~$memberinfo{$user}~; |
| $viewnum = ""; |
| } |
| if ($INFO{'num'} || $FORM{'threadid'} && $user eq $username) { |
| $addmembergroup{$user} = '<br />'; |
| if ($INFO{'num'}) { |
| for my $addgrptitle ( split /,/xsm, ${ $uid . $user }{'addgroups'} ) { |
| $viewnum = $INFO{'num'}; |
| for my $key ( sort { $a <=> $b } keys %NoPost ) { |
| } elsif ($FORM{'threadid'}) { |
| ( |
| $viewnum = $FORM{'threadid'}; |
| $atitle, undef, undef, undef, |
| } |
| $anoshow, $aviewperms, $atopicperms, $areplyperms, |
| if ($viewnum =~ m~/~) { ($viewnum, undef) = split('/', $viewnum); } |
| $apollperms, $aattachperms |
| |
| ) = split /\|/xsm, $NoPost{$key}; |
| # No need to open the message file so many times. |
| if ( $addgrptitle eq $key && $atitle ne $memstat[0] ) { |
| # Opening it once is enough to do the access checks. |
| if ( $user eq $username && !$iamadmin ) { |
| unless ($topicstarter) { |
| if ( $aviewperms == 1 ) { $viewperms = 1; } |
| if (-e "$datadir/$viewnum.txt") { |
| if ( $atopicperms == 1 ) { $topicperms = 1; } |
| unless (ref($thread_arrayref{$viewnum})) { |
| if ( $areplyperms == 1 ) { $replyperms = 1; } |
| fopen(TOPSTART, "$datadir/$viewnum.txt"); |
| if ( $apollperms == 1 ) { $pollperms = 1; } |
| @{$thread_arrayref{$viewnum}} = <TOPSTART>; |
| if ( $aattachperms == 1 ) { $attachperms = 1; } |
| fclose(TOPSTART); |
| ${ $uid . $user }{'perms'} = |
| } |
| "$viewperms|$topicperms|$replyperms|$pollperms|$attachperms"; |
| (undef, undef, undef, undef, $topicstarter, undef) = split(/\|/, ${$thread_arrayref{$viewnum}}[0], 6); |
| } |
| } |
| if ( |
| } |
| $anoshow |
| |
| && ( $iamadmin |
| if ($user eq $topicstarter) { $topicstart{$user} = "Topic Starter"; } |
| || ( $iamgmod && $gmod_access2{'profileAdmin'} ) ) |
| } |
| ) |
| $memberaddgroup{$user} = ${$uid.$user}{'addgroups'}; |
| { |
| |
| $addmembergroup{$user} .= qq~($atitle)<br />~; |
| my $starnum = $stars; |
| } |
| my $memberstartemp = ''; |
| elsif ( !$anoshow ) { |
| if ($starpic !~ /\//) { $starpic = "$imagesdir/$starpic"; } |
| $addmembergroup{$user} .= qq~$atitle<br />~; |
| while ($starnum-- > 0) { |
| } |
| $memberstartemp .= qq~<img src="$starpic" border="0" alt="*" />~; |
| } |
| } |
| } |
| $memberstar{$user} = $memberstartemp ? "$memberstartemp<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'}; |
| |
| } |
| |
| elsif ( $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. |
| |
| if ( !$topicstarter ) { |
| |
| if ( -e "$datadir/$viewnum.txt" ) { |
| |
| if ( !ref $thread_arrayref{$viewnum} ) { |
| |
| 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 = $memstat[1]; |
| |
| my $memberstartemp = q{}; |
| |
| if ( $memstat[2] !~ /\//xsm ) { $starpic = "$imagesdir/$memstat[2]"; } |
| |
| while ( $starnum-- > 0 ) { |
| |
| $memberstartemp .= qq~<img src="$starpic" alt="*" />~; |
| |
| } |
| |
| $memberstar{$user} = $memberstartemp ? "$memberstartemp<br />" : q{}; |
| |
| return; |
| } |
| } |
| |
| |
| sub QuickLinks { |
| sub QuickLinks { |
| my $user = $_[0]; |
| my ( $user, $online ) = @_; |
| my $lastonline; |
| my $lastonline; |
| if ($iamguest) { return ($_[1] ? ${$uid.$user}{'realname'} : $format{$user}); } |
| 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 ) { |
| my $days = int($lastonline / 86400); |
| if ( ${ $uid . $user }{'lastonline'} ) { |
| my $hours = sprintf("%02d", int(($lastonline - ($days * 86400)) / 3600)); |
| $lastonline = abs( $date - ${ $uid . $user }{'lastonline'} ); |
| my $mins = sprintf("%02d", int(($lastonline - ($days * 86400) - ($hours * 3600)) / 60)); |
| my $days = int( $lastonline / 86400 ); |
| my $secs = sprintf("%02d", ($lastonline - ($days * 86400) - ($hours * 3600) - ($mins * 60))); |
| my $hours = sprintf '%02d', |
| if (!$mins) { |
| int( ( $lastonline - ( $days * 86400 ) ) / 3600 ); |
| $lastonline = "00:00:$secs"; |
| my $mins = sprintf |
| } elsif (!$hours) { |
| '%02d', |
| $lastonline = "00:$mins:$secs"; |
| int( |
| } elsif (!$days) { |
| ( $lastonline - ( $days * 86400 ) - ( $hours * 3600 ) ) / 60 ); |
| $lastonline = "$hours:$mins:$secs"; |
| my $secs = sprintf |
| } else { |
| '%02d', |
| $lastonline = "$days $maintxt{'11'} $hours:$mins:$secs"; |
| ( $lastonline - |
| } |
| ( $days * 86400 ) - |
| $lastonline = qq~ title="$maintxt{'10'} $lastonline $maintxt{'12'}."~; |
| ( $hours * 3600 ) - |
| } else { |
| ( $mins * 60 ) ); |
| $lastonline = qq~ title="$maintxt{'13'}."~; |
| if ( !$mins ) { |
| } |
| $lastonline = "00:00:$secs"; |
| } |
| } |
| if ($usertools) { |
| elsif ( !$hours ) { |
| $qlcount++; |
| $lastonline = "00:$mins:$secs"; |
| my $display = "display:inline"; |
| } |
| if ($ENV{'HTTP_USER_AGENT'} =~ /opera/i) { |
| elsif ( !$days ) { |
| $display = "display:inline-block"; |
| $lastonline = "$hours:$mins:$secs"; |
| } elsif ($ENV{'HTTP_USER_AGENT'} =~ /firefox/i) { |
| } |
| $display = "display:inline-block"; |
| else { |
| } |
| $lastonline = "$days $maintxt{'11'} $hours:$mins:$secs"; |
| my $quicklinks = qq~<div style="position:relative;$display"> |
| } |
| <ul id="ql$useraccount{$user}$qlcount" class="QuickLinks" onmouseover="keepLinks('$useraccount{$user}$qlcount')" onmouseout="TimeClose('$useraccount{$user}$qlcount')"> |
| $lastonline = |
| <li>~ . &userOnLineStatus($user) . qq~<a href="javascript:closeLinks('$useraccount{$user}$qlcount')" style="position:absolute;right:3px"><b>X</b></a></li>\n~; |
| qq~ title="$maintxt{'10'} $lastonline $maintxt{'12'}."~; |
| 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~; |
| else { |
| &CheckUserPM_Level($user); |
| $lastonline = qq~ title="$maintxt{'13'}."~; |
| if ($PM_level == 1 || ($PM_level == 2 && $UserPM_Level{$user} > 1 && $staff) || ($PM_level == 3 && $UserPM_Level{$user} == 3 && ($iamadmin || $iamgmod))) { |
| } |
| $quicklinks .= qq~ <li><a href="$scripturl?action=imsend;to=$useraccount{$user}">$maintxt{'0'} ${$uid.$user}{'realname'}</a></li>\n~; |
| } |
| } |
| my $quicklinks; |
| if (!${$uid.$user}{'hidemail'} || $iamadmin) { |
| if ($usertools) { |
| $quicklinks .= " <li>" . &enc_eMail("$maintxt{'1'} ${$uid.$user}{'realname'}",${$uid.$user}{'email'},'','') . "</li>\n"; |
| $qlcount++; |
| } |
| my $modcol = is_moderator_b($user); |
| if (!%mybuddie) { &loadMyBuddy; } |
| if ( $modcol == 1 ) { |
| if ($buddyListEnabled && !$mybuddie{$user}) { |
| @memstats = split /\|/xsm, $Group{'Moderator'}; |
| $quicklinks .= qq~ <li><a href="$scripturl?action=addbuddy;name=$useraccount{$user}">$maintxt{'4'} ${$uid.$user}{'realname'} $maintxt{'5'}</a></li>\n~; |
| } |
| } |
| my $display = 'display:inline'; |
| |
| if ( $ENV{'HTTP_USER_AGENT'} =~ /opera/ism || $ENV{'HTTP_USER_AGENT'} =~ /firefox/ism ) { |
| } else { |
| $display = 'display:inline-block'; |
| $quicklinks .= qq~ <li><a href="$scripturl?action=viewprofile;username=$useraccount{$user}">$maintxt{'6'}</a></li>\n~; |
| } |
| } |
| |
| $quicklinks .= qq~ </ul><a href="javascript:quickLinks('$useraccount{$user}$qlcount')"$lastonline>~; |
| $quicklinks = qq~<div style="position:relative;$display"> |
| $quicklinks .= $_[1] ? ${$uid.$user}{'realname'} : $format{$user}; |
| <ul id="$useraccount{$user}$qlcount" class="QuickLinks" onmouseover="keepLinks('$useraccount{$user}$qlcount')" onmouseout="TimeClose('$useraccount{$user}$qlcount')"> |
| qq~$quicklinks</a></div>~; |
| <li>~ |
| |
| . userOnLineStatus($user) . qq~</li>\n~; |
| } else { |
| if ( $user ne $username ) { |
| qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}"$lastonline>~ . ($_[1] ? ${$uid.$user}{'realname'} : $format{$user}) . qq~</a>~; |
| $quicklinks .= |
| } |
| qq~ <li><a href="$scripturl?action=viewprofile;username=$useraccount{$user}">$maintxt{'2'} ${$uid.$user}{'realname'}$maintxt{'3'}</a></li>\n~; |
| |
| CheckUserPM_Level($user); |
| |
| if ( |
| |
| $PM_level == 1 |
| |
| || ( $PM_level == 2 && $UserPM_Level{$user} > 1 && $staff ) |
| |
| || ( $PM_level == 3 |
| |
| && $UserPM_Level{$user} == 4 |
| |
| && ( $iamadmin || $iamgmod || $iamfmod ) ) |
| |
| || ( $PM_level == 4 |
| |
| && $UserPM_Level{$user} == 3 |
| |
| && ( $iamadmin || $iamgmod ) ) |
| |
| ) |
| |
| { |
| |
| $quicklinks .= |
| |
| qq~ <li><a href="$scripturl?action=imsend;to=$useraccount{$user}">$maintxt{'0'} ${$uid.$user}{'realname'}</a></li>\n~; |
| |
| } |
| |
| if ( !${ $uid . $user }{'hidemail'} || $iamadmin ) { |
| |
| $quicklinks .= ' <li>' |
| |
| . enc_eMail( |
| |
| "$maintxt{'1'} ${$uid.$user}{'realname'}", |
| |
| ${ $uid . $user }{'email'}, |
| |
| q{}, q{}, 1 |
| |
| ) . "</li>\n"; |
| |
| } |
| |
| |
| |
| if ( !%mybuddie ) { loadMyBuddy(); } |
| |
| 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 .= |
| |
| qq~ <li><a href="$scripturl?action=viewprofile;username=$useraccount{$user}">$maintxt{'6'}</a></li>\n~; |
| |
| } |
| |
| $quicklinks .= |
| |
| qq~ </ul><a href="javascript:quickLinks('$useraccount{$user}$qlcount')"$lastonline>~; |
| |
| $quicklinks .= $online ? $format_unbold{$user} : $format{$user}; |
| |
| $quicklinks .= q~</a></div>~; |
| |
| } |
| |
| else { |
| |
| $quicklinks = |
| |
| qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$user}"$lastonline>~ |
| |
| . ( $online ? $format_unbold{$user} : $format{$user} ) |
| |
| . q~</a>~; |
| |
| } |
| |
| |
| |
| return $quicklinks; |
| |
| } |
| |
| |
| |
| sub LoadTools { |
| |
| my ( $where, @buttons ) = @_; |
| |
| |
| |
| # Load Icon+Text for tool drop downs |
| |
| my @tools; |
| |
| |
| |
| if ( !%tmpimg ) { %tmpimg = %img; } |
| |
| require Sources::Menu; |
| |
| |
| |
| 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]; |
| |
| $tools[$i] = |
| |
| qq~[tool=$buttons[$i]]<div class="toolbutton_a" style="background-image: url($img_url)">$img_txt</div>[/tool]~; |
| |
| } |
| |
| |
| |
| foreach my $i ( 0 .. $#tools ) { |
| |
| $img{ $buttons[$i] } = $tools[$i]; |
| |
| } |
| |
| return; |
| |
| } |
| |
| |
| |
| sub MakeTools { |
| |
| my ( $counter, $text, $template ) = @_; |
| |
| my $list_item = '</li><li>'; |
| |
| $template = qq~<li>$template</li>~; |
| |
| $template =~ s/\|\|\|/$list_item/gsm; |
| |
| $template =~ s/<li>[\s]*<\/li>//gsm; |
| |
| if ( $MenuType == 1 ) { |
| |
| $template =~ s/\Q$menusep//gsm; |
| |
| } |
| |
| |
| |
| my $tools_template = $template |
| |
| ? qq~ |
| |
| <div class="post_tools_a"> |
| |
| <a href="javascript:quickLinks('threadtools$counter')">$text</a> |
| |
| </div> |
| |
| </td> |
| |
| <td class="center bottom" style="padding:0px; width:0"> |
| |
| <div class="right cursor toolbutton_b"> |
| |
| <ul class="post_tools_menu" id="threadtools$counter" onmouseover="keepLinks('threadtools$counter')" onmouseout="TimeClose('threadtools$counter')"> |
| |
| $template |
| |
| </ul> |
| |
| </div> |
| |
| ~ |
| |
| : qq~<div class="post_tools_a">$load_con{'actionslock'}</div></td><td class="center bottom" style="padding:0px; width:0">~; |
| |
| $tools_template =~ s/{yabb actionlock}/$maintxt{'64'}/gsm; |
| |
| |
| |
| return $tools_template; |
| } |
| } |
| |
| |
| sub LoadCookie { |
| sub LoadCookie { |
| foreach (split(/; /, $ENV{'HTTP_COOKIE'})) { |
| foreach ( split /; /sm, $ENV{'HTTP_COOKIE'} ) { |
| $_ =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; |
| $_ =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack('C', hex($1))/egxsm; |
| ($cookie, $value) = split(/=/); |
| ( $cookie, $value ) = split /=/xsm; |
| $yyCookies{$cookie} = $value; |
| $yyCookies{$cookie} = $value; |
| } |
| } |
| if ($yyCookies{$cookiepassword}) { |
| if ( $yyCookies{$cookiepassword} ) { |
| $password = $yyCookies{$cookiepassword}; |
| $password = $yyCookies{$cookiepassword}; |
| $username = $yyCookies{$cookieusername} || 'Guest'; |
| $username = $yyCookies{$cookieusername} || 'Guest'; |
| $cookiesession = $yyCookies{$session_id}; |
| $cookiesession = $yyCookies{$session_id}; |
| } else { |
| } |
| $password = ''; |
| else { |
| $username = 'Guest'; |
| $password = q{}; |
| } |
| $username = 'Guest'; |
| |
| } |
| if ( $yyCookies{'guestlanguage'} |
| if ( $yyCookies{'guestlanguage'} |
| && !$FORM{'guestlang'} |
| && !$FORM{'guestlang'} |
| && $enable_guestlanguage ) |
| && $enable_guestlanguage ) |
| { opendir DIR, $langdir; |
| { |
| |
| opendir DIR, $langdir; |
| my @langDir = readdir DIR; |
| my @langDir = readdir DIR; |
| closedir DIR; |
| closedir DIR; |
| @lang = (); |
| @lang = (); |
| foreach my $langitems ( sort { lc($a) cmp lc $b } @langDir ) { |
| foreach my $langitems ( sort { lc($a) cmp lc $b } @langDir ) { |
| chomp $langitems; |
| chomp $langitems; |
| if ( ( $langitems ne q{.} ) |
| if ( ( $langitems ne q{.} ) |
| && ( $langitems ne q{..} ) |
| && ( $langitems ne q{..} ) |
| && ( $langitems ne q{.htaccess} ) |
| && ( $langitems ne q{.htaccess} ) |
| && ( $langitems ne q{index.html} ) ) |
| && ( $langitems ne q{index.html} ) ) |
| { |
| { |
| push @lang, $langitems; |
| push @lang, $langitems; |
| } |
| } |
| } |
| } |
| |
| |
| $ccheck = 0; |
| $ccheck = 0; |
| $clang = q{}; |
| $clang = q{}; |
| for my $lng (@lang) { |
| for my $lng (@lang) { |
| if ( $yyCookies{'guestlanguage'} eq $lng ) { |
| if ( $yyCookies{'guestlanguage'} eq $lng ) { |
| $clang = $lng; |
| $clang = $lng; |
| $ccheck = 1; last; |
| $ccheck = 1; |
| } |
| last; |
| |
| } |
| } |
| } |
| if ($ccheck == 1) { |
| if ( $ccheck == 1 ) { |
| $language = $guestLang = $clang; |
| $language = $guestLang = $clang; |
| |
| } |
| |
| } |
| |
| return; |
| |
| } |
| |
| |
| |
| sub guestLangcc { |
| |
| opendir DIR, $langdir; |
| |
| my @langDir = readdir DIR; |
| |
| closedir DIR; |
| |
| @lang = (); |
| |
| foreach my $langitems ( sort { lc($a) cmp lc $b } @langDir ) { |
| |
| chomp $langitems; |
| |
| if ( ( $langitems ne q{.} ) |
| |
| && ( $langitems ne q{..} ) |
| |
| && ( $langitems ne q{.htaccess} ) |
| |
| && ( $langitems ne q{index.html} ) ) |
| |
| { |
| |
| push @lang, $langitems; |
| } |
| } |
| } |
| } |
| return; |
| return \@lang; |
| } |
| } |
| |
| |
| sub UpdateCookie { |
| sub UpdateCookie { |
| my ($what, $user, $passw, $sessionval, $pathval, $expire) = @_; |
| my ( $what, $user, $passw, $sessionval, $pathval, $expire ) = @_; |
| my ($valid, $expiration); |
| my ( $valid, $expiration ); |
| if ($what eq "delete") { |
| if ( $what eq 'delete' ) { |
| $expiration = "Thursday, 01-Jan-1970 00:00:00 GMT"; |
| $expiration = 'Thursday, 01-Jan-1970 00:00:00 GMT'; |
| if ($pathval eq "") { $pathval = qq~/~; } |
| 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'}~; } |
| if ( $FORM{'guestlang'} && !$guestLang ) { |
| $language = qq~$guestLang~; |
| $guestLang = qq~$FORM{'guestlang'}~; |
| $cookiepassword = "guestlanguage"; |
| } |
| $passw = qq~$language~; |
| $language = qq~$guestLang~; |
| $expire = "persistent"; |
| $cookiepassword = 'guestlanguage'; |
| } |
| $passw = qq~$language~; |
| $valid = 1; |
| $expire = 'persistent'; |
| } elsif ($what eq "write") { |
| } |
| $expiration = $expire; |
| $valid = 1; |
| if ($pathval eq "") { $pathval = qq~/~; } |
| } |
| $valid = 1; |
| elsif ( $what eq 'write' ) { |
| } |
| $expiration = $expire; |
| |
| if ( $pathval eq q{} ) { $pathval = q~/~; } |
| if ($valid) { |
| $valid = 1; |
| if ($expire eq "persistent") { $expiration = "Sunday, 17-Jan-2038 00:00:00 GMT"; } |
| } |
| $yySetCookies1 = &write_cookie( |
| |
| -name => "$cookieusername", |
| if ($valid) { |
| -value => "$user", |
| if ( $expire eq 'persistent' ) { |
| -path => "$pathval", |
| $expiration = 'Sunday, 17-Jan-2038 00:00:00 GMT'; |
| -expires => "$expiration"); |
| } |
| $yySetCookies2 = &write_cookie( |
| $yySetCookies1 = write_cookie( |
| -name => "$cookiepassword", |
| -name => "$cookieusername", |
| -value => "$passw", |
| -value => "$user", |
| -path => "$pathval", |
| -path => "$pathval", |
| -expires => "$expiration"); |
| -expires => "$expiration" |
| $yySetCookies3 = &write_cookie( |
| ); |
| -name => "$cookiesession_name", |
| $yySetCookies2 = write_cookie( |
| -value => "$sessionval", |
| -name => "$cookiepassword", |
| -path => "$pathval", |
| -value => "$passw", |
| -expires => "$expiration"); |
| -path => "$pathval", |
| } |
| -expires => "$expiration" |
| } |
| ); |
| |
| $yySetCookies3 = write_cookie( |
| sub LoadAccess { |
| -name => "$cookiesession_name", |
| $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'808'}<br />"; |
| -value => "$sessionval", |
| $noaccesses = ""; |
| -path => "$pathval", |
| |
| -expires => "$expiration" |
| # Reply Check |
| ); |
| my $rcaccess = &AccessCheck($currentboard, 2) || 0; |
| |
| if ($rcaccess eq "granted") { $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'809'}<br />"; } |
| my $adminpass = 'adminpass'; |
| else { $noaccesses .= "$load_txt{'805'} $load_txt{'807'} $load_txt{'809'}<br />"; } |
| my $admincookie = "$cookieusername$adminpass"; |
| |
| if ( $yyCookies{$admincookie} ) { |
| # Topic Check |
| push @otherCookies, |
| my $tcaccess = &AccessCheck($currentboard, 1) || 0; |
| write_cookie( |
| if ($tcaccess eq "granted") { $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'810'}<br />"; } |
| -name => "$admincookie", |
| else { $noaccesses .= "$load_txt{'805'} $load_txt{'807'} $load_txt{'810'}<br />"; } |
| -value => q{}, |
| |
| -path => q{/}, |
| # Poll Check |
| -expires => 'Thursday, 01-Jan-1970 00:00:00 GMT' |
| my $access = &AccessCheck($currentboard, 3) || 0; |
| ); |
| if ($access eq "granted") { $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'811'}<br />"; } |
| $yyCookies{$admincookie} = q{}; |
| else { $noaccesses .= "$load_txt{'805'} $load_txt{'807'} $load_txt{'811'}<br />"; } |
| } |
| |
| |
| # 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 />"; } |
| |
| else { $noaccesses .= "$load_txt{'805'} $load_txt{'807'} $load_txt{'812'}<br />"; } |
| |
| } |
| |
| |
| |
| $accesses = qq~$yesaccesses<br />$noaccesses~; |
| 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 WhatTemplate { |
| sub WhatTemplate { |
| $found = 0; |
| $found = 0; |
| while (($curtemplate, $value) = each(%templateset)) { |
| while ( ( $curtemplate, $value ) = each %templateset ) { |
| if ($curtemplate eq $default_template) { $template = $curtemplate; $found = 1; } |
| if ( $curtemplate eq $default_template ) { |
| } |
| $template = $curtemplate; |
| if (!$found) { $template = 'Forum default'; } |
| $found = 1; |
| if (${$uid.$username}{'template'} ne '') { |
| } |
| if (!exists $templateset{${$uid.$username}{'template'}}) { |
| } |
| ${$uid.$username}{'template'} = 'Forum default'; |
| if ( !$found ) { $template = 'Forum default'; } |
| &UserAccount($username, "update"); |
| if ( ${ $uid . $username }{'template'} ne q{} ) { |
| } |
| if ( !exists $templateset{ ${ $uid . $username }{'template'} } ) { |
| while (($curtemplate, $value) = each(%templateset)) { |
| ${ $uid . $username }{'template'} = 'Forum default'; |
| if ($curtemplate eq ${$uid.$username}{'template'}) { $template = $curtemplate; } |
| UserAccount( $username, 'update' ); |
| } |
| } |
| } |
| while ( ( $curtemplate, $value ) = each %templateset ) { |
| ($usestyle, $useimages, $usehead, $useboard, $usemessage, $usedisplay, $usemycenter, $UseMenuType) = split(/\|/, $templateset{$template}); |
| if ( $curtemplate eq ${ $uid . $username }{'template'} ) { |
| |
| $template = $curtemplate; |
| if (!-e "$forumstylesdir/$usestyle.css") { $usestyle = 'default'; } |
| } |
| if (!-e "$templatesdir/$usehead/$usehead.html") { $usehead = 'default'; } |
| } |
| if (!-e "$templatesdir/$useboard/BoardIndex.template") { $useboard = 'default'; } |
| } |
| if (!-e "$templatesdir/$usemessage/MessageIndex.template") { $usemessage = 'default'; } |
| ( |
| if (!-e "$templatesdir/$usedisplay/Display.template") { $usedisplay = 'default'; } |
| $usestyle, $useimages, $usehead, $useboard, |
| if (!-e "$templatesdir/$usemycenter/MyCenter.template") { $usemycenter = 'default'; } |
| $usemessage, $usedisplay, $usemycenter, $UseMenuType, |
| |
| $useThreadtools, $usePosttools, |
| if ($UseMenuType eq '') { $UseMenuType = $MenuType; } |
| ) = split /\|/xsm, $templateset{$template}; |
| |
| |
| if (-d "$forumstylesdir/$useimages") { $imagesdir = "$forumstylesurl/$useimages"; } |
| if ( !-e "$htmldir/Templates/Forum/$usestyle.css" ) { |
| else { $imagesdir = "$forumstylesurl/default"; } |
| $usestyle = 'default'; |
| $defaultimagesdir = "$forumstylesurl/default"; |
| } |
| $extpagstyle = qq~$forumstylesurl/$usestyle.css~; |
| if ( !-e "$templatesdir/$usehead/$usehead.html" ) { $usehead = 'default'; } |
| $extpagstyle =~ s~$usestyle\/~~g; |
| if ( !-e "$templatesdir/$useboard/BoardIndex.template" ) { |
| |
| $useboard = 'default'; |
| |
| } |
| |
| if ( !-e "$templatesdir/$usemessage/MessageIndex.template" ) { |
| |
| $usemessage = 'default'; |
| |
| } |
| |
| if ( !-e "$templatesdir/$usedisplay/Display.template" ) { |
| |
| $usedisplay = 'default'; |
| |
| } |
| |
| if ( !-e "$templatesdir/$usemycenter/MyCenter.template" ) { |
| |
| $usemycenter = 'default'; |
| |
| } |
| |
| |
| |
| if ( $UseMenuType eq q{} ) { $UseMenuType = $MenuType; } |
| |
| if ( $useThreadtools eq q{} ) { $useThreadtools = $threadtools; } |
| |
| if ( $usePosttools eq q{} ) { $usePosttools = $posttools; } |
| |
| |
| |
| 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"; |
| |
| |
| |
| $extpagstyle =~ s/$usestyle\///gxsm; |
| |
| return; |
| } |
| } |
| |
| |
| sub WhatLanguage { |
| sub WhatLanguage { |
| if (${$uid.$username}{'language'} ne '') { |
| if ( ${ $uid . $username }{'language'} ne q{} ) { |
| $language = ${$uid.$username}{'language'}; |
| $language = ${ $uid . $username }{'language'}; |
| } elsif($FORM{'guestlang'} && $enable_guestlanguage) { |
| } |
| $language = $FORM{'guestlang'}; |
| elsif ( $FORM{'guestlang'} && $enable_guestlanguage ) { |
| } elsif($guestLang && $enable_guestlanguage) { |
| $language = $FORM{'guestlang'}; |
| $language = $guestLang; |
| } |
| } else { |
| elsif ( $guestLang && $enable_guestlanguage ) { |
| $language = $lang; |
| $language = $guestLang; |
| } |
| } |
| |
| else { |
| &LoadLanguage('Main'); |
| $language = $lang; |
| &LoadLanguage('Menu'); |
| } |
| |
| |
| if ($adminscreen) { |
| LoadLanguage('Main'); |
| &LoadLanguage('Admin'); |
| LoadLanguage('Menu'); |
| &LoadLanguage('FA'); |
| |
| } |
| if ($adminscreen) { |
| |
| LoadLanguage('Admin'); |
| |
| LoadLanguage('FA'); |
| |
| } |
| |
| return; |
| } |
| } |
| |
| |
| # build the .ims file from scratch |
| |
| # here because its needed by admin and user |
| |
| #messageid|[blank]|touser(s)|(ccuser(s))|(bccuser(s))| |
| |
| # subject|date|message|(parentmid)|(reply#)|ip| |
| |
| # messagestatus|flags|storefolder|attachment |
| |
| # messagestatus = c(confidential)/h(igh importance)/s(tandard) |
| |
| # parentmid stays same, reply# increments for replies, so we can build conversation threads |
| |
| # storefolder = name of storage folder. Start with in & out for everyone. |
| |
| # flags - u(nread)/f(orward)/q(oute)/r(eply)/c(alled back) |
| |
| # |
| |
| # old file |
| |
| #1 $mnum = 3; |
| |
| #2 $imnewcount = 0; |
| |
| #3 $moutnum = 17; |
| |
| #4 $storenum = 0; |
| |
| #5 $draftnum = 0; |
| |
| #6 @folders (name1|name2|name3); |
| |
| |
| |
| # new .ims file format |
| |
| # ### UserIMS YaBB 2.2 Version ### |
| |
| # '${$username}{'PMmnum'}',"value" |
| |
| # '${$username}{'PMimnewcount'}',"value" |
| |
| # '${$username}{'PMmoutnum'}',"value" |
| |
| # '${$username}{'PMstorenum'}',"value" |
| |
| # '${$username}{'PMdraftnum'}',"value" |
| |
| # '${$username}{'PMfolders'}',"value" |
| |
| # '${$username}{'PMfoldersCount'}',"value" |
| |
| # '${$username}{'PMbcRead'}',"value" |
| |
| |
| |
| # usage: &buildIMS(<user>, 'tasks'); |
| |
| # tasks: load, update, '' [= rebuild] |
| |
| sub buildIMS { |
| sub buildIMS { |
| my ($incurr, $inunr, $outcurr, $draftcount, @imstore, $storetotal, @storefoldersCount, $storeCounts); |
| my ( $builduser, $job ) = @_; |
| my ($builduser,$job) = @_; |
| my ( $incurr, $inunr, $outcurr, $draftcount, @imstore, $storetotal, |
| |
| @storefoldersCount, $storeCounts ); |
| |
| |
| |
| 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" ) { |
| |
| fopen( USERMSG, "$memberdir/$builduser.msg" ) |
| |
| or 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 |
| |
| if ( ( split /\|/xsm, $message )[12] =~ /u/sm ) { $inunr++; } |
| |
| } |
| |
| $incurr = @messages; |
| |
| |
| |
| } |
| |
| |
| if ($job) { |
| ## do the outbox |
| if ($job eq 'load') { |
| if ( -e "$memberdir/$builduser.outbox" ) { |
| &load_IMS($builduser); |
| fopen( OUTMESS, "$memberdir/$builduser.outbox" ) |
| } else { |
| or fatal_error( 'cannot_open', "$memberdir/$builduser.outbox", 1 ); |
| &update_IMS($builduser); |
| my @outmessages = <OUTMESS>; |
| } |
| fclose(OUTMESS); |
| return; |
| $outcurr = @outmessages; |
| } |
| } |
| |
| |
| ## inbox if it exists, either load and count totals or parse and update format. |
| if ( -e "$memberdir/$builduser.imdraft" ) { |
| if (-e "$memberdir/$builduser.msg") { |
| fopen( DRAFTMESS, "$memberdir/$builduser.imdraft" ) |
| fopen(USERMSG, "$memberdir/$builduser.msg") || &fatal_error('cannot_open', "$memberdir/$builduser.msg", 1); # open inbox |
| or fatal_error( 'cannot_open', "$memberdir/$builduser.imdraft", 1 ); |
| my @messages = <USERMSG>; |
| my @d = <DRAFTMESS>; |
| fclose(USERMSG); |
| fclose(DRAFTMESS); |
| |
| $draftcount = @d; |
| # test the data for version. 16 elements in new format, no more than 8 in old. |
| } |
| if (split(/\|/, $messages[0]) > 8) { # new format, so just need to check the flags |
| |
| foreach my $message (@messages) { |
| ## grab the current list of store folders |
| # If the message is flagged as u(nopened), add to the new count |
| ## else, create an entry for the two 'default ones' for the in/out status stuff |
| if ((split /\|/, $message)[12] =~ /u/) { $inunr++; } |
| my $storefolders = ${$builduser}{'PMfolders'} || 'in|out'; |
| } |
| my @currStoreFolders = split /\|/xsm, $storefolders; |
| $incurr = @messages; |
| if ( -e "$memberdir/$builduser.imstore" ) { |
| |
| fopen( STOREMESS, "$memberdir/$builduser.imstore" ) |
| } else { # old format, needs rearranging |
| or fatal_error( 'cannot_open', "$memberdir/$builduser.imstore", 1 ); |
| ($inunr,$incurr) = &convert_MSG($builduser); |
| @imstore = <STOREMESS>; |
| } |
| fclose(STOREMESS); |
| } |
| if (@imstore) { |
| |
| my ( $storeUpdated, $storeMessLine ) = ( 0, 0 ); |
| ## do the outbox |
| foreach my $message (@imstore) { |
| if (-e "$memberdir/$builduser.outbox") { |
| my @messLine = split /\|/xsm, $message; |
| fopen("OUTMESS", "$memberdir/$builduser.outbox") || &fatal_error('cannot_open', "$memberdir/$builduser.outbox", 1); |
| ## look through list for folder name |
| my @outmessages = <OUTMESS>; |
| if ( $messLine[13] eq q{} ) |
| fclose("OUTMESS"); |
| { # some folder missing within imstore |
| if (split(/\|/, $outmessages[0]) > 8) { # > 10 elements in new format, no more than 8 in old |
| if ( $messLine[1] ne q{} ) { # 'from' name so inbox |
| $outcurr = @outmessages; |
| $messLine[13] = 'in'; |
| } else { |
| } |
| $outcurr = &convert_OUTBOX($builduser); |
| else { # no 'from' so outbox |
| } |
| $messLine[13] = 'out'; |
| } |
| } |
| |
| $imstore[$storeMessLine] = join q{|}, @messLine; |
| ## do the draft store - slightly easier - only exists in y22 |
| $storeUpdated = 1; |
| if (-e "$memberdir/$builduser.imdraft") { |
| } |
| fopen("DRAFTMESS", "$memberdir/$builduser.imdraft") || &fatal_error('cannot_open', "$memberdir/$builduser.imdraft", 1); |
| if ( $storefolders !~ /\b$messLine[13]\b/sm ) { |
| my @d = <DRAFTMESS>; |
| push @currStoreFolders, $messLine[13]; |
| fclose("DRAFTMESS"); |
| $storefolders = join q{|}, @currStoreFolders; |
| $draftcount = @d; |
| } |
| } |
| $storeMessLine++; |
| |
| } |
| ## grab the current list of store folders |
| if ( $storeUpdated == 1 ) { |
| ## else, create an entry for the two 'default ones' for the in/out status stuff |
| fopen( STRMESS, "+>$memberdir/$builduser.imstore" ) |
| my $storefolders = ${$builduser}{'PMfolders'} || "in|out"; |
| or fatal_error( 'cannot_open', |
| my @currStoreFolders = split(/\|/, $storefolders); |
| "$memberdir/$builduser.imstore", 1 ); |
| if (-e "$memberdir/$builduser.imstore") { |
| print {STRMESS} @imstore or croak "$croak{'print'} STRMESS"; |
| fopen(STOREMESS, "$memberdir/$builduser.imstore") || &fatal_error('cannot_open', "$memberdir/$builduser.imstore", 1); |
| fclose(STRMESS); |
| @imstore = <STOREMESS>; |
| } |
| fclose (STOREMESS); |
| $storetotal = @imstore; |
| if (@imstore) { |
| $storefolders = join q{|}, @currStoreFolders; |
| # > 10 elements in new format, no more than 8 in old |
| |
| #messageid0|[blank]1|touser(s)2|(ccuser(s))3|(bccuser(s))4| |
| } |
| # subject5|date6|message7|(parentmid)8|(reply#)9|ip10|messagestatus11|flags12|storefolder13|attachment14 |
| else { |
| if (split(/\|/, $imstore[0]) <= 8) { @imstore = &convert_IMSTORE($builduser); } |
| unlink "$memberdir/$builduser.imstore"; |
| |
| } |
| my ($storeUpdated,$storeMessLine) = (0,0); |
| } |
| foreach my $message (@imstore) { |
| ## run through the messages and count against the folder name |
| my @messLine = split(/\|/, $message); |
| for my $y ( 0 .. $#currStoreFolders ) { |
| ## look through list for folder name |
| $storefoldersCount[$y] = 0; |
| if ($messLine[13] eq '') { # some folder missing within imstore |
| for my $x ( 0 .. $#imstore ) { |
| if ($messLine[1] ne '') { # 'from' name so inbox |
| if ( ( split /\|/xsm, $imstore[$x] )[13] eq $currStoreFolders[$y] ) |
| $messLine[13] = 'in'; |
| { |
| } else { # no 'from' so outbox |
| $storefoldersCount[$y]++; |
| $messLine[13] = 'out'; |
| } |
| } |
| } |
| $imstore[$storeMessLine] = join('|', @messLine); |
| } |
| $storeUpdated = 1; |
| $storeCounts = join q{|}, @storefoldersCount; |
| } |
| |
| unless ($storefolders =~ /\b$messLine[13]\b/) { |
| LoadBroadcastMessages($builduser); |
| push(@currStoreFolders, $messLine[13]); |
| |
| $storefolders = join('|', @currStoreFolders); |
| ${$builduser}{'PMmnum'} = $incurr || 0; |
| } |
| ${$builduser}{'PMimnewcount'} = $inunr || 0; |
| $storeMessLine++; |
| ${$builduser}{'PMmoutnum'} = $outcurr || 0; |
| } |
| ${$builduser}{'PMdraftnum'} = $draftcount || 0; |
| if ($storeUpdated == 1) { |
| ${$builduser}{'PMstorenum'} = $storetotal || 0; |
| fopen(STRMESS, "+>$memberdir/$builduser.imstore") || &fatal_error('cannot_open', "$memberdir/$builduser.imstore", 1); |
| ${$builduser}{'PMfolders'} = $storefolders; |
| print STRMESS @imstore; |
| ${$builduser}{'PMfoldersCount'} = $storeCounts || 0; |
| fclose(STRMESS); |
| update_IMS($builduser); |
| } |
| return; |
| $storetotal = @imstore; |
| |
| $storefolders = join('|', @currStoreFolders); |
| |
| |
| |
| } else { |
| |
| unlink "$memberdir/$builduser.imstore"; |
| |
| } |
| |
| } |
| |
| ## run through the messages and count against the folder name |
| |
| for (my $y = 0; $y < @currStoreFolders; $y++) { |
| |
| $storefoldersCount[$y] = 0; |
| |
| for (my $x = 0; $x < @imstore; $x++) { |
| |
| if ((split(/\|/, $imstore[$x]))[13] eq $currStoreFolders[$y]) { |
| |
| $storefoldersCount[$y]++; |
| |
| } |
| |
| } |
| |
| } |
| |
| $storeCounts = join('|', @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; |
| |
| &update_IMS($builduser); |
| |
| } |
| } |
| |
| |
| sub update_IMS { |
| sub update_IMS { |
| my $builduser = shift; |
| my $builduser = shift; |
| my @tag = qw(PMmnum PMimnewcount PMmoutnum PMstorenum PMdraftnum PMfolders PMfoldersCount PMbcRead); |
| my @tag = |
| |
| qw(PMmnum PMimnewcount PMmoutnum PMstorenum PMdraftnum PMfolders PMfoldersCount PMbcRead); |
| fopen(UPDATE_IMS, ">$memberdir/$builduser.ims",1) || &fatal_error('cannot_open', "$memberdir/$builduser.ims", 1); |
| |
| print UPDATE_IMS qq~### UserIMS YaBB 2.2 Version ###\n\n~; |
| fopen( UPDATE_IMS, ">$memberdir/$builduser.ims", 1 ) |
| for (my $cnt = 0; $cnt < @tag; $cnt++) { |
| or fatal_error( 'cannot_open', "$memberdir/$builduser.ims", 1 ); |
| print UPDATE_IMS qq~'$tag[$cnt]',"${$builduser}{$tag[$cnt]}"\n~; |
| print {UPDATE_IMS} qq~### UserIMS YaBB 2.6.12 Version ###\n\n~ |
| } |
| or croak "$croak{'print'} update IMS"; |
| fclose(UPDATE_IMS); |
| for my $cnt ( 0 .. $#tag ) { |
| |
| print {UPDATE_IMS} qq~'$tag[$cnt]',"${$builduser}{$tag[$cnt]}"\n~ |
| |
| or croak "$croak{'print'} update IMS"; |
| |
| } |
| |
| fclose(UPDATE_IMS); |
| |
| return; |
| } |
| } |
| |
| |
| sub load_IMS { |
| sub load_IMS { |
| my $builduser = shift; |
| my $builduser = shift; |
| my @ims; |
| my @ims; |
| if (-e "$memberdir/$builduser.ims") { |
| if ( -e "$memberdir/$builduser.ims" ) { |
| fopen ("IMSFILE", "$memberdir/$builduser.ims") || &fatal_error('cannot_open', "$memberdir/$builduser.ims", 1); |
| fopen( IMSFILE, "$memberdir/$builduser.ims" ) |
| @ims = <IMSFILE>; |
| or fatal_error( 'cannot_open', "$memberdir/$builduser.ims", 1 ); |
| fclose("IMSFILE"); |
| @ims = <IMSFILE>; |
| } |
| fclose(IMSFILE); |
| |
| } |
| if ($ims[0] =~ /###/) { |
| |
| foreach (@ims) { if ($_ =~ /'(.*?)',"(.*?)"/) { ${$builduser}{$1} = $2; } } |
| if ( $ims[0] =~ /\x23\x23\x23/xsm ) { |
| } else { |
| foreach (@ims) { |
| &buildIMS($builduser, ''); |
| if ( $_ =~ /'(.*?)',"(.*?)"/xsm ) { ${$builduser}{$1} = $2; } |
| } |
| } |
| } |
| } |
| |
| else { |
| sub LoadBroadcastMessages { #check broadcast messages |
| buildIMS( $builduser, q{} ); |
| return if ($iamguest || $PM_level == 0 || ($maintenance && !$iamadmin) || ($PM_level == 2 && (!$iamadmin && !$iamgmod && !$iammod)) || ($PM_level == 3 && (!$iamadmin && !$iamgmod))); |
| } |
| |
| return; |
| my $builduser = shift; |
| } |
| $BCnewMessage = 0; |
| |
| $BCCount = 0; |
| sub LoadBroadcastMessages { #check broadcast messages |
| if (-e "$memberdir/broadcast.messages") { |
| return |
| my %PMbcRead; |
| if ( $iamguest |
| map { $PMbcRead{$_} = 0; } split(/,/, ${$builduser}{'PMbcRead'}); |
| || $PM_level == 0 |
| |
| || ( $maintenance && !$iamadmin ) |
| fopen(BCMESS, "<$memberdir/broadcast.messages") || &fatal_error('cannot_open', "$memberdir/broadcast.messages", 1); |
| || ( $PM_level == 2 && ( !$staff ) ) |
| my @bcmessages = <BCMESS>; |
| || ( $PM_level == 3 && ( !$iamadmin && !$iamgmod ) ) |
| fclose(BCMESS); |
| || ( $PM_level == 4 && ( !$iamadmin && !$iamgmod && !$iamfmod ) ) ); |
| foreach (@bcmessages) { |
| |
| my ($mnum, $mfrom, $mto, undef) = split (/\|/, $_, 4); |
| my $builduser = shift; |
| if ($mfrom eq $username) { $BCCount++; $PMbcRead{$mnum} = 1; } |
| $BCnewMessage = 0; |
| elsif (&BroadMessageView($mto)) { |
| $BCCount = 0; |
| $BCCount++; |
| if ( -e "$memberdir/broadcast.messages" ) { |
| if (exists $PMbcRead{$mnum}) { $PMbcRead{$mnum} = 1; } |
| my %PMbcRead; |
| else { $BCnewMessage++; } |
| map { $PMbcRead{$_} = 1; } split /,/xsm, ${$builduser}{'PMbcRead'}; |
| } |
| |
| } |
| fopen( BCMESS, "<$memberdir/broadcast.messages" ) |
| ${$builduser}{'PMbcRead'} = ''; |
| or fatal_error( 'cannot_open', "$memberdir/broadcast.messages", 1 ); |
| foreach (keys %PMbcRead) { |
| my @bcmessages = <BCMESS>; |
| if ($PMbcRead{$_}) { |
| fclose(BCMESS); |
| ${$builduser}{'PMbcRead' . $_} = 1; |
| foreach (@bcmessages) { |
| ${$builduser}{'PMbcRead'} .= ${$builduser}{'PMbcRead'} ? ",$_" : $_; |
| my ( $mnum, $mfrom, $mto, undef ) = split /\|/xsm, $_, 4; |
| } |
| if ( $mfrom eq $username ) { $BCCount++; $PMbcRead{$mnum} = 1; } |
| } |
| elsif ( BroadMessageView($mto) ) { |
| } else { |
| $BCCount++; |
| ${$builduser}{'PMbcRead'} = ''; |
| if ( exists $PMbcRead{$mnum} ) { $PMbcRead{$mnum} = 1; } |
| } |
| else { $BCnewMessage++; } |
| } |
| } |
| |
| } |
| sub convert_MSG { |
| ${$builduser}{'PMbcRead'} = q{}; |
| my $builduser = shift; |
| foreach ( keys %PMbcRead ) { |
| my $inunr; |
| if ( $PMbcRead{$_} ) { |
| # clean out msg file and rebuild in new format |
| ${$builduser}{ 'PMbcRead' . $_ } = 1; |
| # new format: |
| ${$builduser}{'PMbcRead'} .= |
| # messageid(0)|from(1)|touser(2)|ccuser(3)|bccuser(4)|subject(5)|date(6)|message(7)|parentmid(8)|reply#(9)|ip(10)|messagestatus(11)|flags(12)|storefolder(13)|attachment(14) |
| ${$builduser}{'PMbcRead'} ? ",$_" : $_; |
| # old format: |
| } |
| # from(0)|subject(1)|date(2)|message(3)|messageid(4)|ip(5)|read/replied(6) |
| } |
| fopen(OLDMESS, "+<$memberdir/$builduser.msg") || &fatal_error('cannot_open', "$memberdir/$builduser.msg", 1); |
| } |
| my @oldmessages = <OLDMESS>; |
| else { |
| chomp @oldmessages; |
| ${$builduser}{'PMbcRead'} = q{}; |
| seek OLDMESS , 0, 0; |
| } |
| truncate OLDMESS, 0; |
| return; |
| foreach my $oldmessage (@oldmessages) { # parse messages for flags |
| |
| my @oldformat = split(/\|/,$oldmessage); |
| |
| # under old format, unread,and replied are exclusive, so no need to go mixing them |
| |
| if ($oldformat[6] == 1) { $oldformat[6] = 'u' ; $inunr++; } # if 6 (status) is 1 then change to u(nread) flag |
| |
| elsif ($oldformat[6] == 2) { $oldformat[6] = 'r'; } # if 6 (status) is 2 then change to r(eplied) flag |
| |
| # if any old style message ids still there, or odd blank ones, correct them to = date value |
| |
| if ($oldformat[4] < 101) { $oldformat[4] = $oldformat[2]; } |
| |
| # reassemble to new format and print back to file |
| |
| print OLDMESS "$oldformat[4]|$oldformat[0]|$builduser|||$oldformat[1]|$oldformat[2]|$oldformat[3]|$oldformat[4]|0|$oldformat[5]|s|$oldformat[6]||\n"; |
| |
| } |
| |
| fclose(OLDMESS); |
| |
| ($inunr,scalar @oldmessages); |
| |
| } |
| |
| |
| |
| sub convert_OUTBOX { |
| |
| my $builduser = shift; |
| |
| ## clean out msg file and rebuild in new format |
| |
| fopen(OLDOUTBOX, "+<$memberdir/$builduser.outbox") || &fatal_error('cannot_open', "$memberdir/$builduser.outbox", 1); |
| |
| my @oldoutmessages = <OLDOUTBOX>; |
| |
| chomp @oldoutmessages; |
| |
| seek OLDOUTBOX, 0, 0; |
| |
| truncate OLDOUTBOX, 0; |
| |
| # clean out msg file and rebuild in new format |
| |
| # new format: |
| |
| # messageid(0)|from(1)|touser(2)|ccuser(3)|bccuser(4)|subject(5)|date(6)|message(7)|parentmid(8)|reply#(9)|ip(10)|messagestatus(11)|flags(12)|storefolder(13)|attachment(14) |
| |
| # old format: |
| |
| # from(0)|subject(1)|date(2)|message(3)|messageid(4)|ip(5)|read/replied(6) |
| |
| foreach my $oldmessage (@oldoutmessages) { |
| |
| my @oldformat = split(/\|/, $oldmessage); |
| |
| ## if any old style message ids still there, or odd blank ones, correct them to = date value |
| |
| if ($oldformat[4] < 101 || $oldformat[4] eq '') { $oldformat[4] = $oldformat[2]; } |
| |
| ## outbox can't be replied to ;) and forwarding doesn't exist in old format |
| |
| if (!$oldformat[6]) { $oldformat[6] = 'u'; } |
| |
| elsif ($oldformat[6] == 1) { $oldformat[6] = ''; } |
| |
| print OLDOUTBOX "$oldformat[4]|$builduser|$oldformat[0]|||$oldformat[1]|$oldformat[2]|$oldformat[3]|$oldformat[4]|0|$oldformat[5]|s|$oldformat[6]||\n"; |
| |
| } |
| |
| fclose(OLDOUTBOX); |
| |
| return scalar @oldoutmessages; |
| |
| } |
| |
| |
| |
| sub convert_IMSTORE { |
| |
| my $builduser = shift; |
| |
| my @imstore; |
| |
| fopen(OLDIMSTORE, "+<$memberdir/$builduser.imstore") || &fatal_error('cannot_open', "$memberdir/$builduser.imstore", 1); |
| |
| my @oldstoremessages = <OLDIMSTORE>; |
| |
| chomp @oldstoremessages; |
| |
| seek OLDIMSTORE, 0, 0; |
| |
| truncate OLDIMSTORE, 0; |
| |
| # new format: |
| |
| # messageid(0)|from(1)|touser(2)|ccuser(3)|bccuser(4)|subject(5)|date(6)|message(7)|parentmid(8)|reply#(9)|ip(10)|messagestatus(11)|flags(12)|storefolder(13)|attachment(14) |
| |
| # old format: |
| |
| # from(0)|subject(1)|date(2)|message(3)|messageid(4)|ip(5)|read/replied(6)|folder/imwhere(7) |
| |
| foreach my $oldmessage (@oldstoremessages) { |
| |
| my @oldformat = split(/\|/, $oldmessage); |
| |
| my ($touser, $fromuser); |
| |
| if ($oldformat[7] eq 'outbox') { |
| |
| $oldformat[7] = 'out'; |
| |
| $touser = $oldformat[0]; |
| |
| $fromuser = $builduser; |
| |
| if (!$oldformat[6]) { $oldformat[6] = 'u'; } |
| |
| elsif ($oldformat[6] == 1) { $oldformat[6] = 'r'; } |
| |
| } elsif ($oldformat[7] eq 'inbox') { |
| |
| $oldformat[7] = 'in'; |
| |
| $touser = $builduser; |
| |
| $fromuser = $oldformat[0]; |
| |
| if ($oldformat[6] == 1) { $oldformat[6] = 'u'; } |
| |
| elsif ($oldformat[6] == 2) { $oldformat[6] = 'r'; } |
| |
| } |
| |
| push (@imstore, "$oldformat[4]|$fromuser|$touser|||$oldformat[1]|$oldformat[2]|$oldformat[3]|$oldformat[4]|0|$oldformat[5]|s|$oldformat[6]|$oldformat[7]|\n"); |
| |
| } |
| |
| print OLDIMSTORE @imstore; |
| |
| fclose(OLDIMSTORE); |
| |
| @imstore; |
| |
| } |
| } |
| |
| |
| 1; |
| 1; |
| |
| |