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

@ -4,7 +4,7 @@
/**
* @file autolink.addon.php
* @author NHN (developers@xpressengine.com)
* @brief 자동 링크 애드온
* @brief Automatic link add-on
**/
if($called_position == 'after_module_proc' && Context::getResponseMethod()!="XMLRPC") {
Context::addJsFile('./addons/autolink/autolink.js', false ,'', null, 'body');

View file

@ -4,57 +4,47 @@
/**
* @file blogapicounter.addon.php
* @author NHN (developers@xpressengine.com)
* @brief blogAPI 애드온
* @brief Add blogAPI
*
* ms live writer, 파이어폭스의 performancing, zoundry 등의 외부 툴을 이용하여 글을 입력할 있게 합니다.
* 모듈 실행 이전(before_module_proc) 호출이 되어야 하며 정상동작후에는 강제 종료를 한다.
* It enables to write a post by using an external tool such as ms live writer, firefox performancing, zoundry and so on.
* It should be called before executing the module(before_module_proc). If not, it is forced to shut down.
**/
// called_position가 after_module_proc일때 rsd 태그 삽입
// Insert a rsd tag when called_position is after_module_proc
if($called_position == 'after_module_proc') {
// 현재 모듈의 rsd주소를 만듬
// Create rsd address of the current module
$site_module_info = Context::get('site_module_info');
$rsd_url = getFullSiteUrl($site_module_info->domain, '', 'mid',$site_module_info->mid, 'act','api');
// 헤더에 rsd태그 삽입
// Insert rsd tag into the header
Context::addHtmlHeader(" ".'<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.$rsd_url.'" />');
}
// act가 api가 아니면 그냥 리턴~
// If act isnot api, just return
if($_REQUEST['act']!='api') return;
// 관련 func 파일 읽음
// Read func file
require_once('./addons/blogapi/blogapi.func.php');
// xmlprc 파싱
// 요청된 xmlrpc를 파싱
// xmlprc parsing
// Parse the requested xmlrpc
$oXmlParser = new XmlParser();
$xmlDoc = $oXmlParser->parse();
$method_name = $xmlDoc->methodcall->methodname->body;
$params = $xmlDoc->methodcall->params->param;
if($params && !is_array($params)) $params = array($params);
// 일부 methodname에 대한 호환
// Compatible with some of methodname
if(in_array($method_name, array('metaWeblog.deletePost', 'metaWeblog.getUsersBlogs', 'metaWeblog.getUserInfo'))) {
$method_name = str_replace('metaWeblog.', 'blogger.', $method_name);
}
// blogger.deletePost일 경우 첫번째 인자 값 삭제
// Delete the first argument if it is blogger.deletePost
if($method_name == 'blogger.deletePost') array_shift($params);
// user_id, password를 구해서 로그인 시도
// Get user_id, password and attempt log-in
$user_id = trim($params[1]->value->string->body);
$password = trim($params[2]->value->string->body);
// 모듈 실행전이라면 인증을 처리한다.
// Before executing the module, authentication is processed.
if($called_position == 'before_module_init') {
// member controller을 이용해서 로그인 시도
// Attempt log-in by using member controller
if($user_id && $password) {
$oMemberController = &getController('member');
$output = $oMemberController->doLogin($user_id, $password);
// 로그인 실패시 에러 메시지 출력
// If login fails, an error message appears
if(!$output->toBool()) {
$content = getXmlRpcFailure(1, $output->getMessage());
printContent($content);
@ -64,25 +54,21 @@
printContent($content);
}
}
// 모듈에서 무언가 작업을 하기 전에 blogapi tool의 요청에 대한 처리를 하고 강제 종료한다.
// Before module processing, handle requests from blogapi tool and then terminate.
if($called_position == 'before_module_proc') {
// 글쓰기 권한 체크 (권한명의 경우 약속이 필요할듯..)
// Check writing permission
if(!$this->grant->write_document) {
printContent( getXmlRpcFailure(1, 'no permission') );
}
// 카테고리의 정보를 구해옴
// Get information of the categories
$oDocumentModel = &getModel('document');
$category_list = $oDocumentModel->getCategoryList($this->module_srl);
// 임시 파일 저장 장소 지정
// Specifies a temporary file storage
$tmp_uploaded_path = sprintf('./files/cache/blogapi/%s/%s/', $this->mid, $user_id);
$uploaded_target_path = sprintf('/files/cache/blogapi/%s/%s/', $this->mid, $user_id);
switch($method_name) {
// 블로그 정보
// Blog information
case 'blogger.getUsersBlogs' :
$obj->url = getFullSiteUrl('');
$obj->blogid = $this->mid;
@ -92,8 +78,7 @@
$content = getXmlRpcResponse($blog_list);
printContent($content);
break;
// 카테고리 목록 return
// Return a list of categories
case 'metaWeblog.getCategories' :
$category_obj_list = array();
if($category_list) {
@ -111,10 +96,9 @@
$content = getXmlRpcResponse($category_obj_list);
printContent($content);
break;
// 파일 업로드
// Upload file
case 'metaWeblog.newMediaObject' :
// 파일 업로드 권한 체크
// Check a file upload permission
$oFileModel = &getModel('file');
$file_module_config = $oFileModel->getFileModuleConfig($this->module_srl);
if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant)>0) {
@ -151,8 +135,7 @@
$content = getXmlRpcResponse($obj);
printContent($content);
break;
// 글 가져오기
// Get posts
case 'metaWeblog.getPost' :
$document_srl = $params[0]->value->string->body;
if(!$document_srl) {
@ -163,7 +146,7 @@
if(!$oDocument->isExists() || !$oDocument->isGranted()) {
printContent( getXmlRpcFailure(1, 'no permission') );
} else {
// 카테고리를 사용하는지 확인후 사용시 카테고리 목록을 구해와서 Context에 세팅
// Get a list of categories and set Context
$category = "";
if($oDocument->get('category_srl')) {
$oDocumentModel = &getModel('document');
@ -203,12 +186,11 @@
}
}
break;
// 글작성
// Write a new post
case 'metaWeblog.newPost' :
unset($obj);
$info = $params[3];
// 글, 제목, 카테고리 정보 구함
// Get information of post, title, and category
for($i=0;$i<count($info->value->struct->member);$i++) {
$val = $info->value->struct->member[$i];
switch($val->name->body) {
@ -239,13 +221,11 @@
}
}
// 문서 번호 설정
// Set document srl
$document_srl = getNextSequence();
$obj->document_srl = $document_srl;
$obj->module_srl = $this->module_srl;
// 첨부파일 정리
// Attachment
if(is_dir($tmp_uploaded_path)) {
$file_list = FileHandler::readDir($tmp_uploaded_path);
$file_count = count($file_list);
@ -276,8 +256,7 @@
printContent($content);
break;
// 글 수정
// Edit post
case 'metaWeblog.editPost' :
$tmp_val = $params[0]->value->string->body;
if(!$tmp_val) $tmp_val = $params[0]->value->i4->body;
@ -294,8 +273,7 @@
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
// 글 수정 권한 체크
// Check if a permission to modify a document is granted
if(!$oDocument->isGranted()) {
$content = getXmlRpcFailure(1, 'no permission');
break;
@ -304,8 +282,7 @@
$obj = $oDocument->getObjectVars();
$info = $params[3];
// 글, 제목, 카테고리 정보 구함
// Get information of post, title, and category
for($i=0;$i<count($info->value->struct->member);$i++) {
$val = $info->value->struct->member[$i];
switch($val->name->body) {
@ -336,12 +313,10 @@
}
}
// 문서 번호 설정
// Document srl
$obj->document_srl = $document_srl;
$obj->module_srl = $this->module_srl;
// 첨부파일 정리
// Attachment
if(is_dir($tmp_uploaded_path)) {
$file_list = FileHandler::readDir($tmp_uploaded_path);
$file_count = count($file_list);
@ -374,27 +349,22 @@
printContent($content);
break;
// 글삭제
// Delete the post
case 'blogger.deletePost' :
$tmp_val = $params[0]->value->string->body;
$tmp_arr = explode('/', $tmp_val);
$document_srl = array_pop($tmp_arr);
// 글 받아오기
// Get a document
$oDocumentModel = &getModel('document');
$oDocument = $oDocumentModel->getDocument($document_srl);
// 글 존재
// If the document exists
if(!$oDocument->isExists()) {
$content = getXmlRpcFailure(1, 'not exists');
// 글 삭제 권한 체크
// Check if a permission to delete a document is granted
} elseif(!$oDocument->isGranted()) {
$content = getXmlRpcFailure(1, 'no permission');
break;
// 삭제
// Delete
} else {
$oDocumentController = &getController('document');
$output = $oDocumentController->deleteDocument($document_srl);
@ -404,14 +374,13 @@
printContent($content);
break;
// 최신글 받기
// Get recent posts
case 'metaWeblog.getRecentPosts' :
// 목록을 구하기 위한 옵션
$args->module_srl = $this->module_srl; ///< 현재 모듈의 module_srl
// Options to get a list
$args->module_srl = $this->module_srl; // /< module_srl of the current module
$args->page = 1;
$args->list_count = 20;
$args->sort_index = 'list_order'; ///< 소팅 값
$args->sort_index = 'list_order'; // /< Sorting values
$logged_info = Context::get('logged_info');
$args->search_target = 'member_srl';
$args->search_keyword = $logged_info->member_srl;
@ -441,8 +410,7 @@
printContent($content);
}
break;
// 아무런 요청이 없을 경우 RSD 출력
// Display RSD if there is no request
default :
$homepagelink = getUrl('','mid',$this->mid);

View file

@ -4,10 +4,10 @@
/**
* @file ./addons/blogapi/blogapi.func.php
* @author NHN (developers@xpressengine.com)
* @brief blogapi구현을 위한 함수 모음집
* @brief Function collections for the implementation of blogapi
**/
// 오류 표시
// Error messages
function getXmlRpcFailure($error, $message) {
return
sprintf(
@ -16,8 +16,7 @@
htmlspecialchars($message)
);
}
// 결과 표시
// Display results
function getXmlRpcResponse($params) {
$buff = '<?xml version="1.0" encoding="utf-8"?>'."\n<methodResponse><params>";
$buff .= _getEncodedVal($params);
@ -25,8 +24,7 @@
return $buff;
}
// 인코딩 처리
// Encoding
function _getEncodedVal($val, $is_sub_set = false) {
if(is_int($val)) $buff = sprintf("<value><i4>%d</i4></value>", $val);
elseif(is_string($val)&&preg_match('/^([0-9]+)T([0-9\:]+)$/', $val)) $buff = sprintf("<value><dateTime.iso8601>%s</dateTime.iso8601></value>\n", $val);
@ -53,8 +51,7 @@
if(!$is_sub_set) return sprintf("<param>\n%s</param>", $buff);
return $buff;
}
// 결과 출력
// Display the result
function printContent($content) {
header("Content-Type: text/xml; charset=UTF-8");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");

View file

@ -4,8 +4,8 @@
/**
* @file captcha.addon.php
* @author NHN (developers@xpressengine.com)
* @brief 특정 action을 실행할때 captcha를 띄우도록
* 영어 알파벳을 입력, 음성기능 추가
* @brief Captcha for a particular action
* English alphabets and voice verification added
**/
if(!class_exists('AddonCaptcha'))
@ -43,8 +43,8 @@
Context::addHtmlHeader('<script type="text/javascript"> var captchaTargetAct = new Array("'.implode('","',$target_acts).'"); </script>');
Context::addJsFile('./addons/captcha/captcha.js',false, '', null, 'body');
}
// compare session when calling actions such as writing a post or a comment on the board/issue tracker module
// 게시판/ 이슈트래커의 글쓰기/댓글쓰기 액션 호출시 세션 비교
if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $target_acts)) {
Context::loadLang('./addons/captcha/lang');
$ModuleHandler->error = "captcha_denied";
@ -56,11 +56,11 @@
function before_module_init_setCaptchaSession()
{
if($_SESSION['captcha_authed']) return false;
// Load language files
// 언어파일 로드
Context::loadLang(_XE_PATH_.'addons/captcha/lang');
// Generate keywords
// 키워드 생성
$arr = range('A','Y');
shuffle($arr);
$arr = array_slice($arr,0,6);
@ -106,31 +106,31 @@
{
$arr = array();
for($i=0,$c=strlen($string);$i<$c;$i++) $arr[] = $string{$i};
// Font site
// 글자 하나 사이즈
$w = 18;
$h = 25;
// Character length
// 글자 수
$c = count($arr);
// Character image
// 글자 이미지
$im = array();
// Create an image by total size
// 총사이즈로 바탕 이미지 생성
$im[] = imagecreate(($w+2)*count($arr), $h);
$deg = range(-30,30);
shuffle($deg);
// Create an image for each letter
// 글자별 이미지 생성
foreach($arr as $i => $str)
{
$im[$i+1] = @imagecreate($w, $h);
$background_color = imagecolorallocate($im[$i+1], 255, 255, 255);
$text_color = imagecolorallocate($im[$i+1], 0, 0, 0);
// Control font size
// 글자폰트(사이즈) 조절
$ran = range(1,20);
shuffle($ran);
@ -148,22 +148,23 @@
}
}
// 각글자 이미지를 합침
// Combine images of each character
for($i=1;$i<count($im);$i++)
{
imagecopy($im[0],$im[$i],(($w+2)*($i-1)),0,0,0,$w,$h);
imagedestroy($im[$i]);
}
// Larger image
// 이미지 확대
$big_count = 2;
$big = imagecreatetruecolor(($w+2)*$big_count*$c, $h*$big_count);
imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w+2)*$big_count*$c, $h*$big_count, ($w+2)*$c, $h);
imagedestroy($im[0]);
if(function_exists('imageantialias')) imageantialias($big,true);
// Background line
// 배경 라인 및 점찍기
$line_color = imagecolorallocate($big, 0, 0, 0);
$w = ($w+2)*$big_count*$c;
@ -207,8 +208,8 @@
{
$_data = FileHandler::readFile(sprintf($_audio, $string{$i}));
$start = rand(5, 68); // 해더 4바이트, 데이터 영역 64바이트 정도 랜덤하게 시작
$datalen = strlen($_data) - $start - 256; // 마지막 unchanged 256 바이트
$start = rand(5, 68); // Random start in 4-byte header and 64 byte data
$datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes
for($j=$start;$j<$datalen;$j+=64)
{

View file

@ -4,9 +4,9 @@
/**
* @file counter.addon.php
* @author NHN (developers@xpressengine.com)
* @brief 카운터 애드온
* @brief Counter add-on
**/
// called_position가 before_display_content 일 경우 실행
// Execute if called_position is before_display_content
if(Context::isInstalled() && $called_position == 'before_module_init' && Context::get('module')!='admin' && Context::getResponseMethod() == 'HTML') {
$oCounterController = &getController('counter');
$oCounterController->procCounterExecute();

View file

@ -4,31 +4,27 @@
/**
* @file member_communication.addon.php
* @author NHN (developers@xpressengine.com)
* @brief 사용자의 커뮤니케이션 기능을 활성화
* @brief Promote user communication
*
* - 새로운 쪽지가 왔을 경우 팝업으로 띄움
* - MemberModel::getMemberMenu 호출시 대상이 회원일 경우 쪽지 보내기 기능 추가합니다.
* - MemberModel::getMemberMenu 호출시 친구 등록 메뉴를 추가합니다.
* - Pop-up the message if new message comes in
* - When calling MemberModel::getMemberMenu, feature to send a message is added
* - When caliing MemberModel::getMemberMenu, feature to add a friend is added
**/
// 비로그인 사용자면 중지
// Stop if non-logged-in user is
$logged_info = Context::get('logged_info');
if(!$logged_info) return;
/**
* 기능 수행 : 팝업 회원정보 보기에서 쪽지/친구 메뉴 추가. 시작할때 새쪽지가 왔는지 검사
* Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received
**/
if($called_position == 'before_module_init' && $this->module != 'member') {
// 커뮤니케이션 모듈의 언어파일을 읽음
// Load a language file from the communication module
Context::loadLang('./modules/communication/lang');
// 회원 로그인 정보중에서 쪽지등의 메뉴를 추가
// Add menus on the member login information
$oMemberController = &getController('member');
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
// 새로운 쪽지에 대한 플래그가 있으면 쪽지 보기 팝업 띄움
// Pop-up to display messages if a flag on new message is set
$flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl);
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
@ -43,41 +39,33 @@
}
/**
* 기능 수행 : 사용자 이름을 클릭시 요청되는 팝업메뉴의 메뉴에 쪽지 발송, 친구추가등의 링크 추가
* Links are added on the pop-up menu which appears when clicking user name
**/
} elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu') {
$oMemberController = &getController('member');
$member_srl = Context::get('target_srl');
$mid = Context::get('cur_mid');
// communication 모델 객체 생성
// Creates communication model object
$oCommunicationModel = &getModel('communication');
// 자신이라면 쪽지함 보기 기능 추가
// Add a feature to display own message box.
if($logged_info->member_srl == $member_srl) {
// 자신의 쪽지함 보기 기능 추가
// Add your own viewing Note Template
$oMemberController->addMemberPopupMenu(getUrl('','mid',$mid,'act','dispCommunicationMessages'), 'cmd_view_message_box', './modules/communication/tpl/images/icon_message_box.gif', 'self');
// 친구 목록 보기
// Display a list of friends
$oMemberController->addMemberPopupMenu(getUrl('','mid',$mid,'act','dispCommunicationFriend'), 'cmd_view_friend', './modules/communication/tpl/images/icon_friend_box.gif', 'self');
// 아니라면 쪽지 발송, 친구 등록 추가
// If not, Add menus to send message and to add friends
} else {
// 대상 회원의 정보를 가져옴
// Get member information
$oMemberModel = &getModel('member');
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
if(!$target_member_info->member_srl) return;
// 로그인된 사용자 정보를 구함
// Get logged-in user information
$logged_info = Context::get('logged_info');
// 쪽지 발송 메뉴를 만듬
// Add a menu for sending message
if( $logged_info->is_admin == 'Y' || $target_member_info->allow_message =='Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl)))
$oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationSendMessage','receiver_srl',$member_srl), 'cmd_send_message', './modules/communication/tpl/images/icon_write_message.gif', 'popup');
// 친구 등록 메뉴를 만듬 (이미 등록된 친구가 아닐 경우)
// Add a menu for listing friends (if a friend is new)
if(!$oCommunicationModel->isAddedFriend($member_srl))
$oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationAddFriend','target_srl',$member_srl), 'cmd_add_friend', './modules/communication/tpl/images/icon_add_friend.gif', 'popup');
}

View file

@ -4,20 +4,18 @@
/**
* @file image_name.addon.php
* @author NHN (developers@xpressengine.com)
* @brief 사용자의 이미지이름/ 이미지마크등을 출력
* @brief Display user image name/image mark
*
* <div class="member_회원번호">....</div> 정의가 부분을 찾아 회원번호를 구해서
* 이미지이름, 이미지마크가 있는지를 확인하여 있으면 내용을 변경해버립니다.
* Find member_srl in the part with <div class="member_회원번호"> .... </div>
* Check if ther is image name and image mark. Then change it.
**/
/**
* 출력되기 바로 직전일 경우에 이미지이름/이미지마크등을 변경
* Just before displaying, change image name/ image mark
**/
if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return;
// 회원 이미지이름/ 마크/ 찾아서 대체할 함수를 담고 있는 파일을 include
// Include a file having functions to replace member image name/mark
require_once('./addons/member_extra_info/member_extra_info.lib.php');
// 1. 출력문서중에서 <div class="member_번호">content</div>를 찾아 MemberController::transImageName() 를 이용하여 이미지이름/마크로 변경
// 1. Find a part <div class="member_번호"> content </div> in the output document, change it to image name/mark by using MemberController::transImageName()
$output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'memberTransImageName', $output);
?>

View file

@ -1,22 +1,19 @@
<?php
/**
* @brief div 또는 span에 member_번호 있을때 해당 회원 번호에 맞는 이미지이름이나 닉이미지를 대체
* @brief If member_srl exists in the div or span, replace to image name or nick image for each member_srl
**/
function memberTransImageName($matches) {
// 회원번호를 추출하여 0보다 찾으면 본문중 text만 return
// If member_srl < 0, then return text only in the body
$member_srl = $matches[3];
if($member_srl<0) return $matches[5];
$site_module_info = Context::get('site_module_info');
$oMemberModel = &getModel('member');
$group_image = $oMemberModel->getGroupImageMark($member_srl,$site_module_info->site_srl);
// 회원이 아닐경우(member_srl = 0) 본문 전체를 return
// If member_srl=o(not a member), return the entire body
$nick_name = $matches[5];
if(!$member_srl) return $matches[0];
// 전역변수에 미리 설정한 데이터가 있다면 그걸 return
// If pre-defined data in the global variablesm return it
if(!$GLOBALS['_transImageNameList'][$member_srl]->cached) {
$GLOBALS['_transImageNameList'][$member_srl]->cached = true;
$image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl);
@ -29,8 +26,7 @@
$image_name_file = $GLOBALS['_transImageNameList'][$member_srl]->image_name_file;
$image_mark_file = $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file;
}
// 이미지이름이나 마크가 없으면 원본 정보를 세팅
// If image name and mark doesn't exist, set the original information
if(!$image_name_file && !$image_mark_file && !$group_image) return $matches[0];
if($image_name_file) $nick_name = sprintf('<img src="%s%s" border="0" alt="id: %s" title="id: %s" style="vertical-align:middle;margin-right:3px" />', Context::getRequestUri(),$image_name_file, strip_tags($nick_name), strip_tags($nick_name));

View file

@ -13,7 +13,7 @@
}
/**
* @brief hdml 헤더 출력
* @brief hdml header output
**/
function printHeader() {
header("Content-Type:text/x-hdml; charset=".$this->charset);
@ -33,7 +33,7 @@
}
/**
* @brief 제목을 출력
* @brief Output title
**/
function printTitle() {
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
@ -41,8 +41,8 @@
}
/**
* @brief 내용을 출력
* hasChilds() 있으면 목록형을 그렇지 않으면 컨텐츠를 출력
* @brief Output information
* hasChilds() if there is a list of content types, otherwise output
**/
function printContent() {
if($this->hasChilds()) {
@ -56,10 +56,10 @@
}
/**
* @brief 버튼을 출력함
* @brief Button to output
**/
function printBtn() {
// 메뉴 형식
// Menu Types
if($this->hasChilds()) {
if($this->nextUrl) {
$url = $this->nextUrl;
@ -73,7 +73,7 @@
$url = $this->homeUrl;
printf('<ce task=go label="%s" dest="%s">%s%s', $url->text, $url->url, $url->text, "\n");
}
// 컨텐츠 형식
// Content Types
} else {
if($this->nextUrl) {
$url = $this->nextUrl;
@ -91,7 +91,7 @@
}
/**
* @brief 푸터 정보를 출력
* @brief Footer information output
**/
function printFooter() {
print $this->hasChilds()?'</choice>':'</display>';

View file

@ -13,23 +13,22 @@
}
/**
* @brief hdml 헤더 출력
* @brief hdml header output
**/
function printHeader() {
print("<html><head>\n");
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
printf("<title>%s%s</title></head><body>\n", htmlspecialchars($this->title),htmlspecialchars($titlePageStr));
}
// 제목을 출력
// Output title
function printTitle() {
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
printf('&lt;%s%s&gt;<br>%s', htmlspecialchars($this->title),htmlspecialchars($titlePageStr),"\n");
}
/**
* @brief 내용을 출력
* hasChilds() 있으면 목록형을 그렇지 않으면 컨텐츠를 출력
* @brief Output information
* hasChilds() if there is a list of content types, otherwise output
**/
function printContent() {
if($this->hasChilds()) {
@ -45,7 +44,7 @@
}
/**
* @brief 버튼을 출력함
* @brief Button to output
**/
function printBtn() {
if($this->nextUrl) {
@ -56,7 +55,7 @@
$url = $this->prevUrl;
printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
}
// 언어선택
// Select Language
if(!parent::isLangChange()){
$url = getUrl('','lcm','1','sel_lang',Context::getLangType(),'return_uri',Context::get('current_url'));
printf('<a href="%s">%s</a><br>%s', $url, 'Language : '.Context::getLang('select_lang'), "\n");
@ -73,8 +72,7 @@
printf('<a btn="%s" href="%s">%s</a><br>%s', $url->text, $url->url, $url->text, "\n");
}
}
// 푸터 정보를 출력
// Footer information output
function printFooter() {
print("</body></html>\n");
}

View file

@ -2,48 +2,40 @@
/**
* Mobile XE Library Class ver 0.1
* @author NHN (developers@xpressengine.com) / lang_select : misol
* @brief WAP 태그 출력을 위한 XE 라이브러리
* @brief XE library for WAP tag output
**/
class mobileXE {
// 기본 url
// Base url
var $homeUrl = NULL;
var $upperUrl = NULL;
var $nextUrl = NULL;
var $prevUrl = NULL;
var $etcBtn = NULL;
// 메뉴 네비게이션을 위한 변수
// Variable for menu navigation
var $childs = null;
// 기본 변수
// Basic variable
var $title = NULL;
var $content = NULL;
var $mobilePage = 0;
var $totalPage = 1;
var $charset = 'UTF-8';
var $no = 0;
// 네비게이션 관련 변수
// Navigation-related variables
var $menu = null;
var $listed_items = null;
var $node_list = null;
var $index_mid = null;
// Navigation On/ Off 상태 값
// Navigation On/Off status value
var $navigationMode = 0;
// 현재 요청된 XE 모듈 정보
// XE module information currently requested
var $module_info = null;
// 현재 실행중인 모듈의 instance
// Currently running instance of the module
var $oModule = null;
// Deck size
var $deckSize = 1024;
// 언어 설정 변경
// Changing the language setting
var $languageMode = 0;
var $lang = null;
/**
@ -59,8 +51,7 @@
$class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType);
require_once($class_file);
// 모바일 언어설정 로드(쿠키가 안되어 생각해낸 방법...-캐시파일 재생성을 클릭하면 초기화된다..)
// Download mobile language settings (cookies, not willing to come up when you click create cache file ...- is initialized ..)
$this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php');
if($this->lang) {
$lang_supported = Context::get('lang_supported');
@ -85,7 +76,7 @@
* @brief constructor
**/
function mobileXE() {
// navigation mode 체크
// Check navigation mode
if(Context::get('nm')) {
$this->navigationMode = 1;
$this->cmid = (int)Context::get('cmid');
@ -98,16 +89,16 @@
}
/**
* @brief navigation mode 체크
* navigationMode 세팅과 모듈 정보의 menu_srl이 있어야 navigation mode = true로 return
* @brief Check navigation mode
* navigationMode settings and modules of information must be menu_srl return to navigation mode = true
**/
function isNavigationMode() {
return ($this->navigationMode && $this->module_info->menu_srl)?true:false;
}
/**
* @brief langchange mode 체크
* languageMode 세팅 있어야 true return
* @brief Check langchange mode
* true return should be set languageMode
**/
function isLangChange() {
if($this->languageMode) return true;
@ -115,12 +106,12 @@
}
/**
* @brief 언어 설정
* 쿠키가 안되기 때문에 휴대전화마다 고유한 파일로 언어설정을 저장하는 파일 생성
* @brief Language settings
* Cookies Since you set your phone to store language-specific file, file creation
**/
function setLangType() {
$lang_supported = Context::get('lang_supported');
// 언어 변수가 있는지 확인하고 변수가 유효한지 확인
// Make sure that the language variables and parameters are valid
if($this->lang && isset($lang_supported[$this->lang])) {
$langbuff = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php');
if($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php');
@ -130,7 +121,7 @@
}
/**
* @brief 현재 요청된 모듈 정보 세팅
* @brief Information currently requested module settings
**/
function setModuleInfo(&$module_info) {
if($this->module_info) return;
@ -138,21 +129,18 @@
}
/**
* @brief 현재 실행중인 모듈 instance 세팅
* @brief Set the module instance is currently running
**/
function setModuleInstance(&$oModule) {
if($this->oModule) return;
// instance 저장
// Save instance
$this->oModule = $oModule;
// 현재 모듈의 메뉴가 설정되어 있으면 메뉴 정리
// Of the current module if there is a menu by menu
$menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $this->module_info->menu_srl);
if(!file_exists($menu_cache_file)) return;
include $menu_cache_file;
// 정리된 menu들을 1차원으로 변경
// One-dimensional arrangement of menu changes
$this->getListedItems($menu->list, $listed_items, $node_list);
$this->listed_items = $listed_items;
@ -162,8 +150,7 @@
$k = array_keys($node_list);
$v = array_values($node_list);
$this->index_mid = $k[0];
// 현재 메뉴의 depth가 1이상이면 상위 버튼을 지정
// The depth of the current menu, the top button to specify if one or more
$cur_menu_item = $listed_items[$node_list[$this->module_info->mid]];
if($cur_menu_item['parent_srl']) {
$parent_srl = $cur_menu_item['parent_srl'];
@ -177,12 +164,12 @@
}
/**
* @brief 접속 브라우저의 헤더를 판단하여 브라우저 타입을 return
* 모바일 브라우저가 아닐 경우 null return
* @brief Access the browser's header to determine the return type of the browser
* Mobile browser, if not null return
**/
function getBrowserType() {
if(Context::get('smartphone')) return null;
// 브라우저 타입을 판별
// Determine the type of browser
$browserAccept = $_SERVER['HTTP_ACCEPT'];
$userAgent = $_SERVER['HTTP_USER_AGENT'];
$wap_sid = $_SERVER['HTTP_X_UP_SUBNO'];
@ -197,19 +184,18 @@
}
/**
* @brief charset 지정
* @brief Specify charset
**/
function setCharSet($charset = 'UTF-8') {
if(!$charset) $charset = 'UTF-8';
//SKT는 euc-kr만 지원
// SKT supports the euc-kr
if(Context::get('mobile_skt')==1) $charset = 'euc-kr';
$this->charset = $charset;
}
/**
* @brief 모바일 기기의 용량 제한에 다른 가상 페이지 지정
* @brief Limited capacity of mobile devices, specifying a different virtual page
**/
function setMobilePage($page=1) {
if(!$page) $page = 1;
@ -217,10 +203,10 @@
}
/**
* @brief 목록형 데이터 설정을 위한 child menu지정
* @brief Mokrokhyeong child menu for specifying the data set
**/
function setChilds($childs) {
// menu개수가 9개 이상일 경우 자체 페이징 처리
// If more than nine the number of menu paging processing itself
$menu_count = count($childs);
if($menu_count>9) {
$startNum = ($this->mobilePage-1)*9;
@ -235,8 +221,7 @@
$childs = $new_childs;
$this->totalPage = (int)(($menu_count-1)/9)+1;
// next/prevUrl 지정
// next/prevUrl specify
if($this->mobilePage>1) {
$url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage-1);
$text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage-1, $this->totalPage);
@ -253,21 +238,21 @@
}
/**
* @brief menu 출력대상이 있는지 확인
* @brief Check the menu to be output
**/
function hasChilds() {
return count($this->childs)?true:0;
}
/**
* @brief child menu반환
* @brief Returns the child menu
**/
function getChilds() {
return $this->childs;
}
/**
* @brief title 지정
* @brief Specify title
**/
function setTitle($title) {
$oModuleController = &getController('module');
@ -276,28 +261,24 @@
}
/**
* @brief title 반환
* @brief return title
**/
function getTitle() {
return $this->title;
}
/**
* @brief 컨텐츠 정리
* HTML 컨텐츠에서 텍스트와 링크만 추출하는 기능
* @brief Content Cleanup
* In HTML content, the ability to extract text and links
**/
function setContent($content) {
$oModuleController = &getController('module');
$allow_tag_array = array('<a>','<br>','<p>','<b>','<i>','<u>','<em>','<small>','<strong>','<big>','<table>','<tr>','<td>');
// 링크/ 줄바꿈, 강조만 제외하고 모든 태그 제거
// Links/wrap, remove all tags except gangjoman
$content = strip_tags($content, implode($allow_tag_array));
// 탭 여백 제거
// Margins tab removed
$content = str_replace("\t", "", $content);
// 2번 이상 반복되는 공백과 줄나눔을 제거
// Repeat two more times the space and remove julnanumeul
$content = preg_replace('/( ){2,}/s', '', $content);
$content = preg_replace("/([\r\n]+)/s", "\r\n", $content);
$content = preg_replace(array("/<a/i","/<\/a/i","/<b/i","/<\/b/i","/<br/i"),array('<a','</a','<b','</b','<br'),$content);
@ -306,8 +287,7 @@
while(strpos($content, '<br/><br/>')) {
$content = str_replace('<br/><br/>','<br/>',$content);
}
// 모바일의 경우 한 덱에 필요한 사이즈가 적어서 내용을 모두 페이지로 나눔
// If the required size of a deck of mobile content to write down all the dividing pages
$contents = array();
while($content) {
$tmp = $this->cutStr($content, $this->deckSize, '');
@ -335,8 +315,7 @@
}
$this->totalPage = count($contents);
// next/prevUrl 지정
// next/prevUrl specify
if($this->mobilePage>1) {
$url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage-1);
$text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage-1, $this->totalPage);
@ -355,21 +334,21 @@
}
/**
* @brief byte수로 자르는 함수
* @brief cutting the number of byte functions
**/
function cutStr($string, $cut_size) {
return preg_match('/.{'.$cut_size.'}/su', $string, $arr) ? $arr[0] : $string;
}
/**
* @brief 컨텐츠 반환
* @brief Return content
**/
function getContent() {
return $this->content;
}
/**
* @brief home url 지정
* @brief Specifies the home url
**/
function setHomeUrl($url, $text) {
if(!$url) $url = '#';
@ -378,7 +357,7 @@
}
/**
* @brief upper url 지정
* @brief Specify upper url
**/
function setUpperUrl($url, $text) {
if(!$url) $url = '#';
@ -387,7 +366,7 @@
}
/**
* @brief prev url 지정
* @brief Specify prev url
**/
function setPrevUrl($url, $text) {
if(!$url) $url = '#';
@ -396,7 +375,7 @@
}
/**
* @brief next url 지정
* @brief Specify next url
**/
function setNextUrl($url, $text) {
if(!$url) $url = '#';
@ -405,7 +384,7 @@
}
/**
* @brief 다음, 이전, 상위 이외에 기타 버튼 지정
* @brief Next, Previous, Top button assignments other than
**/
function setEtcBtn($url, $text) {
if(!$url) $url = '#';
@ -418,32 +397,25 @@
* @brief display
**/
function display() {
// 홈버튼 지정
// Home button assignments
$this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home'));
// 제목 지정
// Specify the title
if(!$this->title) $this->setTitle(Context::getBrowserTitle());
ob_start();
// 헤더를 출력
// Output header
$this->printHeader();
// 제목을 출력
// Output title
$this->printTitle();
// 내용 출력
// Information output
$this->printContent();
// 버튼 출력
// Button output
$this->printBtn();
// 푸터를 출력
// Footer output
$this->printFooter();
$content = ob_get_clean();
// 변환 후 출력
// After conversion output
if(strtolower($this->charset) == 'utf-8') print $content;
else print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content);
@ -451,7 +423,7 @@
}
/**
* @brief 페이지 이동
* @brief Move page
**/
function movepage($url) {
header("location:$url");
@ -459,7 +431,7 @@
}
/**
* @brief 목록등에서 일련 번호를 리턴한다
* @brief And returns a list of serial numbers in
**/
function getNo() {
$this->no++;
@ -468,7 +440,7 @@
}
/**
* @brief XEMenu 모듈이 값을 사용하기 쉽게 정리해주는 함수
* @brief XE is easy to use Menu module is relieved during the function, value
**/
function getListedItems($menu, &$listed_items, &$node_list) {
if(!count($menu)) return;
@ -486,7 +458,7 @@
}
/**
* @brief XE 네비게이션 출력
* @brief XE navigation output
**/
function displayNavigationContent() {
$childs = array();
@ -523,13 +495,12 @@
}
$this->setChilds($childs);
}
// 출력
// Output
$this->display();
}
/**
* @brief 언어설정 메뉴 출력
* @brief Language Settings menu, the output
**/
function displayLangSelect() {
$childs = array();
@ -561,37 +532,33 @@
}
/**
* @brief 모듈의 WAP 클래스 객체 생성하여 WAP 준비
* @brief Module to create a class object of the WAP WAP ready
**/
function displayModuleContent() {
// 선택된 모듈의 WAP class 객체 생성
// Create WAP class objects of the selected module
$oModule = &getWap($this->module_info->module);
if(!$oModule || !method_exists($oModule, 'procWAP') ) return;
$vars = get_object_vars($this->oModule);
if(count($vars)) foreach($vars as $key => $val) $oModule->{$key} = $val;
// 실행
// Run
$oModule->procWAP($this);
// 출력
// Output
$this->display();
}
/**
* @brief WAP 컨텐츠를 별도로 구할 없으면 최종 결과물을 출력
* @brief WAP content is available as a separate output if the final results
**/
function displayContent() {
Context::set('layout','none');
// 템플릿 컴파일
// Compile a template
$oTemplate = new TemplateHandler();
$oContext = &Context::getInstance();
$content = $oTemplate->compile($this->oModule->getTemplatePath(), $this->oModule->getTemplateFile());
$this->setContent($content);
// 출력
// Output
$this->display();
}
}

View file

@ -13,19 +13,19 @@
}
/**
* @brief wml 헤더 출력
* @brief wml header output
**/
function printHeader() {
header("Content-Type: text/vnd.wap.wml");
header("charset: ".$this->charset);
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
print("<?xml version=\"1.0\" encoding=\"".$this->charset."\"?><!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\" \"http://www.wapforum.org/DTD/wml_1.1.xml\">\n");
// 카드제목
// Card Title
printf("<wml>\n<card title=\"%s%s\">\n<p>\n",htmlspecialchars($this->title),htmlspecialchars($titlePageStr));
}
/**
* @brief 제목을 출력
* @brief Output title
**/
function printTitle() {
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
@ -33,8 +33,8 @@
}
/**
* @brief 내용을 출력
* hasChilds() 있으면 목록형을 그렇지 않으면 컨텐츠를 출력
* @brief Output information
* hasChilds() if there is a list of content types, otherwise output
**/
function printContent() {
if($this->hasChilds()) {
@ -50,7 +50,7 @@
}
/**
* @brief 버튼을 출력함
* @brief Button to output
**/
function printBtn() {
if($this->nextUrl) {
@ -61,7 +61,7 @@
$url = $this->prevUrl;
printf('<do type="vnd.prev" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
}
// 기타 해당사항 없는 버튼 출력 담당 (array로 전달) type??
// Others are not applicable in charge of the button output (array passed) type??
if($this->etcBtn) {
if(is_array($this->etcBtn)) {
foreach($this->etcBtn as $key=>$val) {
@ -69,7 +69,7 @@
}
}
}
// 언어선택
// Select Language
if(!parent::isLangChange()){
$url = getUrl('','lcm','1','sel_lang',Context::getLangType(),'return_uri',Context::get('current_url'));
printf('<do type="vnd.lang" label="%s"><go href="%s"/></do>%s', 'Language : '.Context::getLang('select_lang'), $url, "\n");
@ -86,13 +86,11 @@
printf('<do type="vnd.up" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
}
}
// 푸터 정보를 출력
// Footer information output
function printFooter() {
print("</p>\n</card>\n</wml>");
}
// 목록등에서 일련 번호를 리턴한다
// And returns a list of serial numbers in
function getNo() {
if(Context::get('mobile_skt')==1) {
return "vnd.skmn".parent::getNo();

View file

@ -1,11 +1,10 @@
<?php
/**
* @file addons/mobile/lang/jp.lang.php
* @author NHN (developers@xpressengine.com) 訳:ミニ
* @brief 日本語言語パッケージ
* @author NHN (developers@xpressengine.com) : ミニ
* @brief Japanese language package
**/
// 言語選択部分 by misol
// Choose the language part by misol
$lang->president_lang = '現在言語';
$lang->select_lang = '言語選択';
$lang->lang_return = '戻る';

View file

@ -2,10 +2,9 @@
/**
* @file addons/mobile/lang/ko.lang.php
* @author NHN (developers@xpressengine.com)
* @brief 한국어 언어팩 (기본적인 내용만 수록)
* @brief Korean language pack (only the more basic)
**/
// 언어 선택부분 by misol
// Language selection by misol
$lang->president_lang = '현재 언어';
$lang->select_lang = '언어 선택';
$lang->lang_return = '돌아가기';

View file

@ -2,10 +2,9 @@
/**
* @file addons/mobile/lang/ko.lang.php
* @author NHN (developers@xpressengine.com)
* @brief 한국어 언어팩 (기본적인 내용만 수록)
* @brief Korean language pack (only the more basic)
**/
// 언어 선택부분 by misol
// Language selection by misol
$lang->president_lang = 'Дейсвующй язык';
$lang->select_lang = 'Выбор языка';
$lang->lang_return = 'Вернуться';

View file

@ -1,8 +1,8 @@
<?php
/**
* @file addons/mobile/lang/zh-CN.lang.php
* @author NHN (developers@xpressengine.com) 翻译guny
* @brief 手机XE插件简体中文语言包
* @author NHN (developers@xpressengine.com) 翻译: guny
* @brief XE mobile phone plug-Simplified Chinese Language Pack
**/
$lang->cmd_go_upper = '上一级';

View file

@ -1,8 +1,8 @@
<?php
/**
* @file addons/mobile/lang/zh-TW.lang.php
* @author NHN (developers@xpressengine.com) 譯:royallin
* @brief XE行動上網正體中文語言
* @author NHN (developers@xpressengine.com) : royallin
* @brief XE Mobile Internet Traditional Chinese Language
**/
// lang select by misol
$lang->president_lang = '已選擇語言';

View file

@ -4,58 +4,47 @@
/**
* @file mobile.addon.php
* @author NHN (developers@xpressengine.com)
* @brief 모바일XE 애드온
* @brief Mobile XE add-on
*
* 헤더정보를 가로채서 모바일에서의 접속일 경우 WAP 태그로 컨텐츠를 출력함
* If a mobile connection is made (see the header information), display contents with WAP tags
*
* 동작 시점
* Time to call
*
* before_module_proc > 모바일 처리를 위해 모듈의 일반 설정을 변경해야 경우 호출
* before_module_proc > call when changing general settings for mobile
*
* after_module_proc > 모바일 컨텐츠 출력
* 동작 조건
* after_module_proc > display mobile content
* Condition
**/
// 관리자 페이지는 무시
// Ignore admin page
if(Context::get('module')=='admin') return;
// 동작 시점 관리
// Manage when to call it
if($called_position != 'before_module_proc' && $called_position != 'after_module_proc' ) return;
// 모바일 브라우저가 아니라면 무시
// Ignore if not mobile browser
require_once(_XE_PATH_.'addons/mobile/classes/mobile.class.php');
if(!mobileXE::getBrowserType()) return;
// mobile instance 생성
// Generate mobile instance
$oMobile = &mobileXE::getInstance();
if(!$oMobile) return;
// 애드온 설정에서 지정된 charset으로 지정
// Specify charset on the add-on settings
$oMobile->setCharSet($addon_info->charset);
// 모듈의 정보를 세팅
// Set module information
$oMobile->setModuleInfo($this->module_info);
// 현재 모듈 객체 등록
// Register the current module object
$oMobile->setModuleInstance($this);
// 네비게이트 모드이거나 WAP class가 있을 경우 미리 컨텐츠를 추출하여 출력/ 종료
// Extract content and display/exit if navigate mode is or if WAP class exists
if($called_position == 'before_module_proc') {
if($oMobile->isLangChange()) {
$oMobile->setLangType();
$oMobile->displayLangSelect();
}
// 네비게이트 모드이면 네비게이션 컨텐츠 출력
// On navigation mode, display navigation content
if($oMobile->isNavigationMode()) $oMobile->displayNavigationContent();
// WAP class가 있으면 WAP class를 통해 컨텐츠 출력
// If you have a WAP class content output via WAP class
else $oMobile->displayModuleContent();
// 네비게이트 모드가 아니고 WAP 클래스가 아니면 모듈의 결과를 출력
// If neither navigation mode nor WAP class is, display the module's result
} else if($called_position == 'after_module_proc') {
// 내용 준비
// Display
$oMobile->displayContent();
}
?>

View file

@ -4,16 +4,14 @@
/**
* @file openid_delegation_id.addon.php
* @author NHN (developers@xpressengine.com)
* @brief OpenID Delegation ID 애드온
* @brief OpenID Delegation ID Add-on
*
* 오픈아이디를 자신의 홈페이지나 블로그 주소로 이용할 있도록 해줍니다.
* 설정을 통해서 사용하시는 오픈아이디 서비스에 해당하는 정보를 입력해주세요.
* This enables to use openID as user's homepage or blog url.
* Enter your open ID service information on the configuration.
**/
// called_position이 before_module_init일때만 실행
// Execute only wen called_position is before_module_init
if($called_position != 'before_module_init') return;
// openid_delegation_id 애드온 설정 정보를 가져옴
// Get add-on settings(openid_delegation_id)
if(!$addon_info->server||!$addon_info->delegate||!$addon_info->xrds) return;
$header_script = sprintf(

View file

@ -4,12 +4,11 @@
/**
* @file point.addon.php
* @author NHN (developers@xpressengine.com)
* @brief 포인트 레벨 아이콘 표시 애드온
* @brief Icon-on-point level
*
* 포인트 시스템 사용중일때 사용자 이름 앞에 포인트 레벨 아이콘을 표시합니다.
* Display point level icon before user name when point system is enabled.
**/
// before_display_content 가 아니면 return
// return unless before_display_content
if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return;
require_once('./addons/point_level_icon/point_level_icon.lib.php');

View file

@ -1,34 +1,29 @@
<?php
/**
* @brief 포인트 아이콘 변경을 위한 함수.
* @brief Function to change point icon.
**/
function pointLevelIconTrans($matches) {
$member_srl = $matches[3];
if($member_srl<1) return $matches[0];
if(!isset($GLOBALS['_pointLevelIcon'][$member_srl])) {
// 포인트 설정을 구해옴
// Get point configuration
if(!$GLOBALS['_pointConfig']) {
$oModuleModel = &getModel('module');
$GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point');
}
$config = $GLOBALS['_pointConfig'];
// 포인트 모델을 구해 놓음
// Get point model
if(!$GLOBALS['_pointModel']) $GLOBALS['_pointModel'] = getModel('point');
$oPointModel = &$GLOBALS['_pointModel'];
// 포인트를 구함
// Get points
$point = $oPointModel->getPoint($member_srl);
// 레벨을 구함
// Get level
$level = $oPointModel->getLevel($point, $config->level_step);
$text = $matches[5];
// 레벨 아이콘의 위치를 구함
// Get a path where level icon is
$level_icon = sprintf('%smodules/point/icons/%s/%d.gif', Context::getRequestUri(), $config->level_icon, $level);
// 최고 레벨이 아니면 다음 레벨로 가기 위한 per을 구함 :: 주석과 실제 내용이 맞지 않아 실제 내용을 수정
// Get per to go to the next level if not a top level
if($level < $config->max_level) {
$next_point = $config->level_step[$level+1];
$present_point = $config->level_step[$level];

View file

@ -4,7 +4,7 @@
/**
* @file resize_image.addon.php
* @author NHN (developers@xpressengine.com)
* @brief 본문내 이미지 조절 애드온
* @brief Add-on to resize images in the body
**/
if($called_position == 'after_module_proc' && Context::getResponseMethod()=="HTML") {

View file

@ -857,7 +857,7 @@ class Context {
}
/**
* @brief 요청이 들어온 URL에서 argument를 제거하여 return
* @brief Return after removing an argument on the requested URL
**/
function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL, $domain = null) {
static $url = array();
@ -919,7 +919,7 @@ class Context {
}
/**
* @brief key값에 해당하는 값을 return
* @brief return key value
**/
function get($key) {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -927,9 +927,9 @@ class Context {
}
/**
* @brief 받고자 하는 변수만 object에 입력하여 받음
*
* key1, key2, key3 .. 등의 인자를 주어 여러개의 변수를 object vars로 세팅하여 받을 있음
* @brief get a specified var in object
*
* get one more vars in object vars with given arguments(key1, key2, key3,...)
**/
function gets() {
$num_args = func_num_args();
@ -944,7 +944,7 @@ class Context {
}
/**
* @brief 모든 데이터를 return
* @brief Return all data
**/
function getAll() {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -952,7 +952,7 @@ class Context {
}
/**
* @brief GET/POST/XMLRPC에서 넘어온 변수값을 return
* @brief Return values from the GET/POST/XMLRPC
**/
function getRequestVars() {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -960,8 +960,8 @@ class Context {
}
/**
* @brief SSL로 인증되어야 action이 있을 경우 등록
* common/js/xml_handler.js에서 action들에 대해서 https로 전송되도록
* @brief Register if actions is to be encrypted by SSL
* Those actions are sent to https in common/js/xml_handler.js
**/
function addSSLAction($action) {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -992,7 +992,7 @@ class Context {
}
/**
* @brief js file추가
* @brief Add the js file
**/
function addJsFile($file, $optimized = false, $targetie = '',$index=0, $type='head') {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -1009,7 +1009,7 @@ class Context {
}
/**
* @brief js file제거
* @brief Remove the js file
**/
function unloadJsFile($file, $optimized = false, $targetie = '') {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -1034,14 +1034,14 @@ class Context {
}
/**
* @brief javascript filter 추가
* @brief Add javascript filter
**/
function addJsFilter($path, $filename) {
$oXmlFilter = new XmlJSFilter($path, $filename);
$oXmlFilter->compile();
}
/**
* @brief array_unique와 동작은 동일하나 file 첨자에 대해서만 동작함
* @brief Same as array_unique but works only for file subscript
* @deprecated
**/
function _getUniqueFileList($files) {
@ -1080,7 +1080,7 @@ class Context {
}
/**
* @brief CSS file 추가
* @brief Add CSS file
**/
function addCSSFile($file, $optimized=false, $media='all', $targetie='',$index=0) {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -1092,7 +1092,7 @@ class Context {
}
/**
* @brief css file제거
* @brief Remove css file
**/
function unloadCSSFile($file, $optimized = false, $media = 'all', $targetie = '') {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -1163,7 +1163,7 @@ class Context {
}
/**
* @brief HtmlHeader 추가
* @brief Add HtmlHeader
**/
function addHtmlHeader($header) {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -1179,7 +1179,7 @@ class Context {
}
/**
* @brief Html Body에 css class 추가
* @brief Add css class to Html Body
**/
function addBodyClass($class_name) {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -1187,7 +1187,7 @@ class Context {
}
/**
* @brief Html Body에 css class return
* @brief Return css class to Html Body
**/
function getBodyClass() {
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
@ -1251,7 +1251,7 @@ class Context {
}
/**
* @brief 내용의 위젯이나 기타 기능에 대한 code를 실제 code로 변경
* @brief Transforms codes about widget or other features into the actual code, deprecatred
**/
function transContent($content) {
return $content;

View file

@ -241,7 +241,7 @@
}
/**
* @brief query xml 파일을 실행하여 결과를 return
* @brief Run the result of the query xml file
* @param[in] $query_id query id (module.queryname
* @param[in] $args arguments for query
* @return result of query

View file

@ -2,34 +2,34 @@
/**
* @class DBCubrid
* @author NHN (developers@xpressengine.com)
* @brief Cubrid DBMS이용하기 위한 class
* @brief Cubrid DBMS to use the class
* @version 0.1p1
*
* CUBRID2008 R1.3 대응하도록 수정 Prototype (prototype@cubrid.com) / 09.02.23
* 7.3 ~ 2008 R1.3 까지 테스트 완료함.
* 기본 쿼리만 사용하였기에 특화된 튜닝이 필요
* Modified to work with CUBRID2008 R1.3 verion by Prototype (prototype@cubrid.com)/09.02.23
* Test completed for CUBRID 7.3 ~ 2008 R1.3 versions.
* Only basic query used so query tunning and optimization needed
**/
class DBCubrid extends DB
{
/**
* @brief Cubrid DB에 접속하기 위한 정보
* @brief CUBRID DB connection information
**/
var $hostname = '127.0.0.1'; ///< hostname
var $userid = NULL; ///< user id
var $password = NULL; ///< password
var $database = NULL; ///< database
var $port = 33000; ///< db server port
var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE 설치 가능)
var $cutlen = 12000; ///< 큐브리드의 최대 상수 크기(스트링이 이보다 크면 '...'+'...' 방식을 사용해야 한다
var $prefix = 'xe'; // / <prefix of XE tables(One more XE can be installed on a single DB)
var $cutlen = 12000; // /< max size of constant in CUBRID(if string is larger than this, '...'+'...' should be used)
var $comment_syntax = '/* %s */';
/**
* @brief cubrid에서 사용될 column type
* @brief column type used in CUBRID
*
* column_typeschema/query xml에서 공통 선언된 type을 이용하기 때문에
* DBMS에 맞게 replace 해주어야 한다
* column_type should be replaced for each DBMS's type
* becasue it uses commonly defined type in the schema/query xml
**/
var $column_type = array(
'bignumber' => 'numeric(20)',
@ -61,7 +61,7 @@
}
/**
* @brief 설치 가능 여부를 return
* @brief Return if installable
**/
function isSupported()
{
@ -70,7 +70,7 @@
}
/**
* @brief DB정보 설정 connect/ close
* @brief DB settings and connect/close
**/
function _setDBInfo()
{
@ -86,17 +86,17 @@
}
/**
* @brief DB 접속
* @brief DB Connection
**/
function _connect()
{
// db 정보가 없으면 무시
// ignore if db information not exists
if (!$this->hostname || !$this->userid || !$this->password || !$this->database || !$this->port) return;
// 접속시도
// attempts to connect
$this->fd = @cubrid_connect ($this->hostname, $this->port, $this->database, $this->userid, $this->password);
// 접속체크
// check connections
if (!$this->fd) {
$this->setError (-1, 'database connect fail');
return $this->is_connected = false;
@ -107,7 +107,7 @@
}
/**
* @brief DB접속 해제
* @brief DB disconnect
**/
function close()
{
@ -119,7 +119,7 @@
}
/**
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
* @brief handles quatation of the string variables from the query
**/
function addQuotes($string)
{
@ -147,7 +147,7 @@
}
/**
* @brief 트랜잭션 시작
* @brief Begin transaction
**/
function begin()
{
@ -156,7 +156,7 @@
}
/**
* @brief 롤백
* @brief Rollback
**/
function rollback()
{
@ -166,7 +166,7 @@
}
/**
* @brief 커밋
* @brief Commit
**/
function commit()
{
@ -178,24 +178,24 @@
}
/**
* @brief : 쿼리문의 실행 결과의 fetch 처리
* @brief : executing the query and fetching the result
*
* query : query문 실행하고 result return\n
* fetch : reutrn 값이 없으면 NULL\n
* rows이면 array object\n
* row이면 object\n
* return\n
* query: run a query and return the result\n
* fetch: NULL if no value returned \n
* array object if rows returned \n
* object if a row returned \n
* return\n
**/
function _query($query)
{
if (!$query || !$this->isConnected ()) return;
// 쿼리 시작을 알림
// Notify to start a query execution
$this->actStart ($query);
// 쿼리 문 실행
// Execute the query
$result = @cubrid_execute ($this->fd, $query);
// 오류 체크
// error check
if (cubrid_error_code ()) {
$code = cubrid_error_code ();
$msg = cubrid_error_msg ();
@ -203,15 +203,15 @@
$this->setError ($code, $msg);
}
// 쿼리 실행 종료를 알림
// Notify to complete a query execution
$this->actFinish ();
// 결과 리턴
// Return the result
return $result;
}
/**
* @brief 결과를 fetch
* @brief Fetch the result
**/
function _fetch($result)
{
@ -246,7 +246,7 @@
}
/**
* @brief 1 증가되는 sequence 값을 return (cubrid의 auto_increment는 sequence테이블에서만 사용)
* @brief return the sequence value incremented by 1(auto_increment column only used in the CUBRID sequence table)
**/
function getNextSequence()
{
@ -260,7 +260,7 @@
}
/**
* @brief 마이그레이션시 sequence 없을 경우 생성
* @brief return if the table already exists
**/
function _makeSequence()
{
@ -302,7 +302,7 @@
/**
* @brief 테이블 기생성 여부 return
* brief return a table if exists
**/
function isTableExists ($target_name)
{
@ -327,7 +327,7 @@
}
/**
* @brief 특정 테이블에 특정 column 추가
* @brief add a column to the table
**/
function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = '', $notnull = false)
{
@ -362,7 +362,7 @@
}
/**
* @brief 특정 테이블에 특정 column 제거
* @brief drop a column from the table
**/
function dropColumn ($table_name, $column_name)
{
@ -372,7 +372,7 @@
}
/**
* @brief 특정 테이블의 column의 정보를 return
* @brief return column information of the table
**/
function isColumnExists ($table_name, $column_name)
{
@ -388,7 +388,7 @@
}
/**
* @brief 특정 테이블에 특정 인덱스 추가
* @brief add an index to the table
* $target_columns = array(col1, col2)
* $is_unique? unique : none
**/
@ -404,7 +404,7 @@
}
/**
* @brief 특정 테이블의 특정 인덱스 삭제
* @brief drop an index from the table
**/
function dropIndex ($table_name, $index_name, $is_unique = false)
{
@ -414,7 +414,7 @@
}
/**
* @brief 특정 테이블의 index 정보를 return
* @brief return index information of the table
**/
function isIndexExists ($table_name, $index_name)
{
@ -430,7 +430,7 @@
}
/**
* @brief xml 받아서 테이블을 생성
* @brief creates a table by using xml file
**/
function createTableByXml ($xml_doc)
{
@ -438,19 +438,19 @@
}
/**
* @brief xml 받아서 테이블을 생성
* @brief creates a table by using xml file
**/
function createTableByXmlFile ($file_name)
{
if (!file_exists ($file_name)) return;
// xml 파일을 읽음
// read xml file
$buff = FileHandler::readFile ($file_name);
return $this->_createTable ($buff);
}
/**
* @brief schema xml을 이용하여 create class query생성
* @brief create table by using the schema xml
*
* type : number, varchar, tinytext, text, bigtext, char, date, \n
* opt : notnull, default, size\n
@ -461,14 +461,13 @@
// xml parsing
$oXml = new XmlParser();
$xml_obj = $oXml->parse($xml_doc);
// 테이블 생성 schema 작성
// Create a table schema
$table_name = $xml_obj->table->attrs->name;
// if the table already exists exit function
if ($this->isTableExists($table_name)) return;
// 만약 테이블 이름이 sequence라면 serial 생성
// If the table name is sequence, it creates a serial
if ($table_name == 'sequence') {
$query = sprintf ('create serial "%s" start with 1 increment by 1'.
' minvalue 1 '.
@ -563,7 +562,7 @@
}
/**
* @brief 조건문 작성하여 return
* @brief return the condition
**/
function getCondition ($output)
{
@ -651,16 +650,16 @@
}
/**
* @brief insertAct 처리
* @brief handles insertAct
**/
function _executeInsertAct ($output)
{
// 테이블 정리
// tables
foreach ($output->tables as $val) {
$table_list[] = '"'.$this->prefix.$val.'"';
}
// 컬럼 정리
// columns
foreach ($output->columns as $key => $val) {
$name = $val['name'];
$value = $val['value'];
@ -699,18 +698,18 @@
}
/**
* @brief updateAct 처리
* @brief handles updateAct
**/
function _executeUpdateAct ($output)
{
// 테이블 정리
// tables
foreach ($output->tables as $key => $val) {
$table_list[] = '"'.$this->prefix.$val.'" as "'.$key.'"';
}
$check_click_count = true;
// 컬럼 정리
// columns
foreach ($output->columns as $key => $val) {
if (!isset ($val['value'])) continue;
$name = $val['name'];
@ -721,10 +720,10 @@
}
for ($i = 0; $i < $key; $i++) {
/* 한문장에 같은 속성에 대한 중복 설정은 큐브리드에서는 허용치 않음 */
// not allows to define the same property repeatedly in a single query in CUBRID
if ($output->columns[$i]['name'] == $name) break;
}
if ($i < $key) continue; // 중복이 발견되면 이후의 설정은 무시
if ($i < $key) continue; // ignore the rest of properties if duplicated property found
if (strpos ($name, '.') !== false && strpos ($value, '.') !== false) {
$column_list[] = $name.' = '.$value;
@ -742,7 +741,7 @@
}
}
// 조건절 정리
// conditional clause
$condition = $this->getCondition ($output);
$check_click_count_condition = false;
@ -792,16 +791,16 @@
}
/**
* @brief deleteAct 처리
* @brief handles deleteAct
**/
function _executeDeleteAct ($output)
{
// 테이블 정리
// tables
foreach ($output->tables as $val) {
$table_list[] = '"'.$this->prefix.$val.'"';
}
// 조건절 정리
// Conditional clauses
$condition = $this->getCondition ($output);
$query = sprintf ("delete from %s %s", implode (',',$table_list), $condition);
@ -812,14 +811,14 @@
}
/**
* @brief selectAct 처리
* @brief Handle selectAct
*
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
* navigation이라는 method를 제공
* to get a specific page list easily in select statement,\n
* a method, navigation, is used
**/
function _executeSelectAct ($output)
{
// 테이블 정리
// tables
$table_list = array ();
foreach ($output->tables as $key => $val) {
$table_list[] = '"'.$this->prefix.$val.'" as "'.$key.'"';
@ -966,7 +965,7 @@
}
// list_count를 사용할 경우 적용
// apply when using list_count
if ($output->list_count['value']) {
$start_count = 0;
$list_count = $output->list_count['value'];
@ -1050,7 +1049,7 @@
}
/**
* @brief 현재 시점의 Stack trace를 보여줌.결과를 fetch
* @brief displays the current stack trace. Fetch the result
**/
function backtrace ()
{
@ -1102,9 +1101,9 @@
}
/**
* @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다
* @brief paginates when navigation info exists in the query xml
*
* 그닥 좋지는 않은 구조이지만 편리하다.. -_-;
* it is convenient although its structure is not good .. -_-;
**/
function _getNavigationData ($table_list, $columns, $left_join, $condition, $output) {
require_once (_XE_PATH_.'classes/page/PageHandler.class.php');
@ -1129,7 +1128,7 @@
$page = $output->page['value'];
if (!$page) $page = 1;
// 전체 페이지를 구함
// total pages
if ($total_count) {
$total_page = (int) (($total_count - 1) / $list_count) + 1;
}
@ -1137,7 +1136,7 @@
$total_page = 1;
}
// 페이지 변수를 체크
// check the page variables
if ($page > $total_page) $page = $total_page;
$start_count = ($page - 1) * $list_count;

View file

@ -1,8 +1,8 @@
<?php
/**
* @class DBFriebird
* @author 김현식 (dev.hyuns@gmail.com)
* @brief Firebird DBMS이용하기 위한 class
* @class DBFirebird
* @author Kim Hyun Sik (dev.hyuns @ gmail.com)
* @brief class to use Firebird DBMS
* @version 0.3
*
* firebird handling class
@ -11,21 +11,21 @@
class DBFireBird extends DB {
/**
* @brief Firebird DB접속하기 위한 정보
* @brief connection to Firebird DB
**/
var $hostname = '127.0.0.1'; ///< hostname
var $userid = NULL; ///< user id
var $password = NULL; ///< password
var $database = NULL; ///< database
var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE 설치 가능)
var $idx_no = 0; // 인덱스 생성시 사용할 카운터
var $prefix = 'xe'; // / <prefix of XE tables(One more XE can be installed on a single DB)
var $idx_no = 0; // counter for creating an index
var $comment_syntax = '/* %s */';
/**
* @brief firebird에서 사용될 column type
* @brief column type used in firebird
*
* column_typeschema/query xml에서 공통 선언된 type을 이용하기 때문에
* DBMS에 맞게 replace 해주어야 한다
* column_type should be replaced for each DBMS's type
* becasue it uses commonly defined type in the schema/query xml
**/
var $column_type = array(
'bignumber' => 'BIGINT',
@ -55,7 +55,7 @@
}
/**
* @brief 설치 가능 여부를 return
* @brief Return if installable
**/
function isSupported() {
if(!function_exists('ibase_connect')) return false;
@ -63,7 +63,7 @@
}
/**
* @brief DB정보 설정 connect/ close
* @brief DB settings and connect/close
**/
function _setDBInfo() {
$db_info = Context::getDBInfo();
@ -77,16 +77,14 @@
}
/**
* @brief DB 접속
* @brief DB Connection
**/
function _connect() {
// db 정보가 없으면 무시
// ignore if db information not exists
if(!$this->hostname || !$this->port || !$this->userid || !$this->password || !$this->database) return;
//if(strpos($this->hostname, ':')===false && $this->port) $this->hostname .= ':'.$this->port;
// 접속시도
// attempts to connect
$host = $this->hostname."/".$this->port.":".$this->database;
$this->fd = @ibase_connect($host, $this->userid, $this->password);
@ -94,8 +92,7 @@
$this->setError(ibase_errcode(), ibase_errmsg());
return $this->is_connected = false;
}
// Firebird 버전 확인후 2.0 이하면 오류 표시
// Error when Firebird version is lower than 2.0
if (($service = ibase_service_attach($this->hostname, $this->userid, $this->password)) != FALSE) {
// get server version and implementation strings
$server_info = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
@ -118,14 +115,13 @@
@ibase_close($this->fd);
return $this->is_connected = false;
}
// 접속체크
// Check connections
$this->is_connected = true;
$this->password = md5($this->password);
}
/**
* @brief DB접속 해제
* @brief DB disconnect
**/
function close() {
if(!$this->isConnected()) return;
@ -135,7 +131,7 @@
}
/**
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
* @brief handles quatation of the string variables from the query
**/
function addQuotes($string) {
// if(get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string));
@ -144,7 +140,7 @@
}
/**
* @brief 쿼리에서 입력되는 table, column 명에 더블쿼터를 넣어줌
* @brief put double quotes for tabls, column names in the query statement
**/
function addDoubleQuotes($string) {
if($string == "*") return $string;
@ -162,12 +158,11 @@
}
/**
* @brief 쿼리에서 입력되는 table, column 명에 더블쿼터를 넣어줌
* @brief put double quotes for tabls, column names in the query statement
**/
function autoQuotes($string){
$string = strtolower($string);
// substr 함수 일경우
// for substr function
if(strpos($string, "substr(") !== false) {
$tokken = strtok($string, "(,)");
$tokken = strtok("(,)");
@ -190,8 +185,7 @@
$as = trim($as);
$as = $this->addDoubleQuotes($as);
}
// 함수 사용시
// for functions
$tmpFunc1 = null;
$tmpFunc2 = null;
if(($no1 = strpos($string,'('))!==false && ($no2 = strpos($string, ')'))!==false) {
@ -199,8 +193,7 @@
$tmpFunc2 = substr($string, $no2, strlen($string)-$no2+1);
$string = trim(substr($string, $no1+1, $no2-$no1-1));
}
// (테이블.컬럼) 구조 일때 처리
// for (table.column) structure
preg_match("/((?i)[a-z0-9_-]+)[.]((?i)[a-z0-9_\-\*]+)/", $string, $matches);
if($matches) {
@ -225,7 +218,7 @@
}
foreach($values as $val1) {
// (테이블.컬럼) 구조 일때 처리
// for (table.column) structure
preg_match("/((?i)[a-z0-9_-]+)[.]((?i)[a-z0-9_\-\*]+)/", $val1, $matches);
if($matches) {
$isTable = false;
@ -257,7 +250,7 @@
}
/**
* @brief 트랜잭션 시작
* @brief Begin transaction
**/
function begin() {
if(!$this->isConnected() || $this->transaction_started) return;
@ -265,7 +258,7 @@
}
/**
* @brief 롤백
* @brief Rollback
**/
function rollback() {
if(!$this->isConnected() || !$this->transaction_started) return;
@ -274,7 +267,7 @@
}
/**
* @brief 커밋
* @brief Commits
**/
function commit() {
if(!$force && (!$this->isConnected() || !$this->transaction_started)) return;
@ -283,48 +276,43 @@
}
/**
* @brief : 쿼리문의 실행 결과의 fetch 처리
* @brief : Run a query and fetch the result
*
* query : query문 실행하고 result return\n
* fetch : reutrn 값이 없으면 NULL\n
* rows이면 array object\n
* row이면 object\n
* return\n
* query: run a query and return the result\n
* fetch: NULL if no value returned \n
* array object if rows returned \n
* object if a row returned \n
* return\n
**/
function _query($query, $params=null) {
if(!$this->isConnected()) return;
if(count($params) == 0) {
// 쿼리 시작을 알림
// Notify to start a query execution
$this->actStart($query);
// 쿼리 문 실행
// Execute the query statement
$result = ibase_query($this->fd, $query);
}
else {
// 쿼리 시작을 알림
// Notify to start a query execution
$log = $query."\n\t\t\t";
$log .= implode(",", $params);
$this->actStart($log);
// 쿼리 문 실행 (blob type 입력하기 위한 방법)
// Execute the query(for blob type)
$query = ibase_prepare($this->fd, $query);
$fnarr = array_merge(array($query), $params);
$result = call_user_func_array("ibase_execute", $fnarr);
}
// 오류 체크
// Error Check
if(ibase_errmsg()) $this->setError(ibase_errcode(), ibase_errmsg());
// 쿼리 실행 종료를 알림
// Notify to complete a query execution
$this->actFinish();
// 결과 리턴
// Return the result
return $result;
}
/**
* @brief 결과를 fetch
* @brief Fetch the result
**/
function _fetch($result, $output = null) {
if(!$this->isConnected() || $this->isError() || !$result) return;
@ -332,12 +320,11 @@
while($tmp = ibase_fetch_object($result)) {
foreach($tmp as $key => $val) {
$type = $output->column_type[$key];
// type 값이 null 일때는 $key값이 alias인 경우라 실제 column 이름을 찾아 type을 구함
// type value is null when $key is an alias. so get a type by finding actual coloumn name
if($type == null && $output->columns && count($output->columns)) {
foreach($output->columns as $cols) {
if($cols['alias'] == $key) {
// table.column 형식인지 정규식으로 검사 함
// checks if the format is table.column or a regular expression
preg_match("/\w+[.](\w+)/", $cols['name'], $matches);
if($matches) {
$type = $output->column_type[$matches[1]];
@ -356,7 +343,7 @@
ibase_blob_close($blob_hndl);
}
else if($type == "char") {
$tmp->{$key} = trim($tmp->{$key}); // DB의 character set이 UTF8일때 생기는 빈칸을 제거
$tmp->{$key} = trim($tmp->{$key}); // remove blanks generated when DB character set is UTF8
}
}
@ -368,7 +355,7 @@
}
/**
* @brief 1 증가되는 sequence값을 return (firebird의 generator 값을 증가)
* @brief return sequence value incremented by 1(increase the value of the generator in firebird)
**/
function getNextSequence() {
$gen = "GEN_".$this->prefix."sequence_ID";
@ -377,7 +364,7 @@
}
/**
* @brief 테이블 기생성 여부 return
* @brief returns if the table already exists
**/
function isTableExists($target_name) {
$query = sprintf("select rdb\$relation_name from rdb\$relations where rdb\$system_flag=0 and rdb\$relation_name = '%s%s';", $this->prefix, $target_name);
@ -392,7 +379,7 @@
}
/**
* @brief 특정 테이블에 특정 column 추가
* @brief add a column to the table
**/
function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) {
$type = $this->column_type[$type];
@ -412,7 +399,7 @@
}
/**
* @brief 특정 테이블에 특정 column 제거
* @brief drop a column from the table
**/
function dropColumn($table_name, $column_name) {
$query = sprintf("alter table %s%s drop %s ", $this->prefix, $table_name, $column_name);
@ -422,7 +409,7 @@
/**
* @brief 특정 테이블의 column의 정보를 return
* @brief return column information of the table
**/
function isColumnExists($table_name, $column_name) {
$query = sprintf("SELECT RDB\$FIELD_NAME as \"FIELD\" FROM RDB\$RELATION_FIELDS WHERE RDB\$RELATION_NAME = '%s%s'", $this->prefix, $table_name);
@ -446,15 +433,14 @@
}
/**
* @brief 특정 테이블에 특정 인덱스 추가
* @brief add an index to the table
* $target_columns = array(col1, col2)
* $is_unique? unique : none
**/
function addIndex($table_name, $index_name, $target_columns, $is_unique = false) {
// index name 크기가 31byte로 제한으로 index name을 넣지 않음
// Firebird에서는 index name을 넣지 않으면 "RDB$10"처럼 자동으로 이름을 부여함
// table을 삭제 할 경우 인덱스도 자동으로 삭제 됨
// index name size should be limited to 31 byte. no index name assigned
// if index name omitted, Firebird automatically assign its name like "RDB $10"
// deletes indexes when deleting the table
if(!is_array($target_columns)) $target_columns = array($target_columns);
$query = sprintf('CREATE %s INDEX "" ON "%s%s" ("%s");', $is_unique?'UNIQUE':'', $this->prefix, $table_name, implode('", "',$target_columns));
@ -464,7 +450,7 @@
}
/**
* @brief 특정 테이블의 특정 인덱스 삭제
* @brief drop an index from the table
**/
function dropIndex($table_name, $index_name, $is_unique = false) {
$query = sprintf('DROP INDEX "%s" ON "%s%s"', $index_name, $this->prefix, $table_name);
@ -475,7 +461,7 @@
/**
* @brief 특정 테이블의 index 정보를 return
* @brief return index information of the table
**/
function isIndexExists($table_name, $index_name) {
$query = "SELECT\n";
@ -512,24 +498,24 @@
}
/**
* @brief xml 받아서 테이블을 생성
* @brief creates a table by using xml file
**/
function createTableByXml($xml_doc) {
return $this->_createTable($xml_doc);
}
/**
* @brief xml 받아서 테이블을 생성
* @brief creates a table by using xml file
**/
function createTableByXmlFile($file_name) {
if(!file_exists($file_name)) return;
// xml 파일을 읽음
// read xml file
$buff = FileHandler::readFile($file_name);
return $this->_createTable($buff);
}
/**
* @brief schema xml을 이용하여 create table query생성
* @brief create table by using the schema xml
*
* type : number, varchar, text, char, date, \n
* opt : notnull, default, size\n
@ -539,8 +525,7 @@
// xml parsing
$oXml = new XmlParser();
$xml_obj = $oXml->parse($xml_doc);
// 테이블 생성 schema 작성
// Create a table schema
$table_name = $xml_obj->table->attrs->name;
if($this->isTableExists($table_name)) return;
$table_name = $this->prefix.$table_name;
@ -596,10 +581,9 @@
if(count($index_list)) {
foreach($index_list as $key => $val) {
// index name 크기가 31byte로 제한으로 index name을 넣지 않음
// Firebird에서는 index name을 넣지 않으면 "RDB$10"처럼 자동으로 이름을 부여함
// table을 삭제 할 경우 인덱스도 자동으로 삭제 됨
// index name size should be limited to 31 byte. no index name assigned
// if index name omitted, Firebird automatically assign its name like "RDB $10"
// deletes indexes when deleting the table
$schema = sprintf("CREATE INDEX \"\" ON \"%s\" (\"%s\");",
$table_name, implode($val, "\",\""));
$output = $this->_query($schema);
@ -613,12 +597,11 @@
$output = $this->_query($schema);
if(!$this->transaction_started) @ibase_commit($this->fd);
if(!$output) return false;
// Firebird에서 auto increment는 generator를 만들어 insert 발생시 트리거를 실행시켜
// generator의 값을 증가시키고 그값을 테이블에 넣어주는 방식을 사용함.
// 아래 트리거가 auto increment 역할을 하지만 쿼리로 트리거 등록이 되지 않아 주석처리 하였음.
// php 함수에서 generator 값을 증가시켜 주는 함수가 있어 XE에서는 굳이
// auto increment를 사용 할 필요가 없어보임.
// auto_increment in Firebird creates a generator which activates a trigger when insert occurs
// the generator increases the value of the generator and then insert to the table
// The trigger below acts like auto_increment however I commented the below because the trigger cannot be defined by a query statement
// php api has a function to increase a generator, so
// no need to use auto increment in XE
/*
$schema = 'SET TERM ^ ; ';
$schema .= sprintf('CREATE TRIGGER "%s_BI" FOR "%s" ', $table_name, $table_name);
@ -634,7 +617,7 @@
}
/**
* @brief 조건문 작성하여 return
* @brief Return conditional clause
**/
function getCondition($output) {
if(!$output->conditions) return;
@ -683,15 +666,14 @@
}
/**
* @brief insertAct 처리
* @brief Handle the insertAct
**/
function _executeInsertAct($output) {
// 테이블 정리
// tables
foreach($output->tables as $key => $val) {
$table_list[] = '"'.$this->prefix.$val.'"';
}
// 컬럼 정리
// Columns
foreach($output->columns as $key => $val) {
$name = $val['name'];
$value = $val['value'];
@ -721,15 +703,14 @@
}
/**
* @brief updateAct 처리
* @brief handles updateAct
**/
function _executeUpdateAct($output) {
// 테이블 정리
// Tables
foreach($output->tables as $key => $val) {
$table_list[] = '"'.$this->prefix.$val.'"';
}
// 컬럼 정리
// Columns
foreach($output->columns as $key => $val) {
if(!isset($val['value'])) continue;
$name = $val['name'];
@ -747,7 +728,7 @@
else if($output->column_type[$name]=='number' ||
$output->column_type[$name]=='bignumber' ||
$output->column_type[$name]=='float') {
// 연산식이 들어갔을 경우 컬럼명이 있는 지 체크해 더블쿼터를 넣어줌
// put double-quotes on column name if an expression is entered
preg_match("/(?i)[a-z][a-z0-9_]+/", $value, $matches);
foreach($matches as $key => $val) {
@ -764,8 +745,7 @@
$column_list[] = sprintf('"%s" = ?', $name);
}
}
// 조건절 정리
// conditional clause
$condition = $this->getCondition($output);
$query = sprintf("update %s set %s %s;", implode(',',$table_list), implode(',',$column_list), $condition);
@ -775,15 +755,14 @@
}
/**
* @brief deleteAct 처리
* @brief handles deleteAct
**/
function _executeDeleteAct($output) {
// 테이블 정리
// Tables
foreach($output->tables as $key => $val) {
$table_list[] = '"'.$this->prefix.$val.'"';
}
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
$query = sprintf("delete from %s %s;", implode(',',$table_list), $condition);
@ -794,13 +773,13 @@
}
/**
* @brief selectAct 처리
* @brief Handle selectAct
*
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
* navigation이라는 method를 제공
* In order to get a list of pages easily when selecting \n
* it supports a method as navigation
**/
function _executeSelectAct($output) {
// 테이블 정리
// Tables
$table_list = array();
foreach($output->tables as $key => $val) {
$table_list[] = sprintf("\"%s%s\" as \"%s\"", $this->prefix, $val, $key);
@ -839,8 +818,7 @@
$output->column_list = $column_list;
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// query added in the condition to use an index when ordering by list_order, update_order
if($output->order) {
$conditions = $this->getConditionList($output);
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
@ -852,8 +830,7 @@
}
}
}
// list_count를 사용할 경우 적용
// apply when using list_count
if($output->list_count['value']) $limit = sprintf('FIRST %d', $output->list_count['value']);
else $limit = '';
@ -910,9 +887,9 @@
}
/**
* @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다
* @brief paginates when navigation info exists in the query xml
*
* 그닥 좋지는 않은 구조이지만 편리하다.. -_-;
* it is convenient although its structure is not good .. -_-;
**/
function _getNavigationData($table_list, $columns, $left_join, $condition, $output) {
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
@ -929,8 +906,8 @@
}
/*
// group by 절이 포함된 SELECT 쿼리의 전체 갯수를 구하기 위한 수정
// 정상적인 동작이 확인되면 주석으로 막아둔 부분으로 대체합니다.
// modified to get the number of rows by SELECT query with group by clause
// activate the commented codes when you confirm it works correctly
//
$count_condition = strlen($query_groupby) ? sprintf('%s group by %s', $condition, $query_groupby) : $condition;
$total_count = $this->getCountCache($output->tables, $count_condition);
@ -944,8 +921,7 @@
$this->putCountCache($output->tables, $count_condition, $total_count);
}
*/
// 전체 개수를 구함
// total number of rows
$count_query = sprintf("select count(*) as \"count\" from %s %s %s", implode(',',$table_list),implode(' ',$left_join), $condition);
$count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):'';
$result = $this->_query($count_query);
@ -960,16 +936,13 @@
if(!$page_count) $page_count = 10;
$page = $output->page['value'];
if(!$page) $page = 1;
// 전체 페이지를 구함
// total pages
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
else $total_page = 1;
// 페이지 변수를 체크
// check the page variables
if($page > $total_page) $page = $total_page;
$start_count = ($page-1)*$list_count;
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// query added in the condition to use an index when ordering by list_order, update_order
if($output->order) {
$conditions = $this->getConditionList($output);
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
@ -1025,12 +998,11 @@
while($tmp = ibase_fetch_object($result)) {
foreach($tmp as $key => $val){
$type = $output->column_type[$key];
// type 값이 null 일때는 $key값이 alias인 경우라 실제 column 이름을 찾아 type을 구함
// $key value is an alias when type value is null. get type by finding the actual column name
if($type == null && $output->columns && count($output->columns)) {
foreach($output->columns as $cols) {
if($cols['alias'] == $key) {
// table.column 형식인지 정규식으로 검사 함
// checks if the format is table.column or a regular expression
preg_match("/\w+[.](\w+)/", $cols['name'], $matches);
if($matches) {
$type = $output->column_type[$matches[1]];

View file

@ -3,26 +3,26 @@
/**
* @class DBMSSQL
* @author NHN (developers@xpressengine.com)
* @brief MSSQL driver로 수정 sol (sol@ngleader.com)
* @brief Modified to use MSSQL driver by sol (sol@ngleader.com)
* @version 0.1
**/
class DBMssql extends DB {
/**
* DB를 이용하기 위한 정보
* information to connect to DB
**/
var $conn = NULL;
var $database = NULL; ///< database
var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE 설치 가능)
var $prefix = 'xe'; // / <prefix of XE tables(One more XE can be installed on a single DB)
var $param = array();
var $comment_syntax = '/* %s */';
/**
* @brief mssql 에서 사용될 column type
* @brief column type used in mssql
*
* column_typeschema/query xml에서 공통 선언된 type을 이용하기 때문에
* DBMS에 맞게 replace 해주어야 한다
* column_type should be replaced for each DBMS's type
* becasue it uses commonly defined type in the schema/query xml
**/
var $column_type = array(
'bignumber' => 'bigint',
@ -52,7 +52,7 @@
}
/**
* @brief 설치 가능 여부를 return
* @brief Return if installable
**/
function isSupported() {
if (!extension_loaded("sqlsrv")) return false;
@ -60,7 +60,7 @@
}
/**
* @brief DB정보 설정 connect/ close
* @brief DB settings and connect/close
**/
function _setDBInfo() {
$db_info = Context::getDBInfo();
@ -75,10 +75,10 @@
}
/**
* @brief DB 접속
* @brief DB Connection
**/
function _connect() {
// db 정보가 없으면 무시
// ignore if db information not exists
if(!$this->hostname || !$this->database) return;
//sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
@ -89,7 +89,8 @@
array( 'Database' => $this->database,'UID'=>$this->userid,'PWD'=>$this->password ));
// 접속체크
// Check connections
if($this->conn){
$this->is_connected = true;
$this->password = md5($this->password);
@ -99,7 +100,7 @@
}
/**
* @brief DB접속 해제
* @brief DB disconnect
**/
function close() {
if($this->is_connected == false) return;
@ -110,7 +111,7 @@
}
/**
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
* @brief handles quatation of the string variables from the query
**/
function addQuotes($string) {
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string));
@ -120,7 +121,7 @@
}
/**
* @brief 트랜잭션 시작
* @brief Begin transaction
**/
function begin() {
if($this->is_connected == false || $this->transaction_started) return;
@ -130,7 +131,7 @@
}
/**
* @brief 롤백
* @brief Rollback
**/
function rollback() {
if($this->is_connected == false || !$this->transaction_started) return;
@ -140,7 +141,7 @@
}
/**
* @brief 커밋
* @brief Commit
**/
function commit($force = false) {
if(!$force && ($this->is_connected == false || !$this->transaction_started)) return;
@ -150,13 +151,13 @@
}
/**
* @brief : 쿼리문의 실행 결과의 fetch 처리
* @brief : executing the query and fetching the result
*
* query : query문 실행하고 result return\n
* fetch : reutrn 값이 없으면 NULL\n
* rows이면 array object\n
* row이면 object\n
* return\n
* query: run a query and return the result\n
* fetch: NULL if no value returned \n
* array object if rows returned \n
* object if a row returned \n
* return\n
**/
function _query($query) {
if($this->is_connected == false || !$query) return;
@ -173,21 +174,21 @@
}
}
// 쿼리 시작을 알림
// Notify to start a query execution
$this->actStart($query);
// 쿼리 문 실행
// Run the query statement
$result = false;
if(count($_param)){
$result = @sqlsrv_query($this->conn, $query, $_param);
}else{
$result = @sqlsrv_query($this->conn, $query);
}
// Error Check
// 오류 체크
if(!$result) $this->setError(print_r(sqlsrv_errors(),true));
// 쿼리 실행 종료를 알림
// Notify to complete a query execution
$this->actFinish();
$this->param = array();
@ -195,7 +196,7 @@
}
/**
* @brief 결과를 fetch
* @brief Fetch results
**/
function _fetch($result) {
if(!$this->isConnected() || $this->isError() || !$result) return;
@ -219,7 +220,7 @@
}
/**
* @brief 1 증가되는 sequence값을 return (mssql의 auto_increment는 sequence테이블에서만 사용)
* @brief Return sequence value incremented by 1(auto_increment is usd in the sequence table only)
**/
function getNextSequence() {
$query = sprintf("insert into %ssequence (seq) values (ident_incr('%ssequence'))", $this->prefix, $this->prefix);
@ -234,7 +235,7 @@
}
/**
* @brief 테이블 기생성 여부 return
* @brief Return if a table already exists
**/
function isTableExists($target_name) {
$query = sprintf("select name from sysobjects where name = '%s%s' and xtype='U'", $this->prefix, $this->addQuotes($target_name));
@ -246,7 +247,7 @@
}
/**
* @brief 특정 테이블에 특정 column 추가
* @brief Add a column to a table
**/
function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) {
if($this->isColumnExists($table_name, $column_name)) return;
@ -263,7 +264,7 @@
}
/**
* @brief 특정 테이블에 특정 column 제거
* @brief Delete a column from a table
**/
function dropColumn($table_name, $column_name) {
if(!$this->isColumnExists($table_name, $column_name)) return;
@ -272,7 +273,7 @@
}
/**
* @brief 특정 테이블의 column의 정보를 return
* @brief Return column information of a table
**/
function isColumnExists($table_name, $column_name) {
$query = sprintf("select syscolumns.name as name from syscolumns, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = syscolumns.id and syscolumns.name = '%s'", $this->prefix, $table_name, $column_name);
@ -284,7 +285,7 @@
}
/**
* @brief 특정 테이블에 특정 인덱스 추가
* @brief Add an index to a table
* $target_columns = array(col1, col2)
* $is_unique? unique : none
**/
@ -297,7 +298,7 @@
}
/**
* @brief 특정 테이블의 특정 인덱스 삭제
* @brief Drop an index from a table
**/
function dropIndex($table_name, $index_name, $is_unique = false) {
if(!$this->isIndexExists($table_name, $index_name)) return;
@ -306,7 +307,7 @@
}
/**
* @brief 특정 테이블의 index 정보를 return
* @brief Return index information of a table
**/
function isIndexExists($table_name, $index_name) {
$query = sprintf("select sysindexes.name as name from sysindexes, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = sysindexes.id and sysindexes.name = '%s'", $this->prefix, $table_name, $index_name);
@ -320,24 +321,24 @@
}
/**
* @brief xml 받아서 테이블을 생성
* @brief Create a table by using xml file
**/
function createTableByXml($xml_doc) {
return $this->_createTable($xml_doc);
}
/**
* @brief xml 받아서 테이블을 생성
* @brief Create a table by using xml file
**/
function createTableByXmlFile($file_name) {
if(!file_exists($file_name)) return;
// xml 파일을 읽음
// read xml file
$buff = FileHandler::readFile($file_name);
return $this->_createTable($buff);
}
/**
* @brief schema xml을 이용하여 create table query생성
* @brief generate a query statement to create a table by using schema xml
*
* type : number, varchar, text, char, date, \n
* opt : notnull, default, size\n
@ -347,8 +348,7 @@
// xml parsing
$oXml = new XmlParser();
$xml_obj = $oXml->parse($xml_doc);
// 테이블 생성 schema 작성
// Create a table schema
$table_name = $xml_obj->table->attrs->name;
if($this->isTableExists($table_name)) return;
@ -409,7 +409,7 @@
}
/**
* @brief 조건문 작성하여 return
* @brief Return conditional clause
**/
function getCondition($output) {
if(!$output->conditions) return;
@ -525,16 +525,15 @@
}
/**
* @brief insertAct 처리
* @brief Handle the insertAct
**/
function _executeInsertAct($output) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[] = '['.$this->prefix.$val.']';
}
// 컬럼 정리
// List columns
foreach($output->columns as $key => $val) {
$name = $val['name'];
$value = $val['value'];
@ -561,15 +560,16 @@
}
/**
* @brief updateAct 처리
* @brief Handle updateAct
**/
function _executeUpdateAct($output) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[] = '['.$this->prefix.$val.']';
}
// 컬럼 정리
// List columns
foreach($output->columns as $key => $val) {
if(!isset($val['value'])) continue;
@ -597,8 +597,7 @@
}
}
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
$query = sprintf("update %s set %s %s", implode(',',$table_list), implode(',',$column_list), $condition);
@ -607,15 +606,14 @@
}
/**
* @brief deleteAct 처리
* @brief Handle deleteAct
**/
function _executeDeleteAct($output) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[] = '['.$this->prefix.$val.']';
}
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
@ -624,13 +622,13 @@
}
/**
* @brief selectAct 처리
* @brief Handle selectAct
*
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
* navigation이라는 method를 제공
* In order to get a list of pages easily when selecting \n
* it supports a method as navigation
**/
function _executeSelectAct($output) {
// 테이블 정리
// List tables
$table_list = array();
foreach($output->tables as $key => $val) {
$table_list[] = '['.$this->prefix.$val.'] as '.$key;
@ -675,8 +673,7 @@
$output->column_list = $column_list;
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// Add a condition to use an index when sorting in order by list_order, update_order
if($output->order) {
$conditions = $this->getConditionList($output);
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
@ -718,7 +715,7 @@
}
$query = sprintf("%s from %s %s %s %s", $columns, implode(',',$table_list),implode(' ',$left_join), $condition, $groupby_query.$orderby_query);
// list_count를 사용할 경우 적용
// Apply when using list_count
if($output->list_count['value']) $query = sprintf('select top %d %s', $output->list_count['value'], $query);
else $query = "select ".$query;
@ -741,16 +738,16 @@
}
/**
* @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다
* @brief Paging is handled if navigation information exists in the query xml
*
* 그닥 좋지는 않은 구조이지만 편리하다.. -_-;
* It is quite convenient although its structure is not good at all .. -_-;
**/
function _getNavigationData($table_list, $columns, $left_join, $condition, $output) {
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
$column_list = $output->column_list;
// 전체 개수를 구함
// Get a total count
if(count($output->groups)){
foreach($output->groups as $k => $v ){
if(preg_match('/^substr\(/i',$v)) $output->groups[$k] = preg_replace('/^substr\(/i','substring(',$v);
@ -780,16 +777,13 @@
if(!$page_count) $page_count = 10;
$page = $output->page['value'];
if(!$page) $page = 1;
// 전체 페이지를 구함
// Get a total page
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
else $total_page = 1;
// 페이지 변수를 체크
// Check Page variables
if($page > $total_page) $page = $total_page;
$start_count = ($page-1)*$list_count;
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// Add a condition to use an index when sorting in order by list_order, update_order
$conditions = $this->getConditionList($output);
if($output->order) {
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
@ -802,7 +796,7 @@
}
}
// group by 절 추가
// Add group by clause
if(count($output->groups)){
foreach($output->groups as $k => $v ){
if(preg_match('/^substr\(/i',$v)) $output->groups[$k] = preg_replace('/^substr\(/i','substring(',$v);
@ -812,7 +806,7 @@
$group = sprintf('group by %s', implode(',',$output->groups));
}
// order 절 추가
// Add order by clause
$order_targets = array();
if($output->order) {
foreach($output->order as $key => $val) {
@ -848,7 +842,7 @@
$first_sub_columns[] = $k;
}
// 1차로 order 대상에 해당 하는 값을 가져옴
// Fetch values to sort
$param = $this->param;
$first_query = sprintf("select %s from (select top %d %s from %s %s %s %s %s) xet", implode(',',$first_columns), $start_count, implode(',',$first_sub_columns), implode(',',$table_list), implode(' ',$left_join), $condition, $group, $order);
$result = $this->_query($first_query);
@ -857,7 +851,7 @@
// 1차에서 나온 값을 이용 다시 쿼리 실행
// Re-execute a query by using fetched values
$sub_cond = array();
foreach($order_targets as $k => $v) {
$sub_cond[] = sprintf("%s %s '%s'", $k, $v=='asc'?'>':'<', $tmp->{$k});

View file

@ -2,7 +2,7 @@
/**
* @class DBMysql
* @author NHN (developers@xpressengine.com)
* @brief MySQL DBMS이용하기 위한 class
* @brief Class to use MySQL DBMS
* @version 0.1
*
* mysql handling class
@ -11,20 +11,20 @@
class DBMysql extends DB {
/**
* @brief Mysql DB에 접속하기 위한 정보
* @brief Connection information for Mysql DB
**/
var $hostname = '127.0.0.1'; ///< hostname
var $userid = NULL; ///< user id
var $password = NULL; ///< password
var $database = NULL; ///< database
var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE 설치 가능)
var $prefix = 'xe'; // / <prefix of a tablename (One or more XEs can be installed in a single DB)
var $comment_syntax = '/* %s */';
/**
* @brief mysql에서 사용될 column type
* @brief Column type used in MySQL
*
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
* DBMS에 맞게 replace 해주어야 한다
* Becasue a common column type in schema/query xml is used for colum_type,
* it should be replaced properly for each DBMS
**/
var $column_type = array(
'bignumber' => 'bigint',
@ -50,7 +50,7 @@
}
/**
* @brief 설치 가능 여부를 return
* @brief Return if it is installable
**/
function isSupported() {
if(!function_exists('mysql_connect')) return false;
@ -58,7 +58,7 @@
}
/**
* @brief DB정보 설정 connect/ close
* @brief DB settings and connect/close
**/
function _setDBInfo() {
$db_info = Context::getDBInfo();
@ -72,44 +72,39 @@
}
/**
* @brief DB 접속
* @brief DB Connection
**/
function _connect() {
// db 정보가 없으면 무시
// Ignore if no DB information exists
if(!$this->hostname || !$this->userid || !$this->password || !$this->database) return;
if(strpos($this->hostname, ':')===false && $this->port) $this->hostname .= ':'.$this->port;
// 접속시도
// Attempt to connect
$this->fd = @mysql_connect($this->hostname, $this->userid, $this->password);
if(mysql_error()) {
$this->setError(mysql_errno(), mysql_error());
return;
}
// 버전 확인후 4.1 이하면 오류 표시
// Error appears if the version is lower than 4.1
if(mysql_get_server_info($this->fd)<"4.1") {
$this->setError(-1, "XE cannot be installed under the version of mysql 4.1. Current mysql version is ".mysql_get_server_info());
return;
}
// db 선택
// select db
@mysql_select_db($this->database, $this->fd);
if(mysql_error()) {
$this->setError(mysql_errno(), mysql_error());
return;
}
// 접속체크
// Check connections
$this->is_connected = true;
$this->password = md5($this->password);
// mysql의 경우 utf8임을 지정
// Set utf8 if a database is MySQL
$this->_query("set names 'utf8'");
}
/**
* @brief DB접속 해제
* @brief DB disconnection
**/
function close() {
if(!$this->isConnected()) return;
@ -117,7 +112,7 @@
}
/**
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
* @brief Add quotes on the string variables in a query
**/
function addQuotes($string) {
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string));
@ -126,53 +121,48 @@
}
/**
* @brief 트랜잭션 시작
* @brief Begin transaction
**/
function begin() {
}
/**
* @brief 롤백
* @brief Rollback
**/
function rollback() {
}
/**
* @brief 커밋
* @brief Commits
**/
function commit() {
}
/**
* @brief : 쿼리문의 실행 결과의 fetch 처리
* @brief : Run a query and fetch the result
*
* query : query문 실행하고 result return\n
* fetch : reutrn 값이 없으면 NULL\n
* rows이면 array object\n
* row이면 object\n
* query: run a query and return the result \n
* fetch: NULL if no value is returned \n
* array object if rows are returned \n
* object if a row is returned \n
* return\n
**/
function _query($query) {
if(!$this->isConnected()) return;
// 쿼리 시작을 알림
// Notify to start a query execution
$this->actStart($query);
// 쿼리 문 실행
// Run the query statement
$result = @mysql_query($query, $this->fd);
// 오류 체크
// Error Check
if(mysql_error($this->fd)) $this->setError(mysql_errno($this->fd), mysql_error($this->fd));
// 쿼리 실행 종료를 알림
// Notify to complete a query execution
$this->actFinish();
// 결과 리턴
// Return result
return $result;
}
/**
* @brief 결과를 fetch
* @brief Fetch results
**/
function _fetch($result) {
if(!$this->isConnected() || $this->isError() || !$result) return;
@ -184,7 +174,7 @@
}
/**
* @brief 1 증가되는 sequence값을 return (mysql의 auto_increment는 sequence테이블에서만 사용)
* @brief Return sequence value incremented by 1(auto_increment is used in sequence table only in MySQL)
**/
function getNextSequence() {
$query = sprintf("insert into `%ssequence` (seq) values ('0')", $this->prefix);
@ -199,7 +189,7 @@
}
/**
* @brief mysql old password를 가져오는 함수 (mysql에서만 사용)
* @brief Function to obtain mysql old password(mysql only)
**/
function isValidOldPassword($password, $saved_password) {
$query = sprintf("select password('%s') as password, old_password('%s') as old_password", $this->addQuotes($password), $this->addQuotes($password));
@ -210,7 +200,7 @@
}
/**
* @brief 테이블 기생성 여부 return
* @brief Return if a table already exists
**/
function isTableExists($target_name) {
$query = sprintf("show tables like '%s%s'", $this->prefix, $this->addQuotes($target_name));
@ -221,7 +211,7 @@
}
/**
* @brief 특정 테이블에 특정 column 추가
* @brief Add a column to a table
**/
function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) {
$type = $this->column_type[$type];
@ -237,7 +227,7 @@
}
/**
* @brief 특정 테이블에 특정 column 제거
* @brief Delete a column from a table
**/
function dropColumn($table_name, $column_name) {
$query = sprintf("alter table `%s%s` drop `%s` ", $this->prefix, $table_name, $column_name);
@ -245,7 +235,7 @@
}
/**
* @brief 특정 테이블의 column의 정보를 return
* @brief Return column information of a table
**/
function isColumnExists($table_name, $column_name) {
$query = sprintf("show fields from `%s%s`", $this->prefix, $table_name);
@ -263,7 +253,7 @@
}
/**
* @brief 특정 테이블에 특정 인덱스 추가
* @brief Add an index to a table
* $target_columns = array(col1, col2)
* $is_unique? unique : none
**/
@ -275,7 +265,7 @@
}
/**
* @brief 특정 테이블의 특정 인덱스 삭제
* @brief Drop an index from a table
**/
function dropIndex($table_name, $index_name, $is_unique = false) {
$query = sprintf("alter table `%s%s` drop index `%s`", $this->prefix, $table_name, $index_name);
@ -284,7 +274,7 @@
/**
* @brief 특정 테이블의 index 정보를 return
* @brief Return index information of a table
**/
function isIndexExists($table_name, $index_name) {
//$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name);
@ -302,24 +292,24 @@
}
/**
* @brief xml 받아서 테이블을 생성
* @brief Create a table by using xml file
**/
function createTableByXml($xml_doc) {
return $this->_createTable($xml_doc);
}
/**
* @brief xml 받아서 테이블을 생성
* @brief Create a table by using xml file
**/
function createTableByXmlFile($file_name) {
if(!file_exists($file_name)) return;
// xml 파일을 읽음
// read xml file
$buff = FileHandler::readFile($file_name);
return $this->_createTable($buff);
}
/**
* @brief schema xml을 이용하여 create table query생성
* @brief generate a query statement to create a table by using schema xml
*
* type : number, varchar, text, char, date, \n
* opt : notnull, default, size\n
@ -329,8 +319,7 @@
// xml parsing
$oXml = new XmlParser();
$xml_obj = $oXml->parse($xml_doc);
// 테이블 생성 schema 작성
// Create a table schema
$table_name = $xml_obj->table->attrs->name;
if($this->isTableExists($table_name)) return;
$table_name = $this->prefix.$table_name;
@ -386,7 +375,7 @@
}
/**
* @brief 조건문 작성하여 return
* @brief Return conditional clause
**/
function getCondition($output) {
if(!$output->conditions) return;
@ -429,15 +418,14 @@
}
/**
* @brief insertAct 처리
* @brief Handle the insertAct
**/
function _executeInsertAct($output) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[] = '`'.$this->prefix.$val.'`';
}
// 컬럼 정리
// List columns
foreach($output->columns as $key => $val) {
$name = $val['name'];
$value = $val['value'];
@ -466,15 +454,14 @@
}
/**
* @brief updateAct 처리
* @brief Handle updateAct
**/
function _executeUpdateAct($output) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[] = '`'.$this->prefix.$val.'` as '.$key;
}
// 컬럼 정리
// List columns
foreach($output->columns as $key => $val) {
if(!isset($val['value'])) continue;
$name = $val['name'];
@ -487,8 +474,7 @@
$column_list[] = sprintf("`%s` = %s", $name, $value);
}
}
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
$query = sprintf("update %s set %s %s", implode(',',$table_list), implode(',',$column_list), $condition);
@ -497,15 +483,14 @@
}
/**
* @brief deleteAct 처리
* @brief Handle deleteAct
**/
function _executeDeleteAct($output) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[] = '`'.$this->prefix.$val.'`';
}
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
@ -514,13 +499,13 @@
}
/**
* @brief selectAct 처리
* @brief Handle selectAct
*
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
* navigation이라는 method를 제공
* In order to get a list of pages easily when selecting \n
* it supports a method as navigation
**/
function _executeSelectAct($output) {
// 테이블 정리
// List tables
$table_list = array();
foreach($output->tables as $key => $val) {
$table_list[] = '`'.$this->prefix.$val.'` as '.$key;
@ -584,8 +569,7 @@
$condition = $this->getCondition($output);
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// Add a condition to use an index when sorting in order by list_order, update_order
if($output->order) {
$conditions = $this->getConditionList($output);
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
@ -633,7 +617,7 @@
$query = sprintf("select %s from %s %s %s %s", $columns, implode(',',$table_list),implode(' ',$left_join), $condition, $groupby_query.$orderby_query);
// list_count를 사용할 경우 적용
// Apply when using list_count
if($output->list_count['value']) $query = sprintf('%s limit %d', $query, $output->list_count['value']);
$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):'';
@ -656,16 +640,16 @@
}
/**
* @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다
* @brief Paging is handled if navigation information exists in the query xml
*
* 그닥 좋지는 않은 구조이지만 편리하다.. -_-;
* It is quite convenient although its structure is not good at all .. -_-;
**/
function _getNavigationData($table_list, $columns, $left_join, $condition, $output) {
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
$column_list = $output->column_list;
// 전체 개수를 구함
// Get a total count
$count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition;
$count_query = sprintf("select count(*) as count from %s %s %s", implode(', ', $table_list), implode(' ', $left_join), $count_condition);
if (count($output->groups)) $count_query = sprintf('select count(*) as count from (%s) xet', $count_query);
@ -681,16 +665,13 @@
if(!$page_count) $page_count = 10;
$page = $output->page['value'];
if(!$page) $page = 1;
// 전체 페이지를 구함
// Get a total page
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
else $total_page = 1;
// 페이지 변수를 체크
// Check Page variables
if($page > $total_page) $page = $total_page;
$start_count = ($page-1)*$list_count;
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// Add a condition to use an index when sorting in order by list_order, update_order
if($output->order) {
$conditions = $this->getConditionList($output);
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {

View file

@ -4,7 +4,7 @@
/**
* @class DBMysql_innodb
* @author NHN (developers@xpressengine.com)
* @brief MySQL DBMS이용하기 위한 class
* @brief class to use MySQL DBMS
* @version 0.1
*
* mysql innodb handling class
@ -29,7 +29,7 @@
}
/**
* @brief DB접속 해제
* @brief DB disconnection
**/
function close() {
if(!$this->isConnected()) return;
@ -38,7 +38,7 @@
}
/**
* @brief 트랜잭션 시작
* @brief Begin transaction
**/
function begin() {
if(!$this->isConnected() || $this->transaction_started) return;
@ -47,7 +47,7 @@
}
/**
* @brief 롤백
* @brief Rollback
**/
function rollback() {
if(!$this->isConnected() || !$this->transaction_started) return;
@ -56,7 +56,7 @@
}
/**
* @brief 커밋
* @brief Commits
**/
function commit($force = false) {
if(!$force && (!$this->isConnected() || !$this->transaction_started)) return;
@ -65,35 +65,30 @@
}
/**
* @brief : 쿼리문의 실행 결과의 fetch 처리
* @brief : Run a query and fetch the result
*
* query : query문 실행하고 result return\n
* fetch : reutrn 값이 없으면 NULL\n
* rows이면 array object\n
* row이면 object\n
* query: run a query and return the result \n
* fetch: NULL if no value is returned \n
* array object if rows are returned \n
* object if a row is returned \n
* return\n
**/
function _query($query) {
if(!$this->isConnected()) return;
// 쿼리 시작을 알림
// Notify to start a query execution
$this->actStart($query);
// 쿼리 문 실행
// Run the query statement
$result = @mysql_query($query, $this->fd);
// 오류 체크
// Error Check
if(mysql_error($this->fd)) $this->setError(mysql_errno($this->fd), mysql_error($this->fd));
// 쿼리 실행 종료를 알림
// Notify to complete a query execution
$this->actFinish();
// 결과 리턴
// Return result
return $result;
}
/**
* @brief schema xml을 이용하여 create table query생성
* @brief generate a query statement to create a table by using schema xml
*
* type : number, varchar, text, char, date, \n
* opt : notnull, default, size\n
@ -103,8 +98,7 @@
// xml parsing
$oXml = new XmlParser();
$xml_obj = $oXml->parse($xml_doc);
// 테이블 생성 schema 작성
// Create a table schema
$table_name = $xml_obj->table->attrs->name;
if($this->isTableExists($table_name)) return;
$table_name = $this->prefix.$table_name;

View file

@ -3,7 +3,7 @@
/**
* @class DBMysqli
* @author NHN (developers@xpressengine.com)
* @brief MySQL DBMS를 mysqli_* 이용하기 위한 class
* @brief Class to use MySQL DBMS as mysqli_*
* @version 0.1
*
* mysql handling class
@ -21,7 +21,7 @@
}
/**
* @brief 설치 가능 여부를 return
* @brief Return if it is installable
**/
function isSupported() {
if(!function_exists('mysqli_connect')) return false;
@ -37,13 +37,12 @@
}
/**
* @brief DB 접속
* @brief DB Connection
**/
function _connect() {
// db 정보가 없으면 무시
// Ignore if no DB information exists
if(!$this->hostname || !$this->userid || !$this->password || !$this->database) return;
// 접속시도
// Attempt to connect
if($this->port){
$this->fd = @mysqli_connect($this->hostname, $this->userid, $this->password, $this->database, $this->port);
}else{
@ -55,14 +54,13 @@
return;
}
mysqli_set_charset($this->fd,'utf8');
// 접속체크
// Check connections
$this->is_connected = true;
$this->password = md5($this->password);
}
/**
* @brief DB접속 해제
* @brief DB disconnection
**/
function close() {
if(!$this->isConnected()) return;
@ -70,7 +68,7 @@
}
/**
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
* @brief Add quotes on the string variables in a query
**/
function addQuotes($string) {
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string));
@ -79,32 +77,29 @@
}
/**
* @brief : 쿼리문의 실행 결과의 fetch 처리
* @brief : Run a query and fetch the result
*
* query : query문 실행하고 result return\n
* fetch : reutrn 값이 없으면 NULL\n
* rows이면 array object\n
* row이면 object\n
* query: run a query and return the result \n
* fetch: NULL if no value is returned \n
* array object if rows are returned \n
* object if a row is returned \n
* return\n
**/
function _query($query) {
if(!$this->isConnected()) return;
// 쿼리 시작을 알림
// Notify to start a query execution
$this->actStart($query);
// 쿼리 문 실행
// Run the query statement
$result = mysqli_query($this->fd,$query);
// 오류 체크
// Error Check
$error = mysqli_error($this->fd);
if($error){
$this->setError(mysqli_errno($this->fd), $error);
}
// 쿼리 실행 종료를 알림
// Notify to complete a query execution
$this->actFinish();
// 결과 리턴
// Return result
return $result;
}

View file

@ -2,34 +2,34 @@
/**
* @class DBPostgreSQL
* @author ioseph (ioseph@postgresql.kr) updated by yoonjong.joh@gmail.com
* @brief MySQL DBMS를 이용하기 위한 class
* @brief Class to use PostgreSQL DBMS
* @version 0.2
*
* postgresql handling class
* 2009.02.10 update delete query를 실행할때 table 이름에 alias 사용하는 것을 없앰. 지원 안함
* order by clause를 실행할때 함수를 실행 하는 부분을 column alias로 대체.
* 2009.02.11 dropColumn() function이 추가
* 2009.02.13 addColumn() 함수 변경
* 2009.02.10 update and delete query for the table name at runtime, eliminating the alias to use. Not Supported
* when running order by clause column alias to run a function to replace parts.
* 2009.02.11 dropColumn() function added
* 2009.02.13 addColumn() function changes
**/
class DBPostgresql extends DB
{
/**
* @brief PostgreSQL DB접속하기 위한 정보
* @brief Connection information for PostgreSQL DB
**/
var $hostname = '127.0.0.1'; ///< hostname
var $userid = null; ///< user id
var $password = null; ///< password
var $database = null; ///< database
var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE설치 가능)
var $prefix = 'xe'; // / <prefix of a tablename (One or more XEs can be installed in a single DB)
var $comment_syntax = '/* %s */';
/**
* @brief postgresql에서 사용될 column type
* @brief column type used in postgresql
*
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
* DBMS에 맞게 replace 해주어야 한다
* Becasue a common column type in schema/query xml is used for colum_type,
* it should be replaced properly for each DBMS
**/
var $column_type = array(
'bignumber' => 'bigint',
@ -60,7 +60,7 @@ class DBPostgresql extends DB
}
/**
* @brief 설치 가능 여부를 return
* @brief Return if it is installable
**/
function isSupported()
{
@ -70,7 +70,7 @@ class DBPostgresql extends DB
}
/**
* @brief DB정보 설정 connect/ close
* @brief DB settings and connect/close
**/
function _setDBInfo()
{
@ -86,40 +86,36 @@ class DBPostgresql extends DB
}
/**
* @brief DB 접속
* @brief DB Connection
**/
function _connect()
{
// pg용 connection string
// the connection string for PG
$conn_string = "";
// db 정보가 없으면 무시
// Ignore if no DB information exists
if (!$this->hostname || !$this->userid || !$this->database)
return;
// connection string 만들기
// Create connection string
$conn_string .= ($this->hostname) ? " host=$this->hostname" : "";
$conn_string .= ($this->userid) ? " user=$this->userid" : "";
$conn_string .= ($this->password) ? " password=$this->password" : "";
$conn_string .= ($this->database) ? " dbname=$this->database" : "";
$conn_string .= ($this->port) ? " port=$this->port" : "";
// 접속시도
// Attempt to connect
$this->fd = @pg_connect($conn_string);
if (!$this->fd || pg_connection_status($this->fd) != PGSQL_CONNECTION_OK) {
$this->setError(-1, "CONNECTION FAILURE");
return;
}
// 접속체크
// Check connections
$this->is_connected = true;
$this->password = md5($this->password);
// utf8임을 지정
// Set utf8
//$this ->_query('set client_encoding to uhc');
}
/**
* @brief DB접속 해제
* @brief DB disconnection
**/
function close()
{
@ -129,7 +125,7 @@ class DBPostgresql extends DB
}
/**
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
* @brief Add quotes on the string variables in a query
**/
function addQuotes($string)
{
@ -141,7 +137,7 @@ class DBPostgresql extends DB
}
/**
* @brief 트랜잭션 시작
* @brief Begin transaction
**/
function begin()
{
@ -152,7 +148,7 @@ class DBPostgresql extends DB
}
/**
* @brief 롤백
* @brief Rollback
**/
function rollback()
{
@ -163,7 +159,7 @@ class DBPostgresql extends DB
}
/**
* @brief 커밋
* @brief Commits
**/
function commit()
{
@ -174,12 +170,12 @@ class DBPostgresql extends DB
}
/**
* @brief : 쿼리문의 실행 결과의 fetch 처리
* @brief : Run a query and fetch the result
*
* query : query문 실행하고 result return\n
* fetch : reutrn 값이 없으면 NULL\n
* rows이면 array object\n
* row이면 object\n
* query: run a query and return the result \n
* fetch: NULL if no value is returned \n
* array object if rows are returned \n
* object if a row is returned \n
* return\n
**/
function _query($query)
@ -208,16 +204,12 @@ class DBPostgresql extends DB
}
}
*/
// 쿼리 시작을 알림
// Notify to start a query execution
$this->actStart($query);
$arr = array('Hello', 'World!', 'Beautiful', 'Day!');
// 쿼리 문 실행
// Run the query statement
$result = @pg_query($this->fd, $query);
// 오류 체크
// Error Check
if (!$result) {
// var_dump($l_query_array);
//var_dump($query);
@ -225,16 +217,14 @@ class DBPostgresql extends DB
//var_dump(debug_backtrace());
$this->setError(1, pg_last_error($this->fd));
}
// 쿼리 실행 종료를 알림
// Notify to complete a query execution
$this->actFinish();
// 결과 리턴
// Return result
return $result;
}
/**
* @brief 결과를 fetch
* @brief Fetch results
**/
function _fetch($result)
{
@ -249,7 +239,7 @@ class DBPostgresql extends DB
}
/**
* @brief 1 증가되는 sequence값을 return (postgresql의 auto_increment는 sequence테이블에서만 사용)
* @brief Return sequence value incremented by 1(in postgresql, auto_increment is used in the sequence table only)
**/
function getNextSequence()
{
@ -260,7 +250,7 @@ class DBPostgresql extends DB
}
/**
* @brief 테이블 기생성 여부 return
* @brief Return if a table already exists
**/
function isTableExists($target_name)
{
@ -277,7 +267,7 @@ class DBPostgresql extends DB
}
/**
* @brief 특정 테이블에 특정 column 추가
* @brief Add a column to a table
**/
function addColumn($table_name, $column_name, $type = 'number', $size = '', $default =
NULL, $notnull = false)
@ -309,7 +299,7 @@ class DBPostgresql extends DB
/**
* @brief 특정 테이블의 column의 정보를 return
* @brief Return column information of a table
**/
function isColumnExists($table_name, $column_name)
{
@ -329,7 +319,7 @@ class DBPostgresql extends DB
}
/**
* @brief 특정 테이블에 특정 인덱스 추가
* @brief Add an index to a table
* $target_columns = array(col1, col2)
* $is_unique? unique : none
**/
@ -340,8 +330,7 @@ class DBPostgresql extends DB
if (strpos($table_name, $this->prefix) === false)
$table_name = $this->prefix . $table_name;
// index_name의 경우 앞에 table이름을 붙여줘서 중복을 피함
// Use a tablename before an index name to avoid defining the same index
$index_name = $table_name . $index_name;
$query = sprintf("create %s index %s on %s (%s);", $is_unique ? 'unique' : '', $index_name,
@ -350,7 +339,7 @@ class DBPostgresql extends DB
}
/**
* @brief 특정 테이블에 특정 column 제거
* @brief Delete a column from a table
**/
function dropColumn($table_name, $column_name)
{
@ -359,14 +348,13 @@ class DBPostgresql extends DB
}
/**
* @brief 특정 테이블의 특정 인덱스 삭제
* @brief Drop an index from a table
**/
function dropIndex($table_name, $index_name, $is_unique = false)
{
if (strpos($table_name, $this->prefix) === false)
$table_name = $this->prefix . $table_name;
// index_name의 경우 앞에 table이름을 붙여줘서 중복을 피함
// Use a tablename before an index name to avoid defining the same index
$index_name = $table_name . $index_name;
$query = sprintf("drop index %s", $index_name);
@ -375,14 +363,13 @@ class DBPostgresql extends DB
/**
* @brief 특정 테이블의 index 정보를 return
* @brief Return index information of a table
**/
function isIndexExists($table_name, $index_name)
{
if (strpos($table_name, $this->prefix) === false)
$table_name = $this->prefix . $table_name;
// index_name의 경우 앞에 table이름을 붙여줘서 중복을 피함
// Use a tablename before an index name to avoid defining the same index
$index_name = $table_name . $index_name;
//$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name);
@ -402,7 +389,7 @@ class DBPostgresql extends DB
}
/**
* @brief xml 받아서 테이블을 생성
* @brief Create a table by using xml file
**/
function createTableByXml($xml_doc)
{
@ -410,19 +397,19 @@ class DBPostgresql extends DB
}
/**
* @brief xml 받아서 테이블을 생성
* @brief Create a table by using xml file
**/
function createTableByXmlFile($file_name)
{
if (!file_exists($file_name))
return;
// xml 파일을 읽음
// read xml file
$buff = FileHandler::readFile($file_name);
return $this->_createTable($buff);
}
/**
* @brief schema xml을 이용하여 create table query생성
* @brief generate a query statement to create a table by using schema xml
*
* type : number, varchar, text, char, date, \n
* opt : notnull, default, size\n
@ -433,8 +420,7 @@ class DBPostgresql extends DB
// xml parsing
$oXml = new XmlParser();
$xml_obj = $oXml->parse($xml_doc);
// 테이블 생성 schema 작성
// Create a table schema
$table_name = $xml_obj->table->attrs->name;
if ($table_name == 'sequence') {
@ -508,7 +494,7 @@ class DBPostgresql extends DB
}
/**
* @brief 조건문 작성하여 return
* @brief Return conditional clause
**/
function getCondition($output)
{
@ -564,16 +550,15 @@ class DBPostgresql extends DB
/**
* @brief insertAct 처리
* @brief Handle the insertAct
**/
function _executeInsertAct($output)
{
// 테이블 정리
// List tables
foreach ($output->tables as $key => $val) {
$table_list[] = $this->prefix . $val;
}
// 컬럼 정리
// List columns
foreach ($output->columns as $key => $val) {
$name = $val['name'];
$value = $val['value'];
@ -594,17 +579,16 @@ class DBPostgresql extends DB
}
/**
* @brief updateAct 처리
* @brief Handle updateAct
**/
function _executeUpdateAct($output)
{
// 테이블 정리
// List tables
foreach ($output->tables as $key => $val) {
//$table_list[] = $this->prefix.$val.' as '.$key;
$table_list[] = $this->prefix . $val;
}
// 컬럼 정리
// List columns
foreach ($output->columns as $key => $val) {
if (!isset($val['value']))
continue;
@ -621,8 +605,7 @@ class DBPostgresql extends DB
$column_list[] = sprintf("%s = %s", $name, $value);
}
}
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
$query = sprintf("update %s set %s %s", implode(',', $table_list), implode(',',
@ -632,16 +615,15 @@ class DBPostgresql extends DB
}
/**
* @brief deleteAct 처리
* @brief Handle deleteAct
**/
function _executeDeleteAct($output)
{
// 테이블 정리
// List tables
foreach ($output->tables as $key => $val) {
$table_list[] = $this->prefix . $val;
}
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
$query = sprintf("delete from %s %s", implode(',', $table_list), $condition);
@ -650,14 +632,14 @@ class DBPostgresql extends DB
}
/**
* @brief selectAct 처리
* @brief Handle selectAct
*
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
* navigation이라는 method를 제공
* In order to get a list of pages easily when selecting \n
* it supports a method as navigation
**/
function _executeSelectAct($output)
{
// 테이블 정리
// List tables
$table_list = array();
foreach ($output->tables as $key => $val) {
$table_list[] = $this->prefix . $val . ' as ' . $key;
@ -709,8 +691,7 @@ class DBPostgresql extends DB
if ($output->list_count && $output->page)
return $this->_getNavigationData($table_list, $columns, $left_join, $condition,
$output);
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// Add a condition to use an index when sorting in order by list_order, update_order
if ($output->order) {
$conditions = $this->getConditionList($output);
if (!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
@ -794,9 +775,9 @@ class DBPostgresql extends DB
}
/**
* @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다
* @brief Paging is handled if navigation information exists in the query xml
*
* 그닥 좋지는 않은 구조이지만 편리하다.. -_-;
* It is quite convenient although its structure is not good at all .. -_-;
**/
function _getNavigationData($table_list, $columns, $left_join, $condition, $output)
{
@ -804,8 +785,8 @@ class DBPostgresql extends DB
$column_list = $output->column_list;
/*
// group by 절이 포함된 SELECT 쿼리의 전체 갯수를 구하기 위한 수정
// 정상적인 동작이 확인되면 주석으로 막아둔 부분으로 대체합니다.
// Modified to find total number of SELECT queries having group by clause
// If it works correctly, uncomment the following codes
//
$count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition;
$total_count = $this->getCountCache($output->tables, $count_condition);
@ -820,7 +801,7 @@ class DBPostgresql extends DB
}
*/
// 전체 개수를 구함
// Get a total count
$count_query = sprintf("select count(*) as count from %s %s %s", implode(',', $table_list), implode(' ', $left_join), $condition);
$count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):'';
$result = $this->_query($count_query);
@ -835,15 +816,14 @@ class DBPostgresql extends DB
if (!$page)
$page = 1;
// 전체 페이지를 구함
// Get a total page
if ($total_count) $total_page = (int)(($total_count - 1) / $list_count) + 1;
else $total_page = 1;
// 페이지 변수를 체크
// Check Page variables
if ($page > $total_page) $page = $total_page;
$start_count = ($page - 1) * $list_count;
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// Add a condition to use an index when sorting in order by list_order, update_order
if ($output->order) {
$conditions = $this->getConditionList($output);
if (!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {

View file

@ -2,7 +2,7 @@
/**
* @class DBSqlite2
* @author NHN (developers@xpressengine.com)
* @brief SQLite ver 2.x 이용하기 위한 class
* @brief Class for using SQLite ver 2.x
* @version 0.1
*
* sqlite handling class (sqlite ver 2.x)
@ -11,17 +11,17 @@
class DBSqlite2 extends DB {
/**
* DB이용하기 위한 정보
* DB information
**/
var $database = NULL; ///< database
var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE설치 가능)
var $prefix = 'xe'; // / <prefix of a tablename (One or more XEs can be installed in a single DB)
var $comment_syntax = '/* %s */';
/**
* @brief sqlite 에서 사용될 column type
* @brief sqlite column type used in
*
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
* DBMS에 맞게 replace 해주어야 한다
* Becasue a common column type in schema/query xml is used for colum_type,
* it should be replaced properly for each DBMS
**/
var $column_type = array(
'bignumber' => 'INTEGER',
@ -51,7 +51,7 @@
}
/**
* @brief 설치 가능 여부를 return
* @brief Return if it is installable
**/
function isSupported() {
if(!function_exists('sqlite_open')) return false;
@ -59,7 +59,7 @@
}
/**
* @brief DB정보 설정 connect/ close
* @brief DB settings and connect/close
**/
function _setDBInfo() {
$db_info = Context::getDBInfo();
@ -69,27 +69,25 @@
}
/**
* @brief DB 접속
* @brief DB Connection
**/
function _connect() {
// db 정보가 없으면 무시
// Ignore if no DB information exists
if(!$this->database) return;
// 데이터 베이스 파일 접속 시도
// Attempt to access the database file
$this->fd = sqlite_open($this->database, 0666, $error);
if(!file_exists($this->database) || $error) {
$this->setError(-1,$error);
$this->is_connected = false;
return;
}
// 접속체크
// Check connections
$this->is_connected = true;
$this->password = md5($this->password);
}
/**
* @brief DB접속 해제
* @brief DB disconnection
**/
function close() {
if(!$this->isConnected()) return;
@ -97,7 +95,7 @@
}
/**
* @brief 트랜잭션 시작
* @brief Begin transaction
**/
function begin() {
if(!$this->is_connected || $this->transaction_started) return;
@ -105,7 +103,7 @@
}
/**
* @brief 롤백
* @brief Rollback
**/
function rollback() {
if(!$this->is_connected || !$this->transaction_started) return;
@ -114,7 +112,7 @@
}
/**
* @brief 커밋
* @brief Commits
**/
function commit($force = false) {
if(!$force && (!$this->isConnected() || !$this->transaction_started)) return;
@ -124,7 +122,7 @@
}
/**
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
* @brief Add quotes on the string variables in a query
**/
function addQuotes($string) {
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string));
@ -133,34 +131,30 @@
}
/**
* @brief : 쿼리문의 실행 결과의 fetch 처리
* @brief : Run a query and fetch the result
*
* query : query문 실행하고 result return\n
* fetch : reutrn 값이 없으면 NULL\n
* rows이면 array object\n
* row이면 object\n
* query: run a query and return the result \n
* fetch: NULL if no value is returned \n
* array object if rows are returned \n
* object if a row is returned \n
* return\n
**/
function _query($query) {
if(!$this->isConnected()) return;
// 쿼리 시작을 알림
// Notify to start a query execution
$this->actStart($query);
// 쿼리 문 실행
// Run the query statement
$result = @sqlite_query($query, $this->fd);
// 오류 체크
// Error Check
if(sqlite_last_error($this->fd)) $this->setError(sqlite_last_error($this->fd), sqlite_error_string(sqlite_last_error($this->fd)));
// 쿼리 실행 알림
// Notify to complete a query execution
$this->actFinish();
return $result;
}
/**
* @brief 결과를 fetch
* @brief Fetch results
**/
function _fetch($result) {
if($this->isError() || !$result) return;
@ -180,7 +174,7 @@
}
/**
* @brief 1 증가되는 sequence값을 return
* @brief Return the sequence value is incremented by 1
**/
function getNextSequence() {
$query = sprintf("insert into %ssequence (seq) values ('')", $this->prefix);
@ -195,7 +189,7 @@
}
/**
* @brief 테이블 기생성 여부 return
* @brief Return if a table already exists
**/
function isTableExists($target_name) {
$query = sprintf('pragma table_info(%s%s)', $this->prefix, $this->addQuotes($target_name));
@ -205,7 +199,7 @@
}
/**
* @brief 특정 테이블에 특정 column 추가
* @brief Add a column to a table
**/
function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) {
$type = $this->column_type[$type];
@ -221,7 +215,7 @@
}
/**
* @brief 특정 테이블에 특정 column 제거
* @brief Delete a column from a table
**/
function dropColumn($table_name, $column_name) {
$query = sprintf("alter table %s%s drop column %s ", $this->prefix, $table_name, $column_name);
@ -229,7 +223,7 @@
}
/**
* @brief 특정 테이블의 column의 정보를 return
* @brief Return column information of a table
**/
function isColumnExists($table_name, $column_name) {
$query = sprintf("pragma table_info(%s%s)", $this->prefix, $table_name);
@ -246,7 +240,7 @@
}
/**
* @brief 특정 테이블에 특정 인덱스 추가
* @brief Add an index to a table
* $target_columns = array(col1, col2)
* $is_unique? unique : none
**/
@ -261,7 +255,7 @@
}
/**
* @brief 특정 테이블의 특정 인덱스 삭제
* @brief Drop an index from a table
**/
function dropIndex($table_name, $index_name, $is_unique = false) {
$key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name);
@ -270,7 +264,7 @@
}
/**
* @brief 특정 테이블의 index 정보를 return
* @brief Return index information of a table
**/
function isIndexExists($table_name, $index_name) {
$key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name);
@ -282,24 +276,24 @@
}
/**
* @brief xml 받아서 테이블을 생성
* @brief Create a table by using xml file
**/
function createTableByXml($xml_doc) {
return $this->_createTable($xml_doc);
}
/**
* @brief xml 받아서 테이블을 생성
* @brief Create a table by using xml file
**/
function createTableByXmlFile($file_name) {
if(!file_exists($file_name)) return;
// xml 파일을 읽음
// read xml file
$buff = FileHandler::readFile($file_name);
return $this->_createTable($buff);
}
/**
* @brief schema xml을 이용하여 create table query생성
* @brief generate a query statement to create a table by using schema xml
*
* type : number, varchar, text, char, date, \n
* opt : notnull, default, size\n
@ -309,8 +303,7 @@
// xml parsing
$oXml = new XmlParser();
$xml_obj = $oXml->parse($xml_doc);
// 테이블 생성 schema 작성
// Create a table schema
$table_name = $xml_obj->table->attrs->name;
if($this->isTableExists($table_name)) return;
$table_name = $this->prefix.$table_name;
@ -371,7 +364,7 @@
}
/**
* @brief 조건문 작성하여 return
* @brief Return conditional clause
**/
function getCondition($output) {
if(!$output->conditions) return;
@ -415,15 +408,14 @@
}
/**
* @brief insertAct 처리
* @brief Handle the insertAct
**/
function _executeInsertAct($output) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[] = $this->prefix.$val;
}
// 컬럼 정리
// List columns
foreach($output->columns as $key => $val) {
$name = $val['name'];
$value = $val['value'];
@ -441,18 +433,16 @@
}
/**
* @brief updateAct 처리
* @brief Handle updateAct
**/
function _executeUpdateAct($output) {
$table_count = count(array_values($output->tables));
// 대상 테이블이 1개일 경우
// If one day the destination table
if($table_count == 1) {
// 테이블 정리
// List tables
list($target_table) = array_values($output->tables);
$target_table = $this->prefix.$target_table;
// 컬럼 정리
// List columns
foreach($output->columns as $key => $val) {
if(!isset($val['value'])) continue;
$name = $val['name'];
@ -465,27 +455,23 @@
$column_list[] = sprintf("%s = %s", $name, $value);
}
}
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
$query = sprintf("update %s set %s %s", $target_table, implode(',',$column_list), $condition);
// 대상 테이블이 2개일 경우 (sqlite에서 update 테이블을 1개 이상 지정 못해서 이렇게 꽁수로... 다른 방법이 있으려나..)
// trick to handle if targt table to update is more than one (sqlite doesn't support update to multi-tables)
} elseif($table_count == 2) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[$val] = $this->prefix.$key;
}
list($source_table, $target_table) = array_values($table_list);
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
foreach($table_list as $key => $val) {
$condition = eregi_replace($key.'\\.', $val.'.', $condition);
}
// 컬럼 정리
// List columns
foreach($output->columns as $key => $val) {
if(!isset($val['value'])) continue;
$name = $val['name'];
@ -507,15 +493,14 @@
}
/**
* @brief deleteAct 처리
* @brief Handle deleteAct
**/
function _executeDeleteAct($output) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[] = $this->prefix.$val;
}
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
@ -524,13 +509,13 @@
}
/**
* @brief selectAct 처리
* @brief Handle selectAct
*
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
* navigation이라는 method를 제공
* In order to get a list of pages easily when selecting \n
* it supports a method as navigation
**/
function _executeSelectAct($output) {
// 테이블 정리
// List tables
$table_list = array();
foreach($output->tables as $key => $val) {
$table_list[] = $this->prefix.$val.' as '.$key;
@ -573,8 +558,7 @@
$output->column_list = $column_list;
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// Add a condition to use an index when sorting in order by list_order, update_order
if($output->order) {
$conditions = $this->getConditionList($output);
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
@ -597,8 +581,7 @@
}
if(count($index_list)) $query .= ' order by '.implode(',',$index_list);
}
// list_count를 사용할 경우 적용
// Apply when using list_count
if($output->list_count['value']) $query = sprintf('%s limit %d', $query, $output->list_count['value']);
$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):'';
@ -620,17 +603,17 @@
}
/**
* @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다
* @brief Paging is handled if navigation information exists in the query xml
*
* 그닥 좋지는 않은 구조이지만 편리하다.. -_-;
* It is quite convenient although its structure is not good at all .. -_-;
**/
function _getNavigationData($table_list, $columns, $left_join, $condition, $output) {
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
$column_list = $output->column_list;
/*
// group by 절이 포함된 SELECT 쿼리의 전체 갯수를 구하기 위한 수정
// 정상적인 동작이 확인되면 주석으로 막아둔 부분으로 대체합니다.
// Modified to find total number of SELECT queries having group by clause
// If it works correctly, uncomment the following codes
//
$count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition;
$total_count = $this->getCountCache($output->tables, $count_condition);
@ -644,8 +627,7 @@
$this->putCountCache($output->tables, $count_condition, $total_count);
}
*/
// 전체 개수를 구함
// Get a total count
$count_query = sprintf("select count(*) as count from %s %s %s", implode(',',$table_list),implode(' ',$left_join), $condition);
$count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):'';
$result = $this->_query($count_query);
@ -658,16 +640,13 @@
if(!$page_count) $page_count = 10;
$page = $output->page['value'];
if(!$page) $page = 1;
// 전체 페이지를 구함
// Get a total page
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
else $total_page = 1;
// 페이지 변수를 체크
// Check Page variables
if($page > $total_page) $page = $total_page;
$start_count = ($page-1)*$list_count;
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// Add a condition to use an index when sorting in order by list_order, update_order
if($output->order) {
$conditions = $this->getConditionList($output);
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {

View file

@ -2,21 +2,21 @@
/**
* @class DBSqlite3_pdo
* @author NHN (developers@xpressengine.com)
* @brief SQLite3를 PDO로 이용하여 class
* @brief class to use SQLite3 with PDO
* @version 0.1
**/
class DBSqlite3_pdo extends DB {
/**
* DB이용하기 위한 정보
* DB information
**/
var $database = NULL; ///< database
var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE 설치 가능)
var $prefix = 'xe'; // /< prefix of a tablename (many XEs can be installed in a single DB)
var $comment_syntax = '/* %s */';
/**
* PDO 사용시 필요한 변수들
* Variables for using PDO
**/
var $handler = NULL;
var $stmt = NULL;
@ -24,10 +24,10 @@
var $bind_vars = array();
/**
* @brief sqlite3 에서 사용될 column type
* @brief column type used in sqlite3
*
* column_typeschema/query xml에서 공통 선언된 type을 이용하기 때문에
* DBMS에 맞게 replace 해주어야 한다
* column_type should be replaced for each DBMS properly
* because column_type uses a commonly defined type in schema/query xml files
**/
var $column_type = array(
'bignumber' => 'INTEGER',
@ -57,14 +57,14 @@
}
/**
* @brief 설치 가능 여부를 return
* @brief Return if installable
**/
function isSupported() {
return class_exists('PDO');
}
/**
* @brief DB정보 설정 connect/ close
* @brief DB settings and connect/close
**/
function _setDBInfo() {
$db_info = Context::getDBInfo();
@ -74,13 +74,13 @@
}
/**
* @brief DB 접속
* @brief DB Connection
**/
function _connect() {
// db 정보가 없으면 무시
// override if db information not exists
if(!$this->database) return;
// 데이터 베이스 파일 접속 시도
// Attempt to access the database file
try {
// PDO is only supported with PHP5,
// so it is allowed to use try~catch statment in this class.
@ -91,13 +91,13 @@
return;
}
// 접속체크
// Check connections
$this->is_connected = true;
$this->password = md5($this->password);
}
/**
* @brief DB접속 해제
* @brief disconnect to DB
**/
function close() {
if(!$this->is_connected) return;
@ -105,7 +105,7 @@
}
/**
* @brief 트랜잭션 시작
* @brief Begin a transaction
**/
function begin() {
if(!$this->is_connected || $this->transaction_started) return;
@ -113,7 +113,7 @@
}
/**
* @brief 롤백
* @brief Rollback
**/
function rollback() {
if(!$this->is_connected || !$this->transaction_started) return;
@ -122,7 +122,7 @@
}
/**
* @brief 커밋
* @brief Commit
**/
function commit($force = false) {
if(!$force && (!$this->is_connected || !$this->transaction_started)) return;
@ -131,7 +131,7 @@
}
/**
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
* @brief Add or change quotes to the query string variables
**/
function addQuotes($string) {
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string));
@ -140,12 +140,12 @@
}
/**
* @brief : 쿼리문의 prepare
* @brief : Prepare a query statement
**/
function _prepare($query) {
if(!$this->is_connected) return;
// 쿼리 시작을 알림
// notify to start a query execution
$this->actStart($query);
$this->stmt = $this->handler->prepare($query);
@ -159,7 +159,7 @@
}
/**
* @brief : stmt에 binding params
* @brief : Binding params in stmt
**/
function _bind($val) {
if(!$this->is_connected || !$this->stmt) return;
@ -170,7 +170,7 @@
}
/**
* @brief : prepare된 쿼리의 execute
* @brief : execute the prepared statement
**/
function _execute() {
if(!$this->is_connected || !$this->stmt) return;
@ -200,7 +200,7 @@
}
/**
* @brief 1 증가되는 sequence값을 return
* @brief Return the sequence value incremented by 1
**/
function getNextSequence() {
$query = sprintf("insert into %ssequence (seq) values (NULL)", $this->prefix);
@ -217,7 +217,7 @@
}
/**
* @brief 테이블 기생성 여부 return
* @brief return if the table already exists
**/
function isTableExists($target_name) {
$query = sprintf('pragma table_info(%s%s)', $this->prefix, $target_name);
@ -227,7 +227,7 @@
}
/**
* @brief 특정 테이블에 특정 column 추가
* @brief Add a column to a table
**/
function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) {
$type = $this->column_type[$type];
@ -244,7 +244,7 @@
}
/**
* @brief 특정 테이블에 특정 column 제거
* @brief Remove a column from a table
**/
function dropColumn($table_name, $column_name) {
$query = sprintf("alter table %s%s drop column %s ", $this->prefix, $table_name, $column_name);
@ -252,7 +252,7 @@
}
/**
* @brief 특정 테이블의 column의 정보를 return
* @brief Return column information of a table
**/
function isColumnExists($table_name, $column_name) {
$query = sprintf("pragma table_info(%s%s)", $this->prefix, $table_name);
@ -270,7 +270,7 @@
}
/**
* @brief 특정 테이블에 특정 인덱스 추가
* @brief Add an index to a table
* $target_columns = array(col1, col2)
* $is_unique? unique : none
**/
@ -285,7 +285,7 @@
}
/**
* @brief 특정 테이블의 특정 인덱스 삭제
* @brief Drop an index from a table
**/
function dropIndex($table_name, $index_name, $is_unique = false) {
$key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name);
@ -294,7 +294,7 @@
}
/**
* @brief 특정 테이블의 index 정보를 return
* @brief Return index information of a table
**/
function isIndexExists($table_name, $index_name) {
$key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name);
@ -307,24 +307,24 @@
}
/**
* @brief xml 받아서 테이블을 생성
* @brief create a table from xml file
**/
function createTableByXml($xml_doc) {
return $this->_createTable($xml_doc);
}
/**
* @brief xml 받아서 테이블을 생성
* @brief create a table from xml file
**/
function createTableByXmlFile($file_name) {
if(!file_exists($file_name)) return;
// xml 파일을 읽음
// read xml file
$buff = FileHandler::readFile($file_name);
return $this->_createTable($buff);
}
/**
* @brief schema xml을 이용하여 create table query생성
* @brief generate a query to create a table using the schema xml
*
* type : number, varchar, text, char, date, \n
* opt : notnull, default, size\n
@ -334,8 +334,7 @@
// xml parsing
$oXml = new XmlParser();
$xml_obj = $oXml->parse($xml_doc);
// 테이블 생성 schema 작성
// Create a table schema
$table_name = $xml_obj->table->attrs->name;
if($this->isTableExists($table_name)) return;
$table_name = $this->prefix.$table_name;
@ -401,7 +400,7 @@
}
/**
* @brief 조건문 작성하여 return
* @brief Return conditional clause(where)
**/
function getCondition($output) {
if(!$output->conditions) return;
@ -445,15 +444,14 @@
}
/**
* @brief insertAct 처리
* @brief insertAct
**/
function _executeInsertAct($output) {
// 테이블 정리
// list tables
foreach($output->tables as $key => $val) {
$table_list[] = $this->prefix.$val;
}
// 컬럼 정리
// list columns
foreach($output->columns as $key => $val) {
$name = $val['name'];
$value = $val['value'];
@ -480,18 +478,16 @@
}
/**
* @brief updateAct 처리
* @brief updateAct
**/
function _executeUpdateAct($output) {
$table_count = count(array_values($output->tables));
// 대상 테이블이 1개일 경우
// If a target table is one
if($table_count == 1) {
// 테이블 정리
// list tables
list($target_table) = array_values($output->tables);
$target_table = $this->prefix.$target_table;
// 컬럼 정리
// list columns
foreach($output->columns as $key => $val) {
if(!isset($val['value'])) continue;
$name = $val['name'];
@ -504,27 +500,23 @@
$column_list[] = sprintf("%s = %s", $name, $value);
}
}
// 조건절 정리
// List where cluase
$condition = $this->getCondition($output);
$query = sprintf("update %s set %s %s", $target_table, implode(',',$column_list), $condition);
// 대상 테이블이 2개일 경우 (sqlite에서 update 테이블을 1개 이상 지정 못해서 이렇게 꽁수로... 다른 방법이 있으려나..)
// If tables to update are morea than two (In sqlite, it is possible to update a single table only. Let me know if you know a better way)
} elseif($table_count == 2) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[$val] = $this->prefix.$key;
}
list($source_table, $target_table) = array_values($table_list);
// 조건절 정리
// List where cluase
$condition = $this->getCondition($output);
foreach($table_list as $key => $val) {
$condition = eregi_replace($key.'\\.', $val.'.', $condition);
}
// 컬럼 정리
// List columns
foreach($output->columns as $key => $val) {
if(!isset($val['value'])) continue;
$name = $val['name'];
@ -547,15 +539,14 @@
}
/**
* @brief deleteAct 처리
* @brief deleteAct
**/
function _executeDeleteAct($output) {
// 테이블 정리
// List tables
foreach($output->tables as $key => $val) {
$table_list[] = $this->prefix.$val;
}
// 조건절 정리
// List the conditional clause
$condition = $this->getCondition($output);
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
@ -565,13 +556,13 @@
}
/**
* @brief selectAct 처리
* @brief selectAct
*
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
* navigation이라는 method를 제공
* To fetch a list of the page conveniently when selecting, \n
* navigation method supported
**/
function _executeSelectAct($output) {
// 테이블 정리
// List tables
$table_list = array();
foreach($output->tables as $key => $val) {
$table_list[] = $this->prefix.$val.' as '.$key;
@ -616,8 +607,7 @@
$output->column_list = $column_list;
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// add the condition to the query to use an index for ordering by list_order, update_order
if($output->order) {
$conditions = $this->getConditionList($output);
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
@ -655,7 +645,7 @@
}
$query = sprintf("select %s from %s %s %s %s", $columns, implode(',',$table_list),implode(' ',$left_join), $condition, $groupby_query.$orderby_query);
// list_count를 사용할 경우 적용
// apply when using list_count
if($output->list_count['value']) $query = sprintf('%s limit %d', $query, $output->list_count['value']);
$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):'';
@ -676,17 +666,17 @@
}
/**
* @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다
* @brief Paging is handled if navigation information exists in the query xml
*
* 그닥 좋지는 않은 구조이지만 편리하다.. -_-;
* It is quite convenient although its structure is not good at all .. -_-;
**/
function _getNavigationData($table_list, $columns, $left_join, $condition, $output) {
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
$column_list = $output->column_list;
/*
// group by 절이 포함된 SELECT 쿼리의 전체 갯수를 구하기 위한 수정
// 정상적인 동작이 확인되면 주석으로 막아둔 부분으로 대체합니다.
// Modified to find total number of SELECT queries having group by clause
// If it works correctly, uncomment the following codes
//
$count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition;
$total_count = $this->getCountCache($output->tables, $count_condition);
@ -700,8 +690,7 @@
$this->putCountCache($output->tables, $count_condition, $total_count);
}
*/
// 전체 개수를 구함
// Get a total count
$count_query = sprintf("select count(*) as count from %s %s %s", implode(',',$table_list),implode(' ',$left_join), $condition);
$count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):'';
$this->_prepare($count_query);
@ -714,16 +703,13 @@
if(!$page_count) $page_count = 10;
$page = $output->page['value'];
if(!$page) $page = 1;
// 전체 페이지를 구함
// Get a total page
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
else $total_page = 1;
// 페이지 변수를 체크
// Check Page variables
if($page > $total_page) $page = $total_page;
$start_count = ($page-1)*$list_count;
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
// Add a condition to use an index when sorting in order by list_order, update_order
if($output->order) {
$conditions = $this->getConditionList($output);
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
@ -760,7 +746,7 @@
$columns = join(',',$output->arg_columns);
}
// return 결과물 생성
// Return the result
$buff = new Object();
$buff->total_count = 0;
$buff->total_page = 0;
@ -768,7 +754,7 @@
$buff->data = array();
$buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count);
// 쿼리 실행
// Query Execution
$query = sprintf("select %s from %s %s %s %s", $columns, implode(',',$table_list),implode(' ',$left_join), $condition, $groupby_query.$orderby_query);
$query = sprintf('%s limit %d, %d', $query, $start_count, $list_count);
$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):'';

View file

@ -10,9 +10,9 @@
class DisplayHandler extends Handler {
var $content_size = 0; ///< 출력하는 컨텐츠의 사이즈
var $content_size = 0; // /< The size of displaying contents
var $gz_enabled = false; ///< gzip 압축하여 컨텐츠 호출할 것인지에 대한 flag변수
var $gz_enabled = false; // / <a flog variable whether to call contents after compressing by gzip
var $handler = null;
/**
@ -22,16 +22,14 @@
* @param[in] $oModule the module object
**/
function printContent(&$oModule) {
// gzip encoding 지원 여부 체크
// Check if the gzip encoding supported
if(
(defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) &&
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')!==false &&
function_exists('ob_gzhandler') &&
extension_loaded('zlib')
) $this->gz_enabled = true;
// request method에 따른 컨텐츠 결과물 추출
// Extract contents to display by the request method
if(Context::get('xeVirtualRequestMethod')=='xml') {
require_once("./classes/display/VirtualXMLDisplayHandler.php");
$handler = new VirtualXMLDisplayHandler();
@ -51,33 +49,27 @@
}
$output = $handler->toDoc($oModule);
// 출력하기 전에 trigger 호출 (before)
// call a trigger before display
ModuleHandler::triggerCall('display', 'before', $output);
// 애드온 실행
// execute add-on
$called_position = 'before_display_content';
$oAddonController = &getController('addon');
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
@include($addon_file);
if(method_exists($handler, "prepareToPrint")) $handler->prepareToPrint($output);
// header 출력
// header output
if($this->gz_enabled) header("Content-Encoding: gzip");
if(Context::getResponseMethod() == 'JSON') $this->_printJSONHeader();
else if(Context::getResponseMethod() != 'HTML') $this->_printXMLHeader();
else $this->_printHTMLHeader();
// debugOutput 출력
// debugOutput output
$this->content_size = strlen($output);
$output .= $this->_debugOutput();
// 결과물 직접 출력
// results directly output
if($this->gz_enabled) print ob_gzhandler($output, 5);
else print $output;
// 출력 후 trigger 호출 (after)
// call a trigger after display
ModuleHandler::triggerCall('display', 'after', $content);
}
@ -91,8 +83,7 @@
if(!__DEBUG__) return;
$end = getMicroTime();
// Firebug 콘솔 출력
// Firebug console output
if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) {
static $firephp;
if(!isset($firephp)) $firephp = FirePHP::getInstance(true);
@ -101,8 +92,7 @@
$firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.');
return;
}
// 전체 실행 시간 출력, Request/Response info 출력
// display total execution time and Request/Response info
if(__DEBUG__ & 2) {
$firephp->fb(
array('Request / Response info >>> '.$_SERVER['REQUEST_METHOD'].' / '.Context::getResponseMethod(),
@ -135,8 +125,7 @@
'TABLE'
);
}
// DB 쿼리 내역 출력
// display DB query history
if((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) {
$queries_output = array(array('Query', 'Elapsed time', 'Result'));
foreach($GLOBALS['__db_queries__'] as $query) {
@ -150,43 +139,34 @@
'TABLE'
);
}
// 파일 및 HTML 주석으로 출력
// dislpay the file and HTML comments
} else {
// 전체 실행 시간 출력, Request/Response info 출력
// display total execution time and Request/Response info
if(__DEBUG__ & 2) {
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
return;
}
// Request/Response 정보 작성
// Request/Response information
$buff .= "\n- Request/ Response info\n";
$buff .= sprintf("\tRequest URI \t\t\t: %s:%s%s%s%s\n", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']?'?':'', $_SERVER['QUERY_STRING']);
$buff .= sprintf("\tRequest method \t\t\t: %s\n", $_SERVER['REQUEST_METHOD']);
$buff .= sprintf("\tResponse method \t\t: %s\n", Context::getResponseMethod());
$buff .= sprintf("\tResponse contents size\t\t: %d byte\n", $this->content_size);
// 전체 실행 시간
// total execution time
$buff .= sprintf("\n- Total elapsed time : %0.5f sec\n", $end-__StartTime__);
$buff .= sprintf("\tclass file load elapsed time \t: %0.5f sec\n", $GLOBALS['__elapsed_class_load__']);
$buff .= sprintf("\tTemplate compile elapsed time\t: %0.5f sec (%d called)\n", $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']);
$buff .= sprintf("\tXmlParse compile elapsed time\t: %0.5f sec\n", $GLOBALS['__xmlparse_elapsed__']);
$buff .= sprintf("\tPHP elapsed time \t\t: %0.5f sec\n", $end-__StartTime__-$GLOBALS['__template_elapsed__']-$GLOBALS['__xmlparse_elapsed__']-$GLOBALS['__db_elapsed_time__']-$GLOBALS['__elapsed_class_load__']);
// 위젯 실행 시간 작성
// widget execution time
$buff .= sprintf("\n\tWidgets elapsed time \t\t: %0.5f sec", $GLOBALS['__widget_excute_elapsed__']);
// 레이아웃 실행 시간
// layout execution time
$buff .= sprintf("\n\tLayout compile elapsed time \t: %0.5f sec", $GLOBALS['__layout_compile_elapsed__']);
// 위젯, 에디터 컴포넌트 치환 시간
// Widgets, the editor component replacement time
$buff .= sprintf("\n\tTrans Content \t\t\t: %0.5f sec\n", $GLOBALS['__trans_content_elapsed__']);
}
// DB 로그 작성
// DB Logging
if(__DEBUG__ & 4) {
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
return;
@ -206,8 +186,7 @@
}
}
}
// HTML 주석으로 출력
// Output in HTML comments
if($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') {
$buff = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
@ -217,8 +196,7 @@
return "<!--\r\n".$buff."\r\n-->";
}
// 파일에 출력
// Output to a file
if($buff && __DEBUG_OUTPUT__ == 0) {
$debug_file = _XE_PATH_.'files/_debug_message.php';
$buff = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));

View file

@ -28,21 +28,21 @@ class HTMLDisplayHandler {
$edited_layout_file = $oModule->getEditedLayoutFile();
// 현재 요청된 레이아웃 정보를 구함
// get the layout information currently requested
$oLayoutModel = &getModel('layout');
$layout_info = Context::get('layout_info');
$layout_srl = $layout_info->layout_srl;
// 레이아웃과 연결되어 있으면 레이아웃 컴파일
// compile if connected to the layout
if($layout_srl > 0){
// faceoff 레이아웃일 경우 별도 처리
// handle separately if the layout is faceoff
if($layout_info && $layout_info->type == 'faceoff') {
$oLayoutModel->doActivateFaceOff($layout_info);
Context::set('layout_info', $layout_info);
}
// 관리자 레이아웃 수정화면에서 변경된 CSS가 있는지 조사
// search if the changes CSS exists in the admin layout edit window
$edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl);
if(file_exists($edited_layout_css)) Context::addCSSFile($edited_layout_css,true,'all','',100);
@ -66,13 +66,13 @@ class HTMLDisplayHandler {
if(__DEBUG__==3) $start = getMicroTime();
// body 내의 <style ..></style>를 header로 이동
// move <style ..></style> in body to the header
$output = preg_replace_callback('!<style(.*?)<\/style>!is', array($this,'_moveStyleToHeader'), $output);
// 메타 파일 변경 (캐싱기능등으로 인해 위젯등에서 <!--Meta:경로--> 태그를 content에 넣는 경우가 있음
$output = preg_replace_callback('/<!--(#)?Meta:([a-z0-9\_\/\.\@]+)-->/is', array($this,'_transMeta'), $output);
// change a meta fine(widget often put the tag like <!--Meta:path--> to the content because of caching)
$output = preg_replace_callback('/<!--Meta:([a-z0-9\_\/\.\@]+)-->/is', array($this,'_transMeta'), $output);
// rewrite module 사용시 생기는 상대경로에 대한 처리를 함
// handles a relative path generated by using the rewrite module
if(Context::isAllowRewrite()) {
$url = parse_url(Context::getRequestUri());
$real_path = $url['path'];
@ -89,15 +89,15 @@ class HTMLDisplayHandler {
}
}
// 간혹 background-image에 url(none) 때문에 request가 한번 더 일어나는 경우가 생기는 것을 방지
// prevent the 2nd request due to url(none) of the background-image
$output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output);
if(__DEBUG__==3) $GLOBALS['__trans_content_elapsed__'] = getMicroTime()-$start;
// 불필요한 정보 제거
// Remove unnecessary information
$output = preg_replace('/member\_\-([0-9]+)/s','member_0',$output);
// 최종 레이아웃 변환
// convert the final layout
Context::set('content', $output);
$oTemplate = &TemplateHandler::getInstance();
if(Mobile::isFromMobilePhone()) {
@ -109,7 +109,7 @@ class HTMLDisplayHandler {
$output = $oTemplate->compile('./common/tpl', 'common_layout');
}
// 사용자 정의 언어 변환
// replace the user-defined-language
$oModuleController = &getController('module');
$oModuleController->replaceDefinedLangCode($output);
}

View file

@ -2,15 +2,15 @@
/**
* @class EditorHandler
* @author NHN (developers@xpressengine.com)
* @brief edit component상위 클래스임
* @brief superclass of the edit component
*
* 주로 하는 일은 컴포넌트 요청시 컴포넌트에서 필요로 하는 변수를 세팅해준다
* set up the component variables
**/
class EditorHandler extends Object {
/**
* @brief 컴포넌트의 xml및 관련 정보들을 설정
* @brief set the xml and other information of the component
**/
function setInfo($info) {
Context::set('component_info', $info);

View file

@ -2,7 +2,7 @@
/**
* @class ExtraVar
* @author NHN (developers@xpressengine.com)
* @brief 게시글, 회원등에서 사용하는 확장변수를 핸들링하는 클래스
* @brief a class to handle extra variables used in posts, member and others
*
**/
class ExtraVar {
@ -25,7 +25,7 @@
}
/**
* @brief 확장변수 키를 등록
* @brief register a key of extra variable
* @param module_srl, idx, name, type, default, desc, is_required, search, value
**/
function setExtraVarKeys($extra_keys) {
@ -38,7 +38,7 @@
}
/**
* @brief 확장변수 객체 배열 return
* @brief Return an array of extra vars
**/
function getExtraVars() {
return $this->keys;
@ -48,7 +48,7 @@
/**
* @class ExtraItem
* @author NHN (developers@xpressengine.com)
* @brief 확장변수의 개별
* @brief each value of the extra vars
**/
class ExtraItem {
var $module_srl = 0;
@ -80,14 +80,14 @@
}
/**
* @brief 지정
* @brief Values
**/
function setValue($value) {
$this->value = $value;
}
/**
* @brief type에 따라서 주어진 값을 변형하여 원형 값을 return
* @brief return a given value converted based on its type
**/
function _getTypeValue($type, $value) {
$value = trim($value);
@ -134,8 +134,8 @@
}
/**
* @brief 값을 return
* 원형 값을 HTML 결과물로 return
* @brief Return value
* return the original values for HTML result
**/
function getValueHTML() {
$value = $this->_getTypeValue($this->type, $this->value);
@ -174,7 +174,7 @@
}
/**
* @brief type에 따른 form을 리턴
* @brief return a form based on its type
**/
function getFormHTML() {
static $id_num = 1000;
@ -188,17 +188,15 @@
$buff = '';
switch($type) {
// 홈페이지 주소
// Homepage
case 'homepage' :
$buff .= '<input type="text" name="'.$column_name.'" value="'.$value.'" class="homepage" />';
break;
// Email 주소
// Email Address
case 'email_address' :
$buff .= '<input type="text" name="'.$column_name.'" value="'.$value.'" class="email_address" />';
break;
// 전화번호
// Phone Number
case 'tel' :
$buff .=
'<input type="text" name="'.$column_name.'" value="'.$value[0].'" size="4" class="tel" />'.
@ -210,8 +208,7 @@
case 'textarea' :
$buff .= '<textarea name="'.$column_name.'" class="textarea">'.$value.'</textarea>';
break;
// 다중 선택
// multiple choice
case 'checkbox' :
$buff .= '<ul>';
foreach($default as $v) {
@ -225,8 +222,7 @@
}
$buff .= '</ul>';
break;
// 단일 선택
// single choice
case 'select' :
$buff .= '<select name="'.$column_name.'" class="select">';
foreach($default as $v) {
@ -251,8 +247,7 @@
}
$buff .= '</ul>';
break;
// 날짜 입력
// date
case 'date' :
// datepicker javascript plugin load
Context::loadJavascriptPlugin('ui.datepicker');
@ -272,8 +267,7 @@
'})(jQuery);'."\n".
'</script>';
break;
// 주소 입력
// address
case "kr_zip" :
// krzip address javascript plugin load
Context::loadJavascriptPlugin('ui.krzip');
@ -298,8 +292,7 @@
'<input type="text" name="'.$column_name.'" value="'.htmlspecialchars($value[1]).'" class="address" />'.
'';
break;
// 일반 text
// General text
default :
$buff .=' <input type="text" name="'.$column_name.'" value="'.$value.'" class="text" />';
break;

View file

@ -30,8 +30,7 @@
$source_dir = FileHandler::getRealPath($source_dir);
$target_dir = FileHandler::getRealPath($target_dir);
if(!is_dir($source_dir)) return false;
// target이 없을땐 생성
// generate when no target exists
if(!file_exists($target_dir)) FileHandler::makeDir($target_dir);
if(substr($source_dir, -1) != '/') $source_dir .= '/';

View file

@ -1,6 +1,6 @@
<?php
/**
* @brief 메일 발송
* @brief Mailing
* @author NHN (developers@xpressengine.com)
**/

View file

@ -55,7 +55,7 @@
/**
* @brief sett to set the template path for refresh.html
* @remark refresh.html is executed as a result of method execution
* 공통 tpl중 refresh.html을 실행할 ..
* Tpl as the common run of the refresh.html ..
**/
function setRefreshPage() {
$this->setTemplatePath('./common/tpl');
@ -76,21 +76,18 @@
* @param[in] $xml_info object containing module description
**/
function setModuleInfo($module_info, $xml_info) {
// 기본 변수 설정
// The default variable settings
$this->mid = $module_info->mid;
$this->module_srl = $module_info->module_srl;
$this->module_info = $module_info;
$this->xml_info = $xml_info;
$this->skin_vars = $module_info->skin_vars;
// 웹서비스에서 꼭 필요한 인증 정보와 권한 설정 체크
// validate certificate info and permission settings necessary in Web-services
$is_logged = Context::get('is_logged');
$logged_info = Context::get('logged_info');
// module model 객체 생성
// module model create an object
$oModuleModel = &getModel('module');
// XE에서 access, manager (== is_admin) 는 고정된 권한명이며 이와 관련된 권한 설정
// permission settings. access, manager(== is_admin) are fixed and privilege name in XE
$module_srl = Context::get('module_srl');
if(!$module_info->mid && preg_match('/^([0-9]+)$/',$module_srl)) {
$request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
@ -100,19 +97,15 @@
} else {
$grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info);
}
// 현재 모듈의 access 권한이 없으면 권한 없음 표시
// display no permission if the current module doesn't have an access privilege
//if(!$grant->access) return $this->stop("msg_not_permitted");
// 관리 권한이 없으면 permision, action 확인
// checks permission and action if you don't have an admin privilege
if(!$grant->manager) {
// 현재 요청된 action의 퍼미션 type(guest, member, manager, root)를 구함
// get permission types(guest, member, manager, root) of the currently requested action
$permission_target = $xml_info->permission->{$this->act};
// module.xml에 명시된 퍼미션이 없을때 action명에 Admin이 있으면 manager로 체크
// check manager if a permission in module.xml otherwise action if no permission
if(!$permission_target && substr_count($this->act, 'Admin')) $permission_target = 'manager';
// 권한 체크
// Check permissions
switch($permission_target) {
case 'root' :
$this->stop('msg_not_permitted_act');
@ -125,8 +118,7 @@
break;
}
}
// 권한변수 설정
// permission variable settings
$this->grant = $grant;
Context::set('grant', $grant);
@ -138,14 +130,12 @@
* @param $msg_code an error code
**/
function stop($msg_code) {
// proc 수행을 중지 시키기 위한 플래그 세팅
// flag setting to stop the proc processing
$this->stop_proc = true;
// 에러 처리
// Error handling
$this->setError(-1);
$this->setMessage($msg_code);
// message 모듈의 에러 표시
// Error message display by message module
$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
$oMessageObject = &ModuleHandler::getModuleInstance('message',$type);
$oMessageObject->setError(-1);
@ -241,7 +231,7 @@
*
**/
function proc() {
// stop_proc==true이면 그냥 패스
// pass if stop_proc is true
if($this->stop_proc) return false;
// trigger call
@ -252,23 +242,20 @@
return false;
}
// addon 실행(called_position 를 before_module_proc로 하여 호출)
// execute an addon(call called_position as before_module_proc)
$called_position = 'before_module_proc';
$oAddonController = &getController('addon');
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
@include($addon_file);
if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) {
// 권한 체크
// Check permissions
if(!$this->grant->access) return $this->stop("msg_not_permitted_act");
// 모듈의 스킨 정보를 연동 (스킨 정보의 테이블 분리로 동작대상 모듈에만 스킨 정보를 싱크시키도록 변경)
// integrate skin information of the module(change to sync skin info with the target module only by seperating its table)
$oModuleModel = &getModel('module');
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
Context::set('module_info', $this->module_info);
// 실행
// Run
$output = $this->{$this->act}();
}
else {
@ -283,7 +270,7 @@
return false;
}
// addon 실행(called_position 를 after_module_proc로 하여 호출)
// execute an addon(call called_position as after_module_proc)
$called_position = 'after_module_proc';
$oAddonController = &getController('addon');
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
@ -294,8 +281,7 @@
$this->setMessage($output->getMessage());
return false;
}
// view action이고 결과 출력이 XMLRPC 또는 JSON일 경우 해당 모듈의 api method를 실행
// execute api methos of the module if view action is and result is XMLRPC or JSON
if($this->module_info->module_type == 'view'){
if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') {
$oAPI = getAPI($this->module_info->module, 'api');
@ -304,7 +290,6 @@
}
}
}
return true;
}
}

View file

@ -9,10 +9,10 @@
class Object {
var $error = 0; ///< 에러 코드 (0이면 에러 아님)
var $message = 'success'; ///< 에러 메세지 (success이면 에러 아님)
var $error = 0; // / "Error code (if 0, it is not an error)
var $message = 'success'; // / "Error message (if success, it is not an error)
var $variables = array(); ///< 추가 변수
var $variables = array(); // /< an additional variable
/**
* @brief constructor

View file

@ -151,22 +151,22 @@
// replace value of src in img/input/script tag
$buff = preg_replace_callback('/<(img|input|script)([^>]*)src="([^"]*?)"/is', array($this, '_replacePath'), $buff);
// loop 템플릿 문법을 변환
// replace the loop template syntax
$buff = $this->_replaceLoop($buff);
// cond 템플릿 문법을 변환
// |replace the cond template syntax
$buff = $this->_replaceCond($buff);
// |cond 템플릿 문법을 변환
// replace the cond template syntax
$buff = preg_replace_callback("/<\/?(\w+)((\s+\w+(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)\/?>/i", array($this, '_replacePipeCond'), $buff);
// include 태그의 변환
// replace the include tags
$buff = preg_replace_callback('!<include ([^>]+)>!is', array($this, '_replaceInclude'), $buff);
// unload/ load 태그의 변환
// replace unload/load tags
$buff = preg_replace_callback('!<(unload|load) ([^>]+)>!is', array($this, '_replaceLoad'), $buff);
// 가상 태그인 block의 변환
// replace block which is a virtual tag
$buff = preg_replace('/<block([ ]*)>|<\/block>/is','',$buff);
// replace include <!--#include($filename)-->
@ -190,7 +190,7 @@
// replace variables
$buff = preg_replace_callback('/\{[^@^ ]([^\{\}\n]+)\}/i', array($this, '_compileVarToContext'), $buff);
// PHP 변수형의 변환 ($문자등을 공유 context로 변환)
// replace PHP variable types(converts characters like $ into shared context)
$buff = $this->_replaceVarInPHP($buff);
// replace parts not displaying results
@ -246,7 +246,7 @@
}
/**
* @brief loop 문법의 변환
* @brief replace loop syntax
**/
function _replaceLoop($buff)
{
@ -331,7 +331,7 @@
}
/**
* @brief pipe cond, |cond= 변환
* @brief replace pipe cond and |cond=
**/
function _replacePipeCond($matches)
{
@ -346,7 +346,7 @@
}
/**
* @brief cond 문법의 변환
* @brief replace cond syntax
**/
function _replaceCond($buff)
{
@ -406,7 +406,7 @@
}
/**
* @brief 다른 template파일을 include하는 include tag의 변환
* @brief replace include tags which include other template files
**/
function _replaceInclude($matches)
{
@ -442,7 +442,7 @@
}
/**
* @brief load 태그의 변환
* @brief replace load tags
**/
function _replaceLoad($matches) {
$output = $matches[0];
@ -539,7 +539,7 @@
}
/**
* @brief $문자 PHP 변수 변환
* @brief replace PHP variables of $ character
**/
function _replaceVarInPHP($buff) {
$head = $tail = '';
@ -558,7 +558,7 @@
/**
* @brief php5의 class::$변수명의 경우 context를 사용하지 않아야 하기에 함수로 대체
* @brief if class::$variable_name in php5, replace the function not to use context
**/
function _replaceVarString($matches)
{

View file

@ -12,11 +12,11 @@
* <form> <-- code to validate data in the form
* <node target="name" required="true" minlength="1" maxlength="5" filter="email,userid,alpha,number" equalto="target" />
* </form>
* <parameter> <-- 항목을 조합하여 key=val js array로 return, act는 필수
* <parameter> "- A form of key = val combination of items to js array return, act required
* <param name="key" target="target" />
* </parameter>
* <response callback_func="callback 받게 될 js function 이름 지정" > <-- 서버에 ajax로 전송하여 받을 결과값
* <tag name="error" /> <-- error이름의 결과값을 받겠다는
* <response callback_func="specifying the name of js function to callback" > "- Result to get by sending ajax to the server
* <tag name="error" /> <- get the result of error name
* </response>
* </filter>
* }
@ -36,7 +36,7 @@
*
* - parameter - param
* name = key : indicate that a new array, 'key' will be created and a value will be assigned to it
* target = target_name : target form element값을 가져옴
* target = target_name: get the value of the target form element
*
* - response
* tag = key : name of variable that will contain the result of the execution
@ -45,9 +45,9 @@
class XmlJsFilter extends XmlParser {
var $version = '0.2.5';
var $compiled_path = './files/cache/js_filter_compiled/'; ///< 컴파일된 캐시 파일이 놓일 위치
var $xml_file = NULL; ///< 대상 xml 파일
var $js_file = NULL; ///< 컴파일된 js 파일
var $compiled_path = './files/cache/js_filter_compiled/'; // / directory path for compiled cache file
var $xml_file = NULL; // / Target xml file
var $js_file = NULL; // / Compiled js file
/**
* @brief constructor
@ -75,7 +75,7 @@
function _compile() {
global $lang;
// xml 파일을 읽음
// read xml file
$buff = FileHandler::readFile($this->xml_file);
// xml parsing
@ -84,7 +84,7 @@
$attrs = $xml_obj->filter->attrs;
$rules = $xml_obj->filter->rules;
// XmlJsFilter는 filter_name, field, parameter 3개의 데이터를 핸들링
// XmlJsFilter handles three data; filter_name, field, and parameter
$filter_name = $attrs->name;
$confirm_msg_code = $attrs->confirm_msg_code;
$module = $attrs->module;
@ -101,27 +101,27 @@
$response_tag = $xml_obj->filter->response->tag;
if($response_tag && !is_array($response_tag)) $response_tag = array($response_tag);
// extend_filter가 있을 경우 해당 method를 호출하여 결과를 받음
// If extend_filter exists, result returned by calling the method
if($extend_filter) {
// extend_filter가 있을 경우 캐시 사용을 못하도록 js 캐시 파일명을 변경
// If extend_filter exists, it changes the name of cache not to use cache
$this->js_file .= '.nocache.js';
// extend_filter는 module.method 로 지칭되어 이를 분리
// Separate the extend_filter
list($module_name, $method) = explode('.',$extend_filter);
// 모듈 이름과 method가 있을 경우 진행
// contibue if both module_name and methos exist.
if($module_name&&$method) {
// 해당 module의 model 객체를 받음
// get model object of the module
$oExtendFilter = &getModel($module_name);
// method가 존재하면 실행
// execute if method exists
if(method_exists($oExtendFilter, $method)) {
// 결과를 받음
// get the result
$extend_filter_list = $oExtendFilter->{$method}(true);
$extend_filter_count = count($extend_filter_list);
// 결과에서 lang값을 이용 문서 변수에 적용
// apply lang_value from the result to the variable
for($i=0; $i < $extend_filter_count; $i++) {
$name = $extend_filter_list[$i]->name;
$lang_value = $extend_filter_list[$i]->lang;
@ -132,7 +132,7 @@
}
}
// 언어 입력을 위한 사용되는 필드 조사
// search the field to be used for entering language
$target_list = array();
$target_type_list = array();
@ -152,7 +152,7 @@
}
}
// field, 즉 체크항목의 script 생성
// generates a field, which is a script of the checked item
$node_count = count($field_node);
if($node_count) {
foreach($field_node as $key =>$node) {
@ -179,7 +179,7 @@
}
}
// extend_filter_item 체크
// Check extend_filter_item
$rule_types = array('homepage'=>'homepage', 'email_address'=>'email');
for($i=0;$i<$extend_filter_count;$i++) {
@ -188,7 +188,7 @@
if(!$target) continue;
// extend filter item의 type으로 rule을 구함
// get the filter from the type of extend filter item
$type = $filter_item->type;
$rule = $rule_types[$type]?$rule_types[$type]:'';
$required = ($filter_item->required == 'true');
@ -202,11 +202,11 @@
if(!$target_type_list[$target]) $target_type_list[$target] = $type;
}
// 데이터를 만들기 위한 parameter script 생성
// generates parameter script to create dbata
$rename_params = array();
$parameter_count = count($parameter_param);
if($parameter_count) {
// 기본 필터 내용의 parameter로 구성
// contains parameter of the default filter contents
foreach($parameter_param as $key =>$param) {
$attrs = $param->attrs;
$name = trim($attrs->name);
@ -217,7 +217,7 @@
if($name && !in_array($name, $target_list)) $target_list[] = $name;
}
// extend_filter_item 체크
// Check extend_filter_item
for($i=0;$i<$extend_filter_count;$i++) {
$filter_item = $extend_filter_list[$i];
$target = $name = trim($filter_item->name);
@ -227,7 +227,7 @@
}
}
// response script 생성
// generates the response script
$response_count = count($response_tag);
$responses = array();
for($i=0;$i<$response_count;$i++) {
@ -236,7 +236,7 @@
$responses[] = "'{$name}'";
}
// lang : form field description
// writes lang values of the form field
$target_count = count($target_list);
for($i=0;$i<$target_count;$i++) {
$target = $target_list[$i];
@ -244,7 +244,7 @@
$js_messages[] = sprintf("v.cast('ADD_MESSAGE',['%s','%s']);", $target, addslashes($lang->{$target}));
}
// target type을 기록
// writes the target type
/*
$target_type_count = count($target_type_list);
if($target_type_count) {
@ -254,7 +254,7 @@
}
*/
// lang : error message
// writes error messages
foreach($lang->filter as $key => $val) {
if(!$val) $val = $key;
$js_messages[] = sprintf("v.cast('ADD_MESSAGE',['%s','%s']);", $key, $val);
@ -276,7 +276,7 @@
$jsdoc[] = '})(jQuery);';
$jsdoc = implode("\n", $jsdoc);
// js파일 생성
// generates the js file
FileHandler::writeFile($this->js_file, $jsdoc);
}

View file

@ -19,10 +19,10 @@
var $input = NULL; ///< input xml
var $output = array(); ///< output object
var $lang = "en"; ///< 기본 언어타입
var $lang = "en"; // /< The default language type
/**
* @brief load a xml file specified by a filename and parse it to return the resultant data object
* @brief load a xml file specified by a filename and parse it to Return the resultant data object
* @param[in] $filename a file path of file
* @return Returns a data object containing data extracted from a xml file or NULL if a specified file does not exist
**/
@ -40,7 +40,7 @@
* @return Returns a resultant data object or NULL in case of error
**/
function parse($input = '') {
// 디버그를 위한 컴파일 시작 시간 저장
// Save the compile starting time for debugging
if(__DEBUG__==3) $start = getMicroTime();
$this->lang = Context::getLangType();
@ -48,12 +48,12 @@
$this->input = $input?$input:$GLOBALS['HTTP_RAW_POST_DATA'];
$this->input = str_replace(array('',''),array('',''),$this->input);
// 지원언어 종류를 뽑음
// extracts a supported language
preg_match_all("/xml:lang=\"([^\"].+)\"/i", $this->input, $matches);
// xml:lang이 쓰였을 경우 지원하는 언어종류를 뽑음
// extracts the supported lanuage when xml:lang is used
if(count($matches[1]) && $supported_lang = array_unique($matches[1])) {
// supported_lang에 현재 접속자의 lang이 없으면 en이 있는지 확인하여 en이 있으면 en을 기본, 아니면 첫번째것을..
// if lang of the first log-in user doesn't exist, apply en by default if exists. Otherwise apply the first lang.
if(!in_array($this->lang, $supported_lang)) {
if(in_array('en', $supported_lang)) {
$this->lang = 'en';
@ -61,7 +61,7 @@
$this->lang = array_shift($supported_lang);
}
}
// 특별한 언어가 지정되지 않았다면 언어체크를 하지 않음
// uncheck the language if no specific language is set.
} else {
unset($this->lang);
}
@ -78,8 +78,7 @@
if(!count($this->output)) return;
$output = array_shift($this->output);
// 디버그를 위한 컴파일 시작 시간 저장
// Save compile starting time for debugging
if(__DEBUG__==3) $GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start;
return $output;

View file

@ -23,7 +23,7 @@
* @remarks {there should be a way to report an error}
**/
function parse($query_id, $xml_file, $cache_file) {
// query xml 파일을 찾아서 파싱, 결과가 없으면 return
// parse the query xml file. Return if get no result
$buff = FileHandler::readFile($xml_file);
$xml_obj = parent::parse($buff);
if(!$xml_obj) return;
@ -40,12 +40,10 @@
$module = $id_args[1];
$id = $id_args[2];
}
// insert, update, delete, select등의 action
// actions like insert, update, delete, select and so on
$action = strtolower($xml_obj->query->attrs->action);
if(!$action) return;
// 테이블 정리 (배열코드로 변환)
// get the table list(converting an array code)
$tables = $xml_obj->query->tables->table;
$output->left_tables = array();
@ -54,8 +52,7 @@
if(!$tables) return;
if(!is_array($tables)) $tables = array($tables);
foreach($tables as $key => $val) {
// 테이블과 alias의 이름을 구함
// get the name of tables and aliases
$table_name = $val->attrs->name;
$alias = $val->attrs->alias;
if(!$alias) $alias = $table_name;
@ -66,8 +63,7 @@
$output->left_tables[$alias] = $val->attrs->type;
$left_conditions[$alias] = $val->conditions;
}
// 테이블을 찾아서 컬럼의 속성을 구함
// get column properties from the table
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
if(!file_exists($table_file)) {
$searched_list = FileHandler::readDir(_XE_PATH_.'modules');
@ -93,9 +89,7 @@
}
}
}
// 컬럼 정리
// Column list
$columns = $xml_obj->query->columns->column;
$out = $this->_setColumn($columns);
$output->columns = $out->columns;
@ -114,8 +108,7 @@
$group_list = $xml_obj->query->groups->group;
$out = $this->_setGroup($group_list);
$output->groups = $out->groups;
// 네비게이션 정리
// Navigation
$out = $this->_setNavigation($xml_obj);
$output->order = $out->order;
$output->list_count = $out->list_count;
@ -132,8 +125,7 @@
}
}
$buff .= ' );'."\n";
// php script 생성
// generates a php script
$buff .= '$output->_tables = array( ';
foreach($output->tables as $key => $val) {
$buff .= sprintf('"%s"=>"%s",', $key, $val);
@ -147,22 +139,19 @@
}
$buff .= ' );'."\n";
}
// column 정리
// column info
if($column_count) {
$buff .= '$output->columns = array ( ';
$buff .= $this->_getColumn($output->columns);
$buff .= ' );'."\n";
}
// conditions 정리
// get conditions
if($condition_count) {
$buff .= '$output->conditions = array ( ';
$buff .= $this->_getConditions($output->conditions);
$buff .= ' );'."\n";
}
// conditions 정리
// get conditions
if(count($output->left_conditions)) {
$buff .= '$output->left_conditions = array ( ';
foreach($output->left_conditions as $key => $val){
@ -173,7 +162,7 @@
$buff .= ' );'."\n";
}
// args 변수 확인
// get arguments
$arg_list = $this->getArguments();
if($arg_list)
{
@ -184,7 +173,7 @@
}
}
// order 정리
// order
if($output->order) {
$buff .= '$output->order = array(';
foreach($output->order as $key => $val) {
@ -193,22 +182,22 @@
$buff .= ');'."\n";
}
// list_count 정리
// list_count
if($output->list_count) {
$buff .= sprintf('$output->list_count = array("var"=>"%s", "value"=>$args->%s?$args->%s:"%s");%s', $output->list_count->var, $output->list_count->var, $output->list_count->var, $output->list_count->default,"\n");
}
// page_count 정리
// page_count
if($output->page_count) {
$buff .= sprintf('$output->page_count = array("var"=>"%s", "value"=>$args->%s?$args->%s:"%s");%s', $output->page_count->var, $output->page_count->var, $output->page_count->var, $output->list_count->default,"\n");
}
// page 정리
// page order
if($output->page) {
$buff .= sprintf('$output->page = array("var"=>"%s", "value"=>$args->%s?$args->%s:"%s");%s', $output->page->var, $output->page->var, $output->page->var, $output->list->default,"\n");
}
// group by 정리
// group by
if($output->groups) {
$buff .= sprintf('$output->groups = array("%s");%s', implode('","',$output->groups),"\n");
}
@ -255,7 +244,7 @@
. $buff
. 'return $output; ?>';
// 저장
// Save
FileHandler::writeFile($cache_file, $buff);
}
@ -301,8 +290,7 @@
* @result Returns $output
*/
function _setConditions($conditions){
// 조건절 정리
// Conditional clause
$condition = $conditions->condition;
if($condition) {
$obj->condition = $condition;
@ -344,7 +332,7 @@
* @result Returns $output
*/
function _setGroup($group_list){
// group 정리
// group list
if($group_list) {
if(!is_array($group_list)) $group_list = array($group_list);

View file

@ -7,7 +7,7 @@
var filebox = {
selected : null,
/**
* 파일 박스 팝업
* pop up the file box
*/
open : function(input_obj, filter) {
this.selected = input_obj;
@ -22,7 +22,7 @@
},
/**
* 파일 선택
* select a file
*/
selectFile : function(file_url, module_filebox_srl){
var target = $(opener.XE.filebox.selected);
@ -37,7 +37,7 @@
},
/**
* 파일 선택 취소
* cancel
*/
cancel : function(name) {
$('[name=' + name + ']').val('');
@ -46,7 +46,7 @@
},
/**
* 파일 삭제
* delete a file
*/
deleteFile : function(module_filebox_srl){
var params = {
@ -57,7 +57,7 @@
},
/**
* 초기화
* initialize
*/
init : function(name) {
var file;
@ -76,7 +76,7 @@
}
};
// XE에 담기
// put the file into XE
$.extend(window.XE, {'filebox' : filebox});
}) (jQuery);

View file

@ -2,7 +2,7 @@
/**
* @file config/config.inc.php
* @author NHN (developers@xpressengine.com)
* @brief 기본적으로 사용하는 class파일의 include 환경 설정을
* @brief set the include of the class file and other environment configurations
**/
@error_reporting(E_ALL ^ E_NOTICE);
@ -10,13 +10,13 @@
if(!defined('__ZBXE__')) exit();
/**
* @brief XE의 전체 버전 표기
* 파일의 수정이 없더라도 공식 릴리즈시에 수정되어 함께 배포되어야
* @brief display XE's full version
* Even The file should be revised when releasing altough no change is made
**/
define('__ZBXE_VERSION__', '1.4.5.2');
/**
* @brief zbXE가 설치된 장소의 base path를 구함
* @brief The base path to where you installed zbXE Wanted
**/
define('_XE_PATH_', str_replace('config/config.inc.php', '', str_replace('\\', '/', __FILE__)));
@ -26,8 +26,8 @@
ini_set('session.use_only_cookies', 0);
/**
* @brief 기본 설정에 우선하는 사용자 설정 파일
* config/config.user.inc.php 파일에 아래 내용을 저장하면
* @brief user configuration files which override the default settings
* save the following information into config/config.user.inc.php
* <?php
* define('__DEBUG__', 0);
* define('__DEBUG_OUTPUT__', 0);
@ -45,75 +45,75 @@
}
/**
* @brief 디버깅 메시지 출력 (비트 )
* 0 : 디버그 메시지를 생성/ 출력하지 않음
* 1 : debugPrint() 함수를 통한 메시지 출력
* 2 : 소요시간, Request/Response info 출력
* 4 : DB 쿼리 내역 출력
* @brief output debug message(bit value)
* 0: generate debug messages/not display
* 1: display messages through debugPrint() function
* 2: output execute time, Request/Response info
* 4: output DB query history
**/
if(!defined('__DEBUG__')) define('__DEBUG__', 0);
/**
* @brief 디버그 메세지의 출력 장소
* 0 : files/_debug_message.php 연결하여 출력
* 1 : HTML 최하단에 주석으로 출력 (Response Method가 HTML )
* 2 : Firebug 콘솔에 출력 (PHP 4 & 5. Firebug/FirePHP 플러그인 필요)
* @brief output location of debug message
* 0: connect to the files/_debug_message.php and output
* 1: HTML output as a comment on the bottom (when response method is the HTML)
* 2: Firebug console output (PHP 4 & 5. Firebug/FirePHP plug-in required)
**/
if(!defined('__DEBUG_OUTPUT__')) define('__DEBUG_OUTPUT__', 0);
/**
* @brief FirePHP 콘솔 브라우저 주석 출력 보안
* 0 : 제한 없음 (권장하지 않음)
* 1 : 지정한 IP 주소에만 허용
* @brief output comments of the firePHP console and browser
* 0: No limit (not recommended)
* 1: Allow only specified IP addresses
**/
if(!defined('__DEBUG_PROTECT__')) define('__DEBUG_PROTECT__', 1);
if(!defined('__DEBUG_PROTECT_IP__')) define('__DEBUG_PROTECT_IP__', '127.0.0.1');
/**
* @brief DB 오류 메세지 출력 정의
* 0 : 출력하지 않음
* 1 : files/_debug_db_query.php 연결하여 출력
* @brief DB error message definition
* 0: No output
* 1: files/_debug_db_query.php connected to the output
**/
if(!defined('__DEBUG_DB_OUTPUT__')) define('__DEBUG_DB_OUTPUT__', 0);
/**
* @brief DB 쿼리중 정해진 시간을 넘기는 쿼리의 로그 남김
* 0 : 로그를 남기지 않음
* 0 이상 : 단위를 초로 하여 지정된 이상의 실행시간이 걸린 쿼리를 로그로 남김
* 로그파일은 ./files/_db_slow_query.php 파일로 저장됨
* @brief Query log for only timeout query among DB queries
* 0: Do not leave a log
* = 0: leave a log when the slow query takes over specified seconds
* Log file is saved as ./files/_db_slow_query.php file
**/
if(!defined('__LOG_SLOW_QUERY__')) define('__LOG_SLOW_QUERY__', 0);
/**
* @brief DB 쿼리 정보를 남김
* 0 : 쿼리에 정보를 추가하지 않음
* 1 : XML Query ID 쿼리 주석으로 남김
* @brief Leave DB query information
* 0: Do not add information to the query
* 1: Comment the XML Query ID
**/
if(!defined('__DEBUG_QUERY__')) define('__DEBUG_QUERY__', 0);
/**
* @brief ob_gzhandler를 이용한 압축 기능을 강제로 사용하거나 끄는 옵션
* 0 : 사용하지 않음
* 1 : 사용함
* 대부분의 서버에서는 문제가 없는데 특정 서버군에서 압축전송시 IE에서 오동작을 일으키는경우가 있음
* @brief option to enable/disable a compression feature using ob_gzhandler
* 0: Not used
* 1: Enabled
* Only particular servers may have a problem in IE browser when sending a compression
**/
if(!defined('__OB_GZHANDLER_ENABLE__')) define('__OB_GZHANDLER_ENABLE__', 1);
/**
* @brief php unit test (경로/tests/index.php) 실행 유무 지정
* 0 : 사용하지 않음
* 1 : 사용함
* @brief decide to use/not use the php unit test (Path/tests/index.php)
* 0: Not used
* 1: Enabled
**/
if(!defined('__ENABLE_PHPUNIT_TEST__')) define('__ENABLE_PHPUNIT_TEST__', 0);
/**
* @brief __PROXY_SERVER__ 대상 서버를 거쳐서 외부 요청을 하도록 하는 서버의 정보를 가지고 있음
* FileHandler::getRemoteResource 에서 상수를 사용함
* @brief __PROXY_SERVER__ has server information to request to the external through the target server
* FileHandler:: getRemoteResource uses the constant
**/
if(!defined('__PROXY_SERVER__')) define('__PROXY_SERVER__', null);
/**
* @brief Firebug 콘솔 출력 사용시 관련 파일 require
* @brief Require specific files when using Firebug console output
**/
if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) {
require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php';
@ -129,15 +129,15 @@
if(!defined('__XE_LOADED_CLASS__')){
/**
* @brief 간단하게 사용하기 위한 함수 정의한 파일 require
* @brief Require a function-defined-file for simple use
**/
require(_XE_PATH_.'config/func.inc.php');
if(__DEBUG__) define('__StartTime__', getMicroTime());
/**
* @brief 기본적인 class 파일 include
* @TODO : PHP5 기반으로 바꾸게 되면 _autoload() 이용할 있기에 제거 대상
* @brief include the class files
* @TODO : When _autoload() can be used for PHP5 based applications, it will be removed.
**/
if(__DEBUG__) define('__ClassLoadStartTime__', getMicroTime());
require(_XE_PATH_.'classes/object/Object.class.php');

View file

@ -2,13 +2,13 @@
/**
* @file config/func.inc.php
* @author NHN (developers@xpressengine.com)
* @brief 편의 목적으로 만든 함수라이브러리 파일
* @brief function library files for convenience
**/
if(!defined('__ZBXE__')) exit();
/**
* @brief php5에 대비하여 clone 정의
* @brief define clone for php5
**/
if (version_compare(phpversion(), '5.0') < 0) {
eval('
@ -19,7 +19,7 @@
}
/**
* @brief iconv 함수가 없을 경우 함수를 만들어서 오류가 생기지 않도록 정의
* @brief define an empty function to avoid errors when iconv function doesn't exist
**/
if(!function_exists('iconv')) {
eval('
@ -74,8 +74,8 @@
) ;
/**
* @brief ModuleHandler::getModuleObject($module_name, $type) 쓰기 쉽게 함수로 선언
* @param module_name 모듈이름
* @brief define a function to use ModuleHandler::getModuleObject ($module_name, $type)
* @param module_name
* @param type disp, proc, controller, class
* @param kind admin, null
* @return module instance
@ -85,8 +85,8 @@
}
/**
* @brief module의 controller 객체 생성용
* @param module_name 모듈이름
* @brief create a controller instance of the module
* @param module_name
* @return module controller instance
**/
function &getController($module_name) {
@ -94,8 +94,8 @@
}
/**
* @brief module의 admin controller 객체 생성용
* @param module_name 모듈이름
* @brief create a controller instance of the module
* @param module_name
* @return module admin controller instance
**/
function &getAdminController($module_name) {
@ -103,8 +103,8 @@
}
/**
* @brief module의 view 객체 생성용
* @param module_name 모듈이름
* @brief create a view instance of the module
* @param module_name
* @return module view instance
**/
function &getView($module_name) {
@ -112,8 +112,8 @@
}
/**
* @brief module의 mobile 객체 생성용
* @param module_name 모듈이름
* @brief create a view instance of the module
* @param module_name
* @return module mobile instance
**/
function &getMobile($module_name) {
@ -130,8 +130,8 @@
}
/**
* @brief module의 model 객체 생성용
* @param module_name 모듈이름
* @brief create a model instance of the module
* @param module_name
* @return module model instance
**/
function &getModel($module_name) {
@ -139,8 +139,8 @@
}
/**
* @brief module의 admin model 객체 생성용
* @param module_name 모듈이름
* @brief create an admin model instance of the module
* @param module_name
* @return module admin model instance
**/
function &getAdminModel($module_name) {
@ -148,8 +148,8 @@
}
/**
* @brief module의 api 객체 생성용
* @param module_name 모듈이름
* @brief create an api instance of the module
* @param module_name
* @return module api class instance
**/
function &getAPI($module_name) {
@ -157,8 +157,8 @@
}
/**
* @brief module의 wap 객체 생성용
* @param module_name 모듈이름
* @brief create a wap instance of the module
* @param module_name
* @return module wap class instance
**/
function &getWAP($module_name) {
@ -166,8 +166,8 @@
}
/**
* @brief module의 상위 class 객체 생성용
* @param module_name 모듈이름
* @brief create a class instance of the module
* @param module_name
* @return module class instance
**/
function &getClass($module_name) {
@ -175,10 +175,10 @@
}
/**
* @brief DB::executeQuery() alias
* @param query_id 쿼리 ID ( 모듈명.쿼리XML파일 )
* @param args object 변수로 선언된 인자값
* @return 처리결과
* @brief the alias of DB::executeQuery()
* @param query_id (module name.query XML file)
* @param argument values of args object
* @return results
**/
function executeQuery($query_id, $args = null) {
$oDB = &DB::getInstance();
@ -186,10 +186,10 @@
}
/**
* @brief DB::executeQuery() 결과값을 무조건 배열로 처리하도록 하는 함수
* @param query_id 쿼리 ID ( 모듈명.쿼리XML파일 )
* @param args object 변수로 선언된 인자값
* @return 처리결과
* @brief function to handle the result of DB::executeQuery() as an array
* @param query_id(module name.query XML file)
* @param argument values of args object
* @return results
**/
function executeQueryArray($query_id, $args = null) {
$oDB = &DB::getInstance();
@ -201,7 +201,7 @@
}
/**
* @brief DB::getNextSequence() alias
* @brief DB:: alias of getNextSequence()
* @return big int
**/
function getNextSequence() {
@ -210,14 +210,14 @@
}
/**
* @brief Context::getUrl() 쓰기 쉽게 함수로 선언
* @brief define a function to use Context::getUrl()
* @return string
*
* getUrl() 현재 요청된 RequestURI에 주어진 인자의 값으로 변형하여 url을 리턴한다\n
* 1. 인자는 (key, value)... 형식으로 주어져야 한다.\n
* ex) getUrl('key1','val1', 'key2', '') : key1, key2를 val1과 '' 변형\n
* 2. 아무런 인자가 없으면 argument를 제외한 url을 리턴
* 3. 인자값이 '' 이면 RequestUri에다가 추가된 args_list로 url을 만듬
* getUrl() returns the URL transformed from given arguments of RequestURI\n
* 1. argument format follows as (key, value).\.
* ex) getUrl('key1', 'val1', 'key2',''): transform key1 and key2 to val1 and '' respectively\n
* 2. returns URL without the argument if no argument is given.
* 3. URL made of args_list added to RequestUri if the first argument value is ''.
**/
function getUrl() {
$num_args = func_num_args();
@ -238,8 +238,8 @@
}
/**
* @brief getUrl() 값에 request uri를 추가하여 reutrn
* full url얻기 위함
* @brief return the value adding request uri to getUrl()
* to get the full url
**/
function getFullUrl() {
$num_args = func_num_args();
@ -271,11 +271,12 @@
}
/**
* @brief Context::getUrl() 쓰기 쉽게 함수로 선언
* @brief Context:: getUrl() function is declared as easier to write
* @return string
*
* getSiteUrl() 지정된 도메인에 대해 주어진 인자의 값으로 변형하여 url을 리턴한다\n
* 인자는 도메인(http://등이 제외된)+path 여야 .
* getSiteUrl() returns the URL by transforming the given argument value of domain\n
* The first argument should consist of domain("http://" not included) and path
*
**/
function getSiteUrl() {
$num_args = func_num_args();
@ -302,8 +303,8 @@
}
/**
* @brief getSiteUrl() 값에 request uri를 추가하여 reutrn
* full url얻기 위함
* @brief return the value adding request uri to the getSiteUrl()
* To get the full url
**/
function getFullSiteUrl() {
$num_args = func_num_args();
@ -324,17 +325,17 @@
}
/**
* @brief 가상사이트의 Domain이 url형식인지 site id인지 return
* @brief return if domain of the virtual site is url type or id type
**/
function isSiteID($domain) {
return preg_match('/^([a-z0-9\_]+)$/i', $domain);
}
/**
* @brief 주어진 문자를 주어진 크기로 자르고 잘라졌을 경우 주어진 꼬리를
* @param string 자를 문자열
* @param cut_size 주어진 문자열을 자를 크기
* @param tail 잘라졌을 경우 문자열의 제일 뒤에 붙을 꼬리
* @brief put a given tail after trimming string to the specified size
* @param the original string to trim
* @param cut_size: the size to be
* @param tail: tail to put in the end of the string after trimming
* @return string
**/
function cut_str($string,$cut_size=0,$tail = '...') {
@ -388,8 +389,8 @@
}
/**
* @brief YYYYMMDDHHIISS 형식의 시간값을 unix time으로 변경
* @param str YYYYMMDDHHIISS 형식의 시간값
* @brief YYYYMMDDHHIISS format changed to unix time value
* @param str: time value in format of YYYYMMDDHHIISS
* @return int
**/
function ztime($str) {
@ -410,7 +411,7 @@
}
/**
* @brief YmdHis의 시간 형식을 지금으로 부터 몇분/몇시간전, 1 이상 차이나면 format string return
* @brief If the recent post within a day, output format of YmdHis is "min/hours ago from now". If not within a day, it return format string.
**/
function getTimeGap($date, $format = 'Y.m.d') {
$gap = time() - ztime($date);
@ -425,7 +426,7 @@
}
/**
* @brief 월이름을 return
* @brief Name of the month return
**/
function getMonthName($month, $short = true) {
$short_month = array('','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
@ -434,17 +435,16 @@
}
/**
* @brief YYYYMMDDHHIISS 형식의 시간값을 원하는 시간 포맷으로 변형
* @param string|int str YYYYMMDDHHIISS 형식의 시간
* @param string format php date()함수의 시간 포맷
* @param bool conversion 언어에 따라 날짜 포맷의 자동변환 여부
* @brief change the time format YYYYMMDDHHIISS to the user defined format
* @param string|int str is YYYYMMDDHHIISS format time values
* @param string format is time format of php date() function
* @param bool conversion means whether to convert automatically according to the language
* @return string
**/
function zdate($str, $format = 'Y-m-d H:i:s', $conversion=true) {
// 대상 시간이 없으면 null return
// return null if no target time is specified
if(!$str) return;
// 언어권에 따라서 지정된 날짜 포맷을 변경
// convert the date format according to the language
if($conversion == true) {
switch(Context::getLangType()) {
case 'en' :
@ -462,7 +462,7 @@
}
}
// 년도가 1970년 이전이면 별도 처리
// If year value is less than 1970, handle it separately.
if((int)substr($str,0,4) < 1970) {
$hour = (int)substr($str,8,2);
$min = (int)substr($str,10,2);
@ -493,11 +493,10 @@
$string = strtr($format, $trans);
} else {
// 1970년 이후라면 ztime()함수로 unixtime을 구하고 date함수로 처리
// if year value is greater than 1970, get unixtime by using ztime() for date() function's argument.
$string = date($format, ztime($str));
}
// 요일, am/pm을 각 언어에 맞게 변경
// change day and am/pm for each language
$unit_week = Context::getLang('unit_week');
$unit_meridiem = Context::getLang('unit_meridiem');
$string = str_replace(array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'),$unit_week, $string);
@ -511,8 +510,8 @@
* @param display_line boolean flag whether to print seperator (default:true)
* @return none
*
* ./files/_debug_message.php 파일에 $buff 내용을 출력한다.
* tail -f ./files/_debug_message.php 하여 계속 살펴 있다
* Display $buff contents into the file ./files/_debug_message.php.
* You can see the file on your prompt by command: tail-f./files/_debug_message.php
**/
function debugPrint($debug_output = null, $display_option = true, $file = '_debug_message.php') {
if(!(__DEBUG__ & 1)) return;
@ -533,11 +532,9 @@
{
$label = sprintf('[%s:%d] ', $file_name, $line_num);
}
// FirePHP 옵션 체크
// Check a FirePHP option
if($display_option === 'TABLE') $label = $display_option;
// __DEBUG_PROTECT__ 옵션으로 지정된 IP와 접근 IP가 동일한지 체크
// Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP.
if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
$debug_output = 'The IP address is not allowed. Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php';
$label = null;
@ -579,9 +576,9 @@
}
/**
* @brief 첫번째 인자로 오는 object var에서 2번째 object의 var들을 제거
* @param target_obj object
* @param del_obj object의 vars에서 del_obj의 vars를 제거한다
* @brief Delete the second object vars from the first argument
* @param target_obj is an original object
* @param del_obj is object vars to delete from the original object
* @return object
**/
function delObjectVars($target_obj, $del_obj) {
@ -607,7 +604,7 @@
}
/**
* @brief php5 이상에서 error_handing을 debugPrint로 변경
* @brief change error_handing to debugPrint on php5 higher
* @param errno
* @param errstr
* @return file
@ -625,9 +622,9 @@
}
/**
* @brief 주어진 숫자를 주어진 크기로 recursive하게 잘라줌
* @param no 주어진 숫자
* @param size 잘라낼 크기
* @brief Trim a given number to a fiven size recursively
* @param no : a given number
* @param size : a given digits
**/
function getNumberingPath($no, $size=3) {
$mod = pow(10, $size);
@ -637,22 +634,22 @@
}
/**
* @brief 한글이 들어간 url의 decode
* @brief decode the URL in Korean
**/
function url_decode($str) {
return preg_replace('/%u([[:alnum:]]{4})/', '&#x\\1;',$str);
}
/**
* @brief 해킹 시도로 의심되는 코드들을 미리 차단
* @brief Pre-block the codes which may be hacking attempts
**/
function removeHackTag($content) {
// 특정 태그들을 일반 문자로 변경
// change the specific tags to the common texts
$content = preg_replace('/<(\/?)(iframe|script|meta|style|applet|link|base|html|body)/is', '&lt;$1$2', $content);
/**
* 이미지나 동영상등의 태그에서 src에 관리자 세션을 악용하는 코드를 제거
* - 취약점 제보 : 김상원님
* Remove codes to abuse the admin session in src by tags of imaages and video postings
* - Issue reported by Sangwon Kim
**/
$content = preg_replace_callback("!<(/?)([a-z]+)(.*?)>!is", removeSrcHack, $content);
@ -690,7 +687,7 @@
$xml_doc = $oXmlParser->parse($buff);
if(!$xml_doc) return sprintf("<%s>", $tag);
// src값에 module=admin이라는 값이 입력되어 있으면 이 값을 무효화 시킴
// invalidate the value if src value is module = admin.
$src = $xml_doc->attrs->src;
$dynsrc = $xml_doc->attrs->dynsrc;
$lowsrc = $xml_doc->attrs->lowsrc;
@ -748,7 +745,7 @@
}
/**
* @brief attribute의 value를 " 로 둘러싸도록 처리하는 함수
* @brief function to enclose attribute values to double quotes(")
**/
function fixQuotation($matches) {
$key = $matches[1];
@ -774,8 +771,7 @@
return $output;
}
// hexa값을 RGB로 변환
// convert hexa value to RGB
if(!function_exists('hexrgb')) {
function hexrgb($hexstr) {
$int = hexdec($hexstr);
@ -788,9 +784,9 @@
}
/**
* @brief mysql old_password php 구현 함수
* 제로보드4나 기타 mysql4.1 이전의 old_password()함수를 데이터의 사용을 위해서
* mysql의 password.c 소스 참조해서 구현함
* @brief php function for mysql old_password()
* provides backward compatibility for zero board4 which uses old_password() of mysql 4.1 earlier versions.
* the function implemented by referring to the source codes of password.c file in mysql
**/
function mysql_pre4_hash_password($password) {
$nr = 1345345333;
@ -816,7 +812,7 @@
}
/**
* 현재 요청받은 스크립트 경로를 return
* return the requested script path
**/
function getScriptPath() {
static $url = null;
@ -825,7 +821,7 @@
}
/**
* javascript의 escape의 php unescape 함수
* php unescape function of javascript's escape
* Function converts an Javascript escaped string back into a string with specified charset (default is UTF-8).
* Modified function from http://pure-essence.net/stuff/code/utf8RawUrlDecode.phps
**/

View file

@ -2,16 +2,16 @@
/**
* @file index.php
* @author NHN (developers@xpressengine.com)
* @brief 시작 페이지
* @brief Start page
*
* Request Argument에서 mid, act로 module 객체를 찾아서 생성하고 \n
* 모듈 정보를 세팅함
* Find and create module object by mif, act in Request Argument \n
* Set module information
*
* @mainpage XpressEngine
* @section intro 소개
* XE 오픈 프로젝트로 개발되는 오픈 소스입니다.\n
* 자세한 내용은 아래 링크를 참조하세요.
* - 공식홈페이지 : http://www.xpressengine.com
* @section intro introduction
* XE is an opensource and being developed in the opensource project. \N
* For more information, please see the link below.
* - Official website: http://www.xpressengine.com
* - SVN Repository : http://svn.xpressengine.net/xe
* \n
* "XpressEngine (XE)" is free software; you can redistribute it and/or \n
@ -31,24 +31,24 @@
**/
/**
* @brief 기본적인 상수 선언, 웹에서 직접 호출되는 것을 막기 위해 체크하는 상수 선언
* @brief Declare constants for generic use and for checking to avoid a direct call from the Web
**/
define('__ZBXE__', true);
/**
* @brief 필요한 설정 파일들을 include
* @brief Include the necessary configuration files
**/
require('./config/config.inc.php');
/**
* @brief create and initialize a Context object
* 모든 Request Argument/ 환경변수등을 세팅
* @brief Initialize by creating Context object
* Set all Request Argument/Environment variables
**/
$oContext = &Context::getInstance();
$oContext->init();
/**
* @brief default_url 설정되어 있고 현재 url이 default_url과 다르면 SSO인증을 위한 rediret 시도 모듈 동작
* @brief If default_url is set and it is different from the current url, attempt to redirect for SSO authentication and then process the module
**/
if($oContext->checkSSO()) {
$oModuleHandler = new ModuleHandler();

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.
*
* However, editor_sequence can be value from getNextSequence() in case of the modified or the auto-saved for file upload
*
* , 수정하는 경우 또는 파일업로드를 자동저장본의 경우는 getNextSequence() 값으로 저장된 editor_seqnece가
* 설정된다.
**/
/**
* @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');
}

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