init
This commit is contained in:
40
local/htdocs/tools/embedcontent.bml
Normal file
40
local/htdocs/tools/embedcontent.bml
Normal file
@@ -0,0 +1,40 @@
|
||||
<?_code
|
||||
{
|
||||
use strict;
|
||||
use vars qw(%GET %POST $title $headextra @errors @warnings);
|
||||
use LJ::Auth;
|
||||
use LJ::EmbedModule;
|
||||
|
||||
# this can only be accessed from the embed module subdomain
|
||||
my $r = Apache->request;
|
||||
|
||||
my $host = $r->header_in("Host");
|
||||
my $fwd_host = $r->header_in("X-Forwarded-Host");
|
||||
$host = $fwd_host if $fwd_host;
|
||||
$host =~ s/,.+//;
|
||||
|
||||
return "This page cannot be viewed from $host"
|
||||
unless $host =~ /.*$LJ::EMBED_MODULE_DOMAIN$/i;
|
||||
|
||||
# we should have three GET params: journalid, moduleid, auth_token
|
||||
my $journalid = $GET{journalid}+0 or return "No journalid specified";
|
||||
my $moduleid = $GET{moduleid};
|
||||
return "No module id specified" unless defined $moduleid;
|
||||
$moduleid += 0;
|
||||
my $preview = $GET{preview};
|
||||
# check auth_token
|
||||
return "Invalid auth string" unless
|
||||
LJ::Auth->check_sessionless_auth_token('embedcontent', %GET);
|
||||
|
||||
# ok we're cool, return content
|
||||
my $content = LJ::EmbedModule->module_content(
|
||||
journalid => $journalid,
|
||||
moduleid => $moduleid,
|
||||
preview => $preview,
|
||||
);
|
||||
|
||||
return qq {
|
||||
<html><head></head><body style="background-color: transparent;">$content</body></html>
|
||||
};
|
||||
}
|
||||
_code?>
|
||||
321
local/htdocs/tools/memadd.bml
Executable file
321
local/htdocs/tools/memadd.bml
Executable file
@@ -0,0 +1,321 @@
|
||||
<?_code
|
||||
|
||||
use strict;
|
||||
use vars qw(%GET %POST $title $body);
|
||||
|
||||
my $dbr = LJ::get_db_reader();
|
||||
|
||||
$title = $ML{'.title'};
|
||||
$body = "";
|
||||
|
||||
my $err = sub {
|
||||
$title = "Error";
|
||||
$body = LJ::bad_input(@_);
|
||||
return;
|
||||
};
|
||||
|
||||
$POST{'oldkeywords'} = [ split('\0', $POST{'oldkeywords'}) ];
|
||||
|
||||
unless (LJ::text_in(\%POST)) {
|
||||
return $err->("Invalid UTF-8 Input");
|
||||
}
|
||||
|
||||
my $remote = LJ::get_remote();
|
||||
return $err->($ML{'error.noremote'})
|
||||
unless $remote;
|
||||
|
||||
my $authas = $GET{'authas'} || $remote->{'user'};
|
||||
my $memoryu = LJ::get_authas_user($authas);
|
||||
return $err->($ML{'error.invalidauth'})
|
||||
unless $memoryu;
|
||||
|
||||
my %secopts = ( 'public' => $ML{'label.security.public'},
|
||||
'friends' => $ML{'label.security.friends'},
|
||||
'private' => $ML{'label.security.private'}, );
|
||||
|
||||
if ($memoryu->{'journaltype'} eq "C") {
|
||||
$secopts{'private'} = $ML{'label.security.maintainers'};
|
||||
$secopts{'friends'} = $ML{'label.security.members'};
|
||||
}
|
||||
|
||||
my $sth;
|
||||
my $journal = $GET{'journal'};
|
||||
my $ditemid = $GET{'itemid'}+0;
|
||||
|
||||
# OK. the memories schema is weird and stores *display* itemids in the database.
|
||||
# additionally, we distinguish precluster itemids because they're stored without a userid.
|
||||
# it's too late to fix it in the db, so we just work around it--
|
||||
# all new memories still get userid+ditemid because we can't change the ditemid/itemid problem,
|
||||
# but old-style itemids get fixed up to userid+ditemid.
|
||||
|
||||
# *however*, when editing old itemids we need to keep around
|
||||
# the old-style ditemid so we can still edit it.
|
||||
|
||||
# to keep this all sorted out, we fixup variables like this:
|
||||
# - itemid -- real, new-style itemid
|
||||
# - ditemid -- display itemid (with anum)
|
||||
# - dbitemid -- itemid that is in the database;
|
||||
# usually same as ditemid, but different for old-style itemids.
|
||||
|
||||
my $dbitemid = $ditemid;
|
||||
my $itemid;
|
||||
my $oldstyle = 0;
|
||||
my $ju;
|
||||
my $jid;
|
||||
|
||||
my $anum;
|
||||
|
||||
if ($journal) {
|
||||
$ju = LJ::load_user($journal);
|
||||
$jid = $ju->{'userid'};
|
||||
$anum = $ditemid % 256;
|
||||
$itemid = int($ditemid / 256);
|
||||
} else {
|
||||
# old-style item url?
|
||||
my $newids = LJ::get_newids('L', $ditemid);
|
||||
if ($newids) {
|
||||
($jid, $itemid) = @$newids;
|
||||
$ju = LJ::load_userid($jid);
|
||||
$oldstyle = 1;
|
||||
}
|
||||
}
|
||||
|
||||
unless ($ju && $itemid) {
|
||||
$title = $ML{'Error'};
|
||||
$body = $ML{'error.nojournal'};
|
||||
return;
|
||||
}
|
||||
|
||||
my $log = LJ::get_log2_row($ju, $itemid);
|
||||
unless ($log) {
|
||||
$title = $ML{'Error'};
|
||||
$body = "Error retrieving data to add a memory.";
|
||||
return;
|
||||
}
|
||||
|
||||
# check to see if it already is memorable (thus we're editing, not adding);
|
||||
my $memory = LJ::Memories::get_by_ditemid($memoryu, $oldstyle ? 0 : $jid, $ditemid);
|
||||
|
||||
if ($oldstyle) {
|
||||
# ditemid was an old-style itemid, so we update it to the new style.
|
||||
$anum = $log->{anum};
|
||||
$ditemid = $itemid<<8 + $anum;
|
||||
}
|
||||
|
||||
# get keywords user has used
|
||||
my $exist_kw = LJ::Memories::get_keywords($memoryu);
|
||||
unless ($exist_kw) {
|
||||
$title = $ML{'Error'};
|
||||
$body = "Error fetching existing keywords.";
|
||||
return;
|
||||
}
|
||||
|
||||
if ($POST{'mode'} eq "")
|
||||
{
|
||||
my ($des, $keywords);
|
||||
|
||||
my @all_keywords;
|
||||
my %selected_keyword;
|
||||
@all_keywords = sort values %$exist_kw;
|
||||
|
||||
if (defined $memory) {
|
||||
$title = $ML{'.title.edit_memory'};
|
||||
$des = $memory->{'des'};
|
||||
my $kwids = LJ::Memories::get_keywordids($memoryu, $memory->{memid}) || [];
|
||||
foreach my $kwid (@$kwids) {
|
||||
my $kw = $exist_kw->{$kwid};
|
||||
next if ($kw eq "*");
|
||||
if ($keywords) { $keywords .= ", "; }
|
||||
$keywords .= $kw;
|
||||
$selected_keyword{$kw} = 1;
|
||||
}
|
||||
if (!$log || ($jid && $log->{'anum'} != $anum))
|
||||
{
|
||||
LJ::Memories::delete_by_id($memoryu, $memory->{memid});
|
||||
LJ::Memories::updated_keywords($memoryu);
|
||||
$title = $ML{'Error'};
|
||||
$body = $ML{'.error.entry_deleted'};
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
elsif (!$log || ($jid && $log->{'anum'} != $anum))
|
||||
{
|
||||
$title = $ML{'Error'};
|
||||
$body = $ML{'error.noentry'};
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
$title = $ML{'.title.add_memory'};
|
||||
|
||||
# this is a new memory.
|
||||
my $user = LJ::get_username($log->{'journalid'});
|
||||
my $dt = substr($log->{'eventtime'}, 0, 10);
|
||||
my $item = LJ::Talk::get_journal_item($ju, $itemid);
|
||||
my $subject = $item->{'subject'};
|
||||
|
||||
$des = "$dt: $user: $subject";
|
||||
}
|
||||
|
||||
# it'd be nice to only show the authas form when adding an entry and not
|
||||
# when editing one, but if user u is logged in and has post p as a memory
|
||||
# already then wants to add it to community c, when u clicks the "add memory"
|
||||
# link on p, u gets the "edit entry" page and they need to be able to switch
|
||||
# to c.
|
||||
$body .= "<form method='get' action='memadd.bml'>\n";
|
||||
$body .= LJ::make_authas_select($remote, { 'authas' => $GET{'authas'} }) . "\n";
|
||||
$body .= LJ::html_hidden(journal => $GET{journal}) if $GET{journal};
|
||||
$body .= LJ::html_hidden(itemid => $GET{itemid});
|
||||
$body .= "</form>\n\n";
|
||||
|
||||
LJ::text_out(\$des);
|
||||
LJ::text_out(\$keywords);
|
||||
|
||||
$body .= $ML{'.add_previous'};
|
||||
|
||||
my $getextra = "?itemid=$dbitemid";
|
||||
$getextra .= "&authas=$authas" if $authas ne $remote->{'user'};
|
||||
# we still need to pass the dbitemid and not the itemid to ourself.
|
||||
$getextra .= "&journal=$journal" unless $oldstyle;
|
||||
|
||||
$body .= "<form method='post' action='memadd.bml$getextra'>";
|
||||
$body .= LJ::html_hidden(mode => "save");
|
||||
|
||||
$body .= "<table cellpadding='4'>";
|
||||
$body .= "<tr><th align='right' valign='top'>$ML{'.description'}</th><td>";
|
||||
$body .= LJ::html_text({name => 'des', value => $des, maxlength => LJ::CMAX_MEMORY, size => 40});
|
||||
$body .= "<br /><small>$ML{'.description.text'}</small></td></tr>";
|
||||
|
||||
$body .= "<tr><th align='right' valign='top'>$ML{'.keywords'}</th><td>";
|
||||
$body .= LJ::html_text({name => 'keywords', maxlength => LJ::CMAX_KEYWORD, size => 40, value => $keywords});
|
||||
$body .= "<br /><small>$ML{'.keywords.text'}</small><br />";
|
||||
|
||||
if (@all_keywords) {
|
||||
my $size = scalar(@all_keywords);
|
||||
$size = 15 if $size > 15;
|
||||
$body .= "<small>$ML{'.keywords.select'}</small><div style='margin-left: 30px;'>";
|
||||
$body .= LJ::html_select( { name => 'oldkeywords', size => $size, multiple => 1,
|
||||
selected => [ keys %selected_keyword ], noescape => 1 },
|
||||
map { (LJ::ehtml($_), LJ::ehtml($_)) } @all_keywords);
|
||||
$body .= "</div><small>$ML{'.multiple_selections'}</small>";
|
||||
} else {
|
||||
$body .= "<small>$ML{'.keywords.example'}</small>";
|
||||
}
|
||||
|
||||
$body .= "</td></tr>\n";
|
||||
$body .= "<tr><th align='right' valign='top'>$ML{'.security'}</th><td>";
|
||||
$body .= LJ::html_select({name => 'security', selected => defined $memory ? $memory->{'security'} : undef},
|
||||
map { ($_, $secopts{$_}) } qw(public friends private));
|
||||
if ($memoryu->{'journaltype'} eq "C") {
|
||||
$body .= "<br /><small>$ML{'.whocansee.comm'}</small></td></tr><tr><th></th><td>\n";
|
||||
} else {
|
||||
$body .= "<br /><small>$ML{'.whocansee'}</small></td></tr><tr><th></th><td>\n";
|
||||
}
|
||||
$body .= LJ::html_submit(undef, $ML{'.form.submit'});
|
||||
$body .= LJ::html_submit(undef, $ML{'.form.reset'}, {type => 'reset'}) if defined $memory;
|
||||
$body .= "</td></tr></table></form>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if ($POST{'mode'} eq "save")
|
||||
{
|
||||
my $dbh = LJ::get_db_writer();
|
||||
|
||||
if (! $POST{'des'}) {
|
||||
# then we're deleting.
|
||||
if (defined $memory) {
|
||||
LJ::Memories::delete_by_id($memoryu, $memory->{memid});
|
||||
LJ::Memories::updated_keywords($memoryu);
|
||||
$title = $ML{'.title.deleted'};
|
||||
$body = "<?h1 $ML{'.error.deleted.title'} h1?><?p " .
|
||||
BML::ml(".error.deleted.body", { 'desc' => $memory->{'des'} }) .
|
||||
"p?>";
|
||||
return;
|
||||
} else {
|
||||
$title = $ML{'Error'};
|
||||
$body = "<?h1 $ML{'.error.nodescription.title'} h1?><?p ";
|
||||
$body .= BML::ml('.error.nodescription.body');
|
||||
$body .= " p?>";
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
#### we're inserting/replacing now into memories
|
||||
my @keywords;
|
||||
{
|
||||
my %kws;
|
||||
foreach (split(/\s*,\s*/, $POST{'keywords'})) { $kws{$_} = 1; }
|
||||
# oldkeywords were split at the beginning
|
||||
foreach (@{$POST{'oldkeywords'}}) { $kws{$_} = 1; }
|
||||
@keywords = keys %kws;
|
||||
}
|
||||
if (scalar(@keywords) > 5) {
|
||||
$title = $ML{'Error'};
|
||||
$body = "<?h1 $ML{'Error'} h1?><?p $ML{'.error.fivekeywords'} p?>";
|
||||
return;
|
||||
}
|
||||
@keywords = grep { $_ } map { s/\s\s+/ /g; LJ::trim($_); } @keywords;
|
||||
push @keywords, "*" unless (@keywords);
|
||||
my @kwid;
|
||||
|
||||
my $needflush = 0;
|
||||
foreach my $kw (@keywords) {
|
||||
if (length($kw) > 40) {
|
||||
$title = $ML{'Error'};
|
||||
$body = "<?h1 $ML{'Error'} h1?><?p " .
|
||||
BML::ml(".error.maxsize", { 'keyword' => LJ::ehtml($kw) }) . "p?>";
|
||||
return;
|
||||
}
|
||||
|
||||
my $kwid = LJ::get_keyword_id($memoryu, $kw);
|
||||
$needflush = 1 unless defined $exist_kw->{$kwid};
|
||||
push @kwid, $kwid;
|
||||
}
|
||||
|
||||
unless (exists $secopts{$POST{'security'}}) {
|
||||
$title = $ML{'Error'};
|
||||
$body = $ML{'.error.invalid_security'};
|
||||
return;
|
||||
}
|
||||
|
||||
my $des = LJ::text_trim($POST{'des'}, LJ::BMAX_MEMORY, LJ::CMAX_MEMORY);
|
||||
my $sec = $POST{'security'};
|
||||
|
||||
# handle edits by deleting the old memory and recreating
|
||||
LJ::Memories::delete_by_id($memoryu, $memory->{memid})
|
||||
if defined $memory;
|
||||
LJ::Memories::create($memoryu, {
|
||||
journalid => $jid,
|
||||
ditemid => $ditemid,
|
||||
des => $des,
|
||||
security => $sec,
|
||||
}, \@kwid);
|
||||
LJ::Memories::updated_keywords($memoryu) if $needflush;
|
||||
|
||||
$title = $ML{'.title.added'};
|
||||
$body = "<?h1 $ML{'.body.added.header'} h1?><?p ";
|
||||
|
||||
my $backlink = LJ::item_link($ju->{user}, $itemid, $anum);
|
||||
$body .= BML::ml('.body.added.body2', {'aopts' => "href='$backlink'"});
|
||||
$body .= " p?>";
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$title = $ML{'Error'};
|
||||
$body = $ML{'error.unknownmode'};
|
||||
|
||||
return;
|
||||
_code?>
|
||||
|
||||
<?page
|
||||
title=><?_code return $title; _code?>
|
||||
body=> <?_code return $body; _code?>
|
||||
page?>
|
||||
|
||||
<?_c <LJDEP>
|
||||
link: htdocs/login.bml
|
||||
post: htdocs/tools/memadd.bml
|
||||
</LJDEP> _c?>
|
||||
261
local/htdocs/tools/recent_comments.bml
Executable file
261
local/htdocs/tools/recent_comments.bml
Executable file
@@ -0,0 +1,261 @@
|
||||
<?page
|
||||
title=>Recent Comments
|
||||
head<=
|
||||
<script src='/js/commentmanage.js'></script>
|
||||
<=head
|
||||
body<=
|
||||
<?_code
|
||||
{
|
||||
use strict;
|
||||
use vars qw(%GET %POST);
|
||||
my $ret;
|
||||
my %LJ_cmtinfo;
|
||||
|
||||
my $remote = LJ::get_remote();
|
||||
return LJ::bad_input($ML{'error.noremote'})
|
||||
unless $remote;
|
||||
|
||||
$LJ_cmtinfo{'canAdmin'} = 1;
|
||||
$LJ_cmtinfo{'remote'} = $remote->{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 .= "<form method='get' action='/tools/recent_comments.bml'>\n";
|
||||
$ret .= LJ::make_authas_select($remote, { 'authas' => $GET{'authas'} }) . "\n";
|
||||
$ret .= "</form>\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 .= "<table style='width: 50%'>";
|
||||
while (my $r = $sth->fetchrow_hashref) {
|
||||
$r->{ownerid} = $r->{journalid}; $r->{itemid} = $r->{nodeid}; # fill_items_with...multiowner required fields: ownerid, userid !
|
||||
push @posted, $r;
|
||||
$need_userid{$r->{journalid}} = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$ret .= "<div style='text-align: center'><a name='received'></a>" .
|
||||
BML::ml('Actionlink', { 'link' => "Latest Received"}) . " " .
|
||||
BML::ml('Actionlink', { 'link'=>"<a href='#posted'>Latest Posted</a>"}) . "</div>" if $u->{journaltype} eq "P";
|
||||
|
||||
|
||||
|
||||
$ret .= "<?h1 Latest Received h1?>";
|
||||
$ret .= "<?p " . (%talkids ? "Last $count comments posted in " : "No comments have been posted in ") . LJ::ljuser($u) . " p?>";
|
||||
|
||||
@recv = sort { $b->{datepostunix} <=> $a->{datepostunix} } @recv;
|
||||
my @recv_talkids = map { $_->{'jtalkid'} } @recv;
|
||||
|
||||
my %props;
|
||||
LJ::load_talk_props2($u, \@recv_talkids, \%props);
|
||||
my $comment_text = LJ::get_talktext2($u, keys %talkids);
|
||||
|
||||
my $root = LJ::journal_base($u);
|
||||
|
||||
my $us = LJ::load_userids(keys %need_userid);
|
||||
|
||||
LJ::fill_items_with_text_props(\@recv, $u, {'only_subject' => 1});
|
||||
LJ::fill_items_with_text_props(\@posted, $us, {'multiowner' => 1, 'only_subject' => 1});
|
||||
|
||||
|
||||
$ret .= "<table style='width: 100%' cellpadding='5' cellspacing='0'>";
|
||||
foreach my $r ( @recv) {
|
||||
next unless $r->{nodetype} eq "L";
|
||||
next if $r->{state} eq "D";
|
||||
|
||||
my $pu = $us->{$r->{posterid}};
|
||||
next if $pu->{statusvis} =~ /[XS]/;
|
||||
|
||||
$r->{'props'} = $props{$r->{'jtalkid'}};
|
||||
|
||||
my $lrow = $logrow{"$u->{userid} $r->{nodeid}"} ||= LJ::get_log2_row($u, $r->{'nodeid'});
|
||||
my $talkid = ($r->{'jtalkid'} << 8) + $lrow->{'anum'};
|
||||
|
||||
my $ditemid = "$root/$lrow->{ditemid}.html";
|
||||
my $talkurl = "$root/$lrow->{ditemid}.html?thread=$talkid\#t$talkid";
|
||||
|
||||
my $bgcolor = "transparent";
|
||||
my $state = "";
|
||||
if ($r->{state} eq "S") {
|
||||
$bgcolor = BML::fill_template("screenedbarcolor");
|
||||
$state = "Screened";
|
||||
} elsif ($r->{state} eq "D") {
|
||||
$state = "Deleted";
|
||||
} elsif ($r->{state} eq "F") {
|
||||
$state = "Frozen";
|
||||
}
|
||||
|
||||
my $ljcmt = $LJ_cmtinfo{$talkid} = {};
|
||||
$ljcmt->{u} = $pu->{userid} ? $pu->{user} : "";
|
||||
|
||||
$ret .= "<tr valign='top' id='ljcmtbar$talkid'><td style='width: 150px; line-height: 1.5em; border-top: 1px solid #999; background-color: $bgcolor' id='cmtbar$talkid'>";
|
||||
$ret .= ($pu->{userid} ? LJ::ljuser($pu) : "Anonymous") . "<br />";
|
||||
|
||||
$ret .= LJ::ago_text($now - $r->{datepostunix}) . "<br />";
|
||||
$ret .= "<div id='state$talkid'>$state</div>" if $r->{state} ne "D";
|
||||
|
||||
unless ($r->{state} eq "D")
|
||||
{
|
||||
$ret .= "<a href='/delcomment.bml?${jargent}id=$talkid'>" . LJ::img("btn_del", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . "</a>";
|
||||
if ($r->{'state'} ne 'F') {
|
||||
$ret .= "<a href='/talkscreen.bml?mode=freeze&${jargent}talkid=$talkid'>" . LJ::img("btn_freeze", "", { align => 'absmiddle', hspace => 2, vspace => }) . "</a>";
|
||||
}
|
||||
|
||||
if ($r->{'state'} eq 'F') {
|
||||
$ret .= "<a href='/talkscreen.bml?mode=unfreeze&${jargent}talkid=$talkid'>" . LJ::img("btn_unfreeze", "", { align => 'absmiddle', hspace => 2, vspace => }) . "</a>";
|
||||
}
|
||||
|
||||
if ($r->{'state'} ne 'S') {
|
||||
$ret .= "<a href='/talkscreen.bml?mode=screen&${jargent}talkid=$talkid'>" . LJ::img("btn_scr", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . "</a>";
|
||||
}
|
||||
|
||||
if ($r->{'state'} eq 'S') {
|
||||
$ret .= "<a href='/talkscreen.bml?mode=unscreen&${jargent}talkid=$talkid'>" . LJ::img("btn_unscr", "", { 'align' => 'absmiddle', 'hspace' => 2, 'vspace' => }) . "</a>";
|
||||
}
|
||||
}
|
||||
|
||||
# FIXME: (David?) We'll have to make talk_multi.bml understand jtalkids in multiple posts
|
||||
#$ret .= " <nobr><input type='checkbox' name='selected_$r->{jtalkid}' id='s$r->{jtalkid}' />";
|
||||
#$ret .= " <label for='s$r->{jtalkid}'>$ML{'/talkread.bml.select'}</label></nobr>";
|
||||
|
||||
$ret .= "</td><td id='ljcmt$talkid' style='text-align: left; border-top: 1px solid #999; border-left: 1px solid #999'>";
|
||||
|
||||
my $subject = $r->{'text'}->[0];
|
||||
LJ::CleanHTML::clean_subject(\$subject) if $subject ne "";
|
||||
|
||||
$ret .= "<strong style='float: left; text-decoration: underline'>$subject</strong> " if $subject ne "";
|
||||
$ret .= "<strong style='float: right'>(<a href='$ditemid'>Entry Link</a>)</strong>" unless $lrow->{ditemid} == undef;
|
||||
$ret .= "<br /><br />";
|
||||
my $subject = $comment_text->{$r->{jtalkid}}[0];
|
||||
LJ::CleanHTML::clean_subject(\$subject);
|
||||
|
||||
if ($subject && $subject !~ /^Re:\s*$/) {
|
||||
$ret .= "<cite>$subject</cite><br />";
|
||||
}
|
||||
|
||||
my $comment = $comment_text->{$r->{jtalkid}}[1];
|
||||
LJ::CleanHTML::clean_comment(\$comment, { 'preformatted' => $r->{'props'}->{'opt_preformatted'},
|
||||
'anon_comment' => !$pu });
|
||||
$ret .= "$comment<br /><br />";
|
||||
|
||||
$ret .= "(<a href='$talkurl'>Comment Link</a>) " 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 .= "<strong>(Post Deleted)</strong>";
|
||||
} elsif ($r->{'state'} eq 'F') {
|
||||
$ret .= "($ML{'talk.frozen'}) ";
|
||||
} elsif ($r->{'state'} eq "D") {
|
||||
$ret .= "<strong>(Comment Deleted)</strong>";
|
||||
} else {
|
||||
$ret .= "(<a href='$replyurl'>$ML{'talk.replytothis'}</a>) ";
|
||||
}
|
||||
|
||||
$ret .= "</td></tr>";
|
||||
|
||||
}
|
||||
$ret .= "</table>";
|
||||
|
||||
$ret .= "<?p " . BML::ml('/tools/recent_comments.bml.maxnotshown',
|
||||
{ 'current' => $count, 'max' => $LJ::TOOLS_RECENT_COMMENTS_MAX }).
|
||||
" p?>" unless $count == $LJ::TOOLS_RECENT_COMMENTS_MAX;
|
||||
|
||||
|
||||
if ($u->{journaltype} eq "P") {
|
||||
$ret .= "<div style='text-align: center; margin-top: 1em'><a name='posted'></a>" .
|
||||
BML::ml('Actionlink', { 'link'=>"<a href='#received'>Latest Received</a>"}) .
|
||||
BML::ml('Actionlink', { 'link' => "Latest Posted"}) . " " .
|
||||
"</div>";
|
||||
$ret .= "<?h1 Latest Posted h1?><?p Last $count comments " . LJ::ljuser($u) . " has posted. p?>";
|
||||
my %jcount; # jid -> ct
|
||||
$ret .= "<table style='text-align: left'>";
|
||||
$ret .= "<tr><th>Time</th><th>Location</th></tr>";
|
||||
|
||||
foreach my $r (@posted) {
|
||||
$jcount{$r->{'journalid'}}++;
|
||||
next unless $r->{'nodetype'} eq "L"; # log2 comment
|
||||
|
||||
my $ju = $us->{$r->{journalid}};
|
||||
my $lrow = $logrow{"$ju->{userid} $r->{nodeid}"} ||= LJ::get_log2_row($ju, $r->{'nodeid'});
|
||||
my $talkid = ($r->{'jtalkid'} << 8) + $lrow->{'anum'};
|
||||
|
||||
my $logurl = "$LJ::SITEROOT/users/$ju->{user}/$lrow->{ditemid}.html";
|
||||
my $talkurl = "$logurl?thread=$talkid\#t$talkid";
|
||||
|
||||
my $hr_ago = LJ::ago_text($now - $r->{'posttime'});
|
||||
my $subject;
|
||||
if (defined $lrow->{ditemid}) {
|
||||
$hr_ago = "<a href='$talkurl'>$hr_ago</a>";
|
||||
|
||||
$subject = $r->{'text'}->[0] || "$lrow->{ditemid}.html";
|
||||
LJ::CleanHTML::clean_subject(\$subject);
|
||||
$subject = "<a href='$logurl'>$subject</a>";
|
||||
} else {
|
||||
$subject = "Post Deleted";
|
||||
}
|
||||
|
||||
my $links = "[<a href='$talkurl'>Comment</a>] [<a href='$logurl'>Entry</a>]\n";
|
||||
$ret .= "<tr><td>$hr_ago</td><td>" . LJ::ljuser($ju->{user}) . ": $subject</td></tr>";
|
||||
}
|
||||
$ret .= "</table>";
|
||||
}
|
||||
|
||||
my $js_screen_color = "\"" . LJ::ejs(BML::get_template_def("screenedbarcolor")) . "\"";
|
||||
$ret .= "<script>var LJ_cmtinfo = " . LJ::js_dumper(\%LJ_cmtinfo) . ";\n" .
|
||||
"function userhook_screen_comment_ARG (talkid) { setStyle('cmtbar'+talkid, 'background', $js_screen_color); setInner('state'+talkid, 'Screened'); }\n".
|
||||
"function userhook_unscreen_comment_ARG (talkid) { setStyle('cmtbar'+talkid, 'background', 'transparent'); setInner('state'+talkid, ''); }\n".
|
||||
"function userhook_delete_comment_ARG (talkid) { hideElement('ljcmtbar'+talkid); }\n".
|
||||
"var LJVAR; if (!LJVAR) LJVAR = new Object(); LJVAR.imgprefix = \"$LJ::IMGPREFIX\";\n".
|
||||
"</script>";
|
||||
|
||||
return $@ || $ret;
|
||||
|
||||
}
|
||||
_code?>
|
||||
<=body
|
||||
page?>
|
||||
46
local/htdocs/tools/search.bml
Normal file
46
local/htdocs/tools/search.bml
Normal file
@@ -0,0 +1,46 @@
|
||||
<?page
|
||||
title=>Поиск по журналу
|
||||
body<=
|
||||
<?_code
|
||||
{
|
||||
use strict;
|
||||
use vars qw(%GET %ML);
|
||||
|
||||
my $u = defined $GET{'journal'} ? LJ::load_user($GET{'journal'}) : LJ::get_remote();
|
||||
return LJ::bad_input($ML{'error.nojournal'}) unless $u;
|
||||
|
||||
my $ljuser = LJ::ljuser($u);
|
||||
|
||||
$u = $u->{user};
|
||||
|
||||
my $ret = qq{
|
||||
<?standout
|
||||
<form action="http://blogs.yandex.ru/search.xml" method="get" style="display:inline">
|
||||
<input type="hidden" name="server" value="lj.rossia.org" />
|
||||
<input type="hidden" name="author" value="$u" />
|
||||
|
||||
<table cellpadding="3">
|
||||
<tr>
|
||||
<td align="left">Searching in:</td>
|
||||
<td align="left">$ljuser</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="left">Search for:</td>
|
||||
<td align="left"><input maxlength="256" size="45" name="text" value="" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td> </td>
|
||||
<td align="left"><input type="submit" value="Search" name="btnG" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
standout?>
|
||||
|
||||
<p>Для поиска используется <a href="http://blogs.yandex.ru/">blogs.yandex.ru</a>.</p>
|
||||
};
|
||||
|
||||
return $ret;
|
||||
}
|
||||
_code?>
|
||||
<=body
|
||||
page?>
|
||||
Reference in New Issue
Block a user