update sabredav to 1.5.3

remotes/origin/stable
Robin Appelman 14 years ago
parent fcc6d61fe1
commit 2086bc4be7
  1. 15
      3rdparty/Sabre/CalDAV/Backend/Abstract.php
  2. 17
      3rdparty/Sabre/CalDAV/Backend/PDO.php
  3. 4
      3rdparty/Sabre/CalDAV/Calendar.php
  4. 5
      3rdparty/Sabre/CalDAV/CalendarObject.php
  5. 18
      3rdparty/Sabre/CalDAV/ICalendar.php
  6. 20
      3rdparty/Sabre/CalDAV/ICalendarObject.php
  7. 6
      3rdparty/Sabre/CalDAV/Plugin.php
  8. 2
      3rdparty/Sabre/CalDAV/Version.php
  9. 2
      3rdparty/Sabre/CardDAV/AddressBook.php
  10. 4
      3rdparty/Sabre/CardDAV/Backend/PDO.php
  11. 3
      3rdparty/Sabre/CardDAV/Card.php
  12. 3
      3rdparty/Sabre/CardDAV/Plugin.php
  13. 69
      3rdparty/Sabre/CardDAV/Property/SupportedAddressData.php
  14. 4
      3rdparty/Sabre/CardDAV/Version.php
  15. 18
      3rdparty/Sabre/DAV/Browser/Plugin.php
  16. 43
      3rdparty/Sabre/DAV/Server.php
  17. 120
      3rdparty/Sabre/DAV/SimpleFile.php
  18. 21
      3rdparty/Sabre/DAV/StringUtil.php
  19. 42
      3rdparty/Sabre/DAV/URLUtil.php
  20. 4
      3rdparty/Sabre/DAV/Version.php
  21. 13
      3rdparty/Sabre/DAVACL/Principal.php
  22. 2
      3rdparty/Sabre/DAVACL/Version.php
  23. 2
      3rdparty/Sabre/HTTP/Response.php
  24. 2
      3rdparty/Sabre/HTTP/Version.php
  25. 6
      3rdparty/Sabre/VObject/Element/DateTime.php
  26. 6
      3rdparty/Sabre/VObject/Element/MultiDateTime.php
  27. 38
      3rdparty/Sabre/VObject/Property.php
  28. 12
      3rdparty/Sabre/VObject/Reader.php
  29. 2
      3rdparty/Sabre/VObject/Version.php

