@param $filename

@return bool
971078
public function template_exists($filename)
    {
        if (!is_array($this->template_dir)) {
            return file_exists($this->template_dir . DIRECTORY_SEPARATOR . $filename);
        } else {
            foreach ($this->template_dir as $tpl_dir) {
                if (file_exists($tpl_dir . DIRECTORY_SEPARATOR . $filename)) {
                    return true;
                }
            }

            return false;
        }
    }
699929
public function get($filename)
    {
        if (!$stream = $this->readStream($filename)) {
            return false;
        }

        $contents = stream_get_contents($stream);

        fclose($stream);

        return $contents;
    }
155455
public function exists($name): bool
    {
        $filename = $this->getFilename($name);
        if ($filename === false) {
            return false;
        }

        return true;
    }
774565
public function checkFile( $fileName )
	{
		$output = shell_exec('php -l "'.$fileName.'"');
		if( preg_match( "@^No syntax errors detected@", $output	) )
			return TRUE;
		$this->error	= $output;
		return FALSE;
	}
104422
protected function validateFilePath($fileName) {
		if (!file_exists($fileName)) {
			throw new IOException("File $fileName does not exists");
		}
		if (!is_file($fileName)) {
			throw new IOException("$fileName must be a file");
		}
		if (!is_readable($fileName)) {
			throw new IOException("File $fileName is not readable");
		}
		return true;
	}
771745
public function isSupportedImageFormat($filename)
	{
		$info = new ImageInfo($filename);
		if ($info->hasError()) {
			$this->container->getLogger()->error($info->getError());
			return false;
		}

		if ( ! $this->isMimeTypeImage($info->getMime())) {
			return false;
		}

		return ImageProcessor\ImageProcessor::isSupportedImageType($info->getType());
	}
601675
protected function checkIfFileNameIsSafe(string $fileName)
    {
        $allowedFileNames = $this->getLanguageFiles(true);

        if (!in_array($fileName, $allowedFileNames)) {
            return false;
        }

        return true;
    }
109308
protected function _shouldSkip($fileName) {
		$filter = $this->param('filter');
		if (!$filter) {
			return false;
		}

		return !(bool)preg_match('/' . preg_quote($filter, '/') . '/i', $fileName);
	}
1155905
public static function _release( $filename )
    {
        if(function_exists('sem_get')) {
            @sem_release(self::getResource(hexdec(md5($filename))));
            return true;
        } else {
            return @unlink($filename.'.lock');
        }
    }
435360
function isDirectory( $filename = false )
    {
        if ( !$filename )
            $filename = $this->FileName;
        return $this->doIsDirectory( $filename );
    }
143110
public function rename($filename)
    {
        if ($this->exists() && !@rename($this->filename, $filename)) {
            return false;
        }

        unset(static::$instances[$this->filename]);
        static::$instances[$filename] = $this;

        $this->filename = $filename;

        return true;
    }
1335616
protected function isValidFilename($filename)
    {
        $extension = strtolower(File::get_file_extension($filename));

        // Validate true if within the list of allowed extensions
        $allowed = $this->getAllowedExtensions();
        if ($allowed) {
            return in_array($extension, $allowed);
        }

        // If no extensions are configured, fallback to global list
        $globalList = File::getAllowedExtensions();
        if (in_array($extension, $globalList)) {
            return true;
        }

        // Only admins can bypass global rules
        return !File::config()->apply_restrictions_to_admin && Permission::check('ADMIN');
    }
357237
public function fileExists($filename)
    {
        if ($this->mediaDirectory->isFile($filename)) {
            return true;
        } else {
            return $this->coreFileStorageDatabase->saveFileToFilesystem(
                $this->mediaDirectory->getAbsolutePath($filename)
            );
        }
    }
506609
public function read($fileName)
    {
        $path = $this->getPathBase($fileName);

        if (!file_exists($path)) {
            return;
        }

        $data = file_get_contents($path);
        return $this->data = unserialize($data);
    }
661851
public function contains($filename)
    {
        $this->initialize();

        try {
            $file = $this->matcher->getFile($filename);
        } catch (FileNotFoundException $e) {
            return false;
        }

        foreach ($this->files as $item) {
            if ($item->getFullPath() === $file->getFullPath()) {
                return true;
            }
        }

        return false;
    }
150383
protected function checkExpire($fileName)
    {
        if(!is_file($fileName))
        {
            return false;
        }
        $exDataFileName = $this->getExDataFileName($fileName);
        $data = unserialize(FileUtil::readFile($exDataFileName));
        if(null === $data['ttl'] ?? null)
        {
            return false;
        }
        $maxTime = time() - $data['ttl'];
        if(filemtime($fileName) <= $maxTime)
        {
            unlink($fileName);
            unlink($exDataFileName);
            return true;
        }
        else
        {
            return false;
        }
    }
10262
public function isFile($filename)
    {
        $absolutePath = $this->parser->absoluteFilePath($filename);

        return file_exists($absolutePath) && is_file($absolutePath) ? $absolutePath : null;
    }