mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
update trunk and tag 1.4.2.0
git-svn-id: http://xe-core.googlecode.com/svn/trunk@7470 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
55e72e3b47
commit
fae67f375d
70 changed files with 7400 additions and 507 deletions
85
modules/install/install.model.php
Normal file
85
modules/install/install.model.php
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
<?php
|
||||
|
||||
class installModel extends install {
|
||||
function init() {
|
||||
}
|
||||
var $pwd;
|
||||
|
||||
function getSFTPList()
|
||||
{
|
||||
$ftp_info = Context::getRequestVars();
|
||||
if(!$ftp_info->ftp_host)
|
||||
{
|
||||
$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))
|
||||
{
|
||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
|
||||
$sftp = ssh2_sftp($connection);
|
||||
$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;
|
||||
}
|
||||
closedir($dh);
|
||||
$this->add('list', $list);
|
||||
}
|
||||
|
||||
function getInstallFTPList()
|
||||
{
|
||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||
$ftp_info = Context::getRequestVars();
|
||||
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password)
|
||||
{
|
||||
return new Object(-1, 'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
$this->pwd = $ftp_info->ftp_root_path;
|
||||
if(!$ftp_info->ftp_host)
|
||||
{
|
||||
$ftp_info->ftp_host = "127.0.0.1";
|
||||
}
|
||||
|
||||
if($ftp_info->sftp == 'Y')
|
||||
{
|
||||
return $this->getSFTPList();
|
||||
}
|
||||
|
||||
$oFtp = new ftp();
|
||||
if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)){
|
||||
if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
||||
$_list = $oFtp->ftp_rawlist($this->pwd);
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
else
|
||||
{
|
||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||
}
|
||||
}
|
||||
$list = array();
|
||||
|
||||
if($_list){
|
||||
foreach($_list as $k => $v){
|
||||
$src = null;
|
||||
$src->data = $v;
|
||||
$res = Context::convertEncoding($src);
|
||||
$v = $res->data;
|
||||
if(strpos($v,'d') === 0 || strpos($v, '<DIR>')) $list[] = substr(strrchr($v,' '),1) . '/';
|
||||
}
|
||||
}
|
||||
$this->add('list', $list);
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue