Recent Comments head<= <=head body<= {user}; $LJ_cmtinfo{'journal'} = $remote->{user}; my $authas = $GET{'authas'} || $remote->{'user'}; my $u = LJ::get_authas_user($authas); return LJ::bad_input($ML{'error.invalidauth'}) unless $u; my $user = $u->{'user'}; my $dbcr = LJ::get_cluster_reader($u); return "Error: can't get DB for user" unless $dbcr; my $count = LJ::get_cap($u, "tools_recent_comments_display"); # authas switcher form $ret .= "
\n\n"; my (@recv, @posted, %talkids); my %need_userid; my %logrow; # "jid nodeid" -> $logrow my $now = time(); my $sth; my $jargent ="journal=$u->{'user'}&"; # Retrieve recv { my $max = $dbcr->selectrow_array("SELECT MAX(jtalkid) FROM talk2 WHERE journalid=?", undef, $u->{userid}); $sth = $dbcr->prepare("SELECT jtalkid, nodetype, nodeid, parenttalkid, ". " posterid, UNIX_TIMESTAMP(datepost) as 'datepostunix', state ". "FROM talk2 ". "WHERE journalid=? AND jtalkid > ?"); $sth->execute($u->{userid}, $max - $count); die $dbcr->errstr if $dbcr->err; while (my $r = $sth->fetchrow_hashref) { $r->{itemid} = $r->{nodeid}; # fill_items_with required field push @recv, $r; $need_userid{$r->{posterid}} = 1 if $r->{posterid}; $talkids{$r->{jtalkid}} = 1; } } # Retrieve posted if ($u->{journaltype} eq "P") { $sth = $dbcr->prepare("SELECT posttime, journalid, nodetype, nodeid, jtalkid, publicitem ". "FROM talkleft ". "WHERE userid=? ORDER BY posttime DESC LIMIT $count"); $sth->execute($u->{'userid'}); my %jcount; # jid -> ct $ret .= "";
$ret .= ($pu->{userid} ? LJ::ljuser($pu) : "Anonymous") . " "; $ret .= LJ::ago_text($now - $r->{datepostunix}) . " "; $ret .= " $state " if $r->{state} ne "D";
unless ($r->{state} eq "D")
{
$ret .= "" . LJ::img("btn_del", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . "";
if ($r->{'state'} ne 'F') {
$ret .= "" . LJ::img("btn_freeze", "", { align => 'absmiddle', hspace => 2, vspace => }) . "";
}
if ($r->{'state'} eq 'F') {
$ret .= "" . LJ::img("btn_unfreeze", "", { align => 'absmiddle', hspace => 2, vspace => }) . "";
}
if ($r->{'state'} ne 'S') {
$ret .= "" . LJ::img("btn_scr", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . "";
}
if ($r->{'state'} eq 'S') {
$ret .= "" . LJ::img("btn_unscr", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . "";
}
}
# FIXME: (David?) We'll have to make talk_multi.bml understand jtalkids in multiple posts
#$ret .= " | ";
my $subject = $r->{'text'}->[0];
LJ::CleanHTML::clean_subject(\$subject) if $subject ne "";
$ret .= "$subject " if $subject ne "";
$ret .= "(Entry Link)" unless $lrow->{ditemid} == undef;
$ret .= " "; my $subject = $comment_text->{$r->{jtalkid}}[0]; LJ::CleanHTML::clean_subject(\$subject); if ($subject && $subject !~ /^Re:\s*$/) { $ret .= "$subject "; } my $comment = $comment_text->{$r->{jtalkid}}[1]; LJ::CleanHTML::clean_comment(\$comment, { 'preformatted' => $r->{'props'}->{'opt_preformatted'}, 'anon_comment' => !$pu }); $ret .= "$comment "; $ret .= "(Comment Link) " unless $r->{state} eq "D" || $lrow->{ditemid} == undef; my $stylemine = 0; my $replyurl = LJ::Talk::talkargs($ditemid, "replyto=$talkid", $stylemine); if ($lrow->{ditemid} == undef) { $ret .= "(Post Deleted)"; } elsif ($r->{'state'} eq 'F') { $ret .= "($ML{'talk.frozen'}) "; } elsif ($r->{'state'} eq "D") { $ret .= "(Comment Deleted)"; } else { $ret .= "($ML{'talk.replytothis'}) "; } $ret .= " |
Time | Location |
---|---|
$hr_ago | " . LJ::ljuser($ju->{user}) . ": $subject |