ljr/livejournal/htdocs/admin/topics/screentop_do.bml

50 lines
1.1 KiB
Plaintext
Raw Permalink Normal View History

2019-02-05 21:49:12 +00:00
<?_code
my $remote = LJ::get_remote();
unless (LJ::remote_has_priv($remote, "topicaddtopic")) {
return "You don't have access to do this, or you're not logged in.";
}
my $dbh = LJ::get_db_writer();
my $sth;
my $ret;
foreach my $field (keys %FORM)
{
next unless ($field =~ /^action:(\d+)$/);
my $act = $FORM{$field};
next if ($act eq "L");
my $topid = $1;
if ($act eq "A") {
$sth = $dbh->prepare("UPDATE topic_list SET status='on' WHERE tptopid=$topid AND status='new'");
$sth->execute;
if ($sth->rows) {
$ret .= "<B>$topid</B> approved.<BR>\n";
} else {
$ret .= "<B>$topid</B> already acted on.<BR>\n";
}
}
if ($act eq "D") {
$sth = $dbh->prepare("UPDATE topic_list SET status='deny' WHERE tptopid=$topid AND status='new'");
$sth->execute;
if ($sth->rows) {
$ret .= "<B>$topid</B> denied.<BR>\n";
} else {
$ret .= "<B>$topid</B> already acted on.<BR>\n";
}
}
}
return $ret;
_code?><?_c <LJDEP>
# None
</LJDEP> _c?>