You are here

function autoban_form_validate in Automatic IP ban (Autoban) 7

Form validation for autoban_form().

File

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

Code

function autoban_form_validate($form, &$form_state) {
  $type = filter_xss(trim($form_state['values']['type']));
  $message = filter_xss(trim($form_state['values']['message']));
  if (empty($type) && empty($message)) {
    form_set_error('type', t('Type and Message can not both be empty.'));
    form_set_error('message');
  }
  $threshold = intval($form_state['values']['threshold']);
  if ($threshold < 1) {
    form_set_error('threshold', t('Threshold value must be positive integer value.'));
  }
}