You are here

function autoban_ban_all_form_submit in Automatic IP ban (Autoban) 7

Form submission for autoban_ban_all_form().

File

./autoban.admin.inc, line 457
Configuration for autoban module.

Code

function autoban_ban_all_form_submit($form, &$form_state) {

  // Stored number banned IP to session.
  $_SESSION['autoban_ban_all_count'] = 0;
  $rules = autoban_get_rules();
  if (!empty($rules)) {
    $operations = array();
    foreach ($rules as $rule) {
      $operations[] = array(
        'autoban_ban',
        array(
          $rule,
        ),
      );
    }
    $batch = array(
      'operations' => $operations,
      'finished' => 'autoban_ban_all_batch_finished',
      'title' => t('IP ban'),
      'file' => drupal_get_path('module', 'autoban') . '/autoban.admin.inc',
    );
    batch_set($batch);
  }
  $form_state['redirect'] = AUTOBAN_BASE_URL;
}