Checks given file for security

@param  SplFileInfo $file
@access protected
@return bool
191142
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;
  }
500949
protected function checkFile(SplFileInfo $file, $force) {
        $scssPath = $file->getPathname();
        $scssMod = $file->getMTime();
        $scssName = preg_replace('/^.+(\/|\\\\)([^\/\\\\]+)$/', '\\2', $scssPath);

        // don't compile `_`-prefixed system files
        if (substr($scssName, 0, 1) === '_') {
            $this->sysMod = max($this->sysMod, $scssMod);
            return;
        }

        $cssPath = preg_replace('/(\.|\/|\\\\)scss($|\/|\\\\)/', '\\1css\\2', $scssPath);
        $cssMod = is_file($cssPath) ? filemtime($cssPath) : 0;
        $this->oldestMod = min($this->oldestMod, $cssMod);

        $isModified = $scssMod - $cssMod > 0 ? true : false;

        if ($isModified || $force) {
            $this->generateCss($scssPath, $cssPath);
        }
        
        // Possibly imported mixin/sys file changed, update all CSS files
        if (!$force && $this->sysMod > $this->oldestMod) {
            $this->checkFiles(true);
            $this->oldestMod = $this->sysMod;
        }        
    }
594470
public function filter(\SplFileInfo $file)
    {
        $content = file_get_contents($file);
        $result = preg_match_all('/class\s+([^\s|\{]+)[\s\{]/im', $content, $results, PREG_PATTERN_ORDER);
        unset($content);

        if (!$result) {
            return false;
        }

        if (count($results[0]) > 1) {
            return false;
        }

        return true;
    }
982262
private function getFilenameFromFile(SplFileInfo $file) : string
    {
        return substr($file->getRelativePathname(), 0, -(strlen($this->fileExtension) + 1));
    }
651436
public function filter(\SplFileInfo $file)
    {
        foreach ($this->filter as $filter) {
            if ($filter->filter($file)) {
                return true;
            }
        }
        return false;
    }
519386
public static function isFileReadable($file)
    {
        $result = false;

        if (!file_exists($file)) {
            return $result;
        }
        if (!is_file($file)) {
            return $result;
        }
        if (!is_readable($file)) {
            return $result;
        }

        $result = true;

        return $result;
    }
1048198
public static function checkFileDeletable($file)
    {
        clearstatcache();
        $dir = dirname($file);
        // Deleting a file requires write permissions on the directory.
        // It does not require write permissions on the file
        return @file_exists($dir) && @is_writable($dir);
    }
770203
public function resolve($file)
    {
        $info = null;

        $this->rewind();
        foreach (clone $this as $path) {
            $info = new SplFileInfo(rtrim($path, '/') . '/' . ltrim($file, '/'));

            if ($info->isDir() || $info->isFile() || $info->isLink()) {
                break;
            }
        }

        return ($info)? $info->getPathname() : null;
    }
99422
protected function checkPermissions($file, $permissions = '0444')
    {
        if (substr(sprintf('%o', fileperms($file)), -4) === $permissions) {
            return true;
        }

        $vars = array('%name' => $file, '%perm' => $permissions);
        return $this->translation->text('File %name is not secure. The file permissions must be %perm', $vars);
    }
552909
private function isCovered($file)
    {
        return in_array($file, $this->includedFiles)
            && !in_array($file, $this->excludedFiles)
            && isset($this->covered[$file]);
    }
604618
protected function instanceOf(SplFileInfo $file): bool
    {
        $reflecter = new ReflectionClass($this->getClassName($file));

        if (! $this->isSkip($reflecter)) {
            if ($this->interface === null) {
                return true;
            }
            return (bool) $reflecter->implementsInterface($this->interface);
        }

        unset($reflecter);

        return false;
    }
470931
protected function load(SplFileInfo $file)
    {
        $path = $file->getPathName();

        if (!isset($this->cache['contents'][$path])) {
            $data    = $this->decoder->decode($file->getContents(), static::getFormat($file));
            $context = ['file' => $file, 'data' => $data];

            if (is_array($data)) {
                foreach ($this->handlers as $property => $handler) {
                    if ($handler->isSupported($data)) {
                        $value = isset($data[$property]) ? $data[$property] : null;
                        $data[$property] = $handler->handle($value, $context);
                    }
                }
            }

            $this->cache['contents'][$path] = $data;
        }

        return $this->cache['contents'][$path];
    }
1099187
protected function isExcluded(SplFileInfo $file, Collection $excludes)
    {
        return $excludes->contains(function ($exclude) use ($file) {
            return Str::startsWith($file->getPathname(), $exclude);
        });
    }
995924
public function isSafe($file)
	{
		$file = Util::normalizePath($file);

		return (bool) $this->adapter->isSafe($file);
	}
197779
public function filter(SplFileInfo $file)
    {
        try {
            $class = $this->getClassName($file->getPathname());
        } catch (Exception $e){
            return false;
        }

        $usedtraits = class_uses($class, $this->useautoload);

        foreach ($this->instances as $instance) {
            if (in_array($instance, $usedtraits)) {
                return true;
            }
        }

        return false;
    }
876680
protected static function getFilePath(\SplFileInfo $file)
    {
        $path = $file->getPathname();

        $path = trim(str_replace('\\', '/', $path));

        return $path;
    }
424496
private function checkFile(string &$file): bool
    {
        $file = "{$this->directory}/{$file}";

        return file_exists($file) || (touch($file) && chmod($file, 0600));
    }