From 50569114acdc64e7c7cae1498635d3f821517c30 Mon Sep 17 00:00:00 2001 From: Daniel Lange Date: Mon, 7 Mar 2016 15:53:16 +0100 Subject: Initial commit of the Faster IT roundcube_calendar plugin distribution This includes: * Kolab plugins 3.2.9 (calendar and libcalendaring) * CalDAV driver 3.2.8 * .htaccess files for at least some security * SabreDAV updated to 1.8.12 (Jan 2015 release) * Support for CURLOPT_SSL_* settings to allow self-signed certificates * Small fixes & improved documentation --- .../lib/OldSabre/DAVACL/Property/Principal.php | 161 +++++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 calendar/lib/SabreDAV/lib/OldSabre/DAVACL/Property/Principal.php (limited to 'calendar/lib/SabreDAV/lib/OldSabre/DAVACL/Property/Principal.php') diff --git a/calendar/lib/SabreDAV/lib/OldSabre/DAVACL/Property/Principal.php b/calendar/lib/SabreDAV/lib/OldSabre/DAVACL/Property/Principal.php new file mode 100644 index 0000000..fbf7c1f --- /dev/null +++ b/calendar/lib/SabreDAV/lib/OldSabre/DAVACL/Property/Principal.php @@ -0,0 +1,161 @@ +type = $type; + + if ($type===self::HREF && is_null($href)) { + throw new DAV\Exception('The href argument must be specified for the HREF principal type.'); + } + $this->href = $href; + + } + + /** + * Returns the principal type + * + * @return int + */ + public function getType() { + + return $this->type; + + } + + /** + * Returns the principal uri. + * + * @return string + */ + public function getHref() { + + return $this->href; + + } + + /** + * Serializes the property into a DOMElement. + * + * @param DAV\Server $server + * @param \DOMElement $node + * @return void + */ + public function serialize(DAV\Server $server, \DOMElement $node) { + + $prefix = $server->xmlNamespaces['DAV:']; + switch($this->type) { + + case self::UNAUTHENTICATED : + $node->appendChild( + $node->ownerDocument->createElement($prefix . ':unauthenticated') + ); + break; + case self::AUTHENTICATED : + $node->appendChild( + $node->ownerDocument->createElement($prefix . ':authenticated') + ); + break; + case self::HREF : + $href = $node->ownerDocument->createElement($prefix . ':href'); + $href->nodeValue = $server->getBaseUri() . DAV\URLUtil::encodePath($this->href); + $node->appendChild($href); + break; + + } + + } + + /** + * Deserializes a DOM element into a property object. + * + * @param \DOMElement $dom + * @return Principal + */ + static public function unserialize(\DOMElement $dom) { + + $parent = $dom->firstChild; + while(!DAV\XMLUtil::toClarkNotation($parent)) { + $parent = $parent->nextSibling; + } + + switch(DAV\XMLUtil::toClarkNotation($parent)) { + + case '{DAV:}unauthenticated' : + return new self(self::UNAUTHENTICATED); + case '{DAV:}authenticated' : + return new self(self::AUTHENTICATED); + case '{DAV:}href': + return new self(self::HREF, $parent->textContent); + case '{DAV:}all': + return new self(self::ALL); + default : + throw new DAV\Exception\BadRequest('Unexpected element (' . DAV\XMLUtil::toClarkNotation($parent) . '). Could not deserialize'); + + } + + } + +} -- cgit v1.2.3