############################################################################### # Display.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 1 Gold - SP 1.1 # # Released: December 2001; Updated March 22, 2002 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2002 Xnull (www.xnull.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # ############################################################################### $displayplver = "1 Gold - SP 1.1"; sub Display { my($msf,$mfn,$attachment,$showattach); require "$sourcedir/Karma.pl"; my $viewnum = $INFO{'num'}; if( $viewnum =~ /\D/ ) { &fatal_error($txt{'337'}); } if( $currentboard eq '' ) { &fatal_error($txt{'1'}); } $maxmessagedisplay ||= 10; my($buffer,$views,$lastposter,$tmpa,$tmpb,$tmpc,$tmpd,$moderators,$counter,$counterwords,$pageindex,$msubthread,$mnum,$mstate,$mdate,$msub,$mname,$memail,$mreplies,$musername,$micon,$noposting,$threadclass,$notify,$max,$start,$bgcolornum,$windowbg,$mattach,$mip,$mlm,$mlmb,$lastmodified,$postinfo,$star,$sendm,$topicdate); my(@userprofile,@messages,@bgcolors); my($mystatus); my(@statussettings); # Determine what category we are in. fopen(FILE, "$boardsdir/$currentboard.ctb") || &fatal_error("300 $txt{'106'}: $txt{'23'} $currentboard.ctb"); $curcat = ; fclose(FILE); #$curcat = $cat; fopen(FILE, "$boardsdir/$curcat.cat") || &fatal_error("300 $txt{'106'}: $txt{'23'} $cat.cat"); $cat = ; fclose(FILE); # Load the membergroups list. fopen(FILE, "$vardir/membergroups.txt") || &fatal_error("100 $txt{'106'}: $txt{'23'} membergroups.txt"); @membergroups = ; fclose(FILE); # Mark current thread as read. ($mnum,$tmpa,$tmpa,$tmpa,$mdate) = split(/\|/,$yyThreadLine); &dumplog($mnum,$date); ### group picture mod - load picture settings for various groups if( fopen(FILE, "$vardir/membergroups_pics.txt") ) {; @grouppics = ; fclose(FILE); @grouppics = split(/\|/,$grouppics[0]); } ### end group picture mod # Add 1 to the number of views of this thread. if(fopen(FILE, "$datadir/$viewnum.data")) { $tmpa = ; fclose(FILE); } elsif( -e "$datadir/$viewnum.data" ) { &fatal_error("102 $txt{'106'}: $txt{'23'} $viewnum.data"); } else { $tmpa = '0'; } ($tmpa, $tmpb, $tmpc, $tmpd) = split( /\|/, $tmpa ); $tmpa++; fopen(FILE, "+>$datadir/$viewnum.data") || &fatal_error("103 $txt{'106'}: $txt{'23'} $viewnum.data"); print FILE qq~$tmpa|$tmpb|$tmpc|$tmpd~; fclose(FILE); $views = $tmpa - 1; # Check to make sure this thread isn't locked. ($mnum,$msubthread,$mname,$memail,$mdate,$mreplies,$musername,$micon,$mstate) = split( /\|/, $yyThreadLine ); $noposting = $viewnum eq $mnum && $mstate == 1 ? 1 : 0; # Get the class of this thread, based on lock status and number of replies. $replybutton = qq~$img{'reply'}~; $threadclass = 'thread'; if( $mstate == 1 ) { $threadclass = 'locked'; $replybutton = ""; } elsif( $mreplies > 24 ) { $threadclass = 'veryhotthread'; } elsif( $mreplies > 14 ) { $threadclass = 'hotthread'; } elsif( $mstate == 0 ) { $threadclass = 'thread'; } fopen(FILE, "$boardsdir/sticky.stk") || &fatal_error("300 $txt{'106'}: $txt{'23'} sticky.stk"); @stickys = ; fclose(FILE); foreach $curnum (@stickys) { if ($mnum == $curnum) { if($threadclass eq 'locked') { $threadclass = 'stickylock'; } else { $threadclass = 'sticky'; } } } &LoadCensorList; # Load Censor List # Build a list of this board's moderators. if( scalar keys %moderators > 0 ) { if( scalar keys %moderators == 1 ) { $showmods = qq~($txt{'298'}: ~; } else { $showmods = qq~($txt{'299'}: ~; } while( $_ = each(%moderators) ) { &FormatUserName($_); $showmods .= qq~$moderators{$_}, ~; } $showmods =~ s/, \Z/)/; } if($enable_notification) { my $startnum = $start || '0'; $notify = qq~$menusep$img{'notify'}~; } &jumpto; # create the jumpto list # Build the page links list. $postdisplaynum = 3; # max number of pages to display $max = $mreplies + 1; $start = $INFO{'start'} || 0; $start = $start > $mreplies ? $mreplies : $start; $start = ( int( $start / $maxmessagedisplay ) ) * $maxmessagedisplay; $tmpa = 1; $tmpx = int( $max / $maxmessagedisplay ); if ($start >= (($postdisplaynum-1) * $maxmessagedisplay)) { $startpage = $start - (($postdisplaynum-1) * $maxmessagedisplay); $tmpa = int( $startpage / $maxmessagedisplay ) + 1; } if ($max >= $start + ($postdisplaynum * $maxmessagedisplay)) { $endpage = $start + ($postdisplaynum * $maxmessagedisplay); } else { $endpage = $max } if ($startpage > 0) { $pageindex = qq~1 ... ~; } if ($startpage == $maxmessagedisplay) { $pageindex = qq~1 ~;} for( $counter = $startpage; $counter < $endpage; $counter += $maxmessagedisplay ) { $pageindex .= $start == $counter ? qq~$tmpa ~ : qq~$tmpa ~; $tmpa++; } $tmpx = $max - $maxmessagedisplay; $outerpn = int($tmpx / $maxmessagedisplay) + 0; $lastpn = int($mreplies / $maxmessagedisplay) + 1; $lastptn = ($lastpn - 1) * $maxmessagedisplay; if ($endpage < $max - ($maxmessagedisplay) ) {$pageindexadd = qq~ ... ~;} if ($endpage != $max) {$pageindexadd .= qq~ $lastpn~;} $pageindex .= $pageindexadd; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $msubthread =~ s~\Q$tmpa\E~$tmpb~gi; } if ($boardlinks == 1) {$yymain .= "$blink";} $curthreadurl = $curposlinks ? qq~$msubthread~ : $msubthread; # Begin addon for boardlinksSP1 $blink = ''; $i=0; $ii=0; while($LinkBoard[$i]) { if ($LinkBoard[$i] eq $currentboard){ if ($ii == 0){ $blink .= qq~$LinkName[$i]~; $ii=1; } else { $blink .= qq~$blinkstxt{'13'}$LinkName[$i]~; } } $i++; } if ($blink ne ''){ $blink = qq~
$blinkstxt{'12'}$boardname
$blink


