mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-01 00:02:21 +09:00
172900064 FTP class 추가 및 설치시에 FTP정보를 입력/저장하는 루틴 추가. 디렉토리 생성시 safe_mode일 경우 ftp로 디렉토리를 만들도록 처리. 추가 테스트 필요
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@4520 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
28163b1312
commit
e581ffc40b
21 changed files with 955 additions and 51 deletions
|
|
@ -8,6 +8,8 @@
|
|||
<action name="dispInstallForm" type="view" standalone="true" />
|
||||
|
||||
<action name="procInstall" type="controller" standalone="true" />
|
||||
<action name="procInstallFTP" type="controller" standalone="true" />
|
||||
<action name="procInstallCheckFTP" type="controller" standalone="true" />
|
||||
<action name="procInstallAdminInstall" type="controller" standalone="true" />
|
||||
<action name="procInstallAdminUpdate" type="controller" standalone="true" />
|
||||
<action name="procInstallAdminSaveTimeZone" type="controller" standalone="true" />
|
||||
|
|
|
|||
|
|
@ -59,6 +59,81 @@
|
|||
$this->setMessage('msg_install_completed');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FTP 정보 등록
|
||||
**/
|
||||
function procInstallFTP() {
|
||||
$ftp_info = Context::gets('ftp_user','ftp_password','ftp_port');
|
||||
$ftp_info->ftp_port = (int)$ftp_info->ftp_port;
|
||||
if(!$ftp_info->ftp_port) $ftp_info->ftp_port = 21;
|
||||
|
||||
$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 .= "?>";
|
||||
|
||||
// safe_mode 일 경우
|
||||
if(ini_get('safe_mode')) {
|
||||
if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
if(!is_dir(_XE_PATH_.'files') && !$oFtp->ftp_mkdir(_XE_PATH_.'files')) {
|
||||
$oFtp->ftp_quit();
|
||||
return new Object(-1,'msg_ftp_mkdir_fail');
|
||||
}
|
||||
|
||||
if(!$oFtp->ftp_site("CHMOD 777 "._XE_PATH_.'files')) {
|
||||
$oFtp->ftp_quit();
|
||||
return new Object(-1,'msg_ftp_chmod_fail');
|
||||
}
|
||||
|
||||
if(!is_dir(_XE_PATH_.'files/config') && !$oFtp->ftp_mkdir(_XE_PATH_.'files/config')) {
|
||||
$oFtp->ftp_quit();
|
||||
return new Object(-1,'msg_ftp_mkdir_fail');
|
||||
}
|
||||
|
||||
if(!$oFtp->ftp_site("CHMOD 777 "._XE_PATH_.'files/config')) {
|
||||
$oFtp->ftp_quit();
|
||||
return new Object(-1,'msg_ftp_chmod_fail');
|
||||
}
|
||||
|
||||
$oFtp->ftp_quit();
|
||||
}
|
||||
|
||||
$config_file = Context::getFTPConfigFile();
|
||||
FileHandler::WriteFile($config_file, $buff);
|
||||
}
|
||||
|
||||
function procInstallCheckFtp() {
|
||||
$ftp_info = Context::gets('ftp_user','ftp_password','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_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed');
|
||||
|
||||
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');
|
||||
}
|
||||
|
||||
$oFtp->ftp_quit();
|
||||
|
||||
$this->setMessage('msg_ftp_connect_success');
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 인스톨 환경을 체크하여 결과 return
|
||||
**/
|
||||
|
|
|
|||
|
|
@ -49,7 +49,12 @@
|
|||
// 설치 불가능하다면 check_env를 출력
|
||||
if(!$this->install_enable) return $this->dispInstallCheckEnv();
|
||||
|
||||
$this->setTemplateFile('select_db');
|
||||
// ftp 정보 입력
|
||||
if(!Context::isFTPRegisted()) {
|
||||
$this->setTemplateFile('ftp');
|
||||
} else {
|
||||
$this->setTemplateFile('select_db');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -24,6 +24,7 @@ body { background:#4d4d4d url(../images/installBg.gif) repeat-x;}
|
|||
|
||||
#content { position:relative; padding:25px 20px 20px 20px; overflow:hidden; background:#ffffff;}
|
||||
#content h2 { font-size:1em; padding-left:.5em; margin:0 0 1em 0;}
|
||||
#content blockquote { padding:10px; margin:0; border:1px solid #c9c9c9; margin-bottom:10px; color:#696969; line-height:20px;}
|
||||
#agreement { border:1px solid #c9c9c9; height:15em; padding:1.2em; overflow:auto; color:#696969; line-height:1.25em; margin-bottom:20px;}
|
||||
|
||||
.iePngFix { display:block; }
|
||||
|
|
|
|||
38
modules/install/tpl/ftp.html
Normal file
38
modules/install/tpl/ftp.html
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
<!--%import("js/install_admin.js")-->
|
||||
<!--#include("header.html")-->
|
||||
|
||||
<form action="./" method="post" onsubmit="return doInstallFTPInfo(this);" id="ftp_form">
|
||||
|
||||
<h2>{$lang->ftp_form_title}</h2>
|
||||
|
||||
<blockquote>{$lang->about_ftp_info}</blockquote>
|
||||
|
||||
<table cellspacing="0" class="tableType7">
|
||||
<col width="100" />
|
||||
<col width="160" />
|
||||
<col />
|
||||
|
||||
<!-- FTP 정보 -->
|
||||
<tr>
|
||||
<th rowspan="3" scope="row" class="hr"><label for="radio2">{$lang->ftp}</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>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="second" scope="row"><label for="textfield22">{$lang->password}</label></th>
|
||||
<td><input id="textfield22" type="password" name="ftp_password" class="inputTypeText" /></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="second hr" 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>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<div class="buttonCenter">
|
||||
<span class="button"><input type="button" value="{$lang->cmd_check_ftp_connect}" onclick="doCheckFTPInfo(); return false;"/></span>
|
||||
<span class="button"><input type="submit" value="{$lang->cmd_registration}" /></span>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<!--#include("footer.html")-->
|
||||
|
|
@ -5,3 +5,29 @@ function completeInstalled(ret_obj) {
|
|||
alert(ret_obj["message"]);
|
||||
location.href = "./index.php?module=admin";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FTP 정보 입력
|
||||
**/
|
||||
function doInstallFTPInfo(fo_obj) {
|
||||
var oFilter = new XmlJsFilter(fo_obj, "install", "procInstallFTP", completeInstallFTPInfo);
|
||||
oFilter.addResponseItem("error");
|
||||
oFilter.addResponseItem("message");
|
||||
return oFilter.proc();
|
||||
}
|
||||
|
||||
function completeInstallFTPInfo(ret_obj) {
|
||||
location.href = current_url;
|
||||
}
|
||||
|
||||
function doCheckFTPInfo() {
|
||||
var fo_obj = xGetElementById("ftp_form");
|
||||
var oFilter = new XmlJsFilter(fo_obj, "install", "procInstallCheckFTP", completeInstallCheckFtpInfo);
|
||||
oFilter.addResponseItem("error");
|
||||
oFilter.addResponseItem("message");
|
||||
return oFilter.proc();
|
||||
}
|
||||
|
||||
function completeInstallCheckFtpInfo(ret_obj) {
|
||||
alert(ret_obj['message']);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue