| ############################################################################### |
| ############################################################################### |
| # BoardIndex.pl # |
| # BoardIndex.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 strict; |
| |
| # use warnings; |
| |
| no warnings qw(uninitialized once redefine); |
| |
| use CGI::Carp qw(fatalsToBrowser); |
| |
| use English '-no_match_vars'; |
| |
| our $VERSION = '2.6.12'; |
| |
| |
| $boardindexplver = 'YaBB 2.5.2 $Revision: 1.0 $'; |
| $boardindexpmver = 'YaBB 2.6.12 $Revision: 1710 $'; |
| if ( $action eq 'detailedversion' ) { return 1; } |
| if ( $action eq 'detailedversion' ) { return 1; } |
| |
| |
| &LoadLanguage('BoardIndex'); |
| LoadLanguage('BoardIndex'); |
| require "$templatesdir/$useboard/BoardIndex.template"; |
| get_micon(); |
| |
| |
| sub BoardIndex { |
| sub BoardIndex { |
| my ( |
| my ( |
| $users, $lspostid, $lspostbd, $lssub, |
| $users, $lspostid, $lspostbd, $lssub, $lsposter, |
| $lsposttime, $lsposter, $lsreply, $lsdatetime, |
| $lsreply, $lsdatetime, @goodboards, @loadboards, $guestlist |
| $lastthreadtime, @goodboards, @loadboards, $guestlist |
| |
| ); |
| ); |
| my ( $memcount, $latestmember ) = &MembershipGet; |
| get_forum_master(); |
| |
| my @brd_img_id = sort ( keys %board); |
| |
| my %brd_img_id = (); |
| |
| my $brdimgcnt = 0; |
| |
| for ( @brd_img_id ) { |
| |
| $brd_img_id{$_} = $brdimgcnt; |
| |
| $brdimgcnt++; |
| |
| } |
| |
| |
| |
| my ( $memcount, $latestmember ) = MembershipGet(); |
| chomp $latestmember; |
| chomp $latestmember; |
| $totalm = 0; |
| $totalm = 0; |
| $totalt = 0; |
| $totalt = 0; |
| $lastposttime = 0; |
| $lastposttime = 0; |
| $lastthreadtime = 0; |
| my $lastthreadtime = 0; |
| &GetBotlist; |
| |
| |
| if ( $INFO{'boardselect'} ) { $subboard_sel = $INFO{'boardselect'}; } |
| |
| |
| |
| # if sub board is selected but none exists with that name, show everything |
| |
| if ( $subboard_sel && !$subboard{$subboard_sel} ) { |
| |
| $subboard_sel = 0; |
| |
| } |
| |
| |
| |
| get_template('BoardIndex'); |
| |
| |
| my ( $numusers, $guests, $numbots, $user_in_log, $guest_in_log ) = |
| my ( $numusers, $guests, $numbots, $user_in_log, $guest_in_log ) = |
| ( 0, 0, 0, 0, 0 ); |
| ( 0, 0, 0, 0, 0 ); |
| my $lastonline = $date - ( $OnlineLogTime * 60 ); |
| my %bvusers = (); |
| foreach (@logentries) { |
| |
| ( $name, $date1, $last_ip, $last_host ) = split( /\|/, $_ ); |
| # do not do this stuff when we're calling for sub board display |
| if ( !$last_ip ) { |
| if ( !$subboard_sel ) { |
| $last_ip = |
| GetBotlist(); |
| |
| |
| |
| my $lastonline = $date - ( $OnlineLogTime * 60 ); |
| |
| foreach (@logentries) { |
| |
| ( $name, $date1, $last_ip, $last_host, undef, $boardv, undef ) = |
| |
| split /\|/xsm, $_, 7; |
| |
| if ( !$last_ip ) { |
| |
| $last_ip = |
| qq~</i></span><span class="error">$boardindex_txt{'no_ip'}</span><span class="small"><i>~; |
| qq~</i></span><span class="error">$boardindex_txt{'no_ip'}</span><span class="small"><i>~; |
| } |
| } |
| my $is_a_bot = &Is_Bot($last_host); |
| my $lookupIP = |
| if ($is_a_bot) { |
| ( $ipLookup && $last_ip ) |
| $numbots++; |
| ? qq~<a href="$scripturl?action=iplookup;ip=$last_ip">$last_ip</a>~ |
| $bot_count{$is_a_bot}++; |
| : qq~$last_ip~; |
| } |
| |
| elsif ($name) { |
| my $is_a_bot = Is_Bot($last_host); |
| if ( &LoadUser($name) ) { |
| if ($is_a_bot) { |
| if ( $name eq $username ) { $user_in_log = 1; } |
| $numbots++; |
| elsif ( ${ $uid . $name }{'lastonline'} < $lastonline ) { |
| $bot_count{$is_a_bot}++; |
| next; |
| } |
| } |
| elsif ($name) { |
| if ( $iamadmin || $iamgmod ) { |
| if ( -e "$memberdir/$name.vars" ) { |
| $numusers++; |
| LoadUser( $name, 'vars'); |
| $users .= &QuickLinks($name); |
| if ( $name eq $username ) { $user_in_log = 1; } |
| $users .= ( ${ $uid . $name }{'stealth'} ? "*" : "" ) |
| elsif ( ${ $uid . $name }{'lastonline'} < $lastonline ) { |
| . ( |
| next; |
| ( |
| } |
| ( $iamadmin && $show_online_ip_admin ) |
| if ( $iamadmin || $iamgmod || $iamfmod ) { |
| || ( $iamgmod && $show_online_ip_gmod ) |
| $numusers++; |
| ) ? " <i>($last_ip)</i>, " : ", " |
| $bvusers{$boardv}++; |
| ); |
| $users .= QuickLinks($name); |
| |
| $users .= ( ${ $uid . $name }{'stealth'} ? q{*} : q{} ) |
| |
| . ( |
| |
| ( |
| |
| ( $iamadmin && $show_online_ip_admin ) |
| |
| || ( $iamgmod && $show_online_ip_gmod ) |
| |
| || ( $iamfmod && $show_online_ip_fmod ) |
| |
| ) ? qq~ <i>($lookupIP)</i>, ~ : q{, } |
| |
| ); |
| |
| |
| |
| } |
| |
| elsif ( !${ $uid . $name }{'stealth'} ) { |
| |
| $numusers++; |
| |
| $users .= QuickLinks($name) . q{, }; |
| |
| } |
| } |
| } |
| elsif ( !${ $uid . $name }{'stealth'} ) { |
| else { |
| $numusers++; |
| if ( $name eq $user_ip ) { $guest_in_log = 1; } |
| $users .= &QuickLinks($name) . ", "; |
| $guests++; |
| |
| $bvusers{$boardv}++; |
| |
| if ( ( $iamadmin && $show_online_ip_admin ) |
| |
| || ( $iamgmod && $show_online_ip_gmod ) |
| |
| || ( $iamfmod && $show_online_ip_fmod ) ) |
| |
| { |
| |
| $guestlist .= qq~<i>$lookupIP</i>, ~; |
| |
| } |
| } |
| } |
| } |
| } |
| else { |
| } |
| if ( $name eq $user_ip ) { $guest_in_log = 1; } |
| if ( !$iamguest && !$user_in_log ) { |
| $guests++; |
| if ($guests) { $guests--; } |
| |
| $numusers++; |
| |
| $bvusers{$boardv}++; |
| |
| $users .= QuickLinks($username); |
| |
| if ( $iamadmin || $iamgmod || $iamfmod ) { |
| |
| $users .= ${ $uid . $username }{'stealth'} ? q{*} : q{}; |
| if ( ( $iamadmin && $show_online_ip_admin ) |
| if ( ( $iamadmin && $show_online_ip_admin ) |
| || ( $iamgmod && $show_online_ip_gmod ) ) |
| || ( $iamgmod && $show_online_ip_gmod ) |
| |
| || ( $iamfmod && $show_online_ip_fmod ) ) |
| { |
| { |
| $guestlist .= qq~<i>$last_ip</i>, ~; |
| $users .= " <i>($user_ip)</i>"; |
| |
| $guestlist =~ s/<i>$lookupIP<\/i>, //osm; |
| } |
| } |
| } |
| } |
| } |
| } |
| } |
| elsif ( $iamguest && !$is_a_bot && !$guest_in_log ) { |
| if ( !$iamguest && !$user_in_log ) { |
| $guests++; |
| $guests-- if $guests; |
| $bvusers{$boardv}++; |
| $numusers++; |
| } |
| $users .= &QuickLinks($username); |
| |
| if ( $iamadmin || $iamgmod ) { |
| if ($numusers) { |
| $users .= ${ $uid . $username }{'stealth'} ? "*" : ""; |
| $users =~ s/, \Z//sm; |
| if ( ( $iamadmin && $show_online_ip_admin ) |
| $users .= q~<br />~; |
| || ( $iamgmod && $show_online_ip_gmod ) ) |
| } |
| { |
| if ($guestlist) { # build the guest list |
| $users .= " <i>($user_ip)</i>"; |
| $guestlist =~ s/, $//sm; |
| $guestlist =~ s|<i>$last_ip</i>, ||o; |
| $guestlist = qq~<span class="small">$guestlist</span><br />~; |
| |
| } |
| |
| if ($numbots) { # build the bot list |
| |
| foreach ( sort keys %bot_count ) { |
| |
| $botlist .= qq~$_ ($bot_count{$_}), ~; |
| } |
| } |
| |
| $botlist =~ s/, $//sm; |
| |
| $botlist = qq~<span class="small">$botlist</span>~; |
| } |
| } |
| } |
| |
| elsif ( $iamguest && !$guest_in_log ) { |
| |
| $guests++; |
| |
| } |
| |
| |
| |
| if ($numusers) { |
| if ( !$INFO{'catselect'} ) { |
| $users =~ s~, \Z~~; |
| $yytitle = $boardindex_txt{'18'}; |
| $users .= qq~<br />~; |
| } |
| } |
| else { |
| if ($guestlist) { # build the guest list |
| ( $tmpcat, $tmpmod, $tmpcol ) = |
| $guestlist =~ s/, $//; |
| split /\|/xsm, $catinfo{ $INFO{'catselect'} }; |
| $guestlist = qq~<span class="small">$guestlist</span><br />~; |
| ToChars($tmpcat); |
| |
| $yytitle = qq~$tmpcat~; |
| |
| $yynavigation = qq~› $tmpcat~; |
| |
| } |
| |
| |
| |
| if ( !$iamguest ) { Collapse_Load(); } |
| } |
| } |
| if ($numbots) { # build the bot list |
| |
| foreach ( sort keys(%bot_count) ) { |
| else { |
| $botlist .= qq~$_ ($bot_count{$_}), ~; |
| foreach (@logentries) { |
| |
| ( $name, $date1, $last_ip, $last_host, undef, $boardv, undef ) = |
| |
| split /\|/xsm, $_, 7; |
| |
| if ($name) { |
| |
| if ( -e "$memberdir/$name.vars" ) { |
| |
| LoadUser( $name, 'vars'); |
| |
| if ( $iamadmin || $iamgmod || $iamfmod ) { |
| |
| $numusers++; |
| |
| $bvusers{$boardv}++; |
| |
| } |
| |
| } |
| |
| else { |
| |
| if ( $name eq $user_ip ) { $guest_in_log = 1; } |
| |
| $guests++; |
| |
| $bvusers{$boardv}++; |
| |
| } |
| |
| } |
| } |
| } |
| $botlist =~ s/, $//; |
| |
| $botlist = qq~<span class="small">$botlist</span>~; |
| |
| } |
| } |
| |
| |
| if ( !$INFO{'catselect'} ) { |
| my @tmplist; |
| $yytitle = $boardindex_txt{'18'}; |
| if ($subboard_sel) { |
| |
| push @tmplist, $subboard_sel; |
| } |
| } |
| else { |
| else { |
| ( $tmpcat, $tmpmod, $tmpcol ) = |
| push @tmplist, @categoryorder; |
| split( /\|/, $catinfo{ $INFO{'catselect'} } ); |
| |
| &ToChars($tmpcat); |
| |
| $yytitle = qq~$tmpcat~; |
| |
| $yynavigation = qq~› $tmpcat~; |
| |
| } |
| } |
| |
| |
| if ( !$iamguest ) { &Collapse_Load; } |
| # first get all the boards based on the categories found in forum.master or the provided sub board |
| |
| foreach my $catid (@tmplist) { |
| # first get all the boards based on the categories found in forum.master |
| if ( $INFO{'catselect'} ne $catid |
| foreach $catid (@categoryorder) { |
| && $INFO{'catselect'} |
| if ( $INFO{'catselect'} ne $catid && $INFO{'catselect'} ) { next; } |
| && !$subboard_sel ) |
| $boardlist = $cat{$catid}; |
| { |
| (@bdlist) = split( /\,/, $boardlist ); |
| next; |
| my ( $catname, $catperms, $catallowcol ) = |
| } |
| split( /\|/, $catinfo{"$catid"} ); |
| |
| |
| |
| # Category Permissions Check |
| |
| my $access = &CatAccess($catperms); |
| |
| if ( !$access ) { next; } |
| |
| $cat_boardcnt{$catid} = 0; |
| |
| |
| |
| # next determine all the boards a user has access to |
| # get boards in category if we're not looking for subboards |
| foreach $curboard (@bdlist) { |
| if ( !$subboard_sel ) { |
| |
| (@bdlist) = split /\,/xsm, $cat{$catid}; |
| |
| my ( $catname, $catperms, $catallowcol ) = |
| |
| split /\|/xsm, $catinfo{$catid}; |
| |
| |
| |
| # Category Permissions Check |
| |
| my $access = CatAccess($catperms); |
| |
| if ( !$access ) { next; } |
| |
| $cat_boardcnt{$catid} = 0; |
| |
| } |
| |
| else { |
| |
| (@bdlist) = split /\|/xsm, $subboard{$catid}; |
| |
| } |
| |
| |
| # now fill all the neccesary hashes to show all board index stuff |
| foreach my $curboard (@bdlist) { |
| if ( !exists $board{$curboard} ) { |
| if ( !exists $board{$curboard} ) { |
| &gostRemove( $catid, $curboard ); |
| gostRemove( $catid, $curboard ); |
| next; |
| next; |
| } |
| } |
| |
| |
| # hide the actual global announcement board for all normal users but admins and gmods |
| # hide the actual global announcement board for all normal users but admins and gmods |
| if ( $annboard eq $curboard && !$iamadmin && !$iamgmod ) { next; } |
| if ( $annboard eq $curboard |
| |
| && !$iamadmin |
| |
| && !$iamgmod |
| |
| && !$iamfmod ) |
| |
| { |
| |
| next; |
| |
| } |
| my ( $boardname, $boardperms, $boardview ) = |
| my ( $boardname, $boardperms, $boardview ) = |
| split( /\|/, $board{"$curboard"} ); |
| split /\|/xsm, $board{$curboard}; |
| my $access = &AccessCheck( $curboard, '', $boardperms ); |
| my $access = AccessCheck( $curboard, q{}, $boardperms ); |
| if ( !$iamadmin && $access ne "granted" && $boardview != 1 ) { |
| if ( !$iamadmin && $access ne 'granted' && $boardview != 1 ) { |
| next; |
| next; |
| } |
| } |
| push( @goodboards, "$catid|$curboard" ); |
| |
| push( @loadboards, $curboard ); |
| # Now check subboards that won't be displayed but we need their latest info |
| $cat_boardcnt{$catid}++; |
| if ( $subboard{$curboard} ) { |
| |
| |
| |
| # recursively check access to all sub boards then add them to load list |
| |
| *recursive_boards = sub { |
| |
| foreach my $childbd (@_) { |
| |
| |
| |
| # now fill all the necessary hashes to show all board index stuff |
| |
| if ( !exists $board{$childbd} ) { |
| |
| gostRemove( $catid, $childbd ); |
| |
| next; |
| |
| } |
| |
| |
| |
| # hide the actual global announcement board for all normal users but admins and gmods |
| |
| if ( $annboard eq $childbd |
| |
| && !$iamadmin |
| |
| && !$iamgmod |
| |
| && !$iamfmod ) |
| |
| { |
| |
| next; |
| |
| } |
| |
| ( $boardname, $boardperms, $boardview ) = |
| |
| split /\|/xsm, $board{$childbd}; |
| |
| $access = AccessCheck( $childbd, q{}, $boardperms ); |
| |
| if ( !$iamadmin |
| |
| && $access ne 'granted' |
| |
| && $boardview != 1 ) |
| |
| { |
| |
| next; |
| |
| } |
| |
| |
| |
| # add it to list of boards to load data |
| |
| push @loadboards, $childbd; |
| |
| |
| |
| # make recursive call if this board has more children |
| |
| if ( $subboard{$childbd} ) { |
| |
| recursive_boards( split /\|/xsm, |
| |
| $subboard{$childbd} ); |
| |
| } |
| |
| } |
| |
| }; |
| |
| recursive_boards( split /\|/xsm, $subboard{$curboard} ); |
| |
| } |
| |
| |
| |
| # if it's a sub board don't add to category count |
| |
| if ( !${ $uid . $curboard }{'parent'} ) { |
| |
| $cat_boardcnt{$catid}++; |
| |
| } |
| |
| |
| |
| push @goodboards, "$catid|$curboard"; |
| |
| push @loadboards, $curboard; |
| } |
| } |
| } |
| } |
| |
| |
| &BoardTotals( "load", @loadboards ); |
| BoardTotals( 'load', @loadboards ); |
| &getlog; |
| getlog(); |
| my $dmax = $date - ( $max_log_days_old * 86400 ); |
| my $dmax = $date - ( $max_log_days_old * 86400 ); |
| |
| |
| # showcase poll start |
| # if loading subboard list by ajax we don't need this (Ajax showcasepoll load does not work, assume this is mistake. DAR) |
| |
| |
| my $polltemp; |
| my $polltemp; |
| if ( -e "$datadir/showcase.poll" ) { |
| if ( -e "$datadir/showcase.poll" ) { |
| fopen( SCPOLLFILE, "$datadir/showcase.poll" ); |
| fopen( SCPOLLFILE, "$datadir/showcase.poll" ); |
| my $scthreadnum = <SCPOLLFILE>; |
| my $scthreadnum = <SCPOLLFILE>; |
| fclose(SCPOLLFILE); |
| fclose(SCPOLLFILE); |
| |
| |
| # Look for a valid poll file. |
| # Look for a valid poll file. |
| my $pollthread; |
| my $pollthread; |
| if ( -e "$datadir/$scthreadnum.poll" ) { |
| if ( -e "$datadir/$scthreadnum.poll" ) { |
| &MessageTotals( "load", $scthreadnum ); |
| MessageTotals( 'load', $scthreadnum ); |
| if ( $iamadmin || $iamgmod ) { |
| if ( $iamadmin || $iamgmod || $iamfmod ) { |
| $pollthread = 1; |
| $pollthread = 1; |
| } |
| } |
| else { |
| else { |
| my $curcat = ${ $uid . ${$scthreadnum}{'board'} }{'cat'}; |
| my $curcat = ${ $uid . ${$scthreadnum}{'board'} }{'cat'}; |
| my $catperms = ( split /\|/, $catinfo{$curcat} )[1]; |
| my $catperms = ( split /\|/xsm, $catinfo{$curcat} )[1]; |
| $pollthread = 1 if &CatAccess($catperms); |
| if ( CatAccess($catperms) ) { $pollthread = 1; } |
| my $boardperms = |
| my $boardperms = |
| ( split /\|/, $board{ ${$scthreadnum}{'board'} } )[1]; |
| ( split /\|/xsm, $board{ ${$scthreadnum}{'board'} } )[1]; |
| $pollthread = |
| $pollthread = |
| &AccessCheck( ${$scthreadnum}{'board'}, '', $boardperms ) eq |
| AccessCheck( ${$scthreadnum}{'board'}, q{}, $boardperms ) eq |
| 'granted' ? $pollthread : 0; |
| 'granted' ? $pollthread : 0; |
| } |
| } |
| |
| if ( ${ $uid . $scboard }{'brdpasswr'} && !$iamadmin && !$iamgmod ) |
| |
| { |
| |
| my $pswiammod = 0; |
| |
| my $bdmods = ${ $uid . $curboard }{'mods'}; |
| |
| $bdmods =~ s/\, /\,/gsm; |
| |
| $bdmods =~ s/\ /\,/gsm; |
| |
| foreach my $curuser ( split /\,/xsm, $bdmods ) { |
| |
| if ( $username eq $curuser ) { $pswiammod = 1; last; } |
| |
| } |
| |
| my $bdmodgroups = ${ $uid . $scboard }{'modgroups'}; |
| |
| $bdmodgroups =~ s/\, /\,/gsm; |
| |
| foreach my $curgroup ( split /\,/xsm, $bdmodgroups ) { |
| |
| if ( ${ $uid . $username }{'position'} eq $curgroup ) { |
| |
| $pswiammod = 1; |
| |
| last; |
| |
| } |
| |
| foreach my $memberaddgroups ( split /\, /xsm, |
| |
| ${ $uid . $username }{'addgroups'} ) |
| |
| { |
| |
| chomp $memberaddgroups; |
| |
| if ( $memberaddgroups eq $curgroup ) { |
| |
| $pswiammod = 1; |
| |
| last; |
| |
| } |
| |
| } |
| |
| } |
| |
| my $bpasscookie = |
| |
| "$cookiepassword$scboard$username$cookieother_name"; |
| |
| my $crypass = ${ $uid . $scboard }{'brdpassw'}; |
| |
| if ( !$pswiammod && $yyCookies{$bpasscookie} ne $crypass ) { |
| |
| $pollthread = 0; |
| |
| } |
| |
| } |
| } |
| } |
| |
| |
| if ($pollthread) { |
| if ($pollthread) { |
| my $tempcurrentboard = $currentboard; |
| my $tempcurrentboard = $currentboard; |
| $currentboard = ${$scthreadnum}{'board'}; |
| $currentboard = ${$scthreadnum}{'board'}; |
| my $tempmod = $iammod; |
| my $tempstaff = $staff; |
| $iammod = 0; |
| if ( !$iamadmin && !$iamgmod && !$iamfmod ) { $staff = 0; } |
| require "$sourcedir/Poll.pl"; |
| require Sources::Poll; |
| &display_poll( $scthreadnum, 1 ); |
| display_poll( $scthreadnum, 1 ); |
| $iammod = $tempmod; |
| $staff = $tempstaff; |
| $polltemp = |
| $polltemp = $pollmain . '<br />'; |
| qq~<script language="JavaScript1.2" src="$yyhtml_root/ubbc.js" type="text/javascript"></script>~ |
| |
| . $pollmain |
| |
| . '<br />'; |
| |
| $currentboard = $tempcurrentboard; |
| $currentboard = $tempcurrentboard; |
| } |
| } |
| } |
| } |
| |
| |
| # showcase poll end |
| # showcase poll end |
| |
| |
| foreach $curboard (@loadboards) { |
| foreach my $curboard (@loadboards) { |
| chomp $curboard; |
| chomp $curboard; |
| $lastposttime = ${ $uid . $curboard }{'lastposttime'}; |
| |
| ${ $uid . $curboard }{'lastposttime'} = |
| |
| ( ${ $uid . $curboard }{'lastposttime'} eq 'N/A' |
| |
| || !${ $uid . $curboard }{'lastposttime'} ) |
| |
| ? $boardindex_txt{'470'} |
| |
| : ${ $uid . $curboard }{'lastposttime'}; |
| |
| if ( ${ $uid . $curboard }{'lastposttime'} > 0 ) { |
| |
| $lastposttime{$curboard} = |
| |
| &timeformat( ${ $uid . $curboard }{'lastposttime'} ); |
| |
| } |
| |
| else { $lastposttime{$curboard} = $boardindex_txt{'470'}; } |
| |
| $lastpostrealtime{$curboard} = |
| |
| ( ${ $uid . $curboard }{'lastposttime'} eq 'N/A' |
| |
| || !${ $uid . $curboard }{'lastposttime'} ) |
| |
| ? 0 |
| |
| : ${ $uid . $curboard }{'lastposttime'}; |
| |
| $lsreply{$curboard} = ${ $uid . $curboard }{'lastreply'} + 1; |
| |
| if ( ${ $uid . $curboard }{'lastposter'} =~ m~\AGuest-(.*)~ ) { |
| |
| ${ $uid . $curboard }{'lastposter'} = $1 . " ($maintxt{'28'})"; |
| |
| $lastposterguest{$curboard} = 1; |
| |
| } |
| |
| ${ $uid . $curboard }{'lastposter'} = |
| |
| ${ $uid . $curboard }{'lastposter'} eq 'N/A' |
| |
| || !${ $uid . $curboard }{'lastposter'} |
| |
| ? $boardindex_txt{'470'} |
| |
| : ${ $uid . $curboard }{'lastposter'}; |
| |
| ${ $uid . $curboard }{'messagecount'} = |
| |
| ${ $uid . $curboard }{'messagecount'} || 0; |
| |
| ${ $uid . $curboard }{'threadcount'} = |
| |
| ${ $uid . $curboard }{'threadcount'} || 0; |
| |
| $totalm += ${ $uid . $curboard }{'messagecount'}; |
| |
| $totalt += ${ $uid . $curboard }{'threadcount'}; |
| |
| |
| |
| # hide hidden threads for ordinary members and guests |
| my $iammodhere = q{}; |
| my $iammodhere = ''; |
| foreach my $curuser ( split /, ?/sm, ${ $uid . $curboard }{'mods'} ) { |
| foreach my $curuser ( split( /, ?/, ${ $uid . $curboard }{'mods'} ) ) { |
| |
| if ( $username eq $curuser ) { $iammodhere = 1; } |
| if ( $username eq $curuser ) { $iammodhere = 1; } |
| } |
| } |
| foreach |
| foreach |
| my $curgroup ( split( /, /, ${ $uid . $curboard }{'modgroups'} ) ) |
| my $curgroup ( split /, /sm, ${ $uid . $curboard }{'modgroups'} ) |
| { |
| { |
| if ( ${ $uid . $username }{'position'} eq $curgroup ) { |
| if ( ${ $uid . $username }{'position'} eq $curgroup ) { |
| $iammodhere = 1; |
| $iammodhere = 1; |
| } |
| } |
| foreach ( split( /,/, ${ $uid . $username }{'addgroups'} ) ) { |
| foreach ( split /,/xsm, ${ $uid . $username }{'addgroups'} ) { |
| if ( $_ eq $curgroup ) { $iammodhere = 1; last; } |
| if ( $_ eq $curgroup ) { $iammodhere = 1; last; } |
| } |
| } |
| } |
| } |
| |
| |
| |
| # if this is a parent board and it can't be posted in, set lastposttime to 0 so subboards will show latest data |
| |
| if ( $subboard{$curboard} && !${ $uid . $curboard }{'canpost'} ) { |
| |
| ${ $uid . $curboard }{'lastposttime'} = 0; |
| |
| } |
| |
| |
| |
| $lastposttime = ${ $uid . $curboard }{'lastposttime'}; |
| |
| |
| |
| # hide hidden threads for ordinary members and guests in all loaded boards |
| if ( !$iammodhere |
| if ( !$iammodhere |
| && !$iamadmin |
| && !$iamadmin |
| && !$iamgmod |
| && !$iamgmod |
| && ${ $uid . $curboard }{'lasttopicstate'} =~ /h/i ) |
| && !$iamfmod |
| |
| && ${ $uid . $curboard }{'lasttopicstate'} =~ /h/ism ) |
| { |
| { |
| ${ $uid . $curboard }{'lastpostid'} = ''; |
| ${ $uid . $curboard }{'lastpostid'} = q{}; |
| ${ $uid . $curboard }{'lastsubject'} = ''; |
| ${ $uid . $curboard }{'lastsubject'} = q{}; |
| ${ $uid . $curboard }{'lastreply'} = ''; |
| ${ $uid . $curboard }{'lastreply'} = q{}; |
| ${ $uid . $curboard }{'lastposter'} = $boardindex_txt{'470'}; |
| ${ $uid . $curboard }{'lastposter'} = $boardindex_txt{'470'}; |
| ${ $uid . $curboard }{'lastposttime'} = ''; |
| ${ $uid . $curboard }{'lastposttime'} = q{}; |
| $lastposttime{$curboard} = $boardindex_txt{'470'}; |
| $lastposttime{$curboard} = $boardindex_txt{'470'}; |
| |
| my ( $messageid, $messagestate ); |
| fopen( MNUM, "$boardsdir/$curboard.txt" ); |
| fopen( MNUM, "$boardsdir/$curboard.txt" ); |
| my @threadlist = <MNUM>; |
| my @threadlist = <MNUM>; |
| fclose(MNUM); |
| fclose(MNUM); |
| my ( $messageid, $messagestate ); |
| |
| |
| |
| foreach (@threadlist) { |
| foreach (@threadlist) { |
| ( |
| ( |
| $messageid, undef, undef, undef, undef, |
| $messageid, undef, undef, undef, undef, |
| undef, undef, undef, $messagestate |
| undef, undef, undef, $messagestate |
| ) = split( /\|/, $_ ); |
| ) = split /\|/xsm, $_; |
| if ( $messagestate !~ /h/i ) { |
| if ( $messagestate !~ /h/ism ) { |
| fopen( FILE, "$datadir/$messageid.txt" ) || next; |
| fopen( FILE, "$datadir/$messageid.txt" ) || next; |
| my @lastthreadmessages = <FILE>; |
| my @lastthreadmessages = <FILE>; |
| fclose(FILE); |
| fclose(FILE); |
| my @lastmessage = |
| my @lastmessage = split /\|/xsm, $lastthreadmessages[-1], 6; |
| split( /\|/, $lastthreadmessages[$#lastthreadmessages], |
| |
| 6 ); |
| |
| ${ $uid . $curboard }{'lastpostid'} = $messageid; |
| ${ $uid . $curboard }{'lastpostid'} = $messageid; |
| ${ $uid . $curboard }{'lastsubject'} = $lastmessage[0]; |
| ${ $uid . $curboard }{'lastsubject'} = $lastmessage[0]; |
| ${ $uid . $curboard }{'lastreply'} = $#lastthreadmessages; |
| ${ $uid . $curboard }{'lastreply'} = $#lastthreadmessages; |
| ${ $uid . $curboard }{'lastposter'} = |
| ${ $uid . $curboard }{'lastposter'} = |
| $lastmessage[4] eq "Guest" |
| $lastmessage[4] eq 'Guest' |
| ? qq~Guest-$lastmessage[1]~ |
| ? qq~Guest-$lastmessage[1]~ |
| : $lastmessage[4]; |
| : $lastmessage[4]; |
| ${ $uid . $curboard }{'lastposttime'} = $lastmessage[3]; |
| ${ $uid . $curboard }{'lastposttime'} = $lastmessage[3]; |
| $lastposttime{$curboard} = &timeformat( $lastmessage[3] ); |
| $lastposttime{$curboard} = timeformat( $lastmessage[3] ); |
| |
| $lastposttime{$curboard2} = timeformat( $lastmessage[3],0,0,0,1 ); |
| last; |
| last; |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| |
| ${ $uid . $curboard }{'lastposttime'} = |
| |
| ( ${ $uid . $curboard }{'lastposttime'} eq 'N/A' |
| |
| || !${ $uid . $curboard }{'lastposttime'} ) |
| |
| ? $boardindex_txt{'470'} |
| |
| : ${ $uid . $curboard }{'lastposttime'}; |
| |
| if ( ${ $uid . $curboard }{'lastposttime'} ne 'N/A' |
| |
| && ${ $uid . $curboard }{'lastposttime'} > 0 ) |
| |
| { |
| |
| $lastposttime{$curboard} = |
| |
| timeformat( ${ $uid . $curboard }{'lastposttime'} ); |
| |
| $lastposttime{$curboard2} = |
| |
| timeformat( ${ $uid . $curboard }{'lastposttime'},0,0,0,1 ); |
| |
| } |
| |
| else { $lastposttime{$curboard} = $boardindex_txt{'470'}; } |
| |
| |
| |
| $lastpostrealtime{$curboard} = |
| |
| ( ${ $uid . $curboard }{'lastposttime'} eq 'N/A' |
| |
| || !${ $uid . $curboard }{'lastposttime'} ) |
| |
| ? 0 |
| |
| : ${ $uid . $curboard }{'lastposttime'}; |
| |
| |
| |
| $lsreply{$curboard} = ${ $uid . $curboard }{'lastreply'} + 1; |
| |
| if ( ${ $uid . $curboard }{'lastposter'} =~ m{\AGuest-(.*)}xsm ) { |
| |
| ${ $uid . $curboard }{'lastposter'} = $1 . " ($maintxt{'28'})"; |
| |
| $lastposterguest{$curboard} = 1; |
| |
| } |
| |
| |
| |
| ${ $uid . $curboard }{'lastposter'} = |
| |
| ${ $uid . $curboard }{'lastposter'} eq 'N/A' |
| |
| || !${ $uid . $curboard }{'lastposter'} |
| |
| ? $boardindex_txt{'470'} |
| |
| : ${ $uid . $curboard }{'lastposter'}; |
| |
| |
| |
| ${ $uid . $curboard }{'messagecount'} = |
| |
| ${ $uid . $curboard }{'messagecount'} || 0; |
| |
| |
| |
| ${ $uid . $curboard }{'threadcount'} = |
| |
| ${ $uid . $curboard }{'threadcount'} || 0; |
| |
| |
| |
| $totalm += ${ $uid . $curboard }{'messagecount'}; |
| |
| $totalt += ${ $uid . $curboard }{'threadcount'}; |
| |
| |
| |
| if ( |
| |
| !$iamguest |
| |