~; } if ($boardlinks != 1) {$yymain .= "$blink";} # End addon for boardlinksSP1 # Create next/prev links fopen(LISTS, "$boardsdir/$INFO{'board'}.txt"); @boardtopics = ; seek LISTS, 0, 0; my $found; my $name = $INFO{'num'}; my $bcount = 0; $CurrentPosition = -1; while($ThreadNum = ) { ++$CurrentPosition; $boardtopics[$bcount] = $ThreadNum; $bcount++; if ($ThreadNum =~ m/\A$name/o) { $found = 1; last; } } fclose(LISTS); $previous = $boardtopics[$CurrentPosition-1]; $next = $boardtopics[$CurrentPosition+1]; @prevthread = split(/\|/, $previous); $goprevious = $prevthread[0]; @nextthread = split(/\|/, $next); $gonext = $nextthread[0]; @getlastthread = @boardtopics; $lastthread = pop(@getlastthread); @lasttopic = split(/\|/, $lastthread); $endthread2 = $lasttopic[0]; if($found) { $prevtopic = "$cgi;action=display;num=$goprevious"; $nexttopic = "$cgi;action=display;num=$gonext"; $endthread = "$cgi;action=display;num=$endthread2"; } if( $endthread eq $prevtopic && $gonext eq "") { $nav = qq~« $txt{'766'} | $txt{'766'} »~; } if($endthread eq $prevtopic && $gonext ne "") { $nav = qq~« $txt{'766'} | $txt{'767'} »~; } if ( $endthread ne $prevtopic && $gonext eq "") { $nav = qq~« $txt{'768'} | $txt{'766'} »~; } if ($endthread ne $prevtopic && $gonext ne "") { $nav = qq~« $txt{'768'} | $txt{'767'} »~; } $yymain .= qq~
   $mbname
   $cat
   $boardname
$showmods
   $curthreadurl
$nav
~; if ($enable_topicrating == 1) { $yymain .= qq~ ~; } else { $yymain .= qq~~; } $yymain .= qq~
$txt{'139'}: $pageindex ~; if ($enable_topicrating == 1) { $yymain .= qq~
~; require "$sourcedir/Rate.pl"; &PrintStars; } $yymain .= qq~
$rate{'008'}
$replybutton$notify$menusep $img{'sendtopic'}$menusep $img{'print'}
~; # Look for a poll file for this thread. if (-e "$datadir/$viewnum.poll") { $pollthread = 1; } if ($pollthread) { fopen (FILE, "$datadir/$viewnum.poll"); @polldata = ; fclose (FILE); $pollquestion = $polldata[0]; $pollquestion =~ s~\n~~g; ($question, $lockstatus) = split(/\|/, $pollquestion); $num = 1; $line = 0; my @options; my @votes; foreach $pointer (@polldata) { ($vote, $option) = split(/\|/, $polldata[$num]); $options[$line] = $option; $votes[$line] = $vote; $line++; $num++; } $search = -1; my $found; $usersemail = $settings[2]; $userstatus = $settings[7]; $found = &CheckVoted($viewnum); if ($found) { $userhasvoted = 1; } $viewresults = $INFO{'viewresults'}; if ($lockstatus eq "Locked") { $pollislocked = 1; } ########showcase poll # Look for a showcase.poll file. my($scboard, $scviewnum, $comment, $boardpoll, $showcasepoll); if (-e "$datadir/showcase.poll") { fopen (FILE, "$datadir/showcase.poll"); @showdata = ; fclose (FILE); $showcasepoll = $showdata[0]; $showcasepoll =~ s~\n~~g; ($scboard, $scviewnum, $comment) = split(/\|/, $showcasepoll); } $boardpoll = ''; if ($scviewnum == $viewnum) { $boardpoll = qq~$scpolltxt{'3'} ~; } if ($userstatus eq "Administrator" && ($scviewnum != $viewnum)) { $boardpoll = qq~$scpolltxt{'4'} ~; } ########showcase poll if ($username ne "Guest" && ($username eq $susername) || ($userstatus eq "Administrator" or $userstatus eq "Global Moderator" or exists $moderators{$username})) { $modifypoll = qq~$polltxt{'39'} ~; } if (($userstatus eq "Administrator" || $userstatus eq "Global Moderator" || exists $moderators{$username}) && ($pollislocked ne 1)) { $lockpoll = qq~$img{'polliconclosed'} $polltxt{'20'} ~; } if (($userstatus eq "Administrator" || $userstatus eq "Global Moderator" || exists $moderators{$username}) && ($pollislocked eq 1)) { $lockpoll = qq~$img{'polliconclosed'} $polltxt{'21'} ~; } if ($userstatus eq "Administrator"){ $displayvoters = qq~ $polltxt{'33'}~;} $vresults = qq~$polltxt{'19'}~; if ($pollislocked eq 1) { $endedtext = $polltxt{'22'}; } $poll_icon = qq~$img{'pollicon'}~; if ($pollislocked == 1) { $poll_icon = qq~$img{'polliconclosed'}~; } $yymain.= qq~
 $poll_icon $polltxt{'15'} $endedtext $lockpoll   $displayvoters   $modifypoll
~; # Censor the question. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $question =~ s~\Q$tmpa\E~$tmpb~gi; } if (($userhasvoted) || $viewresults eq 'yes' || $pollislocked eq 1 ) { $yymain.= qq~
$polltxt{'16'}: $question

~; $nums = 0; my $Key; my $Total; $maxvote = 0; foreach $Key (@votes) { $Total += $Key; if ($Key >= $maxvote) { $maxvote = $Key;} } $totalvotes = $Total; pop (@options); foreach (@options) { # Censor the options. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $options[$nums] =~ s~\Q$tmpa\E~$tmpb~gi; } $message = $options[$nums]; # put the message back into the proper variable to do ubbc on it if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &MakeSmileys; $options[$nums] = $message; $options[$nums] =~ s~\n~~g; $options[$nums] =~ s~
~~g; $yymain .= qq~ ~; $nums++; } $yymain .= qq~
$options[$nums] ~; # Now lets calculate how many devisions by the total number of votes are needed to make the bar graphs stay nicely sized in the browser window: $pollpercent = 0; $pollbar = 0; if ($totalvotes ne 0 && $maxvote ne 0) { $pollpercent = int(1000 * $votes[$nums] / $totalvotes); $pollpercent = $pollpercent / 10; $pollbar = int( 150 * $votes[$nums] / $maxvote); } $yymain .= qq~   $votes[$nums] ($pollpercent%)

$polltxt{'17'}: $totalvotes
  $vthread $boardpoll
~; } else { $board = $INFO{'board'}; $yymain.= qq~
$polltxt{'16'}: $question
~; $nums = 0; pop (@options); foreach (@options) { # Censor the options. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $options[$nums] =~ s~\Q$tmpa\E~$tmpb~gi; } $options[$nums] =~ s~\n~~g; $options[$nums] =~ s~
~~g; $message = $options[$nums]; # put the message back into the proper variable to do ubbc on it if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &MakeSmileys; $options[$nums] = $message; $yymain .= qq~ ~; $nums++; } $yymain .= qq~
  $options[$nums]

$vresults
$boardpoll
~; } $yymain .= qq~
~; } $yymain .= qq~
   $txt{'29'}  $txt{'118'}: $msubthread  ($txt{'641'} $views $txt{'642'})
