lib/private/Archive/TAR.php
/**
	 * check if a file or folder exists in the archive
	 *
	 * @param string $path
	 * @return bool
	 */
check if a file or folder exists in the archive
@param string $path
@return bool
check if a file or folder exists in the archive @param string $path @return bool
function fileExists($path) {
		$files = $this->getFiles();
		if ((array_search($path, $files) !== false) or (array_search($path . '/', $files) !== false)) {
			return true;
		} else {
			$folderPath = $path;
			if (substr($folderPath, -1, 1) != '/') {
				$folderPath .= '/';
			}
			$pathLength = strlen($folderPath);
			foreach ($files as $file) {
				if (strlen($file) > $pathLength and substr($file, 0, $pathLength) == $folderPath) {
					return true;
				}
			}
		}
		if ($path[0] != '/') { 
			return $this->fileExists('/' . $path);
		} else {
			return false;
		}
	}
function fileExists ( $ path ) { $ files = $ this -> getFiles ( ) ; if ( ( array_search ( $ path , $ files ) !== false ) or ( array_search ( $ path . '/' , $ files ) !== false ) ) { return true ; } else { $ folderPath = $ path ; if ( substr ( $ folderPath , - 1 , 1 ) != '/' ) { $ folderPath .= '/' ; } $ pathLength = strlen ( $ folderPath ) ; foreach ( $ files as $ file ) { if ( strlen ( $ file ) > $ pathLength and substr ( $ file , 0 , $ pathLength ) == $ folderPath ) { return true ; } } } if ( $ path [ 0 ] != '/' ) { return $ this -> fileExists ( '/' . $ path ) ; } else { return false ; } }
check if a file or folder exists in the archive
 @param string $path
 @return bool
check if a file or folder exists in the archive @param string $path @return bool
//not all programs agree on the use of a leading /