diff --git a/modules/admin/admin.admin.model.php b/modules/admin/admin.admin.model.php
index fc7974e7b..8e658c84c 100644
--- a/modules/admin/admin.admin.model.php
+++ b/modules/admin/admin.admin.model.php
@@ -6,8 +6,12 @@
function getSFTPList()
{
- $ftp_info = Context::getFTPInfo();
- $connection = ssh2_connect('localhost', $ftp_info->ftp_port);
+ $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');
@@ -36,8 +40,16 @@
{
set_time_limit(5);
require_once(_XE_PATH_.'libs/ftp.class.php');
- $ftp_info = Context::getFTPInfo();
- $this->pwd = Context::get('pwd');
+ $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')
{
@@ -45,7 +57,7 @@
}
$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)) {
$_list = $oFtp->ftp_rawlist($this->pwd);
$oFtp->ftp_quit();
@@ -56,19 +68,6 @@
}
}
$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){
foreach($_list as $k => $v){
diff --git a/modules/admin/admin.admin.view.php b/modules/admin/admin.admin.view.php
index 1083fae1a..2d715a8f5 100644
--- a/modules/admin/admin.admin.view.php
+++ b/modules/admin/admin.admin.view.php
@@ -276,22 +276,6 @@
$output = executeQuery('module.getSiteInfo', $site_args);
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('layout','none');
$this->setTemplateFile('config');
diff --git a/modules/admin/lang/en.lang.php b/modules/admin/lang/en.lang.php
index e5c0b228d..a110e6a70 100644
--- a/modules/admin/lang/en.lang.php
+++ b/modules/admin/lang/en.lang.php
@@ -79,4 +79,6 @@
$lang->use_db_session = 'Use Session DB';
$lang->about_db_session = 'It will use php session with DB when authenticating.
Websites with infrequent usage of web server may expect faster response when this function is disabled.
However session DB will make it unable to get current users, so you cannot use related functions.';
$lang->sftp = "Use SFTP";
+ $lang->ftp_get_list = "Get List";
+ $lang->ftp_remove_info = 'Remove FTP Info.';
?>
diff --git a/modules/admin/lang/es.lang.php b/modules/admin/lang/es.lang.php
index 292a43ba5..52d223e67 100644
--- a/modules/admin/lang/es.lang.php
+++ b/modules/admin/lang/es.lang.php
@@ -81,4 +81,6 @@
$lang->use_db_session = '인증 세션 DB 사용';
$lang->about_db_session = '인증시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.
웹서버의 사용율이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다
단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
$lang->sftp = "Use SFTP";
+ $lang->ftp_get_list = "Get List";
+ $lang->ftp_remove_info = 'Remove FTP Info.';
?>
diff --git a/modules/admin/lang/fr.lang.php b/modules/admin/lang/fr.lang.php
index fe7562caa..a2c057634 100644
--- a/modules/admin/lang/fr.lang.php
+++ b/modules/admin/lang/fr.lang.php
@@ -80,4 +80,6 @@
$lang->use_db_session = '인증 세션 DB 사용';
$lang->about_db_session = '인증시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.
웹서버의 사용율이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다
단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
$lang->sftp = "Use SFTP";
+ $lang->ftp_get_list = "Get List";
+ $lang->ftp_remove_info = 'Remove FTP Info.';
?>
diff --git a/modules/admin/lang/jp.lang.php b/modules/admin/lang/jp.lang.php
index 0a9f5bc8b..877db6107 100644
--- a/modules/admin/lang/jp.lang.php
+++ b/modules/admin/lang/jp.lang.php
@@ -79,4 +79,6 @@
$lang->use_db_session = 'DBで認証セッション管理';
$lang->about_db_session = '認証の時に使われるPHPセッションをDBで使う機能です。
ウェブサーバーの負荷が低いサイトではこの機能をオフにすることでむしろサイトのレスポンスが向上されることもあります。
また、この機能をオンにすると、「現在ログイン中の会員」の機能が不可になります。';
$lang->sftp = "Use SFTP";
+ $lang->ftp_get_list = "Get List";
+ $lang->ftp_remove_info = 'Remove FTP Info.';
?>
diff --git a/modules/admin/lang/ko.lang.php b/modules/admin/lang/ko.lang.php
index a9e030047..731aa660e 100644
--- a/modules/admin/lang/ko.lang.php
+++ b/modules/admin/lang/ko.lang.php
@@ -79,4 +79,6 @@
$lang->use_db_session = '인증 세션 DB 사용';
$lang->about_db_session = '인증 시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.
웹서버의 사용률이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다.
단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
$lang->sftp = 'SFTP 사용';
+ $lang->ftp_get_list = '목록 가져오기';
+ $lang->ftp_remove_info = 'FTP 정보 삭제';
?>
diff --git a/modules/admin/lang/ru.lang.php b/modules/admin/lang/ru.lang.php
index af6478217..cad2a62b1 100644
--- a/modules/admin/lang/ru.lang.php
+++ b/modules/admin/lang/ru.lang.php
@@ -80,4 +80,6 @@
$lang->use_db_session = '인증 세션 DB 사용';
$lang->about_db_session = '인증시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.
웹서버의 사용율이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다
단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
$lang->sftp = "Use SFTP";
+ $lang->ftp_get_list = "Get List";
+ $lang->ftp_remove_info = 'Remove FTP Info.';
?>
diff --git a/modules/admin/lang/vi.lang.php b/modules/admin/lang/vi.lang.php
index d073b4b5f..7805bd5af 100644
--- a/modules/admin/lang/vi.lang.php
+++ b/modules/admin/lang/vi.lang.php
@@ -81,4 +81,6 @@
$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->sftp = "Use SFTP";
+ $lang->ftp_get_list = "Get List";
+ $lang->ftp_remove_info = 'Remove FTP Info.';
?>
diff --git a/modules/admin/lang/zh-CN.lang.php b/modules/admin/lang/zh-CN.lang.php
index c28b31730..e21ae8ced 100644
--- a/modules/admin/lang/zh-CN.lang.php
+++ b/modules/admin/lang/zh-CN.lang.php
@@ -79,4 +79,6 @@
$lang->use_db_session = 'DB储存认证会话';
$lang->about_db_session = '用DB储存认证时的PHP会话。
服务器使用率较少的网站建议不要勾选此项(可提高网站访问速度)。
只是无法统计在线会员。';
$lang->sftp = "Use SFTP";
+ $lang->ftp_get_list = "Get List";
+ $lang->ftp_remove_info = 'Remove FTP Info.';
?>
diff --git a/modules/admin/lang/zh-TW.lang.php b/modules/admin/lang/zh-TW.lang.php
index 5fc5dc857..631c98515 100644
--- a/modules/admin/lang/zh-TW.lang.php
+++ b/modules/admin/lang/zh-TW.lang.php
@@ -79,4 +79,6 @@
$lang->use_db_session = 'DB session認證';
$lang->about_db_session = '인증 시 사용되는 PHP 세션을 DB로 사용하는 기능입니다.
웹서버의 사용률이 낮은 사이트에서는 비활성화시 사이트 응답 속도가 향상될 수 있습니다.
단 현재 접속자를 구할 수 없어 관련된 기능을 사용할 수 없게 됩니다.';
$lang->sftp = "使用 SFTP";
+ $lang->ftp_get_list = "Get List";
+ $lang->ftp_remove_info = 'Remove FTP Info.';
?>
diff --git a/modules/admin/tpl/config.html b/modules/admin/tpl/config.html
index 1e03c455b..a6715f4fd 100644
--- a/modules/admin/tpl/config.html
+++ b/modules/admin/tpl/config.html
@@ -15,12 +15,7 @@
sObj.value = module_srl;
obj.value = decodeURIComponent(browser_title.replace(/\+/g," "))+' ('+mid+')';
}
-
- var pwd = '{$pwd}';
- params = new Array();
- params['pwd'] = pwd;
- exec_xml('admin','getAdminFTPList', params, completeGetFtpInfo, new Array('list','error','message'));
-
+ var xe_root = "{_XE_PATH_}";
@@ -127,67 +122,55 @@
+
{$lang->ftp_form_title}
{$lang->about_ftp_info}
-
-
{$lang->ftp_path_title}
-
-
diff --git a/modules/admin/tpl/filter/install_ftp_info.xml b/modules/admin/tpl/filter/install_ftp_info.xml
index 05160bd69..2e27c569e 100644
--- a/modules/admin/tpl/filter/install_ftp_info.xml
+++ b/modules/admin/tpl/filter/install_ftp_info.xml
@@ -1,8 +1,8 @@
diff --git a/modules/admin/tpl/js/config.js b/modules/admin/tpl/js/config.js
index 52330f8c4..3915fa5e9 100644
--- a/modules/admin/tpl/js/config.js
+++ b/modules/admin/tpl/js/config.js
@@ -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)
{
+ 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']))
@@ -7,6 +44,7 @@ function completeGetFtpInfo(ret_obj)
ret_obj['list']['item'] = [ret_obj['list']['item']];
}
+ pwd = jQuery("#ftp_form").get(0).ftp_root_path.value;
if(pwd != "/")
{
arr = pwd.split("/");
@@ -14,7 +52,7 @@ function completeGetFtpInfo(ret_obj)
arr.pop();
arr.push("");
target = arr.join("/");
- list = list + "../";
+ list = list + "../";
}
for(var i=0;i"+v+"";
+ list = list + ""+v+"";
}
}
list = " | ";
e.append(jQuery(list));
-}
\ No newline at end of file
+}
diff --git a/modules/autoinstall/autoinstall.admin.controller.php b/modules/autoinstall/autoinstall.admin.controller.php
index f4942e40c..97525fe43 100644
--- a/modules/autoinstall/autoinstall.admin.controller.php
+++ b/modules/autoinstall/autoinstall.admin.controller.php
@@ -5,195 +5,7 @@
* @brief autoinstall 모듈의 admin controller class
**/
- 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;
-
- 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;$iftp_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();
- }
- }
+ require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php');
class autoinstallAdminController extends autoinstall {
@@ -303,18 +115,31 @@
$oModel =& getModel('autoinstall');
$packages = explode(',', $package_srls);
$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)
{
$package = $oModel->getPackage($package_srl);
if($ftp_info->sftp && $ftp_info->sftp == 'Y')
{
$oModuleInstaller = new SFTPModuleInstaller($package);
+ $oModuleInstaller->setPassword($ftp_password);
}
else
{
$oModuleInstaller = new FTPModuleInstaller($package);
+ $oModuleInstaller->setPassword($ftp_password);
}
- $oModuleInstaller->install();
+ $output = $oModuleInstaller->install();
+ if(!$output->toBool()) return $output;
}
$this->setMessage('success_installed');
}
diff --git a/modules/autoinstall/autoinstall.admin.view.php b/modules/autoinstall/autoinstall.admin.view.php
index 2b0a010eb..3a50d3013 100644
--- a/modules/autoinstall/autoinstall.admin.view.php
+++ b/modules/autoinstall/autoinstall.admin.view.php
@@ -156,6 +156,10 @@
Context::set("package", $package);
}
+ if(!$_SESSION['ftp_password'])
+ {
+ Context::set('need_password', true);
+ }
$this->setTemplateFile('install');
}
diff --git a/modules/autoinstall/autoinstall.lib.php b/modules/autoinstall/autoinstall.lib.php
new file mode 100644
index 000000000..4113f6163
--- /dev/null
+++ b/modules/autoinstall/autoinstall.lib.php
@@ -0,0 +1,215 @@
+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;$iftp_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();
+ }
+ }
+
+?>
diff --git a/modules/autoinstall/lang/en.lang.php b/modules/autoinstall/lang/en.lang.php
index 9045a2807..4410f41fc 100644
--- a/modules/autoinstall/lang/en.lang.php
+++ b/modules/autoinstall/lang/en.lang.php
@@ -29,4 +29,5 @@
$lang->path = "Path";
$lang->cmd_download = "Download";
$lang->view_installed_packages = "Installed Packages";
+ $lang->msg_ftp_password_input = "Please input FTP password.";
?>
diff --git a/modules/autoinstall/lang/jp.lang.php b/modules/autoinstall/lang/jp.lang.php
index dea87600f..b22567405 100644
--- a/modules/autoinstall/lang/jp.lang.php
+++ b/modules/autoinstall/lang/jp.lang.php
@@ -29,4 +29,5 @@
$lang->path = "インストールパス";
$lang->cmd_download = "ダウンロード";
$lang->view_installed_packages = "Installed Packages";
+ $lang->msg_ftp_password_input = "Please input FTP password.";
?>
diff --git a/modules/autoinstall/lang/ko.lang.php b/modules/autoinstall/lang/ko.lang.php
index 59777b64b..9d9363565 100644
--- a/modules/autoinstall/lang/ko.lang.php
+++ b/modules/autoinstall/lang/ko.lang.php
@@ -29,4 +29,5 @@
$lang->path = "설치경로";
$lang->cmd_download = "다운로드";
$lang->view_installed_packages = "설치된 패키지";
+ $lang->msg_ftp_password_input = "FTP 비밀번호를 입력해주세요";
?>
diff --git a/modules/autoinstall/lang/vi.lang.php b/modules/autoinstall/lang/vi.lang.php
index 6be1bcde8..bbbd63ebb 100644
--- a/modules/autoinstall/lang/vi.lang.php
+++ b/modules/autoinstall/lang/vi.lang.php
@@ -29,4 +29,5 @@
$lang->path = "Đường dẫn";
$lang->cmd_download = "Download";
$lang->view_installed_packages = "Installed Packages";
+ $lang->msg_ftp_password_input = "Please input FTP password.";
?>
diff --git a/modules/autoinstall/lang/zh-CN.lang.php b/modules/autoinstall/lang/zh-CN.lang.php
index d2e077526..a8a9dbee8 100644
--- a/modules/autoinstall/lang/zh-CN.lang.php
+++ b/modules/autoinstall/lang/zh-CN.lang.php
@@ -29,4 +29,5 @@
$lang->path = "Path";
$lang->cmd_download = "Download";
$lang->view_installed_packages = "Installed Packages";
+ $lang->msg_ftp_password_input = "Please input FTP password.";
?>
diff --git a/modules/autoinstall/lang/zh-TW.lang.php b/modules/autoinstall/lang/zh-TW.lang.php
index 53dc0a6bb..fc07ce535 100644
--- a/modules/autoinstall/lang/zh-TW.lang.php
+++ b/modules/autoinstall/lang/zh-TW.lang.php
@@ -29,4 +29,5 @@
$lang->path = "路徑";
$lang->cmd_download = "下載";
$lang->view_installed_packages = "已安裝套裝軟體";
+ $lang->msg_ftp_password_input = "Please input FTP password.";
?>
diff --git a/modules/autoinstall/tpl/install.html b/modules/autoinstall/tpl/install.html
index cf7f79f40..df1bac164 100644
--- a/modules/autoinstall/tpl/install.html
+++ b/modules/autoinstall/tpl/install.html
@@ -12,13 +12,19 @@
+
+
{$lang->description_download}. (FTP Setup)
{$lang->path} : {$package->path}
{$lang->cmd_download}
{$lang->description_install}.
- {$lang->install}
+
+
+
+ {$package->installed?$lang->update:$lang->install}
+
diff --git a/modules/autoinstall/tpl/js/autoinstall.js b/modules/autoinstall/tpl/js/autoinstall.js
index 4e65fd53f..10534b04d 100644
--- a/modules/autoinstall/tpl/js/autoinstall.js
+++ b/modules/autoinstall/tpl/js/autoinstall.js
@@ -11,6 +11,12 @@ function doUpdate() {
function doInstallPackage(package_srl) {
var params = new Array();
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);
}
@@ -20,6 +26,7 @@ function completeUpdateNoMsg(ret_obj) {
function completeInstall(ret_obj) {
alert(ret_obj['message']);
+ if(ret_obj['error'] != 0) return;
var params = new Array();
exec_xml('autoinstall', 'procAutoinstallAdminUpdateinfo', params, completeUpdateNoMsg);
}
diff --git a/modules/install/conf/module.xml b/modules/install/conf/module.xml
index 75b648386..16474a979 100644
--- a/modules/install/conf/module.xml
+++ b/modules/install/conf/module.xml
@@ -16,6 +16,6 @@
-
+
diff --git a/modules/install/install.admin.controller.php b/modules/install/install.admin.controller.php
index 855ed5d4c..c6831c904 100644
--- a/modules/install/install.admin.controller.php
+++ b/modules/install/install.admin.controller.php
@@ -114,12 +114,24 @@
$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() {
$ftp_info = Context::getFTPInfo();
$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->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 = ' $val) {
if(!$val) continue;
@@ -131,20 +143,5 @@
$this->setMessage('success_updated');
}
- /**
- * @brief FTP 정보 등록
- **/
- function procInstallAdminSaveFTPPath() {
- $ftp_info = Context::getFTPInfo();
- $ftp_info->ftp_root_path = Context::get('ftp_root_path');
- $buff = ' $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');
- }
}
?>