############################################################################### # MessageIndex.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. # ############################################################################### $messageindexplver = 'YaBB 2.4 $Revision$'; if ($GLOBAL::ACTION eq 'detailedversion') { return 1; } &LoadLanguage('MessageIndex'); require "$templatesdir/$usemessage/MessageIndex.template"; sub MessageIndex { # Check if board was 'shown to all' - and whether they can view the board if (&AccessCheck($currentboard, '', $boardperms) ne "granted") { &fatal_error("no_access"); } if ($annboard eq $currentboard && !$iamadmin && !$iamgmod) { &fatal_error("no_access"); } my ($counter, $mcount, $buffer, $pages, $showmods, $mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate, $dlp, $threadlength); my ($numanns, $threadcount, $countsticky, $countnosticky, $stkynum, @temp_list, @threadlist, @stickythreadlist, @nostickythreadlist, @threads, $usermessagepage, $tsort, %user_info); &BoardTotals("load", $currentboard); # Build a list of the board's moderators. 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) . ", "; } $showmods =~ s/, \Z/)/; } 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(/\|/, $NoPost{$tmpmodgrp}, 2); $showmodgroups .= qq~$thismodgrp, ~; } $showmodgroups =~ s/, \Z/)/; } if ($showmodgroups ne "" && $showmods ne "") { $showmods .= qq~ - ~; } # Load announcements, if they exist. if ($annboard && $annboard ne $currentboard && ${$uid.$currentboard}{'rbin'} != 1) { chomp $annboard; @temp_list = &read_DBorFILE(0,'',$boardsdir,$annboard,'txt'); foreach my $realanns (@temp_list) { my $threadstatus = (split /\|/, $realanns)[8]; if ($threadstatus =~ /h/i && !$staff) { next; } push (@threads, $realanns); $numanns++; } } # Determine what category we are in. $catid = ${$uid.$currentboard}{'cat'}; ($cat, undef) = split(/\|/, $catinfo{$catid}); &ToChars($cat); @temp_list = &read_DBorFILE(0,'',$boardsdir,$currentboard,'txt'); # Sort the messages START if (!$iamguest) { ($usermessagepage, undef, undef, undef, $tsort) = split(/\|/, ${$uid.$username}{'pageindex'}); } else { $tsort = $INFO{'tsort'}; } $sort_subject = qq~$messageindex_txt{'70'}~; $sort_starter = qq~$messageindex_txt{'109'}~; $sort_answer = qq~$messageindex_txt{'110'}~; $sort_lastpostim = qq~$messageindex_txt{'22'}~; &ManageMemberinfo("load"); if ($tsort == 1) { $sort_lastpostim = qq~$messageindex_txt{'22'} $messageindex_sort{'sort_first'}~; @threadlist = reverse (@temp_list); } elsif ($tsort == 2) { $sort_subject = qq~$messageindex_txt{'70'} $messageindex_sort{'sort_za'}~; @threadlist = sort {lc((split /\|/,$b,3)[1]) cmp lc((split /\|/,$a,3)[1])} @temp_list; } elsif ($tsort == 3) { $sort_subject = qq~$messageindex_txt{'70'} $messageindex_sort{'sort_az'}~; @threadlist = sort {lc((split /\|/,$a,3)[1]) cmp lc((split /\|/,$b,3)[1])} @temp_list; } elsif ($tsort == 4) { $sort_starter = qq~$messageindex_txt{'109'} $messageindex_sort{'sort_za'}~; @threadlist = sort { &starter((split /\|/, $b, 8)[6], $b) cmp &starter((split /\|/, $a, 8)[6], $a) } @temp_list; } elsif ($tsort == 5) { $sort_starter = qq~$messageindex_txt{'109'} $messageindex_sort{'sort_az'}~; @threadlist = sort { &starter((split /\|/, $a, 8)[6], $a) cmp &starter((split /\|/, $b, 8)[6], $b) } @temp_list; } elsif ($tsort == 6) { $sort_answer = qq~$messageindex_txt{'110'} $messageindex_sort{'sort_max'}~; @threadlist = sort {(split /\|/,$b,7)[5] <=> (split /\|/,$a,7)[5]} @temp_list; } elsif ($tsort == 7) { $sort_answer = qq~$messageindex_txt{'110'} $messageindex_sort{'sort_min'}~; @threadlist = sort {(split /\|/,$a,7)[5] <=> (split /\|/,$b,7)[5]} @temp_list; } else { $sort_lastpostim = qq~$messageindex_txt{'22'} $messageindex_sort{'sort_last'}~; @threadlist = @temp_list; } sub starter { return $user_info{$_[0]} if exists $user_info{$_[0]}; return lc((split /\|/, $_[1], 4)[2]) unless exists $memberinf{$_[0]}; $user_info{$_[0]} = lc((split /\|/, $memberinf{$_[0]}, 3)[1]); } undef @temp_list; undef %user_info; # Sort the messages END foreach (@threadlist) { my $threadstatus = (split /\|/, $_)[8]; if ($threadstatus =~ /h/i && !$staff) { next; } if ($threadstatus =~ /s/i) { push (@threads, $_); $countsticky++; } else { push (@nostickythreadlist, $_); $threadcount++; } } undef @threadlist; $threadcount = $threadcount + $countsticky + $numanns; my $maxindex = $INFO{'view'} eq 'all' ? $threadcount : $maxdisplay; # There are three kinds of lies: lies, damned lies, and statistics. # - Mark Twain # Construct the page links for this board. my ($pagetxtindex, $pagetextindex, $pagedropindex1, $pagedropindex2, $all, $allselected); $indexdisplaynum = 3; # max number of pages to display $dropdisplaynum = 10; $startpage = 0; $max = $threadcount; if (substr($INFO{'start'}, 0, 3) eq 'all' && $showpageall != 0) { $maxindex = $max; $all = 1; $allselected = qq~ 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 = qq~~; if (!$iamguest) { $pagetxtindexst .= qq~$messageindex_txt{'19'} $messageindex_txt{'139'}: ~; } else { $pagetxtindexst .= qq~$messageindex_txt{'139'} $messageindex_txt{'139'}: ~; } if ($startpage > 0) { $pagetxtindex = qq~1 ... ~; } if ($startpage == $maxindex) { $pagetxtindex = qq~1 ~; } for ($counter = $startpage; $counter < $endpage; $counter += $maxindex) { $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 = qq~~; $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 ($i = 0; $i < $indexpages; $i++) { $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 = ""; if ($i == $selectedindex) { $selected = qq~ 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 .= qq~~; $pagedropindex2 .= qq~~; $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'}~; } if ($nextpage > $lastptn) { $pagedropindexnx .= qq~~; } else { $pagedropindexnx .= qq~$pidtxt{'03'}~; } $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) { foreach (&read_DBorFILE(1,'',$vardir,'attachments','txt')) { $attachments{(split(/\|/, $_, 2))[0]}++; } } &LoadCensorList; # check if user can bypass locked threads my $icanbypass = &checkUserLockBypass; my ($bypasslock,$exist_locked); # check the Multi-admin setting my $multiview = 0; if ($staff) { if (($iamadmin && $adminview == 3) || ($iamgmod && $gmodview == 3) || ($iammod && $modview == 3)) { $multiview = 3; } elsif (($iamadmin && $adminview == 2) || ($iamgmod && $gmodview == 2) || ($iammod && $modview == 2)) { $multiview = 2; } elsif (($iamadmin && $adminview == 1) || ($iamgmod && $gmodview == 1) || ($iammod && $modview == 1)) { $multiview = 1; } } # Print the header and board info. &ToChars($boardname); if ($multiview == 1) { $yymain .= qq~~; } my $homelink = qq~$mbname~; my $catlink = qq~$cat~; my $boardlink = qq~$boardname~; my $modslink = qq~$showmods~; # check howmany col's must be spanned if ($multiview > 0) { $colspan = 8; } else { $colspan = 7; } if (!$iamguest) { $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 $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'}~ if $icanbypass; $adminlink .= qq~$messageindex_txt{'844'}$messageindex_txt{'132'}$messageindex_txt{'54'}~; } else { $adminlink = qq~$messageindex_txt{'104'}~ if $icanbypass; $adminlink .= qq~$messageindex_txt{'781'}$messageindex_txt{'844'}$messageindex_txt{'132'}$messageindex_txt{'54'}~; } $adminheader =~ s/({|<)yabb admin(}|>)/$adminlink/g; } elsif ($multiview) { $adminheader =~ s/({|<)yabb admin(}|>)/$messageindex_txt{'2'}/g; } # check to display moderator column my $tmpstickyheader; if ($stkynum) { $stickyheader =~ s/({|<)yabb colspan(}|>)/$colspan/g; $tmpstickyheader = $stickyheader; } # load Favorites in a hash if (${$uid.$username}{'favorites'}) { foreach (split(/,/, ${$uid.$username}{'favorites'})) { $favicon{$_} = 1; } } # 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(/\|/, $_); my ($movedSubject, $movedFlag) = &Split_Splice_Move($msub,$mnum); &MessageTotals('load', $mnum); my $goodboard = $mstate =~ /a/i ? $annboard : $currentboard; if (${$mnum}{'board'} ne $goodboard) { ${$mnum}{'board'} = $goodboard if $goodboard; &MessageTotals('recover', $mnum); } $permlinkboard = ${$mnum}{'board'} eq $annboard ? $annboard : $currentboard; my $permdate = &permtimer($_); my $message_permalink = qq~$messageindex_txt{'10'}~; $bypasslock = 0; # 0 - not locked; 1 - locked and I can bypass; 2 - locked $threadclass = 'thread'; if ($mstate =~ /h/i) { $threadclass = 'hide'; } elsif ($mstate =~ /l/i) { $threadclass = 'locked'; if (!$movedFlag) { $bypasslock = $icanbypass ? 1 : 2; $exist_locked = 1; } } elsif ($mreplies >= $VeryHotTopic) { $threadclass = 'veryhotthread'; } elsif ($mreplies >= $HotTopic) { $threadclass = 'hotthread'; } elsif ($mstate == '') { $threadclass = 'thread'; } if ($threadclass eq 'hide' && $mstate =~ /s/i && $mstate !~ /l/i) { $threadclass = 'hidesticky'; } elsif ($threadclass eq 'hide' && $mstate =~ /l/i && $mstate !~ /s/i) { $threadclass = 'hidelock'; if (!$movedFlag) { $bypasslock = $icanbypass ? 1 : 2; $exist_locked = 1; } } elsif ($threadclass eq 'hide' && $mstate =~ /s/i && $mstate =~ /l/i) { $threadclass = 'hidestickylock'; } elsif ($threadclass eq 'locked' && $mstate =~ /s/i && $mstate !~ /h/i) { $threadclass = 'stickylock'; } elsif ($mstate =~ /s/i && $mstate !~ /h/i) { $threadclass = 'sticky'; } elsif (${$mnum}{'board'} eq $annboard && $mstate !~ /h/i) { $threadclass = $threadclass eq 'locked' ? 'announcementlock' : 'announcement'; } $threadclass = 'locked_moved' if $movedFlag; 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~$messageindex_txt{'302'}~; } else { $new = qq~$messageindex_txt{'302'}~; } } else { $new = ''; } } $micon = qq~~; $mpoll = ""; if (&checkfor_DBorFILE("$datadir/$mnum.poll")) { $mpoll = qq~$messageindex_txt{'15'}: ~; my @poll = &read_DBorFILE(1,'',$datadir,$mnum,'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(/\|/, $poll[0]); chomp $poll_end; if ($poll_end && !$poll_locked && $poll_end < $date) { $poll_locked = 1; $poll_end = ''; $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"; &write_DBorFILE(1,'',$datadir,$mnum,'poll',@poll); } $micon = qq~$img{'pollicon'}~; if ($poll_locked) { $micon = $img{'polliconclosed'}; } elsif (!$iamguest && $max_log_days_old && $mdate > $date - ($max_log_days_old * 86400)) { if ($dlp < $createpoll_date) { $micon = qq~$img{'polliconnew'}~; } else { (undef, undef, undef, $vote_date, undef) = split(/\|/, (&read_DBorFILE(1,'',$datadir,$mnum,'polled'))[0]); if ($dlp < $vote_date) { $micon = qq~$img{'polliconnew'}~; } } } } # Load the current nickname of the account name of the thread starter. if ($musername ne 'Guest') { $user_info{$musername} = [split(/\|/, $memberinf{$musername}, 3)] if !exists $user_info{$musername}; if ($memberinf{$musername} && $mdate > ${$user_info{$musername}}[0]) { &FormatUserName($musername); $mname = qq~${$user_info{$musername}}[1]~; } else { $mname .= qq~ ($messageindex_txt{'470a'})~; } } else { $mname .= " ($maintxt{'28'})"; } # Build the page links list. my ($pages, $pagesall); if ($showpageall) { $pagesall = qq~$pidtxt{'01'}~; } 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; for ($tmpb = 0; $tmpb < $mreplies + 1; $tmpb += $maxmessagedisplay) { $pages .= qq~$tmpa\n~; ++$tmpa; } $pages =~ s/\n\Z//; $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-(.*)~) { $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") { $lastposter = qq~${$uid.$lastposter}{'realname'}~; } else { # Need to load thread to see lastposters DISPLAYname if is Ex-Member my @x = &read_DBorFILE(0,'',$datadir,$mnum,'txt'); $lastposter = (split(/\|/, $x[$#x], 3))[1] . " - $messageindex_txt{'470a'}"; } } $lastpostername = $lastposter || $messageindex_txt{'470'}; if (($stkynum && ($counter >= $stkynum)) && ($stkyshowed < 1)) { $nonstickyheader =~ s/({|<)yabb colspan(}|>)/$colspan/g; $tmptempbar .= $nonstickyheader; $stkyshowed = 1; } # Check if the thread contains attachments and create a paper-clip icon if it does 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~ : qq~~ . qq~$messageindex_txt{'3'} $attachments{$mnum} $alt~) : ""; $mcount++; # Print the thread info. my $admincol; if ($multiview == 3) { my $adminbar; my $js_confirm = qq~ onclick="if (confirm('$messageindex_txt{'modifylocked'}') == false) this.checked = false;"~ if $bypasslock == 1; if ($counter < $numanns || $bypasslock == 2) { $adminbar = qq~ ~; } elsif ($currentboard eq $annboard) { $adminbar = qq~ ~ if $icanbypass; $adminbar .= qq~ ~; } else { $adminbar = qq~ ~ if $icanbypass; $adminbar .= qq~ ~; } $admincol = $admincolumn; $admincol =~ s/({|<)yabb admin(}|>)/$adminbar/g; } elsif ($multiview == 2) { my $adminbar; my $js_confirm = qq~ onclick="if (confirm('$messageindex_txt{'modifylocked'}') == false) this.checked = false;"~ if $bypasslock == 1; if ($currentboard ne $annboard && $counter < $numanns || $bypasslock == 2) { $adminbar = qq~ ~; } else { $adminbar = qq~~; } $admincol = $admincolumn; $admincol =~ s/({|<)yabb admin(}|>)/$adminbar/g; } elsif ($multiview == 1) { my $adminbar; my $js_confirm = qq~ onclick="return confirm('$messageindex_txt{'modifylocked'}');"~ if $bypasslock == 1; if ($counter < $numanns || $bypasslock == 2) { $adminbar = qq~ ~; } elsif ($currentboard eq $annboard) { $adminbar = qq~ $messageindex_txt{'104'} ~ if $icanbypass; $adminbar .= qq~ $messageindex_txt{'844'}  $messageindex_txt{'132'}  $messageindex_txt{'54'} ~; } else { $adminbar = qq~ $messageindex_txt{'104'} ~ if $icanbypass; $adminbar .= qq~ $messageindex_txt{'781'}  $messageindex_txt{'844'}  $messageindex_txt{'132'}  $messageindex_txt{'54'} ~; } $admincol = $admincolumn; $admincol =~ s/({|<)yabb admin(}|>)/$adminbar/g; } $msub = &Censor($msub); &ToChars($msub); if(!$movedFlag) { if (${$mnum}{'board'} eq $annboard) { $msublink = qq~$msub~; } else { $msublink = qq~$msub~; } } elsif ($movedFlag < 100) { &Split_Splice_Move($msub,0); $msublink = qq~$msub
$movedSubject~; } else { $msub =~ /^(Re: )?\[m.*?\]: '(.*)'/; # newer then code in &Split_Splice_Move $msublink = qq~$maintxt{'758'}: '$2'
$movedSubject~; } my $mydate = &timeformat($mdate); my $tempbar = $movedFlag ? $threadbarMoved : $threadbar; $tempbar =~ s/({|<)yabb admin column(}|>)/$admincol/g; $tempbar =~ s/({|<)yabb threadpic(}|>)//g; $tempbar =~ s/({|<)yabb icon(}|>)/$micon/g; $tempbar =~ s/({|<)yabb new(}|>)/$new/g; $tempbar =~ s/({|<)yabb poll(}|>)/$mpoll/g; $tempbar =~ s/({|<)yabb favorite(}|>)/ ($favicon{$mnum} ? qq~$img_txt{'70'}~ : '') /eg; $tempbar =~ s/({|<)yabb subjectlink(}|>)/$msublink/g; $tempbar =~ s/({|<)yabb attachmenticon(}|>)/$temp_attachment/g; $tempbar =~ s/({|<)yabb pages(}|>)/$pages/g; $tempbar =~ s/({|<)yabb starter(}|>)/$mname/g; $tempbar =~ s/({|<)yabb replies(}|>)/ &NumberFormat($mreplies) /eg; $tempbar =~ s/({|<)yabb views(}|>)/ &NumberFormat($views) /eg; $tempbar =~ s/({|<)yabb lastpostlink(}|>)/$img{'lastpost'} $mydate<\/a>/g; $tempbar =~ s/({|<)yabb lastposter(}|>)/$lastpostername/g; if($accept_permalink == 1) { $tempbar =~ s/({|<)yabb permalink(}|>)/$message_permalink/g; } else { $tempbar =~ s/({|<)yabb permalink(}|>)//g; } $tmptempbar .= $tempbar; $counter++; } undef %memberinf; # Put a "no messages" message if no threads exisit - just a bit more friendly... if (!$tmptempbar) { $tmptempbar = qq~
$messageindex_txt{'841'}

