Returns TRUE if the $filename is readable, or FALSE otherwise.
This function uses the PHP include_path, where PHP's is_readable()
does not.

@param  string $filename
@return boolean
496028
public static function isReadable($filename)
    {
        if (!$fh = @fopen($filename, 'r', true)) {
            return false;
        }
        @fclose($fh);
        return true;
    }
1226081
static function isWriteable( $filename )
    {
        if ( eZSys::osType() != 'win32' )
            return is_writable( $filename );

        /* PHP function is_writable() doesn't work correctly on Windows NT descendants.
         * So we have to use the following hack on those OSes.
         */
        if ( !( $fd = @fopen( $filename, 'a' ) ) )
            return FALSE;

        fclose( $fd );

        return TRUE;
    }
222413
public static function isFileLoaded($fileName)
  {
    if (!preg_match('/\.ini$/i', $fileName)) {
      $fileName .= '.ini';
    }
    return array_search($fileName, self::$files) !== false;
  }
1056336
public function equals( $fileName )
	{
		$toCompare	= FS_File_Reader::load( $fileName );
		$thisFile	= FS_File_Reader::load( $this->fileName );
		return( $thisFile == $toCompare );
	}
1189922
private function normalizeFileName($fileName)
    {
        if (!is_array($fileName)) {
            return $fileName;
        }

        return isset($fileName['filename']) ? $fileName['filename']
            : isset($fileName['file']) ? $fileName['file'] : ''
        ;
    }
122268
public function readdata($filename) {
        global $CFG;

        // Find if we are importing a .dat file.
        if (strtolower(pathinfo($filename, PATHINFO_EXTENSION)) == 'dat') {
            if (!is_readable($filename)) {
                $this->error(get_string('filenotreadable', 'error'));
                return false;
            }

            $fileobj = new qformat_blackboard_six_file();

            // As we are not importing a .zip file,
            // there is no imsmanifest, and it is not possible
            // to parse it to find the file type.
            // So we need to guess the file type by looking at the content.
            // For now we will do that searching for a required tag.
            // This is certainly not bullet-proof but works for all usual files.
            $fileobj->text = file_get_contents($filename);
            if (strpos($fileobj->text, '<questestinterop>')) {
                $fileobj->filetype = self::FILETYPE_QTI;
            }
            if (strpos($fileobj->text, '<POOL>')) {
                $fileobj->filetype = self::FILETYPE_POOL;
            }
            // In all other cases we are not able to handle this question file.

            // Readquestions is now expecting an array of strings.
            return array($fileobj);
        }
        // We are importing a zip file.
        // Create name for temporary directory.
        $uniquecode = time();
        $this->tempdir = make_temp_directory('bbquiz_import/' . $uniquecode);
        if (is_readable($filename)) {
            if (!copy($filename, $this->tempdir . '/bboard.zip')) {
                $this->error(get_string('cannotcopybackup', 'question'));
                fulldelete($this->tempdir);
                return false;
            }
            $packer = get_file_packer('application/zip');
            if ($packer->extract_to_pathname($this->tempdir . '/bboard.zip', $this->tempdir)) {
                $dom = new DomDocument();

                if (!$dom->load($this->tempdir . '/imsmanifest.xml')) {
                    $this->error(get_string('errormanifest', 'qformat_blackboard_six'));
                    fulldelete($this->tempdir);
                    return false;
                }

                $xpath = new DOMXPath($dom);

                // We starts from the root element.
                $query = '//resources/resource';
                $qfile = array();

                $examfiles = $xpath->query($query);
                foreach ($examfiles as $examfile) {
                    $fileobj = new qformat_blackboard_six_file();

                    if ($examfile->getAttribute('type') == 'assessment/x-bb-qti-test'
                            || $examfile->getAttribute('type') == 'assessment/x-bb-qti-pool') {

                        if ($content = $this->get_filecontent($examfile->getAttribute('bb:file'))) {
                            $fileobj->filetype = self::FILETYPE_QTI;
                            $fileobj->filebase = $this->tempdir;
                            $fileobj->text = $content;
                            $qfile[] = $fileobj;
                        }
                    }
                    if ($examfile->getAttribute('type') == 'assessment/x-bb-pool') {
                        if ($examfile->getAttribute('baseurl')) {
                            $fileobj->filebase = $this->tempdir. '/' . $examfile->getAttribute('baseurl');
                        }
                        if ($content = $this->get_filecontent($examfile->getAttribute('file'))) {
                            $fileobj->filetype = self::FILETYPE_POOL;
                            $fileobj->text = $content;
                            $qfile[] = $fileobj;
                        }
                    }
                }

                if ($qfile) {
                    return $qfile;
                } else {
                    $this->error(get_string('cannotfindquestionfile', 'question'));
                    fulldelete($this->tempdir);
                }
            } else {
                $this->error(get_string('cannotunzip', 'question'));
                fulldelete($this->temp_dir);
            }
        } else {
            $this->error(get_string('cannotreaduploadfile', 'error'));
            fulldelete($this->tempdir);
        }
        return false;
    }
262482
protected function detectEncodingOfFile($filename)
    {
        $encoding = '';
        $content = file_get_contents($filename);
        if ($content !== false) {
            $encoding = mb_detect_encoding($content, 'UTF-8, ISO-8859-1', true);
        }

        return $encoding;
    }
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;
    }
1048638
def is_readable(filename):
    """"""
    return os.path.isfile(filename) and os.access(filename, os.R_OK)
1135566
protected function checkFileType($filename) {

        if ( $this->config['allow_ext'] == '*' ) {
            return true;
        }
		$_ext = strtolower(self::getFileExt($filename));
        $_allow_ext = explode("|", $this->config['allow_ext']);
		if ( !in_array($_ext, $_allow_ext) ) {
			$this->errNum = 5;
            return false;
		}
        return true;
	}
811276
public static function parseFile($filename) {
    $source = @file_get_contents($filename);
    if ($source === FALSE) {
      return FALSE;
    }
    return self::parseSource($source, $filename);
  }
193093
public static function isGifFile($filename)
    {
        try {
            $image = new ImageFile($filename);
            if (strtolower($image->getMime()) !== @image_type_to_mime_type(IMAGETYPE_GIF)) {
                return false;
            }

            return true;
        } catch (\RuntimeException $ex) {
            return false;
        }
    }
1357464
public function isReadable(): bool
    {
        if ($this->caching == false) {
            return is_readable($this->getAbsoluteFilePath());
        }

        if ($this->isReadable == null) {
            $this->isReadable = is_readable($this->getAbsoluteFilePath());
        }

        return $this->isReadable;
    }
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;
	}
59878
public static function parseFromFile($filename)
    {
        if (file_exists($filename) && is_readable($filename)) {
            return new self(file_get_contents($filename));
        } else {
            throw new \RuntimeException(sprintf("File %s is not readable, or doesn't exist.", $filename));
        }
    }
75072
public function isReadable() {

		if(false !== $this -> file -> getExists()) {

			$this -> refresh();
			
			return $this -> file -> getReadable();
		}

		return false;
	}
653401
public function import_from_file($filename)
    {
        $reader = new FileReader($filename);
        if (!$reader->is_resource()) {
            return false;
        }

        $this->filename = (string) $filename;

        return $this->import_from_reader($reader);
    }