mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-10 20:44:28 +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');
|
$pwd = Context::get('pwd');
|
||||||
if(!$pwd) $pwd = '/';
|
if(!$pwd) $pwd = '/';
|
||||||
Context::set('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');
|
Context::set('layout','none');
|
||||||
$this->setTemplateFile('config');
|
$this->setTemplateFile('config');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,5 +8,6 @@
|
||||||
|
|
||||||
<action name="procAdminRecompileCacheFile" type="controller" standalone="true" />
|
<action name="procAdminRecompileCacheFile" type="controller" standalone="true" />
|
||||||
<action name="procAdminLogout" type="controller" standalone="true" />
|
<action name="procAdminLogout" type="controller" standalone="true" />
|
||||||
|
<action name="getAdminFTPList" type="model" standalone="true" />
|
||||||
</actions>
|
</actions>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
<!--%import("./filter/install_ftp_path.xml")-->
|
<!--%import("./filter/install_ftp_path.xml")-->
|
||||||
<!--%import("../../install/lang")-->
|
<!--%import("../../install/lang")-->
|
||||||
<!--%import("../../install/tpl/js/install_admin.js",optimized=false)-->
|
<!--%import("../../install/tpl/js/install_admin.js",optimized=false)-->
|
||||||
|
<!--%import("./js/config.js")-->
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function insertSelectedModule(id, module_srl, mid, browser_title) {
|
function insertSelectedModule(id, module_srl, mid, browser_title) {
|
||||||
|
|
@ -14,6 +15,12 @@
|
||||||
sObj.value = module_srl;
|
sObj.value = module_srl;
|
||||||
obj.value = browser_title+' ('+mid+')';
|
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>
|
</script>
|
||||||
|
|
||||||
<div class="content">
|
<div class="content">
|
||||||
|
|
@ -120,7 +127,7 @@
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</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>
|
<p class="summary">{$lang->about_ftp_info}</p>
|
||||||
<form action="./" method="post" onsubmit="return procFilter(this, install_ftp_info);" id="ftp_form">
|
<form action="./" method="post" onsubmit="return procFilter(this, install_ftp_info);" id="ftp_form">
|
||||||
<table cellspacing="0" class="rowTable">
|
<table cellspacing="0" class="rowTable">
|
||||||
|
|
@ -143,7 +150,7 @@
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
<!--@if($ftp_info && $ftp_info->ftp_password && $ftp_info->ftp_user)-->
|
<!--@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)">
|
<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_user" value="{$ftp_info->ftp_user}" />
|
||||||
<input type="hidden" name="ftp_password" value="{$ftp_info->ftp_password}" />
|
<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" />
|
<input type="text" name="ftp_root_path" value="<!--@if($pwd && $pwd!='/')-->{$pwd}<!--@else-->{$ftp_info->ftp_root_path}<!--@end-->" class="inputTypeText w400" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr id="ftplist">
|
||||||
<td>
|
<td>
|
||||||
<!--@if($list)-->
|
<div class="serverresponse">
|
||||||
<ul>
|
Waiting to load information
|
||||||
<!--@foreach($list as $k => $v)-->
|
</div>
|
||||||
<!--@if($v)-->
|
|
||||||
<li> <a href="{getUrl('pwd',$pwd.$v)}#ftp_setup">{$v}</a></li>
|
|
||||||
<!--@end-->
|
|
||||||
<!--@end-->
|
|
||||||
</ul>
|
|
||||||
<!--@end-->
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="row2">
|
<tr class="row2">
|
||||||
|
|
|
||||||
|
|
@ -200,4 +200,4 @@
|
||||||
|
|
||||||
.adminLeftContent { float:left; width:60%; margin-right:2%; _margin-right:1.9%;}
|
.adminLeftContent { float:left; width:60%; margin-right:2%; _margin-right:1.9%;}
|
||||||
.adminRightExtra { float:left; width:38%; }
|
.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