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


PHP CKFinder_Connector_Utils_FileSystem::isEmptyDir方法代码示例

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


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

示例1: buildXml

 /**
  * Handle request and build XML
  */
 protected function buildXml()
 {
     parent::buildXml();
     $extractDir = !empty($_POST['extractDir']) ? ltrim($_POST['extractDir'], '/') : '';
     $extractDir = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($extractDir);
     if (preg_match(CKFINDER_REGEX_INVALID_PATH, $extractDir)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     }
     $extractPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $extractDir . '/');
     $extractClientPath = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getClientPath(), $extractDir);
     // acl for upload dir
     $_aclConfig = $this->_config->getAccessControlConfig();
     $aclMask = $_aclConfig->getComputedMask($this->_currentFolder->getResourceTypeName(), $extractDir);
     if (!(($aclMask & CKFINDER_CONNECTOR_ACL_FOLDER_CREATE) == CKFINDER_CONNECTOR_ACL_FOLDER_CREATE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     if (empty($_POST['force']) && file_exists($extractPath) && is_dir($extractPath) && !CKFinder_Connector_Utils_FileSystem::isEmptyDir($extractPath)) {
         $dirExists = new CKFinder_Connector_Utils_XmlNode("FolderExists");
         $oErrorNode = new CKFinder_Connector_Utils_XmlNode("Folder");
         $oErrorNode->addAttribute("name", $extractDir);
         $dirExists->addChild($oErrorNode);
         $this->_connectorNode->addChild($dirExists);
         return;
     } elseif (!empty($_POST['force']) && $_POST['force'] == 'overwrite') {
         if (!(($aclMask & CKFINDER_CONNECTOR_ACL_FILE_UPLOAD | CKFINDER_CONNECTOR_ACL_FILE_DELETE) == CKFINDER_CONNECTOR_ACL_FILE_UPLOAD | CKFINDER_CONNECTOR_ACL_FILE_DELETE)) {
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
         }
         if ($extractDir && file_exists($extractPath) && is_dir($extractPath)) {
             if (!(($aclMask & CKFINDER_CONNECTOR_ACL_FOLDER_CREATE | CKFINDER_CONNECTOR_ACL_FOLDER_DELETE) == CKFINDER_CONNECTOR_ACL_FOLDER_CREATE | CKFINDER_CONNECTOR_ACL_FOLDER_DELETE)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
             }
             if (!CKFinder_Connector_Utils_FileSystem::unlink($extractPath)) {
                 $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
             }
         }
     } else {
         if (!empty($_POST['force']) && $_POST['force'] !== 'merge') {
             $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
         }
     }
     for ($i = 0; $i < $this->zip->numFiles; $i++) {
         $fileName = $this->zip->getNameIndex($i);
         $filePathInfo = pathinfo($fileName);
         $sFileName = $this->checkOneFile($filePathInfo, $fileName);
         // security test failed, add to skipped
         if ($sFileName) {
             $this->extractTo($extractPath, $extractClientPath, $filePathInfo, $sFileName, $fileName);
         }
     }
     $this->zip->close();
     $this->_connectorNode->addChild($this->unzippedNodes);
     if ($this->errorCode != CKFINDER_CONNECTOR_ERROR_NONE) {
         $this->_connectorNode->addChild($this->skippedFilesNode);
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ZIP_FAILED);
     }
 }
开发者ID:jambik,项目名称:ikkf05,代码行数:59,代码来源:plugin.php


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