~; # Look for an auction file for this thread. if (-e "$datadir/$viewnum.auction") {$auctionthread = 1; } if ($auctionthread) { require "$vardir/auctionsettings.txt"; fopen (FILE, "$datadir/$viewnum.auction"); @auctiondata = ; fclose (FILE); $article = $auctiondata[0]; $askprice = sprintf("%.2f",$auctiondata[1]); $minprice = sprintf("%.2f",$auctiondata[2]); $bidincr = sprintf("%.2f",$auctiondata[3]); $aucttype = $auctiondata[4]; $bidduration = $auctiondata[5]; $bidphone = $auctiondata[6]; $bidcity = $auctiondata[7]; $bidpicture = $auctiondata[8]; $biduser = $auctiondata[9]; $bidusername = $auctiondata[10]; $bidmail = $auctiondata[11]; chomp $askprice; chomp $minprice; chomp $bidincr; $biduser =~ s/[\n\r]//g; $bidusername =~ s/[\n\r]//g; $bidcity =~ s/[\n\r]//g; $bidphone =~ s/[\n\r]//g; $exttext =""; ($bidpicurl,$picwidth) = split (/\|/,$bidpicture); if (-e "$datadir/$viewnum.auctx"){ fopen (FILE, "$datadir/$viewnum.auctx"); @extdata = ; fclose (FILE); $extnum = 0; $exttime = 0; foreach $extention(@extdata){ chomp $extention; $extnum++; $exttime = $exttime + $extention; } if ($extnum == 1){ $exttext = qq~$extnum $aucttxt{'49a'} $aucttxt{'49'}.~; } elsif ($extnum > 1){ $exttext = qq~$extnum $aucttxt{'49b'} $aucttxt{'49'}.~; } } my $day = 86400; $today = time; $dif = (($today - $viewnum) / $day) ; if(!$dif) { $dif = 0; } $bidtimeleft = sprintf("%.1f",$bidduration - $dif + $exttime); if($bidtimeleft <=1){ $duration = $aucttxt{'10c'}; } else { $duration = $aucttxt{'10a'}; } if(!$yyUDLoaded{$username}) { &LoadUser($username); } if ($bidphone eq ""){ $bidphone = qq~$aucttxt{'44'}~;} if ($bidcity eq ""){ $bidcity = qq~$aucttxt{'44'}~;} if (-e "$datadir/$viewnum.bids") {$auctionbid = 1; } else {$auctionbid = 0; } fopen (FILE, "$datadir/$viewnum.bids"); @auctionbids = ; fclose (FILE); @auctionbids = reverse @auctionbids; if ($settings[7] eq "Administrator" || $settings[7] eq "Global Moderator" || $biduser eq $username || exists $moderators{$username} ){$bidcontrol =1; } else {$bidcontrol =0;} if ($settings[7] eq "Administrator" || $settings[7] eq "Global Moderator" || exists $moderators{$username} ){$admcontrol =1; } else {$admcontrol =0;} if ($aucttype == 1 ){ $showtype = $aucttxt{'26'};} else { $showtype = $aucttxt{'27'};} if ($bidtimeleft <=0){$auctislocked = 2; $exttext="";} if (-e "$datadir/$viewnum.auctl") { $auctislocked = 1; $exttext="";} if ($bidcontrol==1 && $auctislocked ne 1) { $lockauct = qq~$aucttxt{'30'}~; } if ($bidcontrol==1 && $auctislocked eq 1) { $lockauct = qq~$aucttxt{'31'}~; } if ($bidcontrol==1 && $auctislocked eq 2 && -($bidtimeleft) < $maxextendtime) { $extendauct = qq~$aucttxt{'32'}~; } else {$extendauct="";} if ($bidcontrol==1 ) { $editauct = qq~$aucttxt{'33'}~; } else {$extendauct="";} if ($auctionbid ){ $bidders = qq~ $aucttxt{'16'} $aucttxt{'17'} $aucttxt{'18'} ~; $highestbid =0; foreach $bidline (@auctionbids){ chomp $bidline; @biditem = split(/\|/,$bidline); if($biditem[2] >= $highestbid){ $highestbid = $biditem[2]; $hbuser = $biditem[0]; $hbusername = $biditem[1]; if ($hbuser eq $username) {$viewbid =1;} } if($highestbid < $minprice){ $minbidreached = $aucttxt{'21'}; } else { $minbidreached = ""; } $biddingtime = &timeformat($biditem[3], 1); if ($showsecondcur) { $secbidval = sprintf("%.2f",$biditem[2]*$curfactor); $secondbidval = qq~($secbidval $secondcur)~; } else {$secondbidval = ""; } $bidders .=qq~ $biditem[1] $biditem[2] $aucttxt{'11'} $secondbidval $biddingtime ~; } } if ($auctislocked eq 1) { $bidtimeleft = $aucttxt{'34a'}; $duration =""; } if ($auctislocked eq 2) { $bidtimeleft = $aucttxt{'34'}; $duration =""; } if ($aucttype == 1 && $bidcontrol == 0 && $viewbid == 0 && $auctislocked == 0){ $showbidder = qq~$aucttxt{'27a'}~;} else { $showbidder = qq~$hbusername~; } if (!$auctionbid ){$showbidder = $aucttxt{'45'};} if ($showsecondcur) { $seccurval = sprintf("%.2f",$highestbid*$curfactor); $secondval = qq~($seccurval $secondcur)~; } else {$secondval = ""; } my $autobid = sprintf("%.2f",$highestbid+$bidincr); $yymain .= qq~
~; if($username eq "Guest"){ $yymain .= qq~ ~; } elsif($auctislocked > 0){ $yymain .= qq~ ~; } elsif($bidcontrol == 1 && $allowownbids == 0 && $admcontrol == 0){ $yymain .= qq~ ~; } elsif($viewbid == 1 && $allowoverbid == 0 && $admcontrol == 0){ $yymain .= qq~ ~; } else { $yymain .= qq~ ~; } $yymain .= qq~ ~; if ($bidcontrol ==1){ $yymain .= qq~ ~; } if ($aucttype == 0 || $bidcontrol == 1 || $viewbid == 1){ $yymain .= qq~ $bidders~; } $yymain .= qq~
 $img{'auctionicon'} $aucttxt{'15'}
