############################################################################### # BoardIndex.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 1 Gold - SP 1.3 # # Released: December 2001; Updated April 6, 2003 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2003 YaBB (www.yabbforum.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # # Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com # ############################################################################### $boardindexplver = "1 Gold - SP 1.3"; sub BoardIndex { #RECENT USERS LIST MOD START if ($username ne 'Guest' && $action ne 'login2') { require "$sourcedir/LogInOut.pl"; &RecentUsersList; } #RECENT USERS LIST MOD END require "$vardir/shoutbox_vars.pl"; $shout_rowspan = ($username eq 'Guest') ? $shout_rowspan : $shout_rowspan - 2; # Open the file with all categories fopen(FILE, "$vardir/cat.txt"); @categories = ; fclose(FILE); $yyCatsLoaded = 1; my($memcount, $latestmember) = &MembershipGet; $totalm = 0; $totalt = 0; foreach $curcat (@categories) { chomp $curcat; 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; my($mscount); $mscount=0; foreach $tmpa (@membergroups) { if( $tmpa eq $settings[7]) { $openmemgr{$curcat} = 1; last; } while($MemStat[$mscount]) { if($settings[6] >= $MemPostNum[$mscount] && $MemPostNum[$mscount] ne "x") { $memberinfo = "$MemStat[$mscount]"; } ++$mscount; } if ( $memberinfo eq $tmpa ) { $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; } } $curforumurl = $curposlinks ? qq~$mbname~ : $mbname; #RECENT USERS LIST MOD START if ($rul_show_avatars && ($rul_avatar_width || $rul_avatar_height)) { $yymain .= qq~ ~; } #RECENT USERS LIST MOD END $yymain .= qq~

$curforumurl~; if($shownewsfader == 1) { if(!$fadedelay) { $fadedelay = 5000; } $yymain .= qq~
$txt{'102'}
~; } ########showcase poll start # Look for a showcase.poll file. if (-e "$datadir/showcase.poll") { my ($board, $viewnum); fopen (FILE, "$datadir/showcase.poll"); @showdata = ; fclose (FILE); $showcasepoll = $showdata[0]; $showcasepoll =~ s~\n~~g; ($scboard, $viewnum) = split(/\|/, $showcasepoll); # Look for a valid poll file. if (-e "$datadir/$viewnum.poll") { $pollthread = 1; unless( &BoardAccessGet($scboard) ) { $pollthread = 0; } } if ($pollthread) { $yymain .= qq~~; require "$sourcedir/Poll.pl"; &display_poll($viewnum, 1, $scboard); } } #########showcase poll end $yymain .= qq~
~; foreach $curcat (@categories) { unless( $openmemgr{$curcat} ) { next; } $yymain .= qq~~; 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'}; $yymain .= qq~~; } } my $checkadded = 0; $guests = 0; $users = ''; $numusers = 0; fopen(FILE, "$vardir/log.txt"); @entries = ; fclose(FILE); foreach $curentry (@entries) { chomp $curentry; ($name, $value) = split(/\|/, $curentry); if($name) { if(!$yyUDLoaded{$musername}) { &LoadUser($name); } if(exists $userprofile{$name}) { $numusers++; $users .= qq~ $userprofile{$name}->[1], \n~; } else { $guests++; } } } $users =~ s~, \n\Z~~; if($username ne 'Guest') { $ims = @immessages; ### AIMB START ### if($userimcfg[5] eq "on") { $yymain .= qq~~; } else { $yymain .= qq~~; } if ($minnum == $numibox && $enable_imlimit) { $yymain .= qq~~; } if ($minnum > $numibox && $numibox ne "" && $enable_imlimit == 1) { $yymain .= qq~~; &Del_Max_IM; } if ($moutnum > $numobox && $numobox ne "" && $enable_imlimit == 1) { $yymain .= qq~~; &Del_Max_IMOUT; } if ($storenum > $numstore && $numstore ne "" && $enable_imlimit == 1) { $yymain .= qq~~; &Del_Max_STORE; } $ims = qq~
$txt{'796'} $ims $imtxt{'24'}: $imnewcount~; ### AIMB END ### $yymain .= qq~
~; } #set the correct rowspan for the RECENT USERS LIST main cell $rul_rowspan = ($username eq 'Guest') ? $rul_rowspan : $rul_rowspan - 2; $yymain .= qq~
$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{'333'}   $txt{'334'} $txt{'334'}   ~; if($showmarkread) { $yymain .= qq~$img{'markallread'}~; } $yymain .= qq~


