mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-29 07:12:15 +09:00
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:
parent
693e215bc1
commit
4d272994dd
219 changed files with 6407 additions and 8705 deletions
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue