Code Duplication    Length = 37-37 lines in 3 locations

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

other/upgrade.php 1 location

@@ 415-451 (lines=37) @@
412
			return true;
413
		}
414
415
		function list_dir($ftp_path = '', $search = false)
416
		{
417
			// Are we even connected...?
418
			if (!is_resource($this->connection))
419
				return false;
420
421
			// Passive... non-agressive...
422
			if (!$this->passive())
423
				return false;
424
425
			// Get the listing!
426
			fwrite($this->connection, 'LIST -1' . ($search ? 'R' : '') . ($ftp_path == '' ? '' : ' ' . $ftp_path) . "\r\n");
427
428
			// Connect, assuming we've got a connection.
429
			$fp = @fsockopen($this->pasv['ip'], $this->pasv['port'], $err, $err, 5);
430
			if (!$fp || !$this->check_response(array(150, 125)))
431
			{
432
				$this->error = 'bad_response';
433
				@fclose($fp);
434
				return false;
435
			}
436
437
			// Read in the file listing.
438
			$data = '';
439
			while (!feof($fp))
440
				$data .= fread($fp, 4096);
441
			fclose($fp);
442
443
			// Everything go okay?
444
			if (!$this->check_response(226))
445
			{
446
				$this->error = 'bad_response';
447
				return false;
448
			}
449
450
			return $data;
451
		}
452
453
		function locate($file, $listing = null)
454
		{

other/install.php 1 location

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