{'head'} : \$r_head; my $title = $_[1] ? \$_[1]->{'title'} : \$r_title; my $bodyopts = $_[1] ? \$_[1]->{'bodyopts'} : \$r_bodyopts; return LJ::server_down_html() if $LJ::SERVER_DOWN; my $pics = LJ::Talk::get_subjecticons(); ## workaround mail client bug when don't understand quoted-printable. ## Only correct 'journal' if 'itemid' was also broken, to avoid the ## unlikely clash with a journal name. if ($GET{'itemid'} =~ s/^3D//) { $GET{'journal'} =~ s/^3D//; $GET{'thread'} =~ s/^3D//; } my $r = Apache->request; $r->notes("codepath" => "bml.talkread"); my $uri = BML::get_uri(); my $itemid; if ($uri =~ m!/(\d+)\.html$!) { $itemid = $1; $GET{'itemid'} = $itemid; $GET{'journal'} = $r->notes("_journal"); BML::set_language_scope("/talkread.bml"); } # pre-load common strings for little speed and less typing later # (we're doing this *after* set_language_scope is called, because # two below are relative strings) my %T = qw(postcomments talk.commentpost readcomments talk.commentsread parent talk.parentlink thread talk.threadlink replythis talk.replytothis frozen talk.frozen link talk.commentpermlink deleted .subjectdeleted nosubject .nosubject ); foreach (keys %T) { $T{$_} = $ML{$T{$_}}; } my $init = LJ::Talk::init(\%GET); my $u = $init->{'journalu'}; return $ML{'talk.error.nojournal'} unless $u; my $ditemid = $init->{'ditemid'}+0; # redirect if account was renamed if ($u->{'journaltype'} eq "R") { LJ::load_user_props($u, "renamedto"); if ($u->{'renamedto'} ne "") { return BML::redirect(LJ::journal_base($u->{'renamedto'}) . "/$ditemid.html"); } } # now check for init->error, since we know the account wasn't renamed return "{'error'} p?>" if $init->{'error'}; LJ::load_user_props($u, "opt_blockrobots") if $u->{'statusvis'} eq 'V'; if ($u->{'statusvis'} ne 'V' || $u->{'opt_blockrobots'}) { $$head .= LJ::robot_meta_tags(); } $r->notes("journalid" => $u->{'userid'}); my $thread = $init->{'thread'}; my $dthread = $init->{'dthread'}; $itemid = $init->{'itemid'}+0; my $stylemine = $init->{'style'} eq "mine" ? "style=mine" : ""; my $item = LJ::Talk::get_journal_item($u, $itemid); if ($init->{'oldurl'} && $item) { $init->{'anum'} = $item->{'anum'}; $init->{'ditemid'} = $init->{'itemid'}*256 + $item->{'anum'}; $ditemid = $init->{'ditemid'} + 0; } unless ($item && $item->{'anum'} == $init->{'anum'}) { return ""; } my $jarg = "journal=$u->{'user'}&"; my $jargent ="journal=$u->{'user'}&"; my $talkurl = LJ::journal_base($u) . "/$ditemid.html"; my $ret = ""; my $props = $item->{'props'}; my $nocomments = $u->{'opt_showtalklinks'} eq "N" ? 1 : $props->{'opt_nocomments'}; ### load users my ($up); # $up = user posted journal item LJ::load_userids_multiple([ $item->{'posterid'} => \$up, ], [ $u ]); LJ::text_out(\$u->{'name'}); my $remote = LJ::get_remote(); # set viewall/viewsome my $viewall = 0; my $viewsome = 0; if ($GET{viewall} && LJ::check_priv($remote, 'canview')) { LJ::statushistory_add($u->{'userid'}, $remote->{'userid'}, "viewall", "entry: $u->{'user'}, itemid: $item->{'itemid'}, statusvis: $u->{'statusvis'}"); $viewall = LJ::check_priv($remote, 'canview', '*'); $viewsome = $viewall || LJ::check_priv($remote, 'canview', 'suspended'); } # check for deleted/suspended/security unless ($viewsome) { # check suspended return "" if ($u->{'statusvis'} eq "S" || $up->{'statusvis'} eq "S"); # check deleted return "" if ($u->{'statusvis'} eq "D"); } unless ($viewall) { #### Check security before viewing this post my $errtxt; return $errtxt unless LJ::Talk::check_viewable($remote, $item, \%GET, \$errtxt); } # See if we should inject QuickReply javascript LJ::load_user_props($remote, "opt_no_quickreply"); if (($remote && !$remote->{'opt_no_quickreply'}) && !$nocomments) { $$head .= $LJ::COMMON_CODE{'quickreply'}; $$bodyopts .= 'onload="restore_entry();" onunload="save_entry();"'; } my $showmultiform = $remote && ($remote->{'user'} eq $u->{'user'} || $remote->{'user'} eq $up->{'user'} || LJ::can_manage($remote, $u)); my $multiform_selects = 0; # are there select boxes? don't show form if not. my $event = $item->{'event'}; LJ::expand_embedded($u, $ditemid, $remote, \$event); LJ::CleanHTML::clean_event(\$event, $props->{'opt_preformatted'}); BML::ebml(\$event); # make the title { my $subject = $item->{'subject'} || $event; LJ::CleanHTML::clean_subject_all(\$subject); $subject =~ s/\n.*//s; # yes, the 3 param to text_trim is chars, and length returns bytes, but # it works, as bytes >= chars: $subject = LJ::text_trim($subject, 0, length($item->{'subject'}) || 40); $$title = "$u->{'user'}: $subject"; } $ret .= "
"; $ret .= "
{'height'}' align='absmiddle' ". "hspace='3' title='$alt' alt=''> | "; } $ret .= "";
my $is_shared = $u->{'journaltype'} eq 'C' || $u->{'journaltype'} eq 'S';
if ($is_shared) {
$ret .= BML::ml("talk.somebodywrote_comm", { 'realname' => LJ::ehtml($up->{'name'}),
'userlink' => LJ::ljuser($up),
'commlink' => LJ::ljuser($u) });
} else {
$ret .= BML::ml("talk.somebodywrote", { 'realname' => LJ::ehtml($up->{'name'}),
'userlink' => LJ::ljuser($up) });
}
my $etime = $item->{'eventtime'};
$etime =~ s!(\d\d\d\d)-(\d\d)-(\d\d)!LJ::date_to_view_links($u, $&)!e;
$ret .= " @ $etime"; $ret .= " |
$curname | $current{$_} |
\n";
}
### security indicator
my $sec = "";
if ($item->{'security'} eq "private") {
$sec = BML::fill_template("securityprivate");
} elsif ($item->{'security'} eq "usemask") {
$sec = BML::fill_template("securityprotected");
}
$sec .= "
\n" unless $sec eq "" or $item->{'subject'};
$ret .= $sec;
###
if ($item->{'subject'}) {
my $subject = $item->{'subject'};
LJ::CleanHTML::clean_subject(\$subject);
BML::ebml(\$subject);
$ret .= "$subject
\n";
}
$ret .= $event;
$ret .= "
"; $navcrap .= BML::ml('ljlib.pageofpages',{'page'=>$page, 'total'=>$pages}); $navcrap .= " | ||
$left | ";
for (my $i=1; $i<=$pages; $i++) {
my $link = "[$i]";
if ($i != $page) { $link = " $i }) . "#comments'>$link"; }
else { $link = "$link"; }
$navcrap .= "$link ";
if ($i == 11) { $navcrap .= " "; } elsif ($i > 10 && $i % 10 == 0) { $navcrap .= " "; } } $navcrap .= " | $right |
"; $ret .= " | $ML{'.deletedpost'} |
"; my $screenedtext = $ML{'.screenedpost'}; $ret .= " | $screenedtext |
"; $ret .= " | $ML{'.replysuspended'}"; if (LJ::Talk::can_delete($remote, $u, $up, $userpost)) { $ret .= " " . LJ::img("btn_del", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . ""; } if ($post->{state} ne 'F' && LJ::Talk::can_freeze($remote, $u, $up, $userpost)) { $ret .= "" . LJ::img("btn_freeze", "", { align => 'absmiddle', hspace => 2, vspace => }) . ""; } if ($post->{state} eq 'F' && LJ::Talk::can_unfreeze($remote, $u, $up, $userpost)) { $ret .= "" . LJ::img("btn_unfreeze", "", { align => 'absmiddle', hspace => 2, vspace => }) . ""; } $ret .= " |
"; $ret .= " | ";
if (my $picid = $post->{'picid'}) {
my $alt = $pu->{'name'};
if ($post->{'props'}->{'picture_keyword'}) {
$alt .= ": $post->{'props'}->{'picture_keyword'}";
}
$alt = LJ::ehtml($alt);
my ($w, $h) = ($userpics{$picid}->{'width'}, $userpics{$picid}->{'height'});
$ret .= "{'subject'});
$ret .= "$cleansubject $icon";
$ret .= " $user\n"; $ret .= " $datepost\n"; if ($post->{'props'}->{'poster_ip'} && $remote && ($remote->{'user'} eq $up->{'user'} || LJ::can_manage($remote, $u) || $viewall)) { $ret .= BML::ml('.fromip', {'ip'=>$post->{'props'}->{'poster_ip'}}); } $ret .= " ($T{'link'}) "; if (LJ::Talk::can_delete($remote, $u, $up, $userpost)) { $ret .= "" . LJ::img("btn_del", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . ""; } if ($post->{'state'} ne 'F' && LJ::Talk::can_freeze($remote, $u, $up, $userpost)) { $ret .= "" . LJ::img("btn_freeze", "", { align => 'absmiddle', hspace => 2, vspace => }) . ""; } if ($post->{'state'} eq 'F' && LJ::Talk::can_unfreeze($remote, $u, $up, $userpost)) { $ret .= "" . LJ::img("btn_unfreeze", "", { align => 'absmiddle', hspace => 2, vspace => }) . ""; } if ($post->{'state'} ne 'S' && LJ::Talk::can_screen($remote, $u, $up, $userpost)) { $ret .= "" . LJ::img("btn_scr", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . ""; } if ($post->{'state'} eq 'S' && LJ::Talk::can_unscreen($remote, $u, $up, $userpost)) { $ret .= "" . LJ::img("btn_unscr", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . ""; } if ($showmultiform) { $ret .= " $ML{'.posted'}" if $last_talkid == $dtid && $last_jid == $u->{'userid'}; $ret .= " |
";
LJ::CleanHTML::clean_comment(\$post->{'body'}, { 'preformatted' => $post->{'props'}->{'opt_preformatted'},
'anon_comment' => !$pu });
BML::ebml(\$post->{'body'});
$ret .= $post->{'body'};
$ret .= " "; my $replyurl = LJ::Talk::talkargs($talkurl, "replyto=$dtid", $stylemine); if ($post->{'state'} eq 'F') { $ret .= "($T{'frozen'}) "; } elsif ($remote) { $ret .= "(" . LJ::make_qr_link($dtid, $post->{'subject'}, $T{'replythis'}, $replyurl) . ")"; } else { $ret .= "($T{'replythis'}) "; } if ($post->{'parenttalkid'} != 0) { my $dpid = $post->{'parenttalkid'} * 256 + $init->{'anum'}; $ret .= "($T{'parent'}) "; } if ($post->{'children'} && @{$post->{'children'}}) { my $url = LJ::Talk::talkargs($talkurl, "thread=$dtid", $stylemine) . "#t$dtid"; $ret .= "($T{'thread'})"; } $ret .= " "; $ret .= LJ::make_qr_target($dtid) if $remote; $ret .= " |
"; $ret .= " | " . LJ::ehtml($post->{'subject'} || $T{'nosubject'}) . " - $user, $post->{'datepost'}"; # Comment Posted Notice $ret .= " - $ML{'.posted'}" if $last_talkid == $dtid && $last_jid == $u->{'userid'}; $ret .= " |
$navcrap
"; } $ret .= "