summaryrefslogtreecommitdiff
path: root/forum
diff options
context:
space:
mode:
authordeva <deva>2008-12-28 16:31:28 +0000
committerdeva <deva>2008-12-28 16:31:28 +0000
commitd6085157d11880bf1106a19a3adc34a381ba4d41 (patch)
tree0055cb35892e1167ff5b44224fb3a20ad6f4bd83 /forum
parenteb2fbadbdfd52d98fd20bcb1905d33bd7a3fd49e (diff)
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')
Diffstat (limited to 'forum')
-rw-r--r--forum/utils/calendar.php27
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&amp;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") {