You are here

function rate_settings_form in Rate 7

Admin settings form.

1 string reference to 'rate_settings_form'
rate_menu in ./rate.module
Implements hook_menu().

File

./rate.admin.inc, line 808
Rating admin

Code

function rate_settings_form($form, &$form_state) {
  $form['bot'] = array(
    '#type' => 'fieldset',
    '#title' => t('Bot detection'),
    '#description' => t('Bots can be automatically banned from voting if they rate more than a given amount of votes within one minute or hour. This threshold is configurable below. Votes from the same IP-address will be ignored forever after reaching this limit.'),
    '#collapsbile' => FALSE,
    '#collapsed' => FALSE,
  );
  $options = drupal_map_assoc(array(
    0,
    10,
    25,
    50,
    100,
    250,
    500,
    1000,
  ));
  $options[0] = t('disable');
  $form['bot'][RATE_VAR_BOT_MINUTE_THRESHOLD] = array(
    '#type' => 'select',
    '#title' => t('1 minute threshold'),
    '#options' => $options,
    '#default_value' => variable_get(RATE_VAR_BOT_MINUTE_THRESHOLD, 25),
  );
  $form['bot'][RATE_VAR_BOT_HOUR_THRESHOLD] = array(
    '#type' => 'select',
    '#title' => t('1 hour threshold'),
    '#options' => $options,
    '#default_value' => variable_get(RATE_VAR_BOT_HOUR_THRESHOLD, 250),
  );

  /* Feature planned for 1.5 release
    $form['bot'][RATE_VAR_BOT_RETROACTIVE] = array(
      '#type' => 'checkbox',
      '#title' => t('Retroactive delete votes'),
      '#default_value' => variable_get(RATE_VAR_BOT_RETROACTIVE, TRUE),
      '#description' => t('The bot detection is a retrospective process. When enabled all votes done from the bots IP will be deleted when the bot hits the threshold.'),
    );
    */
  $form['bot'][RATE_VAR_BOT_BOTSCOUT_KEY] = array(
    '#type' => 'textfield',
    '#title' => t('BotScout.com API key'),
    '#default_value' => variable_get(RATE_VAR_BOT_BOTSCOUT_KEY, ''),
    '#description' => t('Rate will check the voters IP against the BotScout database if it has an API key. You can request a key at %url.', array(
      '%url' => 'http://botscout.com/getkey.htm',
    )),
  );
  return system_settings_form($form);
}