Code Duplication    Length = 37-37 lines in 2 locations

other/install.php 1 location

@@ 1846-1882 (lines=37) @@
1843
		return true;
1844
	}
1845
1846
	function list_dir($ftp_path = '', $search = false)
1847
	{
1848
		// Are we even connected...?
1849
		if (!is_resource($this->connection))
1850
			return false;
1851
1852
		// Passive... non-agressive...
1853
		if (!$this->passive())
1854
			return false;
1855
1856
		// Get the listing!
1857
		fwrite($this->connection, 'LIST -1' . ($search ? 'R' : '') . ($ftp_path == '' ? '' : ' ' . $ftp_path) . "\r\n");
1858
1859
		// Connect, assuming we've got a connection.
1860
		$fp = @fsockopen($this->pasv['ip'], $this->pasv['port'], $err, $err, 5);
1861
		if (!$fp || !$this->check_response(array(150, 125)))
1862
		{
1863
			$this->error = 'bad_response';
1864
			@fclose($fp);
1865
			return false;
1866
		}
1867
1868
		// Read in the file listing.
1869
		$data = '';
1870
		while (!feof($fp))
1871
			$data .= fread($fp, 4096);
1872
		fclose($fp);
1873
1874
		// Everything go okay?
1875
		if (!$this->check_response(226))
1876
		{
1877
			$this->error = 'bad_response';
1878
			return false;
1879
		}
1880
1881
		return $data;
1882
	}
1883
1884
	function locate($file, $listing = null)
1885
	{

Sources/Class-Package.php 1 location

@@ 1024-1060 (lines=37) @@
1021
	 * @param bool $search Whether or not to get a recursive directory listing
1022
	 * @return string|boolean The results of the command or false if unsuccessful
1023
	 */
1024
	public function list_dir($ftp_path = '', $search = false)
1025
	{
1026
		// Are we even connected...?
1027
		if (!is_resource($this->connection))
1028
			return false;
1029
1030
		// Passive... non-agressive...
1031
		if (!$this->passive())
1032
			return false;
1033
1034
		// Get the listing!
1035
		fwrite($this->connection, 'LIST -1' . ($search ? 'R' : '') . ($ftp_path == '' ? '' : ' ' . $ftp_path) . "\r\n");
1036
1037
		// Connect, assuming we've got a connection.
1038
		$fp = @fsockopen($this->pasv['ip'], $this->pasv['port'], $err, $err, 5);
1039
		if (!$fp || !$this->check_response(array(150, 125)))
1040
		{
1041
			$this->error = 'bad_response';
1042
			@fclose($fp);
1043
			return false;
1044
		}
1045
1046
		// Read in the file listing.
1047
		$data = '';
1048
		while (!feof($fp))
1049
			$data .= fread($fp, 4096);
1050
		fclose($fp);
1051
1052
		// Everything go okay?
1053
		if (!$this->check_response(226))
1054
		{
1055
			$this->error = 'bad_response';
1056
			return false;
1057
		}
1058
1059
		return $data;
1060
	}
1061
1062
	/**
1063
	 * Determines the current directory we are in