~; } my $tmptempfooter; if ($multiview > 1) { my $boardlist = &moveto; my ($admincheckboxes,$adminselector); if ($multiview == 3) { $admincheckboxes = qq~ ~ if $icanbypass; if ($currentboard eq $annboard) { $admincheckboxes .= qq~ \n~; } else { $admincheckboxes .= qq~ \n~; } $adminselector = qq~ : \n~; } else { $admincheckboxes = qq~ \n~; $adminselector = qq~ ~ if $icanbypass; if ($currentboard eq $annboard) { $adminselector .= qq~ : \n~; } else { $adminselector .= qq~ : \n~; } } $tmptempfooter = $subfooterbar; $tmptempfooter =~ s/({|<)yabb admin checkboxes(}|>)/$admincheckboxes/g; $tmptempfooter =~ s/({|<)yabb admin selector(}|>)/$adminselector/g; } $yabbicons = qq~ $messageindex_txt{'457'} $messageindex_txt{'457'}
$messageindex_txt{'779'} $messageindex_txt{'779'}
$messageindex_txt{'456'} $messageindex_txt{'456'}
$messageindex_txt{'456'} $messageindex_txt{'780'}
$messageindex_txt{'845'} $messageindex_txt{'845'}
~; if ($staff) { $yabbadminicons = qq~ $messageindex_txt{'458'} $messageindex_txt{'458'}
$messageindex_txt{'459'} $messageindex_txt{'459'}
$messageindex_txt{'460'} $messageindex_txt{'460'}
$messageindex_txt{'461'} $messageindex_txt{'461'}
~; } $yabbadminicons .= qq~ $messageindex_txt{'779a'} $messageindex_txt{'779a'}
$messageindex_txt{'779b'} $messageindex_txt{'779b'}
$messageindex_txt{'454'} $HotTopic $messageindex_txt{'454a'} $messageindex_txt{'454'} $HotTopic $messageindex_txt{'454a'}
$messageindex_txt{'455'} $VeryHotTopic $messageindex_txt{'454a'} $messageindex_txt{'455'} $VeryHotTopic $messageindex_txt{'454a'}
~; #template it $messageindex_template =~ s/({|<)yabb board(}|>)/$boardlink/g; $template_mods = qq~$modslink$showmodgroups~; my ($rss_link, $rss_text); if (!$rss_disabled) { $rss_link = qq~
$main_txt{'rssfeed'}~; $rss_text = qq~$messageindex_txt{843}~; } $yyrssfeed = $rss_text; $yyrss = $rss_link; $messageindex_template =~ s/({|<)yabb rssfeed(}|>)/$rss_text/g; $messageindex_template =~ s/({|<)yabb rss(}|>)/$rss_link/g; $messageindex_template =~ s/({|<)yabb home(}|>)/$homelink/g; $messageindex_template =~ s/({|<)yabb category(}|>)/$catlink/g; $messageindex_template =~ s/({|<)yabb board(}|>)/$boardlink/g; $messageindex_template =~ s/({|<)yabb moderators(}|>)/$template_mods/g; $messageindex_template =~ s/({|<)yabb sortsubject(}|>)/$sort_subject/g; $messageindex_template =~ s/({|<)yabb sortstarter(}|>)/$sort_starter/g; $messageindex_template =~ s/({|<)yabb sortanswer(}|>)/$sort_answer/g; $messageindex_template =~ s/({|<)yabb sortlastpostim(}|>)/$sort_lastpostim/g; if ($ShowBDescrip) { if ($bdescrip ne "") { &ToChars($bdescrip); $boarddescription =~ s/({|<)yabb boarddescription(}|>)/$bdescrip/g; $messageindex_template =~ s/({|<)yabb description(}|>)/$boarddescription/g; } else { $messageindex_template =~ s/({|<)yabb description(}|>)//g; } if (${$uid.$currentboard}{'ann'} == 1) { ${$uid.$currentboard}{'pic'} = "ann.gif"; } elsif (${$uid.$currentboard}{'rbin'} == 1) { ${$uid.$currentboard}{'pic'} = "recycle.gif"; } else { if (!${$uid.$currentboard}{'pic'}) { ${$uid.$currentboard}{'pic'} = "boards.gif"; } } $bdpic = ${$uid.$currentboard}{'pic'}; if ($bdpic =~ /\//i) { $bdpic = qq~ $boardname ~; } elsif ($bdpic) { $bdpic = qq~ $boardname ~; } $messageindex_template =~ s/({|<)yabb bdpicture(}|>)/$bdpic/g; $messageindex_template =~ s/({|<)yabb threadcount(}|>)/ &NumberFormat(${$uid.$currentboard}{'threadcount'}) /eg; $messageindex_template =~ s/({|<)yabb messagecount(}|>)/ &NumberFormat(${$uid.$currentboard}{'messagecount'}) /eg; } $messageindex_template =~ s/({|<)yabb colspan(}|>)/$colspan/g; $topichandellist =~ s/({|<)yabb notify button(}|>)/$notify_board/g; $topichandellist =~ s/({|<)yabb markall button(}|>)/$markalllink/g; $topichandellist =~ s/({|<)yabb new post button(}|>)/$postlink/g; $topichandellist =~ s/({|<)yabb new poll button(}|>)/$polllink/g; $topichandellist =~ s/\Q$menusep//i; $messageindex_template =~ s/({|<)yabb topichandellist(}|>)/$topichandellist/g; $messageindex_template =~ s/({|<)yabb pageindex top(}|>)/$pageindex1/g; $messageindex_template =~ s/({|<)yabb pageindex bottom(}|>)/$pageindex2/g; if ($multiview == 3) { $messageindex_template =~ s/({|<)yabb admin column(}|>)/$adminheader/g; } elsif ($multiview) { $messageindex_template =~ s/({|<)yabb admin column(}|>)/$adminheader/g; } else { $messageindex_template =~ s/({|<)yabb admin column(}|>)//g; } if ($multiview > 1) { $formstart = qq~
~; $formend = qq~
~; $messageindex_template =~ s/({|<)yabb modupdate(}|>)/$formstart/g; $messageindex_template =~ s/({|<)yabb modupdateend(}|>)/$formend/g; } else { $messageindex_template =~ s/({|<)yabb modupdate(}|>)//g; $messageindex_template =~ s/({|<)yabb modupdateend(}|>)//g; } if ($tmpstickyheader) { $messageindex_template =~ s/({|<)yabb stickyblock(}|>)/$tmpstickyheader/g; } else { $messageindex_template =~ s/({|<)yabb stickyblock(}|>)//g; } $messageindex_template =~ s/({|<)yabb threadblock(}|>)/$tmptempbar/g; if ($tmptempfooter) { $messageindex_template =~ s/({|<)yabb adminfooter(}|>)/$tmptempfooter/g; } else { $messageindex_template =~ s/({|<)yabb adminfooter(}|>)//g; } $messageindex_template =~ s/({|<)yabb icons(}|>)/$yabbicons/g; $messageindex_template =~ s/({|<)yabb admin icons(}|>)/$yabbadminicons/g; $messageindex_template =~ s/({|<)yabb access(}|>)/ &LoadAccess /e; $yymain .= qq~ $messageindex_template $pageindexjs ~; if ($multiview > 1) { my $modul = $currentboard eq $annboard ? 4 : 5; $modul-- unless $icanbypass; $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~\n~; } $tabsep = qq~~; $yynavback = qq~$tabsep ‹ $img_txt{'103'} $tabsep~; $yynavigation = qq~› $catlink › $boardname~; $yytitle = $boardname; if ($postlink and $enable_quickpost) { $yymain =~ s~()~$1\n
{yabb forumjump}
~; require "$sourcedir/Post.pl"; $GLOBAL::ACTION = 'post'; $INFO{'title'} = 'StartNewTopic'; $Quick_Post = 1; &Post; } &template; } 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 my @threadlist = map {/^(\d+)\|/} &read_DBorFILE(0,'',$boardsdir,$currentboard,'txt'); # Loop through @threadlist and delete the corresponding item from %yyuserlog foreach (@threadlist) { delete $yyuserlog{"$_--unread"}; } # Write it out &dumplog("$currentboard--mark"); if($INFO{'oldmarkread'}) { &redirectinternal; } $elenable = 0; die ""; # This is here only to avoid server error log entries! } sub ListPages { my ($pcount, $maxvalue, $tlink); if ($INFO{'num'} ne '') { $tlink = $INFO{'num'}; $pcount = ${$INFO{'num'}}{'replies'} + 1; $maxvalue = $maxmessagedisplay; $jcode = 'num='; } if ($INFO{'board'} ne '') { $tlink = $INFO{'board'}; $pcount = $INFO{'count'}; $maxvalue = $maxdisplay; $jcode = 'board='; } $tmpa = 1; for ($tmpb = 0; $tmpb < $pcount; $tmpb += $maxvalue) { $pages .= qq~$tmpa\n~; ++$tmpa; } $pages =~ s/\n\Z//; &print_output_header; $output = qq~ $messageindex_txt{'139'} $messageindex_txt{'18'}
$messageindex_txt{'139'} $messageindex_txt{'18'}




