mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
#18429537 : Using AJAX, make it working even if FTPport is wronly set to SFTP port
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@6938 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
f289e77261
commit
a2a57aeaa1
6 changed files with 67 additions and 40 deletions
38
modules/admin/admin.admin.model.php
Normal file
38
modules/admin/admin.admin.model.php
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<?php
|
||||
|
||||
class adminAdminModel extends admin
|
||||
{
|
||||
function getAdminFTPList()
|
||||
{
|
||||
set_time_limit(5);
|
||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
$pwd = Context::get('pwd');
|
||||
|
||||
$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);
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
}
|
||||
$list = array();
|
||||
if(count($_list) == 0 || !$_list[0]) {
|
||||
$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);
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($_list){
|
||||
foreach($_list as $k => $v){
|
||||
if(strpos($v,'d') === 0) $list[] = substr(strrchr($v,' '),1) . '/';
|
||||
}
|
||||
}
|
||||
$this->add('list', $list);
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -271,33 +271,6 @@
|
|||
$pwd = Context::get('pwd');
|
||||
if(!$pwd) $pwd = '/';
|
||||
Context::set('pwd',$pwd);
|
||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
$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);
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
}
|
||||
$list = array();
|
||||
if(count($_list) == 0 || !$_list[0]) {
|
||||
$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);
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
}
|
||||
}
|
||||
if($_list){
|
||||
foreach($_list as $k => $v){
|
||||
if(strpos($v,'d') === 0) $list[] = substr(strrchr($v,' '),1) . '/';
|
||||
}
|
||||
}
|
||||
|
||||
Context::set('list',$list);
|
||||
Context::set('layout','none');
|
||||
$this->setTemplateFile('config');
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,5 +8,6 @@
|
|||
|
||||
<action name="procAdminRecompileCacheFile" type="controller" standalone="true" />
|
||||
<action name="procAdminLogout" type="controller" standalone="true" />
|
||||
<action name="getAdminFTPList" type="model" standalone="true" />
|
||||
</actions>
|
||||
</module>
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@
|
|||
<!--%import("./filter/install_ftp_path.xml")-->
|
||||
<!--%import("../../install/lang")-->
|
||||
<!--%import("../../install/tpl/js/install_admin.js",optimized=false)-->
|
||||
<!--%import("./js/config.js")-->
|
||||
|
||||
<script type="text/javascript">
|
||||
function insertSelectedModule(id, module_srl, mid, browser_title) {
|
||||
|
|
@ -14,6 +15,12 @@
|
|||
sObj.value = module_srl;
|
||||
obj.value = browser_title+' ('+mid+')';
|
||||
}
|
||||
<!--@if($ftp_info && $ftp_info->ftp_password && $ftp_info->ftp_user)-->
|
||||
var pwd = '{$pwd}';
|
||||
params = new Array();
|
||||
params['pwd'] = pwd;
|
||||
exec_xml('admin','getAdminFTPList', params, completeGetFtpInfo, new Array('list','error','message'));
|
||||
<!--@end-->
|
||||
</script>
|
||||
|
||||
<div class="content">
|
||||
|
|
@ -120,7 +127,7 @@
|
|||
</table>
|
||||
</form>
|
||||
|
||||
<h4 class="xeAdmin">{$lang->ftp_form_title}</h4>
|
||||
<h4 class="xeAdmin" id="ftpSetup">{$lang->ftp_form_title}</h4>
|
||||
<p class="summary">{$lang->about_ftp_info}</p>
|
||||
<form action="./" method="post" onsubmit="return procFilter(this, install_ftp_info);" id="ftp_form">
|
||||
<table cellspacing="0" class="rowTable">
|
||||
|
|
@ -143,7 +150,7 @@
|
|||
</table>
|
||||
</form>
|
||||
<!--@if($ftp_info && $ftp_info->ftp_password && $ftp_info->ftp_user)-->
|
||||
<h4 class="xeAdmin" id="ftp_setup">{$lang->ftp_path_title}</h4>
|
||||
<h4 class="xeAdmin" id="ftpSetup">{$lang->ftp_path_title}</h4>
|
||||
<form action="./" method="get" onsubmit="return procFilter(this, install_ftp_path)">
|
||||
<input type="hidden" name="ftp_user" value="{$ftp_info->ftp_user}" />
|
||||
<input type="hidden" name="ftp_password" value="{$ftp_info->ftp_password}" />
|
||||
|
|
@ -161,17 +168,11 @@
|
|||
<input type="text" name="ftp_root_path" value="<!--@if($pwd && $pwd!='/')-->{$pwd}<!--@else-->{$ftp_info->ftp_root_path}<!--@end-->" class="inputTypeText w400" />
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr id="ftplist">
|
||||
<td>
|
||||
<!--@if($list)-->
|
||||
<ul>
|
||||
<!--@foreach($list as $k => $v)-->
|
||||
<!--@if($v)-->
|
||||
<li> <a href="{getUrl('pwd',$pwd.$v)}#ftp_setup">{$v}</a></li>
|
||||
<!--@end-->
|
||||
<!--@end-->
|
||||
</ul>
|
||||
<!--@end-->
|
||||
<div class="serverresponse">
|
||||
Waiting to load information
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="row2">
|
||||
|
|
|
|||
|
|
@ -200,4 +200,4 @@
|
|||
|
||||
.adminLeftContent { float:left; width:60%; margin-right:2%; _margin-right:1.9%;}
|
||||
.adminRightExtra { float:left; width:38%; }
|
||||
|
||||
.serverresponse { background: #FFFFFF url(../../../../common/tpl/images/loading.gif) no-repeat scroll 5px 5px; height:30px; padding-left:25px; padding-top:5px; }
|
||||
|
|
|
|||
14
modules/admin/tpl/js/config.js
Normal file
14
modules/admin/tpl/js/config.js
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
function completeGetFtpInfo(ret_obj)
|
||||
{
|
||||
|
||||
var e = jQuery("#ftplist").empty();
|
||||
var list = "";
|
||||
for(var i=0;i<ret_obj['list']['item'].length;i++)
|
||||
{
|
||||
var v = ret_obj['list']['item'][i];
|
||||
list = list + "<li><a href='"+current_url.setQuery('pwd',pwd+v)+"#ftpSetup'>"+v+"</a></li>";
|
||||
}
|
||||
list = "<td><ul>"+list+"</ul></td>";
|
||||
e.append(jQuery(list));
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue