You are here

function autoban_settings_form_validate in Automatic IP ban (Autoban) 7

Validate handler for Autoban settings form.

File

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

Code

function autoban_settings_form_validate($form, &$form_state) {
  if ($form_state['values']['autoban_whitelist_source'] == 1) {
    $path = $form_state['values']['autoban_whitelist_file'];
    if (!($path = drupal_realpath($path)) || !is_file($path) || !is_readable($path)) {
      form_error($form['autoban_whitelist_file'], t('%name must be a local file system path which is readable by Drupal.', array(
        '%name' => $form['autoban_whitelist_file']['#title'],
      )));
    }
  }
}