don't allow events to finish before they begin

This commit is contained in:
Friendika 2011-09-14 23:09:09 -07:00
parent cdf2fe859f
commit 46b220518c
1 changed files with 8 additions and 1 deletions

View File

@ -45,13 +45,20 @@ function events_post(&$a) {
$finish = datetime_convert('UTC','UTC',$finish); $finish = datetime_convert('UTC','UTC',$finish);
} }
// Don't allow the event to finish before it begins.
// It won't hurt anything, but somebody will file a bug report
// and we'll waste a bunch of time responding to it. Time that
// could've been spent doing something else.
if(strcmp($finish,$start) < 0)
$finish = $start;
$desc = escape_tags(trim($_POST['desc'])); $desc = escape_tags(trim($_POST['desc']));
$location = escape_tags(trim($_POST['location'])); $location = escape_tags(trim($_POST['location']));
$type = 'event'; $type = 'event';
if((! $desc) || (! $start)) { if((! $desc) || (! $start)) {
notice('Event description and start time are required.'); notice( t('Event description and start time are required.') . EOL);
goaway($a->get_baseurl() . '/events/new'); goaway($a->get_baseurl() . '/events/new');
} }