public function action_admin_moderate_comments($action, Comments $comments, AdminHandler $handler) { $false_positives = array(); $false_negatives = array(); foreach ($comments as $comment) { switch ($action) { case 'spam': if (($comment->status == Comment::STATUS_APPROVED || $comment->status == Comment::STATUS_UNAPPROVED) && isset($comment->info->defensio_signature)) { $false_negatives[] = $comment->info->defensio_signature; } break; case 'approve': if ($comment->status == Comment::STATUS_SPAM && isset($comment->info->defensio_signature)) { $false_positives[] = $comment->info->defensio_signature; } break; } } try { if ($false_positives) { $this->defensio->report_false_positives(array('signatures' => $false_positives)); Cache::expire('defensio_stats'); $count = count($false_positives); Session::notice(sprintf(_n('Reported %d false positive to Defensio', 'Reported %d false positives to Defensio', $count, 'defensio'), $count)); } if ($false_negatives) { $this->defensio->report_false_negatives(array('signatures' => $false_negatives)); Cache::expire('defensio_stats'); $count = count($false_negatives); Session::notice(sprintf(_n('Reported %d false negative to Defensio', 'Reported %d false negatives to Defensio', $count, 'defensio'), $count)); } } catch (Exception $e) { EventLog::log($e->getMessage(), 'notice', 'comment', 'Defensio'); } }