You are here

function httpbl_admin_settings in http:BL 6

Same name and namespace in other branches
  1. 5 httpbl.module \httpbl_admin_settings()
  2. 6.2 httpbl.module \httpbl_admin_settings()
  3. 7 httpbl.admin.inc \httpbl_admin_settings()

Implementation of hook_settings().

1 string reference to 'httpbl_admin_settings'
httpbl_menu in ./httpbl.module
Implementation of hook_menu().

File

./httpbl.module, line 213
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', HTTPBL_CHECK_NONE))) {
    drupal_set_message(t('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' => 'radios',
    '#title' => t('Blacklist checks'),
    '#default_value' => variable_get('httpbl_check', HTTPBL_CHECK_NONE),
    '#options' => array(
      t('Disabled'),
      t('On comment submissions'),
      t('On all requests'),
    ),
    '#description' => t('At what times the blacklist should be checked.'),
  );
  $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('Honeypot link'),
    '#default_value' => variable_get('httpbl_link', NULL),
    '#description' => t('Your Honeypot (spam trap) link. This can be one of your <a href="http://www.projecthoneypot.org/manage_honey_pots.php">own 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_log'] = array(
    '#type' => 'checkbox',
    '#title' => t('Verbose watchdog logging'),
    '#default_value' => variable_get('httpbl_log', FALSE),
    '#description' => t('Logs all positive lookups in the watchdog.'),
  );
  $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 positive lookups. Statistics are show on the Drupal <a href="@statusreport">Status report page</a>.', array(
      '@statusreport' => url('admin/reports/status'),
    )),
  );
  $form['advanced']['httpbl_cache'] = array(
    '#type' => 'radios',
    '#title' => t('Caching'),
    '#default_value' => variable_get('httpbl_cache', HTTPBL_CACHE_DBDRUPAL),
    '#options' => array(
      t('Off'),
      t('Database cache'),
      t('Database cache and Drupal access table'),
    ),
    '#description' => t('Whether to enable database-based caching. Note that when this is disabled, IPs that fail the session whitelist test cannot be banned. The Drupal access table allows visitors to be blocked in the early stages of the bootstrap.'),
  );
  return system_settings_form($form);
}