A start for a new change_password master plugin. This is not finished
[squirrelmail.git] / plugins / calendar / calendar_data.php
index 82e16b860460787db81b19c572d193f15ddcac62..705e8a7168adce2782369bc4e57eae664a4ee470 100644 (file)
  * functions to operate on calendar data files.
  *
  * $Id$
+ * @package plugins
+ * @subpackage calendar
  */
 
-// this is array that contains all events
-// it is three dimensional array with fallowing structure
-// $calendardata[date][time] = array(length,priority,title,message);
+/** this is array that contains all events
+ *  it is three dimensional array with fallowing structure
+ *  $calendardata[date][time] = array(length,priority,title,message); */
 $calendardata = array();
 
-//read events into array
-//data is | delimited, just like addresbook
-//files are structured like this:
-//date|time|length|priority|title|message);
-//files are divide by year for performance increase
+/**
+ * read events into array
+ *
+ * data is | delimited, just like addressbook
+ * files are structured like this:
+ * date|time|length|priority|title|message
+ * files are divided by year for performance increase */
 function readcalendardata() {
     global $calendardata, $username, $data_dir, $year;
 
@@ -40,6 +44,13 @@ function readcalendardata() {
                                                             'reminder' => $fdata[6] );
             }
             fclose ($fp);
+            // this is to sort the events within a day on starttime
+            $new_calendardata = array();
+           foreach($calendardata as $day => $data) {
+                ksort($data, SORT_NUMERIC);
+                $new_calendardata[$day] = $data;
+            }
+           $calendardata = $new_calendardata;
         }
     }
 }