You are here

function watchdog_prune_admin_config_form_validate in Watchdog Prune 7

Function watchdog_prune_admin_config_form_validate

File

./watchdog_prune.module, line 132
This is the main module file for watchdog_prune.

Code

function watchdog_prune_admin_config_form_validate($form, &$form_state) {
  $prune_type = $form_state['values']['watchdog_prune_age_type'];
  if (!empty($prune_type)) {
    $prune_type = explode("\n", $prune_type);
    if (is_array($prune_type)) {
      $current_date = strtotime('today');
      foreach ($prune_type as $key => $value) {
        $watchdog_prune_settings = explode("|", $value);
        $user_entered_date = strtotime(trim($watchdog_prune_settings[1]));
        if ($current_date < $user_entered_date) {
          form_set_error('watchdog_prune_age_type', t('Incorrect value for <b>' . implode("|", $watchdog_prune_settings) . '</b> Watchdog Prune age must be older than todays date'));
        }
      }
    }
  }
}