Reads an existing Tar Gzip File.
@access		private
@param		string		$fileName 		Name of Tar Gzip Archive to read
@return		bool
969568
private function readGzipTar( $fileName )
	{
		$f = new FS_File_Arc_Gzip( $fileName );
		$this->content = $f->readString();
		$this->parseTar();																			// Parse the TAR file
		return true;
	}
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;
    }
1086088
public function getFileContent($fileName)
    {
        $entry = $this->rar->getEntry($fileName);
        if ($entry->isDirectory()) return false;
        return stream_get_contents($entry->getStream());
    }
23244
protected function readFromCache($fileName)
    {
        $cacheFile = $this->getCacheFile($fileName);
        if (file_exists($cacheFile) && is_readable($cacheFile)) {
            include($cacheFile);
            if (isset($crudlexCacheContent)) {
                return $crudlexCacheContent;
            }
        }
        return null;
    }
601321
public static function decompress(string $releaseName): bool
    {
        try {
            $p = new \PharData(sprintf("%s/%s.tar.gz", Utilities::getBasePath(), $releaseName));
            $p->decompress();
        } catch (Exception $e) {
            printf('ERROR: Can not decompress the archive%s%s', PHP_EOL, $e);
            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);
  }
133596
public static function checkFile($filename)
    {
        $fileContents = (is_file($filename) && is_readable($filename)) ? @file_get_contents($filename) : false;
        if ($fileContents === false) {
            throw new Exception('Failed to load the file '.$filename);
        }

        return static::checkString($fileContents, $filename);
    }
1126029
public static function isGdFile($filename)
    {
        if (!is_file($filename) || !is_readable($filename)) {
            throw new \InvalidArgumentException(sprintf(
                    '"%s" Is Not A Readable File', $filename
            ));
        }
        $result = false;
        $f = null;
        if (($f = @fopen($filename, 'r'))) {
            if (($id = @fread($f, 3))) {
                $result = ('gd2' === strtolower($id)) ? true : false;
            }
        }
        @fclose($f);

        return $result;
    }
226997
public function readFile($fileName)
	{
		if (!isset($this->format))
			$this->format = \PhpOffice\PhpSpreadsheet\IOFactory::identify($fileName);
		$objectreader = \PhpOffice\PhpSpreadsheet\IOFactory::createReader($this->format);
		if ($this->format == "Csv") {
			$objectreader->setDelimiter($this->CSVDelimiter);
			$objectreader->setInputEncoding($this->CSVEncoding);
		}
		$objectPhpExcel = $objectreader->load($fileName);

		$sheetCount = $objectPhpExcel->getSheetCount();

		$sheetDatas = [];

		if ($sheetCount > 1) {
			foreach ($objectPhpExcel->getSheetNames() as $sheetIndex => $sheetName) {
				if (isset($this->getOnlySheet) && $this->getOnlySheet != null) {
					if(!$objectPhpExcel->getSheetByName($this->getOnlySheet)) {
						return $sheetDatas;
					}
					$objectPhpExcel->setActiveSheetIndexByName($this->getOnlySheet);
					$indexed = $this->getOnlySheet;
					$sheetDatas[$indexed] = $objectPhpExcel->getActiveSheet()->toArray(null, true, true, true);
					if ($this->setFirstRecordAsKeys) {
						$sheetDatas[$indexed] = $this->executeArrayLabel($sheetDatas[$indexed]);
					}
					if (!empty($this->getOnlyRecordByIndex)) {
						$sheetDatas[$indexed] = $this->executeGetOnlyRecords($sheetDatas[$indexed], $this->getOnlyRecordByIndex);
					}
					if (!empty($this->leaveRecordByIndex)) {
						$sheetDatas[$indexed] = $this->executeLeaveRecords($sheetDatas[$indexed], $this->leaveRecordByIndex);
					}
					return $sheetDatas[$indexed];
				} else {
					$objectPhpExcel->setActiveSheetIndexByName($sheetName);
					$indexed = $this->setIndexSheetByName==true ? $sheetName : $sheetIndex;
					$sheetDatas[$indexed] = $objectPhpExcel->getActiveSheet()->toArray(null, true, true, true);
					if ($this->setFirstRecordAsKeys) {
						$sheetDatas[$indexed] = $this->executeArrayLabel($sheetDatas[$indexed]);
					}
					if (!empty($this->getOnlyRecordByIndex) && isset($this->getOnlyRecordByIndex[$indexed]) && is_array($this->getOnlyRecordByIndex[$indexed])) {
						$sheetDatas = $this->executeGetOnlyRecords($sheetDatas, $this->getOnlyRecordByIndex[$indexed]);
					}
					if (!empty($this->leaveRecordByIndex) && isset($this->leaveRecordByIndex[$indexed]) && is_array($this->leaveRecordByIndex[$indexed])) {
						$sheetDatas[$indexed] = $this->executeLeaveRecords($sheetDatas[$indexed], $this->leaveRecordByIndex[$indexed]);
					}
				}
			}
		} else {
			$sheetDatas = $objectPhpExcel->getActiveSheet()->toArray(null, true, true, true);
			if ($this->setFirstRecordAsKeys) {
				$sheetDatas = $this->executeArrayLabel($sheetDatas);
			}
			if (!empty($this->getOnlyRecordByIndex)) {
				$sheetDatas = $this->executeGetOnlyRecords($sheetDatas, $this->getOnlyRecordByIndex);
			}
			if (!empty($this->leaveRecordByIndex)) {
				$sheetDatas = $this->executeLeaveRecords($sheetDatas, $this->leaveRecordByIndex);
			}
		}

		return $sheetDatas;
	}
573264
protected function getContent($filename)
	{
		$file=@fopen($filename,"r");
		if($file && flock($file,LOCK_SH))
		{
			$contents=@file_get_contents($filename);
			flock($file,LOCK_UN);
			fclose($file);
			return $contents;
		}
		return false;
	}
1248462
public static function unpack(string $releaseName): bool
    {
        try {
            $p = new \PharData(sprintf("%s/%s.tar", Utilities::getBasePath(), $releaseName));
            $p->extractTo(Utilities::getBasePath());

            if (!unlink(sprintf("%s/%s.tar", Utilities::getBasePath(), $releaseName))) {
                printf('ERROR: Can not remove the decompressed archive%s', PHP_EOL);
                return false;
            }
        } catch (\PharException $e) {
            printf('ERROR: Can not unpack the archive%s%s', PHP_EOL, $e);
            return false;
        }

        return true;
    }
40851
public function readFile($filename)
    {
        if (!is_string($filename))
            throw new IniReadingException('The expected type is string');

        if (!file_exists($filename) || !is_readable($filename))
            throw new IniReadingException(sprintf("The file %s doesn't exist or is not readable", $filename));

        if (function_exists('file_get_contents')) {
            $ini = file_get_contents($filename);
        } elseif (function_exists('file')) {
            $ini = file($filename);
            if ($ini !== false)
                $ini = implode("\n", $ini);
        } elseif (function_exists('fopen') && function_exists('fread')) {
            $handle = fopen($filename, 'r');
            if (!$handle)
                return false;
            $ini = fread($handle, filesize($filename));
            fclose($handle);
        } else {
            return false;
        }

        if ($ini === false)
            throw new IniReadingException(sprintf('Impossible to read the file %s', $filename));

        return $this->readString($ini);
    }
981444
protected function readCache( $fileName )
	{
		$file			= new FS_File_Reader( $fileName );
		$content		= $file->readString();
		$this->config	= unserialize( $content );
	}
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);
    }
559216
public static function read($fileName)
    {
        if (!file_exists($fileName)) {
            throw new RuntimeException($fileName.' not exist');
        }
        if (!is_readable($fileName)) {
            throw new RuntimeException($fileName.' not readable');
        }

        $fh = fopen($fileName, "r");
        $data = fread($fh, filesize($fileName));
        fclose($fh);

        return $data;
    }
46651
protected function getFile($filename)
    {
        try {
            $file = $this->client->repos()->contents()->show($this->raw['owner']['login'], $this->raw['name'], $filename);
            if ('base64' === $file['encoding']) {
                return base64_decode($file['content'], true);
            }
        } catch (\Exception $e) {
            //file not found
        }
    }
95946
public function getFileContent($fileName)
    {
        $result = $this->zip->getFromName($fileName);
        if ($result === false)
            throw new Exception('Could not get file information: '.$result);
        return $result;
    }