diff -r 490d5cc509ed -r cf61fcea0001 wp/wp-admin/includes/class-ftp.php --- a/wp/wp-admin/includes/class-ftp.php Tue Jun 09 11:14:17 2015 +0000 +++ b/wp/wp-admin/includes/class-ftp.php Mon Oct 14 17:39:30 2019 +0200 @@ -121,10 +121,6 @@ var $AutoAsciiExt; /* Constructor */ - function ftp_base($port_mode=FALSE) { - $this->__construct($port_mode); - } - function __construct($port_mode=FALSE, $verb=FALSE, $le=FALSE) { $this->LocalEcho=$le; $this->Verbose=$verb; @@ -157,6 +153,10 @@ elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') $this->OS_local=FTP_OS_Mac; } + function ftp_base($port_mode=FALSE) { + $this->__construct($port_mode); + } + // // // @@ -380,7 +380,7 @@ function pwd() { if(!$this->_exec("PWD", "pwd")) return FALSE; if(!$this->_checkCode()) return FALSE; - return ereg_replace("^[0-9]{3} \"(.+)\".+", "\\1", $this->_message); + return preg_replace("/^[0-9]{3} \"(.+)\".*$/s", "\\1", $this->_message); } function cdup() { @@ -424,7 +424,7 @@ } if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE; if(!$this->_checkCode()) return FALSE; - return ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message); + return preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message); } function abort() { @@ -444,7 +444,7 @@ } if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE; if(!$this->_checkCode()) return FALSE; - $mdtm = ereg_replace("^[0-9]{3} ([0-9]+)".CRLF, "\\1", $this->_message); + $mdtm = preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message); $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d"); $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]); return $timestamp; @@ -694,7 +694,7 @@ } foreach($list as $k=>$v) { $list[$k]=$this->parselisting($v); - if($list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]); + if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]); } $ret=true; foreach($list as $el) { @@ -727,7 +727,7 @@ foreach($list as $k=>$v) { $list[$k]=$this->parselisting($v); - if($list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]); + if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]); } $ret=true; @@ -818,8 +818,8 @@ function glob_regexp($pattern,$probe) { $sensitive=(PHP_OS!='WIN32'); return ($sensitive? - ereg($pattern,$probe): - eregi($pattern,$probe) + preg_match( '/' . preg_quote( $pattern, '/' ) . '/', $probe ) : + preg_match( '/' . preg_quote( $pattern, '/' ) . '/i', $probe ) ); } @@ -904,3 +904,9 @@ } require_once dirname( __FILE__ ) . "/class-ftp-" . ( $mod_sockets ? "sockets" : "pure" ) . ".php"; + +if ( $mod_sockets ) { + class ftp extends ftp_sockets {} +} else { + class ftp extends ftp_pure {} +}