You are here

function ip_anon_settings in IP Anonymize 6

Same name and namespace in other branches
  1. 5 ip_anon.module \ip_anon_settings()
  2. 7 ip_anon.inc \ip_anon_settings()

Configuration options for IP anonymize.

1 string reference to 'ip_anon_settings'
ip_anon_menu in ./ip_anon.module
Implementation of hook_menu().

File

./ip_anon.pages.inc, line 22
Page callbacks and utility functions for IP anonymize module.

Code

function ip_anon_settings() {
  $form = array();
  $form['ip_anon_policy'] = array(
    '#type' => 'radios',
    '#title' => t('Retention policy'),
    '#options' => array(
      0 => t('Preserve IP addresses'),
      1 => t('Anonymize IP addresses'),
    ),
    '#description' => t('This setting may be used to temporarily disable IP anonymization.'),
    '#default_value' => variable_get('ip_anon_policy', 0),
  );
  $form['ip_anon_period'] = array(
    '#type' => 'fieldset',
    '#title' => 'Retention period',
    '#description' => t('IP addresses older than the retention period will be anonymized. The flood table expects a retention period of at least @one_hour.', array(
      '@one_hour' => format_interval(3600),
    )),
  );
  $options = drupal_map_assoc(array(
    0,
    30,
    60,
    120,
    180,
    300,
    600,
    900,
    1800,
    2700,
    3600,
    5400,
    7200,
    10800,
    21600,
    32400,
    43200,
    64800,
    86400,
    172800,
    259200,
    345600,
    604800,
    1209600,
    2419200,
    4838400,
    9676800,
    31536000,
  ), 'format_interval');
  foreach (ip_anon_tables() as $table => $columns) {
    $schema = drupal_get_schema($table);
    $form['ip_anon_period']['ip_anon_period_' . $table] = array(
      '#type' => 'select',
      '#title' => t('@table table', array(
        '@table' => $table,
      )),
      '#options' => $options,
      '#default_value' => variable_get('ip_anon_period_' . $table, 10800),
      '#description' => t($schema['description']),
    );
  }
  return system_settings_form($form);
}