public static function ftpChmod($url, $mode)
	{
		$sch = parse_url($url, PHP_URL_SCHEME);

		if (($sch != 'ftp') && ($sch != 'ftps'))
		{
			return false;
		}

		$server = parse_url($url, PHP_URL_HOST);
		$port = parse_url($url, PHP_URL_PORT);
		$path = parse_url($url, PHP_URL_PATH);
		$user = parse_url($url, PHP_URL_USER);
		$pass = parse_url($url, PHP_URL_PASS);

		if ((!$server) || (!$path))
		{
			return false;
		}

		if (!$port)
		{
			$port = 21;
		}

		if (!$user)
		{
			$user = 'anonymous';
		}

		if (!$pass)
		{
			$pass = '';
		}

		switch ($sch)
		{
			case 'ftp':
				$ftpid = ftp_connect($server, $port);
				break;

			case 'ftps':
				$ftpid = ftp_ssl_connect($server, $port);
				break;
		}

		if (!$ftpid)
		{
			return false;
		}

		$login = ftp_login($ftpid, $user, $pass);

		if (!$login)
		{
			return false;
		}

		$res = ftp_chmod($ftpid, $mode, $path);
		ftp_close($ftpid);

		return $res;
	}
public static function ftpChmod($url, $mode)
	{
		$sch = parse_url($url, PHP_URL_SCHEME);

		if (($sch != 'ftp') && ($sch != 'ftps'))
		{
			return false;
		}

		$server = parse_url($url, PHP_URL_HOST);
		$port = parse_url($url, PHP_URL_PORT);
		$path = parse_url($url, PHP_URL_PATH);
		$user = parse_url($url, PHP_URL_USER);
		$pass = parse_url($url, PHP_URL_PASS);

		if ((!$server) || (!$path))
		{
			return false;
		}

		if (!$port)
		{
			$port = 21;
		}

		if (!$user)
		{
			$user = 'anonymous';
		}

		if (!$pass)
		{
			$pass = '';
		}

		switch ($sch)
		{
			case 'ftp':
				$ftpid = ftp_connect($server, $port);
				break;

			case 'ftps':
				$ftpid = ftp_ssl_connect($server, $port);
				break;
		}

		if (!$ftpid)
		{
			return false;
		}

		$login = ftp_login($ftpid, $user, $pass);

		if (!$login)
		{
			return false;
		}

		$res = ftp_chmod($ftpid, $mode, $path);
		ftp_close($ftpid);

		return $res;
	}
public static function ftpChmod ( $ url , $ mode ) { $ sch = parse_url ( $ url , PHP_URL_SCHEME ) ; if ( ( $ sch != 'ftp' ) && ( $ sch != 'ftps' ) ) { return false ; } $ server = parse_url ( $ url , PHP_URL_HOST ) ; $ port = parse_url ( $ url , PHP_URL_PORT ) ; $ path = parse_url ( $ url , PHP_URL_PATH ) ; $ user = parse_url ( $ url , PHP_URL_USER ) ; $ pass = parse_url ( $ url , PHP_URL_PASS ) ; if ( ( ! $ server ) || ( ! $ path ) ) { return false ; } if ( ! $ port ) { $ port = 21 ; } if ( ! $ user ) { $ user = 'anonymous' ; } if ( ! $ pass ) { $ pass = '' ; } switch ( $ sch ) { case 'ftp' : $ ftpid = ftp_connect ( $ server , $ port ) ; break ; case 'ftps' : $ ftpid = ftp_ssl_connect ( $ server , $ port ) ; break ; } if ( ! $ ftpid ) { return false ; } $ login = ftp_login ( $ ftpid , $ user , $ pass ) ; if ( ! $ login ) { return false ; } $ res = ftp_chmod ( $ ftpid , $ mode , $ path ) ; ftp_close ( $ ftpid ) ; return $ res ; }
Quick FTP chmod

@param   string   $url   Link identifier
@param   integer  $mode  The new permissions, given as an octal value.

@return  mixed

@see     http://www.php.net/manual/en/function.ftp-chmod.php
@since   1.0
Quick FTP chmod