10 if(!$ftp_info->ftp_host)
12 $ftp_info->ftp_host =
"127.0.0.1";
15 $connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
16 if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
18 return new BaseObject(-1,
'msg_ftp_invalid_auth_info');
21 $sftp = ssh2_sftp($connection);
22 $curpwd =
"ssh2.sftp://$sftp".$this->pwd;
23 $dh = @opendir($curpwd);
24 if(!$dh)
return new BaseObject(-1,
'msg_ftp_invalid_path');
27 while(($file = readdir($dh)) !==
false)
29 if(!is_dir($curpwd.$file))
continue;
30 $list[] = $file .
"/";
33 $this->
add(
'list', $list);
40 return new BaseObject(-1,
'msg_ftp_invalid_auth_info');
42 $this->pwd = $ftp_info->ftp_root_path;
43 if(!$ftp_info->ftp_host)
45 $ftp_info->ftp_host =
"127.0.0.1";
48 if($ftp_info->sftp ==
'Y')
54 if(function_exists(
'ftp_connect'))
56 $connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
58 if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
60 ftp_close($connection);
61 return new BaseObject(-1,
'msg_ftp_invalid_auth_info');
64 if($ftp_info->ftp_pasv !=
"N")
66 ftp_pasv($connection,
true);
69 $_list = ftp_rawlist($connection, $this->pwd);
70 ftp_close($connection);
74 require_once(
_XE_PATH_.
'libs/ftp.class.php');
76 if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port))
78 if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password))
80 $_list = $oFtp->ftp_rawlist($this->pwd);
86 return new BaseObject(-1,
'msg_ftp_invalid_auth_info');
94 foreach($_list as $k => $v)
96 $src =
new stdClass();
100 if(strpos($v,
'd') === 0 || strpos($v,
'<DIR>')) $list[] = substr(strrchr($v,
' '),1) .
'/';
103 $this->
add(
'list', $list);
install module of the high class
convertEncoding($source_obj)