function httpbl_admin_settings in http:BL 5
Same name and namespace in other branches
- 6.2 httpbl.module \httpbl_admin_settings()
- 6 httpbl.module \httpbl_admin_settings()
- 7 httpbl.admin.inc \httpbl_admin_settings()
Implementation of hook_settings().
Return value
array
1 string reference to 'httpbl_admin_settings'
- httpbl_menu in ./
httpbl.module - Implementation of hook_menu().
File
- ./
httpbl.module, line 94 - Implementation of http:BL for Drupal. It provides IP-based blacklisting through http:BL and allows linking to a honeypot.
Code
function httpbl_admin_settings() {
if (!$_POST && (!variable_get('httpbl_accesskey', NULL) || !variable_get('httpbl_check', 0))) {
drupal_set_message(t('IP blacklist lookups are currently disabled; enter your access key below and enable checks to enable blacklist lookups.'), 'error');
}
$form['core'] = array(
'#type' => 'fieldset',
'#title' => t('http:BL'),
'#description' => t('For more information about http:BL, see the <a href="http://www.projecthoneypot.org/httpbl.php">http:BL homepage</a>.'),
'#collapsible' => TRUE,
);
$form['core']['httpbl_accesskey'] = array(
'#type' => 'textfield',
'#title' => t('http:BL Access Key'),
'#default_value' => variable_get('httpbl_accesskey', NULL),
'#description' => t('Your http:BL <a href="http://www.projecthoneypot.org/httpbl_configure.php">Access Key</a>.'),
'#size' => 20,
'#maxlength' => 12,
);
$form['core']['httpbl_check'] = array(
'#type' => 'select',
'#title' => t('Check blacklist status'),
'#default_value' => variable_get('httpbl_check', 0),
'#options' => array(
t('Nowhere (disabled)'),
t('On comment forms'),
t('For anonymous users'),
t('For all users'),
),
'#description' => t('At what times the blacklist should be checked.'),
);
$form['core']['httpbl_message_black'] = array(
'#type' => 'textarea',
'#title' => t('Blacklist message'),
'#default_value' => variable_get('httpbl_message_black', "Sorry, %ip has been blacklisted by <a href=\"%ipurl\">http:BL</a>.\n%honeypot"),
'#description' => t("The message visitors will see when their IP is blacklisted. <em>%ip</em> will be replaced with the visitor's IP, <em>%ipurl</em> with a link to the Project Honeypot information page for that IP, <em>%honeypot</em> with your Honeypot link."),
);
$form['core']['httpbl_message_grey'] = array(
'#type' => 'textarea',
'#title' => t('Greylist message'),
'#default_value' => variable_get('httpbl_message_grey', "Sorry, %ip has been greylisted by <a href=\"%ipurl\">http:BL</a>.\nYou may try whitelisting on <a href=\"%whitelisturl\">%whitelisturl</a>.\n%honeypot"),
'#description' => t("The message visitors will see when their IP is greylisted. <em>%ip</em> will be replaced with the visitor's IP, <em>%ipurl</em> with a link to the Project Honeypot information page for that IP, <em>%honeypot</em> with your Honeypot link, <em>%whitelisturl</em> with the internal whitelist request URL."),
);
$form['honeypot'] = array(
'#type' => 'fieldset',
'#title' => t('Honeypot'),
'#description' => t('Your Honeypot (spam trap) settings. For more information, see the <a href="http://www.projecthoneypot.org/">Project Honey Pot homepage</a>.'),
'#collapsible' => TRUE,
);
$form['honeypot']['httpbl_footer'] = array(
'#type' => 'checkbox',
'#title' => t('Add link to footer'),
'#default_value' => variable_get('httpbl_footer', FALSE),
'#description' => t('Whether to add your Honeypot link to the footer of every page.'),
);
$form['honeypot']['httpbl_link'] = array(
'#type' => 'textfield',
'#title' => t('Project Honey Pot Link'),
'#default_value' => variable_get('httpbl_link', NULL),
'#description' => t('Your Honeypot (spam trap) link. This can be one of your own <a href="http://www.projecthoneypot.org/manage_honey_pots.php">Honey Pots</a> or a <a href="http://www.projecthoneypot.org/manage_quicklink.php">QuickLink</a>.'),
);
$form['honeypot']['httpbl_word'] = array(
'#type' => 'textfield',
'#title' => t('Link word'),
'#default_value' => variable_get('httpbl_word', 'randomness'),
'#description' => t('A random word which will be used as a link.'),
);
$form['advanced'] = array(
'#type' => 'fieldset',
'#title' => t('Advanced'),
'#collapsible' => TRUE,
'#collapsed' => TRUE,
);
$form['advanced']['httpbl_threatlevel'] = array(
'#type' => 'textfield',
'#title' => t('Greylisting threshold'),
'#default_value' => variable_get('httpbl_threatlevel', 50),
'#description' => t('Threshold for the greylisting threat level (1-255, 0 to disable greylisting)'),
'#size' => 5,
'#maxlength' => 3,
);
$form['advanced']['httpbl_log'] = array(
'#type' => 'select',
'#title' => t('Log level'),
'#default_value' => variable_get('httpbl_log', 1),
'#options' => array(
t('Only errors'),
t('Temporary whitelist requests'),
t('Grey- and blacklisted IPs'),
t('All requests (debugging)'),
),
'#description' => t('Log level for http:BL requests. Every item contains all items above it.'),
);
$form['advanced']['httpbl_stats'] = array(
'#type' => 'checkbox',
'#title' => t('Enable statistics'),
'#default_value' => variable_get('httpbl_stats', TRUE),
'#description' => t('Whether to enable counting of grey- and blacklisted requests.'),
);
$form['advanced']['httpbl_dbcache'] = array(
'#type' => 'checkbox',
'#title' => t('Enable database cache'),
'#default_value' => variable_get('httpbl_dbcache', TRUE),
'#description' => t('Whether to enable database-based caching. Note that when this is disabled, IPs that fail the temporary whitelist test cannot be banned.'),
);
return system_settings_form($form);
}