############################################################################### # Display.pl # ############################################################################### # YaBB: Yet another Bulletin Board # # Open-Source Community Software for Webmasters # # Version: YaBB 2.4 # # Packaged: April 12, 2009 # # Distributed by: http://www.yabbforum.com # # =========================================================================== # # Copyright (c) 2000-2009 YaBB (www.yabbforum.com) - All Rights Reserved. # # Software by: The YaBB Development Team # # with assistance from the YaBB community. # # Sponsored by: Xnull Internet Media, Inc. - http://www.ximinc.com # # Your source for web hosting, web design, and domains. # ############################################################################### $displayplver = 'YaBB 2.4 $Revision: 1.61 $'; if ($action eq 'detailedversion') { return 1; } &LoadLanguage('Display'); &LoadLanguage('FA'); require "$templatesdir/$usedisplay/Display.template"; if ($iamgmod) { require "$vardir/gmodsettings.txt"; } sub Display { # Check if board was 'shown to all' - and whether they can view the topic if (&AccessCheck($currentboard, '', $boardperms) ne "granted") { &fatal_error("no_access"); } # Get the "NEW"est Post for this user. my $newestpost; if (!$iamguest && $max_log_days_old && $INFO{'start'} eq "new") { # This decides which messages were already read in the thread to # determing where the redirect should go. It is done by # comparing times in the username.log and the boardnumber.txt files. &getlog; my $mnum = $INFO{'num'}; my $dlp = int($yyuserlog{$mnum}) > int($yyuserlog{"$currentboard--mark"}) ? int($yyuserlog{$mnum}) : int($yyuserlog{"$currentboard--mark"}); $dlp = $dlp > $date - ($max_log_days_old * 86400) ? $dlp : $date - ($max_log_days_old * 86400); unless (ref($thread_arrayref{$mnum})) { fopen(MNUM, "$datadir/$mnum.txt"); @{$thread_arrayref{$mnum}} = ; fclose(MNUM); } my $i = -1; foreach (@{$thread_arrayref{$mnum}}) { $i++; last if (split(/\|/, $_))[3] > $dlp; } $newestpost = $INFO{'start'} = $i; } if ($buddyListEnabled) { &loadMyBuddy; } my $viewnum = $INFO{'num'}; # strip off any non numeric values to avoid exploitation $maxmessagedisplay ||= 10; my ($msubthread, $mnum, $mstate, $mdate, $msub, $mname, $memail, $mreplies, $musername, $micon, $mip, $mlm, $mlmb); my ($counter, $counterwords, $threadclass, $notify, $max, $start, $windowbg, $mattach, $pagedropindex, $template_viewers, $template_favorite, $template_pollmain, $navback, $mark_unread, $pollbutton, $icanbypass, $replybutton, $bypassReplyButton); &LoadCensorList; # Determine category $curcat = ${$uid.$currentboard}{'cat'}; # Figure out the name of the category unless ($mloaded == 1) { require "$boardsdir/forum.master"; } if ($currentboard eq $annboard) { $vircurrentboard = $INFO{'virboard'}; $vircurcat = ${$uid.$vircurrentboard}{'cat'}; ($vircat, undef) = split(/\|/, $catinfo{$vircurcat}); ($virboardname, undef) = split(/\|/, $board{$vircurrentboard},2); &ToChars($virboardname); } ($cat, $catperms) = split(/\|/, $catinfo{"$curcat"}); &ToChars($cat); ($boardname, $boardperms, $boardview) = split(/\|/, $board{$currentboard}); &ToChars($boardname); # Check to make sure this thread isn't locked. ($mnum, $msubthread, $mname, $memail, $mdate, $mreplies, $musername, $micon, $mstate) = split(/\|/, $yyThreadLine); ($msubthread, undef) = &Split_Splice_Move($msubthread,0); &ToChars($msubthread); $msubthread = &Censor($msubthread); # Build a list of this board's moderators. if (keys %moderators > 0) { if (keys %moderators == 1) { $showmods = qq~($display_txt{'298'}: ~; } else { $showmods = qq~($display_txt{'63'}: ~; } while ($_ = each(%moderators)) { &FormatUserName($_); $showmods .= &QuickLinks($_,1) . ", "; } $showmods =~ s/, \Z/)/; } if (keys %moderatorgroups > 0) { if (keys %moderatorgroups == 1) { $showmodgroups = qq~($display_txt{'298a'}: ~; } else { $showmodgroups = qq~($display_txt{'63a'}: ~; } my ($tmpmodgrp,$thismodgrp); while ($_ = each(%moderatorgroups)) { $tmpmodgrp = $moderatorgroups{$_}; ($thismodgrp, undef) = split(/\|/, $NoPost{$tmpmodgrp}, 2); $showmodgroups .= qq~$thismodgrp, ~; } $showmodgroups =~ s/, \Z/)/; } ## now we've established credentials, ## can this user bypass locks? ## work out who can bypass locked thread post only if bypass switched on if ($mstate =~ /l/i) { if ($bypass_lock_perm) { $icanbypass = &checkUserLockBypass; } $enable_quickreply = 0; } my $permdate = &permtimer($mnum); my $display_permalink = qq~$display_txt{'10'}~; # Look for a poll file for this thread. if (&AccessCheck($currentboard, 3) eq 'granted') { $pollbutton = qq~$menusep$img{'addpoll'}~; } if (-e "$datadir/$viewnum.poll") { $has_poll = 1; $pollbutton = ''; } else { $has_poll = 0; if ($useraddpoll == 0) { $pollbutton = ''; } } # Get the class of this thread, based on lock status and number of replies. if ((!$iamguest || $enable_guestposting) && &AccessCheck($currentboard, 2) eq 'granted') { $replybutton = qq~$menusep$img{'reply'} ~; $replybutton .= qq~">$img{'reply'} ~; } $threadclass = 'thread'; ## hidden threads if ($mstate =~ /h/i) { $threadclass = 'hide'; if (!$iamadmin && !$iamgmod && !$iammod) { &fatal_error('no_access'); } } ## locked thread elsif ($mstate =~ /l/i) { $threadclass = 'locked'; ## same icon regardless $pollbutton = ''; if ($icanbypass) { $replybutton = $bypassReplyButton; } else { $replybutton = ''; } # squish } elsif ($mreplies >= $VeryHotTopic) { $threadclass = 'veryhotthread'; } elsif ($mreplies >= $HotTopic) { $threadclass = 'hotthread'; } elsif ($mstate eq '') { $threadclass = 'thread'; } if ($threadclass eq 'hide') { ## hidden if ($mstate =~ /s/i && $mstate !~ /l/i) { $threadclass = 'hidesticky'; } elsif ($mstate =~ /l/i && $mstate !~ /s/i) { $threadclass = 'hidelock'; $pollbutton = ''; if ($icanbypass) { $replybutton = $bypassReplyButton; } else { $replybutton = ''; } # squish } elsif ($mstate =~ /s/i && $mstate =~ /l/i) { $threadclass = 'hidestickylock'; $pollbutton = ''; if ($icanbypass) { $replybutton = $bypassReplyButton; } else { $replybutton = ''; } # squish } } elsif ($threadclass eq 'locked' && $mstate =~ /s/i) { $threadclass = 'stickylock'; if ($icanbypass) { $replybutton = $bypassReplyButton; } else { $replybutton = ''; } # squish } elsif ($mstate =~ /s/i) { $threadclass = 'sticky'; } elsif (${$mnum}{'board'} eq $annboard) { $threadclass = $threadclass eq 'locked' ? 'announcementlock' : 'announcement'; } if (-e "$datadir/$mnum.mail" && !$iamguest) { require "$sourcedir/Notify.pl"; &ManageThreadNotify("update", $mnum, $username, '', '', '1'); } if ($showmodgroups ne "" && $showmods ne "") { $showmods .= qq~ - ~; } # Build the page links list. if (!$iamguest) { (undef, $userthreadpage, undef,undef) = split(/\|/, ${$uid.$username}{'pageindex'}); } my ($pagetxtindex, $pagetextindex, $pagedropindex1, $pagedropindex2, $all, $allselected); $postdisplaynum = 3; # max number of pages to display $dropdisplaynum = 10; $startpage = 0; $max = $mreplies + 1; if (substr($INFO{'start'}, 0, 3) eq 'all' && $showpageall != 0) { $maxmessagedisplay = $max; $all = 1; $allselected = qq~ selected="selected"~; $start = !$ttsreverse ? 0 : $mreplies; } else { $start = $INFO{'start'} !~ /\d/ ? (!$ttsreverse ? 0 : $mreplies) : $INFO{'start'}; } $start = $start > $mreplies ? $mreplies : $start; $start = !$ttsreverse ? (int($start / $maxmessagedisplay) * $maxmessagedisplay) : (int(($mreplies - $start) / $maxmessagedisplay) * $maxmessagedisplay); $tmpa = 1; $pagenumb = int(($max - 1) / $maxmessagedisplay) + 1; 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; } $lastpn = int($mreplies / $maxmessagedisplay) + 1; $lastptn = ($lastpn - 1) * $maxmessagedisplay; $pageindex1 = qq~$display_txt{'19'} $display_txt{'139'}: $pagenumb~; $pageindex2 = $pageindex1; if ($pagenumb > 1 || $all) { if ($userthreadpage == 1 || $iamguest) { $pagetxtindexst = qq~~; if (!$iamguest) { $pagetxtindexst .= qq~$display_txt{'19'} $display_txt{'139'}: ~; } else { $pagetxtindexst .= qq~ $display_txt{'139'}: ~; } if ($startpage > 0) { $pagetxtindex = qq~1 ... ~; } if ($startpage == $maxmessagedisplay) { $pagetxtindex = qq~1 ~; } for ($counter = $startpage; $counter < $endpage; $counter += $maxmessagedisplay) { $pagetxtindex .= $start == $counter ? qq~$tmpa ~ : qq~$tmpa ~; $tmpa++; } if ($endpage < $max - ($maxmessagedisplay)) { $pageindexadd = qq~... ~; } if ($endpage != $max) { $pageindexadd .= qq~$lastpn~; } $pagetxtindex .= qq~$pageindexadd~; $pageindex1 = qq~$pagetxtindexst$pagetxtindex~; $pageindex2 = $pageindex1; } else { $pagedropindex1 = qq~~; $pagedropindex1 .= qq~$display_txt{'19'}~; $pagedropindex2 = $pagedropindex1; $tstart = $start; #if (substr($INFO{'start'}, 0, 3) eq "all") { ($tstart, $start) = split(/\-/, $INFO{'start'}); } $d_indexpages = $pagenumb / $dropdisplaynum; $i_indexpages = int($pagenumb / $dropdisplaynum); if ($d_indexpages > $i_indexpages) { $indexpages = int($pagenumb / $dropdisplaynum) + 1; } else { $indexpages = int($pagenumb / $dropdisplaynum) } $selectedindex = int(($start / $maxmessagedisplay) / $dropdisplaynum); if ($pagenumb > $dropdisplaynum) { $pagedropindex1 .= qq~\n~; } for ($i = 0; $i < $indexpages; $i++) { $indexpage = !$ttsreverse ? ($i * $dropdisplaynum * $maxmessagedisplay) : ($mreplies - ($i * $dropdisplaynum * $maxmessagedisplay)); $indexstart = ($i * $dropdisplaynum) + 1; $indexend = $indexstart + ($dropdisplaynum - 1); if ($indexend > $pagenumb) { $indexend = $pagenumb; } if ($indexstart == $indexend) { $indxoption = qq~$indexstart~; } else { $indxoption = qq~$indexstart-$indexend~; } $selected = ""; if ($i == $selectedindex) { $selected = qq~ selected="selected"~; $pagejsindex = qq~$indexstart|$indexend|$maxmessagedisplay|$indexpage~; } if ($pagenumb > $dropdisplaynum) { $pagedropindex1 .= qq~\n~; $pagedropindex2 .= qq~\n~; } } if ($pagenumb > $dropdisplaynum) { $pagedropindex1 .= qq~\n~; $pagedropindex2 .= qq~\n~; } $pagedropindex1 .= qq~~; $pagedropindex2 .= qq~~; $tmpmaxmessagedisplay = $maxmessagedisplay; $prevpage = !$ttsreverse ? $start - $tmpmaxmessagedisplay : $mreplies - $start + $tmpmaxmessagedisplay; $nextpage = !$ttsreverse ? $start + $maxmessagedisplay : $mreplies - $start - $maxmessagedisplay; $pagedropindexpvbl = qq~~; $pagedropindexnxbl = qq~~; if ((!$ttsreverse and $start < $maxmessagedisplay) or ($ttsreverse and $prevpage > $mreplies)) { $pagedropindexpv .= qq~~; } else { $pagedropindexpv .= qq~$pidtxt{'02'}~; } if ((!$ttsreverse and $nextpage > $lastptn) or ($ttsreverse and $nextpage < $mreplies - $lastptn)) { $pagedropindexnx .= qq~~; } else { $pagedropindexnx .= qq~$pidtxt{'03'}~; } $pageindex1 = qq~$pagedropindex1~; $pageindex2 = qq~$pagedropindex2~; $pageindexjs = qq~ function SelDec(decparam, visel) { splitparam = decparam.split("|"); var vistart = parseInt(splitparam[0]); var viend = parseInt(splitparam[1]); var maxpag = parseInt(splitparam[2]); var pagstart = parseInt(splitparam[3]); //var allpagstart = parseInt(splitparam[3]); if(visel == 'xx' && decparam == '$pagejsindex') visel = '$tstart'; var pagedropindex = ''; for(i=vistart; i<=viend; i++) { if(visel == pagstart) pagedropindex += ''; else pagedropindex += ''; pagstart ~ . (!$ttsreverse ? '+' : '-') . qq~= maxpag; } ~; if ($showpageall) { $pageindexjs .= qq~ if (vistart != viend) { if(visel == 'all') pagedropindex += ''; else pagedropindex += ''; } ~; } $pageindexjs .= qq~ if(visel != 'xx') pagedropindex += ''; else pagedropindex += ''; pagedropindex += '
' + i + '' + i + '$pidtxt{'01'}$pidtxt{'01'}$pagedropindexpv$pagedropindexnx$pagedropindexpvbl$pagedropindexnxbl
'; document.getElementById("ViewIndex1").innerHTML=pagedropindex; document.getElementById("ViewIndex1").style.visibility = "visible"; document.getElementById("ViewIndex2").innerHTML=pagedropindex; document.getElementById("ViewIndex2").style.visibility = "visible"; ~; if ($pagenumb > $dropdisplaynum) { $pageindexjs .= qq~ document.getElementById("decselector1").value = decparam; document.getElementById("decselector2").value = decparam; ~; } $pageindexjs .= qq~ } SelDec('$pagejsindex', '~ . (!$ttsreverse ? $tstart : ($mreplies - $tstart)) . qq~'); ~; } } if (!$iamguest) { $yyjavascript .= qq~ var addnotlink = '$img{'add_notify'}'; var remnotlink = '$img{'del_notify'}'; ~; if (${$uid.$username}{'thread_notifications'} =~ /\b$viewnum\b/) { $notify = qq~$menusep$img{'del_notify'}~; } else { $notify = qq~$menusep$img{'add_notify'}~; } } $yymain .= qq~ ~; # update the .ctb file START &MessageTotals("load", $viewnum); if ($username ne "Guest") { my (%viewer,@tmprepliers,$isrep); foreach (@logentries) { # @logentries already loaded in YaBB.pl => &WriteLog; $viewer{(split(/\|/, $_, 2))[0]} = 1; } my $j = 0; foreach (@repliers) { my ($reptime, $repuser, $isreplying) = split(/\|/, $_); next if $date - $reptime > 600 || !exists $viewer{$repuser}; if ($repuser eq $username) { $tmprepliers[$j] = qq~$date|$repuser|0~; $isrep = 1; } else { $tmprepliers[$j] = qq~$reptime|$repuser|$isreplying~; } $j++; } push(@tmprepliers, qq~$date|$username|0~) if !$isrep; @repliers = @tmprepliers; ${$viewnum}{'views'}++; # Add 1 to the number of views of this thread. &MessageTotals("update", $viewnum); } else { &MessageTotals("incview", $viewnum); # Add 1 to the number of views of this thread. } # update the .ctb file END # Mark current board as read if no other new threads are in &getlog; # &NextPrev => Insert Navigation Bit and get info about number of threads newer than last visit if (&NextPrev($viewnum, $yyuserlog{$currentboard}) < 2) { $yyuserlog{$currentboard} = $date; } # Mark current thread as read. Save thread and board Mark. delete $yyuserlog{"$mnum--unread"}; &dumplog($mnum); $template_home = qq~$mbname~; $topviewers = 0; if (${$uid.$currentboard}{'ann'} == 1) { if ($vircurrentboard) { $template_cat = qq~$vircat~; $template_board = qq~$virboardname~; $navback = qq~‹ $maintxt{'board'}~; $template_mods = qq~$showmods$showmodgroups~; } elsif ($iamadmin || $iamgmod) { $template_cat = qq~$cat~; $template_board = qq~$boardname~; $navback = qq~‹ $maintxt{'board'}~; $template_mods = qq~$showmods$showmodgroups~; } else { $template_cat = $maintxt{'418'}; $template_board = $display_txt{'999'}; $template_mods = ''; } } else { $template_cat = qq~$cat~; $template_board = qq~$boardname~; $navback = qq~‹ $maintxt{'board'}~; $template_mods = qq~$showmods$showmodgroups~; } if ($showtopicviewers && ($iamadmin || $iamgmod || $iammod) && $sessionvalid == 1) { my ($mrepuser, $misreplying, $replying); foreach (@repliers) { (undef, $mrepuser, $misreplying) = split(/\|/, $_); &LoadUser($mrepuser); $replying = $misreplying ? qq~ ($display_txt{'645'})~ : ''; $template_viewers .= qq~$link{$mrepuser}$replying, ~; $topviewers++; } $template_viewers =~ s/\, \Z/\./; } $yyjavascript .= qq~ var addfavlang = '$display_txt{'526'}'; var remfavlang = '$display_txt{'527'}'; var remnotelang = '$display_txt{'530'}'; var addnotelang = '$display_txt{'529'}'; var markfinishedlang = '$display_txt{'528'}';~; if (!$iamguest && $currentboard ne $annboard) { require "$sourcedir/Favorites.pl"; $template_favorite = &IsFav($viewnum, (!$ttsreverse ? $start : $mreplies - $start)); } $template_threadimage = qq~~; $template_sendtopic = $sendtopicmail ? qq~$menusep$img{'sendtopic'}~ : ''; $template_print = qq~$menusep$img{'print'}~; if ($has_poll) { require "$sourcedir/Poll.pl"; &display_poll($viewnum); $template_pollmain = qq~$pollmain
~; } # Load background color list. @cssvalues = ('windowbg', 'windowbg2'); $cssnum = @cssvalues; if (!$UseMenuType) { $sm = 1; } unless (ref($thread_arrayref{$viewnum})) { fopen(MSGTXT, "$datadir/$viewnum.txt") || &fatal_error("cannot_open","$datadir/$viewnum.txt", 1); @{$thread_arrayref{$viewnum}} = ; fclose(MSGTXT); } $counter = 0; my @messages; # Skip the posts in this thread until we reach $start. if (!$ttsreverse) { foreach (@{$thread_arrayref{$viewnum}}) { if ($counter >= $start and $counter < ($start + $maxmessagedisplay)) { push(@messages, $_); } $counter++; } $counter = $start; } else { foreach (@{$thread_arrayref{$viewnum}}) { if ($counter > ($mreplies - $start - $maxmessagedisplay) and $counter <= ($mreplies - $start)) { push(@messages, $_); } $counter++; } $counter = $mreplies - $start; @messages = reverse(@messages); } # For each post in this thread: my (%attach_gif,%attach_count,$movedflag); foreach (@messages) { my ($userlocation, $aimad, $yimad, $msnad, $gtalkad, $skypead, $myspacead, $facebookad, $icqad, $buddyad, $addbuddy, $isbuddy, $addbuddylink, $userOnline, $signature_hr, $lastmodified, $memberinfo, $template_postinfo, $template_ext_prof, $template_profile, $template_quote, $template_email, $template_www, $template_pm); $css = $cssvalues[($counter % $cssnum)]; ($msub, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $postmessage, $ns, $mlm, $mlmb, $mfn) = split(/[\|]/, $_); # Do we have an attachment file? chomp $mfn; $attachment = ''; $showattach = ''; $showattachhr = ''; if ($mfn ne '') { # store all downloadcounts in variable if (!%attach_count) { my ($atfile,$atcount); fopen(ATM, "$vardir/attachments.txt"); while () { (undef, undef, undef, undef, undef, undef, undef, $atfile, $atcount) =split(/\|/, $_); $attach_count{$atfile} = $atcount; } fclose(ATM); $attach_count{'no_attachments'} = 1 if !%attach_count; } foreach (split(/,/, $mfn)) { $_ =~ /\.(.+?)$/; my $ext = lc($1); unless (exists $attach_gif{$ext}) { $attach_gif{$ext} = ($ext && -e "$forumstylesdir/$useimages/$ext.gif") ? "$ext.gif" : "paperclip.gif"; } my $filesize = -s "$uploaddir/$_"; if ($filesize) { if ($_ =~ /\.(bmp|jpe|jpg|jpeg|gif|png)$/i && $amdisplaypics == 1) { $showattach .= qq~
$_ (~ . int($filesize / 1024) . qq~ KB | $attach_count{$_} )
~ . ($img_greybox ? ($img_greybox == 2 ? qq~~ : qq~~) : qq~~) . qq~$_
\n~; } else { $attachment .= qq~
$_ (~ . int($filesize / 1024) . qq~ KB | $attach_count{$_} )
~; } } else { $attachment .= qq~
$_ ($fatxt{'1'}~ . (exists $attach_count{$_} ? qq~ | $attach_count{$_} ~ : '') . qq~)
~; } } $showattachhr = qq~
~; if ($showattach && $attachment) { $attachment =~ s/
/
/g; } } # Should we show "last modified by?" if ($showmodify && $mlm ne '' && $mlmb ne '' && (!$tllastmodflag || ($mdate + ($tllastmodtime * 60)) < $mlm)) { &LoadUser($mlmb); $mlmb = ${$uid.$mlmb}{'realname'} || $display_txt{'470'}; $lastmodified = qq~« $display_txt{'211'}: ~ . &timeformat($mlm) . qq~ $display_txt{'525'} $mlmb »~; } $messdate = &timeformat($mdate); if ($iamadmin || $iamgmod && $gmod_access2{'ipban2'} eq "on") { $mip = $mip } else { $mip = $display_txt{'511'}; } # If the user isn't a guest, load their info. if ($musername ne 'Guest' && !$yyUDLoaded{$musername} && -e ("$memberdir/$musername.vars")) { &LoadUserDisplay($musername); } $messagedate = $mdate; if (${$uid.$musername}{'regtime'}) { $registrationdate = ${$uid.$musername}{'regtime'}; } else { $registrationdate = $date; } ## moderator alert button! if ($PMenableAlertButton && $PM_level && !$iamadmin && !$iamgmod && !$iammod && (!$iamguest || ($iamguest && $PMAlertButtonGuests))) { $PMAlertButton = qq~$menusep$img{'alertmod'}~; } ## is member a buddy of mine? if ($buddyListEnabled && !$iamguest && $musername ne $username) { $isbuddy = qq~
$display_txt{'isbuddy'}
$display_txt{'isbuddy'}~; $addbuddylink = qq~$menusep$img{'addbuddy'}~; } # user is current / admin / gmod if ((${$uid.$musername}{'regdate'} && $messagedate > $registrationdate) || ${$uid.$musername}{'position'} eq 'Administrator' || ${$uid.$musername}{'position'} eq 'Global Moderator') { if (!$iamguest && $musername ne $username) { ## check whether user is a buddy if ($mybuddie{$musername}) { $buddyad = $isbuddy; } else { $addbuddy = $addbuddylink; } # Allow instant message sending if current user is a member. &CheckUserPM_Level($musername); if ($PM_level == 1 || ($PM_level == 2 && $UserPM_Level{$musername} > 1 && ($iamadmin || $iamgmod || $iammod)) || ($PM_level == 3 && $UserPM_Level{$musername} == 3 && ($iamadmin || $iamgmod))) { $template_pm = qq~$menusep$img{'message_sm'}~; } } $template_postinfo = qq~$display_txt{'21'}: ${$uid.$musername}{'postcount'}
~; $template_profile = ($profilebutton && !$iamguest) ? qq~$menusep$img{'viewprofile_sm'}~ : ''; $template_www = ${$uid.$musername}{'weburl'} ? qq~$menusep${$uid.$musername}{'weburl'}~ : ''; $userOnline = &userOnLineStatus($musername) . "
"; $displayname = ${$uid.$musername}{'realname'}; if (${$uid.$musername}{'location'}) { $userlocation = ${$uid.$musername}{'location'} . "
"; } $signature_hr = qq~
~ if ${$uid.$musername}{'signature'}; $memberinfo = "$memberinfo{$musername}$addmembergroup{$musername}"; $aimad = ${$uid.$musername}{'aim'} ? qq~$menusep${$uid.$musername}{'aim'}~ : ''; $icqad = ${$uid.$musername}{'icq'} ? qq~$menusep${$uid.$musername}{'icq'}~ : ''; $yimad = ${$uid.$musername}{'yim'} ? qq~$menusep${$uid.$musername}{'yim'}~ : ''; $msnad = ${$uid.$musername}{'msn'} ? qq~$menusep${$uid.$musername}{'msn'}~ : ''; $gtalkad = ${$uid.$musername}{'gtalk'} ? qq~$menusep${$uid.$musername}{'gtalk'}~ : ''; $skypead = ${$uid.$musername}{'skype'} ? qq~$menusep${$uid.$musername}{'skype'}~ : ''; $myspacead = ${$uid.$musername}{'myspace'} ? qq~$menusep${$uid.$musername}{'myspace'}~ : ''; $facebookad = ${$uid.$musername}{'facebook'} ? qq~$menusep${$uid.$musername}{'facebook'}~ : ''; $usernamelink = &QuickLinks($musername); if ($extendedprofiles) { require "$sourcedir/ExtendedProfiles.pl"; $usernamelink = &ext_viewinposts_popup($musername,$usernamelink); } } elsif ($musername !~ m~Guest~ && $messagedate < $registrationdate) { $exmem = 1; $memberinfo = $display_txt{'470a'}; $usernamelink = qq~$mname~; $displayname = $display_txt{'470a'}; } else { require "$sourcedir/Decoder.pl"; $musername = 'Guest'; $memberinfo = $display_txt{'28'}; $usernamelink = qq~$mname~; $displayname = $mname; $cryptmail = &scramble($memail, $musername); } $usernames_life_quote{$useraccount{$musername}} = $displayname; # for display names in Quotes in LivePreview # Insert 2 if ((!${$uid.$musername}{'hidemail'} || $iamadmin || $allow_hide_email != 1 || $musername eq 'Guest') && !$exmem) { $template_email = $menusep . &enc_eMail($img{'email_sm'},$memail,'',''); } if ($iamguest) { $template_email = ''; } $counterwords = $counter != 0 ? "$display_txt{'146'} #$counter - " : ""; # Print the post and user info for the poster. my $outblock = $messageblock; my $posthandelblock = $posthandellist; my $contactblock = $contactlist; ($msub, undef) = &Split_Splice_Move($msub,0); $msub ||= $display_txt{'24'}; &ToChars($msub); $msub = &Censor($msub); $message = $postmessage; &wrap; ($message,$movedflag) = &Split_Splice_Move($message,$viewnum); if ($enable_ubbc) { if (!$yyYaBBCloaded) { require "$sourcedir/YaBBC.pl"; } &DoUBBC; } &wrap2; &ToChars($message); $message = &Censor($message); if ($icanbypass) { $template_modify = qq~$menusep$img{'modify'} ~; } if ($mstate !~ /l/i) { if ($replybutton) { my $quote_mname = $mname; $quote_mname =~ s/'/\\'/g; $usernamelink = qq~$display_txt{'146n'} $usernamelink~ if $enable_quickreply && $enable_quoteuser && (!$iamguest || $enable_guestposting); if (!$movedflag || $iamadmin || $iamgmod || $iammod) { if ($enable_quickreply) { $quote_mname = $useraccount{$musername}; $quote_mname =~ s/'/\\'/g; if ($enable_markquote) { $outblock =~ s/()/$1 onmouseup="get_selection($counter);"$2/i; $template_quote = qq~$menusep$img{'mquote'}~; } else { $template_quote = ''; } if ($enable_quickjump) { if (length($postmessage) <= $quick_quotelength) { my $quickmessage = $postmessage; $quickmessage =~ s/<(br|p).*?>/\\r\\n/ig; $quickmessage =~ s/'/\\'/g; $template_quote .= qq~$menusep$img{'quote'}~; } else { $template_quote .= qq~$menusep$img{'quote'}~; } } else { $template_quote .= qq~$menusep$img{'quote'}~; } } else { $template_quote = qq~$menusep$img{'quote'}~; } } } if ($sessionvalid == 1 && ($iamadmin || $iamgmod || $iammod || ($username eq $musername && !$exmem && (!$tlnomodflag || $date < $mdate + ($tlnomodtime * 3600 * 24))))) { $template_modify = qq~$menusep$img{'modify'}~; } else { $template_modify = ''; } if ($counter > 0 && ($iamadmin || $iamgmod || $iammod) && $sessionvalid == 1) { $template_split = qq~$menusep$img{'admin_split'}~; } if ($sessionvalid == 1 && ($iamadmin || $iamgmod || $iammod || ($username eq $musername && !$exmem && (!$tlnodelflag || $date < $mdate + ($tlnodeltime * 3600 * 24))))) { $template_delete = qq~$menusep$img{'delete'}~; if ((($iammod && $mdmod == 1) || ($iamadmin && $mdadmin == 1) || ($iamgmod && $mdglobal == 1)) && $sessionvalid == 1) { $template_admin = qq~~; } else { # need to set visibility to hidden - used for regular users to delete their posts too, $template_admin = qq~ ~; } } else { $template_delete = ''; $template_admin = qq~ ~; } } $msgimg = qq~~; $ipimg = qq~~; if ($extendedprofiles) { require "$sourcedir/ExtendedProfiles.pl"; $template_ext_prof = &ext_viewinposts($musername); } # Jump to the "NEW" Post. $usernamelink = qq~$usernamelink~ if $newestpost && $newestpost == $counter; $posthandelblock =~ s/({|<)yabb quote(}|>)/$template_quote/g; $posthandelblock =~ s/({|<)yabb modify(}|>)/$template_modify/g; $posthandelblock =~ s/({|<)yabb split(}|>)/$template_split/g; $posthandelblock =~ s/({|<)yabb delete(}|>)/$template_delete/g; $posthandelblock =~ s/({|<)yabb admin(}|>)/$template_admin/g; $posthandelblock =~ s/({|<)yabb modalert(}|>)/$PMAlertButton/g; $posthandelblock =~ s/\Q$menusep//i; $contactblock =~ s/({|<)yabb email(}|>)/$template_email/g; $contactblock =~ s/({|<)yabb profile(}|>)/$template_profile/g; $contactblock =~ s/({|<)yabb pm(}|>)/$template_pm/g; $contactblock =~ s/({|<)yabb www(}|>)/$template_www/g; $contactblock =~ s/({|<)yabb aim(}|>)/$aimad/g; $contactblock =~ s/({|<)yabb yim(}|>)/$yimad/g; $contactblock =~ s/({|<)yabb icq(}|>)/$icqad/g; $contactblock =~ s/({|<)yabb msn(}|>)/$msnad/g; $contactblock =~ s/({|<)yabb gtalk(}|>)/$gtalkad/g; $contactblock =~ s/({|<)yabb skype(}|>)/$skypead/g; $contactblock =~ s/({|<)yabb myspace(}|>)/$myspacead/g; $contactblock =~ s/({|<)yabb facebook(}|>)/$facebookad/g; $contactblock =~ s/({|<)yabb addbuddy(}|>)/$addbuddy/g; $contactblock =~ s/\Q$menusep//i; $outblock =~ s/({|<)yabb images(}|>)/$imagesdir/g; $outblock =~ s/({|<)yabb messageoptions(}|>)/$msgcontrol/g; $outblock =~ s/({|<)yabb memberinfo(}|>)/$memberinfo/g; $outblock =~ s/({|<)yabb userlink(}|>)/$usernamelink/g; $outblock =~ s/({|<)yabb location(}|>)/$userlocation/g; $outblock =~ s/({|<)yabb stars(}|>)/$memberstar{$musername}/g; $outblock =~ s/({|<)yabb subject(}|>)/$msub/g; $outblock =~ s/({|<)yabb msgimg(}|>)/$msgimg/g; $outblock =~ s/({|<)yabb msgdate(}|>)/$messdate/g; $outblock =~ s/({|<)yabb replycount(}|>)/$counterwords/g; $outblock =~ s/({|<)yabb count(}|>)/$counter/g; $outblock =~ s/({|<)yabb att(}|>)/$attachment/g; $outblock =~ s/({|<)yabb css(}|>)/$css/g; $outblock =~ s/({|<)yabb gender(}|>)/${$uid.$musername}{'gender'}/g; $outblock =~ s/({|<)yabb ext_prof(}|>)/$template_ext_prof/g; $outblock =~ s/({|<)yabb postinfo(}|>)/$template_postinfo/g; $outblock =~ s/({|<)yabb usertext(}|>)/${$uid.$musername}{'usertext'}/g; $outblock =~ s/({|<)yabb userpic(}|>)/${$uid.$musername}{'userpic'}/g; $outblock =~ s/({|<)yabb message(}|>)/$message/g; $outblock =~ s/({|<)yabb showatt(}|>)/$showattach/g; $outblock =~ s/({|<)yabb showatthr(}|>)/$showattachhr/g; $outblock =~ s/({|<)yabb modified(}|>)/$lastmodified/g; $outblock =~ s/({|<)yabb signature(}|>)/${$uid.$musername}{'signature'}/g; $outblock =~ s/({|<)yabb signaturehr(}|>)/$signature_hr/g; $outblock =~ s/({|<)yabb ipimg(}|>)/$ipimg/g; $outblock =~ s/({|<)yabb ip(}|>)/$mip/g; $outblock =~ s/({|<)yabb posthandellist(}|>)/$posthandelblock/g; $outblock =~ s/({|<)yabb contactlist(}|>)/$contactblock/g; if ($accept_permalink == 1){ $outblock =~ s/({|<)yabb permalink(}|>)/$display_permalink/g; } else { $outblock =~ s/({|<)yabb permalink(}|>)//g; } $outblock =~ s/({|<)yabb useronline(}|>)/$userOnline/g; $outblock =~ s/({|<)yabb isbuddy(}|>)/$buddyad/g; $tmpoutblock .= $outblock; $counter += !$ttsreverse ? 1 : -1; } undef %UserPM_Level; # Insert 4 # Insert 5 my ($template_remove, $template_splice, $template_lock, $template_hide, $template_sticky, $template_multidelete); if (($iammod || $iamadmin || $iamgmod) && $sessionvalid == 1) { $template_remove = qq~$menusep $img{'admin_rem'}~; $template_splice = qq~$menusep$img{'admin_move_split_splice'}~; $template_lock = qq~$menusep$img{'admin_lock'}~; $template_hide = qq~$menusep$img{'hide'}~; $template_sticky = qq~$menusep$img{'admin_sticky'}~; if (${$mnum}{'board'} eq $annboard) { $template_sticky = ''; } } if ((($iammod && $mdmod == 1) || ($iamadmin && $mdadmin == 1) || ($iamgmod && $mdglobal == 1)) && $sessionvalid == 1) { if ($mstate !~ /l/i) { $template_multidelete = qq~$menusep$img{'admin_del'}~; } } if ($template_viewers) { $topic_viewers = qq~ $display_txt{'644'} ($topviewers): $template_viewers ~; } # Mark as read button has no use in global announcements or for guests if ($currentboard ne $annboard && !$iamguest) { $mark_unread = qq~$menusep$img{'markunread'}~; } # Template it $tabsep = qq~~; $yynavback = qq~$tabsep « $img_txt{'103'} $tabsep $navback $tabsep~; $yynavigation = qq~› $template_cat › $template_board › $msubthread~; # Create link to modify displayed post order if allowed my $curthreadurl = (!$iamguest and $ttsureverse) ? qq~ $msubthread~ : $msubthread; $threadhandellist =~ s/({|<)yabb markunread(}|>)/$mark_unread/g; $threadhandellist =~ s/({|<)yabb reply(}|>)/$replybutton/g; $threadhandellist =~ s/({|<)yabb poll(}|>)/$pollbutton/g; $threadhandellist =~ s/({|<)yabb notify(}|>)/$notify/g; $threadhandellist =~ s/({|<)yabb favorite(}|>)/$template_favorite/g; $threadhandellist =~ s/({|<)yabb sendtopic(}|>)/$template_sendtopic/g; $threadhandellist =~ s/({|<)yabb print(}|>)/$template_print/g; $threadhandellist =~ s/\Q$menusep//i; $adminhandellist =~ s/({|<)yabb remove(}|>)/$template_remove/g; $adminhandellist =~ s/({|<)yabb splice(}|>)/$template_splice/g; $adminhandellist =~ s/({|<)yabb lock(}|>)/$template_lock/g; $adminhandellist =~ s/({|<)yabb hide(}|>)/$template_hide/g; $adminhandellist =~ s/({|<)yabb sticky(}|>)/$template_sticky/g; $adminhandellist =~ s/({|<)yabb multidelete(}|>)/$template_multidelete/g; $adminhandellist =~ s/\Q$menusep//i; $display_template =~ s/({|<)yabb home(}|>)/$template_home/g; $display_template =~ s/({|<)yabb category(}|>)/$template_cat/g; $display_template =~ s/({|<)yabb board(}|>)/$template_board/g; $display_template =~ s/({|<)yabb moderators(}|>)/$template_mods/g; $display_template =~ s/({|<)yabb topicviewers(}|>)/$topic_viewers/g; $display_template =~ s/({|<)yabb prev(}|>)/$prevlink/g; $display_template =~ s/({|<)yabb next(}|>)/$nextlink/g; $display_template =~ s/({|<)yabb pageindex top(}|>)/$pageindex1/g; $display_template =~ s/({|<)yabb pageindex bottom(}|>)/$pageindex2/g; $display_template =~ s/({|<)yabb threadhandellist(}|>)/$threadhandellist/g; $display_template =~ s/({|<)yabb threadimage(}|>)/$template_threadimage/g; $display_template =~ s/({|<)yabb threadurl(}|>)/$curthreadurl/g; $display_template =~ s/({|<)yabb views(}|>)/ ${$viewnum}{'views'} - 1 /eg; if (($iamadmin || $iamgmod || $iammod) && $sessionvalid == 1) { # Board=$currentboard is necessary for multidel - DO NOT REMOVE!! # This form is necessary to allow thread deletion in locked topics. $formstart .= qq~
~; } $formstart .= qq~
~; $formend = qq~
~; $display_template =~ s/({|<)yabb multistart(}|>)/$formstart/g; $display_template =~ s/({|<)yabb multiend(}|>)/$formend/g; $display_template =~ s/({|<)yabb pollmain(}|>)/$template_pollmain/g; $display_template =~ s/({|<)yabb postsblock(}|>)/$tmpoutblock/g; $display_template =~ s/({|<)yabb adminhandellist(}|>)/$adminhandellist/g; $display_template =~ s/({|<)yabb forumselect(}|>)/$selecthtml/g; $yymain .= qq~ $display_template ~; if ($img_greybox) { $yyinlinestyle .= qq~\n~; $yyjavascript .= qq~ var GB_ROOT_DIR = "$yyhtml_root/greybox/"; // --> ~; } sub SetGtalk { $gtalkstyle = qq~~; $gtalkstyle =~ s~$usestyle\/~~g; my $gtalkname = $INFO{'gtalkname'}; if (!${$uid.$gtalkname}{'password'}) { &LoadUser($gtalkname); } $gtalkuser = ${$uid.$gtalkname}{'gtalk'}; print qq~Content-type: text/html\n\n~; print qq~ Google Talk $gtalkstyle
Google Talk
${$uid.$gtalkname}{'realname'} $gtalkuser

~; } sub ThreadPageindex { #my ($msindx, $trindx, $mbindx); my ($msindx, $trindx, $mbindx,$pmindx) = split(/\|/, ${$uid.$username}{'pageindex'}); if ($INFO{'action'} eq "threadpagedrop") { ${$uid.$username}{'pageindex'} = qq~$msindx|0|$mbindx|$pmindx~; } if ($INFO{'action'} eq "threadpagetext") { ${$uid.$username}{'pageindex'} = qq~$msindx|1|$mbindx|$pmindx~; } if (exists($INFO{'reversetopic'})) { ${$uid.$username}{'reversetopic'} = $INFO{'reversetopic'} ? 0 : 1; } &UserAccount($username, "update"); $yySetLocation = qq~$scripturl?num=$INFO{'num'}/$INFO{'start'}~; &redirectexit; } sub undumplog { # Used to mark a thread as unread # Load the log file &getlog; &dumplog("$INFO{'thread'}--unread") if $yyuserlog{$INFO{'thread'}}; &redirectinternal; } 1;