{yabb forumjump}<\/div>/xsm;
}
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 {
my $tmpboardrules = q{};
my @tmpbdrule = split /[|]/xsm, ${ $uid . $username }{'collapsebdrules'};
foreach 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;
user_account( $username, 'update' );
$elenable = 0;
return;
}
sub mark_read { # 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
our ($BRDTXT);
fopen( 'BRDTXT', '<', "$boardsdir/$currentboard.txt" )
or fatal_error( 'cannot_open', $currentboard );
my @threadlist = map { /^(\d+)[|]/xsm } <$BRDTXT>;
fclose('BRDTXT') or croak "$croak{'close'} BRDTXT";
chomp @threadlist;
# Loop through @threadlist and delete the corresponding item from %yyuserlog
foreach (@threadlist) { delete $yyuserlog{"$_--unread"}; }
# Write it out
dumplog("$currentboard--mark");
if ( $INFO{'oldmarkread'} ) {
message_index();
}
$elenable = 0;
return;
}
sub list_pages {
## popup list ##
my ( $pcount, $maxvalue, $tlink, $jcode );
my $pages = q{};
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=';
}
my $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');
our $output = $msg_listpages;
$output =~ s/\Q{yabb jcode}\E/$jcode/xsm;
$output =~ s/\Q{yabb pages}\E/$pages/xsm;
$output =~ s/\Q{yabb messageindex_139}\E/$messageindex_txt{'139'}/gxsm;
$output =~ s/\Q{yabb messageindex_18}\E/$messageindex_txt{'18'}/gxsm;
$output =~ s/\Q{yabb messageindex_903}\E/$messageindex_txt{'903'}/gxsm;
print_html_output_and_finish();
return;
}
sub message_pageindex {
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~;
}
user_account( $username, 'update' );
message_index();
return;
}
sub moveto {
my (
$boardlist, $catid, $board, $boardname,
$boardview, $catname, $catperms, $access
);
get_forum_master();
my $indent = 0;
my $my_board = q{};
my $alert = q{};
local *move_subboards = sub {
my @x = @_;
$indent += 2;
foreach my $board (@x) {
my $dash = q{};
if ( $indent > 0 ) { $dash = q{-}; }
( $boardname, $boardperms, $boardview ) = @{ $board{$board} };
$boardname = to_chars($boardname);
$access = access_check( $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 = $messageindex_txt{'nopost'};
$bdnopost = qq~ class="nopost" onclick="alert('$alert')"~;
$my_board = q{};
}
$boardlist .=
qq~
\n~;
}
if ( $subboard{$board} ) {
move_subboards( @{ $subboard{$board} } );
}
}
$indent -= 2;
};
foreach my $catid (@categoryorder) {
if ( !$cat{$catid} ) { next; }
( $catname, $catperms ) = @{ $catinfo{$catid} };
my $cat_access = cat_access($catperms);
if ( !$cat_access ) { next; }
$catname = to_chars($catname);
$boardlist .= qq~
~;
}
return $boardlist;
}
sub load_access {
my $yesaccesses =
"$load_txt{'805'} $load_txt{'806'} $load_txt{'808'}
";
my $noaccesses = q{};
# Reply Check
if ( access_check( $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 ( access_check( $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 (
access_check( $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 ( access_check( $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'}
&& access_check( $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 set_topicpreview {
if ( !$INFO{'todo'} || $INFO{'todo'} eq 'disable' ) {
${ $uid . $username }{'topicpreview'} = '0';
}
else {
${ $uid . $username }{'topicpreview'} = '1';
}
user_account( $username, 'update' );
message_index();
return;
}
sub get_mess_mods {
my $showmods = q{};
my $showmodgroups = q{};
if ( keys %moderators > 0 ) {
if ( keys %moderators == 1 ) {
$showmods = qq~($messageindex_txt{'298'}: ~;
}
else { $showmods = qq~($messageindex_txt{'63'}: ~; }
my %sortmd = reverse %moderators;
my @sortmd = sort keys %sortmd;
foreach my $i (@sortmd) {
format_username( $sortmd{$i} );
$showmods .= quick_links( $sortmd{$i}, 1 ) . q{, };
}
$showmods =~ s/,\s$/)/xsm;
}
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 ) = @{ $grp_nopost{$tmpmodgrp} };
$showmodgroups .= qq~$thismodgrp, ~;
}
$showmodgroups =~ s/,\s$/)/xsm;
}
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 && $yy_cookies{$cookiename} ne $crypass ) {
my $boardname = ${ $board{$currentboard} }[0];
boardpassw($boardname);
}
}
return ( $showmodgroups, $showmods );
}
sub get_poll_icon {
my ( $poll, $mnum, $mdate, $dlp ) = @_;
my @poll = @{$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";
my $prnpoll = join q{}, @poll;
our ($POLL);
fopen( 'POLL', '>', "$datadir/$mnum.poll" )
or croak "$croak{'open'} POLL";
print {$POLL} $prnpoll or croak "$croak{'print'} POLL";
fclose('POLL') or croak "$croak{'close'} POLL";
}
my $micon = $micon{'pollicon'};
if ($poll_locked) { $micon = $micon{'polliconclosed'}; }
elsif ( !$iamguest
&& $max_log_days_old
&& $mdate > $date - ( $max_log_days_old * 86400 ) )
{
if ( $dlp < $poll_date ) {
$micon = $micon{'polliconnew'};
}
else {
if ( -e "$datadir/$mnum.polled" ) {
our ($POLLED);
fopen( 'POLLED', '<', "$datadir/$mnum.polled" )
or croak "$croak{'open'} POLLED";
my $polled = <$POLLED>;
fclose('POLLED') or croak "$croak{'close'} POLLED";
my ( undef, undef, undef, $vote_date, undef ) =
split /[|]/xsm, $polled;
if ( $dlp < $vote_date ) {
$micon = $micon{'polliconnew'};
}
}
}
}
return $micon;
}
sub get_mess_top1 {
my ( $mnum, $musername, $msub, $stickdir ) = @_;
our ($MNUM);
fopen( 'MNUM', '<', "$datadir/$mnum.txt" )
or croak "$croak{'open'} $mnum.txt";
my $thetopic = <$MNUM>;
fclose('MNUM') or croak "$croak{'close'} MNUM";
my $themessage = ( split /[|]/xsm, $thetopic )[8];
my $ns = ( split /[|]/xsm, $thetopic )[9];
my $clip = 0;
my $msglength = 200;
my $testlength = 0;
my $pretextlength = 0;
$themessage = from_html($themessage);
$themessage =~
s/\[img\].*?\[\/img\]/[b][$messageindex_tp{'image_tp'}][\/b]/igxsm;
$themessage =~
s/\[media].*?\[\/media]/[b][$messageindex_tp{'media_tp'}][\/b]/igxsm;
if ( $themessage =~ m/\[code(.*?)].*?\[\/code]/ixsm ) {
$themessage =~ s/\[code(.*?)].*?\[\/code]/[b][XCODE$1][\/b]/igxsm;
}
$themessage =~ s/
/
/igxsm;
$themessage =~ s/(\s?)/
/igxsm;
$themessage =~ s/^//igxsm;
my $lgtagtxtrem = q{};
local *fixtags = sub {
my ( $tmpmessage, $pretext, $pretag, $tagtext, $posttag ) = @_;
my $testmessage = $tmpmessage;
$testmessage =~ s/\[.*?\]//gxsm;
$testmessage =~ s/\<.*?\>//gxsm;
$testlength = length $testmessage;
$pretextlength = length $pretext;
if ( $pretext =~ m/\[(.*?\])/xsm ) {
$pretext =~ s/\[(.*?\])/|$1/gxsm;
}
$pretag =~ s/\[/|/xsm;
if ( $tagtext =~ m/\[(.*?\])/xsm ) {
$tagtext =~ s/\[(.*?\])/|$1/gxsm;
}
$posttag =~ s/\[/|/xsm;
if ( $pretextlength > $msglength ) {
return $pretext;
}
if ( $testlength > $msglength ) {
$clip = 1;
$lgtagtxtrem = ( $msglength - $pretextlength ) - 3;
my $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) /eigxsm
)
{
}
if ( $themessage =~ m/[|](.*?\])/xsm ) {
$themessage =~ s/[|](.*?\])/[$1/gxsm;
}
$themessage = substr $themessage, 0, $msglength;
if ( length($themessage) > ( $msglength - 1 ) && !$clip ) {
$themessage .= '...';
}
my $displayname = ${ $uid . $musername }{'realname'};
$themessage = wrap($themessage);
if ( $enable_ubbc && !$ns ) {
enable_yabbc();
$themessage = do_ubbc( $themessage, q{}, $displayname );
}
$themessage = wrap2($themessage);
$themessage = to_chars($themessage);
$themessage =~ s/XCODE/$messageindex_tp{'code_tp'}/gxsm;
$themessage = do_censor($themessage);
my $topicsum =
qq~$themessage
~;
my $msublink = q{};
if ( ${$mnum}{'board'} eq $annboard ) {
$msublink =
qq~$msub$topicsum$stickdir
~;
}
else {
$msublink =
qq~$msub$topicsum$stickdir
~;
}
return $msublink;
}
sub get_mess_rules {
($currentboard) = @_;
${ $uid . $currentboard }{'rulestitle'} =
to_chars( ${ $uid . $currentboard }{'rulestitle'} );
${ $uid . $currentboard }{'rulesdesc'} =
to_chars( ${ $uid . $currentboard }{'rulesdesc'} );
my $tmpruletxt = qq~${$uid.$currentboard}{'rulesdesc'}~;
my $rulestitle = q{};
if ( !$iamguest && ${ $uid . $currentboard }{'rulescollapse'} ) {
my $tmprulelgt = length( ${ $uid . $currentboard }{'rulesdesc'} );
$rulestitle =
qq~
~;
my @collbdrules =
split /[|]/xsm, ${ $uid . $username }{'collapsebdrules'};
foreach my $i ( 0 .. $#collbdrules ) {
my ( $rulebd, $rulelgt ) = split /,/xsm, $collbdrules[$i];
if ( $rulebd eq $currentboard && $rulelgt == $tmprulelgt ) {
$tmpruletxt = qq~$messageindex_txt{'collruletext'}~;
$rulestitle =
qq~
~;
}
}
}
$rulestitle .= qq~ ${$uid.$currentboard}{'rulestitle'}~;
my $rulesdesc = qq~$tmpruletxt
~;
my $mycat_col = q{};
my $mycat_exp = q{};
if ( !$iamguest && ${ $uid . $currentboard }{'rulescollapse'} ) {
$mycat_col = $newload{'brd_col'};
$mycat_exp = $newload{'brd_exp'};
$rulesdesc .= qq~
~;
}
return ( $rulestitle, $rulesdesc );
}
sub get_mess_sort {
($currentboard) = @_;
our ($BRDTXT);
fopen( 'BRDTXT', '<', "$boardsdir/$currentboard.txt" )
or fatal_error( 'cannot_open', "$currentboard", 1 );
our @threadlist = <$BRDTXT>;
fclose('BRDTXT') or croak "$croak{'close'} BRDTXT";
my %starter;
my @temp_list = @threadlist;
local *starter = sub {
if ( exists $user_info{ $_[0] } ) { return $user_info{ $_[0] }; }
if ( !exists $memberinf{ $_[0] } ) {
return lc $_[1][2];
}
$user_info{ $_[0] } =
lc $memberinf{ $_[0] }[0];
};
my $sort_subject =
qq~$messageindex_txt{'70'}~;
my $sort_starter =
qq~$messageindex_txt{'109'}~;
my $sort_answer =
qq~$messageindex_txt{'110'}~;
my $sort_lastpostim =
qq~$messageindex_txt{'22'}~;
if ( !$tsort ) {
if ($ttsreverse) { $tsort = 'a'; }
else { $tsort = 'b'; }
}
if ($tsort) {
if ( $tsort =~ /[ab]/xsm ) {
if ( $tsort eq 'a' ) {
$sort_lastpostim =
qq~$messageindex_txt{'22'} $micon{'sort_last'}~;
@threadlist =
reverse
sort {
( split /[|]/xsm, $a )[4] <=> ( split /[|]/xsm, $b )[4]
} @temp_list;
}
else {
$sort_lastpostim =
qq~$messageindex_txt{'22'} $micon{'sort_first'}~;
@threadlist =
sort {
( split /[|]/xsm, $a )[4] <=> ( split /[|]/xsm, $b )[4]
} @temp_list;
}
}
elsif ( $tsort =~ /[cd]/xsm ) {
if ( $tsort eq 'c' ) {
$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;
}
else {
$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 =~ /[ef]/xsm ) {
if ( $tsort eq 'e' ) {
require Variables::Memberinfo;
$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;
}
else {
require Variables::Memberinfo;
$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 =~ /[gh]/xsm ) {
if ( $tsort eq 'g' ) {
$sort_answer =
qq~$messageindex_txt{'110'} $micon{'sort_up'}~;
@threadlist =
reverse
sort {
( split /[|]/xsm, $a, 7 )[5]
<=> ( split /[|]/xsm, $b, 7 )[5]
} @temp_list;
}
else {
$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'}~;
@threadlist =
reverse
sort { ( split /[|]/xsm, $a )[4] <=> ( split /[|]/xsm, $b )[4] }
@temp_list;
}
}
else {
$sort_lastpostim =
qq~$messageindex_txt{'22'} $micon{'sort_up'}~;
@threadlist =
reverse
sort { ( split /[|]/xsm, $a )[4] <=> ( split /[|]/xsm, $b )[4] }
@temp_list;
}
undef @temp_list;
undef %starter;
return (
$sort_subject, $sort_starter, $sort_answer,
$sort_lastpostim, \@threadlist
);
}
sub get_mess_page1 {
my @args = @_;
my (
$messagelist, $start, $startpage, $maxindex, $threadcount,
$endpage, $tmpa, $lastptn, $lastpn
) = @args;
my $pagetxtindexst = q~~;
my $pagetxtindex = q{};
if ( !$iamguest ) {
$pagetxtindexst .=
qq~
$messageindex_txt{'139'}: ~;
}
else {
$pagetxtindexst .=
qq~
$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++;
}
}
my $pageindexadd = q{};
if ( $endpage < $threadcount - $maxindex ) {
$pageindexadd .=
qq~... ~;
}
if ( $endpage != $threadcount ) {
$pageindexadd .=
qq~$lastpn~;
}
$pagetxtindex .= $pageindexadd;
my $pageindex1 = qq~$pagetxtindexst $pagetxtindex~;
return $pageindex1;
}
sub get_mess_page2 {
my @args = @_;
my ( $messagelist, $pagenumb, $dropdisplaynum, $start,
$maxindex, $lastptn, $tstart, $pagedropindex1 )
= @args;
my $indexpages = q{};
my $pageindex1 = q{};
my $pageindex2 = q{};
my $pageindexjs = q{};
my $d_indexpages = $pagenumb / $dropdisplaynum;
my $i_indexpages = int( $pagenumb / $dropdisplaynum );
if ( $d_indexpages > $i_indexpages ) {
$indexpages = int( $pagenumb / $dropdisplaynum ) + 1;
}
else { $indexpages = int( $pagenumb / $dropdisplaynum ) }
my $selectedindex = int( ( $start / $maxindex ) / $dropdisplaynum );
my $pagedropindex2 = $pagedropindex1;
if ( $pagenumb > $dropdisplaynum ) {
$pagedropindex1 .=
qq~\n~;
}
$pagedropindex1 .=
q~ ~;
$pagedropindex2 .=
q~ ~;
my $tmpmaxindex = $maxindex;
my $prevpage = $start - $tmpmaxindex;
my $nextpage = $start + $maxindex;
my $pagedropindexpv = q{};
my $pagedropindexnx = q{};
my $pagedropindexpvbl =
qq~
~;
my $pagedropindexnxbl =
qq~
~;
if ( $start < $maxindex ) {
$pagedropindexpv .=
qq~
~;
}
else {
$pagedropindexpv .=
qq~
~;
}
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~
~;
}
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
our $default_or_ajax = qq~$scripturl?board=$currentboard/' + pagstart + '~;
if ($messagelist) {
$default_or_ajax =
qq~javascript:MessageList(\\'$scripturl?board=$currentboard/' + pagstart + ';messagelist=1\\', \\'$yyhtml_root\\',\\'$currentboard\\', 1)~;
}
$pageindex1 = qq~$pagedropindex1~;
$pageindex2 = qq~$pagedropindex2~;
$pageindexjs = qq~
~;
return (
$pageindex1, $pageindex2, $pageindexjs,
$pagedropindex1, $pagedropindex1
);
}
sub get_mess_multi1 {
my $multiview = get_mess_collevl();
my $boardname = ${ $board{$currentboard} }[0];
my $curboardname = $boardname;
$curboardname = to_chars($curboardname);
my $multiviewscr = q{};
if ( $multiview == 1 ) {
$multiviewscr .= qq~
~;
}
if ( $multiview >= 2 ) {
$multiviewscr .=
qq~
\n~;
}
my $colspan = 6;
if ( $multiview > 0 ) {
$colspan = 7;
}
my $adminlink = get_mess_multi2($multiview);
return ( $multiview, $multiviewscr, $curboardname, $colspan, $adminlink );
}
sub get_mess_multi2 {
my ($multiview) = @_;
my $adminlink = q{};
if ( $multiview == 3 ) {
if ( $currentboard eq $annboard ) {
$adminlink =
qq~


~;
}
else {
$adminlink =
qq~



~;
}
}
elsif ( $multiview != 0 ) {
$adminlink = $messageindex_txt{'2'};
}
return $adminlink;
}
sub get_mess_postlink {
my ( $crboard, $messagelist ) = @_;
my $postlink = q{};
if ( access_check( $crboard, 1 ) eq 'granted' ) {
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'}~;
}
}
}
my $polllink = q{};
if ( access_check( $currentboard, 3 ) eq 'granted' ) {
$polllink =
qq~$menusep$img{'createpoll'}~;
}
return ( $postlink, $polllink );
}
sub get_mess_thrdcls {
my ( $mstate, $mreplies, $mnum ) = @_;
my $threadclass = 'thread';
if ( !$mstate ) { $threadclass = 'thread'; }
else {
if ( $mstate =~ /h/ixsm ) { $threadclass = 'hide'; }
elsif ( $mstate =~ /l/ixsm ) { $threadclass = 'locked'; }
elsif ( $mreplies >= $very_hot_topic ) {
$threadclass = 'veryhotthread';
}
elsif ( $mreplies >= $hot_topic ) { $threadclass = 'hotthread'; }
if ( $threadclass eq 'hide' ) {
if ( $mstate =~ /s/ixsm && $mstate !~ /l/ixsm ) {
$threadclass = 'hidesticky';
}
elsif ( $mstate =~ /l/ixsm && $mstate !~ /s/ixsm ) {
$threadclass = 'hidelock';
}
elsif ($mstate =~ /s/ixsm
&& $mstate =~ /l/ixsm )
{
$threadclass = 'hidestickylock';
}
}
elsif ($threadclass eq 'locked'
&& $mstate =~ /s/ixsm
&& $mstate !~ /h/ixsm )
{
$threadclass = 'stickylock';
}
elsif ( $mstate =~ m/s/ixsm && $mstate !~ m/h/ixsm ) {
$threadclass = 'sticky';
}
elsif ( ${$mnum}{'board'} eq $annboard && $mstate !~ m/h/ixsm ) {
$threadclass =
$threadclass eq 'locked'
? 'announcementlock'
: 'announcement';
}
}
return $threadclass;
}
sub get_mess_sticky {
my ( $threadclass, $mnum, $mstate ) = @_;
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/ixsm
)
&& ( $iamadmin || $iamgmod )
)
{
$stickdir =
qq~ ↑↓ ~;
}
}
return $stickdir;
}
sub get_mess_new {
my ( $currentbrd, $mnum, $mdate, $moved_flag, $dmax ) = @_;
my $new = q{};
my $dlp = 0;
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.
if (
!$yyuserlog{"$currentbrd--mark"}
|| ( $yyuserlog{$mnum}
&& $yyuserlog{"$currentbrd--mark"}
&& int( $yyuserlog{$mnum} ) >
int $yyuserlog{"$currentbrd--mark"} )
)
{
$dlp = int $yyuserlog{$mnum};
}
else { $dlp = int $yyuserlog{"$currentbrd--mark"}; }
$mdate ||= $mnum;
if (
!$moved_flag
&& ( $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{};
}
}
return ( $new, $dlp );
}
sub get_mess_starter {
my ( $mdate, $musername ) = @_;
my $mname = q{};
if ( $musername ne 'Guest' ) {
load_user($musername);
$mdate ||= 0;
if (
(
${ $uid . $musername }{'regdate'}
&& $mdate > ${ $uid . $musername }{'regtime'}
)
|| ${ $uid . $musername }{'position'} eq 'Administrator'
|| ${ $uid . $musername }{'position'} eq 'Global Moderator'
)
{
$mname = profile_view($musername);
}
else {
$mname .= qq~ ($messageindex_txt{'470a'})~;
}
}
else {
$mname .= " ($maintxt{'28'})";
}
return $mname;
}
sub get_mess_lastposter {
my ($mnum) = @_;
my $lastposter = ${$mnum}{'lastposter'};
if ( $lastposter =~ m{\AGuest-(.*)}xsm ) {
$lastposter = $1 . " ($maintxt{'28'})";
}
else {
load_user($lastposter);
if ( !${$mnum}{'lastpostdate'} || ${$mnum}{'lastpostdate'} eq q{} ) {
${$mnum}{'lastpostdate'} = $mnum;
}
if (
(
${ $uid . $lastposter }{'regtime'}
&& ${$mnum}{'lastpostdate'} > ${ $uid . $lastposter }{'regtime'}
)
|| ${ $uid . $lastposter }{'position'}
&& ( ${ $uid . $lastposter }{'position'} eq 'Administrator'
|| ${ $uid . $lastposter }{'position'} eq 'Global Moderator' )
)
{
$lastposter = profile_view($lastposter);
}
else {
# Need to load thread to see lastposters DISPLAYname if is Ex-Member
our ($EXMEMBERTHREAD);
fopen( 'EXMEMBERTHREAD', '<', "$datadir/$mnum.txt" )
or fatal_error( 'cannot_open', "$mnum", 1 );
my @x = <$EXMEMBERTHREAD>;
fclose('EXMEMBERTHREAD')
or croak "$croak{'close'} EXMEMBERTHREAD";
$lastposter =
( split /[|]/xsm, $x[-1], 3 )[1] . " - $messageindex_txt{'470a'}";
}
}
my $lastpostername = $lastposter || $messageindex_txt{'470'};
return $lastpostername;
}
sub get_mess_att {
my ( $mnum, $attachments ) = @_;
my %attachments = %{$attachments};
my $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~
~
: $msg_attach_win
. qq~
~
)
: q{};
$temp_attachment =~ s/\Q{yabb mnum}\E/$mnum/xsm;
}
return $temp_attachment;
}
sub get_mess_permlink {
my ( $mnum, $msub, $msublink ) = @_;
my $permlinkboard =
${$mnum}{'board'} eq $annboard ? $annboard : $currentboard;
my $permdate = permtimer($mnum);
my $message_permalink = q{};
if ($accept_permafull) {
$message_permalink =
qq~$msub~;
$msublink = $message_permalink;
if ($accept_permalink) {
$message_permalink = q{};
}
else {
$message_permalink =
qq~$messageindex_txt{'10'}~;
}
}
return ( $message_permalink, $msublink );
}
sub get_mess_admincol {
my ( $mcount, $mnum, $counter, $numanns ) = @_;
my $adminbar = q{};
my $admincol = q{};
my $multiview = get_mess_collevl();
if ( $multiview == 3 ) {
$adminbar = qq~
~;
if ( $currentboard eq $annboard ) {
$adminbar = qq~
~;
}
elsif ( $counter < $numanns ) {
$adminbar = q~ ~;
}
}
elsif ( $multiview == 2 ) {
if ( $currentboard ne $annboard && $counter < $numanns ) {
$adminbar = q~ ~;
}
else {
$adminbar =
qq~~;
}
}
elsif ( $multiview == 1 ) {
if ( $currentboard eq $annboard ) {
$adminbar = qq~
~;
}
elsif ( $counter < $numanns ) {
$adminbar = q~ ~;
}
else {
$adminbar = qq~
~;
}
}
if ($multiview) {
$admincol = $admincolumn;
$admincol =~ s/\Q{yabb admin}\E/$adminbar/gxsm;
}
return $admincol;
}
sub get_mess_collevl {
my $collevl = 0;
if ( $sessionvalid == 1 ) {
my $ismod = 0;
if ( $iammod
&& !$iamadmin
&& !$iamgmod
&& !$iamfmod )
{
$ismod = 1;
}
if ( ( $iamadmin && $adminview == 3 )
|| ( $iamgmod && $gmodview == 3 )
|| ( $iamfmod && $fmodview == 3 )
|| ( $ismod && $modview == 3 ) )
{
$collevl = 3;
}
elsif (( $iamadmin && $adminview == 2 )
|| ( $iamgmod && $gmodview == 2 )
|| ( $iamfmod && $fmodview == 2 )
|| ( $ismod && $modview == 2 ) )
{
$collevl = 2;
}
elsif (( $iamadmin && $adminview == 1 )
|| ( $iamgmod && $gmodview == 1 )
|| ( $iamfmod && $fmodview == 1 )
|| ( $ismod && $modview == 1 ) )
{
$collevl = 1;
}
}
return $collevl;
}
sub get_mess_msublink {
my @args = @_;
my ( $mnum, $musername, $msub, $stickdir, $messagelist, $moved_flag,
$moved_subject )
= @args;
my $msublink = q{};
if ( !$moved_flag ) {
if ( $enabletopichover
&& !$messagelist
&& ( ${ $uid . $username }{'topicpreview'} || $iamguest ) )
{
$msublink = get_mess_top1( $mnum, $musername, $msub, $stickdir );
}
else {
$msublink =
qq~$msub$stickdir
~;
if ( ${$mnum}{'board'} eq $annboard ) {
$msublink =
qq~$msub$stickdir
~;
}
}
}
elsif ( $moved_flag < 100 ) {
split_splice_move( $msub, 0 );
$msublink = qq~$msub
$moved_subject~;
}
else {
$msub =~ /^(Re:\s)?\[m.*?\]:\s'(.*)'/xsm;
$msublink =
qq~$maintxt{'758'}: '$2'
$moved_subject~;
}
return $msublink;
}
sub get_mess_tmpfooter {
my $tmptempfooter = q{};
my $tempfooter = q{};
my $adminselector = q{};
my $adminselectorb = q{};
my $adminselectorc = q{};
my $admincheckboxes = q{};
my $multiview = get_mess_collevl();
if ( $multiview >= 2 ) {
my $boardlist = moveto();
if ( $multiview == 3 ) {
$tempfooter = $subfooterbar;
$adminselector = qq~
: $boardlist
~;
if ( $currentboard eq $annboard ) {
$admincheckboxes = qq~
~;
}
else {
$admincheckboxes = qq~
~;
}
$tempfooter =~ s/\Q{yabb admin selector}\E/$adminselector/gxsm;
$tempfooter =~ s/\Q{yabb admin selectorb\E//gxsm;
$tempfooter =~ s/\Q{yabb admin selectorc}\E//gxsm;
$tempfooter =~ s/\Q{yabb admin checkboxes}\E/$admincheckboxes/gxsm;
}
elsif ( $multiview == 2 ) {
$tempfooter = $subfooterbar;
if ( $currentboard eq $annboard ) {
$adminselector = qq~
: ~;
$adminselectorb = qq~
$boardlist~;
$adminselectorc =
qq~
~;
}
else {
$adminselector = qq~
: ~;
$adminselectorb = qq~
$boardlist~;
$adminselectorc = qq~
~;
}
$admincheckboxes = q~
~;
$tempfooter =~ s/\Q{yabb admin selector}\E/$adminselector/gxsm;
$tempfooter =~ s/\Q{yabb admin selectorb}\E/$adminselectorb/gxsm;
$tempfooter =~ s/\Q{yabb admin selectorc}\E/$adminselectorc/gxsm;
$tempfooter =~ s/\Q{yabb admin checkboxes}\E/$admincheckboxes/gxsm;
}
$tmptempfooter = $subfooterbar;
$tmptempfooter =~ s/\Q{yabb admin selector}\E/$adminselector/gxsm;
$tmptempfooter =~ s/\Q{yabb admin selectorb}\E/$adminselectorb/gxsm;
$tmptempfooter =~ s/\Q{yabb admin selectorc}\E/$adminselectorc/gxsm;
$tmptempfooter =~ s/\Q{yabb admin checkboxes}\E/$admincheckboxes/gxsm;
$tmptempfooter =~
s/\Q{yabb messageindex_txt_737}\E/$messageindex_txt{'737'}/gxsm;
}
return ( $tmptempfooter, $tempfooter );
}
sub get_mess_icons {
my ($messagelist) = q{};
my $yabbicons = q{};
my $yabbadminicons = q{};
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'} $hot_topic $messageindex_txt{'454a'}
$micon{'veryhotthread'} $messageindex_txt{'455'} $very_hot_topic $messageindex_txt{'454a'}
~;
$yabbadminicons =~ s/\Q{yabb veryhotthread}\E/$very_hot_topic/gxsm;
$yabbadminicons =~ s/\Q{yabb hottopic}\E/$hot_topic/gxsm;
load_access();
}
return ( $yabbicons, $yabbadminicons );
}
sub get_mess_stkylist {
my ( $threadlst, $threads ) = @_;
my @threadlist = @{$threadlst};
my @threads = @{$threads};
my $countsticky = 0;
my $threadcount = 0;
my @nostickythreadlist = ();
foreach my $threadlist (@threadlist) {
my $threadstatus = ( split /[|]/xsm, $threadlist )[8];
if ( $threadstatus =~ /h/ixsm && !$staff ) {
next;
}
if ( $threadstatus =~ /s/ixsm ) {
push @threads, $threadlist;
$countsticky++;
}
else {
$nostickythreadlist[$threadcount] = $threadlist;
$threadcount++;
}
}
undef @threadlist;
return ( $countsticky, $threadcount, \@nostickythreadlist, \@threads );
}
sub get_mess_rss {
($currentboard) = @_;
my ( $rss_link, $rss_text );
if ( !$rss_disabled ) {
$rss_link =
qq~
~;
$rss_text =
qq~$messageindex_txt{843}~;
if ( $rssperm || $accept_permafull ) {
$rss_link =
qq~
~;
$rss_text =
qq~$messageindex_txt{843}~;
}
}
return ( $rss_link, $rss_text );
}
sub get_mess_mark {
my ($messagelist) = @_;
my $markalllink = q{};
my $notify_board = q{};
if ( !$iamguest ) {
my $brdid = q{};
my $mthreadslang = q{};
if ($messagelist) {
$mthreadslang = 1;
$brdid = q{new_} . $INFO{'board'};
}
$markalllink =
qq~$menusep$img{'markboardread'}~;
$notify_board =
qq~$menusep$img{'notify'}~;
}
return ( $markalllink, $notify_board );
}
sub get_mess_poll {
my ( $micn, $mnum, $mdate, $dlp ) = @_;
my $micon = $micon{$micn};
my $mpoll = q{};
if ( -e "$datadir/$mnum.poll" ) {
$mpoll = qq~$messageindex_txt{'15'}: ~;
our ($POLL);
fopen( 'POLL', '<', "$datadir/$mnum.poll" )
or croak "$croak{'close'} POLL";
my @poll = <$POLL>;
fclose('POLL') or croak "$croak{'close'} POLL";
$micon = get_poll_icon( \@poll, $mnum, $mdate, $dlp );
}
return ( $micon, $mpoll );
}
sub get_mess_bdpic {
my ( $crrentboard, $curboardname ) = @_;
my $bdpic = qq~$imagesdir/boards.$bdpic_ext~;
if ( -e "$boardsdir/brdpics.db" ) {
our ($BRDPIC);
fopen( 'BRDPIC', '<', "$boardsdir/brdpics.db" )
or croak "$croak{'open'} brdpics.db";
my @brdpics = <$BRDPIC>;
fclose('BRDPIC') or croak "$croak{'close'} BRDPIC";
chomp @brdpics;
foreach (@brdpics) {
my ( $brdnm, $style, $brdpic ) = split /[|]/xsm;
if ( $brdnm eq $crrentboard && $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.$bdpic_ext~; }
if ( ${ $uid . $crrentboard }{'ann'} ) {
$bdpic = qq~$imagesdir/ann.$bdpic_ext~;
}
if ( ${ $uid . $crrentboard }{'rbin'} ) {
$bdpic = qq~$imagesdir/recycle.$bdpic_ext~;
}
$bdpic =
qq~
~;
return $bdpic;
}
sub get_mess_pages {
my ( $mnum, $mreplies, $endpage, $tmpa ) = @_;
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;
my $i = ( $endpage - 1 ) * $maxmessagedisplay;
my $j = $i - $maxmessagedisplay;
my $k = $endpage - 1;
$tmpa = $endpage - 2;
my $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 »~;
}
return $pages;
}
1;