mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 23:03:25 +09:00
#18430274 : support SFTP
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6948 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
c4fe618378
commit
51e758fd39
7 changed files with 131 additions and 26 deletions
|
|
@ -2,17 +2,52 @@
|
|||
|
||||
class adminAdminModel extends admin
|
||||
{
|
||||
var $pwd;
|
||||
|
||||
function getSFTPList()
|
||||
{
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
$connection = ssh2_connect('localhost', $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);
|
||||
$list = array();
|
||||
while(($file = readdir($dh)) !== false) {
|
||||
if(is_dir($curpwd.$file))
|
||||
{
|
||||
$file .= "/";
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
$list[] = $file;
|
||||
}
|
||||
closedir($dh);
|
||||
$this->add('list', $list);
|
||||
}
|
||||
|
||||
function getAdminFTPList()
|
||||
{
|
||||
set_time_limit(5);
|
||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
$pwd = Context::get('pwd');
|
||||
$this->pwd = Context::get('pwd');
|
||||
|
||||
if($ftp_info->sftp == 'Y')
|
||||
{
|
||||
return $this->getSFTPList();
|
||||
}
|
||||
|
||||
$oFtp = new ftp();
|
||||
if($oFtp->ftp_connect('localhost', $ftp_info->ftp_port)){
|
||||
if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
||||
$_list = $oFtp->ftp_rawlist($pwd);
|
||||
$_list = $oFtp->ftp_rawlist($this->pwd);
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
}
|
||||
|
|
@ -21,7 +56,7 @@
|
|||
$oFtp = new ftp();
|
||||
if($oFtp->ftp_connect($_SERVER['SERVER_NAME'], $ftp_info->ftp_port)){
|
||||
if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
||||
$_list = $oFtp->ftp_rawlist($pwd);
|
||||
$_list = $oFtp->ftp_rawlist($this->pwd);
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -254,7 +254,7 @@
|
|||
function dispAdminConfig() {
|
||||
$db_info = Context::getDBInfo();
|
||||
|
||||
Context::set('sftp_support', function_exists(ftp_ssl_connect));
|
||||
Context::set('sftp_support', function_exists(ssh2_sftp));
|
||||
|
||||
Context::set('selected_lang', $db_info->lang_type);
|
||||
|
||||
|
|
@ -263,15 +263,25 @@
|
|||
Context::set('langs', Context::loadLangSupported());
|
||||
|
||||
Context::set('lang_selected', Context::loadLangSelected());
|
||||
|
||||
Context::set('ftp_info', Context::getFTPInfo());
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
Context::set('ftp_info', $ftp_info);
|
||||
|
||||
$site_args->site_srl = 0;
|
||||
$output = executeQuery('module.getSiteInfo', $site_args);
|
||||
Context::set('start_module', $output->data);
|
||||
|
||||
$pwd = Context::get('pwd');
|
||||
if(!$pwd) $pwd = '/';
|
||||
if(!$pwd) {
|
||||
if($ftp_info->sftp == 'Y')
|
||||
{
|
||||
$pwd = _XE_PATH_;
|
||||
}
|
||||
else
|
||||
{
|
||||
$pwd = '/';
|
||||
}
|
||||
}
|
||||
Context::set('pwd',$pwd);
|
||||
Context::set('layout','none');
|
||||
$this->setTemplateFile('config');
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@
|
|||
<td><input id="textfield22" type="password" name="ftp_password" value="{$ftp_info->ftp_password}" class="inputTypeText" /></td>
|
||||
<td><input id="textfield24" type="text" name="ftp_port" value="{$ftp_info->ftp_port}" class="inputTypeText" /></td>
|
||||
<!--@if($sftp_support)-->
|
||||
<td><input type="checkbox" id="checkbox25" name="sftp" value="Y" /></td>
|
||||
<td><input type="checkbox" id="checkbox25" name="sftp" value="Y" <!--@if($ftp_info->sftp=="Y")-->checked="checked"<!--@end--> /></td>
|
||||
<!--@end-->
|
||||
</tr>
|
||||
<tr>
|
||||
|
|
@ -163,6 +163,7 @@
|
|||
<input type="hidden" name="ftp_user" value="{$ftp_info->ftp_user}" />
|
||||
<input type="hidden" name="ftp_password" value="{$ftp_info->ftp_password}" />
|
||||
<input type="hidden" name="ftp_port" value="{$ftp_info->ftp_port}" />
|
||||
<input type="hidden" name="sftp" value="{$ftp_info->sftp}" />
|
||||
|
||||
<table cellspacing="0" class="rowTable">
|
||||
<tr>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue