wp/wp-admin/includes/class-ftp-sockets.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
    23  * @copyright Alexey Dotsenko
    23  * @copyright Alexey Dotsenko
    24  * @author Alexey Dotsenko
    24  * @author Alexey Dotsenko
    25  * @link http://www.phpclasses.org/browse/package/1743.html Site
    25  * @link http://www.phpclasses.org/browse/package/1743.html Site
    26  * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
    26  * @license LGPL http://www.opensource.org/licenses/lgpl-license.html
    27  */
    27  */
    28 class ftp extends ftp_base {
    28 class ftp_sockets extends ftp_base {
    29 
       
    30 	function ftp($verb=FALSE, $le=FALSE) {
       
    31 		$this->__construct($verb, $le);
       
    32 	}
       
    33 
    29 
    34 	function __construct($verb=FALSE, $le=FALSE) {
    30 	function __construct($verb=FALSE, $le=FALSE) {
    35 		parent::__construct(true, $verb, $le);
    31 		parent::__construct(true, $verb, $le);
    36 	}
    32 	}
    37 
    33 
   129 			}
   125 			}
   130 			if(!$this->_checkCode()) {
   126 			if(!$this->_checkCode()) {
   131 				$this->_data_close();
   127 				$this->_data_close();
   132 				return FALSE;
   128 				return FALSE;
   133 			}
   129 			}
   134 			$ip_port = explode(",", ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*".CRLF."$", "\\1", $this->_message));
   130 			$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));
   135 			$this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
   131 			$this->_datahost=$ip_port[0].".".$ip_port[1].".".$ip_port[2].".".$ip_port[3];
   136             $this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
   132 			$this->_dataport=(((int)$ip_port[4])<<8) + ((int)$ip_port[5]);
   137 			$this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
   133 			$this->SendMSG("Connecting to ".$this->_datahost.":".$this->_dataport);
   138 			if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) {
   134 			if(!@socket_connect($this->_ftp_data_sock, $this->_datahost, $this->_dataport)) {
   139 				$this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock)));
   135 				$this->PushError("_data_prepare","socket_connect", socket_strerror(socket_last_error($this->_ftp_data_sock)));
   140 				$this->_data_close();
   136 				$this->_data_close();
   141 				return FALSE;
   137 				return FALSE;