Replacing tabs with spaces, trimming white space at EOL and newline at EOF
[squirrelmail.git] / plugins / calendar / calendar_data.php
index 8d6566808e3ef967ae16e64a9160d7f8477618fe..1441f513b401ddfd3ac57592075426aa922a9726 100644 (file)
@@ -46,18 +46,18 @@ function readcalendardata() {
             fclose ($fp);
             // this is to sort the events within a day on starttime
             $new_calendardata = array();
-           foreach($calendardata as $day => $data) {
+            foreach($calendardata as $day => $data) {
                 ksort($data, SORT_NUMERIC);
                 $new_calendardata[$day] = $data;
             }
-           $calendardata = $new_calendardata;
+            $calendardata = $new_calendardata;
         }
     }
 }
 
 //makes events persistant
 function writecalendardata() {
-    global $calendardata, $username, $data_dir, $year;
+    global $calendardata, $username, $data_dir, $year, $color;
 
     $filetmp = getHashedFile($username, $data_dir, "$username.$year.cal.tmp");
     $filename = getHashedFile($username, $data_dir, "$username.$year.cal");
@@ -67,7 +67,9 @@ function writecalendardata() {
             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);
+                if(sq_fwrite($fp, $calstr, 4096) === FALSE) {
+                        error_box(_("Could not write calendar file %s", "$username.$year.cal.tmp"), $color);
+                }
             }
 
         }
@@ -125,4 +127,4 @@ function update_event($date, $time) {
 }
 
 
-?>
+?>
\ No newline at end of file