mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
#18896651 : better handling for safemode=on case
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7466 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
78933e2e0d
commit
45dba7b1fd
15 changed files with 225 additions and 23 deletions
|
|
@ -200,17 +200,23 @@
|
||||||
static $oFtp = null;
|
static $oFtp = null;
|
||||||
|
|
||||||
// if safe_mode is on, use FTP
|
// if safe_mode is on, use FTP
|
||||||
if(ini_get('safe_mode') && $oFtp == null) {
|
if(ini_get('safe_mode')) {
|
||||||
if(!Context::isFTPRegisted()) return;
|
$ftp_info = Context::getFTPInfo();
|
||||||
|
if($oFtp == null) {
|
||||||
|
if(!Context::isFTPRegisted()) return;
|
||||||
|
|
||||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||||
$ftp_info = Context::getFTPInfo();
|
$oFtp = new ftp();
|
||||||
$oFtp = new ftp();
|
if(!$ftp_info->ftp_host) $ftp_info->ftp_host = "127.0.0.1";
|
||||||
if(!$oFtp->ftp_connect('localhost')) return;
|
if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
|
||||||
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return;
|
||||||
$oFtp->ftp_quit();
|
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
||||||
return;
|
$oFtp->ftp_quit();
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$ftp_path = $ftp_info->ftp_root_path;
|
||||||
|
if(!$ftp_path) $ftp_path = "/";
|
||||||
}
|
}
|
||||||
|
|
||||||
$path_string = str_replace(_XE_PATH_,'',$path_string);
|
$path_string = str_replace(_XE_PATH_,'',$path_string);
|
||||||
|
|
@ -220,10 +226,11 @@
|
||||||
for($i=0;$i<count($path_list);$i++) {
|
for($i=0;$i<count($path_list);$i++) {
|
||||||
if(!$path_list[$i]) continue;
|
if(!$path_list[$i]) continue;
|
||||||
$path .= $path_list[$i].'/';
|
$path .= $path_list[$i].'/';
|
||||||
|
$ftp_path .= $path_list[$i].'/';
|
||||||
if(!is_dir($path)) {
|
if(!is_dir($path)) {
|
||||||
if(ini_get('safe_mode')) {
|
if(ini_get('safe_mode')) {
|
||||||
$oFtp->ftp_mkdir($path);
|
$oFtp->ftp_mkdir($ftp_path);
|
||||||
$oFtp->ftp_site("CHMOD 777 ".$path);
|
$oFtp->ftp_site("CHMOD 777 ".$ftp_path);
|
||||||
} else {
|
} else {
|
||||||
@mkdir($path, 0755);
|
@mkdir($path, 0755);
|
||||||
@chmod($path, 0755);
|
@chmod($path, 0755);
|
||||||
|
|
|
||||||
|
|
@ -17,5 +17,6 @@
|
||||||
<action name="procInstallAdminSaveLangSelected" type="controller" standalone="true" />
|
<action name="procInstallAdminSaveLangSelected" type="controller" standalone="true" />
|
||||||
<action name="procInstallAdminSaveFTPInfo" type="controller" standalone="true" />
|
<action name="procInstallAdminSaveFTPInfo" type="controller" standalone="true" />
|
||||||
<action name="procInstallAdminRemoveFTPInfo" type="controller" standalone="true" />
|
<action name="procInstallAdminRemoveFTPInfo" type="controller" standalone="true" />
|
||||||
|
<action name="getInstallFTPList" type="model" standalone="true" />
|
||||||
</actions>
|
</actions>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
||||||
|
|
@ -74,9 +74,11 @@
|
||||||
**/
|
**/
|
||||||
function procInstallFTP() {
|
function procInstallFTP() {
|
||||||
if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
|
if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
|
||||||
$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port');
|
$ftp_info = Context::gets('ftp_host', 'ftp_user','ftp_password','ftp_port','ftp_root_path');
|
||||||
$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
|
$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
|
||||||
if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
|
if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
|
||||||
|
if(!$ftp_info->ftp_host) $ftp_info->ftp_host = '127.0.0.1';
|
||||||
|
if(!$ftp_info->ftp_root_path) $ftp_info->ftp_root_path = '/';
|
||||||
|
|
||||||
$buff = '<?php if(!defined("__ZBXE__")) exit();'."\n";
|
$buff = '<?php if(!defined("__ZBXE__")) exit();'."\n";
|
||||||
foreach($ftp_info as $key => $val) {
|
foreach($ftp_info as $key => $val) {
|
||||||
|
|
@ -90,29 +92,29 @@
|
||||||
|
|
||||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||||
$oFtp = new ftp();
|
$oFtp = new ftp();
|
||||||
if(!$oFtp->ftp_connect('localhost', $ftp_info->ftp_port)) return new Object(-1,'msg_ftp_not_connected');
|
if(!$oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)) return new Object(-1,'msg_ftp_not_connected');
|
||||||
|
|
||||||
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
||||||
$oFtp->ftp_quit();
|
$oFtp->ftp_quit();
|
||||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir(_XE_PATH_.'files')) {
|
if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files')) {
|
||||||
$oFtp->ftp_quit();
|
$oFtp->ftp_quit();
|
||||||
return new Object(-1,'msg_ftp_mkdir_fail');
|
return new Object(-1,'msg_ftp_mkdir_fail');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$oFtp->ftp_site("CHMOD 777 "._XE_PATH_.'files')) {
|
if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files')) {
|
||||||
$oFtp->ftp_quit();
|
$oFtp->ftp_quit();
|
||||||
return new Object(-1,'msg_ftp_chmod_fail');
|
return new Object(-1,'msg_ftp_chmod_fail');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir(_XE_PATH_.'files/config')) {
|
if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir($ftp_info->ftp_root_path.'files/config')) {
|
||||||
$oFtp->ftp_quit();
|
$oFtp->ftp_quit();
|
||||||
return new Object(-1,'msg_ftp_mkdir_fail');
|
return new Object(-1,'msg_ftp_mkdir_fail');
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!$oFtp->ftp_site("CHMOD 777 "._XE_PATH_.'files/config')) {
|
if(!$oFtp->ftp_site("CHMOD 777 ".$ftp_info->ftp_root_path.'files/config')) {
|
||||||
$oFtp->ftp_quit();
|
$oFtp->ftp_quit();
|
||||||
return new Object(-1,'msg_ftp_chmod_fail');
|
return new Object(-1,'msg_ftp_chmod_fail');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
@ -548,4 +548,6 @@ EndOfLicense;
|
||||||
$lang->msg_table_is_exists = "Table is already created in the DB.\nConfig file is recreated";
|
$lang->msg_table_is_exists = "Table is already created in the DB.\nConfig file is recreated";
|
||||||
$lang->msg_install_completed = "Installation has been completed.\nThank you for choosing XE";
|
$lang->msg_install_completed = "Installation has been completed.\nThank you for choosing XE";
|
||||||
$lang->msg_install_failed = "An error has occurred while creating installation file.";
|
$lang->msg_install_failed = "An error has occurred while creating installation file.";
|
||||||
|
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -547,4 +547,6 @@ EndOfLicense;
|
||||||
$lang->msg_table_is_exists = "La tabla ya ha sido creado en BD.\n Creado nuevamente el archivo de configuración.";
|
$lang->msg_table_is_exists = "La tabla ya ha sido creado en BD.\n Creado nuevamente el archivo de configuración.";
|
||||||
$lang->msg_install_completed = "Instalación finalizada.\n Muchas gracias.";
|
$lang->msg_install_completed = "Instalación finalizada.\n Muchas gracias.";
|
||||||
$lang->msg_install_failed = "Ha ocurrido un error al crear el archivo de instalación.";
|
$lang->msg_install_failed = "Ha ocurrido un error al crear el archivo de instalación.";
|
||||||
|
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -551,4 +551,6 @@ EndOfLicense;
|
||||||
$lang->msg_table_is_exists = "La Table est déjà créée dans la Base de Données.\nLe fichier de Configuration est recréé.";
|
$lang->msg_table_is_exists = "La Table est déjà créée dans la Base de Données.\nLe fichier de Configuration est recréé.";
|
||||||
$lang->msg_install_completed = "Installation a complété.\nMerci pour choisir XE";
|
$lang->msg_install_completed = "Installation a complété.\nMerci pour choisir XE";
|
||||||
$lang->msg_install_failed = "Une erreur a lieu en créant le fichier d\'installation.";
|
$lang->msg_install_failed = "Une erreur a lieu en créant le fichier d\'installation.";
|
||||||
|
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -548,4 +548,6 @@ EndOfLicense;
|
||||||
$lang->msg_table_is_exists = "既にデータベースにデーブルが作成されています。\nconfigファイルを再作成しました。";
|
$lang->msg_table_is_exists = "既にデータベースにデーブルが作成されています。\nconfigファイルを再作成しました。";
|
||||||
$lang->msg_install_completed = "インストールが完了しました。\nありがとうございます。";
|
$lang->msg_install_completed = "インストールが完了しました。\nありがとうございます。";
|
||||||
$lang->msg_install_failed = 'インストールファイルを作成する際にエラーが発生しました。';
|
$lang->msg_install_failed = 'インストールファイルを作成する際にエラーが発生しました。';
|
||||||
|
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -550,4 +550,6 @@ EndOfLicense;
|
||||||
$lang->msg_table_is_exists = "이미 DB에 테이블이 생성되어 있습니다.\nconfig파일을 재생성하였습니다.";
|
$lang->msg_table_is_exists = "이미 DB에 테이블이 생성되어 있습니다.\nconfig파일을 재생성하였습니다.";
|
||||||
$lang->msg_install_completed = "설치가 완료되었습니다.\n감사합니다.";
|
$lang->msg_install_completed = "설치가 완료되었습니다.\n감사합니다.";
|
||||||
$lang->msg_install_failed = '설치 파일 생성 시에 오류가 발생하였습니다.';
|
$lang->msg_install_failed = '설치 파일 생성 시에 오류가 발생하였습니다.';
|
||||||
|
|
||||||
|
$lang->ftp_get_list = '목록 가져오기';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -550,4 +550,6 @@ EndOfLicense;
|
||||||
$lang->msg_table_is_exists = "Таблица существует в базе данных.\nФайл конфигурации создан заново";
|
$lang->msg_table_is_exists = "Таблица существует в базе данных.\nФайл конфигурации создан заново";
|
||||||
$lang->msg_install_completed = "Установка завершена.\nСпасибо Вам за выбор XE";
|
$lang->msg_install_completed = "Установка завершена.\nСпасибо Вам за выбор XE";
|
||||||
$lang->msg_install_failed = "Произошла ошибка при создании файла конфигурации.";
|
$lang->msg_install_failed = "Произошла ошибка при создании файла конфигурации.";
|
||||||
|
|
||||||
|
$lang->ftp_get_list = 'Get List';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -551,4 +551,6 @@ EndOfLicense;
|
||||||
$lang->msg_table_is_exists = "Table đã có sẵn trên Database.\nFile Config đã đuwọc thiết lập lại.";
|
$lang->msg_table_is_exists = "Table đã có sẵn trên Database.\nFile Config đã đuwọc thiết lập lại.";
|
||||||
$lang->msg_install_completed = "Đã cài đặt thành công!.\nXin cảm ơn đã sử dụng XE!";
|
$lang->msg_install_completed = "Đã cài đặt thành công!.\nXin cảm ơn đã sử dụng XE!";
|
||||||
$lang->msg_install_failed = "Đã có lỗi xảy ra khi tạo File cài đặt.";
|
$lang->msg_install_failed = "Đã có lỗi xảy ra khi tạo File cài đặt.";
|
||||||
|
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -546,4 +546,6 @@ EndOfLicense;
|
||||||
$lang->msg_table_is_exists = "已生成数据表。\n重新生成了config文件。";
|
$lang->msg_table_is_exists = "已生成数据表。\n重新生成了config文件。";
|
||||||
$lang->msg_install_completed = "安装完成。\n非常感谢。";
|
$lang->msg_install_completed = "安装完成。\n非常感谢。";
|
||||||
$lang->msg_install_failed = "生成安装文件时发生错误。";
|
$lang->msg_install_failed = "生成安装文件时发生错误。";
|
||||||
|
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -549,4 +549,6 @@ EndOfLicense;
|
||||||
$lang->msg_table_is_exists = "已建立資料表。\n重新建立 config 檔案。";
|
$lang->msg_table_is_exists = "已建立資料表。\n重新建立 config 檔案。";
|
||||||
$lang->msg_install_completed = "安裝完成。\n非常感謝。";
|
$lang->msg_install_completed = "安裝完成。\n非常感謝。";
|
||||||
$lang->msg_install_failed = "建立安裝檔案時,發生錯誤。";
|
$lang->msg_install_failed = "建立安裝檔案時,發生錯誤。";
|
||||||
|
|
||||||
|
$lang->ftp_get_list = "取得列表";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
|
|
||||||
<h2 class="xeAdmin">{$lang->ftp_form_title}</h2>
|
<h2 class="xeAdmin">{$lang->ftp_form_title}</h2>
|
||||||
|
|
||||||
<blockquote>{$lang->about_ftp_info}</blockquote>
|
<blockquote>{$lang->msg_safe_mode_ftp_needed}</blockquote>
|
||||||
|
|
||||||
<table cellspacing="0" class="tableType7">
|
<table cellspacing="0" class="tableType7">
|
||||||
<col width="100" />
|
<col width="100" />
|
||||||
|
|
@ -14,17 +14,34 @@
|
||||||
|
|
||||||
<!-- FTP 정보 -->
|
<!-- FTP 정보 -->
|
||||||
<tr>
|
<tr>
|
||||||
<th rowspan="3" scope="row" class="hr"><label for="radio2">{$lang->ftp}</label></th>
|
<th rowspan="6" scope="row" class="hr"><label for="radio2">{$lang->ftp}</label></th>
|
||||||
|
<th class="second" scope="row"><label for="textfield20">{$lang->ftp_host}</label></th>
|
||||||
|
<td><input type="text" id="textfield20" name="ftp_host" value="127.0.0.1" class="inputTypeText" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
<th class="second" scope="row"><label for="textfield21">{$lang->user_id}</label></th>
|
<th class="second" scope="row"><label for="textfield21">{$lang->user_id}</label></th>
|
||||||
<td><input type="text" id="textfield21" name="ftp_user" value="" class="inputTypeText" /></td>
|
<td><input type="text" id="textfield21" name="ftp_user" value="" class="inputTypeText" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="second" scope="row"><label for="textfield22">{$lang->password}</label></th>
|
<th class="second" scope="row"><label for="textfield22">{$lang->password}</label></th>
|
||||||
<td><input id="textfield22" type="password" name="ftp_password" class="inputTypeText" /></td>
|
<td><input id="textfield22" type="password" name="ftp_password" class="inputTypeText" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="second hr" scope="row"><label for="textfield24">{$lang->ftp_port}</label></th>
|
<th class="second" scope="row"><label for="textfield24">{$lang->ftp_port}</label></th>
|
||||||
<td class="hr"><input id="textfield24" type="text" name="ftp_port" value="21" class="inputTypeText" /></td>
|
<td><input id="textfield24" type="text" name="ftp_port" value="21" class="inputTypeText" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th class="second hr" scope="row" rowspan="2"><div>{$lang->msg_ftp_installed_ftp_realpath}<br /><br/>{$lang->msg_ftp_installed_realpath}:<br/> {_XE_PATH_}</div></th>
|
||||||
|
<td>
|
||||||
|
<input type="text" name="ftp_root_path" value="{$ftp_info->ftp_root_path}" class="inputTypeText w400" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr id="ftplist">
|
||||||
|
<td class="hr">
|
||||||
|
<div>
|
||||||
|
<span class="button blue strong"><input type="button" onclick="getFTPList(); return false;" value="{$lang->ftp_get_list}"></span>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -36,3 +36,75 @@ function completeInstallCheckFtpInfo(ret_obj) {
|
||||||
function completeFtpPath(ret_obj){
|
function completeFtpPath(ret_obj){
|
||||||
location.reload();
|
location.reload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFTPList(pwd)
|
||||||
|
{
|
||||||
|
var form = jQuery("#ftp_form").get(0);
|
||||||
|
if(typeof(pwd) != 'undefined')
|
||||||
|
{
|
||||||
|
form.ftp_root_path.value = pwd;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if(!form.ftp_root_path.value)
|
||||||
|
{
|
||||||
|
if(typeof(form.sftp) != 'undefined' && form.sftp.checked) {
|
||||||
|
form.ftp_root_path.value = xe_root;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
form.ftp_root_path.value = "/";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var params={}, data=jQuery("#ftp_form").serializeArray();
|
||||||
|
jQuery.each(data, function(i, field){ params[field.name] = field.value });
|
||||||
|
exec_xml('install', 'getInstallFTPList', params, completeGetFtpInfo, ['list', 'error', 'message'], params, form);
|
||||||
|
}
|
||||||
|
|
||||||
|
function completeGetFtpInfo(ret_obj)
|
||||||
|
{
|
||||||
|
if(ret_obj['error'] != 0)
|
||||||
|
{
|
||||||
|
alert(ret_obj['error']);
|
||||||
|
alert(ret_obj['message']);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
var e = jQuery("#ftplist").empty();
|
||||||
|
var list = "";
|
||||||
|
if(!jQuery.isArray(ret_obj['list']['item']))
|
||||||
|
{
|
||||||
|
ret_obj['list']['item'] = [ret_obj['list']['item']];
|
||||||
|
}
|
||||||
|
|
||||||
|
pwd = jQuery("#ftp_form").get(0).ftp_root_path.value;
|
||||||
|
if(pwd != "/")
|
||||||
|
{
|
||||||
|
arr = pwd.split("/");
|
||||||
|
arr.pop();
|
||||||
|
arr.pop();
|
||||||
|
arr.push("");
|
||||||
|
target = arr.join("/");
|
||||||
|
list = list + "<li><a href='#ftpSetup' onclick=\"getFTPList('"+target+"')\">../</a></li>";
|
||||||
|
}
|
||||||
|
|
||||||
|
for(var i=0;i<ret_obj['list']['item'].length;i++)
|
||||||
|
{
|
||||||
|
var v = ret_obj['list']['item'][i];
|
||||||
|
if(v == "../")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else if( v == "./")
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
list = list + "<li><a href='#ftpSetup' onclick=\"getFTPList('"+pwd+v+"')\">"+v+"</a></li>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
list = "<td><ul>"+list+"</ul></td>";
|
||||||
|
e.append(jQuery(list));
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue