############################################################################### # 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 { # Load censor list. fopen(FILE,"$vardir/censor.txt"); while( chomp( $buffer = ) ) { ($tmpa,$tmpb) = split(/=/,$buffer); push(@censored,[$tmpa,$tmpb]); } fclose(FILE); #RECENT USERS LIST MOD START if ($username ne 'Guest' && $action ne 'login2') { require "$sourcedir/LogInOut.pl"; &RecentUsersList; } #RECENT USERS LIST MOD END # 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, $lastthreadid{$curboard} ) = &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~

$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~
~; #Check to see if the subcat.txt doesn't exist, if it doesn't we still need a forum header or it looks funny if(!(-e "$vardir/subcat.txt")) { $yymain .= qq~ ~; } #This bit of code goes through and checks if we have visible categories. If there are no visible # categories, we need to still insert a
Forum Name $txt{'330'} $txt{'21'} $txt{'22'}
string or else the info table will expand to full screen. $catisvisible="false"; foreach $curcat (@categories) { unless( $openmemgr{$curcat} ) { next; } $catisvisible="true"; } if($catisvisible eq "false") { $yymain .= qq~
~; } #Go through the categories and creat the tables if they are needed $foundasubcat="false"; foreach $curcat (@categories) { unless( $openmemgr{$curcat} ) { next; } #### if ($catpic{$curcat} =~ /\//i) {$catpic{$curcat} = qq~ ~;} elsif ($catpic{$curcat}) {$catpic{$curcat} = qq~ ~;} #### fopen(FILE, "$vardir/subcat.txt"); @subcategories = ; fclose(FILE); $newsubcatlist=""; #Go through the subcats and check to see if the curcat is found in the subcats file (It is a subcategory) foreach $cursubcat (@subcategories) { chomp($cursubcat); ($cursubcatid,$cursubcatname) = split(/\|/,$cursubcat); #Check if we found a match if ($curcat eq $cursubcatid) { $foundasubcat="true"; #This little code breaks the table away from the previous category if ($curcat ne @categories[0]) { $yymain .= qq~

~; } $yymain .= qq~ ~; } } #This code adds a table header for the very first category if the very first category is not found in subcat.txt if ((-e "$vardir/subcat.txt") && $foundasubcat eq "false") { $foundasubcat="true"; $yymain .= qq~
$cursubcatname $txt{'330'} $txt{'21'} $txt{'22'}
~; } $yymain .= qq~~; 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~~;} #### ## LAST SUBJECT MOD ## # Use the following line to decide if you want the Latest Subject in the Board Index to display the details # (message icon, subject and link) of the FIRST post or LAST post of the most recently replied to thread $last_post = 1; # 0 = FIRST post; 1 = LAST post $subjecthtml = ""; if ($lastthreadid{$curboard}) { fopen(FILE,"$datadir/$lastthreadid{$curboard}.txt"); @tmp_messages = ; fclose(FILE); if ($last_post) {$subjectmain = $tmp_messages[$#tmp_messages];} else {$subjectmain = $tmp_messages[0];} ($subjectmain, $dummy, $dummy, $dummy, $dummy, $subicon, $dummy) = split(/\|/, $subjectmain); # Censor the subject of the thread. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $subjectmain =~ s~\Q$tmpa\E~$tmpb~gi; } if (length($subjectmain) > 25) { $subjectmain = substr($subjectmain, 0, 25) . qq~ ...~; } $subicon = qq~~; # Detect if this thread is a poll thread if (-e "$datadir/$lastthreadid{$curboard}.poll") { fopen (FILE, "$datadir/$lastthreadid{$curboard}.poll"); $poll_question = ; fclose (FILE); chomp $poll_question; ($dummy, $poll_locked, $dummy) = split(/\|/, $poll_question, 3); $subicon = qq~$img{'pollicon'}~; if ($poll_locked eq "1" || $poll_locked eq "Locked") { $subicon = qq~$img{'polliconclosed'}~; } } if ($last_post) {$tmp_start = qq~;start=$#tmp_messages\#$#tmp_messages~;} else {$tmp_start = "";} $subjecthtml = qq~$subicon $subjectmain
~; if ($settings[7] ne "Administrator" && $boardpw{$curboard} && $yyCookies{$cookiename} ne $crypass) {$subjecthtml = qq~ $mbco{'14'}
~;} } ## END LAST SUBJECT MOD ## $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, $last_ip) = split(/\|/, $curentry); if(!$last_ip){$last_ip = qq~$txt{'no_ip'}~;} if($name) { if(!$yyUDLoaded{$musername}) { &LoadUser($name); } if(exists $userprofile{$name}) { $numusers++; $users .= qq~ $userprofile{$name}->[1]~; if($settings[7] eq "Administrator") { $users .= qq~ ($last_ip)~; } $users .= qq~, \n~; } else { $guests++; if($settings[7] eq "Administrator") { if($guests == 1){$guestlist = "
$txt{'guest_ip'}: ";} $guestlist .= qq~$last_ip, \n~; } } } } $users =~ s~, \n\Z~~; $guestlist =~ s~, \n\Z~\n~; 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~
Forum Name $txt{'330'} $txt{'21'} $txt{'22'}
$catpic{$curcat}$catname{$curcat}
$new $boardpic{$curboard}$curboardname $boardpwpic
$curboarddescr
$threadcount{$curboard} $messagecount{$curboard} $subjecthtml$lastposttime{$curboard}
$txt{'525'} $lastposter
$txt{'333'} $txt{'333'}   $txt{'334'} $txt{'334'}   ~; if($showmarkread) { $yymain .= qq~$img{'markallread'}~; } $yymain .= qq~



~; ### Recent Topics List $Show_RecentPostList=5; if($Show_RecentPostList>0) { require "$sourcedir/Recent.pl"; &RecentPostList($Show_RecentPostList); } $yymain .= qq~ ~; if($totalt > 0) { require "$sourcedir/TopStats.pl"; &TopLink; } $yymain .= qq~ ~; if ($forum_staff) { # Load MemberGroups if(!$MemStatAdmin) { fopen(FILE, "$vardir/membergroups.txt") || &fatal_error("100 $txt{'106'}: $txt{'23'} membergroups.txt"); @membergroups = ; fclose(FILE); chomp $membergroups[0]; $tmp_admin_txt = $membergroups[0] || "Administrator"; chomp $membergroups[7]; $tmp_gmod_txt = $membergroups[7] || "Global Moderator"; } else { $tmp_admin_txt = $MemStatAdmin || "Administrator"; $tmp_gmod_txt = $MemStatGMod || "Global Moderator"; } fopen(FILE, "$vardir/mem_groups.txt"); @mem_groups = ; fclose(FILE); @mem_groups = sort{uc($a) cmp uc($b)} (@mem_groups); foreach $curentry (@mem_groups) { chomp $curentry; ($tmp_username, $tmp_group, $tmp_name) = split(/\|/, $curentry); if ($group_list{$tmp_group}) { $group_list{$tmp_group} .= qq~, ~;} $group_list{$tmp_group} .= qq~$tmp_name~; } @staff = split (/,/, $forum_staff); $list = ""; foreach $curentry (@staff) { $curentry =~ s~^\s*(\S.*?\S|\S)\s*$~$1~; if($curentry eq "Administrator") {$tmp_group_txt = $tmp_admin_txt;} elsif($curentry eq "Global Moderator") {$tmp_group_txt = $tmp_gmod_txt;} else {$tmp_group_txt = $curentry;} if ($group_list{$curentry}) { $list .= qq~ ~; } } if ($list) {$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~ ~; ########### 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'}
$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
$tmp_group_txt: $group_list{$curentry}
$txt{'509c'}
$list
$txt{'158'}
$guests $txt{'141'}, $numusers $txt{'142'}
$users$guestlist
$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'}
$ecaltxt{'55'}
$moonpict
~; 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~
~; 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;