function search_log_report_form_validate in Search Log 6
Same name and namespace in other branches
- 7 search_log.admin.inc \search_log_report_form_validate()
Report filter form validation.
File
- ./
search_log.admin.inc, line 345 - Admin page callbacks file for the search_log module.
Code
function search_log_report_form_validate($form, &$form_state) {
$today = _search_log_get_time();
$from = strtotime($form_state['values']['from_date']);
if (!$from) {
$from = $today;
}
if ($from > $today) {
form_set_error('from_date', t('From date cannot be after today.'));
}
$to = strtotime($form_state['values']['to_date']);
if (!$to) {
$to = $today;
}
if ($from > $to) {
form_set_error('from_date', t('From date cannot be after To date.'));
}
if (isset($form_state['values']['modules'])) {
$modules = array_flip($form_state['values']['modules']);
unset($modules[0]);
if (count($modules) < 1) {
form_set_error('modules', t('At least one Search module must be selected.'));
}
}
if ((int) $form_state['values']['rows'] < 10) {
form_set_error('rows', t('The number of rows must be a number 10 or greater.'));
}
}