mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2025-07-07 00:48:55 +00:00
Exporting and Importing ICS-Files
This commit is contained in:
parent
a96c8ce670
commit
66384e2e2c
16 changed files with 245 additions and 47 deletions
|
@ -16,8 +16,13 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
|
|||
|
||||
/**
|
||||
* We need to specify a max date, because we need to stop *somewhere*
|
||||
*
|
||||
* On 32 bit system the maximum for a signed integer is 2147483647, so
|
||||
* MAX_DATE cannot be higher than date('Y-m-d', 2147483647) which results
|
||||
* in 2038-01-19 to avoid problems when the date is converted
|
||||
* to a unix timestamp.
|
||||
*/
|
||||
const MAX_DATE = '2040-01-01';
|
||||
const MAX_DATE = '2038-01-01';
|
||||
|
||||
/**
|
||||
* pdo
|
||||
|
|
|
@ -154,8 +154,7 @@ class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
|
|||
if (is_resource($val))
|
||||
$val = stream_get_contents($val);
|
||||
|
||||
// Taking out \r to not screw up the xml output
|
||||
$returnedProperties[200][$addressDataProp] = str_replace("\r","", $val);
|
||||
$returnedProperties[200][$addressDataProp] = $val;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,8 +13,6 @@
|
|||
*/
|
||||
abstract class Sabre_DAV_Property implements Sabre_DAV_PropertyInterface {
|
||||
|
||||
abstract function serialize(Sabre_DAV_Server $server, DOMElement $prop);
|
||||
|
||||
static function unserialize(DOMElement $prop) {
|
||||
|
||||
throw new Sabre_DAV_Exception('Unserialize has not been implemented for this class');
|
||||
|
|
|
@ -337,6 +337,8 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
|
|||
$this->endDate = clone $this->startDate;
|
||||
if (isset($this->baseEvent->DURATION)) {
|
||||
$this->endDate->add(Sabre_VObject_DateTimeParser::parse($this->baseEvent->DURATION->value));
|
||||
} elseif ($this->baseEvent->DTSTART->getDateType()===Sabre_VObject_Property_DateTime::DATE) {
|
||||
$this->endDate->modify('+1 day');
|
||||
}
|
||||
}
|
||||
$this->currentDate = clone $this->startDate;
|
||||
|
@ -565,7 +567,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
|
|||
*/
|
||||
public function fastForward(DateTime $dt) {
|
||||
|
||||
while($this->valid() && $this->getDTEnd() < $dt) {
|
||||
while($this->valid() && $this->getDTEnd() <= $dt) {
|
||||
$this->next();
|
||||
}
|
||||
|
||||
|
@ -838,9 +840,40 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
|
|||
*/
|
||||
protected function nextYearly() {
|
||||
|
||||
$currentMonth = $this->currentDate->format('n');
|
||||
$currentYear = $this->currentDate->format('Y');
|
||||
$currentDayOfMonth = $this->currentDate->format('j');
|
||||
|
||||
// No sub-rules, so we just advance by year
|
||||
if (!$this->byMonth) {
|
||||
|
||||
// Unless it was a leap day!
|
||||
if ($currentMonth==2 && $currentDayOfMonth==29) {
|
||||
|
||||
$counter = 0;
|
||||
do {
|
||||
$counter++;
|
||||
// Here we increase the year count by the interval, until
|
||||
// we hit a date that's also in a leap year.
|
||||
//
|
||||
// We could just find the next interval that's dividable by
|
||||
// 4, but that would ignore the rule that there's no leap
|
||||
// year every year that's dividable by a 100, but not by
|
||||
// 400. (1800, 1900, 2100). So we just rely on the datetime
|
||||
// functions instead.
|
||||
$nextDate = clone $this->currentDate;
|
||||
$nextDate->modify('+ ' . ($this->interval*$counter) . ' years');
|
||||
} while ($nextDate->format('n')!=2);
|
||||
$this->currentDate = $nextDate;
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
// The easiest form
|
||||
$this->currentDate->modify('+' . $this->interval . ' years');
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
$currentMonth = $this->currentDate->format('n');
|
||||
|
@ -892,8 +925,8 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
|
|||
|
||||
} else {
|
||||
|
||||
// no byDay or byMonthDay, so we can just loop through the
|
||||
// months.
|
||||
// These are the 'byMonth' rules, if there are no byDay or
|
||||
// byMonthDay sub-rules.
|
||||
do {
|
||||
|
||||
$currentMonth++;
|
||||
|
@ -903,6 +936,7 @@ class Sabre_VObject_RecurrenceIterator implements Iterator {
|
|||
}
|
||||
} while (!in_array($currentMonth, $this->byMonth));
|
||||
$this->currentDate->setDate($currentYear, $currentMonth, $currentDayOfMonth);
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ class Sabre_VObject_Version {
|
|||
/**
|
||||
* Full version number
|
||||
*/
|
||||
const VERSION = '1.3.3';
|
||||
const VERSION = '1.3.4';
|
||||
|
||||
/**
|
||||
* Stability : alpha, beta, stable
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue