function antispam_anti_spambot_action in AntiSpam 6
Same name and namespace in other branches
- 7 antispam.module \antispam_anti_spambot_action()
Perform an anti-spambot action based on module settings.
Parameters
array Extra data, used here to enhance the logged information, for debugging purposes.:
2 calls to antispam_anti_spambot_action()
- _antispam_comment_form_validate in ./
antispam.module - Comment form validate callback; check for spambots.
- _antispam_node_form_validate in ./
antispam.module - Node form validate callback; check for spambots.
File
- ./
antispam.module, line 1097
Code
function antispam_anti_spambot_action($debug_info) {
$antispambot_action = variable_get('antispam_antispambot_action', '503');
// First action is generate a delay, if requested to.
if (($seconds = variable_get('antispam_antispambot_delay', 60)) > 0) {
sleep($seconds);
}
// If no other action was set, we're done.
if ($antispambot_action == 'none') {
return;
}
$items = array();
foreach ($debug_info as $label => $value) {
$items[] = '<strong>' . check_plain($label) . '</strong>: ' . check_plain($value);
}
// From here on, the request is killed using different methods.
if ($antispambot_action == '403d') {
drupal_access_denied();
$message = t('Spambot detected (action: 403 Forbidden).');
}
else {
if ($antispambot_action == '403') {
@header('HTTP/1.0 403 Forbidden');
print t('Access denied');
$message = t('Spambot detected (action: 403 Forbidden).');
}
else {
// 503
@header('HTTP/1.0 503 Service unavailable');
print t('Service unavailable');
$message = t('Spambot detected (action: 503 Service unavailable).');
}
}
watchdog('antispam', '%message<p>Additional information:</p>%items', array(
'%message' => $message,
'%items' => theme('item_list', $items),
));
module_invoke_all('exit');
exit;
}