mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-02-11 17:44:56 +00:00
properly handle duplicate names when moving a document/folder
This commit is contained in:
parent
699152d95b
commit
bb38dc7b22
|
@ -1062,6 +1062,11 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
$objdest = $this->reverseLookup($options["dest"]);
|
||||
|
||||
$newdocname = '';
|
||||
/* if the destіnation could not be found, then a folder/document shall
|
||||
* be renamed. In that case the source object is moved into the ѕame
|
||||
* or different folder under a new name.
|
||||
* $objdest will store the new destination folder afterwards
|
||||
*/
|
||||
if(!$objdest) {
|
||||
/* check if at least the dest directory exists */
|
||||
$dirname = dirname($options['dest']);
|
||||
|
@ -1112,13 +1117,17 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
/* Set the new Folder of the source object */
|
||||
if(get_class($objsource) == $this->dms->getClassname('document')) {
|
||||
/* Check if name already exists in the folder */
|
||||
/*
|
||||
if(!$settings->_enableDuplicateDocNames) {
|
||||
if($newdocname) {
|
||||
if($objdest->hasDocumentByName($newdocname)) {
|
||||
return "403 Forbidden";
|
||||
}
|
||||
} else {
|
||||
if($objdest->hasDocumentByName($objsource->getName())) {
|
||||
return "403 Forbidden";
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
$oldFolder = $objsource->getFolder();
|
||||
if($objsource->setFolder($objdest)) {
|
||||
|
@ -1153,10 +1162,16 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
} elseif(get_class($objsource) == $this->dms->getClassname('folder')) {
|
||||
/* Check if name already exists in the folder */
|
||||
if(!$settings->_enableDuplicateSubFolderNames) {
|
||||
if($newdocname) {
|
||||
if($objdest->hasSubFolderByName($newdocname)) {
|
||||
return "403 Forbidden";
|
||||
}
|
||||
} else {
|
||||
if($objdest->hasSubFolderByName($objsource->getName())) {
|
||||
return "403 Forbidden";
|
||||
}
|
||||
}
|
||||
}
|
||||
$oldFolder = $objsource->getParent();
|
||||
if($objsource->setParent($objdest)) {
|
||||
if($this->notifier) {
|
||||
|
@ -1176,7 +1191,7 @@ class HTTP_WebDAV_Server_SeedDMS extends HTTP_WebDAV_Server
|
|||
$params['old_folder_path'] = $oldFolder->getFolderPathPlain();
|
||||
$params['new_folder_path'] = $objdest->getFolderPathPlain();
|
||||
$params['username'] = $this->user->getFullName();
|
||||
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$folder->getID();
|
||||
$params['url'] = "http".((isset($_SERVER['HTTPS']) && (strcmp($_SERVER['HTTPS'],'off')!=0)) ? "s" : "")."://".$_SERVER['HTTP_HOST'].$settings->_httpRoot."out/out.ViewFolder.php?folderid=".$objsource->getID();
|
||||
$params['sitename'] = $settings->_siteName;
|
||||
$params['http_root'] = $settings->_httpRoot;
|
||||
$this->notifier->toList($this->user, $nl["users"], $subject, $message, $params);
|
||||
|
|
Loading…
Reference in New Issue
Block a user