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


PHP CKFinder_Connector_Utils_FileSystem::checkFolderName方法代码示例

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


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

示例1: 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_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"]);
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     if ($_config->forceAscii()) {
         $newFolderName = CKFinder_Connector_Utils_FileSystem::convertToAscii($newFolderName);
     }
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!CKFinder_Connector_Utils_FileSystem::checkFolderName($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:kartikads,项目名称:ch,代码行数:56,代码来源:RenameFolder.php

示例2: 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);
     }
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     if (!$this->_currentFolder->checkAcl(CKFINDER_CONNECTOR_ACL_FOLDER_CREATE)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_UNAUTHORIZED);
     }
     $_resourceTypeConfig = $this->_currentFolder->getResourceTypeConfig();
     $sNewFolderName = isset($_GET["NewFolderName"]) ? $_GET["NewFolderName"] : "";
     $sNewFolderName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($sNewFolderName);
     if ($_config->forceAscii()) {
         $sNewFolderName = CKFinder_Connector_Utils_FileSystem::convertToAscii($sNewFolderName);
     }
     if (!CKFinder_Connector_Utils_FileSystem::checkFolderName($sNewFolderName) || $_resourceTypeConfig->checkIsHiddenFolder($sNewFolderName)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_NAME);
     }
     $sServerDir = CKFinder_Connector_Utils_FileSystem::combinePaths($this->_currentFolder->getServerPath(), $sNewFolderName);
     if (!is_writeable($this->_currentFolder->getServerPath())) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     }
     $bCreated = false;
     if (file_exists($sServerDir)) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
     }
     if ($perms = $_config->getChmodFolders()) {
         $oldUmask = umask(0);
         $bCreated = @mkdir($sServerDir, $perms);
         umask($oldUmask);
     } else {
         $bCreated = @mkdir($sServerDir);
     }
     if (!$bCreated) {
         $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ACCESS_DENIED);
     } else {
         $oNewFolderNode = new Ckfinder_Connector_Utils_XmlNode("NewFolder");
         $this->_connectorNode->addChild($oNewFolderNode);
         $oNewFolderNode->addAttribute("name", CKFinder_Connector_Utils_FileSystem::convertToConnectorEncoding($sNewFolderName));
     }
 }
开发者ID:jambik,项目名称:elenaburgon,代码行数:46,代码来源:CreateFolder.php

示例3: checkFolderPath

 /**
  * Check whether $path contains valid folders names
  *
  * @static
  * @access public
  * @param string $path
  */
 public static function checkFolderPath($path)
 {
     $path = substr($path, strpos($path, '/') + 1);
     $path = explode('/', trim($path, '/'));
     foreach ($path as $dir) {
         if (!empty($dir) && !CKFinder_Connector_Utils_FileSystem::checkFolderName($dir)) {
             return false;
         }
     }
     return true;
 }
开发者ID:itmyprofession,项目名称:admin,代码行数:18,代码来源:FileSystem.php

示例4: 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_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"]);
     $_config =& CKFinder_Connector_Core_Factory::getInstance("Core_Config");
     if ($_config->forceAscii()) {
         $newFolderName = CKFinder_Connector_Utils_FileSystem::convertToAscii($newFolderName);
     }
     $resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
     if (!CKFinder_Connector_Utils_FileSystem::checkFolderName($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 = substr($this->_currentFolder->getServerPath(), 1, -1);
     $newFolderPath = dirname($oldFolderPath) . '/' . $newFolderName;
     global $config;
     $s3 = s3_con();
     $copied = true;
     $items = $s3->getBucket($config['AmazonS3']['Bucket'], $oldFolderPath);
     foreach ($items as $item) {
         //TODO: Possible bug, if repeating paths occur, it will mess up folder structure. Need to replace only first instance
         $newItemName = str_replace($oldFolderPath, $newFolderPath, $item['name']);
         $copy = $s3->copyObject($config['AmazonS3']['Bucket'], $item['name'], $config['AmazonS3']['Bucket'], $newItemName);
         if ($copy === false) {
             $copied = false;
         }
     }
     $deleted = true;
     foreach ($items as $item) {
         $deleted = $deleted && $s3->deleteObject($config['AmazonS3']['Bucket'], $item['name']);
     }
     //        $bMoved = false;
     //        if (!is_dir($oldFolderPath)) {
     //            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_INVALID_REQUEST);
     //        }
     //let's calculate new folder name
     //        if (file_exists(rtrim($newFolderPath, '/'))) {
     //            $this->_errorHandler->throwError(CKFINDER_CONNECTOR_ERROR_ALREADY_EXIST);
     //        }
     //        $bMoved = @rename($oldFolderPath, $newFolderPath);
     if (!$copied || !$deleted) {
         $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:jul6art,项目名称:vscms,代码行数:72,代码来源:RenameFolder.php


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