当前位置: 首页>>代码示例>>PHP>>正文


PHP CKFinder_Connector_Utils_FileSystem::unlink方法代码示例

本文整理汇总了PHP中CKFinder_Connector_Utils_FileSystem::unlink方法的典型用法代码示例。如果您正苦于以下问题:PHP CKFinder_Connector_Utils_FileSystem::unlink方法的具体用法?PHP CKFinder_Connector_Utils_FileSystem::unlink怎么用?PHP CKFinder_Connector_Utils_FileSystem::unlink使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CKFinder_Connector_Utils_FileSystem的用法示例。


在下文中一共展示了CKFinder_Connector_Utils_FileSystem::unlink方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 function buildXml()
 {
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_RENAME)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     if (!isset($_GET["NewFolderName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $newFolderName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["NewFolderName"]);
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     if ($_config->forceAscii()) {
         $newFolderName = CKFinder_Connector_Utils_FileSystem::convertToAscii($newFolderName);
     }
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($newFolderName) || $resourceTypeInfo->checkIsHiddenFolder($newFolderName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     // The root folder cannot be deleted.
     if ($this->_currentFolder->getClientPath() == "/") {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $oldFolderPath = $this->_currentFolder->getServerPath();
     $bMoved = false;
     if (!is_dir($oldFolderPath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     //let's calculate new folder name
     $newFolderPath = dirname($oldFolderPath) . DIRECTORY_SEPARATOR . $newFolderName . DIRECTORY_SEPARATOR;
     if (file_exists(rtrim($newFolderPath, DIRECTORY_SEPARATOR))) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
     }
     $bMoved = @rename($oldFolderPath, $newFolderPath);
     if (!$bMoved) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     } else {
         $newThumbsServerPath = dirname($this->_currentFolder->getThumbsServerPath()) . '/' . $newFolderName . '/';
         if (!@rename($this->_currentFolder->getThumbsServerPath(), $newThumbsServerPath)) {
             CKFinder_Connector_Utils_FileSystem::unlink($this->_currentFolder->getThumbsServerPath());
         }
     }
     $newFolderPath = preg_replace(",[^/]+/?\$,", $newFolderName, $this->_currentFolder->getClientPath()) . '/';
     $newFolderUrl = $resourceTypeInfo->getUrl() . ltrim($newFolderPath, '/');
     $oRenameNode = new Ckfinder_Connector_Utils_XmlNode("RenamedFolder");
     $this->_connectorNode->addChild($oRenameNode);
     $oRenameNode->addAttribute("newName", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderName));
     $oRenameNode->addAttribute("newPath", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderPath));
     $oRenameNode->addAttribute("newUrl", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFolderUrl));
 }
开发者ID:abhaygmit,项目名称:testprj,代码行数:53,代码来源:RenameFolder.php

示例2: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 protected function buildXml()
 {
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_DELETE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     // The root folder cannot be deleted.
     if ($this->_currentFolder->getClientPath() == "/") {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $folderServerPath = $this->_currentFolder->getServerPath();
     if (!file_exists($folderServerPath) || !is_dir($folderServerPath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
     }
     if (!CKFinder_Connector_Utils_FileSystem::unlink($folderServerPath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     CKFinder_Connector_Utils_FileSystem::unlink($this->_currentFolder->getThumbsServerPath());
 }
开发者ID:abhaygmit,项目名称:testprj,代码行数:23,代码来源:DeleteFolder.php

示例3: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 function buildXml()
 {
     if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_RENAME)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     if (!isset($_GET["fileName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     if (!isset($_GET["newFileName"])) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     $fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["fileName"]);
     $newFileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_GET["newFileName"]);
     $oRenamedFileNode = new Ckfinder_Connector_Utils_XmlNode("RenamedFile");
     $this->_connectorNode->addChild($oRenamedFileNode);
     $oRenamedFileNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($fileName));
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!$resourceTypeInfo->checkExtension($newFileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
     }
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($fileName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($newFileName) || $resourceTypeInfo->checkIsHiddenFile($newFileName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     if (!$resourceTypeInfo->checkExtension($fileName, false)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if ($_config->forceAscii()) {
         $newFileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($newFileName);
     }
     $filePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $fileName);
     $newFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $newFileName);
     $bMoved = false;
     if (!file_exists($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     if (!is_writable(dirname($newFilePath))) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     if (!is_writable($filePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     if (file_exists($newFilePath)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
     }
     $bMoved = @rename($filePath, $newFilePath);
     if (!$bMoved) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNKNOWN, "File " . CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($fileName) . "has not been renamed");
     } else {
         $oRenamedFileNode->addAttribute("newName", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($newFileName));
         $thumbPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getThumbsServerPath(), $fileName);
         CKFinder_Connector_Utils_FileSystem::unlink($thumbPath);
     }
 }
开发者ID:kevinsmasters,项目名称:purecatskillsmarketplace,代码行数:65,代码来源:RenameFile.php

示例4: unlink

 /**
  * Unlink file/folder
  *
  * @static
  * @access public
  * @param string $path
  * @return boolean
  */
 public static function unlink($path)
 {
     /*    make sure the path exists    */
     if (!file_exists($path)) {
         return false;
     }
     /*    If it is a file or link, just delete it    */
     if (is_file($path) || is_link($path)) {
         return @unlink($path);
     }
     /*    Scan the dir and recursively unlink    */
     $files = scandir($path);
     if ($files) {
         foreach ($files as $filename) {
             if ($filename == '.' || $filename == '..') {
                 continue;
             }
             $file = str_replace('//', '/', $path . '/' . $filename);
             CKFinder_Connector_Utils_FileSystem::unlink($file);
         }
     }
     /*    Remove the parent dir    */
     if (!@rmdir($path)) {
         return false;
     }
     return true;
 }
开发者ID:wangshipeng,项目名称:license,代码行数:35,代码来源:FileSystem.php

示例5: buildXml

 /**
  * handle request and build XML
  * @access protected
  *
  */
 protected function buildXml()
 {
     if (empty($_POST['CKFinderCommand']) || $_POST['CKFinderCommand'] != 'true') {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_DELETE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $oErrorsNode = new CKFinder_Connector_Utils_XmlNode("Errors");
     $errorCode = CKFINDER_CONNECTOR_ERROR_NONE;
     $deleted = 0;
     $oDeleteFilesNode = new Ckfinder_Connector_Utils_XmlNode("DeleteFiles");
     $currentResourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     $_aclConfig = $_config->getAccessControlConfig();
     $aclMasks = array();
     $_resourceTypeConfig = array();
     $checkedPaths = array();
     if (!empty($_POST['files']) && is_array($_POST['files'])) {
         foreach ($_POST['files'] as $arr) {
             if (empty($arr['name'])) {
                 continue;
             }
             if (!isset($arr['type'], $arr['folder'])) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
             }
             // file name
             $name = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($arr['name']);
             // resource type
             $type = $arr['type'];
             // client path
             $path = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($arr['folder']);
             if (!isset($_resourceTypeConfig[$type])) {
                 $_resourceTypeConfig[$type] = $_config->getResourceTypeConfig($type);
             }
             if (is_null($_resourceTypeConfig[$type]) || !CKFinder_Connector_Utils_FileSystem::checkFileName($name) || preg_match(CKFINDER_REGEX_INVALID_PATH, $path)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
             }
             if (!$_resourceTypeConfig[$type]->checkExtension($name, false)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
             }
             if (empty($checkedPaths[$path])) {
                 $checkedPaths[$path] = true;
                 if ($_resourceTypeConfig[$type]->checkIsHiddenPath($path)) {
                     $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
                 }
             }
             if ($currentResourceTypeConfig->checkIsHiddenFile($name)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
             }
             if (!isset($aclMasks[$type . "@" . $path])) {
                 $aclMasks[$type . "@" . $path] = $_aclConfig->getComputedMask($type, $path);
             }
             $isAuthorized = ($aclMasks[$type . "@" . $path] & CKFINDER_CONNECTOR_ACL_FILE_DELETE) == CKFINDER_CONNECTOR_ACL_FILE_DELETE;
             if (!$isAuthorized) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
             }
             $filePath = $_resourceTypeConfig[$type]->getDirectory() . $path . $name;
             if (!file_exists($filePath) || !is_file($filePath)) {
                 $errorCode = CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND;
                 $this->appendErrorNode($oErrorsNode, $errorCode, $name, $type, $path);
                 continue;
             }
             if (!CKFinder_Connector_Utils_FileSystem::unlink($filePath)) {
                 $errorCode = CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED;
                 $this->appendErrorNode($oErrorsNode, $errorCode, $name, $type, $path);
                 continue;
             } else {
                 $deleted++;
                 $thumbPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getThumbsServerPath(), $name);
                 @unlink($thumbPath);
             }
         }
     }
     $this->_connectorNode->addChild($oDeleteFilesNode);
     if ($errorCode != CKFINDER_CONNECTOR_ERROR_NONE) {
         $this->_connectorNode->addChild($oErrorsNode);
     }
     $oDeleteFilesNode->addAttribute("deleted", $deleted);
     if ($errorCode != CKFINDER_CONNECTOR_ERROR_NONE) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_DELETE_FAILED);
     }
 }
开发者ID:robocon,项目名称:iopr,代码行数:88,代码来源:DeleteFiles.php

示例6: buildXml


//.........这里部分代码省略.........
             // check #8 (invalid file name)
             if (!file_exists($sourceFilePath) || !is_file($sourceFilePath)) {
                 continue;
             }
             // check #9 - max file size
             if (!empty($zipMaxSize)) {
                 clearstatcache();
                 $_zipFilesSize += filesize($sourceFilePath);
                 if ($_zipFilesSize > $zipMaxSize) {
                     $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_CREATED_FILE_TOO_BIG);
                 }
             }
             $zipPathPart = $_isBasket ? CKFinder_Connector_Utils_FileSystem::combinePaths($type, $path) : '';
             $files[$sourceFilePath] = $zipPathPart . pathinfo($sourceFilePath, PATHINFO_BASENAME);
         }
     } else {
         if (!is_dir($_sServerDir)) {
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FOLDER_NOT_FOUND);
         }
         $files = $this->getFilesRecursively($_sServerDir, $zipMaxSize);
     }
     if (sizeof($files) < 1) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND);
     }
     // default destination dir - temp
     $dest_dir = CKFinder_Connector_Utils_FileSystem::getTmpDir();
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     // default file name - hash
     $zip_filename = substr(md5(serialize($files)), 0, 16) . $resourceTypeInfo->getHash() . '.zip';
     // compress files - do not download them
     // change destination and name
     if (isset($_POST['download']) && $_POST['download'] == 'false') {
         $dest_dir = $_sServerDir;
         if (isset($_POST['zipName']) && !empty($_POST['zipName'])) {
             $zip_filename = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($_POST['zipName']);
             if (!$resourceTypeInfo->checkExtension($zip_filename)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_EXTENSION);
             }
         }
     }
     if (!CKFinder_Connector_Utils_FileSystem::checkFileName($zip_filename) || $resourceTypeInfo->checkIsHiddenFile($zip_filename)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     if ($this->_config->forceAscii()) {
         $zip_filename = CKFinder_Connector_Utils_FileSystem::convertToAscii($zip_filename);
     }
     $zipFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($dest_dir, $zip_filename);
     if (!is_writable(dirname($zipFilePath))) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     // usually we would need to create zip?
     $createZip = true;
     // only if file already exists and we want download it
     // do not create new one - because hash of previously created is the same - existing archive is ok
     if (file_exists($zipFilePath) && isset($_POST['download']) && $_POST['download'] == 'true') {
         $createZip = false;
     } else {
         if (file_exists($zipFilePath) && (!isset($_POST['fileExistsAction']) || !in_array($_POST['fileExistsAction'], array('autorename', 'overwrite')))) {
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
         }
         if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_UPLOAD)) {
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
         }
         // check how to deal with existing file
         if (isset($_POST['fileExistsAction']) && $_POST['fileExistsAction'] == 'autorename') {
             if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_UPLOAD | CKFINDER_CONNECTOR_ACL_FILE_RENAME)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
             }
             $zip_filename = CKFinder_Connector_Utils_FileSystem::autoRename($dest_dir, $zip_filename);
             $zipFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($dest_dir, $zip_filename);
         } elseif (isset($_POST['fileExistsAction']) && $_POST['fileExistsAction'] == 'overwrite') {
             if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FILE_RENAME | CKFINDER_CONNECTOR_ACL_FILE_DELETE)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
             }
             if (!CKFinder_Connector_Utils_FileSystem::unlink($zipFilePath)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
             }
         }
     }
     if ($createZip) {
         $zip = new ZipArchive();
         $result = $zip->open($zipFilePath, ZIPARCHIVE::CREATE);
         if ($result !== TRUE) {
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNKNOWN);
         }
         foreach ($files as $pathname => $filename) {
             if (!empty($filename)) {
                 if (file_exists($pathname) && is_readable($pathname)) {
                     $zip->addFile($pathname, $filename);
                 }
             } else {
                 $zip->addEmptyDir($pathname);
             }
         }
         $zip->close();
     }
     $file = new CKFinder_Connector_Utils_XmlNode("ZipFile");
     $file->addAttribute("name", $zip_filename);
     $this->_connectorNode->addChild($file);
 }
开发者ID:jambik,项目名称:ikkf05,代码行数:101,代码来源:plugin.php

示例7: buildXml


//.........这里部分代码省略.........
             $sourceFilePath = $_resourceTypeConfig[$type]->getDirectory() . $path . $name;
             // check #6 (hidden file name)
             if ($currentResourceTypeConfig->checkIsHiddenFile($name)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
             }
             // check #7 (Access Control, need file view permission to source files)
             if (!isset($aclMasks[$type . "@" . $path])) {
                 $aclMasks[$type . "@" . $path] = $_aclConfig->getComputedMask($type, $path);
             }
             $isAuthorized = ($aclMasks[$type . "@" . $path] & CKFINDER_CONNECTOR_ACL_FILE_VIEW) == CKFINDER_CONNECTOR_ACL_FILE_VIEW;
             if (!$isAuthorized) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
             }
             // check #8 (invalid file name)
             if (!file_exists($sourceFilePath) || !is_file($sourceFilePath)) {
                 $errorCode = CKFINDER_CONNECTOR_ERROR_FILE_NOT_FOUND;
                 $this->appendErrorNode($oErrorsNode, $errorCode, $name, $type, $path);
                 continue;
             }
             // check #9 (max size)
             if ($currentResourceTypeConfig->getName() != $type) {
                 $maxSize = $currentResourceTypeConfig->getMaxSize();
                 $fileSize = filesize($sourceFilePath);
                 if ($maxSize && $fileSize > $maxSize) {
                     $errorCode = CKFINDER_CONNECTOR_ERROR_UPLOADED_TOO_BIG;
                     $this->appendErrorNode($oErrorsNode, $errorCode, $name, $type, $path);
                     continue;
                 }
             }
             $_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
             if ($sourceFilePath == $destinationFilePath) {
                 $errorCode = CKFINDER_CONNECTOR_ERROR_SOURCE_AND_TARGET_PATH_EQUAL;
                 $this->appendErrorNode($oErrorsNode, $errorCode, $name, $type, $path);
                 continue;
             } else {
                 if (file_exists($destinationFilePath)) {
                     if (strpos($options, "overwrite") !== false) {
                         if (!@unlink($destinationFilePath)) {
                             $errorCode = CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED;
                             $this->appendErrorNode($oErrorsNode, $errorCode, $name, $type, $path);
                             continue;
                         } else {
                             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++;
                             }
                         }
                     } else {
                         if (strpos($options, "autorename") !== false) {
                             $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++;
                             }
                         } else {
                             $errorCode = CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST;
                             $this->appendErrorNode($oErrorsNode, $errorCode, $name, $type, $path);
                             continue;
                         }
                     }
                 } else {
                     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++;
                     }
                 }
             }
         }
     }
     $this->_connectorNode->addChild($oMoveFilesNode);
     if ($errorCode != CKFINDER_CONNECTOR_ERROR_NONE) {
         $this->_connectorNode->addChild($oErrorsNode);
     }
     $oMoveFilesNode->addAttribute("moved", $moved);
     $oMoveFilesNode->addAttribute("movedTotal", $movedAll + $moved);
     /**
      * Note: actually we could have more than one error.
      * This is just a flag for CKFinder interface telling it to check all errors.
      */
     if ($errorCode != CKFINDER_CONNECTOR_ERROR_NONE) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_MOVE_FAILED);
     }
 }
开发者ID:kentonquatman,项目名称:iofa,代码行数:101,代码来源:MoveFiles.php


注:本文中的CKFinder_Connector_Utils_FileSystem::unlink方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。