« $messageindex_txt{'139'} $pages »





$messageindex_txt{'903'}
~; &print_HTML_output_and_finish; } sub MessagePageindex { my ($msindx, $trindx, $mbindx, $pmindx, $tsort) = split(/\|/, ${$uid.$username}{'pageindex'}); if ($INFO{'action'} eq "messagepagedrop") { ${$uid.$username}{'pageindex'} = qq~0|$trindx|$mbindx|$pmindx|$tsort~; } elsif ($INFO{'action'} eq "messagepagetext") { ${$uid.$username}{'pageindex'} = qq~1|$trindx|$mbindx|$pmindx|$tsort~; } elsif ($INFO{'action'} eq "messagesortorder") { ${$uid.$username}{'pageindex'} = qq~$msindx|$trindx|$mbindx|$pmindx|$INFO{'tsort'}~; } &UserAccount($username, "update"); &redirectinternal; } sub moveto { my ($boardlist, $catid, $board, $category, $boardname, $boardperms, $boardview, $brdlist, @bdlist, $catname, $catperms, $access); foreach $catid (@categoryorder) { $brdlist = $cat{$catid}; if(!$brdlist) { next; } @bdlist = split(/,/, $brdlist); ($catname, $catperms) = split(/\|/, $catinfo{"$catid"}); $access = &CatAccess($catperms); if (!$access) { next; } &ToChars($catname); $boardlist .= qq~~; foreach $board (@bdlist) { ($boardname, $boardperms, $boardview) = split(/\|/, $board{"$board"}); &ToChars($boardname); $access = &AccessCheck($board, '', $boardperms); if (!$iamadmin && $access ne "granted") { next; } if ($board ne $currentboard) { $boardlist .= qq~\n~; } } $boardlist .= qq~~; } $boardlist; } sub LoadAccess { my $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'808'}
"; my $noaccesses = ""; # Reply Check my $rcaccess = &AccessCheck($currentboard, 2) || 0; if ($rcaccess 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 if (&AccessCheck($currentboard, 4) eq 'granted' && $allowattach && ${$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 && $rcaccess eq "granted") { $yesaccesses .= "$load_txt{'805'} $load_txt{'806'} $load_txt{'812'}
"; } else { $noaccesses .= "$load_txt{'805'} $load_txt{'807'} $load_txt{'812'}
"; } } qq~$yesaccesses
$noaccesses~; } 1;