mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue