############################################################################### # 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"; $high_lst = 5; # Set the number of members in the Top-Poster list 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 - 8; # 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; 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; } } $curforumurl = $curposlinks ? qq~$mbname~ : $mbname; if( $enable_favorites && $enable_favdrop && $username ne 'Guest' ) { require "$sourcedir/Favor.pl"; &favordrop; $yymain .= qq~
$favselect

~; } #RECENT USERS LIST MOD START if ($rul_show_avatars && ($rul_avatar_width || $rul_avatar_height)) { $yymain .= qq~ ~; } #RECENT USERS LIST MOD END $yymain .= qq~
~; $yymain .= qq~ ~; $total_posts = 0; foreach $curcat (@categories) { chomp $curcat; fopen(FILE, "$boardsdir/$curcat.cat"); @thiscurcat = ; chomp @thiscurcat; fclose(FILE); foreach $curboard (@thiscurcat) { chomp $curboard; ( $threadcount, $messagecount, $lastposttime, $lastposter ) = &BoardCountGet($curboard); $total_posts += $messagecount; } } my(@templist, @SortAList); fopen(FILE, "$memberdir/memberlist.txt"); @membername = ; $memcount = @membername; fclose(FILE); $z = 0; $total_topposts = 0; for($i=0;$i<$memcount;$i++) { chomp(@membername); $membname = $membername[$i]; fopen(MEMBERFILE,"$memberdir/$membname.dat"); @member = ; fclose(MEMBERFILE); chomp(@member); if($member[6] > 0) { $templist[$z] .= qq($member[6]|$member[1]|$membname); $z++; } } @SortAList = sort{$b<=>$a} (@templist); $pstmem = @SortAList; if($pstmem > $high_lst) { $pstmem = $high_lst } if($pstmem > 0) { $yymain .= qq~ ~; } $yymain .= qq~ ~; if( $tellfriendshowbottom == '1') { if($username ne 'Guest') {$yymain .= qq~ ~; } } ########### Newcalendar mod start ####################### chomp $newcalgroup; @newcalgrouplist = split(",",$newcalgroup); $newcalgroupflag = 0; foreach $newcalgroupitem (@newcalgrouplist) { if ($settings[7] eq $newcalgroupitem) { $newcalgroupflag = 1; } } if ($newcalopen == 1 || $settings[7] eq 'Administrator' || $newcalgroupflag ==1 ) { if ($newcalmoon2 == 1) { require "$sourcedir/MoonPhase.pl"; #This is the moon phase calculator ( $MoonPhase, $MoonIllum, $MoonAge, $MoonDist, $MoonAng, $SunDist, $SunAng ) = phase(); my ($newphaselow) = 0.016666667; my ($newphasehigh) = 0.983333333; my ($phaseincrement) = 0.033333333; if ( ($MoonPhase < $newphaselow) || ($MoonPhase > $newphasehigh) ){ $moonpict = qq~~; } else { $gifnumber = 1; for ($phasescan = $newphaselow; $phasescan < $newphasehigh; $phasescan += $phaseincrement) { if ( ($MoonPhase > $phasescan) && ( $MoonPhase <= ($phasescan + $phaseincrement)) ){ if ($gifnumber < 10) { $moonpict = qq~~; } else { $moonpict = qq~~; } } $gifnumber++; } } } else { $moonpict = qq~~; } $yymain .=qq~ ~; } ########### Newcalendar mod end ####################### 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'}
  ~; &RecentUsersListShow; $yymain .= qq~
~; require "$sourcedir/Shoutbox.pl"; &ShoutBox; $yymain .= qq~
$txt{'200'}  
$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
 
$ecaltxt{'55'}
~; require "$sourcedir/NewcalIndex.pl"; if ($newcalindexmini == 1) { $yymain .=qq~
~; &IndexCal; $yymain .=qq~ ~; require "$sourcedir/NewcalPost.pl"; &MiniCalYY; $yymain .=qq~$yyminical~; $yymain .=qq~
~; } else { &IndexCal; } $yymain .=qq~
$txt{'411'} $pstmem $txt{'306'}  
~; for($i=0;$i<$pstmem;$i++) { $x = $i+1; chomp(@SortAList); ($shposts[$i], $shname[$i], $usname[$i]) = split(/\|/, $SortAList[$i]); $total_topposts = $total_topposts + $shposts[$i]; $Bar = ""; $barchart = ($shposts[$i]); $bartemp = ($shposts[$i] * 100); $barwidth = ($bartemp / $shposts[0]); $barwidth = ($barwidth + 0.5); $barwidth = int($barwidth); if($barwidth > 100) {$barwidth = 100} if ($barwidth < 1) {$Bar = "$Bar";} else { $Bar = qq~~; } if ($Bar eq "") { $Bar=" "; } &LoadUser($usname[$i]); $yymain .= qq~ ~; } if ($total_posts > 0) { $tmp_pct = ($total_topposts * 100) / $total_posts; } else { $tmp_pct = 0; } $top_pct = sprintf ("%.2f", $tmp_pct); $yymain .= qq~
$x. $shname[$i] $shposts[$i] $Bar
$pstmem $txt{'314'}:
- $total_topposts $txt{'86'}
- $top_pct% $txt{'309'} $txt{'190'} $txt{'86'}
$txttellfriend{'718'}
$txttellfriend{'718'}
$txttellfriend{'719'}
$moonpict  

$curforumurl~; if($shownewsfader == 1) { if(!$fadedelay) { $fadedelay = 5000; } $yymain .= qq~
$txt{'102'}
~; } $yymain .= qq~
~; ### snYpir's collapsable YaBB part 1 # expand/collapse all buttons if ( $username ne 'Guest' ){ $yymain .= qq~ ~; } else{ $yymain .= qq~~; } ### end snYpir's collapsable YaBB part 1 $yymain .= qq~ ~; ### snYpir's collapsable YaBB part 2 # init catstatus counter my $catcount=0; if ( $username ne 'Guest' ){ # load the .cat file for this user, put into array fopen(FILE, "$memberdir/$username.cat"); @catstatus = ; fclose(FILE); # remove trailing newline chars for( $_ = 0; $_ < @catstatus; $_++ ) { chomp $catstatus[$_]; } # .cat file for this user not found, or number of categories changed? if ( @catstatus ne @categories ){ # write new .cat file for user fopen( FILE, ">$memberdir/$username.cat", 1); for( $_ = 0; $_ < @categories; $_++ ) { print FILE "0\n"; } fclose(FILE); fopen(FILE, "$memberdir/$username.cat"); @catstatus = ; fclose(FILE); for( $_ = 0; $_ < @catstatus; $_++ ) { chomp $catstatus[$_]; } } } ### end snYpir's collapsable YaBB part 2 foreach $curcat (@categories) { unless( $openmemgr{$curcat} ) { next; } #### if ($catpic{$curcat} =~ /\//i) {$catpic{$curcat} = qq~ ~;} elsif ($catpic{$curcat}) {$catpic{$curcat} = qq~ ~;} #### $yymain .= qq~ ~; ### snYpir's collapsable YaBB part 3 if ( $username ne 'Guest' ) { my $newmsg = 0; my $new = ""; # determine if there are new posts somewhere in this category, but only if cat is collapsed if ( !$catstatus[$catcount] ) { foreach $curboard (@{$catboards{$curcat}}) { chomp $curboard; my $dlp = &getlog($curboard); if( $max_log_days_old && $lastposttime{$curboard} ne $txt{'470'} && $dlp < stringtotime( $lastpostrealtime{$curboard} ) ) { $newmsg = 1; last; } } if ( $newmsg ) { $new = qq~$txt{'333'}~; } else { $new = qq~$txt{'334'}~; } } if( $catstatus[$catcount] ) { $expandpic = qq~~;} else { $expandpic = qq~~;} $yymain .= qq~~; } else { $yymain .= qq~~; } ### end snYpir's collapsable YaBB part 3 $yymain .= qq~ ~; ### snYpir's collapsable YaBB part 4 # if category is open, display boards (or if this user is a guest) if( $catstatus[$catcount] || $username eq 'Guest' ){ ### end snYpir's collapsable YaBB part 4 foreach $curboard (@{$catboards{$curcat}}) { chomp $curboard; my $access = &AccessCheck($curboard, ''); if ($settings[7] ne "Administrator" && $access ne "granted" && $showprivboards{$curboard} ne "1") {next;} 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'}; #### $boardpic = ""; if (-e "$boardsdir/$curboard.mbo" ) { require "$boardsdir/$curboard.mbo"; } if ($boardpic{$curboard} =~ /\//i) {$boardpic{$curboard} = qq~ ~;} elsif ($boardpic{$curboard}) {$boardpic{$curboard} = qq~ ~;} my $cookiename = "$cookiepassword$curboard"; my $crypass = crypt($boardpw{$curboard},$pwseed); my $boardpwpic = ""; if ($settings[7] ne "Administrator" && $boardpw{$curboard} && $yyCookies{$cookiename} ne $crypass) {$boardpwpic = qq~~;} elsif ($boardpw{$curboard}) {$boardpwpic = qq~~;} #### $yymain .= qq~~; } ### snYpir's collapsable YaBB part 5 } ++$catcount; ### end snYpir's collapsable YaBB part 5 } 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; ### LIMITED IM MOD ### if($userimcfg[5] eq "on") { $yymain .= qq~~; } else { $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~; ### END LIMITED IM ### $yymain .= qq~
~; } #set the correct rowspan for the RECENT USERS LIST main cell $rul_rowspan = ($username eq 'Guest') ? $rul_rowspan : $rul_rowspan - 8; $yymain .= qq~
$txt{'20'} · $exptxt{'1'} · $exptxt{'2'} ·
$txt{'20'}$txt{'330'} $txt{'21'} $txt{'22'}
$catpic{$curcat}$expandpic $new $caticon$catname{$curcat} $catpic{$curcat}« $caticon$catname{$curcat} »
$new $boardpic{$curboard}$curboardname $boardpwpic
$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~


~; 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
~; } ### snYpir's collapsable YaBB - subs sub Collapse_Cat { my ($catindex,@catstatus); if ( $username eq 'Guest' ){ &fatal_error($exptxt{'4'}); exit; } # Grab the index of the category to collapse/expand $catindex = $INFO{'forumnum'}; # read the current users category file fopen(FILE, "$memberdir/$username.cat"); @catstatus = ; fclose(FILE); chomp @catstatus; # does the file exist? if ( $catstatus[0] != 1 && $catstatus[0] != 0 ){ &fatal_error($exptxt{'3'}); exit; } # toggle the status of the selected category if ( $catstatus[$catindex] eq 1 ){ $catstatus[$catindex] = 0; } else{ $catstatus[$catindex] = 1; } # rewrite category file for this user fopen( FILE, ">$memberdir/$username.cat", 1); for( $_ = 0; $_ < @catstatus; $_++ ) { print FILE "$catstatus[$_]\n"; } fclose(FILE); &redirectinternal; exit; } sub Collapse_All { my ($state,@catstatus); $state = $INFO{'status'}; if ( $username eq 'Guest' ){ &fatal_error($exptxt{'4'}); exit; } # read the current users category file fopen(FILE, "$memberdir/$username.cat"); my @catstatus = ; fclose(FILE); chomp @catstatus; # does the file exist? if ( $catstatus[0] != 1 && $catstatus[0] != 0 ){ &fatal_error($exptxt{'3'}); exit; } # rewrite category file for this user fopen( FILE, ">$memberdir/$username.cat", 1); for( $_ = 0; $_ < @catstatus; $_++ ) { print FILE "$state\n"; } fclose(FILE); &redirectinternal; exit; } ### end snYpir's collapsable YaBB - subs 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;