############################################################################### # BoardIndex.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Project started by Zef Hemel (zef@zefnet.com) # # Software Version: YaBB 1 Gold - Release # # =========================================================================== # # Software Distributed by: http://yabb.xnull.com # # Support, News, Updates at: http://yabb.xnull.com/community/ # # =========================================================================== # # Copyright (c) 2000-2001 X-Null - All Rights Reserved # # Software by: The YaBB Development Team # ############################################################################### $boardindexplver="1 Gold - Release"; sub BoardIndex { # Open the file with all categories fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); my( $memcount, $latestmember ) = &MembershipGet; &LoadUser($latestmember); $thelatestmember = qq~$txt{'201'} $userprofile{$latestmember}->[1]$txt{'581'}~; $totalm = 0; $totalt = 0; for( $catnum = 0; $catnum < @categories; $catnum++ ) { chomp $categories[$catnum]; $curcat = $categories[$catnum]; fopen(FILE, "$boardsdir/$curcat.cat"); $catname{$curcat} = ; chomp $catname{$curcat}; $cataccess{$curcat} = ; chomp $cataccess{$curcat}; @{$catboards{$curcat}} = ; fclose(FILE); @membergroups = split( /,/, $cataccess{$curcat} ); $openmemgr{$curcat} = 0; foreach $tmpa (@membergroups) { if( $tmpa eq $settings[7]) { $openmemgr{$curcat} = 1; last; } } if( ! $cataccess{$curcat} || $settings[7] eq 'Administrator' ) { $openmemgr{$curcat} = 1; } unless( $openmemgr{$curcat} ) { next; } foreach $curboard (@{$catboards{$curcat}}) { chomp $curboard; ( $threadcount, $messagecount, $lastposttime, $lastposter ) = &BoardCountGet($curboard); $lastposttime{$curboard} = $lastposttime eq 'N/A' || ! $lastposttime ? $txt{'470'} : &timeformat($lastposttime); $lastpostrealtime{$curboard} = $lastposttime eq 'N/A' || ! $lastposttime ? '' : $lastposttime; if( $lastposter =~ m~\AGuest-(.*)~ ) { $lastposter = $1; $lastposterguest{$curboard} = 1; } $lastposter{$curboard} = $lastposter eq 'N/A' || ! $lastposter ? $txt{'470'} : $lastposter; $messagecount{$curboard} = $messagecount || 0; $threadcount{$curboard} = $threadcount || 0; $totalm += $messagecount; $totalt += $threadcount; } } $yytitle = "$txt{'18'}"; &header; $curforumurl = $curposlinks ? qq~$mbname~ : $mbname; print <<"EOT";
$curforumurl $txt{'19'}: $memcount  •  $txt{'95'} $totalm  •  $txt{'64'} $totalt EOT if ($showlatestmember == 1) { print <<"EOT";
$thelatestmember
EOT } print <<"EOT";
EOT if($shownewsfader == 1) { if(!$fadertime) { $fadertime = 5; } print <<"EOT";
$txt{'102'}
EOT } print <<"EOT"; EOT foreach $curcat (@categories) { unless( $openmemgr{$curcat} ) { next; } print <<"EOT"; EOT foreach $curboard (@{$catboards{$curcat}}) { chomp $curboard; fopen(FILE, "$boardsdir/$curboard.dat"); $curboardname = ; chomp $curboardname; $curboarddescr = ; chomp $curboarddescr; $curboardmods = ; chomp $curboardmods; fclose(FILE); %moderators = (); foreach $curuser (split(/\|/, $curboardmods)) { &LoadUser($curuser); $moderators{$curuser} = $userprofile{$curuser}->[1]; } $showmods = ''; if( scalar keys %moderators == 1 ) { $showmods = qq~$txt{'298'}: ~; } elsif( scalar keys %moderators != 0) { $showmods = qq~$txt{'299'}: ~; } while( $tmpa = each(%moderators) ) { &FormatUserName($tmpa); $showmods .= qq~$moderators{$tmpa}, ~; } $showmods =~ s/, \Z//; if($showmods eq '') { $showmods = qq~$txt{'298'}: $txt{'470'}~; } $dlp = &getlog($curboard); if( $max_log_days_old && $lastposttime{$curboard} ne $txt{'470'} && $username ne 'Guest' && $dlp < stringtotime( $lastpostrealtime{$curboard} ) ) { $new = qq~$txt{'333'}~; } else { $new = qq~$txt{'334'}~; } $lastposter = $lastposter{$curboard}; unless( $lastposterguest{$curboard} || $lastposter{$curboard} eq $txt{'470'} ) { $lastposterid = $lastposter; &LoadUser($lastposterid); if($userprofile{$lastposter}->[1]) { $lastposter = qq~$userprofile{$lastposter}->[1]~; } } $lastposter ||= $txt{'470'}; $lastposttime ||= $txt{'470'}; print <<"EOT"; EOT } } $guests = 0; $users = ''; fopen(FILE, "$vardir/log.txt"); @entries = ; fclose(FILE); foreach $curentry (@entries) { chomp $curentry; ($name, $value) = split(/\|/, $curentry); if( $name ) { &LoadUser($name); if( exists $userprofile{$name} ) { $users .= qq~ $userprofile{$name}->[1], \n~; } else { ++$guests; } } } $users =~ s~, \n\Z~~; if( $username ne 'Guest' ) { $messnum = @immessages; print <<"EOT"; EOT } print <<"EOT";
$txt{'20'} $txt{'330'} $txt{'21'} $txt{'22'}
« $catname{$curcat} »
$new $curboardname
$curboarddescr

» $showmods
$threadcount{$curboard} $messagecount{$curboard} $lastposttime{$curboard}
$txt{'525'} $lastposter
$txt{'333'}    $txt{'334'}   EOT if($showmarkread) { print qq~ $img{'markallread'}~; } print <<"EOT";


EOT if($Show_RecentBar == 1) { print <<"EOT"; EOT } if($Show_MemberBar == 1) { print <<"EOT"; EOT } print <<"EOT"; EOT if( $username ne 'Guest' ) { print <<"EOT"; EOT } if( $username eq 'Guest' ) { print <<"EOT"; EOT } print <<"EOT";
$txt{'685'}
» $txt{'214'}
$txt{'214'}
EOT require "$sourcedir/Recent.pl"; &LastPost; print <<"EOT";
» $txt{'331'}
$txt{'332'}
$txt{'200'}
» $txt{'158'}
$txt{'141'}: $guests
$txt{'142'}: $users
» $txt{'159'}
$txt{'159'}
$txt{'660'} $messnum EOT if($messnum == 1) { print $txt{'471'}; } else { print $txt{'153'}; } print <<"EOT"; .... $txt{'661'} $txt{'662'} $txt{'663'}
» $txt{'34'} ($txt{'315'})

$txt{'35'}: $txt{'36'}: $txt{'497'}:   $txt{'508'}:
EOT &footer; exit; } sub MarkAllRead { fopen(FILE, "$vardir/cat.txt"); my @categories = ; fclose(FILE); my( $curcat, $curcatname, $curcataccess, @catboards, @membergroups, $openmemgr, $curboard ); foreach $curcat (@categories) { chomp $curcat; fopen(FILE, "$boardsdir/$curcat.cat"); $curcatname = ; $curcataccess = ; chomp $curcatname; chomp $curcataccess; @catboards = ; fclose(FILE); @membergroups = split( /,/, $curcataccess ); $openmemgr = 0; foreach (@membergroups) { if( $_ eq $settings[7]) { $openmemgr = 1; last; } } if( ! $curcataccess || $settings[7] eq 'Administrator' ) { $openmemgr = 1; } unless( $openmemgr ) { next; } foreach $curboard (@catboards) { chomp $curboard; &modlog("$curboard--mark"); &modlog($curboard); } } &dumplog; &BoardIndex; } 1;