############################################################################### # MessageIndex.pm # # $Date: 06.01.16 $ # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 2.6.13 # # Packaged: June 1, 2016 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2016 YaBB (www.yabbforum.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### # use strict; # use warnings; no warnings qw(uninitialized once); use CGI::Carp qw(fatalsToBrowser); our $VERSION = '2.6.13'; $messageindexpmver = 'YaBB 2.6.13 $Revision$'; $action ||= q{}; if ( $action eq 'detailedversion' ) { return 1; } get_micon(); LoadLanguage('MessageIndex'); LoadLanguage('Notify'); if ( !$INFO{'tsort'} ) { $tsortcookie = "$cookietsort$currentboard$username"; $tsort = $yyCookies{$tsortcookie} || q{}; $tsort =~ s/\D//gsm; } else { $tsort = $INFO{'tsort'}; $tsort =~ s/\D//gsm; my $cookiename = "$cookietsort$currentboard$username"; my $expiration = 'Sunday, 17-Jan-2038 00:00:00 GMT'; push @otherCookies, write_cookie( -name => "$cookiename", -value => "$tsort", -path => q{/}, -expires => "$expiration" ); } sub MessageIndex { # Check if board was 'shown to all' - and whether they can view the board if ( AccessCheck( $currentboard, q{}, $boardperms ) ne 'granted' ) { fatal_error('no_access'); } if ( $annboard eq $currentboard && !$iamadmin && !$iamgmod && !$iamfmod ) { fatal_error('no_access'); } my ( $counter, $mcount, $showmods, $mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate, $dlp, ); my ( $numanns, $threadcount, $countsticky, $stkynum, @tmpanns, @threadlist, @nostickythreadlist, @threads, $usermessagepage ); BoardTotals( 'load', $currentboard ); # See if we just want a message list from ajax if ( $INFO{'messagelist'} ) { $messagelist = $INFO{'messagelist'}; } # Load template here for conditionals based on whether we're ajax loading or not. get_template('MessageIndex'); # Build a list of the board's moderators. We don't need this if it's ajax. if ( !$messagelist ) { if ( keys %moderators > 0 ) { if ( keys %moderators == 1 ) { $showmods = qq~($messageindex_txt{'298'}: ~; } else { $showmods = qq~($messageindex_txt{'63'}: ~; } while ( $_ = each %moderators ) { FormatUserName($_); $showmods .= QuickLinks( $_, 1 ) . q{, }; } $showmods =~ s/, \Z/)/sm; } if ( keys %moderatorgroups > 0 ) { if ( keys %moderatorgroups == 1 ) { $showmodgroups = qq~($messageindex_txt{'298a'}: ~; } else { $showmodgroups = qq~($messageindex_txt{'63a'}: ~; } my ( $tmpmodgrp, $thismodgrp ); while ( $_ = each %moderatorgroups ) { $tmpmodgrp = $moderatorgroups{$_}; ( $thismodgrp, undef ) = split /\|/xsm, $NoPost{$tmpmodgrp}, 2; $showmodgroups .= qq~$thismodgrp, ~; } $showmodgroups =~ s/, \Z/)/sm; } if ( $showmodgroups && $showmods ) { $showmods .= q~ - ~; } if ( ${ $uid . $currentboard }{'brdpasswr'} ) { my $cookiename = "$cookiepassword$currentboard$username"; my $crypass = ${ $uid . $currentboard }{'brdpassw'}; if ( $iamguest ) { BoardPassw_g(); } elsif ( !$staff && $yyCookies{$cookiename} ne $crypass ) { BoardPassw(); } } } # Thread Tools if ($useThreadtools) { LoadTools( 0, 'newthread', 'createpoll', 'notify', 'markboardread' ); } # Load announcements, if they exist. if ( $annboard && $annboard ne $currentboard && (!${ $uid . $currentboard }{'rbin'} || ${ $uid . $currentboard }{'rbin'} != 1) ) { chomp $annboard; fopen( ANN, "$boardsdir/$annboard.txt" ); @tmpanns = ; fclose(ANN); foreach my $realanns (@tmpanns) { my $threadstatus = ( split /\|/xsm, $realanns )[8]; if ( $threadstatus =~ /h/ism && !$staff ) { next; } push @threads, $realanns; $numanns++; } undef @tmpanns; } # Determine what category we are in. $catid = ${ $uid . $currentboard }{'cat'}; ( $cat, undef ) = split /\|/xsm, $catinfo{$catid}; ToChars($cat); fopen( BRDTXT, "$boardsdir/$currentboard.txt" ) or fatal_error( 'cannot_open', "$boardsdir/$currentboard.txt", 1 ); @threadlist = ; fclose(BRDTXT); $sort_subject = qq~$messageindex_txt{'70'}~; $sort_starter = qq~$messageindex_txt{'109'}~; $sort_answer = qq~$messageindex_txt{'110'}~; $sort_lastpostim = qq~$messageindex_txt{'22'}~; my %starter; @temp_list = @threadlist; local *starter = sub { if ( exists $user_info{ $_[0] } ) { return $user_info{ $_[0] }; } if ( !exists $memberinf{ $_[0] } ) { return lc( ( split /\|/xsm, $_[1], 4 )[2] ); } $user_info{ $_[0] } = lc( ( split /\|/xsm, $memberinf{ $_[0] }, 2 )[0] ); }; if ( $tsort ) { if($tsort == 1 ) { $sort_lastpostim = qq~$messageindex_txt{'22'} $micon{'sort_first'}~; @threadlist = reverse @temp_list; } elsif ( $tsort == 2 ) { $sort_subject = qq~$messageindex_txt{'70'} $micon{'sort_up'}~; @threadlist = reverse sort { lc( ( split /\|/xsm, $a, 3 )[1] ) cmp lc( ( split /\|/xsm, $b, 3 )[1] ) } @temp_list; } elsif ( $tsort == 3 ) { $sort_subject = qq~$messageindex_txt{'70'} $micon{'sort_down'}~; @threadlist = sort { lc( ( split /\|/xsm, $a, 3 )[1] ) cmp lc( ( split /\|/xsm, $b, 3 )[1] ) } @temp_list; } elsif ( $tsort == 4 ) { ManageMemberinfo('load'); $sort_starter = qq~$messageindex_txt{'109'} $micon{'sort_up'}~; @threadlist = reverse sort { starter( ( split /\|/xsm, $a, 8 )[6], $a ) cmp starter( ( split /\|/xsm, $b, 8 )[6], $b ) } @temp_list; undef %memberinf; } elsif ( $tsort == 5 ) { ManageMemberinfo('load'); $sort_starter = qq~$messageindex_txt{'109'} $micon{'sort_down'}~; @threadlist = sort { starter( ( split /\|/xsm, $a, 8 )[6], $a ) cmp starter( ( split /\|/xsm, $b, 8 )[6], $b ) } @temp_list; undef %memberinf; } elsif ( $tsort == 6 ) { $sort_answer = qq~$messageindex_txt{'110'} $micon{'sort_up'}~; @threadlist = reverse sort { ( split /\|/xsm, $a, 7 )[5] <=> ( split /\|/xsm, $b, 7 )[5] } @temp_list; } elsif ( $tsort == 7 ) { $sort_answer = qq~$messageindex_txt{'110'} $micon{'sort_down'}~; @threadlist = sort { ( split /\|/xsm, $a, 7 )[5] <=> ( split /\|/xsm, $b, 7 )[5] } @temp_list; } else { $sort_lastpostim = qq~$messageindex_txt{'22'} $micon{'sort_up'}~; } } else { $sort_lastpostim = qq~$messageindex_txt{'22'} $micon{'sort_up'}~; } undef @temp_list; undef %starter; foreach my $threadlist (@threadlist) { my $threadstatus = ( split /\|/xsm, $threadlist )[8]; if ( $threadstatus =~ /h/ism && !$staff ) { next; } if ( $threadstatus =~ /s/ism ) { push @threads, $threadlist; $countsticky++; } else { $nostickythreadlist[$threadcount] = $threadlist; $threadcount++; } } undef @threadlist; $threadcount = $threadcount + $countsticky + $numanns; my $maxindex = $INFO{'view'} eq 'all' ? $threadcount : $maxdisplay; # Construct the page links for this board. if ( !$iamguest ) { ( $usermessagepage, undef, undef, undef ) = split /\|/xsm, ${ $uid . $username }{'pageindex'}; } my ( $pagetxtindex, $pagedropindex1, $pagedropindex2, $all, $allselected ); $indexdisplaynum = 3; # max number of pages to display $dropdisplaynum = 10; $startpage = 0; $max = $threadcount; if ( $INFO{'start'} && substr( $INFO{'start'}, 0, 3 ) eq 'all' && $showpageall != 0 ) { $maxindex = $max; $all = 1; $allselected = q~ selected="selected"~; $start = 0; } else { $start = $INFO{'start'} || 0; } if ( $start > $threadcount - 1 ) { $start = $threadcount - 1; } elsif ( $start < 0 ) { $start = 0; } $start = int( $start / $maxindex ) * $maxindex; $tmpa = 1; $pagenumb = int( ( $threadcount - 1 ) / $maxindex ) + 1; if ( $start >= ( ( $indexdisplaynum - 1 ) * $maxindex ) ) { $startpage = $start - ( ( $indexdisplaynum - 1 ) * $maxindex ); $tmpa = int( $startpage / $maxindex ) + 1; } if ( $threadcount >= $start + ( $indexdisplaynum * $maxindex ) ) { $endpage = $start + ( $indexdisplaynum * $maxindex ); } else { $endpage = $threadcount } $lastpn = int( ( $threadcount - 1 ) / $maxindex ) + 1; $lastptn = ( $lastpn - 1 ) * $maxindex; $pageindex1 = qq~$messageindex_txt{'19'} $messageindex_txt{'139'}: $pagenumb~; $pageindex2 = $pageindex1; if ( $pagenumb > 1 || $all ) { if ( $usermessagepage == 1 || $iamguest ) { $pagetxtindexst = q~~; if ( !$iamguest ) { $pagetxtindexst .= qq~$messageindex_txt{'19'} $messageindex_txt{'139'}: ~; } else { $pagetxtindexst .= qq~$messageindex_txt{'139'} $messageindex_txt{'139'}: ~; } if ( $startpage > 0 ) { if ($messagelist) { $pagetxtindex = qq~1 ... ~; } if ( $startpage == $maxindex ) { $pagetxtindex = qq~1 ~; } } foreach my $counter ( $startpage .. ( $endpage - 1 ) ) { if ( $counter % $maxindex == 0 ) { if ($messagelist) { $pagetxtindex .= $start == $counter ? qq~[$tmpa] ~ : qq~$tmpa ~; } else { $pagetxtindex .= $start == $counter ? qq~[$tmpa] ~ : qq~$tmpa ~; } $tmpa++; } } if ( $endpage < $threadcount - $maxindex ) { $pageindexadd = qq~... ~; } if ( $endpage != $threadcount ) { $pageindexadd .= qq~$lastpn~; } $pagetxtindex .= $pageindexadd; $pageindex1 = qq~$pagetxtindexst $pagetxtindex~; $pageindex2 = $pageindex1; } else { $pagedropindex1 = q~~; $pagedropindex1 .= qq~$messageindex_txt{'19'}~; $pagedropindex2 = $pagedropindex1; $tstart = $start; #if (substr($INFO{'start'}, 0, 3) eq 'all') { ($tstart, $start) = split(/\-/, $INFO{'start'}); } $d_indexpages = $pagenumb / $dropdisplaynum; $i_indexpages = int( $pagenumb / $dropdisplaynum ); if ( $d_indexpages > $i_indexpages ) { $indexpages = int( $pagenumb / $dropdisplaynum ) + 1; } else { $indexpages = int( $pagenumb / $dropdisplaynum ) } $selectedindex = int( ( $start / $maxindex ) / $dropdisplaynum ); if ( $pagenumb > $dropdisplaynum ) { $pagedropindex1 .= qq~\n~; } for my $i ( 0 .. ( $indexpages - 1 ) ) { $indexpage = ( $i * $dropdisplaynum ) * $maxindex; $indexstart = ( $i * $dropdisplaynum ) + 1; $indexend = $indexstart + ( $dropdisplaynum - 1 ); if ( $indexend > $pagenumb ) { $indexend = $pagenumb; } if ( $indexstart == $indexend ) { $indxoption = qq~$indexstart~; } else { $indxoption = qq~$indexstart-$indexend~; } $selected = q{}; if ( $i == $selectedindex ) { $selected = q~ selected="selected"~; $pagejsindex = qq~$indexstart|$indexend|$maxindex|$indexpage~; } if ( $pagenumb > $dropdisplaynum ) { $pagedropindex1 .= qq~\n~; $pagedropindex2 .= qq~\n~; } } if ( $pagenumb > $dropdisplaynum ) { $pagedropindex1 .= qq~\n~; $pagedropindex2 .= qq~\n~; } $pagedropindex1 .= q~ ~; $pagedropindex2 .= q~ ~; $tmpmaxindex = $maxindex; #if (substr($INFO{'start'}, 0, 3) eq 'all') { $maxindex = $maxindex * $dropdisplaynum; } $prevpage = $start - $tmpmaxindex; $nextpage = $start + $maxindex; $pagedropindexpvbl = qq~~; $pagedropindexnxbl = qq~~; if ( $start < $maxindex ) { $pagedropindexpv .= qq~~; } else { $pagedropindexpv .= qq~$pidtxt{'02'}~; } else { $pagedropindexpv .= qq~onclick="location.href=\\'$scripturl?board=$currentboard/$prevpage\\'" ondblclick="location.href=\\'$scripturl?board=$currentboard/0\\'" />~; } } if ( $nextpage > $lastptn ) { $pagedropindexnx .= qq~~; } else { $pagedropindexnx .= qq~$pidtxt{'03'}~; } else { $pagedropindexnx .= qq~onclick="location.href=\\'$scripturl?board=$currentboard/$nextpage\\'" ondblclick="location.href=\\'$scripturl?board=$currentboard/$lastptn\\'" />~; } } # make select box have links for ajax vs default url if ($messagelist) { $default_or_ajax = qq~javascript:MessageList(\\'$scripturl?board=$currentboard/' + pagstart + ';messagelist=1\\', \\'$yyhtml_root\\',\\'$currentboard\\', 1)~; } else { $default_or_ajax = qq~$scripturl?board=$currentboard/' + pagstart + '~; } $pageindex1 = qq~$pagedropindex1~; $pageindex2 = qq~$pagedropindex2~; $pageindexjs = qq~ ~; } } if ( $start <= $#threads ) { $stkynum = scalar @threads; } push @threads, @nostickythreadlist; undef @nostickythreadlist; @threads = splice @threads, $start, $maxindex; chomp @threads; my %attachments; if ( ( -s "$vardir/attachments.txt" ) > 5 ) { fopen( ATM, "$vardir/attachments.txt" ); while () { $attachments{ ( split /\|/xsm, $_, 2 )[0] }++; } fclose(ATM); } LoadCensorList(); # check the Multi-admin setting my $multiview = 0; if ($staff) { if ( ( $iamadmin && $adminview == 3 ) || ( $iamgmod && $gmodview == 3 ) || ( $iamfmod && $fmodview == 3 ) || ( $iammod && $modview == 3 ) ) { $multiview = 3; } elsif (( $iamadmin && $adminview == 2 ) || ( $iamgmod && $gmodview == 2 ) || ( $iamfmod && $fmodview == 2 ) || ( $iammod && $modview == 2 ) ) { $multiview = 2; } elsif (( $iamadmin && $adminview == 1 ) || ( $iamgmod && $gmodview == 1 ) || ( $iamfmod && $fmodview == 1 ) || ( $iammod && $modview == 1 ) ) { $multiview = 1; } } # Print the header and board info. ( $boardname, undef ) = split /\|/xsm, $board{$currentboard}; my $curboardname = $boardname; ToChars($curboardname); if ( $multiview == 1 ) { $yymain .= qq~ \n~; } if ( $multiview >= 2 ) { my $modul = $currentboard eq $annboard ? 4 : 5; $yymain .= qq~ \n~; } my $homelink = qq~$mbname~; my $catlink = qq~$cat~; my $boardlink = qq~$curboardname~; my $modslink = qq~$showmods~; $boardtree = q{}; $parentboard = $currentboard; while ($parentboard) { my ( $pboardname, undef, undef ) = split /\|/xsm, $board{"$parentboard"}; ToChars($pboardname); if ( ${ $uid . $parentboard }{'canpost'} || !$subboard{$parentboard} ) { $pboardname = qq~$pboardname~; } else { $pboardname = qq~$pboardname~; } $boardtree = qq~ › $pboardname$boardtree~; $parentboard = ${ $uid . $parentboard }{'parent'}; } # check how many col's must be spanned if ( $multiview > 0 ) { $colspan = 7; } else { $colspan = 6; } if ( !$iamguest ) { my $brdid = q{}; if ( $messagelist ) { $mthreadslang = 1; $brdid = q{new_} . $INFO{'board'}; } $markalllink = qq~$menusep$img{'markboardread'}~; $notify_board = qq~$menusep$img{'notify'}~; } if ( AccessCheck( $currentboard, 1 ) eq 'granted' ) { # when Quick-Post and Quick-Jump: focus message first, then the subject to have a better display if ($messagelist) { if ($mdrop_postpopup) { $postlink = qq~$menusep$img{'newthread'}~; } else { $postlink = qq~$menusep$img{'newthread'}~; } } else { if ($mindex_postpopup) { $postlink = qq~$menusep$img{'newthread'}~; } else { $postlink = qq~$menusep$img{'newthread'}~; } } } if ( AccessCheck( $currentboard, 3 ) eq 'granted' ) { $polllink = qq~$menusep$img{'createpoll'}~; } if ( $multiview == 3 ) { my $adminlink; if ( $currentboard eq $annboard ) { $adminlink = qq~$messageindex_txt{'104'}$messageindex_txt{'844'}$messageindex_txt{'132'}$messageindex_txt{'54'}~; } else { $adminlink = qq~$messageindex_txt{'104'}$messageindex_txt{'781'}$messageindex_txt{'844'}$messageindex_txt{'132'}$messageindex_txt{'54'}~; } $adminheader =~ s/{yabb admin}/$adminlink/gsm; } elsif ( ( ( $iamadmin && $adminview != 0 ) || ( $iamgmod && $gmodview != 0 ) || ( $iamfmod && $fmodview != 0 ) || ( $iammod && $modview != 0 && !$iamadmin && !$iamgmod && !$iamfmod ) ) && $sessionvalid == 1 ) { $adminlink = qq~$messageindex_txt{'2'}~; $adminheader =~ s/{yabb admin}/$adminlink/gsm; } # check to display moderator column my $tmpstickyheader; if ($stkynum) { $stickyheader =~ s/{yabb colspan}/$colspan/gsm; $tmpstickyheader = $stickyheader; } # load Favorites in a hash if ( ${ $uid . $username }{'favorites'} ) { foreach ( split /,/xsm, ${ $uid . $username }{'favorites'} ) { $favicon{$_} = 1; } } # Count threads to alternate colors my $alternatethreadcolor = 0; # Begin printing the message index for current board. $counter = $start; dumplog($currentboard); # Mark current board as seen my $dmax = $date - ( $max_log_days_old * 86400 ); foreach (@threads) { ( $mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate ) = split /\|/xsm, $_; my ( $movedSubject, $movedFlag ) = Split_Splice_Move( $msub, $mnum ); MessageTotals( 'load', $mnum ); my $altthdcolor = ( ( $alternatethreadcolor % 2 ) == 1 ) ? 'windowbg' : 'windowbg2'; $alternatethreadcolor++; my $goodboard = $mstate =~ /a/ism ? $annboard : $currentboard; if ( ${$mnum}{'board'} ne $goodboard ) { if ($goodboard) { ${$mnum}{'board'} = $goodboard; } MessageTotals( 'recover', $mnum ); } $permlinkboard = ${$mnum}{'board'} eq $annboard ? $annboard : $currentboard; my $permdate = permtimer($mnum); my $message_permalink = qq~$messageindex_txt{'10'}~; $threadclass = 'thread'; if ( !$mstate ) { $threadclass = 'thread'; } else { if ( $mstate =~ /h/ism ) { $threadclass = 'hide'; } elsif ( $mstate =~ /l/ism ) { $threadclass = 'locked'; } elsif ( $mreplies >= $VeryHotTopic ) { $threadclass = 'veryhotthread'; } elsif ( $mreplies >= $HotTopic ) { $threadclass = 'hotthread'; } if ( $threadclass eq 'hide' && $mstate =~ /s/ism && $mstate !~ /l/ism ) { $threadclass = 'hidesticky'; } elsif ($threadclass eq 'hide' && $mstate =~ /l/ism && $mstate !~ /s/ism ) { $threadclass = 'hidelock'; } elsif ($threadclass eq 'hide' && $mstate =~ /s/ism && $mstate =~ /l/ism ) { $threadclass = 'hidestickylock'; } elsif ($threadclass eq 'locked' && $mstate =~ /s/ism && $mstate !~ /h/ism ) { $threadclass = 'stickylock'; } elsif ( $mstate =~ /s/ism && $mstate !~ /h/ism ) { $threadclass = 'sticky'; } elsif ( ${$mnum}{'board'} eq $annboard && $mstate !~ /h/ism ) { $threadclass = $threadclass eq 'locked' ? 'announcementlock' : 'announcement'; } } ### Start Sticky Shimmy Shuffle mod my $stickdir = q{}; if ($staff) { if ( $threadclass eq 'sticky' || $threadclass eq 'stickylock' || $threadclass eq 'hidesticky' || $threadclass eq 'hidestickylock') { $stickdir = qq~   ~; } elsif (( $threadclass eq 'announcement' || $threadclass eq 'announcementlock' || ${$mnum}{'board'} eq $annboard && $mstate =~ /h/ism ) && ( $iamadmin || $iamgmod ) ) { $stickdir = qq~   ~; } } ### End Sticky Shimmy Shuffle Mod if ($movedFlag) { $threadclass = 'locked_moved'; } if ( !$iamguest && $max_log_days_old ) { # Decide if thread should have the "NEW" indicator next to it. # Do this by reading the user's log for last read time on thread, # and compare to the last post time on the thread. $dlp = int( $yyuserlog{$mnum} ) > int( $yyuserlog{"$currentboard--mark"} ) ? int( $yyuserlog{$mnum} ) : int $yyuserlog{"$currentboard--mark"}; if ( !$movedFlag && ( $yyuserlog{"$mnum--unread"} || ( !$dlp && $mdate > $dmax ) || ( $dlp > $dmax && $dlp < $mdate ) ) ) { if ( ${$mnum}{'board'} eq $annboard ) { $new = qq~$newload{'new_mess'}~; } else { $new = qq~$newload{'new_mess'}~; } } else { $new = q{}; } } $micon = qq~$micon{$micon}~; $mpoll = q{}; if ( -e "$datadir/$mnum.poll" ) { $mpoll = qq~$messageindex_txt{'15'}: ~; fopen( POLL, "$datadir/$mnum.poll" ); my @poll = ; fclose(POLL); my ( $poll_question, $poll_locked, $poll_uname, $poll_name, $poll_email, $poll_date, $guest_vote, $hide_results, $multi_vote, $poll_mod, $poll_modname, $poll_comment, $vote_limit, $pie_radius, $pie_legends, $poll_end ) = split /\|/xsm, $poll[0]; chomp $poll_end; if ( $poll_end && !$poll_locked && $poll_end < $date ) { $poll_locked = 1; $poll_end = q{}; $poll[0] = "$poll_question|$poll_locked|$poll_uname|$poll_name|$poll_email|$poll_date|$guest_vote|$hide_results|$multi_vote|$poll_mod|$poll_modname|$poll_comment|$vote_limit|$pie_radius|$pie_legends|$poll_end\n"; fopen( POLL, ">$datadir/$mnum.poll" ); print {POLL} @poll or croak "$croak{'print'} POLL"; fclose(POLL); } $micon = qq~$micon{'pollicon'}~; if ($poll_locked) { $micon = $micon{'polliconclosed'}; } elsif ( !$iamguest && $max_log_days_old && $mdate > $date - ( $max_log_days_old * 86400 ) ) { if ( $dlp < $createpoll_date ) { $micon = qq~$micon{'polliconnew'}~; } else { fopen( POLLED, "$datadir/$mnum.polled" ); $polled = ; fclose(POLLED); ( undef, undef, undef, $vote_date, undef ) = split /\|/xsm, $polled; if ( $dlp < $vote_date ) { $micon = qq~$micon{'polliconnew'}~; } } } } # Load the current nickname of the account name of the thread starter. if ( $musername ne 'Guest' ) { LoadUser($musername); # See if they are an ex-member. if ( ( ${ $uid . $musername }{'regdate'} && $mdate > ${ $uid . $musername }{'regtime'} ) || ${ $uid . $musername }{'position'} eq 'Administrator' || ${ $uid . $musername }{'position'} eq 'Global Moderator' ) { if ( $iamguest) { $mname = $format_unbold{$musername}; } else { $mname = qq~$format_unbold{$musername}~; } } else { $mname .= qq~ ($messageindex_txt{'470a'})~; } } else { $mname .= " ($maintxt{'28'})"; } # Build the page links list. my $pagesall = q{}; my $pages = q{}; if ($showpageall) { $pagesall = qq~$pidtxt{'01'}~; } $maxmessagedisplay ||= 10; if ( int( ( $mreplies + 1 ) / $maxmessagedisplay ) > 6 ) { $pages = qq~ 1~; $pages .= qq~ 2~; $endpage = int( $mreplies / $maxmessagedisplay ) + 1; $i = ( $endpage - 1 ) * $maxmessagedisplay; $j = $i - $maxmessagedisplay; $k = $endpage - 1; $tmpa = $endpage - 2; $tmpb = $j - $maxmessagedisplay; $pages .= qq~ ...~; $pages .= qq~ $tmpa~; $pages .= qq~ $k~; $pages .= qq~ $endpage~; $pages = qq~
« $messageindex_txt{'139'} $pages $pagesall »~; } elsif ( $mreplies + 1 > $maxmessagedisplay ) { $tmpa = 1; foreach my $tmpb ( 0 .. $mreplies ) { if ( $tmpb % $maxmessagedisplay == 0 ) { $pages .= qq~$tmpa\n~; ++$tmpa; } } $pages =~ s/\n\Z//xsm; $pages = qq~
« $messageindex_txt{'139'} $pages $pagesall »~; } # build number of views my $views = ${$mnum}{'views'} ? ${$mnum}{'views'} - 1 : 0; $lastposter = ${$mnum}{'lastposter'}; if ( $lastposter =~ m{\AGuest-(.*)}xsm ) { $lastposter = $1 . " ($maintxt{'28'})"; } else { LoadUser($lastposter); if ( ( ${ $uid . $lastposter }{'regdate'} && ${$mnum}{'lastpostdate'} > ${ $uid . $lastposter }{'regtime'} ) || ${ $uid . $lastposter }{'position'} eq 'Administrator' || ${ $uid . $lastposter }{'position'} eq 'Global Moderator' ) { if ( $iamguest) { $lastposter = $format_unbold{$lastposter}; } else { $lastposter = qq~$format_unbold{$lastposter}~; } } else { # Need to load thread to see lastposters DISPLAYname if is Ex-Member fopen( EXMEMBERTHREAD, "$datadir/$mnum.txt" ) or fatal_error( 'cannot_open', "$datadir/$mnum.txt", 1 ); my @x = ; fclose(EXMEMBERTHREAD); $lastposter = ( split /\|/xsm, $x[-1], 3 )[1] . " - $messageindex_txt{'470a'}"; } } $lastpostername = $lastposter || $messageindex_txt{'470'}; if ( ( $stkynum && ( $counter >= $stkynum ) ) && ( $stkyshowed < 1 ) ) { $nonstickyheader =~ s/{yabb colspan}/$colspan/gsm; $tmptempbar .= $nonstickyheader; $stkyshowed = 1; } # Check if the thread contains attachments and create a paper-clip icon if it does $temp_attachment = q{}; if ( $attachments{$mnum} ) { my $alt = $attachments{$mnum} == 1 ? $messageindex_txt{'5'} : $messageindex_txt{'4'}; $temp_attachment = $attachments{$mnum} ? ( ( $guest_media_disallowed && $iamguest ) ? qq~$messageindex_txt{'3'} $attachments{$mnum} $alt~ : $msg_attach_win . qq~$messageindex_txt{'3'} $attachments{$mnum} $alt~ ) : q{}; $temp_attachment =~ s/{yabb mnum}/$mnum/sm; } $mcount++; # Print the thread info. $mydate = timeformat($mdate); if ( ( ( $iamadmin && $adminview == 3 ) || ( $iamgmod && $gmodview == 3 ) || ( $iamfmod && $fmodview == 3 ) || ( $iammod && $modview == 3 && !$iamadmin && !$iamgmod && !$iamfmod ) ) && $sessionvalid == 1 ) { if ( $currentboard eq $annboard ) { $adminbar = qq~ ~; } elsif ( $counter < $numanns ) { $adminbar = q~ ~; } else { $adminbar = qq~ ~; } $admincol = $admincolumn; $admincol =~ s/{yabb admin}/$adminbar/gsm; } elsif ( ( ( $iamadmin && $adminview == 2 ) || ( $iamgmod && $gmodview == 2 ) || ( $iamfmod && $fmodview == 2 ) || ( $iammod && $modview == 2 && !$iamadmin && !$iamgmod && !$iamfmod ) ) && $sessionvalid == 1 ) { if ( $currentboard ne $annboard && $counter < $numanns ) { $adminbar = q~ ~; } else { $adminbar = qq~~; } $admincol = $admincolumn; $admincol =~ s/{yabb admin}/$adminbar/gsm; } elsif ( ( ( $iamadmin && $adminview == 1 ) || ( $iamgmod && $gmodview == 1 ) || ( $iamfmod && $fmodview == 1 ) || ( $iammod && $modview == 1 && !$iamadmin && !$iamgmod && !$iamfmod ) ) && $sessionvalid == 1 ) { if ( $currentboard eq $annboard ) { $adminbar = qq~ $messageindex_txt{'104'}  $messageindex_txt{'844'}  $messageindex_txt{'132'}  $messageindex_txt{'54'} ~; } elsif ( $counter < $numanns ) { $adminbar = q~ ~; } else { $adminbar = qq~ $messageindex_txt{'104'}  $messageindex_txt{'781'}  $messageindex_txt{'844'}  $messageindex_txt{'132'}  $messageindex_txt{'54'} ~; } $admincol = $admincolumn; $admincol =~ s/{yabb admin}/$adminbar/gsm; } $msub = Censor($msub); ToChars($msub); if ( !$movedFlag ) { if ( $enabletopichover && !$messagelist && ( ${ $uid . $username }{'topicpreview'} || $iamguest ) ) { fopen( MNUM, "$datadir/$mnum.txt" ); my $thetopic = ; fclose(MNUM); my $themessage = ( split /\|/xsm, $thetopic )[8]; $clip = 0; $msglength = 200; $testlength = 0; $pretextlength = 0; FromHTML($themessage); $themessage =~ s~\[img\].*?\[\/img\]~[b][$messageindex_tp{'image_tp'}][/b]~igsm; $themessage =~ s~\[media].*?\[/media]~[b][$messageindex_tp{'media_tp'}][/b]~igsm; $themessage =~ s~\[code(.*?)].*?\[/code]~[b][XCODE$1][/b]~igsm; $themessage =~ s/
/
/igsm; $themessage =~ s/(
){2,}/
/igsm; $themessage =~ s/^
//igsm; local *fixtags = sub { ( $tmpmessage, $pretext, $pretag, $tagtext, $posttag ) = @_; $testmessage = $tmpmessage; $testmessage =~ s/\[.*?\]//gsm; $testmessage =~ s/\<.*?\>//gsm; $testlength = length $testmessage; $pretextlength = length $pretext; $pretext =~ s/\[(.*?\])/|$1/gsm; $pretag =~ s/\[/|/sm; $tagtext =~ s/\[(.*?\])/|$1/gsm; $posttag =~ s/\[/|/sm; if ( $pretextlength > $msglength ) { return $pretext; } if ( $testlength > $msglength ) { $clip = 1; $lgtagtxtrem = ( $msglength - $pretextlength ) - 3; $tagtextrem = substr $tagtext, 0, $lgtagtxtrem; $msglength += ( length($tmpmessage) - $testlength ); return $pretext . $pretag . $tagtextrem . '...' . $posttag; } $msglength += ( length($tmpmessage) - $testlength ); return $pretext . $pretag . $tagtext . $posttag; }; while ($testlength < $msglength && $themessage =~ s/^((.*?)(\[(\w+?)[\s|\=]*(.*?)\])(.*?)(\[\/\4\]))/ fixtags($1,$2,$3,$6,$7) /eisgm ) { } $themessage =~ s/\|(.*?\])/[$1/gsm; $themessage = substr $themessage, 0, $msglength; if ( length($themessage) > ( $msglength - 1 ) && !$clip ) { $themessage .= '...'; } $message = $themessage; $displayname = ${ $uid . $musername }{'realname'}; wrap(); if ($enable_ubbc) { if ( !$yyYaBBCloaded ) { require Sources::YaBBC; } DoUBBC(); } wrap2(); $themessage = $message; $message = q{}; ToChars($themessage); $themessage =~ s/XCODE/$messageindex_tp{'code_tp'}/gsm; $themessage = Censor($themessage); my $topicsum = qq~
$themessage
~; if ( ${$mnum}{'board'} eq $annboard ) { $msublink = qq~$msub$topicsum
$stickdir
~; } else { $msublink = qq~$msub$topicsum
$stickdir
~; } } else { if ( ${$mnum}{'board'} eq $annboard ) { $msublink = qq~$msub
$stickdir
~; } else { $msublink = qq~$msub
$stickdir
~; } } } elsif ( $movedFlag < 100 ) { Split_Splice_Move( $msub, 0 ); $msublink = qq~$msub
$movedSubject~; } else { $msub =~ /^(Re: )?\[m.*?\]: '(.*)'/sm; $msublink = qq~$maintxt{'758'}: '$2'
$movedSubject~; } my $mydate = timeformat($mdate); my $thicon = $micon{$threadclass}; my $tempbar = $movedFlag ? $threadbarMoved : $threadbar; $tempbar =~ s/{yabb admin column}/$admincol/gsm; $tempbar =~ s/{yabb threadpic}/$thicon/gsm; $tempbar =~ s/{yabb icon}/$micon/gsm; $tempbar =~ s/{yabb new}/$new/gsm; $tempbar =~ s/{yabb poll}/$mpoll/gsm; $tempbar =~ s/{yabb favorite}/ ($favicon{$mnum} ? qq~$micon{'addfav'}~ : q{}) /egsm; $tempbar =~ s/{yabb subjectlink}/$msublink/gsm; $tempbar =~ s/{yabb attachmenticon}/$temp_attachment/gsm; $tempbar =~ s/{yabb pages}/$pages/gsm; $tempbar =~ s/{yabb starter}/$mname/gsm; $tempbar =~ s/{yabb starttime}/ timeformat($mnum,0,0,0,1)/egsm; $tempbar =~ s/{yabb replies}/ NumberFormat($mreplies) /egsm; $tempbar =~ s/{yabb views}/ NumberFormat($views) /egsm; $tempbar =~ s/{yabb lastpostlink}/$img{'lastpost'} $mydate<\/a>/gsm; $tempbar =~ s/{yabb lastposter}/$lastpostername/gsm; $tempbar =~ s/{yabb altthdcolor}/$altthdcolor/gsm; if ( $accept_permalink == 1 ) { $tempbar =~ s/{yabb permalink}/$message_permalink/gsm; } else { $tempbar =~ s/{yabb permalink}//gsm; } $tmptempbar .= $tempbar; $counter++; } # Put a "no messages" message if no threads exist - just a bit more friendly... if ( !$tmptempbar ) { $tmptempbar = $brd_tmptempbar; $tmptempbar =~ s/{yabb colspan}/$colspan/sm; } $multiview = 0; my $tmptempfooter; if ( ( ( $iamadmin && $adminview == 3 ) || ( $iamgmod && $gmodview == 3 ) || ( $iamfmod && $fmodview == 3 ) || ( $iammod && $modview == 3 && !$iamadmin && !$iamgmod && !$iamfmod ) ) && $sessionvalid == 1 ) { $multiview = 3; } elsif ( ( ( $iamadmin && $adminview == 2 ) || ( $iamgmod && $gmodview == 2 ) || ( $iamfmod && $fmodview == 2 ) || ( $iammod && $modview == 2 && !$iamadmin && !$iamgmod && !$iamfmod ) ) && $sessionvalid == 1 ) { $multiview = 2; } if ( $multiview >= 2 ) { my $boardlist = moveto(); if ( $multiview eq '3' ) { $tempfooter = $subfooterbar; $adminselector = qq~ : ~; if ( $currentboard eq $annboard ) { $admincheckboxes = qq~ ~; } else { $admincheckboxes = qq~ ~; } $tempfooter =~ s/{yabb admin selector}/$adminselector/gsm; $tempfooter =~ s/{yabb admin checkboxes}/$admincheckboxes/gsm; } elsif ( $multiview eq '2' ) { $tempfooter = $subfooterbar; if ( $currentboard eq $annboard ) { $adminselector = qq~ : ~; } else { $adminselector = qq~ : ~; } $admincheckboxes = q~ ~; $tempfooter =~ s/{yabb admin selector}/$adminselector/gsm; $tempfooter =~ s/{yabb admin checkboxes}/$admincheckboxes/gsm; } $tmptempfooter = $subfooterbar; $tmptempfooter =~ s/{yabb admin selector}/$adminselector/gsm; $tmptempfooter =~ s/{yabb admin checkboxes}/$admincheckboxes/gsm; } if ( !$messagelist ) { $yabbicons = qq~ $micon{'thread'} $messageindex_txt{'457'}
$micon{'sticky'} $messageindex_txt{'779'}
$micon{'locked'} $messageindex_txt{'456'}
$micon{'stickylock'} $messageindex_txt{'780'}
$micon{'locked_moved'} $messageindex_txt{'845'}
~; if ( ($staff) && $sessionvalid == 1 ) { $yabbadminicons = qq~ $micon{'hide'} $messageindex_txt{'458'}
$micon{'hidesticky'} $messageindex_txt{'459'}
$micon{'hidelock'} $messageindex_txt{'460'}
$micon{'hidestickylock'} $messageindex_txt{'461'}
~; } $yabbadminicons .= qq~ $micon{'announcement'} $messageindex_txt{'779a'}
$micon{'announcementlock'} $messageindex_txt{'779b'}
$micon{'hotthread'} $messageindex_txt{'454'} $HotTopic $messageindex_txt{'454a'}
$micon{'veryhotthread'} $messageindex_txt{'455'} $VeryHotTopic $messageindex_txt{'454a'}
~; LoadAccess(); } #template it $messageindex_template =~ s/{yabb board}/$boardlink/gsm; $template_mods = qq~$modslink$showmodgroups~; if ($iamadmin) { require Sources::AddModerators; ModSearch(); $template_mods .= qq~
$addmod_txt{'modsearch'}~; } my ( $rss_link, $rss_text ); if ( !$rss_disabled ) { $rss_link = qq~$maintxt{'rssfeed'}~; $rss_text = qq~$messageindex_txt{843}~; } $yyrssfeed = $rss_text; $yyrss = $rss_link; $messageindex_template =~ s/{yabb rssfeed}/$rss_text/gsm; $messageindex_template =~ s/{yabb rss}/$rss_link/gsm; $messageindex_template =~ s/{yabb home}/$homelink/gsm; $messageindex_template =~ s/{yabb category}/$catlink/gsm; $messageindex_template =~ s/{yabb board}/$boardlink/gsm; $messageindex_template =~ s/{yabb moderators}/$template_mods/gsm; if ($enabletopichover) { if ( !$iamguest && !$INFO{'messagelist'} ) { if ( ${ $uid . $username }{'topicpreview'} ) { $enab_topicprev = qq~$messageindex_tp{'disabletp'}
~; } else { $enab_topicprev = qq~$messageindex_tp{'enabletp'}
~; } } } else { $enab_topicprev = q{}; } $messageindex_template =~ s/{yabb topicpreview}/$enab_topicprev/gsm; $messageindex_template =~ s/{yabb sortsubject}/$sort_subject/gsm; $messageindex_template =~ s/{yabb sortstarter}/$sort_starter/gsm; $messageindex_template =~ s/{yabb sortanswer}/$sort_answer/gsm; $messageindex_template =~ s/{yabb sortlastpostim}/$sort_lastpostim/gsm; if ($ShowBDescrip) { if ( $bdescrip ) { ToChars($bdescrip); $boarddescription =~ s/{yabb boarddescription}/$bdescrip/gsm; $messageindex_template =~ s/{yabb description}/$boarddescription/gsm; } else { $messageindex_template =~ s/{yabb description}//gsm; } } $bdpic = qq~$imagesdir/boards.$bdpicExt~; if (-e "<$boardsdir/brdpics.db") { fopen( BRDPIC, "<$boardsdir/brdpics.db" ); my @brdpics = ; fclose(BRDPIC); chomp @brdpics; foreach (@brdpics) { my ( $brdnm, $style, $brdpic ) = split /[|]/xsm, $_; if ( $brdnm eq $currentboard && $template eq $style ) { if ( $brdpic =~ /\//ixsm ) { $bdpic = $brdpic; } elsif ( -e "$htmldir/Templates/Forum/$useimages/Boards/$brdpic" ) { $bdpic = qq~$imagesdir/Boards/$brdpic~; } } } } else { $bdpic = qq~$imagesdir/boards.$bdpicExt~; } if ( ${ $uid . $currentboard }{'ann'} ) { $bdpic = qq~$imagesdir/ann.$bdpicExt~; } if ( ${ $uid . $currentboard }{'rbin'} ) { $bdpic = qq~$imagesdir/recycle.$bdpicExt~; } $bdpic = qq~ $curboardname ~; $messageindex_template =~ s/{yabb bdpicture}/$bdpic/gsm; my $tmpthreadcount = NumberFormat( ${ $uid . $currentboard }{'threadcount'} ); my $tmpmessagecount = NumberFormat( ${ $uid . $currentboard }{'messagecount'} ); $messageindex_template =~ s/{yabb threadcount}/$tmpthreadcount/gsm; $messageindex_template =~ s/{yabb messagecount}/$tmpmessagecount/gsm; $messageindex_template =~ s/{yabb new_load}/$newload/gsm; $messageindex_template =~ s/{yabb colspan}/$colspan/gsm; ### Board Rules Start ### if ( ${ $uid . $currentboard }{'rules'} == 1 ) { ToChars( ${ $uid . $currentboard }{'rulestitle'} ); ToChars( ${ $uid . $currentboard }{'rulesdesc'} ); $tmpruletxt = qq~${$uid.$currentboard}{'rulesdesc'}~; if ( !$iamguest && ${ $uid . $currentboard }{'rulescollapse'} == 1 ) { $tmprulelgt = length( ${ $uid . $currentboard }{'rulesdesc'} ); $rulestitle = qq~$boardindex_exptxt{'2'}~; my @collbdrules = split /\|/xsm, ${ $uid . $username }{'collapsebdrules'}; for my $i ( 0 .. $#collbdrules ) { ( $rulebd, $rulelgt ) = split /,/xsm, $collbdrules[$i]; if ( $rulebd eq $currentboard && $rulelgt == $tmprulelgt ) { $tmpruletxt = qq~$messageindex_txt{'collruletext'}~; $rulestitle = qq~$boardindex_exptxt{'1'}~; } } } $rulestitle .= qq~ ${$uid.$currentboard}{'rulestitle'}~; $rulesdesc = qq~
$tmpruletxt
~; if ( !$iamguest && ${ $uid . $currentboard }{'rulescollapse'} == 1 ) { $mycat_col = $newload{'brd_col'}; $mycat_exp = $newload{'brd_exp'}; $rulesdesc .= qq~ ~; } $messageindex_template =~ s/{yabb rulestitle}/$rulestitle/gsm; $messageindex_template =~ s/{yabb rulesdescription}/$rulesdesc/gsm; } ### Board Rules End ### $tool_sep = $useThreadtools ? q{|||} : q{}; $topichandellist =~ s/{yabb notify button}/$notify_board$tool_sep/gsm; $topichandellist =~ s/{yabb markall button}/$markalllink$tool_sep/gsm; $topichandellist =~ s/{yabb new post button}/$postlink$tool_sep/gsm; $topichandellist =~ s/{yabb new poll button}/$polllink$tool_sep/gsm; $topichandellist =~ s/\Q$menusep//ixsm; @threadin = ( "$notify_board","$markalllink","$postlink","$polllink",); @threadout = (); my $sepcn = 0; for (@threadin) { if ($_ ) { if ( !$useThreadtools ) { $threadout[$sepcn] = "$_$my_ttsep";} else { $threadout[$sepcn] = "$my_ttsep$_"; } } else { $threadout[$sepcn] = q{}; } $sepcn++; } $outside_threadtools =~ s/{yabb notify button}/$threadout[0]/gsm; $outside_threadtools =~ s/{yabb markall button}/$threadout[1]/gsm; $outside_threadtools =~ s/{yabb new post button}/$threadout[2]/gsm; $outside_threadtools =~ s/{yabb new poll button}/$threadout[3]/gsm; ## Mod Hook outside_threadtools ## if ( $my_ttsep ne q{ } ) { $outside_threadtools =~ s/\Q$my_ttsep//ixsm; } if ( !$useThreadtools ) { if ( $menusep ne q{ } ) { $outside_threadtools =~ s/\Q$menusep//ixsm; } $topichandellist = $outside_threadtools . $topichandellist; $outside_threadtools = q{}; } else { $outside_threadtools =~ s/\[tool=(.+?)\](.+?)\[\/tool\]/$tmpimg{$1}/gsm; $topichandellist =~ s/\[tool=(.+?)\](.+?)\[\/tool\]/$2/gsm; } $topichandellist2 = $topichandellist; # Thread Tools # if ($useThreadtools) { $dropid = q{}; if ($messagelist) { $dropid = $INFO{'board'}; } $topichandellist2 = MakeTools( "bottom$dropid", $maintxt{'62'}, $topichandellist2 ); $topichandellist = MakeTools( "top$dropid", $maintxt{'62'}, $topichandellist ); } $messageindex_template =~ s/{yabb outsidethreadtools}/$outside_threadtools/gsm; $messageindex_template =~ s/{yabb topichandellist}/$topichandellist/gsm; $messageindex_template =~ s/{yabb topichandellist2}/$topichandellist2/gsm; $messageindex_template =~ s/{yabb pageindex top}/$pageindex1/gsm; $messageindex_template =~ s/{yabb pageindex bottom}/$pageindex2/gsm; if ( ( ( $iamadmin && $adminview == 3 ) || ( $iamgmod && $gmodview == 3 ) || ( $iamfmod && $fmodview == 3 ) || ( $iammod && $modview == 3 && !$iamadmin && !$iamgmod && !$iamfmod ) ) && $sessionvalid == 1 ) { $messageindex_template =~ s/{yabb admin column}/$adminheader/gsm; } elsif ( ( ( $iamadmin && $adminview != 0 ) || ( $iamgmod && $gmodview != 0 ) || ( $iamfmod && $fmodview != 0 ) || ( $iammod && $modview != 0 && !$iamadmin && !$iamgmod && !$iamfmod ) ) && $sessionvalid == 1 ) { $messageindex_template =~ s/{yabb admin column}/$adminheader/gsm; } else { $messageindex_template =~ s/{yabb admin column}//gsm; } if ( ( ( $iamadmin && $adminview >= 2 ) || ( $iamgmod && $gmodview >= 2 ) || ( $iamfmod && $fmodview >= 2 ) || ( $iammod && $modview >= 2 && !$iamadmin && !$iamgmod && !$iamfmod ) ) && $sessionvalid == 1 ) { if ( !$messagelist ) { $formstart = qq~
~; } else { $formstart = qq~ ~; } $formend = qq~
~; $messageindex_template =~ s/{yabb modupdate}/$formstart/gsm; $messageindex_template =~ s/{yabb modupdateend}/$formend/gsm; } else { $messageindex_template =~ s/{yabb modupdate}//gsm; $messageindex_template =~ s/{yabb modupdateend}//gsm; } if ($tmpstickyheader) { $messageindex_template =~ s/{yabb stickyblock}/$tmpstickyheader/gsm; } else { $messageindex_template =~ s/{yabb stickyblock}//gsm; } $messageindex_template =~ s/{yabb threadblock}/$tmptempbar/gsm; if ($tmptempfooter) { $messageindex_template =~ s/{yabb adminfooter}/$tmptempfooter/gsm; } else { $messageindex_template =~ s/{yabb adminfooter}//gsm; } $messageindex_template =~ s/{yabb icons}/$yabbicons/gsm; $messageindex_template =~ s/{yabb admin icons}/$yabbadminicons/gsm; $messageindex_template =~ s/{yabb access}/ $messagelist ? q{} : LoadAccess() /esm; # Show subboards if ( $subboard{$currentboard} ) { $show_subboards = 1; $subboard_sel = $currentboard; require Sources::BoardIndex; $boardindex_template = BoardIndex(); } $yymain .= qq~ $boardindex_template $messageindex_template $pageindexjs ~; if ( ( ( $iamadmin && $adminview >= 2 ) || ( $iamgmod && $gmodview >= 2 ) || ( $iamfmod && $fmodview >= 2 ) || ( $iammod && $modview >= 2 && !$iamadmin && !$iamgmod && !$iamfmod ) ) && $sessionvalid == 1 ) { my $modul = $currentboard eq $annboard ? 4 : 5; if ( $sessionvalid == 1 ) { $yymain .= qq~ \n~; } } $yyjavascript .= qq~\nvar markallreadlang = '$messageindex_txt{'500'}';\nvar markfinishedlang = '$messageindex_txt{'500a'}';~; $yymain .= qq~ ~; # Make browsers aware of our RSS if ( !$rss_disabled && $INFO{'board'} ) { # Check to see if we're on a real board, not announcements $yyinlinestyle .= qq~ ~; } if ( !$messagelist ) { $yynavback = qq~$tabsep ‹ $img_txt{'103'}   ~; $yynavigation = qq~› $catlink$boardtree~; $yytitle = $curboardname; if ( $postlink && $enable_quickpost == 1 && !$mindex_postpopup ) { $yymain =~ s/()/$1\n
{yabb forumjump}<\/div>/sm; require Sources::Post; $action = 'post'; $INFO{'title'} = 'StartNewTopic'; $Quick_Post = 1; Post(); } template(); } else { print "Content-type: text/html; charset=$yymycharset\n\n" or croak "$croak{'print'} content-type"; print qq~ $messageindex_template $pageindexjs ~ or croak "$croak{'print'} content"; CORE::exit; # This is here only to avoid server error log entries! } return; } sub collapse_bdrule { $tmpboardrules = q{}; my @tmpbdrule = split /\|/xsm, ${ $uid . $username }{'collapsebdrules'}; for my $i ( 0 .. $#tmpbdrule ) { my ( $tmrulebd, $tmrulelgt ) = split /,/xsm, $tmpbdrule[$i]; if ( $tmrulebd ne $INFO{'rulebd'} ) { $tmpboardrules .= qq~$tmpbdrule[$i]|~; } } if ( $INFO{'rulelg'} > 1 ) { $tmpboardrules .= qq~$INFO{'rulebd'},$INFO{'rulelg'}~; } $tmpboardrules =~ s/\|\Z//xsm; ${ $uid . $username }{'collapsebdrules'} = $tmpboardrules; UserAccount( $username, 'update' ); $elenable = 0; croak q{}; return; } sub MarkRead { # Mark all threads in this board as read. # Load the log file getlog(); # Look for any threads marked unread in the current board and remove them fopen( BRDTXT, "$boardsdir/$currentboard.txt" ) or fatal_error( 'cannot_open', "$boardsdir/$currentboard.txt", 1 ); my @threadlist = map { /^(\d+)\|/xsm } ; fclose(BRDTXT); # Loop through @threadlist and delete the corresponding item from %yyuserlog foreach (@threadlist) { delete $yyuserlog{"$_--unread"}; } # Write it out dumplog("$currentboard--mark"); if ( $INFO{'oldmarkread'} ) { MessageIndex(); } $elenable = 0; croak q{}; # This is here only to avoid server error log entries! } sub ListPages { my ( $pcount, $maxvalue, $tlink ); if ( $INFO{'num'} ) { $tlink = $INFO{'num'}; $pcount = ${ $INFO{'num'} }{'replies'} + 1; $maxvalue = $maxmessagedisplay; $jcode = 'num='; } if ( $INFO{'board'} ) { $tlink = $INFO{'board'}; $pcount = $INFO{'count'}; $maxvalue = $maxdisplay; $jcode = 'board='; } $tmpa = 1; foreach my $tmpb ( 0 .. ( $pcount - 1 ) ) { if ( $tmpb % $maxvalue == 0 ) { $pages .= qq~$tmpa\n~; ++$tmpa; } } $pages =~ s/\n\Z//xsm; print_output_header(); get_template('MessageIndex'); $output = $msg_listpages; $output =~ s/{yabb jcode}/$jcode/sm; $output =~ s/{yabb pages}/$pages/sm; print_HTML_output_and_finish(); return; } sub MessagePageindex { my ( $msindx, $trindx, $mbindx, $pmindx ) = split /\|/xsm, ${ $uid . $username }{'pageindex'}; if ( $INFO{'action'} eq 'messagepagedrop' ) { ${ $uid . $username }{'pageindex'} = qq~0|$trindx|$mbindx|$pmindx~; } elsif ( $INFO{'action'} eq 'messagepagetext' ) { ${ $uid . $username }{'pageindex'} = qq~1|$trindx|$mbindx|$pmindx~; } UserAccount( $username, 'update' ); MessageIndex(); return; } sub moveto { my ( $boardlist, $catid, $board, $boardname, $boardperms, $boardview, $brdlist, @bdlist, $catname, $catperms, $access ); get_forum_master(); local *move_subboards = sub { my @x = @_; $indent += 2; foreach my $board (@x) { my $dash; if ( $indent > 0 ) { $dash = q{-}; } ( $boardname, $boardperms, $boardview ) = split /\|/xsm, $board{"$board"}; ToChars($boardname); $access = AccessCheck( $board, q{}, $boardperms ); if ( !$iamadmin && $access ne 'granted' ) { next; } my $bdnopost = q{}; if ( $board ne $currentboard ) { $my_board = $board; if ( !${ $uid . $board }{'canpost'} && $subboard{$board} ) { $alert = qq~$messageindex_txt{'nopost'}~; $bdnopost = qq~ class="nopost" onclick="alert('$alert')"~; $my_board = q{}; } $boardlist .= qq~~ . ( ' ' x $indent ) . ( $dash x ( $indent / 2 ) ) . qq~$boardname\n~; } if ( $subboard{$board} ) { move_subboards( split /\|/xsm, $subboard{$board} ); } } $indent -= 2; }; foreach my $catid (@categoryorder) { $brdlist = $cat{$catid}; if ( !$brdlist ) { next; } (@bdlist) = split /\,/xsm, $cat{$catid}; #@bdlist = split(/\,/, $brdlist); ( $catname, $catperms ) = split /\|/xsm, $catinfo{$catid}; $access = CatAccess($catperms); if ( !$access ) { next; } ToChars($catname); $boardlist .= qq~~; my $indent = -2; move_subboards(@bdlist); $boardlist .= q~~; } return $boardlist; } sub LoadAccess { my $yesaccesses = "$load_txt{'805'} $load_txt{'806'} $load_txt{'808'}
"; my $noaccesses = q{}; # Reply Check if ( AccessCheck( $currentboard, 2 ) eq 'granted' ) { $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'809'}
"; } else { $noaccesses .= "$load_txt{'805'} $load_txt{'807'} $load_txt{'809'}
"; } # start new Topic Check if ( AccessCheck( $currentboard, 1 ) eq 'granted' ) { $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'810'}
"; } else { $noaccesses .= "$load_txt{'805'} $load_txt{'807'} $load_txt{'810'}
"; } # Attachments Check $allowattach ||= 0; if ( AccessCheck( $currentboard, 4 ) eq 'granted' && $allowattach > 0 && ( ${ $uid . $currentboard }{'attperms'} && ${ $uid . $currentboard }{'attperms'} == 1 ) && ( ( $allowguestattach == 0 && !$iamguest ) || $allowguestattach == 1 ) ) { $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'813'}
"; } else { $noaccesses .= "$load_txt{'805'} $load_txt{'807'} $load_txt{'813'}
"; } # Poll Check if ( AccessCheck( $currentboard, 3 ) eq 'granted' ) { $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'811'}
"; } else { $noaccesses .= "$load_txt{'805'} $load_txt{'807'} $load_txt{'811'}
"; } # Zero Post Check if ( $username ne 'Guest' ) { if ( $INFO{'zeropost'} != 1 && AccessCheck( $currentboard, 2 ) eq 'granted' ) { $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'812'}
"; } else { $noaccesses .= "$load_txt{'805'} $load_txt{'807'} $load_txt{'812'}
"; } } return qq~$yesaccesses
$noaccesses~; } sub SetTopicPreview { if ( !$INFO{'todo'} || $INFO{'todo'} eq 'disable' ) { ${ $uid . $username }{'topicpreview'} = '0'; } else { ${ $uid . $username }{'topicpreview'} = '1'; } UserAccount( $username, 'update' ); MessageIndex(); return; } 1;