示例#1
0
 public function streamContents($names, XmlStreamWriterInterface $xml, $baseUri)
 {
     $xml->startElement(WebDav::NS_DAV, 'multistatus');
     $this->streamResources($names, $xml, $baseUri);
     $xml->writeElement(WebDav::NS_DAV, 'sync-token', sprintf('urn:webdav:sync:%s', $this->syncToken));
     $xml->endElement();
     // D:multistatus
 }
 public function streamContents(XmlStreamWriterInterface $xml)
 {
     $xml->startElement(WebDav::NS_DAV, 'mkcol-response');
     foreach ($this->getPropStats() as $status => $operations) {
         $this->streamPropStat($status, $operations, $xml);
     }
     $xml->endElement();
     // D:mkcol-response
 }
 public function toXml(XmlStreamWriterInterface $xml)
 {
     $xml->startElement(WebDav::NS_DAV, 'no-conflicting-lock');
     foreach ($this->uris as $uri) {
         $xml->writeElement(WebDav::NS_DAV, 'href', $uri);
     }
     $xml->endElement();
     // D:no-conflicting-lock
 }
示例#4
0
 public function streamPropStat($status, array $operations, XmlStreamWriterInterface $xml)
 {
     $xml->startElement(WebDav::NS_DAV, 'propstat');
     $xml->startElement(WebDav::NS_DAV, 'prop');
     foreach ($operations as $operation) {
         $prop = $operation->getPropertyName();
         $xml->writeElement($prop->getNamespaceUri(), $prop->getLocalName());
     }
     $xml->endElement();
     // D:prop
     $xml->writeElement(WebDav::NS_DAV, 'status', sprintf('HTTP/1.1 %u %s', $status, WebDav::getReason($status)));
     if (!empty($prop) && $prop instanceof ProppatchOperationInterface) {
         $result = $prop->getResult();
         if ($result instanceof WebDavConditionException) {
             $xml->startElement(WebDav::NS_DAV, 'error');
             $result->toXml($xml);
             $xml->endElement();
             // D:error
         }
     }
     $xml->endElement();
     // D:propstat
     $xml->flush();
 }
 public function toXml(XmlStreamWriterInterface $xml)
 {
     $xml->writeElement(WebDav::NS_DAV, 'lock-token-matches-request-uri');
 }
 public function toXml(XmlStreamWriterInterface $xml)
 {
     $xml->writeElement(WebDav::NS_DAV, 'cannot-modify-protected-property');
 }
 public function streamResourcePropertyNames(ResourceInterface $resource, XmlStreamWriterInterface $xml, $baseUri)
 {
     $xml->startElement(WebDav::NS_DAV, 'response');
     $xml->writeElement(WebDav::NS_DAV, 'href', $baseUri . Uri::encode($resource->getPath()));
     $xml->startElement(WebDav::NS_DAV, 'propstat');
     $xml->startElement(WebDav::NS_DAV, 'prop');
     $xml->writeElement(WebDav::NS_DAV, 'displayname');
     $xml->writeElement(WebDav::NS_DAV, 'getcontenttype');
     $xml->writeElement(WebDav::NS_DAV, 'creationdate');
     $xml->writeElement(WebDav::NS_DAV, 'getlastmodified');
     $xml->writeElement(WebDav::NS_DAV, 'resourcetype');
     if (!$resource->isCollection()) {
         $xml->writeElement(WebDav::NS_DAV, 'getcontentlength');
         $xml->writeElement(WebDav::NS_DAV, 'getetag');
     }
     $xml->writeElement(WebDav::NS_DAV, 'supported-method-set');
     $this->dispatcher->notify(new SerializePropertyNamesEvent($resource, $this->baseUri, $xml));
     $xml->endElement();
     // D:prop
     $xml->writeElement(WebDav::NS_DAV, 'status', 'HTTP/1.1 200 OK');
     $xml->endElement();
     // D:propstat
     $xml->endElement();
     // D:response
     $xml->flush();
 }
示例#8
0
 public function toXml(XmlStreamWriterInterface $xml, Uri $baseUri)
 {
     $xml->startElement(WebDav::NS_DAV, 'activelock');
     $xml->startElement(WebDav::NS_DAV, 'lockscope');
     $xml->writeElement(WebDav::NS_DAV, $this->isExclusive() ? 'exclusive' : 'shared');
     $xml->endElement();
     // lockscope
     $xml->startElement(WebDav::NS_DAV, 'locktype');
     $xml->writeElement(WebDav::NS_DAV, 'write');
     $xml->endElement();
     // locktype
     $xml->writeElement(WebDav::NS_DAV, 'depth', $this->depth);
     if ($this->owner != '') {
         $xml->startElement(WebDav::NS_DAV, 'owner');
         if (preg_match("'^[^:]+://'i", $this->owner)) {
             $xml->writeElement(WebDav::NS_DAV, 'href', $this->owner);
         } else {
             $xml->writeText($this->owner);
         }
         $xml->endElement();
         // owner
     }
     $seconds = $this->expires->getTimestamp() - time();
     $xml->writeElement(WebDav::NS_DAV, 'timeout', 'Second-' . ($seconds < 0 ? 0 : $seconds));
     $xml->startElement(WebDav::NS_DAV, 'locktoken');
     $xml->writeElement(WebDav::NS_DAV, 'href', 'urn:webdav:lock:' . $this->token);
     $xml->endElement();
     // locktoken
     $xml->startElement(WebDav::NS_DAV, 'lockroot');
     $xml->writeElement(WebDav::NS_DAV, 'href', rtrim($baseUri, '/') . Uri::encode($this->rootPath));
     $xml->endElement();
     // lockroot
     $xml->endElement();
     // activelock
 }
 public function toXml(XmlStreamWriterInterface $xml)
 {
     $xml->writeElement(WebDav::NS_DAV, 'valid-resourcetype');
 }
 public function toXml(XmlStreamWriterInterface $xml)
 {
     $xml->writeElement(WebDav::NS_DAV, 'propfind-finite-depth');
 }
 public function toXml(XmlStreamWriterInterface $xml)
 {
     $xml->writeElement(WebDav::NS_DAV, 'supported-report');
 }