############################################################################### # Recent.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 2.4 # # Packaged: April 12, 2009 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2009 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 # # Your source for web hosting, web design, and domains. # ############################################################################### $recentplver = 'YaBB 2.4 $Revision$'; if ($GLOBAL::ACTION eq 'detailedversion') { return 1; } # Sub Recent_Topics_Posts shows # - all the most recently posted topics (recenttopics) # - OR the X last POSTS (recent) # Meaning each thread will show up ONCE in the list (recenttopics) # OR all new post will be shown even if from the same thread (recent) sub Recent_Topics_Posts { &spam_protection; my ($recent_topics, $display, @data, $numfound, %catid, %catname, $curboard, $boardperms, $i, $c, @mess, @messages, $tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate, $mname, $memail, $mdate, $musername, $micon, $mreplyno, $mip, $mns, $mtime, $board, $notify, $registrationdate, $icanbypass); $recent_topics = $GLOBAL::ACTION eq 'recenttopics' ? 1 : 0; $display = $FORM{'display'} || $INFO{'display'} || 10; if ($display < 0) { $display = 5; } elsif ($display > $maxrecentdisplay) { $display = $maxrecentdisplay; } $numfound = 0; foreach my $catid (@categoryorder) { my ($catname, $catperms) = split(/\|/, $catinfo{$catid}); unless (&CatAccess($catperms)) { next; } foreach $curboard (split(/\,/, $cat{$catid})) { ($boardname{$curboard}, $boardperms, undef) = split(/\|/, $board{$curboard}); if (!$iamadmin && &AccessCheck($curboard, '', $boardperms) ne "granted") { next; } $catid{$curboard} = $catid; $catname{$curboard} = $catname; my @buffer = &read_DBorFILE(0,'',$boardsdir,$curboard,'txt'); for ($i = 0; ($i < $display && $buffer[$i]); $i++) { ($tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate) = split(/\|/, $buffer[$i]); chomp $tstate; if ($tstate !~ /h/ || $iamadmin || $iamgmod) { $data[$numfound] = "$tdate|$curboard|$tnum|$treplies|$tusername|$tname|$tstate"; $numfound++; } } } } @data = sort {$b <=> $a} @data; $numfound = 0; $notify = $recent_topics ? scalar @data : (@data > $display ? $display : scalar @data); for ($i = 0; $i < $notify; $i++) { ($mtime, $curboard, $tnum, $treplies, $tusername, $tname, $tstate) = split(/\|/, $data[$i]); next if !(@mess = &read_DBorFILE(0,'',$datadir,$tnum,'txt')); for ($c = ($recent_topics ? $#mess : (@mess > $display ? @mess - $display : 0)); $c < @mess; $c++) { chomp($mess[$c]); if ($mess[$c]) { ($msub, $mname, $memail, $mdate, $musername, $micon, $mreplyno, $mip, $message, $mns) = split(/\|/, $mess[$c]); $messages[$numfound] = "$mdate|$curboard|$tnum|$c|$tusername|$tname|$msub|$mname|$memail|$mdate|$musername|$micon|$mreplyno|$mip|$message|$mns|$tstate|$mtime"; $numfound++; } } if ($recent_topics && $numfound == $display) { last; } } @messages = sort {$b <=> $a} @messages; if ($numfound > 0) { if ($numfound > $display) { $numfound = $display; } &LoadCensorList; $icanbypass = &checkUserLockBypass; } else { $yymain .= qq~
| ~ . ($i + 1) . qq~ | $catname{$board} / $boardname{$board} / $msub $maintxt{'30'}: $mdate |
||
|
|||