From 517bb340dc6dfa8934e381b00a0df7c126e823ba Mon Sep 17 00:00:00 2001 From: taggon Date: Tue, 28 Sep 2010 19:41:22 +0000 Subject: [PATCH] =?UTF-8?q?#19140647=20Fixed=20:=20ftp.class.php=EC=9D=98?= =?UTF-8?q?=20=EB=AC=B8=EC=A0=9C=EB=A1=9C=20=EC=B5=9C=EC=8B=A0=EB=B2=84?= =?UTF-8?q?=EC=A0=84=20PHP=EC=97=90=EC=84=9C=20=EC=89=AC=EC=9A=B4=EC=84=A4?= =?UTF-8?q?=EC=B9=98=EA=B0=80=20=EB=8F=99=EC=9E=91=EC=95=88=EB=90=98?= =?UTF-8?q?=EB=8A=94=20=ED=98=84=EC=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7730 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- libs/ftp.class.php | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/libs/ftp.class.php b/libs/ftp.class.php index ad6c526cf..21ff636d1 100644 --- a/libs/ftp.class.php +++ b/libs/ftp.class.php @@ -2,12 +2,19 @@ /********************************************************************* * * PHP FTP Client Class By TOMO ( groove@spencernetwork.org ) + * Modified By NHN ( developers@xpressengine.com ) * - * - Version 0.12 (2002/01/11) + * - Version 0.13 (2010/09/29) + * * - This script is free but without any warranty. * - You can freely copy, use, modify or redistribute this script * for any purpose. * - But please do not erase this information!!. + * + * Change log + * - Version 0.13 (2010/09/29) + * . use preg functions instead of ereg functions + * - Version 0.12 (2002/01/11) * ********************************************************************/ @@ -104,7 +111,7 @@ return FALSE; } - return ereg_replace("^[0-9]{3} \"(.+)\" .+\r\n", "\\1", $this->ftp_resp); + return preg_replace("@^[0-9]{3} \"(.+)\" .+\r\n@", "\\1", $this->ftp_resp); } function ftp_size($pathname) @@ -115,7 +122,7 @@ return -1; } - return ereg_replace("^[0-9]{3} ([0-9]+)\r\n", "\\1", $this->ftp_resp); + return preg_replace("@^[0-9]{3} ([0-9]+)\r\n@", "\\1", $this->ftp_resp); } function ftp_mdtm($pathname) @@ -125,7 +132,7 @@ $this->ftp_debug("Error : MDTM command failed\n"); return -1; } - $mdtm = ereg_replace("^[0-9]{3} ([0-9]+)\r\n", "\\1", $this->ftp_resp); + $mdtm = preg_replace("@^[0-9]{3} ([0-9]+)\r\n@", "\\1", $this->ftp_resp); $date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d"); $timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]); @@ -251,7 +258,7 @@ $this->ftp_debug("Connected to remote host\n"); while (!feof($sock_data)) { - $list[] = ereg_replace("[\r\n]", "", fgets($sock_data, 512)); + $list[] = preg_replace("@[\r\n]@", "", fgets($sock_data, 512)); } $this->ftp_close_data_connection($sock_data); $this->ftp_debug(implode("\n", $list)); @@ -282,7 +289,7 @@ $this->ftp_debug("Connected to remote host\n"); while (!feof($sock_data)) { - $list[] = ereg_replace("[\r\n]", "", fgets($sock_data, 512)); + $list[] = preg_replace("@[\r\n]@", "", fgets($sock_data, 512)); } $this->ftp_debug(implode("\n", $list)); $this->ftp_close_data_connection($sock_data); @@ -450,7 +457,7 @@ return FALSE; } - $ip_port = ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*\r\n$", "\\1", $this->ftp_resp); + $ip_port = preg_replace("@^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*\r\n$@", "\\1", $this->ftp_resp); return $ip_port; } @@ -476,7 +483,7 @@ $this->ftp_debug(str_replace("\r\n", "\n", $this->ftp_resp)); - if (!ereg("^[123]", $this->ftp_resp)) { + if (!preg_match("@^[123]@", $this->ftp_resp)) { return FALSE; } @@ -491,7 +498,7 @@ function ftp_open_data_connection($ip_port) { - if (!ereg("[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+", $ip_port)) { + if (!preg_match("@[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+@", $ip_port)) { $this->ftp_debug("Error : Illegal ip-port format(".$ip_port.")\n"); return FALSE; }