english comments added

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0_english@8278 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
mosmartin 2011-04-06 16:48:06 +00:00
parent 693e215bc1
commit 4d272994dd
219 changed files with 6407 additions and 8705 deletions

View file

@ -2,35 +2,33 @@
/**
* @class addonAdminController
* @author NHN (developers@xpressengine.com)
* @brief addon 모듈의 admin controller class
* @brief admin controller class of addon modules
**/
include_once('addon.controller.php');
class addonAdminController extends addonController {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 애드온의 활성/비활성 체인지
* @brief Add active/inactive change
**/
function procAddonAdminToggleActivate() {
$oAddonModel = &getAdminModel('addon');
$site_module_info = Context::get('site_module_info');
// addon값을 받아옴
// batahom addon values
$addon = Context::get('addon');
$type = Context::get('type');
if(!$type) $type = "pc";
if($addon) {
// 활성화 되어 있으면 비활성화 시킴
// If enabled Disables
if($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type)) $this->doDeactivate($addon, $site_module_info->site_srl, $type);
// 비활성화 되어 있으면 활성화 시킴
// If it is disabled Activate
else $this->doActivate($addon, $site_module_info->site_srl, $type);
}
@ -38,7 +36,7 @@
}
/**
* @brief 애드온 설정 정보 입력
* @brief Add the configuration information input
**/
function procAddonAdminSetupAddon() {
$args = Context::getRequestVars();
@ -59,8 +57,8 @@
/**
* @brief 애드온 추가
* DB에 애드온을 추가함
* @brief Add-on
* Adds Add to DB
**/
function doInsert($addon, $site_srl = 0) {
$args->addon = $addon;
@ -71,8 +69,8 @@
}
/**
* @brief 애드온 활성화
* addons라는 테이블에 애드온의 활성화 상태를 on 시켜줌
* @brief Add-activated
* addons add-ons to the table on the activation state sikyeojum
**/
function doActivate($addon, $site_srl = 0, $type = "pc") {
$args->addon = $addon;
@ -84,9 +82,9 @@
}
/**
* @brief 애드온 비활성화
* @brief Disable Add-ons
*
* addons라는 테이블에 애드온의 이름을 제거하는 것으로 비활성화를 시키게 된다
* addons add a table to remove the name of the deactivation is sikige
**/
function doDeactivate($addon, $site_srl = 0, $type = "pc") {
$args->addon = $addon;

View file

@ -2,19 +2,19 @@
/**
* @class addonAdminModel
* @author NHN (developers@xpressengine.com)
* @brief addon 모듈의 admin model class
* @brief admin model class of addon modules
**/
class addonAdminModel extends addon {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 애드온의 경로를 구함
* @brief Wanted to add the path to
**/
function getAddonPath($addon_name) {
$class_path = sprintf('./addons/%s/', $addon_name);
@ -23,27 +23,24 @@
}
/**
* @brief 애드온의 종류와 정보를 구함
* @brief Wanted to add the kind of information and
**/
function getAddonList($site_srl = 0) {
// activated된 애드온 목록을 구함
// Wanted to add a list of activated
$inserted_addons = $this->getInsertedAddons($site_srl);
// 다운받은 애드온과 설치된 애드온의 목록을 구함
// Downloaded and installed add-on to the list of Wanted
$searched_list = FileHandler::readDir('./addons');
$searched_count = count($searched_list);
if(!$searched_count) return;
sort($searched_list);
for($i=0;$i<$searched_count;$i++) {
// 애드온의 이름
// Add the name of
$addon_name = $searched_list[$i];
if($addon_name == "smartphone") continue;
// 애드온의 경로 (files/addons가 우선)
// Add the path (files/addons precedence)
$path = $this->getAddonPath($addon_name);
// 해당 애드온의 정보를 구함
// Wanted information on the add-on
unset($info);
$info = $this->getAddonInfoXml($addon_name, $site_srl);
@ -51,14 +48,12 @@
$info->path = $path;
$info->activated = false;
$info->mactivated = false;
// DB에 입력되어 있는지 확인
// Check if a permossion is granted entered in DB
if(!in_array($addon_name, array_keys($inserted_addons))) {
// DB에 입력되어 있지 않으면 입력 (model에서 이런짓 하는거 싫지만 귀찮아서.. ㅡ.ㅜ)
// If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ)
$oAddonAdminController = &getAdminController('addon');
$oAddonAdminController->doInsert($addon_name, $site_srl);
// 활성화 되어 있는지 확인
// Is activated
} else {
if($inserted_addons[$addon_name]->is_used=='Y') $info->activated = true;
if($inserted_addons[$addon_name]->is_used_m=='Y') $info->mactivated = true;
@ -70,14 +65,13 @@
}
/**
* @brief 모듈의 conf/info.xml 읽어서 정보를 구함
* @brief Modules conf/info.xml wanted to read the information
**/
function getAddonInfoXml($addon, $site_srl = 0) {
// 요청된 모듈의 경로를 구한다. 없으면 return
// Get a path of the requested module. Return if not exists.
$addon_path = $this->getAddonPath($addon);
if(!$addon_path) return;
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
// Read the xml file for module skin information
$xml_file = sprintf("%sconf/info.xml", $addon_path);
if(!file_exists($xml_file)) return;
@ -88,7 +82,7 @@
if(!$xml_obj) return;
// DB에 설정된 내역을 가져온다
// DB is set to bring history
$db_args->addon = $addon;
if(!$site_srl) $output = executeQuery('addon.getAddonInfo',$db_args);
else {
@ -104,7 +98,7 @@
}
// 애드온 정보
// Add information
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
// addon format v0.2
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
@ -129,7 +123,7 @@
$addon_info->author[] = $author_obj;
}
// 확장변수를 정리
// Expand the variable order
if($xml_obj->extra_vars) {
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
@ -152,7 +146,7 @@
if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
// 'select'type에서 option목록을 구한다.
// 'Select'type obtained from the option list.
if(is_array($val->options)) {
$option_count = count($val->options);
@ -227,7 +221,7 @@
$addon_info->author[] = $author_obj;
if($xml_obj->extra_vars) {
// 확장변수를 정리
// Expand the variable order
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
@ -247,8 +241,7 @@
$obj->value = $extra_vals->{$obj->name};
if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
// 'select'type에서 option목록을 구한다.
// 'Select'type obtained from the option list.
if(is_array($val->options)) {
$option_count = count($val->options);
@ -271,7 +264,7 @@
}
/**
* @brief 활성화된 애드온 목록을 구해옴
* @brief Add to the list of active guhaeom
**/
function getInsertedAddons($site_srl = 0) {
$args->list_order = 'addon';
@ -292,7 +285,7 @@
}
/**
* @brief 애드온이 활성화 되어 있는지 체크
* @brief Add-on is enabled, check whether
**/
function isActivatedAddon($addon, $site_srl = 0, $type = "pc") {
$args->addon = $addon;

View file

@ -2,57 +2,51 @@
/**
* @class addonAdminView
* @author NHN (developers@xpressengine.com)
* @brief addon 모듈의 admin view class
* @brief admin view class of addon modules
**/
class addonAdminView extends addon {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 애드온 관리 메인 페이지 (목록 보여줌)
* @brief Add Management main page (showing the list)
**/
function dispAddonAdminIndex() {
$site_module_info = Context::get('site_module_info');
// 애드온 목록을 세팅
// Add to the list settings
$oAddonModel = &getAdminModel('addon');
$addon_list = $oAddonModel->getAddonList($site_module_info->site_srl);
Context::set('addon_list', $addon_list);
// 템플릿 패스 및 파일을 지정
// Template specifies the path and file
$this->setTemplateFile('addon_list');
}
/**
* @biref 애드온 세부 설정 팝업 출력
* @biref Setting out the details pop-up add-on
**/
function dispAddonAdminSetup() {
$site_module_info = Context::get('site_module_info');
// 요청된 애드온을 구함
// Wanted to add the requested
$selected_addon = Context::get('selected_addon');
// 요청된 애드온의 정보를 구함
// Wanted to add the requested information
$oAddonModel = &getAdminModel('addon');
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl);
Context::set('addon_info', $addon_info);
// mid 목록을 가져옴
// Get a mid list
$oModuleModel = &getModel('module');
$oModuleAdminModel = &getAdminModel('module');
if($site_module_info->site_srl) $args->site_srl = $site_module_info->site_srl;
$mid_list = $oModuleModel->getMidList($args);
// module_category와 module의 조합
// module_category and module combination
if(!$site_module_info->site_srl) {
// 모듈 카테고리 목록을 구함
// Get a list of module categories
$module_categories = $oModuleModel->getModuleCategories();
if($mid_list) {
@ -65,32 +59,26 @@
}
Context::set('mid_list',$module_categories);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 패스 및 파일을 지정
// Template specifies the path and file
$this->setTemplateFile('setup_addon');
}
/**
* @brief 애드온의 상세 정보(conf/info.xml) 팝업 출력
* @brief Add details (conf/info.xml) a pop-out
**/
function dispAddonAdminInfo() {
$site_module_info = Context::get('site_module_info');
// 요청된 애드온을 구함
// Wanted to add the requested
$selected_addon = Context::get('selected_addon');
// 요청된 애드온의 정보를 구함
// Wanted to add the requested information
$oAddonModel = &getAdminModel('addon');
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl);
Context::set('addon_info', $addon_info);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 패스 및 파일을 지정
// Template specifies the path and file
$this->setTemplateFile('addon_info');
}

View file

@ -2,16 +2,16 @@
/**
* @class addon
* @author NHN (developers@xpressengine.com)
* @brief addon 모듈의 high class
* @brief high class of addon modules
**/
class addon extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// 몇가지 애드온을 등록
// Register to add a few
$oAddonController = &getAdminController('addon');
$oAddonController->doInsert('autolink');
$oAddonController->doInsert('blogapi');
@ -23,8 +23,7 @@
$oAddonController->doInsert('resize_image');
$oAddonController->doInsert('openid_delegation_id');
$oAddonController->doInsert('point_level_icon');
// 몇가지 애드온을 기본 활성화 상태로 변경
// To add a few changes to the default activation state
$oAddonController->doActivate('autolink');
$oAddonController->doActivate('counter');
$oAddonController->doActivate('member_communication');
@ -37,7 +36,7 @@
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oDB = &DB::getInstance();
@ -47,7 +46,7 @@
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
@ -61,7 +60,7 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
FileHandler::removeFilesInDir('./files/cache/addons');

View file

@ -2,20 +2,20 @@
/**
* @class addonController
* @author NHN (developers@xpressengine.com)
* @brief addon 모듈의 controller class
* @brief addon module's controller class
**/
class addonController extends addon {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 메인/ 가상 사이트별 애드온 캐시 파일의 위치를 구함
* @brief Main/Virtual-specific add-on file, the location of the cache Wanted
**/
function getCacheFilePath($type = "pc") {
$site_module_info = Context::get('site_module_info');
@ -36,7 +36,7 @@
/**
* @brief 애드온 mid 추가 설정
* @brief Add-on mid settings
**/
function _getMidList($selected_addon, $site_srl = 0) {
@ -48,11 +48,10 @@
/**
* @brief 애드온 mid 추가 설정
* @brief Add-on mid settings
**/
function _setAddMid($selected_addon,$mid, $site_srl=0) {
// 요청된 애드온의 정보를 구함
// Wanted to add the requested information
$mid_list = $this->_getMidList($selected_addon, $site_srl);
$mid_list[] = $mid;
@ -62,11 +61,10 @@
/**
* @brief 애드온 mid 추가 설정
* @brief Add-on mid settings
**/
function _setDelMid($selected_addon,$mid,$site_srl=0) {
// 요청된 애드온의 정보를 구함
// Wanted to add the requested information
$mid_list = $this->_getMidList($selected_addon,$site_srl);
$new_mid_list = array();
@ -83,7 +81,7 @@
}
/**
* @brief 애드온 mid 추가 설정
* @brief Add-on mid settings
**/
function _setMid($selected_addon,$mid_list,$site_srl=0) {
$args->mid_list = join('|@|',$mid_list);
@ -93,7 +91,7 @@
/**
* @brief 애드온 mid 추가
* @brief Add mid-on
**/
function procAddonSetupAddonAddMid() {
$site_module_info = Context::get('site_module_info');
@ -105,7 +103,7 @@
}
/**
* @brief 애드온 mid 삭제
* @brief Add mid Delete
**/
function procAddonSetupAddonDelMid() {
$site_module_info = Context::get('site_module_info');
@ -118,10 +116,10 @@
}
/**
* @brief 캐시 파일 생성
* @brief Re-generate the cache file
**/
function makeCacheFile($site_srl = 0, $type = "pc") {
// 모듈에서 애드온을 사용하기 위한 캐시 파일 생성
// Add-on module for use in creating the cache file
$buff = "";
$oAddonModel = &getAdminModel('addon');
$addon_list = $oAddonModel->getInsertedAddons($site_srl, $type);
@ -155,7 +153,7 @@
}
/**
* @brief 애드온 설정
* @brief Add-On Set
**/
function doSetup($addon, $extra_vars,$site_srl=0) {
if($extra_vars->mid_list) $extra_vars->mid_list = explode('|@|', $extra_vars->mid_list);
@ -167,7 +165,7 @@
}
/**
* @brief 가상 사이트에서의 애드온 정보 제거
* @brief Remove add-on information in the virtual site
**/
function removeAddonConfig($site_srl) {
$addon_path = _XE_PATH_.'files/cache/addons/';

View file

@ -150,8 +150,7 @@
$oAddonModel = &getAdminModel('addon');
$addon_list = $oAddonModel->getAddonList();
Context::set('addon_list', $addon_list);
// 방문자수
// Visitors
$time = time();
$w = date("D");
while(date("D",$time) != "Sat") {
@ -193,20 +192,17 @@
$status->week[date("Y.m.d",$i)]->this = (int)$visitors[date("Ymd",$i)];
$status->week[date("Y.m.d",$i)]->last = (int)$visitors[date("Ymd",$i-60*60*24*7)];
}
// 각종 통계 정보를 구함
// Wanted various statistical information
$output = executeQuery('admin.getTotalVisitors');
$status->total_visitor = $output->data->count;
$output = executeQuery('admin.getTotalSiteVisitors');
$status->total_visitor += $output->data->count;
$status->visitor = $visitors[date("Ymd")];
// 오늘의 댓글 수
// Today's Number of Comments
$args->regdate = date("Ymd");
$output = executeQuery('admin.getTodayCommentCount', $args);
$status->comment_count = $output->data->count;
// 오늘의 엮인글 수
// Today Wed yeokingeul
$args->regdate = date("Ymd");
$output = executeQuery('admin.getTodayTrackbackCount', $args);
$status->trackback_count = $output->data->count;

View file

@ -2,7 +2,7 @@
/**
* @class autoinstallAdminController
* @author NHN (developers@xpressengine.com)
* @brief autoinstall 모듈의 admin controller class
* @brief autoinstall module admin controller class
**/
require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php');
@ -10,7 +10,7 @@
class autoinstallAdminController extends autoinstall {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}

View file

@ -2,7 +2,7 @@
/**
* @class autoinstallAdminView
* @author NHN (developers@xpressengine.com)
* @brief autoinstall 모듈의 admin view class
* @brief admin view class in the autoinstall module
**/

View file

@ -2,7 +2,7 @@
/**
* @class autoinstall
* @author NHN (developers@xpressengine.com)
* @brief autoinstall 모듈의 high class
* @brief high class of the autoinstall module
**/
class XmlGenerater {
@ -36,13 +36,13 @@
var $tmp_dir = './files/cache/autoinstall/';
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief for additional tasks required when installing
**/
function moduleInstall() {
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief method to check if installation is succeeded
**/
function checkUpdate() {
$oDB =& DB::getInstance();
@ -61,7 +61,7 @@
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB =& DB::getInstance();
@ -79,7 +79,7 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
}

View file

@ -2,7 +2,7 @@
/**
* @class autoinstallModel
* @author NHN (developers@xpressengine.com)
* @brief autoinstall 모듈의 Model class
* @brief Model class of the autoinstall module
**/
class autoinstallModel extends autoinstall {

View file

@ -3,13 +3,13 @@
/**
* @class autoinstallView
* @author NHN (developers@xpressengine.com)
* @brief autoinstall 모듈의 View class
* @brief View class of the autoinstall module
**/
class autoinstallView extends autoinstall {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}

View file

@ -2,23 +2,22 @@
/**
* @class commentAdminController
* @author NHN (developers@xpressengine.com)
* @brief comment 모듈의 admin controller class
* @brief admin controller class of the comment module
**/
class commentAdminController extends comment {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 관리자 페이지에서 선택된 댓글들을 삭제
* @brief Delete the selected comment from the administrator page
**/
function procCommentAdminDeleteChecked() {
// 선택된 글이 없으면 오류 표시
// Error display if none is selected
$cart = Context::get('cart');
if(!$cart) return $this->stop('msg_cart_is_null');
$comment_srl_list= explode('|@|', $cart);
@ -28,8 +27,7 @@
$oCommentController = &getController('comment');
$deleted_count = 0;
// 글삭제
// Delete the comment posting
for($i=0;$i<$comment_count;$i++) {
$comment_srl = trim($comment_srl_list[$i]);
if(!$comment_srl) continue;
@ -44,7 +42,7 @@
}
/**
* @brief 신고대상을 취소 시킴
* @brief cancel the blacklist of abused comments reported by other users
**/
function procCommentAdminCancelDeclare() {
$comment_srl = trim(Context::get('comment_srl'));
@ -57,7 +55,7 @@
}
/**
* @brief 특정 모듈의 모든 댓글 삭제
* @brief delete all comments of the specific module
**/
function deleteModuleComments($module_srl) {
$args->module_srl = $module_srl;

View file

@ -2,59 +2,57 @@
/**
* @class commentAdminView
* @author NHN (developers@xpressengine.com)
* @brief comment 모듈의 admin view 클래스
* @brief admin view class of the comment module
**/
class commentAdminView extends comment {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 목록 출력 (관리자용)
* @brief Display the list(for administrators)
**/
function dispCommentAdminList() {
// 목록을 구하기 위한 옵션
$args->page = Context::get('page'); ///< 페이지
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
// option to get a list
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // / the number of postings to appear on a single page
$args->page_count = 10; // / the number of pages to appear on the page navigation
$args->sort_index = 'list_order'; ///< 소팅 값
$args->sort_index = 'list_order'; // /< Sorting values
$args->module_srl = Context::get('module_srl');
// 목록 구함, comment->getCommentList 에서 걍 알아서 다 해버리는 구조이다... (아.. 이거 나쁜 버릇인데.. ㅡ.ㅜ 어쩔수 없다)
// get a list by using comment->getCommentList.
$oCommentModel = &getModel('comment');
$output = $oCommentModel->getTotalCommentList($args);
// 템플릿에 쓰기 위해서 comment_model::getTotalCommentList() 의 return object에 있는 값들을 세팅
// set values in the return object of comment_model:: getTotalCommentList() in order to use a template.
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('comment_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
// 템플릿 지정
// set the template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('comment_list');
}
/**
* @brief 관리자 페이지의 신고 목록 보기
* @brief show the blacklist of comments in the admin page
**/
function dispCommentAdminDeclared() {
// 목록을 구하기 위한 옵션
$args->page = Context::get('page'); ///< 페이지
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
// option to get a blacklist
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< the number of comment postings to appear on a single page
$args->page_count = 10; // /< the number of pages to appear on the page navigation
$args->sort_index = 'comment_declared.declared_count'; ///< 소팅 값
$args->order_type = 'desc'; ///< 소팅 정렬 값
$args->sort_index = 'comment_declared.declared_count'; // /< sorting values
$args->order_type = 'desc'; // /< sorted value
// 목록을 구함
// get a list
$declared_output = executeQuery('comment.getDeclaredList', $args);
if($declared_output->data && count($declared_output->data)) {
@ -68,14 +66,13 @@
$declared_output->data = $comment_list;
}
// 템플릿에 쓰기 위해서 comment_model::getCommentList() 의 return object에 있는 값들을 세팅
// set values in the return object of comment_model:: getCommentList() in order to use a template.
Context::set('total_count', $declared_output->total_count);
Context::set('total_page', $declared_output->total_page);
Context::set('page', $declared_output->page);
Context::set('comment_list', $declared_output->data);
Context::set('page_navigation', $declared_output->page_navigation);
// 템플릿 지정
// set the template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('declared_list');
}

View file

@ -2,7 +2,7 @@
/**
* @class comment
* @author NHN (developers@xpressengine.com)
* @brief comment 모듈의 high class
* @brief comment module's high class
**/
require_once(_XE_PATH_.'modules/comment/comment.item.php');
@ -10,45 +10,37 @@
class comment extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief implemented if additional tasks are required when installing
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
// register the action forward (for using on the admin mode)
$oModuleController = &getController('module');
// 2007. 10. 17 게시글이 삭제될때 댓글도 삭제되도록 trigger 등록
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
// 2007. 10. 17 모듈이 삭제될때 등록된 댓글도 모두 삭제하는 트리거 추가
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
// 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가
// 2008. 02. 22 add comment setting when a new module added
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief method to check if installation is succeeded
**/
function checkUpdate() {
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
// 2007. 10. 17 게시글이 삭제될때 댓글도 삭제되도록 trigger 등록
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) return true;
// 2007. 10. 17 모듈이 삭제될때 등록된 댓글도 모두 삭제하는 트리거 추가
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) return true;
// 2007. 10. 23 댓글에도 추천/ 알림 기능을 위한 컬럼 추가
// 2007. 10. 23 add a column for recommendation votes or notification of the comments
if(!$oDB->isColumnExists("comments","voted_count")) return true;
if(!$oDB->isColumnExists("comments","notify_message")) return true;
// 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가
// 2008. 02. 22 add comment setting when a new module added
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) return true;
// 2008. 05. 14 blamed count 컬럼 추가
// 2008. 05. 14 add a column for blamed count
if(!$oDB->isColumnExists("comments", "blamed_count")) return true;
if(!$oDB->isColumnExists("comment_voted_log", "point")) return true;
@ -56,22 +48,19 @@
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// 2007. 10. 17 게시글이 삭제될때 댓글도 삭제되도록 trigger 등록
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
// 2007. 10. 17 모듈이 삭제될때 등록된 댓글도 모두 삭제하는 트리거 추가
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
// 2007. 10. 23 댓글에도 추천/ 알림 기능을 위한 컬럼 추가
// 2007. 10. 23 add a column for recommendation votes or notification of the comments
if(!$oDB->isColumnExists("comments","voted_count")) {
$oDB->addColumn("comments","voted_count", "number","11");
$oDB->addIndex("comments","idx_voted_count", array("voted_count"));
@ -80,12 +69,10 @@
if(!$oDB->isColumnExists("comments","notify_message")) {
$oDB->addColumn("comments","notify_message", "char","1");
}
// 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가
// 2008. 02. 22 add comment setting when a new module added
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
// 2008. 05. 14 blamed count 컬럼 추가
// 2008. 05. 14 add a column for blamed count
if(!$oDB->isColumnExists("comments", "blamed_count")) {
$oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, true);
$oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count'));
@ -97,7 +84,7 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Regenerate cache file
**/
function recompileCache() {
}

View file

@ -2,19 +2,19 @@
/**
* @class commentController
* @author NHN (developers@xpressengine.com)
* @brief comment 모듈의 controller class
* @brief controller class of the comment module
**/
class commentController extends comment {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 댓글의 추천을 처리하는 action (Up)
* @brief action to handle recommendation votes on comments (Up)
**/
function procCommentVoteUp() {
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
@ -36,7 +36,7 @@
}
/**
* @brief 댓글의 추천을 처리하는 action (Down)
* @brief action to handle recommendation votes on comments (Down)
**/
function procCommentVoteDown() {
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
@ -58,7 +58,7 @@
}
/**
* @brief 댓글이 신고될 경우 호출되는 action
* @brief action to be called when a comment posting is reported
**/
function procCommentDeclare() {
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
@ -70,7 +70,7 @@
}
/**
* @brief document삭제시 해당 document의 댓글을 삭제하는 trigger
* @brief trigger to delete its comments together with document deleted
**/
function triggerDeleteDocumentComments(&$obj) {
$document_srl = $obj->document_srl;
@ -80,7 +80,7 @@
}
/**
* @brief module 삭제시 해당 댓글을 모두 삭제하는 trigger
* @brief trigger to delete corresponding comments when deleting a module
**/
function triggerDeleteModuleComments(&$obj) {
$module_srl = $obj->module_srl;
@ -91,32 +91,30 @@
}
/**
* @brief 코멘트의 권한 부여
* 세션값으로 접속상태에서만 사용 가능
* @brief Authorization of the comments
* available only in the current connection of the session value
**/
function addGrant($comment_srl) {
$_SESSION['own_comment'][$comment_srl] = true;
}
/**
* @brief 댓글 입력
* @brief Enter comments
**/
function insertComment($obj, $manual_inserted = false) {
$obj->__isupdate = false;
// trigger 호출 (before)
// call a trigger (before)
$output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj);
if(!$output->toBool()) return $output;
// document_srl에 해당하는 글이 있는지 확인
// check if a posting of the corresponding document_srl exists
$document_srl = $obj->document_srl;
if(!$document_srl) return new Object(-1,'msg_invalid_document');
// document model 객체 생성
// get a object of document model
$oDocumentModel = &getModel('document');
// even for manual_inserted if password exists, md5 it.
if($obj->password) $obj->password = md5($obj->password);
// 원본글을 가져옴
// get the original posting
if(!$manual_inserted) {
$oDocument = $oDocumentModel->getDocument($document_srl);
@ -124,8 +122,7 @@
if($oDocument->isLocked()) return new Object(-1,'msg_invalid_request');
if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage;
// 로그인 된 회원일 경우 회원의 정보를 입력
// input the member's information if logged-in
if(Context::get('is_logged')) {
$logged_info = Context::get('logged_info');
$obj->member_srl = $logged_info->member_srl;
@ -136,24 +133,20 @@
$obj->homepage = $logged_info->homepage;
}
}
// 로그인정보가 없고 사용자 이름이 없으면 오류 표시
// error display if neither of log-in info and user name exist.
if(!$logged_info->member_srl && !$obj->nick_name) return new Object(-1,'msg_invalid_request');
if(!$obj->comment_srl) $obj->comment_srl = getNextSequence();
// 순서를 정함
// determine the order
$obj->list_order = getNextSequence() * -1;
// 내용에서 XE만의 태그를 삭제
// remove XE's own tags from the contents
$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
if(Mobile::isFromMobilePhone())
{
$obj->content = nl2br(htmlspecialchars($obj->content));
}
if(!$obj->regdate) $obj->regdate = date("YmdHis");
// 세션에서 최고 관리자가 아니면 iframe, script 제거
// remove iframe and script if not a top administrator on the session.
if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
if(!$obj->notify_message) $obj->notify_message = 'N';
@ -162,38 +155,32 @@
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 댓글 목록 부분을 먼저 입력
// Enter a list of comments first
$list_args->comment_srl = $obj->comment_srl;
$list_args->document_srl = $obj->document_srl;
$list_args->module_srl = $obj->module_srl;
$list_args->regdate = $obj->regdate;
// 부모댓글이 없으면 바로 데이터를 설정
// If parent comment doesn't exist, set data directly
if(!$obj->parent_srl) {
$list_args->head = $list_args->arrange = $obj->comment_srl;
$list_args->depth = 0;
// 부모댓글이 있으면 부모글의 정보를 구해옴
// If parent comment exists, get information of the parent comment
} else {
// 부모댓글의 정보를 구함
// get information of the parent comment posting
$parent_args->comment_srl = $obj->parent_srl;
$parent_output = executeQuery('comment.getCommentListItem', $parent_args);
// 부모댓글이 존재하지 않으면 return
// return if no parent comment exists
if(!$parent_output->toBool() || !$parent_output->data) return;
$parent = $parent_output->data;
$list_args->head = $parent->head;
$list_args->depth = $parent->depth+1;
// depth가 2단계 미만이면 별도의 update문 없이 insert만으로 쓰레드 정리
// if the depth of comments is less than 2, execute insert.
if($list_args->depth<2) {
$list_args->arrange = $obj->comment_srl;
// depth가 2단계 이상이면 반업데이트 실행
// if the depth of comments is greater than 2, execute update.
} else {
// 부모 댓글과 같은 head를 가지고 depth가 같거나 작은 댓글중 제일 위 댓글을 구함
// get the top listed comment among those in lower depth and same head with parent's.
$p_args->head = $parent->head;
$p_args->arrange = $parent->arrange;
$p_args->depth = $parent->depth;
@ -211,31 +198,23 @@
$output = executeQuery('comment.insertCommentList', $list_args);
if(!$output->toBool()) return $output;
// 댓글 본문을 입력
// insert comment
$output = executeQuery('comment.insertComment', $obj);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// comment model객체 생성
// creat the comment model object
$oCommentModel = &getModel('comment');
// 해당 글의 전체 댓글 수를 구해옴
// get the number of all comments in the posting
$comment_count = $oCommentModel->getCommentCount($document_srl);
// document의 controller 객체 생성
// create the controller object of the document
$oDocumentController = &getController('document');
// 해당글의 댓글 수를 업데이트
// Update the number of comments in the post
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, true);
// 댓글의 권한을 부여
// grant autority of the comment
$this->addGrant($obj->comment_srl);
// trigger 호출 (after)
// call a trigger(after)
if($output->toBool()) {
$trigger_output = ModuleHandler::triggerCall('comment.insertComment', 'after', $obj);
if(!$trigger_output->toBool()) {
@ -248,10 +227,9 @@
$oDB->commit();
if(!$manual_inserted) {
// 원본글에 알림(notify_message)가 설정되어 있으면 메세지 보냄
// send a message if notify_message option in enabled in the original article
$oDocument->notify(Context::getLang('comment'), $obj->content);
// 원본 댓글이 있고 원본 댓글에 알림(notify_message)가 있으면 메세지 보냄
// send a message if notify_message option in enabled in the original comment
if($obj->parent_srl) {
$oParent = $oCommentModel->getComment($obj->parent_srl);
if ($oParent->get('member_srl') != $oDocument->get('member_srl')) {
@ -266,18 +244,16 @@
}
/**
* @brief 댓글 수정
* @brief fix the comment
**/
function updateComment($obj, $is_admin = false) {
$obj->__isupdate = true;
// trigger 호출 (before)
// call a trigger (before)
$output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj);
if(!$output->toBool()) return $output;
// comment model 객체 생성
// create a comment model object
$oCommentModel = &getModel('comment');
// 원본 데이터를 가져옴
// get the original data
$source_obj = $oCommentModel->getComment($obj->comment_srl);
if(!$source_obj->getMemberSrl()) {
$obj->member_srl = $source_obj->get('member_srl');
@ -286,14 +262,12 @@
$obj->email_address = $source_obj->get('email_address');
$obj->homepage = $source_obj->get('homepage');
}
// 권한이 있는지 확인
// check if permission is granted
if(!$is_admin && !$source_obj->isGranted()) return new Object(-1, 'msg_not_permitted');
if($obj->password) $obj->password = md5($obj->password);
if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage;
// 로그인 되어 있고 작성자와 수정자가 동일하면 수정자의 정보를 세팅
// set modifier's information if logged-in and posting author and modifier are matched.
if(Context::get('is_logged')) {
$logged_info = Context::get('logged_info');
if($source_obj->member_srl == $logged_info->member_srl) {
@ -304,8 +278,7 @@
$obj->homepage = $logged_info->homepage;
}
}
// 로그인한 유저가 작성한 글인데 nick_name이 없을 경우
// if nick_name of the logged-in author doesn't exist
if($source_obj->get('member_srl')&& !$obj->nick_name) {
$obj->member_srl = $source_obj->get('member_srl');
$obj->user_name = $source_obj->get('user_name');
@ -316,25 +289,21 @@
if(!$obj->content) $obj->content = $source_obj->get('content');
// 내용에서 XE만의 태그를 삭제
// remove XE's wn tags from contents
$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
// 세션에서 최고 관리자가 아니면 iframe, script 제거
// remove iframe and script if not a top administrator on the session
if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 업데이트
// Update
$output = executeQuery('comment.updateComment', $obj);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// trigger 호출 (after)
// call a trigger (after)
if($output->toBool()) {
$trigger_output = ModuleHandler::triggerCall('comment.updateComment', 'after', $obj);
if(!$trigger_output->toBool()) {
@ -351,34 +320,28 @@
}
/**
* @brief 댓글 삭제
* @brief Delete comment
**/
function deleteComment($comment_srl, $is_admin = false) {
// comment model 객체 생성
// create the comment model object
$oCommentModel = &getModel('comment');
// 기존 댓글이 있는지 확인
// check if comment already exists
$comment = $oCommentModel->getComment($comment_srl);
if($comment->comment_srl != $comment_srl) return new Object(-1, 'msg_invalid_request');
$document_srl = $comment->document_srl;
// trigger 호출 (before)
// call a trigger (before)
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
if(!$output->toBool()) return $output;
// 해당 댓글에 child가 있는지 확인
// check if child comment exists on the comment
$child_count = $oCommentModel->getChildCommentCount($comment_srl);
if($child_count>0) return new Object(-1, 'fail_to_delete_have_children');
// 권한이 있는지 확인
// check if permission is granted
if(!$is_admin && !$comment->isGranted()) return new Object(-1, 'msg_not_permitted');
// begin transaction
$oDB = &DB::getInstance();
$oDB->begin();
// 삭제
// Delete
$args->comment_srl = $comment_srl;
$output = executeQuery('comment.deleteComment', $args);
if(!$output->toBool()) {
@ -387,21 +350,17 @@
}
$output = executeQuery('comment.deleteCommentList', $args);
// 댓글 수를 구해서 업데이트
// update the number of comments
$comment_count = $oCommentModel->getCommentCount($document_srl);
// document의 controller 객체 생성
// create the controller object of the document
$oDocumentController = &getController('document');
// 해당글의 댓글 수를 업데이트
// update comment count of the article posting
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, null, false);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// trigger 호출 (after)
// call a trigger (after)
if($output->toBool()) {
$trigger_output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment);
if(!$trigger_output->toBool()) {
@ -418,45 +377,40 @@
}
/**
* @brief 특정 글의 모든 댓글 삭제
* @brief remove all comments of the article
**/
function deleteComments($document_srl) {
// document model객체 생성
// create the document model object
$oDocumentModel = &getModel('document');
$oCommentModel = &getModel('comment');
// 권한이 있는지 확인
// check if permission is granted
$oDocument = $oDocumentModel->getDocument($document_srl);
if(!$oDocument->isExists() || !$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
// 댓글 목록을 가져와서 일단 trigger만 실행 (일괄 삭제를 해야 하기에 최대한 처리 비용을 줄이기 위한 방법)
// get a list of comments and then execute a trigger(way to reduce the processing cost for delete all)
$args->document_srl = $document_srl;
$comments = executeQueryArray('comment.getAllComments',$args);
if($comments->data) {
foreach($comments->data as $key => $comment) {
// trigger 호출 (before)
// call a trigger (before)
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
if(!$output->toBool()) continue;
// trigger 호출 (after)
// call a trigger (after)
$output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment);
if(!$output->toBool()) continue;
}
}
// 댓글 본문 삭제
// delete the comment
$args->document_srl = $document_srl;
$output = executeQuery('comment.deleteComments', $args);
if(!$output->toBool()) return $output;
// 댓글 목록 삭제
// Delete a list of comments
$output = executeQuery('comment.deleteCommentsList', $args);
return $output;
}
/**
* @brief 해당 comment의 추천수 증가
* @brief Increase vote-up counts of the comment
**/
function updateVotedCount($comment_srl, $point = 1) {
if($point > 0) {
@ -467,31 +421,28 @@
$success_message = 'success_blamed';
}
// 세션 정보에 추천 정보가 있으면 중단
// invalid vote if vote info exists in the session info.
if($_SESSION['voted_comment'][$comment_srl]) return new Object(-1, $failed_voted);
$oCommentModel = &getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl, false, false);
// 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스
// invalid vote if both ip addresses between author's and the current user are same.
if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
$_SESSION['voted_comment'][$comment_srl] = true;
return new Object(-1, $failed_voted);
}
// comment의 작성자가 회원일때 조사
// if the comment author is a member
if($oComment->get('member_srl')) {
// create the member model object
$oMemberModel = &getModel('member');
$member_srl = $oMemberModel->getLoggedMemberSrl();
// 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 생각하고 세션 등록후 패스
// session registered if the author information matches to the current logged-in user's.
if($member_srl && $member_srl == $oComment->get('member_srl')) {
$_SESSION['voted_comment'][$comment_srl] = true;
return new Object(-1, $failed_voted);
}
}
// 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단
// If logged-in, use the member_srl. otherwise use the ipaddress.
if($member_srl) {
$args->member_srl = $member_srl;
} else {
@ -499,14 +450,13 @@
}
$args->comment_srl = $comment_srl;
$output = executeQuery('comment.getCommentVotedLogInfo', $args);
// 로그 정보에 추천 로그가 있으면 세션 등록후 패스
// session registered if log info contains recommendation vote log.
if($output->data->count) {
$_SESSION['voted_comment'][$comment_srl] = true;
return new Object(-1, $failed_voted);
}
// 추천수 업데이트
// update the number of votes
if($point < 0) {
$args->blamed_count = $oComment->get('blamed_count') + $point;
$output = executeQuery('comment.updateBlamedCount', $args);
@ -514,54 +464,46 @@
$args->voted_count = $oComment->get('voted_count') + $point;
$output = executeQuery('comment.updateVotedCount', $args);
}
// 로그 남기기
// leave logs
$args->point = $point;
$output = executeQuery('comment.insertCommentVotedLog', $args);
// 세션 정보에 남김
// leave into session information
$_SESSION['voted_comment'][$comment_srl] = true;
// 결과 리턴
// Return the result
return new Object(0, $success_message);
}
/**
* @brief 댓글 신고
* @brief report a blamed comment
**/
function declaredComment($comment_srl) {
// 세션 정보에 신고 정보가 있으면 중단
// Fail if session information already has a reported document
if($_SESSION['declared_comment'][$comment_srl]) return new Object(-1, 'failed_declared');
// 이미 신고되었는지 검사
// check if already reported
$args->comment_srl = $comment_srl;
$output = executeQuery('comment.getDeclaredComment', $args);
if(!$output->toBool()) return $output;
// 문서 원본을 가져옴
// get the original comment
$oCommentModel = &getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl, false, false);
// 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스
// failed if both ip addresses between author's and the current user are same.
if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
$_SESSION['declared_comment'][$comment_srl] = true;
return new Object(-1, 'failed_declared');
}
// comment의 작성자가 회원일때 조사
// if the comment author is a member
if($oComment->get('member_srl')) {
// member model 객체 생성
// create the member model object
$oMemberModel = &getModel('member');
$member_srl = $oMemberModel->getLoggedMemberSrl();
// 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 생각하고 세션 등록후 패스
// session registered if the author information matches to the current logged-in user's.
if($member_srl && $member_srl == $oComment->get('member_srl')) {
$_SESSION['declared_comment'][$comment_srl] = true;
return new Object(-1, 'failed_declared');
}
}
// 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단
// If logged-in, use the member_srl. otherwise use the ipaddress.
if($member_srl) {
$args->member_srl = $member_srl;
} else {
@ -569,29 +511,25 @@
}
$args->comment_srl = $comment_srl;
$output = executeQuery('comment.getCommentDeclaredLogInfo', $args);
// 로그 정보에 신고 로그가 있으면 세션 등록후 패스
// session registered if log info contains report log.
if($output->data->count) {
$_SESSION['declared_comment'][$comment_srl] = true;
return new Object(-1, 'failed_declared');
}
// 신고글 추가
// execute insert
if($output->data->declared_count > 0) $output = executeQuery('comment.updateDeclaredComment', $args);
else $output = executeQuery('comment.insertDeclaredComment', $args);
if(!$output->toBool()) return $output;
// 로그 남기기
// leave the log
$output = executeQuery('comment.insertCommentDeclaredLog', $args);
// 세션 정보에 남김
// leave into the session information
$_SESSION['declared_comment'][$comment_srl] = true;
$this->setMessage('success_declared');
}
/**
* @brief 댓글의 댓글을.. 클릭시 나타나는 팝업 메뉴를 추가하는 method
* @brief method to add a pop-up menu when clicking for displaying child comments
**/
function addCommentPopupMenu($url, $str, $icon = '', $target = 'self') {
$comment_popup_menu_list = Context::get('comment_popup_menu_list');
@ -607,7 +545,7 @@
}
/**
* @brief 댓글의 모듈별 추가 확장 폼을 저장
* @brief save the comment extension form for each module
**/
function procCommentInsertModuleConfig() {
$module_srl = Context::get('target_module_srl');

View file

@ -2,7 +2,7 @@
/**
* @class commentItem
* @author NHN (developers@xpressengine.com)
* @brief comment 객체
* @brief comment Object
**/
class commentItem extends Object {
@ -35,8 +35,7 @@
}
$this->comment_srl = $attribute->comment_srl;
$this->adds($attribute);
// 기존 스킨의 호환을 위해 변수를 객체 자신에 재선언
// define vars on the object for backward compatibility of skins
if(count($attribute)) foreach($attribute as $key => $val) $this->{$key} = $val;
}
@ -101,28 +100,23 @@
}
function notify($type, $content) {
// useNotify가 아니면 return
// return if not useNotify
if(!$this->useNotify()) return;
// 글쓴이가 로그인 유저가 아니면 패스~
// pass if the author is not logged-in user
if(!$this->get('member_srl')) return;
// 현재 로그인한 사용자와 글을 쓴 사용자를 비교하여 동일하면 return
// return if the currently logged-in user is an author of the comment.
$logged_info = Context::get('logged_info');
if($logged_info->member_srl == $this->get('member_srl')) return;
// 원본글의 주소를 구함
// get where the comment belongs to
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
// 변수 정리
// Variables
if($type) $title = "[".$type."] ";
$title .= cut_str(strip_tags($content), 30, '...');
$content = sprintf('%s<br /><br />from : <a href="%s#comment_%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->get('document_srl')), $this->get('comment_srl'), getFullUrl('','document_srl',$this->get('document_srl')));
$receiver_srl = $this->get('member_srl');
$sender_member_srl = $logged_info->member_srl;
// 쪽지 발송
// send a message
$oCommunicationController = &getController('communication');
$oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false);
}
@ -177,8 +171,7 @@
$content = $this->get('content');
stripEmbedTagForAdmin($content, $this->get('member_srl'));
// 이 댓글을... 팝업메뉴를 출력할 경우
// when displaying the comment on the pop-up menu
if($add_popup_menu && Context::get('is_logged') ) {
$content = sprintf(
'%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>',
@ -186,8 +179,7 @@
$this->comment_srl, Context::getLang('cmd_comment_do')
);
}
// 컨텐츠에 대한 조작이 가능한 추가 정보를 설정하였을 경우
// if additional information which can access contents is set
if($add_content_info) {
$content = sprintf(
'<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->',
@ -196,7 +188,7 @@
$content,
$this->comment_srl, $this->get('member_srl')
);
// 컨텐츠에 대한 조작이 필요하지 않더라도 xe_content라는 클래스명을 꼭 부여
// xe_content class name should be specified although content access is not necessary.
} else {
if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
}
@ -206,26 +198,19 @@
function getSummary($str_size = 50, $tail = '...') {
$content = $this->getContent(false, false);
// 줄바꿈이 있을 때, 공백문자 삽입
// for newline, insert a blank.
$content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content);
// </p>, </div>, </li> 등의 태그를 공백 문자로 치환
// replace tags such as </p> , </div> , </li> by blanks.
$content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content);
// 태그 제거
// Remove tags
$content = preg_replace('!<([^>]*?)>!is','', $content);
// < , > , " 를 치환
// replace < , >, "
$content = str_replace(array('&lt;','&gt;','&quot;','&nbsp;'), array('<','>','"',' '), $content);
// 연속된 공백문자 삭제
// delete a series of blanks
$content = preg_replace('/ ( +)/is', ' ', $content);
// 문자열을 자름
// truncate strings
$content = trim(cut_str($content, $str_size, $tail));
// >, <, "를 다시 복구
// restore >, <, , "\
$content = str_replace(array('<','>','"'),array('&lt;','&gt;','&quot;'), $content);
return $content;
@ -288,7 +273,7 @@
}
/**
* @brief 에디터 html을 구해서 return
* @brief return the editor html
**/
function getEditor() {
$module_srl = $this->get('module_srl');
@ -298,7 +283,7 @@
}
/**
* @brief 작성자의 프로필 이미지를 return
* @brief return author's profile image
**/
function getProfileImage() {
if(!$this->isExists() || !$this->get('member_srl')) return;
@ -310,17 +295,15 @@
}
/**
* @brief 작성자의 서명을 return
* @brief return author's signiture
**/
function getSignature() {
// 존재하지 않는 글이면 패스~
// pass if the posting not exists.
if(!$this->isExists() || !$this->get('member_srl')) return;
// 서명정보를 구함
// get the signiture information
$oMemberModel = &getModel('member');
$signature = $oMemberModel->getSignature($this->get('member_srl'));
// 회원모듈에서 서명 최고 높이 지정되었는지 검사
// check if max height of the signiture is specified on the member module
if(!isset($GLOBALS['__member_signature_max_height'])) {
$oModuleModel = &getModel('module');
$member_config = $oModuleModel->getModuleConfig('member');
@ -339,34 +322,27 @@
}
function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') {
// 존재하지 않는 문서일 경우 return false
// return false if no doc exists
if(!$this->comment_srl) return;
// 높이 지정이 별도로 없으면 정사각형으로 생성
// If signiture height setting is omitted, create a square
if(!$height) $height = $width;
// 첨부파일이 없거나 내용중 이미지가 없으면 return false;
// return false if neigher attached file nor image;
if(!$this->hasUploadedFiles() && !preg_match("!<img!is", $this->get('content'))) return;
// 문서 모듈의 기본 설정에서 Thumbnail의 생성 방법을 구함
// get thumbail generation info on the doc module configuration.
if(!in_array($thumbnail_type, array('crop','ratio'))) $thumbnail_type = 'crop';
// 섬네일 정보 정의
// Define thumbnail information
$thumbnail_path = sprintf('files/cache/thumbnails/%s',getNumberingPath($this->comment_srl, 3));
$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
$thumbnail_url = Context::getRequestUri().$thumbnail_file;
// 섬네일 파일이 있을 경우 파일의 크기가 0 이면 return false 아니면 경로 return
// return false if a size of existing thumbnail file is 0. otherwise return the file path
if(file_exists($thumbnail_file)) {
if(filesize($thumbnail_file)<1) return false;
else return $thumbnail_url;
}
// 대상 파일
// Target file
$source_file = null;
$is_tmp_file = false;
// 첨부된 파일중 이미지 파일이 있으면 찾음
// find an image file among attached files
if($this->hasUploadedFiles()) {
$file_list = $this->getUploadedFiles();
if(count($file_list)) {
@ -380,8 +356,7 @@
}
}
}
// 첨부된 파일이 없으면 내용중 이미지 파일을 구함
// get an image file from the doc content if no file attached.
if(!$source_file) {
$content = $this->get('content');
$target_src = null;
@ -411,11 +386,9 @@
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
if($is_tmp_file) FileHandler::removeFile($source_file);
// 섬네일 생성 성공시 경로 return
// return the thumbnail path if successfully generated.
if($output) return $thumbnail_url;
// 차후 다시 섬네일 생성을 시도하지 않기 위해 빈 파일을 생성
// create an empty file not to attempt to generate the thumbnail afterwards
else FileHandler::writeFile($thumbnail_file, '','w');
return;

View file

@ -2,39 +2,36 @@
/**
* @class commentModel
* @author NHN (developers@xpressengine.com)
* @brief comment 모듈의 model class
* @brief model class of the comment module
**/
class commentModel extends comment {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 선택된 게시물의 팝업메뉴 표시
* @brief display the pop-up menu of the post
*
* 인쇄, 스크랩, 추천, 비추천, 신고 기능 추가
* Print, scrap, vote-up(recommen), vote-down(non-recommend), report features added
**/
function getCommentMenu() {
// 요청된 게시물 번호와 현재 로그인 정보 구함
// get the post's id number and the current login information
$comment_srl = Context::get('target_srl');
$mid = Context::get('cur_mid');
$logged_info = Context::get('logged_info');
$act = Context::get('cur_act');
// menu_list 에 "표시할글,target,url" 을 배열로 넣는다
// array values for menu_list, "comment post, target, url"
$menu_list = array();
// trigger 호출
// call a trigger
ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list);
$oCommentController = &getController('comment');
// 회원이어야만 가능한 기능
// feature that only member can do
if($logged_info->member_srl) {
$oCommentModel = &getModel('comment');
@ -45,31 +42,29 @@
$oModuleModel = &getModel('module');
$comment_config = $oModuleModel->getModulePartConfig('document',$module_srl);
if($comment_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl){
// 추천 버튼 추가
// Add a vote-up button for positive feedback
$url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url,'cmd_vote','./modules/document/tpl/icons/vote_up.gif','javascript');
}
if($comment_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl){
// 비추천 버튼 추가
// Add a vote-down button for negative feedback
$url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url,'cmd_vote_down','./modules/document/tpl/icons/vote_down.gif','javascript');
}
// 신고 기능 추가
// Add the report feature against abused posts
$url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
$oCommentController->addCommentPopupMenu($url,'cmd_declare','./modules/document/tpl/icons/declare.gif','javascript');
}
// trigger 호출 (after)
// call a trigger (after)
ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
// 관리자일 경우 ip로 글 찾기
// find a comment by IP matching if an administrator.
if($logged_info->is_admin == 'Y') {
$oCommentModel = &getModel('comment');
$oComment = $oCommentModel->getComment($comment_srl);
if($oComment->isExists()) {
// ip주소에 해당하는 글 찾기
// Find a post of the corresponding ip address
$url = getUrl('','module','admin','act','dispCommentAdminList','search_target','ipaddress','search_keyword',$oComment->get('ipaddress'));
$icon_path = './modules/member/tpl/images/icon_management.gif';
$oCommentController->addCommentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
@ -78,30 +73,28 @@
$oCommentController->addCommentPopupMenu($url,'cmd_add_ip_to_spamfilter','./modules/document/tpl/icons/declare.gif','javascript');
}
}
// 팝업메뉴의 언어 변경
// Changing a language of pop-up menu
$menus = Context::get('comment_popup_menu_list');
$menus_count = count($menus);
for($i=0;$i<$menus_count;$i++) {
$menus[$i]->str = Context::getLang($menus[$i]->str);
}
// 최종적으로 정리된 팝업메뉴 목록을 구함
// get a list of final organized pop-up menus
$this->add('menus', $menus);
}
/**
* @brief comment_srl에 권한이 있는지 체크
* @brief check if you have a permission to comment_srl
*
* 세션 정보만 이용
* use only session information
**/
function isGranted($comment_srl) {
return $_SESSION['own_comment'][$comment_srl];
}
/**
* @brief 자식 답글의 갯수 리턴
* @brief Returns the number of child comments
**/
function getChildCommentCount($comment_srl) {
$args->comment_srl = $comment_srl;
@ -110,7 +103,7 @@
}
/**
* @brief 댓글 가져오기
* @brief get the comment
**/
function getComment($comment_srl=0, $is_admin = false) {
$oComment = new commentItem($comment_srl);
@ -120,12 +113,11 @@
}
/**
* @brief 여러개의 댓글들을 가져옴 (페이징 아님)
* @brief get the multiple comments(not paginating)
**/
function getComments($comment_srl_list) {
if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list);
// DB에서 가져옴
// fetch from a database
$args->comment_srls = $comment_srls;
$output = executeQuery('comment.getComments', $args);
if(!$output->toBool()) return;
@ -147,7 +139,7 @@
}
/**
* @brief document_srl 해당하는 댓글의 전체 갯수를 가져옴
* @brief get the total number of comments in corresponding with document_srl.
**/
function getCommentCount($document_srl) {
$args->document_srl = $document_srl;
@ -158,7 +150,7 @@
/**
* @brief module_srl 해당하는 댓글의 전체 갯수를 가져옴
* @brief get the total number of comments in corresponding with module_srl.
**/
function getCommentAllCount($module_srl) {
$args->module_srl = $module_srl;
@ -170,7 +162,7 @@
/**
* @brief mid 해당하는 댓글을 가져옴
* @brief get the comment in corresponding with mid.
**/
function getNewestCommentList($obj) {
if($obj->mid) {
@ -178,8 +170,7 @@
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
unset($obj->mid);
}
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
// check if module_srl is an arrary.
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
else $args->module_srl = $obj->module_srl;
$args->list_count = $obj->list_count;
@ -205,20 +196,17 @@
}
/**
* @brief document_srl에 해당하는 문서의 댓글 목록을 가져옴
* @brief get a comment list of the doc in corresponding woth document_srl.
**/
function getCommentList($document_srl, $page = 0, $is_admin = false, $count = 0) {
// 해당 문서의 모듈에 해당하는 댓글 수를 구함
// get the number of comments on the document module
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
// 문서가 존재하지 않으면 return~
// return if no doc exists.
if(!$oDocument->isExists()) return;
// 댓글수가 없으면 return~
// return if no comment exists
if($oDocument->getCommentCount()<1) return;
// 정해진 댓글수에 따른 댓글 목록 구함
// get a list of comments
$module_srl = $oDocument->get('module_srl');
if(!$count) {
@ -228,21 +216,17 @@
} else {
$comment_count = $count;
}
// 페이지가 없으면 제일 뒤 페이지를 구함
// get a very last page if no page exists
if(!$page) $page = (int)( ($oDocument->getCommentCount()-1) / $comment_count) + 1;
// 정해진 수에 따라 목록을 구해옴
// get a list of comments
$args->document_srl = $document_srl;
$args->list_count = $comment_count;
$args->page = $page;
$args->page_count = 10;
$output = executeQueryArray('comment.getCommentPageList', $args);
// 쿼리 결과에서 오류가 생기면 그냥 return
// return if an error occurs in the query results
if(!$output->toBool()) return;
// 만약 구해온 결과값이 저장된 댓글수와 다르다면 기존의 데이터로 판단하고 댓글 목록 테이블에 데이터 입력
// insert data into CommentPageList table if the number of results is different from stored comments
if(!$output->data) {
$this->fixCommentList($oDocument->get('module_srl'), $document_srl);
$output = executeQueryArray('comment.getCommentPageList', $args);
@ -253,16 +237,15 @@
}
/**
* @brief document_srl에 해당하는 댓글 목록을 갱신
* 정식버전 이전에 사용되던 데이터를 위한 처리
* @brief update a list of comments in corresponding with document_srl
* take care of previously used data than GA version
**/
function fixCommentList($module_srl, $document_srl) {
// 일괄 작업이라서 lock 파일을 생성하여 중복 작업이 되지 않도록 한다
// create a lock file to prevent repeated work when performing a batch job
$lock_file = "./files/cache/tmp/lock.".$document_srl;
if(file_exists($lock_file) && filemtime($lock_file)+60*60*10<time()) return;
FileHandler::writeFile($lock_file, '');
// 목록을 구함
// get a list
$args->document_srl = $document_srl;
$args->list_order = 'list_order';
$output = executeQuery('comment.getCommentList', $args);
@ -270,25 +253,20 @@
$source_list = $output->data;
if(!is_array($source_list)) $source_list = array($source_list);
// 댓글를 계층형 구조로 정렬
// Sort comments by the hierarchical structure
$comment_count = count($source_list);
$root = NULL;
$list = NULL;
$comment_list = array();
// 로그인 사용자의 경우 로그인 정보를 일단 구해 놓음
// get the log-in information for logged-in users
$logged_info = Context::get('logged_info');
// loop를 돌면서 코멘트의 계층 구조 만듬
// generate a hierarchical structure of comments for loop
for($i=$comment_count-1;$i>=0;$i--) {
$comment_srl = $source_list[$i]->comment_srl;
$parent_srl = $source_list[$i]->parent_srl;
if(!$comment_srl) continue;
// 목록을 만듬
// generate a list
$list[$comment_srl] = $source_list[$i];
if($parent_srl) {
@ -298,8 +276,7 @@
}
}
$this->_arrangeComment($comment_list, $root->child, 0, null);
// 구해진 값을 db에 입력함
// insert values to the database
if(count($comment_list)) {
foreach($comment_list as $comment_srl => $item) {
$comment_args = null;
@ -314,13 +291,12 @@
executeQuery('comment.insertCommentList', $comment_args);
}
}
// 성공시 lock파일 제거
// remove the lock file if successful.
FileHandler::removeFile($lock_file);
}
/**
* @brief 댓글을 계층형으로 재배치
* @brief relocate comments in the hierarchical structure
**/
function _arrangeComment(&$comment_list, $list, $depth, $parent = null) {
if(!count($list)) return;
@ -343,20 +319,18 @@
}
/**
* @brief 모든 댓글를 시간 역순으로 가져옴 (관리자용)
* @brief get all the comments in time decending order(for administrators)
**/
function getTotalCommentList($obj) {
$query_id = 'comment.getTotalCommentList';
// 변수 설정
// Variables
$args->sort_index = 'list_order';
$args->page = $obj->page?$obj->page:1;
$args->list_count = $obj->list_count?$obj->list_count:20;
$args->page_count = $obj->page_count?$obj->page_count:10;
$args->s_module_srl = $obj->module_srl;
$args->exclude_module_srl = $obj->exclude_module_srl;
// 검색 옵션 정리
// Search options
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
if($search_target && $search_keyword) {
@ -401,11 +375,9 @@
break;
}
}
// comment.getTotalCommentList 쿼리 실행
// comment.getTotalCommentList query execution
$output = executeQueryArray($query_id, $args);
// 결과가 없거나 오류 발생시 그냥 return
// return when no result or error occurance
if(!$output->toBool()||!count($output->data)) return $output;
foreach($output->data as $key => $val) {
unset($_oComment);
@ -418,7 +390,7 @@
}
/**
* @brief 모듈별 댓글 설정을 return
* @brief return a configuration of comments for each module
**/
function getCommentConfig($module_srl) {
$oModuleModel = &getModel('module');

View file

@ -2,42 +2,39 @@
/**
* @class commentView
* @author NHN (developers@xpressengine.com)
* @brief comment 모듈의 view 클래스
* @brief comment module's view class
**/
class commentView extends comment {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 모듈의 추가 설정에서 댓글 설정을 하는 form 추가
* @brief add a form fot comment setting on the additional setting of module
**/
function triggerDispCommentAdditionSetup(&$obj) {
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
if(!$current_module_srl && !$current_module_srls) {
// 선택된 모듈의 정보를 가져옴
// get information of the selected module
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new Object();
}
// 댓글 설정을 구함
// get the comment configuration
$oCommentModel = &getModel('comment');
$comment_config = $oCommentModel->getCommentConfig($current_module_srl);
Context::set('comment_config', $comment_config);
// 그룹 목록을 구함
// get a group list
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups();
Context::set('group_list', $group_list);
// 템플릿 파일 지정
// Set a template file
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'comment_module_config');
$obj .= $tpl;

View file

@ -2,29 +2,28 @@
/**
* @class communicationAdminController
* @author NHN (developers@xpressengine.com)
* @brief communication module의 admin controller class
* @brief communication module of the admin controller class
**/
class communicationAdminController extends communication {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief communication 모듈 설정 저장
* @brief save configurations of the communication module
**/
function procCommunicationAdminInsertConfig() {
// 기본 정보를 받음
// get the default information
$args = Context::gets('skin','colorset','editor_skin','editor_colorset');
if(!$args->skin) $args->skin = "default";
if(!$args->colorset) $args->colorset = "white";
if(!$args->editor_skin) $args->editor_skin = "default";
// module Controller 객체 생성하여 입력
// create the module module Controller object
$oModuleController = &getController('module');
$output = $oModuleController->insertModuleConfig('communication',$args);

View file

@ -2,19 +2,19 @@
/**
* @class communicationAdminModel
* @author NHN (developers@xpressengine.com)
* @brief communication module의 admin model class
* @brief communication module of the admin model class
**/
class communicationAdminModel extends communication {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 지정된 스킨의 컬러셋 선택을 위한 html을 return
* @brief return the html to select colorset of the skin
**/
function getCommunicationAdminColorset() {
$skin = Context::get('skin');

View file

@ -2,36 +2,32 @@
/**
* @class communicationAdminView
* @author NHN (developers@xpressengine.com)
* @brief communication module의 admin view class
* @brief communication module of the admin view class
**/
class communicationAdminView extends communication {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 쪽지 친구등의 관리를 위한 설정
* @brief configuration to manage messages and friends
**/
function dispCommunicationAdminConfig() {
// 객체 생성
// Creating an object
$oEditorModel = &getModel('editor');
$oModuleModel = &getModel('module');
$oCommunicationModel = &getModel('communication');
// communication 모듈의 모듈설정 읽음
// get the configurations of communication module
Context::set('communication_config', $oCommunicationModel->getConfig() );
// 에디터 스킨 목록을 구함
// get a list of editor skins
Context::set('editor_skin_list', $oEditorModel->getEditorSkinList() );
// 커뮤니케이션 스킨 목록을 구함
// get a list of communication skins
Context::set('communication_skin_list', $oModuleModel->getSkins($this->module_path) );
// template 지정
// specify a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('index');
}

View file

@ -2,22 +2,22 @@
/**
* @class communication
* @author NHN (developers@xpressengine.com)
* @brief communication module의 high class
* @brief communication module of the high class
**/
class communication extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// 새쪽지 알림을 위한 임시 파일 저장소 생성
// Create a temporary file storage for one new private message notification
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief method to check if successfully installed.
**/
function checkUpdate() {
if(!is_dir("./files/member_extra_info/new_message_flags")) return true;
@ -25,7 +25,7 @@
}
/**
* @brief 업데이트 실행
* @brief Update
**/
function moduleUpdate() {
if(!is_dir("./files/member_extra_info/new_message_flags"))
@ -34,7 +34,7 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
}

View file

@ -2,19 +2,19 @@
/**
* @class communicationController
* @author NHN (developers@xpressengine.com)
* @brief communication module의 Controller class
* @brief communication module of the Controller class
**/
class communicationController extends communication {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 쪽지함 설정 변경
* @brief change the settings of message box
**/
function procCommunicationUpdateAllowMessage() {
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
@ -31,14 +31,13 @@
}
/**
* @brief 쪽지 발송
* @brief Send a message
**/
function procCommunicationSendMessage() {
// 로그인 정보 체크
// Check login information
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
$logged_info = Context::get('logged_info');
// 변수 검사
// Check variables
$receiver_srl = Context::get('receiver_srl');
if(!$receiver_srl) return new Object(-1, 'msg_not_exists_member');
@ -50,14 +49,12 @@
$send_mail = Context::get('send_mail');
if($send_mail != 'Y') $send_mail = 'N';
// 받을 회원이 있는지에 대한 검사
// Check if there is a member to receive a message
$oMemberModel = &getModel('member');
$oCommunicationModel = &getModel('communication');
$receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
if($receiver_member_info->member_srl != $receiver_srl) return new Object(-1, 'msg_not_exists_member');
// 받을 회원의 쪽지 수신여부 검사 (최고관리자이면 패스)
// check whether to allow to receive the message(pass if a top-administrator)
if($logged_info->is_admin != 'Y') {
if($receiver_member_info->allow_message == 'F') {
if(!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) return new object(-1, 'msg_allow_message_to_friend');
@ -65,11 +62,9 @@
return new object(-1, 'msg_disallow_message');
}
}
// 쪽지 발송
// send a message
$output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
// 메일로도 발송
// send an e-mail
if($output->toBool() && $send_mail == 'Y') {
$view_url = Context::getRequestUri();
$content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>",$content, $view_url, $view_url);
@ -87,8 +82,7 @@
function sendMessage($sender_srl, $receiver_srl, $title, $content, $sender_log = true) {
$content = removeHackTag($content);
$title = htmlspecialchars($title);
// 보내는 사용자의 쪽지함에 넣을 쪽지
// messages to save in the sendor's message box
$sender_args->sender_srl = $sender_srl;
$sender_args->receiver_srl = $receiver_srl;
$sender_args->message_type = 'S';
@ -99,8 +93,7 @@
$sender_args->related_srl = getNextSequence();
$sender_args->message_srl = getNextSequence();
$sender_args->list_order = getNextSequence()*-1;
// 받는 회원의 쪽지함에 넣을 쪽지
// messages to save in the receiver's message box
$receiver_args->message_srl = $sender_args->related_srl;
$receiver_args->related_srl = 0;
$receiver_args->list_order = $sender_args->related_srl*-1;
@ -115,8 +108,7 @@
$oDB = &DB::getInstance();
$oDB->begin();
// 발송하는 회원의 쪽지함에 넣을 쪽지
// messages to save in the sendor's message box
if($sender_srl && $sender_log) {
$output = executeQuery('communication.sendMessage', $sender_args);
if(!$output->toBool()) {
@ -124,15 +116,13 @@
return $output;
}
}
// 받을 회원의 쪽지함에 넣을 쪽지
// messages to save in the receiver's message box
$output = executeQuery('communication.sendMessage', $receiver_args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 받는 회원의 쪽지 발송 플래그 생성 (파일로 생성)
// create a flag that message is sent (in file format)
$flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($receiver_srl);
FileHandler::makeDir($flag_path);
$flag_file = sprintf('%s%s', $flag_path, $receiver_srl);
@ -145,18 +135,16 @@
}
/**
* @brief 특정 쪽지를 보관함으로 보냄
* @brief store a specific message into the archive
**/
function procCommunicationStoreMessage() {
// 로그인 정보 체크
// Check login information
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
$logged_info = Context::get('logged_info');
// 변수 체크
// Check variable
$message_srl = Context::get('message_srl');
if(!$message_srl) return new Object(-1,'msg_invalid_request');
// 쪽지를 가져옴
// get the message
$oCommunicationModel = &getModel('communication');
$message = $oCommunicationModel->getSelectedMessage($message_srl);
if(!$message || $message->message_type != 'R') return new Object(-1,'msg_invalid_request');
@ -170,31 +158,27 @@
}
/**
* @brief 쪽지 삭제
* @brief Delete a message
**/
function procCommunicationDeleteMessage() {
// 로그인 정보 체크
// Check login information
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
$logged_info = Context::get('logged_info');
$member_srl = $logged_info->member_srl;
// 변수 체크
// Check the variable
$message_srl = Context::get('message_srl');
if(!$message_srl) return new Object(-1,'msg_invalid_request');
// 쪽지를 가져옴
// Get the message
$oCommunicationModel = &getModel('communication');
$message = $oCommunicationModel->getSelectedMessage($message_srl);
if(!$message) return new Object(-1,'msg_invalid_request');
// 발송인+type=S or 수신인+type=R 검사
// Check a message type if 'S' or 'R'
if($message->sender_srl == $member_srl && $message->message_type == 'S') {
if(!$message_srl) return new Object(-1, 'msg_invalid_request');
} elseif($message->receiver_srl == $member_srl && $message->message_type == 'R') {
if(!$message_srl) return new Object(-1, 'msg_invalid_request');
}
// 삭제
// Delete
$args->message_srl = $message_srl;
$output = executeQuery('communication.deleteMessage', $args);
if(!$output->toBool()) return $output;
@ -203,15 +187,14 @@
}
/**
* @brief 선택된 다수의 쪽지 삭제
* @brief Delete the multiple messages
**/
function procCommunicationDeleteMessages() {
// 로그인 정보 체크
// Check login information
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
$logged_info = Context::get('logged_info');
$member_srl = $logged_info->member_srl;
// 변수 체크
// check variables
$message_srl_list = trim(Context::get('message_srl_list'));
if(!$message_srl_list) return new Object(-1, 'msg_cart_is_null');
@ -229,8 +212,7 @@
$target[] = $message_srl;
}
if(!count($target)) return new Object(-1,'msg_cart_is_null');
// 삭제
// Delete
$args->message_srls = implode(',',$target);
$args->message_type = $message_type;
@ -244,17 +226,16 @@
}
/**
* @brief 친구 추가
* @brief Add a friend
**/
function procCommunicationAddFriend() {
// 로그인 정보 체크
// Check login information
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
$logged_info = Context::get('logged_info');
$target_srl = (int)trim(Context::get('target_srl'));
if(!$target_srl) return new Object(-1,'msg_invalid_request');
// 변수 정리
// Variable
$args->friend_srl = getNextSequence();
$args->list_order = $args->friend_srl * -1;
$args->friend_group_srl = Context::get('friend_group_srl');
@ -268,14 +249,13 @@
}
/**
* @brief 등록된 친구의 그룹 이동
* @brief Move a group of the friend
**/
function procCommunicationMoveFriend() {
// 로그인 정보 체크
// Check login information
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
$logged_info = Context::get('logged_info');
// 변수 체크
// Check variables
$friend_srl_list = trim(Context::get('friend_srl_list'));
if(!$friend_srl_list) return new Object(-1, 'msg_cart_is_null');
@ -290,8 +270,7 @@
$target[] = $friend_srl;
}
if(!count($target)) return new Object(-1,'msg_cart_is_null');
// 변수 정리
// Variables
$args->friend_srls = implode(',',$target);
$args->member_srl = $logged_info->member_srl;
$args->friend_group_srl = Context::get('target_friend_group_srl');
@ -303,15 +282,14 @@
}
/**
* @brief 친구 삭제
* @brief Delete a friend
**/
function procCommunicationDeleteFriend() {
// 로그인 정보 체크
// Check login information
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
$logged_info = Context::get('logged_info');
$member_srl = $logged_info->member_srl;
// 변수 체크
// Check variables
$friend_srl_list = trim(Context::get('friend_srl_list'));
if(!$friend_srl_list) return new Object(-1, 'msg_cart_is_null');
@ -326,8 +304,7 @@
$target[] = $friend_srl;
}
if(!count($target)) return new Object(-1,'msg_cart_is_null');
// 삭제
// Delete
$args->friend_srls = implode(',',$target);
$args->member_srl = $logged_info->member_srl;
$output = executeQuery('communication.deleteFriend', $args);
@ -337,26 +314,23 @@
}
/**
* @brief 친구 그룹 추가
* @brief Add a group of friends
**/
function procCommunicationAddFriendGroup() {
// 로그인 정보 체크
// Check login information
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
$logged_info = Context::get('logged_info');
// 변수 정리
// Variables
$args->friend_group_srl = trim(Context::get('friend_group_srl'));
$args->member_srl = $logged_info->member_srl;
$args->title = Context::get('title');
$args->title = htmlspecialchars($args->title);
if(!$args->title) return new Object(-1, 'msg_invalid_request');
// friend_group_srl이 있으면 수정
// modify if friend_group_srl exists.
if($args->friend_group_srl) {
$output = executeQuery('communication.renameFriendGroup', $args);
$msg_code = 'success_updated';
// 아니면 입력
// add if not exists
} else {
$output = executeQuery('communication.addFriendGroup', $args);
$msg_code = 'success_registed';
@ -368,14 +342,13 @@
}
/**
* @brief 친구 그룹 이름 변경
* @brief change a name of friend group
**/
function procCommunicationRenameFriendGroup() {
// 로그인 정보 체크
// Check login information
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
$logged_info = Context::get('logged_info');
// 변수 정리
// Variables
$args->friend_group_srl= Context::get('friend_group_srl');
$args->member_srl = $logged_info->member_srl;
$args->title = Context::get('title');
@ -389,14 +362,13 @@
}
/**
* @brief 친구 그룹 삭제
* @brief Delete a group of friends
**/
function procCommunicationDeleteFriendGroup() {
// 로그인 정보 체크
// Check login information
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
$logged_info = Context::get('logged_info');
// 변수 정리
// Variables
$args->friend_group_srl = Context::get('friend_group_srl');
$args->member_srl = $logged_info->member_srl;
$output = executeQuery('communication.deleteFriendGroup', $args);
@ -406,7 +378,7 @@
}
/**
* @brief 특정 쪽지의 상태를 읽은 상태로 변경
* @brief set a message status to be 'already read'
**/
function setMessageReaded($message_srl) {
$args->message_srl = $message_srl;

View file

@ -2,19 +2,19 @@
/**
* @class communicationModel
* @author NHN (developers@xpressengine.com)
* @brief communication module의 Model class
* @brief communication module of the Model class
**/
class communicationModel extends communication {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 설정된 내용을 구함
* @brief get the configuration
**/
function getConfig() {
$oModuleModel = &getModel('module');
@ -28,7 +28,7 @@
}
/**
* @brief 쪽지 내용을 가져옴
* @brief get the message contents
**/
function getSelectedMessage($message_srl) {
$logged_info = Context::get('logged_info');
@ -37,12 +37,10 @@
$output = executeQuery('communication.getMessage',$args);
$message = $output->data;
if(!$message) return ;
// 보낸 쪽지일 경우 받는 사람 정보를 구함
// get recipient's information if it is a sent message
$oMemberModel = &getModel('member');
if($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S') $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->receiver_srl);
// 보관/받은 쪽지일 경우 보낸 사람 정보를 구함
// get sendor's information if it is a received/archived message
else $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->sender_srl);
if($member_info) {
@ -50,8 +48,7 @@
if($key != 'regdate') $message->{$key} = $val;
}
}
// 받은 쪽지이고 아직 읽지 않았을 경우 읽은 상태로 변경
// change the status if is a received and not yet read message
if($message->message_type == 'R' && $message->readed != 'Y') {
$oCommunicationController = &getController('communication');
$oCommunicationController->setMessageReaded($message_srl);
@ -62,7 +59,7 @@
}
/**
* @brief 쪽지를 가져옴
* @brief get a new message
**/
function getNewMessage() {
$logged_info = Context::get('logged_info');
@ -80,10 +77,10 @@
}
/**
* @brief 쪽지 목록 가져오기
* type = R : 받은 쪽지
* type = S : 보낸 쪽지
* type = T : 보관함
* @brief get a message list
* type = R: Received Message
* type = S: Sent Message
* type = T: Archive
**/
function getMessages($message_type = "R") {
$logged_info = Context::get('logged_info');
@ -106,8 +103,7 @@
break;
}
// 기타 변수들 정리
// Other variables
$args->sort_index = 'message.list_order';
$args->page = Context::get('page');
$args->list_count = 20;
@ -116,15 +112,14 @@
}
/**
* @brief 친구 목록 가져오기
* @brief Get a list of friends
**/
function getFriends($friend_group_srl = 0) {
$logged_info = Context::get('logged_info');
$args->friend_group_srl = $friend_group_srl;
$args->member_srl = $logged_info->member_srl;
// 기타 변수들 정리
// Other variables
$args->page = Context::get('page');
$args->sort_index = 'friend.list_order';
$args->list_count = 10;
@ -134,7 +129,7 @@
}
/**
* @brief 이미 친구로 등록되었는지 검사
* @brief check if a friend is already added
**/
function isAddedFriend($member_srl) {
$logged_info = Context::get('logged_info');
@ -146,7 +141,7 @@
}
/**
* @brief 특정 친구 그룹 가져오기
* @brief Get a group of friends
**/
function getFriendGroupInfo($friend_group_srl) {
$logged_info = Context::get('logged_info');
@ -159,7 +154,7 @@
}
/**
* @brief 그룹 목록 가져오기
* @brief Get a list of groups
**/
function getFriendGroups() {
$logged_info = Context::get('logged_info');
@ -174,7 +169,7 @@
}
/**
* @brief 특정 회원의 친구 목록에 포함되어 있는지를 확인
* @brief check whether to be added in the friend list
**/
function isFriend($target_srl) {
$logged_info = Context::get('logged_info');

View file

@ -2,13 +2,13 @@
/**
* @class communicationView
* @author NHN (developers@xpressengine.com)
* @brief communication moduleView class
* @brief View class of communication module
**/
class communicationView extends communication {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
$oCommunicationModel = &getModel('communication');
@ -23,14 +23,13 @@
}
/**
* @brief 쪽지함 출력
* @brief Display message box
**/
function dispCommunicationMessages() {
// 로그인이 되어 있지 않으면 오류 표시
// Error appears if not logged-in
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
// 변수 설정
// Set the variables
$message_srl = Context::get('message_srl');
$message_type = Context::get('message_type');
if(!in_array($message_type, array('R','S','T'))) {
@ -39,8 +38,7 @@
}
$oCommunicationModel = &getModel('communication');
// message_srl이 있으면 내용 추출
// extract contents if message_srl exists
if($message_srl) {
$message = $oCommunicationModel->getSelectedMessage($message_srl);
if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl) ) {
@ -48,11 +46,9 @@
Context::set('message', $message);
}
}
// 목록 추출
// Extract a list
$output = $oCommunicationModel->getMessages($message_type);
// 템플릿에 쓰기 위해서 context::set
// set a template file
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
@ -63,25 +59,23 @@
}
/**
* @brief 쪽지 보여줌
* @brief display a new message
**/
function dispCommunicationNewMessage() {
$this->setLayoutFile('popup_layout');
// 로그인이 되어 있지 않으면 오류 표시
// Error appears if not logged-in
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
$oCommunicationModel = &getModel('communication');
// 새 쪽지를 가져옴
// get a new message
$message = $oCommunicationModel->getNewMessage();
if($message) {
stripEmbedTagForAdmin($message->content, $message->sender_srl);
Context::set('message', $message);
}
// 플래그 삭제
// Delete a flag
$flag_path = './files/communication_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl);
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
FileHandler::removeFile($flag_file);
@ -90,22 +84,19 @@
}
/**
* @brief 쪽지 발송 출력
* @brief Display message sending
**/
function dispCommunicationSendMessage() {
$this->setLayoutFile("popup_layout");
$oCommunicationModel = &getModel('communication');
$oMemberModel = &getModel('member');
// 로그인이 되어 있지 않으면 오류 표시
// Error appears if not logged-in
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
// 쪽지 받을 사용자 정보 구함
// get receipient's information
$receiver_srl = Context::get('receiver_srl');
if(!$receiver_srl || $logged_info->member_srl == $receiver_srl) return $this->stop('msg_not_logged');
// 답글 쪽지일 경우 원본 메세지의 글번호를 구함
// get message_srl of the original message if it is a reply
$message_srl = Context::get('message_srl');
if($message_srl) {
$source_message = $oCommunicationModel->getSelectedMessage($message_srl);
@ -118,8 +109,7 @@
$receiver_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
Context::set('receiver_info', $receiver_info);
// 에디터 모듈의 getEditor를 호출하여 서명용으로 세팅
// set a signiture by calling getEditor of the editor module
$oEditorModel = &getModel('editor');
$option->primary_key_name = 'receiver_srl';
$option->content_key_name = 'content';
@ -139,21 +129,19 @@
}
/**
* @brief 친구 목록 보기
* @brief display a list of friends
**/
function dispCommunicationFriend() {
// 로그인이 되어 있지 않으면 오류 표시
// Error appears if not logged-in
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
$oCommunicationModel = &getModel('communication');
// 그룹 목록을 가져옴
// get a group list
$tmp_group_list = $oCommunicationModel->getFriendGroups();
$group_count = count($tmp_group_list);
for($i=0;$i<$group_count;$i++) $friend_group_list[$tmp_group_list[$i]->friend_group_srl] = $tmp_group_list[$i];
Context::set('friend_group_list', $friend_group_list);
// 친구 목록을 가져옴
// get a list of friends
$friend_group_srl = Context::get('friend_group_srl');
$output = $oCommunicationModel->getFriends($friend_group_srl);
$friend_count = count($output->data);
@ -165,8 +153,7 @@
$output->data[$key]->group_title = $group_title;
}
}
// 템플릿에 쓰기 위해서 context::set
// set a template file
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
@ -177,26 +164,23 @@
}
/**
* @brief 친구 추가
* @brief Add a friend
**/
function dispCommunicationAddFriend() {
$this->setLayoutFile("popup_layout");
// 로그인이 되어 있지 않으면 오류 표시
// error appears if not logged-in
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
$target_srl = Context::get('target_srl');
if(!$target_srl) return $this->stop('msg_invalid_request');
// 대상 회원의 정보를 구함
// get information of the member
$oMemberModel = &getModel('member');
$oCommunicationModel = &getModel('communication');
$communication_info = $oMemberModel->getMemberInfoByMemberSrl($target_srl);
if($communication_info->member_srl != $target_srl) return $this->stop('msg_invalid_request');
Context::set('target_info', $communication_info);
// 그룹의 목록을 구함
// get a group list
$friend_group_list = $oCommunicationModel->getFriendGroups();
Context::set('friend_group_list', $friend_group_list);
@ -204,16 +188,14 @@
}
/**
* @brief 친구 그룹 추가
* @brief Add a group of friends
**/
function dispCommunicationAddFriendGroup() {
$this->setLayoutFile("popup_layout");
// 로그인이 되어 있지 않으면 오류 표시
// error apprears if not logged-in
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
// 그룹 번호가 넘어오면 수정모드로..
// change to edit mode when getting the group_srl
$friend_group_srl = Context::get('friend_group_srl');
if($friend_group_srl) {
$oCommunicationModel = &getModel('communication');

View file

@ -2,38 +2,35 @@
/**
* @class counterAdminView
* @author NHN (developers@xpressengine.com)
* @brief counter 모듈의 Admin view class
* @brief Admin view class of counter module
**/
class counterAdminView extends counter {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
// 템플릿 경로 지정
// set the template path
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 관리자 페이지 초기화면
* @brief Admin page
**/
function dispCounterAdminIndex() {
// 정해진 일자가 없으면 오늘자로 설정
// set today's if no date is given
$selected_date = Context::get('selected_date');
if(!$selected_date) $selected_date = date("Ymd");
Context::set('selected_date', $selected_date);
// counter model 객체 생성
// create the counter model object
$oCounterModel = &getModel('counter');
// 전체 카운터 및 지정된 일자의 현황 가져오기
// get a total count and daily count
$site_module_info = Context::get('site_module_info');
$status = $oCounterModel->getStatus(array(0,$selected_date),$site_module_info->site_srl);
Context::set('total_counter', $status[0]);
Context::set('selected_day_counter', $status[$selected_date]);
// 시간, 일, 월, 년도별로 데이터 가져오기
// get data by time, day, month, and year
$type = Context::get('type');
if(!$type) {
$type = 'day';
@ -42,7 +39,7 @@
$detail_status = $oCounterModel->getHourlyStatus($type, $selected_date, $site_module_info->site_srl);
Context::set('detail_status', $detail_status);
// 표시
// display
$this->setTemplateFile('index');
}

View file

@ -2,31 +2,29 @@
/**
* @class counter
* @author NHN (developers@xpressengine.com)
* @brief counter 모듈의 high class
* @brief high class of counter module
**/
class counter extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
$oCounterController = &getController('counter');
// 0 일자로 기록될 전체 방문 기록 row 추가
// add a row for the total visit history
//$oCounterController->insertTotalStatus();
// 오늘자 row입력
// add a row for today's status
//$oCounterController->insertTodayStatus();
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief method if successfully installed
**/
function checkUpdate() {
// 카운터에 site_srl추가
// Add site_srl to the counter
$oDB = &DB::getInstance();
if(!$oDB->isColumnExists('counter_log', 'site_srl')) return true;
if(!$oDB->isIndexExists('counter_log','idx_site_counter_log')) return true;
@ -35,10 +33,10 @@
}
/**
* @brief 업데이트 실행
* @brief Update
**/
function moduleUpdate() {
// 카운터에 site_srl추가
// Add site_srl to the counter
$oDB = &DB::getInstance();
if(!$oDB->isColumnExists('counter_log', 'site_srl')) $oDB->addColumn('counter_log','site_srl','number',11,0,true);
if(!$oDB->isIndexExists('counter_log','idx_site_counter_log')) $oDB->addIndex('counter_log','idx_site_counter_log',array('site_srl','ipaddress'),false);
@ -47,7 +45,7 @@
}
/**
* @brief 캐시 파일 재생성
* @brief re-generate the cache file
**/
function recompileCache() {
}

View file

@ -2,19 +2,19 @@
/**
* @class counterController
* @author NHN (developers@xpressengine.com)
* @brief counter 모듈의 controller class
* @brief counter module's controller class
**/
class counterController extends counter {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 카운터 기록
* @brief Counter logs
**/
function procCounterExecute() {
$oDB = &DB::getInstance();
@ -22,26 +22,21 @@
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
// 로그를 검사
// Check the logs
$oCounterModel = &getModel('counter');
// 오늘자 row가 있는지 체크하여 없으면 등록
// Register today's row if not exist
if(!$oCounterModel->isInsertedTodayStatus($site_srl)) {
$this->insertTodayStatus(0,$site_srl);
// 기존 row가 있으면 사용자 체크
// check user if the previous row exists
} else {
// 등록되어 있지 않은 아이피일 경우
// If unregistered IP
if(!$oCounterModel->isLogged($site_srl)) {
// 로그 등록
// Leave logs
$this->insertLog($site_srl);
// unique 및 pageview 등록
// Register unique and pageview
$this->insertUniqueVisitor($site_srl);
} else {
// pageview 등록
// Register pageview
$this->insertPageView($site_srl);
}
}
@ -50,7 +45,7 @@
}
/**
* @brief 로그 등록
* @brief Leave logs
**/
function insertLog($site_srl=0) {
$args->regdate = date("YmdHis");
@ -60,7 +55,7 @@
}
/**
* @brief unique visitor 등록
* @brief Register the unique visitor
**/
function insertUniqueVisitor($site_srl=0) {
if($site_srl) {
@ -78,7 +73,7 @@
}
/**
* @brief pageview 등록
* @brief Register pageview
**/
function insertPageView($site_srl=0) {
if($site_srl) {
@ -96,7 +91,7 @@
}
/**
* @brief 전체 카운터 status 추가
* @brief Add the total counter status
**/
function insertTotalStatus($site_srl=0) {
$args->regdate = 0;
@ -109,7 +104,7 @@
}
/**
* @brief 오늘자 카운터 status 추가
* @brief Add today's counter status
**/
function insertTodayStatus($regdate = 0, $site_srl=0) {
if($regdate) $args->regdate = $regdate;
@ -118,23 +113,21 @@
$args->site_srl = $site_srl;
$query_id = 'counter.insertSiteTodayStatus';
$u_args->site_srl = $site_srl; ///< 일별 row입력시 전체 row (regdate=0)도 같이 입력 시도
$u_args->site_srl = $site_srl; // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together
executeQuery($query_id, $u_args);
} else {
$query_id = 'counter.insertTodayStatus';
executeQuery($query_id); ///< 일별 row입력시 전체 row (regdate=0)도 같이 입력 시도
executeQuery($query_id); // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together
}
$output = executeQuery($query_id, $args);
// 로그 등록
// Leave logs
$this->insertLog($site_srl);
// unique 및 pageview 등록
// Register unique and pageview
$this->insertUniqueVisitor($site_srl);
}
/**
* @brief 특정 가상 사이트의 카운터 로그 삭제
* @brief Delete counter logs of the specific virtual site
**/
function deleteSiteCounterLogs($site_srl) {
$args->site_srl = $site_srl;

View file

@ -2,19 +2,19 @@
/**
* @class counterModel
* @author NHN (developers@xpressengine.com)
* @brief counter 모듈의 Model class
* @brief Model class of counter module
**/
class counterModel extends counter {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 로그 검사
* @brief Verify logs
**/
function isLogged($site_srl=0) {
$args->regdate = date("Ymd");
@ -25,7 +25,7 @@
}
/**
* @brief 오늘자 카운터 현황 row 있는지 체크
* @brief Check if a row of today's counter status exists
**/
function isInsertedTodayStatus($site_srl=0) {
$args->regdate = date("Ymd");
@ -39,15 +39,14 @@
}
/**
* @brief 특정 일의 접속 통계를 가져옴
* @brief Get access statistics for a given date
**/
function getStatus($selected_date, $site_srl=0) {
// 여러개의 날짜 로그를 가져올 경우
// If more than one date logs are selected
if(is_array($selected_date)) {
$date_count = count($selected_date);
$args->regdate = implode(',',$selected_date);
// 단일 날짜의 로그를 가져올 경우
// If a single date log is selected
} else {
if(strlen($selected_date)==8) $selected_date = $selected_date;
$args->regdate = $selected_date;
@ -73,14 +72,14 @@
}
/**
* @brief 지정된 일자의 시간대별 로그 가져오기
* @brief Select hourly logs of a given date
**/
function getHourlyStatus($type='hour', $selected_date, $site_srl=0) {
$max = 0;
$sum = 0;
switch($type) {
case 'year' :
// 카운터 시작일 구함
// Get a date to start counting
if($site_srl) {
$args->site_srl = $site_srl;
$output = executeQuery('counter.getSiteStartLogDate', $args);

View file

@ -2,29 +2,28 @@
/**
* @class documentAdminController
* @author NHN (developers@xpressengine.com)
* @brief document 모듈의 admin controller 클래스
* @brief document the module's admin controller class
**/
class documentAdminController extends document {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 관리자 페이지에서 선택된 문서들 삭제
* @brief Remove the selected docs from admin page
**/
function procDocumentAdminDeleteChecked() {
// 선택된 글이 없으면 오류 표시
// error appears if no doc is selected
$cart = Context::get('cart');
if(!$cart) return $this->stop('msg_cart_is_null');
$document_srl_list= explode('|@|', $cart);
$document_count = count($document_srl_list);
if(!$document_count) return $this->stop('msg_cart_is_null');
// 글삭제
// Delete a doc
$oDocumentController = &getController('document');
for($i=0;$i<$document_count;$i++) {
$document_srl = trim($document_srl_list[$i]);
@ -37,7 +36,7 @@
}
/**
* @brief 특정 게시물들의 소속 모듈 변경 (게시글 이동시에 사용)
* @brief change the module to move a specific article
**/
function moveDocumentModule($document_srl_list, $module_srl, $category_srl) {
if(!count($document_srl_list)) return;
@ -51,8 +50,7 @@
$triggerObj->document_srls = implode(',',$document_srl_list);
$triggerObj->module_srl = $module_srl;
$triggerObj->category_srl = $category_srl;
// Call trigger (before)
// Call a trigger (before)
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj);
if(!$output->toBool()) {
$oDB->rollback();
@ -68,8 +66,7 @@
unset($obj);
$obj = $oDocument->getObjectVars();
// 대상 모듈이 다를 경우 첨부파일 이동
// Move the attached file if the target module is different
if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) {
$oFileController = &getController('file');
@ -80,24 +77,21 @@
$file_info['name'] = $val->source_filename;
$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true);
if($inserted_file && $inserted_file->toBool()) {
// 이미지/동영상등일 경우
// for image/video files
if($val->direct_download == 'Y') {
$source_filename = substr($val->uploaded_filename,2);
$target_filename = substr($inserted_file->get('uploaded_filename'),2);
$obj->content = str_replace($source_filename, $target_filename, $obj->content);
// binary 파일일 경우
// For binary files
} else {
$obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content);
$obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content);
}
}
// 기존 파일 삭제
// Delete an existing file
$oFileController->deleteFile($val->file_srl);
}
// 등록된 모든 파일을 유효로 변경
// Set the all files to be valid
$oFileController->setFilesValid($obj->document_srl);
}
@ -105,8 +99,7 @@
{
$oDocumentController->deleteDocumentAliasByDocument($obj->document_srl);
}
// 게시물의 모듈 이동
// Move a module of the article
$obj->module_srl = $module_srl;
$obj->category_srl = $category_srl;
$output = executeQuery('document.updateDocumentModule', $obj);
@ -114,8 +107,7 @@
$oDB->rollback();
return $output;
}
// 카테고리가 변경되었으면 검사후 없는 카테고리면 0으로 세팅
// Set 0 if a new category doesn't exist after catergory change
if($source_category_srl != $category_srl) {
if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl);
@ -125,8 +117,7 @@
$args->document_srls = implode(',',$document_srl_list);
$args->module_srl = $module_srl;
// 댓글의 이동
// move the comment
$output = executeQuery('comment.updateCommentModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
@ -138,22 +129,19 @@
$oDB->rollback();
return $output;
}
// 엮인글의 이동
// move the trackback
$output = executeQuery('trackback.updateTrackbackModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 태그
// Tags
$output = executeQuery('tag.updateTagModule', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// Call trigger (before)
// Call a trigger (before)
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj);
if(!$output->toBool()) {
$oDB->rollback();
@ -165,7 +153,7 @@
}
/**
* @brief 게시글의 복사
* @brief Copy the post
**/
function copyDocumentModule($document_srl_list, $module_srl, $category_srl) {
if(!count($document_srl_list)) return;
@ -191,8 +179,7 @@
$obj->password_is_hashed = true;
$obj->comment_count = 0;
$obj->trackback_count = 0;
// 첨부파일 미리 등록
// Pre-register the attachment
if($oDocument->hasUploadedFiles()) {
$files = $oDocument->getUploadedFiles();
foreach($files as $key => $val) {
@ -201,14 +188,12 @@
$file_info['name'] = $val->source_filename;
$oFileController = &getController('file');
$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true);
// 이미지/동영상등일 경우
// if image/video files
if($val->direct_download == 'Y') {
$source_filename = substr($val->uploaded_filename,2);
$target_filename = substr($inserted_file->get('uploaded_filename'),2);
$obj->content = str_replace($source_filename, $target_filename, $obj->content);
// binary 파일일 경우
// If binary file
} else {
$obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content);
$obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content);
@ -216,14 +201,13 @@
}
}
// 글의 등록
// Write a post
$output = $oDocumentController->insertDocument($obj, true);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 댓글 이전
// Move the comments
if($oDocument->getCommentCount()) {
$oCommentModel = &getModel('comment');
$comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999);
@ -250,8 +234,7 @@
}
}
// 엮인글 이전
// Move the trackbacks
if($oDocument->getTrackbackCount()) {
$oTrackbackModel = &getModel('trackback');
$trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl);
@ -264,8 +247,7 @@
$output = executeQuery('trackback.insertTrackback', $trackback_obj);
if($output->toBool()) $success_count++;
}
// 엮인글 수 업데이트
// Update the number of trackbacks
$oDocumentController->updateTrackbackCount($obj->document_srl, $success_count);
}
}
@ -280,7 +262,7 @@
}
/**
* @brief 특정 모듈의 전체 문서 삭제
* @brief Delete all documents of the module
**/
function deleteModuleDocument($module_srl) {
$args->module_srl = $module_srl;
@ -289,20 +271,19 @@
}
/**
* @brief 문서 모듈의 기본설정 저장
* @brief Save the default settings of the document module
**/
function procDocumentAdminInsertConfig() {
// 기본 정보를 받음
// Get the basic information
$config = Context::gets('thumbnail_type');
// module Controller 객체 생성하여 입력
// Insert by creating the module Controller object
$oModuleController = &getController('module');
$output = $oModuleController->insertModuleConfig('document',$config);
return $output;
}
/**
* @brief 선택된 글들에 대해 신고 취소
* @brief Revoke declaration of the blacklisted posts
**/
function procDocumentAdminCancelDeclare() {
$document_srl = trim(Context::get('document_srl'));
@ -315,14 +296,12 @@
}
/**
* @brief 모든 생성된 섬네일 삭제
* @brief Delete all thumbnails
**/
function procDocumentAdminDeleteAllThumbnail() {
// files/attaches/images/ 디렉토리를 순환하면서 thumbnail_*.jpg 파일을 모두 삭제 (1.0.4 이전까지)
// delete all of thumbnail_ *. jpg files from files/attaches/images/ directory (prior versions to 1.0.4)
$this->deleteThumbnailFile('./files/attach/images');
// files/cache/thumbnails 디렉토리 자체를 삭제 (1.0.5 이후 변경된 섬네일 정책)
// delete a directory itself, files/cache/thumbnails (thumbnail policies have changed since version 1.0.5)
FileHandler::removeFilesInDir('./files/cache/thumbnails');
$this->setMessage('success_deleted');
@ -344,7 +323,7 @@
}
/**
* @brief 모듈의 확장 변수 추가 또는 수정
* @brief Add or modify extra variables of the module
**/
function procDocumentAdminInsertExtraVar() {
$module_srl = Context::get('module_srl');
@ -358,15 +337,14 @@
$eid = Context::get('eid');
if(!$module_srl || !$name || !$eid) return new Object(-1,'msg_invalid_request');
// idx가 지정되어 있지 않으면 최고 값을 지정
// set the max value if idx is not specified
if(!$var_idx) {
$obj->module_srl = $module_srl;
$output = executeQuery('document.getDocumentMaxExtraKeyIdx', $obj);
$var_idx = $output->data->var_idx+1;
}
// 이미 존재하는 모듈 이름인지 체크
// Check if the module name already exists
$obj->module_srl = $module_srl;
$obj->var_idx = $var_idx;
$obj->eid = $eid;
@ -384,7 +362,7 @@
}
/**
* @brief 모듈의 확장 변수 삭제
* @brief delete extra variables of the module
**/
function procDocumentAdminDeleteExtraVar() {
$module_srl = Context::get('module_srl');
@ -399,7 +377,7 @@
}
/**
* @brief 확장변수 순서 조절
* @brief control the order of extra variables
**/
function procDocumentAdminMoveExtraVar() {
$type = Context::get('type');
@ -419,8 +397,7 @@
if($type == 'up') $new_idx = $var_idx-1;
else $new_idx = $var_idx+1;
if($new_idx<1) return new Object(-1,'msg_invalid_request');
// 바꿀 idx가 없으면 바로 업데이트
// update immediately if there is no idx to change
if(!$extra_keys[$new_idx]) {
$args->module_srl = $module_srl;
$args->var_idx = $var_idx;
@ -429,7 +406,7 @@
if(!$output->toBool()) return $output;
$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
if(!$output->toBool()) return $output;
// 있으면 기존의 꺼랑 교체
// replace if exists
} else {
$args->module_srl = $module_srl;
$args->var_idx = $new_idx;
@ -521,15 +498,13 @@
$oDB->rollback();
return $output;
}
// 임시 저장되었던 글이 아닌 경우, 등록된 첨부파일의 상태를 유효로 지정
// If the post was not temorarily saved, set the attachment's status to be valid
if($oDocument->hasUploadedFiles() && $document_args->member_srl != $document_args->module_srl) {
$args->upload_target_srl = $oDocument->document_srl;
$args->isvalid = 'Y';
executeQuery('file.updateFileValid', $args);
}
// trigger 호출 (after)
// call a trigger (after)
if($output->toBool()) {
$trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $document_args);
if(!$trigger_output->toBool()) {

View file

@ -3,51 +3,45 @@
* @class documentAdminModel
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @brief document 모듈의 admin model class
* @brief document the module's admin model class
**/
class documentAdminModel extends document {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 휴지통에 존재하는 문서 목록을 가져옴
* @brief get a document list from the trash
**/
function getDocumentTrashList($obj) {
// 정렬 대상과 순서 체크
// check a list and its order
if (!in_array($obj->sort_index, array('list_order','delete_date','title'))) $obj->sort_index = 'list_order';
if (!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc';
// module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌
// get a module_srl if mid is returned instead of modul_srl
if ($obj->mid) {
$oModuleModel = &getModel('module');
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
unset($obj->mid);
}
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
// check if the module_srl is an array
if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
else $args->module_srl = $obj->module_srl;
// 변수 체크
// Variable check
$args->sort_index = $obj->sort_index;
$args->order_type = $obj->order_type;
$args->page = $obj->page?$obj->page:1;
$args->list_count = $obj->list_count?$obj->list_count:20;
$args->page_count = $obj->page_count?$obj->page_count:10;
$args->member_srl = $obj->member_srl;
// query_id 지정
// Specify query_id
$query_id = 'document.getTrashList';
// query 실행
// Execute a query
$output = executeQueryArray($query_id, $args);
// 결과가 없거나 오류 발생시 그냥 return
// Return if no result or an error occurs
if (!$output->toBool() || !count($output->data)) return $output;
$idx = 0;
@ -71,7 +65,7 @@
}
/**
* @brief trash_srl값을 가지는 휴지통 문서를 가져옴
* @brief get the doc which has trash_srl from the trash can
**/
function getDocumentTrash($trash_srl) {
$args->trash_srl = $trash_srl;

View file

@ -2,82 +2,82 @@
/**
* @class documentAdminView
* @author NHN (developers@xpressengine.com)
* @brief document 모듈의 admin view 클래스
* @brief document admin view of the module class
**/
class documentAdminView extends document {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 목록 출력 (관리자용)
* @brief Display a list(administrative)
**/
function dispDocumentAdminList() {
// 목록을 구하기 위한 옵션
$args->page = Context::get('page'); ///< 페이지
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
// option to get a list
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< the number of posts to display on a single page
$args->page_count = 10; // /< the number of pages that appear in the page navigation
$args->search_target = Context::get('search_target'); ///< 검색 대상 (title, contents...)
$args->search_keyword = Context::get('search_keyword'); ///< 검색어
$args->search_target = Context::get('search_target'); // /< search (title, contents ...)
$args->search_keyword = Context::get('search_keyword'); // /< keyword to search
$args->sort_index = 'list_order'; ///< 소팅 값
$args->sort_index = 'list_order'; // /< sorting value
$args->module_srl = Context::get('module_srl');
// 목록 구함, document->getDocumentList 에서 걍 알아서 다 해버리는 구조이다... (아.. 이거 나쁜 버릇인데.. ㅡ.ㅜ 어쩔수 없다)
// get a list
$oDocumentModel = &getModel('document');
$output = $oDocumentModel->getDocumentList($args);
// 템플릿에 쓰기 위해서 document_model::getDocumentList() 의 return object에 있는 값들을 세팅
// Set values of document_model::getDocumentList() objects for a template
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('document_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
// 템플릿에서 사용할 검색옵션 세팅
// set a search option used in the template
$count_search_option = count($this->search_option);
for($i=0;$i<$count_search_option;$i++) {
$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
}
Context::set('search_option', $search_option);
// 템플릿 지정
// Specify a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('document_list');
}
/**
* @brief 문서 모듈 설정
* @brief Set a document module
**/
function dispDocumentAdminConfig() {
$oDocumentModel = &getModel('document');
$config = $oDocumentModel->getDocumentConfig();
Context::set('config',$config);
// 템플릿 파일 지정
// Set the template file
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('document_config');
}
/**
* @brief 관리자 페이지의 신고 목록 보기
* @brief display a report list on the admin page
**/
function dispDocumentAdminDeclared() {
// 목록을 구하기 위한 옵션
$args->page = Context::get('page'); ///< 페이지
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
// option for a list
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< the number of posts to display on a single page
$args->page_count = 10; // /< the number of pages that appear in the page navigation
$args->sort_index = 'document_declared.declared_count'; ///< 소팅 값
$args->order_type = 'desc'; ///< 소팅 정렬 값
$args->sort_index = 'document_declared.declared_count'; // /< sorting values
$args->order_type = 'desc'; // /< sorting values by order
// 목록을 구함
// get a list
$declared_output = executeQuery('document.getDeclaredList', $args);
if($declared_output->data && count($declared_output->data)) {
@ -91,14 +91,13 @@
$declared_output->data = $document_list;
}
// 템플릿에 쓰기 위해서 document_model::getDocumentList() 의 return object에 있는 값들을 세팅
// Set values of document_model::getDocumentList() objects for a template
Context::set('total_count', $declared_output->total_count);
Context::set('total_page', $declared_output->total_page);
Context::set('page', $declared_output->page);
Context::set('document_list', $declared_output->data);
Context::set('page_navigation', $declared_output->page_navigation);
// 템플릿 지정
// Set the template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('declared_list');
}
@ -130,28 +129,27 @@
}
function dispDocumentAdminTrashList() {
// 목록을 구하기 위한 옵션
$args->page = Context::get('page'); ///< 페이지
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
// options for a list
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< the number of posts to display on a single page
$args->page_count = 10; // /< the number of pages that appear in the page navigation
$args->sort_index = 'list_order'; ///< 소팅 값
$args->order_type = 'desc'; ///< 소팅 정렬 값
$args->sort_index = 'list_order'; // /< sorting values
$args->order_type = 'desc'; // /< sorting values by order
$args->module_srl = Context::get('module_srl');
// 목록을 구함
// get a list
$oDocumentAdminModel = &getAdminModel('document');
$output = $oDocumentAdminModel->getDocumentTrashList($args);
// 템플릿에 쓰기 위해서 document_admin_model::getDocumentTrashList() 의 return object에 있는 값들을 세팅
// Set values of document_admin_model::getDocumentTrashList() objects for a template
Context::set('total_count', $output->total_count);
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('document_list', $output->data);
Context::set('page_navigation', $output->page_navigation);
// 템플릿 지정
// set the template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('document_trash_list');
}

View file

@ -2,21 +2,21 @@
/**
* @class document
* @author NHN (developers@xpressengine.com)
* @brief document 모듈의 high 클래스
* @brief document the module's high class
**/
require_once(_XE_PATH_.'modules/document/document.item.php');
class document extends ModuleObject {
// 관리자페이지에서 사용할 검색 옵션
var $search_option = array('title','content','title_content','user_name',); ///< 검색 옵션
// search option to use in admin page
var $search_option = array('title','content','title_content','user_name',); // /< Search options
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
// Register action forward (to use in administrator mode)
$oModuleController = &getController('module');
$oDB = &DB::getInstance();
@ -29,8 +29,7 @@
$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
$oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true);
$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
// 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
// 2009. 01. 29 Added a trigger for additional setup
@ -40,67 +39,59 @@
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
/**
* 2007. 7. 25 : 알림 필드(notify_message) 추가
* 2007. 7. 25: Add a column(notify_message) for notification
**/
if(!$oDB->isColumnExists("documents","notify_message")) return true;
/**
* 2007. 8. 23 : document테이블에 결합 인덱스 적용
* 2007. 8. 23: create a clustered index in the document table
**/
if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true;
if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true;
if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true;
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
// 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
// 2007. 10. 25 문서 분류에 parent_srl, expand를 추가
// 2007. 10. 25 add parent_srl, expand to the document category
if(!$oDB->isColumnExists("document_categories","parent_srl")) return true;
if(!$oDB->isColumnExists("document_categories","expand")) return true;
if(!$oDB->isColumnExists("document_categories","group_srls")) return true;
// 2007. 11. 20 게시글에 module_srl + is_notice 복합인덱스 만들기
// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
if(!$oDB->isIndexExists("documents","idx_module_notice")) return true;
// 2008. 02. 18 게시글에 module_srl + document_srl 복합인덱스 만들기 (manian님 확인)
// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true;
/**
* 2007. 12. 03 : 확장변수(extra_vars) 컬럼이 없을 경우 추가
* 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
**/
if(!$oDB->isColumnExists("documents","extra_vars")) return true;
// 2008. 04. 23 blamed count 컬럼 추가
// 2008. 04. 23 Add a column(blamed_count)
if(!$oDB->isColumnExists("documents", "blamed_count")) return true;
if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true;
if(!$oDB->isColumnExists("document_voted_log", "point")) return true;
// 2008-12-15 문서 분류에 color를 추가
// 2008-12-15 Add a column(color)
if(!$oDB->isColumnExists("document_categories", "color")) return true;
/**
* 2009. 01. 29 : 확장변수 테이블에 lang_code가 없을 경우 추가
* 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
**/
if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true;
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
// 2009. 03. 09 documents에 lang_code 컬럼 추가
// 2009. 03. 09 Add a column(lang_code) to the documnets table
if(!$oDB->isColumnExists("documents","lang_code")) return true;
// 2009. 03. 11 확장변수 값 테이블의 인덱스 점검
// 2009. 03. 11 check the index in the document_extra_vars table
if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
/**
* 2009. 03. 19 : 확장변수 테이블에 eid가 없을 경우 추가
* 2009. 03. 19: Add a column(eid) if not exist in the table
**/
if(!$oDB->isColumnExists("document_extra_keys","eid")) return true;
if(!$oDB->isColumnExists("document_extra_vars","eid")) return true;
@ -112,7 +103,7 @@
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
@ -120,14 +111,14 @@
$oModuleController = &getController('module');
/**
* 2007. 7. 25 : 알림 필드(notify_message) 추가
* 2007. 7. 25: Add a column(notify_message) for notification
**/
if(!$oDB->isColumnExists("documents","notify_message")) {
$oDB->addColumn('documents',"notify_message","char",1);
}
/**
* 2007. 8. 23 : document테이블에 결합 인덱스 적용
* 2007. 8. 23: create a clustered index in the document table
**/
if(!$oDB->isIndexExists("documents","idx_module_list_order")) {
$oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order"));
@ -144,30 +135,26 @@
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) {
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
}
// 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
// 2007. 10. 25 문서 분류에 parent_srl, expand를 추가
// 2007. 10. 25 add columns(parent_srl, expand)
if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0);
if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N");
if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text");
// 2007. 11. 20 게시글에 module_srl + is_notice 복합인덱스 만들기
// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice"));
/**
* 2007. 12. 03 : 확장변수(extra_vars) 컬럼이 없을 경우 추가
* 2007. 12. 03: Add if the colume(extra_vars) doesn't exist
**/
if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text');
/**
* 2008. 02. 18 게시글에 module_srl + document_srl 복합인덱스 만들기 (manian님 확인)
* 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
**/
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
// 2008. 04. 23 blamed count 컬럼 추가
// 2008. 04. 23 Add a column(blamed count)
if(!$oDB->isColumnExists("documents", "blamed_count")) {
$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
@ -184,23 +171,21 @@
if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7);
/**
* 2009. 01. 29 : 확장변수 테이블에 lang_code가 없을 경우 추가
* 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table
**/
if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10);
// 2009. 01. 29 Added a trigger for additional setup
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
// 2009. 03. 09 documents에 lang_code 컬럼 추가
// 2009. 03. 09 Add a column(lang_code) to the documnets table
if(!$oDB->isColumnExists("documents","lang_code")) {
$db_info = Context::getDBInfo();
$oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code);
$obj->lang_code = $db_info->lang_type;
executeQuery('document.updateDocumentsLangCode', $obj);
}
// 2009. 03. 11 확장변수 값 테이블의 인덱스 점검
// 2009. 03. 11 Check the index in the document_extra_vars table
if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) {
$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
}
@ -210,8 +195,8 @@
}
/**
* 2009. 03. 19 : 확장변수 테이블에 eid 없을 경우 추가
* 2009. 04. 12 : eid를 등록할 다른 필드 값이 변경되는 문제 수정 #17922959
* 2009. 03. 19: Add a column(eid)
* 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column
**/
if(!$oDB->isColumnExists("document_extra_keys","eid")) {
$oDB->addColumn("document_extra_keys","eid","varchar",40);
@ -251,10 +236,10 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
// 게시글 분류 캐시 파일 삭제
// Delete the cache files of document_category
FileHandler::removeFilesInDir(_XE_PATH_."files/cache/document_category");
}

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
/**
* @class documentItem
* @author NHN (developers@xpressengine.com)
* @brief document 객체
* @brief document object
**/
class documentItem extends Object {
@ -40,8 +40,7 @@
$this->document_srl = $attribute->document_srl;
$this->lang_code = $attribute->lang_code;
$this->adds($attribute);
// 태그 정리
// Tags
if($this->get('tags')) {
$tags = explode(',',$this->get('tags'));
$tag_count = count($tags);
@ -95,15 +94,14 @@
function allowTrackback() {
static $allow_trackback_status = null;
if(is_null($allow_trackback_status)) {
// 엮인글 관리 모듈의 사용금지 설정 상태이면 무조건 금지, 그렇지 않으면 개별 체크
// If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module.
$oModuleModel = &getModel('module');
$trackback_config = $oModuleModel->getModuleConfig('trackback');
if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
else {
$module_srl = $this->get('module_srl');
// 모듈별 설정을 체크
// Check settings of each module
$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
@ -153,25 +151,20 @@
function notify($type, $content) {
if(!$this->document_srl) return;
// useNotify가 아니면 return
// return if it is not useNotify
if(!$this->useNotify()) return;
// 글쓴이가 로그인 유저가 아니면 패스~
// Pass if an author is not a logged-in user
if(!$this->get('member_srl')) return;
// 현재 로그인한 사용자와 글을 쓴 사용자를 비교하여 동일하면 return
// Return if the currently logged-in user is an author
$logged_info = Context::get('logged_info');
if($logged_info->member_srl == $this->get('member_srl')) return;
// 변수 정리
// List variables
if($type) $title = "[".$type."] ";
$title .= cut_str(strip_tags($content), 10, '...');
$content = sprintf('%s<br /><br />from : <a href="%s" target="_blank">%s</a>',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl));
$receiver_srl = $this->get('member_srl');
$sender_member_srl = $logged_info->member_srl;
// 쪽지 발송
// Send a message
$oCommunicationController = &getController('communication');
$oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false);
}
@ -263,13 +256,12 @@
$content = $this->get('content');
if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
// rewrite모듈을 사용하면 링크 재정의
// Define a link if using a rewrite module
$oContext = &Context::getInstance();
if($oContext->allow_rewrite) {
$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
}
// 이 게시글을... 팝업메뉴를 출력할 경우
// To display a pop-up menu
if($add_popup_menu) {
$content = sprintf(
'%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>',
@ -277,8 +269,7 @@
$this->document_srl, Context::getLang('cmd_document_do')
);
}
// 컨텐츠에 대한 조작이 가능한 추가 정보를 설정하였을 경우
// If additional content information is set
if($add_content_info) {
$content = sprintf(
'<!--BeforeDocument(%d,%d)--><div class="document_%d_%d xe_content">%s</div><!--AfterDocument(%d,%d)-->',
@ -288,12 +279,11 @@
$this->document_srl, $this->get('member_srl'),
$this->document_srl, $this->get('member_srl')
);
// 컨텐츠에 대한 조작이 필요하지 않더라도 xe_content라는 클래스명을 꼭 부여
// Add xe_content class although accessing content is not required
} else {
if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
}
// resource_realpath가 true이면 내용내 이미지의 경로를 절대 경로로 변경
// Change the image path to a valid absolute path if resource_realpath is true
if($resource_realpath) {
$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
}
@ -302,7 +292,7 @@
}
/**
* 에디터 코드가 변환된 내용 반환
* Return transformed content by Editor codes
**/
function getTransContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true) {
$oEditorController = &getController('editor');
@ -316,25 +306,25 @@
function getSummary($str_size = 50, $tail = '...') {
$content = $this->getContent(false,false);
// 줄바꿈이 있을 때, 공백문자 삽입
// For a newlink, inert a whitespace
$content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content);
// </p>, </div>, </li> 등의 태그를 공백 문자로 치환
// Replace tags such as </p> , </div> , </li> and others to a whitespace
$content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content);
// 태그 제거
// Remove Tags
$content = preg_replace('!<([^>]*?)>!is','', $content);
// < , > , " 를 치환
// Replace < , >, "
$content = str_replace(array('&lt;','&gt;','&quot;','&nbsp;'), array('<','>','"',' '), $content);
// 연속된 공백문자 삭제
// Delete a series of whitespaces
$content = preg_replace('/ ( +)/is', ' ', $content);
// 문자열을 자름
// Truncate string
$content = trim(cut_str($content, $str_size, $tail));
// >, <, "를 다시 복구
// Replace back < , <, "
$content = str_replace(array('<','>','"'),array('&lt;','&gt;','&quot;'), $content);
return $content;
@ -383,8 +373,7 @@
function getTrackbackUrl() {
if(!$this->document_srl) return;
// 스팸을 막기 위한 key 생성
// Generate a key to prevent spams
$oTrackbackModel = &getModel('trackback');
return $oTrackbackModel->getTrackbackUrl($this->document_srl);
}
@ -431,7 +420,7 @@
if($extra_vars)
{
// eid 명칭으로 확장변수 처리
// Handle extra variable(eid)
foreach($extra_vars as $idx => $key) {
$extra_eid[$key->eid] = $key;
}
@ -441,7 +430,7 @@
function getExtraEidValueHTML($eid) {
$extra_vars = $this->getExtraVars();
// eid 명칭으로 확장변수 처리
// Handle extra variable(eid)
foreach($extra_vars as $idx => $key) {
$extra_eid[$key->eid] = $key;
}
@ -461,33 +450,27 @@
function getComments() {
if(!$this->allowComment() || !$this->getCommentCount()) return;
if(!$this->isGranted() && $this->isSecret()) return;
// cpage는 댓글페이지의 번호
// cpage is a number of comment pages
$cpage = Context::get('cpage');
// 댓글 목록을 구해옴
// Get a list of comments
$oCommentModel = &getModel('comment');
$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
if(!$output->toBool() || !count($output->data)) return;
// 구해온 목록을 commentItem 객체로 만듬
// 계층구조에 따라 부모글에 관리권한이 있으면 자식글에는 보기 권한을 줌
// Create commentItem object from a comment list
// If admin priviledge is granted on parent posts, you can read its child posts.
$accessible = array();
foreach($output->data as $key => $val) {
$oCommentItem = new commentItem();
$oCommentItem->setAttribute($val);
// 권한이 있는 글에 대해 임시로 권한이 있음을 설정
// If permission is granted to the post, you can access it temporarily
if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
// 현재 댓글이 비밀글이고 부모글이 있는 답글이고 부모글에 대해 관리 권한이 있으면 보기 가능하도록 수정
// If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post
if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) {
$oCommentItem->setAccessible();
}
$comment_list[$val->comment_srl] = $oCommentItem;
}
// 스킨에서 출력하기 위한 변수 설정
// Variable setting to be displayed on the skin
Context::set('cpage', $output->page_navigation->cur_page);
if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
@ -514,16 +497,13 @@
}
function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') {
// 존재하지 않는 문서일 경우 return false
// Return false if the document doesn't exist
if(!$this->document_srl) return;
// 높이 지정이 별도로 없으면 정사각형으로 생성
// If not specify its height, create a square
if(!$height) $height = $width;
// 첨부파일이 없거나 내용중 이미지가 없으면 return false;
// Return false if neither attachement nor image files in the document
if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return;
// 문서 모듈의 기본 설정에서 Thumbnail의 생성 방법을 구함
// Get thumbnai_type information from document module's configuration
if(!in_array($thumbnail_type, array('crop','ratio'))) {
$config = $GLOBALS['__document_config__'];
if(!$config) {
@ -533,23 +513,19 @@
}
$thumbnail_type = $config->thumbnail_type;
}
// 섬네일 정보 정의
// Define thumbnail information
$thumbnail_path = sprintf('files/cache/thumbnails/%s',getNumberingPath($this->document_srl, 3));
$thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
$thumbnail_url = Context::getRequestUri().$thumbnail_file;
// 섬네일 파일이 있을 경우 파일의 크기가 0 이면 return false 아니면 경로 return
// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
if(file_exists($thumbnail_file)) {
if(filesize($thumbnail_file)<1) return false;
else return $thumbnail_url;
}
// 대상 파일
// Target File
$source_file = null;
$is_tmp_file = false;
// 첨부된 파일중 이미지 파일이 있으면 찾음
// Find an iamge file among attached files if exists
if($this->get('uploaded_count')) {
$oFileModel = &getModel('file');
$file_list = $oFileModel->getFiles($this->document_srl);
@ -564,8 +540,7 @@
}
}
}
// 첨부된 파일이 없으면 내용중 이미지 파일을 구함
// If not exists, file an image file from the content
if(!$source_file) {
$content = $this->get('content');
$target_src = null;
@ -597,42 +572,39 @@
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
}
if($is_tmp_file) FileHandler::removeFile($source_file);
// 섬네일 생성 성공시 경로 return
// Return its path if a thumbnail is successfully genetated
if($output) return $thumbnail_url;
// 차후 다시 섬네일 생성을 시도하지 않기 위해 빈 파일을 생성
// Create an empty file not to re-generate the thumbnail
else FileHandler::writeFile($thumbnail_file, '','w');
return;
}
/**
* @brief 새글, 최신 업데이트글, 비밀글, 이미지/동영상/첨부파일등의 아이콘 출력용 함수
* $time_interval 지정된 시간() 새글/최신 업데이트글의 판별
* @brief Functions to display icons for new post, latest update, secret(private) post, image/video/attachment
* Determine new post and latest update by $time_interval
**/
function getExtraImages($time_interval = 43200) {
if(!$this->document_srl) return;
// 아이콘 목록을 담을 변수 미리 설정
// variables for icon list
$buffs = array();
$check_files = false;
// 비밀글 체크
// Check if secret post is
if($this->isSecret()) $buffs[] = "secret";
// 최신 시간 설정
// Set the latest time
$time_check = date("YmdHis", time()-$time_interval);
// 새글 체크
// Check new post
if($this->get('regdate')>$time_check) $buffs[] = "new";
else if($this->get('last_update')>$time_check) $buffs[] = "update";
/*
$content = $this->get('content');
// 사진 이미지 체크
// Check image files
preg_match_all('!<img([^>]*?)>!is', $content, $matches);
$cnt = count($matches[0]);
for($i=0;$i<$cnt;$i++) {
@ -642,26 +614,25 @@
break;
}
// 동영상 체크
// Check video files
if(preg_match('!<embed([^>]*?)>!is', $content) || preg_match('/editor_component=("|\')*multimedia_link/i', $content) ) {
$buffs[] = "movie";
$check_files = true;
}
*/
// 첨부파일 체크
// Check the attachment
if($this->hasUploadedFiles()) $buffs[] = "file";
return $buffs;
}
/**
* @brief getExtraImages로 구한 값을 이미지 태그를 씌워서 리턴
* @brief Return the value obtained from getExtraImages with image tag
**/
function printExtraImages($time_check = 43200) {
if(!$this->document_srl) return;
// 아이콘 디렉토리 구함
// Get the icon directory
$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
$buffs = $this->getExtraImages($time_check);
@ -693,7 +664,7 @@
}
/**
* @brief 에디터 html을 구해서 return
* @brief Return Editor html
**/
function getEditor() {
$module_srl = $this->get('module_srl');
@ -704,18 +675,18 @@
}
/**
* @brief 댓글을 있는지에 대한 권한 체크
* 게시글의 댓글 권한과 다른 부분
* @brief Check whether to have a permission to write comment
* Authority to write a comment and to write a document is separated
**/
function isEnableComment() {
// 권한이 없고 비밀글 or 댓글금지 or 댓글허용금지이면 return false
// Return false if not authorized, if a secret document, if the document is set not to allow any comment
if(!$this->isGranted() && ( $this->isSecret() || $this->isLocked() || !$this->allowComment() ) ) return false;
return true;
}
/**
* @brief 댓글 에디터 html을 구해서 return
* @brief Return comment editor's html
**/
function getCommentEditor() {
if(!$this->isEnableComment()) return;
@ -725,7 +696,7 @@
}
/**
* @brief 작성자의 프로필 이미지를 return
* @brief Return author's profile image
**/
function getProfileImage() {
if(!$this->isExists() || !$this->get('member_srl')) return;
@ -737,17 +708,15 @@
}
/**
* @brief 작성자의 서명을 return
* @brief Return author's signiture
**/
function getSignature() {
// 존재하지 않는 글이면 패스~
// Pass if a document doesn't exist
if(!$this->isExists() || !$this->get('member_srl')) return;
// 서명정보를 구함
// Get signature information
$oMemberModel = &getModel('member');
$signature = $oMemberModel->getSignature($this->get('member_srl'));
// 회원모듈에서 서명 최고 높이 지정되었는지 검사
// Check if a maximum height of signiture is set in the member module
if(!isset($GLOBALS['__member_signature_max_height'])) {
$oModuleModel = &getModel('module');
$member_config = $oModuleModel->getModuleConfig('member');
@ -762,7 +731,7 @@
}
/**
* @brief 내용내의 이미지 경로를 절대 경로로 변경
* @brief Change an image path in the content to absolute path
**/
function replaceResourceRealPath($matches) {
return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);

View file

@ -2,45 +2,41 @@
/**
* @class documentModel
* @author NHN (developers@xpressengine.com)
* @brief document 모듈의 model 클래스
* @brief model class of the module document
**/
class documentModel extends document {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief document대한 권한을 세션값으로 체크
* @brief document checked the permissions on the session values
**/
function isGranted($document_srl) {
return $_SESSION['own_document'][$document_srl];
}
/**
* @brief 확장변수를 문서마다 처리하지 않기 위해 매크로성으로 일괄 select 적용
* @brief extra variables for each article will not be processed bulk select and apply the macro city
**/
function setToAllDocumentExtraVars() {
static $checked_documents = array();
// XE에서 모든 문서 객체는 XE_DOCUMENT_LIST라는 전역 변수에 세팅을 함
// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
if(!count($GLOBALS['XE_DOCUMENT_LIST'])) return;
// 모든 호출된 문서 객체를 찾아서 확장변수가 설정되었는지를 확인
// Find all called the document object variable has been set extension
$document_srls = array();
foreach($GLOBALS['XE_DOCUMENT_LIST'] as $key => $val) {
if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
$checked_documents[$val->document_srl] = true;
$document_srls[] = $val->document_srl;
}
// 검출된 문서 번호가 없으면 return
// If the document number, return detected
if(!count($document_srls)) return;
// 확장변수 미지정된 문서에 대해서 일단 현재 접속자의 언어코드로 확장변수를 검색
// Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable
$obj->document_srl = implode(',',$document_srls);
$output = executeQueryArray('document.getDocumentExtraVars', $obj);
if($output->toBool() && $output->data) {
@ -62,8 +58,7 @@
$extra_keys = $this->getExtraKeys($module_srl);
$vars = $extra_vars[$document_srl];
$document_lang_code = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->get('lang_code');
// 확장변수 처리
// Expand the variable processing
if(count($extra_keys)) {
foreach($extra_keys as $idx => $key) {
$val = $vars[$idx];
@ -78,11 +73,9 @@
unset($evars);
$evars = new ExtraVar($module_srl);
$evars->setExtraVarKeys($extra_keys);
// 제목 처리
// Title Processing
if($vars[-1][$user_lang_code]) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->add('title',$vars[-1][$user_lang_code]);
// 내용 처리
// Information processing
if($vars[-2][$user_lang_code]) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->add('content',$vars[-2][$user_lang_code]);
if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]){
@ -94,7 +87,7 @@
}
/**
* @brief 문서 가져오기
* @brief Import Document
**/
function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true) {
if(!$document_srl) return new documentItem();
@ -110,7 +103,7 @@
}
/**
* @brief 여러개의 문서들을 가져옴 (페이징 아님)
* @brief Bringing multiple documents (or paging)
**/
function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true) {
if(is_array($document_srls)) {
@ -157,29 +150,25 @@
}
/**
* @brief module_srl값을 가지는 문서의 목록을 가져옴
* @brief module_srl value, bringing the list of documents
**/
function getDocumentList($obj, $except_notice = false, $load_extra_vars=true) {
// 정렬 대상과 순서 체크
// Check the target and sequence alignment
if(!in_array($obj->sort_index, array('list_order','regdate','last_update','update_order','readed_count','voted_count','comment_count','trackback_count','uploaded_count','title','category_srl'))) $obj->sort_index = 'list_order';
if(!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc';
// module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌
// If that came across mid module_srl instead of a direct module_srl guhaejum
if($obj->mid) {
$oModuleModel = &getModel('module');
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
unset($obj->mid);
}
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
// Module_srl passed the array may be a check whether the array
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
else $args->module_srl = $obj->module_srl;
// 제외 module_srl에 대한 검사
// Except for the test module_srl
if(is_array($obj->exclude_module_srl)) $args->exclude_module_srl = implode(',', $obj->exclude_module_srl);
else $args->exclude_module_srl = $obj->exclude_module_srl;
// 변수 체크
// Variable check
$args->category_srl = $obj->category_srl?$obj->category_srl:null;
$args->sort_index = $obj->sort_index;
$args->order_type = $obj->order_type;
@ -189,39 +178,35 @@
$args->start_date = $obj->start_date?$obj->start_date:null;
$args->end_date = $obj->end_date?$obj->end_date:null;
$args->member_srl = $obj->member_srl;
// 카테고리가 선택되어 있으면 하부 카테고리까지 모두 조건에 추가
// Category is selected, further sub-categories until all conditions
if($args->category_srl) {
$category_list = $this->getCategoryList($args->module_srl);
$category_info = $category_list[$args->category_srl];
$category_info->childs[] = $args->category_srl;
$args->category_srl = implode(',',$category_info->childs);
}
// 기본으로 사용할 query id 지정 (몇가지 검색 옵션에 따라 query id가 변경됨)
// Used to specify the default query id (based on several search options to query id modified)
$query_id = 'document.getDocumentList';
// 내용검색일 경우 document division을 지정하여 검색하기 위한 처리
// If the search by specifying the document division naeyonggeomsaekil processed for
$use_division = false;
// 검색 옵션 정리
// Search options
$searchOpt->search_target = $obj->search_target;
$searchOpt->search_keyword = $obj->search_keyword;
$this->_setSearchOption($searchOpt, &$args, &$query_id, &$use_division);
/**
* division은 list_order의 asc 정렬일때만 사용할 있음
* list_order asc sort of division that can be used only when
**/
if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false;
/**
* 만약 use_division이 true일 경우 document division을 이용하도록 변경
* If it is true, use_division changed to use the document division
**/
if($use_division) {
// 시작 division
// Division begins
$division = (int)Context::get('division');
// division값이 없다면 제일 상위
// If you do not value the best division top
if(!$division) {
$division_args->module_srl = $args->module_srl;
$division_args->exclude_module_srl = $args->exclude_module_srl;
@ -235,11 +220,9 @@
}
$division_args = null;
}
// 마지막 division
// The last division
$last_division = (int)Context::get('last_division');
// 지정된 division에서부터 5000개 후의 division값을 구함
// Division after division from the 5000 value of the specified Wanted
if(!$last_division) {
$last_division_args->module_srl = $args->module_srl;
$last_division_args->exclude_module_srl = $args->exclude_module_srl;
@ -255,8 +238,7 @@
}
}
// last_division 이후로 글이 있는지 확인
// Make sure that after last_division article
if($last_division) {
$last_division_args = null;
$last_division_args->module_srl = $args->module_srl;
@ -271,9 +253,8 @@
Context::set('division', $division);
Context::set('last_division', $last_division);
}
// document.getDocumentList 쿼리 실행
// 만약 query_id가 getDocumentListWithinComment 또는 getDocumentListWithinTag일 경우 group by 절 사용 때문에 쿼리를 한번더 수행
// document.getDocumentList query execution
// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
if(in_array($query_id, array('document.getDocumentListWithinComment', 'document.getDocumentListWithinTag'))) {
$group_args = clone($args);
$group_args->sort_index = 'documents.'.$args->sort_index;
@ -301,8 +282,7 @@
} else {
$output = executeQueryArray($query_id, $args);
}
// 결과가 없거나 오류 발생시 그냥 return
// Return if no result or an error occurs
if(!$output->toBool()||!count($output->data)) return $output;
$idx = 0;
@ -349,7 +329,7 @@
}
/**
* @brief module_srl값을 가지는 문서의 공지사항만 가져옴
* @brief module_srl value, bringing the document's gongjisa Port
**/
function getNoticeList($obj) {
$args->module_srl = $obj->module_srl;
@ -378,8 +358,8 @@
}
/**
* @brief document의 확장 변수 키값을 가져오는 함수
* $form_include : 작성시에 필요한 확장변수의 input form 추가 여부
* @brief function to retrieve the key values of the extended variable document
* $Form_include: writing articles whether to add the necessary extensions of the variable input form
**/
function getExtraKeys($module_srl) {
if(is_null($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) {
@ -398,11 +378,11 @@
}
/**
* @brief 특정 document의 확장 변수 값을 가져오는 함수
* @brief A particular document to get the value of the extra variable function
**/
function getExtraVars($module_srl, $document_srl) {
if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) {
// 확장변수 값을 추출하여 세팅
// Extended to extract the values of variables set
$oDocument = $this->getDocument($document_srl, false);
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
$this->setToAllDocumentExtraVars();
@ -412,27 +392,23 @@
}
/**
* @brief 선택된 게시물의 팝업메뉴 표시
* @brief Show pop-up menu of the selected posts
*
* 인쇄, 스크랩, 추천, 비추천, 신고 기능 추가
* Printing, scrap, recommendations and negative, reported the Add Features
**/
function getDocumentMenu() {
// 요청된 게시물 번호와 현재 로그인 정보 구함
// Post number and the current login information requested Wanted
$document_srl = Context::get('target_srl');
$mid = Context::get('cur_mid');
$logged_info = Context::get('logged_info');
$act = Context::get('cur_act');
// menu_list 에 "표시할글,target,url" 을 배열로 넣는다
// to menu_list "pyosihalgeul, target, url" put into an array
$menu_list = array();
// trigger 호출
// call trigger
ModuleHandler::triggerCall('document.getDocumentMenu', 'before', $menu_list);
$oDocumentController = &getController('document');
// 회원이어야만 가능한 기능
// Members must be a possible feature
if($logged_info->member_srl) {
$oDocumentModel = &getModel('document');
@ -444,40 +420,37 @@
$oModuleModel = &getModel('module');
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl){
// 추천 버튼 추가
// Add a Referral Button
$url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl);
$oDocumentController->addDocumentPopupMenu($url,'cmd_vote','./modules/document/tpl/icons/vote_up.gif','javascript');
}
if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl){
// 비추천 버튼 추가
// Add button to negative
$url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
$oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','./modules/document/tpl/icons/vote_down.gif','javascript');
}
// 신고 기능 추가
// Adding Report
$url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','./modules/document/tpl/icons/declare.gif','javascript');
// 스크랩 버튼 추가
// Add Bookmark button
$url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);
$oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','./modules/document/tpl/icons/scrap.gif','javascript');
}
// 인쇄 버튼 추가
// Add print button
$url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl);
$oDocumentController->addDocumentPopupMenu($url,'cmd_print','./modules/document/tpl/icons/print.gif','printDocument');
// trigger 호출 (after)
// Call a trigger (after)
ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list);
// 관리자일 경우 ip로 글 찾기
// If you are managing to find posts by ip
if($logged_info->is_admin == 'Y') {
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
if($oDocument->isExists()) {
// ip주소에 해당하는 글 찾기
// Find a post equivalent to ip address
$url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->get('ipaddress'));
$icon_path = './modules/member/tpl/images/icon_management.gif';
$oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
@ -486,23 +459,21 @@
$oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','./modules/document/tpl/icons/declare.gif','javascript');
}
}
// 팝업메뉴의 언어 변경
// Changing the language of pop-up menu
$menus = Context::get('document_popup_menu_list');
$menus_count = count($menus);
for($i=0;$i<$menus_count;$i++) {
$menus[$i]->str = Context::getLang($menus[$i]->str);
}
// 최종적으로 정리된 팝업메뉴 목록을 구함
// Wanted to finally clean pop-up menu list
$this->add('menus', $menus);
}
/**
* @brief module_srl해당하는 문서의 전체 갯수를 가져옴
* @brief module_srl the total number of documents that are bringing
**/
function getDocumentCount($module_srl, $search_obj = NULL) {
// 검색 옵션 추가
// Additional search options
$args->module_srl = $module_srl;
$args->s_title = $search_obj->s_title;
$args->s_content = $search_obj->s_content;
@ -513,16 +484,15 @@
$args->category_srl = $search_obj->category_srl;
$output = executeQuery('document.getDocumentCount', $args);
// 전체 갯수를 return
// Return total number of
$total_count = $output->data->count;
return (int)$total_count;
}
/**
* @brief 해당 document의 page 가져오기, module_srl이 없으면 전체에서..
* @brief Import page of the document, module_srl Without throughout ..
**/
function getDocumentPage($oDocument, $opt) {
// 정렬 형식에 따라서 query args 변경
// Sort type changes depending on the query args
switch($opt->sort_index) {
case 'update_order' :
if($opt->order_type == 'desc') $args->rev_update_order = $oDocument->get('update_order');
@ -552,7 +522,7 @@
$searchOpt->search_keyword = $opt->search_keyword;
$this->_setSearchOption($searchOpt, &$args, &$query_id, &$use_division);
// 전체 갯수를 구한후 해당 글의 페이지를 검색
// Guhanhu total number of the article search page
$output = executeQuery('document.getDocumentPage', $args);
$count = $output->data->count;
$page = (int)(($count-1)/$opt->list_count)+1;
@ -560,7 +530,7 @@
}
/**
* @brief 카테고리의 정보를 가져옴
* @brief Imported Category of information
**/
function getCategory($category_srl) {
$args->category_srl = $category_srl;
@ -581,7 +551,7 @@
}
/**
* @brief 특정 카테고리에 child가 있는지 체크
* @brief Check whether the child has a specific category
**/
function getCategoryChlidCount($category_srl) {
$args->category_srl = $category_srl;
@ -591,29 +561,27 @@
}
/**
* @brief 특정 모듈의 카테고리 목록을 가져옴
* 속도나 여러가지 상황을 고려해서 카테고리 목록은 php로 생성된 script를 include하여 사용하는 것을 원칙으로
* @brief Bringing the Categories list the specific module
* Speed and variety of categories, considering the situation created by the php script to include a list of the must, in principle, to use
**/
function getCategoryList($module_srl) {
// 대상 모듈의 카테고리 파일을 불러옴
// Category of the target module file swollen
$filename = sprintf("./files/cache/document_category/%s.php", $module_srl);
// 대상 파일이 없으면 카테고리 캐시 파일을 재생성
// If the target file to the cache file regeneration category
if(!file_exists($filename)) {
$oDocumentController = &getController('document');
if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
}
@include($filename);
// 카테고리의 정리
// Cleanup of category
$document_category = array();
$this->_arrangeCategory($document_category, $menu->list, 0);
return $document_category;
}
/**
* @brief 카테고리를 1 배열 형식으로 변경하는 내부 method
* @brief Category within a primary method to change the array type
**/
function _arrangeCategory(&$document_category, $list, $depth) {
if(!count($list)) return;
@ -640,8 +608,7 @@
$obj->selected = $selected;
$list_order[$idx++] = $obj->category_srl;
// 부모 카테고리가 있으면 자식노드들의 데이터를 적용
// If you have a parent category of child nodes apply data
if($obj->parent_srl) {
$parent_srl = $obj->parent_srl;
@ -668,7 +635,7 @@
}
/**
* @brief 카테고리에 속한 문서의 갯수를 구함
* @brief Wanted number of documents belonging to category
**/
function getCategoryDocumentCount($module_srl, $category_srl) {
$args->module_srl = $module_srl;
@ -678,7 +645,7 @@
}
/**
* @brief 문서 category정보의 xml 캐시 파일을 return
* @brief Xml cache file of the document category return information
**/
function getCategoryXmlFile($module_srl) {
$xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl);
@ -690,7 +657,7 @@
}
/**
* @brief 문서 category정보의 php 캐시 파일을 return
* @brief Php cache files in the document category return information
**/
function getCategoryPhpFile($module_srl) {
$php_file = sprintf('files/cache/document_category/%s.php',$module_srl);
@ -702,7 +669,7 @@
}
/**
* @brief 월별 보관현황을 가져옴
* @brief Imported post monthly archive status
**/
function getMonthlyArchivedList($obj) {
if($obj->mid) {
@ -710,8 +677,7 @@
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
unset($obj->mid);
}
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
// Module_srl passed the array may be a check whether the array
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
else $args->module_srl = $obj->module_srl;
@ -724,7 +690,7 @@
}
/**
* @brief 특정달의 일별 현황을 가져옴
* @brief Bringing a month on the status of the daily posts
**/
function getDailyArchivedList($obj) {
if($obj->mid) {
@ -732,8 +698,7 @@
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
unset($obj->mid);
}
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
// Module_srl passed the array may be a check whether the array
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
else $args->module_srl = $obj->module_srl;
$args->regdate = $obj->regdate;
@ -747,15 +712,14 @@
}
/**
* @brief 특정 모듈의 분류를 구함
* @brief Get a list for a particular module
**/
function getDocumentCategories() {
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
$module_srl = Context::get('module_srl');
$categories= $this->getCategoryList($module_srl);
$lang = Context::get('lang');
// 분류 없음 추가
// No additional category
$output = "0,0,{$lang->none_category}\n";
if($categories){
foreach($categories as $category_srl => $category) {
@ -766,7 +730,7 @@
}
/**
* @brief 문서 설정 정보를 구함
* @brief Wanted to set document information
**/
function getDocumentConfig() {
if(!$GLOBALS['__document_config__']) {
@ -779,21 +743,20 @@
}
/**
* @brief 공통 :: 모듈의 확장 변수 관리
* 모듈의 확장변수 관리는 모든 모듈에서 document module instance를 이용할때 사용할 있음
* @brief Common:: Module extensions of variable management
* Expansion parameter management module in the document module instance, when using all the modules available
**/
function getExtraVarsHTML($module_srl) {
// 기존의 extra_keys 가져옴
// Bringing existing extra_keys
$extra_keys = $this->getExtraKeys($module_srl);
Context::set('extra_keys', $extra_keys);
// grant 정보를 추출
// Get information of module_grants
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($this->module_path.'tpl', 'extra_keys');
}
/**
* @brief 공통 :: 모듈의 카테고리 변수 관리
* @brief Common:: Category parameter management module
**/
function getCategoryHTML($module_srl) {
$category_xml_file = $this->getCategoryXmlFile($module_srl);
@ -801,50 +764,43 @@
Context::set('category_xml_file', $category_xml_file);
Context::loadJavascriptPlugin('ui.tree');
// grant 정보를 추출
// Get information of module_grants
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($this->module_path.'tpl', 'category_list');
}
/**
* @brief 특정 카테고리의 정보를 이용하여 템플릿을 구한후 return
* 관리자 페이지에서 특정 메뉴의 정보를 추가하기 위해 서버에서 tpl을 컴파일 한후 컴파일 html을 직접 return
* @brief Certain categories of information, return the template guhanhu
* Manager on the page to add information about a particular menu from the server after compiling tpl compiled a direct return html
**/
function getDocumentCategoryTplInfo() {
$oModuleModel = &getModel('module');
$oMemberModel = &getModel('member');
// 해당 메뉴의 정보를 가져오기 위한 변수 설정
// Get information on the menu for the parameter settings
$module_srl = Context::get('module_srl');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
// 권한 체크
// Check permissions
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
if(!$grant->manager) return new Object(-1,'msg_not_permitted');
$category_srl = Context::get('category_srl');
$parent_srl = Context::get('parent_srl');
// 회원 그룹의 목록을 가져옴
// Get a list of member groups
$group_list = $oMemberModel->getGroups($module_info->site_srl);
Context::set('group_list', $group_list);
// parent_srl이 있고 category_srl 이 없으면 하부 메뉴 추가임
// Without the sub-menu has parent_srl category_srl chugaim
if(!$category_srl && $parent_srl) {
// 상위 메뉴의 정보를 가져옴
// Get information of the parent menu
$parent_info = $this->getCategory($parent_srl);
// 추가하려는 메뉴의 기본 변수 설정
// Default parameter settings for a new menu
$category_info->category_srl = getNextSequence();
$category_info->parent_srl = $parent_srl;
$category_info->parent_category_title = $parent_info->title;
// root에 메뉴 추가하거나 기존 메뉴의 수정일 경우
// Add to the root menu, or if an existing menu Modified
} else {
// category_srl 이 있으면 해당 메뉴의 정보를 가져온다
// If category_srl the menu brings the information
if($category_srl) $category_info = $this->getCategory($category_srl);
// 찾아진 값이 없다면 신규 메뉴 추가로 보고 category_srl값만 구해줌
// If you do not add value d which pertain to the menu to see the new values guhaejum category_srl
if(!$category_info->category_srl) {
$category_info->category_srl = getNextSequence();
}
@ -853,17 +809,14 @@
$category_info->title = htmlspecialchars($category_info->title);
Context::set('category_info', $category_info);
// template 파일을 직접 컴파일한후 tpl변수에 담아서 return한다.
// tpl template file directly compile and will return a variable and puts it on.
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile('./modules/document/tpl', 'category_info');
$tpl = str_replace("\n",'',$tpl);
// 사용자 정의 언어 변경
// Changing user-defined language
$oModuleController = &getController('module');
$oModuleController->replaceDefinedLangCode($tpl);
// return 할 변수 설정
// set of variables to return
$this->add('tpl', $tpl);
}
@ -906,20 +859,17 @@
}
/**
* @brief module_srl값을 가지는 문서의 목록을 가져옴
* @brief module_srl value, bringing the list of documents
**/
function getTrashList($obj) {
// 변수 체크
// Variable check
$args->category_srl = $obj->category_srl?$obj->category_srl:null;
$args->sort_index = $obj->sort_index;
$args->order_type = $obj->order_type?$obj->order_type:'desc';
$args->page = $obj->page?$obj->page:1;
$args->list_count = $obj->list_count?$obj->list_count:20;
$args->page_count = $obj->page_count?$obj->page_count:10;
// 검색 옵션 정리
// Search options
$search_target = $obj->search_target;
$search_keyword = $obj->search_keyword;
if($search_target && $search_keyword) {

View file

@ -2,42 +2,37 @@
/**
* @class documentView
* @author NHN (developers@xpressengine.com)
* @brief document 모듈의 View class
* @brief View class of the module document
**/
class documentView extends document {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 문서 인쇄 기능
* 해당 글만 찾아서 그냥 출력해버린다;;
* @brief Document printing
* I make it out to find the geulman;;
**/
function dispDocumentPrint() {
// 목록 구현에 필요한 변수들을 가져온다
// Bring a list of variables needed to implement
$document_srl = Context::get('document_srl');
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
// document 객체를 생성. 기본 데이터 구조의 경우 document모듈만 쓰면 만사 해결.. -_-;
// Create the document object. If the document module of basic data structures, write it all works .. -_-;
$oDocumentModel = &getModel('document');
// 선택된 문서 표시를 위한 객체 생성
// Creates an object for displaying the selected document
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
// 권한 체크
// Check permissions
if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
// 모듈 정보 세팅
// Information setting module
Context::set('module_info', $module_info);
// 브라우저 타이틀 설정
// Browser title settings
Context::setBrowserTitle($oDocument->getTitleText());
Context::set('oDocument', $oDocument);
@ -47,7 +42,7 @@
}
/**
* @brief 미리 보기
* @brief Preview
**/
function dispDocumentPreview() {
Context::set('layout','none');
@ -58,12 +53,11 @@
}
/**
* @brief 관리자가 선택한 문서에 대한 관리
* @brief Selected by the administrator for the document management
**/
function dispDocumentManageDocument() {
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
// 선택한 목록을 세션에서 가져옴
// Taken from a list of selected sessions
$flag_list = $_SESSION['document_management'];
if(count($flag_list)) {
foreach($flag_list as $key => $val) {
@ -79,11 +73,9 @@
}
$oModuleModel = &getModel('module');
// 모듈 카테고리 목록과 모듈 목록의 조합
// The combination of module categories list and the list of modules
if(count($module_list)>1) Context::set('module_list', $module_categories);
// 팝업 레이아웃 선택
// Select Pop-up layout
$this->setLayoutPath('./common/tpl');
$this->setLayoutFile('popup_layout');
@ -96,7 +88,7 @@
$current_module_srls = Context::get('module_srls');
if(!$current_module_srl && !$current_module_srls) {
// 선택된 모듈의 정보를 가져옴
// Get information of the current module
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new Object();

View file

@ -2,18 +2,17 @@
/**
* @class emoticon
* @author NHN (developers@xpressengine.com)
* @brief 이모티콘 이미지 연결 컴포넌트
* @brief Emoticons image connected components
**/
class emoticon extends EditorHandler {
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
var $emoticon_path = '';
/**
* @brief editor_sequence컴포넌트의 경로를 받음
* @brief editor_sequence and components out of the path
**/
function emoticon($editor_sequence, $component_path) {
$this->editor_sequence = $editor_sequence;
@ -22,7 +21,7 @@
}
/**
* @brief 이모티콘 파일 목록을 리턴
* @brief Returns a list of emoticons file
**/
function getEmoticonList() {
$emoticon = Context::get('emoticon');
@ -34,7 +33,7 @@
}
/**
* @brief 재귀적으로 이모티콘이 법한 파일들을 하위 디렉토리까지 전부 검색한다. 8,000개까지는 테스트 해봤는데 스택오버프로우를 일으킬지 어떨지는 모르겠음.(2007.9.6, 베니)
* @brief Likely to be recursively emoticons will search all the files to a subdirectory. 8000 gaekkajineun ran tests whether the stack and raise beef pro-overs and Unsure. (06/09/2007, Benny)
**/
function getEmoticons($path) {
$emoticon_path = sprintf("%s/%s", $this->emoticon_path, $path);
@ -51,10 +50,10 @@
}
/**
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
* @brief popup window to display in popup window request is to add content
**/
function getPopupContent() {
// 이모티콘 디렉토리 목록을 가져옴
// Bringing a list of emoticons directory
$emoticon_dirs = FileHandler::readDir($this->emoticon_path);
$emoticon_list = array();
if($emoticon_dirs) {
@ -63,12 +62,10 @@
}
}
Context::set('emoticon_list', $emoticon_list);
// 첫번째 이모티콘 디렉토리의 이미지 파일을 구함
// The first emoticon image files in the directory Wanted
$emoticons = $this->getEmoticons($emoticon_list[0]);
Context::set('emoticons', $emoticons);
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
@ -77,7 +74,7 @@
}
/**
* @brief 이모티콘의 경로 문제 해결을 하기 위해 추가하였다. (2007.9.6 베니)
* @brief Emoticon of the path were added to solve the problem. (06/09/2007 Benny)
**/
function transHTML($xml_obj) {
$src = $xml_obj->attrs->src;

View file

@ -2,17 +2,16 @@
/**
* @class image_gallery
* @author NHN (developers@xpressengine.com)
* @brief 업로드된 이미지로 이미지갤러리를 만듬
* @brief Making images uploaded to the image gallery
**/
class image_gallery extends EditorHandler {
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
/**
* @brief editor_sequence컴포넌트의 경로를 받음
* @brief editor_sequence and components out of the path
**/
function image_gallery($editor_sequence, $component_path) {
$this->editor_sequence = $editor_sequence;
@ -20,10 +19,10 @@
}
/**
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
* @brief popup window to display in popup window request is to add content
**/
function getPopupContent() {
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
@ -34,10 +33,10 @@
}
/**
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 코드를 html로 변경하여 주는 method
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
**/
function transHTML($xml_obj) {
$gallery_info->srl = rand(111111,999999);
@ -50,8 +49,7 @@
$images_list = $xml_obj->attrs->images_list;
$images_list = preg_replace('/\.(gif|jpg|jpeg|png) /i',".\\1\n",$images_list);
$gallery_info->images_list = explode("\n",trim($images_list));
// 만약 출력설정이 XML일 경우 이미지 목록만 출력하도록 코드 생성
// If you set the output to output the XML code generated a list of the image
if(Context::getResponseMethod() == 'XMLRPC') {
$output = '';
for($i=0;$i<count($gallery_info->images_list);$i++) {
@ -59,8 +57,7 @@
}
return $output;
}
// HTML 출력일 경우 템플릿 변환을 거쳐서 갤러리 출력 설정에 맞는 html코드를 생성하도록 함
// HTML gallery output, the output settings via the template for the conversion to generate the html code should
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
$gallery_info->width = trim($matches[3][0]);
if(!$gallery_info->width) $gallery_info->width = 400;

View file

@ -2,17 +2,16 @@
/**
* @class image_link
* @author NHN (developers@xpressengine.com)
* @brief 이미지를 추가하거나 속성을 수정하는 컴포넌트
* @brief Add an image, or to modify the properties of components
**/
class image_link extends EditorHandler {
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
/**
* @brief editor_sequence컴포넌트의 경로를 받음
* @brief editor_sequence and components out of the path
**/
function image_link($editor_sequence, $component_path) {
$this->editor_sequence = $editor_sequence;
@ -20,10 +19,10 @@
}
/**
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
* @brief popup window to display in popup window request is to add content
**/
function getPopupContent() {
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
@ -34,10 +33,10 @@
}
/**
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 코드를 html로 변경하여 주는 method
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
**/
function transHTML($xml_obj) {
$src = $xml_obj->attrs->src;
@ -60,7 +59,7 @@
$src = str_replace('&amp;amp;', '&amp;', $src);
if(!$alt) $alt = $src;
// 이미지 주소를 request uri가 포함된 주소로 변환 (rss출력, 등등을 위함)
// Image containing the address to the address conversion request uri (rss output, etc. purposes)
$temp_src = explode('/', $src);
if(substr($src, 0,2)=='./') $src = Context::getRequestUri().substr($src, 2);
elseif(substr($src , 0, 1)=='/') {

View file

@ -2,17 +2,16 @@
/**
* @class multimedia_link
* @author NHN (developers@xpressengine.com)
* @brief 본문에 멀티미디어 자료를 연결하는 컴포넌트
* @brief The components connected to the body of multimedia data
**/
class multimedia_link extends EditorHandler {
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
/**
* @brief editor_sequence컴포넌트의 경로를 받음
* @brief editor_sequence and components out of the path
**/
function multimedia_link($editor_sequence, $component_path) {
$this->editor_sequence = $editor_sequence;
@ -20,10 +19,10 @@
}
/**
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
* @brief popup window to display in popup window request is to add content
**/
function getPopupContent() {
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
@ -34,10 +33,10 @@
}
/**
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 코드를 html로 변경하여 주는 method
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
**/
function transHTML($xml_obj) {
$src = $xml_obj->attrs->multimedia_src;

View file

@ -2,17 +2,16 @@
/**
* @class poll_maker
* @author NHN (developers@xpressengine.com)
* @brief 에디터에서 url링크하는 기능 제공.
* @brief Editor provides the ability to link to the url.
**/
class poll_maker extends EditorHandler {
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
// editor_sequence from the editor must attend mandatory wearing ....
var $editor_sequence = 0;
var $component_path = '';
/**
* @brief editor_sequence컴포넌트의 경로를 받음
* @brief editor_sequence and components out of the path
**/
function poll_maker($editor_sequence, $component_path) {
$this->editor_sequence = $editor_sequence;
@ -20,15 +19,14 @@
}
/**
* @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다
* @brief popup window to display in popup window request is to add content
**/
function getPopupContent() {
// 설문조사 스킨을 구함
// Wanted Skins survey
$oModuleModel = &getModel('module');
$skin_list = $oModuleModel->getSkins("./modules/poll/");
Context::set('skin_list', $skin_list);
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
// Pre-compiled source code to compile template return to
$tpl_path = $this->component_path.'tpl';
$tpl_file = 'popup.html';
@ -37,10 +35,10 @@
}
/**
* @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 코드를 html로 변경하여 주는 method
* @brief Editor of the components separately if you use a unique code to the html code for a method to change
*
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
**/
function transHTML($xml_obj) {
$poll_srl = $xml_obj->attrs->poll_srl;
@ -51,8 +49,7 @@
$width = $matches[2];
if(!$width) $width = 400;
$style = sprintf('width:%dpx', $width);
// poll model 객체 생성해서 html 얻어와서 return
// poll model object creation to come get it return html
$oPollModel = &getModel('poll');
return $oPollModel->getPollHtml($poll_srl, $style, $skin);
}

View file

@ -2,19 +2,19 @@
/**
* @class editorAdminController
* @author NHN (developers@xpressengine.com)
* @brief editor 모듈의 admin controller class
* @brief editor of the module admin controller class
**/
class editorAdminController extends editor {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 컴포넌트의 활성화
* @brief Activate components
**/
function procEditorAdminEnableComponent() {
$site_module_info = Context::get('site_module_info');
@ -33,7 +33,7 @@
}
/**
* @brief 컴포넌트의 비활성화
* @brief Deactivate components
**/
function procEditorAdminDisableComponent() {
$site_module_info = Context::get('site_module_info');
@ -52,15 +52,14 @@
}
/**
* @brief 컴포넌트의 위치 변경
* @brief Change a location of the component
**/
function procEditorAdminMoveListOrder() {
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->component_name = Context::get('component_name');
$mode = Context::get('mode');
// DB에서 전체 목록 가져옴
// Get a full list of components from the DB
if(!$args->site_srl) $output = executeQuery('editor.getComponentList', $args);
else $output = executeQuery('editor.getSiteComponentList', $args);
@ -108,7 +107,7 @@
}
/**
* @brief 컴포넌트 설정
* @brief Set components
**/
function procEditorAdminSetupComponent() {
$site_module_info = Context::get('site_module_info');
@ -138,7 +137,7 @@
}
/**
* @brief 컴포넌트를 DB에 추가
* @brief Add a component to DB
**/
function insertComponent($component_name, $enabled = false, $site_srl = 0) {
if($enabled) $enabled = 'Y';
@ -147,13 +146,11 @@
$args->component_name = $component_name;
$args->enabled = $enabled;
$args->site_srl = $site_srl;
// 컴포넌트가 있는지 확인
// Check if the component exists
if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args);
else $output = executeQuery('editor.isSiteComponentInserted', $args);
if($output->data->count) return new Object(-1, 'msg_component_is_not_founded');
// 입력
// Inert a component
$args->list_order = getNextSequence();
if(!$site_srl) $output = executeQuery('editor.insertComponent', $args);
else $output = executeQuery('editor.insertSiteComponent', $args);

View file

@ -2,26 +2,25 @@
/**
* @class editorAdminView
* @author NHN (developers@xpressengine.com)
* @brief editor 모듈의 admin view 클래스
* @brief editor admin view of the module class
**/
class editorAdminView extends editor {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 관리자 설정 페이지
* 에디터 컴포넌트의 on/off 설정을 담당
* @brief Administrator Setting page
* Settings to enable/disable editor component and other features
**/
function dispEditorAdminIndex() {
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
// 컴포넌트의 종류를 구해옴
// Get a type of component
$oEditorModel = &getModel('editor');
$component_list = $oEditorModel->getComponentList(false, $site_srl, true);
@ -32,33 +31,29 @@
}
/**
* @brief 컴퍼넌트 setup
* @brief Component setup
**/
function dispEditorAdminSetupComponent() {
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
$component_name = Context::get('component_name');
// 에디터 컴포넌트의 정보를 구함
// Get information of the editor component
$oEditorModel = &getModel('editor');
$component = $oEditorModel->getComponent($component_name,$site_srl);
Context::set('component', $component);
// 그룹 설정을 위한 그룹 목록을 구함
// Get a group list to set a group
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($site_srl);
Context::set('group_list', $group_list);
// mid 목록을 가져옴
// Get a mid list
$oModuleModel = &getModel('module');
$args->site_srl = $site_srl;
$mid_list = $oModuleModel->getMidList($args);
// module_category와 module의 조합
// Combination of module_category and module
if(!$args->site_srl) {
// 모듈 카테고리 목록을 구함
// Get a list of module category
$module_categories = $oModuleModel->getModuleCategories();
if(!is_array($mid_list)) $mid_list = array($mid_list);

View file

@ -2,19 +2,18 @@
/**
* @class editor
* @author NHN (developers@xpressengine.com)
* @brief editor 모듈의 high class
* @brief high class of the editor odule
**/
class editor extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
// Register action forward (to use in administrator mode)
$oModuleController = &getController('module');
// 기본 에디터 컴포넌트를 추가
// Add the default editor component
$oEditorController = &getAdminController('editor');
$oEditorController->insertComponent('colorpicker_text',true);
$oEditorController->insertComponent('colorpicker_bg',true);
@ -26,83 +25,71 @@
$oEditorController->insertComponent('table_maker',true);
$oEditorController->insertComponent('poll_maker',true);
$oEditorController->insertComponent('image_gallery',true);
// 에디터 모듈에서 사용할 디렉토리 생성
// Create a directory to use in the editor module
FileHandler::makeDir('./files/cache/editor');
// 2007. 10. 17 글의 입력(신규 or 수정)이 일어날때마다 자동 저장된 문서를 삭제하는 trigger 추가
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
// 2007. 10. 23 모듈의 추가 설정에서 에디터 trigger 추가
// 2007. 10. 23 Add an editor trigger on the module addition setup
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
// 2009. 04. 14 editor component 변환 코드를 trigger로 독립
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oModuleModel = &getModel('module');
$oDB = &DB::getInstance();
// 2009. 06. 15 자동저장시 module_srl 을 저장
// 2009. 06. 15 Save module_srl when auto-saving
if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true;
if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) return true;
// 2007. 10. 17 글의 입력(신규 or 수정)이 일어날때마다 자동 저장된 문서를 삭제하는 trigger 추가
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
// 2007. 10. 23 모듈의 추가 설정에서 에디터 trigger 추가
// 2007. 10. 23 Add an editor trigger on the module addition setup
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true;
// 2009. 04. 14 editor component 변환 코드를 trigger로 독립
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true;
// 2009. 06. 19 사용하지 않는 트리거 제거
// 2009. 06. 19 Remove unused trigger
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
return false;
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
$oDB = &DB::getInstance();
// 자동저장시 module_srl 을 저장 2009.6.15
// Save module_srl when auto-saving 15/06/2009
if(!$oDB->isColumnExists("editor_autosave","module_srl"))
$oDB->addColumn("editor_autosave","module_srl","number",11);
// module_srl을 인덱스로
// create an index on module_srl
if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl");
// 2007. 10. 17 글의 입력(신규 or 수정)이 일어날때마다 자동 저장된 문서를 삭제하는 trigger 추가
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
// 2007. 10. 23 모듈의 추가 설정에서 에디터 trigger 추가
// 2007. 10. Add an editor trigger on the module addition setup
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
// 2009. 04. 14 editor component 변환 코드를 trigger로 독립
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'))
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
// 2009. 06. 19 사용하지 않는 트리거 제거
// 2009. 06. 19 Remove unused trigger
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'))
$oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before');
@ -110,10 +97,10 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
// 에디터 컴포넌트 캐시 파일 삭제
// Delete the cache file editor component
FileHandler::removeFilesInDir("./files/cache/editor");
}
}

View file

@ -2,19 +2,19 @@
/**
* @class editor
* @author NHN (developers@xpressengine.com)
* @brief editor 모듈의 controller class
* @brief editor module's controller class
**/
class editorController extends editor {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 자동 저장
* @brief AutoSave
**/
function procEditorSaveDoc() {
@ -29,7 +29,7 @@
}
/**
* @brief 자동저장된 문서 삭제
* @brief Delete autosaved documents
**/
function procEditorRemoveSavedDoc() {
$oEditorController = &getController('editor');
@ -37,7 +37,7 @@
}
/**
* @brief 컴포넌트에서 ajax요청시 해당 컴포넌트의 method를 실행
* @brief Execute a method of the component when the component requests ajax
**/
function procEditorCall() {
$component = Context::get('component');
@ -67,12 +67,11 @@
}
/**
* @brief 에디터의 모듈별 추가 확장 폼을 저장
* @brief Save Editor's additional form for each module
**/
function procEditorInsertModuleConfig() {
$module_srl = Context::get('target_module_srl');
// 여러개의 모듈 일괄 설정일 경우
// To configure many of modules at once
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);
@ -149,7 +148,7 @@
}
/**
* @brief 에디터컴포넌트의 코드를 결과물로 변환 + 문서서식 style 지정
* @brief convert editor component codes to be returned and specify content style.
**/
function triggerEditorComponentCompile(&$content) {
if(Context::getResponseMethod()!='HTML') return new Object();
@ -189,7 +188,7 @@
}
/**
* @brief 에디터 컴포넌트코드를 결과물로 변환
* @brief Convert editor component codes to be returned
**/
function transComponent($content) {
$content = preg_replace_callback('!<div([^\>]*)editor_component=([^\>]*)>(.*?)\<\/div\>!is', array($this,'transEditorComponent'), $content);
@ -198,7 +197,7 @@
}
/**
* @brief 내용의 에디터 컴포넌트 코드를 변환
* @brief Convert editor component code of the contents
**/
function transEditorComponent($matches) {
$script = sprintf(' %s editor_component=%s', $matches[1], $matches[2]);
@ -210,8 +209,7 @@
$xml_obj->body = $matches[3];
if(!$xml_obj->attrs->editor_component) return $matches[0];
// component::transHTML() 을 이용하여 변환된 코드를 받음
// Get converted codes by using component::transHTML()
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $matches[0];
@ -221,7 +219,7 @@
/**
* @brief 자동 저장
* @brief AutoSave
**/
function doSaveDoc($args) {
@ -232,7 +230,7 @@
} else {
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
// module_srl이 없으면 현재 모듈
// Get the current module if module_srl doesn't exist
if(!$args->module_srl) {
$args->module_srl = Context::get('module_srl');
}
@ -240,13 +238,12 @@
$current_module_info = Context::get('current_module_info');
$args->module_srl = $current_module_info->module_srl;
}
// 저장
// Save
return executeQuery('editor.insertSavedDoc', $args);
}
/**
* @brief 자동 저장글 Srl 로드 - XE 이전 버전 사용자를 위함.
* @brief Load the srl of autosaved document - for those who uses XE older versions.
**/
function procEditorLoadSavedDocument() {
$editor_sequence = Context::get('editor_sequence');
@ -267,7 +264,7 @@
/**
* @brief 게시글의 입력/수정이 일어났을 경우 자동 저장문서를 제거하는 trigger
* @brief A trigger to remove auto-saved document when inserting/updating the document
**/
function triggerDeleteSavedDoc(&$obj) {
$this->deleteSavedDoc(false);
@ -275,8 +272,8 @@
}
/**
* @brief 자동 저장된 글을 삭제
* 현재 접속한 사용자를 기준
* @brief Delete the auto-saved document
* Based on the current logged-in user
**/
function deleteSavedDoc($mode = false) {
if(Context::get('is_logged')) {
@ -286,13 +283,12 @@
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$args->module_srl = Context::get('module_srl');
// module_srl이 없으면 현재 모듈
// Get the current module if module_srl doesn't exist
if(!$args->module_srl) {
$current_module_info = Context::get('current_module_info');
$args->module_srl = $current_module_info->module_srl;
}
// 자동저장된 값이 혹시 이미 등록된 글인지 확인
// Check if the auto-saved document already exists
$output = executeQuery('editor.getSavedDocument', $args);
$saved_doc = $output->data;
if(!$saved_doc) return;
@ -305,13 +301,12 @@
$output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc);
}
}
// 일단 이전 저장본 삭제
// Delete the saved document
return executeQuery('editor.deleteSavedDoc', $args);
}
/**
* @brief 가상 사이트에서 사용된 에디터 컴포넌트 정보를 제거
* @brief ERemove editor component information used on the virtual site
**/
function removeEditorConfig($site_srl) {
$args->site_srl = $site_srl;
@ -319,8 +314,8 @@
}
/**
* @brief 에디터 컴포넌트 목록 캐싱 (editorModel::getComponentList)
* 에디터 컴포넌트 목록의 경우 DB query + Xml Parsing 때문에 캐싱 파일을 이용하도록
* @brief Caching a list of editor component (editorModel::getComponentList)
* For the editor component list, use a caching file because of DB query and Xml parsing
**/
function makeCache($filter_enabled = true, $site_srl) {
$oEditorModel = &getModel('editor');
@ -332,11 +327,9 @@
$output = executeQuery('editor.getSiteComponentList', $args);
} else $output = executeQuery('editor.getComponentList', $args);
$db_list = $output->data;
// 파일목록을 구함
// Get a list of files
$downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components');
// 로그인 여부 및 소속 그룹 구함
// Get information about log-in status and its group
$is_logged = Context::get('is_logged');
if($is_logged) {
$logged_info = Context::get('logged_info');
@ -344,8 +337,7 @@
$group_list = array_keys($logged_info->group_list);
} else $group_list = array();
}
// DB 목록을 loop돌면서 xml정보까지 구함
// Get xml information for looping DB list
if(!is_array($db_list)) $db_list = array($db_list);
foreach($db_list as $component) {
if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
@ -370,12 +362,11 @@
$xml_info->mid_list = $extra_vars->mid_list;
}
/*
// 사용권한이 있으면 권한 체크
// Permisshin check if you are granted
if($extra_vars->target_group) {
// 사용권한이 체크되어 있는데 로그인이 되어 있지 않으면 무조건 사용 중지
// Stop using if not logged-in
if(!$is_logged) continue;
// 대상 그룹을 구해서 현재 로그인 사용자의 그룹과 비교
// Compare a target group with the current logged-in user group
$target_group = $extra_vars->target_group;
unset($extra_vars->target_group);
@ -388,13 +379,11 @@
}
if(!$is_granted) continue;
}
// 대상 모듈이 있으면 체크
// Check if the target module exists
if($extra_vars->mid_list && count($extra_vars->mid_list) && Context::get('mid')) {
if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue;
}*/
// 에디터 컴포넌트의 설정 정보를 체크
// Check the configuration of the editor component
if($xml_info->extra_vars) {
foreach($xml_info->extra_vars as $key => $val) {
$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
@ -403,34 +392,28 @@
}
$component_list->{$component_name} = $xml_info;
// 버튼, 아이콘 이미지 구함
// Get buttons, icons, images
$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif';
if(file_exists($icon_file)) $component_list->{$component_name}->icon = true;
if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
}
// enabled만 체크하도록 하였으면 그냥 return
// Return if it checks enabled only
if($filter_enabled) {
$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
FileHandler::writeFile($cache_file, $buff);
return $component_list;
}
// 다운로드된 목록의 xml_info를 마저 구함
// Get xml_info of downloaded list
foreach($downloaded_list as $component_name) {
if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
// 설정된 것이라면 패스
// Pass if configured
if($component_list->{$component_name}) continue;
// DB에 입력
// Insert data into the DB
$oEditorController = &getAdminController('editor');
$oEditorController->insertComponent($component_name, false, $site_srl);
// component_list에 추가
// Add to component_list
unset($xml_info);
$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
$xml_info->enabled = 'N';
@ -446,7 +429,7 @@
}
/**
* @brief 캐시 파일 삭제
* @brief Delete cache files
**/
function removeCache($site_srl = 0) {
$oEditorModel = &getModel('editor');

View file

@ -2,7 +2,7 @@
/**
* @class editorModel
* @author NHN (developers@xpressengine.com)
* @brief editor 모듈의 model 클래스
* @brief model class of the editor odule
**/
class editorModel extends editor {
@ -10,21 +10,21 @@
var $loaded_component_list = array();
/**
* @brief 에디터를 return
* @brief Return the editor
*
* 에디터의 경우 내부적으로 1~30까지의 임시 editor_seuqnece를 생성한다.
* 한페이지에 30 이상의 에디터를 출력하지는 못하도록 제한되어 있다.
* Editor internally generates editor_sequence from 1 to 30 for temporary use.
* That means there is a limitation that more than 30 editors cannot be displayed on a single page.
*
* , 수정하는 경우 또는 파일업로드를 자동저장본의 경우는 getNextSequence() 값으로 저장된 editor_seqnece가
* 설정된다.
* However, editor_sequence can be value from getNextSequence() in case of the modified or the auto-saved for file upload
*
**/
/**
* @brief 모듈별 에디터 설정을 return
* @brief Return editor setting for each module
**/
function getEditorConfig($module_srl) {
if(!$GLOBALS['__editor_module_config__'][$module_srl]) {
// 선택된 모듈의 trackback설정을 가져옴
// Get trackback settings of the selected module
$oModuleModel = &getModel('module');
$GLOBALS['__editor_module_config__'][$module_srl] = $oModuleModel->getModulePartConfig('editor', $module_srl);
}
@ -75,20 +75,17 @@
function getDrComponentXmlInfo($drComponentName){
$lang_type = Context::getLangType();
// 요청된 컴포넌트의 xml파일 위치를 구함
// Get the xml file path of requested component
$component_path = sprintf('%s/skins/dreditor/drcomponents/%s/', $this->module_path, $drComponentName);
$xml_file = sprintf('%sinfo.xml', $component_path);
$cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type);
// 캐시된 xml파일이 있으면 include 후 정보 return
// Return information after including it after cached xml file exists
if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) {
include($cache_file);
return $xml_info;
}
// 캐시된 파일이 없으면 파싱후 캐싱 후 return
// Return after parsing and caching if the cached file does not exist
$oParser = new XmlParser();
$xml_doc = $oParser->loadXmlFile($xml_file);
@ -111,7 +108,7 @@
$buff .= sprintf('$xml_info->license = "%s";', $component_info->license);
$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
// 작성자 정보
// Author information
if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
else $author_list = $xml_doc->component->author;
@ -154,8 +151,7 @@
}
}
}
// 추가 변수 정리 (에디터 컴포넌트에서는 text형만 가능)
// List extra variables (text type only in the editor component)
$extra_vars = $xml_doc->component->extra_vars->var;
if($extra_vars) {
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
@ -182,48 +178,40 @@
}
/**
* @brief 에디터 template을 return
* upload_target_srl은 글의 수정시 호출하면 .
* upload_target_srl은 첨부파일의 유무를 체크하기 위한 루틴을 구현하는데 사용됨.
* @brief Return the editor template
* You can call upload_target_srl when modifying content
* The upload_target_srl is used for a routine to check if an attachment exists
**/
function getEditor($upload_target_srl = 0, $option = null) {
/**
* 기본적인 에디터의 옵션을 정리
* Editor's default options
**/
// 파일 업로드 유무 옵션 설정
// Option setting to allow file upload
if(!$option->allow_fileupload) $allow_fileupload = false;
else $allow_fileupload = true;
// content_style 세팅
// content_style setting
if(!$option->content_style) $option->content_style = 'default';
Context::set('content_style', $option->content_style);
// 기본 글꼴 지정
// Default font setting
Context::set('content_font', $option->content_font);
Context::set('content_font_size', $option->content_font_size);
// 자동 저장 유무 옵션 설정 글 수정시는 사용 안함
// Option setting to allow auto-save
if(!$option->enable_autosave) $enable_autosave = false;
elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
else $enable_autosave = true;
// 기본 에디터 컴포넌트 사용 설정
// Option setting to allow the default editor component
if(!$option->enable_default_component) $enable_default_component = false;
else $enable_default_component = true;
// 확장 컴포넌트 사용 설정
// Option setting to allow other extended components
if(!$option->enable_component) $enable_component = false;
else $enable_component = true;
// html 모드 조절
// Setting for html-mode
if($option->disable_html) $html_mode = false;
else $html_mode = true;
// 높이 설정
// Set Height
if(!$option->height) $editor_height = 400;
else $editor_height = $option->height;
// 스킨 설정
// Skin Setting
$skin = $option->skin;
if(!$skin) $skin = 'xpresseditor';
@ -236,19 +224,18 @@
}
/**
* 자동백업 기능 체크 ( 수정일 경우는 사용하지 않음)
* Check the automatic backup feature (do not use if the post is edited)
**/
if($enable_autosave) {
// 자동 저장된 데이터를 추출
// Extract auto-saved data
$saved_doc = $this->getSavedDoc($upload_target_srl);
// 자동 저장 데이터를 context setting
// Context setting auto-saved data
Context::set('saved_doc', $saved_doc);
}
Context::set('enable_autosave', $enable_autosave);
/**
* 에디터의 고유 번호 추출 ( 페이지에 여러개의 에디터를 출력하는 경우를 대비)
* Extract editor's unique number (in order to display multiple editors on a single page)
**/
if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
else {
@ -257,50 +244,42 @@
}
/**
* 업로드 활성화시 내부적으로 file 모듈의 환경설정을 이용하여 설정
* Upload setting by using configuration of the file module internally
**/
$files_count = 0;
if($allow_fileupload) {
$oFileModel = &getModel('file');
// SWFUploader에 세팅할 업로드 설정 구함
// Get upload configuration to set on SWFUploader
$file_config = $oFileModel->getUploadConfig();
$file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024;
$file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024;
Context::set('file_config',$file_config);
// 업로드 가능 용량등에 대한 정보를 세팅
// Configure upload status such as file size
$upload_status = $oFileModel->getUploadStatus();
Context::set('upload_status', $upload_status);
// upload가능하다고 설정 (내부적으로 캐싱하여 처리)
// Upload enabled (internally caching)
$oFileController = &getController('file');
$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
// 이미 등록된 파일이 있는지 검사
// Check if the file already exists
if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
}
Context::set('files_count', (int)$files_count);
Context::set('allow_fileupload', $allow_fileupload);
// 에디터 동작을 위한 editor_sequence값 설정
// Set editor_sequence value
Context::set('editor_sequence', $editor_sequence);
// 파일 첨부 관련 행동을 하기 위해 문서 번호를 upload_target_srl로 설정
// 신규문서일 경우 upload_target_srl=0 이고 첨부파일 관련 동작이 요청될때 이 값이 변경됨
// Set the document number to upload_target_srl for file attachments
// If a new document, upload_target_srl = 0. The value becomes changed when file attachment is requested
Context::set('upload_target_srl', $upload_target_srl);
// 문서 혹은 댓글의 primary key값을 세팅한다.
// Set the primary key valueof the document or comments
Context::set('editor_primary_key_name', $option->primary_key_name);
// 내용을 sync 맞추기 위한 content column name을 세팅한다
// Set content column name to sync contents
Context::set('editor_content_key_name', $option->content_key_name);
/**
* 에디터 컴포넌트 체크
* Check editor component
**/
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
@ -314,20 +293,19 @@
Context::set('enable_default_component', $enable_default_component);
/**
* html_mode 가능한지 변수 설정
* Variable setting if html_mode is available
**/
Context::set('html_mode', $html_mode);
/**
* 에디터 세로 크기 설정
* Set a height of editor
**/
Context::set('editor_height', $editor_height);
// 에디터의 초기화를 수동으로하는 것에 대한 값 체크
// Check an option whether to start the editor manually
Context::set('editor_manual_start', $option->manual_start);
/**
* 템플릿을 미리 컴파일해서 컴파일된 소스를 하기 위해 스킨의 경로를 설정
* Set a skin path to pre-compile the template
?**/
$tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin);
$tpl_file = 'editor.html';
@ -340,24 +318,22 @@
// load editor skin lang
Context::loadLang($tpl_path.'lang');
// tpl 파일을 compile한 결과를 return
// Return the compiled result from tpl file
$oTemplate = new TemplateHandler();
return $oTemplate->compile($tpl_path, $tpl_file);
}
/**
* @brief 모듈별 설정이 반영된 에디터 template을 return
* getEditor() 동일한 결과물을 return하지만 getModuleEditor() 모듈별 추가 설정을 통해 직접 제어되는 설정을 이용하여 에디터를 생성함
* @brief Return editor template which contains settings of each module
* Result of getModuleEditor() is as same as getEditor(). But getModuleEditor()uses additional settings of each module to generate an editor
*
* document/ comment 2가지 종류를 이용함.
* 굳이 나눈 이유는 하나의 모듈에서 2 종류의 에디터 사용을 위해서인데 게시판이나 블로그등 원글과 그에 연관된 (댓글) 위한 용도임.
* 2 types of editors supported; document and comment.
* 2 types of editors can be used on a single module. For instance each for original post and reply port.
**/
function getModuleEditor($type = 'document', $module_srl, $upload_target_srl, $primary_key_name, $content_key_name) {
// 지정된 모듈의 에디터 설정을 구해옴
// Get editor settings of the module
$editor_config = $this->getEditorConfig($module_srl);
// type에 따른 설정 정리
// Configurations listed according to a type
if($type == 'document') {
$config->editor_skin = $editor_config->editor_skin;
$config->content_style = $editor_config->content_style;
@ -383,23 +359,20 @@
$config->editor_height = $editor_config->comment_editor_height;
$config->enable_autosave = 'N';
}
// 권한 체크를 위한 현재 로그인 사용자의 그룹 설정 체크
// Check a group_list of the currently logged-in user for permission check
if(Context::get('is_logged')) {
$logged_info = Context::get('logged_info');
$group_list = $logged_info->group_list;
} else {
$group_list = array();
}
// 에디터 옵션 변수를 미리 설정
// Pre-set option variables of editor
$option->skin = $config->editor_skin;
$option->content_style = $config->content_style;
$option->content_font = $config->content_font;
$option->content_font_size = $config->content_font_size;
$option->colorset = $config->sel_editor_colorset;
// 파일 업로드 권한 체크
// Permission check for file upload
$option->allow_fileupload = false;
if(count($config->upload_file_grant)) {
foreach($group_list as $group_srl => $group_info) {
@ -409,8 +382,7 @@
}
}
} else $option->allow_fileupload = true;
// 기본 컴포넌트 사용 권한
// Permission check for using default components
$option->enable_default_component = false;
if(count($config->enable_default_component_grant)) {
foreach($group_list as $group_srl => $group_info) {
@ -420,8 +392,7 @@
}
}
} else $option->enable_default_component = true;
// 확장 컴포넌트 사용 권한
// Permisshion check for using extended components
$option->enable_component = false;
if(count($config->enable_component_grant)) {
foreach($group_list as $group_srl => $group_info) {
@ -431,8 +402,7 @@
}
}
} else $option->enable_component = true;
// HTML 편집 권한
// HTML editing privileges
$enable_html = false;
if(count($config->enable_html_grant)) {
foreach($group_list as $group_srl => $group_info) {
@ -445,14 +415,11 @@
if($enable_html) $option->disable_html = false;
else $option->disable_html = true;
// 높이 설정
// Set Height
$option->height = $config->editor_height;
// 자동 저장 유무 옵션 설정
// Set an option for Auto-save
$option->enable_autosave = $config->enable_autosave=='Y'?true:false;
// 기타 설정
// Other settings
$option->primary_key_name = $primary_key_name;
$option->content_key_name = $content_key_name;
@ -460,10 +427,10 @@
}
/**
* @brief 자동저장되어 있는 정보를 가져옴
* @brief Get information which has been auto-saved
**/
function getSavedDoc($upload_target_srl) {
// 로그인 회원이면 member_srl, 아니면 ipaddress로 저장되어 있는 문서를 찾음
// Find a document by using member_srl for logged-in user and ipaddress for non-logged user
if(Context::get('is_logged')) {
$logged_info = Context::get('logged_info');
$auto_save_args->member_srl = $logged_info->member_srl;
@ -471,34 +438,29 @@
$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
}
$auto_save_args->module_srl = Context::get('module_srl');
// module_srl이 없으면 현재 모듈
// Get the current module if module_srl doesn't exist
if(!$auto_save_args->module_srl) {
$current_module_info = Context::get('current_module_info');
$auto_save_args->module_srl = $current_module_info->module_srl;
}
// DB에서 자동저장 데이터 추출
// Extract auto-saved data from the DB
$output = executeQuery('editor.getSavedDocument', $auto_save_args);
$saved_doc = $output->data;
// 자동저장한 결과가 없으면 null값 return
// Return null if no result is auto-saved
if(!$saved_doc) return;
// 자동저장된 값이 혹시 이미 등록된 글인지 확인
// Check if the auto-saved document already exists
$oDocumentModel = &getModel('document');
$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
if($oSaved->isExists()) return;
// 자동저장 데이터에 문서번호가 있고 이 번호에 파일이 있다면 파일을 모두 이동하고
// 해당 문서 번호를 editor_sequence로 세팅함
// Move all the files if the auto-saved data contains document_srl and file
// Then set document_srl to editor_sequence
if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) {
$saved_doc->module_srl = $auto_save_args->module_srl;
$oFileController = &getController('file');
$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
}
else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
// 자동 저장 데이터 변경
// Change auto-saved data
$oEditorController = &getController('editor');
$oEditorController->deleteSavedDoc(false);
$oEditorController->doSaveDoc($saved_doc);
@ -507,24 +469,22 @@
}
/**
* @brief component의 객체 생성
* @brief create objects of the component
**/
function getComponentObject($component, $editor_sequence = 0, $site_srl = 0) {
if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
if(!$this->loaded_component_list[$component][$editor_sequence]) {
// 해당 컴포넌트의 객체를 생성해서 실행
// Create an object of the component and execute
$class_path = sprintf('%scomponents/%s/', $this->module_path, $component);
$class_file = sprintf('%s%s.class.php', $class_path, $component);
if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
// 클래스 파일을 읽은 후 객체 생성
// Create an object after loading the class file
require_once($class_file);
$tmp_fn = create_function('$seq,$path', "return new {$component}(\$seq,\$path);");
$oComponent = $tmp_fn($editor_sequence, $class_path);
if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
// 설정 정보를 추가
// Add configuration information
$component_info = $this->getComponent($component, $site_srl);
$oComponent->setInfo($component_info);
$this->loaded_component_list[$component][$editor_sequence] = $oComponent;
@ -534,14 +494,14 @@
}
/**
* @brief editor skin 목록을 return
* @brief Return a list of the editor skin
**/
function getEditorSkinList() {
return FileHandler::readDir('./modules/editor/skins');
}
/**
* @brief 에디터 컴포넌트 목록 캐시 파일 이름 return
* @brief Return the cache file name of editor component list
**/
function getCacheFile($filter_enabled= true, $site_srl = 0) {
$lang = Context::getLangType();
@ -555,7 +515,7 @@
}
/**
* @brief component 목록을 return (DB정보 보함)
* @brief Return a component list (DB Information included)
**/
function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false) {
$cache_file = $this->getCacheFile(false, $site_srl);
@ -619,7 +579,7 @@
}
/**
* @brief compnent의 xml+db정보를 구함
* @brief Get xml and db information of the component
**/
function getComponent($component_name, $site_srl = 0) {
$args->component_name = $component_name;
@ -667,28 +627,24 @@
}
/**
* @brief component의 xml정보를 읽음
* @brief Read xml information of the component
**/
function getComponentXmlInfo($component) {
$lang_type = Context::getLangType();
// 요청된 컴포넌트의 xml파일 위치를 구함
// Get xml file path of the requested components
$component_path = sprintf('%s/components/%s/', $this->module_path, $component);
$xml_file = sprintf('%sinfo.xml', $component_path);
$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
// 캐시된 xml파일이 있으면 include 후 정보 return
// Include and return xml file information if cached file exists
if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) {
include($cache_file);
return $xml_info;
}
// 캐시된 파일이 없으면 파싱후 캐싱 후 return
// Parse, cache and then return if the cached file doesn't exist
$oParser = new XmlParser();
$xml_doc = $oParser->loadXmlFile($xml_file);
// 정보 정리
// Component information listed
if($xml_doc->component->version && $xml_doc->component->attrs->version == '0.2') {
$component_info->component_name = $component;
$component_info->title = $xml_doc->component->title->body;
@ -708,8 +664,7 @@
$buff .= sprintf('$xml_info->homepage = "%s";', $component_info->homepage);
$buff .= sprintf('$xml_info->license = "%s";', $component_info->license);
$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
// 작성자 정보
// Author information
if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
else $author_list = $xml_doc->component->author;
@ -776,8 +731,7 @@
$buff .= sprintf('$xml_info->author[0]->email_address = "%s";', $xml_info->author->email_address);
$buff .= sprintf('$xml_info->author[0]->homepage = "%s";', $xml_info->author->homepage);
}
// 추가 변수 정리 (에디터 컴포넌트에서는 text형만 가능)
// List extra variables (text type only for editor component)
$extra_vars = $xml_doc->component->extra_vars->var;
if($extra_vars) {
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);

View file

@ -2,32 +2,30 @@
/**
* @class editorView
* @author NHN (developers@xpressengine.com)
* @brief editor 모듈의 view 클래스
* @brief view class of the editor module
**/
class editorView extends editor {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 컴포넌트의 팝업 출력을 요청을 받는 action
* @brief Action to get a request to display compoenet pop-up
**/
function dispEditorPopup() {
// css 파일 추가
// add a css file
Context::addCssFile($this->module_path."tpl/css/editor.css");
// 변수 정리
// List variables
$editor_sequence = Context::get('editor_sequence');
$component = Context::get('component');
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
// component 객체를 받음
// Get compoenet object
$oEditorModel = &getModel('editor');
$oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl);
if(!$oComponent->toBool()) {
@ -35,22 +33,19 @@
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('component_not_founded');
} else {
// 컴포넌트의 popup url을 출력하는 method실행후 결과를 받음
// Get the result after executing a method to display popup url of the component
$popup_content = $oComponent->getPopupContent();
Context::set('popup_content', $popup_content);
// 레이아웃을 popup_layout으로 설정
// Set layout to popup_layout
$this->setLayoutFile('popup_layout');
// 템플릿 지정
// Set a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('popup');
}
}
/**
* @brief 컴퍼넌트 정보 보기
* @brief Get component information
**/
function dispEditorComponentInfo() {
$component_name = Context::get('component_name');
@ -68,28 +63,26 @@
}
/**
* @brief 모듈의 추가 설정에서 에디터 설정을 하는 form 추가
* @brief Add a form for editor addition setup
**/
function triggerDispEditorAdditionSetup(&$obj) {
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
if(!$current_module_srl && !$current_module_srls) {
// 선택된 모듈의 정보를 가져옴
// Get information of the current module
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new Object();
}
// 에디터 설정을 구함
// Get editors settings
$oEditorModel = &getModel('editor');
$editor_config = $oEditorModel->getEditorConfig($current_module_srl);
Context::set('editor_config', $editor_config);
$oModuleModel = &getModel('module');
// 에디터 스킨 목록을 구함
// Get a list of editor skin
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
Context::set('editor_skin_list', $editor_skin_list);
@ -105,15 +98,12 @@
$content_style_list[$style]->title = $info->title;
}
Context::set('content_style_list', $content_style_list);
// 그룹 목록을 구함
// Get a group list
$oMemberModel = &getModel('member');
$site_module_info = Context::get('site_module_info');
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
Context::set('group_list', $group_list);
// 템플릿 파일 지정
// Set a template file
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'editor_module_config');
$obj .= $tpl;

View file

@ -2,37 +2,34 @@
/**
* @class fileAdminController
* @author NHN (developers@xpressengine.com)
* @brief file 모듈의 admin controller 클래스
* @brief admin controller class of the file module
**/
class fileAdminController extends file {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 특정 모듈의 첨부파일 모두 삭제
* @brief Delete the attachment of a particular module
**/
function deleteModuleFiles($module_srl) {
// 전체 첨부파일 목록을 구함
// Get a full list of attachments
$args->module_srl = $module_srl;
$output = executeQueryArray('file.getModuleFiles',$args);
if(!$output) return $output;
$files = $output->data;
// DB에서 삭제
// Remove from the DB
$args->module_srl = $module_srl;
$output = executeQuery('file.deleteModuleFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제 (일단 약속에 따라서 한번에 삭제)
// Remove the file
FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
// DB에서 구한 파일 목록을 삭제
// Remove the file list obtained from the DB
$path = array();
$cnt = count($files);
for($i=0;$i<$cnt;$i++) {
@ -42,18 +39,17 @@
$path_info = pathinfo($uploaded_filename);
if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
}
// 해당 글의 첨부파일 디렉토리 삭제
// Remove a file directory of the document
for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
return $output;
}
/**
* @brief 관리자 페이지에서 선택된 파일들을 삭제
* @brief Delete selected files from the administrator page
**/
function procFileAdminDeleteChecked() {
// 선택된 글이 없으면 오류 표시
// An error appears if no document is selected
$cart = Context::get('cart');
if(!$cart) return $this->stop('msg_cart_is_null');
$file_srl_list= explode('|@|', $cart);
@ -61,8 +57,7 @@
if(!$file_count) return $this->stop('msg_cart_is_null');
$oFileController = &getController('file');
// 글삭제
// Delete the post
for($i=0;$i<$file_count;$i++) {
$file_srl = trim($file_srl_list[$i]);
if(!$file_srl) continue;
@ -74,31 +69,29 @@
}
/**
* @brief 파일 기본 정보의 추가
* @brief Add file information
**/
function procFileAdminInsertConfig() {
// 설정 정보를 받아옴 (module model 객체를 이용)
// Get configurations (using module model object)
$config->allowed_filesize = Context::get('allowed_filesize');
$config->allowed_attach_size = Context::get('allowed_attach_size');
$config->allowed_filetypes = Context::get('allowed_filetypes');
$config->allow_outlink = Context::get('allow_outlink');
$config->allow_outlink_format = Context::get('allow_outlink_format');
$config->allow_outlink_site = Context::get('allow_outlink_site');
// module Controller 객체 생성하여 입력
// Create module Controller object
$oModuleController = &getController('module');
$output = $oModuleController->insertModuleConfig('file',$config);
return $output;
}
/**
* @brief 모듈별 파일 기본 정보의 추가
* @brief Add file information for each module
**/
function procFileAdminInsertModuleConfig() {
// 필요한 변수를 받아옴
// Get variables
$module_srl = Context::get('target_module_srl');
// 여러개의 모듈 일괄 설정일 경우
// In order to configure multiple modules at once
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
else $module_srl = array($module_srl);

View file

@ -2,22 +2,22 @@
/**
* @class fileAdminModel
* @author NHN (developers@xpressengine.com)
* @brief file 모듈의 admin model 클래스
* @brief admin model class of the file module
**/
class fileAdminModel extends file {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 모든 첨부파일을 시간 역순으로 가져옴 (관리자용)
* @brief Get all the attachments in order by time descending (for administrators)
**/
function getFileList($obj) {
// 검색 옵션 정리
// Search options
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
@ -59,27 +59,22 @@
break;
}
}
// 유효/대기 상태 설정
// Set valid/invalid state
if($obj->isvalid == 'Y') $args->isvalid = 'Y';
elseif($obj->isvalid == 'N') $args->isvalid = 'N';
// 멀티미디어/ 일반 상태 설정
// Set multimedia/common file
if($obj->direct_download == 'Y') $args->direct_download = 'Y';
elseif($obj->direct_download == 'N') $args->direct_download= 'N';
// 변수 설정
// Set variables
$args->sort_index = $obj->sort_index;
$args->page = $obj->page?$obj->page:1;
$args->list_count = $obj->list_count?$obj->list_count:20;
$args->page_count = $obj->page_count?$obj->page_count:10;
$args->s_module_srl = $obj->module_srl;
$args->exclude_module_srl = $obj->exclude_module_srl;
// file.getFileList쿼리 실행
// Execute the file.getFileList query
$output = executeQuery('file.getFileList', $args);
// 결과가 없거나 오류 발생시 그냥 return
// Return if no result or an error occurs
if(!$output->toBool()||!count($output->data)) return $output;
$oFileModel = &getModel('file');

View file

@ -2,35 +2,33 @@
/**
* @class fileAdminView
* @author NHN (developers@xpressengine.com)
* @brief file 모듈의 admin view 클래스
* @brief admin view of the module class file
**/
class fileAdminView extends file {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 목록 출력 (관리자용)
* @brief Display output list (for administrator)
**/
function dispFileAdminList() {
// 목록을 구하기 위한 옵션
$args->page = Context::get('page'); ///< 페이지
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
// Options to get a list
$args->page = Context::get('page'); // /< Page
$args->list_count = 30; // /< Number of documents that appear on a single page
$args->page_count = 10; // /< Number of pages that appear in the page navigation
$args->sort_index = 'file_srl'; ///< 소팅 값
$args->sort_index = 'file_srl'; // /< Sorting values
$args->isvalid = Context::get('isvalid');
$args->module_srl = Context::get('module_srl');
// 목록 구함
// Get a list
$oFileModel = &getAdminModel('file');
$output = $oFileModel->getFileList($args);
// 목록의 loop를 돌면서 document를 구하기
// Get the document for looping a list
if($output->data) {
$oCommentModel = &getModel('comment');
$oDocumentModel = &getModel('document');
@ -50,10 +48,9 @@
$target_srl = $file->upload_target_srl;
$file_update_args = null;
$file_update_args->file_srl = $file_srl;
// upload_target_type이 없으면 찾아서 업데이트
// Find and update if upload_target_type doesn't exist
if(!$file->upload_target_type) {
// 찾아둔게 있으면 패스
// Pass if upload_target_type is already found
if($document_list[$target_srl]) {
$file->upload_target_type = 'doc';
} else if($comment_list[$target_srl]) {
@ -79,7 +76,7 @@
$doc_srls[] = $comment->document_srl;
}
}
// module (페이지인 경우)
// module (for a page)
if(!$file->upload_target_type) {
$module = $oModuleModel->getModulesInfo($target_srl);
if($module) {
@ -92,8 +89,7 @@
executeQuery('file.updateFileTargetType', $file_update_args);
}
}
// 이미 구해진 데이터가 있는 확인
// Check if data is already obtained
for($i = 0; $i < $com_srls_count; ++$i) {
if($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
}
@ -114,13 +110,11 @@
$file_list[$file_srl] = $file;
$mod_srls[] = $file->module_srl;
}
// 중복 제거
// Remove duplication
$doc_srls = array_unique($doc_srls);
$com_srls = array_unique($com_srls);
$mod_srls = array_unique($mod_srls);
// 댓글 목록
// Comment list
$com_srls_count = count($com_srls);
if($com_srls_count) {
$comment_output = $oCommentModel->getComments($com_srls);
@ -129,8 +123,7 @@
$doc_srls[] = $comment->document_srl;
}
}
// 문서 목록
// Document list
$doc_srls_count = count($doc_srls);
if($doc_srls_count) {
$document_output = $oDocumentModel->getDocuments($doc_srls);
@ -138,8 +131,7 @@
$document_list[$document->document_srl] = $document;
}
}
// 모듈 목록
// Module List
$mod_srls_count = count($mod_srls);
if($mod_srls_count) {
$module_output = $oModuleModel->getModulesInfo($mod_srls);
@ -164,21 +156,19 @@
Context::set('total_page', $output->total_page);
Context::set('page', $output->page);
Context::set('page_navigation', $output->page_navigation);
// 템플릿 지정
// Set a template
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('file_list');
}
/**
* @brief 첨부파일 정보 설정 (관리자용)
* @brief Set attachment information (for administrator)
**/
function dispFileAdminConfig() {
$oFileModel = &getModel('file');
$config = $oFileModel->getFileConfig();
Context::set('config',$config);
// 템플릿 파일 지정
// Set a template file
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('file_config');
}

View file

@ -2,29 +2,26 @@
/**
* @class file
* @author NHN (developers@xpressengine.com)
* @brief file 모듈의 high 클래스
* @brief high class of the file module
**/
class file extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
// Register action forward (to use in administrator mode)
$oModuleController = &getController('module');
// 첨부파일의 기본 설정 저장
// Save the default settings for attachments
$config->allowed_filesize = '2';
$config->allowed_attach_size = '2';
$config->allowed_filetypes = '*.*';
$oModuleController->insertModuleConfig('file', $config);
// file 모듈에서 사용할 디렉토리 생성
// Generate a directory for the file module
FileHandler::makeDir('./files/attach/images');
FileHandler::makeDir('./files/attach/binaries');
// 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after');
$oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
@ -35,27 +32,23 @@
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before');
$oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after');
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
// 2009. 6. 9 자동저장문서 삭제시 첨부 파일도 같이 삭제
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
$oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after');
// 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
// 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
// 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true;
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true;
if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true;
@ -66,31 +59,26 @@
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true;
if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true;
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true;
// 2009. 6. 9 자동저장문서 삭제시 첨부 파일도 같이 삭제
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true;
// 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) return true;
// 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) return true;
// 타겟 판별용 필드
// A column to determine a target type
if(!$oDB->isColumnExists('files', 'upload_target_type')) return true;
return false;
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록
// 2007. 10. 17 Create a trigger to insert, update, delete documents and comments
if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before'))
$oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before');
@ -120,27 +108,23 @@
if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'))
$oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after');
// 2009. 6. 9 자동저장문서 삭제시 첨부 파일도 같이 삭제
// 2009. 6. 9 Delete all the attachements when auto-saved document is deleted
if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after'))
$oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after');
// 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가
// 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted
if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after'))
$oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after');
// 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출
// 2007. 10. 19 Call a trigger to set up the file permissions before displaying
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before'))
$oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before');
// 타겟 판별용 필드
// A column to determine a target type
if(!$oDB->isColumnExists('files', 'upload_target_type')) $oDB->addColumn('files', 'upload_target_type', 'char', '3');
return new Object(0, 'success_updated');
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
}

View file

@ -2,44 +2,41 @@
/**
* @class fileController
* @author NHN (developers@xpressengine.com)
* @brief file 모듈의 controller 클래스
* @brief controller class of the file module
**/
class fileController extends file {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 에디터에서 첨부파일 업로드
* editor_sequence, uploadTargetSrl 변수값을 받아서 이를 바탕으로 첨부 대상 srl을 결정함.
* 만약 uploadTargetSrl이 없다면 새로 생성하고 return 하여 UI에서 이에 대한 값을 재설정하도록 하여
* sync이상없도록
* @brief Upload attachments in the editor
* Determine the upload target srl from editor_sequence and uploadTargetSrl variables.
* Create and return the UploadTargetSrl if not exists so that UI can use the value
* for sync.
**/
function procFileUpload() {
$file_info = Context::get('Filedata');
// 정상적으로 업로드된 파일이 아니면 오류 출력
// An error appears if not a normally uploaded file
if(!is_uploaded_file($file_info['tmp_name'])) exit();
// 기본적으로 필요한 변수 설정
// Basic variables setting
$oFileModel = &getModel('file');
$editor_sequence = Context::get('editor_sequence');
$upload_target_srl = intval(Context::get('uploadTargetSrl'));
if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl'));
$module_srl = $this->module_srl;
// 업로드 권한이 없거나 정보가 없을시 종료
// Exit a session if there is neither upload permission nor information
if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
// upload_target_srl 값이 명시되지 않았을 경우 세션정보에서 추출
// Extract from session information if upload_target_srl is not specified
if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
// 세션정보에도 정의되지 않았다면 새로 생성
// Create if upload_target_srl is not defined in the session information
if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
@ -48,32 +45,28 @@
/**
* @brief iframe 첨부파일 업로드
* @brief iframe upload attachments
**/
function procFileIframeUpload() {
// 기본적으로 필요한 변수 설정
// Basic variables setting
$editor_sequence = Context::get('editor_sequence');
$callback = Context::get('callback');
$module_srl = $this->module_srl;
$upload_target_srl = intval(Context::get('uploadTargetSrl'));
if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl'));
// 업로드 권한이 없거나 정보가 없을시 종료
// Exit a session if there is neither upload permission nor information
if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
// upload_target_srl 값이 명시되지 않았을 경우 세션정보에서 추출
// Extract from session information if upload_target_srl is not specified
if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
// 세션정보에도 정의되지 않았다면 새로 생성
// Create if upload_target_srl is not defined in the session information
if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence();
// file_srl이 요청되었을 경우 삭제 후 재업로드 시도
// Delete and then attempt to re-upload if file_srl is requested
$file_srl = Context::get('file_srl');
if($file_srl) $this->deleteFile($file_srl);
$file_info = Context::get('Filedata');
// 정상적으로 업로드된 파일이 아니면 오류 출력
// An error appears if not a normally uploaded file
if(is_uploaded_file($file_info['tmp_name'])) {
$output = $this->insertFile($file_info, $module_srl, $upload_target_srl);
Context::set('uploaded_fileinfo',$output);
@ -116,10 +109,10 @@
/**
* @brief 첨부파일 다운로드
* 직접 요청을 받음
* file_srl : 파일의 sequence
* sid : db에 저장된 비교 , 틀리면 다운로드 하지 않음
* @brief Download Attachment
* Receive a request directly
* file_srl: File sequence
* sid : value in DB for comparison, No download if not matched
**/
function procFileDownload() {
$oFileModel = &getModel('file');
@ -127,23 +120,18 @@
$file_srl = Context::get('file_srl');
$sid = Context::get('sid');
$logged_info = Context::get('logged_info');
// 파일의 정보를 DB에서 받아옴
// Get file information from the DB
$file_obj = $oFileModel->getFile($file_srl);
// 요청된 파일 정보가 잘못되었다면 파일을 찾을 수 없다는 오류 출력
// If the requested file information is incorrect, an error that file cannot be found appears
if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found');
// 대기 상태일 경우 파일 다운로드 권한이 없음을 알림 (최고관리자는 다운 로드 허용)
// Notify that file download is not allowed when standing-by(Only a top-administrator is permitted)
if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download');
// 파일 이름
// File name
$filename = $file_obj->source_filename;
$file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl);
// 파일 외부링크 차단
// Not allow the file outlink
if($file_module_config->allow_outlink == 'N') {
//외부링크 허용 확장자 처리
// Handles extension to allow outlink
if($file_module_config->allow_outlink_format) {
$allow_outlink_format_array = array();
$allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format);
@ -157,7 +145,7 @@
}
}
}
//외부링크 허용 사이트 처리
// Sites that outlink is allowed
if($file_module_config->allow_outlink != 'Y') {
$referer = parse_url($_SERVER["HTTP_REFERER"]);
if($referer['host'] != $_SERVER['HTTP_HOST']) {
@ -179,8 +167,7 @@
}
if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink');
}
// 파일 다운로드 권한이 있는지 확인
// Check if a permission for file download is granted
if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant)>0) {
if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download');
$logged_info = Context::get('logged_info');
@ -206,12 +193,10 @@
}
}
}
// trigger 호출 (before)
// Call a trigger (before)
$output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj);
if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download');
// 파일 출력
// File Output
if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) {
$filename = rawurlencode($filename);
$filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1);
@ -240,11 +225,10 @@
fpassthru($fp);
}
// 이상이 없으면 download_count 증가
// Increase download_count
$args->file_srl = $file_srl;
executeQuery('file.updateFileDownloadCount', $args);
// trigger 호출 (after)
// Call a trigger (after)
$output = ModuleHandler::triggerCall('file.downloadFile', 'after', $file_obj);
Context::close();
@ -253,16 +237,15 @@
}
/**
* @brief 에디터에서 첨부 파일 삭제
* @brief Delete an attachment from the editor
**/
function procFileDelete() {
// 기본적으로 필요한 변수인 upload_target_srl, module_srl을 설정
// Basic variable setting(upload_target_srl and module_srl set)
$editor_sequence = Context::get('editor_sequence');
$file_srl = Context::get('file_srl');
$file_srls = Context::get('file_srls');
if($file_srls) $file_srl = $file_srls;
// 업로드 권한이 없거나 정보가 없을시 종료
// Exit a session if there is neither upload permission nor information
if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit();
$upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl;
@ -270,13 +253,12 @@
}
/**
* @brief 특정 upload_target_srl(document_srl) 등록된 첨부파일의 갯수를 return하는 trigger
* @brief A trigger to return numbers of attachments in the upload_target_srl (document_srl)
**/
function triggerCheckAttached(&$obj) {
$document_srl = $obj->document_srl;
if(!$document_srl) return new Object();
// 첨부 파일의 갯수를 구함
// Get numbers of attachments
$oFileModel = &getModel('file');
$obj->uploaded_count = $oFileModel->getFilesCount($document_srl);
@ -284,7 +266,7 @@
}
/**
* @brief 특정 upload_target_srl(document_srl) 등록된 첨부파일을 연결하는 trigger
* @brief A trigger to link the attachment with the upload_target_srl (document_srl)
**/
function triggerAttachFiles(&$obj) {
$document_srl = $obj->document_srl;
@ -297,7 +279,7 @@
}
/**
* @brief 특정 upload_target_srl(document_srl) 등록된 첨부파일을 삭제하는 trigger
* @brief A trigger to delete the attachment in the upload_target_srl (document_srl)
**/
function triggerDeleteAttached(&$obj) {
$document_srl = $obj->document_srl;
@ -308,13 +290,12 @@
}
/**
* @brief 특정 upload_target_srl(comment_srl) 등록된 첨부파일의 갯수를 return하는 trigger
* @brief A trigger to return numbers of attachments in the upload_target_srl (comment_srl)
**/
function triggerCommentCheckAttached(&$obj) {
$comment_srl = $obj->comment_srl;
if(!$comment_srl) return new Object();
// 첨부 파일의 갯수를 구함
// Get numbers of attachments
$oFileModel = &getModel('file');
$obj->uploaded_count = $oFileModel->getFilesCount($comment_srl);
@ -322,7 +303,7 @@
}
/**
* @brief 특정 upload_target_srl(comment_srl) 등록된 첨부파일을 연결하는 trigger
* @brief A trigger to link the attachment with the upload_target_srl (comment_srl)
**/
function triggerCommentAttachFiles(&$obj) {
$comment_srl = $obj->comment_srl;
@ -336,7 +317,7 @@
}
/**
* @brief 특정 upload_target_srl(comment_srl) 등록된 첨부파일을 삭제하는 trigger
* @brief A trigger to delete the attachment in the upload_target_srl (comment_srl)
**/
function triggerCommentDeleteAttached(&$obj) {
$comment_srl = $obj->comment_srl;
@ -347,7 +328,7 @@
}
/**
* @brief module 삭제시 해당 첨부파일 모두 삭제하는 trigger
* @brief A trigger to delete all the attachements when deleting the module
**/
function triggerDeleteModuleFiles(&$obj) {
$module_srl = $obj->module_srl;
@ -358,7 +339,7 @@
}
/**
* @brief 업로드 가능하다고 세팅
* @brief Upload enabled
**/
function setUploadInfo($editor_sequence, $upload_target_srl=0) {
$_SESSION['upload_info'][$editor_sequence]->enabled = true;
@ -366,8 +347,8 @@
}
/**
* @brief 특정 upload_target_srl의 첨부파일들의 상태를 유효로 변경
* 글이 등록될때 글에 첨부된 파일들의 상태를 유효상태로 변경함으로서 관리시 불필요 파일로 인식되지 않도록
* @brief Set the attachements of the upload_target_srl to be valid
* By changing its state to valid when a document is inserted, it prevents from being considered as a unnecessary file
**/
function setFilesValid($upload_target_srl) {
$args->upload_target_srl = $upload_target_srl;
@ -375,10 +356,10 @@
}
/**
* @brief 첨부파일 추가
* @brief Add an attachement
**/
function insertFile($file_info, $module_srl, $upload_target_srl, $download_count = 0, $manual_insert = false) {
// trigger 호출 (before)
// Call a trigger (before)
$trigger_obj->module_srl = $module_srl;
$trigger_obj->upload_target_srl = $upload_target_srl;
$output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj);
@ -390,19 +371,16 @@
}
if(!$manual_insert) {
// 첨부파일 설정 가져옴
// Get the file configurations
$logged_info = Context::get('logged_info');
if($logged_info->is_admin != 'Y') {
$oFileModel = &getModel('file');
$config = $oFileModel->getFileConfig($module_srl);
$allowed_filesize = $config->allowed_filesize * 1024 * 1024;
$allowed_attach_size = $config->allowed_attach_size * 1024 * 1024;
// 한 파일당 허용 용량 초과시 오류 출력
// An error appears if file size exceeds a limit
if($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size');
// 해당 문서에 첨부된 모든 파일의 용량을 가져옴 (DB에서 가져옴)
// Get total file size of all attachements (from DB)
$size_args->upload_target_srl = $upload_target_srl;
$output = executeQuery('file.getAttachedFileSize', $size_args);
$attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']);
@ -410,9 +388,9 @@
}
}
// 이미지인지 기타 파일인지 체크하여 upload path 지정
// Set upload path by checking if the attachement is an image or other kinds of file
if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) {
// direct 파일에 해킹을 의심할 수 있는 확장자가 포함되어 있으면 바로 삭제함
// Immediately remove the direct file if it has any kind of extensions for hacking
$file_info['name'] = preg_replace('/\.(php|phtm|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']);
$file_info['name'] = str_replace(array('<','>'),array('%3C','%3E'),$file_info['name']);
@ -435,11 +413,9 @@
$filename = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
$direct_download = 'N';
}
// 디렉토리 생성
// Create a directory
if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create');
// 파일 이동
// Move the file
if($manual_insert) {
@copy($file_info['tmp_name'], $filename);
if(!file_exists($filename)) {
@ -452,12 +428,10 @@
if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1,'msg_file_upload_error');
}
}
// 사용자 정보를 구함
// Get member information
$oMemberModel = &getModel('member');
$member_srl = $oMemberModel->getLoggedMemberSrl();
// 파일 정보를 정리
// List file information
$args->file_srl = getNextSequence();
$args->upload_target_srl = $upload_target_srl;
$args->module_srl = $module_srl;
@ -472,8 +446,7 @@
$output = executeQuery('file.insertFile', $args);
if(!$output->toBool()) return $output;
// trigger 호출 (after)
// Call a trigger (after)
$trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args);
if(!$trigger_output->toBool()) return $trigger_output;
@ -488,7 +461,7 @@
}
/**
* @brief 첨부파일 삭제
* @brief Delete the attachment
**/
function deleteFile($file_srl) {
if(!$file_srl) return;
@ -510,21 +483,17 @@
$source_filename = $output->data->source_filename;
$uploaded_filename = $output->data->uploaded_filename;
// trigger 호출 (before)
// Call a trigger (before)
$trigger_obj = $output->data;
$output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj);
if(!$output->toBool()) return $output;
// DB에서 삭제
// Remove from the DB
$output = executeQuery('file.deleteFile', $args);
if(!$output->toBool()) return $output;
// trigger 호출 (after)
// Call a trigger (after)
$trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj);
if(!$trigger_output->toBool()) return $trigger_output;
// 삭제 성공하면 파일 삭제
// If successfully deleted, remove the file
FileHandler::removeFile($uploaded_filename);
}
@ -532,22 +501,19 @@
}
/**
* @brief 특정 문서의 첨부파일을 모두 삭제
* @brief Delete all attachments of a particular document
**/
function deleteFiles($upload_target_srl) {
// 첨부파일 목록을 받음
// Get a list of attachements
$oFileModel = &getModel('file');
$file_list = $oFileModel->getFiles($upload_target_srl);
// 첨부파일이 없으면 성공 return
// Success returned if no attachement exists
if(!is_array($file_list)||!count($file_list)) return new Object();
// DB에서 삭제
// Remove from the DB
$args->upload_target_srl = $upload_target_srl;
$output = executeQuery('file.deleteFiles', $args);
if(!$output->toBool()) return $output;
// 실제 파일 삭제
// Delete the file
$path = array();
$file_count = count($file_list);
for($i=0;$i<$file_count;$i++) {
@ -558,15 +524,14 @@
$path_info = pathinfo($uploaded_filename);
if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
}
// 해당 글의 첨부파일 디렉토리 삭제
// Remove a file directory of the document
for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
return $output;
}
/**
* @brief 특정 글의 첨부파일을 다른 글로 이동
* @brief Move an attachement to the other document
**/
function moveFile($source_srl, $target_module_srl, $target_srl) {
if($source_srl == $target_srl) return;
@ -582,8 +547,7 @@
unset($file_info);
$file_info = $file_list[$i];
$old_file = $file_info->uploaded_filename;
// 이미지인지 기타 파일인지 체크하여 이동할 위치 정함
// Determine the file path by checking if the file is an image or other kinds
if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_info->source_filename)) {
$path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl);
$new_file = $path.$file_info->source_filename;
@ -591,17 +555,13 @@
$path = sprintf("./files/attach/binaries/%s/%s/", $target_module_srl, $target_srl);
$new_file = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
}
// 이전 대상이 동일하면 그냥 패스
// Pass if a target document to move is same
if($old_file == $new_file) continue;
// 디렉토리 생성
// Create a directory
FileHandler::makeDir($path);
// 파일 이동
// Move the file
FileHandler::rename($old_file, $new_file);
// DB 정보도 수정
// Update DB information
unset($args);
$args->file_srl = $file_info->file_srl;
$args->uploaded_filename = $new_file;
@ -612,7 +572,7 @@
}
/**
* @brief upload_target_srl을 키로 하는 첨부파일을 찾아서 java script 코드로 return
* @brief Find the attachment where a key is upload_target_srl and then return java script code
**/
function printUploadedFileList($editor_sequence, $upload_target_srl) {
return;

View file

@ -2,21 +2,21 @@
/**
* @class fileModel
* @author NHN (developers@xpressengine.com)
* @brief file 모듈의 model 클래스
* @brief model class of the file module
**/
class fileModel extends file {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 특정 문서에 속한 첨부파일 목록을 return
* 문서 생성/ 수정시 ajax로 특정 upload_target_srl에 대해서 파일 목록을 요청받을 사용됨.
* upload_target_srl이 정해지지 않은 경우 서버측 session의 값으로 대체 시도
* @brief Return a file list attached in the document
* It is used when a file list of the upload_target_srl is requested for creating/updating a document.
* Attempt to replace with sever-side session if upload_target_srl is not yet determined
**/
function getFileList() {
$oModuleModel = &getModel('module');
@ -50,16 +50,13 @@
$attached_size = 0;
$files = array();
}
// 업로드 상태 표시 작성
// Display upload status
$upload_status = $this->getUploadStatus($attached_size);
// 남은 용량 체크
// Check remained file size until upload complete
$config = $oModuleModel->getModuleInfoByMid($mid);
$file_config = $this->getUploadConfig();
$left_size = $file_config->allowed_attach_size*1024*1024 - $attached_size;
// 필요한 정보들 세팅
// Settings of required information
$this->add("files",$files);
$this->add("editor_sequence",$editor_sequence);
$this->add("upload_target_srl",$upload_target_srl);
@ -68,7 +65,7 @@
}
/**
* @brief 특정 문서에 속한 첨부파일의 개수를 return
* @brief Return number of attachments which belongs to a specific document
**/
function getFilesCount($upload_target_srl) {
$args->upload_target_srl = $upload_target_srl;
@ -77,17 +74,17 @@
}
/**
* @brief 다운로드 경로를 구함
* @brief Get a download path
**/
function getDownloadUrl($file_srl, $sid) {
return sprintf('?module=%s&amp;act=%s&amp;file_srl=%s&amp;sid=%s', 'file', 'procFileDownload', $file_srl, $sid);
}
/**
* @brief 파일 설정 정보를 구함
* @brief Get file cinfigurations
**/
function getFileConfig($module_srl = null) {
// 설정 정보를 받아옴 (module model 객체를 이용)
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$file_module_config = $oModuleModel->getModuleConfig('file');
@ -104,8 +101,7 @@
$config->allow_outlink_site = $file_config->allow_outlink_site;
$config->allow_outlink_format = $file_config->allow_outlink_format;
}
// 전체 파일첨부 속성을 먼저 따른다
// Property for all files comes first than each property
if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize;
if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size;
if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes;
@ -113,8 +109,7 @@
if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site;
if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format;
if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant;
// 그래도 없으면 default로
// Default setting if not exists
if(!$config->allowed_filesize) $config->allowed_filesize = '2';
if(!$config->allowed_attach_size) $config->allowed_attach_size = '3';
if(!$config->allowed_filetypes) $config->allowed_filetypes = '*.*';
@ -125,7 +120,7 @@
}
/**
* @brief 파일 정보를 구함
* @brief Get file information
**/
function getFile($file_srl) {
$args->file_srl = $file_srl;
@ -139,7 +134,7 @@
}
/**
* @brief 특정 문서에 속한 파일을 모두 return
* @brief Return all files which belong to a specific document
**/
function getFiles($upload_target_srl) {
$args->upload_target_srl = $upload_target_srl;
@ -163,7 +158,7 @@
}
/**
* @brief 첨부파일에 대한 설정을 return (관리자/비관리자 자동 구분)
* @brief Return configurations of the attachement (it automatically checks if an administrator is)
**/
function getUploadConfig() {
$logged_info = Context::get('logged_info');
@ -173,7 +168,7 @@
$file_config->allowed_filetypes = '*.*';
} else {
$module_srl = Context::get('module_srl');
// module_srl이 없으면 현재 모듈
// Get the current module if module_srl doesn't exist
if(!$module_srl) {
$current_module_info = Context::get('current_module_info');
$module_srl = $current_module_info->module_srl;
@ -184,12 +179,11 @@
}
/**
* @brief 파일 업로드를 위한 관리자/비관리자에 따른 안내문구 return
* @brief Return messages for file upload and it depends whether an admin is or not
**/
function getUploadStatus($attached_size = 0) {
$file_config = $this->getUploadConfig();
// 업로드 상태 표시 작성
// Display upload status
$upload_status = sprintf(
'%s : %s/ %s<br /> %s : %s (%s : %s)',
Context::getLang('allowed_attach_size'),
@ -204,7 +198,7 @@
}
/**
* @brief 특정 모듈의 file 설정을 return
* @brief Return file configuration of the module
**/
function getFileModuleConfig($module_srl) {
return $this->getFileConfig($module_srl);

View file

@ -2,7 +2,7 @@
/**
* @class fileView
* @author NHN (developers@xpressengine.com)
* @brief file module의 view class
* @brief The view class file module
*
*
*
@ -11,38 +11,35 @@
class fileView extends file {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 서비스형 모듈의 추가 설정을 위한 부분
* file의 사용 형태에 대한 설정만 받음
* @brief This is for additional configuration for service module
* It only receives file configurations
**/
function triggerDispFileAdditionSetup(&$obj) {
$current_module_srl = Context::get('module_srl');
$current_module_srls = Context::get('module_srls');
if(!$current_module_srl && !$current_module_srls) {
// 선택된 모듈의 정보를 가져옴
// Get information of the current module
$current_module_info = Context::get('current_module_info');
$current_module_srl = $current_module_info->module_srl;
if(!$current_module_srl) return new Object();
}
// 선택된 모듈의 file설정을 가져옴
// Get file configurations of the module
$oFileModel = &getModel('file');
$file_config = $oFileModel->getFileModuleConfig($current_module_srl);
Context::set('file_config', $file_config);
// 그룹의 설정을 위한 권한 가져오기
// Get a permission for group setting
$oMemberModel = &getModel('member');
$site_module_info = Context::get('site_module_info');
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
Context::set('group_list', $group_list);
// 템플릿 파일 지정
// Set a template file
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'file_module_config');
$obj .= $tpl;

View file

@ -2,7 +2,7 @@
/**
* @class extract
* @author NHN (developers@xpressengine.com)
* @brief 대용량의 xml파일을 특정 태그를 중심으로 개별 파일로 저장하는 클래스
* @brief Class to save each file by using tags in the large xml
**/
class extract {
var $key = '';
@ -26,7 +26,7 @@
var $index = 0;
/**
* @brief 생성자, 대상 파일이름과 시작- 태그명, 그리고 개별 아이템 태그명을 인자로 받음
* @brief Get arguments for constructor, file name, start tag, end tag, tag name for each item
**/
function set($filename, $startTag, $endTag, $itemTag, $itemEndTag) {
$this->filename = $filename;
@ -47,18 +47,16 @@
}
/**
* @brief 지정된 파일의 지시자를
* @brief Open an indicator of the file
**/
function openFile() {
FileHandler::removeFile($this->cache_index_file);
$this->index_fd = fopen($this->cache_index_file,"a");
// local 파일일 경우
// If local file
if(!preg_match('/^http:/i',$this->filename)) {
if(!file_exists($this->filename)) return new Object(-1,'msg_no_xml_file');
$this->fd = fopen($this->filename,"r");
// remote 파일일 경우
// If remote file
} else {
$url_info = parse_url($this->filename);
if(!$url_info['port']) $url_info['port'] = 80;
@ -66,8 +64,7 @@
$this->fd = @fsockopen($url_info['host'], $url_info['port']);
if(!$this->fd) return new Object(-1,'msg_no_xml_file');
// 한글 파일이 있으면 한글파일 부분만 urlencode하여 처리 (iconv 필수)
// If the file name contains Korean, do urlencode(iconv required)
$path = $url_info['path'];
if(preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path)&&function_exists('iconv')) {
$path_list = explode('/',$path);

View file

@ -2,7 +2,7 @@
/**
* @class importerAdminController
* @author NHN (developers@xpressengine.com)
* @brief importer 모듈의 admin controller class
* @brief admin controller class of importer module
**/
@set_time_limit(0);
@ -14,13 +14,13 @@
var $oXmlParser = null;
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 회원정보와 게시물 정보를 싱크
* @brief sync member information with document information
**/
function procImporterAdminSync() {
/* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 댓글에 대한 사용자 정보를 동기화 없으므로 예외 처리 합니다.
@ -74,16 +74,14 @@
}
/**
* @brief XML파일을 미리 분석하여 개발 단위로 캐싱
* @brief Pre-analyze the xml file and cache it
**/
function procImporterAdminPreProcessing() {
// 이전할 대상 xml파일을 구함
// Get the target xml file to import
$xml_file = Context::get('xml_file');
// 이전할 대상의 type을 구함
// Get a type of the target
$type = Context::get('type');
// xml파일에서 정해진 규칙으로 캐싱
// Extract and cache information from the xml file
$oExtract = new extract();
switch($type) {
@ -96,10 +94,10 @@
if($output->toBool()) $oExtract->saveItems();
break;
case 'ttxml' :
// 카테고리 정보를 구함
// Category information
$output = $oExtract->set($xml_file, '', '', '', '');
if ($output->toBool()) {
// ttxml 카테고리는 별도로 구함
// Get a category of ttxml separately
$started = false;
$buff = '';
while (!feof($oExtract->fd)) {
@ -117,7 +115,7 @@
FileHandler::writeFile($category_filename, $buff);
// 방명록 정보를 구함
// Guestbook information
$output = $oExtract->set($xml_file, '', '', '', '');
if ($output->toBool()) {
$started = false;
@ -140,8 +138,7 @@
$oExtract->closeFile();
$guestbook_filename = sprintf('%s/%s', $oExtract->cache_path, 'guestbook.xml');
FileHandler::writeFile($guestbook_filename, $buff);
// 개별 아이템 구함
// Individual items
$output = $oExtract->set($xml_file,'<blog', '</blog>', '<post ', '</post>');
if($output->toBool()) $oExtract->saveItems();
@ -149,12 +146,11 @@
}
break;
default :
// 카테고리 정보를 먼저 구함
// First get category information
$output = $oExtract->set($xml_file,'<categories>', '</categories>', '<category','</category>');
if($output->toBool()) {
$oExtract->mergeItems('category.xml');
// 개별 아이템 구함
// Get each item
$output = $oExtract->set($xml_file,'<posts ', '</posts>', '<post>', '</post>');
if($output->toBool()) $oExtract->saveItems();
}
@ -168,8 +164,7 @@
$this->setMessage($output->getMessage());
return;
}
// extract가 종료됨을 알림
// Notify that all data completely extracted
$this->add('type',$type);
$this->add('total',$oExtract->getTotalCount());
$this->add('cur',0);
@ -178,11 +173,10 @@
}
/**
* @brief xml파일의 내용이 extract되고 난후 차례대로 마이그레이션
* @brief Migrate data after completing xml file extraction
**/
function procImporterAdminImport() {
// 변수 설정
// Variable setting
$type = Context::get('type');
$total = Context::get('total');
$cur = Context::get('cur');
@ -191,9 +185,7 @@
$target_module = Context::get('target_module');
$guestbook_target_module = Context::get('guestbook_target_module');
$this->unit_count = Context::get('unit_count');
// index파일이 있는지 확인
// Check if an index file exists
$index_file = './files/cache/importer/'.$key.'/index';
if(!file_exists($index_file)) return new Object(-1, 'msg_invalid_xml_file');
@ -215,20 +207,18 @@
$cur = $this->importMember($key, $cur, $index_file);
break;
case 'module' :
// 타켓 모듈의 유무 체크
// Check if the target module exists
if(!$target_module) return new Object(-1,'msg_invalid_request');
$cur = $this->importModule($key, $cur, $index_file, $target_module);
break;
}
// extract가 종료됨을 알림
// Notify that all data completely extracted
$this->add('type',$type);
$this->add('total',$total);
$this->add('cur',$cur);
$this->add('key', $key);
$this->add('target_module', $target_module);
// 모두 입력시 성공 메세지 출력하고 cache 파일제거
// When completing, success message appears and remove the cache files
if($total <= $cur) {
$this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) );
FileHandler::removeFilesInDir('./files/cache/importer/'.$key);
@ -236,41 +226,32 @@
}
/**
* @brief 회원 정보 입력
* @brief Import member information
**/
function importMember($key, $cur, $index_file) {
if(!$cur) $cur = 0;
// xmlParser객체 생성
// Create the xmlParser object
$oXmlParser = new XmlParser();
// 회원 입력을 위한 기본 객체들 생성
// Create objects for importing member information
$this->oMemberController = &getController('member');
$this->oMemberModel = &getModel('member');
// 기본 회원 그룹을 구함
// Get a default member group
$default_group = $this->oMemberModel->getDefaultGroup();
$default_group_srl = $default_group->group_srl;
// index파일을 염
// Open an index file
$f = fopen($index_file,"r");
// 이미 읽혀진 것은 패스
// Pass if already read
for($i=0;$i<$cur;$i++) fgets($f, 1024);
// 라인단위로 읽어들이면서 $cur보다 커지고 $cur+$this->unit_count개보다 작으면 중지
// Read by each line until the condition meets
for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) {
if(feof($f)) break;
// 정해진 위치를 찾음
// Find a given location
$target_file = trim(fgets($f, 1024));
// 대상 파일을 읽여서 파싱후 입력
// Load and parse the file
$xmlObj = $oXmlParser->loadXmlFile($target_file);
FileHandler::removeFile($target_file);
if(!$xmlObj) continue;
// 객체 정리
// List Objects
$obj = null;
$obj->user_id = base64_decode($xmlObj->member->user_id->body);
$obj->password = base64_decode($xmlObj->member->password->body);
@ -296,71 +277,56 @@
$obj->extra_vars->{$key} = base64_decode($val->body);
}
}
// homepage, blog의 url을 정확히 만듬
// Create url for homepage and blog
if($obj->homepage && !preg_match("/^http:\/\//i",$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage;
if($obj->blog && !preg_match("/^http:\/\//i",$obj->blog)) $obj->blog = 'http://'.$obj->blog;
// email address 필드 정리
// email address column
$obj->email_address = $obj->email;
list($obj->email_id, $obj->email_host) = explode('@', $obj->email);
// 메일링 허용 체크
// Set the mailing option
if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N';
// 쪽지 수신 체크
// Set the message option
$obj->allow_message = 'Y';
if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y';
// 최종 로그인 시간이 없으면 가입일을 입력
// Get member-join date if the last login time is not found
if(!$obj->last_login) $obj->last_login = $obj->regdate;
// 회원 번호를 구함
// Get a member_srl
$obj->member_srl = getNextSequence();
// 확장변수의 정리
// List extra vars
$extra_vars = $obj->extra_vars;
unset($obj->extra_vars);
$obj->extra_vars = serialize($extra_vars);
// 중복되는 nick_name 데이터가 있는지 체크
// Check if the same nickname is existing
$nick_args = null;
$nick_args->nick_name = $obj->nick_name;
$nick_output = executeQuery('member.getMemberSrl', $nick_args);
if(!$nick_output->toBool()) $obj->nick_name .= '_'.$obj->member_srl;
// 회원 추가
// Add a member
$output = executeQuery('member.insertMember', $obj);
// 입력 성공시 그룹 가입/ 이미지이름-마크-서명등을 추가
// add group join/image name-mark-signiture and so on if a new member successfully added
if($output->toBool()) {
// 기본 그룹 가입 시킴
// Join to the default group
$obj->group_srl = $default_group_srl;
executeQuery('member.addMemberToGroup',$obj);
// 이미지네임
// Image name
if($obj->image_nickname) {
$target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl));
$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
FileHandler::writeFile($target_filename, $obj->image_nickname);
}
// 이미지마크
// Image mark
if($obj->image_mark && file_exists($obj->image_mark)) {
$target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl));
$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
FileHandler::writeFile($target_filename, $obj->image_mark);
}
// 프로필 이미지
// Profile image
if($obj->profile_image) {
$target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl));
$target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl);
FileHandler::writeFile($target_filename, $obj->profile_image);
}
// 서명
// Signiture
if($obj->signature) {
$signature = removeHackTag($obj->signature);
$signature_buff = sprintf('<?php if(!defined("__ZBXE__")) exit();?>%s', $signature);
@ -380,33 +346,26 @@
}
/**
* @brief 주어진 xml 파일을 파싱해서 쪽지 정보 입력
* @brief Import message information parsed from a given xml file
**/
function importMessage($key, $cur, $index_file) {
if(!$cur) $cur = 0;
// xmlParser객체 생성
// Create the xmlParser object
$oXmlParser = new XmlParser();
// index파일을 염
// Open an index file
$f = fopen($index_file,"r");
// 이미 읽혀진 것은 패스
// Pass if already read
for($i=0;$i<$cur;$i++) fgets($f, 1024);
// 라인단위로 읽어들이면서 $cur보다 커지고 $cur+$this->unit_count개보다 작으면 중지
// Read each line until the condition meets
for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) {
if(feof($f)) break;
// 정해진 위치를 찾음
// Find a location
$target_file = trim(fgets($f, 1024));
// 대상 파일을 읽여서 파싱후 입력
// Load and parse the file
$xmlObj = $oXmlParser->loadXmlFile($target_file);
FileHandler::removeFile($target_file);
if(!$xmlObj) continue;
// 객체 정리
// List objects
$obj = null;
$obj->receiver = base64_decode($xmlObj->message->receiver->body);
$obj->sender = base64_decode($xmlObj->message->sender->body);
@ -416,8 +375,7 @@
$obj->regdate = base64_decode($xmlObj->message->regdate->body);
$obj->readed_date = base64_decode($xmlObj->message->readed_date->body);
$obj->receiver = base64_decode($xmlObj->message->receiver->body);
// 보낸이/ 받는이의 member_srl을 구함 (존재하지 않으면 그냥 pass..)
// Get member_srl of sender/recipient (If not exists, pass)
if(!$obj->sender) continue;
$sender_args->user_id = $obj->sender;
$sender_output = executeQuery('member.getMemberInfo',$sender_args);
@ -429,8 +387,7 @@
$receiver_output = executeQuery('member.getMemberInfo',$receiver_args);
$receiver_srl = $receiver_output->data->member_srl;
if(!$receiver_srl) continue;
// 보내는 사용자의 쪽지함에 넣을 쪽지
// Message to save into sender's message box
$sender_args->sender_srl = $sender_srl;
$sender_args->receiver_srl = $receiver_srl;
$sender_args->message_type = 'S';
@ -445,7 +402,7 @@
$output = executeQuery('communication.sendMessage', $sender_args);
if($output->toBool()) {
// 받는 회원의 쪽지함에 넣을 쪽지
// Message to save into recipient's massage box
$receiver_args->message_srl = $sender_args->related_srl;
$receiver_args->list_order = $sender_args->related_srl*-1;
$receiver_args->sender_srl = $sender_srl;
@ -467,25 +424,23 @@
}
/**
* @brief module.xml 형식의 데이터 import
* @brief Import data in module.xml format
**/
function importModule($key, $cur, $index_file, $module_srl) {
// 필요한 객체 미리 생성
// Pre-create the objects needed
$this->oXmlParser = new XmlParser();
// 타겟 모듈의 카테고리 정보 구함
// Get category information of the target module
$oDocumentController = &getController('document');
$oDocumentModel = &getModel('document');
$category_list = $category_titles = array();
$category_list = $oDocumentModel->getCategoryList($module_srl);
if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
// 먼저 카테고리 정보를 입력함
// Extract category information
$category_file = preg_replace('/index$/i', 'category.xml', $index_file);
if(file_exists($category_file)) {
$buff = FileHandler::readFile($category_file);
// xmlParser객체 생성
// Create the xmlParser object
$xmlDoc = $this->oXmlParser->loadXmlFile($category_file);
$categories = $xmlDoc->items->category;
@ -524,23 +479,18 @@
}
if(!$cur) $cur = 0;
// index파일을 염
// Open an index file
$f = fopen($index_file,"r");
// 이미 읽혀진 것은 패스
// Pass if already read
for($i=0;$i<$cur;$i++) fgets($f, 1024);
// 라인단위로 읽어들이면서 $cur보다 커지고 $cur+$this->unit_count개보다 작으면 중지
// Read each line until the condition meets
for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) {
if(feof($f)) break;
// 정해진 위치를 찾음
// Find a location
$target_file = trim(fgets($f, 1024));
if(!file_exists($target_file)) continue;
// 이제부터 데이터를 가져오면서 처리
// Importing data from now on
$fp = fopen($target_file,"r");
if(!$fp) continue;
@ -553,31 +503,25 @@
$started = false;
$buff = null;
// 본문 데이터부터 처리 시작
// Start from the body data
while(!feof($fp)) {
$str = fgets($fp, 1024);
// 한 아이템 준비 시작
// Prepare an item
if(trim($str) == '<post>') {
$started = true;
// 엮인글 입력
// Trackback inserted
} else if(substr($str,0,11) == '<trackbacks') {
$obj->trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl);
continue;
// 댓글 입력
// Comments inserted
} else if(substr($str,0,9) == '<comments') {
$obj->comment_count = $this->importComments($fp, $module_srl, $obj->document_srl);
continue;
// 첨부파일 입력
// Attachment inserted
} else if(substr($str,0,9) == '<attaches') {
$obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files);
continue;
// 추가 변수 시작 일 경우
// When starting extra variabls
} elseif(trim($str) == '<extra_vars>') {
$extra_vars = $this->importExtraVars($fp);
continue;
@ -618,8 +562,7 @@
$obj->lock_comment = base64_decode($xmlDoc->post->lock_comment->body)=='Y'?'Y':'N';
$obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body)!='N'?'Y':'N';
$obj->notify_message = base64_decode($xmlDoc->post->is_notice->body);
// content 정보 변경 (첨부파일)
// Change content information (attachment)
if(count($files)) {
foreach($files as $key => $val) {
$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content);
@ -645,8 +588,7 @@
}
}
// 확장변수 추가
// Add extra variables
if(count($extra_vars)) {
foreach($extra_vars as $key => $val) {
if(!$val->value) continue;
@ -657,8 +599,7 @@
$e_args->value = $val->value;
$e_args->lang_code = $val->lang_code;
$e_args->eid = $val->eid;
// 등록된 확장변수 키가 없으면 생성(제목/내용 언어별 변수는 제외)
// Create a key for extra vars if not exists (except vars for title and content)
if(!preg_match('/^(title|content)_(.+)$/i',$e_args->eid) && !$extra_keys[$e_args->eid]) {
unset($ek_args);
$ek_args->module_srl = $module_srl;
@ -681,15 +622,14 @@
}
fclose($f);
// 카테고리별 개수 동기화
// Sync category counts
if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl);
return $idx-1;
}
/**
* @brief 엮인글 정리
* @brief Trackbacks
**/
function importTrackbacks($fp, $module_srl, $document_srl) {
$started = false;
@ -698,16 +638,13 @@
while(!feof($fp)) {
$str = fgets($fp, 1024);
// </trackbacks>이면 중단
// If </trackbacks> is, break
if(trim($str) == '</trackbacks>') break;
// <trackback>면 시작
// If <trackback>, start importing
if(trim($str) == '<trackback>') $started = true;
if($started) $buff .= $str;
// </trackback>이면 DB에 입력
// If </trackback>, insert to the DB
if(trim($str) == '</trackback>') {
$xmlDoc = $this->oXmlParser->parse($buff);
@ -733,7 +670,7 @@
}
/**
* @brief 댓글 정리
* @brief Comments
**/
function importComments($fp, $module_srl, $document_srl) {
$started = false;
@ -745,27 +682,23 @@
while(!feof($fp)) {
$str = fgets($fp, 1024);
// </comments>이면 중단
// If </comments> is, break
if(trim($str) == '</comments>') break;
// <comment>면 시작
// If <comment> is, start importing
if(trim($str) == '<comment>') {
$started = true;
$obj = null;
$obj->comment_srl = getNextSequence();
$files = array();
}
// attaches로 시작하면 첨부파일 시작
// If <attaches is, start importing attachments
if(substr($str,0,9) == '<attaches') {
$obj->uploaded_count = $this->importAttaches($fp, $module_srl, $obj->comment_srl, $files);
continue;
}
if($started) $buff .= $str;
// </comment>이면 DB에 입력
// If </comment> is, insert to the DB
if(trim($str) == '</comment>') {
$xmlDoc = $this->oXmlParser->parse($buff);
@ -797,33 +730,28 @@
if(!$obj->last_update) $obj->last_update = $obj->regdate;
$obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body);
$obj->list_order = $obj->comment_srl*-1;
// content 정보 변경 (첨부파일)
// Change content information (attachment)
if(count($files)) {
foreach($files as $key => $val) {
$obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content);
}
}
// 댓글 목록 부분을 먼저 입력
// Comment list first
$list_args = null;
$list_args->comment_srl = $obj->comment_srl;
$list_args->document_srl = $obj->document_srl;
$list_args->module_srl = $obj->module_srl;
$list_args->regdate = $obj->regdate;
// 부모댓글이 없으면 바로 데이터를 설정
// Set data directly if parent comment doesn't exist
if(!$obj->parent_srl) {
$list_args->head = $list_args->arrange = $obj->comment_srl;
$list_args->depth = 0;
// 부모댓글이 있으면 부모글의 정보를 구해옴
// Get parent_srl if parent comment exists
} else {
// 부모댓글의 정보를 구함
// Get parent comment infomation
$parent_args->comment_srl = $obj->parent_srl;
$parent_output = executeQuery('comment.getCommentListItem', $parent_args);
// 부모댓글이 존재하지 않으면 return
// Return if parent comment doesn't exist
if(!$parent_output->toBool() || !$parent_output->data) continue;
$parent = $parent_output->data;
@ -851,7 +779,7 @@
}
/**
* @brief 첨부파일 정리
* @brief Import attachment
**/
function importAttaches($fp, $module_srl, $upload_target_srl, &$files) {
$uploaded_count = 0;
@ -861,11 +789,9 @@
while(!feof($fp)) {
$str = trim(fgets($fp, 1024));
// </attaches>로 끝나면 중단
// If it ends with </attaches>, break
if(trim($str) == '</attaches>') break;
// <attach>로 시작하면 첨부파일 수집
// If it starts with <attach>, collect attachments
if(trim($str) == '<attach>') {
$file_obj = null;
$file_obj->file_srl = getNextSequence();
@ -874,15 +800,14 @@
$started = true;
$buff = null;
// <file>로 시작하면 xml파일내의 첨부파일로 처리
// If it starts with <file>, handle the attachement in xml file
} else if(trim($str) == '<file>') {
$file_obj->file = $this->saveTemporaryFile($fp);
continue;
}
if($started) $buff .= $str;
// </attach>로 끝나면 첨부파일 정리
// If it ends with </attach>, handle attachements
if(trim($str) == '</attach>') {
$xmlDoc = $this->oXmlParser->parse($buff.$str);
@ -900,8 +825,7 @@
}
if(file_exists($file_obj->file)) {
// 이미지인지 기타 파일인지 체크하여 upload path 지정
// Set upload path by checking if the attachement is an image or other kind of file
if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_obj->source_filename)) {
$path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3));
$filename = $path.$file_obj->source_filename;
@ -911,14 +835,12 @@
$filename = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
$file_obj->direct_download = 'N';
}
// 디렉토리 생성
// Create a directory
if(!FileHandler::makeDir($path)) continue;
if(preg_match('/^\.\/files\/cache\/importer/i',$file_obj->file)) FileHandler::rename($file_obj->file, $filename);
else @copy($file_obj->file, $filename);
// DB입력
// Insert the file to the DB
unset($file_obj->file);
if(file_exists($filename)) {
$file_obj->uploaded_filename = $filename;
@ -944,7 +866,7 @@
}
/**
* @biref 임의로 사용할 파일이름을 return
* @biref Return a filename to temporarily use
**/
function getTmpFilename() {
$path = "./files/cache/importer";
@ -955,7 +877,7 @@
}
/**
* @brief 특정 파일포인트로부터 key에 해당하는 값이 나타날때까지 buff를 읽음
* @brief Read buff until key value comes out from a specific file point
**/
function saveTemporaryFile($fp) {
$temp_filename = $this->getTmpFilename();
@ -979,7 +901,7 @@
/**
* @brief 게시글 추가 변수 설정
* @brief Set extra variables
**/
function importExtraVars($fp) {
$buff = null;

View file

@ -2,21 +2,21 @@
/**
* @class importerAdminView
* @author NHN (developers@xpressengine.com)
* @brief importer 모듈의 admin view class
* @brief admin view class of the importer module
**/
class importerAdminView extends importer {
/**
* @brief 초기화
* @brief Initialization
*
* importer 모듈은 일반 사용과 관리자용으로 나누어진다.\n
* Importer module is divided by general use and administrative use \n
**/
function init() {
}
/**
* @brief XML 파일을 업로드하는 form 출력
* @brief Display a form to upload the xml file
**/
function dispImporterAdminContent() {
$this->setTemplatePath($this->module_path.'tpl');

View file

@ -2,34 +2,34 @@
/**
* @class importer
* @author NHN (developers@xpressengine.com)
* @brief importer 모듈의 high class
* @brief high class of importer module
**/
class importer extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
return false;
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
return new Object();
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
}

View file

@ -13,26 +13,23 @@
var $oXmlParser = null;
/**
* @brief module.xml 형식의 데이터 import
* @brief import data in module.xml format
**/
function importModule($key, $cur, $index_file, $unit_count, $module_srl, $guestbook_module_srl, $user_id, $module_name=null) {
// 필요한 객체 미리 생성
// Pre-create the objects needed
$this->oXmlParser = new XmlParser();
// 타겟 모듈의 카테고리 정보 구함
// Get category information of the target module
$oDocumentController = &getController('document');
$oDocumentModel = &getModel('document');
$category_list = $category_titles = array();
$category_list = $oDocumentModel->getCategoryList($module_srl);
if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
// 먼저 카테고리 정보를 입력함
// First handle categorty information
$category_file = preg_replace('/index$/i', 'category.xml', $index_file);
if(file_exists($category_file)) {
// xmlParser객체 생성
// Create the xmlParser object
$xmlDoc = $this->oXmlParser->loadXmlFile($category_file);
// 카테고리 정보를 정리
// List category information
if($xmlDoc->categories->category) {
$categories = array();
$idx = 0;
@ -58,30 +55,24 @@
$category_list = $category_titles = array();
$category_list = $oDocumentModel->getCategoryList($module_srl);
if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl;
// 관리자 정보를 구함
// Get administrator information
$oMemberModel = &getModel('member');
$member_info = $oMemberModel->getMemberInfoByUserID($user_id);
$author_xml_id = 0;
if(!$cur) $cur = 0;
// index파일을 염
// Open an index file
$f = fopen($index_file,"r");
// 이미 읽혀진 것은 패스
// Pass if already read
for($i=0;$i<$cur;$i++) fgets($f, 1024);
// 라인단위로 읽어들이면서 $cur보다 커지고 $cur+$unit_count개보다 작으면 중지
// Read each line until the codition meets
for($idx=$cur;$idx<$cur+$unit_count;$idx++) {
if(feof($f)) break;
// 정해진 위치를 찾음
// Find a location
$target_file = trim(fgets($f, 1024));
if(!file_exists($target_file)) continue;
// 이제부터 데이터를 가져오면서 처리
// Start importing data
$fp = fopen($target_file,"r");
if(!$fp) continue;
@ -94,17 +85,14 @@
$started = false;
$buff = null;
// 본문 데이터부터 처리 시작
// Start importing from the body data
while(!feof($fp)) {
$str = fgets($fp, 1024);
// 한 아이템 준비 시작
// Prepare an item
if(substr($str,0,5) == '<post') {
$started = true;
continue;
// 첨부파일 입력
// Import the attachment
} else if(substr($str,0,12) == '<attachment ') {
if($this->importAttaches($fp, $module_srl, $obj->document_srl, $files, $str)) $obj->uploaded_count++;
continue;
@ -158,8 +146,7 @@
$obj->list_order = $obj->update_order = $obj->document_srl*-1;
$obj->lock_comment = 'N';
$obj->notify_message = 'N';
// content 정보 변경 (첨부파일)
// Change content information (attachment)
$obj->content = str_replace('[##_ATTACH_PATH_##]/','',$obj->content);
if(count($files)) {
foreach($files as $key => $val) {
@ -173,8 +160,7 @@
$this->files = $files;
$obj->content = preg_replace_callback('!\[##_([a-z0-9]+)\|([^\|]*)\|([^\|]*)\|(.*?)_##\]!is', array($this, '_replaceTTAttach'), $obj->content);
}
// 역인글 입력
// Trackback inserted
$obj->trackback_count = 0;
if($xmlDoc->post->trackback) {
$trackbacks = $xmlDoc->post->trackback;
@ -197,8 +183,7 @@
}
}
}
// 댓글입력
// Comment
$obj->comment_count = 0;
if($xmlDoc->post->comment) {
$comment = $xmlDoc->post->comment;
@ -224,20 +209,18 @@
$args->module_srl = $obj->module_srl;
$args->logs = serialize(null);
$output = executeQuery('textyle.insertPublishLog', $args);
// 발행 상태의 visibility 값
// Visibility value of published state
$status_published = array('public', 'syndicated');
// 발행이 아닌 것들은 저장상태로
// Save state if not published
if(!in_array($xmlDoc->post->visibility->body, $status_published)) {
$obj->module_srl = $member_info->member_srl;
}
}
// 문서 입력
// Document
$output = executeQuery('document.insertDocument', $obj);
if($output->toBool()) {
// 태그 입력
// Tags
if($obj->tags) {
$tag_list = explode(',',$obj->tags);
$tag_count = count($tag_list);
@ -261,15 +244,12 @@
fclose($f);
if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl);
// 방명록 정보를 입력함
// Guestbook information
$guestbook_file = preg_replace('/index$/i', 'guestbook.xml', $index_file);
if (file_exists($guestbook_file)) {
// xmlParser객체 생성
// Create the xmlParser object
$xmlDoc = $this->oXmlParser->loadXmlFile($guestbook_file);
// 방명록 정보를 처리
// Handle guest book information
if($guestbook_module_srl && $xmlDoc->guestbook->comment) {
$comment = $xmlDoc->guestbook->comment;
if(!is_array($comment)) $comment = array($comment);
@ -298,7 +278,7 @@
$obj->is_secret = $val->secret->body=='1'?'Y':'N';
$obj->content = nl2br($val->content->body);
// 본문에서 제목 추출
// Extract a title form the bocy
$obj->title = cut_str(strip_tags($obj->content),20,'...');
if ($obj->title == '') $obj->title = 'Untitled';
@ -341,7 +321,7 @@
}
}
// 문서 입력
// Document
$output = executeQuery('document.insertDocument', $obj);
}
}
@ -395,7 +375,7 @@
/**
* @brief 첨부파일 정리
* @brief Attachment
**/
function importAttaches($fp, $module_srl, $upload_target_srl, &$files, $buff) {
$uploaded_count = 0;
@ -407,11 +387,9 @@
while(!feof($fp)) {
$str = fgets($fp, 1024);
// </attaches>로 끝나면 중단
// If it ends with </attaches>, break
if(trim($str) == '</attachment>') break;
// <file>로 시작하면 xml파일내의 첨부파일로 처리
// If it starts with <file>, handle the attachement in the xml file
if(substr($str, 0, 9)=='<content>') {
$file_obj->file = $this->saveTemporaryFile($fp, $str);
continue;
@ -428,8 +406,7 @@
$file_obj->source_filename = $xmlDoc->attachment->label->body;
$file_obj->download_count = $xmlDoc->attachment->downloads->body;
$name = $xmlDoc->attachment->name->body;
// 이미지인지 기타 파일인지 체크하여 upload path 지정
// Set upload path by checking if the attachement is an image or other kind of file
if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_obj->source_filename)) {
$path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3));
$filename = $path.$file_obj->source_filename;
@ -439,13 +416,11 @@
$filename = $path.md5(crypt(rand(1000000,900000), rand(0,100)));
$file_obj->direct_download = 'N';
}
// 디렉토리 생성
// Create a directory
if(!FileHandler::makeDir($path)) return;
FileHandler::rename($file_obj->file, $filename);
// DB입력
// Insert to the DB
unset($file_obj->file);
$file_obj->uploaded_filename = $filename;
$file_obj->file_size = filesize($filename);
@ -469,7 +444,7 @@
}
/**
* @biref 임의로 사용할 파일이름을 return
* @biref Return a filename to temporarily use
**/
function getTmpFilename() {
$path = "./files/cache/importer";
@ -480,7 +455,7 @@
}
/**
* @brief 특정 파일포인트로부터 key에 해당하는 값이 나타날때까지 buff를 읽음
* @brief Read buff until key value comes out from a specific file point
**/
function saveTemporaryFile($fp, $buff) {
$temp_filename = $this->getTmpFilename();
@ -501,32 +476,30 @@
}
/**
* @brief ttxml의 자체 img 태그를 치환
* @brief Replace img tag in the ttxml
**/
function _replaceTTAttach($matches) {
$name = $matches[2];
if(!$name) return $matches[0];
$obj = $this->files[$name];
// 멀티미디어성 파일의 경우
// If multimedia file is,
if($obj->direct_download == 'Y') {
// 이미지의 경우
// If image file is
if(preg_match('/\.(jpg|gif|jpeg|png)$/i', $obj->source_filename)) {
return sprintf('<img editor_component="image_link" src="%s" alt="%s" />', $obj->url, str_replace('"','\\"',$matches[4]));
// 이미지 외의 멀티미디어성 파일의 경우
// If other multimedia file but image is,
} else {
return sprintf('<img src="./common/tpl/images/blank.gif" editor_component="multimedia_link" multimedia_src="%s" width="400" height="320" style="display:block;width:400px;height:320px;border:2px dotted #4371B9;background:url(./modules/editor/components/multimedia_link/tpl/multimedia_link_component.gif) no-repeat center;" auto_start="false" alt="" />', $obj->url);
}
// binary파일일 경우
// If binary file is
} else {
return sprintf('<a href="%s">%s</a>', $obj->url, $obj->source_filename);
}
}
/**
* @brief ttxml의 동영상 변환
* @brief Convert the video file
**/
function _replaceTTMovie($matches) {
$key = $matches[1];
@ -543,7 +516,7 @@
}
/**
* @brief 댓글 입력
* @brief Comment
**/
function insertComment($val, $module_srl, $document_srl, $member_info, $parent_srl = 0, $author_xml_id) {
$tobj = null;
@ -573,26 +546,22 @@
$tobj->list_order = $tobj->comment_srl*-1;
$tobj->sequence = $sequence;
$tobj->parent_srl = $parent_srl;
// 댓글 목록 부분을 먼저 입력
// Comment list first
$list_args = null;
$list_args->comment_srl = $tobj->comment_srl;
$list_args->document_srl = $tobj->document_srl;
$list_args->module_srl = $tobj->module_srl;
$list_args->regdate = $tobj->regdate;
// 부모댓글이 없으면 바로 데이터를 설정
// Set data directly if parent comment doesn't exist
if(!$tobj->parent_srl) {
$list_args->head = $list_args->arrange = $tobj->comment_srl;
$list_args->depth = 0;
// 부모댓글이 있으면 부모글의 정보를 구해옴
// Get parent_srl if parent comment exists
} else {
// 부모댓글의 정보를 구함
// Get parent_srl
$parent_args->comment_srl = $tobj->parent_srl;
$parent_output = executeQuery('comment.getCommentListItem', $parent_args);
// 부모댓글이 존재하지 않으면 return
// Return if parent comment doesn't exist
if(!$parent_output->toBool() || !$parent_output->data) return false;
$parent = $parent_output->data;
@ -613,8 +582,7 @@
}
return false;
}
// 카테고리 정리
// List category
function arrangeCategory($obj, &$category, &$idx, $parent = 0) {
if(!$obj->category) return;
if(!is_array($obj->category)) $c = array($obj->category);

View file

@ -2,20 +2,20 @@
/**
* @class installAdminController
* @author NHN (developers@xpressengine.com)
* @brief install module의 admin controller class
* @brief admin controller class of the install module
**/
class installAdminController extends install {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 모듈 설치
* @brief Install the module
**/
function procInstallAdminInstall() {
$module_name = Context::get('module_name');
@ -28,7 +28,7 @@
}
/**
* @brief 모듈 업데이트
* @brief Upate the module
**/
function procInstallAdminUpdate() {
$module_name = Context::get('module_name');
@ -42,7 +42,7 @@
}
/**
* @brief 설정 변경
* @brief Change settings
**/
function procInstallAdminSaveTimeZone() {
$use_rewrite = Context::get('use_rewrite');
@ -101,7 +101,7 @@
}
/**
* @brief 지원 언어 선택
* @brief Supported languages
**/
function procInstallAdminSaveLangSelected() {
$selected_lang = trim(Context::get('selected_lang'));

View file

@ -2,34 +2,34 @@
/**
* @class install
* @author NHN (developers@xpressengine.com)
* @brief install module의 high class
* @brief install module of the high class
**/
class install extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
return false;
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
return new Object();
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
}

View file

@ -2,58 +2,50 @@
/**
* @class installController
* @author NHN (developers@xpressengine.com)
* @brief install module의 Controller class
* @brief install module of the Controller class
**/
class installController extends install {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
// 설치가 되어 있으면 오류
// Error occurs if already installed
if(Context::isInstalled()) {
return new Object(-1, 'msg_already_installed');
}
}
/**
* @brief 입력받은 정보로 설치를
* @brief Install with received information
**/
function procInstall() {
// 설치가 되어 있는지에 대한 체크
// Check if it is already installed
if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
// 설치시 임시로 최고관리자로 지정
// Assign a temporary administrator when installing
$logged_info->is_admin = 'Y';
$_SESSION['logged_info'] = $logged_info;
Context::set('logged_info', $logged_info);
// DB와 관련된 변수를 받음
// Get DB-related variables
$db_info = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix','time_zone','use_rewrite');
if($db_info->use_rewrite!='Y') $db_info->use_rewrite = 'N';
if(!$db_info->default_url) $db_info->default_url = Context::getRequestUri();
$db_info->lang_type = Context::getLangType();
// DB의 타입과 정보를 등록
// Set DB type and information
Context::setDBInfo($db_info);
// DB Instance 생성
// Create DB Instance
$oDB = &DB::getInstance();
// DB접속이 가능한지 체크
// Check if available to connect to the DB
$output = $oDB->getError();
if(!$oDB->isConnected()) return $oDB->getError();
// firebird는 설치시에 트랜젝션을 사용하지 않음
// When installing firebire DB, transaction will not be used
if($db_info->db_type != "firebird") $oDB->begin();
// 모든 모듈의 설치
// Install all the modules
$this->installDownloadedModule();
if($db_info->db_type != "firebird") $oDB->commit();
// config 파일 생성
// Create a config file
if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed');
// load script
@ -65,12 +57,12 @@
}
}
// 설치 완료 메세지 출력
// Display a message that installation is completed
$this->setMessage('msg_install_completed');
}
/**
* @brief FTP 정보 등록
* @brief Set FTP Information
**/
function procInstallFTP() {
if(Context::isInstalled()) return new Object(-1, 'msg_already_installed');
@ -85,8 +77,7 @@
$buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val));
}
$buff .= "?>";
// safe_mode 일 경우
// If 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');
@ -160,40 +151,33 @@
}
/**
* @brief 인스톨 환경을 체크하여 결과 return
* @brief Result returned after checking the installation environment
**/
function checkInstallEnv() {
// 각 필요한 항목 체크
// Check each item
$checklist = array();
// 0. php 버전 체크 (5.2.2는 설치 불가)
// 0. check your version of php (5.2.2 is not supported)
if(phpversion()=='5.2.2') $checklist['php_version'] = false;
else $checklist['php_version'] = true;
// 1. permission 체크
// 1. Check permission
if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true;
else $checklist['permission'] = false;
// 2. xml_parser_create함수 유무 체크
// 2. Check if xml_parser_create exists
if(function_exists('xml_parser_create')) $checklist['xml'] = true;
else $checklist['xml'] = false;
// 3. ini_get(session.auto_start)==1 체크
// 3. Check if ini_get (session.auto_start) == 1
if(ini_get(session.auto_start)!=1) $checklist['session'] = true;
else $checklist['session'] = false;
// 4. iconv 체크
// 4. Check if iconv exists
if(function_exists('iconv')) $checklist['iconv'] = true;
else $checklist['iconv'] = false;
// 5. gd 체크 (imagecreatefromgif함수)
// 5. Check gd(imagecreatefromgif function)
if(function_exists('imagecreatefromgif')) $checklist['gd'] = true;
else $checklist['gd'] = false;
if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session']) $install_enable = false;
else $install_enable = true;
// 체크 결과를 Context에 저장
// Save the checked result to the Context
Context::set('checklist', $checklist);
Context::set('install_enable', $install_enable);
@ -201,8 +185,8 @@
}
/**
* @brief files 하위 디렉토리 생성
* DB 정보를 바탕으로 실제 install하기 전에 로컬 환경 설저d
* @brief Create files and subdirectories
* Local evironment setting before installation by using DB information
**/
function makeDefaultDirectory() {
$directory_list = array(
@ -218,17 +202,16 @@
}
/**
* @brief 모든 모듈의 설치
* @brief Install all the modules
*
* 모든 module의 schemas 디렉토리를 확인하여 schema xml을 이용, 테이블 생성
* Create a table by using schema xml file in the shcema directory of each module
**/
function installDownloadedModule() {
$oModuleModel = &getModel('module');
// 각 모듈의 schemas/*.xml 파일을 모두 찾아서 table 생성
// Create a table ny finding schemas/*.xml file in each module
$module_list = FileHandler::readDir('./modules/', NULL, false, true);
foreach($module_list as $module_path) {
// 모듈 이름을 구함
// Get module name
$tmp_arr = explode('/',$module_path);
$module = $tmp_arr[count($tmp_arr)-1];
@ -236,15 +219,13 @@
if(!$xml_info) continue;
$modules[$xml_info->category][] = $module;
}
// module 모듈은 미리 설치
// Install "module" module in advance
$this->installModule('module','./modules/module');
$oModule = &getClass('module');
if($oModule->checkUpdate()) $oModule->moduleUpdate();
// 모듈을 category에 의거 설치 순서를 정함
// Determine the order of module installation depending on category
$install_step = array('system','content','member');
// 나머지 모든 모듈 설치
// Install all the remaining modules
foreach($install_step as $category) {
if(count($modules[$category])) {
foreach($modules[$category] as $module) {
@ -257,8 +238,7 @@
unset($modules[$category]);
}
}
// 나머지 모든 모듈 설치
// Install all the remaining modules
if(count($modules)) {
foreach($modules as $category => $module_list) {
if(count($module_list)) {
@ -280,13 +260,12 @@
}
/**
* @brief 개별 모듈의 설치
* @brief Install an each module
**/
function installModule($module, $module_path) {
// db instance생성
// create db instance
$oDB = &DB::getInstance();
// 해당 모듈의 schemas 디렉토리를 검사하여 schema xml파일이 있으면 생성
// Create a table if the schema xml exists in the "schemas" directory of the module
$schema_dir = sprintf('%s/schemas/', $module_path);
$schema_files = FileHandler::readDir($schema_dir, NULL, false, true);
@ -296,8 +275,7 @@
if(!$file || substr($file,-4)!='.xml') continue;
$output = $oDB->createTableByXmlFile($file);
}
// 테이블 설치후 module instance를 만들고 install() method를 실행
// Create a table and module instance and then execute install() method
unset($oModule);
$oModule = &getClass($module);
if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall();
@ -306,8 +284,8 @@
}
/**
* @brief config 파일을 생성
* 모든 설정이 이상없이 끝난 후에 config파일 생성
* @brief Create config file
* Create the config file when all settings are completed
**/
function makeConfigFile() {
$config_file = Context::getConfigFile();

View file

@ -2,7 +2,7 @@
/**
* @class installView
* @author NHN (developers@xpressengine.com)
* @brief install moduleView class
* @brief View class of install module
**/
class installView extends install {
@ -10,25 +10,22 @@
var $install_enable = false;
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
// template 경로를 지정
// Specify the template path
$this->setTemplatePath($this->module_path.'tpl');
// 설치가 되어 있으면 오류
// Error occurs if already installed
if(Context::isInstalled()) return $this->stop('msg_already_installed');
// 컨트롤러 생성
// Install a controller
$oInstallController = &getController('install');
$this->install_enable = $oInstallController->checkInstallEnv();
// 설치 가능한 환경이라면 installController::makeDefaultDirectory() 실행
// If the environment is installable, execute installController::makeDefaultDirectory()
if($this->install_enable) $oInstallController->makeDefaultDirectory();
}
/**
* @brief license 메세지 노출
* @brief Display license messages
**/
function dispInstallIntroduce() {
$install_config_file = FileHandler::getRealPath('./config/install.config.php');
@ -48,7 +45,7 @@
}
/**
* @brief 설치 환경에 대한 메세지 보여줌
* @brief Display messages about installation environment
**/
function dispInstallCheckEnv() {
$this->setTemplateFile('check_env');
@ -56,13 +53,12 @@
/**
* @brief DB 선택 화면
* @brief Choose a DB
**/
function dispInstallSelectDB() {
// 설치 불가능하다면 check_env를 출력
// Display check_env if it is not installable
if(!$this->install_enable) return $this->dispInstallCheckEnv();
// ftp 정보 입력
// Enter ftp information
if(ini_get('safe_mode') && !Context::isFTPRegisted()) {
$this->setTemplateFile('ftp');
} else {
@ -71,18 +67,16 @@
}
/**
* @brief DB 정보/ 최고 관리자 정보 입력 화면을 보여줌
* @brief Display a screen to enter DB and administrator's information
**/
function dispInstallForm() {
// 설치 불가능하다면 check_env를 출력
// Display check_env if not installable
if(!$this->install_enable) return $this->dispInstallCheckEnv();
// db_type이 지정되지 않았다면 다시 초기화면 출력
// Return to the start-up screen if db_type is not specified
if(!Context::get('db_type')) return $this->dispInstallSelectDB();
Context::set('time_zone', $GLOBALS['time_zone']);
// disp_db_info_form.html 파일 출력
// Output the file, disp_db_info_form.html
$tpl_filename = sprintf('form.%s', Context::get('db_type'));
$this->setTemplateFile($tpl_filename);
}

View file

@ -2,23 +2,23 @@
/**
* @class integration_searchAdminController
* @author NHN (developers@xpressengine.com)
* @brief integration_search moduleadmin view class
* @brief admin view class of the integration_search module
*
* 통합검색 관리
* Search Management
*
**/
class integration_searchAdminController extends integration_search {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {}
/**
* @brief 설정 저장
* @brief Save Settings
**/
function procIntegration_searchAdminInsertConfig() {
// 설정 정보를 받아옴 (module model 객체를 이용)
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('integration_search');
@ -33,79 +33,67 @@
}
/**
* @brief 스킨 정보 저장
* @brief Save the skin information
**/
function procIntegration_searchAdminInsertSkin() {
// 설정 정보를 받아옴 (module model 객체를 이용)
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('integration_search');
$args->skin = $config->skin;
$args->target_module_srl = $config->target_module_srl;
// 스킨의 정보를 구해옴 (extra_vars를 체크하기 위해서)
// Get skin information (to check extra_vars)
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $config->skin);
// 입력받은 변수들을 체크 (mo, act, module_srl, page등 기본적인 변수들 없앰)
// Check received variables (delete the basic variables such as mo, act, module_srl, page)
$obj = Context::getRequestVars();
unset($obj->act);
unset($obj->module_srl);
unset($obj->page);
// 원 skin_info에서 extra_vars의 type이 image일 경우 별도 처리를 해줌
// Separately handle if the extra_vars is an image type in the original skin_info
if($skin_info->extra_vars) {
foreach($skin_info->extra_vars as $vars) {
if($vars->type!='image') continue;
$image_obj = $obj->{$vars->name};
// 삭제 요청에 대한 변수를 구함
// Get a variable on a request to delete
$del_var = $obj->{"del_".$vars->name};
unset($obj->{"del_".$vars->name});
if($del_var == 'Y') {
FileHandler::removeFile($module_info->{$vars->name});
continue;
}
// 업로드 되지 않았다면 이전 데이터를 그대로 사용
// Use the previous data if not uploaded
if(!$image_obj['tmp_name']) {
$obj->{$vars->name} = $module_info->{$vars->name};
continue;
}
// 정상적으로 업로드된 파일이 아니면 무시
// Ignore if the file is not successfully uploaded
if(!is_uploaded_file($image_obj['tmp_name'])) {
unset($obj->{$vars->name});
continue;
}
// 이미지 파일이 아니어도 무시
// Ignore if the file is not an image
if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) {
unset($obj->{$vars->name});
continue;
}
// 경로를 정해서 업로드
// Upload the file to a path
$path = sprintf("./files/attach/images/%s/", $module_srl);
// 디렉토리 생성
// Create a directory
if(!FileHandler::makeDir($path)) return false;
$filename = $path.$image_obj['name'];
// 파일 이동
// Move the file
if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
unset($obj->{$vars->name});
continue;
}
// 변수를 바꿈
// Change a variable
unset($obj->{$vars->name});
$obj->{$vars->name} = $filename;
}
}
// serialize하여 저장
// Serialize and save
$args->skin_vars = serialize($obj);
$oModuleController = &getController('module');

View file

@ -2,9 +2,9 @@
/**
* @class integration_searchAdminView
* @author NHN (developers@xpressengine.com)
* @brief integration_search moduleadmin view class
* @brief admin view class of the integration_search module
*
* 통합검색 관리
* Search Management
*
**/
@ -13,10 +13,10 @@
var $config = null;
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
// 설정 정보를 받아옴 (module model 객체를 이용)
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$this->config = $oModuleModel->getModuleConfig('integration_search');
Context::set('config',$this->config);
@ -25,22 +25,19 @@
}
/**
* @brief 모듈 선정 스킨 설정
* @brief Module selection and skin set
**/
function dispIntegration_searchAdminContent() {
// 스킨 목록을 구해옴
// Get a list of skins(themes)
$oModuleModel = &getModel('module');
$skin_list = $oModuleModel->getSkins($this->module_path);
Context::set('skin_list',$skin_list);
// 모듈 카테고리 목록을 구함
// Get a list of module categories
$module_categories = $oModuleModel->getModuleCategories();
// 생성된 mid목록을 구함
// Generated mid Wanted list
$obj->site_srl = 0;
$mid_list = $oModuleModel->getMidList($obj);
// module_category와 module의 조합
// module_category and module combination
if($module_categories) {
foreach($mid_list as $module_srl => $module) {
$module_categories[$module->module_category_srl]->list[$module_srl] = $module;
@ -50,22 +47,20 @@
}
Context::set('mid_list',$module_categories);
// 샘플코드
// Sample Code
Context::set('sample_code', htmlspecialchars('<form action="{getUrl()}" method="get"><input type="hidden" name="vid" value="{$vid}" /><input type="hidden" name="mid" value="{$mid}" /><input type="hidden" name="act" value="IS" /><input type="text" name="is_keyword" class="inputTypeText" value="{$is_keyword}" /><span class="button"><input type="submit" value="{$lang->cmd_search}" /></span></form>') );
$this->setTemplateFile("index");
}
/**
* @brief 스킨 설정
* @brief Skin Settings
**/
function dispIntegration_searchAdminSkinInfo() {
$oModuleModel = &getModel('module');
$skin_info = $oModuleModel->loadSkinInfo($this->module_path, $this->config->skin);
$skin_vars = unserialize($this->config->skin_vars);
// skin_info에 extra_vars 값을 지정
// value for skin_info extra_vars
if(count($skin_info->extra_vars)) {
foreach($skin_info->extra_vars as $key => $val) {
$name = $val->name;

View file

@ -2,16 +2,16 @@
/**
* @class integration_search
* @author NHN (developers@xpressengine.com)
* @brief integration_search moduleview class
* @brief view class of the integration_search module
**/
class integration_search extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// action forward에 등록
// Registered in action forward
$oModuleController = &getController('module');
$oModuleController->insertActionForward('integration_search', 'view', 'IS');
@ -19,21 +19,21 @@
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
return false;
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
return new Object(0, 'success_updated');
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
}

View file

@ -2,18 +2,18 @@
/**
* @class integrationModel
* @author NHN (developers@xpressengine.com)
* @brief integration 모듈의 Model class
* @brief Model class of integration module
**/
class integration_searchModel extends module {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 게시글 검색
* @brief Search documents
**/
function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20) {
if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list);
@ -35,15 +35,14 @@
$args->sort_index = 'list_order';
$args->order_type = 'asc';
if(!$args->module_srl) unset($args->module_srl);
// 대상 문서들을 가져옴
// Get a list of documents
$oDocumentModel = &getModel('document');
return $oDocumentModel->getDocumentList($args);
}
/**
* @brief 댓글 검색
* @brief Comment Search
**/
function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) {
if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
@ -57,8 +56,7 @@
$args->search_keyword = $search_keyword;
$args->sort_index = 'list_order';
$args->order_type = 'asc';
// 대상 문서들을 가져옴
// Get a list of documents
$oCommentModel = &getModel('comment');
$output = $oCommentModel->getTotalCommentList($args);
if(!$output->toBool()|| !$output->data) return $output;
@ -66,7 +64,7 @@
}
/**
* @brief 엮인글 검색
* @brief Search trackbacks
**/
function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20) {
if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
@ -80,8 +78,7 @@
$args->search_keyword = $search_keyword;
$args->sort_index = 'list_order';
$args->order_type = 'asc';
// 대상 문서들을 가져옴
// Get a list of documents
$oTrackbackModel = &getAdminModel('trackback');
$output = $oTrackbackModel->getTotalTrackbackList($args);
if(!$output->toBool()|| !$output->data) return $output;
@ -89,7 +86,7 @@
}
/**
* @brief 파일 검색
* @brief File Search
**/
function _getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, $direct_download = 'Y') {
if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list);
@ -105,8 +102,7 @@
$args->order_type = 'desc';
$args->isvalid = 'Y';
$args->direct_download = $direct_download=='Y'?'Y':'N';
// 대상 문서들을 가져옴
// Get a list of documents
$oFileAdminModel = &getAdminModel('file');
$output = $oFileAdminModel->getFileList($args);
if(!$output->toBool() || !$output->data) return $output;
@ -120,8 +116,7 @@
$obj->download_url = Context::getRequestUri().$val->download_url;
$obj->target_srl = $val->upload_target_srl;
$obj->file_size = $val->file_size;
// 이미지
// Images
if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename)) {
$obj->type = 'image';
@ -131,13 +126,11 @@
$thumbnail_url = Context::getRequestUri().$thumbnail_file;
if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop');
$obj->src = sprintf('<img src="%s" alt="%s" width="%d" height="%d" />', $thumbnail_url, htmlspecialchars($obj->filename), 120, 120);
// 동영상
// Videos
} elseif(preg_match('/\.(swf|flv|wmv|avi|mpg|mpeg|asx|asf|mp3)$/i', $val->source_filename)) {
$obj->type = 'multimedia';
$obj->src = sprintf('<script type="text/javascript">displayMultimedia("%s",120,120);</script>', $obj->download_url);
// 기타
// Others
} else {
$obj->type = 'binary';
$obj->src = '';
@ -176,14 +169,14 @@
}
/**
* @brief 멀티미디어 검색
* @brief Multimedia Search
**/
function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) {
return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count);
}
/**
* @brief 첨부파일 검색
* @brief Search for attachments
**/
function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) {
return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, 'N');

View file

@ -2,9 +2,9 @@
/**
* @class integration_searchView
* @author NHN (developers@xpressengine.com)
* @brief integration_search moduleview class
* @brief view class of the integration_search module
*
* 통합검색 출력
* Search Output
*
**/
@ -14,19 +14,18 @@
var $skin = 'default';
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 통합 검색 출력
* @brief Search Result
**/
function IS() {
$oFile = &getClass('file');
$oModuleModel = &getModel('module');
// 권한 체크
// Check permissions
if(!$this->grant->access) return new Object(-1,'msg_not_permitted');
$config = $oModuleModel->getModuleConfig('integration_search');
@ -37,18 +36,14 @@
$target = $config->target;
if(!$target) $target = 'include';
$module_srl_list = explode(',',$config->target_module_srl);
// 검색어 변수 설정
// Set a variable for search keyword
$is_keyword = Context::get('is_keyword');
// 페이지 변수 설정
// Set page variables
$page = (int)Context::get('page');
if(!$page) $page = 1;
// 검색탭에 따른 검색
// Search by search tab
$where = Context::get('where');
// integration search model객체 생성
// Create integration search model object
if($is_keyword) {
$oIS = &getModel('integration_search');
switch($where) {

View file

@ -2,28 +2,27 @@
/**
* @class krzipAdminController
* @author NHN (developers@xpressengine.com)
* @brief krzip 모듈의 admin controller class
* @brief admin controller class of the krzip module
**/
class krzipAdminController extends krzip {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 설정
* @brief Configuration
**/
function procKrzipAdminInsertConfig() {
// 기본 정보를 받음
// Get the basic information
$args = Context::gets('krzip_server_hostname','krzip_server_port','krzip_server_query');
if(!$args->krzip_server_hostname) $args->krzip_server_hostname = $this->hostname;
if(!$args->krzip_server_port) $args->krzip_server_port = $this->port;
if(!$args->krzip_server_query) $args->krzip_server_query = $this->query;
// module Controller 객체 생성하여 입력
// Insert by creating the module Controller object
$oModuleController = &getController('module');
$output = $oModuleController->insertModuleConfig('krzip',$args);
return $output;

View file

@ -2,27 +2,26 @@
/**
* @class krzipAdminView
* @author NHN (developers@xpressengine.com)
* @brief krzip 모듈의 admin view class
* @brief admin view class of the krzip module
**/
class krzipAdminView extends krzip {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 설정
* @brief Configuration
**/
function dispKrzipAdminConfig() {
// 설정 정보를 받아옴 (module model 객체를 이용)
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('krzip');
Context::set('config',$config);
// 템플릿 파일 지정
// Set a template file
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('index');
}

View file

@ -2,7 +2,7 @@
/**
* @class krzip
* @author NHN (developers@xpressengine.com)
* @brief 우편번호 검색 모듈인 krzip의 상위 클래스
* @brief Super class of krzip, which is a zip code search module
**/
class krzip extends ModuleObject {
@ -12,28 +12,28 @@
var $query = '/server.php?addr3=';
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
return false;
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
return new Object();
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
}

View file

@ -2,34 +2,32 @@
/**
* @class krzipModel
* @author NHN (developers@xpressengine.com)
* @brief krzip 모듈의 model 클래스
* @brief model class of the krzip module
**/
class krzipModel extends krzip {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 우편 번호 검색
* 동이름을 입력받아서 지정된 서버에 우편번호 목록을 요청한다
* @brief Zip Code Search
* Request a zip code to the server with user-entered address
**/
function getKrzipCodeList() {
// 설정 정보를 받아옴 (module model 객체를 이용)
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('krzip');
if($config->krzip_server_hostname) $this->hostname = $config->krzip_server_hostname;
if($config->krzip_server_port) $this->port = $config->krzip_server_port;
if($config->krzip_server_query) $this->query = $config->krzip_server_query;
// 동네 이름을 받음
// Get address(town)
$addr = trim(Context::get('addr'));
if(!$addr) return new Object(-1,'msg_not_exists_addr');
// 지정된 서버에 요청을 시도한다
// Attempt to request to the server
$query_string = $this->query.urlencode($addr);
$fp = @fsockopen($this->hostname, $this->port, $errno, $errstr);

View file

@ -2,23 +2,23 @@
/**
* @class layoutAdminController
* @author NHN (developers@xpressengine.com)
* @brief layout 모듈의 admin controller class
* @brief admin controller class of the layout module
**/
class layoutAdminController extends layout {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 레이아웃 신규 생성
* 레이아웃의 신규 생성은 제목만 받아서 layouts테이블에 입력함
* @brief Create a new layout
* Insert a title into "layouts" table in order to create a layout
**/
function procLayoutAdminInsert() {
// 레이아웃 생성과 관련된 기본 정보를 받음
// Get information to create a layout
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->layout_srl = getNextSequence();
@ -26,43 +26,37 @@
$args->title = Context::get('title');
$args->layout_type = Context::get('layout_type');
if(!$args->layout_type) $args->layout_type = "P";
// DB 입력
// Insert into the DB
$output = $this->insertLayout($args);
if(!$output->toBool()) return $output;
// faceOff 레이아웃일 경우 init 필요
// initiate if it is faceoff layout
$this->initLayout($args->layout_srl, $args->layout);
// 결과 리턴
// Return result
$this->add('layout_srl', $args->layout_srl);
}
// 레이아웃 정보를 DB에 입력
// Insert layout information into the DB
function insertLayout($args) {
$output = executeQuery("layout.insertLayout", $args);
return $output;
}
// faceOff 레이아웃을 경우 init
// Initiate if it is faceoff layout
function initLayout($layout_srl, $layout_name){
$oLayoutModel = &getModel('layout');
// faceOff일 경우 sample import
// Import a sample layout if it is faceoff
if($oLayoutModel->useDefaultLayout($layout_name)) {
$this->importLayout($layout_srl, $this->module_path.'tpl/faceOff_sample.tar');
// 디렉토리 제거
// Remove a directory
} else {
FileHandler::removeDir($oLayoutModel->getUserLayoutPath($layout_srl));
}
}
/**
* @brief 레이아웃 정보 변경
* 생성된 레이아웃의 제목과 확장변수(extra_vars) 적용한다
* @brief Update layout information
* Apply a title of the new layout and extra vars
**/
function procLayoutAdminUpdate() {
// module, act, layout_srl, layout, title을 제외하면 확장변수로 판단.. 좀 구리다..
// Consider the rest of items as extra vars, except module, act, layout_srl, layout, and title .. Some gurida ..
$extra_vars = Context::getRequestVars();
unset($extra_vars->module);
unset($extra_vars->act);
@ -73,8 +67,7 @@
unset($extra_vars->apply_mobile_view);
$args = Context::gets('layout_srl','title');
// 레이아웃의 정보를 가져옴
// Get layout information
$oLayoutModel = &getModel('layout');
$oMenuAdminModel = &getAdminModel('menu');
$layout_info = $oLayoutModel->getLayout($args->layout_srl);
@ -124,56 +117,46 @@
}
}
}
// extra_vars의 type이 image일 경우 별도 처리를 해줌
// Separately handle if a type of extra_vars is an image
if($layout_info->extra_var) {
foreach($layout_info->extra_var as $name => $vars) {
if($vars->type!='image') continue;
$image_obj = $extra_vars->{$name};
$extra_vars->{$name} = $layout_info->extra_var->{$name}->value;
// 삭제 요청에 대한 변수를 구함
// Get a variable on a request to delete
$del_var = $extra_vars->{"del_".$name};
unset($extra_vars->{"del_".$name});
// 삭제 요청이 있거나, 새로운 파일이 업로드 되면, 기존 파일 삭제
// Delete the old file if there is a request to delete or a new file is uploaded
if($del_var == 'Y' || $image_obj['tmp_name']) {
FileHandler::removeFile($extra_vars->{$name});
$extra_vars->{$name} = '';
if($del_var == 'Y' && !$image_obj['tmp_name']) continue;
}
// 정상적으로 업로드된 파일이 아니면 무시
// Ignore if the file is not successfully uploaded
if(!$image_obj['tmp_name'] || !is_uploaded_file($image_obj['tmp_name'])) continue;
// 이미지 파일이 아니어도 무시 (swf는 패스~)
// Ignore if the file is not an image (swf the paths ~)
if(!preg_match("/\.(jpg|jpeg|gif|png|swf)$/i", $image_obj['name'])) continue;
// 경로를 정해서 업로드
// Upload the file to a path
$path = sprintf("./files/attach/images/%s/", $args->layout_srl);
// 디렉토리 생성
// Create a directory
if(!FileHandler::makeDir($path)) continue;
$filename = $path.$image_obj['name'];
// 파일 이동
// Move the file
if(!move_uploaded_file($image_obj['tmp_name'], $filename)) continue;
$extra_vars->{$name} = $filename;
}
}
// header script를 레이아웃 모듈의 config에 저장
// Save header script into "config" of layout module
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
$layout_config->header_script = Context::get('header_script');
$oModuleController->insertModulePartConfig('layout',$args->layout_srl,$layout_config);
//menu의 title도 저장하자
// Save a title of the menu
$extra_vars->menu_name_list = $menu_name_list;
// DB에 입력하기 위한 변수 설정
// Variable setting for DB insert
$args->extra_vars = serialize($extra_vars);
$output = $this->updateLayout($args);
@ -196,8 +179,8 @@
}
/**
* @brief 레이아웃 삭제
* 삭제시 메뉴 xml 캐시 파일도 삭제
* @brief Delete Layout
* Delete xml cache file too when deleting a layout
**/
function procLayoutAdminDelete() {
$layout_srl = Context::get('layout_srl');
@ -212,8 +195,7 @@
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_srl);
if(file_exists($layout_file)) FileHandler::removeFile($layout_file);
// 레이아웃 삭제
// Delete Layout
$args->layout_srl = $layout_srl;
$output = executeQuery("layout.deleteLayout", $args);
if(!$output->toBool()) return $output;
@ -222,7 +204,7 @@
}
/**
* @brief 레이아웃 코드 추가
* @brief Adding Layout Code
**/
function procLayoutAdminCodeUpdate() {
$layout_srl = Context::get('layout_srl');
@ -248,7 +230,7 @@
}
/**
* @brief 레이아웃 코드 초기화
* @brief Reset layout code
**/
function procLayoutAdminCodeReset() {
$layout_srl = Context::get('layout_srl');
@ -274,7 +256,7 @@
/**
* @brief 레이아웃 설정페이지 -> 이미지 업로드
* @brief Layout setting page -> Upload an image
*
**/
function procLayoutAdminUserImageUpload(){
@ -294,7 +276,7 @@
}
/**
* @brief 레이아웃 설정페이지 -> 이미지 업로드
* @brief Layout setting page -> Upload an image
*
**/
function insertUserLayoutImage($layout_srl,$source){
@ -315,7 +297,7 @@
/**
* @brief 레이아웃 설정페이지 -> 이미지 삭제
* @brief Layout setting page -> Delete an image
*
**/
function removeUserLayoutImage($layout_srl,$filename){
@ -325,7 +307,7 @@
}
/**
* @brief 레이아웃 설정페이지 -> 이미지 삭제
* @brief Layout setting page -> Delete an image
*
**/
function procLayoutAdminUserImageDelete(){
@ -337,8 +319,8 @@
/**
* @brief 레이아웃 설정 저장
* ini 저장한다 faceoff
* @brief Save layout configuration
* save in "ini" format for faceoff
**/
function procLayoutAdminUserValueInsert(){
$oModuleModel = &getModel('module');
@ -387,7 +369,7 @@
}
/**
* @brief 레이아웃 설정 ini 저장
* @brief Layout setting, save "ini"
*
**/
function insertUserLayoutValue($layout_srl,$arr){
@ -401,7 +383,7 @@
}
/**
* @brief faceoff용 위젯코드를 사용자 layout 파일에 직접 추가한다
* @brief Add the widget code for faceoff into user layout file
*
**/
function addExtension($layout_srl,$arg,$content){
@ -426,7 +408,7 @@
/**
* @brief faceoff용 temp file들을 지운다
* @brief Delete temp files for faceoff
*
**/
function deleteUserLayoutTempFile($layout_srl){
@ -446,12 +428,10 @@
if(!$layout_srl) return new Object('-1','msg_invalid_request');
require_once(_XE_PATH_.'libs/tar.class.php');
// 압축할 파일 목록을 가져온다
// Get a list of files to zip
$oLayoutModel = &getModel('layout');
$file_list = $oLayoutModel->getUserLayoutFileList($layout_srl);
// 압축을 한다.
// Compress the files
$tar = new tar();
$user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl));
chdir($user_layout_path);
@ -468,8 +448,7 @@
header('Content-Disposition: attachment; filename="'. $filename .'"');
header("Content-Transfer-Encoding: binary\n");
echo $stream;
// Context를 강제로 닫고 종료한다.
// Close Context and then exit
Context::close();
exit();
}
@ -508,16 +487,14 @@
FileHandler::makeDir($image_path);
$tar = new tar();
$tar->openTAR($source_file);
// layout.ini 파일이 없으면
// If layout.ini file does not exist
if(!$tar->getFile('layout.ini')) return;
$replace_path = getNumberingPath($layout_srl,3);
foreach($tar->files as $key => $info) {
FileHandler::writeFile($user_layout_path . $info['name'],str_replace('__LAYOUT_PATH__',$replace_path,$info['file']));
}
// 업로드한 파일을 삭제
// Remove uploaded file
FileHandler::removeFile($source_file);
}
}

View file

@ -2,20 +2,20 @@
/**
* @class layoutAdminView
* @author NHN (developers@xpressengine.com)
* @brief layout 모듈의 admin view class
* @brief admin view class of the layout module
**/
class layoutAdminView extends layout {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 레이아웃 관리의 페이지
* @brief The first page of the layout admin
**/
function dispLayoutAdminContent() {
$oLayoutModel = &getModel('layout');
@ -35,11 +35,11 @@
}
/**
* @brief 레이아웃 등록 페이지
* 1차적으로 레이아웃만 선택한 DB 값을 넣고 상세 설정하는 단계를 거침
* @brief Layout setting page
* Once select a layout with empty value in the DB, then adjust values
**/
function dispLayoutAdminInsert() {
// 레이아웃 목록을 세팅
// Set layout list
$oLayoutModel = &getModel('layout');
$layout_type = Context::get('layout_type');
$layout_list = $oLayoutModel->getDownloadedLayoutList($layout_type);
@ -49,25 +49,20 @@
}
/**
* @brief 레이아웃 세부 정보 입력
* @brief Insert Layout details
**/
function dispLayoutAdminModify() {
// 선택된 레이아웃의 정보르 구해서 세팅
// Set the layout after getting layout information
$layout_srl = Context::get('layout_srl');
// 레이아웃의 정보를 가져옴
// Get layout information
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayout($layout_srl);
// 등록된 레이아웃이 없으면 오류 표시
// Error appears if there is no layout information is registered
if(!$layout_info) return $this->dispLayoutAdminContent();
// faceoff면 경로를 보여줄 필요는 없다
// If faceoff, no need to display the path
if($layout_info->type == 'faceoff') unset($layout_info->path);
Context::set('selected_layout', $layout_info);
// 메뉴 목록을 가져옴
// Get a menu list
$oMenuAdminModel = &getAdminModel('menu');
$menu_list = $oMenuAdminModel->getMenus();
Context::set('menu_list', $menu_list);
@ -76,25 +71,22 @@
}
/**
* @brief 레이아웃 코드 편집
* @brief Edit layout codes
**/
function dispLayoutAdminEdit() {
// 선택된 레이아웃의 정보르 구해서 세팅
// Set the layout with its information
$layout_srl = Context::get('layout_srl');
// 레이아웃의 정보를 가져옴
// Get layout information
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayout($layout_srl);
// 등록된 레이아웃이 없으면 오류 표시
// Error appears if there is no layout information is registered
if(!$layout_info) return $this->dispLayoutAdminContent();
Context::set('selected_layout', $layout_info);
// 레이아웃 코드 가져오기
// Get Layout Code
$oLayoutModel = &getModel('layout');
$layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl);
if(!file_exists($layout_file)){
// faceoff
// If faceoff
if($oLayoutModel->useDefaultLayout($layout_info->layout_srl)){
$layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout);
}else{
@ -117,8 +109,7 @@
$layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_info->layout_srl);
Context::set('layout_image_path', $layout_image_path);
// 위젯 목록을 세팅
// Set widget list
$oWidgetModel = &getModel('widget');
$widget_list = $oWidgetModel->getDownloadedWidgetList();
Context::set('widget_list', $widget_list);
@ -127,10 +118,10 @@
}
/**
* @brief 레이아웃 목록을 보여줌
* @brief Display a layout list
**/
function dispLayoutAdminDownloadedList() {
// 레이아웃 목록을 세팅
// Set a layout list
$oLayoutModel = &getModel('layout');
$layout_list = $oLayoutModel->getDownloadedLayoutList();
Context::set('layout_list', $layout_list);
@ -139,7 +130,7 @@
}
function dispLayoutAdminDownloadedMobileList() {
// 레이아웃 목록을 세팅
// Set a layout list
$oLayoutModel = &getModel('layout');
$layout_list = $oLayoutModel->getDownloadedLayoutList(0, "M");
Context::set('layout_list', $layout_list);
@ -148,33 +139,28 @@
}
/**
* @brief 레이아웃 미리 보기
* @brief Preview a layout
**/
function dispLayoutAdminPreview() {
$layout_srl = Context::get('layout_srl');
$code = Context::get('code');
$code_css = Context::get('code_css');
if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request');
// 레이아웃 정보 가져오기
// Get the layout information
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayout($layout_srl);
if(!$layout_info) return new Object(-1, 'msg_invalid_request');
// faceoff 레이아웃일 경우 별도 처리
// Separately handle the layout if its type is faceoff
if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info);
// 직접 입력된 CSS 적용
// Apply CSS directly
Context::addHtmlHeader("<style type=\"text/css\" charset=\"UTF-8\">".$code_css."</style>");
// 레이아웃 정보중 extra_vars의 이름과 값을 $layout_info에 입력
// Set names and values of extra_vars to $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
// menu in layout information becomes an argument for 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);
@ -184,12 +170,10 @@
Context::set('layout_info', $layout_info);
Context::set('content', Context::getLang('layout_preview_content'));
// 코드를 임시로 저장
// Temporary save the codes
$edited_layout_file = sprintf('./files/cache/layout/tmp.tpl');
FileHandler::writeFile($edited_layout_file, $code);
// 컴파일
// Compile
$oTemplate = &TemplateHandler::getInstance();
$layout_path = $layout_info->path;
@ -197,44 +181,39 @@
$layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file);
Context::set('layout','none');
// 위젯등을 변환
// Convert widgets and others
$oContext = &Context::getInstance();
Context::set('layout_tpl', $layout_tpl);
// 임시 파일 삭제
// Delete Temporary Files
FileHandler::removeFile($edited_layout_file);
$this->setTemplateFile('layout_preview');
}
/**
* @brief 레이아웃의 상세 정보(conf/info.xml) 팝업 출력
* @brief Pop-up details of the layout(conf/info.xml)
**/
function dispLayoutAdminInfo() {
// 선택된 레이아웃 정보를 구함
// Get the layout information
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
Context::set('layout_info', $layout_info);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('layout_detail_info');
}
/**
* @brief faceoff의 관리자 layout 수정
* @brief Modify admin layout of faceoff
**/
function dispLayoutAdminLayoutModify(){
//layout_srl 를 가져온다
// Get layout_srl
$current_module_info = Context::get('current_module_info');
$layout_srl = $current_module_info->layout_srl;
// 파일로 임시저장을 하기때문에 남아 있을지 모르는 tmp를 지운다
// to do 개선이 필요
// Remove the remaining tmp files because of temporarily saving
// This part needs to be modified
$delete_tmp = Context::get('delete_tmp');
if($delete_tmp =='Y'){
$oLayoutAdminController = &getAdminController('layout');
@ -242,11 +221,9 @@
}
$oLayoutModel = &getModel('layout');
// layout file들은 temp로 사용한다.
// layout file is used as a temp.
$oLayoutModel->setUseUserLayoutTemp();
// css 를 inline style로 뽑는다
// Apply CSS in inline style
$faceoffcss = $oLayoutModel->_getUserLayoutFaceOffCss($current_module_info->layout_srl);
$css = FileHandler::readFile($faceoffcss);
@ -267,24 +244,20 @@
$oTemplate = &TemplateHandler::getInstance();
Context::set('content', $oTemplate->compile($this->module_path.'tpl','about_faceoff'));
// 위젯 코드를 Javascript 수정모드로 변경
// Change widget codes in Javascript mode
$oWidgetController = &getController('widget');
$oWidgetController->setWidgetCodeInJavascriptMode();
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('faceoff_layout_edit');
}
function dispLayoutAdminLayoutImageList(){
$layout_srl = Context::get('layout_srl');
$oLayoutModel = &getModel('layout');
// 이미지 목록
// Image List
$layout_image_list = $oLayoutModel->getUserLayoutImageList($layout_srl);
Context::set('layout_image_list',$layout_image_list);
// 경로
// Path
$layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_srl);
Context::set('layout_image_path',$layout_image_path);

View file

@ -2,31 +2,29 @@
/**
* @class layout
* @author NHN (developers@xpressengine.com)
* @brief layout 모듈의 high class
* @brief high class of the layout module
**/
class layout extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// 레이아웃에서 사용할 디렉토리 생성
// Create a directory to be used in the layout
FileHandler::makeDir('./files/cache/layout');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oDB = &DB::getInstance();
// 2009. 02. 11 layout 테이블에 site_srl 추가
// 2009. 02. 11 Add site_srl to layout table
if(!$oDB->isColumnExists('layouts', 'site_srl')) return true;
// 2009. 02. 26 faceOff에 맞춰 기존 레이아웃 편집본을 이동
// 2009. 02. 26 Move the previous layout for faceoff
$files = FileHandler::readDir('./files/cache/layout');
for($i=0,$c=count($files);$i<$c;$i++) {
$filename = $files[$i];
@ -39,17 +37,15 @@
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
// 2009. 02. 11 menu 테이블에 site_srl 추가
// 2009. 02. 11 Add site_srl to menu table
if(!$oDB->isColumnExists('layouts', 'site_srl')) {
$oDB->addColumn('layouts','site_srl','number',11,0,true);
}
// 2009. 02. 26 faceOff에 맞춰 기존 레이아웃 편집본을 이동
// 2009. 02. 26 Move the previous layout for faceoff
$oLayoutModel = &getModel('layout');
$files = FileHandler::readDir('./files/cache/layout');
for($i=0,$c=count($files);$i<$c;$i++) {
@ -72,10 +68,10 @@
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
// 레이아웃 캐시 삭제 (수정본은 지우지 않음)
// Remove layout cache(modified layout is not deleted)
$path = './files/cache/layout';
if(!is_dir($path)) {
FileHandler::makeDir($path);

View file

@ -3,21 +3,21 @@
* @class layoutModel
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @brief layout 모듈의 Model class
* @brief Model class of the layout module
**/
class layoutModel extends layout {
var $useUserLayoutTemp = null;
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief DB 생성된 레이아웃의 목록을 구함
* 생성되었다는 것은 DB에 등록이 되었다는 것을 의미
* @brief Get a layout list created in the DB
* If you found a new list, it means that the layout list is inserted to the DB
**/
function getLayoutList($site_srl = 0, $layout_type="P") {
if(!$site_srl) {
@ -33,22 +33,21 @@
}
/**
* @brief DB 생성된 한개의 레이아웃 정보를 구함
* 생성된 레이아웃의 DB정보+XML정보를 return
* @brief Get one of layout information created in the DB
* Return DB info + XML info of the generated layout
**/
function getLayout($layout_srl) {
// 일단 DB에서 정보를 가져옴
// Get information from the DB
$args->layout_srl = $layout_srl;
$output = executeQuery('layout.getLayout', $args);
if(!$output->data) return;
// layout, extra_vars를 정리한 후 xml 파일 정보를 정리해서 return
// Return xml file informaton after listing up the layout and extra_vars
$layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type);
return $layout_info;
}
/**
* @brief 레이아웃의 경로를 구함
* @brief Get a layout path
**/
function getLayoutPath($layout_name, $layout_type = "P") {
if($layout_name == 'faceoff'){
@ -65,11 +64,11 @@
}
/**
* @brief 레이아웃의 종류와 정보를 구함
* 다운로드되어 있는 레이아웃의 종류 (생성과 다른 의미)
* @brief Get a type and information of the layout
* A type of downloaded layout
**/
function getDownloadedLayoutList($layout_type = "P") {
// 다운받은 레이아웃과 설치된 레이아웃의 목록을 구함
// Get a list of downloaded layout and installed layout
if($layout_type == "M")
{
$directory = "./m.layouts";
@ -84,13 +83,11 @@
if(!$searched_count) return;
natcasesort($searched_list);
// 찾아진 레이아웃 목록을 loop돌면서 필요한 정보를 간추려 return
// Return information for looping searched list of layouts
for($i=0;$i<$searched_count;$i++) {
// 레이아웃의 이름
// Name of the layout
$layout = $searched_list[$i];
// 해당 레이아웃의 정보를 구함
// Get information of the layout
$layout_info = $this->getLayoutInfo($layout, null, $layout_type);
$list[] = $layout_info;
@ -99,8 +96,8 @@
}
/**
* @brief 모듈의 conf/info.xml 읽어서 정보를 구함
* 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다..
* @brief Get information by reading conf/info.xml in the module
* It uses caching to reduce time for xml parsing ..
**/
function getLayoutInfo($layout, $info = null, $layout_type = "P") {
if($info) {
@ -115,12 +112,10 @@
$xml_file = sprintf('%sskin.xml', $layout_path);
}
}
// 요청된 모듈의 경로를 구한다. 없으면 return
// Get a path of the requested module. Return if not exists.
if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type);
if(!is_dir($layout_path)) return;
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
// Read the xml file for module skin information
if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path);
if(!file_exists($xml_file)) {
$layout_info->layout = $layout;
@ -130,8 +125,7 @@
$layout_info->layout_type = $layout_type;
return $layout_info;
}
// cache 파일을 비교하여 문제 없으면 include하고 $layout_info 변수를 return
// Include the cache file if it is valid and then return $layout_info variable
if(!$layout_srl){
$cache_file = $this->getLayoutCache($layout, Context::getLangType());
}else{
@ -149,8 +143,7 @@
}
return $layout_info;
}
// cache 파일이 없으면 xml parsing하고 변수화 한 후에 캐시 파일에 쓰고 변수 바로 return
// If no cache file exists, parse the xml and then return the variable.
$oXmlParser = new XmlParser();
$tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file);
if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout;
@ -162,7 +155,7 @@
$buff .= sprintf('$layout_info->site_srl = "%s";', $site_srl);
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
// 레이아웃의 제목, 버전
// Layout title, version and other information
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$buff .= sprintf('$layout_info->layout = "%s";', $layout);
@ -178,8 +171,7 @@
$buff .= sprintf('$layout_info->license = "%s";', $xml_obj->license->body);
$buff .= sprintf('$layout_info->license_link = "%s";', $xml_obj->license->attrs->link);
$buff .= sprintf('$layout_info->layout_type = "%s";', $layout_type);
// 작성자 정보
// Author information
if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author;
else $author_list = $xml_obj->author;
@ -188,10 +180,7 @@
$buff .= sprintf('$layout_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address);
$buff .= sprintf('$layout_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link);
}
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
// Extra vars (user defined variables to use in a template)
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
@ -239,8 +228,7 @@
}
}
}
// 메뉴
// Menu
if($xml_obj->menus->menu) {
$menus = $xml_obj->menus->menu;
if(!is_array($menus)) $menus = array($menus);
@ -297,8 +285,7 @@
} else {
// 레이아웃의 제목, 버전
// Layout title, version and other information
sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d);
$date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d);
$buff .= sprintf('$layout_info->layout = "%s";', $layout);
@ -309,13 +296,11 @@
$buff .= sprintf('$layout_info->date = "%s";', $date);
$buff .= sprintf('$layout_info->layout_srl = $layout_srl;');
$buff .= sprintf('$layout_info->layout_title = $layout_title;');
// 작성자 정보
// Author information
$buff .= sprintf('$layout_info->author[0]->name = "%s";', $xml_obj->author->name->body);
$buff .= sprintf('$layout_info->author[0]->email_address = "%s";', $xml_obj->author->attrs->email_address);
$buff .= sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link);
// 추가 변수 (템플릿에서 사용할 제작자 정의 변수)
// Extra vars (user defined variables to use in a template)
$extra_var_groups = $xml_obj->extra_vars->group;
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
@ -350,8 +335,7 @@
}
}
}
// 메뉴
// Menu
if($xml_obj->menus->menu) {
$menus = $xml_obj->menus->menu;
if(!is_array($menus)) $menus = array($menus);
@ -389,7 +373,7 @@
/**
* @brief layout설정화면에서의 업로드한 이미지목록을 반환한다
* @brief Return a list of images which are uploaded on the layout setting page
**/
function getUserLayoutImageList($layout_srl){
$path = $this->getUserLayoutImagePath($layout_srl);
@ -399,7 +383,7 @@
/**
* @brief ini config들을 가져온다 array다.
* @brief Get ini configurations and make them an array.
**/
function getUserLayoutIniConfig($layout_srl, $layout_name=null){
$file = $this->getUserLayoutIni($layout_srl);
@ -426,7 +410,7 @@
}
/**
* @brief user layout css 관리자가 설정화면에서 저장한 css
* @brief css which is set by an administrator on the layout setting page
**/
function getUserLayoutCss($layout_srl){
return $this->getUserLayoutPath($layout_srl). 'layout.css';
@ -434,7 +418,7 @@
/**
* @brief faceoff용 css module handler에서 import 한다
* @brief Import faceoff css from css module handler
**/
function getUserLayoutFaceOffCss($layout_srl){
$src = $this->_getUserLayoutFaceOffCss($layout_srl);
@ -444,7 +428,7 @@
/**
* @brief faceoff용 css module handler에서 import 한다
* @brief Import faceoff css from css module handler
**/
function _getUserLayoutFaceOffCss($layout_srl){
return $this->getUserLayoutPath($layout_srl). 'faceoff.css';
@ -504,7 +488,7 @@
/**
* @brief user layout cache
* todo 파일 자체를 삭제 필요가 있다
* todo It may need to remove the file itself
**/
function getUserLayoutCache($layout_srl,$lang_type){
return $this->getUserLayoutPath($layout_srl). "{$lang_type}.cache.php";
@ -518,28 +502,28 @@
}
/**
* @brief default layout ini 사용자의 임의 수정을 막기 위해
* @brief default layout ini to prevent arbitrary changes by a user
**/
function getDefaultLayoutIni($layout_name){
return $this->getDefaultLayoutPath($layout_name). 'layout.ini';
}
/**
* @brief default layout html 사용자의 임의 수정을 막기 위해
* @brief default layout html to prevent arbitrary changes by a user
**/
function getDefaultLayoutHtml($layout_name){
return $this->getDefaultLayoutPath($layout_name). 'layout.html';
}
/**
* @brief default layout css 사용자의 임의 수정을 막기 위해
* @brief default layout css to prevent arbitrary changes by a user
**/
function getDefaultLayoutCss($layout_name){
return $this->getDefaultLayoutPath($layout_name). 'css/layout.css';
}
/**
* @brief default layout path 사용자의 임의 수정을 막기 위해
* @brief default layout path to prevent arbitrary changes by a user
**/
function getDefaultLayoutPath() {
return "./modules/layout/faceoff/";
@ -547,7 +531,7 @@
/**
* @brief faceoff 인지
* @brief faceoff is
**/
function useDefaultLayout($layout_name){
$info = $this->getLayoutInfo($layout_name);
@ -557,7 +541,7 @@
/**
* @brief User Layout 임시 저장 모드로
* @brief Set user layout as temporary save mode
**/
function setUseUserLayoutTemp($flag='temp'){
$this->useUserLayoutTemp = $flag;
@ -565,7 +549,7 @@
/**
* @brief User Layout 임시 저장 파일 목록.
* @brief Temp file list for User Layout
**/
function getUserLayoutTempFileList($layout_srl){
$file_list = array(
@ -578,7 +562,7 @@
/**
* @brief User Layout 저장 파일 목록.
* @brief Saved file list for User Layout
**/
function getUserLayoutFileList($layout_srl){
$file_list = array(
@ -596,32 +580,26 @@
}
/**
* @brief faceOff관련 서비스 출력을 위한 동작 실행
* @brief faceOff related services for the operation run out
**/
function doActivateFaceOff(&$layout_info) {
$layout_info->faceoff_ini_config = $this->getUserLayoutIniConfig($layout_info->layout_srl, $layout_info->layout);
// 기본 faceoff layout CSS
// faceoff layout CSS
Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout));
// 레이아웃 매니져에서 생성된 CSS
// CSS generated in the layout manager
$faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl);
if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css);
// 레이아웃의 위젯을 위한 css출력
// CSS output for the widget
Context::addCSSFile($this->module_path.'/tpl/css/widget.css');
if($layout_info->extra_var->colorset->value == 'black') Context::addCSSFile($this->module_path.'/tpl/css/widget@black.css');
else Context::addCSSFile($this->module_path.'/tpl/css/widget@white.css');
// 권한에 따른 다른 내용 출력
// Different page displayed upon user's permission
$logged_info = Context::get('logged_info');
// faceOff 레이아웃 편집 버튼 노출
// Display edit button for faceoff layout
if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin')===false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) {
Context::addHtmlFooter("<div class=\"faceOffManager\"><a href=\"".getUrl('','mid',Context::get('mid'),'act','dispLayoutAdminLayoutModify','delete_tmp','Y')."\" class=\"buttonSet buttonLayoutEditor\"><span>".Context::getLang('cmd_layout_edit')."</span></a></div>");
}
// faceOff페이지 수정시에 메뉴 출력
// Display menu when editing the faceOff page
if(Context::get('act')=='dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) {
$oTemplate = &TemplateHandler::getInstance();
Context::addBodyHeader($oTemplate->compile($this->module_path.'/tpl', 'faceoff_layout_menu'));

View file

@ -2,32 +2,30 @@
/**
* @class layoutView
* @author NHN (developers@xpressengine.com)
* @brief layout 모듈의 admin view class
* @brief admin view class of the layout module
**/
class layoutView extends layout {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 레이아웃의 상세 정보(conf/info.xml) 팝업 출력
* @brief Pop-up layout details(conf/info.xml)
**/
function dispLayoutInfo() {
// 선택된 레이아웃 정보를 구함
// Get the layout information
$oLayoutModel = &getModel('layout');
$layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout'));
if(!$layout_info) exit();
Context::set('layout_info', $layout_info);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('layout_detail_info');
}
}

View file

@ -2,50 +2,44 @@
/**
* @class memberAdminController
* @author NHN (developers@xpressengine.com)
* @brief member module의 admin controller class
* @brief member module of the admin controller class
**/
class memberAdminController extends member {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 사용자 추가 (관리자용)
* @brief Add a user (Administrator)
**/
function procMemberAdminInsert() {
if(Context::getRequestMethod() == "GET") return new Object(-1, "msg_invalid_request");
// 필수 정보들을 미리 추출
// Extract the necessary information in advance
$args = Context::gets('member_srl','user_id','user_name','nick_name','homepage','blog','birthday','email_address','password','allow_mailing','allow_message','denied','is_admin','description','group_srl_list','limit_date');
// 넘어온 모든 변수중에서 몇가지 불필요한 것들 삭제
// Remove some unnecessary variables from all the vars
$all_args = Context::getRequestVars();
unset($all_args->module);
unset($all_args->act);
if(!isset($args->limit_date)) $args->limit_date = "";
// 모든 request argument에서 필수 정보만 제외 한 후 추가 데이터로 입력
// Add extra vars after excluding necessary information from all the requested arguments
$extra_vars = delObjectVars($all_args, $args);
$args->extra_vars = serialize($extra_vars);
// member_srl이 넘어오면 원 회원이 있는지 확인
// Check if an original member exists having the member_srl
if($args->member_srl) {
// 멤버 모델 객체 생성
// Create a member model object
$oMemberModel = &getModel('member');
// 회원 정보 구하기
// Get memebr profile
$member_info = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl);
// 만약 원래 회원이 없으면 새로 입력하기 위한 처리
// If no original member exists, make a new one
if($member_info->member_srl != $args->member_srl) unset($args->member_srl);
}
$oMemberController = &getController('member');
// member_srl의 값에 따라 insert/update
// Execute insert or update depending on the value of member_srl
if(!$args->member_srl) {
$output = $oMemberController->insertMember($args);
$msg_code = 'success_registed';
@ -55,21 +49,19 @@
}
if(!$output->toBool()) return $output;
// 서명 저장
// Save Signature
$signature = Context::get('signature');
$oMemberController->putSignature($args->member_srl, $signature);
// 결과 리턴
// Return result
$this->add('member_srl', $args->member_srl);
$this->setMessage($msg_code);
}
/**
* @brief 사용자 삭제 (관리자용)
* @brief Delete a user (Administrator)
**/
function procMemberAdminDelete() {
// 일단 입력된 값들을 모두 받아서 db 입력항목과 그외 것으로 분리
// Separate all the values into DB entries and others
$member_srl = Context::get('member_srl');
$oMemberController = &getController('member');
@ -81,10 +73,10 @@
}
/**
* @brief 회원 관리용 기본 정보의 추가
* @brief Add information for member administration
**/
function procMemberAdminInsertConfig() {
// 기본 정보를 받음
// Get the basic information
$args = Context::gets(
'webmaster_name', 'webmaster_email',
'skin', 'colorset',
@ -119,7 +111,7 @@
}
/**
* @brief 사용자 그룹 추가
* @brief Add a user group
**/
function procMemberAdminInsertGroup() {
$args = Context::gets('title','description','is_default','image_mark');
@ -132,7 +124,7 @@
}
/**
* @brief 사용자 그룹 정보 수정
* @brief Update user group information
**/
function procMemberAdminUpdateGroup() {
$group_srl = Context::get('group_srl');
@ -159,7 +151,7 @@
}
/**
* @brief 가입 항목 추가
* @brief Add a join form
**/
function procMemberAdminInsertJoinForm() {
$args->member_join_form_srl = Context::get('member_join_form_srl');
@ -173,15 +165,13 @@
$args->required = Context::get('required');
if(!in_array(strtoupper($args->required), array('Y','N'))) $args->required = 'N';
$args->description = Context::get('description');
// 기본값의 정리
// Default values
if(in_array($args->column_type, array('checkbox','select','radio')) && count($args->default_value) ) {
$args->default_value = serialize($args->default_value);
} else {
$args->default_value = '';
}
// member_join_form_srl이 있으면 수정, 없으면 추가
// Fix if member_join_form_srl exists. Add if not exists.
if(!$args->member_join_form_srl){
$args->list_order = getNextSequence();
$output = executeQuery('member.insertJoinForm', $args);
@ -196,7 +186,7 @@
}
/**
* @brief 가입 항목의 / 이동 내용 수정
* @brief Move up/down the member join form and modify it
**/
function procMemberAdminUpdateJoinForm() {
$member_join_form_srl = Context::get('member_join_form_srl');
@ -224,7 +214,7 @@
}
/**
* @brief 선택된 회원들을 일괄 삭제
* @brief Delete the selected members
*/
function procMemberAdminDeleteMembers() {
$target_member_srls = Context::get('target_member_srls');
@ -244,7 +234,7 @@
}
/**
* @brief 선택된 회원들의 그룹을 일괄 변경
* @brief Update a group of selected memebrs
**/
function procMemberAdminUpdateMembersGroup() {
$member_srl = Context::get('member_srl');
@ -257,16 +247,14 @@
$oDB = &DB::getInstance();
$oDB->begin();
// 선택된 회원들의 그룹을 삭제
// Delete a group of selected members
$args->member_srl = $member_srl;
$output = executeQuery('member.deleteMembersGroup', $args);
if(!$output->toBool()) {
$oDB->rollback();
return $output;
}
// 선택된 그룹으로 추가
// Add to a selected group
$group_count = count($group_srls);
$member_count = count($member_srls);
for($j=0;$j<$group_count;$j++) {
@ -293,7 +281,7 @@
}
/**
* @brief 금지 아이디 추가
* @brief Add a denied ID
**/
function procMemberAdminInsertDeniedID() {
$user_id = Context::get('user_id');
@ -308,7 +296,7 @@
}
/**
* @brief 금지 아이디 업데이트
* @brief Update denied ID
**/
function procMemberAdminUpdateDeniedID() {
$user_id = Context::get('user_id');
@ -327,13 +315,12 @@
}
/**
* @brief 관리자를 추가한다
* @brief Add an administrator
**/
function insertAdmin($args) {
// 관리자임을 설정
// Assign an administrator
$args->is_admin = 'Y';
// 관리자 그룹을 구해와서 설정
// Get admin group and set
$oMemberModel = &getModel('member');
$admin_group = $oMemberModel->getAdminGroup();
$args->group_srl_list = $admin_group->group_srl;
@ -343,7 +330,7 @@
}
/**
* @brief 회원의 그룹값을 변경
* @brief Change the group values of member
**/
function changeGroup($source_group_srl, $target_group_srl) {
$args->source_group_srl = $source_group_srl;
@ -353,11 +340,11 @@
}
/**
* @brief 그룹 등록
* @brief Insert a group
**/
function insertGroup($args) {
if(!$args->site_srl) $args->site_srl = 0;
// is_default값을 체크, Y일 경우 일단 모든 is_default에 대해서 N 처리
// Check the value of is_default.
if($args->is_default!='Y') {
$args->is_default = 'N';
} else {
@ -369,10 +356,10 @@
}
/**
* @brief 그룹 정보 수정
* @brief Modify Group Information
**/
function updateGroup($args) {
// is_default값을 체크, Y일 경우 일단 모든 is_default에 대해서 N 처리
// Check the value of is_default.
if($args->is_default!='Y') $args->is_default = 'N';
else {
$output = executeQuery('member.updateGroupDefaultClear', $args);
@ -383,23 +370,20 @@
}
/**
* 그룹 삭제
* Delete a Group
**/
function deleteGroup($group_srl, $site_srl = null) {
// 멤버모델 객체 생성
// Create a member model object
$oMemberModel = &getModel('member');
// 삭제 대상 그룹을 가져와서 체크 (is_default == 'Y'일 경우 삭제 불가)
// Check the group_srl (If is_default == 'Y', it cannot be deleted)
$group_info = $oMemberModel->getGroup($group_srl);
if(!$group_info) return new Object(-1, 'lang->msg_not_founded');
if($group_info->is_default == 'Y') return new Object(-1, 'msg_not_delete_default');
// is_default == 'Y'인 그룹을 가져옴
// Get groups where is_default == 'Y'
$default_group = $oMemberModel->getDefaultGroup($site_srl);
$default_group_srl = $default_group->group_srl;
// default_group_srl로 변경
// Change to default_group_srl
$this->changeGroup($group_srl, $default_group_srl);
$args->group_srl = $group_srl;
@ -418,7 +402,7 @@
}
/**
* @brief 금지아이디 등록
* @brief Register denied ID
**/
function insertDeniedID($user_id, $description = '') {
$args->user_id = $user_id;
@ -429,7 +413,7 @@
}
/**
* @brief 금지아이디 삭제
* @brief Delete a denied ID
**/
function deleteDeniedID($user_id) {
$args->user_id = $user_id;
@ -437,7 +421,7 @@
}
/**
* @brief 가입폼 항목을 삭제
* @brief Delete a join form
**/
function deleteJoinForm($member_join_form_srl) {
$args->member_join_form_srl = $member_join_form_srl;
@ -446,19 +430,17 @@
}
/**
* @brief 가입항목을 상단으로 이동
* @brief Move up a join form
**/
function moveJoinFormUp($member_join_form_srl) {
$oMemberModel = &getModel('member');
// 선택된 가입항목의 정보를 구한다
// Get information of the join form
$args->member_join_form_srl = $member_join_form_srl;
$output = executeQuery('member.getJoinForm', $args);
$join_form = $output->data;
$list_order = $join_form->list_order;
// 전체 가입항목 목록을 구한다
// Get a list of all join forms
$join_form_list = $oMemberModel->getJoinFormList();
$join_form_srl_list = array_keys($join_form_list);
if(count($join_form_srl_list)<2) return new Object();
@ -468,19 +450,15 @@
if($val->member_join_form_srl == $member_join_form_srl) break;
$prev_member_join_form = $val;
}
// 이전 가입항목가 없으면 그냥 return
// Return if no previous join form exists
if(!$prev_member_join_form) return new Object();
// 선택한 가입항목의 정보
// Information of the join form
$cur_args->member_join_form_srl = $member_join_form_srl;
$cur_args->list_order = $prev_member_join_form->list_order;
// 대상 가입항목의 정보
// Information of the target join form
$prev_args->member_join_form_srl = $prev_member_join_form->member_join_form_srl;
$prev_args->list_order = $list_order;
// DB 처리
// Execute Query
$output = executeQuery('member.updateMemberJoinFormListorder', $cur_args);
if(!$output->toBool()) return $output;
@ -491,19 +469,17 @@
}
/**
* @brief 가입항목을 하단으로 이동
* @brief Move down a join form
**/
function moveJoinFormDown($member_join_form_srl) {
$oMemberModel = &getModel('member');
// 선택된 가입항목의 정보를 구한다
// Get information of the join form
$args->member_join_form_srl = $member_join_form_srl;
$output = executeQuery('member.getJoinForm', $args);
$join_form = $output->data;
$list_order = $join_form->list_order;
// 전체 가입항목 목록을 구한다
// Get information of all join forms
$join_form_list = $oMemberModel->getJoinFormList();
$join_form_srl_list = array_keys($join_form_list);
if(count($join_form_srl_list)<2) return new Object();
@ -513,20 +489,16 @@
}
$next_member_join_form_srl = $join_form_srl_list[$i+1];
// 이전 가입항목가 없으면 그냥 return
// Return if no previous join form exists
if(!$next_member_join_form_srl) return new Object();
$next_member_join_form = $join_form_list[$next_member_join_form_srl];
// 선택한 가입항목의 정보
// Information of the join form
$cur_args->member_join_form_srl = $member_join_form_srl;
$cur_args->list_order = $next_member_join_form->list_order;
// 대상 가입항목의 정보
// Information of the target join form
$next_args->member_join_form_srl = $next_member_join_form->member_join_form_srl;
$next_args->list_order = $list_order;
// DB 처리
// Execute Query
$output = executeQuery('member.updateMemberJoinFormListorder', $cur_args);
if(!$output->toBool()) return $output;

View file

@ -2,29 +2,29 @@
/**
* @class memberAdminModel
* @author NHN (developers@xpressengine.com)
* @brief member module의 admin model class
* @brief admin model class of member module
**/
class memberAdminModel extends member {
/**
* @brief 자주 호출될거라 예상되는 데이터는 내부적으로 가지고 있자...
* @brief Keep data internally which may be frequently called.
**/
var $member_info = NULL;
var $member_groups = NULL;
var $join_form_list = NULL;
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 회원 목록을 구함
* @brief Get a member list
**/
function getMemberList() {
// 검색 옵션 정리
// Search options
$args->is_admin = Context::get('is_admin')=='Y'?'Y':'';
$args->is_denied = Context::get('is_denied')=='Y'?'Y':'';
$args->selected_group_srl = Context::get('selected_group_srl');
@ -74,7 +74,7 @@
}
}
// selected_group_srl이 있으면 query id를 변경 (table join때문에)
// Change the query id if selected_group_srl exists (for table join)
$sort_order = Context::get('sort_order');
$sort_index = Context::get('sort_index');
if($sort_index != 'last_login') {
@ -92,8 +92,7 @@
if($sort_order != "desc") $sort_order = "asc";
$args->sort_order = $sort_order;
Context::set('sort_order', $sort_order);
// 기타 변수들 정리
// Other variables
$args->page = Context::get('page');
$args->list_count = 40;
$args->page_count = 10;
@ -102,7 +101,7 @@
}
/**
* @brief 사이트별 회원 목록을 구함
* @brief Get a memebr list for each site
**/
function getSiteMemberList($site_srl, $page = 1) {
$args->site_srl = $site_srl;
@ -115,7 +114,7 @@
}
/**
* @brief 회원 모듈의 특정 스킨에 속한 컬러셋 목록을 return
* @brief Return colorset list of a skin in the member module
**/
function getMemberAdminColorset() {
$skin = Context::get('skin');

View file

@ -160,13 +160,12 @@
}
/**
* @brief 회원 가입 목록 출력
* @brief Display a list of member join form
**/
function dispMemberAdminJoinFormList() {
// 멤버모델 객체 생성
// Create a member model object
$oMemberModel = &getModel('member');
// 추가로 설정한 가입 항목 가져오기
// Get join form list which is additionally set
$form_list = $oMemberModel->getJoinFormList();
Context::set('form_list', $form_list);
@ -174,10 +173,10 @@
}
/**
* @brief 회원 가입 관리 화면 출력
* @brief Display an admin page for memebr join forms
**/
function dispMemberAdminInsertJoinForm() {
// 수정일 경우 대상 join_form의 값을 구함
// Get the value of join_form
$member_join_form_srl = Context::get('member_join_form_srl');
if($member_join_form_srl) {
$oMemberModel = &getModel('member');
@ -190,13 +189,12 @@
}
/**
* @brief 금지 목록 아이디 출력
* @brief Display denied ID list
**/
function dispMemberAdminDeniedIDList() {
// 멤버모델 객체 생성
// Create a member model object
$oMemberModel = &getModel('member');
// 사용금지 목록 가져오기
// Get a denied ID list
$output = $oMemberModel->getDeniedIDList();
Context::set('total_count', $output->total_count);
@ -209,15 +207,14 @@
}
/**
* @brief 회원 그룹 일괄 변경
* @brief Update all the member groups
**/
function dispMemberAdminManageGroup() {
// 선택된 회원 목록을 구함
// Get a list of the selected member
$args->member_srl = trim(Context::get('member_srls'));
$output = executeQueryArray('member.getMembers', $args);
Context::set('member_list', $output->data);
// 회원 그룹 목록을 구함
// Get a list of the selected member
$oMemberModel = &getModel('member');
Context::set('member_groups', $oMemberModel->getGroups());
@ -226,10 +223,10 @@
}
/**
* @brief 회원 일괄 삭제
* @brief Delete all members
**/
function dispMemberAdminDeleteMembers() {
// 선택된 회원 목록을 구함
// Get a list of the selected member
$args->member_srl = trim(Context::get('member_srls'));
$output = executeQueryArray('member.getMembers', $args);
Context::set('member_list', $output->data);

View file

@ -2,14 +2,14 @@
/**
* @class memberAPI
* @author NHN (developers@xpressengine.com)
* @brief member 모듈의 View Action에 대한 API 처리
* @brief API Processing of View Action in the member module
**/
class memberAPI extends member {
/**
* @brief 컨텐츠 목록
* @brief Content List
**/
function dispSavedDocumentList(&$oModule) {
$document_list = $this->arrangeContentList(Context::get('document_list'));

View file

@ -2,7 +2,7 @@
/**
* @class member
* @author NHN (developers@xpressengine.com)
* @brief member modulehigh class
* @brief high class of the member module
**/
class member extends ModuleObject {
@ -14,8 +14,7 @@
$oModuleModel = &getModel('module');
$member_config = $oModuleModel->getModuleConfig('member');
// SSL 사용시 회원가입/정보/비밀번호등과 관련된 action에 대해 SSL 전송하도록 지정
// Set to use SSL upon actions related member join/information/password and so on
if(Context::get('_use_ssl') == 'optional') {
Context::addSSLAction('dispMemberModifyPassword');
Context::addSSLAction('dispMemberSignUpForm');
@ -29,10 +28,10 @@
}
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
// Register action forward (to use in administrator mode)
$oModuleController = &getController('module');
$oDB = &DB::getInstance();
@ -40,8 +39,7 @@
$oModuleModel = &getModel('module');
$args = $oModuleModel->getModuleConfig('member');
// 기본 정보를 세팅
// Set the basic information
$args->enable_join = 'Y';
if(!$args->enable_openid) $args->enable_openid = 'N';
if(!$args->enable_auth_mail) $args->enable_auth_mail = 'N';
@ -57,15 +55,14 @@
if($args->group_image_mark!='Y') $args->group_image_mark = 'N';
$oModuleController->insertModuleConfig('member',$args);
// 멤버 컨트롤러 객체 생성
// Create a member controller object
$oMemberModel = &getModel('member');
$oMemberController = &getController('member');
$oMemberAdminController = &getAdminController('member');
$groups = $oMemberModel->getGroups();
if(!count($groups)) {
// 관리자, 정회원, 준회원 그룹을 입력
// Set an administrator, regular member(group1), and associate member(group2)
$group_args->title = Context::getLang('admin_group');
$group_args->is_default = 'N';
$group_args->is_admin = 'Y';
@ -83,22 +80,19 @@
$group_args->is_admin = 'N';
$oMemberAdminController->insertGroup($group_args);
}
// 관리자 정보 세팅
// Configure administrator information
$admin_args->is_admin = 'Y';
$output = executeQuery('member.getMemberList', $admin_args);
if(!$output->data) {
$admin_info = Context::gets('user_id','password','nick_name','user_name', 'email_address');
if($admin_info->user_id) {
// 관리자 정보 입력
// Insert admin information
$oMemberAdminController->insertAdmin($admin_info);
// 로그인 처리시킴
// Log-in Processing
$output = $oMemberController->doLogin($admin_info->user_id);
}
}
// 금지 아이디 등록 (기본 + 모듈명)
// Register denied ID(default + module name)
$oModuleModel = &getModel('module');
$module_list = $oModuleModel->getModuleList();
foreach($module_list as $key => $val) {
@ -110,8 +104,7 @@
$oMemberAdminController->insertDeniedID('telnet','');
$oMemberAdminController->insertDeniedID('ftp','');
$oMemberAdminController->insertDeniedID('http','');
// member 에서 사용할 cache디렉토리 생성
// Create cache directory to use in the member module
FileHandler::makeDir('./files/member_extra_info/image_name');
FileHandler::makeDir('./files/member_extra_info/image_mark');
FileHandler::makeDir('./files/member_extra_info/profile_image');
@ -122,34 +115,28 @@
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oDB = &DB::getInstance();
$oModuleModel = &getModel('module');
// member 디렉토리 체크 (2007. 8. 11 추가)
// check member directory (11/08/2007 added)
if(!is_dir("./files/member_extra_info")) return true;
// member 디렉토리 체크 (2007. 10. 22 추가)
// check member directory (22/10/2007 added)
if(!is_dir("./files/member_extra_info/profile_image")) return true;
// member_auth_mail 테이블에 is_register 필드 추가 (2008. 04. 22)
// Add a column(is_register) to "member_auth_mail" table (22/04/2008)
$act = $oDB->isColumnExists("member_auth_mail", "is_register");
if(!$act) return true;
// member_group_member 테이블에 site_srl 추가 (2008. 11. 15)
// Add a column(site_srl) to "member_group_member" table (11/15/2008)
if(!$oDB->isColumnExists("member_group_member", "site_srl")) return true;
if(!$oDB->isColumnExists("member_group", "site_srl")) return true;
if($oDB->isIndexExists("member_group","uni_member_group_title")) return true;
// image_mark 추가 (2009. 02. 14)
// Add a column for image_mark (02/14/2009)
if(!$oDB->isColumnExists("member_group", "image_mark")) return true;
// password 유효기간을 위한 추가
// Add c column for password expiration date
if(!$oDB->isColumnExists("member", "change_password_date")) return true;
// 비밀번호 찾기 질문/답변을 위한 추가
// Add columns of question and answer to verify a password
if(!$oDB->isColumnExists("member", "find_account_question")) return true;
if(!$oDB->isColumnExists("member", "find_account_answer")) return true;
@ -160,24 +147,21 @@
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
$oModuleController = &getController('module');
// member 디렉토리 체크
// Check member directory
FileHandler::makeDir('./files/member_extra_info/image_name');
FileHandler::makeDir('./files/member_extra_info/image_mark');
FileHandler::makeDir('./files/member_extra_info/signature');
FileHandler::makeDir('./files/member_extra_info/profile_image');
// DB 필드 추가
// Add a column
if (!$oDB->isColumnExists("member_auth_mail", "is_register")) {
$oDB->addColumn("member_auth_mail", "is_register", "char", 1, "N", true);
}
// member_group_member 테이블에 site_srl 추가 (2008. 11. 15)
// Add a column(site_srl) to "member_group_member" table (11/15/2008)
if (!$oDB->isColumnExists("member_group_member", "site_srl")) {
$oDB->addColumn("member_group_member", "site_srl", "number", 11, 0, true);
$oDB->addIndex("member_group_member", "idx_site_srl", "site_srl", false);
@ -189,19 +173,17 @@
if($oDB->isIndexExists("member_group","uni_member_group_title")) {
$oDB->dropIndex("member_group","uni_member_group_title",true);
}
// image_mark 추가 (2009. 02. 14)
// Add a column for image_mark (02/14/2009)
if(!$oDB->isColumnExists("member_group", "image_mark")) {
$oDB->addColumn("member_group", "image_mark", "text");
}
// password 유효기간을 위한 추가
// Add a column for password expiration date
if(!$oDB->isColumnExists("member", "change_password_date")) {
$oDB->addColumn("member", "change_password_date", "date");
executeQuery('member.updateAllChangePasswordDate');
}
// 비밀번호 찾기 질문/답변을 위한 추가
// Add columns of question and answer to verify a password
if(!$oDB->isColumnExists("member", "find_account_question")) {
$oDB->addColumn("member", "find_account_question", "number", 11);
}
@ -225,7 +207,7 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
set_include_path(_XE_PATH_."modules/member/php-openid-1.2.3");

File diff suppressed because it is too large Load diff

View file

@ -3,7 +3,7 @@
class memberMobile extends member
{
function init() {
// 회원 관리 정보를 받음
// Get the member configuration
$oModuleModel = &getModel('module');
$this->member_config = $oModuleModel->getModuleConfig('member');
@ -20,7 +20,7 @@ class memberMobile extends member
return;
}
// 템플릿 파일 지정
// Set a template file
Context::set('referer_url', $_SERVER['HTTP_REFERER']);
$this->setTemplateFile('login_form');
@ -47,7 +47,7 @@ class memberMobile extends member
$oMemberModel = &getModel('member');
$logged_info = Context::get('logged_info');
// 비회원일 경우 정보 열람 중지
// Don't display member info to non-logged user
if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
$member_srl = Context::get('member_srl');
if(!$member_srl && Context::get('is_logged')) {
@ -73,14 +73,14 @@ class memberMobile extends member
}
/**
* @brief 회원 정보 수정
* @brief Edit member profile
**/
function dispMemberModifyInfo() {
$oMemberModel = &getModel('member');
$oModuleModel = &getModel('module');
$memberModuleConfig = $oModuleModel->getModuleConfig('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
@ -90,12 +90,12 @@ class memberMobile extends member
$member_info->signature = $oMemberModel->getSignature($member_srl);
Context::set('member_info',$member_info);
// 추가 가입폼 목록을 받음
// Receive a member join form
Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info));
Context::set('openids', $oMemberModel->getMemberOpenIDByMemberSrl($member_srl));
// 에디터 모듈의 getEditor를 호출하여 서명용으로 세팅
// Call getEditor of the editor module and set it for signiture
if($member_info->member_srl) {
$oEditorModel = &getModel('editor');
$option->primary_key_name = 'member_srl';
@ -113,17 +113,17 @@ class memberMobile extends member
Context::set('editor', $editor);
}
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('modify_info');
}
/**
* @brief 회원 비밀번호 수정
* @brief Change the user password
**/
function dispMemberModifyPassword() {
$oMemberModel = &getModel('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
@ -132,17 +132,17 @@ class memberMobile extends member
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
Context::set('member_info',$member_info);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('modify_password');
}
/**
* @brief 탈퇴 화면
* @brief Member withdrawl
**/
function dispMemberLeave() {
$oMemberModel = &getModel('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
@ -151,7 +151,7 @@ class memberMobile extends member
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
Context::set('member_info',$member_info);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('leave_form');
}
}

View file

@ -2,31 +2,30 @@
/**
* @class memberModel
* @author NHN (developers@xpressengine.com)
* @brief member moduleModel class
* @brief Model class of the member module
**/
class memberModel extends member {
/**
* @brief 자주 호출될거라 예상되는 데이터는 내부적으로 가지고 있자...
* @brief Keep data internally which may be frequently called ...
**/
var $join_form_list = NULL;
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 회원 설정 정보를 return
* @brief Return member's configuration
**/
function getMemberConfig() {
// DB에 저장되는 회원 설정 정보 구함
// Get member configuration stored in the DB
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('member');
// 회원가입 약관 구함
// Get terms of user
$agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt';
if(file_exists($agreement_file)) $config->agreement = FileHandler::readFile($agreement_file);
@ -45,62 +44,52 @@
}
/**
* @brief 선택된 회원의 간단한 메뉴를 표시
* @brief Display menus of the member
**/
function getMemberMenu() {
// 요청된 회원 번호와 현재 사용자의 로그인 정보 구함
// Get member_srl of he target member and logged info of the current user
$member_srl = Context::get('target_srl');
$mid = Context::get('cur_mid');
$logged_info = Context::get('logged_info');
$act = Context::get('cur_act');
// 자신의 아이디를 클릭한 경우
// When click user's own nickname
if($member_srl == $logged_info->member_srl) $member_info = $logged_info;
// 다른 사람의 아이디를 클릭한 경우
// When click other's nickname
else $member_info = $this->getMemberInfoByMemberSrl($member_srl);
$member_srl = $member_info->member_srl;
if(!$member_srl) return;
// 변수 정리
// List variables
$user_id = $member_info->user_id;
$user_name = $member_info->user_name;
ModuleHandler::triggerCall('member.getMemberMenu', 'before', $null);
$oMemberController = &getController('member');
// 회원 정보 보기 (비회원일 경우 볼 수 없도록 수정)
// Display member information (Don't display to non-logged user)
if($logged_info->member_srl) {
$url = getUrl('','mid',$mid,'act','dispMemberInfo','member_srl',$member_srl);
$icon_path = './modules/member/tpl/images/icon_view_info.gif';
$oMemberController->addMemberPopupMenu($url,'cmd_view_member_info',$icon_path,'self');
}
// 다른 사람의 아이디를 클릭한 경우
// When click other's nickname
if($member_srl != $logged_info->member_srl) {
// 메일 보내기
// Send an email
if($member_info->email_address) {
$url = 'mailto:'.htmlspecialchars($member_info->email_address);
$icon_path = './modules/member/tpl/images/icon_sendmail.gif';
$oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path);
}
}
// 홈페이지 보기
// View homepage info
if($member_info->homepage)
$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage), 'homepage', './modules/member/tpl/images/icon_homepage.gif','blank');
// 블로그 보기
// View blog info
if($member_info->blog)
$oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog), 'blog', './modules/member/tpl/images/icon_blog.gif','blank');
// trigger 호출 (after)
// Call a trigger (after)
ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null);
// 최고 관리자라면 회원정보 수정 메뉴 만듬
// Display a menu for editting member info to a top administrator
if($logged_info->is_admin == 'Y') {
$url = getUrl('','module','admin','act','dispMemberAdminInsert','member_srl',$member_srl);
$icon_path = './modules/member/tpl/images/icon_management.gif';
@ -114,20 +103,18 @@
$icon_path = './modules/member/tpl/images/icon_trace_comment.gif';
$oMemberController->addMemberPopupMenu($url,'cmd_trace_comment',$icon_path,'TraceMemberComment');
}
// 팝업메뉴의 언어 변경
// Change a language of pop-up menu
$menus = Context::get('member_popup_menu_list');
$menus_count = count($menus);
for($i=0;$i<$menus_count;$i++) {
$menus[$i]->str = Context::getLang($menus[$i]->str);
}
// 최종적으로 정리된 팝업메뉴 목록을 구함
// Get a list of finalized pop-up menu
$this->add('menus', $menus);
}
/**
* @brief 로그인 되어 있는지에 대한 체크
* @brief Check if logged-in
**/
function isLogged() {
if($_SESSION['is_logged']&&$_SESSION['ipaddress']==$_SERVER['REMOTE_ADDR']) return true;
@ -138,24 +125,22 @@
}
/**
* @brief 인증된 사용자의 정보 return
* @brief Return session information of the logged-in user
**/
function getLoggedInfo() {
// 로그인 되어 있고 세션 정보를 요청하면 세션 정보를 return
// Return session info if session info is requested and the user is logged-in
if($this->isLogged()) {
$logged_info = $_SESSION['logged_info'];
// site_module_info에 따라서 관리자/ 그룹 목록을 매번 재지정
// Admin/Group list defined depending on site_module_info
$site_module_info = Context::get('site_module_info');
if($site_module_info->site_srl) {
$logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl);
// 사이트 관리자이면 로그인 정보에 is_site_admin bool변수를 추가
// Add is_site_admin bool variable into logged_info if site_administrator is
$oModuleModel = &getModel('module');
if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true;
else $logged_info->is_site_admin = false;
} else {
// 만약 기본 사이트인데 회원 그룹이 존재하지 않으면 등록
// Register a default group if the site doesn't have a member group
if(!count($logged_info->group_list)) {
$default_group = $this->getDefaultGroup(0);
$oMemberController = &getController('member');
@ -175,7 +160,7 @@
}
/**
* @brief user_id에 해당하는 사용자 정보 return
* @brief Return member information with user_id
**/
function getMemberInfoByUserID($user_id) {
if(!$user_id) return;
@ -191,7 +176,7 @@
}
/**
* @brief member_srl로 사용자 정보 return
* @brief Return member information with member_srl
**/
function getMemberInfoByMemberSrl($member_srl, $site_srl = 0) {
if(!$member_srl) return;
@ -208,7 +193,7 @@
}
/**
* @brief 사용자 정보 extra_vars와 기타 정보를 알맞게 편집
* @brief Add member info from extra_vars and other information
**/
function arrangeMemberInfo($info, $site_srl = 0) {
if(!$GLOBALS['__member_info__'][$info->member_srl]) {
@ -241,7 +226,7 @@
}
/**
* @brief userid에 해당하는 member_srl을 구함
* @brief Get member_srl corresponding to userid
**/
function getMemberSrlByUserID($user_id) {
$args->user_id = $user_id;
@ -250,7 +235,7 @@
}
/**
* @brief EmailAddress에 해당하는 member_srl을 구함
* @brief Get member_srl corresponding to EmailAddress
**/
function getMemberSrlByEmailAddress($email_address) {
$args->email_address = $email_address;
@ -259,7 +244,7 @@
}
/**
* @brief NickName에 해당하는 member_srl을 구함
* @brief Get member_srl corresponding to nickname
**/
function getMemberSrlByNickName($nick_name) {
$args->nick_name = $nick_name;
@ -268,7 +253,7 @@
}
/**
* @brief 현재 접속자의 member_srl을 return
* @brief Return member_srl of the current logged-in user
**/
function getLoggedMemberSrl() {
if(!$this->isLogged()) return;
@ -276,7 +261,7 @@
}
/**
* @brief 현재 접속자의 user_id을 return
* @brief Return user_id of the current logged-in user
**/
function getLoggedUserID() {
if(!$this->isLogged()) return;
@ -285,7 +270,7 @@
}
/**
* @brief member_srl이 속한 group 목록을 가져옴
* @brief Get a list of groups which the member_srl belongs to
**/
function getMemberGroups($member_srl, $site_srl = 0, $force_reload = false) {
static $member_groups = array();
@ -307,7 +292,7 @@
}
/**
* @brief member_srl들이 속한 group 목록을 가져옴
* @brief Get a list of groups which member_srls belong to
**/
function getMembersGroups($member_srls, $site_srl = 0) {
$args->member_srls = implode(',',$member_srls);
@ -323,7 +308,7 @@
}
/**
* @brief 기본 그룹을 가져옴
* @brief Get a default group
**/
function getDefaultGroup($site_srl = 0) {
$args->site_srl = $site_srl;
@ -332,7 +317,7 @@
}
/**
* @brief 관리자 그룹을 가져옴
* @brief Get an admin group
**/
function getAdminGroup() {
$output = executeQuery('member.getAdminGroup');
@ -340,7 +325,7 @@
}
/**
* @brief group_srl에 해당하는 그룹 정보 가져옴
* @brief Get group info corresponding to group_srl
**/
function getGroup($group_srl) {
$args->group_srl = $group_srl;
@ -349,7 +334,7 @@
}
/**
* @brief 그룹 목록을 가져옴
* @brief Get a list of groups
**/
function getGroups($site_srl = 0) {
if(!$GLOBALS['__group_info__'][$site_srl]) {
@ -370,28 +355,25 @@
}
/**
* @brief 회원 가입폼 추가 확장 목록 가져오기
* @brief Get a list of member join forms
*
* 메소드는 modules/member/tpl/filter/insert.xml extend_filter로 동작을 한다.
* extend_filter로 사용을 하기 위해서는 인자값으로 boolean값을 받도록 규정한다.
* 인자값이 true일 경우 filter 타입에 맞는 형태의 object로 결과를 return하여야 한다.
* This method works as an extend filter of modules/member/tpl/filter/insert.xml.
* To use as extend_filter, the argument should be boolean.
* When the argument is true, it returns object result in type of filter.
**/
function getJoinFormList($filter_response = false) {
global $lang;
// 최고관리자는 무시하도록 설정
// Set to ignore if a super administrator.
$logged_info = Context::get('logged_info');
if(!$this->join_form_list) {
// list_order 컬럼의 정렬을 위한 인자 세팅
// Argument setting to sort list_order column
$args->sort_index = "list_order";
$output = executeQuery('member.getJoinFormList', $args);
// 결과 데이터가 없으면 NULL return
// NULL if output data deosn't exist
$join_form_list = $output->data;
if(!$join_form_list) return NULL;
// default_value의 경우 DB에 array가 serialize되어 입력되므로 unserialize가 필요
// Need to unserialize because serialized array is inserted into DB in case of default_value
if(!is_array($join_form_list)) $join_form_list = array($join_form_list);
$join_form_count = count($join_form_list);
for($i=0;$i<$join_form_count;$i++) {
@ -402,11 +384,9 @@
$column_name = $join_form_list[$i]->column_name;
$column_title = $join_form_list[$i]->column_title;
$default_value = $join_form_list[$i]->default_value;
// 언어변수에 추가
// Add language variable
$lang->extend_vars[$column_name] = $column_title;
// checkbox, select등 다수 데이터 형식일 경우 unserialize해줌
// unserialize if the data type if checkbox, select and so on
if(in_array($column_type, array('checkbox','select','radio'))) {
$join_form_list[$i]->default_value = unserialize($default_value);
if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = '';
@ -418,8 +398,7 @@
}
$this->join_form_list = $list;
}
// filter_response가 true일 경우 object 스타일을 구함
// Get object style if the filter_response is true
if($filter_response && count($this->join_form_list)) {
foreach($this->join_form_list as $key => $val) {
@ -441,19 +420,17 @@
return $filter_output;
}
// 결과 리턴
// Return the result
return $this->join_form_list;
}
/**
* @brief 추가 회원가입폼과 특정 회원의 정보를 조합 (회원정보 수정등에 사용)
* @brief Combine extend join form and member information (used to modify member information)
**/
function getCombineJoinForm($member_info) {
$extend_form_list = $this->getJoinFormlist();
if(!$extend_form_list) return;
// 관리자이거나 자기 자신이 아니면 비공개의 경우 무조건 패스해버림
// Member info is open only to an administrator and him/herself when is_private is true.
$logged_info = Context::get('logged_info');
foreach($extend_form_list as $srl => $item) {
@ -464,8 +441,7 @@
$extend_form_list[$srl]->is_private = true;
continue;
}
// 추가 확장폼의 종류에 따라 값을 변경
// Change values depening on the type of extend form
switch($item->column_type) {
case 'checkbox' :
if($value && !is_array($value)) $value = array($value);
@ -489,7 +465,7 @@
}
/**
* @brief 한개의 가입항목을 가져옴
* @brief Get a join form
**/
function getJoinForm($member_join_form_srl) {
$args->member_join_form_srl = $member_join_form_srl;
@ -510,7 +486,7 @@
}
/**
* @brief 금지 아이디 목록 가져오기
* @brief Get a list of denied IDs
**/
function getDeniedIDList() {
if(!$this->denied_id_list) {
@ -526,7 +502,7 @@
}
/**
* @brief 금지 아이디인지 확인
* @brief Verify if ID is denied
**/
function isDeniedID($user_id) {
$args->user_id = $user_id;
@ -536,7 +512,7 @@
}
/**
* @brief 프로필 이미지의 정보를 구함
* @brief Get information of the profile image
**/
function getProfileImage($member_srl) {
if(!isset($GLOBALS['__member_info__']['profile_image'][$member_srl])) {
@ -561,7 +537,7 @@
}
/**
* @brief 이미지이름의 정보를 구함
* @brief Get the image name
**/
function getImageName($member_srl) {
if(!isset($GLOBALS['__member_info__']['image_name'][$member_srl])) {
@ -579,7 +555,7 @@
}
/**
* @brief 이미지마크의 정보를 구함
* @brief Get the image mark
**/
function getImageMark($member_srl) {
if(!isset($GLOBALS['__member_info__']['image_mark'][$member_srl])) {
@ -599,7 +575,7 @@
/**
* @brief group의 이미지마크 정보를 구함
* @brief Get the image mark of the group
**/
function getGroupImageMark($member_srl,$site_srl=0) {
$oModuleModel = &getModel('module');
@ -626,7 +602,7 @@
}
/**
* @brief 사용자의 signature를 구함
* @brief Get user's signature
**/
function getSignature($member_srl) {
if(!isset($GLOBALS['__member_info__']['signature'][$member_srl])) {
@ -641,19 +617,16 @@
}
/**
* @brief 입력된 plain text 비밀번호와 DB에 저장된 비밀번호와의 비교
* @brief Compare plain text password to the password saved in DB
**/
function isValidPassword($hashed_password, $password_text) {
// 입력된 비밀번호가 없으면 무조건 falase
// False if no password in entered
if(!$password_text) return false;
// md5 해쉬된값가 맞으면 return true
// Return true if the user input is equal to md5 hash value
if($hashed_password == md5($password_text)) return true;
// mysql_pre4_hash_password함수의 값과 동일하면 return true
// Return true if the user input is equal to the value of mysql_pre4_hash_password
if(mysql_pre4_hash_password($password_text) == $hashed_password) return true;
// 현재 DB에서 mysql DB를 이용시 직접 old_password를 이용하여 검사하고 맞으면 비밀번호를 변경
// Verify the password by using old_password if the current db is MySQL. If correct, return true.
if(substr(Context::getDBType(),0,5)=='mysql') {
$oDB = &DB::getInstance();
if($oDB->isValidOldPassword($password_text, $hashed_password)) return true;
@ -663,7 +636,7 @@
}
/**
* @brief 멤버와 연결된 오픈아이디들을 모두 리턴한다.
* @brief Return all the open IDs of the member
**/
function getMemberOpenIDByMemberSrl($member_srl) {
$oModuleModel = &getModel('module');
@ -697,7 +670,7 @@
}
/**
* @brief 오픈아이디에 연결된 멤버를 리턴한다.
* @brief Return the member of the open ID.
**/
function getMemberSrlByOpenID($openid) {
$oModuleModel = &getModel('module');

View file

@ -2,20 +2,20 @@
/**
* @class memberView
* @author NHN (developers@xpressengine.com)
* @brief member moduleView class
* @brief View class of member module
**/
class memberView extends member {
var $group_list = NULL; ///< 그룹 목록 정보
var $member_info = NULL; ///< 선택된 사용자의 정보
var $group_list = NULL; // /< Group list information
var $member_info = NULL; // /< Member information of the user
var $skin = 'default';
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
// 회원 관리 정보를 받음
// Get the member configuration
$oModuleModel = &getModel('module');
$this->member_config = $oModuleModel->getModuleConfig('member');
if(!$this->member_config->skin) $this->member_config->skin = "default";
@ -23,21 +23,19 @@
Context::set('member_config', $this->member_config);
$skin = $this->member_config->skin;
// template path 지정
// Set the template path
$tpl_path = sprintf('%sskins/%s', $this->module_path, $skin);
if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default');
$this->setTemplatePath($tpl_path);
}
/**
* @brief 회원 정보 출력
* @brief Display member information
**/
function dispMemberInfo() {
$oMemberModel = &getModel('member');
$logged_info = Context::get('logged_info');
// 비회원일 경우 정보 열람 중지
// Don't display member info to non-logged user
if(!$logged_info->member_srl) return $this->stop('msg_not_permitted');
$member_srl = Context::get('member_srl');
@ -65,38 +63,33 @@
}
/**
* @brief 회원 가입 출력
* @brief Display member join form
**/
function dispMemberSignUpForm() {
$oMemberModel = &getModel('member');
// 로그인한 회원일 경우 해당 회원의 정보를 받음
// Get the member information if logged-in
if($oMemberModel->isLogged()) return $this->stop('msg_already_logged');
// before 트리거 호출
// call a trigger (before)
$trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $this->member_config);
if(!$trigger_output->toBool()) return $trigger_output;
// 회원가입을 중지시켰을 때는 에러 표시
// Error appears if the member is not allowed to join
if($this->member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled');
Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info));
$member_config = $oMemberModel->getMemberConfig();
Context::set('member_config', $member_config);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('signup_form');
}
/**
* @brief 회원 정보 수정
* @brief Modify member information
**/
function dispMemberModifyInfo() {
$oMemberModel = &getModel('member');
$oModuleModel = &getModel('module');
$memberModuleConfig = $oModuleModel->getModuleConfig('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
@ -105,13 +98,11 @@
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
$member_info->signature = $oMemberModel->getSignature($member_srl);
Context::set('member_info',$member_info);
// 추가 가입폼 목록을 받음
// Get a list of extend join form
Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info));
Context::set('openids', $oMemberModel->getMemberOpenIDByMemberSrl($member_srl));
// 에디터 모듈의 getEditor를 호출하여 서명용으로 세팅
// Editor of the module set for signing by calling getEditor
if($member_info->member_srl) {
$oEditorModel = &getModel('editor');
$option->primary_key_name = 'member_srl';
@ -128,19 +119,17 @@
$editor = $oEditorModel->getEditor($member_info->member_srl, $option);
Context::set('editor', $editor);
}
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('modify_info');
}
/**
* @brief 회원 작성글 보기
* @brief Display documents written by the member
**/
function dispMemberOwnDocument() {
$oMemberModel = &getModel('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
@ -159,12 +148,11 @@
}
/**
* @brief 회원 스크랩 게시물 보기
* @brief Display documents scrapped by the member
**/
function dispMemberScrappedDocument() {
$oMemberModel = &getModel('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
@ -182,15 +170,13 @@
}
/**
* @brief 회원의 저장함 보기
* @brief Display documents saved by the member
**/
function dispMemberSavedDocument() {
$oMemberModel = &getModel('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
// 저장함에 보관된 글을 가져옴 (저장함은 module_srl이 member_srl로 세팅되어 있음)
// Get the saved document(module_srl is set to member_srl instead)
$logged_info = Context::get('logged_info');
$args->module_srl = $logged_info->member_srl;
$args->page = (int)Context::get('page');
@ -207,7 +193,7 @@
}
/**
* @brief 로그인 출력
* @brief Display the login form
**/
function dispMemberLoginForm() {
if(Context::get('is_logged')) {
@ -216,19 +202,17 @@
$this->setTemplateFile('redirect.html');
return;
}
// 템플릿 파일 지정
// Set a template file
Context::set('referer_url', $_SERVER['HTTP_REFERER']);
$this->setTemplateFile('login_form');
}
/**
* @brief 회원 비밀번호 수정
* @brief Change the user password
**/
function dispMemberModifyPassword() {
$oMemberModel = &getModel('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
@ -236,18 +220,16 @@
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
Context::set('member_info',$member_info);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('modify_password');
}
/**
* @brief 탈퇴 화면
* @brief Member withdrawl
**/
function dispMemberLeave() {
$oMemberModel = &getModel('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
@ -255,18 +237,16 @@
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
Context::set('member_info',$member_info);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('leave_form');
}
/**
* @brief 오픈 아이디 탈퇴 화면
* @brief OpenID member withdrawl
**/
function dispMemberOpenIDLeave() {
$oMemberModel = &getModel('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
$logged_info = Context::get('logged_info');
@ -274,13 +254,12 @@
$member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
Context::set('member_info',$member_info);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('openid_leave_form');
}
/**
* @brief 로그아웃 출력
* @brief Member log-out
**/
function dispMemberLogout() {
$oMemberController = &getController('member');
@ -292,17 +271,15 @@
}
/**
* @brief 저장된 목록을 보여줌
* @brief Display a list of saved articles
**/
function dispSavedDocumentList() {
$this->setLayoutFile('popup_layout');
$oMemberModel = &getModel('member');
// 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력
// A message appears if the user is not logged-in
if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged');
// 저장함에 보관된 글을 가져옴 (저장함은 module_srl이 member_srl로 세팅되어 있음)
// Get the saved document (module_srl is set to member_srl instead)
$logged_info = Context::get('logged_info');
$args->module_srl = $logged_info->member_srl;
$args->page = (int)Context::get('page');
@ -320,7 +297,7 @@
}
/**
* @brief 아이디/ 비밀번호 찾기 기능
* @brief Find user ID and password
**/
function dispMemberFindAccount() {
if(Context::get('is_logged')) return $this->stop('already_logged');
@ -329,7 +306,7 @@
}
/**
* @brief 임시 비밀번호 발급
* @brief Generate a temporary password
**/
function dispMemberGetTempPassword() {
if(Context::get('is_logged')) return $this->stop('already_logged');
@ -346,7 +323,7 @@
}
/**
* @brief 인증 메일 재발송 페이지
* @brief Page of re-sending an authentication mail
**/
function dispMemberResendAuthMail() {
if(Context::get('is_logged')) return $this->stop('already_logged');

View file

@ -2,22 +2,22 @@
/**
* @class menuAdminController
* @author NHN (developers@xpressengine.com)
* @brief menu 모듈의 admin controller class
* @brief admin controller class of the menu module
**/
class menuAdminController extends menu {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 메뉴 추가
* @brief Add a menu
**/
function procMenuAdminInsert() {
// 입력할 변수 정리
// List variables
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->title = Context::get('title');
@ -32,10 +32,10 @@
}
/**
* @brief 메뉴 제목 변경
* @brief Change the menu title
**/
function procMenuAdminUpdate() {
// 입력할 변수 정리
// List variables
$args->title = Context::get('title');
$args->menu_srl = Context::get('menu_srl');
@ -46,8 +46,8 @@
}
/**
* @brief 메뉴 삭제
* menu_item과 xml 캐시 파일 모두 삭제
* @brief Delete menu
* Delete menu_item and xml cache files
**/
function procMenuAdminDelete() {
$menu_srl = Context::get('menu_srl');
@ -55,7 +55,7 @@
}
function deleteMenu($menu_srl) {
// 캐시 파일 삭제
// Delete cache files
$cache_list = FileHandler::readDir("./files/cache/menu","",false,true);
if(count($cache_list)) {
foreach($cache_list as $cache_file) {
@ -63,18 +63,15 @@
if($pos>0)FileHandler::removeFile($cache_file);
}
}
// 이미지 버튼 모두 삭제
// Delete images of menu buttons
$image_path = sprintf('./files/attach/menu_button/%s', $menu_srl);
FileHandler::removeDir($image_path);
$args->menu_srl = $menu_srl;
// 메뉴 메뉴 삭제
// Delete menu items
$output = executeQuery("menu.deleteMenuItems", $args);
if(!$output->toBool()) return $output;
// 메뉴 삭제
// Delete the menu
$output = executeQuery("menu.deleteMenu", $args);
if(!$output->toBool()) return $output;
@ -82,10 +79,10 @@
}
/**
* @brief 메뉴에 아이템 추가
* @brief Add an item to the menu
**/
function procMenuAdminInsertItem() {
// 입력할 변수 정리
// List variables to insert
$source_args = Context::getRequestVars();
unset($source_args->module);
unset($source_args->act);
@ -93,8 +90,7 @@
if($source_args->menu_expand !="Y") $source_args->menu_expand = "N";
$source_args->group_srls = str_replace('|@|',',',$source_args->group_srls);
$source_args->parent_srl = (int)$source_args->parent_srl;
// 변수를 다시 정리 (form문의 column과 DB column이 달라서)
// Re-order variables (Column's order is different between form and DB)
$args->menu_srl = $source_args->menu_srl;
$args->menu_item_srl = $source_args->menu_item_srl;
$args->parent_srl = $source_args->parent_srl;
@ -108,46 +104,37 @@
$args->hover_btn = $source_args->hover_btn;
$args->active_btn = $source_args->active_btn;
$args->group_srls = $source_args->group_srls;
// 이미 존재하는지를 확인
// Check if already exists
$oMenuModel = &getAdminModel('menu');
$item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl);
// 존재하게 되면 update를 해준다
// Update if exists
if($item_info->menu_item_srl == $args->menu_item_srl) {
$output = executeQuery('menu.updateMenuItem', $args);
if(!$output->toBool()) return $output;
// 존재하지 않으면 insert를 해준다
// Insert if not exist
} else {
$args->listorder = -1*$args->menu_item_srl;
$output = executeQuery('menu.insertMenuItem', $args);
if(!$output->toBool()) return $output;
}
// 해당 메뉴의 정보를 구함
// Get information of the menu
$menu_info = $oMenuModel->getMenu($args->menu_srl);
$menu_title = $menu_info->title;
// XML 파일을 갱신하고 위치을 넘겨 받음
// Update the xml file and get its location
$xml_file = $this->makeXmlFile($args->menu_srl);
// url이 mid일 경우 기록 남김
// If a new menu item that mid is URL is added, the current layout is applied
if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $args->url)) {
$mid = $args->url;
$mid_args->menu_srl = $args->menu_srl;
$mid_args->mid = $mid;
// menu_srl에 해당하는 레이아웃 값을 구함
// Get layout value of menu_srl
$output = executeQuery('menu.getMenuLayout', $args);
// 해당 모듈에 레이아웃 값이 정해져 있지 않으면 지정
// Set if layout value is not specified in the module
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByMid($mid);
if(!$module_info->layout_srl&&$output->data->layout_srl) $mid_args->layout_srl = $output->data->layout_srl;
// 해당 mid의 메뉴값을 선택된 메뉴로 변경
// Change menu value of the mid to the menu
$oModuleController = &getController('module');
$oModuleController->updateModuleMenu($mid_args);
}
@ -160,35 +147,29 @@
}
/**
* @brief 메뉴 메뉴 삭제
* @brief Delete menu item(menu of the menu)
**/
function procMenuAdminDeleteItem() {
// 변수 정리
// List variables
$args = Context::gets('menu_srl','menu_item_srl');
$oMenuAdminModel = &getAdminModel('menu');
// 원정보를 가져옴
// Get original information
$item_info = $oMenuAdminModel->getMenuItemInfo($args->menu_item_srl);
if($item_info->parent_srl) $parent_srl = $item_info->parent_srl;
// 자식 노드가 있는지 체크하여 있으면 삭제 못한다는 에러 출력
// Display an error that the category cannot be deleted if it has a child node
$output = executeQuery('menu.getChildMenuCount', $args);
if(!$output->toBool()) return $output;
if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child');
// DB에서 삭제
// Remove from the DB
$output = executeQuery("menu.deleteMenuItem", $args);
if(!$output->toBool()) return $output;
// 해당 메뉴의 정보를 구함
// Get information of the menu
$menu_info = $oMenuAdminModel->getMenu($args->menu_srl);
$menu_title = $menu_info->title;
// XML 파일을 갱신하고 위치을 넘겨 받음
// Update the xml file and get its location
$xml_file = $this->makeXmlFile($args->menu_srl);
// 이미지 버튼 모두 삭제
// Delete all of image buttons
if($item_info->normal_btn) FileHandler::removeFile($item_info->normal_btn);
if($item_info->hover_btn) FileHandler::removeFile($item_info->hover_btn);
if($item_info->active_btn) FileHandler::removeFile($item_info->active_btn);
@ -200,7 +181,7 @@
}
/**
* @brief 메뉴의 메뉴를 이동
* @brief Move menu items
**/
function procMenuAdminMoveItem() {
$menu_srl = Context::get('menu_srl');
@ -214,13 +195,12 @@
}
function moveMenuItem($menu_srl,$parent_srl,$source_srl,$target_srl,$mode){
// 원본 메뉴들을 구함
// Get the original menus
$oMenuAdminModel = &getAdminModel('menu');
$target_item = $oMenuAdminModel->getMenuItemInfo($target_srl);
if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request');
// 위치 이동 (순서 조절)
// Move the menu location(change the order menu appears)
if($mode == 'move') {
$args->parent_srl = $parent_srl;
$args->menu_srl = $menu_srl;
@ -243,7 +223,7 @@
$args->menu_item_srl = $target_srl;
$output = executeQuery('menu.updateMenuItemNode', $args);
if(!$output->toBool()) return $output;
// 자식으로 추가
// Add a child
} elseif($mode == 'insert') {
$args->menu_item_srl = $target_srl;
$args->parent_srl = $parent_srl;
@ -257,42 +237,37 @@
}
/**
* @brief xml 파일을 갱신
* 관리자페이지에서 메뉴 구성 간혹 xml파일이 재생성 안되는 경우가 있는데\n
* 이럴 경우 관리자의 수동 갱신 기능을 구현해줌\n
* 개발 중간의 문제인 같고 현재는 문제가 생기지 않으나 굳이 없앨 필요 없는 기능
* @brief Update xml file
* XML file is not often generated after setting menus on the admin page\n
* For this occasional cases, manually update was implemented. \n
* It looks unnecessary at this moment however no need to eliminate the feature. Just leave it.
**/
function procMenuAdminMakeXmlFile() {
// 입력값을 체크
// Check input value
$menu_srl = Context::get('menu_srl');
// 해당 메뉴의 정보를 구함
// Get information of the menu
$oMenuAdminModel = &getAdminModel('menu');
$menu_info = $oMenuAdminModel->getMenu($menu_srl);
$menu_title = $menu_info->title;
// xml파일 재생성
// Re-generate the xml file
$xml_file = $this->makeXmlFile($menu_srl);
// return 값 설정
// Set return value
$this->add('menu_title',$menu_title);
$this->add('xml_file',$xml_file);
}
/**
* @brief 메뉴 이미지 버튼을 등록
* @brief Register a menu image button
**/
function procMenuAdminUploadButton() {
$menu_srl = Context::get('menu_srl');
$menu_item_srl = Context::get('menu_item_srl');
$target = Context::get('target');
$target_file = Context::get($target);
// 필수 요건이 없거나 업로드된 파일이 아니면 오류 발생
// Error occurs when the target is neither a uploaded file nor a valid file
if(!$menu_srl || !$menu_item_srl || !$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)/i',$target_file['name'])) {
Context::set('error_messge', Context::getLang('msg_invalid_request'));
// 요건을 만족하고 업로드된 파일이면 지정된 위치로 이동
// Move the file to a specific director if the uploaded file meets requirement
} else {
$tmp_arr = explode('.',$target_file['name']);
$ext = $tmp_arr[count($tmp_arr)-1];
@ -312,7 +287,7 @@
}
/**
* @brief 등록된 메뉴 이미지 제거
* @brief Remove the menu image button
**/
function procMenuAdminDeleteButton() {
$menu_srl = Context::get('menu_srl');
@ -325,13 +300,12 @@
}
/**
* @brief 메뉴의 xml 파일을 만들고 위치를 return
* @brief Generate XML file for menu and return its location
**/
function makeXmlFile($menu_srl) {
// xml파일 생성시 필요한 정보가 없으면 그냥 return
// Return if there is no information when creating the xml file
if(!$menu_srl) return;
// 메뉴 정보를 구함
// Get menu informaton
$args->menu_srl = $menu_srl;
$output = executeQuery('menu.getMenu', $args);
if(!$output->toBool() || !$output->data) return $output;
@ -342,18 +316,15 @@
$site_info = $oModuleModel->getSiteInfo($site_srl);
$domain = $site_info->domain;
}
// DB에서 menu_srl에 해당하는 메뉴 아이템 목록을 listorder순으로 구해옴
// Get a list of menu items corresponding to menu_srl by listorder
$args->menu_srl = $menu_srl;
$args->sort_index = 'listorder';
$output = executeQuery('menu.getMenuItems', $args);
if(!$output->toBool()) return;
// 캐시 파일의 이름을 지정
// Specify the name of the cache file
$xml_file = sprintf("./files/cache/menu/%s.xml.php", $menu_srl);
$php_file = sprintf("./files/cache/menu/%s.php", $menu_srl);
// 구해온 데이터가 없다면 노드데이터가 없는 xml 파일만 생성
// If no data found, generate an XML file without node data
$list = $output->data;
if(!$list) {
$xml_buff = "<root />";
@ -361,11 +332,9 @@
FileHandler::writeFile($php_file, '<?php if(!defined("__ZBXE__")) exit(); ?>');
return $xml_file;
}
// 구해온 데이터가 하나라면 array로 바꾸어줌
// Change to an array if only a single data is obtained
if(!is_array($list)) $list = array($list);
// 루프를 돌면서 tree 구성
// Create a tree for loop
$list_count = count($list);
for($i=0;$i<$list_count;$i++) {
$node = $list[$i];
@ -374,8 +343,7 @@
$tree[$parent_srl][$menu_item_srl] = $node;
}
// 캐시 파일의 권한과 그룹 설정을 위한 공통 헤더
// A common header to set permissions of the cache file and groups
$header_script =
'$lang_type = Context::getLangType(); '.
'$is_logged = Context::get(\'is_logged\'); '.
@ -397,8 +365,7 @@
'$is_admin = false; '.
'$group_srsl = array(); '.
'} ';
// xml 캐시 파일 생성 (xml캐시는 따로 동작하기에 session 지정을 해주어야 함)
// Create the xml cache file (a separate session is needed for xml cache)
$xml_buff = sprintf(
'<?php '.
'define(\'__ZBXE__\', true); '.
@ -418,8 +385,7 @@
$header_script,
$this->getXmlTree($tree[0], $tree, $site_srl, $domain)
);
// php 캐시 파일 생성
// Create php cache file
$php_output = $this->getPhpCacheCode($tree[0], $tree, $site_srl, $domain);
$php_buff = sprintf(
'<?php '.
@ -432,17 +398,16 @@
$php_output['name'],
$php_output['buff']
);
// 파일 저장
// Save File
FileHandler::writeFile($xml_file, $xml_buff);
FileHandler::writeFile($php_file, $php_buff);
return $xml_file;
}
/**
* @brief array로 정렬된 노드들을 parent_srl을 참조하면서 recursive하게 돌면서 xml 데이터 생성
* 메뉴 xml파일은 node라는 tag가 중첩으로 사용되며 xml doc으로 관리자 페이지에서 메뉴를 구성해줌\n
* (tree_menu.js 에서 xml파일을 바로 읽고 tree menu를 구현)
* @brief Create xml data recursively looping for array nodes by referencing to parent_srl
* menu xml file uses a tag named "node" and this XML configures menus on admin page.
* (Implement tree menu by reading the xml file in tree_menu.js)
**/
function getXmlTree($source_node, $tree, $site_srl, $domain) {
if(!$source_node) return;
@ -451,11 +416,9 @@
foreach($source_node as $menu_item_srl => $node) {
$child_buff = "";
// 자식 노드의 데이터 가져옴
// Get data of the child nodes
if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain);
// 변수 정리
// List variables
$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
foreach($names as $key => $val) {
$name_arr_str .= sprintf('"%s"=>"%s",',$key, str_replace('\\','\\\\',htmlspecialchars($val)));
@ -492,8 +455,7 @@
} else {
$link = '<?php print $_names[$lang_type]; ?>';
}
// node->group_srls값이 있으면
// If the value of node->group_srls exists
if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls);
else $group_check_code = "true";
$attribute = sprintf(
@ -522,10 +484,10 @@
}
/**
* @brief array로 정렬된 노드들을 php code로 변경하여 return
* 메뉴에서 메뉴를 tpl에 사용시 xml데이터를 사용할 수도 있지만 별도의 javascript 사용이 필요하기에
* php로 캐시파일을 만들어서 db이용없이 바로 메뉴 정보를 구할 있도록 한다
* 캐시는 ModuleHandler::displayContent() 에서 include하여 Context::set() 한다
* @brief Return php code converted from nodes in an array
* Although xml data can be used for tpl, menu to menu, it needs to use javascript separately
* By creating cache file in php and then you can get menu information without DB
* This cache includes in ModuleHandler::displayContent() and then Context::set()
**/
function getPhpCacheCode($source_node, $tree, $site_srl, $domain) {
$output = array("buff"=>"", "url_list"=>array());
@ -534,26 +496,22 @@
$oMenuAdminModel = &getAdminModel('menu');
foreach($source_node as $menu_item_srl => $node) {
// 자식 노드가 있으면 자식 노드의 데이터를 먼저 얻어옴
// Get data from child nodes if exist.
if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain);
else $child_output = array("buff"=>"", "url_list"=>array());
// 변수 정리
// List variables
$names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl);
foreach($names as $key => $val) {
$name_arr_str .= sprintf('"%s"=>"%s",',$key, str_replace(array('\\','"'),array('\\\\','&quot;'),$val));
}
$name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']);
// 현재 노드의 url값이 공란이 아니라면 url_list 배열값에 입력
// If url value is not empty in the current node, put the value into an array url_list
if($node->url) $child_output['url_list'][] = $node->url;
$output['url_list'] = array_merge($output['url_list'], $child_output['url_list']);
// node->group_srls값이 있으면
// If node->group_srls value exists
if($node->group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$node->group_srls);
else $group_check_code = "true";
// 변수 정리
// List variables
$href = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->href);
$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$node->url);
if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url)) {
@ -594,8 +552,7 @@
} else {
$link_active = $link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl);
}
// 속성을 생성한다 ( url_list를 이용해서 선택된 메뉴의 노드에 속하는지를 검사한다. 꽁수지만 빠르고 강력하다고 생각;;)
// Create properties (check if it belongs to the menu node by url_list. It looks a trick but fast and powerful)
$attribute = sprintf(
'"node_srl"=>"%s","parent_srl"=>"%s","text"=>(%s?$_menu_names[%d][$lang_type]:""),"href"=>(%s?"%s":""),"url"=>(%s?"%s":""),"open_window"=>"%s","normal_btn"=>"%s","hover_btn"=>"%s","active_btn"=>"%s","selected"=>(array(%s)&&in_array(Context::get("mid"),array(%s))?1:0),"expand"=>"%s", "list"=>array(%s), "link"=>(%s? ( array(%s)&&in_array(Context::get("mid"),array(%s)) ?%s:%s):""),',
$node->menu_item_srl,
@ -620,8 +577,7 @@
$link_active,
$link
);
// buff 데이터를 생성한다
// Generate buff data
$output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute);
$output['name'] .= $name_str;
}
@ -629,20 +585,18 @@
}
/**
* @brief 메뉴와 레이아웃 매핑
* 레이아웃에서 메뉴를 지정할때 지정된 메뉴의 기본 레이아웃을 매핑
* @brief Mapping menu and layout
* When setting menu on the layout, map the default layout
**/
function updateMenuLayout($layout_srl, $menu_srl_list) {
if(!count($menu_srl_list)) return;
// 일단 menu_srls의 값을 지움
// Delete the value of menu_srls
$args->menu_srls = implode(',',$menu_srl_list);
$output = executeQuery('menu.deleteMenuLayout', $args);
if(!$output->toBool()) return $output;
$args->layout_srl = $layout_srl;
// menu_srls, layout_srl 매핑
// Mapping menu_srls, layout_srl
for($i=0;$i<count($menu_srl_list);$i++) {
$args->menu_srl = $menu_srl_list[$i];
$output = executeQuery('menu.insertMenuLayout', $args);

View file

@ -3,19 +3,19 @@
* @class menuAdminModel
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @brief menu 모듈의 admin model class
* @brief admin model class of the menu module
**/
class menuAdminModel extends menu {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 전체 메뉴 목록을 구해옴
* @brief Get a list of all menus
**/
function getMenuList($obj) {
if(!$obj->site_srl) {
@ -27,25 +27,23 @@
$args->page = $obj->page?$obj->page:1;
$args->list_count = $obj->list_count?$obj->list_count:20;
$args->page_count = $obj->page_count?$obj->page_count:10;
// document.getDocumentList 쿼리 실행
// document.getDocumentList query execution
$output = executeQuery('menu.getMenuList', $args);
// 결과가 없거나 오류 발생시 그냥 return
// Return if no result or an error occurs
if(!$output->toBool()||!count($output->data)) return $output;
return $output;
}
/**
* @brief 등록된 모든 메뉴를 return
* @brief Return all menus
**/
function getMenus($site_srl = null) {
if(!isset($site_srl)) {
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
}
// 일단 DB에서 정보를 가져옴
// Get information from the DB
$args->site_srl = $site_srl ;
$args->menu_srl = $menu_srl;
$output = executeQuery('menu.getMenus', $args);
@ -56,11 +54,11 @@
}
/**
* @brief DB 생성된 한개의 메뉴 정보를 구함
* 생성된 메뉴의 DB정보+XML정보를 return
* @brief Get information of a new menu from the DB
* Return DB and XML information of the menu
**/
function getMenu($menu_srl) {
// 일단 DB에서 정보를 가져옴
// Get information from the DB
$args->menu_srl = $menu_srl;
$output = executeQuery('menu.getMenu', $args);
if(!$output->data) return;
@ -72,11 +70,11 @@
}
/**
* @brief 특정 menu_srl의 아이템 정보를 return
* 정보중에 group_srls의 경우는 , 연결되어 들어가며 사용시에는 explode를 통해 array로 변환 시킴
* @brief Return item information of the menu_srl
* group_srls uses a seperator with comma(,) and converts to an array by explode
**/
function getMenuItemInfo($menu_item_srl) {
// menu_item_srl이 있으면 해당 메뉴의 정보를 가져온다
// Get the menu information if menu_item_srl exists
$args->menu_item_srl = $menu_item_srl;
$output = executeQuery('menu.getMenuItem', $args);
$node = $output->data;
@ -94,56 +92,49 @@
}
/**
* @brief 다국어 지원을 위해 menu의 name을 언어별로 나눠서 return
* @brief Return menu name in each language to support multi-language
*/
function getMenuItemNames($source_name, $site_srl = null) {
if(!$site_srl) {
$site_module_info = Context::get('site_module_info');
$site_srl = (int)$site_module_info->site_srl;
}
// 언어코드 구함
// Get language code
$oModuleAdminModel = &getAdminModel('module');
return $oModuleAdminModel->getLangCode($site_srl, $source_name);
}
/**
* @brief 특정 menu_srl의 정보를 이용하여 템플릿을 구한후 return
* 관리자 페이지에서 특정 메뉴의 정보를 추가하기 위해 서버에서 tpl을 컴파일 한후 컴파일 html을 직접 return
* @brief Get a template by using the menu_srl and retrun.
* Return html after compiling tpl on the server in order to add menu information on the admin page
**/
function getMenuAdminTplInfo() {
// 해당 메뉴의 정보를 가져오기 위한 변수 설정
// Get information on the menu for the parameter settings
$menu_item_srl = Context::get('menu_item_srl');
$parent_srl = Context::get('parent_srl');
// 회원 그룹의 목록을 가져옴
// Get a list of member groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups();
Context::set('group_list', $group_list);
// parent_srl이 있고 menu_item_srl이 없으면 하부 메뉴 추가임
// Add a sub-menu if there is parent_srl but not menu_item_srl
if(!$menu_item_srl && $parent_srl) {
// 상위 메뉴의 정보를 가져옴
// Get information of the parent menu
$parent_info = $this->getMenuItemInfo($parent_srl);
// 추가하려는 메뉴의 기본 변수 설정
// Default parameter settings for a new menu
$item_info->menu_item_srl = getNextSequence();
$item_info->parent_srl = $parent_srl;
$item_info->parent_menu_name = $parent_info->name;
// root에 메뉴 추가하거나 기존 메뉴의 수정일 경우
// In case of modifying the existing menu or addting a new menu to the root
} else {
// menu_item_srl 이 있으면 해당 메뉴의 정보를 가져온다
// Get information of the menu if menu_item_srl exists
if($menu_item_srl) $item_info = $this->getMenuItemInfo($menu_item_srl);
// 찾아진 값이 없다면 신규 메뉴 추가로 보고 menu_item_srl값만 구해줌
// Get only menu_item_srl if no values found, considering it as adding a new menu
if(!$item_info->menu_item_srl) {
$item_info->menu_item_srl = getNextSequence();
}
}
Context::set('item_info', $item_info);
// template 파일을 직접 컴파일한후 tpl변수에 담아서 return한다.
// Compile the template file into tpl variable and then return it
$oTemplate = &TemplateHandler::getInstance();
$tpl = $oTemplate->compile($this->module_path.'tpl', 'menu_item_info');

View file

@ -2,23 +2,23 @@
/**
* @class menuAdminView
* @author NHN (developers@xpressengine.com)
* @brief menu 모듈의 admin view class
* @brief admin view class of the menu module
**/
class menuAdminView extends menu {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 메뉴 관리의 페이지
* @brief The first page of the menu admin
**/
function dispMenuAdminContent() {
// 등록된 메뉴 목록을 구해옴
// Get a list of registered menus
$obj->page = Context::get('page');
$obj->sort_index = 'listorder';
$obj->list_count = 20;
@ -37,14 +37,14 @@
}
/**
* @brief 메뉴 등록 페이지
* @brief Page to insert a menu
**/
function dispMenuAdminInsert() {
// 선택된 메뉴의 정보르 구해서 세팅
// Set the menu with menu information
$menu_srl = Context::get('menu_srl');
if($menu_srl) {
// 메뉴의 정보를 가져옴
// Get information of the menu
$oMenuModel = &getAdminModel('menu');
$menu_info = $oMenuModel->getMenu($menu_srl);
if($menu_info->menu_srl == $menu_srl) Context::set('menu_info', $menu_info);
@ -54,50 +54,43 @@
}
/**
* @brief 메뉴 관리 페이지
* @brief Menu admin page
**/
function dispMenuAdminManagement() {
// 선택된 메뉴의 정보르 구해서 세팅
// Get information of the menu
$menu_srl = Context::get('menu_srl');
if(!$menu_srl) return $this->dispMenuAdminContent();
// 메뉴의 정보를 가져옴
// Get information of the menu
$oMenuModel = &getAdminModel('menu');
$menu_info = $oMenuModel->getMenu($menu_srl);
if($menu_info->menu_srl != $menu_srl) return $this->dispMenuAdminContent();
Context::set('menu_info', $menu_info);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setTemplateFile('menu_management');
}
/**
* @brief 메뉴에서 선택할 있는 mid목록을 보여줌
* @brief Display a mid list to be able to select on the menu
**/
function dispMenuAdminMidList() {
$oModuleModel = &getModel('module');
// 모듈 카테고리 목록을 구함
// Get a list of module categories
$module_category = $oModuleModel->getModuleCategories();
Context::set('module_category', $module_category);
// 모듈 목록을 구함
// Get a list of modules
$module_list = $oModuleModel->getModuleList();
Context::set('module_list', $module_list);
// mid 목록을 구해옴
// Get a list of mid
$args->module_category_srl = Context::get('module_category_srl');
$args->module = Context::get('target_module');
$mid_list = $oModuleModel->getMidList($args);
Context::set('mid_list', $mid_list);
// 메뉴을 팝업으로 지정
// Set the menu as a pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('mid_list');
}
}

View file

@ -2,40 +2,38 @@
/**
* @class menu
* @author NHN (developers@xpressengine.com)
* @brief menu 모듈의 high class
* @brief high class of the menu module
**/
class menu extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// 메뉴 사용할 디렉토리 생성
// Create a directory to use menu
FileHandler::makeDir('./files/cache/menu');
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oDB = &DB::getInstance();
// 2009. 02. 11 menu 테이블에 site_srl 추가
// 2009. 02. 11 menu added to the table site_srl
if(!$oDB->isColumnExists('menu', 'site_srl')) return true;
return false;
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
// 2009. 02. 11 menu 테이블에 site_srl 추가
// 2009. 02. 11 menu added to the table site_srl
if(!$oDB->isColumnExists('menu', 'site_srl')) {
$oDB->addColumn('menu','site_srl','number',11,0,true);
}
@ -44,20 +42,18 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
// 메뉴 모듈의 캐시 파일 모두 삭제
// Delete all cache files in the menu module
FileHandler::removeFilesInDir("./files/cache/menu");
$oMenuAdminController = &getAdminController('menu');
// 블로그 모듈 목록을 모두 구함
// Wanted list of all the blog module
$output = executeQueryArray("menu.getMenus");
$list = $output->data;
if(!count($list)) return;
// 메뉴 모듈에서 사용되는 모든 메뉴 목록을 재 생성
// The menu module is used in the re-create all the menu list
foreach($list as $menu_item) {
$menu_srl = $menu_item->menu_srl;
$oMenuAdminController->makeXmlFile($menu_srl);

View file

@ -2,25 +2,24 @@
/**
* @class messageAdminController
* @author NHN (developers@xpressengine.com)
* @brief message module의 admin controller class
* @brief admin controller class of message module
**/
class messageAdminController extends message {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 설정
* @brief Configuration
**/
function procMessageAdminInsertConfig() {
// 기본 정보를 받음
// Get information
$args->skin = Context::get('skin');
// module Controller 객체 생성하여 입력
// Create a module Controller object
$oModuleController = &getController('module');
$output = $oModuleController->insertModuleConfig('message',$args);
if(!$output->toBool()) return $output;

View file

@ -2,31 +2,29 @@
/**
* @class messageAdminView
* @author NHN (developers@xpressengine.com)
* @brief message모듈의 admin view class
* @brief admin view class of the message module
**/
class messageAdminView extends message {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 설정
* @brief Configuration
**/
function dispMessageAdminConfig() {
// 스킨 목록을 구해옴
// Get a list of skins(themes)
$oModuleModel = &getModel('module');
$skin_list = $oModuleModel->getskins($this->module_path);
Context::set('skin_list', $skin_list);
// 설정 정보를 받아옴 (module model 객체를 이용)
// Get configurations (using module model object)
$config = $oModuleModel->getModuleConfig('message');
Context::set('config',$config);
// 템플릿 파일 지정
// Set a template file
$this->setTemplatePath($this->module_path.'tpl');
$this->setTemplateFile('config');
}

View file

@ -2,34 +2,34 @@
/**
* @class message
* @author NHN (developers@xpressengine.com)
* @brief message모듈의 high class
* @brief high class of message module
**/
class message extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
return new Object();
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
return false;
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
return new Object();
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
}

View file

@ -4,29 +4,26 @@
class messageMobile extends messageView {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 메세지 출력
* @brief Message output
**/
function dispMessage() {
// 설정 정보를 받아옴 (module model 객체를 이용)
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('message');
if(!$config->skin) $config->skin = 'default';
// 템플릿 경로를 지정
// Set the template path
$template_path = sprintf('%sm.skins/%s', $this->module_path, $config->skin);
// 회원 관리 정보를 받음
// Get the member configuration
$oModuleModel = &getModel('module');
$member_config = $oModuleModel->getModuleConfig('member');
Context::set('member_config', $member_config);
// ssl 사용시 현재 https접속상태인지에 대한 flag및 https url 생성
// Set a flag to check if the https connection is made when using SSL and create https url
$ssl_mode = false;
if($member_config->enable_ssl == 'Y') {
if(preg_match('/^https:\/\//i',Context::getRequestUri())) $ssl_mode = true;

View file

@ -2,35 +2,32 @@
/**
* @class messageView
* @author NHN (developers@xpressengine.com)
* @brief message모듈의 view class
* @brief view class of the message module
**/
class messageView extends message {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 메세지 출력
* @brief Display messages
**/
function dispMessage() {
// 설정 정보를 받아옴 (module model 객체를 이용)
// Get configurations (using module model object)
$oModuleModel = &getModel('module');
$config = $oModuleModel->getModuleConfig('message');
if(!$config->skin) $config->skin = 'default';
// 템플릿 경로를 지정
// Template path
$template_path = sprintf('%sskins/%s', $this->module_path, $config->skin);
// 회원 관리 정보를 받음
// Get the member configuration
$oModuleModel = &getModel('module');
$member_config = $oModuleModel->getModuleConfig('member');
Context::set('member_config', $member_config);
// ssl 사용시 현재 https접속상태인지에 대한 flag및 https url 생성
// Set a flag to check if the https connection is made when using SSL and create https url
$ssl_mode = false;
if($member_config->enable_ssl == 'Y') {
if(preg_match('/^https:\/\//i',Context::getRequestUri())) $ssl_mode = true;

View file

@ -2,19 +2,19 @@
/**
* @class moduleAdminController
* @author NHN (developers@xpressengine.com)
* @brief module 모듈의 admin controller class
* @brief admin controller class of the module module
**/
class moduleAdminController extends module {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief 모듈 카테고리 추가
* @brief Add the module category
**/
function procModuleAdminInsertCategory() {
$args->title = Context::get('title');
@ -25,7 +25,7 @@
}
/**
* @brief 카테고리의 내용 수정
* @brief Update category
**/
function procModuleAdminUpdateCategory() {
$mode = Context::get('mode');
@ -46,7 +46,7 @@
}
/**
* @brief 모듈 카테고리의 제목 변경
* @brief Change the title of the module category
**/
function doUpdateModuleCategory() {
$args->title = Context::get('title');
@ -55,7 +55,7 @@
}
/**
* @brief 모듈 카테고리 삭제
* @brief Delete the module category
**/
function doDeleteModuleCategory() {
$args->module_category_srl = Context::get('module_category_srl');
@ -63,14 +63,13 @@
}
/**
* @brief 모듈 복사
* @brief Copy Module
**/
function procModuleAdminCopyModule() {
// 복사하려는 대상 모듈의 정보를 구함
// Get information of the target module to copy
$module_srl = Context::get('module_srl');
if(!$module_srl) return;
// 새로 생성하려는 모듈들의 이름/브라우저 제목을 구함
// Get module name to create and browser title
$clones = array();
$args = Context::getAll();
for($i=1;$i<=10;$i++) {
@ -86,11 +85,9 @@
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
// 모듈 정보 가져옴
// Get module information
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
// 권한 정보 가져옴
// Get permission information
$module_args->module_srl = $module_srl;
$output = executeQueryArray('module.getModuleGrants', $module_args);
$grant = array();
@ -101,8 +98,7 @@
$oDB = &DB::getInstance();
$oDB->begin();
// 모듈 복사
// Copy a module
foreach($clones as $mid => $browser_title) {
$clone_args = null;
$clone_args = clone($module_info);
@ -111,12 +107,10 @@
$clone_args->mid = $mid;
$clone_args->browser_title = $browser_title;
$clone_args->is_default = 'N';
// 모듈 생성
// Create a module
$output = $oModuleController->insertModule($clone_args);
$module_srl = $output->get('module_srl');
// 권한 정보 등록
// Grant module permissions
if(count($grant)) $oModuleController->insertModuleGrants($module_srl, $grant);
}
@ -125,20 +119,17 @@
}
/**
* @brief 모듈 권한 저장
* @brief Save the module permissions
**/
function procModuleAdminInsertGrant() {
$oModuleController = &getController('module');
$oModuleModel = &getModel('module');
// 모듈 번호 구함
// Get module_srl
$module_srl = Context::get('module_srl');
// 해당 모듈의 정보를 구함
// Get information of the module
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if(!$module_info) return new Object(-1,'msg_invalid_request');
// 관리자 아이디 등록
// Register Admin ID
$oModuleController->deleteAdminId($module_srl);
$admin_member = Context::get('admin_member');
if($admin_member) {
@ -150,8 +141,7 @@
}
}
// 권한 정리
// List permissions
$xml_info = $oModuleModel->getModuleActionXML($module_info->module);
$grant_list = $xml_info->grant;
@ -160,15 +150,13 @@
$grant_list->manager->default = 'manager';
foreach($grant_list as $grant_name => $grant_info) {
// default값을 구함
// Get the default value
$default = Context::get($grant_name.'_default');
// -1 = 로그인 사용자만, -2 = 사이트 가입자만, 0 = 모든 사용자
// -1 = Log-in user only, -2 = site members only, 0 = all users
if(strlen($default)){
$grant->{$grant_name}[] = $default;
continue;
// 특정 그룹 사용자
// users in a particular group
} else {
$group_srls = Context::get($grant_name);
if($group_srls) {
@ -182,12 +170,11 @@
$grant->{$group_srls} = array();
}
// DB에 저장
// Stored in the DB
$args->module_srl = $module_srl;
$output = executeQuery('module.deleteModuleGrants', $args);
if(!$output->toBool()) return $output;
// DB에 권한 저장
// Permissions stored in the DB
foreach($grant as $grant_name => $group_srls) {
foreach($group_srls as $key => $val) {
$args = null;
@ -202,84 +189,74 @@
}
/**
* @brief 스킨 정보 업데이트
* @brief Updating Skins
**/
function procModuleAdminUpdateSkinInfo() {
// module_srl에 해당하는 정보들을 가져오기
// Get information of the module_srl
$module_srl = Context::get('module_srl');
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
if($module_info->module_srl) {
$skin = $module_info->skin;
// 스킨의 정보를 구해옴 (extra_vars를 체크하기 위해서)
// Get skin information (to check extra_vars)
$module_path = './modules/'.$module_info->module;
$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
// 입력받은 변수들을 체크 (mo, act, module_srl, page등 기본적인 변수들 없앰)
// Check received variables (unset such variables as act, module_srl, page, mid, module)
$obj = Context::getRequestVars();
unset($obj->act);
unset($obj->module_srl);
unset($obj->page);
unset($obj->mid);
unset($obj->module);
// 원 skin_info에서 extra_vars의 type이 image일 경우 별도 처리를 해줌
// Separately handle if a type of extra_vars is an image in the original skin_info
if($skin_info->extra_vars) {
foreach($skin_info->extra_vars as $vars) {
if($vars->type!='image') continue;
$image_obj = $obj->{$vars->name};
// 삭제 요청에 대한 변수를 구함
// Get a variable to delete
$del_var = $obj->{"del_".$vars->name};
unset($obj->{"del_".$vars->name});
if($del_var == 'Y') {
FileHandler::removeFile($skin_vars[$vars->name]->value);
continue;
}
// 업로드 되지 않았다면 이전 데이터를 그대로 사용
// Use the previous data if not uploaded
if(!$image_obj['tmp_name']) {
$obj->{$vars->name} = $skin_vars[$vars->name]->value;
continue;
}
// 정상적으로 업로드된 파일이 아니면 무시
// Ignore if the file is not successfully uploaded
if(!is_uploaded_file($image_obj['tmp_name'])) {
unset($obj->{$vars->name});
continue;
}
// 이미지 파일이 아니어도 무시
// Ignore if the file is not an image
if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) {
unset($obj->{$vars->name});
continue;
}
// 경로를 정해서 업로드
// Upload the file to a path
$path = sprintf("./files/attach/images/%s/", $module_srl);
// 디렉토리 생성
// Create a directory
if(!FileHandler::makeDir($path)) return false;
$filename = $path.$image_obj['name'];
// 파일 이동
// Move the file
if(!move_uploaded_file($image_obj['tmp_name'], $filename)) {
unset($obj->{$vars->name});
continue;
}
// 정상 파일 업로드
// Upload the file
FileHandler::removeFile($skin_vars[$vars->name]->value);
// 변수를 바꿈
// Change a variable
unset($obj->{$vars->name});
$obj->{$vars->name} = $filename;
}
}
// 해당 모듈의 전체 스킨 불러와서 이미지는 제거
// Load the entire skin of the module and then remove the image
/*
if($skin_info->extra_vars) {
foreach($skin_info->extra_vars as $vars) {
@ -291,8 +268,7 @@
*/
$oModuleController = &getController('module');
$oModuleController->deleteModuleSkinVars($module_srl);
// 등록
// Register
$oModuleController->insertModuleSkinVars($module_srl, $obj);
}
@ -303,7 +279,7 @@
}
/**
* @brief 모듈 일괄 정리
* @brief List module information
**/
function procModuleAdminModuleSetup() {
$vars = Context::getRequestVars();
@ -330,7 +306,7 @@
}
/**
* @brief 모듈 권한 일괄 정리
* @brief List permissions of the module
**/
function procModuleAdminModuleGrantSetup() {
$module_srls = Context::get('module_srls');
@ -350,15 +326,13 @@
$grant_list->manager->default = 'manager';
foreach($grant_list as $grant_name => $grant_info) {
// default값을 구함
// Get the default value
$default = Context::get($grant_name.'_default');
// -1 = 로그인 사용자만, 0 = 모든 사용자
// -1 = Sign only, 0 = all users
if(strlen($default)){
$grant->{$grant_name}[] = $default;
continue;
// 특정 그룹 사용자
// Users in a particular group
} else {
$group_srls = Context::get($grant_name);
if($group_srls) {
@ -373,14 +347,13 @@
}
// DB에 저장
// Stored in the DB
foreach($modules as $module_srl) {
$args = null;
$args->module_srl = $module_srl;
$output = executeQuery('module.deleteModuleGrants', $args);
if(!$output->toBool()) continue;
// DB에 권한 저장
// Permissions stored in the DB
foreach($grant as $grant_name => $group_srls) {
foreach($group_srls as $key => $val) {
$args = null;
@ -396,24 +369,21 @@
}
/**
* @brief 언어 추가/ 업데이트
* @brief Add/Update language
**/
function procModuleAdminInsertLang() {
// 언어코드명 가져옴
// Get language code
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->name = str_replace(' ','_',Context::get('lang_code'));
if(!$args->name) return new Object(-1,'msg_invalid_request');
// 언어코드가 있는지 조사
// Check whether a language code exists
$output = executeQueryArray('module.getLang', $args);
if(!$output->toBool()) return $output;
// 있으면 업데이트를 위해 기존 값들을 지움
// If exists, clear the old values for updating
if($output->data) $output = executeQuery('module.deleteLang', $args);
if(!$output->toBool()) return $output;
// 입력
// Enter
$lang_supported = Context::get('lang_supported');
foreach($lang_supported as $key => $val) {
$args->lang_code = $key;
@ -431,10 +401,10 @@
}
/**
* @brief 언어 제거
* @brief Remove language
**/
function procModuleAdminDeleteLang() {
// 언어코드명 가져옴
// Get language code
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->name = str_replace(' ','_',Context::get('name'));
@ -446,10 +416,10 @@
}
/**
* @brief 사용자 정이 언어코드 파일 저장
* @brief Save the file of user-defined language code
**/
function makeCacheDefinedLangCode($site_srl = 0) {
// 현재 사이트의 언어파일 가져오기
// Get the language file of the current site
if(!$site_srl) {
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
@ -458,8 +428,7 @@
}
$output = executeQueryArray('module.getLang', $args);
if(!$output->toBool() || !$output->data) return;
// 캐시 디렉토리 설정
// Set the cache directory
$cache_path = _XE_PATH_.'files/cache/lang_defined/';
if(!is_dir($cache_path)) FileHandler::makeDir($cache_path);

View file

@ -3,20 +3,20 @@
* @class moduleAdminModel
* @author NHN (developers@xpressengine.com)
* @version 0.1
* @brief module 모듈의 AdminModel class
* @brief AdminModel class of the "module" module
**/
class moduleAdminModel extends module {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
}
/**
* @brief module_srl (,콤마로 연결된) 대상 모듈들의 목록을 return)
* 모듈 선택기(ModuleSelector)에서 사용됨
* @brief Return a list of target modules by using module_srls separated by comma(,)
* Used in the ModuleSelector
**/
function getModuleAdminModuleList() {
$args->module_srls = Context::get('module_srls');
@ -47,15 +47,14 @@
}
/**
* @brief 공통 :: 모듈의 모듈 권한 출력 페이지
* 모듈의 모듈 권한 출력은 모든 모듈에서 module instance를 이용할때 사용할 있음
* @brief Common:: module's permission displaying page in the module
* Available when using module instance in all the modules
**/
function getModuleGrantHTML($module_srl, $source_grant_list) {
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
// access, manager 권한은 가상 권한으로 설정
// Grant virtual permission for access and manager
$grant_list->access->title = Context::getLang('grant_access');
$grant_list->access->default = 'guest';
if(count($source_grant_list)) {
@ -68,8 +67,7 @@
$grant_list->manager->title = Context::getLang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
// 현재 모듈에 설정된 권한 그룹을 가져옴
// Get a permission group granted to the current module
$default_grant = array();
$args->module_srl = $module_srl;
$output = executeQueryArray('module.getModuleGrants', $args);
@ -87,22 +85,20 @@
Context::set('selected_group', $selected_group);
Context::set('default_grant', $default_grant);
Context::set('module_srl', $module_srl);
// 현재 모듈에 설정된 관리자 아이디를 추출
// Extract admin ID set in the current module
$admin_member = $oModuleModel->getAdminId($module_srl);
Context::set('admin_member', $admin_member);
// 그룹을 가져옴
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($module_info->site_srl);
Context::set('group_list', $group_list);
// grant 정보를 추출
// Get information of module_grants
$oTemplate = &TemplateHandler::getInstance();
return $oTemplate->compile($this->module_path.'tpl', 'module_grants');
}
/**
* @brief 공통 :: 모듈의 스킨 설정 출력 페이지
* @brief Common:: skin setting page for the module
**/
function getModuleSkinHTML($module_srl) {
$oModuleModel = &getModel('module');
@ -111,11 +107,9 @@
$skin = $module_info->skin;
$module_path = './modules/'.$module_info->module;
// 스킨의 XML 정보를 구함
// Get XML information of the skin
$skin_info = $oModuleModel->loadSkinInfo($module_path, $skin);
// DB에 설정된 스킨 정보를 구함
// Get skin information set in DB
$skin_vars = $oModuleModel->getModuleSkinVars($module_srl);
if(count($skin_info->extra_vars)) {
@ -141,8 +135,8 @@
}
/**
* @brief 특정 언어 코드에 대한 값들을 가져오기
* lang_code를 직접 기입하면 해당 언어코드에 대해서만 가져오고 값이 없으면 $name을 그대로 return
* @brief Get values for a particular language code
* Return its corresponding value if lang_code is specified. Otherwise return $name.
**/
function getLangCode($site_srl, $name) {
$lang_supported = Context::get('lang_supported');
@ -176,7 +170,7 @@
}
/**
* @brief 모듈 언어를 ajax로 요청시 return
* @brief Return if the module language in ajax is requested
**/
function getModuleAdminLangCode() {
$name = Context::get('name');

View file

@ -2,103 +2,93 @@
/**
* @class moduleAdminView
* @author NHN (developers@xpressengine.com)
* @brief module 모듈의 admin view class
* @brief admin view class of the module module
**/
class moduleAdminView extends module {
/**
* @brief 초기화
* @brief Initialization
**/
function init() {
// template path 지정
// Set the template path
$this->setTemplatePath($this->module_path.'tpl');
}
/**
* @brief 모듈 관리자 페이지
* @brief Module admin page
**/
function dispModuleAdminContent() {
$this->dispModuleAdminList();
}
/**
* @brief 모듈 목록 출력
* @brief Display a lost of modules
**/
function dispModuleAdminList() {
// 모듈 목록을 구해서
// Obtain a list of modules
$oModuleModel = &getModel('module');
$module_list = $oModuleModel->getModuleList();
Context::set('module_list', $module_list);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_list');
}
/**
* @brief 모듈의 상세 정보(conf/info.xml) 팝업 출력
* @brief Pop-up details of the module (conf/info.xml)
**/
function dispModuleAdminInfo() {
// 모듈 목록을 구해서
// Obtain a list of modules
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoXml(Context::get('selected_module'));
Context::set('module_info', $module_info);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_info');
}
/**
* @brief 모듈 카테고리 목록
* @brief Module Categories
**/
function dispModuleAdminCategory() {
$module_category_srl = Context::get('module_category_srl');
// 모듈 목록을 구해서
// Obtain a list of modules
$oModuleModel = &getModel('module');
// 선택된 카테고리가 있으면 해당 카테고리의 정보 수정 페이지로
// Display the category page if a category is selected
if($module_category_srl) {
$selected_category = $oModuleModel->getModuleCategory($module_category_srl);
Context::set('selected_category', $selected_category);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('category_update_form');
// 아니면 전체 목록
// If not selected, display a list of categories
} else {
$category_list = $oModuleModel->getModuleCategories();
Context::set('category_list', $category_list);
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('category_list');
}
}
/**
* @brief 모듈 복사 기능
* @brief Feature to copy module
**/
function dispModuleAdminCopyModule() {
// 복사하려는 대상 모듈을 구함
// Get a target module to copy
$module_srl = Context::get('module_srl');
// 해당 모듈의 정보를 구함
// Get information of the module
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
Context::set('module_info', $module_info);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('copy_module');
}
/**
* @brief 모듈 기본 설정 일괄 적용
* @brief Applying the default settings to all modules
**/
function dispModuleAdminModuleSetup() {
$module_srls = Context::get('module_srls');
@ -108,54 +98,45 @@
$oModuleModel = &getModel('module');
$module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0]);
// 모듈의 스킨 목록을 구함
// Get a skin list of the module
$skin_list = $oModuleModel->getSkins('./modules/'.$module_info->module);
Context::set('skin_list',$skin_list);
// 레이아웃 목록을 구해옴
// Get a layout list
$oLayoutMode = &getModel('layout');
$layout_list = $oLayoutMode->getLayoutList();
Context::set('layout_list', $layout_list);
// 모듈 카테고리 목록을 구함
// Get a list of module categories
$module_category = $oModuleModel->getModuleCategories();
Context::set('module_category', $module_category);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_setup');
}
/**
* @brief 모듈 추가 설정 일괄 적용
* @brief Apply module addition settings to all modules
**/
function dispModuleAdminModuleAdditionSetup() {
$module_srls = Context::get('module_srls');
$modules = explode(',',$module_srls);
if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request');
// content는 다른 모듈에서 call by reference로 받아오기에 미리 변수 선언만 해 놓음
// pre-define variables because you can get contents from other module (call by reference)
$content = '';
// 추가 설정을 위한 트리거 호출
// 게시판 모듈이지만 차후 다른 모듈에서의 사용도 고려하여 trigger 이름을 공용으로 사용할 수 있도록 하였음
// Call a trigger for additional settings
// Considering uses in the other modules, trigger name cen be publicly used
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content);
$output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content);
Context::set('setup_content', $content);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_addition_setup');
}
/**
* @brief 모듈 권한 설정 일괄 적용
* @brief Applying module permission settings to all modules
**/
function dispModuleAdminModuleGrantSetup() {
$module_srls = Context::get('module_srls');
@ -167,8 +148,7 @@
$module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0]);
$xml_info = $oModuleModel->getModuleActionXml($module_info->module);
$source_grant_list = $xml_info->grant;
// access, manager 권한은 가상 권한으로 설정
// Grant virtual permissions for access and manager
$grant_list->access->title = Context::getLang('grant_access');
$grant_list->access->default = 'guest';
if(count($source_grant_list)) {
@ -181,42 +161,36 @@
$grant_list->manager->title = Context::getLang('grant_manager');
$grant_list->manager->default = 'manager';
Context::set('grant_list', $grant_list);
// 그룹을 가져옴
// Get a list of groups
$oMemberModel = &getModel('member');
$group_list = $oMemberModel->getGroups($module_info->site_srl);
Context::set('group_list', $group_list);
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_grant_setup');
}
/**
* @brief 언어 코드
* @brief Language codes
**/
function dispModuleAdminLangcode() {
// 현재 사이트의 언어파일 가져오기
// Get the language file of the current site
$site_module_info = Context::get('site_module_info');
$args->site_srl = (int)$site_module_info->site_srl;
$args->sort_index = 'name';
$args->order_type = 'asc';
$output = executeQueryArray('module.getLangList', $args);
Context::set('lang_list', $output->data);
// 현재 선택된 언어 가져오기
// Get the currently selected language
$name = Context::get('name');
if($name) {
$oModuleAdminModel = &getAdminModel('module');
Context::set('selected_lang', $oModuleAdminModel->getLangCode($args->site_srl,'$user_lang->'.$name));
}
// 레이아웃을 팝업으로 지정
// Set the layout to be pop-up
$this->setLayoutFile('popup_layout');
// 템플릿 파일 지정
// Set a template file
$this->setTemplateFile('module_langcode');
}

View file

@ -2,27 +2,25 @@
/**
* @class module
* @author NHN (developers@xpressengine.com)
* @brief module 모듈의 high class
* @brief high class of the module module
**/
class module extends ModuleObject {
/**
* @brief 설치시 추가 작업이 필요할시 구현
* @brief Implement if additional tasks are necessary when installing
**/
function moduleInstall() {
// action forward에 등록 (관리자 모드에서 사용하기 위함)
// Register action forward (to use in administrator mode)
$oModuleController = &getController('module');
$oDB = &DB::getInstance();
$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"), true);
$oDB->addIndex('sites','unique_domain',array('domain'),true);
// module 모듈에서 사용할 디렉토리 생성
// Create a directory to use in the module module
FileHandler::makeDir('./files/cache/module_info');
FileHandler::makeDir('./files/cache/triggers');
// sites 테이블에 기본 사이트 정보 입력
// Insert site information into the sites table
$args->site_srl = 0;
$output = $oDB->executeQuery('module.getSite', $args);
if(!$output->data || !$output->data->index_module_srl) {
@ -43,34 +41,28 @@
}
/**
* @brief 설치가 이상이 없는지 체크하는 method
* @brief a method to check if successfully installed
**/
function checkUpdate() {
$oDB = &DB::getInstance();
// 2008. 10. 27 module_part_config 테이블의 결합 인덱스 추가
// 2008. 10. 27 Add multi-index in the table, the module_part_config
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true;
// 2008. 11. 13 modules 의 mid를 unique를 없애고 site_srl을 추가 후에 site_srl + mid unique index
// 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid
if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true;
// 모든 모듈의 권한/스킨정보를 grants 테이블로 이전시키는 업데이트
// Move permissions/skin information of all modules to the table, grants.
if($oDB->isColumnExists('modules', 'grants')) return true;
// 모든 모듈의 권한/스킨정보를 grants 테이블로 이전시키는 업데이트
// Move permissions/skin information of all modules to the table, grants.
if(!$oDB->isColumnExists('sites', 'default_language')) return true;
// extra_vars* 컬럼 제거
// Delete extra_vars* column
for($i=1;$i<=20;$i++) {
if($oDB->isColumnExists("documents","extra_vars".$i)) return true;
}
// sites 테이블에 기본 사이트 정보 입력
// Insert site information to the table, sites
$args->site_srl = 0;
$output = $oDB->executeQuery('module.getSite', $args);
if(!$output->data) return true;
// sites 테이블에서 도메인이 인덱스로 걸린경우
// If domain index is defined on the table, sites
if($oDB->isIndexExists('sites', 'idx_domain')) return true;
if(!$oDB->isIndexExists('sites','unique_domain')) return true;
@ -83,12 +75,11 @@
}
/**
* @brief 업데이트 실행
* @brief Execute update
**/
function moduleUpdate() {
$oDB = &DB::getInstance();
// 2008. 10. 27 module_part_config 테이블의 결합 인덱스 추가하고 기존에 module_config에 몰려 있던 모든 정보를 재점검
// 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg
if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) {
$oModuleModel = &getModel('module');
$oModuleController = &getController('module');
@ -140,43 +131,35 @@
}
$oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl"));
}
// 2008. 11. 13 modules 의 mid를 unique를 없애고 site_srl을 추가 후에 site_srl + mid unique index
// 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns
if(!$oDB->isIndexExists('modules',"idx_site_mid")) {
$oDB->dropIndex("modules","unique_mid",true);
$oDB->addColumn('modules','site_srl','number',11,0,true);
$oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true);
}
// document 확장변수의 확장을 위한 처리
// document extra vars
if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml');
if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml');
// 모든 모듈의 권한, 스킨정보, 확장정보, 관리자 아이디를 grants 테이블로 이전시키는 업데이트
// Move permission, skin info, extection info, admin ID of all modules to the table, grants
if($oDB->isColumnExists('modules', 'grants')) {
$oModuleController = &getController('module');
$oDocumentController = &getController('document');
// 현재 시스템 언어 코드값을 가져옴
// Get a value of the current system language code
$lang_code = Context::getLangType();
// 모든 모듈의 module_info를 가져옴
// Get module_info of all modules
$output = executeQueryArray('module.getModuleInfos');
if(count($output->data)) {
foreach($output->data as $module_info) {
// 모듈들의 권한/ 확장변수(게시글 확장 포함)/ 스킨 변수/ 최고관리권한 정보 분리
// Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority
$module_srl = trim($module_info->module_srl);
// 권한 등록
// grant an authority
$grants = unserialize($module_info->grants);
if($grants) $oModuleController->insertModuleGrants($module_srl, $grants);
// 스킨 변수 등록
// Insert skin vars
$skin_vars = unserialize($module_info->skin_vars);
if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars);
// 최고 관리자 아이디 등록
// Insert super admin's ID
$admin_id = trim($module_info->admin_id);
if($admin_id && $admin_id != 'Array') {
$admin_ids = explode(',',$admin_id);
@ -186,8 +169,7 @@
}
}
}
// 모듈별 추가 설정 저장 (기본 modules에 없던 컬럼 데이터)
// Save extra configurations for each module(column data which doesn't exist in the defaut modules)
$extra_vars = unserialize($module_info->extra_vars);
$document_extra_keys = null;
if($extra_vars->extra_vars && count($extra_vars->extra_vars)) {
@ -197,9 +179,9 @@
if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars);
/**
* 게시글 확장변수 이동 (documents모듈에서 해야 하지만 modules 테이블의 추가 변수들이 정리되기에 여기서 )
* Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module)
**/
// 플래닛모듈의 경우 직접 추가 변수 입력
// Insert extra vars if planet module is
if($module_info->module == 'planet') {
if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array();
$planet_extra_keys->name = 'postscript';
@ -210,22 +192,19 @@
$planet_extra_keys->desc = '';
$document_extra_keys[20] = $planet_extra_keys;
}
// 게시글 확장변수 키 등록
// Register keys for document extra vars
if(count($document_extra_keys)) {
foreach($document_extra_keys as $var_idx => $val) {
$oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx);
}
// 2009-04-14 #17923809 게시물 100개의 확장 변수만 이전되는 문제점 수정
// 2009-04-14 Fixed a bug that only 100 extra vars are moved
$oDocumentModel = &getModel('document');
$total_count = $oDocumentModel->getDocumentCount($module_srl);
if ($total_count > 0) {
$per_page = 100;
$total_pages = (int) (($total_count - 1) / $per_page) + 1;
// 확장변수가 존재하면 확장변수 가져오기
// Get extra vars if exist
$doc_args = null;
$doc_args->module_srl = $module_srl;
$doc_args->list_count = $per_page;
@ -248,8 +227,7 @@
} // for total_pages
} // if count
}
// 해당 모듈들의 추가 변수들 제거
// Additional variables of the module, remove
$module_info->grant = null;
$module_info->extra_vars = null;
$module_info->skin_vars = null;
@ -257,30 +235,26 @@
executeQuery('module.updateModule', $module_info);
}
}
// 각종 column drop
// Various column drop
$oDB->dropColumn('modules','grants');
$oDB->dropColumn('modules','admin_id');
$oDB->dropColumn('modules','skin_vars');
$oDB->dropColumn('modules','extra_vars');
}
// 모든 모듈의 권한/스킨정보를 grants 테이블로 이전시키는 업데이트
// Rights of all modules/skins transferring the information into a table Update grants
if(!$oDB->isColumnExists('sites', 'default_language')) {
$oDB->addColumn('sites','default_language','varchar',255,0,false);
}
// extra_vars* 컬럼 제거
// extra_vars * Remove Column
for($i=1;$i<=20;$i++) {
if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue;
$oDB->dropColumn('documents','extra_vars'.$i);
}
// sites 테이블에 기본 사이트 정보 입력
// Enter the main site information sites on the table
$args->site_srl = 0;
$output = $oDB->executeQuery('module.getSite', $args);
if(!$output->data) {
// 기본 mid, 언어 구함
// Basic mid, language Wanted
$mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args);
$db_info = Context::getDBInfo();
$domain = Context::getDefaultUrl();
@ -348,19 +322,16 @@
}
/**
* @brief 캐시 파일 재생성
* @brief Re-generate the cache file
**/
function recompileCache() {
// 모듈 정보 캐시 파일 모두 삭제
// Delete all cache files, the module information
FileHandler::removeFilesInDir("./files/cache/module_info");
// 트리거 정보가 있는 파일 모두 삭제
// Delete all the files that trigger information
FileHandler::removeFilesInDir("./files/cache/triggers");
// DB캐시 파일을 모두 삭제
// DB cache, delete all the files
FileHandler::removeFilesInDir("./files/cache/db");
// 기타 캐시 삭제
// Other Cache
FileHandler::removeDir("./files/cache/tmp");
}
}

Some files were not shown because too many files have changed in this diff Show more