Пример #1
0
 function _get_fileinfo($path)
 {
     $io = self::GetIo();
     if (strpos($path, $this->real_path_full) === 0) {
         $path = CWebDavBase::ConvertPathToRelative($path, $this->real_path_full);
     }
     $path = CWebDavBase::CleanRelativePathString($path);
     if ($path === false) {
         return false;
     }
     $fspath = $io->CombinePath($this->real_path_full, $path);
     //$fspath = $path;
     //if (strpos($path, $this->real_path_full) === false)
     //$fspath = str_replace(array("///", "//"), "/", $this->real_path_full."/".$path);
     //else
     //$path = str_replace(array($this->real_path_full, "///", "//"), "/", $path);
     $bDir = $io->DirectoryExists($fspath);
     $info = array();
     $info['path'] = $bDir ? $this->_slashify($path) : $path;
     $info['path'] = $this->MetaNamesReverse(explode('/', $info['path']), 'name', 'alias');
     if (SITE_CHARSET != "UTF-8") {
         $info['path'] = $GLOBALS["APPLICATION"]->ConvertCharset($info['path'], SITE_CHARSET, "UTF-8");
     }
     $info['props'] = array();
     if ($bDir) {
         $ioObj = $io->GetDirectory($fspath);
     } else {
         $ioObj = $io->GetFile($fspath);
     }
     $tzOffset = CTimeZone::GetOffset();
     $info['props'][] = $this->_mkprop('creationdate', $ioObj->GetCreationTime() + $tzOffset);
     $info['props'][] = $this->_mkprop('getlastmodified', $ioObj->GetModificationTime() + $tzOffset);
     if ($bDir) {
         $info['props'][] = $this->_mkprop('resourcetype', 'collection');
         $info['props'][] = $this->_mkprop('getcontenttype', 'httpd/unix-directory');
     } else {
         $info['props'][] = $this->_mkprop('resourcetype', '');
         if ($ioObj->IsReadable()) {
             $info['props'][] = $this->_mkprop('getcontenttype', $this->_mimetype($fspath));
         } else {
             $info['props'][] = $this->_mkprop('getcontenttype', 'application/x-non-readable');
         }
         $info['props'][] = $this->_mkprop('getcontentlength', $ioObj->GetFileSize());
     }
     $arProps = $this->_get_props($path);
     if (is_array($arProps)) {
         foreach ($arProps as $name => $prop) {
             if ($name != "LOCK") {
                 $info["props"][] = CWebDavBase::_mkprop($prop["ns"], $prop["name"], $prop["value"]);
             }
         }
     }
     return $info;
 }