mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
NOISSUE code rearrange on install.model.php
This commit is contained in:
parent
46e8b01f94
commit
714af7cbeb
1 changed files with 10 additions and 16 deletions
|
|
@ -11,6 +11,7 @@ class installModel extends install
|
|||
{
|
||||
$ftp_info->ftp_host = "127.0.0.1";
|
||||
}
|
||||
|
||||
$connection = ssh2_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
|
||||
if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
|
||||
{
|
||||
|
|
@ -21,18 +22,12 @@ class installModel extends install
|
|||
$curpwd = "ssh2.sftp://$sftp".$this->pwd;
|
||||
$dh = @opendir($curpwd);
|
||||
if(!$dh) return new Object(-1, 'msg_ftp_invalid_path');
|
||||
|
||||
$list = array();
|
||||
while(($file = readdir($dh)) !== false)
|
||||
{
|
||||
if(is_dir($curpwd.$file))
|
||||
{
|
||||
$file .= "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$list[] = $file;
|
||||
if(!is_dir($curpwd.$file)) continue;
|
||||
$list[] = $file . "/";
|
||||
}
|
||||
closedir($dh);
|
||||
$this->add('list', $list);
|
||||
|
|
@ -40,8 +35,7 @@ class installModel extends install
|
|||
|
||||
function getInstallFTPList()
|
||||
{
|
||||
$ftp_info = Context::getRequestVars();
|
||||
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
|
||||
if(!($ftp_info = Context::getRequestVars()) || !$ftp_info->ftp_user || !$ftp_info->ftp_password)
|
||||
{
|
||||
return new Object(-1, 'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
|
|
@ -56,12 +50,12 @@ class installModel extends install
|
|||
return $this->getSFTPList();
|
||||
}
|
||||
|
||||
if(function_exists(ftp_connect))
|
||||
$_list = NULL;
|
||||
if(function_exists('ftp_connect'))
|
||||
{
|
||||
$connection = ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port);
|
||||
if(!$connection) return new Object(-1, sprintf(Context::getLang('msg_ftp_not_connected'), $ftp_info->ftp_host));
|
||||
$login_result = @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password);
|
||||
if(!$login_result)
|
||||
if(! @ftp_login($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
|
||||
{
|
||||
ftp_close($connection);
|
||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
|
|
@ -93,13 +87,13 @@ class installModel extends install
|
|||
}
|
||||
}
|
||||
}
|
||||
$list = array();
|
||||
|
||||
$list = array();
|
||||
if($_list)
|
||||
{
|
||||
foreach($_list as $k => $v)
|
||||
{
|
||||
$src = null;
|
||||
$src = new stdClass();
|
||||
$src->data = $v;
|
||||
$res = Context::convertEncoding($src);
|
||||
$v = $res->data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue