Index: branches/5.3.x/core/ckeditor/ckfinder/core/connector/php/php5/CommandHandler/MoveFiles.php =================================================================== diff -u -N -r15483 -r15908 --- branches/5.3.x/core/ckeditor/ckfinder/core/connector/php/php5/CommandHandler/MoveFiles.php (.../MoveFiles.php) (revision 15483) +++ branches/5.3.x/core/ckeditor/ckfinder/core/connector/php/php5/CommandHandler/MoveFiles.php (.../MoveFiles.php) (revision 15908) @@ -2,8 +2,8 @@ /* * CKFinder * ======== - * http://ckfinder.com - * Copyright (C) 2007-2012, CKSource - Frederico Knabben. All rights reserved. + * http://cksource.com/ckfinder + * Copyright (C) 2007-2013, CKSource - Frederico Knabben. All rights reserved. * * The software, this file and its contents are subject to the CKFinder * License. Please read the license.txt file before using, installing, copying, @@ -57,6 +57,7 @@ $currentResourceTypeConfig = $this->_currentFolder->getResourceTypeConfig(); $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config"); $_aclConfig = $_config->getAccessControlConfig(); + $_thumbnailsConfig = $_config->getThumbnailsConfig(); $aclMasks = array(); $_resourceTypeConfig = array(); @@ -172,6 +173,9 @@ } } + $_thumbsServerPath = CKFinder_Connector_Utils_FileSystem::combinePaths($_thumbnailsConfig->getDirectory(), $_config->getResourceTypeConfig($type)->getName()); + $thumbPath = CKFinder_Connector_Utils_FileSystem::combinePaths($_thumbsServerPath, $path.$name); + //$overwrite // finally, no errors so far, we may attempt to copy a file // protection against copying files to itself @@ -195,32 +199,21 @@ continue; } else { + CKFinder_Connector_Utils_FileSystem::unlink($thumbPath); $moved++; } } } else if (strpos($options, "autorename") !== false) { - $iCounter = 1; - while (true) - { - $fileName = CKFinder_Connector_Utils_FileSystem::getFileNameWithoutExtension($name) . - "(" . $iCounter . ")" . "." . - CKFinder_Connector_Utils_FileSystem::getExtension($name); - - $destinationFilePath = $sServerDir.$fileName; - if (!file_exists($destinationFilePath)) { - break; - } - else { - $iCounter++; - } - } + $fileName = CKFinder_Connector_Utils_FileSystem::autoRename($sServerDir, $name); + $destinationFilePath = $sServerDir.$fileName; if (!@rename($sourceFilePath, $destinationFilePath)) { $errorCode = CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED; $this->appendErrorNode($oErrorsNode, $errorCode, $name, $type, $path); continue; } else { + CKFinder_Connector_Utils_FileSystem::unlink($thumbPath); $moved++; } } @@ -237,6 +230,7 @@ continue; } else { + CKFinder_Connector_Utils_FileSystem::unlink($thumbPath); $moved++; } }