@ -36,20 +36,17 @@ abstract class Sabre_CalDAV_Backend_Abstract {
* 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.
*
* This function must return a server-wide unique id that can be used
* later to reference the calendar.
*
* @param string $principalUri
* @param string $calendarUri
* @param array $properties
* @return string|int
* @return void
*/
abstract function createCalendar($principalUri,$calendarUri,array $properties);
/**
* Updates properties on this node,
* Updates properties for a calendar.
*
* The properties array uses the propertyName in clark-notation as key,
* The mutations array uses the propertyName in clark-notation as key,
* and the array value for the property value. In the case a property
* should be deleted, the property value will be null.
*
@ -79,10 +76,10 @@ abstract class Sabre_CalDAV_Backend_Abstract {
* (424 Failed Dependency) because the request needs to be atomic.
*
* @param string $calendarId
* @param array $properties
* @param array $mutations
* @return bool|array
*/
public function updateCalendar($calendarId, array $properties) {
public function updateCalendar($calendarId, array $mutations) {
return false;
@ -97,7 +94,7 @@ abstract class Sabre_CalDAV_Backend_Abstract {
abstract function deleteCalendar($calendarId);
/**
* Returns all calendar objects within a calendar object.
* 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

@ -129,7 +129,6 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
* @param string $principalUri
* @param string $calendarUri
* @param array $properties
* @return mixed
*/
public function createCalendar($principalUri,$calendarUri, array $properties) {
@ -173,9 +172,9 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
}
/**
* Updates a calendars properties
* Updates properties for a calendar.
*
* The properties array uses the propertyName in clark-notation as key,
* The mutations array uses the propertyName in clark-notation as key,
* and the array value for the property value. In the case a property
* should be deleted, the property value will be null.
*
@ -205,10 +204,10 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
* (424 Failed Dependency) because the request needs to be atomic.
*
* @param string $calendarId
* @param array $properties
* @param array $mutations
* @return bool|array
*/
public function updateCalendar($calendarId, array $properties) {
public function updateCalendar($calendarId, array $mutations) {
$newValues = array();
$result = array(
@ -219,13 +218,13 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
$hasError = false;
foreach($properties as $propertyName=>$propertyValue) {
foreach($mutations as $propertyName=>$propertyValue) {
// We don't know about this property.
if (!isset($this->propertyMap[$propertyName])) {
$hasError = true;
$result[403][$propertyName] = null;
unset($properties[$propertyName]);
unset($mutations[$propertyName]);
continue;
}
@ -237,7 +236,7 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
// If there were any errors we need to fail the request
if ($hasError) {
// Properties has the remaining properties
foreach($properties as $propertyName=>$propertyValue) {
foreach($mutations as $propertyName=>$propertyValue) {
$result[424][$propertyName] = null;
}
@ -284,7 +283,7 @@ class Sabre_CalDAV_Backend_PDO extends Sabre_CalDAV_Backend_Abstract {
}
/**
* Returns all calendar objects within a calendar object.
* 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

@ -12,7 +12,7 @@
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_CalDAV_Calendar implements Sabre_DAV_ICollection, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
class Sabre_CalDAV_Calendar implements Sabre_CalDAV_ICalendar, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
/**
* This is an array with calendar information
@ -178,6 +178,8 @@ class Sabre_CalDAV_Calendar implements Sabre_DAV_ICollection, Sabre_DAV_IPropert
public function createFile($name,$calendarData = null) {
$calendarData = stream_get_contents($calendarData);
// Converting to UTF-8, if needed
$calendarData = Sabre_DAV_StringUtil::ensureUTF8($calendarData);
$supportedComponents = $this->calendarInfo['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set'];
if ($supportedComponents) {

@ -9,7 +9,7 @@
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_CalDAV_CalendarObject extends Sabre_DAV_File implements Sabre_DAVACL_IACL {
class Sabre_CalDAV_CalendarObject extends Sabre_DAV_File implements Sabre_CalDAV_ICalendarObject, Sabre_DAVACL_IACL {
/**
* Sabre_CalDAV_Backend_Abstract
@ -93,6 +93,9 @@ class Sabre_CalDAV_CalendarObject extends Sabre_DAV_File implements Sabre_DAVACL
if (is_resource($calendarData))
$calendarData = stream_get_contents($calendarData);
// Converting to UTF-8, if needed
$calendarData = Sabre_DAV_StringUtil::ensureUTF8($calendarData);
$supportedComponents = $this->calendarInfo['{' . Sabre_CalDAV_Plugin::NS_CALDAV . '}supported-calendar-component-set'];
if ($supportedComponents) {
$supportedComponents = $supportedComponents->getValue();

@ -0,0 +1,18 @@
<?php
/**
* Calendar interface
*
* Implement this interface to allow a node to be recognized as an calendar.
*
* @package Sabre
* @subpackage CalDAV
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_CalDAV_ICalendar extends Sabre_DAV_ICollection {
}

@ -0,0 +1,20 @@
<?php
/**
* CalendarObject interface
/**
* Extend the ICalendarObject interface to allow your custom nodes to be picked up as
* CalendarObjects.
*
* Calendar objects are resources such as Events, Todo's or Journals.
*
* @package Sabre
* @subpackage CalDAV
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
interface Sabre_CalDAV_ICalendarObject extends Sabre_DAV_IFile {
}

@ -114,7 +114,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
public function getSupportedReportSet($uri) {
$node = $this->server->tree->getNodeForPath($uri);
if ($node instanceof Sabre_CalDAV_Calendar || $node instanceof Sabre_CalDAV_CalendarObject) {
if ($node instanceof Sabre_CalDAV_ICalendar || $node instanceof Sabre_CalDAV_ICalendarObject) {
return array(
'{' . self::NS_CALDAV . '}calendar-multiget',
'{' . self::NS_CALDAV . '}calendar-query',
@ -143,7 +143,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
$server->propertyMap['{' . self::NS_CALDAV . '}supported-calendar-component-set'] = 'Sabre_CalDAV_Property_SupportedCalendarComponentSet';
$server->resourceTypeMapping['Sabre_CalDAV_Calendar'] = '{urn:ietf:params:xml:ns:caldav}calendar';
$server->resourceTypeMapping['Sabre_CalDAV_ICalendar'] = '{urn:ietf:params:xml:ns:caldav}calendar';
$server->resourceTypeMapping['Sabre_CalDAV_Principal_ProxyRead'] = '{http://calendarserver.org/ns/}calendar-proxy-read';
$server->resourceTypeMapping['Sabre_CalDAV_Principal_ProxyWrite'] = '{http://calendarserver.org/ns/}calendar-proxy-write';
@ -326,7 +326,7 @@ class Sabre_CalDAV_Plugin extends Sabre_DAV_ServerPlugin {
} // instanceof IPrincipal
if ($node instanceof Sabre_CalDAV_CalendarObject) {
if ($node instanceof Sabre_CalDAV_ICalendarObject) {
// The calendar-data property is not supposed to be a 'real'
// property, but in large chunks of the spec it does act as such.
// Therefore we simply expose it as a property.

@ -14,7 +14,7 @@ class Sabre_CalDAV_Version {
/**
* Full version number
*/
const VERSION = '1.5.0';
const VERSION = '1.5.3';
/**
* Stability : alpha, beta, stable

@ -112,6 +112,8 @@ class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_Ca
public function createFile($name,$vcardData = null) {
$vcardData = stream_get_contents($vcardData);
// Converting to UTF-8, if needed
$vcardData = Sabre_DAV_StringUtil::ensureUTF8($vcardData);
$this->carddavBackend->createCard($this->addressBookInfo['id'],$name,$vcardData);

@ -66,7 +66,9 @@ class Sabre_CardDAV_Backend_PDO extends Sabre_CardDAV_Backend_Abstract {
'principaluri' => $row['principaluri'],
'{DAV:}displayname' => $row['displayname'],
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}addressbook-description' => $row['description'],
'{http://calendarserver.org/ns/}getctag' => $row['ctag'],
'{http://calendarserver.org/ns/}getctag' => $row['ctag'],
'{' . Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' =>
new Sabre_CardDAV_Property_SupportedAddressData(),
);
}

@ -88,6 +88,9 @@ class Sabre_CardDAV_Card extends Sabre_DAV_File implements Sabre_CardDAV_ICard,
if (is_resource($cardData))
$cardData = stream_get_contents($cardData);
// Converting to UTF-8, if needed
$cardData = Sabre_DAV_StringUtil::ensureUTF8($cardData);
$this->carddavBackend->updateCard($this->addressBookInfo['id'],$this->cardData['uri'],$cardData);
$this->cardData['carddata'] = $cardData;

@ -95,9 +95,10 @@ class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
public function getSupportedReportSet($uri) {
$node = $this->server->tree->getNodeForPath($uri);
if ($node instanceof Sabre_CardDAV_AddressBook || $node instanceof Sabre_CardDAV_ICard) {
if ($node instanceof Sabre_CardDAV_IAddressBook || $node instanceof Sabre_CardDAV_ICard) {
return array(
'{' . self::NS_CARDDAV . '}addressbook-multiget',
'{' . self::NS_CARDDAV . '}addressbook-query',
);
}
return array();

@ -0,0 +1,69 @@
<?php
/**
* Supported-address-data property
*
* This property is a representation of the supported-address-data property
* in the CardDAV namespace.
*
* @package Sabre
* @subpackage CardDAV
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_CardDAV_Property_SupportedAddressData extends Sabre_DAV_Property {
/**
* supported versions
*
* @var array
*/
protected $supportedData = array();
/**
* Creates the property
*
* @param array $components
*/
public function __construct(array $supportedData = null) {
if (is_null($supportedData)) {
$supportedData = array(
array('contentType' => 'text/vcard', 'version' => '3.0'),
array('contentType' => 'text/vcard', 'version' => '4.0'),
);
}
$this->supportedData = $supportedData;
}
/**
* Serializes the property in a DOMDocument
*
* @param Sabre_DAV_Server $server
* @param DOMElement $node
* @return void
*/
public function serialize(Sabre_DAV_Server $server,DOMElement $node) {
$doc = $node->ownerDocument;
$prefix =
isset($server->xmlNamespaces[Sabre_CardDAV_Plugin::NS_CARDDAV]) ?
$server->xmlNamespaces[Sabre_CardDAV_Plugin::NS_CARDDAV] :
'card';
foreach($this->supportedData as $supported) {
$caldata = $doc->createElementNS(Sabre_CardDAV_Plugin::NS_CARDDAV, $prefix . ':address-data-type');
$caldata->setAttribute('content-type',$supported['contentType']);
$caldata->setAttribute('version',$supported['version']);
$node->appendChild($caldata);
}
}
}

@ -18,11 +18,11 @@ class Sabre_CardDAV_Version {
/**
* Full version number
*/
const VERSION = '0.2';
const VERSION = '1.5.3';
/**
* Stability : alpha, beta, stable
*/
const STABILITY = 'alpha';
const STABILITY = 'stable';
}

@ -68,9 +68,16 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
public function httpGetInterceptor($method, $uri) {
if ($method!='GET') return true;
$node = $this->server->tree->getNodeForPath($uri);
if ($node instanceof Sabre_DAV_IFile) return true;
try {
$node = $this->server->tree->getNodeForPath($uri);
} catch (Sabre_DAV_Exception_FileNotFound $e) {
// We're simply stopping when the file isn't found to not interfere
// with other plugins.
return;
}
if ($node instanceof Sabre_DAV_IFile)
return;
$this->server->httpResponse->sendStatus(200);
$this->server->httpResponse->setHeader('Content-Type','text/html; charset=utf-8');
@ -165,6 +172,8 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
'{DAV:}getlastmodified',
),1);
$parent = $this->server->tree->getNodeForPath($path);
if ($path) {
@ -189,6 +198,7 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
$type = null;
if (isset($file[200]['{DAV:}resourcetype'])) {
$type = $file[200]['{DAV:}resourcetype']->getValue();
@ -246,7 +256,7 @@ class Sabre_DAV_Browser_Plugin extends Sabre_DAV_ServerPlugin {
$html.= "<tr><td colspan=\"4\"><hr /></td></tr>";
if ($this->enablePost) {
if ($this->enablePost && $parent instanceof Sabre_DAV_ICollection) {
$html.= '<tr><td><form method="post" action="">
<h3>Create new folder</h3>
<input type="hidden" name="sabreAction" value="mkcol" />

@ -738,6 +738,34 @@ class Sabre_DAV_Server {
$body = $this->httpRequest->getBody();
// Intercepting Content-Range
if ($this->httpRequest->getHeader('Content-Range')) {
/**
Content-Range is dangerous for PUT requests: PUT per definition
stores a full resource. draft-ietf-httpbis-p2-semantics-15 says
in section 7.6:
An origin server SHOULD reject any PUT request that contains a
Content-Range header field, since it might be misinterpreted as
partial content (or might be partial content that is being mistakenly
PUT as a full representation). Partial content updates are possible
by targeting a separately identified resource with state that
overlaps a portion of the larger resource, or by using a different
method that has been specifically defined for partial updates (for
example, the PATCH method defined in [RFC5789]).
This clarifies RFC2616 section 9.6:
The recipient of the entity MUST NOT ignore any Content-*
(e.g. Content-Range) headers that it does not understand or implement
and MUST return a 501 (Not Implemented) response in such cases.
OTOH is a PUT request with a Content-Range currently the only way to
continue an aborted upload request and is supported by curl, mod_dav,
Tomcat and others. Since some clients do use this feature which results
in unexpected behaviour (cf PEAR::HTTP_WebDAV_Client 1.0.1), we reject
all PUT requests with a Content-Range for now.
*/
throw new Sabre_DAV_Exception_NotImplemented('PUT with Content-Range is not allowed.');
}
// Intercepting the Finder problem
if (($expected = $this->httpRequest->getHeader('X-Expected-Entity-Length')) && $expected > 0) {
@ -798,7 +826,10 @@ class Sabre_DAV_Server {
} else {
// If we got here, the resource didn't exist yet.
$this->createFile($this->getRequestUri(),$body);
if (!$this->createFile($this->getRequestUri(),$body)) {
// For one reason or another the file was not created.
return;
}
$this->httpResponse->setHeader('Content-Length','0');
$this->httpResponse->sendStatus(201);
@ -1377,23 +1408,27 @@ class Sabre_DAV_Server {
* Currently this is done by HTTP PUT and HTTP LOCK (in the Locks_Plugin).
* It was important to get this done through a centralized function,
* allowing plugins to intercept this using the beforeCreateFile event.
*
* This method will return true if the file was actually created
*
* @param string $uri
* @param resource $data
* @return void
* @return bool
*/
public function createFile($uri,$data) {
list($dir,$name) = Sabre_DAV_URLUtil::splitPath($uri);
if (!$this->broadcastEvent('beforeBind',array($uri))) return;
if (!$this->broadcastEvent('beforeCreateFile',array($uri,$data))) return;
if (!$this->broadcastEvent('beforeBind',array($uri))) return false;
if (!$this->broadcastEvent('beforeCreateFile',array($uri,$data))) return false;
$parent = $this->tree->getNodeForPath($dir);
$parent->createFile($name,$data);
$this->tree->markDirty($dir);
$this->broadcastEvent('afterBind',array($uri));
return true;
}
/**

@ -0,0 +1,120 @@
<?php
/**
* SimpleFile
*
* The 'SimpleFile' class is used to easily add read-only immutable files to
* the directory structure. One usecase would be to add a 'readme.txt' to a
* root of a webserver with some standard content.
*
* @package Sabre
* @subpackage DAV
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
* @author Evert Pot (http://www.rooftopsolutions.nl/)
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
*/
class Sabre_DAV_SimpleFile extends Sabre_DAV_File {
/**
* File contents
*
* @var string
*/
protected $contents = array();
/**
* Name of this resource
*
* @var string
*/
protected $name;
/**
* A mimetype, such as 'text/plain' or 'text/html'
*
* @var string
*/
protected $mimeType;
/**
* Creates this node
*
* The name of the node must be passed, as well as the contents of the
* file.
*
* @param string $name
* @param string $contents
*/
public function __construct($name, $contents, $mimeType = null) {
$this->name = $name;
$this->contents = $contents;
$this->mimeType = $mimeType;
}
/**
* Returns the node name for this file.
*
* This name is used to construct the url.
*
* @return string
*/
public function getName() {
return $this->name;
}
/**
* Returns the data
*
* This method may either return a string or a readable stream resource
*
* @return mixed
*/
public function get() {
return $this->contents;
}
/**
* Returns the size of the file, in bytes.
*
* @return int
*/
public function getSize() {
return strlen($this->contents);
}
/**
* Returns the ETag for a file
*
* An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change.
* The ETag is an arbritrary string, but MUST be surrounded by double-quotes.
*
* Return null if the ETag can not effectively be determined
*/
public function getETag() {
return '"' . md5($this->contents) . '"';
}
/**
* Returns the mime-type for a file
*
* If null is returned, we'll assume application/octet-stream
*/
public function getContentType() {
return $this->mimeType;
}
}
?>

@ -64,6 +64,27 @@ class Sabre_DAV_StringUtil {
}
}
/**
* This method takes an input string, checks if it's not valid UTF-8 and
* attempts to convert it to UTF-8 if it's not.
*
* Note that currently this can only convert ISO-8559-1 to UTF-8 (latin-1),
* anything else will likely fail.
*
* @param string $input
* @return string
*/
static public function ensureUTF8($input) {
$encoding = mb_detect_encoding($input , array('UTF-8','ISO-8859-1'), true);
if ($encoding === 'ISO-8859-1') {
return utf8_encode($input);
} else {
return $input;
}
}

@ -30,9 +30,14 @@ class Sabre_DAV_URLUtil {
*/
static function encodePath($path) {
$path = explode('/',$path);
return implode('/',array_map(array('Sabre_DAV_URLUtil','encodePathSegment'), $path));
$valid_chars = '/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.~()';
$newStr = '';
for( $i=0; isset($path[$i]); ++$i ) {
if( strpos($valid_chars,($c=$path[$i]))===false ) $newStr .= '%'.sprintf('%02x',ord($c));
else $newStr .= $c;
}
return $newStr;
}
/**
@ -45,35 +50,13 @@ class Sabre_DAV_URLUtil {
*/
static function encodePathSegment($pathSegment) {
$valid_chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.~()';
$newStr = '';
for($i=0;$i<strlen($pathSegment);$i++) {
$c = ord($pathSegment[$i]);
if(
/* Unreserved chacaters */
($c>=0x41 /* A */ && $c<=0x5a /* Z */) ||
($c>=0x61 /* a */ && $c<=0x7a /* z */) ||
($c>=0x30 /* 0 */ && $c<=0x39 /* 9 */) ||
$c===0x5f /* _ */ ||
$c===0x2d /* - */ ||
$c===0x2e /* . */ ||
$c===0x7E /* ~ */ ||
/* Reserved, but no reserved purpose */
$c===0x28 /* ( */ ||
$c===0x29 /* ) */
) {
$newStr.=$pathSegment[$i];
} else {
$newStr.='%' . str_pad(dechex($c), 2, '0', STR_PAD_LEFT);
}
for( $i=0; isset($pathSegment[$i]); ++$i ) {
if( strpos($valid_chars,($c=$pathSegment[$i]))===false ) $newStr .= '%'.sprintf('%02x',ord($c));
else $newStr .= $c;
}
return $newStr;
}
/**
@ -103,6 +86,7 @@ class Sabre_DAV_URLUtil {
case 'ISO-8859-1' :
$path = utf8_encode($path);
}
return $path;

@ -14,11 +14,11 @@ class Sabre_DAV_Version {
/**
* Full version number
*/
const VERSION = '1.5.0';
const VERSION = '1.5.3';
/**
* Stability : alpha, beta, stable
*/
const STABILITY = 'alpha';
const STABILITY = 'stable';
}

@ -68,12 +68,19 @@ class Sabre_DAVACL_Principal extends Sabre_DAV_Node implements Sabre_DAVACL_IPri
*/
public function getAlternateUriSet() {
$uris = array();
if (isset($this->principalProperties['{DAV:}alternate-URI-set'])) {
$uris = $this->principalProperties['{DAV:}alternate-URI-set'];
}
if (isset($this->principalProperties['{http://sabredav.org/ns}email-address'])) {
return array('mailto:' . $this->principalProperties['{http://sabredav.org/ns}email-address']);
} else {
return array();
$uris[] = 'mailto:' . $this->principalProperties['{http://sabredav.org/ns}email-address'];
}
return array_unique($uris);
}
/**

@ -14,7 +14,7 @@ class Sabre_DAVACL_Version {
/**
* Full version number
*/
const VERSION = '1.4.4';
const VERSION = '1.5.2';
/**
* Stability : alpha, beta, stable

@ -23,7 +23,7 @@ class Sabre_HTTP_Response {
100 => 'Continue',
101 => 'Switching Protocols',
102 => 'Processing',
200 => 'Ok',
200 => 'OK',
201 => 'Created',
202 => 'Accepted',
203 => 'Non-Authorative Information',

@ -14,7 +14,7 @@ class Sabre_HTTP_Version {
/**
* Full version number
*/
const VERSION = '1.4.1';
const VERSION = '1.5.3';
/**
* Stability : alpha, beta, stable

@ -70,20 +70,20 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
$this->setValue($dt->format('Ymd\\THis'));
$this->offsetUnset('VALUE');
$this->offsetUnset('TZID');
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('VALUE','DATETIME');
break;
case self::UTC :
$dt->setTimeZone(new DateTimeZone('UTC'));
$this->setValue($dt->format('Ymd\\THis\\Z'));
$this->offsetUnset('VALUE');
$this->offsetUnset('TZID');
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('VALUE','DATETIME');
break;
case self::LOCALTZ :
$this->setValue($dt->format('Ymd\\THis'));
$this->offsetUnset('VALUE');
$this->offsetUnset('TZID');
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('VALUE','DATETIME');
$this->offsetSet('TZID', $dt->getTimeZone()->getName());
break;
case self::DATE :

@ -60,7 +60,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
$val[] = $i->format('Ymd\\THis');
}
$this->setValue(implode(',',$val));
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('VALUE','DATETIME');
break;
case Sabre_VObject_Element_DateTime::UTC :
$val = array();
@ -69,7 +69,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
$val[] = $i->format('Ymd\\THis\\Z');
}
$this->setValue(implode(',',$val));
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('VALUE','DATETIME');
break;
case Sabre_VObject_Element_DateTime::LOCALTZ :
$val = array();
@ -77,7 +77,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
$val[] = $i->format('Ymd\\THis');
}
$this->setValue(implode(',',$val));
$this->offsetSet('VALUE','DATE-TIME');
$this->offsetSet('VALUE','DATETIME');
$this->offsetSet('TZID', $dt[0]->getTimeZone()->getName());
break;
case Sabre_VObject_Element_DateTime::DATE :

@ -128,6 +128,44 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
}
/**
* Adds a new componenten or element
*
* You can call this method with the following syntaxes:
*
* add(Sabre_VObject_Parameter $element)
* add(string $name, $value)
*
* The first version adds an Parameter
* The second adds a property as a string.
*
* @param mixed $item
* @param mixed $itemValue
* @return void
*/
public function add($item, $itemValue = null) {
if ($item instanceof Sabre_VObject_Parameter) {
if (!is_null($itemValue)) {
throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
}
$this->parameters[] = $item;
} elseif(is_string($item)) {
if (!is_scalar($itemValue)) {
throw new InvalidArgumentException('The second argument must be scalar');
}
$this->parameters[] = new Sabre_VObject_Parameter($item,$itemValue);
} else {
throw new InvalidArgumentException('The first argument must either be a Sabre_VObject_Element or a string');
}
}
/* ArrayAccess interface {{{ */
/**

@ -42,16 +42,10 @@ class Sabre_VObject_Reader {
*/
static function read($data) {
// Detecting line endings
if (strpos($data,"\r\n")!==false) {
$newLine = "\r\n";
} elseif (strpos($data,"\r")) {
$newLine = "\r";
} else {
$newLine = "\n";
}
// Normalizing newlines
$data = str_replace(array("\r","\n\n"), array("\n","\n"), $data);
$lines = explode($newLine, $data);
$lines = explode("\n", $data);
// Unfolding lines
$lines2 = array();

@ -14,7 +14,7 @@ class Sabre_VObject_Version {
/**
* Full version number
*/
const VERSION = '1.2.0';
const VERSION = '1.2.2';
/**
* Stability : alpha, beta, stable

Loading…
Cancel
Save