$aucttxt{'6'}: $article $aucttxt{'14'}
$aucttxt{'25'}: $showtype $aucttxt{'14c'}
$aucttxt{'19'}: $bidusername
$aucttxt{'20'}: $highestbid $aucttxt{'11'} $secondval $minbidreached
$aucttxt{'29'}: $showbidder
$aucttxt{'10b'}: $bidtimeleft $duration $exttext
$aucttxt{'12'}: $bidphone
$aucttxt{'13'}: $bidcity
$aucttxt{'28'}$aucttxt{'43a'}$aucttxt{'43'}
$aucttxt{'11'}
$lockauct
$extendauct
$editauct
~; } # Load background color list. @bgcolors = ( $color{windowbg}, $color{windowbg2} ); $bgcolornum = scalar @bgcolors; @cssvalues = ( "windowbg","windowbg2" ); $cssnum = scalar @bgcolors; if(!$MenuType) { $sm = 1; } $counter = 0; fopen(FILE,"$datadir/$viewnum.txt") || &fatal_error("104 $txt{'106'}: $txt{'23'} $viewnum.txt"); # Skip past the posts in this thread until we reach $start. while($counter < $start && ($buffer = )) { $counter++; } $#messages = $maxmessagedisplay - 1; for($counter = 0; $counter < $maxmessagedisplay && ($buffer = ); $counter++) { $messages[$counter] = $buffer; } fclose(FILE); $#messages = $counter - 1; $counter = $start; # For each post in this thread: foreach (@messages) { $windowbg = $bgcolors[($counter % $bgcolornum)]; $css = $cssvalues[($counter % $cssnum)]; chomp; ($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $postmessage, $ns, $mlm, $mlmb, $msf, $mfn) = split(/[\|]/, $_); # Should we show an attachment file? if( $msf && $mfn && $msf ne "" && $mfn ne "") { if (-e ("$upload_dir/$mfn")) { $attachment = qq~ $mfn~; if(($mfn =~ /(jpg|gif|bmp|png|jpeg)$/i) && ($amdisplaypics == 1)) { $showattach = qq~
~; } else { $showattach = ''; } } elsif (-e ("$upload_temp/$mfn")) { fopen (FILE, "$memberdir/$username.dat"); @usersdata = ; fclose (FILE); chop $usersdata[7]; $userstatus = $usersdata[7]; if ( ($userstatus eq "Administrator") || ($userstatus eq "Global Moderator") || (exists $moderators{$username}) ) { $tmpb2=$INFO{'tmpb'}; $attachment = qq~ $mfn $factxt{'2'}~; $showattach = ''; } else { $attachment = qq~ $mfn    $factxt{'1'}~; $showattach = ''; } } else { $attachment = qq~ $mfn $fatxt{'1'}~; $showattach = ''; } } else { $attachment = ''; $showattach = ''; } $lastmoduser = $mlmb; # Should we show "last modified by?" # Begin Time Lock mod if( $mlm && $showmodify && $mlm ne "" && $mlmb ne "") { if( $tllastmodflag == 1) { $tllastmodtimesecs = $tllastmodtime*60; $tlmesstime = stringtotime($mdate) + $tllastmodtimesecs; $tllasttime = stringtotime($mlm); if ( $tlmesstime > $tllasttime ) { $mlm = '-'; $lastmodified = ''; } else { $mlm = &timeformat($mlm); &LoadUser($mlmb); $mlmb = $userprofile{$mlmb}->[1] || $mlmb || $txt{'470'}; $lastmodified = qq~« $txt{'211'}: $mlm $txt{'525'} $mlmb »~; } } else { $mlm = &timeformat($mlm); &LoadUser($mlmb); $mlmb = $userprofile{$mlmb}->[1] || $mlmb || $txt{'470'}; $lastmodified = qq~« $txt{'211'}: $mlm $txt{'525'} $mlmb »~; } } # End Time Lock mod else { $mlm = '-'; $lastmodified = ''; } $msub ||= $txt{'24'}; $messdate = &timeformat($mdate); $mip = $settings[7] eq 'Administrator' ? $mip : "$txt{'511'}"; $sendm = ''; # If the user isn't a guest, load his/her info. $online = ""; if($musername ne 'Guest' && ! $yyUDLoaded{$musername} && -e("$memberdir/$musername.dat") ) { &LoadUserDisplay($musername); # If user is not in memory, s/he must be loaded. } my($loccode, $displocal, $dispcountry, $dispcontin, $dispx, $dispy, $dispstate, $dispflag, $disptext); if($yyUDLoaded{$musername}) { @userprofile = @{$userprofile{$musername}}; ($loccode, $displocal, $dispcountry, $dispcontin, $dispx, $dispy, $dispstate) = split(/\|/, $userprofile[15]); if($dispcountry ne "") { if($view_flag) { if($loccode eq "x1") { $dispflag = qq~$dispcountry ~; } elsif($loccode eq "x0") { $dispflag = qq~$dispcountry ~; } else { $dispflag = ""; } } if($view_text) { my($initstat, $namestat, $disploc); if($dispstate ne "") { ($initstat, $namestat) = split(/\,/, $dispstate); } if($displocal ne "") { $disploc = qq~$displocal $initstat~; } if($loccode eq "x1") { $disptext = qq~$disploc~; } elsif($loccode eq "x0") { $disptext = qq~$disploc~; } else { $disptext = ""; } } } $displayname = $userprofile[1]; fopen(NUMBERFILEREAD,"$memberdir/$musername.yam"); @number = ; fclose(NUMBERFILEREAD); chomp @number; if ($musername eq "admin") { $displaynumb = ''; } else { $displaynumb = qq~$membtxt{'23'} $number[0]~; } $star = $memberstar{$musername}; $memberinfo = $memberinfo{$musername}; $memberinfo =~ s~\n~~g; $icqad = $icqad{$musername}; $yimon = $yimon{$musername}; if($username ne 'Guest') { # Allow instant message sending if current user is a member. $sendm = qq~$menusep$img{'message_sm'}~; } if((exists $moderators{$useraccount{$musername}})){ $usernamelink = qq~$userprofile[1]~; } else{ $usernamelink = qq~$userprofile[1]~; } $postinfo = qq~$txt{'26'}: $userprofile[6]
~; $memail = $userprofile[2]; ### Begin HTML MOD if ($postmessage =~ /\#enable_html/isg) { $html_username = $musername; if ($lastmoduser ne $html_username && $lastmoduser ne '') { $html_username = $lastmoduser; } $message_backup = $postmessage; # since $message is no local variable, it often gets overwritten accidently somehwere (couldn't find out where) $enable_html = HTML_allow($html_username); $postmessage = $message_backup; if ($enable_html == 1) { $postmessage =~ s/\#enable_html//isg; } } else { $enable_html = 0; } ### End HTML MOD $karmainfo = "
$karmaLabel " . &getKarma($musername); my($inMemberGroup) = &isInMemberGroup; if (($username ne "Guest") && ($inMemberGroup == 1)){ $karmainfo .= "
$karmaSmiteLabel $karmaApplaudLabel"; } $online = ""; fopen(FILE, "$vardir/log.txt"); @entries = ; fclose(FILE); $online = qq~
$img{'offline1'} Offline
~; foreach $curentry (@entries) { chomp $curentry; ($name, $value) = split(/\|/, $curentry); if( $name eq $musername) { $online = qq~
$img{'online1'} Online
~; } } } else { $musername = "Guest"; $displaynumb = ''; $star = ''; $memberinfo = "$txt{'28'}"; $icqad = ''; $yimon = ''; $usernamelink = qq~$mname~; $postinfo = ''; @userprofile = (); $displayname = $mname; } # Censor the subject and message. foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $postmessage =~ s~\Q$tmpa\E~$tmpb~gi; $msub =~ s~\Q$tmpa\E~$tmpb~gi; } # Run UBBC interpreter on the message. $message = $postmessage; # put the message back into the proper variable to do ubbc on it &wrap; if($enable_ubbc && $enable_html != 1) { if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; $profbutton = $profilebutton && $musername ne 'Guest' ? qq~$img{'viewprofile_sm'}$menusep~ : ''; if($counter != 0) { $counterwords = "$txt{'146'} #$counter"; } else { $counterwords = ""; } if($enable_html == 1) { &FromHTML($message); } # Print the post and user info for the poster. $yymain .= qq~
$usernamelink $online
$memberinfo
~; if($musername ne "Guest") { fopen(FILE, "$memberdir/$useraccount{$musername}.flg"); @flag = ; fclose(FILE); chomp @flag; $test = $flag[0]; if($test eq '') { $test = "blank"; } $yymain .= qq~ $star
$displaynumb


$karmainfo $pop{$musername}
$userprofile[13]$userprofile[12]

~; } $yymain .= qq~ $userprofile[11] ~; require "$sourcedir/ExtendedProfiles.pl"; $yymain .= ext_viewinposts($musername) . qq~ $postinfo
~; if(!$rpgdisabled) { if($money) { $yymain .= qq~$rpgtxt{'4'}: $userprofile[34]->[0]
~; } ### SHOW RPG INFO ### } $yymain .= qq~
$avgpost{$musername}
$exp{$musername}
$msub  $attachment
« $counterwords $txt{'30'}: $messdate »
~; ############################ ## My Status Mod by Sonic ## ############################ if ($showstatus) { fopen(FILE, "$memberdir/$musername.status"); @statussettings=; fclose(FILE); $mystatus=@statussettings[0]; if ($mystatus eq '0') { $memstatus =$status{'4'} ; } elsif ($mystatus eq '1') { $memstatus =$status{'5'} ; } elsif ($mystatus eq '2') { $memstatus =$status{'6'} ; } else { $memstatus =$status{'7'} ; } if ($memstatus ne $status{'7'}) { $userprofile[5]=qq~
$status{'3'} $memstatus$userprofile[5]~; } else { $userprofile[5]=qq~$userprofile[5]~; } } ################################ ## / My Status Mod by Sonic / ## ################################ if ($mstate != 1) { $yymain .= qq~ $rtm{'22'} $rtm{'22'} $menusep $replybutton $linktohelp
$img{'replyquote'}$menusep$img{'modify'} ~; if(exists $moderators{$username} || $settings[7] eq 'Administrator' || $username eq $musername && $userpostdel != 1) { $yymain .= qq~ $menusep$img{'delete'}~; } } $yymain .= qq~

