Javascript detection no longer requires SquirrelSpell.
[squirrelmail.git] / plugins / calendar / calendar_data.php
index 737537ec112cdaa15f92c7b345d2f725e0b69642..b7934606a1cf466d005c08bbecc3a86b4b2e04b0 100644 (file)
@@ -1,14 +1,16 @@
-<?php /* Modified at 1 places by ri_once */ ?>
-<?php /* 'php' Added by ri_once */
-/*
- *  calendar_data.php
+<?php
+
+/**
+ * calendar_data.php
+ *
+ * Copyright (c) 2002 The SquirrelMail Project Team
+ * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
- *  Copyright (c) 2001 Michal Szczotka <michal@tuxy.org>
- *  Licensed under the GNU GPL. For full terms see the file COPYING.
+ * Originally contrubuted by Michal Szczotka <michal@tuxy.org>
  *
- *  functions to operate on calendar data files.
+ * functions to operate on calendar data files.
  *
- *  18 Jan 2002 Adapted to official SM rules philippe@squirrelmail.org.
+ * $Id$
  */
 
 // this is array that contains all events
@@ -28,16 +30,17 @@ function readcalendardata() {
 
     if (file_exists($filename)){
         $fp = fopen ($filename,'r');
-    }
-    if ($fp){
-        while ($fdata = fgetcsv ($fp, 4096, '|')) {
-            $calendardata[$fdata[0]][$fdata[1]] = array( 'length' => $fdata[2],
-                                                         'priority' => $fdata[3],
-                                                         'title' => $fdata[4],
-                                                         'message' => $fdata[5],
-                                                         'reminder' => $fdata[6] );
+
+        if ($fp){
+            while ($fdata = fgetcsv ($fp, 4096, '|')) {
+                $calendardata[$fdata[0]][$fdata[1]] = array( 'length' => $fdata[2],
+                                                            'priority' => $fdata[3],
+                                                            'title' => $fdata[4],
+                                                            'message' => $fdata[5],
+                                                            'reminder' => $fdata[6] );
+            }
+            fclose ($fp);
         }
-        fclose ($fp);
     }
 }
 
@@ -50,8 +53,8 @@ function writecalendardata() {
     $fp = fopen ($filetmp,"w");
     if ($fp) {
         while ( $calfoo = each ($calendardata)) {
-            while ( $calbar = each ($calfoo[value])) {
-                $calfoobar = $calendardata[$calfoo[key]][$calbar[key]];
+            while ( $calbar = each ($calfoo['value'])) {
+                $calfoobar = $calendardata[$calfoo['key']][$calbar['key']];
                 $calstr = "$calfoo[key]|$calbar[key]|$calfoobar[length]|$calfoobar[priority]|$calfoobar[title]|$calfoobar[message]|$calfoobar[reminder]\n";
                 fwrite($fp, $calstr, 4096);
             }