]> git.mxchange.org Git - friendica-addons.git/blob - dav/SabreDAV/lib/Sabre/DAV/Property/SupportedLock.php
privacy_image_cache: checking if the cached file really is an image
[friendica-addons.git] / dav / SabreDAV / lib / Sabre / DAV / Property / SupportedLock.php
1 <?php
2
3 /**
4  * This class represents the {DAV:}supportedlock property
5  *
6  * This property contains information about what kind of locks
7  * this server supports.
8  *
9  * @package Sabre
10  * @subpackage DAV
11  * @copyright Copyright (C) 2007-2012 Rooftop Solutions. All rights reserved.
12  * @author Evert Pot (http://www.rooftopsolutions.nl/)
13  * @license http://code.google.com/p/sabredav/wiki/License Modified BSD License
14  */
15 class Sabre_DAV_Property_SupportedLock extends Sabre_DAV_Property {
16
17     /**
18      * supportsLocks
19      *
20      * @var mixed
21      */
22     public $supportsLocks = false;
23
24     /**
25      * __construct
26      *
27      * @param mixed $supportsLocks
28      */
29     public function __construct($supportsLocks) {
30
31         $this->supportsLocks = $supportsLocks;
32
33     }
34
35     /**
36      * serialize
37      *
38      * @param Sabre_DAV_Server $server
39      * @param DOMElement       $prop
40      * @return void
41      */
42     public function serialize(Sabre_DAV_Server $server,DOMElement $prop) {
43
44         $doc = $prop->ownerDocument;
45
46         if (!$this->supportsLocks) return null;
47
48         $lockEntry1 = $doc->createElementNS('DAV:','d:lockentry');
49         $lockEntry2 = $doc->createElementNS('DAV:','d:lockentry');
50
51         $prop->appendChild($lockEntry1);
52         $prop->appendChild($lockEntry2);
53
54         $lockScope1 = $doc->createElementNS('DAV:','d:lockscope');
55         $lockScope2 = $doc->createElementNS('DAV:','d:lockscope');
56         $lockType1 = $doc->createElementNS('DAV:','d:locktype');
57         $lockType2 = $doc->createElementNS('DAV:','d:locktype');
58
59         $lockEntry1->appendChild($lockScope1);
60         $lockEntry1->appendChild($lockType1);
61         $lockEntry2->appendChild($lockScope2);
62         $lockEntry2->appendChild($lockType2);
63
64         $lockScope1->appendChild($doc->createElementNS('DAV:','d:exclusive'));
65         $lockScope2->appendChild($doc->createElementNS('DAV:','d:shared'));
66
67         $lockType1->appendChild($doc->createElementNS('DAV:','d:write'));
68         $lockType2->appendChild($doc->createElementNS('DAV:','d:write'));
69
70         //$frag->appendXML('<d:lockentry><d:lockscope><d:exclusive /></d:lockscope><d:locktype><d:write /></d:locktype></d:lockentry>');
71         //$frag->appendXML('<d:lockentry><d:lockscope><d:shared /></d:lockscope><d:locktype><d:write /></d:locktype></d:lockentry>');
72
73     }
74
75 }
76