2001-03-17 20:39:56 +01:00
|
|
|
<?php
|
|
|
|
/**************************************************************************\
|
2001-06-10 19:05:51 +02:00
|
|
|
* phpGroupWare - vCalendar Parser *
|
2001-03-17 20:39:56 +01:00
|
|
|
* http://www.phpgroupware.org *
|
2001-06-10 19:05:51 +02:00
|
|
|
* Written by Mark Peters <skeeter@phpgroupware.org> *
|
2001-03-17 20:39:56 +01:00
|
|
|
* -------------------------------------------- *
|
|
|
|
* This program is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU General Public License as published by the *
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your *
|
|
|
|
* option) any later version. *
|
|
|
|
\**************************************************************************/
|
|
|
|
|
|
|
|
/* $Id$ */
|
|
|
|
|
2001-07-02 05:31:13 +02:00
|
|
|
define('FOLD_LENGTH',75);
|
2001-06-25 00:13:17 +02:00
|
|
|
|
2001-06-10 19:05:51 +02:00
|
|
|
define('VEVENT',1);
|
|
|
|
define('VTODO',2);
|
|
|
|
|
2001-05-06 02:11:12 +02:00
|
|
|
define('NONE',0);
|
2001-06-07 05:18:35 +02:00
|
|
|
define('CHAIR',1);
|
2001-06-10 06:02:50 +02:00
|
|
|
define('REQ_PARTICIPANT',2);
|
|
|
|
define('OPT_PARTICIPANT',3);
|
|
|
|
define('NON_PARTICIPANT',4);
|
2001-06-07 05:18:35 +02:00
|
|
|
|
|
|
|
define('INDIVIDUAL',1);
|
|
|
|
define('GROUP',2);
|
|
|
|
define('RESOURCE',4);
|
|
|
|
define('ROOM',8);
|
|
|
|
define('UNKNOWN',16);
|
2001-05-06 02:11:12 +02:00
|
|
|
|
2001-06-10 19:05:51 +02:00
|
|
|
define('NEEDS_ACTION',0);
|
|
|
|
define('ACCEPTED',1);
|
|
|
|
define('DECLINED',2);
|
|
|
|
define('TENTATIVE',3);
|
|
|
|
define('DELEGATED',4);
|
|
|
|
define('COMPLETED',5);
|
|
|
|
define('IN_PROCESS',6);
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
/*
|
|
|
|
* Class
|
|
|
|
*/
|
2001-06-10 06:02:50 +02:00
|
|
|
define('PRIVATE',0);
|
|
|
|
define('PUBLIC',1);
|
2001-06-10 19:05:51 +02:00
|
|
|
define('CONFIDENTIAL',3);
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
/*
|
|
|
|
* Transparency
|
|
|
|
*/
|
2001-06-10 19:05:51 +02:00
|
|
|
define('TRANSPARENT',0);
|
|
|
|
define('OPAQUE',1);
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
/*
|
|
|
|
* Frequency
|
|
|
|
*/
|
|
|
|
define('SECONDLY',1);
|
|
|
|
define('MINUTELY',2);
|
|
|
|
define('HOURLY',3);
|
|
|
|
define('DAILY',4);
|
|
|
|
define('WEEKLY',5);
|
|
|
|
define('MONTHLY',6);
|
|
|
|
define('YEARLY',7);
|
|
|
|
|
|
|
|
define('FREE',0);
|
|
|
|
define('BUSY',1);
|
|
|
|
define('BUSY_UNAVAILABLE',2);
|
|
|
|
define('BUSY_TENTATIVE',3);
|
|
|
|
|
|
|
|
define('THISANDPRIOR',0);
|
|
|
|
define('THISANDFUTURE',1);
|
|
|
|
|
|
|
|
define('START',0);
|
|
|
|
define('END',1);
|
|
|
|
|
2001-07-02 05:31:13 +02:00
|
|
|
define('_8BIT',0);
|
|
|
|
define('_BASE64',1);
|
|
|
|
|
2001-06-10 19:05:51 +02:00
|
|
|
define('OTHER',99);
|
2001-06-10 06:02:50 +02:00
|
|
|
|
2001-07-06 05:29:29 +02:00
|
|
|
class class_mailto
|
2001-03-17 20:39:56 +01:00
|
|
|
{
|
|
|
|
var $user;
|
|
|
|
var $host;
|
|
|
|
}
|
|
|
|
|
2001-07-06 05:29:29 +02:00
|
|
|
class class_address
|
2001-03-17 20:39:56 +01:00
|
|
|
{
|
|
|
|
var $cn = 'Unknown';
|
2001-07-02 05:31:13 +02:00
|
|
|
var $dir;
|
2001-06-10 06:02:50 +02:00
|
|
|
var $cutype = INDIVIDUAL;
|
|
|
|
var $role = REQ_PARTICIPANT;
|
2001-06-10 19:05:51 +02:00
|
|
|
var $rsvp = 0;
|
2001-03-17 20:39:56 +01:00
|
|
|
var $mailto;
|
|
|
|
var $sent_by;
|
2001-06-07 05:18:35 +02:00
|
|
|
var $delegated_from;
|
|
|
|
var $delegated_to;
|
|
|
|
var $member;
|
2001-06-10 19:05:51 +02:00
|
|
|
var $partstat = NEEDS_ACTION;
|
2001-03-17 20:39:56 +01:00
|
|
|
}
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
class class_tzprop
|
|
|
|
{
|
|
|
|
var $type;
|
|
|
|
var $comment;
|
|
|
|
var $dtstart;
|
|
|
|
var $rdate;
|
|
|
|
var $rrule;
|
|
|
|
var $tzname;
|
|
|
|
var $tzoffsetfrom;
|
|
|
|
var $tzoffsetto;
|
|
|
|
var $x_type = Array();
|
|
|
|
}
|
|
|
|
|
|
|
|
class class_timezone
|
|
|
|
{
|
|
|
|
var $type;
|
|
|
|
var $tzdata;
|
|
|
|
var $last_modified;
|
|
|
|
var $tzid;
|
|
|
|
var $tzurl;
|
|
|
|
}
|
|
|
|
|
|
|
|
class class_event
|
|
|
|
{
|
|
|
|
var $type;
|
|
|
|
var $alarm;
|
|
|
|
var $attach;
|
|
|
|
var $attendee;
|
|
|
|
var $categories;
|
|
|
|
var $class;
|
|
|
|
var $comment;
|
|
|
|
var $contact;
|
|
|
|
var $created;
|
|
|
|
var $description;
|
|
|
|
var $dtend;
|
|
|
|
var $dtstamp;
|
|
|
|
var $dtstart;
|
|
|
|
var $duration;
|
|
|
|
var $exdate;
|
|
|
|
var $exrule;
|
|
|
|
var $geo;
|
|
|
|
var $last_modified;
|
|
|
|
var $location;
|
|
|
|
var $organizer;
|
|
|
|
var $priority;
|
|
|
|
var $rdate;
|
|
|
|
var $recurrence_id;
|
|
|
|
var $request_status;
|
|
|
|
var $resources;
|
|
|
|
var $rrule;
|
|
|
|
var $sequence;
|
|
|
|
var $status;
|
|
|
|
var $summary;
|
|
|
|
var $transp;
|
|
|
|
var $uid;
|
|
|
|
var $url;
|
|
|
|
var $x_type = Array();
|
|
|
|
}
|
|
|
|
|
|
|
|
class class_todo
|
|
|
|
{
|
|
|
|
var $type;
|
|
|
|
var $alarm;
|
|
|
|
var $attach;
|
|
|
|
var $attendee;
|
|
|
|
var $calscale;
|
|
|
|
var $class;
|
|
|
|
var $comment;
|
|
|
|
var $completed;
|
|
|
|
var $created;
|
|
|
|
var $description;
|
|
|
|
var $dtstamp;
|
|
|
|
var $dtstart;
|
|
|
|
var $due;
|
|
|
|
var $duration;
|
|
|
|
var $exdate;
|
|
|
|
var $exrule;
|
|
|
|
var $geo;
|
|
|
|
var $last_modified;
|
|
|
|
var $location;
|
|
|
|
var $organizer;
|
|
|
|
var $percent_coplete;
|
|
|
|
var $priority;
|
|
|
|
var $rdate;
|
|
|
|
var $recurrence_id;
|
|
|
|
var $related_to;
|
|
|
|
var $request_status;
|
|
|
|
var $resources;
|
|
|
|
var $rrule;
|
|
|
|
var $sequence;
|
|
|
|
var $summary;
|
|
|
|
var $uid;
|
|
|
|
var $url;
|
|
|
|
var $x_type = Array();
|
|
|
|
}
|
|
|
|
|
2001-07-06 05:29:29 +02:00
|
|
|
class class_datetime
|
2001-06-10 06:02:50 +02:00
|
|
|
{
|
2001-03-17 20:39:56 +01:00
|
|
|
var $year;
|
|
|
|
var $month;
|
|
|
|
var $mday;
|
|
|
|
var $hour;
|
|
|
|
var $min;
|
|
|
|
var $sec;
|
2001-07-06 14:06:44 +02:00
|
|
|
var $tzid;
|
2001-03-17 20:39:56 +01:00
|
|
|
var $date;
|
2001-07-06 14:06:44 +02:00
|
|
|
var $value;
|
2001-03-17 20:39:56 +01:00
|
|
|
var $allday = False;
|
2001-07-06 14:06:44 +02:00
|
|
|
var $x_type = Array();
|
2001-03-17 20:39:56 +01:00
|
|
|
}
|
|
|
|
|
2001-07-05 19:04:52 +02:00
|
|
|
class class_geo
|
|
|
|
{
|
|
|
|
var $lat;
|
|
|
|
var $lon;
|
|
|
|
}
|
|
|
|
|
2001-07-06 05:29:29 +02:00
|
|
|
class class_recur
|
2001-06-10 06:02:50 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
var $byday;
|
|
|
|
var $byhour;
|
|
|
|
var $byminute;
|
|
|
|
var $bymonth;
|
|
|
|
var $bymonthday;
|
|
|
|
var $bysecond;
|
|
|
|
var $bysetpos;
|
|
|
|
var $byweekno;
|
|
|
|
var $byyearday;
|
|
|
|
var $count;
|
2001-06-10 06:02:50 +02:00
|
|
|
var $freq;
|
|
|
|
var $interval;
|
2001-07-09 13:35:13 +02:00
|
|
|
var $until;
|
2001-06-10 06:02:50 +02:00
|
|
|
var $wkst;
|
2001-07-09 13:35:13 +02:00
|
|
|
var $x_type = Array();
|
2001-06-10 06:02:50 +02:00
|
|
|
}
|
|
|
|
|
2001-07-02 05:31:13 +02:00
|
|
|
class class_text
|
|
|
|
{
|
|
|
|
var $cid;
|
|
|
|
var $fmttype;
|
|
|
|
var $encoding;
|
|
|
|
var $altrep;
|
2001-07-05 19:04:52 +02:00
|
|
|
var $language;
|
2001-07-02 05:31:13 +02:00
|
|
|
var $value;
|
2001-07-09 13:35:13 +02:00
|
|
|
var $x_type = Array();
|
2001-07-02 05:31:13 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
|
2001-07-06 05:29:29 +02:00
|
|
|
class class_x_type
|
|
|
|
{
|
|
|
|
var $name;
|
|
|
|
var $value;
|
|
|
|
}
|
2001-07-02 05:31:13 +02:00
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
class class_alarm
|
|
|
|
{
|
|
|
|
var $action;
|
|
|
|
var $trigger;
|
|
|
|
var $duration;
|
|
|
|
var $repeat;
|
|
|
|
var $attach;
|
|
|
|
var $x_type = Array();
|
|
|
|
}
|
|
|
|
|
2001-06-25 00:13:17 +02:00
|
|
|
class vCalendar_item
|
2001-03-17 20:39:56 +01:00
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
var $alarm = Array();
|
|
|
|
var $attach;
|
2001-03-17 20:39:56 +01:00
|
|
|
var $attendee = Array();
|
2001-07-06 05:29:29 +02:00
|
|
|
var $calscale;
|
|
|
|
var $categories;
|
|
|
|
var $comment;
|
|
|
|
var $completed;
|
|
|
|
var $class;
|
|
|
|
var $created;
|
|
|
|
var $description;
|
2001-03-17 20:39:56 +01:00
|
|
|
var $dtend;
|
2001-07-05 19:04:52 +02:00
|
|
|
var $dtstamp;
|
2001-07-09 13:35:13 +02:00
|
|
|
var $dtstart;
|
2001-07-05 19:04:52 +02:00
|
|
|
var $due;
|
|
|
|
var $duration;
|
|
|
|
var $freebusy;
|
2001-07-06 05:29:29 +02:00
|
|
|
var $geo;
|
|
|
|
var $last_modified;
|
2001-03-17 20:39:56 +01:00
|
|
|
var $location;
|
2001-07-06 05:29:29 +02:00
|
|
|
var $organizer;
|
2001-07-05 19:04:52 +02:00
|
|
|
var $percent_complete;
|
2001-03-17 20:39:56 +01:00
|
|
|
var $priority;
|
2001-07-09 13:35:13 +02:00
|
|
|
var $rdate;
|
2001-07-05 19:04:52 +02:00
|
|
|
var $resources;
|
|
|
|
var $request_status;
|
2001-07-09 13:35:13 +02:00
|
|
|
var $rrule;
|
2001-07-06 05:29:29 +02:00
|
|
|
var $sequence;
|
|
|
|
var $status;
|
|
|
|
var $summary;
|
|
|
|
var $transp;
|
|
|
|
var $type;
|
2001-07-09 13:35:13 +02:00
|
|
|
var $tzdata = Array();
|
|
|
|
var $tzid;
|
2001-07-06 05:29:29 +02:00
|
|
|
var $tzname;
|
|
|
|
var $tzoffsetto;
|
|
|
|
var $tzoffsetfrom;
|
|
|
|
var $uid;
|
|
|
|
var $x_type = Array();
|
2001-05-06 02:11:12 +02:00
|
|
|
}
|
|
|
|
|
2001-06-10 06:02:50 +02:00
|
|
|
class vCal
|
|
|
|
{
|
|
|
|
var $prodid;
|
|
|
|
var $version;
|
|
|
|
var $method;
|
2001-07-09 13:35:13 +02:00
|
|
|
var $calscale;
|
2001-06-10 06:02:50 +02:00
|
|
|
var $event = Array();
|
2001-07-05 19:04:52 +02:00
|
|
|
var $todo = Array();
|
2001-07-06 05:29:29 +02:00
|
|
|
var $journal = Array();
|
|
|
|
var $freebusy = Array();
|
|
|
|
var $timezone = Array();
|
2001-06-10 06:02:50 +02:00
|
|
|
}
|
|
|
|
|
2001-05-06 02:11:12 +02:00
|
|
|
class vCalendar
|
|
|
|
{
|
2001-06-10 06:02:50 +02:00
|
|
|
var $vcal;
|
2001-06-25 00:13:17 +02:00
|
|
|
var $event = Array();
|
|
|
|
var $todo = Array();
|
2001-07-06 05:29:29 +02:00
|
|
|
var $journal = Array();
|
|
|
|
var $freebusy = Array();
|
|
|
|
var $timezone = Array();
|
2001-07-09 13:35:13 +02:00
|
|
|
var $property = Array();
|
|
|
|
var $parameter= Array();
|
2001-07-05 19:04:52 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Base Functions
|
|
|
|
*/
|
2001-03-17 20:39:56 +01:00
|
|
|
|
2001-07-05 19:04:52 +02:00
|
|
|
function vCalendar()
|
2001-06-07 05:18:35 +02:00
|
|
|
{
|
2001-07-05 19:04:52 +02:00
|
|
|
$this->property = Array(
|
2001-07-09 13:35:13 +02:00
|
|
|
'action' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'valarm' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'attach' => Array(
|
|
|
|
'type' => 'uri',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'valarm' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'attendee' => Array(
|
|
|
|
'type' => 'cal-address',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'valarm' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vfreebusy' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'categories' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
2001-07-09 13:35:13 +02:00
|
|
|
'multiples' => True
|
2001-07-06 05:29:29 +02:00
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
2001-07-06 05:29:29 +02:00
|
|
|
),
|
|
|
|
'class' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'comment' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
2001-07-09 13:35:13 +02:00
|
|
|
'daylight' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
2001-07-09 13:35:13 +02:00
|
|
|
'standard' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
2001-07-09 13:35:13 +02:00
|
|
|
'valarm' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
2001-07-09 13:35:13 +02:00
|
|
|
'vevent' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vfreebusy' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
2001-07-09 13:35:13 +02:00
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'completed' => Array(
|
|
|
|
'type' => 'date-time',
|
|
|
|
'to_text' => False,
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-09 13:35:13 +02:00
|
|
|
'contact' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'created' => Array(
|
|
|
|
'type' => 'date-time',
|
|
|
|
'to_text' => False,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'description' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'valarm' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'dtend' => Array(
|
|
|
|
'type' => 'date-time',
|
|
|
|
'to_text' => False,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vfreebusy' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'dtstamp' => Array(
|
|
|
|
'type' => 'date-time',
|
|
|
|
'to_text' => False,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vfreebusy' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'dtstart' => Array(
|
|
|
|
'type' => 'date-time',
|
|
|
|
'to_text' => False,
|
2001-07-09 13:35:13 +02:00
|
|
|
'daylight' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
2001-07-09 13:35:13 +02:00
|
|
|
'standard' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vevent' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vfreebusy' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
2001-07-09 13:35:13 +02:00
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
2001-07-06 05:29:29 +02:00
|
|
|
),
|
|
|
|
'due' => Array(
|
|
|
|
'type' => 'date-time',
|
|
|
|
'to_text' => False,
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'duration' => Array(
|
|
|
|
'type' => 'duration',
|
|
|
|
'to_text' => False,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'valarm' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-09 13:35:13 +02:00
|
|
|
'exdate' => Array(
|
|
|
|
'type' => 'date-time',
|
|
|
|
'to_text' => False,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'exrule' => Array(
|
|
|
|
'type' => 'recur',
|
|
|
|
'to_text' => False,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'freebusy' => Array(
|
|
|
|
'type' => 'freebusy',
|
|
|
|
'to_text' => False,
|
|
|
|
'vfreebusy' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'geo' => Array(
|
|
|
|
'type' => 'float',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'last_modified' => Array(
|
|
|
|
'type' => 'date-time',
|
|
|
|
'to_text' => False,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtimezone' => Array(
|
2001-07-09 13:35:13 +02:00
|
|
|
'state' => 'optional',
|
2001-07-06 05:29:29 +02:00
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
|
|
|
'location' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'organizer' => Array(
|
|
|
|
'type' => 'cal-address',
|
2001-07-09 13:35:13 +02:00
|
|
|
'to_text' => False,
|
2001-07-06 05:29:29 +02:00
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vfreebusy' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'percent_complete' => Array(
|
|
|
|
'type' => 'integer',
|
|
|
|
'to_text' => False,
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
|
|
|
'priority' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'type' => 'integer',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-09 13:35:13 +02:00
|
|
|
'rdate' => Array(
|
|
|
|
'type' => 'date-time',
|
|
|
|
'to_text' => False,
|
|
|
|
'daylight' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'standard' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'recurrence_id' => Array(
|
|
|
|
'type' => 'date-time',
|
|
|
|
'to_text' => False,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'related_to' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => False,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
2001-07-09 13:35:13 +02:00
|
|
|
'multiples' => True
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'request_status' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vfreebusy' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
)
|
|
|
|
),
|
2001-07-09 13:35:13 +02:00
|
|
|
'resources' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => False,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'rrule' => Array(
|
|
|
|
'type' => 'recur',
|
|
|
|
'to_text' => False,
|
2001-07-09 13:35:13 +02:00
|
|
|
'daylight' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'standard' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'sequence' => Array(
|
|
|
|
'type' => 'integer',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'status' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'summary' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'valarm' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'transp' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-09 13:35:13 +02:00
|
|
|
'trigger' => Array(
|
|
|
|
'type' => 'trigger',
|
|
|
|
'to_text' => True,
|
|
|
|
'valarm' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'tzid' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vtimezone' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'tzname' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
2001-07-09 13:35:13 +02:00
|
|
|
'daylight' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'state' => 'optional',
|
2001-07-09 13:35:13 +02:00
|
|
|
'multiples' => True
|
|
|
|
),
|
|
|
|
'standard' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'tzoffsetfrom' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'type' => 'utc-offset',
|
|
|
|
'to_text' => True,
|
2001-07-09 13:35:13 +02:00
|
|
|
'daylight' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'standard' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'tzoffsetto' => Array(
|
|
|
|
'type' => 'utc-offset',
|
|
|
|
'to_text' => True,
|
2001-07-09 13:35:13 +02:00
|
|
|
'daylight' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'standard' => Array(
|
2001-07-06 05:29:29 +02:00
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'tzurl' => Array(
|
|
|
|
'type' => 'uri',
|
|
|
|
'to_text' => True,
|
|
|
|
'vtimezone' => Array(
|
|
|
|
'state' => 'optional',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
),
|
2001-07-06 05:29:29 +02:00
|
|
|
'uid' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vjournal' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vfreebusy' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
2001-07-09 13:35:13 +02:00
|
|
|
),
|
|
|
|
'url' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'to_text' => True,
|
|
|
|
'vevent' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
|
|
|
),
|
|
|
|
'vtodo' => Array(
|
|
|
|
'state' => 'required',
|
|
|
|
'multiples' => False
|
|
|
|
)
|
2001-07-05 19:04:52 +02:00
|
|
|
)
|
|
|
|
);
|
2001-07-09 13:35:13 +02:00
|
|
|
$this->parameter = Array(
|
|
|
|
'altrep' => Array(
|
|
|
|
'type' => 'uri',
|
|
|
|
'quoted' => True,
|
|
|
|
'to_text' => True,
|
|
|
|
'properties' => Array(
|
|
|
|
'comment' => True,
|
|
|
|
'description' => True,
|
|
|
|
'location' => True,
|
|
|
|
'resources' => True,
|
|
|
|
'summary' => True,
|
|
|
|
'contact' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'byday' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'byhour' => Array(
|
|
|
|
'type' => 'string',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'byminute' => Array(
|
|
|
|
'type' => 'string',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'bymonth' => Array(
|
|
|
|
'type' => 'string',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'bymonthday' => Array(
|
|
|
|
'type' => 'string',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'bysecond' => Array(
|
|
|
|
'type' => 'string',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'bysetpos' => Array(
|
|
|
|
'type' => 'string',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'byweekno' => Array(
|
|
|
|
'type' => 'string',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'byyearday' => Array(
|
|
|
|
'type' => 'string',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'cn' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'quoted' => True,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True,
|
|
|
|
'organizer' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'count' => Array(
|
|
|
|
'type' => 'integer',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'cu' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_cu',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'delegated_from' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_mailto',
|
|
|
|
'quoted' => True,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'delegated_to' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_mailto',
|
|
|
|
'quoted' => True,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'dir' => Array(
|
|
|
|
'type' => 'dir',
|
|
|
|
'quoted' => True,
|
|
|
|
'to_text' => True,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True,
|
|
|
|
'organizer' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'enocding' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_encoding',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attach' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'fmttype' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attach' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'fbtype' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_fbtype',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attach' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'freq' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_freq',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'interval' => Array(
|
|
|
|
'type' => 'integer',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'language' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'categories' => True,
|
|
|
|
'comment' => True,
|
|
|
|
'description' => True,
|
|
|
|
'location' => True,
|
|
|
|
'resources' => True,
|
|
|
|
'summary' => True,
|
|
|
|
'tzname' => True,
|
|
|
|
'attendee' => True,
|
|
|
|
'contact' => True,
|
|
|
|
'organizer' => True,
|
|
|
|
'x-type' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'mailto' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_mailto',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True,
|
|
|
|
'organizer' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'member' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_mailto',
|
|
|
|
'quoted' => True,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'partstat' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_partstat',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'range' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_range',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'recurrence_id' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'related' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_related',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'related_to' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'role' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_role',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'rsvp' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_rsvp',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'sent_by' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'parse_user_host',
|
|
|
|
'quoted' => True,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'attendee' => True,
|
|
|
|
'organizer' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'tzid' => Array(
|
|
|
|
'type' => 'text',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'dtend' => True,
|
|
|
|
'due' => True,
|
|
|
|
'dtstart' => True,
|
|
|
|
'recurrence_id' => True,
|
|
|
|
'exdate' => True,
|
|
|
|
'rdate' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'until' => Array(
|
|
|
|
'type' => 'function',
|
|
|
|
'function' => 'switch_date',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'value' => Array(
|
|
|
|
'type' => 'value',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'calscale' => True,
|
|
|
|
'method' => True,
|
|
|
|
'prodid' => True,
|
|
|
|
'version' => True,
|
|
|
|
'attach' => True,
|
|
|
|
'categories' => True,
|
|
|
|
'class' => True,
|
|
|
|
'comment' => True,
|
|
|
|
'description' => True,
|
|
|
|
'geo' => True,
|
|
|
|
'location' => True,
|
|
|
|
'percent' => True,
|
|
|
|
'priority' => True,
|
|
|
|
'resources' => True,
|
|
|
|
'status' => True,
|
|
|
|
'summary' => True,
|
|
|
|
'completed' => True,
|
|
|
|
'dtend' => True,
|
|
|
|
'due' => True,
|
|
|
|
'dtstart' => True,
|
|
|
|
'duration' => True,
|
|
|
|
'freebusy' => True,
|
|
|
|
'transp' => True,
|
|
|
|
'tzid' => True,
|
|
|
|
'tzname' => True,
|
|
|
|
'tzoffsetfrom' => True,
|
|
|
|
'tzoffsetto' => True,
|
|
|
|
'tzurl' => True,
|
|
|
|
'attendee' => True,
|
|
|
|
'contact' => True,
|
|
|
|
'organizer' => True,
|
|
|
|
'recurrence_id' => True,
|
|
|
|
'url' => True,
|
|
|
|
'uid' => True,
|
|
|
|
'exdate' => True,
|
|
|
|
'exrule' => True,
|
|
|
|
'rdate' => True,
|
|
|
|
'rrule' => True,
|
|
|
|
'action' => True,
|
|
|
|
'repeat' => True,
|
|
|
|
'trigger' => True,
|
|
|
|
'created' => True,
|
|
|
|
'dtstamp' => True,
|
|
|
|
'last_modified' => True,
|
|
|
|
'sequence' => True,
|
|
|
|
'x_type' => True,
|
|
|
|
'request_status' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'wkst' => Array(
|
|
|
|
'type' => 'string',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'rrule' => True
|
|
|
|
)
|
|
|
|
),
|
|
|
|
'x_type' => Array(
|
|
|
|
'type' => 'x_type',
|
|
|
|
'quoted' => False,
|
|
|
|
'to_text' => False,
|
|
|
|
'properties' => Array(
|
|
|
|
'calscale' => True,
|
|
|
|
'method' => True,
|
|
|
|
'prodid' => True,
|
|
|
|
'version' => True,
|
|
|
|
'attach' => True,
|
|
|
|
'categories' => True,
|
|
|
|
'class' => True,
|
|
|
|
'comment' => True,
|
|
|
|
'description' => True,
|
|
|
|
'geo' => True,
|
|
|
|
'location' => True,
|
|
|
|
'percent' => True,
|
|
|
|
'priority' => True,
|
|
|
|
'resources' => True,
|
|
|
|
'status' => True,
|
|
|
|
'summary' => True,
|
|
|
|
'completed' => True,
|
|
|
|
'dtend' => True,
|
|
|
|
'due' => True,
|
|
|
|
'dtstart' => True,
|
|
|
|
'duration' => True,
|
|
|
|
'freebusy' => True,
|
|
|
|
'transp' => True,
|
|
|
|
'tzid' => True,
|
|
|
|
'tzname' => True,
|
|
|
|
'tzoffsetfrom' => True,
|
|
|
|
'tzoffsetto' => True,
|
|
|
|
'tzurl' => True,
|
|
|
|
'attendee' => True,
|
|
|
|
'contact' => True,
|
|
|
|
'organizer' => True,
|
|
|
|
'recurrence_id' => True,
|
|
|
|
'url' => True,
|
|
|
|
'uid' => True,
|
|
|
|
'exdate' => True,
|
|
|
|
'exrule' => True,
|
|
|
|
'rdate' => True,
|
|
|
|
'rrule' => True,
|
|
|
|
'action' => True,
|
|
|
|
'repeat' => True,
|
|
|
|
'trigger' => True,
|
|
|
|
'created' => True,
|
|
|
|
'dtstamp' => True,
|
|
|
|
'last_modified' => True,
|
|
|
|
'sequence' => True,
|
|
|
|
'x_type' => True,
|
|
|
|
'request_status' => True
|
|
|
|
)
|
|
|
|
)
|
|
|
|
);
|
2001-06-07 05:18:35 +02:00
|
|
|
}
|
|
|
|
|
2001-06-10 06:02:50 +02:00
|
|
|
function set_var(&$event,$type,$value)
|
2001-06-07 05:18:35 +02:00
|
|
|
{
|
2001-07-05 19:04:52 +02:00
|
|
|
$type = strtolower(str_replace('-','_',$type));
|
|
|
|
$event->$type = $value;
|
2001-06-07 05:18:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function unfold(&$vcal_text,$current_line)
|
|
|
|
{
|
|
|
|
$next_line = $current_line;
|
|
|
|
|
|
|
|
while(ereg("^[ \t]",substr($vcal_text[$next_line + 1],0,1)))
|
|
|
|
{
|
|
|
|
$vcal_text[$current_line] = str_replace("\r\n",'',$vcal_text[$current_line]);
|
|
|
|
$vcal_text[$current_line] .= substr($vcal_text[$next_line + 1],1);
|
2001-06-10 06:02:50 +02:00
|
|
|
$i = $next_line + 1;
|
|
|
|
while($i + 1 <= count($vcal_text))
|
2001-06-07 05:18:35 +02:00
|
|
|
{
|
2001-06-10 06:02:50 +02:00
|
|
|
$vcal_text[$i] = $vcal_text[$i + 1];
|
|
|
|
$i++;
|
2001-06-07 05:18:35 +02:00
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
// $next_line++;
|
2001-06-07 05:18:35 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-25 00:13:17 +02:00
|
|
|
function fold($str)
|
|
|
|
{
|
2001-07-02 05:31:13 +02:00
|
|
|
return chunk_split($str,FOLD_LENGTH,"\r\n");
|
2001-06-25 00:13:17 +02:00
|
|
|
}
|
|
|
|
|
2001-06-07 05:18:35 +02:00
|
|
|
function strip_quotes($str)
|
2001-03-17 20:39:56 +01:00
|
|
|
{
|
2001-06-10 19:05:51 +02:00
|
|
|
return str_replace('"','',$str);
|
2001-06-07 05:18:35 +02:00
|
|
|
}
|
2001-05-06 02:11:12 +02:00
|
|
|
|
2001-07-02 05:31:13 +02:00
|
|
|
function split_param(&$return_value,$str,$check_equal)
|
|
|
|
{
|
|
|
|
if($check_equal)
|
|
|
|
{
|
|
|
|
$str_len = strlen($str);
|
|
|
|
$i = 0;
|
|
|
|
$found = False;
|
|
|
|
while($i < $str_len)
|
|
|
|
{
|
|
|
|
$char = substr($str,$i,1);
|
|
|
|
if(ereg("^[\=\:]",$char))
|
|
|
|
{
|
|
|
|
$found = True;
|
2001-07-09 13:35:13 +02:00
|
|
|
$ret_str = substr($str,0,$i);
|
2001-07-02 05:31:13 +02:00
|
|
|
$return_value[] = $ret_str;
|
|
|
|
$ret_array = $this->explode_param(substr($str,$i + 1),'"',False);
|
|
|
|
while(list($key,$value) = each($ret_array))
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$return_value[] = $value;
|
2001-07-02 05:31:13 +02:00
|
|
|
}
|
|
|
|
$i = $str_len;
|
|
|
|
}
|
|
|
|
$i++;
|
|
|
|
}
|
|
|
|
if(!$found)
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$return_value[] = $str;
|
2001-07-02 05:31:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$return_value[] = rawurldecode($str);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function explode_param($str,$enclosure,$check_equal)
|
|
|
|
{
|
|
|
|
$enclosure_found = 0;
|
|
|
|
$start = 0;
|
|
|
|
$return_value = Array();
|
|
|
|
$str_len = strlen($str);
|
|
|
|
for($i=0;$i<$str_len;$i++)
|
|
|
|
{
|
|
|
|
$char = substr($str,$i,1);
|
|
|
|
if($char == $enclosure)
|
|
|
|
{
|
|
|
|
$enclosure_found = (~ $enclosure_found);
|
|
|
|
}
|
|
|
|
elseif(ereg("^[\;\:]",$char))
|
|
|
|
{
|
|
|
|
if(! $enclosure_found)
|
|
|
|
{
|
|
|
|
$this->split_param($return_value,substr($str,$start,($i - $start)),$check_equal);
|
|
|
|
$start = $i + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if(! $enclosure_found)
|
|
|
|
{
|
|
|
|
$this->split_param($return_value,substr($str,$start,($i - $start)),$check_equal);
|
|
|
|
}
|
|
|
|
return $return_value;
|
|
|
|
}
|
|
|
|
|
2001-07-05 19:04:52 +02:00
|
|
|
function from_text($str)
|
|
|
|
{
|
|
|
|
$str = str_replace("\\,",",",$str);
|
|
|
|
$str = str_replace("\\;",";",$str);
|
|
|
|
$str = str_replace("\\N","\n",$str);
|
|
|
|
$str = str_replace("\\n","\n",$str);
|
|
|
|
$str = str_replace("\\\\","\\",$str);
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
|
|
|
function to_text($str)
|
|
|
|
{
|
|
|
|
$str = str_replace("\\","\\\\",$str);
|
|
|
|
$str = str_replace(",","\\,",$str);
|
|
|
|
$str = str_replace(";","\\;",$str);
|
|
|
|
$str = str_replace("\n","\\n",$str);
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
function from_dir($str)
|
|
|
|
{
|
|
|
|
return str_replace('=3D','=',str_replace('%20',' ',$str));
|
|
|
|
}
|
|
|
|
|
|
|
|
function to_dir($str)
|
|
|
|
{
|
|
|
|
return str_replace('=','=3D',str_replace(' ','%20',$str));
|
|
|
|
}
|
|
|
|
|
|
|
|
function find_parameters($property)
|
|
|
|
{
|
|
|
|
reset($this->parameter);
|
|
|
|
while(list($key,$param_array) = each($this->parameter))
|
|
|
|
{
|
|
|
|
if($param_array['properties'][$property])
|
|
|
|
{
|
|
|
|
$param[] = $key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
reset($param);
|
|
|
|
return $param;
|
|
|
|
}
|
|
|
|
|
|
|
|
function find_properties($ical_type)
|
|
|
|
{
|
|
|
|
reset($this->property);
|
|
|
|
while(list($key,$param_array) = each($this->property))
|
|
|
|
{
|
|
|
|
if($param_array[$ical_type])
|
|
|
|
{
|
|
|
|
$prop[] = $key;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
reset($prop);
|
|
|
|
return $prop;
|
|
|
|
}
|
|
|
|
|
2001-07-05 19:04:52 +02:00
|
|
|
function new_vcal()
|
|
|
|
{
|
|
|
|
return new vCal;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Parse Functions
|
|
|
|
*/
|
|
|
|
|
2001-07-06 05:29:29 +02:00
|
|
|
function parse_datetime($value)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
$dtime = new class_datetime;
|
2001-07-05 19:04:52 +02:00
|
|
|
if(strpos($value,':'))
|
|
|
|
{
|
|
|
|
$pos = explode(':',$value);
|
|
|
|
$value = $pos[1];
|
|
|
|
}
|
2001-07-06 14:06:44 +02:00
|
|
|
$this->set_var($dtime,'year',intval(substr($value,0,4)));
|
|
|
|
$this->set_var($dtime,'month',intval(substr($value,4,2)));
|
|
|
|
$this->set_var($dtime,'mday',intval(substr($value,6,2)));
|
2001-07-05 19:04:52 +02:00
|
|
|
if(substr($value,8,1) == 'T')
|
|
|
|
{
|
2001-07-06 14:06:44 +02:00
|
|
|
$this->set_var($dtime,'hour',intval(substr($value,9,2)));
|
|
|
|
$this->set_var($dtime,'min',intval(substr($value,11,2)));
|
|
|
|
$this->set_var($dtime,'sec',intval(substr($value,13,2)));
|
2001-07-09 13:35:13 +02:00
|
|
|
if(strlen($value) > 14)
|
|
|
|
{
|
|
|
|
if(substr($value,14,1) != 'Z')
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* The time provided by the vCal is considered local time.
|
|
|
|
*
|
|
|
|
* The implementor will need to consider how to convert that time to UTC.
|
|
|
|
*/
|
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2001-07-06 14:06:44 +02:00
|
|
|
$this->set_var($dtime,'hour',0);
|
|
|
|
$this->set_var($dtime,'min',0);
|
|
|
|
$this->set_var($dtime,'sec',0);
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-06 14:06:44 +02:00
|
|
|
if($pos[0])
|
|
|
|
{
|
|
|
|
$return_value = $this->explode_param($pos[0],'"',True);
|
|
|
|
if(count($return_value) > 0)
|
|
|
|
{
|
|
|
|
for($i=0;$i<count($return_value);$i=$i + 2)
|
|
|
|
{
|
|
|
|
$value = $return_value[$i];
|
|
|
|
$param = $this->strip_quotes($return_value[$i+1]);
|
|
|
|
if(substr($value,0,2) != 'X-')
|
|
|
|
{
|
|
|
|
$this->set_var($dtime,$value,$param);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->parse_xtype($dtime,$value,$param);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
return $dtime;
|
|
|
|
}
|
|
|
|
|
|
|
|
function parse_geo(&$event,$value)
|
|
|
|
{
|
|
|
|
$return_value = $this->explode_param($value,'"',True);
|
|
|
|
if(count($return_value) == 2)
|
|
|
|
{
|
|
|
|
$event->lat = $return_value[0];
|
|
|
|
$event->lon = $return_value[1];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-06 05:29:29 +02:00
|
|
|
function parse_xtype(&$event,$majortype,$value)
|
|
|
|
{
|
|
|
|
$temp_x_type = new class_x_type;
|
|
|
|
$temp_x_type->name = strtoupper(substr($majortype,2));
|
|
|
|
$temp_x_type->value = $value;
|
2001-07-09 13:35:13 +02:00
|
|
|
$event->x_type[] = $temp_x_type;
|
2001-07-06 05:29:29 +02:00
|
|
|
unset($temp_x_type);
|
|
|
|
}
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
function parse_parameters(&$event,$majortype,$value)
|
2001-07-02 05:31:13 +02:00
|
|
|
{
|
|
|
|
$return_value = $this->explode_param($value,'"',True);
|
|
|
|
if(count($return_value) > 0)
|
|
|
|
{
|
|
|
|
for($i=0;$i<count($return_value);$i=$i + 2)
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$name = $return_value[$i];
|
|
|
|
$value = $this->strip_quotes($return_value[$i+1]);
|
|
|
|
if(substr($name,0,2) == 'X-')
|
2001-07-02 05:31:13 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$param = 'x_type';
|
|
|
|
$name = str_replace('-','_',$name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$param = str_replace('-','_',strtolower($name));
|
|
|
|
if(!isset($this->parameter[$param]))
|
|
|
|
{
|
|
|
|
if($majortype == 'attendee' || $majortype == 'organizer')
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$param = 'mailto';
|
|
|
|
$value = $name;
|
|
|
|
$name = $param;
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$param = 'value';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
// echo "name : $name : Param = $param<br>\n";
|
|
|
|
if(@$this->parameter[$param]['properties'][$majortype])
|
|
|
|
{
|
|
|
|
switch(@$this->parameter[$param]['type'])
|
|
|
|
{
|
|
|
|
case 'dir':
|
|
|
|
$this->set_var($event,$name,$this->from_dir($value));
|
|
|
|
break;
|
|
|
|
case 'text':
|
|
|
|
$this->set_var($event,$name,$value);
|
|
|
|
break;
|
|
|
|
case 'x_type':
|
|
|
|
$this->parse_xtype($event,$name,$value);
|
|
|
|
break;
|
|
|
|
case 'function':
|
|
|
|
$function = $this->parameter[$param]['function'];
|
|
|
|
$this->set_var($event,$name,$this->$function($value));
|
|
|
|
break;
|
|
|
|
case 'uri':
|
|
|
|
if(@$this->parameter[$param]['to_text'])
|
|
|
|
{
|
|
|
|
$value = $this->to_text($value);
|
|
|
|
}
|
|
|
|
$this->set_var($event,$name,$value);
|
|
|
|
break;
|
|
|
|
case 'integer':
|
|
|
|
$this->set_var($event,$name,intval($value));
|
|
|
|
break;
|
|
|
|
case 'value':
|
|
|
|
if($name <> "\\n")
|
|
|
|
{
|
|
|
|
$this->set_var($event,$param,$name);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2001-07-02 05:31:13 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
elseif($value <> "\\n")
|
2001-07-02 05:31:13 +02:00
|
|
|
{
|
|
|
|
$this->set_var($event,'value',$value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-05 19:04:52 +02:00
|
|
|
function parse_recurrence(&$event,$value)
|
|
|
|
{
|
|
|
|
$return_value = $this->explode_param($value,'"',True);
|
|
|
|
if(count($return_value) > 0)
|
|
|
|
{
|
|
|
|
for($i=0;$i<count($return_value);$i=$i + 2)
|
|
|
|
{
|
|
|
|
$type[0] = $return_value[$i];
|
|
|
|
$type[1] = $this->strip_quotes($return_value[$i+1]);
|
2001-07-06 14:06:44 +02:00
|
|
|
$this->set_var($event,strtolower($type[0]),$type[1]);
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Build-Card Functions
|
|
|
|
*/
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
function build_xtype($x_type,$seperator='=')
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$quote = '';
|
|
|
|
if($seperator == '=')
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$quote = '"';
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
|
|
|
|
return $this->fold('X-'.$x_type->name.$seperator.$quote.$x_type->value.$quote);
|
|
|
|
}
|
|
|
|
|
|
|
|
function build_cal_address($event,$property)
|
|
|
|
{
|
|
|
|
$str = '';
|
|
|
|
$include_mailto = False;
|
|
|
|
$include_datetime = False;
|
|
|
|
$param = $this->find_parameters($property);
|
|
|
|
while(list($dumb_key,$key) = each($param))
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
if($key == 'mailto')
|
|
|
|
{
|
|
|
|
$include_mailto = True;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$param_array = @$this->parameter[$key];
|
|
|
|
$type = @$param_array['type'];
|
|
|
|
if($type == 'date-time')
|
|
|
|
{
|
|
|
|
$include_datetime = True;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$quote = (@$param_array['quoted']?'"':'');
|
|
|
|
if(!empty($event->$key) && @$param_array['properties'][$property])
|
|
|
|
{
|
|
|
|
$change_text = @$param_array['to_text'];
|
|
|
|
$value = $event->$key;
|
|
|
|
if($change_text && $type == 'text')
|
|
|
|
{
|
|
|
|
$value = $this->to_text($value);
|
|
|
|
}
|
|
|
|
switch($type)
|
|
|
|
{
|
|
|
|
case 'dir':
|
|
|
|
$str .= ';'.str_replace('_','-',strtoupper($key)).'='.$quote.$this->to_dir($value).$quote;
|
|
|
|
break;
|
|
|
|
case 'function':
|
|
|
|
$str .= ';'.str_replace('_','-',strtoupper($key)).'=';
|
|
|
|
$function = @$param_array['function'];
|
|
|
|
$str .= $quote.$this->$function($value).$quote;
|
|
|
|
break;
|
|
|
|
case 'text':
|
|
|
|
$str .= ';'.strtoupper($key).'='.$quote.$value.$quote;
|
|
|
|
break;
|
|
|
|
case 'date-time':
|
|
|
|
$str .= ':'.date('Ymd\THms\Z',mktime($event->hour,$event->min,$event->sec,$event->month,$event->mday,$event->year));
|
|
|
|
|
|
|
|
}
|
|
|
|
unset($value);
|
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
|
|
|
|
if(!empty($event->x_type))
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
for($j=0;$j<count($event->x_type);$j++)
|
|
|
|
{
|
|
|
|
$str .= ';'.$this->build_xtype($event->x_type[$j],'=');
|
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
if(!empty($event->value))
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
if($to_text)
|
|
|
|
{
|
|
|
|
$event->value = $this->to_text($event->value);
|
|
|
|
}
|
|
|
|
$str .= ':'.$event->value;
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
if($include_mailto == True)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$key = 'mailto';
|
|
|
|
$function = $this->parameter[$key]['function'];
|
|
|
|
$str .= ':'.$this->$function($event->$key);
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
if($include_datetime == True || @$this->property[$property]['type'] == 'date-time')
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$str .= ':'.date('Ymd\THms\Z',mktime($event->hour,$event->min,$event->sec,$event->month,$event->mday,$event->year));
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
function build_text($event,$property)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
|
|
|
$str = '';
|
2001-07-09 13:35:13 +02:00
|
|
|
$param = $this->find_parameters($property);
|
|
|
|
while(list($dumb_key,$key) = each($param))
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
if(!empty($event->$key))
|
|
|
|
{
|
|
|
|
$type = @$this->parameter[$key]['type'];
|
|
|
|
$quote = @$this->parameter[$key]['quote'];
|
|
|
|
if(@$this->parameter[$key]['to_text'] == True)
|
|
|
|
{
|
|
|
|
$value = $this->to_text($event->$key);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$value = $event->$key;
|
|
|
|
}
|
|
|
|
switch($type)
|
|
|
|
{
|
|
|
|
case 'text':
|
|
|
|
$str .= ';'.strtoupper($key).'='.$quote.$value.$quote;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
if(!empty($event->x_type))
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
for($j=0;$j<count($event->x_type);$j++)
|
|
|
|
{
|
|
|
|
$str .= ';'.$this->build_xtype($event->x_type[$j],'=');
|
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
|
|
|
if(!empty($event->value))
|
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
if($to_text)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
|
|
|
$event->value = $this->to_text($event->value);
|
|
|
|
}
|
|
|
|
$str .= ':'.$event->value;
|
|
|
|
}
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
2001-07-06 05:29:29 +02:00
|
|
|
function build_recur($event)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
|
|
|
$var = Array(
|
|
|
|
'freq',
|
|
|
|
'count',
|
|
|
|
'wkst',
|
|
|
|
'byday'
|
|
|
|
);
|
|
|
|
for($i=0;$i<count($var);$i++)
|
|
|
|
{
|
|
|
|
iF(!empty($event->{$var[$i]}))
|
|
|
|
{
|
|
|
|
$str[] = strtoupper($var[$i]).'='.$event->{$var[$i]};
|
|
|
|
}
|
|
|
|
}
|
2001-07-06 05:29:29 +02:00
|
|
|
$recur = ':'.implode($str,';');
|
|
|
|
return $recur;
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
|
|
|
|
2001-07-06 05:29:29 +02:00
|
|
|
function build_datetime($event)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
return ':'.date('Ymd\THms\Z',mktime($event->hour,$event->min,$event->sec,$event->month,$event->mday,$event->year));
|
|
|
|
}
|
|
|
|
|
2001-07-05 19:04:52 +02:00
|
|
|
function build_card_internals($ical_item,$event)
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$prop = $this->find_properties($ical_item);
|
|
|
|
reset($prop);
|
|
|
|
while(list($dumb_key,$key) = each($prop))
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
|
|
|
$value = $key;
|
2001-07-09 13:35:13 +02:00
|
|
|
$varray = $this->property[$key];
|
2001-07-05 19:04:52 +02:00
|
|
|
$type = $varray['type'];
|
2001-07-06 05:29:29 +02:00
|
|
|
$to_text = $varray['to_text'];
|
|
|
|
$state = @$varray[$ical_item]['state'];
|
|
|
|
$multiples = @$varray[$ical_item]['multiples'];
|
2001-07-09 13:35:13 +02:00
|
|
|
switch($type)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'date-time':
|
|
|
|
if(!empty($event->$value))
|
|
|
|
{
|
|
|
|
if($multiples)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
|
|
|
for($i=0;$i<count($event->$value);$i++)
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
// $str .= $this->fold(strtoupper($value).$this->build_datetime($event->{$value}[$i]));
|
|
|
|
$str .= $this->fold(strtoupper($value).$this->build_cal_address($event->{$value}[$i],$value));
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
else
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
// $str .= $this->fold(strtoupper($value).$this->build_datetime($event->$value));
|
|
|
|
$str .= $this->fold(strtoupper($value).$this->build_cal_address($event->$value,$value));
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
}
|
|
|
|
elseif($value == 'dtstamp' || $value == 'created')
|
|
|
|
{
|
|
|
|
$str .= $this->fold(strtoupper($value).':'.gmdate('Ymd\THms\Z'));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'uri':
|
|
|
|
if(!empty($event->$value))
|
|
|
|
{
|
|
|
|
for($i=0;$i<count($event->$value);$i++)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$str .= $this->fold(strtoupper($value).$this->build_text($event->{$value}[$i],$to_text));
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'recur':
|
|
|
|
if(!empty($event->$value))
|
|
|
|
{
|
|
|
|
if($multiples)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
for($i=0;$i<count($event->$value);$i++)
|
|
|
|
{
|
|
|
|
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).$this->build_recur($event->{$value}[$i]));
|
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
else
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).$this->build_recur($event->$value));
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'integer':
|
|
|
|
if(!empty($event->$value))
|
|
|
|
{
|
|
|
|
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).':'.$event->$value);
|
|
|
|
}
|
|
|
|
elseif($value == 'sequence' || $value == 'percent_complete')
|
|
|
|
{
|
|
|
|
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).':0');
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'float':
|
|
|
|
if(!empty($event->$value))
|
|
|
|
{
|
|
|
|
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).':'.$event->$value->lat.';'.$event->$value->lon);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'text':
|
|
|
|
// if(empty($event->$value) && $state == 'required')
|
|
|
|
// {
|
|
|
|
// return '';
|
|
|
|
// }
|
|
|
|
if(!empty($event->$value))
|
|
|
|
{
|
|
|
|
if($multiples)
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
for($i=0;$i<count($event->$value);$i++)
|
2001-07-06 05:29:29 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
// $str .= $this->fold(strtoupper(str_replace('_','-',$value)).$this->build_text($event->{$value}[$i],$to_text));
|
|
|
|
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).$this->build_cal_address($event->{$value}[$i],$value));
|
2001-07-06 05:29:29 +02:00
|
|
|
}
|
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
else
|
2001-07-06 05:29:29 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
// $str .= $this->fold(strtoupper(str_replace('_','-',$value)).$this->build_text($event->$value,$to_text));
|
|
|
|
$str .= $this->fold(strtoupper(str_replace('_','-',$value)).$this->build_cal_address($event->$value,$value));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'cal-address':
|
|
|
|
if(!empty($event->$value))
|
|
|
|
{
|
|
|
|
for($j=0;$j<count($event->$value);$j++)
|
|
|
|
{
|
|
|
|
$temp_output = $this->build_cal_address($event->{$value}[$j],$value);
|
|
|
|
if($temp_output)
|
2001-07-06 05:29:29 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$str .= $this->fold(strtoupper($value).$temp_output);
|
2001-07-06 05:29:29 +02:00
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
}
|
|
|
|
break;
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
|
|
|
}
|
2001-07-06 05:29:29 +02:00
|
|
|
if(!empty($event->x_type))
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
for($i=0;$i<count($event->x_type);$i++)
|
|
|
|
{
|
|
|
|
$str .= $this->build_xtype($event->x_type[$i],':');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if($ical_item == 'vtimezone')
|
|
|
|
{
|
|
|
|
if($event->tzdata)
|
|
|
|
{
|
|
|
|
for($k=0;$k<count($event->tzdata);$k++)
|
|
|
|
{
|
|
|
|
$str .= 'BEGIN:'.strtoupper($event->tzdata[$k]->type)."\r\n";
|
|
|
|
$str .= $this->build_card_internals(strtolower($event->tzdata[$k]->type),$event->tzdata[$k]);
|
|
|
|
$str .= 'END:'.strtoupper($event->tzdata[$k]->type)."\r\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Switching Functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
function switch_class($var)
|
|
|
|
{
|
|
|
|
if(is_string($var))
|
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case 'PRIVATE':
|
|
|
|
return PRIVATE;
|
|
|
|
break;
|
|
|
|
case 'PUBLIC':
|
|
|
|
return PUBLIC;
|
|
|
|
break;
|
|
|
|
case 'CONFIDENTIAL':
|
|
|
|
return CONFIDENTIAL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif(is_int($var))
|
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case PRIVATE:
|
|
|
|
return 'PRIVATE';
|
|
|
|
break;
|
|
|
|
case PUBLIC:
|
|
|
|
return 'PUBLIC';
|
|
|
|
break;
|
|
|
|
case CONFIDENTIAL:
|
|
|
|
return 'CONFIDENTIAL';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switch_cu($var)
|
|
|
|
{
|
|
|
|
if(gettype($var) == 'string')
|
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case 'INDIVIDUAL':
|
|
|
|
return INDIVIDUAL;
|
|
|
|
break;
|
|
|
|
case 'GROUP':
|
|
|
|
return GROUP;
|
|
|
|
break;
|
|
|
|
case 'RESOURCE':
|
|
|
|
return RESOURCE;
|
|
|
|
break;
|
|
|
|
case 'ROOM':
|
|
|
|
return ROOM;
|
|
|
|
break;
|
|
|
|
case 'UNKNOWN':
|
|
|
|
return UNKNOWN;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return OTHER;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif(gettype($var) == 'integer')
|
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case INDIVIDUAL:
|
|
|
|
return 'INDIVIDUAL';
|
|
|
|
break;
|
|
|
|
case GROUP:
|
|
|
|
return 'GROUP';
|
|
|
|
break;
|
|
|
|
case RESOURCE:
|
|
|
|
return 'RESOURCE';
|
|
|
|
break;
|
|
|
|
case ROOM:
|
|
|
|
return 'ROOM';
|
|
|
|
break;
|
|
|
|
case UNKNOWN:
|
|
|
|
return 'UNKNOWN';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 'X-OTHER';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switch_date($var)
|
|
|
|
{
|
|
|
|
if(is_string($var))
|
|
|
|
{
|
|
|
|
$dtime = new class_datetime;
|
|
|
|
if(strpos($value,':'))
|
|
|
|
{
|
|
|
|
$pos = explode(':',$value);
|
|
|
|
$value = $pos[1];
|
|
|
|
}
|
|
|
|
$this->set_var($dtime,'year',intval(substr($value,0,4)));
|
|
|
|
$this->set_var($dtime,'month',intval(substr($value,4,2)));
|
|
|
|
$this->set_var($dtime,'mday',intval(substr($value,6,2)));
|
|
|
|
if(substr($value,8,1) == 'T')
|
|
|
|
{
|
|
|
|
$this->set_var($dtime,'hour',intval(substr($value,9,2)));
|
|
|
|
$this->set_var($dtime,'min',intval(substr($value,11,2)));
|
|
|
|
$this->set_var($dtime,'sec',intval(substr($value,13,2)));
|
|
|
|
if(strlen($value) > 14)
|
|
|
|
{
|
|
|
|
if(substr($value,14,1) != 'Z')
|
|
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
* The time provided by the vCal is considered local time.
|
|
|
|
*
|
|
|
|
* The implementor will need to consider how to convert that time to UTC.
|
|
|
|
*/
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->set_var($dtime,'hour',0);
|
|
|
|
$this->set_var($dtime,'min',0);
|
|
|
|
$this->set_var($dtime,'sec',0);
|
|
|
|
}
|
|
|
|
return $dtime;
|
|
|
|
}
|
|
|
|
elseif(is_object($var))
|
|
|
|
{
|
|
|
|
return date('Ymd\THms\Z',mktime($var->hour,$var->min,$var->sec,$var->month,$var->mday,$var->year));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
2001-07-06 05:29:29 +02:00
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
|
|
|
|
2001-07-02 05:31:13 +02:00
|
|
|
function switch_encoding($var)
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
if(is_string($var))
|
2001-07-02 05:31:13 +02:00
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case '8BIT':
|
|
|
|
return _8BIT;
|
|
|
|
break;
|
|
|
|
case 'BASE64':
|
|
|
|
return _BASE64;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return OTHER;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
elseif(is_int($var))
|
2001-07-02 05:31:13 +02:00
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case _8BIT:
|
|
|
|
return '8BIT';
|
|
|
|
break;
|
|
|
|
case _BASE64:
|
|
|
|
return 'BASE64';
|
|
|
|
break;
|
|
|
|
case OTHER:
|
|
|
|
return 'OTHER';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
function switch_fbtype($var)
|
2001-06-07 05:18:35 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
if(is_string($var))
|
2001-06-07 05:18:35 +02:00
|
|
|
{
|
2001-06-10 19:05:51 +02:00
|
|
|
switch($var)
|
2001-06-07 05:18:35 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'FREE':
|
|
|
|
return FREE;
|
2001-06-10 19:05:51 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'BUSY':
|
|
|
|
return BUSY;
|
2001-06-10 19:05:51 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'BUSY-UNAVAILABLE':
|
|
|
|
return BUSY_UNAVAILABLE;
|
2001-06-10 19:05:51 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'BUSY-TENTATIVE':
|
|
|
|
return BUSY_TENTATIVE;
|
2001-06-10 19:05:51 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
default:
|
|
|
|
return OTHER;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif(is_int($var))
|
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case FREE:
|
|
|
|
return 'FREE';
|
|
|
|
break;
|
|
|
|
case BUSY:
|
|
|
|
return 'BUSY';
|
|
|
|
break;
|
|
|
|
case BUSY_UNAVAILABLE:
|
|
|
|
return 'BUSY-UNAVAILABLE';
|
|
|
|
break;
|
|
|
|
case BUSY_TENTATIVE:
|
|
|
|
return 'BUSY-TENTATIVE';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 'OTHER';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switch_freq($var)
|
|
|
|
{
|
|
|
|
if(is_string($var))
|
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case 'SECONDLY':
|
|
|
|
return SECONDLY;
|
|
|
|
break;
|
|
|
|
case 'MINUTELY':
|
|
|
|
return MINUTELY;
|
|
|
|
break;
|
|
|
|
case 'HOURLY':
|
|
|
|
return HOURLY;
|
|
|
|
break;
|
|
|
|
case 'DAILY':
|
|
|
|
return DAILY;
|
|
|
|
break;
|
|
|
|
case 'WEEKLY':
|
|
|
|
return WEEKLY;
|
|
|
|
break;
|
|
|
|
case 'MONTHLY':
|
|
|
|
return MONTHLY;
|
|
|
|
break;
|
|
|
|
case 'YEARLY':
|
|
|
|
return YEARLY;
|
2001-06-10 19:05:51 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif(gettype($var) == 'integer')
|
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case SECONDLY:
|
|
|
|
return 'SECONDLY';
|
2001-06-10 19:05:51 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case MINUTELY:
|
|
|
|
return 'MINUTELY';
|
2001-06-10 19:05:51 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case HOURLY:
|
|
|
|
return 'HOURLY';
|
2001-06-10 19:05:51 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case DAILY:
|
|
|
|
return 'DAILY';
|
2001-06-10 19:05:51 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case WEEKLY:
|
|
|
|
return 'WEEKLY';
|
|
|
|
break;
|
|
|
|
case MONTHLY:
|
|
|
|
return 'MONTHLY';
|
|
|
|
break;
|
|
|
|
case YEARLY:
|
|
|
|
return 'YEARLY';
|
2001-06-10 19:05:51 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
function switch_mailto($var)
|
|
|
|
{
|
|
|
|
if(is_string($var))
|
|
|
|
{
|
|
|
|
if(strpos(' '.$var,':'))
|
|
|
|
{
|
|
|
|
$parts = explode(':',$var);
|
|
|
|
$var = $parts[1];
|
|
|
|
}
|
|
|
|
|
|
|
|
$parts = explode('@',$var);
|
|
|
|
if(count($parts) == 2)
|
|
|
|
{
|
|
|
|
$temp_address = new class_mailto;
|
|
|
|
$temp_address->user = $parts[0];
|
|
|
|
$temp_address->host = $parts[1];
|
|
|
|
return $temp_address;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return False;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif(is_object($var))
|
|
|
|
{
|
|
|
|
$str = 'MAILTO:'.$var->user.'@'.$var->host;
|
|
|
|
return $str;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-10 19:05:51 +02:00
|
|
|
function switch_partstat($var)
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
if(is_string($var))
|
2001-06-10 19:05:51 +02:00
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case 'NEEDS-ACTION':
|
|
|
|
return NEEDS_ACTION;
|
|
|
|
break;
|
|
|
|
case 'ACCEPTED':
|
|
|
|
return ACCEPTED;
|
|
|
|
break;
|
|
|
|
case 'DECLINED':
|
|
|
|
return DECLINED;
|
|
|
|
break;
|
|
|
|
case 'TENTATIVE':
|
|
|
|
return TENTATIVE;
|
|
|
|
break;
|
|
|
|
case 'DELEGATED':
|
|
|
|
return DELEGATED;
|
|
|
|
break;
|
|
|
|
case 'COMPLETED':
|
|
|
|
return COMPLETED;
|
|
|
|
break;
|
|
|
|
case 'IN-PROCESS':
|
|
|
|
return IN_PROCESS;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return OTHER;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
elseif(is_int($var))
|
2001-06-10 19:05:51 +02:00
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case NEEDS_ACTION:
|
|
|
|
return 'NEEDS-ACTION';
|
|
|
|
break;
|
|
|
|
case ACCEPTED:
|
|
|
|
return 'ACCEPTED';
|
|
|
|
break;
|
|
|
|
case DECLINED:
|
|
|
|
return 'DECLINED';
|
|
|
|
break;
|
|
|
|
case TENTATIVE:
|
|
|
|
return 'TENTATIVE';
|
|
|
|
break;
|
|
|
|
case DELEGATED:
|
|
|
|
return 'DELEGATED';
|
|
|
|
break;
|
|
|
|
case COMPLETED:
|
|
|
|
return 'COMPLETED';
|
|
|
|
break;
|
|
|
|
case IN_PROCESS:
|
|
|
|
return 'IN-PROCESS';
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
return 'X-OTHER';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
function switch_range($var)
|
2001-06-10 19:05:51 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
if(is_string($var))
|
2001-06-10 19:05:51 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
switch($var)
|
2001-06-10 19:05:51 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'THISANDPRIOR':
|
|
|
|
return THISANDPRIOR;
|
|
|
|
break;
|
|
|
|
case 'THISANDFUTURE':
|
|
|
|
return THISANDFUTURE;
|
|
|
|
break;
|
2001-06-07 05:18:35 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
}
|
|
|
|
elseif(is_int($var))
|
|
|
|
{
|
|
|
|
switch($var)
|
2001-06-10 06:02:50 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case THISANDPRIOR:
|
|
|
|
return 'THISANDPRIOR';
|
|
|
|
break;
|
|
|
|
case THISANDFUTURE:
|
|
|
|
return 'THISANDFUTURE';
|
|
|
|
break;
|
2001-06-10 19:05:51 +02:00
|
|
|
}
|
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
else
|
2001-06-10 19:05:51 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switch_related($var)
|
|
|
|
{
|
|
|
|
if(is_string($var))
|
|
|
|
{
|
|
|
|
switch($var)
|
2001-06-10 19:05:51 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'START':
|
|
|
|
return START;
|
|
|
|
break;
|
|
|
|
case 'END':
|
|
|
|
return END;
|
|
|
|
break;
|
2001-06-10 19:05:51 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
}
|
|
|
|
elseif(is_int($var))
|
|
|
|
{
|
|
|
|
switch($var)
|
2001-06-10 19:05:51 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case START:
|
|
|
|
return 'START';
|
|
|
|
break;
|
|
|
|
case END:
|
|
|
|
return 'END';
|
|
|
|
break;
|
2001-06-10 19:05:51 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-09 13:35:13 +02:00
|
|
|
function switch_reltype($var)
|
2001-06-25 00:13:17 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
if(is_string($var))
|
2001-06-25 00:13:17 +02:00
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'PARENT':
|
|
|
|
return PARENT;
|
2001-06-25 00:13:17 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'CHILD':
|
|
|
|
return CHILD;
|
2001-06-25 00:13:17 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'SIBLING':
|
|
|
|
return SIBLING;
|
2001-06-25 00:13:17 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
elseif(is_int($var))
|
2001-06-25 00:13:17 +02:00
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case PARENT:
|
|
|
|
return 'PARENT';
|
2001-06-25 00:13:17 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case CHILD:
|
|
|
|
return 'CHILD';
|
2001-06-25 00:13:17 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case SIBLING:
|
|
|
|
return 'SIBLING';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switch_role($var)
|
|
|
|
{
|
|
|
|
if(is_string($var))
|
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case 'NONE':
|
|
|
|
return NONE;
|
|
|
|
break;
|
|
|
|
case 'CHAIR':
|
|
|
|
return CHAIR;
|
|
|
|
break;
|
|
|
|
case 'REQ-PARTICIPANT':
|
|
|
|
return REQ_PARTICIPANT;
|
|
|
|
break;
|
|
|
|
case 'OPT-PARTICIPANT':
|
|
|
|
return OPT_PARTICIPANT;
|
|
|
|
break;
|
|
|
|
case 'NON-PARTICIPANT':
|
|
|
|
return NON_PARTICIPANT;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif(is_int($var))
|
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case NONE:
|
|
|
|
return 'NONE';
|
|
|
|
break;
|
|
|
|
case CHAIR:
|
|
|
|
return 'CHAIR';
|
|
|
|
break;
|
|
|
|
case REQ_PARTICIPANT:
|
|
|
|
return 'REQ-PARTICIPANT';
|
2001-06-25 00:13:17 +02:00
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case OPT_PARTICIPANT:
|
|
|
|
return 'OPT-PARTICIPANT';
|
|
|
|
break;
|
|
|
|
case NON_PARTICIPANT:
|
|
|
|
return 'NON-PARTICIPANT';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switch_rsvp($var)
|
|
|
|
{
|
|
|
|
if(is_string($var))
|
|
|
|
{
|
|
|
|
if($var == 'TRUE')
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
elseif($var == 'FALSE')
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif(is_int($var) || $var == False)
|
|
|
|
{
|
|
|
|
if($var == 1)
|
|
|
|
{
|
|
|
|
return 'TRUE';
|
|
|
|
}
|
|
|
|
elseif($var == 0)
|
|
|
|
{
|
|
|
|
return 'FALSE';
|
2001-06-25 00:13:17 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
function switch_transp($var)
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
if(is_string($var))
|
2001-06-25 00:13:17 +02:00
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case 'TRANSPARENT':
|
|
|
|
return TRANSPARENT;
|
|
|
|
break;
|
|
|
|
case 'OPAQUE':
|
|
|
|
return OPAQUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
elseif(is_int($var))
|
2001-06-25 00:13:17 +02:00
|
|
|
{
|
|
|
|
switch($var)
|
|
|
|
{
|
|
|
|
case TRANSPARENT:
|
|
|
|
return 'TRANSPARENT';
|
|
|
|
break;
|
|
|
|
case OPAQUE:
|
|
|
|
return 'OPAQUE';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return $var;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-07-05 19:04:52 +02:00
|
|
|
/*
|
|
|
|
* The brunt of the class
|
|
|
|
*/
|
2001-06-25 00:13:17 +02:00
|
|
|
|
2001-06-10 06:02:50 +02:00
|
|
|
function read($vcal_text)
|
|
|
|
{
|
|
|
|
$i = 0;
|
2001-07-05 19:04:52 +02:00
|
|
|
$mode = 'none';
|
2001-07-09 13:35:13 +02:00
|
|
|
$standard = Array();
|
|
|
|
$max_lines = count($vcal_text);
|
|
|
|
while($i < $max_lines)
|
2001-06-10 06:02:50 +02:00
|
|
|
{
|
|
|
|
// if(strlen($vcal_text[$i]) > 75)
|
|
|
|
// {
|
|
|
|
// continue;
|
|
|
|
// }
|
2001-06-07 05:18:35 +02:00
|
|
|
|
2001-06-10 06:02:50 +02:00
|
|
|
$this->unfold($vcal_text,$i);
|
2001-07-09 13:35:13 +02:00
|
|
|
$max_lines = count($vcal_text);
|
|
|
|
|
2001-07-02 05:31:13 +02:00
|
|
|
$vcal_text[$i] = str_replace("\r\n",'',$vcal_text[$i]);
|
|
|
|
|
2001-07-05 19:04:52 +02:00
|
|
|
// echo "TEXT : ".$vcal_text[$i]."<br>\n";
|
2001-07-09 13:35:13 +02:00
|
|
|
// flush();
|
2001-06-07 05:18:35 +02:00
|
|
|
// Example #1
|
|
|
|
//vcal_text[$i] = 'BEGIN:VCALENDAR'
|
|
|
|
|
|
|
|
// Example #2
|
|
|
|
//vcal_text[$i] = 'METHOD:REQUEST'
|
|
|
|
|
|
|
|
// Example #3
|
|
|
|
//vcal_text[$i] = 'ATTENDEE;CN="John Doe";ROLE=REQ-PARTICIPANT;RSVP=TRUE:MAILTO:john.doe@somewhere.com'
|
|
|
|
|
|
|
|
// Example #4
|
2001-07-02 05:31:13 +02:00
|
|
|
//vcal_text[$i] = 'ORGANIZER;DIR="ldap://host.com:6666/o=eDABC%20Industries,c=3DUS??(cn=3DBJim%20Dolittle)":MAILTO:John.Doe@somewhere.com'
|
2001-06-07 05:18:35 +02:00
|
|
|
|
|
|
|
// Example #5
|
|
|
|
//vcal_text[$i] = 'DTSTART:20010302T150000Z'
|
|
|
|
|
|
|
|
// Example #6
|
|
|
|
//vcal_text[$i] = 'UID:040000008200E00074C5B7101A82E0080000000040A12C0042A2C0010000000000000000100'
|
|
|
|
//vcal_text[$i+1] = ' 000009BDFF7C7650ED5118DD700805FA71291'
|
|
|
|
|
|
|
|
// When unfolded becomes,
|
|
|
|
//vcal_text[$i] = 'UID:040000008200E00074C5B7101A82E0080000000040A12C0042A2C0010000000000000000100000009BDFF7C7650ED5118DD700805FA71291'
|
|
|
|
|
2001-06-10 06:02:50 +02:00
|
|
|
$colon = strpos($vcal_text[$i],':');
|
2001-06-07 05:18:35 +02:00
|
|
|
if($colon == 0)
|
|
|
|
{
|
|
|
|
$colon = 65535;
|
|
|
|
}
|
|
|
|
|
2001-06-10 06:02:50 +02:00
|
|
|
$semi_colon = strpos($vcal_text[$i],';');
|
2001-06-07 05:18:35 +02:00
|
|
|
if($semi_colon == 0)
|
|
|
|
{
|
|
|
|
$semi_colon = 65535;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($colon == 65535 && $semi_colon == 65535)
|
2001-03-17 20:39:56 +01:00
|
|
|
{
|
2001-05-06 02:11:12 +02:00
|
|
|
continue;
|
|
|
|
}
|
2001-06-07 05:18:35 +02:00
|
|
|
else
|
2001-05-06 02:11:12 +02:00
|
|
|
{
|
2001-06-07 05:18:35 +02:00
|
|
|
$min_value = min($colon,$semi_colon);
|
2001-07-06 05:29:29 +02:00
|
|
|
$majortype = str_replace('-','_',strtolower(substr($vcal_text[$i],0,$min_value)));
|
2001-06-10 06:02:50 +02:00
|
|
|
$vcal_text[$i] = chop(substr($vcal_text[$i],$min_value + 1));
|
2001-06-07 05:18:35 +02:00
|
|
|
$value = $vcal_text[$i];
|
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
|
2001-07-06 05:29:29 +02:00
|
|
|
if($mode != 'none' && ($majortype != 'begin' && $majortype != 'end'))
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
if(isset($this->property[$majortype]))
|
|
|
|
{
|
|
|
|
$state = @$this->property[$majortype]["$mode"]['state'];
|
|
|
|
$type = @$this->property[$majortype]['type'];
|
|
|
|
$multiples = @$this->property[$majortype]["$mode"]['multiples'];
|
|
|
|
$do_to_text = @$this->property[$majortype]['to_text'];
|
|
|
|
}
|
|
|
|
elseif(substr($majortype,0,2) == 'x_')
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
$state = 'optional';
|
|
|
|
$type = 'xtype';
|
|
|
|
$multiples = True;
|
|
|
|
$do_to_test = True;
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$state = '';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$state = 'required';
|
|
|
|
}
|
2001-07-02 05:31:13 +02:00
|
|
|
|
2001-07-05 19:04:52 +02:00
|
|
|
if($state == 'optional' || $state == 'required')
|
2001-07-02 05:31:13 +02:00
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
if($majortype == 'begin')
|
2001-07-05 19:04:52 +02:00
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
switch(strtolower($value))
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'daylight':
|
|
|
|
$mode = 'daylight';
|
|
|
|
$t_event = new class_timezone;
|
|
|
|
$t_event = $event;
|
|
|
|
unset($event);
|
|
|
|
$event = new class_tzprop;
|
|
|
|
$event->type = strtolower($value);
|
|
|
|
break;
|
|
|
|
case 'standard':
|
|
|
|
$mode = 'standard';
|
|
|
|
$t_event = new class_timezone;
|
|
|
|
$t_event = $event;
|
|
|
|
unset($event);
|
|
|
|
$event = new class_tzprop;
|
|
|
|
$event->type = strtolower($value);
|
|
|
|
break;
|
|
|
|
case 'valarm':
|
|
|
|
if($mode == 'vevent' || $mode == 'vtodo')
|
|
|
|
{
|
|
|
|
$mode = 'valarm';
|
|
|
|
$t_event = $event;
|
|
|
|
unset($event);
|
|
|
|
$event = new class_alarm;
|
|
|
|
$event->type = strtolower($value);
|
|
|
|
}
|
|
|
|
break;
|
2001-07-06 05:29:29 +02:00
|
|
|
case 'vcalendar':
|
|
|
|
$vcal = $this->new_vcal();
|
|
|
|
break;
|
|
|
|
case 'vevent':
|
|
|
|
$mode = 'vevent';
|
2001-07-09 13:35:13 +02:00
|
|
|
$event = new class_event;
|
2001-07-06 05:29:29 +02:00
|
|
|
$event->type = strtolower($value);
|
|
|
|
break;
|
|
|
|
case 'vfreebusy':
|
|
|
|
$mode = 'vfreebusy';
|
|
|
|
$event = new vCalendar_item;
|
|
|
|
$event->type = strtolower($value);
|
|
|
|
break;
|
|
|
|
case 'vjournal':
|
|
|
|
$mode = 'vjournal';
|
|
|
|
$event = new vCalendar_item;
|
|
|
|
$event->type = strtolower($value);
|
|
|
|
break;
|
|
|
|
case 'vtimezone':
|
|
|
|
$mode = 'vtimezone';
|
2001-07-09 13:35:13 +02:00
|
|
|
$event = new class_timezone;
|
2001-07-06 05:29:29 +02:00
|
|
|
$event->type = strtolower($value);
|
|
|
|
break;
|
|
|
|
case 'vtodo':
|
|
|
|
$mode = 'vtodo';
|
2001-07-09 13:35:13 +02:00
|
|
|
$event = new class_todo;
|
2001-07-06 05:29:29 +02:00
|
|
|
$event->type = strtolower($value);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elseif($majortype == 'end')
|
|
|
|
{
|
|
|
|
$mode = 'none';
|
|
|
|
switch(strtolower($value))
|
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'daylight':
|
|
|
|
$tzdata[] = $event;
|
|
|
|
unset($event);
|
|
|
|
$event = $t_event;
|
|
|
|
unset($t_event);
|
|
|
|
$mode = 'vtimezone';
|
|
|
|
break;
|
|
|
|
case 'standard':
|
|
|
|
$tzdata[] = $event;
|
|
|
|
unset($event);
|
|
|
|
$event = $t_event;
|
|
|
|
unset($t_event);
|
|
|
|
$mode = 'vtimezone';
|
|
|
|
break;
|
2001-07-06 05:29:29 +02:00
|
|
|
case 'valarm':
|
2001-07-09 13:35:13 +02:00
|
|
|
$alarm[] = $event;
|
|
|
|
unset($event);
|
|
|
|
$event = $t_event;
|
|
|
|
unset($t_event);
|
|
|
|
$mode = $tmode;
|
|
|
|
break;
|
|
|
|
case 'vevent':
|
|
|
|
if(!empty($alarm))
|
2001-07-06 05:29:29 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$event->alarm = $alarm;
|
2001-07-06 05:29:29 +02:00
|
|
|
unset($alarm);
|
|
|
|
}
|
|
|
|
$this->event[] = $event;
|
|
|
|
unset($event);
|
|
|
|
break;
|
|
|
|
case 'vfreebusy':
|
|
|
|
$this->freebusy[] = $event;
|
|
|
|
unset($event);
|
|
|
|
break;
|
|
|
|
case 'vjournal':
|
|
|
|
$this->journal[] = $event;
|
|
|
|
unset($event);
|
|
|
|
break;
|
|
|
|
case 'vtimezone':
|
2001-07-09 13:35:13 +02:00
|
|
|
if(!empty($tzdata))
|
|
|
|
{
|
|
|
|
$event->tzdata = $tzdata;
|
|
|
|
unset($tzdata);
|
|
|
|
}
|
2001-07-06 05:29:29 +02:00
|
|
|
$this->timezone[] = $event;
|
|
|
|
unset($event);
|
|
|
|
break;
|
|
|
|
case 'vtodo':
|
2001-07-09 13:35:13 +02:00
|
|
|
if(!empty($alarm))
|
|
|
|
{
|
|
|
|
$event->alarm = $alarm;
|
|
|
|
unset($alarm);
|
|
|
|
}
|
2001-07-06 05:29:29 +02:00
|
|
|
$this->todo[] = $event;
|
|
|
|
unset($event);
|
|
|
|
break;
|
|
|
|
case 'vcalendar':
|
|
|
|
$this->vcal = $vcal;
|
|
|
|
$this->vcal->event = $this->event;
|
|
|
|
$this->vcal->freebusy = $this->freebusy;
|
|
|
|
$this->vcal->journal = $this->journal;
|
|
|
|
$this->vcal->timezone = $this->timezone;
|
|
|
|
$this->vcal->todo = $this->todo;
|
|
|
|
break 2;
|
|
|
|
}
|
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
elseif($majortype == 'prodid' || $majortype == 'version' || $majortype == 'method' || $majortype == 'calscale')
|
2001-07-06 05:29:29 +02:00
|
|
|
{
|
2001-07-09 13:35:13 +02:00
|
|
|
$this->parse_parameters($vcal->$majortype,$majortype,$this->from_text($value));
|
2001-07-06 05:29:29 +02:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if($do_to_text)
|
|
|
|
{
|
|
|
|
$value = $this->from_text($value);
|
|
|
|
}
|
|
|
|
switch($type)
|
|
|
|
{
|
|
|
|
case 'text':
|
|
|
|
$text_class = new class_text;
|
2001-07-09 13:35:13 +02:00
|
|
|
$this->parse_parameters($text_class,$majortype,$value);
|
2001-07-06 05:29:29 +02:00
|
|
|
if($multiples)
|
|
|
|
{
|
|
|
|
$event->{$majortype}[] = $text_class;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->set_var($event,$majortype,$text_class);
|
|
|
|
}
|
|
|
|
unset($text_class);
|
|
|
|
break;
|
|
|
|
case 'integer':
|
|
|
|
if($multiples)
|
|
|
|
{
|
|
|
|
$event->{$majortype}[] = intval($value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->set_var($event,$majortype,intval($value));
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case 'date-time':
|
|
|
|
$date_class = $this->parse_datetime($value);
|
|
|
|
if($multiples)
|
|
|
|
{
|
|
|
|
$event->{$majortype}[] = $date_class;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->set_var($event,$majortype,$date_class);
|
|
|
|
}
|
|
|
|
unset($date_class);
|
|
|
|
break;
|
|
|
|
case 'float':
|
|
|
|
$event->$majortype = new class_geo;
|
|
|
|
$this->parse_geo($event->$majortype,$value);
|
|
|
|
break;
|
2001-07-09 13:35:13 +02:00
|
|
|
case 'utc-offset':
|
|
|
|
$this->set_var($event,$majortype,intval($value));
|
|
|
|
break;
|
2001-07-06 05:29:29 +02:00
|
|
|
case 'cal-address':
|
|
|
|
$address = new class_address;
|
2001-07-09 13:35:13 +02:00
|
|
|
$this->parse_parameters($address,$majortype,$value);
|
2001-07-06 05:29:29 +02:00
|
|
|
if($multiples)
|
|
|
|
{
|
|
|
|
$event->{$majortype}[] = $address;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->set_var($event,$majortype,$address);
|
|
|
|
}
|
|
|
|
unset($address);
|
|
|
|
break;
|
|
|
|
case 'recur':
|
|
|
|
$recur = new class_recur;
|
2001-07-09 13:35:13 +02:00
|
|
|
$this->parse_parameters($recur,$majortype,$value);
|
2001-07-06 05:29:29 +02:00
|
|
|
if($multiples)
|
|
|
|
{
|
|
|
|
$event->{$majortype}[] = $recur;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$this->set_var($event,$majortype,$recur);
|
|
|
|
}
|
|
|
|
unset($recur);
|
|
|
|
break;
|
|
|
|
case 'uri':
|
|
|
|
$new_var = new class_text;
|
2001-07-09 13:35:13 +02:00
|
|
|
$this->parse_parameters($new_var,$majortype,$value);
|
2001-07-06 05:29:29 +02:00
|
|
|
if($multiples)
|
|
|
|
{
|
|
|
|
switch($mode)
|
|
|
|
{
|
|
|
|
case 'valarm':
|
|
|
|
$alarm->attach[] = $new_var;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
$event->{$majortype}[] = $new_var;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$event->{$majortype} = $new_var;
|
|
|
|
}
|
|
|
|
unset($new_var);
|
|
|
|
break;
|
|
|
|
case 'xtype':
|
2001-07-09 13:35:13 +02:00
|
|
|
$this->parse_xtype($event,$majortype,$value);
|
2001-07-06 05:29:29 +02:00
|
|
|
break;
|
|
|
|
|
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
}
|
2001-07-02 05:31:13 +02:00
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
$i++;
|
2001-06-25 00:13:17 +02:00
|
|
|
}
|
2001-07-05 19:04:52 +02:00
|
|
|
return $this->vcal;
|
2001-06-25 00:13:17 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function build_vcal($vcal)
|
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
$var = Array(
|
|
|
|
'timezone',
|
|
|
|
'event',
|
|
|
|
'todo',
|
|
|
|
'journal',
|
|
|
|
'freebusy'
|
|
|
|
);
|
|
|
|
|
2001-07-02 05:31:13 +02:00
|
|
|
$str = 'BEGIN:VCALENDAR'."\r\n";
|
2001-07-05 19:04:52 +02:00
|
|
|
$str .= $this->fold('PRODID'.$this->build_text($vcal->prodid));
|
|
|
|
$str .= $this->fold('VERSION'.$this->build_text($vcal->version));
|
|
|
|
$str .= $this->fold('METHOD'.$this->build_text($vcal->method));
|
2001-07-06 05:29:29 +02:00
|
|
|
while(list($key,$vtype) = each($var))
|
2001-06-25 00:13:17 +02:00
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
if($vcal->$vtype)
|
2001-06-25 00:13:17 +02:00
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
for($i=0;$i<count($vcal->$vtype);$i++)
|
2001-06-25 00:13:17 +02:00
|
|
|
{
|
2001-07-06 05:29:29 +02:00
|
|
|
$str .= 'BEGIN:V'.strtoupper($vtype)."\r\n";
|
|
|
|
$str .= $this->build_card_internals('v'.$vtype,$vcal->{$vtype}[$i]);
|
|
|
|
$str .= 'END:V'.strtoupper($vtype)."\r\n";
|
2001-06-25 00:13:17 +02:00
|
|
|
}
|
2001-07-09 13:35:13 +02:00
|
|
|
// echo "STR #$i : $str<br>\n";
|
|
|
|
// flush();
|
2001-06-25 00:13:17 +02:00
|
|
|
}
|
|
|
|
}
|
2001-07-02 05:31:13 +02:00
|
|
|
$str .= 'END:VCALENDAR'."\r\n";
|
2001-06-25 00:13:17 +02:00
|
|
|
|
|
|
|
return $str;
|
|
|
|
}
|
2001-03-17 20:39:56 +01:00
|
|
|
}
|
|
|
|
?>
|