Heavily refactored, including multiple calendars per user and recurring events. Not in an installable state yet, though

pull/73/head
Tobias Hößl 2012-07-08 17:14:39 +00:00
parent fefee23e90
commit fc4f2848d9
23 changed files with 2 additions and 13376 deletions

View File

@ -1,6 +1,7 @@
v0.2.0
v0.2.0-pre
======
[FEATURE] Multiple private Calendars can be created.
[FEATURE] Support for recurring events.
[COMPATIBILITY] When creating or updating an event using CalDAV, the etag is returned.
v0.1.1

View File

@ -1,128 +0,0 @@
<?php
/**
* Time zone name translation
*
* This file translates well-known time zone names into "Olson database" time zone names.
*
* @package Sabre
* @subpackage VObject
* @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
* @author Frank Edelhaeuser (fedel@users.sourceforge.net)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_VObject_WindowsTimezoneMap {
protected static $map = array(
// from http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html
// snapshot taken on 2012/01/16
// windows
'AUS Central Standard Time'=>'Australia/Darwin',
'AUS Eastern Standard Time'=>'Australia/Sydney',
'Afghanistan Standard Time'=>'Asia/Kabul',
'Alaskan Standard Time'=>'America/Anchorage',
'Arab Standard Time'=>'Asia/Riyadh',
'Arabian Standard Time'=>'Asia/Dubai',
'Arabic Standard Time'=>'Asia/Baghdad',
'Argentina Standard Time'=>'America/Buenos_Aires',
'Armenian Standard Time'=>'Asia/Yerevan',
'Atlantic Standard Time'=>'America/Halifax',
'Azerbaijan Standard Time'=>'Asia/Baku',
'Azores Standard Time'=>'Atlantic/Azores',
'Bangladesh Standard Time'=>'Asia/Dhaka',
'Canada Central Standard Time'=>'America/Regina',
'Cape Verde Standard Time'=>'Atlantic/Cape_Verde',
'Caucasus Standard Time'=>'Asia/Yerevan',
'Cen. Australia Standard Time'=>'Australia/Adelaide',
'Central America Standard Time'=>'America/Guatemala',
'Central Asia Standard Time'=>'Asia/Almaty',
'Central Brazilian Standard Time'=>'America/Cuiaba',
'Central Europe Standard Time'=>'Europe/Budapest',
'Central European Standard Time'=>'Europe/Warsaw',
'Central Pacific Standard Time'=>'Pacific/Guadalcanal',
'Central Standard Time'=>'America/Chicago',
'Central Standard Time (Mexico)'=>'America/Mexico_City',
'China Standard Time'=>'Asia/Shanghai',
'Dateline Standard Time'=>'Etc/GMT+12',
'E. Africa Standard Time'=>'Africa/Nairobi',
'E. Australia Standard Time'=>'Australia/Brisbane',
'E. Europe Standard Time'=>'Europe/Minsk',
'E. South America Standard Time'=>'America/Sao_Paulo',
'Eastern Standard Time'=>'America/New_York',
'Egypt Standard Time'=>'Africa/Cairo',
'Ekaterinburg Standard Time'=>'Asia/Yekaterinburg',
'FLE Standard Time'=>'Europe/Kiev',
'Fiji Standard Time'=>'Pacific/Fiji',
'GMT Standard Time'=>'Europe/London',
'GTB Standard Time'=>'Europe/Istanbul',
'Georgian Standard Time'=>'Asia/Tbilisi',
'Greenland Standard Time'=>'America/Godthab',
'Greenwich Standard Time'=>'Atlantic/Reykjavik',
'Hawaiian Standard Time'=>'Pacific/Honolulu',
'India Standard Time'=>'Asia/Calcutta',
'Iran Standard Time'=>'Asia/Tehran',
'Israel Standard Time'=>'Asia/Jerusalem',
'Jordan Standard Time'=>'Asia/Amman',
'Kamchatka Standard Time'=>'Asia/Kamchatka',
'Korea Standard Time'=>'Asia/Seoul',
'Magadan Standard Time'=>'Asia/Magadan',
'Mauritius Standard Time'=>'Indian/Mauritius',
'Mexico Standard Time'=>'America/Mexico_City',
'Mexico Standard Time 2'=>'America/Chihuahua',
'Mid-Atlantic Standard Time'=>'Etc/GMT+2',
'Middle East Standard Time'=>'Asia/Beirut',
'Montevideo Standard Time'=>'America/Montevideo',
'Morocco Standard Time'=>'Africa/Casablanca',
'Mountain Standard Time'=>'America/Denver',
'Mountain Standard Time (Mexico)'=>'America/Chihuahua',
'Myanmar Standard Time'=>'Asia/Rangoon',
'N. Central Asia Standard Time'=>'Asia/Novosibirsk',
'Namibia Standard Time'=>'Africa/Windhoek',
'Nepal Standard Time'=>'Asia/Katmandu',
'New Zealand Standard Time'=>'Pacific/Auckland',
'Newfoundland Standard Time'=>'America/St_Johns',
'North Asia East Standard Time'=>'Asia/Irkutsk',
'North Asia Standard Time'=>'Asia/Krasnoyarsk',
'Pacific SA Standard Time'=>'America/Santiago',
'Pacific Standard Time'=>'America/Los_Angeles',
'Pacific Standard Time (Mexico)'=>'America/Santa_Isabel',
'Pakistan Standard Time'=>'Asia/Karachi',
'Paraguay Standard Time'=>'America/Asuncion',
'Romance Standard Time'=>'Europe/Paris',
'Russian Standard Time'=>'Europe/Moscow',
'SA Eastern Standard Time'=>'America/Cayenne',
'SA Pacific Standard Time'=>'America/Bogota',
'SA Western Standard Time'=>'America/La_Paz',
'SE Asia Standard Time'=>'Asia/Bangkok',
'Samoa Standard Time'=>'Pacific/Apia',
'Singapore Standard Time'=>'Asia/Singapore',
'South Africa Standard Time'=>'Africa/Johannesburg',
'Sri Lanka Standard Time'=>'Asia/Colombo',
'Syria Standard Time'=>'Asia/Damascus',
'Taipei Standard Time'=>'Asia/Taipei',
'Tasmania Standard Time'=>'Australia/Hobart',
'Tokyo Standard Time'=>'Asia/Tokyo',
'Tonga Standard Time'=>'Pacific/Tongatapu',
'US Eastern Standard Time'=>'America/Indianapolis',
'US Mountain Standard Time'=>'America/Phoenix',
'UTC'=>'Etc/GMT',
'UTC+12'=>'Etc/GMT-12',
'UTC-02'=>'Etc/GMT+2',
'UTC-11'=>'Etc/GMT+11',
'Ulaanbaatar Standard Time'=>'Asia/Ulaanbaatar',
'Venezuela Standard Time'=>'America/Caracas',
'Vladivostok Standard Time'=>'Asia/Vladivostok',
'W. Australia Standard Time'=>'Australia/Perth',
'W. Central Africa Standard Time'=>'Africa/Lagos',
'W. Europe Standard Time'=>'Europe/Berlin',
'West Asia Standard Time'=>'Asia/Tashkent',
'West Pacific Standard Time'=>'Pacific/Port_Moresby',
'Yakutsk Standard Time'=>'Asia/Yakutsk',
);
static public function lookup($tzid) {
return isset(self::$map[$tzid]) ? self::$map[$tzid] : null;
}
}

View File

@ -1,174 +0,0 @@
<?php
class Sabre_CalDAV_Backend_Std extends Sabre_CalDAV_Backend_Common
{
public function getNamespace()
{
return CALDAV_NAMESPACE_PRIVATE;
}
public function getCalUrlPrefix()
{
return "private";
}
/**
* Creates a new calendar for a principal.
*
* If the creation was a success, an id must be returned that can be used to reference
* this calendar in other methods, such as updateCalendar.
*
* @param string $principalUri
* @param string $calendarUri
* @param array $properties
* @return void
*/
public function createCalendar($principalUri, $calendarUri, array $properties)
{
// TODO: Implement createCalendar() method.
}
/**
* Delete a calendar and all it's objects
*
* @param string $calendarId
* @return void
*/
public function deleteCalendar($calendarId)
{
// TODO: Implement deleteCalendar() method.
}
/**
* Returns all calendar objects within a calendar.
*
* Every item contains an array with the following keys:
* * id - unique identifier which will be used for subsequent updates
* * calendardata - The iCalendar-compatible calendar data
* * uri - a unique key which will be used to construct the uri. This can be any arbitrary string.
* * lastmodified - a timestamp of the last modification time
* * etag - An arbitrary string, surrounded by double-quotes. (e.g.:
* ' "abcdef"')
* * calendarid - The calendarid as it was passed to this function.
* * size - The size of the calendar objects, in bytes.
*
* Note that the etag is optional, but it's highly encouraged to return for
* speed reasons.
*
* The calendardata is also optional. If it's not returned
* 'getCalendarObject' will be called later, which *is* expected to return
* calendardata.
*
* If neither etag or size are specified, the calendardata will be
* used/fetched to determine these numbers. If both are specified the
* amount of times this is needed is reduced by a great degree.
*
* @param string $calendarId
* @return array
*/
function getCalendarObjects($calendarId)
{
$x = explode("-", $calendarId);
$objs = q("SELECT * FROM %s%scalendarobjects WHERE `namespace` = %d AND `namespace_id` = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($x[0]), IntVal($x[1]));
$ret = array();
foreach ($objs as $obj) {
$ret[] = array(
"id" => IntVal($obj["id"]),
"calendardata" => $obj["calendardata"],
"uri" => $obj["uri"],
"lastmodified" => $obj["lastmodified"],
"calendarid" => $calendarId,
"etag" => $obj["etag"],
"size" => IntVal($obj["size"]),
);
}
return $ret;
}
/**
* Returns information from a single calendar object, based on it's object
* uri.
*
* The returned array must have the same keys as getCalendarObjects. The
* 'calendardata' object is required here though, while it's not required
* for getCalendarObjects.
*
* @param string $calendarId
* @param string $objectUri
* @throws Sabre_DAV_Exception_FileNotFound
* @return array
*/
function getCalendarObject($calendarId, $objectUri)
{
$x = explode("-", $calendarId);
$o = q("SELECT * FROM %s%scalendarobjects WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($x[0]), IntVal($x[1]), dbesc($objectUri));
if (count($o) > 0) {
$o[0]["calendarid"] = $calendarId;
$o[0]["calendardata"] = str_ireplace("Europe/Belgrade", "Europe/Berlin", $o[0]["calendardata"]);
return $o[0];
} else throw new Sabre_DAV_Exception_FileNotFound($calendarId . " / " . $objectUri);
}
/**
* Creates a new calendar object.
*
* @param string $calendarId
* @param string $objectUri
* @param string $calendarData
* @return null|string|void
*/
function createCalendarObject($calendarId, $objectUri, $calendarData)
{
$x = explode("-", $calendarId);
q("INSERT INTO %s%scalendarobjects (`namespace`, `namespace_id`, `uri`, `calendardata`, `lastmodified`, `etag`, `size`) VALUES (%d, %d, '%s', '%s', NOW(), '%s', %d)",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX,
IntVal($x[0]), IntVal($x[1]), dbesc($objectUri), addslashes($calendarData), md5($calendarData), strlen($calendarData)
);
$this->increaseCalendarCtag($x[0], $x[1]);
renderCalDavEntry_uri($objectUri);
}
/**
* Updates an existing calendarobject, based on it's uri.
*
* @param string $calendarId
* @param string $objectUri
* @param string $calendarData
* @return null|string|void
*/
function updateCalendarObject($calendarId, $objectUri, $calendarData)
{
$x = explode("-", $calendarId);
q("UPDATE %s%scalendarobjects SET `calendardata` = '%s', `lastmodified` = NOW(), `etag` = '%s', `size` = %d WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, dbesc($calendarData), md5($calendarData), strlen($calendarData), IntVal($x[0]), IntVal($x[1]), dbesc($objectUri));
$this->increaseCalendarCtag($x[0], $x[1]);
renderCalDavEntry_uri($objectUri);
}
/**
* Deletes an existing calendar object.
*
* @param string $calendarId
* @param string $objectUri
* @return void
*/
function deleteCalendarObject($calendarId, $objectUri)
{
$x = explode("-", $calendarId);
q("DELETE FROM %s%scalendarobjects WHERE `namespace` = %d AND `namespace_id` = %d AND `uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($x[0]), IntVal($x[1]), dbesc($objectUri)
);
$this->increaseCalendarCtag($x[0], $x[1]);
renderCalDavEntry_uri($objectUri);
}
}

View File

@ -1,28 +0,0 @@
<?php
# Generated automatically - do not change!
class DBClass_friendica_calendarobjects extends DBClass_animexx {
/** @var $PRIMARY_KEY array */
public $PRIMARY_KEY = array("id");
protected $SRC_TABLE = 'calendarobjects';
/** @var $calendardata string|null */
/** @var $uri string */
/** @var $lastmodified string|null */
/** @var $etag string */
public $calendardata, $uri, $lastmodified, $etag;
/** @var $id int */
/** @var $namespace int */
/** @var $namespace_id int */
/** @var $size int */
public $id, $namespace, $namespace_id, $size;
protected $_string_fields = array('calendardata', 'uri', 'lastmodified', 'etag');
protected $_int_fields = array('id', 'namespace', 'namespace_id', 'size');
protected $_null_fields = array('calendardata', 'lastmodified');
}

View File

@ -1,29 +0,0 @@
<?php
# Generated automatically - do not change!
class DBClass_friendica_calendars extends DBClass_animexx {
/** @var $PRIMARY_KEY array */
public $PRIMARY_KEY = array("namespace", "namespace_id");
protected $SRC_TABLE = 'calendars';
/** @var $calendarcolor string */
/** @var $displayname string */
/** @var $timezone string */
/** @var $description string */
public $calendarcolor, $displayname, $timezone, $description;
/** @var $namespace int */
/** @var $namespace_id int */
/** @var $uid int */
/** @var $calendarorder int */
/** @var $ctag int */
public $namespace, $namespace_id, $uid, $calendarorder, $ctag;
protected $_string_fields = array('calendarcolor', 'displayname', 'timezone', 'description');
protected $_int_fields = array('namespace', 'namespace_id', 'uid', 'calendarorder', 'ctag');
protected $_null_fields = array();
}

View File

@ -1,35 +0,0 @@
<?php
# Generated automatically - do not change!
class DBClass_friendica_jqcalendar extends DBClass_animexx {
/** @var $PRIMARY_KEY array */
public $PRIMARY_KEY = array("id");
protected $SRC_TABLE = 'jqcalendar';
/** @var $ical_uri string */
/** @var $ical_recurr_uri string */
/** @var $Subject string|null */
/** @var $Location string|null */
/** @var $Description string|null */
/** @var $StartTime string|null */
/** @var $EndTime string|null */
/** @var $Color string|null */
/** @var $RecurringRule string|null */
public $ical_uri, $ical_recurr_uri, $Subject, $Location, $Description, $StartTime, $EndTime, $Color, $RecurringRule;
/** @var $id int */
/** @var $uid int */
/** @var $namespace int */
/** @var $namespace_id int */
/** @var $permission_edit int */
/** @var $IsAllDayEvent int */
public $id, $uid, $namespace, $namespace_id, $permission_edit, $IsAllDayEvent;
protected $_string_fields = array('ical_uri', 'ical_recurr_uri', 'Subject', 'Location', 'Description', 'StartTime', 'EndTime', 'Color', 'RecurringRule');
protected $_int_fields = array('id', 'uid', 'namespace', 'namespace_id', 'permission_edit', 'IsAllDayEvent');
protected $_null_fields = array('Subject', 'Location', 'Description', 'StartTime', 'EndTime', 'Color', 'RecurringRule');
}

View File

@ -1,40 +0,0 @@
<?php
# Generated automatically - do not change!
class DBClass_friendica_notifications extends DBClass_animexx {
/** @var $PRIMARY_KEY array */
public $PRIMARY_KEY = array("id");
protected $SRC_TABLE = 'notifications';
/** @var $ical_uri string */
/** @var $ical_recurr_uri string */
/** @var $alert_date string */
/** @var $rel_type string */
public $ical_uri, $ical_recurr_uri, $alert_date, $rel_type;
/** @var $id int */
/** @var $uid int */
/** @var $namespace int */
/** @var $namespace_id int */
/** @var $rel_value int */
/** @var $notified int */
public $id, $uid, $namespace, $namespace_id, $rel_value, $notified;
/** @var $REL_TYPE_VALUES array */
public static $REL_TYPE_VALUES = array('second', 'minute', 'hour', 'day', 'week', 'month', 'year');
public static $REL_TYPE_SECOND = 'second';
public static $REL_TYPE_MINUTE = 'minute';
public static $REL_TYPE_HOUR = 'hour';
public static $REL_TYPE_DAY = 'day';
public static $REL_TYPE_WEEK = 'week';
public static $REL_TYPE_MONTH = 'month';
public static $REL_TYPE_YEAR = 'year';
protected $_string_fields = array('ical_uri', 'ical_recurr_uri', 'alert_date', 'rel_type');
protected $_int_fields = array('id', 'uid', 'namespace', 'namespace_id', 'rel_value', 'notified');
protected $_null_fields = array();
}

View File

@ -1,50 +0,0 @@
<?php
class DBClass_animexx
{
protected $_string_fields = array();
protected $_int_fields = array();
protected $_float_fields = array();
protected $_null_fields = array();
public $PRIMARY_KEY = array();
protected $SRC_TABLE = "";
/**
* @param $dbarray_or_id
* @throws Exception
*/
function __construct($dbarray_or_id)
{
if (is_numeric($dbarray_or_id) && count($this->PRIMARY_KEY) == 1) {
$dbarray_or_id = q("SELECT * FROM %s%s%s WHERE %s=%d",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $this->SRC_TABLE, $this->PRIMARY_KEY[0], IntVal($dbarray_or_id)
);
if (count($dbarray_or_id) == 0) throw new Exception("Not found");
$dbarray_or_id = $dbarray_or_id[0];
}
if (is_array($dbarray_or_id)) {
foreach ($this->_string_fields as $field) {
$this->$field = $dbarray_or_id[$field];
}
foreach ($this->_int_fields as $field) {
$this->$field = IntVal($dbarray_or_id[$field]);
}
foreach ($this->_float_fields as $field) {
$this->$field = FloatVal($dbarray_or_id[$field]);
}
} else throw new Exception("Not found");
}
/**
* @return array
*/
function toArray()
{
$arr = array();
foreach ($this->_string_fields as $field) $arr[$field] = $this->$field;
foreach ($this->_int_fields as $field) $arr[$field] = $this->$field;
foreach ($this->_float_fields as $field) $arr[$field] = $this->$field;
return $arr;
}
}

View File

@ -1,63 +0,0 @@
<?php
abstract class VirtualCalSourceBackend {
/**
* @static
* @param int $uid
* @param int $namespace
*/
static public function invalidateCache($uid = 0, $namespace = 0) {
q("DELETE FROM %s%scache_synchronized WHERE `uid` = %d AND `namespace` = %d",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($uid), IntVal($namespace));
}
/**
* @static
* @abstract
* @param int $uid
* @param int $namespace_id
*/
static abstract function createCache($uid = 0, $namespace_id = 0);
/**
* @static
* @param int $uid
* @param int $namespace
* @return array
*/
static public function getCachedItems($uid = 0, $namespace = 0) {
$uid = IntVal($uid);
$namespace = IntVal($namespace);
$r = q("SELECT COUNT(*) n FROM %s%scache_synchronized WHERE `uid` = %d AND `namespace` = %d",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($uid), $namespace);
if ($r[0]["n"] == 0) self::createCache();
$r = q("SELECT * FROM %s%scal_virtual_object_cache WHERE `uid` = %d AND `namespace` = %d",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $uid, $namespace);
return $r;
}
/**
* @static
* @abstract
* @param int $uid
* @param int $namespace_id
* @param string $date_from
* @param string $date_to
* @return array
*/
abstract static public function getItemsByTime($uid = 0, $namespace_id = 0, $date_from = "", $date_to = "");
/**
* @static
* @abstract
* @param int $uid
* @param string $uri
* @return array
*/
abstract static public function getItemsByUri($uid = 0, $uri);
}

View File

@ -1,138 +0,0 @@
<?php
abstract class AnimexxCalSource
{
/**
* @var int $namespace_id
*/
protected $namespace_id;
/**
* @var DBClass_friendica_calendars $calendarDb
*/
protected $calendarDb;
/**
* @var int
*/
protected $user_id;
/**
* @param int $user_id
* @param int $namespace_id
* @throws Sabre_DAV_Exception_NotFound
*/
function __construct($user_id = 0, $namespace_id = 0)
{
$this->namespace_id = IntVal($namespace_id);
$this->user_id = IntVal($user_id);
$x = q("SELECT * FROM %s%scalendars WHERE `namespace` = %d AND `namespace_id` = %d AND `uid` = %d",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $this->getNamespace(), $this->namespace_id, $this->user_id
);
if (count($x) != 1) throw new Sabre_DAV_Exception_NotFound("Not found");
try {
$this->calendarDb = new DBClass_friendica_calendars($x[0]);
} catch (Exception $e) {
throw new Sabre_DAV_Exception_NotFound("Not found");
}
}
/**
* @abstract
* @return int
*/
public static abstract function getNamespace();
/**
* @abstract
* @param int $user
* @return array
*/
public abstract function getPermissionsCalendar($user);
/**
* @abstract
* @param int $user
* @param string $item_uri
* @param string $recurrence_uri
* @param array|null $item_arr
* @return array
*/
public abstract function getPermissionsItem($user, $item_uri, $recurrence_uri, $item_arr = null);
/**
* @param string $uri
* @param array $start
* @param array $end
* @param string $subject
* @param bool $allday
* @param string $description
* @param string $location
* @param null $color
* @param string $timezone
* @param bool $notification
* @param null $notification_type
* @param null $notification_value
*/
public abstract function updateItem($uri, $start, $end, $subject = "", $allday = false, $description = "", $location = "", $color = null,
$timezone = "", $notification = true, $notification_type = null, $notification_value = null);
/**
* @abstract
* @param array $start
* @param array $end
* @param string $subject
* @param bool $allday
* @param string $description
* @param string $location
* @param null $color
* @param string $timezone
* @param bool $notification
* @param null $notification_type
* @param null $notification_value
* @return array
*/
public abstract function addItem($start, $end, $subject, $allday = false, $description = "", $location = "", $color = null,
$timezone = "", $notification = true, $notification_type = null, $notification_value = null);
/**
* @param string $uri
*/
public abstract function removeItem($uri);
/**
* @abstract
* @param string $sd
* @param string $ed
* @param string $base_path
* @return array
*/
public abstract function listItemsByRange($sd, $ed, $base_path);
/**
* @abstract
* @param string $uri
* @return array
*/
public abstract function getItemByUri($uri);
/**
* @param string $uri
* @return null|string
*/
public function getItemDetailRedirect($uri) {
return null;
}
}

View File

@ -1,332 +0,0 @@
<?php
class AnimexxCalSourcePrivate extends AnimexxCalSource
{
/**
* @return int
*/
public static function getNamespace()
{
return CALDAV_NAMESPACE_PRIVATE;
}
/**
* @param int $user
* @return array
*/
public function getPermissionsCalendar($user)
{
if ($user == $this->calendarDb->uid) return array("read"=> true, "write"=> true);
return array("read"=> false, "write"=> false);
}
/**
* @param int $user
* @param string $item_uri
* @param string $recurrence_uri
* @param null|array $item_arr
* @return array
*/
public function getPermissionsItem($user, $item_uri, $recurrence_uri, $item_arr = null)
{
$cal_perm = $this->getPermissionsCalendar($user);
if (!$cal_perm["read"]) return array("read"=> false, "write"=> false);
if (!$cal_perm["write"]) array("read"=> true, "write"=> false);
if ($item_arr === null) {
$x = q("SELECT `permission_edit` FROM %s%sjqcalendar WHERE `namespace` = %d AND `namespace_id` = %d AND `ical_uri` = '%s' AND `ical_recurr_uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $this->getNamespace(), $this->namespace_id, dbesc($item_uri), dbesc($recurrence_uri)
);
if (!$x || count($x) == 0) return array("read"=> false, "write"=> false);
return array("read"=> true, "write"=> ($x[0]["permission_edit"]));
} else {
return array("read"=> true, "write"=> ($item_arr["permission_edit"]));
}
}
/**
* @param string $uri
* @throws Sabre_DAV_Exception_NotFound
*/
public function removeItem($uri){
$obj_alt = q("SELECT * FROM %s%sjqcalendar WHERE namespace = %d AND namespace_id = %d AND ical_uri = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $this->getNamespace(), $this->namespace_id, dbesc($uri));
if (count($obj_alt) == 0) throw new Sabre_DAV_Exception_NotFound("Not found");
$calendarBackend = new Sabre_CalDAV_Backend_Std();
$calendarBackend->deleteCalendarObject($this->getNamespace() . "-" . $this->namespace_id, $obj_alt[0]["ical_uri"]);
}
/**
* @param string $uri
* @param array $start
* @param array $end
* @param string $subject
* @param bool $allday
* @param string $description
* @param string $location
* @param null $color
* @param string $timezone
* @param bool $notification
* @param null $notification_type
* @param null $notification_value
* @throws Sabre_DAV_Exception_NotFound
* @throws Sabre_DAV_Exception_Conflict
*/
public function updateItem($uri, $start, $end, $subject = "", $allday = false, $description = "", $location = "", $color = null, $timezone = "", $notification = true, $notification_type = null, $notification_value = null)
{
$a = get_app();
$usr_id = IntVal($this->calendarDb->uid);
$old = q("SELECT * FROM %s%sjqcalendar WHERE `uid` = %d AND `namespace` = %d AND `namespace_id` = %d AND `ical_uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, $usr_id, $this->getNamespace(), $this->namespace_id, dbesc($uri));
if (count($old) == 0) throw new Sabre_DAV_Exception_NotFound("Not Found 1");
$old_obj = new DBClass_friendica_jqcalendar($old[0]);
$calendarBackend = new Sabre_CalDAV_Backend_Std();
$obj = $calendarBackend->getCalendarObject($this->getNamespace() . "-" . $this->namespace_id, $old_obj->ical_uri);
if (!$obj) throw new Sabre_DAV_Exception_NotFound("Not Found 2");
$v = new vcalendar();
$v->setConfig('unique_id', $a->get_hostname());
$v->setMethod('PUBLISH');
$v->setProperty("x-wr-calname", "AnimexxCal");
$v->setProperty("X-WR-CALDESC", "Animexx Calendar");
$v->setProperty("X-WR-TIMEZONE", $a->timezone);
$obj["calendardata"] = icalendar_sanitize_string($obj["calendardata"]);
$v->parse($obj["calendardata"]);
/** @var $vevent vevent */
$vevent = $v->getComponent('vevent');
if (trim($vevent->getProperty('uid')) . ".ics" != $old_obj->ical_uri)
throw new Sabre_DAV_Exception_Conflict("URI != URI: " . $old_obj->ical_uri . " vs. " . trim($vevent->getProperty("uid")));
if ($end["year"] < $start["year"] ||
($end["year"] == $start["year"] && $end["month"] < $start["month"]) ||
($end["year"] == $start["year"] && $end["month"] == $start["month"] && $end["day"] < $start["day"]) ||
($end["year"] == $start["year"] && $end["month"] == $start["month"] && $end["day"] == $start["day"] && $end["hour"] < $start["hour"]) ||
($end["year"] == $start["year"] && $end["month"] == $start["month"] && $end["day"] == $start["day"] && $end["hour"] == $start["hour"] && $end["minute"] < $start["minute"]) ||
($end["year"] == $start["year"] && $end["month"] == $start["month"] && $end["day"] == $start["day"] && $end["hour"] == $start["hour"] && $end["minute"] == $start["minute"] && $end["second"] < $start["second"])
) {
$end = $start;
if ($end["hour"] < 23) $end["hour"]++;
} // DTEND muss <= DTSTART
if ($start["hour"] == 0 && $start["minute"] == 0 && $end["hour"] == 23 && $end["minute"] == 59) {
$allday = true;
}
if ($allday) {
$vevent->setDtstart($start["year"], $start["month"], $start["day"], FALSE, FALSE, FALSE, FALSE, array("VALUE"=> "DATE"));
$end = mktime(0, 0, 0, $end["month"], $end["day"], $end["year"]) + 3600 * 24;
// If a DST change occurs on the current day
$end += date("Z", ($end - 3600*24)) - date("Z", $end);
$vevent->setDtend(date("Y", $end), date("m", $end), date("d", $end), FALSE, FALSE, FALSE, FALSE, array("VALUE"=> "DATE"));
} else {
$vevent->setDtstart($start["year"], $start["month"], $start["day"], $start["hour"], $start["minute"], $start["second"], FALSE, array("VALUE"=> "DATE-TIME"));
$vevent->setDtend($end["year"], $end["month"], $end["day"], $end["hour"], $end["minute"], $end["second"], FALSE, array("VALUE"=> "DATE-TIME"));
}
if ($subject != "") {
$vevent->setProperty('LOCATION', $location);
$vevent->setProperty('summary', $subject);
$vevent->setProperty('description', $description);
}
if (!is_null($color) && $color >= 0) $vevent->setProperty("X-ANIMEXX-COLOR", $color);
if (!$notification || $notification_type != null) {
$vevent->deleteComponent("VALARM");
if ($notification) {
$valarm = new valarm();
$valarm->setTrigger(
($notification_type == "year" ? $notification_value : 0),
($notification_type == "month" ? $notification_value : 0),
($notification_type == "day" ? $notification_value : 0),
($notification_type == "week" ? $notification_value : 0),
($notification_type == "hour" ? $notification_value : 0),
($notification_type == "minute" ? $notification_value : 0),
($notification_type == "minute" ? $notification_value : 0),
true,
($notification_value > 0)
);
$valarm->setProperty("ACTION", "DISPLAY");
$valarm->setProperty("DESCRIPTION", $subject);
$vevent->setComponent($valarm);
}
}
$v->deleteComponent("vevent");
$v->setComponent($vevent, trim($vevent->getProperty("uid")));
$ical = $v->createCalendar();
$calendarBackend->updateCalendarObject($this->getNamespace() . "-" . $this->namespace_id, $old_obj->ical_uri, $ical);
}
/**
* @param array $start
* @param array $end
* @param string $subject
* @param bool $allday
* @param string $description
* @param string $location
* @param null $color
* @param string $timezone
* @param bool $notification
* @param null $notification_type
* @param null $notification_value
* @return array|string
*/
public function addItem($start, $end, $subject, $allday = false, $description = "", $location = "", $color = null,
$timezone = "", $notification = true, $notification_type = null, $notification_value = null)
{
$a = get_app();
$v = new vcalendar();
$v->setConfig('unique_id', $a->get_hostname());
$v->setProperty('method', 'PUBLISH');
$v->setProperty("x-wr-calname", "AnimexxCal");
$v->setProperty("X-WR-CALDESC", "Animexx Calendar");
$v->setProperty("X-WR-TIMEZONE", $a->timezone);
$vevent = dav_create_vevent($start, $end, $allday);
$vevent->setLocation(icalendar_sanitize_string($location));
$vevent->setSummary(icalendar_sanitize_string($subject));
$vevent->setDescription(icalendar_sanitize_string($description));
if (!is_null($color) && $color >= 0) $vevent->setProperty("X-ANIMEXX-COLOR", $color);
if ($notification && $notification_type == null) {
if ($allday) {
$notification_type = "hour";
$notification_value = 24;
} else {
$notification_type = "minute";
$notification_value = 60;
}
}
if ($notification) {
$valarm = new valarm();
$valarm->setTrigger(
($notification_type == "year" ? $notification_value : 0),
($notification_type == "month" ? $notification_value : 0),
($notification_type == "day" ? $notification_value : 0),
($notification_type == "week" ? $notification_value : 0),
($notification_type == "hour" ? $notification_value : 0),
($notification_type == "minute" ? $notification_value : 0),
($notification_type == "second" ? $notification_value : 0),
true,
($notification_value > 0)
);
$valarm->setAction("DISPLAY");
$valarm->setDescription($subject);
$vevent->setComponent($valarm);
}
$v->setComponent($vevent);
$ical = $v->createCalendar();
$obj_id = trim($vevent->getProperty("UID"));
$calendarBackend = new Sabre_CalDAV_Backend_Std();
$calendarBackend->createCalendarObject($this->getNamespace() . "-" . $this->namespace_id, $obj_id . ".ics", $ical);
return $obj_id . ".ics";
}
private function jqcal2wdcal($row, $usr_id, $base_path) {
$evo = new DBClass_friendica_jqcalendar($row);
$not = q("SELECT COUNT(*) num FROM %s%snotifications WHERE `ical_uri` = '%s' AND `ical_recurr_uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, dbesc($row["ical_uri"]), $row["ical_recurr_uri"]
);
$editable = $this->getPermissionsItem($usr_id, $row["ical_uri"], $row["ical_recurr_uri"], $row);
$recurring = (is_null($evo->RecurringRule) || $evo->RecurringRule == "" || $evo->RecurringRule == "NULL" ? 0 : 1);
$end = wdcal_mySql2PhpTime($evo->EndTime);
if ($evo->IsAllDayEvent) $end -= 1;
$arr = array(
"uri" => $evo->ical_uri,
"subject" => escape_tags($evo->Subject),
"start" => wdcal_mySql2PhpTime($evo->StartTime),
"end" => $end,
"is_allday" => $evo->IsAllDayEvent,
"is_moredays" => 0,
"is_recurring" => $recurring,
"color" => (is_null($evo->Color) || $evo->Color == "" ? $this->calendarDb->calendarcolor : $evo->Color),
"is_editable" => ($editable ? 1 : 0),
"is_editable_quick" => ($editable && !$recurring ? 1 : 0),
"location" => $evo->Location,
"attendees" => '',
"has_notification" => ($not[0]["num"] > 0 ? 1 : 0),
"url_detail" => $base_path . $evo->ical_uri . "/",
"url_edit" => $base_path . $evo->ical_uri . "/edit/",
"special_type" => "",
);
return $arr;
}
/**
* @param string $sd
* @param string $ed
* @param string $base_path
* @return array
*/
public function listItemsByRange($sd, $ed, $base_path)
{
$usr_id = IntVal($this->calendarDb->uid);
$von = wdcal_php2MySqlTime($sd);
$bis = wdcal_php2MySqlTime($ed);
// @TODO Events, die früher angefangen haben, aber noch andauern
$evs = q("SELECT * FROM %s%sjqcalendar WHERE `uid` = %d AND `namespace` = %d AND `namespace_id` = %d AND `starttime` between '%s' and '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX,
$usr_id, $this->getNamespace(), $this->namespace_id, dbesc($von), dbesc($bis));
$events = array();
foreach ($evs as $row) $events[] = $this->jqcal2wdcal($row, $usr_id, $base_path);
return $events;
}
/**
* @param string $uri
* @throws Sabre_DAV_Exception_NotFound
* @return array
*/
public function getItemByUri($uri)
{
$usr_id = IntVal($this->calendarDb->uid);
$evs = q("SELECT * FROM %s%sjqcalendar WHERE `uid` = %d AND `namespace` = %d AND `namespace_id` = %d AND `ical_uri` = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX,
$usr_id, $this->getNamespace(), $this->namespace_id, dbesc($uri));
if (count($evs) == 0) throw new Sabre_DAV_Exception_NotFound();
return $this->jqcal2wdcal($evs[0], $usr_id);
}
/**
* @param string $uri
* @return string
*/
public function getItemDetailRedirect($uri) {
return "/dav/wdcal/$uri/edit/";
}
}

View File

@ -1,141 +0,0 @@
<?php
class Sabre_CalDAV_Backend_Friendica extends Sabre_CalDAV_Backend_Common
{
public function getNamespace() {
return CALDAV_NAMESPACE_FRIENDICA_NATIVE;
}
public function getCalUrlPrefix() {
return "friendica";
}
/**
* Creates a new calendar for a principal.
*
* If the creation was a success, an id must be returned that can be used to reference
* this calendar in other methods, such as updateCalendar.
*
* @param string $principalUri
* @param string $calendarUri
* @param array $properties
* @throws Sabre_DAV_Exception_Forbidden
* @return void
*/
function createCalendar($principalUri, $calendarUri, array $properties)
{
throw new Sabre_DAV_Exception_Forbidden();
}
/**
* Delete a calendar and all it's objects
*
* @param string $calendarId
* @throws Sabre_DAV_Exception_Forbidden
* @return void
*/
function deleteCalendar($calendarId)
{
throw new Sabre_DAV_Exception_Forbidden();
}
/**
* @param string $calendarId
* @return array
*/
function getCalendarObjects($calendarId)
{
$a = get_app();
$user_id = $a->user["uid"];
$x = explode("-", $calendarId);
$ret = array();
$objs = FriendicaVirtualCalSourceBackend::getItemsByTime($user_id, $x[1]);
foreach ($objs as $obj) {
$ret[] = array(
"id" => IntVal($obj["data_uri"]),
"calendardata" => $obj["ical"],
"uri" => $obj["data_uri"],
"lastmodified" => $obj["date"],
"calendarid" => $calendarId,
"etag" => $obj["ical_etag"],
"size" => IntVal($obj["ical_size"]),
);
}
return $ret;
}
/**
* Returns information from a single calendar object, based on it's object
* uri.
*
* The returned array must have the same keys as getCalendarObjects. The
* 'calendardata' object is required here though, while it's not required
* for getCalendarObjects.
*
* @param string $calendarId
* @param string $objectUri
* @throws Sabre_DAV_Exception_FileNotFound
* @return array
*/
function getCalendarObject($calendarId, $objectUri)
{
$a = get_app();
$user_id = $a->user["uid"];
$obj = FriendicaVirtualCalSourceBackend::getItemsByUri($user_id, $objectUri);
return array(
"id" => IntVal($obj["data_uri"]),
"calendardata" => $obj["ical"],
"uri" => $obj["data_uri"],
"lastmodified" => $obj["date"],
"calendarid" => $calendarId,
"etag" => $obj["ical_etag"],
"size" => IntVal($obj["ical_size"]),
);
}
/**
* Creates a new calendar object.
*
* @param string $calendarId
* @param string $objectUri
* @param string $calendarData
* @throws Sabre_DAV_Exception_Forbidden
* @return null|string|void
*/
function createCalendarObject($calendarId, $objectUri, $calendarData)
{
throw new Sabre_DAV_Exception_Forbidden();
}
/**
* Updates an existing calendarobject, based on it's uri.
*
* @param string $calendarId
* @param string $objectUri
* @param string $calendarData
* @throws Sabre_DAV_Exception_Forbidden
* @return null|string|void
*/
function updateCalendarObject($calendarId, $objectUri, $calendarData)
{
throw new Sabre_DAV_Exception_Forbidden();
}
/**
* Deletes an existing calendar object.
*
* @param string $calendarId
* @param string $objectUri
* @throws Sabre_DAV_Exception_Forbidden
* @return void
*/
function deleteCalendarObject($calendarId, $objectUri)
{
throw new Sabre_DAV_Exception_Forbidden();
}
}

View File

@ -1,320 +0,0 @@
<?php
class Sabre_CardDAV_Backend_FriendicaCommunity extends Sabre_CardDAV_Backend_Abstract
{
/**
* Sets up the object
*/
public function __construct()
{
}
/**
* Returns the list of addressbooks for a specific user.
*
* @param string $principalUri
* @return array
*/
public function getAddressBooksForUser($principalUri)
{
$uid = dav_compat_principal2uid($principalUri);
$addressBooks = array();
$books = q("SELECT ctag FROM %s%saddressbooks_community WHERE uid = %d", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($uid));
if (count($books) == 0) {
q("INSERT INTO %s%saddressbooks_community (uid, ctag) VALUES (%d, 1)", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($uid));
$ctag = 1;
} else {
$ctag = $books[0]["ctag"];
}
$addressBooks[] = array(
'id' => CARDDAV_NAMESPACE_COMMUNITYCONTACTS . "-" . $uid,
'uri' => "friendica",
'principaluri' => $principalUri,
'{DAV:}displayname' => t("Friendica-Contacts"),
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}addressbook-description' => t("Your Friendica-Contacts"),
'{http://calendarserver.org/ns/}getctag' => $ctag,
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' =>
new Sabre_CardDAV_Property_SupportedAddressData(),
);
return $addressBooks;
}
/**
* Updates an addressbook's properties
*
* See Sabre_DAV_IProperties for a description of the mutations array, as
* well as the return value.
*
* @param string $addressBookId
* @param array $mutations
* @throws Sabre_DAV_Exception_Forbidden
* @see Sabre_DAV_IProperties::updateProperties
* @return bool|array
*/
public function updateAddressBook($addressBookId, array $mutations)
{
throw new Sabre_DAV_Exception_Forbidden();
}
/**
* Creates a new address book
*
* @param string $principalUri
* @param string $url Just the 'basename' of the url.
* @param array $properties
* @throws Sabre_DAV_Exception_Forbidden
* @return void
*/
public function createAddressBook($principalUri, $url, array $properties)
{
throw new Sabre_DAV_Exception_Forbidden();
}
/**
* Deletes an entire addressbook and all its contents
*
* @param int $addressBookId
* @throws Sabre_DAV_Exception_Forbidden
* @return void
*/
public function deleteAddressBook($addressBookId)
{
throw new Sabre_DAV_Exception_Forbidden();
}
/**
* @param array $contact
* @return array
*/
private function dav_contactarr2vcardsource($contact)
{
$name = explode(" ", $contact["name"]);
$first_name = $last_name = "";
$middle_name = array();
$num = count($name);
for ($i = 0; $i < $num && $first_name == ""; $i++) if ($name[$i] != "") {
$first_name = $name[$i];
unset($name[$i]);
}
for ($i = $num - 1; $i >= 0 && $last_name == ""; $i--) if (isset($name[$i]) && $name[$i] != "") {
$last_name = $name[$i];
unset($name[$i]);
}
foreach ($name as $n) if ($n != "") $middle_name[] = $n;
$vcarddata = new vcard_source_data($first_name, implode(" ", $middle_name), $last_name);
$vcarddata->homepages[] = new vcard_source_data_homepage("pref", $contact["url"]);
$vcarddata->last_update = ($contact["last-update"] > 0 ? $contact["last-update"] : $contact["created"]);
$photo = q("SELECT * FROM photo WHERE `contact-id` = %d ORDER BY scale DESC", $contact["id"]); //prefer size 80x80
if ($photo && count($photo) > 0) {
$photodata = new vcard_source_data_photo();
$photodata->width = $photo[0]["width"];
$photodata->height = $photo[0]["height"];
$photodata->type = "JPEG";
$photodata->binarydata = $photo[0]["data"];
$vcarddata->photo = $photodata;
}
switch ($contact["network"]) {
case "face":
$vcarddata->socialnetworks[] = new vcard_source_data_socialnetwork("facebook", $contact["notify"], "http://www.facebook.com/" . $contact["notify"]);
break;
case "dfrn":
$vcarddata->socialnetworks[] = new vcard_source_data_socialnetwork("dfrn", $contact["nick"], $contact["url"]);
break;
case "twitter":
$vcarddata->socialnetworks[] = new vcard_source_data_socialnetwork("twitter", $contact["nick"], "http://twitter.com/" . $contact["nick"]); // @TODO Stimmt das?
break;
}
$vcard = vcard_source_compile($vcarddata);
return array(
"id" => $contact["id"],
"carddata" => $vcard,
"uri" => $contact["id"] . ".vcf",
"lastmodified" => wdcal_mySql2PhpTime($vcarddata->last_update),
"etag" => md5($vcard),
"size" => strlen($vcard),
);
}
/**
* @param int $uid
* @param array|int[] $exclude_ids
* @return array
*/
private function dav_getCommunityContactsVCards($uid = 0, $exclude_ids = array())
{
$notin = (count($exclude_ids) > 0 ? " AND id NOT IN (" . implode(", ", $exclude_ids) . ") " : "");
$uid = IntVal($uid);
$contacts = q("SELECT * FROM `contact` WHERE `uid` = %d AND `blocked` = 0 AND `pending` = 0 AND `hidden` = 0 AND `archive` = 0 $notin ORDER BY `name` ASC", $uid);
$retdata = array();
foreach ($contacts as $contact) {
$x = $this->dav_contactarr2vcardsource($contact);
$x["contact"] = $contact["id"];
$retdata[] = $x;
}
return $retdata;
}
/**
* Returns all cards for a specific addressbook id.
*
* This method should return the following properties for each card:
* * carddata - raw vcard data
* * uri - Some unique url
* * lastmodified - A unix timestamp
*
* It's recommended to also return the following properties:
* * etag - A unique etag. This must change every time the card changes.
* * size - The size of the card in bytes.
*
* If these last two properties are provided, less time will be spent
* calculating them. If they are specified, you can also ommit carddata.
* This may speed up certain requests, especially with large cards.
*
* @param string $addressbookId
* @return array
*/
public function getCards($addressbookId)
{
$add = explode("-", $addressbookId);
$indb = q('SELECT id, carddata, uri, lastmodified, etag, size, contact, manually_deleted FROM %s%scards WHERE namespace = %d AND namespace_id = %d',
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($add[0]), IntVal($add[1])
);
$found_contacts = array();
$contacts = array();
foreach ($indb as $x) {
if ($x["manually_deleted"] == 0) $contacts[] = $x;
$found_contacts[] = IntVal($x["contact"]);
}
$new_found = $this->dav_getCommunityContactsVCards($add[1], $found_contacts);
foreach ($new_found as $new) {
q("INSERT INTO %s%scards (namespace, namespace_id, contact, carddata, uri, lastmodified, manually_edited, manually_deleted, etag, size)
VALUES (%d, %d, %d, '%s', '%s', %d, 0, 0, '%s', %d)", CALDAV_SQL_DB, CALDAV_SQL_PREFIX,
IntVal($add[0]), IntVal($add[1]), IntVal($new["contact"]), dbesc($new["carddata"]), dbesc($new["uri"]), time(), md5($new["carddata"]), strlen($new["carddata"])
);
}
return array_merge($contacts, $new_found);
}
/**
* Returns a specfic card.
*
* The same set of properties must be returned as with getCards. The only
* exception is that 'carddata' is absolutely required.
*
* @param mixed $addressBookId
* @param string $cardUri
* @throws Sabre_DAV_Exception_NotFound
* @return array
*/
public function getCard($addressBookId, $cardUri)
{
$x = explode("-", $addressBookId);
$x = q("SELECT id, carddata, uri, lastmodified, etag, size FROM %s%scards WHERE namespace = %d AND namespace_id = %d AND uri = '%s'",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($x[0]), IntVal($x[1]), dbesc($cardUri));
if (count($x) == 0) throw new Sabre_DAV_Exception_NotFound();
return $x[0];
}
/**
* Creates a new card.
*
* The addressbook id will be passed as the first argument. This is the
* same id as it is returned from the getAddressbooksForUser method.
*
* The cardUri is a base uri, and doesn't include the full path. The
* cardData argument is the vcard body, and is passed as a string.
*
* It is possible to return an ETag from this method. This ETag is for the
* newly created resource, and must be enclosed with double quotes (that
* is, the string itself must contain the double quotes).
*
* You should only return the ETag if you store the carddata as-is. If a
* subsequent GET request on the same card does not have the same body,
* byte-by-byte and you did return an ETag here, clients tend to get
* confused.
*
* If you don't return an ETag, you can just return null.
*
* @param string $addressBookId
* @param string $cardUri
* @param string $cardData
* @throws Sabre_DAV_Exception_Forbidden
* @return string
*/
public function createCard($addressBookId, $cardUri, $cardData)
{
throw new Sabre_DAV_Exception_Forbidden();
}
/**
* Updates a card.
*
* The addressbook id will be passed as the first argument. This is the
* same id as it is returned from the getAddressbooksForUser method.
*
* The cardUri is a base uri, and doesn't include the full path. The
* cardData argument is the vcard body, and is passed as a string.
*
* It is possible to return an ETag from this method. This ETag should
* match that of the updated resource, and must be enclosed with double
* quotes (that is: the string itself must contain the actual quotes).
*
* You should only return the ETag if you store the carddata as-is. If a
* subsequent GET request on the same card does not have the same body,
* byte-by-byte and you did return an ETag here, clients tend to get
* confused.
*
* If you don't return an ETag, you can just return null.
*
* @param string $addressBookId
* @param string $cardUri
* @param string $cardData
* @throws Sabre_DAV_Exception_Forbidden
* @return string|null
*/
public function updateCard($addressBookId, $cardUri, $cardData)
{
$x = explode("-", $addressBookId);
$etag = md5($cardData);
q("UPDATE %s%scards SET carddata = '%s', lastmodified = %d, etag = '%s', size = %d, manually_edited = 1 WHERE uri = '%s' AND namespace = %d AND namespace_id =%d",
CALDAV_SQL_DB, CALDAV_SQL_PREFIX, dbesc($cardData), time(), $etag, strlen($cardData), dbesc($cardUri), IntVal($x[10]), IntVal($x[1])
);
q('UPDATE %s%saddressbooks_community SET ctag = ctag + 1 WHERE uid = %d', CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($x[1]));
return '"' . $etag . '"';
}
/**
* Deletes a card
*
* @param string $addressBookId
* @param string $cardUri
* @throws Sabre_DAV_Exception_Forbidden
* @return bool
*/
public function deleteCard($addressBookId, $cardUri)
{
$x = explode("-", $addressBookId);
q("UPDATE %s%scards SET manually_deleted = 1 WHERE namespace = %d AND namespace_id = %d AND uri = '%s'", CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($x[0]), IntVal($x[1]), dbesc($cardUri));
q('UPDATE %s%saddressbooks_community SET ctag = ctag + 1 WHERE uid = %d', CALDAV_SQL_DB, CALDAV_SQL_PREFIX, IntVal($x[1]));
return true;
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,504 +0,0 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
[This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.]
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
<one line to give the library's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random Hacker.
<signature of Ty Coon>, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

View File

@ -1,88 +0,0 @@
2.10.24 ######################
upd returnCalendar, only create header 'content-length' when gziping output
2.10.26 ######################
Concatenate iCalcreator, utilityFunction and helper functions in iCalcreator.class.php file
2.10.27 ######################
parsing dates with extended (MS outlook) time zones
2.10.28 ######################
bug in function selectComponents, (continue if) missing dtstart
2.10.29 ######################
new function ms2phpTZ, (very) simple mapping of MS outlook time zones to PHP
2.10.30 ###################### thanks Yitzchok
external (iCalUtilityFunctions) time zone helper contributions:getTimezonesAsDateArrays (expandTimezoneDates) and getTzOffsetForDate functions
2.11.1 ######################
creation of rfc6321 XML output, input iCalcreator instance
new (helper) function iCal2XML ('inner' _addXMLchild),
2.11.2 ######################
parse of rfc6321 XML input (string/file), output iCalcreator instance
new (helper) functions: XMLstr2iCal, XMLfile2iCal, XML2iCal
('inner' functions:_getXMLParams, _getXMLComponents, _getXMLProperties)
2.11.3 ######################
bug in getProperty, management of properties with multiple ocurrences
2.11.4 ######################
bug in _tz2offset, plus/minus error
2.11.5 ######################
updated _setDate _setDate2, setExdate, setRdate, utc offset management, Z-suffix
2.11.7 ######################
bug in function getConfig, 'directory' or 'filename' couldn't accept '0' (zero)
2.11.8 ######################
upd createTimezone (_setTZrrule), fixing from/to UTC offset and rdate(-s)
upd functions: _format_date_time, _setDate, _setDate2, setRdate, setExdate,
_setRexrule, _isArrayDate
new function: _strDate2arr
2.11.9 ######################
check x-props names, start with 'x-'/'X-'
2.11.10 ######################
function parse, management of list content in TEXT properties
2.11.11 ######################
always update PRODID when (re-)setting 'unique_id'
2.11.12 ######################
update management of (Attendee) parameter value lists
update rfc5545 parameters with 'DQUOTE' settings
function createAttendee and _createParams
2.11.13 ######################
upd _size75, correct line break when property content ends with '0' at pos 76
2.11.14 ######################
upd function transformDateTime, now accepting input date in array format
2.11.15 ######################
bug in function _setRexrule, UNTIL in DATE format
2.11.16 ######################
property ATTACH and large file attachments
2.11.17 ######################
bug in ATTENDEE, parsing error
2.11.19 ######################
upd using.html
2.11.20 ######################
upd createComponent, sorting standard/daylight subComponents
2.11.21 ######################
bug in selectComponents: long 'event' starting before period
2.11.23 ######################
bug: create FREEBUSY, empty property
2.11.24 ######################
bug: set/create RELATED-TO mgnt

View File

@ -1,31 +0,0 @@
A major subrelease:
- Concatenate iCalcreator, utilityFunction and helper functions in iCalcreator.class.php file
- new functionality:
-- external time zone helper contributions:getTimezonesAsDateArrays
(expandTimezoneDates) and getTzOffsetForDate functions
-- create and parse of rfc6321 XML
-- ms2phpTZ, mapping of MS outlook time zones to PHP
-- createComponent, sorting standard/daylight subComponents
- uppdates:
-- parsing dates with extended (MS outlook) time zones
-- returnCalendar, only create header 'content-length' when gziping output
-- _setDate _setDate2, setExdate, setRdate, utc offset management, Z-suffix
-- createTimezone (_setTZrrule), fixing from/to UTC offset and rdate(-s)
-- checking x-props names, start with 'x-'/'X-'
-- parse, management of list content in TEXT properties
-- all rfc5545 parameters with 'DQUOTE' settings
-- transformDateTime, accepting input date in array format
-- property ATTACH and large file attachments
- fixed bugs:
-- selectComponents, (continue if) missing dtstart
-- selectComponents: long 'event' starting before period
-- getProperty, management of properties with multiple ocurrences
-- _tz2offset, plus/minus error
-- getConfig, 'directory' or 'filename' couldn't accept '0' (zero)
-- _size75, correct line break when property content ends with '0' at pos 76--
-- _setRexrule, UNTIL in DATE format
-- ATTENDEE, parsing error
-- setFREEBUSY, empty property
-- set/create RELATED-TO mgnt
-- update of PRODID when (re-)setting 'unique_id'
- updated using manual

View File

@ -1,387 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">
<html>
<head>
<title>iCalcreator 2.12 summary</title>
<meta name="author" content="Kjell-Inge Gustafsson - kigkonsult" />
<meta name="copyright" content="2007-2012 Kjell-Inge Gustafsson - kigkonsult" />
<meta name="keywords" content="ical, calendar, calender, xcal, xml, icalender, rfc2445, rfc5545, vcalender, php, create" />
<meta name="description" content="iCalcreator summary" />
<style type="text/css">
body {
FONT-FAMILY : "Lucida Grande","Lucida Sans Unicode", "Bitstream Vera Sans", Lucida, Arial, Geneva, Helvetica, sans-serif;
FONT-SIZE : small;
MARGIN : 10px;
WIDTH : 800px;
}
h1 {
FONT-FAMILY : "Lucida Grande","Lucida Sans Unicode", "Bitstream Vera Sans", Lucida, Arial, Geneva, Helvetica, sans-serif;
FONT-SIZE : large;
}
h2 {
FONT-FAMILY : "Lucida Grande","Lucida Sans Unicode", "Bitstream Vera Sans", Lucida, Arial, Geneva, Helvetica, sans-serif;
FONT-SIZE : large;
}
h4 {
FONT-FAMILY : "Lucida Grande","Lucida Sans Unicode", "Bitstream Vera Sans", Lucida, Arial, Geneva, Helvetica, sans-serif;
FONT-SIZE : small;
FONT-WEIGHT : bold;
}
.code {
FONT-FAMILY : monospace;
FONT-SIZE : medium;
WHITE-SPACE : pre;
}
.comment {
FONT-FAMILY : arial;
FONT-SIZE : small;
FONT-STYLE : italic;
}
</style>
</head>
<body>
<h1>iCalcreator v2.12</h1>
iCalcreator v2.12<br />
copyright (c) 2007-2012 Kjell-Inge Gustafsson, kigkonsult<br />
<a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult.se/iCalcreator" target="_blank">kigkonsult.se iCalcreator</a><br>
<a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">kigkonsult.se contact</a><br>
<br />
iCalcreator is a <em>PHP</em> class package managing iCal files, supporting (non-)<strong>calendar</strong>
systems and applications to process and communicate <strong>calendar</strong> information like
events, agendas, tasks, reports, totos and journaling information.
<br /><br />
This is a <b>short summary</b> how to use iCalcreator; create, parse, edit, select and output functionality.
<br /><br />
The iCalcreator package, built of a <strong>calendar</strong> class with support of a function class and helper functions, are <strong>calendar</strong>
component property oriented. Development environment is <em>PHP</em> version 5.x but coding is done
to meet 4.x backward compatibility and may work. Some functions requires <em>PHP</em> >= 5.2.0.
<br /><br />
The iCalcreator main class, utility class and helper functions are included in the &quot;iCalcreator.class.php&quot; file.
<br /><br />
More iCalcreator supplementary and &quot;howto&quot; information will be found at
kigkonsult.se iCalcreator implement examples and test <a href="http://kigkonsult.se/test/index.php" title="kigkonsult.se iCalcreator implement and test examples" target="_blank">pages</a>.
A strong recommendation is to have the document <a href="http://kigkonsult.se/iCalcreator/docs/using.html" title="iCalcreator user's Manual" target="_blank">user's manual</a>
open in parallell when exploiting the link.
<h4>iCal</h4>
A short iCal description is found at <a href="http://en.wikipedia.org/wiki/ICalendar#Core_object" title="iCalendar From Wikipedia, the free encyclopedia" target="_blank">Wikipedia</a>. If You are not familiar with iCal, read this first!<br />
Knowledge of <strong>calendar</strong> protocol rfc5545/rfc5546 is to recommend;<br />
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="RFC5545" target="_blank">rfc5545</a>
- Internet Calendaring and Scheduling Core Object Specification (iCalendar)<br />
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc5546" title="RFC5546" target="_blank">rfc5546</a>
- iCalendar Transport-Independent Interoperability Protocol (iTIP) Scheduling Events, BusyTime, To-dos and Journal Entries <br />
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="Download RFC5545 in text format">rfc5545</a> and
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc5546" title="Download RFC5546 in text format">rfc5546</a>
obsoletes, respectively,
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc2445" title="Download RFC2445 in text format">rfc2445</a> and
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc2446" title="Download RFC2446 in text format">rfc2446</a>.
<br />
<h4>xCal</h4>
iCalcreator also supports xCal (iCal xml)<br />
<a href="http://kigkonsult.se/downloads/dl.php?f=rfc6321" title="Download RFC6321 in text format" target="_blank">rfc6321</a>
- &quot;xCal: The XML Format for <strong>iCalendar</strong>&quot;
<br />
<h4>SUPPORT</h4>
The main support channel is using iCalcreator
<a title="Sourceforge" href="http://sourceforge.net/projects/icalcreator/forums/" target="_blank">Sourceforge</a> forum.
<br />
<br />
kigkonsult offer services for software support, design and development of customizations and adaptations of <em>PHP</em>/<em>MySQL</em> solutions
with a special focus on software long term utility and reliability,
supported through our agile acquire/design/transition process model.
<br />
<h4>DONATE</h4>
You can show your appreciation for our free software,
and can support future development by making a donation to the kigkonsult GPL/LGPL projects.
<br />
<br />
Make a donation of any size by clicking <a href="http://kigkonsult.se/contact/index.php#Donate" title="Donate" target="_blank">here</a>.
Thanks in advance!
<br />
<h4>Contact</h4>
Use the contact <a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">page</a>
for queries, improvement/development issues or professional support and development.
Please note that paid support or consulting service has the highest priority.
<br />
<h4>Downloads and usage examples</h4>
On <a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult iCalcreator" target="_blank">kigkonsult.se</a> can you download the
<a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank"><b>complete manual</b></a>
and review
<a href="http://kigkonsult.se/test/index.php" title="kigkonsult.se iCalcreator implement and test examples" target="_blank">coding and test examples</b></a>.
<br />
<h4>INSTALL</h4>
Unpack to any folder<br />
- add this folder to your include-path<br />
- or unpack to your application-(include)-folder<br />
Add &quot;require_once '[folder/]iCalcreator.class.php';&quot; to your php-script.
<br />
<br />
If using <em>PHP</em> version 5.1 or higher, the default timezone need to be set/altered, now &quot;Europe/Stockholm&quot;,
line 50 in the iCalcreator.class.php file.
<br />
When creating a new calendar/component instance, review config settings.
<br />
<br />
To really boost performance, visit kigkonsult.se contact <a href="http://kigkonsult.se/contact/index.php"><u>page</u></a> for information.
<br />
<br />
<h2>CREATE</h2>
<p class="code">require_once( &quot;iCalcreator.class.php&quot; );
$config = array( &quot;unique_id&quot; =&gt; &quot;kigkonsult.se&quot; ); // <span class="comment">set a (site) unique id</span>
$v = new vcalendar( $config ); // <span class="comment">create a new calendar instance</span>
$tz = &quot;Europe/Stockholm&quot;; // <span class="comment">define time zone</span>
$v->setProperty( &quot;method&quot;, &quot;PUBLISH&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;x-wr-calname&quot;, &quot;Calendar Sample&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;X-WR-CALDESC&quot;, &quot;Calendar Description&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;X-WR-TIMEZONE&quot;, $tz ); // <span class="comment">required of some <strong>calendar</strong> software</span>
.. .
$xprops = array( &quot;X-LIC-LOCATION&quot; => $tz ); // <span class="comment">required of some <strong>calendar</strong> software</span>
iCalUtilityFunctions::createTimezone( $v, $tz, $xprops ); // <span class="comment">create timezone component(-s) <b>opt. 1</b></span>
.. . // <span class="comment">based on present date</span>
.. .
$vevent = &amp; $v->newComponent( &quot;vevent&quot; ); // <span class="comment">create an event <strong>calendar</strong> component</span>
$vevent->setProperty( &quot;dtstart&quot;, array( &quot;year&quot;=&gt;2007, &quot;month&quot;=&gt;4, &quot;day&quot;=&gt;1, &quot;hour&quot;=&gt;19, &quot;min&quot;=&gt;0, &quot;sec&quot;=&gt;0 ));
$vevent->setProperty( &quot;dtend&quot;, array( &quot;year&quot;=&gt;2007, &quot;month&quot;=&gt;4, &quot;day&quot;=&gt;1, &quot;hour&quot;=&gt;22, &quot;min&quot;=&gt;30, &quot;sec&quot;=&gt;0 ));
$vevent->setProperty( &quot;LOCATION&quot;, &quot;Central Placa&quot; ); // <span class="comment">property name - case independent</span>
$vevent->setProperty( &quot;summary&quot;, &quot;PHP summit&quot; );
$vevent->setProperty( &quot;description&quot;, &quot;This is a description&quot; );
$vevent->setProperty( &quot;comment&quot;, &quot;This is a comment&quot; );
$vevent->setProperty( &quot;attendee&quot;, &quot;attendee1@icaldomain.net&quot; );
.. .
$valarm = &amp; $vevent->newComponent( &quot;valarm&quot; ); // <span class="comment">create an event alarm</span>
$valarm->setProperty(&quot;action&quot;, &quot;DISPLAY&quot; );
$valarm->setProperty(&quot;description&quot;, $vevent->getProperty( &quot;description&quot; );
.. . // <span class="comment">reuse the event description</span>
.. .
$d = sprintf( '%04d%02d%02d %02d%02d%02d', 2007, 3, 31, 15, 0, 0 );
iCalUtilityFunctions::transformDateTime( $d, $tz, &quot;UTC&quot;, &quot;Ymd\THis\Z&quot;);
$valarm->setProperty( &quot;trigger&quot;, $d ); // <span class="comment">create alarm trigger (in UTC datetime)</span>
.. .
$vevent = & $v->newComponent( &quot;vevent&quot; ); // <span class="comment">create next event calendar component</span>
$vevent->setProperty( &quot;dtstart&quot;, &quot;20070401&quot;, array(&quot;VALUE&quot; =&gt; &quot;DATE&quot;));// <span class="comment">alt. date format, now for an all-day event</span>
$vevent->setProperty( &quot;organizer&quot; , &quot;boss@icaldomain.com&quot; );
$vevent->setProperty( &quot;summary&quot;, &quot;ALL-DAY event&quot; );
$vevent->setProperty( &quot;description&quot;, &quot;This is a description for an all-day event&quot; );
$vevent->setProperty( &quot;resources&quot;, &quot;COMPUTER PROJECTOR&quot; );
$vevent->setProperty( &quot;rrule&quot;, array( &quot;FREQ&quot; =&gt; &quot;WEEKLY&quot;, &quot;count&quot; =&gt; 4));// <span class="comment">weekly, four occasions</span>
$vevent->parse( &quot;LOCATION:1CP Conference Room 4350&quot; ); // <span class="comment">supporting parse of strict rfc5545 formatted text</span>
.. .
.. .// <span class="comment">all calendar components are described in <a href="http://kigkonsult.se/downloads/dl.php?f=rfc5545" title="RFC5545" target="_blank">rfc5545</a></span>
.. .// <span class="comment">a complete iCalcreator function list (ex. setProperty) in <a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank">iCalcreator manual</a></span>
.. .
iCalUtilityFunctions::createTimezone( $v, $tz, $xprops); // <span class="comment">create timezone component(-s) <b>opt. 2</b></span>
.. . // <span class="comment">based on all start dates in events (i.e. dtstart)</span>
.. .
.. .
</p>
<br />
<br />
<h2>PARSE</h2>
<h4>iCal, rfc5545 / rfc2445 </h4>
<p class="code">require_once( &quot;iCalcreator.class.php&quot; );
$config = array( &quot;unique_id&quot; =&gt; &quot;kigkonsult.se&quot; ); // <span class="comment">set a (site) unique id, required if any component UID is missing</span>
$v = new vcalendar( $config ); // <span class="comment">create a new <strong>calendar</strong> instance</span>
/* start parse of local iCal file */
$config = array( &quot;directory&quot; =&gt; &quot;calendar&quot;, &quot;filename&quot; =&gt; &quot;file.ics&quot; );
$v->setConfig( $config ); // <span class="comment">set directory and file name</span>
$v->parse();
/* start parse of remote iCal file */
$v->setConfig( &quot;url&quot;, &quot;http://www.aDomain.net/file.ics&quot; ); // <span class="comment">iCalcreator also support parse of remote files</span>
$v->parse();
$v->setProperty( &quot;method&quot;, &quot;PUBLISH&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;x-wr-calname&quot;, &quot;Calendar Sample&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;X-WR-CALDESC&quot;, &quot;Calendar Description&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;X-WR-TIMEZONE&quot;, &quot;Europe/Stockholm&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
.. .
$v->sort(); // <span class="comment">ensure start date order</span>
.. .
.. . // <span class="comment">continue process (edit, parse,select) the iCalcreator instance</span>
.. .
</p>
<h4>xCal, rfc6321 (XML)</h4>
<p class="code">require_once( &quot;iCalcreator.class.php&quot; );
$config = array( &quot;unique_id&quot; =&gt; &quot;kigkonsult.se&quot; ); // <span class="comment">set a (site) unique id, required if any component UID is missing</span>
.. .
$filename = 'xmlfile.xml'; // <span class="comment">use a local xCal file</span>
// $filename = 'http://kigkonsult.se/xcal.php?a=1&amp;b=2&amp;c=3';// <span class="comment">or a remote xCal resource</span>
if( FALSE === ( $v = XMLfile2iCal( $filename, $config ))) // <span class="comment">convert the XML resource to an iCalcreator instance</span>
exit( &quot;Error when parsing $filename" );
.. .
.. . // <span class="comment">continue process (edit, parse,select) the iCalcreator instance</span>
.. .
</p>
<br />
<h2>EDIT</h2>
<p class="code">require_once( &quot;iCalcreator.class.php&quot; );
$config = array( &quot;unique_id&quot; =&gt; &quot;kigkonsult.se&quot;, &quot;directory&quot; =&gt; &quot;calendar&quot;, &quot;filename&quot; =&gt; &quot;file.ics&quot; );
// <span class="comment">set the (site) unique id, the import directory and file name</span>
$v = new vcalendar( $config ); // <span class="comment">create a new calendar instance</span>
$v->parse();
$v->setProperty( &quot;method&quot;, &quot;PUBLISH&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;x-wr-calname&quot;, &quot;Calendar Sample&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;X-WR-CALDESC&quot;, &quot;Calendar Description&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;X-WR-TIMEZONE&quot;, &quot;Europe/Stockholm&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
while( $vevent = $v->getComponent( &quot;vevent&quot; )) { // <span class="comment">read events, one by one</span>
$uid = $vevent->getProperty( &quot;uid&quot; ); // <span class="comment">uid required, one occurrence (unique id/key for component)</span>
.. .
$dtstart = $vevent->getProperty( &quot;dtstart&quot; ); // <span class="comment">dtstart required, one occurrence</span>
.. .
if( $description = $vevent->getProperty( &quot;description&quot;, 1 )) { // <span class="comment">description optional, first occurrence</span>
.. . // <span class="comment">edit the description</span>
$vevent->setProperty( &quot;description&quot;, $description, FALSE, 1 ); // <span class="comment">update/replace the description</span>
}
while( $comment = $vevent->getProperty( &quot;comment&quot; )) { // <span class="comment">comment optional, may occur more than once </span>
.. . // <span class="comment">manage comments</span>
}
.. .
while( $vevent->deleteProperty( &quot;attendee&quot; ))
continue; // <span class="comment">remove all ATTENDEE properties .. .</span>
.. .
$v->setComponent ( $vevent, $uid ); // <span class="comment">update/replace event in calendar with <b>UID</b> as key </span>
}
.. .
.. .// <span class="comment">a complete iCalcreator function list (ex. getProperty, deleteProperty) in <a href="http://kigkonsult.se/downloads/index.php#iCalcreator" title="iCalcreator complete manual" target="_blank">iCalcreator manual</a></span>
.. .
</p>
<br />
<br />
<h2>SELECT</h2>
<p class="code">require_once( &quot;iCalcreator.class.php&quot; );
$config = array( &quot;unique_id&quot; =&gt; &quot;kigkonsult.se&quot; ); // <span class="comment">set a (site) unique id</span>
$v = new vcalendar( $config ); // <span class="comment">create a new <strong>calendar</strong> instance</span>
$v->setConfig( &quot;url&quot;, &quot;http://www.aDomain.net/file.ics&quot; ); // <span class="comment">iCalcreator also support remote files</span>
$v->parse();
$v->sort(); // <span class="comment">ensure start date order</span>
$v->setProperty( &quot;method&quot;, &quot;PUBLISH&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;x-wr-calname&quot;, &quot;Calendar Sample&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;X-WR-CALDESC&quot;, &quot;Calendar Description&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;X-WR-TIMEZONE&quot;, &quot;Europe/Stockholm&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
</p>
<h4>Select components based on specific date period</h4>
<p class="code">$eventArray = $v->selectComponents(); // <span class="comment">select components occurring <b>today</b></span>
// <span class="comment">(including components with recurrence pattern)</span>
foreach( $eventArray as $year =&gt; $yearArray) {
foreach( $yearArray as $month =&gt; $monthArray ) {
foreach( $monthArray as $day =&gt; $dailyEventsArray ) {
foreach( $dailyEventsArray as $vevent ) {
$currddate = $event->getProperty( &quot;x-current-dtstart&quot; );
// <span class="comment">if member of a recurrence set (2nd occurrence etc)</span>
// <span class="comment">returns array( &quot;x-current-dtstart&quot;</span>
// <span class="comment"> , &lt;(string) date(&quot;Y-m-d [H:i:s][timezone/UTC offset]&quot;)&gt;)</span>
$dtstart = $vevent->getProperty( &quot;dtstart&quot; ); // <span class="comment">dtstart required, one occurrence, (orig. start date)</span>
$summary = $vevent->getProperty( &quot;summary&quot; );
$description = $vevent->getProperty( &quot;description&quot; );
.. .
.. .
}
}
}
}
</p>
<h4>Select specific property values</h4>
<p class="code">$valueOccur = $v->getProperty( &quot;RESOURCES&quot; ); // <span class="comment">fetch specific property (unique) values and occurrences</span>
// <span class="comment">ATTENDEE, CATEGORIES, DTSTART, LOCATION,</span>
// <span class="comment">ORGANIZER, PRIORITY, RESOURCES, STATUS,</span>
// <span class="comment">SUMMARY, UID</span>
foreach( $valueOccur as $uniqueValue =&gt; $occurCnt ) {
echo &quot;The RESOURCES value &lt;b&gt;$uniqueValue&lt;/b&gt; occurs &lt;b&gt;$occurCnt&lt;/b&gt; times&lt;br /&gt;&quot;;
.. .
}
</p>
<h4>Select components based on specific property value</h4>
<p class="code">$selectSpec = array( &quot;CATEGORIES&quot; =&gt; &quot;course1&quot; );
$specComps = $v->selectComponents( $selectSpec ); // <span class="comment">selects components based on specific property value(-s)</span>
// <span class="comment">ATTENDEE, CATEGORIES, LOCATION, ORGANIZER,</span>
// <span class="comment">PRIORITY, RESOURCES, STATUS, SUMMARY, UID</span>
foreach( $specComps as $comp ) {
.. .
}
</p>
<br />
<br />
<h2>OUTPUT</h2>
<p class="code">require_once( &quot;iCalcreator.class.php&quot; );
$config = array( &quot;unique_id&quot; =&gt; &quot;kigkonsult.se&quot; ); // <span class="comment">set a (site) unique id</span>
$v = new vcalendar( $config ); // <span class="comment">create a new calendar instance</span>
$v->setProperty( &quot;method&quot;, &quot;PUBLISH&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;x-wr-calname&quot;, &quot;Calendar Sample&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;X-WR-CALDESC&quot;, &quot;Calendar Description&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
$v->setProperty( &quot;X-WR-TIMEZONE&quot;, &quot;Europe/Stockholm&quot; ); // <span class="comment">required of some <strong>calendar</strong> software</span>
.. .
.. . // <span class="comment">continue process (edit, parse,select) the iCalcreator instance</span>
.. .
</p>
<h4>opt 1</h4>
<p class="code">.. .
$v->returnCalendar(); // <span class="comment">redirect calendar file to browser</span>
</p>
<h4>opt 2</h4>
<p class="code">.. .
$config = array( &quot;directory&quot; =&gt; &quot;depot&quot;, &quot;filename&quot; =&gt; &quot;calendar.ics&quot; );
$v->setConfig( $config ); // <span class="comment">set output directory and file name</span>
$v->saveCalendar(); // <span class="comment">save calendar to (local) file</span>
.. .
</p>
<h4>opt 3, xCal</h4>
<p class="code">.. .
$xmlstr = iCal2XML( $v ); // <span class="comment">create well-formed XML, rfc6321</span>
...
</p>
<br />
<br />
<h2>COPYRIGHT AND LICENSE</h2>
<h4>Copyright</h4>
iCalcreator v2.12<br />
copyright (c) 2007-2012 Kjell-Inge Gustafsson, kigkonsult<br />
<a href="http://kigkonsult.se/iCalcreator/index.php" title="kigkonsult.se/iCalcreator" target="_blank">kigkonsult.se iCalcreator</a><br>
<a href="http://kigkonsult.se/contact/index.php" title="kigkonsult.se/contact" target="_blank">kigkonsult.se contact</a><br>
<br />
<h4>License</h4>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
<br /><br />
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
<br /><br />
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
or download it <a href="http://kigkonsult.se/downloads/dl.php?f=LGPL" target="_blank">here</a>.
</body>
</html>

View File

@ -1,354 +0,0 @@
/*!
* jQuery UI CSS Framework 1.8.20
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*/
/* Layout helpers
----------------------------------*/
.ui-helper-hidden { display: none; }
.ui-helper-hidden-accessible { position: absolute !important; clip: rect(1px 1px 1px 1px); clip: rect(1px,1px,1px,1px); }
.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; }
.ui-helper-clearfix:before, .ui-helper-clearfix:after { content: ""; display: table; }
.ui-helper-clearfix:after { clear: both; }
.ui-helper-clearfix { zoom: 1; }
.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); }
/* Interaction Cues
----------------------------------*/
.ui-state-disabled { cursor: default !important; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; }
/* Misc visuals
----------------------------------*/
/* Overlays */
.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
/*!
* jQuery UI CSS Framework 1.8.20
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Theming/API
*
* To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Trebuchet%20MS,%20Tahoma,%20Verdana,%20Arial,%20sans-serif&fwDefault=bold&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=f6a828&bgTextureHeader=12_gloss_wave.png&bgImgOpacityHeader=35&borderColorHeader=e78f08&fcHeader=ffffff&iconColorHeader=ffffff&bgColorContent=eeeeee&bgTextureContent=03_highlight_soft.png&bgImgOpacityContent=100&borderColorContent=dddddd&fcContent=333333&iconColorContent=222222&bgColorDefault=f6f6f6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=100&borderColorDefault=cccccc&fcDefault=1c94c4&iconColorDefault=ef8c08&bgColorHover=fdf5ce&bgTextureHover=02_glass.png&bgImgOpacityHover=100&borderColorHover=fbcb09&fcHover=c77405&iconColorHover=ef8c08&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=fbd850&fcActive=eb8f00&iconColorActive=ef8c08&bgColorHighlight=ffe45c&bgTextureHighlight=03_highlight_soft.png&bgImgOpacityHighlight=75&borderColorHighlight=fed22f&fcHighlight=363636&iconColorHighlight=228ef1&bgColorError=b81900&bgTextureError=08_diagonals_thick.png&bgImgOpacityError=18&borderColorError=cd0a0a&fcError=ffffff&iconColorError=ffd27a&bgColorOverlay=666666&bgTextureOverlay=08_diagonals_thick.png&bgImgOpacityOverlay=20&opacityOverlay=50&bgColorShadow=000000&bgTextureShadow=01_flat.png&bgImgOpacityShadow=10&opacityShadow=20&thicknessShadow=5px&offsetTopShadow=-5px&offsetLeftShadow=-5px&cornerRadiusShadow=5px
*/
/* Component containers
----------------------------------*/
.ui-widget { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1.1em; }
.ui-widget .ui-widget { font-size: 1em; }
.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Trebuchet MS, Tahoma, Verdana, Arial, sans-serif; font-size: 1em; }
.ui-widget-content { border: 1px solid #dddddd; background: #eeeeee url(images/ui-bg_highlight-soft_100_eeeeee_1x100.png) 50% top repeat-x; color: #333333; }
.ui-widget-content a { color: #333333; }
.ui-widget-header { border: 1px solid #e78f08; background: #f6a828 url(images/ui-bg_gloss-wave_35_f6a828_500x100.png) 50% 50% repeat-x; color: #ffffff; font-weight: bold; }
.ui-widget-header a { color: #ffffff; }
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #cccccc; background: #f6f6f6 url(images/ui-bg_glass_100_f6f6f6_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #1c94c4; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #1c94c4; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #fbcb09; background: #fdf5ce url(images/ui-bg_glass_100_fdf5ce_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #c77405; }
.ui-state-hover a, .ui-state-hover a:hover { color: #c77405; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #fbd850; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: bold; color: #eb8f00; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #eb8f00; text-decoration: none; }
.ui-widget :active { outline: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fed22f; background: #ffe45c url(images/ui-bg_highlight-soft_75_ffe45c_1x100.png) 50% top repeat-x; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #b81900 url(images/ui-bg_diagonals-thick_18_b81900_40x40.png) 50% 50% repeat; color: #ffffff; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #ffffff; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #ffffff; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; }
.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; }
/* Icons
----------------------------------*/
/* states and images */
.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); }
.ui-widget-header .ui-icon {background-image: url(images/ui-icons_ffffff_256x240.png); }
.ui-state-default .ui-icon { background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-active .ui-icon {background-image: url(images/ui-icons_ef8c08_256x240.png); }
.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_228ef1_256x240.png); }
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_ffd27a_256x240.png); }
/* positioning */
.ui-icon-carat-1-n { background-position: 0 0; }
.ui-icon-carat-1-ne { background-position: -16px 0; }
.ui-icon-carat-1-e { background-position: -32px 0; }
.ui-icon-carat-1-se { background-position: -48px 0; }
.ui-icon-carat-1-s { background-position: -64px 0; }
.ui-icon-carat-1-sw { background-position: -80px 0; }
.ui-icon-carat-1-w { background-position: -96px 0; }
.ui-icon-carat-1-nw { background-position: -112px 0; }
.ui-icon-carat-2-n-s { background-position: -128px 0; }
.ui-icon-carat-2-e-w { background-position: -144px 0; }
.ui-icon-triangle-1-n { background-position: 0 -16px; }
.ui-icon-triangle-1-ne { background-position: -16px -16px; }
.ui-icon-triangle-1-e { background-position: -32px -16px; }
.ui-icon-triangle-1-se { background-position: -48px -16px; }
.ui-icon-triangle-1-s { background-position: -64px -16px; }
.ui-icon-triangle-1-sw { background-position: -80px -16px; }
.ui-icon-triangle-1-w { background-position: -96px -16px; }
.ui-icon-triangle-1-nw { background-position: -112px -16px; }
.ui-icon-triangle-2-n-s { background-position: -128px -16px; }
.ui-icon-triangle-2-e-w { background-position: -144px -16px; }
.ui-icon-arrow-1-n { background-position: 0 -32px; }
.ui-icon-arrow-1-ne { background-position: -16px -32px; }
.ui-icon-arrow-1-e { background-position: -32px -32px; }
.ui-icon-arrow-1-se { background-position: -48px -32px; }
.ui-icon-arrow-1-s { background-position: -64px -32px; }
.ui-icon-arrow-1-sw { background-position: -80px -32px; }
.ui-icon-arrow-1-w { background-position: -96px -32px; }
.ui-icon-arrow-1-nw { background-position: -112px -32px; }
.ui-icon-arrow-2-n-s { background-position: -128px -32px; }
.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; }
.ui-icon-arrow-2-e-w { background-position: -160px -32px; }
.ui-icon-arrow-2-se-nw { background-position: -176px -32px; }
.ui-icon-arrowstop-1-n { background-position: -192px -32px; }
.ui-icon-arrowstop-1-e { background-position: -208px -32px; }
.ui-icon-arrowstop-1-s { background-position: -224px -32px; }
.ui-icon-arrowstop-1-w { background-position: -240px -32px; }
.ui-icon-arrowthick-1-n { background-position: 0 -48px; }
.ui-icon-arrowthick-1-ne { background-position: -16px -48px; }
.ui-icon-arrowthick-1-e { background-position: -32px -48px; }
.ui-icon-arrowthick-1-se { background-position: -48px -48px; }
.ui-icon-arrowthick-1-s { background-position: -64px -48px; }
.ui-icon-arrowthick-1-sw { background-position: -80px -48px; }
.ui-icon-arrowthick-1-w { background-position: -96px -48px; }
.ui-icon-arrowthick-1-nw { background-position: -112px -48px; }
.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; }
.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; }
.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; }
.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; }
.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; }
.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; }
.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; }
.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; }
.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; }
.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; }
.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; }
.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; }
.ui-icon-arrowreturn-1-w { background-position: -64px -64px; }
.ui-icon-arrowreturn-1-n { background-position: -80px -64px; }
.ui-icon-arrowreturn-1-e { background-position: -96px -64px; }
.ui-icon-arrowreturn-1-s { background-position: -112px -64px; }
.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; }
.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; }
.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; }
.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; }
.ui-icon-arrow-4 { background-position: 0 -80px; }
.ui-icon-arrow-4-diag { background-position: -16px -80px; }
.ui-icon-extlink { background-position: -32px -80px; }
.ui-icon-newwin { background-position: -48px -80px; }
.ui-icon-refresh { background-position: -64px -80px; }
.ui-icon-shuffle { background-position: -80px -80px; }
.ui-icon-transfer-e-w { background-position: -96px -80px; }
.ui-icon-transferthick-e-w { background-position: -112px -80px; }
.ui-icon-folder-collapsed { background-position: 0 -96px; }
.ui-icon-folder-open { background-position: -16px -96px; }
.ui-icon-document { background-position: -32px -96px; }
.ui-icon-document-b { background-position: -48px -96px; }
.ui-icon-note { background-position: -64px -96px; }
.ui-icon-mail-closed { background-position: -80px -96px; }
.ui-icon-mail-open { background-position: -96px -96px; }
.ui-icon-suitcase { background-position: -112px -96px; }
.ui-icon-comment { background-position: -128px -96px; }
.ui-icon-person { background-position: -144px -96px; }
.ui-icon-print { background-position: -160px -96px; }
.ui-icon-trash { background-position: -176px -96px; }
.ui-icon-locked { background-position: -192px -96px; }
.ui-icon-unlocked { background-position: -208px -96px; }
.ui-icon-bookmark { background-position: -224px -96px; }
.ui-icon-tag { background-position: -240px -96px; }
.ui-icon-home { background-position: 0 -112px; }
.ui-icon-flag { background-position: -16px -112px; }
.ui-icon-calendar { background-position: -32px -112px; }
.ui-icon-cart { background-position: -48px -112px; }
.ui-icon-pencil { background-position: -64px -112px; }
.ui-icon-clock { background-position: -80px -112px; }
.ui-icon-disk { background-position: -96px -112px; }
.ui-icon-calculator { background-position: -112px -112px; }
.ui-icon-zoomin { background-position: -128px -112px; }
.ui-icon-zoomout { background-position: -144px -112px; }
.ui-icon-search { background-position: -160px -112px; }
.ui-icon-wrench { background-position: -176px -112px; }
.ui-icon-gear { background-position: -192px -112px; }
.ui-icon-heart { background-position: -208px -112px; }
.ui-icon-star { background-position: -224px -112px; }
.ui-icon-link { background-position: -240px -112px; }
.ui-icon-cancel { background-position: 0 -128px; }
.ui-icon-plus { background-position: -16px -128px; }
.ui-icon-plusthick { background-position: -32px -128px; }
.ui-icon-minus { background-position: -48px -128px; }
.ui-icon-minusthick { background-position: -64px -128px; }
.ui-icon-close { background-position: -80px -128px; }
.ui-icon-closethick { background-position: -96px -128px; }
.ui-icon-key { background-position: -112px -128px; }
.ui-icon-lightbulb { background-position: -128px -128px; }
.ui-icon-scissors { background-position: -144px -128px; }
.ui-icon-clipboard { background-position: -160px -128px; }
.ui-icon-copy { background-position: -176px -128px; }
.ui-icon-contact { background-position: -192px -128px; }
.ui-icon-image { background-position: -208px -128px; }
.ui-icon-video { background-position: -224px -128px; }
.ui-icon-script { background-position: -240px -128px; }
.ui-icon-alert { background-position: 0 -144px; }
.ui-icon-info { background-position: -16px -144px; }
.ui-icon-notice { background-position: -32px -144px; }
.ui-icon-help { background-position: -48px -144px; }
.ui-icon-check { background-position: -64px -144px; }
.ui-icon-bullet { background-position: -80px -144px; }
.ui-icon-radio-off { background-position: -96px -144px; }
.ui-icon-radio-on { background-position: -112px -144px; }
.ui-icon-pin-w { background-position: -128px -144px; }
.ui-icon-pin-s { background-position: -144px -144px; }
.ui-icon-play { background-position: 0 -160px; }
.ui-icon-pause { background-position: -16px -160px; }
.ui-icon-seek-next { background-position: -32px -160px; }
.ui-icon-seek-prev { background-position: -48px -160px; }
.ui-icon-seek-end { background-position: -64px -160px; }
.ui-icon-seek-start { background-position: -80px -160px; }
/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */
.ui-icon-seek-first { background-position: -80px -160px; }
.ui-icon-stop { background-position: -96px -160px; }
.ui-icon-eject { background-position: -112px -160px; }
.ui-icon-volume-off { background-position: -128px -160px; }
.ui-icon-volume-on { background-position: -144px -160px; }
.ui-icon-power { background-position: 0 -176px; }
.ui-icon-signal-diag { background-position: -16px -176px; }
.ui-icon-signal { background-position: -32px -176px; }
.ui-icon-battery-0 { background-position: -48px -176px; }
.ui-icon-battery-1 { background-position: -64px -176px; }
.ui-icon-battery-2 { background-position: -80px -176px; }
.ui-icon-battery-3 { background-position: -96px -176px; }
.ui-icon-circle-plus { background-position: 0 -192px; }
.ui-icon-circle-minus { background-position: -16px -192px; }
.ui-icon-circle-close { background-position: -32px -192px; }
.ui-icon-circle-triangle-e { background-position: -48px -192px; }
.ui-icon-circle-triangle-s { background-position: -64px -192px; }
.ui-icon-circle-triangle-w { background-position: -80px -192px; }
.ui-icon-circle-triangle-n { background-position: -96px -192px; }
.ui-icon-circle-arrow-e { background-position: -112px -192px; }
.ui-icon-circle-arrow-s { background-position: -128px -192px; }
.ui-icon-circle-arrow-w { background-position: -144px -192px; }
.ui-icon-circle-arrow-n { background-position: -160px -192px; }
.ui-icon-circle-zoomin { background-position: -176px -192px; }
.ui-icon-circle-zoomout { background-position: -192px -192px; }
.ui-icon-circle-check { background-position: -208px -192px; }
.ui-icon-circlesmall-plus { background-position: 0 -208px; }
.ui-icon-circlesmall-minus { background-position: -16px -208px; }
.ui-icon-circlesmall-close { background-position: -32px -208px; }
.ui-icon-squaresmall-plus { background-position: -48px -208px; }
.ui-icon-squaresmall-minus { background-position: -64px -208px; }
.ui-icon-squaresmall-close { background-position: -80px -208px; }
.ui-icon-grip-dotted-vertical { background-position: 0 -224px; }
.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; }
.ui-icon-grip-solid-vertical { background-position: -32px -224px; }
.ui-icon-grip-solid-horizontal { background-position: -48px -224px; }
.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; }
.ui-icon-grip-diagonal-se { background-position: -80px -224px; }
/* Misc visuals
----------------------------------*/
/* Corner radius */
.ui-corner-all, .ui-corner-top, .ui-corner-left, .ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; -khtml-border-top-left-radius: 4px; border-top-left-radius: 4px; }
.ui-corner-all, .ui-corner-top, .ui-corner-right, .ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; -khtml-border-top-right-radius: 4px; border-top-right-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-left, .ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; -khtml-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; }
.ui-corner-all, .ui-corner-bottom, .ui-corner-right, .ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; -khtml-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; }
/* Overlays */
.ui-widget-overlay { background: #666666 url(images/ui-bg_diagonals-thick_20_666666_40x40.png) 50% 50% repeat; opacity: .50;filter:Alpha(Opacity=50); }
.ui-widget-shadow { margin: -5px 0 0 -5px; padding: 5px; background: #000000 url(images/ui-bg_flat_10_000000_40x100.png) 50% 50% repeat-x; opacity: .20;filter:Alpha(Opacity=20); -moz-border-radius: 5px; -khtml-border-radius: 5px; -webkit-border-radius: 5px; border-radius: 5px; }/*!
* jQuery UI Datepicker 1.8.20
*
* Copyright 2012, AUTHORS.txt (http://jqueryui.com/about)
* Dual licensed under the MIT or GPL Version 2 licenses.
* http://jquery.org/license
*
* http://docs.jquery.com/UI/Datepicker#theming
*/
.ui-datepicker { width: 17em; padding: .2em .2em 0; display: none; }
.ui-datepicker .ui-datepicker-header { position:relative; padding:.2em 0; }
.ui-datepicker .ui-datepicker-prev, .ui-datepicker .ui-datepicker-next { position:absolute; top: 2px; width: 1.8em; height: 1.8em; }
.ui-datepicker .ui-datepicker-prev-hover, .ui-datepicker .ui-datepicker-next-hover { top: 1px; }
.ui-datepicker .ui-datepicker-prev { left:2px; }
.ui-datepicker .ui-datepicker-next { right:2px; }
.ui-datepicker .ui-datepicker-prev-hover { left:1px; }
.ui-datepicker .ui-datepicker-next-hover { right:1px; }
.ui-datepicker .ui-datepicker-prev span, .ui-datepicker .ui-datepicker-next span { display: block; position: absolute; left: 50%; margin-left: -8px; top: 50%; margin-top: -8px; }
.ui-datepicker .ui-datepicker-title { margin: 0 2.3em; line-height: 1.8em; text-align: center; }
.ui-datepicker .ui-datepicker-title select { font-size:1em; margin:1px 0; }
.ui-datepicker select.ui-datepicker-month-year {width: 100%;}
.ui-datepicker select.ui-datepicker-month,
.ui-datepicker select.ui-datepicker-year { width: 49%;}
.ui-datepicker table {width: 100%; font-size: .9em; border-collapse: collapse; margin:0 0 .4em; }
.ui-datepicker th { padding: .7em .3em; text-align: center; font-weight: bold; border: 0; }
.ui-datepicker td { border: 0; padding: 1px; }
.ui-datepicker td span, .ui-datepicker td a { display: block; padding: .2em; text-align: right; text-decoration: none; }
.ui-datepicker .ui-datepicker-buttonpane { background-image: none; margin: .7em 0 0 0; padding:0 .2em; border-left: 0; border-right: 0; border-bottom: 0; }
.ui-datepicker .ui-datepicker-buttonpane button { float: right; margin: .5em .2em .4em; cursor: pointer; padding: .2em .6em .3em .6em; width:auto; overflow:visible; }
.ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { float:left; }
/* with multiple calendars */
.ui-datepicker.ui-datepicker-multi { width:auto; }
.ui-datepicker-multi .ui-datepicker-group { float:left; }
.ui-datepicker-multi .ui-datepicker-group table { width:95%; margin:0 auto .4em; }
.ui-datepicker-multi-2 .ui-datepicker-group { width:50%; }
.ui-datepicker-multi-3 .ui-datepicker-group { width:33.3%; }
.ui-datepicker-multi-4 .ui-datepicker-group { width:25%; }
.ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { border-left-width:0; }
.ui-datepicker-multi .ui-datepicker-buttonpane { clear:left; }
.ui-datepicker-row-break { clear:both; width:100%; font-size:0em; }
/* RTL support */
.ui-datepicker-rtl { direction: rtl; }
.ui-datepicker-rtl .ui-datepicker-prev { right: 2px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next { left: 2px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-prev:hover { right: 1px; left: auto; }
.ui-datepicker-rtl .ui-datepicker-next:hover { left: 1px; right: auto; }
.ui-datepicker-rtl .ui-datepicker-buttonpane { clear:right; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button { float: left; }
.ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current { float:right; }
.ui-datepicker-rtl .ui-datepicker-group { float:right; }
.ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
.ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { border-right-width:0; border-left-width:1px; }
/* IE6 IFRAME FIX (taken from datepicker 1.5.3 */
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
display/**/: block; /*sorry for IE5*/
position: absolute; /*must have*/
z-index: -1; /*must have*/
filter: mask(); /*must have*/
top: -4px; /*must have*/
left: -4px; /*must have*/
width: 200px; /*must have*/
height: 200px; /*must have*/
}

File diff suppressed because one or more lines are too long

View File

@ -1,169 +0,0 @@
<?php
class FriendicaVirtualCalSourceBackend extends VirtualCalSourceBackend
{
/**
* @static
* @return int
*/
static public function getNamespace()
{
return CALDAV_NAMESPACE_FRIENDICA_NATIVE;
}
/**
* @static
* @param int $uid
* @param int $namespace_id
* @throws Sabre_DAV_Exception_NotFound
* @return void
*/
static function createCache($uid = 0, $namespace_id = 0)
{
}
static private function row2array($row, $timezone, $hostname, $uid, $namespace_id) {
$v = new vcalendar();
$v->setConfig('unique_id', $hostname);
$v->setProperty('method', 'PUBLISH');
$v->setProperty("x-wr-calname", "AnimexxCal");
$v->setProperty("X-WR-CALDESC", "Animexx Calendar");
$v->setProperty("X-WR-TIMEZONE", $timezone);
if ($row["adjust"]) {
$start = datetime_convert('UTC', date_default_timezone_get(), $row["start"]);
$finish = datetime_convert('UTC', date_default_timezone_get(), $row["finish"]);
} else {
$start = $row["start"];
$finish = $row["finish"];
}
$allday = (strpos($start, "00:00:00") !== false && strpos($finish, "00:00:00") !== false);
/*
if ($allday) {
$dat = Datetime::createFromFormat("Y-m-d H:i:s", $finish_tmp);
$dat->sub(new DateInterval("P1D"));
$finish = datetime_convert("UTC", date_default_timezone_get(), $dat->format("Y-m-d H:i:s"));
var_dump($finish);
}
*/
// 2012-06-29 - change to Friendica new event behaviour where summary is present and required,
// but use desc for older events where summary wasn't present or required (but desc was)
$subject = (($row["summary"]) ? $row["summary"] : substr(preg_replace("/\[[^\]]*\]/", "", $row["desc"]), 0, 100));
$description = (($row["desc"]) ? preg_replace("/\[[^\]]*\]/", "", $row["desc"]) : $row["summary"]);
$vevent = dav_create_vevent(wdcal_mySql2icalTime($row["start"]), wdcal_mySql2icalTime($row["finish"]), false);
$vevent->setLocation(icalendar_sanitize_string($row["location"]));
$vevent->setSummary(icalendar_sanitize_string($subject));
$vevent->setDescription(icalendar_sanitize_string($description));
$v->setComponent($vevent);
$ical = $v->createCalendar();
return array(
"uid" => $uid,
"namespace" => CALDAV_NAMESPACE_FRIENDICA_NATIVE,
"namespace_id" => $namespace_id,
"date" => $row["edited"],
"data_uri" => "friendica-" . $namespace_id . "-" . $row["id"] . "@" . $hostname,
"data_subject" => $subject,
"data_location" => $row["location"],
"data_description" => $description,
"data_start" => $start,
"data_end" => $finish,
"data_allday" => $allday,
"data_type" => $row["type"],
"ical" => $ical,
"ical_size" => strlen($ical),
"ical_etag" => md5($ical),
);
}
/**
* @static
* @param int $uid
* @param int $namespace_id
* @param string|int $date_from
* @param string|int $date_to
* @throws Sabre_DAV_Exception_NotFound
* @return array
*/
static public function getItemsByTime($uid = 0, $namespace_id = 0, $date_from = "", $date_to = "")
{
$uid = IntVal($uid);
$namespace_id = IntVal($namespace_id);
switch ($namespace_id) {
case CALDAV_FRIENDICA_MINE:
$sql_where = " AND cid = 0";
break;
case CALDAV_FRIENDICA_CONTACTS:
$sql_where = " AND cid > 0";
break;
default:
throw new Sabre_DAV_Exception_NotFound();
}
if ($date_from != "") {
if (is_numeric($date_from)) $sql_where .= " AND `finish` >= '" . date("Y-m-d H:i:s", $date_from) . "'";
else $sql_where .= " AND `finish` >= '" . dbesc($date_from) . "'";
}
if ($date_to != "") {
if (is_numeric($date_to)) $sql_where .= " AND `start` <= '" . date("Y-m-d H:i:s", $date_to) . "'";
else $sql_where .= " AND `start` <= '" . dbesc($date_to) . "'";
}
$ret = array();
$a = get_app();
$host = $a->get_hostname();
$r = q("SELECT * FROM `event` WHERE `uid` = %d " . $sql_where . " ORDER BY `start`", $uid);
foreach ($r as $row) $ret[] =self::row2array($row, $a->timezone, $host, $uid, $namespace_id);
return $ret;
}
/**
* @static
* @param int $uid
* @param string $uri
* @throws Sabre_DAV_Exception_NotFound
* @return array
*/
static public function getItemsByUri($uid = 0, $uri)
{
$x = explode("-", $uri);
if ($x[0] != "friendica") throw new Sabre_DAV_Exception_NotFound();
$namespace_id = IntVal($x[1]);
switch ($namespace_id) {
case CALDAV_FRIENDICA_MINE:
$sql_where = " AND cid = 0";
break;
case CALDAV_FRIENDICA_CONTACTS:
$sql_where = " AND cid > 0";
break;
default:
throw new Sabre_DAV_Exception_NotFound();
}
$a = get_app();
$host = $a->get_hostname();
$r = q("SELECT * FROM `event` WHERE `uid` = %d AND id = %d " . $sql_where, $uid, IntVal($x[2]));
if (count($r) != 1) throw new Sabre_DAV_Exception_NotFound();
$ret =self::row2array($r[0], $a->timezone, $host, $uid, $namespace_id);
return $ret;
}
}

View File

@ -1,10 +0,0 @@
v0.1.1
======
[FEATURE] A "New Event" Button in the navigation bar of the calendar is added.
[FEATURE] When creating an event by dragging in the calendar, the "Edit Details"-Link leads to a page where the details can be added before actually creating the event.
[BUGFIX] When editing a event, the start time cannot be set befor the end time anymore.
[BUGFIX] Fixed some problems with Magic Quotes
v0.1
======
Initial Release

View File

@ -1,164 +0,0 @@
<?php
class FriendicaCalSourceEvents extends AnimexxCalSource
{
/**
* @return int
*/
public static function getNamespace()
{
return CALDAV_NAMESPACE_FRIENDICA_NATIVE;
}
/**
* @param int $user
* @return array
*/
public function getPermissionsCalendar($user)
{
if ($user == $this->calendarDb->uid) return array("read"=> true, "write"=> false);
return array("read"=> false, "write"=> false);
}
/**
* @param int $user
* @param string $item_uri
* @param string $recurrence_uri
* @param null|array $item_arr
* @return array
*/
public function getPermissionsItem($user, $item_uri, $recurrence_uri, $item_arr = null)
{
$cal_perm = $this->getPermissionsCalendar($user);
if (!$cal_perm["read"]) return array("read"=> false, "write"=> false);
return array("read"=> true, "write"=> false);
}
/**
* @param string $uri
* @param array $start
* @param array $end
* @param string $subject
* @param bool $allday
* @param string $description
* @param string $location
* @param null $color
* @param string $timezone
* @param bool $notification
* @param null $notification_type
* @param null $notification_value
* @throws Sabre_DAV_Exception_MethodNotAllowed
*/
public function updateItem($uri, $start, $end, $subject = "", $allday = false, $description = "", $location = "", $color = null, $timezone = "", $notification = true, $notification_type = null, $notification_value = null)
{
throw new Sabre_DAV_Exception_MethodNotAllowed();
}
/**
* @param array $start
* @param array $end
* @param string $subject
* @param bool $allday
* @param string $description
* @param string $location
* @param null $color
* @param string $timezone
* @param bool $notification
* @param null $notification_type
* @param null $notification_value
* @throws Sabre_DAV_Exception_MethodNotAllowed
* @return array|string
*/
public function addItem($start, $end, $subject, $allday = false, $description = "", $location = "", $color = null,
$timezone = "", $notification = true, $notification_type = null, $notification_value = null)
{
throw new Sabre_DAV_Exception_MethodNotAllowed();
}
/**
* @param array $row
* @return array
*/
private function virtualData2wdcal($row) {
$end = wdcal_mySql2PhpTime($row["data_end"]);
if ($row["data_allday"]) $end--;
$start = wdcal_mySql2PhpTime($row["data_start"]);
$a = get_app();
$arr = array(
"uri" => $row["data_uri"],
"subject" => escape_tags($row["data_subject"]),
"start" => $start,
"end" => $end,
"is_allday" => ($row["data_allday"] == 1),
"is_moredays" => (date("Ymd", $start) != date("Ymd", $end)),
"is_recurring" => ($row["data_type"] == "birthday"),
"color" => "#ff0000",
"is_editable" => false,
"is_editable_quick" => false,
"location" => $row["data_location"],
"attendees" => '',
"has_notification" => false,
"url_detail" => $a->get_baseurl() . "/dav/wdcal/" . $row["data_uri"] . "/",
"url_edit" => "",
"special_type" => ($row["data_type"] == "birthday" ? "birthday" : ""),
);
return $arr;
}
/**
* @param string $sd
* @param string $ed
* @param string $base_path
* @return array
*/
public function listItemsByRange($sd, $ed, $base_path)
{
$usr_id = IntVal($this->calendarDb->uid);
$evs = FriendicaVirtualCalSourceBackend::getItemsByTime($usr_id, $this->namespace_id, $sd, $ed);
$events = array();
foreach ($evs as $row) $events[] = $this->virtualData2wdcal($row);
return $events;
}
/**
* @param string $uri
* @throws Sabre_DAV_Exception_MethodNotAllowed
* @return void
*/
public function removeItem($uri) {
throw new Sabre_DAV_Exception_MethodNotAllowed();
}
/**
* @param string $uri
* @return array
*/
public function getItemByUri($uri)
{
$usr_id = IntVal($this->calendarDb->uid);
$row = FriendicaVirtualCalSourceBackend::getItemsByUri($usr_id, $uri);
return $this->virtualData2wdcal($row);
}
/**
* @param string $uri
* @return string
*/
public function getItemDetailRedirect($uri) {
$x = explode("@", $uri);
$y = explode("-", $x[0]);
$a = get_app();
if (count($y) != 3) {
goaway($a->get_baseurl() . "/dav/wdcal/");
killme();
}
$a = get_app();
$item = q("SELECT `id` FROM `item` WHERE `event-id` = %d AND `uid` = %d AND deleted = 0", IntVal($y[2]), $a->user["uid"]);
if (count($item) == 0) return "/events/";
return "/display/" . $a->user["nickname"] . "/" . IntVal($item[0]["id"]);
}
}