mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-08 03:01:43 +09:00
#18532365 : remove storing ftp_password.
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7156 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
ddfa2f6df1
commit
c43d52da74
27 changed files with 373 additions and 291 deletions
|
|
@ -6,8 +6,12 @@
|
||||||
|
|
||||||
function getSFTPList()
|
function getSFTPList()
|
||||||
{
|
{
|
||||||
$ftp_info = Context::getFTPInfo();
|
$ftp_info = Context::getRequestVars();
|
||||||
$connection = ssh2_connect('localhost', $ftp_info->ftp_port);
|
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))
|
if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $ftp_info->ftp_password))
|
||||||
{
|
{
|
||||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||||
|
|
@ -36,8 +40,16 @@
|
||||||
{
|
{
|
||||||
set_time_limit(5);
|
set_time_limit(5);
|
||||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||||
$ftp_info = Context::getFTPInfo();
|
$ftp_info = Context::getRequestVars();
|
||||||
$this->pwd = Context::get('pwd');
|
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')
|
if($ftp_info->sftp == 'Y')
|
||||||
{
|
{
|
||||||
|
|
@ -45,7 +57,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$oFtp = new ftp();
|
$oFtp = new ftp();
|
||||||
if($oFtp->ftp_connect('localhost', $ftp_info->ftp_port)){
|
if($oFtp->ftp_connect($ftp_info->ftp_host, $ftp_info->ftp_port)){
|
||||||
if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
if($oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
||||||
$_list = $oFtp->ftp_rawlist($this->pwd);
|
$_list = $oFtp->ftp_rawlist($this->pwd);
|
||||||
$oFtp->ftp_quit();
|
$oFtp->ftp_quit();
|
||||||
|
|
@ -56,19 +68,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$list = array();
|
$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($this->pwd);
|
|
||||||
$oFtp->ftp_quit();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if($_list){
|
if($_list){
|
||||||
foreach($_list as $k => $v){
|
foreach($_list as $k => $v){
|
||||||
|
|
|
||||||
|
|
@ -276,22 +276,6 @@
|
||||||
$output = executeQuery('module.getSiteInfo', $site_args);
|
$output = executeQuery('module.getSiteInfo', $site_args);
|
||||||
Context::set('start_module', $output->data);
|
Context::set('start_module', $output->data);
|
||||||
|
|
||||||
$pwd = Context::get('pwd');
|
|
||||||
if(!$pwd && $ftp_info->ftp_root_path)
|
|
||||||
{
|
|
||||||
$pwd = $ftp_info->ftp_root_path;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(!$pwd) {
|
|
||||||
if($ftp_info->sftp == 'Y')
|
|
||||||
{
|
|
||||||
$pwd = _XE_PATH_;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$pwd = '/';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Context::set('pwd',$pwd);
|
Context::set('pwd',$pwd);
|
||||||
Context::set('layout','none');
|
Context::set('layout','none');
|
||||||
$this->setTemplateFile('config');
|
$this->setTemplateFile('config');
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,6 @@
|
||||||
$lang->use_db_session = 'Use Session DB';
|
$lang->use_db_session = 'Use Session DB';
|
||||||
$lang->about_db_session = 'It will use php session with DB when authenticating.<br/>Websites with infrequent usage of web server may expect faster response when this function is disabled.<br/>However session DB will make it unable to get current users, so you cannot use related functions.';
|
$lang->about_db_session = 'It will use php session with DB when authenticating.<br/>Websites with infrequent usage of web server may expect faster response when this function is disabled.<br/>However session DB will make it unable to get current users, so you cannot use related functions.';
|
||||||
$lang->sftp = "Use SFTP";
|
$lang->sftp = "Use SFTP";
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
|
$lang->ftp_remove_info = 'Remove FTP Info.';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -81,4 +81,6 @@
|
||||||
$lang->use_db_session = '인증 세션 DB 사용';
|
$lang->use_db_session = '인증 세션 DB 사용';
|
||||||
$lang->about_db_session = '인증시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.<br/>웹서버의 사용율이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다<br/>단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
|
$lang->about_db_session = '인증시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.<br/>웹서버의 사용율이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다<br/>단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
|
||||||
$lang->sftp = "Use SFTP";
|
$lang->sftp = "Use SFTP";
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
|
$lang->ftp_remove_info = 'Remove FTP Info.';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,6 @@
|
||||||
$lang->use_db_session = '인증 세션 DB 사용';
|
$lang->use_db_session = '인증 세션 DB 사용';
|
||||||
$lang->about_db_session = '인증시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.<br/>웹서버의 사용율이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다<br/>단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
|
$lang->about_db_session = '인증시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.<br/>웹서버의 사용율이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다<br/>단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
|
||||||
$lang->sftp = "Use SFTP";
|
$lang->sftp = "Use SFTP";
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
|
$lang->ftp_remove_info = 'Remove FTP Info.';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,6 @@
|
||||||
$lang->use_db_session = 'DBで認証セッション管理';
|
$lang->use_db_session = 'DBで認証セッション管理';
|
||||||
$lang->about_db_session = '認証の時に使われるPHPセッションをDBで使う機能です。<br />ウェブサーバーの負荷が低いサイトではこの機能をオフにすることでむしろサイトのレスポンスが向上されることもあります。<br />また、この機能をオンにすると、「現在ログイン中の会員」の機能が不可になります。';
|
$lang->about_db_session = '認証の時に使われるPHPセッションをDBで使う機能です。<br />ウェブサーバーの負荷が低いサイトではこの機能をオフにすることでむしろサイトのレスポンスが向上されることもあります。<br />また、この機能をオンにすると、「現在ログイン中の会員」の機能が不可になります。';
|
||||||
$lang->sftp = "Use SFTP";
|
$lang->sftp = "Use SFTP";
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
|
$lang->ftp_remove_info = 'Remove FTP Info.';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,6 @@
|
||||||
$lang->use_db_session = '인증 세션 DB 사용';
|
$lang->use_db_session = '인증 세션 DB 사용';
|
||||||
$lang->about_db_session = '인증 시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.<br/>웹서버의 사용률이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다.<br/>단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
|
$lang->about_db_session = '인증 시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.<br/>웹서버의 사용률이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다.<br/>단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
|
||||||
$lang->sftp = 'SFTP 사용';
|
$lang->sftp = 'SFTP 사용';
|
||||||
|
$lang->ftp_get_list = '목록 가져오기';
|
||||||
|
$lang->ftp_remove_info = 'FTP 정보 삭제';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -80,4 +80,6 @@
|
||||||
$lang->use_db_session = '인증 세션 DB 사용';
|
$lang->use_db_session = '인증 세션 DB 사용';
|
||||||
$lang->about_db_session = '인증시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.<br/>웹서버의 사용율이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다<br/>단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
|
$lang->about_db_session = '인증시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.<br/>웹서버의 사용율이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다<br/>단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
|
||||||
$lang->sftp = "Use SFTP";
|
$lang->sftp = "Use SFTP";
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
|
$lang->ftp_remove_info = 'Remove FTP Info.';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -81,4 +81,6 @@
|
||||||
$lang->use_db_session = 'Xác nhận Database';
|
$lang->use_db_session = 'Xác nhận Database';
|
||||||
$lang->about_db_session = 'PHP sẽ xác nhận với Database. Có thể cải thiện được tốc độ của Website.';
|
$lang->about_db_session = 'PHP sẽ xác nhận với Database. Có thể cải thiện được tốc độ của Website.';
|
||||||
$lang->sftp = "Use SFTP";
|
$lang->sftp = "Use SFTP";
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
|
$lang->ftp_remove_info = 'Remove FTP Info.';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,6 @@
|
||||||
$lang->use_db_session = 'DB储存认证会话';
|
$lang->use_db_session = 'DB储存认证会话';
|
||||||
$lang->about_db_session = '用DB储存认证时的PHP会话。<br/>服务器使用率较少的网站建议不要勾选此项(可提高网站访问速度)。<br/>只是无法统计在线会员。';
|
$lang->about_db_session = '用DB储存认证时的PHP会话。<br/>服务器使用率较少的网站建议不要勾选此项(可提高网站访问速度)。<br/>只是无法统计在线会员。';
|
||||||
$lang->sftp = "Use SFTP";
|
$lang->sftp = "Use SFTP";
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
|
$lang->ftp_remove_info = 'Remove FTP Info.';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -79,4 +79,6 @@
|
||||||
$lang->use_db_session = 'DB session認證';
|
$lang->use_db_session = 'DB session認證';
|
||||||
$lang->about_db_session = '인증 시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.<br/>웹서버의 사용률이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다.<br/>단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
|
$lang->about_db_session = '인증 시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.<br/>웹서버의 사용률이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다.<br/>단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
|
||||||
$lang->sftp = "使用 SFTP";
|
$lang->sftp = "使用 SFTP";
|
||||||
|
$lang->ftp_get_list = "Get List";
|
||||||
|
$lang->ftp_remove_info = 'Remove FTP Info.';
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -15,12 +15,7 @@
|
||||||
sObj.value = module_srl;
|
sObj.value = module_srl;
|
||||||
obj.value = decodeURIComponent(browser_title.replace(/\+/g," "))+' ('+mid+')';
|
obj.value = decodeURIComponent(browser_title.replace(/\+/g," "))+' ('+mid+')';
|
||||||
}
|
}
|
||||||
<!--@if($ftp_info && $ftp_info->ftp_password && $ftp_info->ftp_user)-->
|
var xe_root = "{_XE_PATH_}";
|
||||||
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">
|
||||||
|
|
@ -127,67 +122,55 @@
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
|
||||||
<h4 class="xeAdmin" id="ftpSetup">{$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">
|
||||||
{@ $nCols = 3; }
|
|
||||||
<table cellspacing="0" class="rowTable">
|
<table cellspacing="0" class="rowTable">
|
||||||
<tr>
|
|
||||||
<th><div><label for="textfield21">{$lang->user_id}</label></div></th>
|
|
||||||
<th><div><label for="textfield22">{$lang->password}</label></div></th>
|
|
||||||
<th><div><label for="textfield24">{$lang->ftp_port}</label></div></th>
|
|
||||||
<!--@if($sftp_support)-->
|
|
||||||
{@ $nCols += 1; }
|
|
||||||
<th><div><label for="checkbox25">{$lang->sftp}</label></div></th>
|
|
||||||
<!--@end-->
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td><input type="text" id="textfield21" name="ftp_user" value="{$ftp_info->ftp_user}" class="inputTypeText" /></td>
|
|
||||||
<td><input id="textfield22" type="password" name="ftp_password" value="" 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" <!--@if($ftp_info->sftp=="Y")-->checked="checked"<!--@end--> /></td>
|
|
||||||
<!--@end-->
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th colspan="{$nCols}" class="button">
|
|
||||||
<span class="button blue"><input type="button" value="{$lang->cmd_check_ftp_connect}" onclick="doCheckFTPInfo(); return false;"/></span>
|
|
||||||
<span class="button black strong"><input type="submit" value="{$lang->cmd_registration}" /></span>
|
|
||||||
</th>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
</form>
|
|
||||||
<!--@if($ftp_info && $ftp_info->ftp_password && $ftp_info->ftp_user)-->
|
|
||||||
<h4 class="xeAdmin" id="ftpSetup">{$lang->ftp_path_title}</h4>
|
|
||||||
<form action="./" method="POST" onsubmit="return procFilter(this, install_ftp_path)">
|
|
||||||
|
|
||||||
<table cellspacing="0" class="rowTable">
|
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col"><div>{$lang->msg_ftp_installed_realpath}</div></th>
|
<th scope="col"><div><label for="textfield21">{$lang->user_id}</label></div></th>
|
||||||
<td>{_XE_PATH_}
|
<td><input type="text" id="textfield21" name="ftp_user" value="{$ftp_info->ftp_user}" class="inputTypeText" />
|
||||||
</td>
|
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" rowspan="2"><div>{$lang->msg_ftp_installed_ftp_realpath}</div></th>
|
<th scope="col"><div><label for="textfield22">{$lang->password} ({$lang->about_ftp_password})</label></div></th>
|
||||||
|
<td><input id="textfield22" type="password" name="ftp_password" value="" class="inputTypeText" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col"><div><label for="textfield23">{$lang->ftp_host} (default: 127.0.0.1)</label></div></th>
|
||||||
|
<td><input id="textfield23" type="text" name="ftp_host" value="{$ftp_info->ftp_host}" class="inputTypeText" /></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col"><div><label for="textfield24">{$lang->ftp_port} (default: 21) </label></div></th>
|
||||||
|
<td><input id="textfield24" type="text" name="ftp_port" value="{$ftp_info->ftp_port}" class="inputTypeText" /></td>
|
||||||
|
</tr>
|
||||||
|
<!--@if($sftp_support)-->
|
||||||
|
<tr>
|
||||||
|
<th scope="col"><div><label for="checkbox25">{$lang->sftp}</label></div></th>
|
||||||
|
<td><input type="checkbox" id="checkbox25" name="sftp" value="Y" <!--@if($ftp_info->sftp=="Y")-->checked="checked"<!--@end--> /></td>
|
||||||
|
</tr>
|
||||||
|
<!--@end-->
|
||||||
|
<tr>
|
||||||
|
<th scope="col" rowspan="2"><div>{$lang->msg_ftp_installed_ftp_realpath}<br /><br/>{$lang->msg_ftp_installed_realpath}:<br/> {_XE_PATH_}</div></th>
|
||||||
<td>
|
<td>
|
||||||
<input type="text" name="ftp_root_path" value="<!--@if($pwd)-->{$pwd}<!--@else-->{$ftp_info->ftp_root_path}<!--@end-->" class="inputTypeText w400" />
|
<input type="text" name="ftp_root_path" value="{$ftp_info->ftp_root_path}" class="inputTypeText w400" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr id="ftplist">
|
<tr id="ftplist">
|
||||||
<td>
|
<td>
|
||||||
<div class="serverresponse">
|
<div>
|
||||||
Waiting to load information
|
<span class="button blue strong"><input type="button" onclick="getFTPList(); return false;" value="{$lang->ftp_get_list}"></span>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="row2">
|
<tr>
|
||||||
<th colspan="2" class="button">
|
<th colspan="2" class="button">
|
||||||
|
<span class="button blue strong"><input type="button" onclick="removeFTPInfo(); return false;" value="{$lang->ftp_remove_info}"></span>
|
||||||
<span class="button black strong"><input type="submit" value="{$lang->cmd_registration}" /></span>
|
<span class="button black strong"><input type="submit" value="{$lang->cmd_registration}" /></span>
|
||||||
</th>
|
</th>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
<!--@end-->
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr />
|
<hr />
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<filter name="install_ftp_info" module="install" act="procInstallAdminSaveFTPInfo" >
|
<filter name="install_ftp_info" module="install" act="procInstallAdminSaveFTPInfo" >
|
||||||
<form>
|
<form>
|
||||||
<node target="ftp_user" required="true" />
|
<node target="ftp_user" required="true" />
|
||||||
<node target="ftp_password" required="true" />
|
|
||||||
<node target="ftp_port" required="true" />
|
<node target="ftp_port" required="true" />
|
||||||
|
<node target="ftp_root_path" required="true" />
|
||||||
<node target="sftp" />
|
<node target="sftp" />
|
||||||
</form>
|
</form>
|
||||||
<response callback_func="completeMessage">
|
<response callback_func="completeMessage">
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,42 @@
|
||||||
|
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('admin', 'getAdminFTPList', params, completeGetFtpInfo, ['list', 'error', 'message'], params, form);
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeFTPInfo()
|
||||||
|
{
|
||||||
|
var params = {};
|
||||||
|
exec_xml('install', 'procInstallAdminRemoveFTPInfo', params, filterAlertMessage, ['error', 'message'], params);
|
||||||
|
}
|
||||||
|
|
||||||
function completeGetFtpInfo(ret_obj)
|
function completeGetFtpInfo(ret_obj)
|
||||||
{
|
{
|
||||||
|
if(ret_obj['error'] != 0)
|
||||||
|
{
|
||||||
|
alert(ret_obj['error']);
|
||||||
|
alert(ret_obj['message']);
|
||||||
|
return;
|
||||||
|
}
|
||||||
var e = jQuery("#ftplist").empty();
|
var e = jQuery("#ftplist").empty();
|
||||||
var list = "";
|
var list = "";
|
||||||
if(!jQuery.isArray(ret_obj['list']['item']))
|
if(!jQuery.isArray(ret_obj['list']['item']))
|
||||||
|
|
@ -7,6 +44,7 @@ function completeGetFtpInfo(ret_obj)
|
||||||
ret_obj['list']['item'] = [ret_obj['list']['item']];
|
ret_obj['list']['item'] = [ret_obj['list']['item']];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pwd = jQuery("#ftp_form").get(0).ftp_root_path.value;
|
||||||
if(pwd != "/")
|
if(pwd != "/")
|
||||||
{
|
{
|
||||||
arr = pwd.split("/");
|
arr = pwd.split("/");
|
||||||
|
|
@ -14,7 +52,7 @@ function completeGetFtpInfo(ret_obj)
|
||||||
arr.pop();
|
arr.pop();
|
||||||
arr.push("");
|
arr.push("");
|
||||||
target = arr.join("/");
|
target = arr.join("/");
|
||||||
list = list + "<li><a href='"+current_url.setQuery('pwd',target)+"#ftpSetup'>../</a></li>";
|
list = list + "<li><a href='#ftpSetup' onclick=\"getFTPList('"+target+"')\">../</a></li>";
|
||||||
}
|
}
|
||||||
|
|
||||||
for(var i=0;i<ret_obj['list']['item'].length;i++)
|
for(var i=0;i<ret_obj['list']['item'].length;i++)
|
||||||
|
|
@ -30,10 +68,10 @@ function completeGetFtpInfo(ret_obj)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
list = list + "<li><a href='"+current_url.setQuery('pwd',pwd+v)+"#ftpSetup'>"+v+"</a></li>";
|
list = list + "<li><a href='#ftpSetup' onclick=\"getFTPList('"+pwd+v+"')\">"+v+"</a></li>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
list = "<td><ul>"+list+"</ul></td>";
|
list = "<td><ul>"+list+"</ul></td>";
|
||||||
e.append(jQuery(list));
|
e.append(jQuery(list));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,195 +5,7 @@
|
||||||
* @brief autoinstall 모듈의 admin controller class
|
* @brief autoinstall 모듈의 admin controller class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class ModuleInstaller {
|
require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php');
|
||||||
var $package = null;
|
|
||||||
var $base_url = 'http://download.xpressengine.com/';
|
|
||||||
var $temp_dir = './files/cache/autoinstall/';
|
|
||||||
var $target_path;
|
|
||||||
var $download_file;
|
|
||||||
var $url;
|
|
||||||
var $download_path;
|
|
||||||
|
|
||||||
function _download()
|
|
||||||
{
|
|
||||||
if($this->package->path == ".")
|
|
||||||
{
|
|
||||||
$this->download_file = $this->temp_dir."xe.tar";
|
|
||||||
$this->target_path = "";
|
|
||||||
$this->download_path = $this->temp_dir;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$subpath = substr($this->package->path,2);
|
|
||||||
$this->download_file = $this->temp_dir.$subpath.".tar";
|
|
||||||
$subpatharr = explode("/", $subpath);
|
|
||||||
array_pop($subpatharr);
|
|
||||||
$this->download_path = $this->temp_dir.implode("/", $subpatharr);
|
|
||||||
$this->target_path = implode("/", $subpatharr);
|
|
||||||
}
|
|
||||||
|
|
||||||
$postdata = array();
|
|
||||||
$postdata["path"] = $this->package->path;
|
|
||||||
$postdata["module"] = "resourceapi";
|
|
||||||
$postdata["act"] = "procResourceapiDownload";
|
|
||||||
$buff = FileHandler::getRemoteResource($this->base_url, null, 3, "POST", "application/x-www-form-urlencoded; charset=utf-8", array(), array(), $postdata);
|
|
||||||
FileHandler::writeFile($this->download_file, $buff);
|
|
||||||
}
|
|
||||||
|
|
||||||
function installModule()
|
|
||||||
{
|
|
||||||
$path_array = explode("/", $this->package->path);
|
|
||||||
$target_name = array_pop($path_array);
|
|
||||||
$type = substr(array_pop($path_array), 0, -1);
|
|
||||||
if($type == "module")
|
|
||||||
{
|
|
||||||
$oModuleModel = &getModel('module');
|
|
||||||
$oInstallController = &getController('install');
|
|
||||||
$module_path = ModuleHandler::getModulePath($target_name);
|
|
||||||
if($oModuleModel->checkNeedInstall($target_name))
|
|
||||||
{
|
|
||||||
$oInstallController->installModule($target_name, $module_path);
|
|
||||||
}
|
|
||||||
if($oModuleModel->checkNeedUpdate($target_name))
|
|
||||||
{
|
|
||||||
$oModule = &getModule($target_name, 'class');
|
|
||||||
if(method_exists($oModule, 'moduleUpdate'))
|
|
||||||
{
|
|
||||||
$oModule->moduleUpdate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function install()
|
|
||||||
{
|
|
||||||
$this->_download();
|
|
||||||
$file_list = $this->_unPack();
|
|
||||||
$this->_copyDir($file_list);
|
|
||||||
$this->installModule();
|
|
||||||
|
|
||||||
FileHandler::removeDir($this->temp_dir);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _unPack(){
|
|
||||||
require_once(_XE_PATH_.'libs/tar.class.php');
|
|
||||||
|
|
||||||
$oTar = new tar();
|
|
||||||
$oTar->openTAR($this->download_file);
|
|
||||||
|
|
||||||
$_files = $oTar->files;
|
|
||||||
$file_list = array();
|
|
||||||
foreach($_files as $key => $info) {
|
|
||||||
FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']);
|
|
||||||
$file_list[] = $info['name'];
|
|
||||||
}
|
|
||||||
return $file_list;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
class SFTPModuleInstaller extends ModuleInstaller {
|
|
||||||
function SFTPModuleInstaller(&$package)
|
|
||||||
{
|
|
||||||
$this->package =& $package;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _copyDir(&$file_list){
|
|
||||||
$ftp_info = Context::getFTPInfo();
|
|
||||||
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password || !$ftp_info->sftp || $ftp_info->sftp != 'Y') return new Object(-1,'msg_ftp_invalid_auth_info');
|
|
||||||
|
|
||||||
$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);
|
|
||||||
|
|
||||||
$target_dir = $ftp_info->ftp_root_path.$this->target_path;
|
|
||||||
|
|
||||||
foreach($file_list as $k => $file){
|
|
||||||
$org_file = $file;
|
|
||||||
if($this->package->path == ".")
|
|
||||||
{
|
|
||||||
$file = substr($file,3);
|
|
||||||
}
|
|
||||||
$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
|
|
||||||
$pathname = dirname($target_dir."/".$file);
|
|
||||||
|
|
||||||
if(!file_exists(FileHandler::getRealPath($real_path)))
|
|
||||||
{
|
|
||||||
ssh2_sftp_mkdir($sftp, $pathname, 0755, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
ssh2_scp_send($connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class FTPModuleInstaller extends ModuleInstaller {
|
|
||||||
function FTPModuleInstaller(&$package)
|
|
||||||
{
|
|
||||||
$this->package =& $package;
|
|
||||||
}
|
|
||||||
|
|
||||||
function _copyDir(&$file_list){
|
|
||||||
$ftp_info = Context::getFTPInfo();
|
|
||||||
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_ftp_invalid_auth_info');
|
|
||||||
|
|
||||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
|
||||||
|
|
||||||
$oFtp = new ftp();
|
|
||||||
if(!$oFtp->ftp_connect('localhost', $ftp_info->ftp_port)) return new Object(-1,'msg_ftp_not_connected');
|
|
||||||
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
|
||||||
$oFtp->ftp_quit();
|
|
||||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
|
||||||
}
|
|
||||||
|
|
||||||
$_list = $oFtp->ftp_rawlist($ftp_info->ftp_root_path);
|
|
||||||
if(count($_list) == 0 || !$_list[0]) {
|
|
||||||
$oFtp->ftp_quit();
|
|
||||||
$oFtp = new ftp();
|
|
||||||
if(!$oFtp->ftp_connect($_SERVER['SERVER_NAME'], $ftp_info->ftp_port)) return new Object(-1,'msg_ftp_not_connected');
|
|
||||||
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
|
||||||
$oFtp->ftp_quit();
|
|
||||||
return new Object(-1,'msg_ftp_invalid_auth_info');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$target_dir = $ftp_info->ftp_root_path.$this->target_path;
|
|
||||||
|
|
||||||
foreach($file_list as $k => $file){
|
|
||||||
$org_file = $file;
|
|
||||||
if($this->package->path == ".")
|
|
||||||
{
|
|
||||||
$file = substr($file,3);
|
|
||||||
}
|
|
||||||
$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
|
|
||||||
$path_list = explode('/', dirname($this->target_path."/".$file));
|
|
||||||
|
|
||||||
$real_path = "./";
|
|
||||||
$ftp_path = $ftp_info->ftp_root_path;
|
|
||||||
|
|
||||||
for($i=0;$i<count($path_list);$i++)
|
|
||||||
{
|
|
||||||
if($path_list=="") continue;
|
|
||||||
$real_path .= $path_list[$i]."/";
|
|
||||||
$ftp_path .= $path_list[$i]."/";
|
|
||||||
if(!file_exists(FileHandler::getRealPath($real_path)))
|
|
||||||
{
|
|
||||||
$oFtp->ftp_mkdir($ftp_path);
|
|
||||||
$oFtp->ftp_site("CHMOD 755 ".$path);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$oFtp->ftp_put($target_dir .'/'. $file, FileHandler::getRealPath($this->download_path."/".$org_file));
|
|
||||||
}
|
|
||||||
$oFtp->ftp_quit();
|
|
||||||
|
|
||||||
return new Object();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class autoinstallAdminController extends autoinstall {
|
class autoinstallAdminController extends autoinstall {
|
||||||
|
|
||||||
|
|
@ -303,18 +115,31 @@
|
||||||
$oModel =& getModel('autoinstall');
|
$oModel =& getModel('autoinstall');
|
||||||
$packages = explode(',', $package_srls);
|
$packages = explode(',', $package_srls);
|
||||||
$ftp_info = Context::getFTPInfo();
|
$ftp_info = Context::getFTPInfo();
|
||||||
|
if(!$_SESSION['ftp_password'])
|
||||||
|
{
|
||||||
|
$ftp_password = Context::get('ftp_password');
|
||||||
|
if($ftp_password) $_SESSION['ftp_password'] = $ftp_password;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ftp_password = $_SESSION['ftp_password'];
|
||||||
|
}
|
||||||
|
|
||||||
foreach($packages as $package_srl)
|
foreach($packages as $package_srl)
|
||||||
{
|
{
|
||||||
$package = $oModel->getPackage($package_srl);
|
$package = $oModel->getPackage($package_srl);
|
||||||
if($ftp_info->sftp && $ftp_info->sftp == 'Y')
|
if($ftp_info->sftp && $ftp_info->sftp == 'Y')
|
||||||
{
|
{
|
||||||
$oModuleInstaller = new SFTPModuleInstaller($package);
|
$oModuleInstaller = new SFTPModuleInstaller($package);
|
||||||
|
$oModuleInstaller->setPassword($ftp_password);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$oModuleInstaller = new FTPModuleInstaller($package);
|
$oModuleInstaller = new FTPModuleInstaller($package);
|
||||||
|
$oModuleInstaller->setPassword($ftp_password);
|
||||||
}
|
}
|
||||||
$oModuleInstaller->install();
|
$output = $oModuleInstaller->install();
|
||||||
|
if(!$output->toBool()) return $output;
|
||||||
}
|
}
|
||||||
$this->setMessage('success_installed');
|
$this->setMessage('success_installed');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,10 @@
|
||||||
|
|
||||||
Context::set("package", $package);
|
Context::set("package", $package);
|
||||||
}
|
}
|
||||||
|
if(!$_SESSION['ftp_password'])
|
||||||
|
{
|
||||||
|
Context::set('need_password', true);
|
||||||
|
}
|
||||||
$this->setTemplateFile('install');
|
$this->setTemplateFile('install');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
215
modules/autoinstall/autoinstall.lib.php
Normal file
215
modules/autoinstall/autoinstall.lib.php
Normal file
|
|
@ -0,0 +1,215 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
class ModuleInstaller {
|
||||||
|
var $package = null;
|
||||||
|
var $base_url = 'http://download.xpressengine.com/';
|
||||||
|
var $temp_dir = './files/cache/autoinstall/';
|
||||||
|
var $target_path;
|
||||||
|
var $download_file;
|
||||||
|
var $url;
|
||||||
|
var $download_path;
|
||||||
|
var $ftp_password;
|
||||||
|
|
||||||
|
function setPassword($ftp_password)
|
||||||
|
{
|
||||||
|
$this->ftp_password = $ftp_password;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _download()
|
||||||
|
{
|
||||||
|
if($this->package->path == ".")
|
||||||
|
{
|
||||||
|
$this->download_file = $this->temp_dir."xe.tar";
|
||||||
|
$this->target_path = "";
|
||||||
|
$this->download_path = $this->temp_dir;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$subpath = substr($this->package->path,2);
|
||||||
|
$this->download_file = $this->temp_dir.$subpath.".tar";
|
||||||
|
$subpatharr = explode("/", $subpath);
|
||||||
|
array_pop($subpatharr);
|
||||||
|
$this->download_path = $this->temp_dir.implode("/", $subpatharr);
|
||||||
|
$this->target_path = implode("/", $subpatharr);
|
||||||
|
}
|
||||||
|
|
||||||
|
$postdata = array();
|
||||||
|
$postdata["path"] = $this->package->path;
|
||||||
|
$postdata["module"] = "resourceapi";
|
||||||
|
$postdata["act"] = "procResourceapiDownload";
|
||||||
|
$buff = FileHandler::getRemoteResource($this->base_url, null, 3, "POST", "application/x-www-form-urlencoded; charset=utf-8", array(), array(), $postdata);
|
||||||
|
FileHandler::writeFile($this->download_file, $buff);
|
||||||
|
}
|
||||||
|
|
||||||
|
function installModule()
|
||||||
|
{
|
||||||
|
$path_array = explode("/", $this->package->path);
|
||||||
|
$target_name = array_pop($path_array);
|
||||||
|
$type = substr(array_pop($path_array), 0, -1);
|
||||||
|
if($type == "module")
|
||||||
|
{
|
||||||
|
$oModuleModel = &getModel('module');
|
||||||
|
$oInstallController = &getController('install');
|
||||||
|
$module_path = ModuleHandler::getModulePath($target_name);
|
||||||
|
if($oModuleModel->checkNeedInstall($target_name))
|
||||||
|
{
|
||||||
|
$oInstallController->installModule($target_name, $module_path);
|
||||||
|
}
|
||||||
|
if($oModuleModel->checkNeedUpdate($target_name))
|
||||||
|
{
|
||||||
|
$oModule = &getModule($target_name, 'class');
|
||||||
|
if(method_exists($oModule, 'moduleUpdate'))
|
||||||
|
{
|
||||||
|
$oModule->moduleUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function install()
|
||||||
|
{
|
||||||
|
$this->_download();
|
||||||
|
$file_list = $this->_unPack();
|
||||||
|
$output = $this->_copyDir($file_list);
|
||||||
|
if(!$output->toBool())
|
||||||
|
{
|
||||||
|
FileHandler::removeDir($this->temp_dir);
|
||||||
|
return $output;
|
||||||
|
}
|
||||||
|
$this->installModule();
|
||||||
|
|
||||||
|
FileHandler::removeDir($this->temp_dir);
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
|
||||||
|
function _unPack(){
|
||||||
|
require_once(_XE_PATH_.'libs/tar.class.php');
|
||||||
|
|
||||||
|
$oTar = new tar();
|
||||||
|
$oTar->openTAR($this->download_file);
|
||||||
|
|
||||||
|
$_files = $oTar->files;
|
||||||
|
$file_list = array();
|
||||||
|
foreach($_files as $key => $info) {
|
||||||
|
FileHandler::writeFile($this->download_path."/".$info['name'], $info['file']);
|
||||||
|
$file_list[] = $info['name'];
|
||||||
|
}
|
||||||
|
return $file_list;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class SFTPModuleInstaller extends ModuleInstaller {
|
||||||
|
function SFTPModuleInstaller(&$package)
|
||||||
|
{
|
||||||
|
$this->package =& $package;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _copyDir(&$file_list){
|
||||||
|
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||||
|
|
||||||
|
$ftp_info = Context::getFTPInfo();
|
||||||
|
if(!$ftp_info->ftp_user || !$ftp_info->sftp || $ftp_info->sftp != 'Y') return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||||
|
|
||||||
|
if($ftp_info->ftp_host)
|
||||||
|
{
|
||||||
|
$ftp_host = $ftp_info->ftp_host;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ftp_host = "127.0.0.1";
|
||||||
|
}
|
||||||
|
$connection = ssh2_connect($ftp_host, $ftp_info->ftp_port);
|
||||||
|
if(!ssh2_auth_password($connection, $ftp_info->ftp_user, $this->ftp_password))
|
||||||
|
{
|
||||||
|
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||||
|
}
|
||||||
|
|
||||||
|
$sftp = ssh2_sftp($connection);
|
||||||
|
|
||||||
|
$target_dir = $ftp_info->ftp_root_path.$this->target_path;
|
||||||
|
|
||||||
|
foreach($file_list as $k => $file){
|
||||||
|
$org_file = $file;
|
||||||
|
if($this->package->path == ".")
|
||||||
|
{
|
||||||
|
$file = substr($file,3);
|
||||||
|
}
|
||||||
|
$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
|
||||||
|
$pathname = dirname($target_dir."/".$file);
|
||||||
|
|
||||||
|
if(!file_exists(FileHandler::getRealPath($real_path)))
|
||||||
|
{
|
||||||
|
ssh2_sftp_mkdir($sftp, $pathname, 0755, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ssh2_scp_send($connection, FileHandler::getRealPath($this->download_path."/".$org_file), $target_dir."/".$file);
|
||||||
|
}
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class FTPModuleInstaller extends ModuleInstaller {
|
||||||
|
function FTPModuleInstaller(&$package)
|
||||||
|
{
|
||||||
|
$this->package =& $package;
|
||||||
|
}
|
||||||
|
|
||||||
|
function _copyDir(&$file_list){
|
||||||
|
$ftp_info = Context::getFTPInfo();
|
||||||
|
if(!$this->ftp_password) return new Object(-1,'msg_ftp_password_input');
|
||||||
|
|
||||||
|
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||||
|
|
||||||
|
if($ftp_info->ftp_host)
|
||||||
|
{
|
||||||
|
$ftp_host = $ftp_info->ftp_host;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$ftp_host = "127.0.0.1";
|
||||||
|
}
|
||||||
|
|
||||||
|
$oFtp = new ftp();
|
||||||
|
if(!$oFtp->ftp_connect($ftp_host, $ftp_info->ftp_port)) return new Object(-1,'msg_ftp_not_connected');
|
||||||
|
if(!$oFtp->ftp_login($ftp_info->ftp_user, $this->ftp_password)) {
|
||||||
|
$oFtp->ftp_quit();
|
||||||
|
return new Object(-1,'msg_ftp_invalid_auth_info');
|
||||||
|
}
|
||||||
|
|
||||||
|
$_list = $oFtp->ftp_rawlist($ftp_info->ftp_root_path);
|
||||||
|
|
||||||
|
$target_dir = $ftp_info->ftp_root_path.$this->target_path;
|
||||||
|
|
||||||
|
foreach($file_list as $k => $file){
|
||||||
|
$org_file = $file;
|
||||||
|
if($this->package->path == ".")
|
||||||
|
{
|
||||||
|
$file = substr($file,3);
|
||||||
|
}
|
||||||
|
$path = FileHandler::getRealPath("./".$this->target_path."/".$file);
|
||||||
|
$path_list = explode('/', dirname($this->target_path."/".$file));
|
||||||
|
|
||||||
|
$real_path = "./";
|
||||||
|
$ftp_path = $ftp_info->ftp_root_path;
|
||||||
|
|
||||||
|
for($i=0;$i<count($path_list);$i++)
|
||||||
|
{
|
||||||
|
if($path_list=="") continue;
|
||||||
|
$real_path .= $path_list[$i]."/";
|
||||||
|
$ftp_path .= $path_list[$i]."/";
|
||||||
|
if(!file_exists(FileHandler::getRealPath($real_path)))
|
||||||
|
{
|
||||||
|
$oFtp->ftp_mkdir($ftp_path);
|
||||||
|
$oFtp->ftp_site("CHMOD 755 ".$path);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$oFtp->ftp_put($target_dir .'/'. $file, FileHandler::getRealPath($this->download_path."/".$org_file));
|
||||||
|
}
|
||||||
|
$oFtp->ftp_quit();
|
||||||
|
|
||||||
|
return new Object();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
@ -29,4 +29,5 @@
|
||||||
$lang->path = "Path";
|
$lang->path = "Path";
|
||||||
$lang->cmd_download = "Download";
|
$lang->cmd_download = "Download";
|
||||||
$lang->view_installed_packages = "Installed Packages";
|
$lang->view_installed_packages = "Installed Packages";
|
||||||
|
$lang->msg_ftp_password_input = "Please input FTP password.";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,5 @@
|
||||||
$lang->path = "インストールパス";
|
$lang->path = "インストールパス";
|
||||||
$lang->cmd_download = "ダウンロード";
|
$lang->cmd_download = "ダウンロード";
|
||||||
$lang->view_installed_packages = "Installed Packages";
|
$lang->view_installed_packages = "Installed Packages";
|
||||||
|
$lang->msg_ftp_password_input = "Please input FTP password.";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,5 @@
|
||||||
$lang->path = "설치경로";
|
$lang->path = "설치경로";
|
||||||
$lang->cmd_download = "다운로드";
|
$lang->cmd_download = "다운로드";
|
||||||
$lang->view_installed_packages = "설치된 패키지";
|
$lang->view_installed_packages = "설치된 패키지";
|
||||||
|
$lang->msg_ftp_password_input = "FTP 비밀번호를 입력해주세요";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,5 @@
|
||||||
$lang->path = "Đường dẫn";
|
$lang->path = "Đường dẫn";
|
||||||
$lang->cmd_download = "Download";
|
$lang->cmd_download = "Download";
|
||||||
$lang->view_installed_packages = "Installed Packages";
|
$lang->view_installed_packages = "Installed Packages";
|
||||||
|
$lang->msg_ftp_password_input = "Please input FTP password.";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,5 @@
|
||||||
$lang->path = "Path";
|
$lang->path = "Path";
|
||||||
$lang->cmd_download = "Download";
|
$lang->cmd_download = "Download";
|
||||||
$lang->view_installed_packages = "Installed Packages";
|
$lang->view_installed_packages = "Installed Packages";
|
||||||
|
$lang->msg_ftp_password_input = "Please input FTP password.";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -29,4 +29,5 @@
|
||||||
$lang->path = "路徑";
|
$lang->path = "路徑";
|
||||||
$lang->cmd_download = "下載";
|
$lang->cmd_download = "下載";
|
||||||
$lang->view_installed_packages = "已安裝套裝軟體";
|
$lang->view_installed_packages = "已安裝套裝軟體";
|
||||||
|
$lang->msg_ftp_password_input = "Please input FTP password.";
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -12,13 +12,19 @@
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
|
|
||||||
|
<!--@if(!$package->installed || $package->need_update)-->
|
||||||
<!--@if($show_ftp_note)-->
|
<!--@if($show_ftp_note)-->
|
||||||
<p class="warning">{$lang->description_download}. (<a href="{getUrl('','module','admin','act','dispAdminConfig')}#ftpSetup">FTP Setup</a>) </p>
|
<p class="warning">{$lang->description_download}. (<a href="{getUrl('','module','admin','act','dispAdminConfig')}#ftpSetup">FTP Setup</a>) </p>
|
||||||
<p>{$lang->path} : {$package->path}</p>
|
<p>{$lang->path} : {$package->path}</p>
|
||||||
<p><a href="http://download.xpressengine.com/?module=resourceapi&act=procResourceapiDownload&package_srl={$package->package_srl}" class="button large green strong"><span>{$lang->cmd_download}</span></a></p>
|
<p><a href="http://download.xpressengine.com/?module=resourceapi&act=procResourceapiDownload&package_srl={$package->package_srl}" class="button large green strong"><span>{$lang->cmd_download}</span></a></p>
|
||||||
<!--@else-->
|
<!--@else-->
|
||||||
<p>{$lang->description_install}. </p>
|
<p>{$lang->description_install}. </p>
|
||||||
<p><!--@if(!$package->installed || $package->need_update)--><a href="#" onclick="doInstallPackage('{$package->package_srl}')" class="button large green strong"><span>{$lang->install}</span></a><!--@end--></p>
|
<!--@if($need_password)-->
|
||||||
|
<p><label for="ftp_password">FTP {$lang->password} ({$lang->about_ftp_password}):</label><input type="password" name="ftp_password" id="ftp_password" class="inputTypeText" /></p>
|
||||||
|
<!--@end-->
|
||||||
|
<p><a href="#" onclick="doInstallPackage('{$package->package_srl}')" class="button large green strong"><span>{$package->installed?$lang->update:$lang->install}</span></a></p>
|
||||||
|
<!--@end-->
|
||||||
<!--@end-->
|
<!--@end-->
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,12 @@ function doUpdate() {
|
||||||
function doInstallPackage(package_srl) {
|
function doInstallPackage(package_srl) {
|
||||||
var params = new Array();
|
var params = new Array();
|
||||||
params['package_srl'] = package_srl;
|
params['package_srl'] = package_srl;
|
||||||
|
var e = jQuery("#ftp_password").get(0)
|
||||||
|
if(typeof(e) != "undefined")
|
||||||
|
{
|
||||||
|
params['ftp_password'] = e.value;
|
||||||
|
}
|
||||||
|
|
||||||
exec_xml('autoinstall', 'procAutoinstallAdminPackageinstall', params, completeInstall);
|
exec_xml('autoinstall', 'procAutoinstallAdminPackageinstall', params, completeInstall);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -20,6 +26,7 @@ function completeUpdateNoMsg(ret_obj) {
|
||||||
|
|
||||||
function completeInstall(ret_obj) {
|
function completeInstall(ret_obj) {
|
||||||
alert(ret_obj['message']);
|
alert(ret_obj['message']);
|
||||||
|
if(ret_obj['error'] != 0) return;
|
||||||
var params = new Array();
|
var params = new Array();
|
||||||
exec_xml('autoinstall', 'procAutoinstallAdminUpdateinfo', params, completeUpdateNoMsg);
|
exec_xml('autoinstall', 'procAutoinstallAdminUpdateinfo', params, completeUpdateNoMsg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,6 @@
|
||||||
<action name="procInstallAdminSaveTimeZone" type="controller" standalone="true" />
|
<action name="procInstallAdminSaveTimeZone" type="controller" standalone="true" />
|
||||||
<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="procInstallAdminSaveFTPPath" type="controller" standalone="true" />
|
<action name="procInstallAdminRemoveFTPInfo" type="controller" standalone="true" />
|
||||||
</actions>
|
</actions>
|
||||||
</module>
|
</module>
|
||||||
|
|
|
||||||
|
|
@ -114,12 +114,24 @@
|
||||||
|
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function procInstallAdminRemoveFTPInfo() {
|
||||||
|
$ftp_config_file = Context::getFTPConfigFile();
|
||||||
|
if(file_exists($ftp_config_file)) unlink($ftp_config_file);
|
||||||
|
if($_SESSION['ftp_password']) unset($_SESSION['ftp_password']);
|
||||||
|
$this->setMessage('success_deleted');
|
||||||
|
}
|
||||||
|
|
||||||
function procInstallAdminSaveFTPInfo() {
|
function procInstallAdminSaveFTPInfo() {
|
||||||
$ftp_info = Context::getFTPInfo();
|
$ftp_info = Context::getFTPInfo();
|
||||||
$ftp_info->ftp_user = Context::get('ftp_user');
|
$ftp_info->ftp_user = Context::get('ftp_user');
|
||||||
$ftp_info->ftp_password = Context::get('ftp_password');
|
|
||||||
$ftp_info->ftp_port = Context::get('ftp_port');
|
$ftp_info->ftp_port = Context::get('ftp_port');
|
||||||
$ftp_info->sftp = Context::get('sftp');
|
$ftp_info->sftp = Context::get('sftp');
|
||||||
|
$ftp_info->ftp_root_path = Context::get('ftp_root_path');
|
||||||
|
if(ini_get('safe_mode')) {
|
||||||
|
$ftp_info->ftp_password = Context::get('ftp_password');
|
||||||
|
}
|
||||||
|
|
||||||
$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) {
|
||||||
if(!$val) continue;
|
if(!$val) continue;
|
||||||
|
|
@ -131,20 +143,5 @@
|
||||||
$this->setMessage('success_updated');
|
$this->setMessage('success_updated');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief FTP 정보 등록
|
|
||||||
**/
|
|
||||||
function procInstallAdminSaveFTPPath() {
|
|
||||||
$ftp_info = Context::getFTPInfo();
|
|
||||||
$ftp_info->ftp_root_path = Context::get('ftp_root_path');
|
|
||||||
$buff = '<?php if(!defined("__ZBXE__")) exit();'."\n";
|
|
||||||
foreach($ftp_info as $key => $val) {
|
|
||||||
$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
|
|
||||||
}
|
|
||||||
$buff .= "?>";
|
|
||||||
$config_file = Context::getFTPConfigFile();
|
|
||||||
FileHandler::WriteFile($config_file, $buff);
|
|
||||||
$this->setMessage('success_updated');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue