You are here

function httpbl_comment in http:BL 6

Same name and namespace in other branches
  1. 5 httpbl.module \httpbl_comment()
  2. 6.2 httpbl.module \httpbl_comment()

Implementation of hook_comment().

File

./httpbl.module, line 112
Implementation of http:BL for Drupal. It provides IP-based blacklisting through http:BL and allows linking to a honeypot.

Code

function httpbl_comment($comment, $op) {
  if (variable_get('httpbl_check', HTTPBL_CHECK_NONE) != HTTPBL_CHECK_COMMENTS) {
    return;
  }
  switch ($op) {
    case 'insert':
    case 'update':
      $comment = (object) $comment;
      if (httpbl_check()) {

        // Unpublish and inform the user.
        $operation = comment_operations('unpublish');
        $query = $operation['unpublish'][1];
        db_query($query, $comment->cid);
        drupal_set_message(t('Your comment has been queued for moderation by site administrators and will be published after approval.'));

        // Add to our statistics
        if (variable_get('httpbl_stats', TRUE)) {
          variable_set('httpbl_stat_comment', variable_get('httpbl_stat_comment', 0) + 1);
        }
      }
      return;
  }
}