You are here

function ip_anon_settings in IP Anonymize 7

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

Configuration options for IP Anonymize.

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

File

./ip_anon.inc, line 23
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(
      t('Preserve IP addresses'),
      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' => t('Retention period'),
    '#description' => t('IP addresses older than the retention period will be anonymized.'),
  );
  $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,
    432000,
    518400,
    604800,
    1209600,
    1814400,
    2419200,
    2592000,
    4838400,
    5184000,
    7776000,
    9676800,
    15552000,
    23328000,
    31536000,
    2147483647,
  ), 'format_interval');
  foreach (ip_anon_tables() as $table => $columns) {
    $schema = drupal_get_schema($table);
    $schema = drupal_get_schema_unprocessed($schema['module'], $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, 21600),
      '#description' => isset($schema['description']) ? check_plain($schema['description']) : '',
    );
  }
  return system_settings_form($form);
}