本文整理汇总了PHP中CKFinder_Connector_Utils_FileSystem::checkFolderPath方法的典型用法代码示例。如果您正苦于以下问题:PHP CKFinder_Connector_Utils_FileSystem::checkFolderPath方法的具体用法?PHP CKFinder_Connector_Utils_FileSystem::checkFolderPath怎么用?PHP CKFinder_Connector_Utils_FileSystem::checkFolderPath使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CKFinder_Connector_Utils_FileSystem
的用法示例。
在下文中一共展示了CKFinder_Connector_Utils_FileSystem::checkFolderPath方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkOneFile
/**
* Checks given file for security
*
* @param SplFileInfo $file
* @access protected
* @return bool
*/
protected function checkOneFile($file)
{
$resourceTypeInfo = $this->_currentFolder->getResourceTypeConfig();
$_aclConfig = $this->_config->getAccessControlConfig();
$directory = str_replace('\\', '/', $resourceTypeInfo->getDirectory());
$fileName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($file->getFilename());
if ($this->_config->forceAscii()) {
$fileName = CKFinder_Connector_Utils_FileSystem::convertToAscii($fileName);
}
$pathName = str_replace('\\', '/', pathinfo($file->getPathname(), PATHINFO_DIRNAME));
$pathName = CKFinder_Connector_Utils_FileSystem::convertToFilesystemEncoding($pathName);
// acl
$aclMask = $_aclConfig->getComputedMask($this->_currentFolder->getResourceTypeName(), str_ireplace($directory, '', $pathName));
$isAuthorized = ($aclMask & CKFINDER_CONNECTOR_ACL_FILE_VIEW) == CKFINDER_CONNECTOR_ACL_FILE_VIEW;
if (!$isAuthorized) {
return false;
}
// if it is a folder fileName represents the dir
if ($file->isDir() && (!CKFinder_Connector_Utils_FileSystem::checkFolderPath($fileName) || $resourceTypeInfo->checkIsHiddenPath($fileName))) {
return false;
}
// folder name
if (!CKFinder_Connector_Utils_FileSystem::checkFolderPath($pathName)) {
return false;
}
// is hidden
if ($resourceTypeInfo->checkIsHiddenPath($pathName) || $resourceTypeInfo->checkIsHiddenFile($fileName)) {
return false;
}
// extension
if (!$resourceTypeInfo->checkExtension($fileName) || !CKFinder_Connector_Utils_FileSystem::checkFileName($fileName)) {
return false;
}
return true;
}