[ Index ]
 

Code source de WebCalendar 1.0.5

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables | Statistiques

title

Body

[fermer]

/ -> import_palmdesktop.php (source)

   1  <?php
   2  
   3  // Parse the datebook file and return the data hash.
   4  //
   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);
   9    $data = array ();
  10    while ( list( $line_num, $line ) = each( $Entries ) ) {
  11      $data[] = ParseLine($line);
  12    }
  13    return $data;
  14  }
  15  
  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'" );
  21    if ( $res ) {
  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]" );
  31       }
  32    }
  33    dbi_free_result ( $res );
  34    return 1;
  35  }
  36  
  37  function ParseLine($line){
  38    list(
  39      $Entry['RecordID'],
  40      $Entry['StartTime'],
  41      $Entry['EndTime'],
  42      $Entry['Summary'],
  43      $Entry['Duration'],
  44      $Entry['Description'],
  45      $Entry['Untimed'],
  46      $Entry['Private'],
  47      $Entry['Category'],
  48      $Entry['AlarmSet'],
  49      $Entry['AlarmAdvanceAmount'],
  50      $Entry['AlarmAdvanceType'],
  51      $Entry['Repeat']['Interval'],
  52      $Entry['Repeat']['Frequency'],
  53      $Entry['Repeat']['EndTime'],
  54      $Exceptions,
  55      $Entry['Repeat']['RepeatDays'],
  56      $WeekNum,
  57        ) = explode("|", $line);
  58  
  59    if ($Exceptions) $Entry['Repeat']['Exceptions'] = explode(":",$Exceptions);
  60    if (($WeekNum == '5') && ($Entry['Repeat']['Interval'] == '3')) $Entry['Repeat']['Interval'] = '6';
  61    return $Entry;
  62  }
  63  ?>


Généré le : Fri Nov 30 19:09:19 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics