]> git.mxchange.org Git - friendica.git/commitdiff
event can not end before it has started.
authorrabuzarus <>
Sun, 24 May 2015 11:33:07 +0000 (13:33 +0200)
committerrabuzarus <>
Sun, 24 May 2015 11:33:07 +0000 (13:33 +0200)
mod/events.php

index ec6d73863b0c82d98cd97b9533fb4e26f67996ad..e9e1af05d8044bd26b86ddfd99a50f736fddbdca 100644 (file)
@@ -59,21 +59,30 @@ function events_post(&$a) {
        // 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;
-
        $summary  = escape_tags(trim($_POST['summary']));
        $desc     = escape_tags(trim($_POST['desc']));
        $location = escape_tags(trim($_POST['location']));
        $type     = 'event';
 
+       $action = ($event_id == '') ? 'new' : "event/" . $event_id;
+       $onerror_url = $a->get_baseurl() . "/events/" . $action . "?summary=$summary&description=$desc&location=$location&start=$start_text&finish=$finish_text&adjust=$adjust&nofinish=$nofinish";
+
+        if(strcmp($finish,$start) < 0 && !$nofinish) {
+               notice( t('Event can not end before it has started.') . EOL);
+                if(intval($_REQUEST['preview'])) {
+                       echo( t('Event can not end before it has started.'));
+                       killme();
+               }
+               goaway($onerror_url);
+       }
+
        if((! $summary) || (! $start)) {
                notice( t('Event title and start time are required.') . EOL);
                if(intval($_REQUEST['preview'])) {
                        echo( t('Event title and start time are required.'));
                        killme();
                }
-               goaway($a->get_baseurl() . '/events/new');
+               goaway($onerror_url);
        }
 
        $share = ((intval($_POST['share'])) ? intval($_POST['share']) : 0);