WebCalendar PHP Cross Reference Groupware Applications

Source: /import_palmdesktop.php - 91 lines - 2857 bytes - Summary - Text - Print

   1  <?php
   2  /* $Id: import_palmdesktop.php,v 1.18.2.2 2007/08/06 02:28:30 cknudsen Exp $ */
   3  
   4  /* Parse the datebook file.
   5   *
   6   * @return the data hash.
   7   */
   8  function parse_palmdesktop ( $file, $exc_private = 1 ) {
   9    $file = EscapeShellArg ( $file );
  10    $exc_private = EscapeShellArg ( $exc_private );
  11    exec ( 'perl tools/palm_datebook.pl ' . "$file $exc_private", $Entries );
  12    $data = array ();
  13    while ( list ( $line_num, $line ) = each ( $Entries ) ) {
  14      $data[] = ParseLine ( $line );
  15    }
  16    return $data;
  17  }
  18  
  19  /* Delete all Palm Events for $login to clear any events deleted in the palm.
  20   *
  21   * @return 1 if successful.
  22   */
  23  function delete_palm_events ( $login ) {
  24    $res = dbi_execute ( 'SELECT cal_id FROM webcal_import_data
  25      WHERE cal_login = ? AND cal_import_type = ?', array ( $login, 'palm' ) );
  26    if ( $res ) {
  27      while ( $row = dbi_fetch_row ( $res ) ) {
  28        dbi_execute ( 'DELETE FROM webcal_blob WHERE cal_id = ?',
  29          array ( $row[0] ) );
  30        dbi_execute ( 'DELETE FROM webcal_entry_log WHERE cal_entry_id = ?',
  31          array ( $row[0] ) );
  32        dbi_execute ( 'DELETE FROM webcal_entry_repeats WHERE cal_id = ?',
  33          array ( $row[0] ) );
  34        dbi_execute ( 'DELETE FROM webcal_entry_repeats_not WHERE cal_id = ?',
  35          array ( $row[0] ) );
  36        dbi_execute ( 'DELETE FROM webcal_import_data WHERE cal_id = ?',
  37          array ( $row[0] ) );
  38        dbi_execute ( 'DELETE FROM webcal_reminders WHERE cal_id = ?',
  39          array ( $row[0] ) );
  40        dbi_execute ( 'DELETE FROM webcal_site_extras WHERE cal_id = ?',
  41          array ( $row[0] ) );
  42        dbi_execute ( 'DELETE FROM webcal_entry_user WHERE cal_id = ?',
  43          array ( $row[0] ) );
  44        dbi_execute ( 'DELETE FROM webcal_entry WHERE cal_id = ?',
  45          array ( $row[0] ) );
  46      }
  47    }
  48    dbi_free_result ( $res );
  49    return 1;
  50  }
  51  
  52  function ParseLine ( $line ) {
  53    global $calUser;
  54  
  55    list ( // .
  56      $Entry['RecordID'],
  57      $Entry['StartTime'],
  58      $Entry['EndTime'],
  59      $Entry['Summary'],
  60      $Entry['Duration'],
  61      $Entry['Description'],
  62      $Entry['Untimed'],
  63      $Entry['Private'],
  64      $Entry['Category'],
  65      $Entry['AlarmSet'],
  66      $Entry['AlarmAdvanceAmount'],
  67      $Entry['AlarmAdvanceType'],
  68      $Entry['Repeat']['Interval'],
  69      $Entry['Repeat']['Frequency'],
  70      $Entry['Repeat']['EndTime'],
  71      $Exceptions,
  72      $Entry['Repeat']['RepeatDays'],
  73      $WeekNum,
  74      ) = explode ( '|', $line );
  75    // .
  76    // Adjust times to users Timezone if not Untimed.
  77    if ( isset ( $Entry['Untimed'] ) && $Entry['Untimed'] == 0 ) {
  78      $Entry['StartTime'] -= date ( 'Z', $Entry['StartTime'] );
  79      $Entry['EndTime'] -= date ( 'Z', $Entry['EndTime'] );
  80    }
  81  
  82    if ( $Exceptions )
  83      $Entry['Repeat']['Exceptions'] = explode ( ': ', $Exceptions );
  84  
  85    if ( ( $WeekNum == '5' ) && ( $Entry['Repeat']['Interval'] == '3' ) )
  86      $Entry['Repeat']['Interval'] = '6';
  87  
  88    return $Entry;
  89  }
  90  
  91  ?>

title

Description

title

Description

title

Description

title

title

Body