ftp_pure::_data_prepare()publicWP 1.0

Метод класса: ftp_pure{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$ftp_pure = new ftp_pure();
$ftp_pure->_data_prepare( $mode );
$mode **
-
По умолчанию: FTP_ASCII

Код ftp_pure::_data_prepare() WP 6.4.3

function _data_prepare($mode=FTP_ASCII) {
	if(!$this->_settype($mode)) return FALSE;
	if($this->_passive) {
		if(!$this->_exec("PASV", "pasv")) {
			$this->_data_close();
			return FALSE;
		}
		if(!$this->_checkCode()) {
			$this->_data_close();
			return FALSE;
		}
		$ip_port = explode(",", preg_replace("/^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*$/s", "\\1", $this->_message));
		$this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
            $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
		$this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
		$this->_ftp_data_sock=@fsockopen($this->_datahost, $this->_dataport, $errno, $errstr, $this->_timeout);
		if(!$this->_ftp_data_sock) {
			$this->PushError("_data_prepare","fsockopen fails", $errstr." (".$errno.")");
			$this->_data_close();
			return FALSE;
		}
		else $this->_ftp_data_sock;
	} else {
		$this->SendMSG("Only passive connections available!");
		return FALSE;
	}
	return TRUE;
}