~; $yymain .= qq~~; if($username eq 'Guest') { require "$sourcedir/LogInOut.pl"; $sharedLogin_title="$txt{'34'} ($txt{'315'})"; &sharedLogin; } $yymain .= qq~
$txt{'685'} $rul_users_display $rul_txt{'1'}
$txt{'200'} ~; &RecentUsersListShow; $yymain .= qq~
~; require "$sourcedir/Shoutbox.pl"; &ShoutBox; $yymain .= qq~
$txt{'200'} ~; &RecentUsersListShow; $yymain .= qq~
$txt{'490'} $totalt   -   $txt{'489'} $totalm ~; if($Show_RecentBar) { require "$sourcedir/Recent.pl"; &LastPost; } $yymain .= qq~ $txt{'488'} $memcount ~; if ($showlatestmember) { &LoadUser($latestmember); $yymain .= qq~
$txt{'201'}: $userprofile{$latestmember}->[1]~; } $yymain .= qq~ $ims
$txt{'158'}
$guests $txt{'141'}, $numusers $txt{'142'}
$users
~; if($imnewcount > 0 && $enable_mailpopup == 1) { if($imnewcount > 1) { $en = "s"; $en2 = "$imtxt{'47'}"; } else { $en = ""; $en2 = "$imtxt{'48'}"; } open(FILE, "$memberdir/$username.imconfig"); @imuserdata = ; close(FILE); chomp($imuserdata[3]); chomp($imuserdata[5]); if($imuserdata[3] eq "on") { if($imuserdata[5] eq "on") { $yymain .= qq~ ~; } else { $yymain .= qq~ ~; } $yymain .= qq~ ~; } } $yytitle = "$txt{'18'}"; &template; exit; } #RECENT USERS LIST #v1.4 #OUTPUTS A TABLE WITH $rul_users_display ROWS - ONE FOR EACH USER IN THE LIST sub RecentUsersListShow { fopen(FILE, "$vardir/lastuseronline.txt"); @lastusers = ; fclose(FILE); chomp @lastusers; $counter = 1; $yymain .= qq~~; foreach $lastuser_line (@lastusers) { ($last_username, $last_userwhen) = split(/\|/, $lastuser_line); #is this user online now? $online_now = ($users =~ /username=$last_username"/) ? "
$rul_txt{'2'}" : ''; #it should never happen, but a Guest entry might have been stored in the file. this avoids showing it if (fopen(MFILE, "$memberdir/$last_username.dat")) { @memberinfo = ; fclose(MFILE); chomp @memberinfo; $last_userwhen = ($rul_show_time) ? '
' . &timeformat($last_userwhen) : ''; #do we want to show an avatar? if ($rul_show_avatars) { #correct url allowing for custom avatars if ($memberinfo[13] =~ m~\Ahttp://~) { $avatar = $memberinfo[13]; } else { $avatar = $facesurl . '/' . $memberinfo[13]; } #is resizing enabled or shall we just show a plain image tag? #if we're using avatar resizing if ($rul_avatar_width || $rul_avatar_height) { #decide what the avatar link should be if ($rul_avatar_link == 2) { $avatars_cell = qq~
~; } elsif ($rul_avatar_link == 1) { $avatars_cell = qq~~; } else { $avatars_cell = qq~~; } } #else we're not using resizing so just use the normal image tag else { #decide what the avatar link should be if ($rul_avatar_link == 2) { $avatars_cell = qq~~; } elsif ($rul_avatar_link == 1) { $avatars_cell = qq~~; } else { $avatars_cell = qq~~; } } } #else we're not showing avatars, so just show the text counter else { $avatars_cell = qq~~; } #output this row $yymain .= qq~$avatars_cell~; } $counter++; } $yymain .= qq~
$rul_txt{'12'} $memberinfo[1]$rul_txt{'13'} $memberinfo[1]$memberinfo[1]$rul_txt{'12'} $memberinfo[1]$rul_txt{'13'} $memberinfo[1]$memberinfo[1]$counter.
$memberinfo[1]$last_userwhen$online_now
~; } 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;