$message
$lastmodified $mip
$showattach $userprofile[5]
~; $counter++; } $yymain .= qq~
~; if ($enable_topicrating == 1) { $yymain .= qq~ ~; } else { $yymain .= qq~~; } $yymain .= qq~
$txt{'139'}: $pageindex ~; if ($enable_topicrating == 1) { $yymain .= qq~
~; require "$sourcedir/Rate.pl"; &PrintStars; } $yymain .= qq~
$rate{'008'}
$replybutton$notify$menusep $img{'sendtopic'}$menusep $img{'print'}

~; $yymain .= qq~
~; if(exists $moderators{$username} || $settings[7] eq 'Administrator') { $yymain .= qq~$img{'admin_func'}  $img{'admin_move'}$menusep $img{'admin_split'}$menusep $img{'admin_splice'}$menusep $img{'admin_rem'}$menusep $img{'admin_lock'}$menusep $img{'admin_sticky'} ~; } $yymain .= qq~ $selecthtml
$nav
~; if ($username ne "Guest" && $mstate != 1 && $enable_quickreply == 1) { $yymain .= qq~
$txt{'172a'}
~; if ($enable_quicksmilies == 1) { $yymain .= qq~ ~; } $yymain .= qq~
$txt{'70'}:
$txt{'297'}:
$txt{'72'}:
 
~; } $yytitle = $msubthread; &template; exit; } sub ReadAnnouncements { if( $currentboard eq '' ) { &fatal_error($txt{'1'}); } my($buffer,$views,$lastposter,$moderators,$counter,$counterwords,$pageindex,$msubthread,$mnum,$mstate,$mdate,$msub,$mname,$memail,$mreplies,$musername,$micon,$noposting,$threadclass,$notify,$max,$start,$bgcolornum,$windowbg,$mattach,$mip,$mlm,$mlmb,$lastmodified,$postinfo,$star,$sendm,$topicdate); my(@userprofile,@messages,@bgcolors); #Load announcement fopen(ANNOUNCEMENT, "$vardir/announcements.txt"); @announcement = ; fclose(ANNOUNCEMENT); #Load announcement data fopen(ANNDATA, "$vardir/announcements.dat"); $title = ; fclose(ANNDATA); #($announcedby, $title) = split(/\,/, @anndata); # Determine what category we are in. fopen(FILE, "$boardsdir/$currentboard.ctb") || &fatal_error("300 $txt{'106'}: $txt{'23'} $currentboard.ctb"); $curcat = ; fclose(FILE); #$curcat = $cat; fopen(FILE, "$boardsdir/$curcat.cat") || &fatal_error("300 $txt{'106'}: $txt{'23'} $cat.cat"); $cat = ; fclose(FILE); # Load the membergroups list. fopen(FILE, "$vardir/membergroups.txt") || &fatal_error("100 $txt{'106'}: $txt{'23'} membergroups.txt"); @membergroups = ; fclose(FILE); # Set thread class as announcement, and therefore prevent replying $threadclass = 'announce'; $replybutton = ""; &LoadCensorList; # Load Censor List # Build a list of this board's moderators. if( scalar keys %moderators > 0 ) { if( scalar keys %moderators == 1 ) { $showmods = qq~($txt{'298'}: ~; } else { $showmods = qq~($txt{'299'}: ~; } while( $_ = each(%moderators) ) { &FormatUserName($_); $showmods .= qq~$moderators{$_}, ~; } $showmods =~ s/, \Z/)/; } # Build the page links list. $postdisplaynum = 3; # max number of pages to display $max = $mreplies + 1; $start = $INFO{'start'} || 0; $start = $start > $mreplies ? $mreplies : $start; $start = ( int( $start / $maxmessagedisplay ) ) * $maxmessagedisplay; $tmpa = 1; $tmpx = int( $max / $maxmessagedisplay ); if ($start >= (($postdisplaynum-1) * $maxmessagedisplay)) { $startpage = $start - (($postdisplaynum-1) * $maxmessagedisplay); $tmpa = int( $startpage / $maxmessagedisplay ) + 1; } if ($max >= $start + ($postdisplaynum * $maxmessagedisplay)) { $endpage = $start + ($postdisplaynum * $maxmessagedisplay); } else { $endpage = $max } if ($startpage > 0) { $pageindex = qq~1 ... ~; } if ($startpage == $maxmessagedisplay) { $pageindex = qq~1 ~;} for( $counter = $startpage; $counter < $endpage; $counter += $maxmessagedisplay ) { $pageindex .= $start == $counter ? qq~$tmpa ~ : qq~$tmpa ~; $tmpa++; } $tmpx = $max - $maxmessagedisplay; $outerpn = int($tmpx / $maxmessagedisplay) + 0; $lastpn = int($mreplies / $maxmessagedisplay) + 1; $lastptn = ($lastpn - 1) * $maxmessagedisplay; if ($endpage < $max - ($maxmessagedisplay) ) {$pageindexadd = qq~ ... ~;} if ($endpage != $max) {$pageindexadd .= qq~ $lastpn~;} $pageindex .= $pageindexadd; foreach (@censored) { ($tmpa,$tmpb) = @{$_}; $msubthread =~ s~\Q$tmpa\E~$tmpb~gi; } if ($boardlinks == 1) {$yymain .= "$blink";} $curthreadurl = $curposlinks ? qq~$txt{'ann'} $title~ : $title; # Create next/prev links fopen(LISTS, "$boardsdir/$INFO{'board'}.txt"); @boardtopics = ; seek LISTS, 0, 0; my $found; my $name = $INFO{'num'}; my $bcount = 0; $CurrentPosition = -1; while($ThreadNum = ) { ++$CurrentPosition; $boardtopics[$bcount] = $ThreadNum; $bcount++; if ($ThreadNum =~ m/\A$name/o) { $found = 1; last; } } fclose(LISTS); $previous = $boardtopics[$CurrentPosition-1]; $next = $boardtopics[$CurrentPosition+1]; @prevthread = split(/\|/, $previous); $goprevious = $prevthread[0]; @nextthread = split(/\|/, $next); $gonext = $nextthread[0]; @getlastthread = @boardtopics; $lastthread = pop(@getlastthread); @lasttopic = split(/\|/, $lastthread); $endthread2 = $lasttopic[0]; if($found) { $prevtopic = "$cgi;action=display;num=$goprevious"; $nexttopic = "$cgi;action=display;num=$gonext"; $endthread = "$cgi;action=display;num=$endthread2"; } if( $endthread eq $prevtopic && $gonext eq "") { $nav = qq~« $txt{'766'} | $txt{'766'} »~; } if($endthread eq $prevtopic && $gonext ne "") { $nav = qq~« $txt{'766'} | $txt{'767'} »~; } if ( $endthread ne $prevtopic && $gonext eq "") { $nav = qq~« $txt{'768'} | $txt{'766'} »~; } if ($endthread ne $prevtopic && $gonext ne "") { $nav = qq~« $txt{'768'} | $txt{'767'} »~; } $yymain .= qq~
   $mbname
   $cat
   $boardname
$showmods
   $curthreadurl
$nav
$txt{'139'}: $pageindex $replybutton$notify$menusep $img{'sendtopic'}$menusep $img{'print'}
   $txt{'29'}  $txt{'ann'} $title  
~; # Load background color list. @bgcolors = ( $color{windowbg}, $color{windowbg2} ); $bgcolornum = scalar @bgcolors; @cssvalues = ( "windowbg","windowbg2" ); $cssnum = scalar @bgcolors; if(!$MenuType) { $sm = 1; } $counter = 0; $#messages = $counter - 1; $counter = $start; # Start writing out the announcement: $windowbg = $bgcolors[($counter % $bgcolornum)]; $css = $cssvalues[($counter % $cssnum)]; chomp; $msub ||= $txt{'24'}; $messdate = &timeformat($mdate); $mip = $settings[7] eq 'Administrator' || $settings[7] eq 'Global Moderator' ? $mip : "$txt{'511'}"; $sendm = ''; # If the user isn't a guest, load his/her info. if(! $yyUDLoaded{$announce_acc} && -e("$memberdir/$announce_acc.dat") ) { &LoadUserDisplay($announce_acc); # If user is not in memory, s/he must be loaded. } if($yyUDLoaded{$announce_acc}) { @userprofile = @{$userprofile{$announce_acc}}; $displayname = $userprofile[1]; $star = $memberstar{'krikkert'}; $memberinfo = $memberinfo{$announce_acc}; $memberinfo =~ s~\n~~g; $icqad = $icqad{$musername}; $yimon = $yimon{$musername}; if($username ne 'Guest') { # Allow instant message sending if current user is a member. $sendm = qq~$menusep$img{'message_sm'}~; } $usernamelink = qq~$userprofile[1]~; $postinfo = qq~$txt{'26'}: $userprofile[6]
~; $memail = $userprofile[2]; } # Censor the subject and message. foreach (@censored) { foreach $postmessage (@announcement) { ($tmpa,$tmpb) = @{$_}; $postmessage =~ s~\Q$tmpa\E~$tmpb~gi; $title =~ s~\Q$tmpa\E~$tmpb~gi; } } # Run UBBC interpreter on the message. #$message = $postmessage; # put the message back into the proper variable to do ubbc on it #&wrap; #if($enable_ubbc) { if(!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } #&wrap2; #$profbutton = $profilebutton && $musername ne 'Guest' ? qq~$img{'viewprofile_sm'}$menusep~ : ''; if($counter != 0) { $counterwords = "$txt{'146'} #$counter"; } else { $counterwords = ""; } # Print the post and user info for the poster. $yymain .= qq~
$usernamelink
~; if($musername ne "Guest") { $yymain .= qq~ ~; if($view_flag) { $yymain .= qq~ $dispflag ~; if(!$view_text) { $yymain .= qq~
~; } } if($view_text) { $yymain .= qq~ $disptext
~; } $yymain .= qq~ $star

$karmainfo #changes made here $grouppic$userprofile[13]$userprofile[12] ~; } $yymain .= qq~ $userprofile[11] $postinfo ~; require "$sourcedir/ExtendedProfiles.pl"; $yymain .= ext_viewinposts($musername) . qq~
$title
« $counterwords $txt{'30'}: $messdate »
~; $yymain .= qq~

~; foreach $line (@announcement) { $yymain .= qq~$line~; } $yymain .= qq~
$lastmodified $mip
$userprofile[5]
~; $counter++; $yymain .= qq~
$txt{'139'}: $pageindex $replybutton$notify$menusep $img{'sendtopic'}$menusep $img{'print'}

~; $yymain .= qq~
~; $yymain .= qq~ $selecthtml
$nav
~; $yytitle = $txt{'ann'}; &template; exit; } 1;