" unless LJ::did_post(); my $ret; my $remote = LJ::get_remote(); my $styleid; my $stylesys = 1; ### Figure out poster/journal my ($u, $up); if ($POST{'usejournal'}) { $u = LJ::load_user($POST{'usejournal'}); $up = $POST{'user'} ? LJ::load_user($POST{'user'}) : $remote; } elsif ($POST{'user'}) { $u = LJ::load_user($POST{'user'}); } else { $u = $remote; } $up = $u unless $up; ### Set up preview variables my ($ditemid, $anum, $itemid); my %req = ( 'usejournal' => $POST{'usejournal'}, ); LJ::entry_form_decode(\%req, \%POST); my ($event, $subject) = ($req{'event'}, $req{'subject'}); LJ::CleanHTML::clean_subject(\$subject); LJ::CleanHTML::clean_event(\$event, $req{'prop_opt_preformatted'}); LJ::expand_embedded($u, $ditemid, $remote, \$event); if ($u && $up) { ### Load necessary props my @needed_props = ("stylesys", "s2_style", "url", "urlname", "opt_usesharedpic", "journaltitle", "journalsubtitle",); LJ::load_user_props($u, @needed_props); ### Determine style system to preview with my $get_styleinfo = sub { my $forceflag = 0; LJ::run_hooks("force_s1", $u, \$forceflag); if ( !$forceflag && $u->{'stylesys'} == 2 ) { return (2, $u->{'s2_style'}); } # no special case and not s2, fall through to s1 return (1, 0); }; ($stylesys, $styleid) = $get_styleinfo->(); } else { $stylesys = 1; $styleid = 0; } if ($stylesys == 1) { # 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 link talk.commentpermlink nosubject .nosubject ); foreach (keys %T) { $T{$_} = $ML{$T{$_}}; } # make the title { my $subject = $req{'subject'} || $req{'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($req{'subject'}) || 40); } $ret .= "
"; if ($u) { $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 = LJ::date_to_view_links($u, "$req{'year'}-$req{'mon'}-$req{'day'}");
$ret .= " @ $etime $req{'hour'}:$req{'min'}:00"; $ret .= " |
$curname | $current{$_} |
\n";
}
### security indicator
my $sec = "";
if ($req{'security'} eq "private") {
$sec = BML::fill_template("securityprivate");
} elsif ($req{'security'} eq "usemask") {
$sec = BML::fill_template("securityprotected");
}
$sec .= "
\n" unless $sec eq "" or $req{'subject'};
$ret .= $sec;
###
if ($subject) {
BML::ebml(\$subject);
$ret .= "$subject
\n";
}
$ret .= $event;
$ret .= "