diff options
-rw-r--r-- | forum/utils/calendar.php | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/forum/utils/calendar.php b/forum/utils/calendar.php index 1cf8d4a..054cdf8 100644 --- a/forum/utils/calendar.php +++ b/forum/utils/calendar.php @@ -11,17 +11,26 @@ else $date = $date - (date("N", $date) - 1) * 24 * 60 * 60; if($action=="addentry") { $time = strtotime($txtdate . " " . $txttimefrom . ":00"); - $duration = strtotime($txtdate . " " . $txttimeto . ":00") - $time; - $eid = time(); - $event = new Event($eid, $title, $time, $duration, $description, $current_user->uid); - $events->add($event); - $events->write(); + if($time !== FALSE) { + $duration = strtotime($txtdate . " " . $txttimeto . ":00") - $time; + $eid = time(); + $event = new Event($eid, $title, $time, $duration, $description, $current_user->uid); + $events->add($event); + $events->write(); - if($ZEND_DIR != "") googleCalendarEvent($event); + if($ZEND_DIR != "") googleCalendarEvent($event); + + notify("calendar", "New calendar entry:\n" . $title . "\n" . date("r", $time) . "\n" . + $description . "\n" . + $FORUM_URL . "/?mode=calendar&date=" . $time); +?> + <meta http-equiv="refresh" content="0; URL=?mode=calendar&date=<?php echo $time; ?>" /> +<?php + + } else { + echo "<div class=\"error\">ERROR: Date is not in the correct format! It was NOT posted. Please try again.</div>\n"; + } - notify("calendar", "New calendar entry:\n" . $title . "\n" . date("r", $time) . "\n" . - $description . "\n" . - $FORUM_URL . "/?mode=calendar&date=" . $time); } if($action=="edit") { |