Ejemplo n.º 1
0
 /**
  * @param $path
  * @param File|Folder|Object $object
  * @return CDavResource
  */
 protected function getResourceByObject($path, BaseObject $object)
 {
     $isFolder = $object instanceof Folder;
     $resource = new CDavResource($path . ($isFolder && substr($path, -1, 1) != "/" ? "/" : ""));
     $resource->AddProperty('name', $object->getName());
     if ($object instanceof File) {
         $resource->AddProperty('getcontentlength', $object->getSize());
     }
     $resource->AddProperty('creationdate', $object->getCreateTime()->getTimestamp());
     $resource->AddProperty('getlastmodified', $object->getUpdateTime()->getTimestamp());
     $resource->AddProperty('iscollection', $isFolder ? '1' : '0');
     if ($isFolder) {
         $resource->AddProperty('resourcetype', array('collection', ''));
         $resource->AddProperty('getcontenttype', 'httpd/unix-directory');
     } else {
         $resource->AddProperty('getcontenttype', '');
         $resource->AddProperty('isreadonly', '');
         $resource->AddProperty('ishidden', '');
         $resource->AddProperty('resourcetype', '');
     }
     $resource->AddProperty("supportedlock", "<D:lockentry><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry><D:lockentry><D:lockscope><D:shared/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry>");
     return $resource;
 }
Ejemplo n.º 2
0
 /**
  * @param $path
  * @param File|Folder|Object $object
  * @return CDavResource
  */
 protected function getResourceByObject($path, BaseObject $object)
 {
     $isFolder = $object instanceof Folder;
     $resource = new CDavResource($path . ($isFolder && substr($path, -1, 1) != "/" ? "/" : ""));
     $resource->AddProperty('name', $object->getName());
     if ($object instanceof File) {
         $resource->AddProperty('getcontentlength', $object->getSize());
     }
     $resource->AddProperty('creationdate', $object->getCreateTime()->getTimestamp());
     $resource->AddProperty('getlastmodified', $object->getUpdateTime()->getTimestamp());
     $resource->AddProperty('iscollection', $isFolder ? '1' : '0');
     $resource->AddProperty('Win32CreationTime', $object->getCreateTime()->getTimestamp(), "urn:schemas-microsoft-com:");
     $resource->AddProperty('Win32LastModifiedTime', $object->getUpdateTime()->getTimestamp(), "urn:schemas-microsoft-com:");
     if ($isFolder) {
         $resource->AddProperty('resourcetype', array('collection', ''));
         $resource->AddProperty('getcontenttype', 'httpd/unix-directory');
     } else {
         $resource->AddProperty('getcontenttype', '');
         $resource->AddProperty('isreadonly', '');
         $resource->AddProperty('ishidden', '');
         $resource->AddProperty('resourcetype', '');
     }
     $resource->AddProperty("supportedlock", "<D:lockentry><D:lockscope><D:exclusive/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry><D:lockentry><D:lockscope><D:shared/></D:lockscope><D:locktype><D:write/></D:locktype></D:lockentry>");
     /*
       <D:response xmlns:ns0="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/">
      	<D:href>/docs/shared/%D0%97%D0%B0%D0%B3%D1%80%D1%83%D0%B7%D0%BA%D0%B8</D:href>
      	 <D:propstat>
      	  <D:prop>
      	   <D:resourcetype><D:collection/></D:resourcetype>
      	   <D:getcontenttype>httpd/unix-directory</D:getcontenttype>
      	   <D:creationdate ns0:dt="dateTime.tz">2014-05-12T08:37:25Z</D:creationdate>
      	   <D:getlastmodified ns0:dt="dateTime.rfc1123">Mon, 12 May 2014 08:37:25 GMT</D:getlastmodified>
      	   <D:iscollection/>
      	   <D:supportedlock><D:lockentry>
      						<D:lockscope><D:exclusive/></D:lockscope>
      						<D:locktype><D:write/></D:locktype>
      					</D:lockentry>
      					<D:lockentry>
      						<D:lockscope><D:shared/></D:lockscope>
      						<D:locktype><D:write/></D:locktype>
      					</D:lockentry></D:supportedlock>
      	 </D:prop>
      	 <D:status>HTTP/1.1 200 OK</D:status>
      	</D:propstat>
       </D:response>
     
     
       <D:response xmlns:ns0="urn:uuid:c2f41010-65b3-11d1-a29f-00aa00c14882/">
      	<D:href>/docs/shared/%D0%90%D0%BD%D0%BA%D0%B5%D1%82%D0%B0.docx</D:href>
      	 <D:propstat>
      	  <D:prop>
      	   <D:creationdate ns0:dt="dateTime.tz">2014-05-12T08:26:30Z</D:creationdate>
      	   <D:getlastmodified ns0:dt="dateTime.rfc1123">Mon, 12 May 2014 08:26:31 GMT</D:getlastmodified>
      	   <D:creationdate ns0:dt="dateTime.tz">2014-05-12T08:26:30Z</D:creationdate>
      	   <D:getlastmodified ns0:dt="dateTime.rfc1123">Mon, 12 May 2014 08:26:31 GMT</D:getlastmodified>
      	   <D:getcontenttype/>
      	   <D:getcontentlength>86838</D:getcontentlength>
      	   <D:isreadonly>false</D:isreadonly>
      	   <D:ishidden>false</D:ishidden>
      	   <D:iscollection>0</D:iscollection>
      	   <D:resourcetype/>
      	   <D:supportedlock><D:lockentry>
      						<D:lockscope><D:exclusive/></D:lockscope>
      						<D:locktype><D:write/></D:locktype>
      					</D:lockentry>
      					<D:lockentry>
      						<D:lockscope><D:shared/></D:lockscope>
      						<D:locktype><D:write/></D:locktype>
      					</D:lockentry></D:supportedlock>
      	 </D:prop>
      	 <D:status>HTTP/1.1 200 OK</D:status>
      	</D:propstat>
       </D:response>
     */
     return $resource;
 }