From d6085157d11880bf1106a19a3adc34a381ba4d41 Mon Sep 17 00:00:00 2001 From: deva Date: Sun, 28 Dec 2008 16:31:28 +0000 Subject: Made calendar postings with errors be ignored, and not posted on unixtime 0. Also made calendar return to the week postined in, efter a new post has been made (instead of 'today') --- forum/utils/calendar.php | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'forum/utils/calendar.php') 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); +?> + +ERROR: Date is not in the correct format! It was NOT posted. Please try again.\n"; + } - notify("calendar", "New calendar entry:\n" . $title . "\n" . date("r", $time) . "\n" . - $description . "\n" . - $FORUM_URL . "/?mode=calendar&date=" . $time); } if($action=="edit") { -- cgit v1.2.3