function httpbl_requirements in http:BL 6
Same name and namespace in other branches
- 8 httpbl.install \httpbl_requirements()
- 5 httpbl.module \httpbl_requirements()
- 6.2 httpbl.module \httpbl_requirements()
- 7 httpbl.module \httpbl_requirements()
Implementation of hook_requirements().
Shows some basic usage statistics for the module.
File
- ./
httpbl.module, line 362 - Implementation of http:BL for Drupal. It provides IP-based blacklisting through http:BL and allows linking to a honeypot.
Code
function httpbl_requirements($phase) {
$requirements = array();
if ($phase == 'runtime') {
if (!variable_get('httpbl_accesskey', NULL) || !variable_get('httpbl_check', HTTPBL_CHECK_NONE)) {
$requirements['httpbl'] = array(
'description' => t('IP blacklist lookups are currently disabled; enter your access key <a href="@settings">on the settings page</a> and enable checks to enable blacklist lookups.', array(
'@settings' => url('admin/settings/httpbl'),
)),
'severity' => REQUIREMENT_ERROR,
'value' => t('Disabled'),
);
if (variable_get('httpbl_footer', FALSE)) {
$requirements['httpbl']['severity'] = REQUIREMENT_WARNING;
}
}
else {
$stat_black = variable_get('httpbl_stat_black', 0);
$stat_comment = variable_get('httpbl_stat_comment', 0);
$stat_grey = variable_get('httpbl_stat_grey', 0);
if (!variable_get('httpbl_stats', TRUE)) {
$requirements['httpbl'] = array(
'description' => t('http:BL is enabled.'),
'severity' => REQUIREMENT_OK,
'value' => t('Enabled'),
);
}
else {
if (variable_get('httpbl_check', HTTPBL_CHECK_NONE) == HTTPBL_CHECK_COMMENTS) {
$requirements['httpbl'] = array(
'description' => t('http:BL is enabled and has blocked @c comments.', array(
'@c' => $stat_comment,
)),
'severity' => REQUIREMENT_OK,
'value' => t('Enabled'),
);
}
else {
if (variable_get('httpbl_check', HTTPBL_CHECK_NONE) == HTTPBL_CHECK_ALL) {
$requirements['httpbl'] = array(
'description' => t('http:BL is enabled and has blocked @t visits (@b blacklisted and @g greylisted).', array(
'@t' => $stat_grey + $stat_black,
'@b' => $stat_black,
'@g' => $stat_grey,
)),
'severity' => REQUIREMENT_OK,
'value' => t('Enabled'),
);
}
}
}
if (!variable_get('httpbl_footer', FALSE)) {
$requirements['httpbl']['severity'] = REQUIREMENT_WARNING;
$requirements['httpbl']['description'] .= ' ' . t('However, the honeypot link is not enabled.');
}
}
$requirements['httpbl']['title'] = t('http:BL');
}
return $requirements;
}