| 1 |
<?php |
<?php |
| 2 |
// $Id: troll.module,v 1.32.2.7 2009/04/24 18:31:08 deekayen Exp $ |
// $Id: troll.module,v 1.32.2.8 2009/05/04 19:06:09 deekayen Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 478 |
/** |
/** |
| 479 |
* Implementation of hook_comment(). |
* Implementation of hook_comment(). |
| 480 |
*/ |
*/ |
| 481 |
function troll_dnsbl_comment($comment, $op) { |
function troll_comment($comment, $op) { |
| 482 |
if (variable_get('troll_dnsbl_active', 0) != 1) { |
if (variable_get('troll_dnsbl_active', 0) != 1) { |
| 483 |
return; |
return; |
| 484 |
} |
} |
| 492 |
$blacklisted = _troll_dnsbl_blacklisted($ip); |
$blacklisted = _troll_dnsbl_blacklisted($ip); |
| 493 |
|
|
| 494 |
if ($blacklisted == TRUE) { |
if ($blacklisted == TRUE) { |
|
// Unpublish and enform the user. |
|
| 495 |
$operation = comment_operations('unpublish'); |
$operation = comment_operations('unpublish'); |
| 496 |
$query = $operation['unpublish'][1]; |
$query = $operation['unpublish'][1]; |
| 497 |
db_query($query, $comment->cid); |
db_query($query, $comment->cid); |
| 498 |
drupal_set_message(t('Your comment has been queued for moderation by site administrators and will be published after approval.')); |
drupal_set_message(t('Your comment has been queued for moderation by site administrators and will be published after approval.')); |
| 499 |
// log |
watchdog('troll', 'Comment unpublished for DNSBL: %subject.', array('%subject' => $comment->subject), WATCHDOG_INFO, l(t('view'), 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid))); |
|
watchdog('troll', 'Comment: unpublished %subject.', array('%subject' => $comment->subject), WATCHDOG_INFO, l(t('view'), 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid)); |
|
| 500 |
} |
} |
| 501 |
else { |
else { |
| 502 |
watchdog('troll', 'IP %ip is not blacklisted.', array('%ip' => $ip), WATCHDOG_INFO, l(t('view'), 'node/'. $comment->nid, NULL, NULL, 'comment-'. $comment->cid)); |
watchdog('troll', 'IP %ip is not blacklisted.', array('%ip' => $ip), WATCHDOG_INFO, l(t('view'), 'node/'. $comment->nid, array('fragment' => 'comment-'. $comment->cid))); |
| 503 |
} |
} |
| 504 |
return; |
return; |
| 505 |
default: |
default: |