body<= "; return $ret; } my $mode = $POST{'mode'}; my ($saved_comm, $saved_modid) = ("", 0); if (LJ::did_post() && ($mode eq 'approve_do' || $mode eq 'reject_do')) { my $cid = $POST{'cid'}+0; my $modid = $POST{'modid'}+0; my $c = LJ::load_userid($cid); unless ($c) { $ret .= ""; return $ret; } my $dbcm = LJ::get_cluster_master($c); unless (LJ::check_rel($c, $remote, 'M')) { $ret .= ""{'user'} ljcomm?>"}) . " p?>"; return $ret; } # use dbcm to read to minimize collisions between moderators due to replication lag my $entry = $dbcm->selectrow_hashref("SELECT * FROM modlog WHERE journalid=? AND modid=?", undef, $c->{'userid'}, $modid); my $frozen = $dbcm->selectrow_array("SELECT request_stor FROM modblob WHERE journalid=? AND modid=?", undef, $c->{'userid'}, $modid); my $req = Storable::thaw($frozen) if $frozen; unless ($frozen && $entry && $req->{'_moderate'}->{'authcode'} && $req->{'_moderate'}->{'authcode'} eq $POST{'auth'}) { $ret .= ""; return $ret; } my $poster = LJ::load_userid($entry->{'posterid'}); my ($success, $do_mail) = (0, 0); my $why_mail; my $prot_err; my $posturl; if ($mode eq 'approve_do') { my $res = LJ::Protocol::do_request('postevent', $req, \$prot_err, {'nomod'=>1, 'noauth'=>1}); if ($res) { # succeeded $success = 1; $ret .= ""; # does the poster want to know? if they have working email and notification on ($do_mail, $why_mail) = (1, 'success') if ($poster->{'opt_gettalkemail'} eq "Y" && $poster->{'status'} eq "A"); $posturl = LJ::item_link($c, $res->{'itemid'}, $res->{'anum'}) . "\n\n"; } else { $prot_err = LJ::Protocol::error_message($prot_err) if $prot_err; $ret .= ""$prot_err"}) . " p?>"; ($do_mail, $why_mail) = (1, 'proterror') if $poster->{'status'} eq "A"; } if ($POST{'preapprove'}) { LJ::set_rel($c, $poster, 'N'); $ret .= ""{'user'} ljuser?>"}) . " p?>"; } } if ($mode eq 'reject_do') { $success = 1; $ret .= ""; ($do_mail, $why_mail) = (1, 'reject') if $poster->{'status'} eq 'A'; } $do_mail = 1 unless $poster->{'statusvis'} eq 'V'; # mail the poster if ($do_mail) { my $subject="Moderated submission notification"; my $to = $poster->{'email'}; my $body = "Your message submitted to the moderated community $c->{'user'} "; if ($why_mail eq 'success') { $body .= "has been approved and successfully posted.\n\n$posturl"; } elsif ($why_mail eq 'proterror') { $body .= "has been approved, but failed to be posted due to the following protocol error:\n$prot_err\n\n"; } elsif ($why_mail eq 'reject') { $body .= "has been rejected by a moderator of that community.\n\nPlease note that replies to this email are not sent to the community's moderator(s). If you would like to discuss the reasons for your entry's rejection, you will need to contact a moderator directly.\n\n"; } if ($why_mail eq 'reject' && $POST{'why'}) { $body .= "Here are the reasons for the rejection as provided by the moderator: \n\n" . $POST{'why'} . "\n\n"; } unless ($why_mail eq 'success') { $body .= "This is the message you submitted:\n\n"; my $etime = sprintf("%04d-%02d-%02d %02d:%02d", $req->{'year'}, $req->{'mon'}, $req->{'day'}, $req->{'hour'}, $req->{'min'}); $body .= "Time: $etime\n"; $body .= "Subject: " . $req->{'subject'} . "\n"; if ($req->{'props'}->{'current_music'}) { $body .= "Current Music: " . $req->{'props'}->{'current_music'} . "\n"; } if ($req->{'props'}->{'current_mood'}) { $body .= "Current Mood: " . $req->{'props'}->{'current_mood'} . "\n"; } if ($req->{'props'}->{'picture_keyword'}) { $body .= "Picture Keyword: " . $req->{'props'}->{'picture_keyword'} . "\n"; } $body .= "Text:\n" . $req->{'event'} . "\n\n"; $body .= "Regards,\n$LJ::SITENAME Team\n\n$LJ::SITEROOT/\n"; } LJ::send_mail({ 'to' => $to, 'from' => $LJ::BOGUS_EMAIL, 'charset' => 'utf-8', 'subject' => $subject, 'body' => $body, }); } if ($success) { $saved_comm = $c->{'user'}; $saved_modid = 0; # Delete this moderated entry from the list $c->do("DELETE FROM modlog WHERE journalid=? AND modid=?", undef, $c->{'userid'}, $modid); $c->do("DELETE FROM modblob WHERE journalid=? AND modid=?", undef, $c->{'userid'}, $modid); # FALL THROUGH to showing the list of entries in this community } else { $ret .= "
";
$ret .= BML::ml('Backlink', {
'link'=>'/community/manage.bml',
'text'=>$ML{'.manage'},
}) . "
";
$ret .= BML::ml('Backlink', {
'link'=>"/community/moderate.bml?comm=$c->{'user'}",
'text'=>$ML{'.moderate'},
}) . "
";
$ret .= "
$ML{'.brlist.time'} | " . "$ML{'.brlist.poster'} | $ML{'.brlist.subject'} | " . "$ML{'.brlist.actions'} |
$_->{'logtime'} | " . "{'posterid'}}->{'user'} . " ljuser?> | " . "$subject | " . "" . BML::ml('Actionlink', { 'link'=>"$ML{'.brlist.view'}" }) . " |
";
$ret .= BML::ml('Backlink', {
'link'=>'/community/manage.bml',
'text'=>$ML{'.manage'},
}) . "
";
$ret .= BML::ml('Backlink', {
'link'=>"/community/moderate.bml?comm=$comm",
'text'=>$ML{'.moderate'},
}) . "
";
$ret .= "
"; $ret .= "
{'height'}' align='absmiddle' ". "hspace='3' title='$alt' alt=''> | "; } $ret .= "";
$ret .= BML::ml("talk.somebodywrote_comm", { 'realname' => BML::eall($up->{'name'}),
'userlink' => LJ::ljuser($up->{'user'}),
'commlink' => "{'user'} ljcomm?>" });
$etime =~ s!(\d\d\d\d)-(\d\d)-(\d\d)!LJ::date_to_view_links($c, $&)!e;
$ret .= " @ $etime"; $ret .= " |
$curname | $current{$_} |
\n";
}
### security indicator
my $sec = "";
if ($req->{'security'} eq "private") {
$sec = "";
} elsif ($req->{'security'} eq "usemask") {
$sec = "";
}
$sec .= "
\n" unless $sec eq "" or $subject;
$ret .= $sec;
if ($subject) {
LJ::CleanHTML::clean_subject(\$subject);
BML::ebml(\$subject);
$ret .= "$subject
\n";
}
$ret .= $event;
$ret .= "