mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-07-15 17:08:11 +00:00
orig filename can be used instead of document name
This commit is contained in:
parent
33b20768ee
commit
2e4ef97bff
|
@ -43,6 +43,14 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
*/
|
*/
|
||||||
var $user = "";
|
var $user = "";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set to true if original file shall be used instead of document name
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
var $useorgfilename = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Serve a webdav request
|
* Serve a webdav request
|
||||||
*
|
*
|
||||||
|
@ -184,7 +192,11 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
$this->logger->log('reverseLookup: found folder '.$root->getName().' ('.$root->getID().')', PEAR_LOG_DEBUG);
|
$this->logger->log('reverseLookup: found folder '.$root->getName().' ('.$root->getID().')', PEAR_LOG_DEBUG);
|
||||||
return $root;
|
return $root;
|
||||||
} else {
|
} else {
|
||||||
if($document = $this->dms->getDocumentByName($docname, $root)) {
|
if($this->useorgfilename)
|
||||||
|
$document = $this->dms->getDocumentByOriginalFilename($docname, $root);
|
||||||
|
else
|
||||||
|
$document = $this->dms->getDocumentByName($docname, $root);
|
||||||
|
if($document) {
|
||||||
if($this->logger)
|
if($this->logger)
|
||||||
$this->logger->log('reverseLookup: found document '.$document->getName().' ('.$document->getID().')', PEAR_LOG_DEBUG);
|
$this->logger->log('reverseLookup: found document '.$document->getName().' ('.$document->getID().')', PEAR_LOG_DEBUG);
|
||||||
return $document;
|
return $document;
|
||||||
|
@ -201,7 +213,11 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
}
|
}
|
||||||
if($folder) {
|
if($folder) {
|
||||||
if($docname) {
|
if($docname) {
|
||||||
if($document = $this->dms->getDocumentByName($docname, $folder)) {
|
if($this->useorgfilename)
|
||||||
|
$document = $this->dms->getDocumentByOriginalFilename($docname, $folder);
|
||||||
|
else
|
||||||
|
$document = $this->dms->getDocumentByName($docname, $folder);
|
||||||
|
if($document) {
|
||||||
if($this->logger)
|
if($this->logger)
|
||||||
$this->logger->log('reverseLookup: found document '.$document->getName().' ('.$document->getID().')', PEAR_LOG_DEBUG);
|
$this->logger->log('reverseLookup: found document '.$document->getName().' ('.$document->getID().')', PEAR_LOG_DEBUG);
|
||||||
return $document;
|
return $document;
|
||||||
|
@ -341,8 +357,13 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
// $path .= rawurlencode($pathseg->getName()).'/';
|
// $path .= rawurlencode($pathseg->getName()).'/';
|
||||||
$path .= $pathseg->getName().'/';
|
$path .= $pathseg->getName().'/';
|
||||||
// $info["path"] = htmlspecialchars($path.rawurlencode($obj->getName()));
|
// $info["path"] = htmlspecialchars($path.rawurlencode($obj->getName()));
|
||||||
|
if($this->useorgfilename) {
|
||||||
|
$info["path"] = $path.$content->getOriginalFileName();
|
||||||
|
$info["props"][] = $this->mkprop("displayname", $content->getOriginalFileName());
|
||||||
|
} else {
|
||||||
$info["path"] = $path.$obj->getName();
|
$info["path"] = $path.$obj->getName();
|
||||||
$info["props"][] = $this->mkprop("displayname", $obj->getName());
|
$info["props"][] = $this->mkprop("displayname", $obj->getName());
|
||||||
|
}
|
||||||
|
|
||||||
$info["props"][] = $this->mkprop("resourcetype", "");
|
$info["props"][] = $this->mkprop("resourcetype", "");
|
||||||
if (1 /*is_readable($fspath)*/) {
|
if (1 /*is_readable($fspath)*/) {
|
||||||
|
@ -495,6 +516,8 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
|
|
||||||
$fspath = $this->dms->contentDir.'/'.$content->getPath();
|
$fspath = $this->dms->contentDir.'/'.$content->getPath();
|
||||||
$filesize = filesize($fspath);
|
$filesize = filesize($fspath);
|
||||||
|
if($this->useorgfilename)
|
||||||
|
$filename = $content->getOriginalFileName();;
|
||||||
}
|
}
|
||||||
// $name = htmlspecialchars($filename);
|
// $name = htmlspecialchars($filename);
|
||||||
$name = $filename;
|
$name = $filename;
|
||||||
|
@ -562,7 +585,11 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
||||||
else $fileType = substr($name, $lastDotIndex);
|
else $fileType = substr($name, $lastDotIndex);
|
||||||
}
|
}
|
||||||
/* First check whether there is already a file with the same name */
|
/* First check whether there is already a file with the same name */
|
||||||
if($document = $this->dms->getDocumentByName($name, $folder)) {
|
if($this->useorgfilename)
|
||||||
|
$document = $this->dms->getDocumentByOriginalFilename($name, $folder);
|
||||||
|
else
|
||||||
|
$document = $this->dms->getDocumentByName($name, $folder);
|
||||||
|
if($document) {
|
||||||
if ($document->getAccessMode($this->user) < M_READWRITE) {
|
if ($document->getAccessMode($this->user) < M_READWRITE) {
|
||||||
unlink($tmpFile);
|
unlink($tmpFile);
|
||||||
return "403 Forbidden";
|
return "403 Forbidden";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user