You are here

function duplicate_admin_settings in Spam 5.3

1 string reference to 'duplicate_admin_settings'
duplicate_menu in filters/duplicate/duplicate.module
Drupal _menu() hook.

File

filters/duplicate/duplicate.module, line 208

Code

function duplicate_admin_settings() {
  $form['content'] = array(
    '#type' => 'fieldset',
    '#title' => t('Content'),
    '#collapsible' => TRUE,
  );
  $limits = drupal_map_assoc(range(2, 15));
  $limits[-1] = t('unlimited');
  $form['content']['duplicate_threshold'] = array(
    '#type' => 'select',
    '#title' => t('Duplication threshold'),
    '#default_value' => variable_get('duplicate_threshold', DUPLICATE_DEFAULT_THRESHOLD),
    '#options' => $limits,
    '#description' => t('Specify how many times the same identical content can be posted before it will be considered spam.  When tuning this filter, note that users may accidentally submit the same content multiple times causing an otherwise acceptible posting to be duplicated.'),
  );
  $form['content']['duplicate_post_message'] = array(
    '#type' => 'textarea',
    '#title' => t('Duplicate post message'),
    '#default_value' => variable_get('duplicate_post_message', t('<p>You have attempted to post the same identical content multiple times, causing your posts to be flagged as potential spam.  If this has happened in error, please report this error along with your IP address (%IP) to a @site site administrator.  We apologize for any inconvenience.</p>', array(
      '@site' => variable_get('site_name', 'Drupal'),
    ))),
    '#description' => t('Message to show visitors when their content has been blocked because it was posted multiple times.  The text "%IP" will be replaced by the visitors actual IP address.'),
  );
  $form['ip'] = array(
    '#type' => 'fieldset',
    '#title' => t('IP'),
    '#collapsible' => TRUE,
  );
  $limits = drupal_map_assoc(range(1, 15));
  $limits[-1] = t('unlimited');
  $form['ip']['duplicate_blacklist'] = array(
    '#type' => 'select',
    '#title' => t('IP blacklist threshold'),
    '#default_value' => variable_get('duplicate_blacklist', DUPLICATE_DEFAULT_BLACKLIST),
    '#options' => $limits,
    '#description' => t('Specify how many times a given IP address is allowed to post possible spam content before the IP address is blacklisted and prevented from posting any additional content.'),
  );
  $form['ip']['duplicate_blacklist_action'] = array(
    '#type' => 'radios',
    '#title' => t('IP blacklist action'),
    '#options' => array(
      t('Silently prevent visitor from posting'),
      t('Notify blacklisted visitor when posting, prevent from posting'),
      t('Notify blacklisted visitor, prevent from visiting site'),
    ),
    '#default_value' => variable_get('duplicate_blacklist_action', DUPLICATE_BLACKLIST_NOTIFY),
    '#description' => t('Select an action from the above options.  If notification is enabled, the user will be redirected to a custom page displaying the "Blacklisted IP message" defined below.  If you only prevent users from posting, they will be able to view all site content.  If you prevent a user from visiting your site, they will only ever see the "Blacklisted IP message".'),
  );
  $form['ip']['duplicate_blacklist_message'] = array(
    '#type' => 'textarea',
    '#title' => t('Blacklisted IP message'),
    '#default_value' => variable_get('duplicate_blacklist_message', t('<p>You are currently not allowed to post content to @site, as previous content posted by your IP address (%IP) has been flagged as potential spam.</p><p>If you have not posted spam to @site, please report this error along with your IP address to a site administrator.  We apologize for any inconvenience.</p>', array(
      '@site' => variable_get('site_name', 'Drupal'),
    ))),
    '#description' => t('Message to show visitors when their IP has been blacklisted.  The text "%IP" will be replaced by the visitors actual IP address.'),
  );
  return system_settings_form($form);
}