function ad_report_admin_validate in Advertisement 5.2
Same name and namespace in other branches
- 6.3 report/ad_report.module \ad_report_admin_validate()
- 6.2 report/ad_report.module \ad_report_admin_validate()
- 7 report/ad_report.module \ad_report_admin_validate()
Sanity check the date range.
File
- report/
ad_report.module, line 182 - Provides comprehensive charts and reports about advertising statistics.
Code
function ad_report_admin_validate($form_id, $form_values) {
if ($_POST['op'] == t('Reset report')) {
unset($_SESSION['ad_report_start']);
unset($_SESSION['ad_report_end']);
unset($_SESSION['ad_report_group']);
}
else {
$start = strtotime($form_values['start']);
$end = strtotime($form_values['end']);
if (!$start) {
form_set_error('start', t('You must enter a valid start date.'));
}
else {
if ($start >= time() - 3600) {
form_set_error('start', t('The report must start at least one hour before the current time.'));
}
else {
if ($start >= $end) {
form_set_error('start', t('The report must start before it ends.'));
}
}
}
if (!$end) {
form_set_error('end', t('You must enter a valid end date.'));
}
}
}