| ############################################################################### |
| ############################################################################### |
| # Favorites.pl # |
| # Favorites.pm # |
| |
| # $Date: 01.05.16 $ # |
| ############################################################################### |
| ############################################################################### |
| # YaBB: Yet another Bulletin Board # |
| # YaBB: Yet another Bulletin Board # |
| # Open-Source Community Software for Webmasters # |
| # Open-Source Community Software for Webmasters # |
| # Version: YaBB 2.5.2 # |
| # Version: YaBB 2.6.12 # |
| # Packaged: October 21, 2012 # |
| # Packaged: January 5, 2016 # |
| # Distributed by: http://www.yabbforum.com # |
| # Distributed by: http://www.yabbforum.com # |
| # =========================================================================== # |
| # =========================================================================== # |
| # Copyright (c) 2000-2012 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Copyright (c) 2000-2016 YaBB (www.yabbforum.com) - All Rights Reserved. # |
| # Software by: The YaBB Development Team # |
| # Software by: The YaBB Development Team # |
| # with assistance from the YaBB community. # |
| # with assistance from the YaBB community. # |
| ############################################################################### |
| ############################################################################### |
| |
| # use strict; |
| |
| # use warnings; |
| |
| no warnings qw(uninitialized once redefine); |
| |
| use CGI::Carp qw(fatalsToBrowser); |
| |
| our $VERSION = '2.6.12'; |
| |
| |
| $favoritesplver = 'YaBB 2.5.2 $Revision: 1.0 $'; |
| $favoritespmver = 'YaBB 2.6.12 $Revision: 1651 $'; |
| if ($action eq 'detailedversion') { return 1; } |
| if ( $action eq 'detailedversion' ) { return 1; } |
| |
| |
| sub Favorites { |
| sub Favorites { |
| &LoadLanguage('MessageIndex'); |
| LoadLanguage('MessageIndex'); |
| require "$templatesdir/$usemessage/MessageIndex.template"; |
| get_micon(); |
| my $start = int($INFO{'start'}) || 0; |
| get_template('MyPosts'); |
| my (@threads, $counter, $pages, $mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate, $dlp); |
| |
| my $treplies = 0; |
| my $start = int( $INFO{'start'} ) || 0; |
| |
| my ( |
| # grab all relevant info on the favorite thread for this user and check access to them |
| @threads, $counter, $pages, $mnum, $msub, |
| if (!$maxfavs) { $maxfavs = 10; } |
| $mname, $memail, $mdate, $mreplies, $musername, |
| my @favboards; |
| $micon, $mstate, $dlp |
| eval { require "$datadir/movedthreads.cgi" }; |
| ); |
| foreach my $myfav (split(/,/, ${$uid.$username}{'favorites'})) { |
| my $treplies = 0; |
| # see if thread exists and search for it if moved |
| |
| if (exists $moved_file{$myfav}) { |
| # grab all relevant info on the favorite thread for this user and check access to them |
| my @moved = ($myfav); |
| if ( !$maxfavs ) { $maxfavs = 10; } |
| while (exists $moved_file{$myfav}) { |
| my @favboards; |
| $myfav = $moved_file{$myfav}; |
| eval { require Variables::Movedthreads }; |
| unshift(@moved, $myfav); |
| foreach my $myfav ( split /,/xsm, ${ $uid . $username }{'favorites'} ) { |
| } |
| |
| foreach (@moved) { |
| # see if thread exists and search for it if moved |
| $myfav = $_; |
| if ( exists $moved_file{$myfav} ) { |
| if ($myfav ne $moved[$#moved]) { |
| my @moved = ($myfav); |
| if (-e "$datadir/$myfav.ctb") { |
| while ( exists $moved_file{$myfav} ) { |
| &RemFav($moved[$#moved], "nonexist"); |
| $myfav = $moved_file{$myfav}; |
| &AddFav($myfav,0,1); |
| unshift @moved, $myfav; |
| last; |
| } |
| } |
| foreach (@moved) { |
| } elsif (!-e "$datadir/$myfav.ctb") { |
| $myfav = $_; |
| &RemFav($myfav, "nonexist"); |
| if ( $myfav ne $moved[-1] ) { |
| $myfav = 0; |
| if ( -e "$datadir/$myfav.ctb" ) { |
| } |
| RemFav( $moved[-1], 'nonexist' ); |
| } |
| AddFav( $myfav, 0, 1 ); |
| next if !$myfav; |
| last; |
| } elsif (!-e "$datadir/$myfav.ctb") { |
| } |
| &RemFav($myfav, "nonexist"); |
| } |
| next; |
| elsif ( !-e "$datadir/$myfav.ctb" ) { |
| } |
| RemFav( $myfav, 'nonexist' ); |
| &MessageTotals("load", $myfav); |
| $myfav = 0; |
| $favoboard = ${$myfav}{'board'}; |
| } |
| push(@favboards, "$favoboard|$myfav"); |
| } |
| } |
| next if !$myfav; |
| |
| } |
| foreach (sort(@favboards)) { |
| elsif ( !-e "$datadir/$myfav.ctb" ) { |
| ($loadboard, $loadfav) = split(/\|/, $_); |
| RemFav( $myfav, 'nonexist' ); |
| &BoardTotals("load", $loadboard) if !${$uid.$loadboard}{'board'}; |
| next; |
| |
| } |
| next if !$iamadmin && &AccessCheck($loadboard, '', (split(/\|/, $board{$loadboard}))[1]) ne "granted"; |
| MessageTotals( 'load', $myfav ); |
| |
| $favoboard = ${$myfav}{'board'}; |
| next if !$iamadmin && !&CatAccess((split(/\|/, $catinfo{"${$uid.$loadboard}{'cat'}"}))[1]); |
| push @favboards, "$favoboard|$myfav"; |
| |
| } |
| fopen(BRDTXT, "$boardsdir/$loadboard.txt") || &fatal_error("cannot_open","$boardsdir/$currentboard.txt", 1); |
| |
| foreach (<BRDTXT>) { |
| foreach ( sort @favboards ) { |
| if ((split(/\|/, $_, 2))[0] eq $loadfav) { push(@threads, $_); } |
| ( $loadboard, $loadfav ) = split /\|/xsm, $_; |
| } |
| if ( !${ $uid . $loadboard }{'board'} ) { |
| fclose(BRDTXT); |
| BoardTotals( 'load', $loadboard ); |
| } |
| } |
| |
| |
| my $curfav = @threads; |
| next |
| |
| if !$iamadmin |
| &LoadCensorList; |
| && AccessCheck( $loadboard, q{}, |
| |
| ( split /\|/xsm, $board{$loadboard} )[1] ) ne 'granted'; |
| my %attachments; |
| |
| if (-s "$vardir/attachments.txt" > 5) { |
| next |
| fopen(ATM, "$vardir/attachments.txt"); |
| if !$iamadmin |
| while (<ATM>) { |
| && !CatAccess( |
| $attachments{(split(/\|/, $_, 2))[0]}++; |
| ( split /\|/xsm, $catinfo{"${$uid.$loadboard}{'cat'}"} )[1] |
| } |
| ); |
| fclose(ATM); |
| |
| } |
| fopen( BRDTXT, "$boardsdir/$loadboard.txt" ) |
| |
| or fatal_error( 'cannot_open', "$boardsdir/$currentboard.txt", 1 ); |
| # Print the header and board info. |
| while ( my $brd = <BRDTXT> ) { |
| my $colspan = 7; |
| if ( ( split /\|/xsm, $brd, 2 )[0] eq $loadfav ) { |
| |
| push @threads, $brd; |
| # Begin printing the message index for current board. |
| } |
| $counter = $start; |
| } |
| &getlog; |
| fclose(BRDTXT); |
| my $dmax = $date - ($max_log_days_old * 86400); |
| } |
| foreach (@threads) { |
| |
| ($mnum, $msub, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate) = split(/\|/, $_); |
| my $curfav = @threads; |
| |
| |
| # Set thread class depending on locked status and number of replies. |
| LoadCensorList(); |
| if ($mnum == '') { next; } |
| |
| #if ($mstate =~ /h/i && ((!$iamadmin && !$iamgmod && !$iammod) || $sessionvalid == 0)) { next; } |
| my %attachments; |
| |
| my $att_length = -s "$vardir/attachments.txt"; |
| &MessageTotals('load', $mnum); |
| if ( ( -s "$vardir/attachments.txt" ) > 5 ) { |
| |
| fopen( ATM, "$vardir/attachments.txt" ); |
| $permlinkboard = ${$mnum}{'board'} eq $annboard ? $annboard : $currentboard; |
| while (<ATM>) { |
| my $permdate = &permtimer($_); |
| $attachments{ ( split /\|/xsm, $_, 2 )[0] }++; |
| my $message_permalink = qq~<a href="http://$perm_domain/$symlink$permdate/$permlinkboard/$mnum">$messageindex_txt{'10'}</a>~; |
| } |
| |
| fclose(ATM); |
| $threadclass = 'thread'; |
| } |
| if ($mstate =~ /h/i) { $threadclass = 'hide'; } |
| |
| elsif ($mstate =~ /l/i) { $threadclass = 'locked'; } |
| # Print the header and board info. |
| elsif ($mreplies >= $VeryHotTopic) { $threadclass = 'veryhotthread'; } |
| my $colspan = 7; |
| elsif ($mreplies >= $HotTopic) { $threadclass = 'hotthread'; } |
| |
| elsif ($mstate == '') { $threadclass = 'thread'; } |
| # Begin printing the message index for current board. |
| if ($threadclass eq 'hide' && $mstate =~ /s/i && $mstate !~ /l/i) { $threadclass = 'hidesticky'; } |
| $counter = $start; |
| elsif ($threadclass eq 'hide' && $mstate =~ /l/i && $mstate !~ /s/i) { $threadclass = 'hidelock'; } |
| getlog(); |
| elsif ($threadclass eq 'hide' && $mstate =~ /s/i && $mstate =~ /l/i) { $threadclass = 'hidestickylock'; } |
| my $dmax = $date - ( $max_log_days_old * 86400 ); |
| elsif ($threadclass eq 'locked' && $mstate =~ /s/i && $mstate !~ /h/i) { $threadclass = 'stickylock'; } |
| foreach (@threads) { |
| elsif ($mstate =~ /s/i && $mstate !~ /h/i) { $threadclass = 'sticky'; } |
| ( |
| elsif (${$mnum}{'board'} eq $annboard && $mstate !~ /h/i) { $threadclass = $threadclass eq 'locked' ? 'announcementlock' : 'announcement'; } |
| $mnum, $msub, $mname, $memail, $mdate, |
| |
| $mreplies, $musername, $micon, $mstate |
| my $movedFlag; |
| ) = split /\|/xsm, $_; |
| (undef, $movedFlag) = &Split_Splice_Move($msub,$mnum); |
| |
| |
| # Set thread class depending on locked status and number of replies. |
| if (!$iamguest && $max_log_days_old) { |
| if ( $mnum eq q{} ) { next; } |
| # 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, |
| MessageTotals( 'load', $mnum ); |
| # 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"}); |
| $permlinkboard = |
| if ($yyuserlog{"$mnum--unread"} || (!$dlp && $mdate > $dmax) || ($dlp > $dmax && $dlp < $mdate)) { |
| ${$mnum}{'board'} eq $annboard ? $annboard : $currentboard; |
| if (${$mnum}{'board'} eq $annboard) { |
| my $permdate = permtimer($mnum); |
| $new = qq~<a href="$scripturl?virboard=$currentboard;num=$mnum/new"><img src="$imagesdir/new.gif" alt="$messageindex_txt{'302'}" title="$messageindex_txt{'302'}" border="0"/></a>~; |
| my $message_permalink = |
| } else { |
| qq~<a href="http://$perm_domain/$symlink$permdate/$permlinkboard/$mnum">$messageindex_txt{'10'}</a>~; |
| $new = qq~<a href="$scripturl?num=$mnum/new"><img src="$imagesdir/new.gif" alt="$messageindex_txt{'302'}" title="$messageindex_txt{'302'}" border="0"/></a>~; |
| |
| } |
| $threadclass = 'thread'; |
| |
| if ( $mstate =~ /h/ism ) { $threadclass = 'hide'; } |
| } else { |
| elsif ( $mstate =~ /l/ism ) { $threadclass = 'locked'; } |
| $new = ''; |
| elsif ( $mreplies >= $VeryHotTopic ) { $threadclass = 'veryhotthread'; } |
| } |
| elsif ( $mreplies >= $HotTopic ) { $threadclass = 'hotthread'; } |
| } |
| elsif ( $mstate eq q{} ) { $threadclass = 'thread'; } |
| $new = '' if $movedFlag; |
| if ( $threadclass eq 'hide' && $mstate =~ /s/ism && $mstate !~ /l/ism ) |
| |
| { |
| $micon = qq~<img src="$imagesdir/$micon.gif" alt="" border="0" align="middle" />~; |
| $threadclass = 'hidesticky'; |
| $mpoll = ""; |
| } |
| if (-e "$datadir/$mnum.poll") { |
| elsif ($threadclass eq 'hide' |
| $mpoll = qq~<b>$messageindex_txt{'15'}: </b>~; |
| && $mstate =~ /l/ism |
| fopen(POLL, "$datadir/$mnum.poll"); |
| && $mstate !~ /s/ism ) |
| my @poll = <POLL>; |
| { |
| fclose(POLL); |
| $threadclass = 'hidelock'; |
| 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; |
| elsif ($threadclass eq 'hide' |
| if ($poll_end && !$poll_locked && $poll_end < $date) { |
| && $mstate =~ /s/ism |
| $poll_locked = 1; |
| && $mstate =~ /l/ism ) |
| $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"; |
| $threadclass = 'hidestickylock'; |
| fopen(POLL, ">$datadir/$mnum.poll"); |
| } |
| print POLL @poll; |
| elsif ($threadclass eq 'locked' |
| fclose(POLL); |
| && $mstate =~ /s/ism |
| } |
| && $mstate !~ /h/ism ) |
| $micon = qq~$img{'pollicon'}~; |
| { |
| if ($poll_locked) { $micon = $img{'polliconclosed'}; } |
| $threadclass = 'stickylock'; |
| elsif ($max_log_days_old && $mdate > $dmax) { |
| } |
| if ($dlp < $createpoll_date) { |
| elsif ( $mstate =~ /s/ism && $mstate !~ /h/ism ) { |
| $micon = qq~$img{'polliconnew'}~; |
| $threadclass = 'sticky'; |
| } else { |
| } |
| fopen(POLLED, "$datadir/$mnum.polled"); |
| elsif ( ${$mnum}{'board'} eq $annboard && $mstate !~ /h/ism ) { |
| my $polled = <POLLED>; |
| $threadclass = |
| fclose(POLLED); |
| $threadclass eq 'locked' ? 'announcementlock' : 'announcement'; |
| if ($dlp < (split(/\|/, $polled))[3]) { $micon = qq~$img{'polliconnew'}~; } |
| } |
| } |
| |
| } |
| my $movedFlag; |
| } |
| ( undef, $movedFlag ) = Split_Splice_Move( $msub, $mnum ); |
| |
| |
| # Load the current nickname of the account name of the thread starter. |
| if ( !$iamguest && $max_log_days_old ) { |
| if ($musername ne 'Guest') { |
| |
| &LoadUser($musername); |
| # Decide if thread should have the "NEW" indicator next to it. |
| if (${$uid.$musername}{'realname'}) { |
| # Do this by reading the user's log for last read time on thread, |
| $mname = qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$musername}">$ {$uid.$musername}{'realname'}</a>~; |
| # and compare to the last post time on the thread. |
| } else { |
| $dlp = |
| $mname .= qq~ ($messageindex_txt{'470a'})~; |
| int( $yyuserlog{$mnum} ) > |
| } |
| int( $yyuserlog{"$currentboard--mark"} ) |
| } |
| ? int( $yyuserlog{$mnum} ) |
| |
| : int $yyuserlog{"$currentboard--mark"}; |
| ($msub, undef) = &Split_Splice_Move($msub,0); |
| if ( $yyuserlog{"$mnum--unread"} |
| # Censor the subject of the thread. |
| || ( !$dlp && $mdate > $dmax ) |
| $msub = &Censor($msub); |
| || ( $dlp > $dmax && $dlp < $mdate ) ) |
| &ToChars($msub); |
| { |
| |
| if ( ${$mnum}{'board'} eq $annboard ) { |
| # Build the page links list. |
| $new = |
| $pages = ''; |
| qq~<a href="$scripturl?virboard=$currentboard;num=$mnum/new">$micon{'new'}</a>~; |
| $pagesall; |
| } |
| if ($showpageall) { $pagesall = qq~<a href="$scripturl?num=$mnum/all-0">$pidtxt{'01'}</a>~; } |
| else { |
| if (int(($mreplies + 1) / $maxmessagedisplay) > 6) { |
| $new = |
| $pages = qq~ <a href="$scripturl?num=$mnum/~ . (!$ttsreverse ? "0#0" : "$mreplies#$mreplies") . qq~">1</a>~; |
| qq~<a href="$scripturl?num=$mnum/new">$micon{'new'}</a>~; |
| $pages .= qq~ <a href="$scripturl?num=$mnum/~ . (!$ttsreverse ? "$maxmessagedisplay#$maxmessagedisplay" : ($mreplies - $maxmessagedisplay) . '#' . ($mreplies - $maxmessagedisplay)) . qq~">2</a>~; |
| } |
| $endpage = int($mreplies / $maxmessagedisplay) + 1; |
| } |
| $i = ($endpage - 1) * $maxmessagedisplay; |
| else { |
| $j = $i - $maxmessagedisplay; |
| $new = q{}; |
| $k = $endpage - 1; |
| } |
| $tmpa = $endpage - 2; |
| } |
| $tmpb = $j - $maxmessagedisplay; |
| if ($movedFlag) { $new = q{}; } |
| $pages .= qq~ <a href="javascript:void(0);" onclick="ListPages($mnum);">...</a>~; |
| |
| $pages .= qq~ <a href="$scripturl?num=$mnum/~ . (!$ttsreverse ? "$tmpb#$tmpb" : ($mreplies - $tmpb) . '#' . ($mreplies - $tmpb)) . qq~">$tmpa</a>~; |
| $micon = $micon{$micon}; |
| $pages .= qq~ <a href="$scripturl?num=$mnum/~ . (!$ttsreverse ? "$j#$j" : ($mreplies - $j) . '#' . ($mreplies - $j)) . qq~">$k</a>~; |
| $mpoll = q{}; |
| $pages .= qq~ <a href="$scripturl?num=$mnum/~ . (!$ttsreverse ? "$i#$i" : ($mreplies - $i) . '#' . ($mreplies - $i)) . qq~">$endpage</a>~; |
| if ( -e "$datadir/$mnum.poll" ) { |
| $pages = qq~<br /><span class="small">« $messageindex_txt{'139'} $pages $pagesall »</span>~; |
| $mpoll = qq~<b>$messageindex_txt{'15'}: </b>~; |
| |
| fopen( POLL, "$datadir/$mnum.poll" ); |
| } elsif ($mreplies + 1 > $maxmessagedisplay) { |
| my @poll = <POLL>; |
| $tmpa = 1; |
| fclose(POLL); |
| for ($tmpb = 0; $tmpb < $mreplies + 1; $tmpb += $maxmessagedisplay) { |
| my ( |
| $pages .= qq~<a href="$scripturl?num=$mnum/~ . (!$ttsreverse ? "$tmpb#$tmpb" : ($mreplies - $tmpb)) . qq~">$tmpa</a>\n~; |
| $poll_question, $poll_locked, $poll_uname, $poll_name, |
| ++$tmpa; |
| $poll_email, $poll_date, $guest_vote, $hide_results, |
| } |
| $multi_vote, $poll_mod, $poll_modname, $poll_comment, |
| $pages =~ s/\n\Z//; |
| $vote_limit, $pie_radius, $pie_legends, $poll_end |
| $pages = qq~<br /><span class="small">« $messageindex_txt{'139'} $pages »</span>~; |
| ) = split /\|/xsm, $poll[0]; |
| } |
| chomp $poll_end; |
| |
| if ( $poll_end && !$poll_locked && $poll_end < $date ) { |
| $views = ${$mnum}{'views'}; |
| $poll_locked = 1; |
| $lastposter = ${$mnum}{'lastposter'}; |
| $poll_end = q{}; |
| if ($lastposter =~ m~\AGuest-(.*)~) { |
| $poll[0] = |
| $lastposter = $1; |
| "$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"; |
| } elsif ($lastposter !~ m~Guest~ && !(-e "$memberdir/$lastposter.vars")) { |
| fopen( POLL, ">$datadir/$mnum.poll" ); |
| $lastposter = $messageindex_txt{'470a'}; |
| print {POLL} @poll or croak "$croak{'print'} POLL"; |
| } else { |
| fclose(POLL); |
| unless (($lastposter eq $messageindex_txt{'470'} || $lastposter eq $messageindex_txt{'470a'}) && -e "$memberdir/$lastposter.vars") { |
| } |
| &LoadUser($lastposter); |
| $micon = qq~$img{'pollicon'}~; |
| if (${$uid.$lastposter}{'realname'}) { $lastposter = qq~<a href="$scripturl?action=viewprofile;username=$lastposter">${$uid.$lastposter}{'realname'}</a>~; } |
| if ($poll_locked) { $micon = $img{'polliconclosed'}; } |
| } |
| elsif ( $max_log_days_old && $mdate > $dmax ) { |
| } |
| if ( $dlp < $createpoll_date ) { |
| $lastpostername = $lastposter || $messageindex_txt{'470'}; |
| $micon = qq~$img{'polliconnew'}~; |
| $views = $views ? $views - 1 : 0; |
| } |
| |
| else { |
| # Check if the thread contains attachments and create a paper-clip icon if it does |
| fopen( POLLED, "$datadir/$mnum.polled" ); |
| $temp_attachment = $attachments{$mnum} ? qq~<a href="javascript:void(window.open('$scripturl?action=viewdownloads;thread=$mnum','_blank','width=800,height=650,scrollbars=yes'))"><img src="$imagesdir/paperclip.gif" alt="$messageindex_txt{'3'} $attachments{$mnum} ~ . ($attachments{$mnum} == 1 ? $messageindex_txt{'5'} : $messageindex_txt{'4'}) . qq~" title="$messageindex_txt{'3'} $attachments{$mnum} ~ . ($attachments{$mnum} == 1 ? $messageindex_txt{'5'} : $messageindex_txt{'4'}) . qq~" style="border-style:none;" /></a>~ : ""; |
| my $polled = <POLLED>; |
| |
| fclose(POLLED); |
| $mydate = &timeformat($mdate); |
| if ( $dlp < ( split /\|/xsm, $polled )[3] ) { |
| |
| $micon = qq~$img{'polliconnew'}~; |
| my $threadpic = qq~<img src="$imagesdir/$threadclass.gif" alt=""/>~; |
| } |
| my $msublink = qq~<a href="$scripturl?num=$mnum">$msub</a>~; |
| } |
| if (!$movedFlag && ${$mnum}{'board'} eq $annboard) { |
| } |
| $msublink = qq~<a href="$scripturl?virboard=$currentboard;num=$mnum">$msub</a>~; |
| } |
| } |
| |
| my $lastpostlink = qq~<a href="$scripturl?num=$mnum/$mreplies#$mreplies">$img{'lastpost'}$mydate</a>~; |
| # Load the current nickname of the account name of the thread starter. |
| my $fmreplies = &NumberFormat($mreplies); |
| if ( $musername ne 'Guest' ) { |
| $views = &NumberFormat($views); |
| LoadUser($musername); |
| my $tempbar = $threadbar; |
| if ( ${ $uid . $musername }{'realname'} ) { |
| if ($movedFlag) { $tempbar = $threadbarMoved; } |
| $mname = |
| |
| qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$musername}">$format_unbold{$musername}</a>~; |
| $adminbar = qq~<input type="checkbox" name="admin$mcount" class="windowbg" style="border: 0px;" value="$mnum" />~; |
| } |
| $admincol = $admincolumn; |
| else { |
| $admincol =~ s/({|<)yabb admin(}|>)/$adminbar/g; |
| $mname .= qq~ ($messageindex_txt{'470a'})~; |
| |
| } |
| $tempbar =~ s/({|<)yabb admin column(}|>)/$admincol/g; |
| } |
| $tempbar =~ s/({|<)yabb threadpic(}|>)/$threadpic/g; |
| |
| $tempbar =~ s/({|<)yabb icon(}|>)/$micon/g; |
| ( $msub, undef ) = Split_Splice_Move( $msub, 0 ); |
| $tempbar =~ s/({|<)yabb new(}|>)/$new/g; |
| |
| $tempbar =~ s/({|<)yabb poll(}|>)/$mpoll/g; |
| # Censor the subject of the thread. |
| $tempbar =~ s/({|<)yabb favorite(}|>)/$favicon{$mnum}/g; |
| $msub = Censor($msub); |
| $tempbar =~ s/({|<)yabb subjectlink(}|>)/$msublink/g; |
| ToChars($msub); |
| $tempbar =~ s/({|<)yabb attachmenticon(}|>)/$temp_attachment/g; |
| |
| $tempbar =~ s/({|<)yabb pages(}|>)/$pages/g; |
| # Build the page links list. |
| $tempbar =~ s/({|<)yabb starter(}|>)/$mname/g; |
| $pages = q{}; |
| $tempbar =~ s/({|<)yabb replies(}|>)/$fmreplies/g; |
| $pagesall; |
| $tempbar =~ s/({|<)yabb views(}|>)/$views/g; |
| if ($showpageall) { |
| $tempbar =~ s/({|<)yabb lastpostlink(}|>)/$lastpostlink/g; |
| $pagesall = |
| $tempbar =~ s/({|<)yabb lastposter(}|>)/$lastpostername/g; |
| qq~<a href="$scripturl?num=$mnum/all-0">$pidtxt{'01'}</a>~; |
| if ($accept_permalink == 1) { |
| } |
| $tempbar =~ s/({|<)yabb permalink(}|>)/$message_permalink/g; |
| $maxmessagedisplay ||= 10; |
| } else { |
| if ( int( ( $mreplies + 1 ) / $maxmessagedisplay ) > 6 ) { |
| $tempbar =~ s/({|<)yabb permalink(}|>)//g; |
| $pages = |
| } |
| qq~ <a href="$scripturl?num=$mnum/~ |
| $tmptempbar .= $tempbar; |
| . ( !$ttsreverse ? '0#0' : "$mreplies#$mreplies" ) |
| $counter++; |
| . q~">1</a>~; |
| $mcount++; |
| $pages .= qq~ <a href="$scripturl?num=$mnum/~ |
| $treplies += $mreplies + 1; |
| . ( |
| } |
| !$ttsreverse |
| |
| ? "$maxmessagedisplay#$maxmessagedisplay" |
| # Put a "no messages" message if no threads exisit: |
| : ( $mreplies - $maxmessagedisplay ) . q{#} |
| if (!$tmptempbar) { |
| . ( $mreplies - $maxmessagedisplay ) |
| $tmptempbar = qq~ |
| ) . q~">2</a>~; |
| <tr> |
| $endpage = int( $mreplies / $maxmessagedisplay ) + 1; |
| <td class="windowbg2" valign="middle" align="center" colspan="8"><br />$messageindex_txt{'840'}<br /><br /></td> |
| $i = ( $endpage - 1 ) * $maxmessagedisplay; |
| </tr> |
| $j = $i - $maxmessagedisplay; |
| ~; |
| $k = $endpage - 1; |
| } |
| $tmpa = $endpage - 2; |
| |
| $tmpb = $j - $maxmessagedisplay; |
| $yabbicons = qq~ |
| $pages .= |
| <img src="$imagesdir/thread.gif" alt="$messageindex_txt{'457'}" title="$messageindex_txt{'457'}" /> $messageindex_txt{'457'}<br /> |
| qq~ <a href="javascript:void(0);" onclick="ListPages($mnum);">...</a>~; |
| <img src="$imagesdir/sticky.gif" alt="$messageindex_txt{'779'}" title="$messageindex_txt{'779'}" /> $messageindex_txt{'779'}<br /> |
| $pages .= qq~ <a href="$scripturl?num=$mnum/~ |
| <img src="$imagesdir/locked.gif" alt="$messageindex_txt{'456'}" title="$messageindex_txt{'456'}" /> $messageindex_txt{'456'}<br /> |
| . ( |
| <img src="$imagesdir/stickylock.gif" alt="$messageindex_txt{'780'}" title="$messageindex_txt{'780'}" /> $messageindex_txt{'780'}<br /> |
| !$ttsreverse |
| ~; |
| ? "$tmpb#$tmpb" |
| |
| : ( $mreplies - $tmpb ) . q{#} . ( $mreplies - $tmpb ) |
| if (($iamadmin || $iamgmod || $iammod) && $sessionvalid == 1) { |
| ) . qq~">$tmpa</a>~; |
| $yabbadminicons = qq~<img src="$imagesdir/hide.gif" alt="$messageindex_txt{'458'}" title="$messageindex_txt{'458'}" /> $messageindex_txt{'458'}<br />~; |
| $pages .= qq~ <a href="$scripturl?num=$mnum/~ |
| $yabbadminicons .= qq~<img src="$imagesdir/hidesticky.gif" alt="$messageindex_txt{'459'}" title="$messageindex_txt{'459'}" /> $messageindex_txt{'459'}<br />~; |
| . ( |
| $yabbadminicons .= qq~<img src="$imagesdir/hidelock.gif" alt="$messageindex_txt{'460'}" title="$messageindex_txt{'460'}" /> $messageindex_txt{'460'}<br />~; |
| !$ttsreverse |
| $yabbadminicons .= qq~<img src="$imagesdir/hidestickylock.gif" alt="$messageindex_txt{'461'}" title="$messageindex_txt{'461'}" /> $messageindex_txt{'461'}<br />~; |
| ? "$j#$j" |
| } |
| : ( $mreplies - $j ) . q{#} . ( $mreplies - $j ) |
| |
| ) . qq~">$k</a>~; |
| $yabbadminicons .= qq~ |
| $pages .= qq~ <a href="$scripturl?num=$mnum/~ |
| <img src="$imagesdir/announcement.gif" alt="$messageindex_txt{'779a'}" title="$messageindex_txt{'779a'}" /> $messageindex_txt{'779a'}<br /> |
| . ( |
| <img src="$imagesdir/announcementlock.gif" alt="$messageindex_txt{'779b'}" title="$messageindex_txt{'779b'}" /> $messageindex_txt{'779b'}<br /> |
| !$ttsreverse |
| <img src="$imagesdir/hotthread.gif" alt="$messageindex_txt{'454'} $HotTopic $messageindex_txt{'454a'}" title="$messageindex_txt{'454'} $HotTopic $messageindex_txt{'454a'}" /> $messageindex_txt{'454'} $HotTopic $messageindex_txt{'454a'}<br /> |
| ? "$i#$i" |
| <img src="$imagesdir/veryhotthread.gif" alt="$messageindex_txt{'455'} $VeryHotTopic $messageindex_txt{'454a'}" title="$messageindex_txt{'455'} $VeryHotTopic $messageindex_txt{'454a'}" /> $messageindex_txt{'455'} $VeryHotTopic $messageindex_txt{'454a'}<br /> |
| : ( $mreplies - $i ) . q{#} . ( $mreplies - $i ) |
| ~; |
| ) . qq~">$endpage</a>~; |
| |
| $pages = |
| $formstart = qq~<form name="multiremfav" action="$scripturl?board=$currentboard;action=multiremfav" method="post" style="display: inline">~; |
| qq~<br /><span class="small">« $messageindex_txt{'139'} $pages $pagesall »</span>~; |
| $formend = qq~<input type="hidden" name="allpost" value="$INFO{'start'}" /></form>~; |
| |
| |
| } |
| &LoadAccess; |
| elsif ( $mreplies + 1 > $maxmessagedisplay ) { |
| |
| $tmpa = 1; |
| $adminselector = qq~ |
| for my $tmpb ( 0 .. $mreplies ) { |
| <input type="submit" value="$messageindex_txt{'842'}" class="button" /> |
| if ( $tmpb % $maxmessagedisplay == 0 ) { |
| ~; |
| $pages .= |
| |
| qq~<a href="$scripturl?num=$mnum/~ |
| $admincheckboxes = qq~ |
| . ( !$ttsreverse ? "$tmpb#$tmpb" : ( $mreplies - $tmpb ) ) |
| <input type="checkbox" name="checkall" id="checkall" value="" class="titlebg" style="border: 0px;" onclick="if (this.checked) checkAll(0); else uncheckAll(0);" /> |
| . qq~">$tmpa</a>\n~; |
| ~; |
| ++$tmpa; |
| $subfooterbar =~ s/({|<)yabb admin selector(}|>)/$adminselector/g; |
| } |
| $subfooterbar =~ s/({|<)yabb admin checkboxes(}|>)/$admincheckboxes/g; |
| } |
| |
| $pages =~ s/\n\Z//xsm; |
| # Template it |
| $pages = |
| $adminheader =~ s/({|<)yabb admin(}|>)/$messageindex_txt{'2'}/g; |
| qq~<br /><span class="small">« $messageindex_txt{'139'} $pages »</span>~; |
| |
| } |
| $messageindex_template =~ s/({|<)yabb home(}|>)//g; |
| |
| $messageindex_template =~ s/({|<)yabb category(}|>)//g; |
| $views = ${$mnum}{'views'}; |
| |
| $lastposter = ${$mnum}{'lastposter'}; |
| $yynavigation = qq~› <a href="$scripturl?action=mycenter" class="nav">$img_txt{'mycenter'}</a> › $img_txt{'70'}~; |
| if ( $lastposter =~ m{\AGuest-(.*)}xsm ) { |
| |
| $lastposter = $1; |
| $favboard = qq~<span class="nav">$img_txt{'70'}</span>~; |
| } |
| $messageindex_template =~ s/({|<)yabb board(}|>)/$favboard/g; |
| elsif ( $lastposter !~ m{Guest}xsm |
| $messageindex_template =~ s/({|<)yabb moderators(}|>)//g; |
| && !( -e "$memberdir/$lastposter.vars" ) ) |
| $bdescrip = qq~$messageindex_txt{'75'}<br />$messageindex_txt{'76'} $curfav $messageindex_txt{'77'} $maxfavs $messageindex_txt{'78'}~; |
| { |
| $curfav = &NumberFormat($curfav); |
| $lastposter = $messageindex_txt{'470a'}; |
| $treplies = &NumberFormat($treplies); |
| } |
| |
| else { |
| &ToChars($bdescrip); |
| if ( |
| $boarddescription =~ s/({|<)yabb boarddescription(}|>)/$bdescrip/g; |
| ( |
| $messageindex_template =~ s/({|<)yabb description(}|>)/$boarddescription/g; |
| $lastposter ne $messageindex_txt{'470'} |
| $bdpic = qq~ <img src="$imagesdir/favboards.gif" alt="$img_txt{'70'}" title="$img_txt{'70'}" border="0" align="middle" /> ~; |
| && $lastposter ne $messageindex_txt{'470a'} |
| $messageindex_template =~ s/({|<)yabb bdpicture(}|>)/$bdpic/g; |
| ) |
| $messageindex_template =~ s/({|<)yabb threadcount(}|>)/$curfav/g; |
| || !-e "$memberdir/$lastposter.vars" |
| $messageindex_template =~ s/({|<)yabb messagecount(}|>)/$treplies/g; |
| ) |
| |
| { |
| $messageindex_template =~ s/({|<)yabb colspan(}|>)/$colspan/g; |
| LoadUser($lastposter); |
| $messageindex_template =~ s/({|<)yabb notify button(}|>)//g; |
| if ( ${ $uid . $lastposter }{'realname'} ) { |
| $messageindex_template =~ s/({|<)yabb markall button(}|>)//g; |
| $lastposter = |
| $messageindex_template =~ s/({|<)yabb new post button(}|>)//g; |
| qq~<a href="$scripturl?action=viewprofile;username=$lastposter">$format_unbold{$lastposter}</a>~; |
| $messageindex_template =~ s/({|<)yabb new poll button(}|>)//g; |
| } |
| $messageindex_template =~ s/({|<)yabb pageindex top(}|>)//g; |
| } |
| $messageindex_template =~ s/({|<)yabb pageindex bottom(}|>)//g; |
| } |
| $messageindex_template =~ s/({|<)yabb topichandellist(}|>)//g; |
| $lastpostername = $lastposter || $messageindex_txt{'470'}; |
| $messageindex_template =~ s/({|<)yabb pageindex toggle(}|>)//g; |
| $views = $views ? $views - 1 : 0; |
| |
| |
| $messageindex_template =~ s/({|<)yabb admin column(}|>)/$adminheader/g; |
| # Check if the thread contains attachments and create a paper-clip icon if it does |
| $messageindex_template =~ s/({|<)yabb modupdate(}|>)/$formstart/g; |
| $temp_attachment = |
| $messageindex_template =~ s/({|<)yabb modupdateend(}|>)/$formend/g; |
| $attachments{$mnum} |
| |
| ? qq~<a href="javascript:void(window.open('$scripturl?action=viewdownloads;thread=$mnum','_blank','width=800,height=650,scrollbars=yes'))"><img src="$micon_bg{'paperclip'}" alt="$messageindex_txt{'3'} $attachments{$mnum} ~ |
| $messageindex_template =~ s/({|<)yabb stickyblock(}|>)//g; |
| . ( |
| $messageindex_template =~ s/({|<)yabb threadblock(}|>)/$tmptempbar/g; |
| $attachments{$mnum} == 1 |
| $messageindex_template =~ s/({|<)yabb adminfooter(}|>)/$subfooterbar/g; |
| ? $messageindex_txt{'5'} |
| $messageindex_template =~ s/({|<)yabb icons(}|>)/$yabbicons/g; |
| : $messageindex_txt{'4'} |
| $messageindex_template =~ s/({|<)yabb admin icons(}|>)/$yabbadminicons/g; |
| ) |
| $messageindex_template =~ s/({|<)yabb rss(}|>)//g; |
| . qq~" title="$messageindex_txt{'3'} $attachments{$mnum} ~ |
| $messageindex_template =~ s/({|<)yabb rssfeed(}|>)//g; |
| . ( |
| $showFavorites .= qq~$messageindex_template~; |
| $attachments{$mnum} == 1 |
| |
| ? $messageindex_txt{'5'} |
| $showFavorites .= qq~ |
| : $messageindex_txt{'4'} |
| <script language="JavaScript1.2" type="text/javascript"> |
| ) |
| <!-- |
| . q~" /></a>~ |
| function checkAll(j) { |
| : q{}; |
| for (var i = 0; i < document.multiremfav.elements.length; i++) { |
| |
| if (j == 0 ) {document.multiremfav.elements[i].checked = true;} |
| $mydate = timeformat($mdate); |
| } |
| |
| } |
| my $threadpic = $micon{$threadclass}; |
| function uncheckAll(j) { |
| my $msublink = qq~<a href="$scripturl?num=$mnum">$msub</a>~; |
| for (var i = 0; i < document.multiremfav.elements.length; i++) { |
| if ( !$movedFlag && ${$mnum}{'board'} eq $annboard ) { |
| if (j == 0 ) {document.multiremfav.elements[i].checked = false;} |
| $msublink = |
| } |
| qq~<a href="$scripturl?virboard=$currentboard;num=$mnum">$msub</a>~; |
| } |
| } |
| function ListPages(tid) { window.open('$scripturl?action=pages;num='+tid, '', 'menubar=no,toolbar=no,top=50,left=50,scrollbars=yes,resizable=no,width=400,height=300'); } |
| my $lastpostlink = |
| //--> |
| qq~<a href="$scripturl?num=$mnum/$mreplies#$mreplies">$img{'lastpost'}$mydate</a>~; |
| |
| my $fmreplies = NumberFormat($mreplies); |
| |
| $views = NumberFormat($views); |
| |
| my $tempbar = $threadbar; |
| |
| if ($movedFlag) { $tempbar = $threadbarMoved; } |
| |
| |
| |
| $adminbar = |
| |
| qq~<input type="checkbox" name="admin$mcount" class="windowbg" value="$mnum" />~; |
| |
| $admincol = $admincolumn; |
| |
| $admincol =~ s/{yabb admin}/$adminbar/gsm; |
| |
| |
| |
| $tempbar =~ s/{yabb admin column}/$admincol/gsm; |
| |
| $tempbar =~ s/{yabb threadpic}/$threadpic/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}/gsm; |
| |
| $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 replies}/$fmreplies/gsm; |
| |
| $tempbar =~ s/{yabb views}/$views/gsm; |
| |
| $tempbar =~ s/{yabb lastpostlink}/$lastpostlink/gsm; |
| |
| $tempbar =~ s/{yabb lastposter}/$lastpostername/gsm; |
| |
| if ( $accept_permalink == 1 ) { |
| |
| $tempbar =~ s/{yabb permalink}/$message_permalink/gsm; |
| |
| } |
| |
| else { |
| |
| $tempbar =~ s/{yabb permalink}//gsm; |
| |
| } |
| |
| $tmptempbar .= $tempbar; |
| |
| $counter++; |
| |
| $mcount++; |
| |
| $treplies += $mreplies + 1; |
| |
| } |
| |
| |
| |
| # Put a "no messages" message if no threads exist: |
| |
| if ( !$tmptempbar ) { |
| |
| $tmptempbar = $no_favs; |
| |
| } |
| |
| |
| |
| $yabbicons = qq~$micon{'thread'} $messageindex_txt{'457'} |
| |
| <br />$micon{'sticky'} $messageindex_txt{'779'} |
| |
| <br />$micon{'locked'} $messageindex_txt{'456'} |
| |
| <br />$micon{'stickylock'}$messageindex_txt{'780'}<br />~; |
| |
| |
| |
| if ( $staff && $sessionvalid == 1 ) { |
| |
| $yabbadminicons = qq~$micon{'hide'} $messageindex_txt{'458'} |
| |
| <br />$micon{'hidesticky'} $messageindex_txt{'459'} |
| |
| <br />$micon{'hidelock'} $messageindex_txt{'460'} |
| |
| <br />$micon{'hidestickylock'} $messageindex_txt{'461'}<br />~; |
| |
| } |
| |
| |
| |
| $yabbadminicons .= qq~$micon{'announcement'} $messageindex_txt{'779a'} |
| |
| <br />$micon{'announcementlock'} $messageindex_txt{'779b'} |
| |
| <br />$micon{'hotthread'} $messageindex_txt{'454'} $HotTopic $messageindex_txt{'454a'} |
| |
| <br />$micon{'veryhotthread'} $messageindex_txt{'455'} $VeryHotTopic $messageindex_txt{'454a'}<br /> |
| |
| ~; |
| |
| |
| |
| $formstart = |
| |
| qq~<form name="multiremfav" action="$scripturl?board=$currentboard;action=multiremfav" method="post" style="display: inline">~; |
| |
| $formend = |
| |
| qq~<input type="hidden" name="allpost" value="$INFO{'start'}" /></form>~; |
| |
| |
| |
| $adminselector = qq~ |
| |
| <input type="submit" value="$messageindex_txt{'842'}" class="button small" /> |
| |
| ~; |
| |
| |
| |
| $admincheckboxes = q~ |
| |
| <input type="checkbox" name="checkall" id="checkall" value="" class="titlebg" onclick="if (this.checked) checkAll(0); else uncheckAll(0);" /> |
| |
| ~; |
| |
| $subfooterbar =~ s/{yabb admin selector}/$adminselector/gsm; |
| |
| $subfooterbar =~ s/{yabb admin checkboxes}/$admincheckboxes/gsm; |
| |
| |
| |
| # Template it |
| |
| $adminheader =~ s/{yabb admin}/$messageindex_txt{'2'}/gsm; |
| |
| |
| |
| $favorites_template =~ s/{yabb home}//gsm; |
| |
| $favorites_template =~ s/{yabb category}//gsm; |
| |
| |
| |
| $yynavigation = |
| |
| qq~› <a href="$scripturl?action=mycenter" class="nav">$img_txt{'mycenter'}</a> › $img_txt{'70'}~; |
| |
| |
| |
| $favboard = qq~<span class="nav">$img_txt{'70'}</span>~; |
| |
| $favorites_template =~ s/{yabb board}/$favboard/gsm; |
| |
| $bdescrip = |
| |
| qq~$messageindex_txt{'75'}<br />$messageindex_txt{'76'} $curfav $messageindex_txt{'77'} $maxfavs $messageindex_txt{'78'}~; |
| |
| $curfav = NumberFormat($curfav); |
| |
| $treplies = NumberFormat($treplies); |
| |
| $bdpicExt ||= 'gif'; |
| |
| |
| |
| ToChars($bdescrip); |
| |
| $boarddescription =~ s/{yabb boarddescription}/$bdescrip/gsm; |
| |
| $favorites_template =~ s/{yabb description}/$boarddescription/gsm; |
| |
| $bdpic = |
| |
| qq~ <img src="$imagesdir/$my_favbrds" alt="$img_txt{'70'}" title="$img_txt{'70'}" /> ~; |
| |
| $favorites_template =~ s/{yabb bdpicture}/$bdpic/gsm; |
| |
| $favorites_template =~ s/{yabb threadcount}/$curfav/gsm; |
| |
| $favorites_template =~ s/{yabb messagecount}/$treplies/gsm; |
| |
| |
| |
| $favorites_template =~ s/{yabb colspan}/$colspan/gsm; |
| |
| |
| |
| $favorites_template =~ s/{yabb admin column}/$adminheader/gsm; |
| |
| $favorites_template =~ s/{yabb modupdate}/$formstart/gsm; |
| |
| $favorites_template =~ s/{yabb modupdateend}/$formend/gsm; |
| |
| |
| |
| $favorites_template =~ s/{yabb threadblock}/$tmptempbar/gsm; |
| |
| $favorites_template =~ s/{yabb adminfooter}/$subfooterbar/gsm; |
| |
| $favorites_template =~ s/{yabb icons}/$yabbicons/gsm; |
| |
| $favorites_template =~ s/{yabb admin icons}/$yabbadminicons/gsm; |
| |
| $showFavorites .= qq~$favorites_template~; |
| |
| |
| |
| $showFavorites .= qq~ |
| |
| <script type="text/javascript"> |
| |
| function checkAll(j) { |
| |
| for (var i = 0; i < document.multiremfav.elements.length; i++) { |
| |
| if (j == 0 ) {document.multiremfav.elements[i].checked = true;} |
| |
| } |
| |
| } |
| |
| function uncheckAll(j) { |
| |
| for (var i = 0; i < document.multiremfav.elements.length; i++) { |
| |
| if (j == 0 ) {document.multiremfav.elements[i].checked = false;} |
| |
| } |
| |
| } |
| |
| function ListPages(tid) { window.open('$scripturl?action=pages;num='+tid, '', 'menubar=no,toolbar=no,top=50,left=50,scrollbars=yes,resizable=no,width=400,height=300'); } |
| </script> |
| </script> |
| ~; |
| ~; |
| |
| |
| $yytitle = $img_txt{'70'}; |
| $yytitle = $img_txt{'70'}; |
| |
| return; |
| } |
| } |
| |
| |
| sub AddFav { |
| sub AddFav { |
| my $favo = $INFO{'fav'} || $_[0]; |
| my @x = @_; |
| my $goto = $INFO{'start'} || $_[1] || 0; |
| my $favo = $INFO{'fav'} || $x[0]; |
| my $return = $_[2]; |
| my $goto = $INFO{'start'} || $x[1] || 0; |
| |
| my $return = $x[2]; |
| &fatal_error("error_occurred",'',1) if $favo =~ /\D/; |
| |
| |
| if ( $favo =~ /\D/xsm ) { fatal_error( 'error_occurred', q{}, 1 ); } |
| my @oldfav = split(/,/, ${$uid.$username}{'favorites'}); |
| |
| if (@oldfav < ($maxfavs || 10)) { |
| my @oldfav = split /,/xsm, ${ $uid . $username }{'favorites'}; |
| push(@oldfav, $favo); |
| if ( @oldfav < ( $maxfavs || 10 ) ) { |
| ${$uid.$username}{'favorites'} = join(",", &undupe(@oldfav)); |
| push @oldfav, $favo; |
| &UserAccount($username, "update"); |
| ${ $uid . $username }{'favorites'} = join q{,}, undupe(@oldfav); |
| } |
| UserAccount( $username, 'update' ); |
| if (!$return) { |
| } |
| if ($INFO{'oldaddfav'}) { |
| if ( !$return ) { |
| $yySetLocation = qq~$scripturl?num=$favo/$goto~; |
| if ( $INFO{'oldaddfav'} ) { |
| &redirectexit; |
| $yySetLocation = qq~$scripturl?num=$favo/$goto~; |
| } |
| redirectexit(); |
| $elenable = 0; |
| } |
| die ""; # This is here only to avoid server error log entries! |
| $elenable = 0; |
| } |
| croak q{}; # This is here only to avoid server error log entries! |
| |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub MultiRemFav { |
| sub MultiRemFav { |
| while ($maxfavs >= $count) { |
| while ( $maxfavs >= $count ) { |
| &RemFav($FORM{"admin$count"}); |
| RemFav( $FORM{"admin$count"} ); |
| $count++; |
| $count++; |
| } |
| } |
| $yySetLocation = qq~$scripturl?action=favorites~; |
| $yySetLocation = qq~$scripturl?action=favorites~; |
| &redirectexit; |
| redirectexit(); |
| |
| return; |
| } |
| } |
| |
| |
| sub RemFav { |
| sub RemFav { |
| my $favo = $INFO{'fav'} || $_[0]; |
| my @x = @_; |
| my $goto = $INFO{'start'} || $_[1]; |
| my $favo = $INFO{'fav'} || $x[0]; |
| if (!$goto) { $goto = 0; } |
| my $goto = $INFO{'start'} || $x[1]; |
| |
| if ( !$goto ) { $goto = 0; } |
| my @newfav; |
| |
| foreach (split(/,/, ${$uid.$username}{'favorites'})) { |
| my @newfav; |
| push(@newfav, $_) if $favo ne $_; |
| foreach ( split /,/xsm, ${ $uid . $username }{'favorites'} ) { |
| } |
| if ( $favo ne $_ ) { push @newfav, $_; } |
| |
| } |
| ${$uid.$username}{'favorites'} = join(",", &undupe(@newfav)); |
| |
| &UserAccount($username, "update"); |
| ${ $uid . $username }{'favorites'} = join q{,}, undupe(@newfav); |
| |
| UserAccount( $username, 'update' ); |
| return if $_[1] eq "nonexist"; |
| |
| if ($INFO{'ref'} ne "delete" && $action ne "multiremfav" && $INFO{'oldaddfav'}) { |
| return if $x[1] eq 'nonexist'; |
| $yySetLocation = qq~$scripturl?num=$favo/$goto~; |
| if ( $INFO{'ref'} ne 'delete' |
| &redirectexit; |
| && $action ne 'multiremfav' |
| } |
| && $INFO{'oldaddfav'} ) |
| if ($action eq 'remfav') { |
| { |
| $elenable = 0; |
| $yySetLocation = qq~$scripturl?num=$favo/$goto~; |
| die ""; # This is here only to avoid server error log entries! |
| redirectexit(); |
| } |
| } |
| |
| if ( $action eq 'remfav' ) { |
| |
| $elenable = 0; |
| |
| croak q{}; # This is here only to avoid server error log entries! |
| |
| } |
| |
| return; |
| } |
| } |
| |
| |
| sub IsFav { |
| sub IsFav { |
| my $favo = $_[0]; |
| my @x = @_; |
| my $goto = $_[1] || 0; |
| my $favo = $x[0]; |
| my $postcheck = $_[2]; |
| my $goto = $x[1] || 0; |
| |
| my $postcheck = $x[2]; |
| $yyjavascript .= qq~\n |
| |
| var addlink = '$img{'addfav'}'; |
| my $addfav = $img{'addfav'}; |
| var remlink = '$img{'remfav'}';\n~ if !$postcheck; |
| my $remfav = $img{'remfav'}; |
| |
| if ($useThreadtools) { |
| my @oldfav = split(/,/, ${$uid.$username}{'favorites'}); |
| $addfav =~ s/\[tool=(.+?)\](.+?)\[\/tool\]/$2/gsm; |
| my ($button,$nofav); |
| $remfav =~ s/\[tool=(.+?)\](.+?)\[\/tool\]/$2/gsm; |
| if (@oldfav < ($maxfavs || 10)) { |
| } |
| $button = qq~$menusep<a href="javascript:AddRemFav('$scripturl?action=addfav;fav=$favo;start=$goto','$imagesdir')" name="favlink">$img{'addfav'}</a>~; |
| if ( !$postcheck ) { |
| $nofav = 1; |
| $yyjavascript .= qq~\n |
| } else { $nofav = 2; } |
| var addlink = '$addfav'; |
| |
| var remlink = '$remfav';\n~; |
| foreach (@oldfav) { |
| } |
| if ($favo eq $_) { |
| |
| $button = qq~$menusep<a href="javascript:AddRemFav('$scripturl?action=remfav;fav=$favo;start=$goto','$imagesdir')" name="favlink">$img{'remfav'}</a>~; |
| my @oldfav = split /,/xsm, ${ $uid . $username }{'favorites'}; |
| $nofav = 0; |
| my ( $button, $nofav ); |
| } |
| if ( @oldfav < ( $maxfavs || 10 ) ) { |
| } |
| $button = |
| (!$postcheck ? $button : $nofav); |
| qq~$menusep<a href="javascript:AddRemFav('$scripturl?action=addfav;fav=$favo;start=$goto','$imagesdir')" id="favlink">$img{'addfav'}</a>~; |
| |
| $nofav = 1; |
| |
| } |
| |
| else { $nofav = 2; } |
| |
| |
| |
| foreach (@oldfav) { |
| |
| if ( $favo eq $_ ) { |
| |
| $button = |
| |
| qq~$menusep<a href="javascript:AddRemFav('$scripturl?action=remfav;fav=$favo;start=$goto','$imagesdir')" id="favlink">$img{'remfav'}</a>~; |
| |
| $nofav = 0; |
| |
| } |
| |
| } |
| |
| return ( !$postcheck ? $button : $nofav ); |
| } |
| } |
| |
| |
| 1; |
| sub IsFav1 { |
| |
| my @x = @_; |
| |
| my $favo = $x[0]; |
| |
| my $goto = $x[1] || 0; |
| |
| my $postcheck = $x[2]; |
| |
| |
| |
| my $addfav = $img{'addfav'}; |
| |
| my $remfav = $img{'remfav'}; |
| |
| if ($useThreadtools) { |
| |
| $addfav =~ s/\[tool=(.+?)\](.+?)\[\/tool\]/$2/gsm; |
| |
| $remfav =~ s/\[tool=(.+?)\](.+?)\[\/tool\]/$2/gsm; |
| |
| } |
| |
| if ( !$postcheck ) { |
| |
| $yyjavascript .= qq~\n |
| |
| addlink = '$addfav'; |
| |
| remlink = '$remfav';\n~; |
| |
| } |
| |
| |
| |
| my @oldfav = split /,/xsm, ${ $uid . $username }{'favorites'}; |
| |
| my ( $button, $nofav ); |
| |
| if ( @oldfav < ( $maxfavs || 10 ) ) { |
| |
| $button = |
| |
| qq~$menusep<a href="javascript:AddRemFav('$scripturl?action=addfav;fav=$favo;start=$goto','$imagesdir')" id="favlink2">$img{'addfav'}</a>~; |
| |
| $nofav = 1; |
| |
| } |
| |
| else { $nofav = 2; } |
| |
| |
| |
| foreach (@oldfav) { |
| |
| if ( $favo eq $_ ) { |
| |
| $button = |
| |
| qq~$menusep<a href="javascript:AddRemFav('$scripturl?action=remfav;fav=$favo;start=$goto','$imagesdir')" id="favlink2">$img{'remfav'}</a>~; |
| |
| $nofav = 0; |
| |
| } |
| |
| } |
| |
| return ( !$postcheck ? $button : $nofav ); |
| |
| } |
| |
| |
| |
| 1; |
| |
| |