Index: httpbl.module =================================================================== --- httpbl.module (revision 117) +++ httpbl.module (working copy) @@ -50,8 +50,13 @@ function httpbl_menu($may_cache) { ); } else { + $httpbl_check = variable_get('httpbl_check', 0); + // Only check when 'for all users' or 'for all anonymous users' is set + if ($httpbl_check > 2 || ($httpbl_check == 2 && !$user)) { _httpbl_check(); } + + } return $items; } @@ -65,6 +70,10 @@ function httpbl_comment($comment, $op) { } switch ($op) { + case 'validate': + if (variable_get('httpbl_rejectcomments', 0)) { + _httpbl_check(); + } case 'insert': case 'update': $comment = (object)$comment; @@ -126,6 +135,13 @@ function httpbl_admin_settings() { '#description' => t('At what times the blacklist should be checked.'), ); + $form['core']['httpbl_rejectcomments'] = array( + '#type' => 'checkbox', + '#title' => t('Reject comments'), + '#default_value' => variable_get('httpbl_rejectcomments', 0), + '#description' => t('If checking on comments should blacklisted IPs have thier comments rejected (otherwise they will be moderated).'), + ); + $form['core']['httpbl_message_black'] = array( '#type' => 'textarea', '#title' => t('Blacklist message'), @@ -631,10 +647,6 @@ function httpbl_dnslookup($ip, $key = NU function _httpbl_check() { global $user; - if (variable_get('httpbl_check', 0) < 2 || (variable_get('httpbl_check', 0) == 2 && $user)) { - // Only check when 'for all users' or 'for all anonymous users' is set - return; - } // Testcases at http://www.projecthoneypot.org/httpbl_api.php // $ip = '127.1.40.1';