upgrade to Sabredav 1.5.4
This commit is contained in:
parent
7b01858c57
commit
5ffec92701
|
@ -71,6 +71,7 @@ include 'Sabre/DAV/IExtendedCollection.php';
|
||||||
/* Node abstract implementations */
|
/* Node abstract implementations */
|
||||||
include 'Sabre/DAV/Node.php';
|
include 'Sabre/DAV/Node.php';
|
||||||
include 'Sabre/DAV/File.php';
|
include 'Sabre/DAV/File.php';
|
||||||
|
include 'Sabre/DAV/Collection.php';
|
||||||
include 'Sabre/DAV/Directory.php';
|
include 'Sabre/DAV/Directory.php';
|
||||||
|
|
||||||
/* Utilities */
|
/* Utilities */
|
||||||
|
@ -124,4 +125,3 @@ include 'Sabre/DAV/Auth/Backend/PDO.php';
|
||||||
/* DavMount plugin */
|
/* DavMount plugin */
|
||||||
include 'Sabre/DAV/Mount/Plugin.php';
|
include 'Sabre/DAV/Mount/Plugin.php';
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* UserAddressBook class
|
* The AddressBook class represents a CardDAV addressbook, owned by a specific user
|
||||||
|
*
|
||||||
|
* The AddressBook can contain multiple vcards
|
||||||
*
|
*
|
||||||
* @package Sabre
|
* @package Sabre
|
||||||
* @subpackage CardDAV
|
* @subpackage CardDAV
|
||||||
|
@ -9,12 +11,6 @@
|
||||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* The AddressBook class represents a CardDAV addressbook, owned by a specific user
|
|
||||||
*
|
|
||||||
* The AddressBook can contain multiple vcards
|
|
||||||
*/
|
|
||||||
class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_CardDAV_IAddressBook, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
|
class Sabre_CardDAV_AddressBook extends Sabre_DAV_Collection implements Sabre_CardDAV_IAddressBook, Sabre_DAV_IProperties, Sabre_DAVACL_IACL {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,20 +3,18 @@
|
||||||
/**
|
/**
|
||||||
* Abstract Backend class
|
* Abstract Backend class
|
||||||
*
|
*
|
||||||
|
* This class serves as a base-class for addressbook backends
|
||||||
|
*
|
||||||
|
* Note that there are references to 'addressBookId' scattered throughout the
|
||||||
|
* class. The value of the addressBookId is completely up to you, it can be any
|
||||||
|
* arbitrary value you can use as an unique identifier.
|
||||||
|
*
|
||||||
* @package Sabre
|
* @package Sabre
|
||||||
* @subpackage CardDAV
|
* @subpackage CardDAV
|
||||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* This class serves as a base-class for addressbook backends
|
|
||||||
*
|
|
||||||
* Note that there are references to 'addressBookId' scattered throughout the
|
|
||||||
* class. The value of the addressBookId is completely up to you, it can be any
|
|
||||||
* arbitrary value you can use as an unique identifier.
|
|
||||||
*/
|
|
||||||
abstract class Sabre_CardDAV_Backend_Abstract {
|
abstract class Sabre_CardDAV_Backend_Abstract {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,16 +3,14 @@
|
||||||
/**
|
/**
|
||||||
* PDO CardDAV backend
|
* PDO CardDAV backend
|
||||||
*
|
*
|
||||||
|
* This CardDAV backend uses PDO to store addressbooks
|
||||||
|
*
|
||||||
* @package Sabre
|
* @package Sabre
|
||||||
* @subpackage CardDAV
|
* @subpackage CardDAV
|
||||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* This CardDAV backend uses PDO to store addressbooks
|
|
||||||
*/
|
|
||||||
class Sabre_CardDAV_Backend_PDO extends Sabre_CardDAV_Backend_Abstract {
|
class Sabre_CardDAV_Backend_PDO extends Sabre_CardDAV_Backend_Abstract {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,17 +1,13 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Card class
|
* The Card object represents a single Card from an addressbook
|
||||||
*
|
*
|
||||||
* @package Sabre
|
* @package Sabre
|
||||||
* @subpackage CardDAV
|
* @subpackage CardDAV
|
||||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
*
|
|
||||||
/
|
|
||||||
/**
|
|
||||||
* The Card object represents a single Card from an addressbook
|
|
||||||
*/
|
*/
|
||||||
class Sabre_CardDAV_Card extends Sabre_DAV_File implements Sabre_CardDAV_ICard, Sabre_DAVACL_IACL {
|
class Sabre_CardDAV_Card extends Sabre_DAV_File implements Sabre_CardDAV_ICard, Sabre_DAVACL_IACL {
|
||||||
|
|
||||||
|
|
|
@ -3,16 +3,14 @@
|
||||||
/**
|
/**
|
||||||
* Card interface
|
* Card interface
|
||||||
*
|
*
|
||||||
|
* Extend the ICard interface to allow your custom nodes to be picked up as
|
||||||
|
* 'Cards'.
|
||||||
|
*
|
||||||
* @package Sabre
|
* @package Sabre
|
||||||
* @subpackage CardDAV
|
* @subpackage CardDAV
|
||||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
*
|
|
||||||
/
|
|
||||||
/**
|
|
||||||
* Extend the ICard interface to allow your custom nodes to be picked up as
|
|
||||||
* 'Cards'.
|
|
||||||
*/
|
*/
|
||||||
interface Sabre_CardDAV_ICard extends Sabre_DAV_IFile {
|
interface Sabre_CardDAV_ICard extends Sabre_DAV_IFile {
|
||||||
|
|
||||||
|
|
|
@ -3,17 +3,14 @@
|
||||||
/**
|
/**
|
||||||
* CardDAV plugin
|
* CardDAV plugin
|
||||||
*
|
*
|
||||||
|
* The CardDAV plugin adds CardDAV functionality to the WebDAV server
|
||||||
|
*
|
||||||
* @package Sabre
|
* @package Sabre
|
||||||
* @subpackage CardDAV
|
* @subpackage CardDAV
|
||||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The CardDAV plugin adds CardDAV functionality to the WebDAV server
|
|
||||||
*/
|
|
||||||
class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
|
class Sabre_CardDAV_Plugin extends Sabre_DAV_ServerPlugin {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,16 +3,14 @@
|
||||||
/**
|
/**
|
||||||
* UserAddressBooks class
|
* UserAddressBooks class
|
||||||
*
|
*
|
||||||
|
* The UserAddressBooks collection contains a list of addressbooks associated with a user
|
||||||
|
*
|
||||||
* @package Sabre
|
* @package Sabre
|
||||||
* @subpackage CardDAV
|
* @subpackage CardDAV
|
||||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* The UserAddressBooks collection contains a list of addressbooks associated with a user
|
|
||||||
*/
|
|
||||||
class Sabre_CardDAV_UserAddressBooks extends Sabre_DAV_Collection implements Sabre_DAV_IExtendedCollection, Sabre_DAVACL_IACL {
|
class Sabre_CardDAV_UserAddressBooks extends Sabre_DAV_Collection implements Sabre_DAV_IExtendedCollection, Sabre_DAVACL_IACL {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,16 +3,14 @@
|
||||||
/**
|
/**
|
||||||
* Version Class
|
* Version Class
|
||||||
*
|
*
|
||||||
|
* This class contains the Sabre_CardDAV version information
|
||||||
|
*
|
||||||
* @package Sabre
|
* @package Sabre
|
||||||
* @subpackage CardDAV
|
* @subpackage CardDAV
|
||||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* This class contains the Sabre_CardDAV version information
|
|
||||||
*/
|
|
||||||
class Sabre_CardDAV_Version {
|
class Sabre_CardDAV_Version {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -88,7 +88,7 @@ class Sabre_DAV_Browser_GuessContentType extends Sabre_DAV_ServerPlugin {
|
||||||
protected function getContentType($fileName) {
|
protected function getContentType($fileName) {
|
||||||
|
|
||||||
// Just grabbing the extension
|
// Just grabbing the extension
|
||||||
$extension = substr($fileName,strrpos($fileName,'.')+1);
|
$extension = strtolower(substr($fileName,strrpos($fileName,'.')+1));
|
||||||
if (isset($this->extensionMap[$extension]))
|
if (isset($this->extensionMap[$extension]))
|
||||||
return $this->extensionMap[$extension];
|
return $this->extensionMap[$extension];
|
||||||
|
|
||||||
|
|
|
@ -821,7 +821,7 @@ class Sabre_DAV_Server {
|
||||||
|
|
||||||
$node->put($body);
|
$node->put($body);
|
||||||
$this->httpResponse->setHeader('Content-Length','0');
|
$this->httpResponse->setHeader('Content-Length','0');
|
||||||
$this->httpResponse->sendStatus(200);
|
$this->httpResponse->sendStatus(204);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Sabre_DAV_Version {
|
||||||
/**
|
/**
|
||||||
* Full version number
|
* Full version number
|
||||||
*/
|
*/
|
||||||
const VERSION = '1.5.3';
|
const VERSION = '1.5.4';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stability : alpha, beta, stable
|
* Stability : alpha, beta, stable
|
||||||
|
|
|
@ -3,6 +3,9 @@
|
||||||
/**
|
/**
|
||||||
* NeedPrivileges
|
* NeedPrivileges
|
||||||
*
|
*
|
||||||
|
* The 403-need privileges is thrown when a user didn't have the appropriate
|
||||||
|
* permissions to perform an operation
|
||||||
|
*
|
||||||
* @package Sabre
|
* @package Sabre
|
||||||
* @subpackage DAVACL
|
* @subpackage DAVACL
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
@ -10,13 +13,6 @@
|
||||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
|
||||||
* NeedPrivileges
|
|
||||||
*
|
|
||||||
* The 403-need privileges is thrown when a user didn't have the appropriate
|
|
||||||
* permissions to perform an operation
|
|
||||||
*/
|
|
||||||
class Sabre_DAVACL_Exception_NeedPrivileges extends Sabre_DAV_Exception_Forbidden {
|
class Sabre_DAVACL_Exception_NeedPrivileges extends Sabre_DAV_Exception_Forbidden {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
* The users are instances of Sabre_DAV_Auth_Principal
|
* The users are instances of Sabre_DAV_Auth_Principal
|
||||||
*
|
*
|
||||||
* @package Sabre
|
* @package Sabre
|
||||||
* @subpackage DAV
|
* @subpackage DAVACL
|
||||||
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
* @copyright Copyright (C) 2007-2011 Rooftop Solutions. All rights reserved.
|
||||||
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
* @author Evert Pot (http://www.rooftopsolutions.nl/)
|
||||||
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
* @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
|
||||||
|
|
|
@ -83,13 +83,16 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
|
||||||
if (!is_null($itemValue)) {
|
if (!is_null($itemValue)) {
|
||||||
throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
|
throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
|
||||||
}
|
}
|
||||||
|
$item->parent = $this;
|
||||||
$this->children[] = $item;
|
$this->children[] = $item;
|
||||||
} elseif(is_string($item)) {
|
} elseif(is_string($item)) {
|
||||||
|
|
||||||
if (!is_scalar($itemValue)) {
|
if (!is_scalar($itemValue)) {
|
||||||
throw new InvalidArgumentException('The second argument must be scalar');
|
throw new InvalidArgumentException('The second argument must be scalar');
|
||||||
}
|
}
|
||||||
$this->children[] = new Sabre_VObject_Property($item,$itemValue);
|
$item = new Sabre_VObject_Property($item,$itemValue);
|
||||||
|
$item->parent = $this;
|
||||||
|
$this->children[] = $item;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -208,16 +211,19 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
|
||||||
$overWrite = count($matches)?key($matches):null;
|
$overWrite = count($matches)?key($matches):null;
|
||||||
|
|
||||||
if ($value instanceof Sabre_VObject_Component || $value instanceof Sabre_VObject_Property) {
|
if ($value instanceof Sabre_VObject_Component || $value instanceof Sabre_VObject_Property) {
|
||||||
|
$value->parent = $this;
|
||||||
if (!is_null($overWrite)) {
|
if (!is_null($overWrite)) {
|
||||||
$this->children[$overWrite] = $value;
|
$this->children[$overWrite] = $value;
|
||||||
} else {
|
} else {
|
||||||
$this->children[] = $value;
|
$this->children[] = $value;
|
||||||
}
|
}
|
||||||
} elseif (is_scalar($value)) {
|
} elseif (is_scalar($value)) {
|
||||||
|
$property = new Sabre_VObject_Property($name,$value);
|
||||||
|
$property->parent = $this;
|
||||||
if (!is_null($overWrite)) {
|
if (!is_null($overWrite)) {
|
||||||
$this->children[$overWrite] = new Sabre_VObject_Property($name,$value);
|
$this->children[$overWrite] = $property;
|
||||||
} else {
|
} else {
|
||||||
$this->children[] = new Sabre_VObject_Property($name,$value);
|
$this->children[] = $property;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgumentException('You must pass a Sabre_VObject_Component, Sabre_VObject_Property or scalar type');
|
throw new InvalidArgumentException('You must pass a Sabre_VObject_Component, Sabre_VObject_Property or scalar type');
|
||||||
|
@ -237,6 +243,7 @@ class Sabre_VObject_Component extends Sabre_VObject_Element {
|
||||||
foreach($matches as $k=>$child) {
|
foreach($matches as $k=>$child) {
|
||||||
|
|
||||||
unset($this->children[$k]);
|
unset($this->children[$k]);
|
||||||
|
$child->parent = null;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -116,7 +116,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
|
||||||
list(
|
list(
|
||||||
$this->dateType,
|
$this->dateType,
|
||||||
$this->dateTime
|
$this->dateTime
|
||||||
) = self::parseData($this->value, $this->offsetGet('TZID'));
|
) = self::parseData($this->value, $this);
|
||||||
return $this->dateTime;
|
return $this->dateTime;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -137,7 +137,7 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
|
||||||
list(
|
list(
|
||||||
$this->dateType,
|
$this->dateType,
|
||||||
$this->dateTime,
|
$this->dateTime,
|
||||||
) = self::parseData($this->value, $this->offsetGet('TZID'));
|
) = self::parseData($this->value, $this);
|
||||||
return $this->dateType;
|
return $this->dateType;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -152,11 +152,11 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
|
||||||
*
|
*
|
||||||
* @param string|null $propertyValue The string to parse (yymmdd or
|
* @param string|null $propertyValue The string to parse (yymmdd or
|
||||||
* ymmddThhmmss, etc..)
|
* ymmddThhmmss, etc..)
|
||||||
* @param string|null $tzid The value of the 'TZID' property.
|
* @param Sabre_VObject_Property|null $property The instance of the
|
||||||
|
* property we're parsing.
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
static public function parseData($propertyValue, $tzid) {
|
static public function parseData($propertyValue, Sabre_VObject_Property $property = null) {
|
||||||
|
|
||||||
|
|
||||||
if (is_null($propertyValue)) {
|
if (is_null($propertyValue)) {
|
||||||
return array(null, null);
|
return array(null, null);
|
||||||
|
@ -195,6 +195,8 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Finding the timezone.
|
||||||
|
$tzid = $property['TZID'];
|
||||||
if (!$tzid) {
|
if (!$tzid) {
|
||||||
return array(
|
return array(
|
||||||
self::LOCAL,
|
self::LOCAL,
|
||||||
|
@ -202,7 +204,32 @@ class Sabre_VObject_Element_DateTime extends Sabre_VObject_Property {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
$tz = new DateTimeZone($tzid->value);
|
$tz = new DateTimeZone($tzid->value);
|
||||||
|
} catch (Exception $e) {
|
||||||
|
|
||||||
|
// The id was invalid, we're going to try to find the information
|
||||||
|
// through the VTIMEZONE object.
|
||||||
|
|
||||||
|
// First we find the root object
|
||||||
|
$root = $property;
|
||||||
|
while($root->parent) {
|
||||||
|
$root = $root->parent;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($root->VTIMEZONE)) {
|
||||||
|
foreach($root->VTIMEZONE as $vtimezone) {
|
||||||
|
if (((string)$vtimezone->TZID) == $tzid) {
|
||||||
|
if (isset($vtimezone->{'X-LIC-LOCATION'})) {
|
||||||
|
$tzid = (string)$vtimezone->{'X-LIC-LOCATION'};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$tz = new DateTimeZone($tzid);
|
||||||
|
|
||||||
|
}
|
||||||
$dt = new DateTime($dateStr, $tz);
|
$dt = new DateTime($dateStr, $tz);
|
||||||
$dt->setTimeZone($tz);
|
$dt->setTimeZone($tz);
|
||||||
|
|
||||||
|
|
|
@ -121,7 +121,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
|
||||||
list(
|
list(
|
||||||
$type,
|
$type,
|
||||||
$dt
|
$dt
|
||||||
) = Sabre_VObject_Element_DateTime::parseData($val, $this->offsetGet('TZID'));
|
) = Sabre_VObject_Element_DateTime::parseData($val, $this);
|
||||||
$dts[] = $dt;
|
$dts[] = $dt;
|
||||||
$this->dateType = $type;
|
$this->dateType = $type;
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,7 @@ class Sabre_VObject_Element_MultiDateTime extends Sabre_VObject_Property {
|
||||||
list(
|
list(
|
||||||
$type,
|
$type,
|
||||||
$dt
|
$dt
|
||||||
) = Sabre_VObject_Element_DateTime::parseData($val, $this->offsetGet('TZID'));
|
) = Sabre_VObject_Element_DateTime::parseData($val, $this);
|
||||||
$dts[] = $dt;
|
$dts[] = $dt;
|
||||||
$this->dateType = $type;
|
$this->dateType = $type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,13 @@ abstract class Sabre_VObject_Node implements IteratorAggregate, ArrayAccess, Cou
|
||||||
*/
|
*/
|
||||||
protected $iterator = null;
|
protected $iterator = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A link to the parent node
|
||||||
|
*
|
||||||
|
* @var Sabre_VObject_Node
|
||||||
|
*/
|
||||||
|
protected $parent = null;
|
||||||
|
|
||||||
/* {{{ IteratorAggregator interface */
|
/* {{{ IteratorAggregator interface */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -149,13 +149,16 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
|
||||||
if (!is_null($itemValue)) {
|
if (!is_null($itemValue)) {
|
||||||
throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
|
throw new InvalidArgumentException('The second argument must not be specified, when passing a VObject');
|
||||||
}
|
}
|
||||||
|
$item->parent = $this;
|
||||||
$this->parameters[] = $item;
|
$this->parameters[] = $item;
|
||||||
} elseif(is_string($item)) {
|
} elseif(is_string($item)) {
|
||||||
|
|
||||||
if (!is_scalar($itemValue)) {
|
if (!is_scalar($itemValue)) {
|
||||||
throw new InvalidArgumentException('The second argument must be scalar');
|
throw new InvalidArgumentException('The second argument must be scalar');
|
||||||
}
|
}
|
||||||
$this->parameters[] = new Sabre_VObject_Parameter($item,$itemValue);
|
$parameter = new Sabre_VObject_Parameter($item,$itemValue);
|
||||||
|
$parameter->parent = $this;
|
||||||
|
$this->parameters[] = $parameter;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -231,12 +234,15 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
|
||||||
throw new InvalidArgumentException('A parameter name must be specified. This means you cannot use the $array[]="string" to add parameters.');
|
throw new InvalidArgumentException('A parameter name must be specified. This means you cannot use the $array[]="string" to add parameters.');
|
||||||
|
|
||||||
$this->offsetUnset($name);
|
$this->offsetUnset($name);
|
||||||
$this->parameters[] = new Sabre_VObject_Parameter($name, $value);
|
$parameter = new Sabre_VObject_Parameter($name, $value);
|
||||||
|
$parameter->parent = $this;
|
||||||
|
$this->parameters[] = $parameter;
|
||||||
|
|
||||||
} elseif ($value instanceof Sabre_VObject_Parameter) {
|
} elseif ($value instanceof Sabre_VObject_Parameter) {
|
||||||
if (!is_null($name))
|
if (!is_null($name))
|
||||||
throw new InvalidArgumentException('Don\'t specify a parameter name if you\'re passing a Sabre_VObject_Parameter. Add using $array[]=$parameterObject.');
|
throw new InvalidArgumentException('Don\'t specify a parameter name if you\'re passing a Sabre_VObject_Parameter. Add using $array[]=$parameterObject.');
|
||||||
|
|
||||||
|
$value->parent = $this;
|
||||||
$this->parameters[] = $value;
|
$this->parameters[] = $value;
|
||||||
} else {
|
} else {
|
||||||
throw new InvalidArgumentException('You can only add parameters to the property object');
|
throw new InvalidArgumentException('You can only add parameters to the property object');
|
||||||
|
@ -258,6 +264,7 @@ class Sabre_VObject_Property extends Sabre_VObject_Element {
|
||||||
$result = array();
|
$result = array();
|
||||||
foreach($this->parameters as $key=>$parameter) {
|
foreach($this->parameters as $key=>$parameter) {
|
||||||
if ($parameter->name == $name) {
|
if ($parameter->name == $name) {
|
||||||
|
$parameter->parent = null;
|
||||||
unset($this->parameters[$key]);
|
unset($this->parameters[$key]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -95,7 +95,7 @@ class Sabre_VObject_Reader {
|
||||||
|
|
||||||
while(stripos($nextLine,"END:")!==0) {
|
while(stripos($nextLine,"END:")!==0) {
|
||||||
|
|
||||||
$obj->children[] = self::readLine($lines);
|
$obj->add(self::readLine($lines));
|
||||||
$nextLine = current($lines);
|
$nextLine = current($lines);
|
||||||
|
|
||||||
if ($nextLine===false)
|
if ($nextLine===false)
|
||||||
|
@ -140,7 +140,9 @@ class Sabre_VObject_Reader {
|
||||||
|
|
||||||
if ($matches['parameters']) {
|
if ($matches['parameters']) {
|
||||||
|
|
||||||
$obj->parameters = self::readParameters($matches['parameters']);
|
foreach(self::readParameters($matches['parameters']) as $param) {
|
||||||
|
$obj->add($param);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $obj;
|
return $obj;
|
||||||
|
|
|
@ -14,7 +14,7 @@ class Sabre_VObject_Version {
|
||||||
/**
|
/**
|
||||||
* Full version number
|
* Full version number
|
||||||
*/
|
*/
|
||||||
const VERSION = '1.2.2';
|
const VERSION = '1.2.4';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Stability : alpha, beta, stable
|
* Stability : alpha, beta, stable
|
||||||
|
|
Loading…
Reference in New Issue