Example #1
0
 private function fileInfo($sPath, $sFullPath)
 {
     // create result array
     $aInfo = array();
     // TODO remove slash append code when base class is able to do it itself
     $aInfo["path"] = str_replace(rawurlencode('/'), '/', rawurlencode($sPath));
     $aInfo["path"] = is_dir($sFullPath) ? $this->_slashify($aInfo["path"]) : $aInfo["path"];
     $aInfo["props"] = array();
     // no special beautified displayname here ...
     $aInfo["props"][] = $this->mkprop("displayname", rawurlencode(basename($sPath)));
     // creation and modification time
     $aInfo["props"][] = $this->mkprop("creationdate", filectime($sFullPath));
     $aInfo["props"][] = $this->mkprop("getlastmodified", filemtime($sFullPath));
     // type and size (caller already made sure that path exists)
     if (is_dir($sFullPath)) {
         // directory (WebDAV collection)
         $aInfo["props"][] = $this->mkprop("resourcetype", "collection");
         $aInfo["props"][] = $this->mkprop("getcontenttype", "application/x-directory");
     } else {
         // plain file (WebDAV resource)
         $aInfo["props"][] = $this->mkprop("resourcetype", "");
         if (is_readable($sFullPath)) {
             $aInfo["props"][] = $this->mkprop("getcontenttype", ResourceFinder::mimeTypeOfFile($sFullPath));
         } else {
             $aInfo["props"][] = $this->mkprop("getcontenttype", "application/x-non-readable");
         }
         $aInfo["props"][] = $this->mkprop("getcontentlength", filesize($sFullPath));
     }
     return $aInfo;
 }