mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +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
|
|
@ -22,6 +22,7 @@
|
|||
var $context = NULL; ///< @brief request parameter 및 각종 환경 변수등을 정리하여 담을 변수
|
||||
|
||||
var $db_info = NULL; ///< @brief DB 정보
|
||||
var $ftp_info = NULL; ///< @brief FTP 정보
|
||||
|
||||
var $ssl_actions = array(); ///< @brief ssl로 전송해야 할 action등록 (common/js/xml_handler.js에서 ajax통신시 활용)
|
||||
var $js_files = array(); ///< @brief display시에 사용하게 되는 js files의 목록
|
||||
|
|
@ -260,6 +261,34 @@
|
|||
return $this->db_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @biref FTP 정보가 등록되었는지 확인
|
||||
**/
|
||||
function isFTPRegisted() {
|
||||
$ftp_config_file = Context::getFTPConfigFile();
|
||||
if(file_exists($ftp_config_file)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FTP 정보가 담긴 object를 return
|
||||
**/
|
||||
function getFTPInfo() {
|
||||
$oContext = &Context::getInstance();
|
||||
return $oContext->_getFTPInfo();
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief FTP 정보가 담긴 object를 return
|
||||
**/
|
||||
function _getFTPInfo() {
|
||||
if(!$this->isFTPRegisted()) return null;
|
||||
|
||||
$ftp_config_file = $this->getFTPConfigFile();
|
||||
@include($ftp_config_file);
|
||||
return $ftp_info;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 사이트 title adding
|
||||
**/
|
||||
|
|
@ -958,6 +987,13 @@
|
|||
return _XE_PATH_."files/config/db.config.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief ftp설정내용이 저장되어 있는 config file의 path를 return
|
||||
**/
|
||||
function getFTPConfigFile() {
|
||||
return _XE_PATH_."files/config/ftp.config.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief 설치가 되어 있는지에 대한 체크
|
||||
*
|
||||
|
|
|
|||
|
|
@ -121,6 +121,22 @@
|
|||
* 주어진 경로를 단계별로 접근하여 recursive하게 디렉토리 생성
|
||||
**/
|
||||
function makeDir($path_string) {
|
||||
static $oFtp = null;
|
||||
|
||||
// safe_mode 일 경우 ftp 정보를 이용해서 디렉토리 생성
|
||||
if(ini_get('safe_mode') && $oFtp == null) {
|
||||
if(!Context::isFTPRegisted()) return;
|
||||
|
||||
require_once(_XE_PATH_.'libs/ftp.class.php');
|
||||
$ftp_info = Context::getFTPInfo();
|
||||
$oFtp = new ftp();
|
||||
if(!$oFtp->ftp_connect('localhost')) return;
|
||||
if(!$oFtp->ftp_login($ftp_info->ftp_user, $ftp_info->ftp_password)) {
|
||||
$oFtp->ftp_quit();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
$path_string = str_replace(_XE_PATH_,'',$path_string);
|
||||
$path_list = explode('/', $path_string);
|
||||
|
||||
|
|
@ -129,8 +145,13 @@
|
|||
if(!$path_list[$i]) continue;
|
||||
$path .= $path_list[$i].'/';
|
||||
if(!is_dir($path)) {
|
||||
@mkdir($path, 0755);
|
||||
@chmod($path, 0755);
|
||||
if(ini_get('safe_mode')) {
|
||||
$oFtp->ftp_mkdir($path);
|
||||
$oFtp->ftp_site("CHMOD 777 ".$path);
|
||||
} else {
|
||||
@mkdir($path, 0755);
|
||||
@chmod($path, 0755);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -181,61 +181,64 @@
|
|||
$this->error = 'msg_module_is_not_exists';
|
||||
}
|
||||
|
||||
// 에러가 발생하였을시 처리
|
||||
if($this->error) {
|
||||
// message 모듈 객체를 생성해서 컨텐츠 생성
|
||||
$oMessageView = &getView('message');
|
||||
$oMessageView->setError(-1);
|
||||
$oMessageView->setMessage($this->error);
|
||||
$oMessageView->dispMessage();
|
||||
// XMLRPC call 이 아니면 message view 객체 이용하도록
|
||||
if(Context::getRequestMethod() != 'XMLRPC') {
|
||||
// 에러가 발생하였을시 처리
|
||||
if($this->error) {
|
||||
// message 모듈 객체를 생성해서 컨텐츠 생성
|
||||
$oMessageView = &getView('message');
|
||||
$oMessageView->setError(-1);
|
||||
$oMessageView->setMessage($this->error);
|
||||
$oMessageView->dispMessage();
|
||||
|
||||
// 정상적으로 호출된 객체가 있을 경우 해당 객체의 template를 변경
|
||||
if($oModule) {
|
||||
$oModule->setTemplatePath($oMessageView->getTemplatePath());
|
||||
$oModule->setTemplateFile($oMessageView->getTemplateFile());
|
||||
// 정상적으로 호출된 객체가 있을 경우 해당 객체의 template를 변경
|
||||
if($oModule) {
|
||||
$oModule->setTemplatePath($oMessageView->getTemplatePath());
|
||||
$oModule->setTemplateFile($oMessageView->getTemplateFile());
|
||||
|
||||
// 그렇지 않으면 message 객체를 호출된 객체로 지정
|
||||
} else {
|
||||
$oModule = $oMessageView;
|
||||
// 그렇지 않으면 message 객체를 호출된 객체로 지정
|
||||
} else {
|
||||
$oModule = $oMessageView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 해당 모듈에 layout_srl이 있는지 확인
|
||||
if($oModule->module_info->layout_srl && !$oModule->getLayoutFile()) {
|
||||
// 해당 모듈에 layout_srl이 있는지 확인
|
||||
if($oModule->module_info->layout_srl && !$oModule->getLayoutFile()) {
|
||||
|
||||
// layout_srl이 있으면 해당 레이아웃 정보를 가져와 layout_path/ layout_file 위치 변경
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($oModule->module_info->layout_srl);
|
||||
// layout_srl이 있으면 해당 레이아웃 정보를 가져와 layout_path/ layout_file 위치 변경
|
||||
$oLayoutModel = &getModel('layout');
|
||||
$layout_info = $oLayoutModel->getLayout($oModule->module_info->layout_srl);
|
||||
|
||||
if($layout_info) {
|
||||
if($layout_info) {
|
||||
|
||||
// 레이아웃 정보중 extra_vars의 이름과 값을 $layout_info에 입력
|
||||
if($layout_info->extra_var_count) {
|
||||
foreach($layout_info->extra_var as $var_id => $val) {
|
||||
$layout_info->{$var_id} = $val->value;
|
||||
// 레이아웃 정보중 extra_vars의 이름과 값을 $layout_info에 입력
|
||||
if($layout_info->extra_var_count) {
|
||||
foreach($layout_info->extra_var as $var_id => $val) {
|
||||
$layout_info->{$var_id} = $val->value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 레이아웃 정보중 menu를 Context::set
|
||||
if($layout_info->menu_count) {
|
||||
foreach($layout_info->menu as $menu_id => $menu) {
|
||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
|
||||
// 레이아웃 정보중 menu를 Context::set
|
||||
if($layout_info->menu_count) {
|
||||
foreach($layout_info->menu as $menu_id => $menu) {
|
||||
if(file_exists($menu->php_file)) @include($menu->php_file);
|
||||
Context::set($menu_id, $menu);
|
||||
}
|
||||
}
|
||||
|
||||
// 레이아웃 정보중 header_script가 있으면 헤더 추가
|
||||
if($layout_info->header_script) Context::addHtmlHeader($layout_info->header_script);
|
||||
|
||||
// 레이아웃 정보를 Context::set
|
||||
Context::set('layout_info', $layout_info);
|
||||
|
||||
$oModule->setLayoutPath($layout_info->path);
|
||||
$oModule->setLayoutFile('layout');
|
||||
|
||||
// 레이아웃이 수정되었을 경우 수정본을 지정
|
||||
$edited_layout = sprintf('./files/cache/layout/%d.html', $layout_info->layout_srl);
|
||||
if(file_exists($edited_layout)) $oModule->setEditedLayoutFile($edited_layout);
|
||||
}
|
||||
|
||||
// 레이아웃 정보중 header_script가 있으면 헤더 추가
|
||||
if($layout_info->header_script) Context::addHtmlHeader($layout_info->header_script);
|
||||
|
||||
// 레이아웃 정보를 Context::set
|
||||
Context::set('layout_info', $layout_info);
|
||||
|
||||
$oModule->setLayoutPath($layout_info->path);
|
||||
$oModule->setLayoutFile('layout');
|
||||
|
||||
// 레이아웃이 수정되었을 경우 수정본을 지정
|
||||
$edited_layout = sprintf('./files/cache/layout/%d.html', $layout_info->layout_srl);
|
||||
if(file_exists($edited_layout)) $oModule->setEditedLayoutFile($edited_layout);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ function XmlJsFilterProc(confirm_msg) {
|
|||
}
|
||||
exec_xml(this.module, this.act, params, this.user_func, response, params, this.fo_obj);
|
||||
|
||||
return null;
|
||||
return false;
|
||||
}
|
||||
|
||||
// form proc
|
||||
|
|
|
|||
|
|
@ -236,6 +236,28 @@
|
|||
$lang->is_active = 'Active';
|
||||
$lang->is_required = 'Required Field';
|
||||
|
||||
// ftp 관련
|
||||
$lang->ftp_form_title = 'FTP 정보 입력';
|
||||
$lang->ftp = 'FTP';
|
||||
$lang->ftp_port = 'FTP port';
|
||||
$lang->cmd_check_ftp_connect = 'FTP 접속 확인';
|
||||
$lang->about_ftp_info = "
|
||||
FTP 정보는 다음의 경우에 이용될 수 있습니다.<br/>
|
||||
1. PHP의 safe_mode=On일 경우에 FTP 정보를 이용해서 XE를 정상적으로 동작할 수 있게 합니다.<br/>
|
||||
2. 자동 업데이트등에서 FTP 정보를 이용할 수 있습니다.<br/>
|
||||
이 FTP정보는 files/config/ftp.config.php 파일내에 정보가 저장됩니다.<br/>
|
||||
그리고 설치 후 관리자 페이지에서 FTP 정보를 변경하거나 제거할 수 있습니다.<br />
|
||||
<strong>FTP 정보 노출을 원하지 않으시면 입력하지 않으셔도 됩니다</strong>
|
||||
";
|
||||
|
||||
$lang->msg_safe_mode_ftp_needed = "PHP의 safe_mode가 On일 경우 FTP 정보를 꼭 입력해주셔야 XE의 설치 및 사용이 가능합니다";
|
||||
$lang->msg_ftp_not_connected = "localhost로의 FTP 접속 오류가 발생하였습니다. ftp 포트 번호를 확인해주시거나 ftp 서비스가 가능한지 확인해주세요";
|
||||
$lang->msg_ftp_invalid_auth_info = "입력하신 FTP 정보로 로그인을 하지 못했습니다. FTP정보를 확인해주세요";
|
||||
$lang->msg_ftp_mkdir_fail = "FTP를 이용한 디렉토리 생성 명령을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_chmod_fail = "FTP를 이용한 디렉토리의 속성 변경을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_connect_success = "FTP 접속 및 인증 성공하였습니다";
|
||||
|
||||
|
||||
// Alert messages for Javascript using by XML filter
|
||||
$lang->filter->isnull = 'Please input a value for %s';
|
||||
$lang->filter->outofrange = 'Please align the text length of %s';
|
||||
|
|
|
|||
|
|
@ -235,6 +235,28 @@
|
|||
$lang->is_active = 'Activado';
|
||||
$lang->is_required = 'Espacio requerido';
|
||||
|
||||
// ftp 관련
|
||||
$lang->ftp_form_title = 'FTP 정보 입력';
|
||||
$lang->ftp = 'FTP';
|
||||
$lang->ftp_port = 'FTP port';
|
||||
$lang->cmd_check_ftp_connect = 'FTP 접속 확인';
|
||||
$lang->about_ftp_info = "
|
||||
FTP 정보는 다음의 경우에 이용될 수 있습니다.<br/>
|
||||
1. PHP의 safe_mode=On일 경우에 FTP 정보를 이용해서 XE를 정상적으로 동작할 수 있게 합니다.<br/>
|
||||
2. 자동 업데이트등에서 FTP 정보를 이용할 수 있습니다.<br/>
|
||||
이 FTP정보는 files/config/ftp.config.php 파일내에 정보가 저장됩니다.<br/>
|
||||
그리고 설치 후 관리자 페이지에서 FTP 정보를 변경하거나 제거할 수 있습니다.<br />
|
||||
<strong>FTP 정보 노출을 원하지 않으시면 입력하지 않으셔도 됩니다</strong>
|
||||
";
|
||||
|
||||
$lang->msg_safe_mode_ftp_needed = "PHP의 safe_mode가 On일 경우 FTP 정보를 꼭 입력해주셔야 XE의 설치 및 사용이 가능합니다";
|
||||
$lang->msg_ftp_not_connected = "localhost로의 FTP 접속 오류가 발생하였습니다. ftp 포트 번호를 확인해주시거나 ftp 서비스가 가능한지 확인해주세요";
|
||||
$lang->msg_ftp_invalid_auth_info = "입력하신 FTP 정보로 로그인을 하지 못했습니다. FTP정보를 확인해주세요";
|
||||
$lang->msg_ftp_mkdir_fail = "FTP를 이용한 디렉토리 생성 명령을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_chmod_fail = "FTP를 이용한 디렉토리의 속성 변경을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_connect_success = "FTP 접속 및 인증 성공하였습니다";
|
||||
|
||||
|
||||
// Mensajes de alerta para Javascript usando el filtro XML
|
||||
$lang->filter->isnull = 'Ingresar un valor para %s';
|
||||
$lang->filter->outofrange = 'Ajustar el largo del texto de %s';
|
||||
|
|
|
|||
|
|
@ -236,6 +236,28 @@
|
|||
$lang->is_active = 'Actif';
|
||||
$lang->is_required = 'Item essentielle';
|
||||
|
||||
// ftp 관련
|
||||
$lang->ftp_form_title = 'FTP 정보 입력';
|
||||
$lang->ftp = 'FTP';
|
||||
$lang->ftp_port = 'FTP port';
|
||||
$lang->cmd_check_ftp_connect = 'FTP 접속 확인';
|
||||
$lang->about_ftp_info = "
|
||||
FTP 정보는 다음의 경우에 이용될 수 있습니다.<br/>
|
||||
1. PHP의 safe_mode=On일 경우에 FTP 정보를 이용해서 XE를 정상적으로 동작할 수 있게 합니다.<br/>
|
||||
2. 자동 업데이트등에서 FTP 정보를 이용할 수 있습니다.<br/>
|
||||
이 FTP정보는 files/config/ftp.config.php 파일내에 정보가 저장됩니다.<br/>
|
||||
그리고 설치 후 관리자 페이지에서 FTP 정보를 변경하거나 제거할 수 있습니다.<br />
|
||||
<strong>FTP 정보 노출을 원하지 않으시면 입력하지 않으셔도 됩니다</strong>
|
||||
";
|
||||
|
||||
$lang->msg_safe_mode_ftp_needed = "PHP의 safe_mode가 On일 경우 FTP 정보를 꼭 입력해주셔야 XE의 설치 및 사용이 가능합니다";
|
||||
$lang->msg_ftp_not_connected = "localhost로의 FTP 접속 오류가 발생하였습니다. ftp 포트 번호를 확인해주시거나 ftp 서비스가 가능한지 확인해주세요";
|
||||
$lang->msg_ftp_invalid_auth_info = "입력하신 FTP 정보로 로그인을 하지 못했습니다. FTP정보를 확인해주세요";
|
||||
$lang->msg_ftp_mkdir_fail = "FTP를 이용한 디렉토리 생성 명령을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_chmod_fail = "FTP를 이용한 디렉토리의 속성 변경을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_connect_success = "FTP 접속 및 인증 성공하였습니다";
|
||||
|
||||
|
||||
// Messages d\'alerte de le Javascript qui est utilisé dans les filtres en XML
|
||||
$lang->filter->isnull = 'Entrez une valeur pour %s';
|
||||
$lang->filter->outofrange = 'Aligner la longueur du texte de %s';
|
||||
|
|
|
|||
|
|
@ -236,6 +236,28 @@
|
|||
$lang->is_active = 'Aktiv';
|
||||
$lang->is_required = 'Pflichtfeld';
|
||||
|
||||
// ftp 관련
|
||||
$lang->ftp_form_title = 'FTP 정보 입력';
|
||||
$lang->ftp = 'FTP';
|
||||
$lang->ftp_port = 'FTP port';
|
||||
$lang->cmd_check_ftp_connect = 'FTP 접속 확인';
|
||||
$lang->about_ftp_info = "
|
||||
FTP 정보는 다음의 경우에 이용될 수 있습니다.<br/>
|
||||
1. PHP의 safe_mode=On일 경우에 FTP 정보를 이용해서 XE를 정상적으로 동작할 수 있게 합니다.<br/>
|
||||
2. 자동 업데이트등에서 FTP 정보를 이용할 수 있습니다.<br/>
|
||||
이 FTP정보는 files/config/ftp.config.php 파일내에 정보가 저장됩니다.<br/>
|
||||
그리고 설치 후 관리자 페이지에서 FTP 정보를 변경하거나 제거할 수 있습니다.<br />
|
||||
<strong>FTP 정보 노출을 원하지 않으시면 입력하지 않으셔도 됩니다</strong>
|
||||
";
|
||||
|
||||
$lang->msg_safe_mode_ftp_needed = "PHP의 safe_mode가 On일 경우 FTP 정보를 꼭 입력해주셔야 XE의 설치 및 사용이 가능합니다";
|
||||
$lang->msg_ftp_not_connected = "localhost로의 FTP 접속 오류가 발생하였습니다. ftp 포트 번호를 확인해주시거나 ftp 서비스가 가능한지 확인해주세요";
|
||||
$lang->msg_ftp_invalid_auth_info = "입력하신 FTP 정보로 로그인을 하지 못했습니다. FTP정보를 확인해주세요";
|
||||
$lang->msg_ftp_mkdir_fail = "FTP를 이용한 디렉토리 생성 명령을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_chmod_fail = "FTP를 이용한 디렉토리의 속성 변경을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_connect_success = "FTP 접속 및 인증 성공하였습니다";
|
||||
|
||||
|
||||
// Alert Nachrichten für JavaScript unter Verwendung von XML-Filter
|
||||
$lang->filter->isnull = 'Bitte geben Sie einen Wert für% s';
|
||||
$lang->filter->outofrange = 'Bitte richten Sie die Textlänge von% s';
|
||||
|
|
|
|||
|
|
@ -236,6 +236,28 @@
|
|||
$lang->is_active = '活性化';
|
||||
$lang->is_required = '必須項目';
|
||||
|
||||
// ftp 관련
|
||||
$lang->ftp_form_title = 'FTP 정보 입력';
|
||||
$lang->ftp = 'FTP';
|
||||
$lang->ftp_port = 'FTP port';
|
||||
$lang->cmd_check_ftp_connect = 'FTP 접속 확인';
|
||||
$lang->about_ftp_info = "
|
||||
FTP 정보는 다음의 경우에 이용될 수 있습니다.<br/>
|
||||
1. PHP의 safe_mode=On일 경우에 FTP 정보를 이용해서 XE를 정상적으로 동작할 수 있게 합니다.<br/>
|
||||
2. 자동 업데이트등에서 FTP 정보를 이용할 수 있습니다.<br/>
|
||||
이 FTP정보는 files/config/ftp.config.php 파일내에 정보가 저장됩니다.<br/>
|
||||
그리고 설치 후 관리자 페이지에서 FTP 정보를 변경하거나 제거할 수 있습니다.<br />
|
||||
<strong>FTP 정보 노출을 원하지 않으시면 입력하지 않으셔도 됩니다</strong>
|
||||
";
|
||||
|
||||
$lang->msg_safe_mode_ftp_needed = "PHP의 safe_mode가 On일 경우 FTP 정보를 꼭 입력해주셔야 XE의 설치 및 사용이 가능합니다";
|
||||
$lang->msg_ftp_not_connected = "localhost로의 FTP 접속 오류가 발생하였습니다. ftp 포트 번호를 확인해주시거나 ftp 서비스가 가능한지 확인해주세요";
|
||||
$lang->msg_ftp_invalid_auth_info = "입력하신 FTP 정보로 로그인을 하지 못했습니다. FTP정보를 확인해주세요";
|
||||
$lang->msg_ftp_mkdir_fail = "FTP를 이용한 디렉토리 생성 명령을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_chmod_fail = "FTP를 이용한 디렉토리의 속성 변경을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_connect_success = "FTP 접속 및 인증 성공하였습니다";
|
||||
|
||||
|
||||
// xml filterで用いられているjavascript用のアラートメッセージ
|
||||
$lang->filter->isnull = '%sを入力してください';
|
||||
$lang->filter->outofrange = '%sの文字の長さを合わせてください';
|
||||
|
|
|
|||
|
|
@ -236,6 +236,27 @@
|
|||
$lang->is_active = '활성';
|
||||
$lang->is_required = '필수항목';
|
||||
|
||||
// ftp 관련
|
||||
$lang->ftp_form_title = 'FTP 정보 입력';
|
||||
$lang->ftp = 'FTP';
|
||||
$lang->ftp_port = 'FTP port';
|
||||
$lang->cmd_check_ftp_connect = 'FTP 접속 확인';
|
||||
$lang->about_ftp_info = "
|
||||
FTP 정보는 다음의 경우에 이용될 수 있습니다.<br/>
|
||||
1. PHP의 safe_mode=On일 경우에 FTP 정보를 이용해서 XE를 정상적으로 동작할 수 있게 합니다.<br/>
|
||||
2. 자동 업데이트등에서 FTP 정보를 이용할 수 있습니다.<br/>
|
||||
이 FTP정보는 files/config/ftp.config.php 파일내에 정보가 저장됩니다.<br/>
|
||||
그리고 설치 후 관리자 페이지에서 FTP 정보를 변경하거나 제거할 수 있습니다.<br />
|
||||
<strong>FTP 정보 노출을 원하지 않으시면 입력하지 않으셔도 됩니다</strong>
|
||||
";
|
||||
|
||||
$lang->msg_safe_mode_ftp_needed = "PHP의 safe_mode가 On일 경우 FTP 정보를 꼭 입력해주셔야 XE의 설치 및 사용이 가능합니다";
|
||||
$lang->msg_ftp_not_connected = "localhost로의 FTP 접속 오류가 발생하였습니다. ftp 포트 번호를 확인해주시거나 ftp 서비스가 가능한지 확인해주세요";
|
||||
$lang->msg_ftp_invalid_auth_info = "입력하신 FTP 정보로 로그인을 하지 못했습니다. FTP정보를 확인해주세요";
|
||||
$lang->msg_ftp_mkdir_fail = "FTP를 이용한 디렉토리 생성 명령을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_chmod_fail = "FTP를 이용한 디렉토리의 속성 변경을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_connect_success = "FTP 접속 및 인증 성공하였습니다";
|
||||
|
||||
// xml filter에서 사용되는 javascript용 alert msg
|
||||
$lang->filter->isnull = '%s의 값을 입력해주세요';
|
||||
$lang->filter->outofrange = '%s의 글자 길이를 맞추어 주세요.';
|
||||
|
|
|
|||
|
|
@ -233,6 +233,28 @@
|
|||
$lang->column_name = 'Имя колонки';
|
||||
$lang->column_title = 'Название колонки';
|
||||
$lang->default_value = 'Стандартное значение';
|
||||
|
||||
// ftp 관련
|
||||
$lang->ftp_form_title = 'FTP 정보 입력';
|
||||
$lang->ftp = 'FTP';
|
||||
$lang->ftp_port = 'FTP port';
|
||||
$lang->cmd_check_ftp_connect = 'FTP 접속 확인';
|
||||
$lang->about_ftp_info = "
|
||||
FTP 정보는 다음의 경우에 이용될 수 있습니다.<br/>
|
||||
1. PHP의 safe_mode=On일 경우에 FTP 정보를 이용해서 XE를 정상적으로 동작할 수 있게 합니다.<br/>
|
||||
2. 자동 업데이트등에서 FTP 정보를 이용할 수 있습니다.<br/>
|
||||
이 FTP정보는 files/config/ftp.config.php 파일내에 정보가 저장됩니다.<br/>
|
||||
그리고 설치 후 관리자 페이지에서 FTP 정보를 변경하거나 제거할 수 있습니다.<br />
|
||||
<strong>FTP 정보 노출을 원하지 않으시면 입력하지 않으셔도 됩니다</strong>
|
||||
";
|
||||
|
||||
$lang->msg_safe_mode_ftp_needed = "PHP의 safe_mode가 On일 경우 FTP 정보를 꼭 입력해주셔야 XE의 설치 및 사용이 가능합니다";
|
||||
$lang->msg_ftp_not_connected = "localhost로의 FTP 접속 오류가 발생하였습니다. ftp 포트 번호를 확인해주시거나 ftp 서비스가 가능한지 확인해주세요";
|
||||
$lang->msg_ftp_invalid_auth_info = "입력하신 FTP 정보로 로그인을 하지 못했습니다. FTP정보를 확인해주세요";
|
||||
$lang->msg_ftp_mkdir_fail = "FTP를 이용한 디렉토리 생성 명령을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_chmod_fail = "FTP를 이용한 디렉토리의 속성 변경을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_connect_success = "FTP 접속 및 인증 성공하였습니다";
|
||||
|
||||
$lang->is_active = 'Активно';
|
||||
$lang->is_required = 'Требуемое поле';
|
||||
|
||||
|
|
|
|||
|
|
@ -236,6 +236,28 @@
|
|||
$lang->is_active = '激活';
|
||||
$lang->is_required = '必填';
|
||||
|
||||
// ftp 관련
|
||||
$lang->ftp_form_title = 'FTP 정보 입력';
|
||||
$lang->ftp = 'FTP';
|
||||
$lang->ftp_port = 'FTP port';
|
||||
$lang->cmd_check_ftp_connect = 'FTP 접속 확인';
|
||||
$lang->about_ftp_info = "
|
||||
FTP 정보는 다음의 경우에 이용될 수 있습니다.<br/>
|
||||
1. PHP의 safe_mode=On일 경우에 FTP 정보를 이용해서 XE를 정상적으로 동작할 수 있게 합니다.<br/>
|
||||
2. 자동 업데이트등에서 FTP 정보를 이용할 수 있습니다.<br/>
|
||||
이 FTP정보는 files/config/ftp.config.php 파일내에 정보가 저장됩니다.<br/>
|
||||
그리고 설치 후 관리자 페이지에서 FTP 정보를 변경하거나 제거할 수 있습니다.<br />
|
||||
<strong>FTP 정보 노출을 원하지 않으시면 입력하지 않으셔도 됩니다</strong>
|
||||
";
|
||||
|
||||
$lang->msg_safe_mode_ftp_needed = "PHP의 safe_mode가 On일 경우 FTP 정보를 꼭 입력해주셔야 XE의 설치 및 사용이 가능합니다";
|
||||
$lang->msg_ftp_not_connected = "localhost로의 FTP 접속 오류가 발생하였습니다. ftp 포트 번호를 확인해주시거나 ftp 서비스가 가능한지 확인해주세요";
|
||||
$lang->msg_ftp_invalid_auth_info = "입력하신 FTP 정보로 로그인을 하지 못했습니다. FTP정보를 확인해주세요";
|
||||
$lang->msg_ftp_mkdir_fail = "FTP를 이용한 디렉토리 생성 명령을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_chmod_fail = "FTP를 이용한 디렉토리의 속성 변경을 실패하였습니다. FTP 서버의 설정을 확인해주세요";
|
||||
$lang->msg_ftp_connect_success = "FTP 접속 및 인증 성공하였습니다";
|
||||
|
||||
|
||||
// 在xml filter使用的 javascript用 alert msg
|
||||
$lang->filter->isnull = '请输入%s';
|
||||
$lang->filter->outofrange = '请确认%s字数';
|
||||
|
|
|
|||
522
libs/ftp.class.php
Normal file
522
libs/ftp.class.php
Normal file
|
|
@ -0,0 +1,522 @@
|
|||
<?php
|
||||
/*********************************************************************
|
||||
*
|
||||
* PHP FTP Client Class By TOMO ( groove@spencernetwork.org )
|
||||
*
|
||||
* - Version 0.12 (2002/01/11)
|
||||
* - This script is free but without any warranty.
|
||||
* - You can freely copy, use, modify or redistribute this script
|
||||
* for any purpose.
|
||||
* - But please do not erase this information!!.
|
||||
*
|
||||
********************************************************************/
|
||||
|
||||
/*********************************************************************
|
||||
* List of available functions
|
||||
* ftp_connect($server, $port = 21)
|
||||
* ftp_login($user, $pass)
|
||||
* ftp_pwd()
|
||||
* ftp_size($pathname)
|
||||
* ftp_mdtm($pathname)
|
||||
* ftp_systype()
|
||||
* ftp_cdup()
|
||||
* ftp_chdir($pathname)
|
||||
* ftp_delete($pathname)
|
||||
* ftp_rmdir($pathname)
|
||||
* ftp_mkdir($pathname)
|
||||
* ftp_file_exists($pathname)
|
||||
* ftp_rename($from, $to)
|
||||
* ftp_nlist($arg = "", $pathname = "")
|
||||
* ftp_rawlist($pathname = "")
|
||||
* ftp_get($localfile, $remotefile, $mode = 1)
|
||||
* ftp_put($remotefile, $localfile, $mode = 1)
|
||||
* ftp_site($command)
|
||||
* ftp_quit()
|
||||
*********************************************************************/
|
||||
|
||||
class ftp
|
||||
{
|
||||
/* Public variables */
|
||||
var $debug;
|
||||
var $umask;
|
||||
var $timeout;
|
||||
|
||||
/* Private variables */
|
||||
var $ftp_sock;
|
||||
var $ftp_resp;
|
||||
|
||||
/* Constractor */
|
||||
function ftp()
|
||||
{
|
||||
$this->debug = FALSE;
|
||||
$this->umask = 0022;
|
||||
$this->timeout = 30;
|
||||
|
||||
if (!defined("FTP_BINARY")) {
|
||||
define("FTP_BINARY", 1);
|
||||
}
|
||||
if (!defined("FTP_ASCII")) {
|
||||
define("FTP_ASCII", 0);
|
||||
}
|
||||
|
||||
$this->ftp_resp = "";
|
||||
}
|
||||
|
||||
/* Public functions */
|
||||
function ftp_connect($server, $port = 21)
|
||||
{
|
||||
$this->ftp_debug("Trying to ".$server.":".$port." ...\n");
|
||||
$this->ftp_sock = @fsockopen($server, $port, $errno, $errstr, $this->timeout);
|
||||
|
||||
if (!$this->ftp_sock || !$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : Cannot connect to remote host \"".$server.":".$port."\"\n");
|
||||
$this->ftp_debug("Error : fsockopen() ".$errstr." (".$errno.")\n");
|
||||
return FALSE;
|
||||
}
|
||||
$this->ftp_debug("Connected to remote host \"".$server.":".$port."\"\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function ftp_login($user, $pass)
|
||||
{
|
||||
$this->ftp_putcmd("USER", $user);
|
||||
if (!$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : USER command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->ftp_putcmd("PASS", $pass);
|
||||
if (!$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : PASS command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
$this->ftp_debug("Authentication succeeded\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function ftp_pwd()
|
||||
{
|
||||
$this->ftp_putcmd("PWD");
|
||||
if (!$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : PWD command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return ereg_replace("^[0-9]{3} \"(.+)\" .+\r\n", "\\1", $this->ftp_resp);
|
||||
}
|
||||
|
||||
function ftp_size($pathname)
|
||||
{
|
||||
$this->ftp_putcmd("SIZE", $pathname);
|
||||
if (!$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : SIZE command failed\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
return ereg_replace("^[0-9]{3} ([0-9]+)\r\n", "\\1", $this->ftp_resp);
|
||||
}
|
||||
|
||||
function ftp_mdtm($pathname)
|
||||
{
|
||||
$this->ftp_putcmd("MDTM", $pathname);
|
||||
if (!$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : MDTM command failed\n");
|
||||
return -1;
|
||||
}
|
||||
$mdtm = ereg_replace("^[0-9]{3} ([0-9]+)\r\n", "\\1", $this->ftp_resp);
|
||||
$date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");
|
||||
$timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);
|
||||
|
||||
return $timestamp;
|
||||
}
|
||||
|
||||
function ftp_systype()
|
||||
{
|
||||
$this->ftp_putcmd("SYST");
|
||||
if (!$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : SYST command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
$DATA = explode(" ", $this->ftp_resp);
|
||||
|
||||
return $DATA[1];
|
||||
}
|
||||
|
||||
function ftp_cdup()
|
||||
{
|
||||
$this->ftp_putcmd("CDUP");
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : CDUP command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_chdir($pathname)
|
||||
{
|
||||
$this->ftp_putcmd("CWD", $pathname);
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : CWD command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_delete($pathname)
|
||||
{
|
||||
$this->ftp_putcmd("DELE", $pathname);
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : DELE command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_rmdir($pathname)
|
||||
{
|
||||
$this->ftp_putcmd("RMD", $pathname);
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : RMD command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_mkdir($pathname)
|
||||
{
|
||||
$this->ftp_putcmd("MKD", $pathname);
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : MKD command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_file_exists($pathname)
|
||||
{
|
||||
if (!($remote_list = $this->ftp_nlist("-a"))) {
|
||||
$this->ftp_debug("Error : Cannot get remote file list\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
reset($remote_list);
|
||||
while (list(,$value) = each($remote_list)) {
|
||||
if ($value == $pathname) {
|
||||
$this->ftp_debug("Remote file ".$pathname." exists\n");
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
$this->ftp_debug("Remote file ".$pathname." does not exist\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function ftp_rename($from, $to)
|
||||
{
|
||||
$this->ftp_putcmd("RNFR", $from);
|
||||
if (!$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : RNFR command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
$this->ftp_putcmd("RNTO", $to);
|
||||
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : RNTO command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_nlist($arg = "", $pathname = "")
|
||||
{
|
||||
if (!($string = $this->ftp_pasv())) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if ($arg == "") {
|
||||
$nlst = "NLST";
|
||||
} else {
|
||||
$nlst = "NLST ".$arg;
|
||||
}
|
||||
$this->ftp_putcmd($nlst, $pathname);
|
||||
|
||||
$sock_data = $this->ftp_open_data_connection($string);
|
||||
if (!$sock_data || !$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : Cannot connect to remote host\n");
|
||||
$this->ftp_debug("Error : NLST command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
$this->ftp_debug("Connected to remote host\n");
|
||||
|
||||
while (!feof($sock_data)) {
|
||||
$list[] = ereg_replace("[\r\n]", "", fgets($sock_data, 512));
|
||||
}
|
||||
$this->ftp_close_data_connection($sock_data);
|
||||
$this->ftp_debug(implode("\n", $list));
|
||||
|
||||
if (!$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : NLST command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
function ftp_rawlist($pathname = "")
|
||||
{
|
||||
if (!($string = $this->ftp_pasv())) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->ftp_putcmd("LIST", $pathname);
|
||||
|
||||
$sock_data = $this->ftp_open_data_connection($string);
|
||||
if (!$sock_data || !$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : Cannot connect to remote host\n");
|
||||
$this->ftp_debug("Error : LIST command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->ftp_debug("Connected to remote host\n");
|
||||
|
||||
while (!feof($sock_data)) {
|
||||
$list[] = ereg_replace("[\r\n]", "", fgets($sock_data, 512));
|
||||
}
|
||||
$this->ftp_debug(implode("\n", $list));
|
||||
$this->ftp_close_data_connection($sock_data);
|
||||
|
||||
if (!$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : LIST command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return $list;
|
||||
}
|
||||
|
||||
function ftp_get($localfile, $remotefile, $mode = 1)
|
||||
{
|
||||
umask($this->umask);
|
||||
|
||||
if (@file_exists($localfile)) {
|
||||
$this->ftp_debug("Warning : local file will be overwritten\n");
|
||||
}
|
||||
|
||||
$fp = @fopen($localfile, "w");
|
||||
if (!$fp) {
|
||||
$this->ftp_debug("Error : Cannot create \"".$localfile."\"");
|
||||
$this->ftp_debug("Error : GET command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!$this->ftp_type($mode)) {
|
||||
$this->ftp_debug("Error : GET command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!($string = $this->ftp_pasv())) {
|
||||
$this->ftp_debug("Error : GET command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->ftp_putcmd("RETR", $remotefile);
|
||||
|
||||
$sock_data = $this->ftp_open_data_connection($string);
|
||||
if (!$sock_data || !$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : Cannot connect to remote host\n");
|
||||
$this->ftp_debug("Error : GET command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
$this->ftp_debug("Connected to remote host\n");
|
||||
$this->ftp_debug("Retrieving remote file \"".$remotefile."\" to local file \"".$localfile."\"\n");
|
||||
while (!feof($sock_data)) {
|
||||
fputs($fp, fread($sock_data, 4096));
|
||||
}
|
||||
fclose($fp);
|
||||
|
||||
$this->ftp_close_data_connection($sock_data);
|
||||
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : GET command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_put($remotefile, $localfile, $mode = 1)
|
||||
{
|
||||
|
||||
if (!@file_exists($localfile)) {
|
||||
$this->ftp_debug("Error : No such file or directory \"".$localfile."\"\n");
|
||||
$this->ftp_debug("Error : PUT command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$fp = @fopen($localfile, "r");
|
||||
if (!$fp) {
|
||||
$this->ftp_debug("Error : Cannot read file \"".$localfile."\"\n");
|
||||
$this->ftp_debug("Error : PUT command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!$this->ftp_type($mode)) {
|
||||
$this->ftp_debug("Error : PUT command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (!($string = $this->ftp_pasv())) {
|
||||
$this->ftp_debug("Error : PUT command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$this->ftp_putcmd("STOR", $remotefile);
|
||||
|
||||
$sock_data = $this->ftp_open_data_connection($string);
|
||||
if (!$sock_data || !$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : Cannot connect to remote host\n");
|
||||
$this->ftp_debug("Error : PUT command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
$this->ftp_debug("Connected to remote host\n");
|
||||
$this->ftp_debug("Storing local file \"".$localfile."\" to remote file \"".$remotefile."\"\n");
|
||||
while (!feof($fp)) {
|
||||
fputs($sock_data, fread($fp, 4096));
|
||||
}
|
||||
fclose($fp);
|
||||
|
||||
$this->ftp_close_data_connection($sock_data);
|
||||
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : PUT command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_site($command)
|
||||
{
|
||||
$this->ftp_putcmd("SITE", $command);
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : SITE command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_quit()
|
||||
{
|
||||
$this->ftp_putcmd("QUIT");
|
||||
if (!$this->ftp_ok() || !fclose($this->ftp_sock)) {
|
||||
$this->ftp_debug("Error : QUIT command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
$this->ftp_debug("Disconnected from remote host\n");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Private Functions */
|
||||
|
||||
function ftp_type($mode)
|
||||
{
|
||||
if ($mode) {
|
||||
$type = "I"; //Binary mode
|
||||
} else {
|
||||
$type = "A"; //ASCII mode
|
||||
}
|
||||
$this->ftp_putcmd("TYPE", $type);
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : TYPE command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_port($ip_port)
|
||||
{
|
||||
$this->ftp_putcmd("PORT", $ip_port);
|
||||
$response = $this->ftp_ok();
|
||||
if (!$response) {
|
||||
$this->ftp_debug("Error : PORT command failed\n");
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
function ftp_pasv()
|
||||
{
|
||||
$this->ftp_putcmd("PASV");
|
||||
if (!$this->ftp_ok()) {
|
||||
$this->ftp_debug("Error : PASV command failed\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$ip_port = ereg_replace("^.+ \\(?([0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+)\\)?.*\r\n$", "\\1", $this->ftp_resp);
|
||||
return $ip_port;
|
||||
}
|
||||
|
||||
function ftp_putcmd($cmd, $arg = "")
|
||||
{
|
||||
if ($arg != "") {
|
||||
$cmd = $cmd." ".$arg;
|
||||
}
|
||||
|
||||
fputs($this->ftp_sock, $cmd."\r\n");
|
||||
$this->ftp_debug("> ".$cmd."\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function ftp_ok()
|
||||
{
|
||||
$this->ftp_resp = "";
|
||||
do {
|
||||
$res = fgets($this->ftp_sock, 512);
|
||||
$this->ftp_resp .= $res;
|
||||
} while (substr($res, 3, 1) != " ");
|
||||
|
||||
$this->ftp_debug(str_replace("\r\n", "\n", $this->ftp_resp));
|
||||
|
||||
if (!ereg("^[123]", $this->ftp_resp)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
function ftp_close_data_connection($sock)
|
||||
{
|
||||
$this->ftp_debug("Disconnected from remote host\n");
|
||||
return fclose($sock);
|
||||
}
|
||||
|
||||
function ftp_open_data_connection($ip_port)
|
||||
{
|
||||
if (!ereg("[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]{1,3},[0-9]+,[0-9]+", $ip_port)) {
|
||||
$this->ftp_debug("Error : Illegal ip-port format(".$ip_port.")\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
$DATA = explode(",", $ip_port);
|
||||
$ipaddr = $DATA[0].".".$DATA[1].".".$DATA[2].".".$DATA[3];
|
||||
$port = $DATA[4]*256 + $DATA[5];
|
||||
$this->ftp_debug("Trying to ".$ipaddr.":".$port." ...\n");
|
||||
$data_connection = @fsockopen($ipaddr, $port, $errno, $errstr);
|
||||
if (!$data_connection) {
|
||||
$this->ftp_debug("Error : Cannot open data connection to ".$ipaddr.":".$port."\n");
|
||||
$this->ftp_debug("Error : ".$errstr." (".$errno.")\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return $data_connection;
|
||||
}
|
||||
|
||||
function ftp_debug($message = "")
|
||||
{
|
||||
if ($this->debug) {
|
||||
echo $message;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -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']);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -409,7 +409,7 @@ class HTTPRetriever {
|
|||
|
||||
if ($this->caching_highvolume) {
|
||||
$cache_dir .= substr($token,0,2) . '/';
|
||||
if (!is_dir($cache_dir)) @mkdir($cache_dir);
|
||||
if (!is_dir($cache_dir)) @FileHandler::makeDir($cache_dir);
|
||||
}
|
||||
|
||||
$filename = $cache_dir.$token.'.tmp';
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@
|
|||
{
|
||||
if(!file_exists($this->cachedir))
|
||||
{
|
||||
mkdir($this->cachedir);
|
||||
FileHandler::makeDir($this->cachedir);
|
||||
}
|
||||
$fp = fopen($this->cachedir.$this->cachefile, "w");
|
||||
fwrite($fp, "aa");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue