static function admin_bulk_comments() { $from = !isset($_GET['from']) ? "manage_comments" : "manage_spam"; if (!isset($_POST['comment'])) { Flash::warning(__("No comments selected."), "/admin/?action=" . $from); } $comments = array_keys($_POST['comment']); if (isset($_POST['delete'])) { foreach ($comments as $comment) { $comment = new Comment($comment); if ($comment->deletable()) { Comment::delete($comment->id); } } Flash::notice(__("Selected comments deleted.", "comments")); } $false_positives = array(); $false_negatives = array(); $sql = SQL::current(); $config = Config::current(); if (isset($_POST['deny'])) { foreach ($comments as $comment) { $comment = new Comment($comment); if (!$comment->editable()) { continue; } if ($comment->status == "spam") { $false_positives[] = $comment->signature; } $sql->update("comments", array("id" => $comment->id), array("status" => "denied")); } Flash::notice(__("Selected comments denied.", "comments")); } if (isset($_POST['approve'])) { foreach ($comments as $comment) { $comment = new Comment($comment); if (!$comment->editable()) { continue; } if ($comment->status == "spam") { $false_positives[] = $comment->signature; } $sql->update("comments", array("id" => $comment->id), array("status" => "approved")); } Flash::notice(__("Selected comments approved.", "comments")); } if (isset($_POST['spam'])) { foreach ($comments as $comment) { $comment = new Comment($comment); if (!$comment->editable()) { continue; } $sql->update("comments", array("id" => $comment->id), array("status" => "spam")); $false_negatives[] = $comment->signature; } Flash::notice(__("Selected comments marked as spam.", "comments")); } if (!empty($config->defensio_api_key)) { $defensio = new Defensio($config->url, $config->defensio_api_key); if (!empty($false_positives)) { $defensio->submitFalsePositives(implode(",", $false_positives)); } if (!empty($false_negatives)) { $defensio->submitFalseNegatives(implode(",", $false_negatives)); } } redirect("/admin/?action=" . $from); }