Code Duplication    Length = 18-18 lines in 3 locations

Sources/Class-Package.php 1 location

@@ 829-846 (lines=18) @@
826
	 * @param string $ftp_path The path to the directory we want to change to
827
	 * @return boolean Whether or not the operation was successful
828
	 */
829
	public function chdir($ftp_path)
830
	{
831
		if (!is_resource($this->connection))
832
			return false;
833
834
		// No slash on the end, please...
835
		if ($ftp_path !== '/' && substr($ftp_path, -1) === '/')
836
			$ftp_path = substr($ftp_path, 0, -1);
837
838
		fwrite($this->connection, 'CWD ' . $ftp_path . "\r\n");
839
		if (!$this->check_response(250))
840
		{
841
			$this->error = 'bad_path';
842
			return false;
843
		}
844
845
		return true;
846
	}
847
848
	/**
849
	 * Changes a files atrributes (chmod)

other/upgrade.php 1 location

@@ 279-296 (lines=18) @@
276
			}
277
		}
278
279
		function chdir($ftp_path)
280
		{
281
			if (!is_resource($this->connection))
282
				return false;
283
284
			// No slash on the end, please...
285
			if (substr($ftp_path, -1) == '/' && $ftp_path !== '/')
286
				$ftp_path = substr($ftp_path, 0, -1);
287
288
			fwrite($this->connection, 'CWD ' . $ftp_path . "\r\n");
289
			if (!$this->check_response(250))
290
			{
291
				$this->error = 'bad_path';
292
				return false;
293
			}
294
295
			return true;
296
		}
297
298
		function chmod($ftp_file, $chmod)
299
		{

other/install.php 1 location

@@ 1716-1733 (lines=18) @@
1713
		}
1714
	}
1715
1716
	function chdir($ftp_path)
1717
	{
1718
		if (!is_resource($this->connection))
1719
			return false;
1720
1721
		// No slash on the end, please...
1722
		if (substr($ftp_path, -1) == '/')
1723
			$ftp_path = substr($ftp_path, 0, -1);
1724
1725
		fwrite($this->connection, 'CWD ' . $ftp_path . "\r\n");
1726
		if (!$this->check_response(250))
1727
		{
1728
			$this->error = 'bad_path';
1729
			return false;
1730
		}
1731
1732
		return true;
1733
	}
1734
1735
	function chmod($ftp_file, $chmod)
1736
	{