3 // Parse the datebook file and return the data hash.
5 function parse_palmdesktop ($file, $exc_private = 1) {
6 $file = EscapeShellArg($file);
7 $exc_private = EscapeShellArg($exc_private);
8 exec ("perl tools/palm_datebook.pl $file $exc_private", $Entries);
10 while ( list( $line_num, $line ) = each( $Entries ) ) {
11 $data[] = ParseLine($line);
16 // Delete all Palm Events for $login to clear any events deleted in the palm
17 // Return 1 if success
18 function delete_palm_events($login) {
19 $res = dbi_query ( "SELECT cal_id FROM webcal_import_data " .
20 "WHERE cal_login = '$login' AND cal_import_type = 'palm'" );
22 while ( $row = dbi_fetch_row ( $res ) ) {
23 dbi_query ( "DELETE FROM webcal_entry_user WHERE cal_id = $row[0]" );
24 dbi_query ( "DELETE FROM webcal_entry_repeats WHERE cal_id = $row[0]" );
25 dbi_query ( "DELETE FROM webcal_entry_repeats_not WHERE cal_id = $row[0]" );
26 dbi_query ( "DELETE FROM webcal_entry_log WHERE cal_entry_id = $row[0]" );
27 dbi_query ( "DELETE FROM webcal_site_extras WHERE cal_id = $row[0]" );
28 dbi_query ( "DELETE FROM webcal_reminder_log WHERE cal_id = $row[0]" );
29 dbi_query ( "DELETE FROM webcal_import_data WHERE cal_id = $row[0]" );
30 dbi_query ( "DELETE FROM webcal_entry WHERE cal_id = $row[0]" );
33 dbi_free_result ( $res );
37 function ParseLine($line){
44 $Entry['Description'],
49 $Entry['AlarmAdvanceAmount'],
50 $Entry['AlarmAdvanceType'],
51 $Entry['Repeat']['Interval'],
52 $Entry['Repeat']['Frequency'],
53 $Entry['Repeat']['EndTime'],
55 $Entry['Repeat']['RepeatDays'],
57 ) = explode("|", $line);
59 if ($Exceptions) $Entry['Repeat']['Exceptions'] = explode(":",$Exceptions);
60 if (($WeekNum == '5') && ($Entry['Repeat']['Interval'] == '3')) $Entry['Repeat']['Interval'] = '6';