mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-05 17:51:40 +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
|
|
@ -4,7 +4,7 @@
|
||||||
/**
|
/**
|
||||||
* @file autolink.addon.php
|
* @file autolink.addon.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 자동 링크 애드온
|
* @brief Automatic link add-on
|
||||||
**/
|
**/
|
||||||
if($called_position == 'after_module_proc' && Context::getResponseMethod()!="XMLRPC") {
|
if($called_position == 'after_module_proc' && Context::getResponseMethod()!="XMLRPC") {
|
||||||
Context::addJsFile('./addons/autolink/autolink.js', false ,'', null, 'body');
|
Context::addJsFile('./addons/autolink/autolink.js', false ,'', null, 'body');
|
||||||
|
|
|
||||||
|
|
@ -4,57 +4,47 @@
|
||||||
/**
|
/**
|
||||||
* @file blogapicounter.addon.php
|
* @file blogapicounter.addon.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief blogAPI 애드온
|
* @brief Add blogAPI
|
||||||
*
|
*
|
||||||
* ms live writer, 파이어폭스의 performancing, zoundry 등의 외부 툴을 이용하여 글을 입력할 수 있게 합니다.
|
* It enables to write a post by using an external tool such as ms live writer, firefox performancing, zoundry and so on.
|
||||||
* 모듈 실행 이전(before_module_proc)에 호출이 되어야 하며 정상동작후에는 강제 종료를 한다.
|
* It should be called before executing the module(before_module_proc). If not, it is forced to shut down.
|
||||||
**/
|
**/
|
||||||
|
// Insert a rsd tag when called_position is after_module_proc
|
||||||
// called_position가 after_module_proc일때 rsd 태그 삽입
|
|
||||||
if($called_position == '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');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$rsd_url = getFullSiteUrl($site_module_info->domain, '', 'mid',$site_module_info->mid, 'act','api');
|
$rsd_url = getFullSiteUrl($site_module_info->domain, '', 'mid',$site_module_info->mid, 'act','api');
|
||||||
|
// Insert rsd tag into the header
|
||||||
// 헤더에 rsd태그 삽입
|
|
||||||
Context::addHtmlHeader(" ".'<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.$rsd_url.'" />');
|
Context::addHtmlHeader(" ".'<link rel="EditURI" type="application/rsd+xml" title="RSD" href="'.$rsd_url.'" />');
|
||||||
}
|
}
|
||||||
|
// If act isnot api, just return
|
||||||
// act가 api가 아니면 그냥 리턴~
|
|
||||||
if($_REQUEST['act']!='api') return;
|
if($_REQUEST['act']!='api') return;
|
||||||
|
// Read func file
|
||||||
// 관련 func 파일 읽음
|
|
||||||
require_once('./addons/blogapi/blogapi.func.php');
|
require_once('./addons/blogapi/blogapi.func.php');
|
||||||
|
// xmlprc parsing
|
||||||
// xmlprc 파싱
|
// Parse the requested xmlrpc
|
||||||
// 요청된 xmlrpc를 파싱
|
|
||||||
$oXmlParser = new XmlParser();
|
$oXmlParser = new XmlParser();
|
||||||
$xmlDoc = $oXmlParser->parse();
|
$xmlDoc = $oXmlParser->parse();
|
||||||
|
|
||||||
$method_name = $xmlDoc->methodcall->methodname->body;
|
$method_name = $xmlDoc->methodcall->methodname->body;
|
||||||
$params = $xmlDoc->methodcall->params->param;
|
$params = $xmlDoc->methodcall->params->param;
|
||||||
if($params && !is_array($params)) $params = array($params);
|
if($params && !is_array($params)) $params = array($params);
|
||||||
|
// Compatible with some of methodname
|
||||||
// 일부 methodname에 대한 호환
|
|
||||||
if(in_array($method_name, array('metaWeblog.deletePost', 'metaWeblog.getUsersBlogs', 'metaWeblog.getUserInfo'))) {
|
if(in_array($method_name, array('metaWeblog.deletePost', 'metaWeblog.getUsersBlogs', 'metaWeblog.getUserInfo'))) {
|
||||||
$method_name = str_replace('metaWeblog.', 'blogger.', $method_name);
|
$method_name = str_replace('metaWeblog.', 'blogger.', $method_name);
|
||||||
}
|
}
|
||||||
|
// Delete the first argument if it is blogger.deletePost
|
||||||
// blogger.deletePost일 경우 첫번째 인자 값 삭제
|
|
||||||
if($method_name == 'blogger.deletePost') array_shift($params);
|
if($method_name == 'blogger.deletePost') array_shift($params);
|
||||||
|
// Get user_id, password and attempt log-in
|
||||||
// user_id, password를 구해서 로그인 시도
|
|
||||||
$user_id = trim($params[1]->value->string->body);
|
$user_id = trim($params[1]->value->string->body);
|
||||||
$password = trim($params[2]->value->string->body);
|
$password = trim($params[2]->value->string->body);
|
||||||
|
// Before executing the module, authentication is processed.
|
||||||
// 모듈 실행전이라면 인증을 처리한다.
|
|
||||||
if($called_position == 'before_module_init') {
|
if($called_position == 'before_module_init') {
|
||||||
|
// Attempt log-in by using member controller
|
||||||
// member controller을 이용해서 로그인 시도
|
|
||||||
if($user_id && $password) {
|
if($user_id && $password) {
|
||||||
$oMemberController = &getController('member');
|
$oMemberController = &getController('member');
|
||||||
$output = $oMemberController->doLogin($user_id, $password);
|
$output = $oMemberController->doLogin($user_id, $password);
|
||||||
// 로그인 실패시 에러 메시지 출력
|
// If login fails, an error message appears
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$content = getXmlRpcFailure(1, $output->getMessage());
|
$content = getXmlRpcFailure(1, $output->getMessage());
|
||||||
printContent($content);
|
printContent($content);
|
||||||
|
|
@ -64,25 +54,21 @@
|
||||||
printContent($content);
|
printContent($content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Before module processing, handle requests from blogapi tool and then terminate.
|
||||||
// 모듈에서 무언가 작업을 하기 전에 blogapi tool의 요청에 대한 처리를 하고 강제 종료한다.
|
|
||||||
if($called_position == 'before_module_proc') {
|
if($called_position == 'before_module_proc') {
|
||||||
|
// Check writing permission
|
||||||
// 글쓰기 권한 체크 (권한명의 경우 약속이 필요할듯..)
|
|
||||||
if(!$this->grant->write_document) {
|
if(!$this->grant->write_document) {
|
||||||
printContent( getXmlRpcFailure(1, 'no permission') );
|
printContent( getXmlRpcFailure(1, 'no permission') );
|
||||||
}
|
}
|
||||||
|
// Get information of the categories
|
||||||
// 카테고리의 정보를 구해옴
|
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$category_list = $oDocumentModel->getCategoryList($this->module_srl);
|
$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);
|
$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);
|
$uploaded_target_path = sprintf('/files/cache/blogapi/%s/%s/', $this->mid, $user_id);
|
||||||
|
|
||||||
switch($method_name) {
|
switch($method_name) {
|
||||||
// 블로그 정보
|
// Blog information
|
||||||
case 'blogger.getUsersBlogs' :
|
case 'blogger.getUsersBlogs' :
|
||||||
$obj->url = getFullSiteUrl('');
|
$obj->url = getFullSiteUrl('');
|
||||||
$obj->blogid = $this->mid;
|
$obj->blogid = $this->mid;
|
||||||
|
|
@ -92,8 +78,7 @@
|
||||||
$content = getXmlRpcResponse($blog_list);
|
$content = getXmlRpcResponse($blog_list);
|
||||||
printContent($content);
|
printContent($content);
|
||||||
break;
|
break;
|
||||||
|
// Return a list of categories
|
||||||
// 카테고리 목록 return
|
|
||||||
case 'metaWeblog.getCategories' :
|
case 'metaWeblog.getCategories' :
|
||||||
$category_obj_list = array();
|
$category_obj_list = array();
|
||||||
if($category_list) {
|
if($category_list) {
|
||||||
|
|
@ -111,10 +96,9 @@
|
||||||
$content = getXmlRpcResponse($category_obj_list);
|
$content = getXmlRpcResponse($category_obj_list);
|
||||||
printContent($content);
|
printContent($content);
|
||||||
break;
|
break;
|
||||||
|
// Upload file
|
||||||
// 파일 업로드
|
|
||||||
case 'metaWeblog.newMediaObject' :
|
case 'metaWeblog.newMediaObject' :
|
||||||
// 파일 업로드 권한 체크
|
// Check a file upload permission
|
||||||
$oFileModel = &getModel('file');
|
$oFileModel = &getModel('file');
|
||||||
$file_module_config = $oFileModel->getFileModuleConfig($this->module_srl);
|
$file_module_config = $oFileModel->getFileModuleConfig($this->module_srl);
|
||||||
if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant)>0) {
|
if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant)>0) {
|
||||||
|
|
@ -151,8 +135,7 @@
|
||||||
$content = getXmlRpcResponse($obj);
|
$content = getXmlRpcResponse($obj);
|
||||||
printContent($content);
|
printContent($content);
|
||||||
break;
|
break;
|
||||||
|
// Get posts
|
||||||
// 글 가져오기
|
|
||||||
case 'metaWeblog.getPost' :
|
case 'metaWeblog.getPost' :
|
||||||
$document_srl = $params[0]->value->string->body;
|
$document_srl = $params[0]->value->string->body;
|
||||||
if(!$document_srl) {
|
if(!$document_srl) {
|
||||||
|
|
@ -163,7 +146,7 @@
|
||||||
if(!$oDocument->isExists() || !$oDocument->isGranted()) {
|
if(!$oDocument->isExists() || !$oDocument->isGranted()) {
|
||||||
printContent( getXmlRpcFailure(1, 'no permission') );
|
printContent( getXmlRpcFailure(1, 'no permission') );
|
||||||
} else {
|
} else {
|
||||||
// 카테고리를 사용하는지 확인후 사용시 카테고리 목록을 구해와서 Context에 세팅
|
// Get a list of categories and set Context
|
||||||
$category = "";
|
$category = "";
|
||||||
if($oDocument->get('category_srl')) {
|
if($oDocument->get('category_srl')) {
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
|
|
@ -203,12 +186,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
// Write a new post
|
||||||
// 글작성
|
|
||||||
case 'metaWeblog.newPost' :
|
case 'metaWeblog.newPost' :
|
||||||
unset($obj);
|
unset($obj);
|
||||||
$info = $params[3];
|
$info = $params[3];
|
||||||
// 글, 제목, 카테고리 정보 구함
|
// Get information of post, title, and category
|
||||||
for($i=0;$i<count($info->value->struct->member);$i++) {
|
for($i=0;$i<count($info->value->struct->member);$i++) {
|
||||||
$val = $info->value->struct->member[$i];
|
$val = $info->value->struct->member[$i];
|
||||||
switch($val->name->body) {
|
switch($val->name->body) {
|
||||||
|
|
@ -239,13 +221,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Set document srl
|
||||||
// 문서 번호 설정
|
|
||||||
$document_srl = getNextSequence();
|
$document_srl = getNextSequence();
|
||||||
$obj->document_srl = $document_srl;
|
$obj->document_srl = $document_srl;
|
||||||
$obj->module_srl = $this->module_srl;
|
$obj->module_srl = $this->module_srl;
|
||||||
|
// Attachment
|
||||||
// 첨부파일 정리
|
|
||||||
if(is_dir($tmp_uploaded_path)) {
|
if(is_dir($tmp_uploaded_path)) {
|
||||||
$file_list = FileHandler::readDir($tmp_uploaded_path);
|
$file_list = FileHandler::readDir($tmp_uploaded_path);
|
||||||
$file_count = count($file_list);
|
$file_count = count($file_list);
|
||||||
|
|
@ -276,8 +256,7 @@
|
||||||
|
|
||||||
printContent($content);
|
printContent($content);
|
||||||
break;
|
break;
|
||||||
|
// Edit post
|
||||||
// 글 수정
|
|
||||||
case 'metaWeblog.editPost' :
|
case 'metaWeblog.editPost' :
|
||||||
$tmp_val = $params[0]->value->string->body;
|
$tmp_val = $params[0]->value->string->body;
|
||||||
if(!$tmp_val) $tmp_val = $params[0]->value->i4->body;
|
if(!$tmp_val) $tmp_val = $params[0]->value->i4->body;
|
||||||
|
|
@ -294,8 +273,7 @@
|
||||||
|
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
|
// Check if a permission to modify a document is granted
|
||||||
// 글 수정 권한 체크
|
|
||||||
if(!$oDocument->isGranted()) {
|
if(!$oDocument->isGranted()) {
|
||||||
$content = getXmlRpcFailure(1, 'no permission');
|
$content = getXmlRpcFailure(1, 'no permission');
|
||||||
break;
|
break;
|
||||||
|
|
@ -304,8 +282,7 @@
|
||||||
$obj = $oDocument->getObjectVars();
|
$obj = $oDocument->getObjectVars();
|
||||||
|
|
||||||
$info = $params[3];
|
$info = $params[3];
|
||||||
|
// Get information of post, title, and category
|
||||||
// 글, 제목, 카테고리 정보 구함
|
|
||||||
for($i=0;$i<count($info->value->struct->member);$i++) {
|
for($i=0;$i<count($info->value->struct->member);$i++) {
|
||||||
$val = $info->value->struct->member[$i];
|
$val = $info->value->struct->member[$i];
|
||||||
switch($val->name->body) {
|
switch($val->name->body) {
|
||||||
|
|
@ -336,12 +313,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Document srl
|
||||||
// 문서 번호 설정
|
|
||||||
$obj->document_srl = $document_srl;
|
$obj->document_srl = $document_srl;
|
||||||
$obj->module_srl = $this->module_srl;
|
$obj->module_srl = $this->module_srl;
|
||||||
|
// Attachment
|
||||||
// 첨부파일 정리
|
|
||||||
if(is_dir($tmp_uploaded_path)) {
|
if(is_dir($tmp_uploaded_path)) {
|
||||||
$file_list = FileHandler::readDir($tmp_uploaded_path);
|
$file_list = FileHandler::readDir($tmp_uploaded_path);
|
||||||
$file_count = count($file_list);
|
$file_count = count($file_list);
|
||||||
|
|
@ -374,27 +349,22 @@
|
||||||
|
|
||||||
printContent($content);
|
printContent($content);
|
||||||
break;
|
break;
|
||||||
|
// Delete the post
|
||||||
// 글삭제
|
|
||||||
case 'blogger.deletePost' :
|
case 'blogger.deletePost' :
|
||||||
$tmp_val = $params[0]->value->string->body;
|
$tmp_val = $params[0]->value->string->body;
|
||||||
$tmp_arr = explode('/', $tmp_val);
|
$tmp_arr = explode('/', $tmp_val);
|
||||||
$document_srl = array_pop($tmp_arr);
|
$document_srl = array_pop($tmp_arr);
|
||||||
|
// Get a document
|
||||||
// 글 받아오기
|
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
|
// If the document exists
|
||||||
// 글 존재
|
|
||||||
if(!$oDocument->isExists()) {
|
if(!$oDocument->isExists()) {
|
||||||
$content = getXmlRpcFailure(1, 'not exists');
|
$content = getXmlRpcFailure(1, 'not exists');
|
||||||
|
// Check if a permission to delete a document is granted
|
||||||
// 글 삭제 권한 체크
|
|
||||||
} elseif(!$oDocument->isGranted()) {
|
} elseif(!$oDocument->isGranted()) {
|
||||||
$content = getXmlRpcFailure(1, 'no permission');
|
$content = getXmlRpcFailure(1, 'no permission');
|
||||||
break;
|
break;
|
||||||
|
// Delete
|
||||||
// 삭제
|
|
||||||
} else {
|
} else {
|
||||||
$oDocumentController = &getController('document');
|
$oDocumentController = &getController('document');
|
||||||
$output = $oDocumentController->deleteDocument($document_srl);
|
$output = $oDocumentController->deleteDocument($document_srl);
|
||||||
|
|
@ -404,14 +374,13 @@
|
||||||
|
|
||||||
printContent($content);
|
printContent($content);
|
||||||
break;
|
break;
|
||||||
|
// Get recent posts
|
||||||
// 최신글 받기
|
|
||||||
case 'metaWeblog.getRecentPosts' :
|
case 'metaWeblog.getRecentPosts' :
|
||||||
// 목록을 구하기 위한 옵션
|
// Options to get a list
|
||||||
$args->module_srl = $this->module_srl; ///< 현재 모듈의 module_srl
|
$args->module_srl = $this->module_srl; // /< module_srl of the current module
|
||||||
$args->page = 1;
|
$args->page = 1;
|
||||||
$args->list_count = 20;
|
$args->list_count = 20;
|
||||||
$args->sort_index = 'list_order'; ///< 소팅 값
|
$args->sort_index = 'list_order'; // /< Sorting values
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$args->search_target = 'member_srl';
|
$args->search_target = 'member_srl';
|
||||||
$args->search_keyword = $logged_info->member_srl;
|
$args->search_keyword = $logged_info->member_srl;
|
||||||
|
|
@ -441,8 +410,7 @@
|
||||||
printContent($content);
|
printContent($content);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
// Display RSD if there is no request
|
||||||
// 아무런 요청이 없을 경우 RSD 출력
|
|
||||||
default :
|
default :
|
||||||
|
|
||||||
$homepagelink = getUrl('','mid',$this->mid);
|
$homepagelink = getUrl('','mid',$this->mid);
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,10 @@
|
||||||
/**
|
/**
|
||||||
* @file ./addons/blogapi/blogapi.func.php
|
* @file ./addons/blogapi/blogapi.func.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief blogapi구현을 위한 함수 모음집
|
* @brief Function collections for the implementation of blogapi
|
||||||
**/
|
**/
|
||||||
|
|
||||||
// 오류 표시
|
// Error messages
|
||||||
function getXmlRpcFailure($error, $message) {
|
function getXmlRpcFailure($error, $message) {
|
||||||
return
|
return
|
||||||
sprintf(
|
sprintf(
|
||||||
|
|
@ -16,8 +16,7 @@
|
||||||
htmlspecialchars($message)
|
htmlspecialchars($message)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// Display results
|
||||||
// 결과 표시
|
|
||||||
function getXmlRpcResponse($params) {
|
function getXmlRpcResponse($params) {
|
||||||
$buff = '<?xml version="1.0" encoding="utf-8"?>'."\n<methodResponse><params>";
|
$buff = '<?xml version="1.0" encoding="utf-8"?>'."\n<methodResponse><params>";
|
||||||
$buff .= _getEncodedVal($params);
|
$buff .= _getEncodedVal($params);
|
||||||
|
|
@ -25,8 +24,7 @@
|
||||||
|
|
||||||
return $buff;
|
return $buff;
|
||||||
}
|
}
|
||||||
|
// Encoding
|
||||||
// 인코딩 처리
|
|
||||||
function _getEncodedVal($val, $is_sub_set = false) {
|
function _getEncodedVal($val, $is_sub_set = false) {
|
||||||
if(is_int($val)) $buff = sprintf("<value><i4>%d</i4></value>", $val);
|
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);
|
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);
|
if(!$is_sub_set) return sprintf("<param>\n%s</param>", $buff);
|
||||||
return $buff;
|
return $buff;
|
||||||
}
|
}
|
||||||
|
// Display the result
|
||||||
// 결과 출력
|
|
||||||
function printContent($content) {
|
function printContent($content) {
|
||||||
header("Content-Type: text/xml; charset=UTF-8");
|
header("Content-Type: text/xml; charset=UTF-8");
|
||||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,8 @@
|
||||||
/**
|
/**
|
||||||
* @file captcha.addon.php
|
* @file captcha.addon.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 특정 action을 실행할때 captcha를 띄우도록 함
|
* @brief Captcha for a particular action
|
||||||
* 영어 알파벳을 입력, 음성기능 추가
|
* English alphabets and voice verification added
|
||||||
**/
|
**/
|
||||||
|
|
||||||
if(!class_exists('AddonCaptcha'))
|
if(!class_exists('AddonCaptcha'))
|
||||||
|
|
@ -43,8 +43,8 @@
|
||||||
Context::addHtmlHeader('<script type="text/javascript"> var captchaTargetAct = new Array("'.implode('","',$target_acts).'"); </script>');
|
Context::addHtmlHeader('<script type="text/javascript"> var captchaTargetAct = new Array("'.implode('","',$target_acts).'"); </script>');
|
||||||
Context::addJsFile('./addons/captcha/captcha.js',false, '', null, 'body');
|
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)) {
|
if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $target_acts)) {
|
||||||
Context::loadLang('./addons/captcha/lang');
|
Context::loadLang('./addons/captcha/lang');
|
||||||
$ModuleHandler->error = "captcha_denied";
|
$ModuleHandler->error = "captcha_denied";
|
||||||
|
|
@ -56,11 +56,11 @@
|
||||||
function before_module_init_setCaptchaSession()
|
function before_module_init_setCaptchaSession()
|
||||||
{
|
{
|
||||||
if($_SESSION['captcha_authed']) return false;
|
if($_SESSION['captcha_authed']) return false;
|
||||||
|
// Load language files
|
||||||
// 언어파일 로드
|
|
||||||
Context::loadLang(_XE_PATH_.'addons/captcha/lang');
|
Context::loadLang(_XE_PATH_.'addons/captcha/lang');
|
||||||
|
// Generate keywords
|
||||||
// 키워드 생성
|
|
||||||
$arr = range('A','Y');
|
$arr = range('A','Y');
|
||||||
shuffle($arr);
|
shuffle($arr);
|
||||||
$arr = array_slice($arr,0,6);
|
$arr = array_slice($arr,0,6);
|
||||||
|
|
@ -106,31 +106,31 @@
|
||||||
{
|
{
|
||||||
$arr = array();
|
$arr = array();
|
||||||
for($i=0,$c=strlen($string);$i<$c;$i++) $arr[] = $string{$i};
|
for($i=0,$c=strlen($string);$i<$c;$i++) $arr[] = $string{$i};
|
||||||
|
// Font site
|
||||||
// 글자 하나 사이즈
|
|
||||||
$w = 18;
|
$w = 18;
|
||||||
$h = 25;
|
$h = 25;
|
||||||
|
// Character length
|
||||||
// 글자 수
|
|
||||||
$c = count($arr);
|
$c = count($arr);
|
||||||
|
// Character image
|
||||||
// 글자 이미지
|
|
||||||
$im = array();
|
$im = array();
|
||||||
|
// Create an image by total size
|
||||||
// 총사이즈로 바탕 이미지 생성
|
|
||||||
$im[] = imagecreate(($w+2)*count($arr), $h);
|
$im[] = imagecreate(($w+2)*count($arr), $h);
|
||||||
|
|
||||||
$deg = range(-30,30);
|
$deg = range(-30,30);
|
||||||
shuffle($deg);
|
shuffle($deg);
|
||||||
|
// Create an image for each letter
|
||||||
// 글자별 이미지 생성
|
|
||||||
foreach($arr as $i => $str)
|
foreach($arr as $i => $str)
|
||||||
{
|
{
|
||||||
$im[$i+1] = @imagecreate($w, $h);
|
$im[$i+1] = @imagecreate($w, $h);
|
||||||
$background_color = imagecolorallocate($im[$i+1], 255, 255, 255);
|
$background_color = imagecolorallocate($im[$i+1], 255, 255, 255);
|
||||||
$text_color = imagecolorallocate($im[$i+1], 0, 0, 0);
|
$text_color = imagecolorallocate($im[$i+1], 0, 0, 0);
|
||||||
|
// Control font size
|
||||||
// 글자폰트(사이즈) 조절
|
|
||||||
$ran = range(1,20);
|
$ran = range(1,20);
|
||||||
shuffle($ran);
|
shuffle($ran);
|
||||||
|
|
||||||
|
|
@ -148,22 +148,23 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 각글자 이미지를 합침
|
// Combine images of each character
|
||||||
|
|
||||||
for($i=1;$i<count($im);$i++)
|
for($i=1;$i<count($im);$i++)
|
||||||
{
|
{
|
||||||
imagecopy($im[0],$im[$i],(($w+2)*($i-1)),0,0,0,$w,$h);
|
imagecopy($im[0],$im[$i],(($w+2)*($i-1)),0,0,0,$w,$h);
|
||||||
imagedestroy($im[$i]);
|
imagedestroy($im[$i]);
|
||||||
}
|
}
|
||||||
|
// Larger image
|
||||||
// 이미지 확대
|
|
||||||
$big_count = 2;
|
$big_count = 2;
|
||||||
$big = imagecreatetruecolor(($w+2)*$big_count*$c, $h*$big_count);
|
$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);
|
imagecopyresized($big, $im[0], 0, 0, 0, 0, ($w+2)*$big_count*$c, $h*$big_count, ($w+2)*$c, $h);
|
||||||
imagedestroy($im[0]);
|
imagedestroy($im[0]);
|
||||||
|
|
||||||
if(function_exists('imageantialias')) imageantialias($big,true);
|
if(function_exists('imageantialias')) imageantialias($big,true);
|
||||||
|
// Background line
|
||||||
// 배경 라인 및 점찍기
|
|
||||||
$line_color = imagecolorallocate($big, 0, 0, 0);
|
$line_color = imagecolorallocate($big, 0, 0, 0);
|
||||||
|
|
||||||
$w = ($w+2)*$big_count*$c;
|
$w = ($w+2)*$big_count*$c;
|
||||||
|
|
@ -207,8 +208,8 @@
|
||||||
{
|
{
|
||||||
$_data = FileHandler::readFile(sprintf($_audio, $string{$i}));
|
$_data = FileHandler::readFile(sprintf($_audio, $string{$i}));
|
||||||
|
|
||||||
$start = rand(5, 68); // 해더 4바이트, 데이터 영역 64바이트 정도 랜덤하게 시작
|
$start = rand(5, 68); // Random start in 4-byte header and 64 byte data
|
||||||
$datalen = strlen($_data) - $start - 256; // 마지막 unchanged 256 바이트
|
$datalen = strlen($_data) - $start - 256; // Last unchanged 256 bytes
|
||||||
|
|
||||||
for($j=$start;$j<$datalen;$j+=64)
|
for($j=$start;$j<$datalen;$j+=64)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,9 @@
|
||||||
/**
|
/**
|
||||||
* @file counter.addon.php
|
* @file counter.addon.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @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') {
|
if(Context::isInstalled() && $called_position == 'before_module_init' && Context::get('module')!='admin' && Context::getResponseMethod() == 'HTML') {
|
||||||
$oCounterController = &getController('counter');
|
$oCounterController = &getController('counter');
|
||||||
$oCounterController->procCounterExecute();
|
$oCounterController->procCounterExecute();
|
||||||
|
|
|
||||||
|
|
@ -4,31 +4,27 @@
|
||||||
/**
|
/**
|
||||||
* @file member_communication.addon.php
|
* @file member_communication.addon.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 사용자의 커뮤니케이션 기능을 활성화
|
* @brief Promote user communication
|
||||||
*
|
*
|
||||||
* - 새로운 쪽지가 왔을 경우 팝업으로 띄움
|
* - Pop-up the message if new message comes in
|
||||||
* - MemberModel::getMemberMenu 호출시 대상이 회원일 경우 쪽지 보내기 기능 추가합니다.
|
* - When calling MemberModel::getMemberMenu, feature to send a message is added
|
||||||
* - MemberModel::getMemberMenu 호출시 친구 등록 메뉴를 추가합니다.
|
* - When caliing MemberModel::getMemberMenu, feature to add a friend is added
|
||||||
**/
|
**/
|
||||||
|
// Stop if non-logged-in user is
|
||||||
// 비로그인 사용자면 중지
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if(!$logged_info) return;
|
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') {
|
if($called_position == 'before_module_init' && $this->module != 'member') {
|
||||||
|
// Load a language file from the communication module
|
||||||
// 커뮤니케이션 모듈의 언어파일을 읽음
|
|
||||||
Context::loadLang('./modules/communication/lang');
|
Context::loadLang('./modules/communication/lang');
|
||||||
|
// Add menus on the member login information
|
||||||
// 회원 로그인 정보중에서 쪽지등의 메뉴를 추가
|
|
||||||
$oMemberController = &getController('member');
|
$oMemberController = &getController('member');
|
||||||
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
|
$oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend');
|
||||||
$oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box');
|
$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_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl);
|
||||||
$flag_file = sprintf('%s%s', $flag_path, $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') {
|
} elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu') {
|
||||||
|
|
||||||
$oMemberController = &getController('member');
|
$oMemberController = &getController('member');
|
||||||
$member_srl = Context::get('target_srl');
|
$member_srl = Context::get('target_srl');
|
||||||
$mid = Context::get('cur_mid');
|
$mid = Context::get('cur_mid');
|
||||||
|
// Creates communication model object
|
||||||
// communication 모델 객체 생성
|
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
|
// Add a feature to display own message box.
|
||||||
// 자신이라면 쪽지함 보기 기능 추가
|
|
||||||
if($logged_info->member_srl == $member_srl) {
|
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');
|
$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');
|
$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 {
|
} else {
|
||||||
// 대상 회원의 정보를 가져옴
|
// Get member information
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
|
$target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
|
||||||
if(!$target_member_info->member_srl) return;
|
if(!$target_member_info->member_srl) return;
|
||||||
|
// Get logged-in user information
|
||||||
// 로그인된 사용자 정보를 구함
|
|
||||||
$logged_info = Context::get('logged_info');
|
$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)))
|
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');
|
$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))
|
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');
|
$oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationAddFriend','target_srl',$member_srl), 'cmd_add_friend', './modules/communication/tpl/images/icon_add_friend.gif', 'popup');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,20 +4,18 @@
|
||||||
/**
|
/**
|
||||||
* @file image_name.addon.php
|
* @file image_name.addon.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @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;
|
if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return;
|
||||||
|
// Include a file having functions to replace member image name/mark
|
||||||
// 회원 이미지이름/ 마크/ 찾아서 대체할 함수를 담고 있는 파일을 include
|
|
||||||
require_once('./addons/member_extra_info/member_extra_info.lib.php');
|
require_once('./addons/member_extra_info/member_extra_info.lib.php');
|
||||||
|
// 1. Find a part <div class="member_번호"> content </div> in the output document, change it to image name/mark by using MemberController::transImageName()
|
||||||
// 1. 출력문서중에서 <div class="member_번호">content</div>를 찾아 MemberController::transImageName() 를 이용하여 이미지이름/마크로 변경
|
|
||||||
$output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'memberTransImageName', $output);
|
$output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'memberTransImageName', $output);
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -1,22 +1,19 @@
|
||||||
<?php
|
<?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) {
|
function memberTransImageName($matches) {
|
||||||
|
// If member_srl < 0, then return text only in the body
|
||||||
// 회원번호를 추출하여 0보다 찾으면 본문중 text만 return
|
|
||||||
$member_srl = $matches[3];
|
$member_srl = $matches[3];
|
||||||
if($member_srl<0) return $matches[5];
|
if($member_srl<0) return $matches[5];
|
||||||
|
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$group_image = $oMemberModel->getGroupImageMark($member_srl,$site_module_info->site_srl);
|
$group_image = $oMemberModel->getGroupImageMark($member_srl,$site_module_info->site_srl);
|
||||||
|
// If member_srl=o(not a member), return the entire body
|
||||||
// 회원이 아닐경우(member_srl = 0) 본문 전체를 return
|
|
||||||
$nick_name = $matches[5];
|
$nick_name = $matches[5];
|
||||||
if(!$member_srl) return $matches[0];
|
if(!$member_srl) return $matches[0];
|
||||||
|
// If pre-defined data in the global variablesm return it
|
||||||
// 전역변수에 미리 설정한 데이터가 있다면 그걸 return
|
|
||||||
if(!$GLOBALS['_transImageNameList'][$member_srl]->cached) {
|
if(!$GLOBALS['_transImageNameList'][$member_srl]->cached) {
|
||||||
$GLOBALS['_transImageNameList'][$member_srl]->cached = true;
|
$GLOBALS['_transImageNameList'][$member_srl]->cached = true;
|
||||||
$image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl);
|
$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_name_file = $GLOBALS['_transImageNameList'][$member_srl]->image_name_file;
|
||||||
$image_mark_file = $GLOBALS['_transImageNameList'][$member_srl]->image_mark_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 && !$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));
|
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));
|
||||||
|
|
|
||||||
|
|
@ -13,7 +13,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief hdml 헤더 출력
|
* @brief hdml header output
|
||||||
**/
|
**/
|
||||||
function printHeader() {
|
function printHeader() {
|
||||||
header("Content-Type:text/x-hdml; charset=".$this->charset);
|
header("Content-Type:text/x-hdml; charset=".$this->charset);
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 제목을 출력
|
* @brief Output title
|
||||||
**/
|
**/
|
||||||
function printTitle() {
|
function printTitle() {
|
||||||
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
|
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
|
||||||
|
|
@ -41,8 +41,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 내용을 출력
|
* @brief Output information
|
||||||
* hasChilds()가 있으면 목록형을 그렇지 않으면 컨텐츠를 출력
|
* hasChilds() if there is a list of content types, otherwise output
|
||||||
**/
|
**/
|
||||||
function printContent() {
|
function printContent() {
|
||||||
if($this->hasChilds()) {
|
if($this->hasChilds()) {
|
||||||
|
|
@ -56,10 +56,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 버튼을 출력함
|
* @brief Button to output
|
||||||
**/
|
**/
|
||||||
function printBtn() {
|
function printBtn() {
|
||||||
// 메뉴 형식
|
// Menu Types
|
||||||
if($this->hasChilds()) {
|
if($this->hasChilds()) {
|
||||||
if($this->nextUrl) {
|
if($this->nextUrl) {
|
||||||
$url = $this->nextUrl;
|
$url = $this->nextUrl;
|
||||||
|
|
@ -73,7 +73,7 @@
|
||||||
$url = $this->homeUrl;
|
$url = $this->homeUrl;
|
||||||
printf('<ce task=go label="%s" dest="%s">%s%s', $url->text, $url->url, $url->text, "\n");
|
printf('<ce task=go label="%s" dest="%s">%s%s', $url->text, $url->url, $url->text, "\n");
|
||||||
}
|
}
|
||||||
// 컨텐츠 형식
|
// Content Types
|
||||||
} else {
|
} else {
|
||||||
if($this->nextUrl) {
|
if($this->nextUrl) {
|
||||||
$url = $this->nextUrl;
|
$url = $this->nextUrl;
|
||||||
|
|
@ -91,7 +91,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 푸터 정보를 출력
|
* @brief Footer information output
|
||||||
**/
|
**/
|
||||||
function printFooter() {
|
function printFooter() {
|
||||||
print $this->hasChilds()?'</choice>':'</display>';
|
print $this->hasChilds()?'</choice>':'</display>';
|
||||||
|
|
|
||||||
|
|
@ -13,23 +13,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief hdml 헤더 출력
|
* @brief hdml header output
|
||||||
**/
|
**/
|
||||||
function printHeader() {
|
function printHeader() {
|
||||||
print("<html><head>\n");
|
print("<html><head>\n");
|
||||||
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
|
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));
|
printf("<title>%s%s</title></head><body>\n", htmlspecialchars($this->title),htmlspecialchars($titlePageStr));
|
||||||
}
|
}
|
||||||
|
// Output title
|
||||||
// 제목을 출력
|
|
||||||
function printTitle() {
|
function printTitle() {
|
||||||
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
|
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
|
||||||
printf('<%s%s><br>%s', htmlspecialchars($this->title),htmlspecialchars($titlePageStr),"\n");
|
printf('<%s%s><br>%s', htmlspecialchars($this->title),htmlspecialchars($titlePageStr),"\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 내용을 출력
|
* @brief Output information
|
||||||
* hasChilds()가 있으면 목록형을 그렇지 않으면 컨텐츠를 출력
|
* hasChilds() if there is a list of content types, otherwise output
|
||||||
**/
|
**/
|
||||||
function printContent() {
|
function printContent() {
|
||||||
if($this->hasChilds()) {
|
if($this->hasChilds()) {
|
||||||
|
|
@ -45,7 +44,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 버튼을 출력함
|
* @brief Button to output
|
||||||
**/
|
**/
|
||||||
function printBtn() {
|
function printBtn() {
|
||||||
if($this->nextUrl) {
|
if($this->nextUrl) {
|
||||||
|
|
@ -56,7 +55,7 @@
|
||||||
$url = $this->prevUrl;
|
$url = $this->prevUrl;
|
||||||
printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
|
printf('<a href="%s">%s</a><br>%s', $url->url, $url->text, "\n");
|
||||||
}
|
}
|
||||||
// 언어선택
|
// Select Language
|
||||||
if(!parent::isLangChange()){
|
if(!parent::isLangChange()){
|
||||||
$url = getUrl('','lcm','1','sel_lang',Context::getLangType(),'return_uri',Context::get('current_url'));
|
$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");
|
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");
|
printf('<a btn="%s" href="%s">%s</a><br>%s', $url->text, $url->url, $url->text, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Footer information output
|
||||||
// 푸터 정보를 출력
|
|
||||||
function printFooter() {
|
function printFooter() {
|
||||||
print("</body></html>\n");
|
print("</body></html>\n");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,48 +2,40 @@
|
||||||
/**
|
/**
|
||||||
* Mobile XE Library Class ver 0.1
|
* Mobile XE Library Class ver 0.1
|
||||||
* @author NHN (developers@xpressengine.com) / lang_select : misol
|
* @author NHN (developers@xpressengine.com) / lang_select : misol
|
||||||
* @brief WAP 태그 출력을 위한 XE 라이브러리
|
* @brief XE library for WAP tag output
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class mobileXE {
|
class mobileXE {
|
||||||
|
// Base url
|
||||||
// 기본 url
|
|
||||||
var $homeUrl = NULL;
|
var $homeUrl = NULL;
|
||||||
var $upperUrl = NULL;
|
var $upperUrl = NULL;
|
||||||
var $nextUrl = NULL;
|
var $nextUrl = NULL;
|
||||||
var $prevUrl = NULL;
|
var $prevUrl = NULL;
|
||||||
var $etcBtn = NULL;
|
var $etcBtn = NULL;
|
||||||
|
// Variable for menu navigation
|
||||||
// 메뉴 네비게이션을 위한 변수
|
|
||||||
var $childs = null;
|
var $childs = null;
|
||||||
|
// Basic variable
|
||||||
// 기본 변수
|
|
||||||
var $title = NULL;
|
var $title = NULL;
|
||||||
var $content = NULL;
|
var $content = NULL;
|
||||||
var $mobilePage = 0;
|
var $mobilePage = 0;
|
||||||
var $totalPage = 1;
|
var $totalPage = 1;
|
||||||
var $charset = 'UTF-8';
|
var $charset = 'UTF-8';
|
||||||
var $no = 0;
|
var $no = 0;
|
||||||
|
// Navigation-related variables
|
||||||
// 네비게이션 관련 변수
|
|
||||||
var $menu = null;
|
var $menu = null;
|
||||||
var $listed_items = null;
|
var $listed_items = null;
|
||||||
var $node_list = null;
|
var $node_list = null;
|
||||||
var $index_mid = null;
|
var $index_mid = null;
|
||||||
|
// Navigation On/Off status value
|
||||||
// Navigation On/ Off 상태 값
|
|
||||||
var $navigationMode = 0;
|
var $navigationMode = 0;
|
||||||
|
// XE module information currently requested
|
||||||
// 현재 요청된 XE 모듈 정보
|
|
||||||
var $module_info = null;
|
var $module_info = null;
|
||||||
|
// Currently running instance of the module
|
||||||
// 현재 실행중인 모듈의 instance
|
|
||||||
var $oModule = null;
|
var $oModule = null;
|
||||||
|
|
||||||
// Deck size
|
// Deck size
|
||||||
var $deckSize = 1024;
|
var $deckSize = 1024;
|
||||||
|
// Changing the language setting
|
||||||
// 언어 설정 변경
|
|
||||||
var $languageMode = 0;
|
var $languageMode = 0;
|
||||||
var $lang = null;
|
var $lang = null;
|
||||||
/**
|
/**
|
||||||
|
|
@ -59,8 +51,7 @@
|
||||||
|
|
||||||
$class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType);
|
$class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType);
|
||||||
require_once($class_file);
|
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');
|
$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) {
|
if($this->lang) {
|
||||||
$lang_supported = Context::get('lang_supported');
|
$lang_supported = Context::get('lang_supported');
|
||||||
|
|
@ -85,7 +76,7 @@
|
||||||
* @brief constructor
|
* @brief constructor
|
||||||
**/
|
**/
|
||||||
function mobileXE() {
|
function mobileXE() {
|
||||||
// navigation mode 체크
|
// Check navigation mode
|
||||||
if(Context::get('nm')) {
|
if(Context::get('nm')) {
|
||||||
$this->navigationMode = 1;
|
$this->navigationMode = 1;
|
||||||
$this->cmid = (int)Context::get('cmid');
|
$this->cmid = (int)Context::get('cmid');
|
||||||
|
|
@ -98,16 +89,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief navigation mode 체크
|
* @brief Check navigation mode
|
||||||
* navigationMode 세팅과 모듈 정보의 menu_srl이 있어야 navigation mode = true로 return
|
* navigationMode settings and modules of information must be menu_srl return to navigation mode = true
|
||||||
**/
|
**/
|
||||||
function isNavigationMode() {
|
function isNavigationMode() {
|
||||||
return ($this->navigationMode && $this->module_info->menu_srl)?true:false;
|
return ($this->navigationMode && $this->module_info->menu_srl)?true:false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief langchange mode 체크
|
* @brief Check langchange mode
|
||||||
* languageMode 세팅 있어야 true return
|
* true return should be set languageMode
|
||||||
**/
|
**/
|
||||||
function isLangChange() {
|
function isLangChange() {
|
||||||
if($this->languageMode) return true;
|
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() {
|
function setLangType() {
|
||||||
$lang_supported = Context::get('lang_supported');
|
$lang_supported = Context::get('lang_supported');
|
||||||
// 언어 변수가 있는지 확인하고 변수가 유효한지 확인
|
// Make sure that the language variables and parameters are valid
|
||||||
if($this->lang && isset($lang_supported[$this->lang])) {
|
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');
|
$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');
|
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) {
|
function setModuleInfo(&$module_info) {
|
||||||
if($this->module_info) return;
|
if($this->module_info) return;
|
||||||
|
|
@ -138,21 +129,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 현재 실행중인 모듈 instance 세팅
|
* @brief Set the module instance is currently running
|
||||||
**/
|
**/
|
||||||
function setModuleInstance(&$oModule) {
|
function setModuleInstance(&$oModule) {
|
||||||
if($this->oModule) return;
|
if($this->oModule) return;
|
||||||
|
// Save instance
|
||||||
// instance 저장
|
|
||||||
$this->oModule = $oModule;
|
$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);
|
$menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $this->module_info->menu_srl);
|
||||||
if(!file_exists($menu_cache_file)) return;
|
if(!file_exists($menu_cache_file)) return;
|
||||||
|
|
||||||
include $menu_cache_file;
|
include $menu_cache_file;
|
||||||
|
// One-dimensional arrangement of menu changes
|
||||||
// 정리된 menu들을 1차원으로 변경
|
|
||||||
$this->getListedItems($menu->list, $listed_items, $node_list);
|
$this->getListedItems($menu->list, $listed_items, $node_list);
|
||||||
|
|
||||||
$this->listed_items = $listed_items;
|
$this->listed_items = $listed_items;
|
||||||
|
|
@ -162,8 +150,7 @@
|
||||||
$k = array_keys($node_list);
|
$k = array_keys($node_list);
|
||||||
$v = array_values($node_list);
|
$v = array_values($node_list);
|
||||||
$this->index_mid = $k[0];
|
$this->index_mid = $k[0];
|
||||||
|
// The depth of the current menu, the top button to specify if one or more
|
||||||
// 현재 메뉴의 depth가 1이상이면 상위 버튼을 지정
|
|
||||||
$cur_menu_item = $listed_items[$node_list[$this->module_info->mid]];
|
$cur_menu_item = $listed_items[$node_list[$this->module_info->mid]];
|
||||||
if($cur_menu_item['parent_srl']) {
|
if($cur_menu_item['parent_srl']) {
|
||||||
$parent_srl = $cur_menu_item['parent_srl'];
|
$parent_srl = $cur_menu_item['parent_srl'];
|
||||||
|
|
@ -177,12 +164,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 접속 브라우저의 헤더를 판단하여 브라우저 타입을 return
|
* @brief Access the browser's header to determine the return type of the browser
|
||||||
* 모바일 브라우저가 아닐 경우 null return
|
* Mobile browser, if not null return
|
||||||
**/
|
**/
|
||||||
function getBrowserType() {
|
function getBrowserType() {
|
||||||
if(Context::get('smartphone')) return null;
|
if(Context::get('smartphone')) return null;
|
||||||
// 브라우저 타입을 판별
|
// Determine the type of browser
|
||||||
$browserAccept = $_SERVER['HTTP_ACCEPT'];
|
$browserAccept = $_SERVER['HTTP_ACCEPT'];
|
||||||
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
$userAgent = $_SERVER['HTTP_USER_AGENT'];
|
||||||
$wap_sid = $_SERVER['HTTP_X_UP_SUBNO'];
|
$wap_sid = $_SERVER['HTTP_X_UP_SUBNO'];
|
||||||
|
|
@ -197,19 +184,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief charset 지정
|
* @brief Specify charset
|
||||||
**/
|
**/
|
||||||
function setCharSet($charset = 'UTF-8') {
|
function setCharSet($charset = 'UTF-8') {
|
||||||
if(!$charset) $charset = 'UTF-8';
|
if(!$charset) $charset = 'UTF-8';
|
||||||
|
// SKT supports the euc-kr
|
||||||
//SKT는 euc-kr만 지원
|
|
||||||
if(Context::get('mobile_skt')==1) $charset = 'euc-kr';
|
if(Context::get('mobile_skt')==1) $charset = 'euc-kr';
|
||||||
|
|
||||||
$this->charset = $charset;
|
$this->charset = $charset;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모바일 기기의 용량 제한에 다른 가상 페이지 지정
|
* @brief Limited capacity of mobile devices, specifying a different virtual page
|
||||||
**/
|
**/
|
||||||
function setMobilePage($page=1) {
|
function setMobilePage($page=1) {
|
||||||
if(!$page) $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) {
|
function setChilds($childs) {
|
||||||
// menu개수가 9개 이상일 경우 자체 페이징 처리
|
// If more than nine the number of menu paging processing itself
|
||||||
$menu_count = count($childs);
|
$menu_count = count($childs);
|
||||||
if($menu_count>9) {
|
if($menu_count>9) {
|
||||||
$startNum = ($this->mobilePage-1)*9;
|
$startNum = ($this->mobilePage-1)*9;
|
||||||
|
|
@ -235,8 +221,7 @@
|
||||||
$childs = $new_childs;
|
$childs = $new_childs;
|
||||||
|
|
||||||
$this->totalPage = (int)(($menu_count-1)/9)+1;
|
$this->totalPage = (int)(($menu_count-1)/9)+1;
|
||||||
|
// next/prevUrl specify
|
||||||
// next/prevUrl 지정
|
|
||||||
if($this->mobilePage>1) {
|
if($this->mobilePage>1) {
|
||||||
$url = getUrl('mid',$_GET['mid'],'mpage',$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);
|
$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() {
|
function hasChilds() {
|
||||||
return count($this->childs)?true:0;
|
return count($this->childs)?true:0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief child menu반환
|
* @brief Returns the child menu
|
||||||
**/
|
**/
|
||||||
function getChilds() {
|
function getChilds() {
|
||||||
return $this->childs;
|
return $this->childs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief title 지정
|
* @brief Specify title
|
||||||
**/
|
**/
|
||||||
function setTitle($title) {
|
function setTitle($title) {
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
|
|
@ -276,28 +261,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief title 반환
|
* @brief return title
|
||||||
**/
|
**/
|
||||||
function getTitle() {
|
function getTitle() {
|
||||||
return $this->title;
|
return $this->title;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컨텐츠 정리
|
* @brief Content Cleanup
|
||||||
* HTML 컨텐츠에서 텍스트와 링크만 추출하는 기능
|
* In HTML content, the ability to extract text and links
|
||||||
**/
|
**/
|
||||||
function setContent($content) {
|
function setContent($content) {
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$allow_tag_array = array('<a>','<br>','<p>','<b>','<i>','<u>','<em>','<small>','<strong>','<big>','<table>','<tr>','<td>');
|
$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));
|
$content = strip_tags($content, implode($allow_tag_array));
|
||||||
|
// Margins tab removed
|
||||||
// 탭 여백 제거
|
|
||||||
$content = str_replace("\t", "", $content);
|
$content = str_replace("\t", "", $content);
|
||||||
|
// Repeat two more times the space and remove julnanumeul
|
||||||
// 2번 이상 반복되는 공백과 줄나눔을 제거
|
|
||||||
$content = preg_replace('/( ){2,}/s', '', $content);
|
$content = preg_replace('/( ){2,}/s', '', $content);
|
||||||
$content = preg_replace("/([\r\n]+)/s", "\r\n", $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);
|
$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/>')) {
|
while(strpos($content, '<br/><br/>')) {
|
||||||
$content = str_replace('<br/><br/>','<br/>',$content);
|
$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();
|
$contents = array();
|
||||||
while($content) {
|
while($content) {
|
||||||
$tmp = $this->cutStr($content, $this->deckSize, '');
|
$tmp = $this->cutStr($content, $this->deckSize, '');
|
||||||
|
|
@ -335,8 +315,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->totalPage = count($contents);
|
$this->totalPage = count($contents);
|
||||||
|
// next/prevUrl specify
|
||||||
// next/prevUrl 지정
|
|
||||||
if($this->mobilePage>1) {
|
if($this->mobilePage>1) {
|
||||||
$url = getUrl('mid',$_GET['mid'],'mpage',$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);
|
$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) {
|
function cutStr($string, $cut_size) {
|
||||||
return preg_match('/.{'.$cut_size.'}/su', $string, $arr) ? $arr[0] : $string;
|
return preg_match('/.{'.$cut_size.'}/su', $string, $arr) ? $arr[0] : $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컨텐츠 반환
|
* @brief Return content
|
||||||
**/
|
**/
|
||||||
function getContent() {
|
function getContent() {
|
||||||
return $this->content;
|
return $this->content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief home url 지정
|
* @brief Specifies the home url
|
||||||
**/
|
**/
|
||||||
function setHomeUrl($url, $text) {
|
function setHomeUrl($url, $text) {
|
||||||
if(!$url) $url = '#';
|
if(!$url) $url = '#';
|
||||||
|
|
@ -378,7 +357,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief upper url 지정
|
* @brief Specify upper url
|
||||||
**/
|
**/
|
||||||
function setUpperUrl($url, $text) {
|
function setUpperUrl($url, $text) {
|
||||||
if(!$url) $url = '#';
|
if(!$url) $url = '#';
|
||||||
|
|
@ -387,7 +366,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief prev url 지정
|
* @brief Specify prev url
|
||||||
**/
|
**/
|
||||||
function setPrevUrl($url, $text) {
|
function setPrevUrl($url, $text) {
|
||||||
if(!$url) $url = '#';
|
if(!$url) $url = '#';
|
||||||
|
|
@ -396,7 +375,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief next url 지정
|
* @brief Specify next url
|
||||||
**/
|
**/
|
||||||
function setNextUrl($url, $text) {
|
function setNextUrl($url, $text) {
|
||||||
if(!$url) $url = '#';
|
if(!$url) $url = '#';
|
||||||
|
|
@ -405,7 +384,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 다음, 이전, 상위 이외에 기타 버튼 지정
|
* @brief Next, Previous, Top button assignments other than
|
||||||
**/
|
**/
|
||||||
function setEtcBtn($url, $text) {
|
function setEtcBtn($url, $text) {
|
||||||
if(!$url) $url = '#';
|
if(!$url) $url = '#';
|
||||||
|
|
@ -418,32 +397,25 @@
|
||||||
* @brief display
|
* @brief display
|
||||||
**/
|
**/
|
||||||
function display() {
|
function display() {
|
||||||
// 홈버튼 지정
|
// Home button assignments
|
||||||
$this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home'));
|
$this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home'));
|
||||||
|
// Specify the title
|
||||||
// 제목 지정
|
|
||||||
if(!$this->title) $this->setTitle(Context::getBrowserTitle());
|
if(!$this->title) $this->setTitle(Context::getBrowserTitle());
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
// Output header
|
||||||
// 헤더를 출력
|
|
||||||
$this->printHeader();
|
$this->printHeader();
|
||||||
|
// Output title
|
||||||
// 제목을 출력
|
|
||||||
$this->printTitle();
|
$this->printTitle();
|
||||||
|
// Information output
|
||||||
// 내용 출력
|
|
||||||
$this->printContent();
|
$this->printContent();
|
||||||
|
// Button output
|
||||||
// 버튼 출력
|
|
||||||
$this->printBtn();
|
$this->printBtn();
|
||||||
|
// Footer output
|
||||||
// 푸터를 출력
|
|
||||||
$this->printFooter();
|
$this->printFooter();
|
||||||
|
|
||||||
$content = ob_get_clean();
|
$content = ob_get_clean();
|
||||||
|
// After conversion output
|
||||||
// 변환 후 출력
|
|
||||||
if(strtolower($this->charset) == 'utf-8') print $content;
|
if(strtolower($this->charset) == 'utf-8') print $content;
|
||||||
else print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content);
|
else print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content);
|
||||||
|
|
||||||
|
|
@ -451,7 +423,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 페이지 이동
|
* @brief Move page
|
||||||
**/
|
**/
|
||||||
function movepage($url) {
|
function movepage($url) {
|
||||||
header("location:$url");
|
header("location:$url");
|
||||||
|
|
@ -459,7 +431,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 목록등에서 일련 번호를 리턴한다
|
* @brief And returns a list of serial numbers in
|
||||||
**/
|
**/
|
||||||
function getNo() {
|
function getNo() {
|
||||||
$this->no++;
|
$this->no++;
|
||||||
|
|
@ -468,7 +440,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief XE의 Menu 모듈이 값을 사용하기 쉽게 정리해주는 함수
|
* @brief XE is easy to use Menu module is relieved during the function, value
|
||||||
**/
|
**/
|
||||||
function getListedItems($menu, &$listed_items, &$node_list) {
|
function getListedItems($menu, &$listed_items, &$node_list) {
|
||||||
if(!count($menu)) return;
|
if(!count($menu)) return;
|
||||||
|
|
@ -486,7 +458,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief XE 네비게이션 출력
|
* @brief XE navigation output
|
||||||
**/
|
**/
|
||||||
function displayNavigationContent() {
|
function displayNavigationContent() {
|
||||||
$childs = array();
|
$childs = array();
|
||||||
|
|
@ -523,13 +495,12 @@
|
||||||
}
|
}
|
||||||
$this->setChilds($childs);
|
$this->setChilds($childs);
|
||||||
}
|
}
|
||||||
|
// Output
|
||||||
// 출력
|
|
||||||
$this->display();
|
$this->display();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 언어설정 메뉴 출력
|
* @brief Language Settings menu, the output
|
||||||
**/
|
**/
|
||||||
function displayLangSelect() {
|
function displayLangSelect() {
|
||||||
$childs = array();
|
$childs = array();
|
||||||
|
|
@ -561,37 +532,33 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모듈의 WAP 클래스 객체 생성하여 WAP 준비
|
* @brief Module to create a class object of the WAP WAP ready
|
||||||
**/
|
**/
|
||||||
function displayModuleContent() {
|
function displayModuleContent() {
|
||||||
// 선택된 모듈의 WAP class 객체 생성
|
// Create WAP class objects of the selected module
|
||||||
$oModule = &getWap($this->module_info->module);
|
$oModule = &getWap($this->module_info->module);
|
||||||
if(!$oModule || !method_exists($oModule, 'procWAP') ) return;
|
if(!$oModule || !method_exists($oModule, 'procWAP') ) return;
|
||||||
|
|
||||||
$vars = get_object_vars($this->oModule);
|
$vars = get_object_vars($this->oModule);
|
||||||
if(count($vars)) foreach($vars as $key => $val) $oModule->{$key} = $val;
|
if(count($vars)) foreach($vars as $key => $val) $oModule->{$key} = $val;
|
||||||
|
// Run
|
||||||
// 실행
|
|
||||||
$oModule->procWAP($this);
|
$oModule->procWAP($this);
|
||||||
|
// Output
|
||||||
// 출력
|
|
||||||
$this->display();
|
$this->display();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief WAP 컨텐츠를 별도로 구할 수 없으면 최종 결과물을 출력
|
* @brief WAP content is available as a separate output if the final results
|
||||||
**/
|
**/
|
||||||
function displayContent() {
|
function displayContent() {
|
||||||
Context::set('layout','none');
|
Context::set('layout','none');
|
||||||
|
// Compile a template
|
||||||
// 템플릿 컴파일
|
|
||||||
$oTemplate = new TemplateHandler();
|
$oTemplate = new TemplateHandler();
|
||||||
$oContext = &Context::getInstance();
|
$oContext = &Context::getInstance();
|
||||||
|
|
||||||
$content = $oTemplate->compile($this->oModule->getTemplatePath(), $this->oModule->getTemplateFile());
|
$content = $oTemplate->compile($this->oModule->getTemplatePath(), $this->oModule->getTemplateFile());
|
||||||
$this->setContent($content);
|
$this->setContent($content);
|
||||||
|
// Output
|
||||||
// 출력
|
|
||||||
$this->display();
|
$this->display();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13,19 +13,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief wml 헤더 출력
|
* @brief wml header output
|
||||||
**/
|
**/
|
||||||
function printHeader() {
|
function printHeader() {
|
||||||
header("Content-Type: text/vnd.wap.wml");
|
header("Content-Type: text/vnd.wap.wml");
|
||||||
header("charset: ".$this->charset);
|
header("charset: ".$this->charset);
|
||||||
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
|
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");
|
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));
|
printf("<wml>\n<card title=\"%s%s\">\n<p>\n",htmlspecialchars($this->title),htmlspecialchars($titlePageStr));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 제목을 출력
|
* @brief Output title
|
||||||
**/
|
**/
|
||||||
function printTitle() {
|
function printTitle() {
|
||||||
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
|
if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage);
|
||||||
|
|
@ -33,8 +33,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 내용을 출력
|
* @brief Output information
|
||||||
* hasChilds()가 있으면 목록형을 그렇지 않으면 컨텐츠를 출력
|
* hasChilds() if there is a list of content types, otherwise output
|
||||||
**/
|
**/
|
||||||
function printContent() {
|
function printContent() {
|
||||||
if($this->hasChilds()) {
|
if($this->hasChilds()) {
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 버튼을 출력함
|
* @brief Button to output
|
||||||
**/
|
**/
|
||||||
function printBtn() {
|
function printBtn() {
|
||||||
if($this->nextUrl) {
|
if($this->nextUrl) {
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
$url = $this->prevUrl;
|
$url = $this->prevUrl;
|
||||||
printf('<do type="vnd.prev" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
|
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($this->etcBtn) {
|
||||||
if(is_array($this->etcBtn)) {
|
if(is_array($this->etcBtn)) {
|
||||||
foreach($this->etcBtn as $key=>$val) {
|
foreach($this->etcBtn as $key=>$val) {
|
||||||
|
|
@ -69,7 +69,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 언어선택
|
// Select Language
|
||||||
if(!parent::isLangChange()){
|
if(!parent::isLangChange()){
|
||||||
$url = getUrl('','lcm','1','sel_lang',Context::getLangType(),'return_uri',Context::get('current_url'));
|
$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");
|
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");
|
printf('<do type="vnd.up" label="%s"><go href="%s"/></do>%s', $url->text, $url->url, "\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Footer information output
|
||||||
// 푸터 정보를 출력
|
|
||||||
function printFooter() {
|
function printFooter() {
|
||||||
print("</p>\n</card>\n</wml>");
|
print("</p>\n</card>\n</wml>");
|
||||||
}
|
}
|
||||||
|
// And returns a list of serial numbers in
|
||||||
// 목록등에서 일련 번호를 리턴한다
|
|
||||||
function getNo() {
|
function getNo() {
|
||||||
if(Context::get('mobile_skt')==1) {
|
if(Context::get('mobile_skt')==1) {
|
||||||
return "vnd.skmn".parent::getNo();
|
return "vnd.skmn".parent::getNo();
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file addons/mobile/lang/jp.lang.php
|
* @file addons/mobile/lang/jp.lang.php
|
||||||
* @author NHN (developers@xpressengine.com) 翻訳:ミニミ
|
* @author NHN (developers@xpressengine.com) 翻 訳: ミニ ミ
|
||||||
* @brief 日本語言語パッケージ
|
* @brief Japanese language package
|
||||||
**/
|
**/
|
||||||
|
// Choose the language part by misol
|
||||||
// 言語選択部分 by misol
|
|
||||||
$lang->president_lang = '現在言語';
|
$lang->president_lang = '現在言語';
|
||||||
$lang->select_lang = '言語選択';
|
$lang->select_lang = '言語選択';
|
||||||
$lang->lang_return = '戻る';
|
$lang->lang_return = '戻る';
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,9 @@
|
||||||
/**
|
/**
|
||||||
* @file addons/mobile/lang/ko.lang.php
|
* @file addons/mobile/lang/ko.lang.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 한국어 언어팩 (기본적인 내용만 수록)
|
* @brief Korean language pack (only the more basic)
|
||||||
**/
|
**/
|
||||||
|
// Language selection by misol
|
||||||
// 언어 선택부분 by misol
|
|
||||||
$lang->president_lang = '현재 언어';
|
$lang->president_lang = '현재 언어';
|
||||||
$lang->select_lang = '언어 선택';
|
$lang->select_lang = '언어 선택';
|
||||||
$lang->lang_return = '돌아가기';
|
$lang->lang_return = '돌아가기';
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,9 @@
|
||||||
/**
|
/**
|
||||||
* @file addons/mobile/lang/ko.lang.php
|
* @file addons/mobile/lang/ko.lang.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 한국어 언어팩 (기본적인 내용만 수록)
|
* @brief Korean language pack (only the more basic)
|
||||||
**/
|
**/
|
||||||
|
// Language selection by misol
|
||||||
// 언어 선택부분 by misol
|
|
||||||
$lang->president_lang = 'Дейсвующй язык';
|
$lang->president_lang = 'Дейсвующй язык';
|
||||||
$lang->select_lang = 'Выбор языка';
|
$lang->select_lang = 'Выбор языка';
|
||||||
$lang->lang_return = 'Вернуться';
|
$lang->lang_return = 'Вернуться';
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file addons/mobile/lang/zh-CN.lang.php
|
* @file addons/mobile/lang/zh-CN.lang.php
|
||||||
* @author NHN (developers@xpressengine.com) 翻译:guny
|
* @author NHN (developers@xpressengine.com) 翻译: guny
|
||||||
* @brief 手机XE插件简体中文语言包
|
* @brief XE mobile phone plug-Simplified Chinese Language Pack
|
||||||
**/
|
**/
|
||||||
|
|
||||||
$lang->cmd_go_upper = '上一级';
|
$lang->cmd_go_upper = '上一级';
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @file addons/mobile/lang/zh-TW.lang.php
|
* @file addons/mobile/lang/zh-TW.lang.php
|
||||||
* @author NHN (developers@xpressengine.com) 翻譯:royallin
|
* @author NHN (developers@xpressengine.com) 翻译: royallin
|
||||||
* @brief XE行動上網正體中文語言
|
* @brief XE Mobile Internet Traditional Chinese Language
|
||||||
**/
|
**/
|
||||||
// lang select by misol
|
// lang select by misol
|
||||||
$lang->president_lang = '已選擇語言';
|
$lang->president_lang = '已選擇語言';
|
||||||
|
|
|
||||||
|
|
@ -4,58 +4,47 @@
|
||||||
/**
|
/**
|
||||||
* @file mobile.addon.php
|
* @file mobile.addon.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @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;
|
if(Context::get('module')=='admin') return;
|
||||||
|
// Manage when to call it
|
||||||
// 동작 시점 관리
|
|
||||||
if($called_position != 'before_module_proc' && $called_position != 'after_module_proc' ) return;
|
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');
|
require_once(_XE_PATH_.'addons/mobile/classes/mobile.class.php');
|
||||||
if(!mobileXE::getBrowserType()) return;
|
if(!mobileXE::getBrowserType()) return;
|
||||||
|
// Generate mobile instance
|
||||||
// mobile instance 생성
|
|
||||||
$oMobile = &mobileXE::getInstance();
|
$oMobile = &mobileXE::getInstance();
|
||||||
if(!$oMobile) return;
|
if(!$oMobile) return;
|
||||||
|
// Specify charset on the add-on settings
|
||||||
// 애드온 설정에서 지정된 charset으로 지정
|
|
||||||
$oMobile->setCharSet($addon_info->charset);
|
$oMobile->setCharSet($addon_info->charset);
|
||||||
|
// Set module information
|
||||||
// 모듈의 정보를 세팅
|
|
||||||
$oMobile->setModuleInfo($this->module_info);
|
$oMobile->setModuleInfo($this->module_info);
|
||||||
|
// Register the current module object
|
||||||
// 현재 모듈 객체 등록
|
|
||||||
$oMobile->setModuleInstance($this);
|
$oMobile->setModuleInstance($this);
|
||||||
|
// Extract content and display/exit if navigate mode is or if WAP class exists
|
||||||
// 네비게이트 모드이거나 WAP class가 있을 경우 미리 컨텐츠를 추출하여 출력/ 종료
|
|
||||||
if($called_position == 'before_module_proc') {
|
if($called_position == 'before_module_proc') {
|
||||||
|
|
||||||
if($oMobile->isLangChange()) {
|
if($oMobile->isLangChange()) {
|
||||||
$oMobile->setLangType();
|
$oMobile->setLangType();
|
||||||
$oMobile->displayLangSelect();
|
$oMobile->displayLangSelect();
|
||||||
}
|
}
|
||||||
|
// On navigation mode, display navigation content
|
||||||
// 네비게이트 모드이면 네비게이션 컨텐츠 출력
|
|
||||||
if($oMobile->isNavigationMode()) $oMobile->displayNavigationContent();
|
if($oMobile->isNavigationMode()) $oMobile->displayNavigationContent();
|
||||||
|
// If you have a WAP class content output via WAP class
|
||||||
// WAP class가 있으면 WAP class를 통해 컨텐츠 출력
|
|
||||||
else $oMobile->displayModuleContent();
|
else $oMobile->displayModuleContent();
|
||||||
|
// If neither navigation mode nor WAP class is, display the module's result
|
||||||
// 네비게이트 모드가 아니고 WAP 클래스가 아니면 모듈의 결과를 출력
|
|
||||||
} else if($called_position == 'after_module_proc') {
|
} else if($called_position == 'after_module_proc') {
|
||||||
// 내용 준비
|
// Display
|
||||||
$oMobile->displayContent();
|
$oMobile->displayContent();
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
|
|
@ -4,16 +4,14 @@
|
||||||
/**
|
/**
|
||||||
* @file openid_delegation_id.addon.php
|
* @file openid_delegation_id.addon.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @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.
|
||||||
**/
|
**/
|
||||||
|
// Execute only wen called_position is before_module_init
|
||||||
// called_position이 before_module_init일때만 실행
|
|
||||||
if($called_position != 'before_module_init') return;
|
if($called_position != 'before_module_init') return;
|
||||||
|
// Get add-on settings(openid_delegation_id)
|
||||||
// openid_delegation_id 애드온 설정 정보를 가져옴
|
|
||||||
if(!$addon_info->server||!$addon_info->delegate||!$addon_info->xrds) return;
|
if(!$addon_info->server||!$addon_info->delegate||!$addon_info->xrds) return;
|
||||||
|
|
||||||
$header_script = sprintf(
|
$header_script = sprintf(
|
||||||
|
|
|
||||||
|
|
@ -4,12 +4,11 @@
|
||||||
/**
|
/**
|
||||||
* @file point.addon.php
|
* @file point.addon.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 포인트 레벨 아이콘 표시 애드온
|
* @brief Icon-on-point level
|
||||||
*
|
*
|
||||||
* 포인트 시스템 사용중일때 사용자 이름 앞에 포인트 레벨 아이콘을 표시합니다.
|
* Display point level icon before user name when point system is enabled.
|
||||||
**/
|
**/
|
||||||
|
// return unless before_display_content
|
||||||
// before_display_content 가 아니면 return
|
|
||||||
if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return;
|
if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return;
|
||||||
|
|
||||||
require_once('./addons/point_level_icon/point_level_icon.lib.php');
|
require_once('./addons/point_level_icon/point_level_icon.lib.php');
|
||||||
|
|
|
||||||
|
|
@ -1,34 +1,29 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief 포인트 아이콘 변경을 위한 함수.
|
* @brief Function to change point icon.
|
||||||
**/
|
**/
|
||||||
function pointLevelIconTrans($matches) {
|
function pointLevelIconTrans($matches) {
|
||||||
$member_srl = $matches[3];
|
$member_srl = $matches[3];
|
||||||
if($member_srl<1) return $matches[0];
|
if($member_srl<1) return $matches[0];
|
||||||
|
|
||||||
if(!isset($GLOBALS['_pointLevelIcon'][$member_srl])) {
|
if(!isset($GLOBALS['_pointLevelIcon'][$member_srl])) {
|
||||||
// 포인트 설정을 구해옴
|
// Get point configuration
|
||||||
if(!$GLOBALS['_pointConfig']) {
|
if(!$GLOBALS['_pointConfig']) {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point');
|
$GLOBALS['_pointConfig'] = $oModuleModel->getModuleConfig('point');
|
||||||
}
|
}
|
||||||
$config = $GLOBALS['_pointConfig'];
|
$config = $GLOBALS['_pointConfig'];
|
||||||
|
// Get point model
|
||||||
// 포인트 모델을 구해 놓음
|
|
||||||
if(!$GLOBALS['_pointModel']) $GLOBALS['_pointModel'] = getModel('point');
|
if(!$GLOBALS['_pointModel']) $GLOBALS['_pointModel'] = getModel('point');
|
||||||
$oPointModel = &$GLOBALS['_pointModel'];
|
$oPointModel = &$GLOBALS['_pointModel'];
|
||||||
|
// Get points
|
||||||
// 포인트를 구함
|
|
||||||
$point = $oPointModel->getPoint($member_srl);
|
$point = $oPointModel->getPoint($member_srl);
|
||||||
|
// Get level
|
||||||
// 레벨을 구함
|
|
||||||
$level = $oPointModel->getLevel($point, $config->level_step);
|
$level = $oPointModel->getLevel($point, $config->level_step);
|
||||||
$text = $matches[5];
|
$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);
|
$level_icon = sprintf('%smodules/point/icons/%s/%d.gif', Context::getRequestUri(), $config->level_icon, $level);
|
||||||
|
// Get per to go to the next level if not a top level
|
||||||
// 최고 레벨이 아니면 다음 레벨로 가기 위한 per을 구함 :: 주석과 실제 내용이 맞지 않아 실제 내용을 수정
|
|
||||||
if($level < $config->max_level) {
|
if($level < $config->max_level) {
|
||||||
$next_point = $config->level_step[$level+1];
|
$next_point = $config->level_step[$level+1];
|
||||||
$present_point = $config->level_step[$level];
|
$present_point = $config->level_step[$level];
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
/**
|
/**
|
||||||
* @file resize_image.addon.php
|
* @file resize_image.addon.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 본문내 이미지 조절 애드온
|
* @brief Add-on to resize images in the body
|
||||||
**/
|
**/
|
||||||
|
|
||||||
if($called_position == 'after_module_proc' && Context::getResponseMethod()=="HTML") {
|
if($called_position == 'after_module_proc' && Context::getResponseMethod()=="HTML") {
|
||||||
|
|
|
||||||
|
|
@ -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) {
|
function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL, $domain = null) {
|
||||||
static $url = array();
|
static $url = array();
|
||||||
|
|
@ -919,7 +919,7 @@ class Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief key값에 해당하는 값을 return
|
* @brief return key value
|
||||||
**/
|
**/
|
||||||
function get($key) {
|
function get($key) {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||||
|
|
@ -927,9 +927,9 @@ class Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 받고자 하는 변수만 object에 입력하여 받음
|
* @brief get a specified var in object
|
||||||
*
|
*
|
||||||
* key1, key2, key3 .. 등의 인자를 주어 여러개의 변수를 object vars로 세팅하여 받을 수 있음
|
* get one more vars in object vars with given arguments(key1, key2, key3,...)
|
||||||
**/
|
**/
|
||||||
function gets() {
|
function gets() {
|
||||||
$num_args = func_num_args();
|
$num_args = func_num_args();
|
||||||
|
|
@ -944,7 +944,7 @@ class Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모든 데이터를 return
|
* @brief Return all data
|
||||||
**/
|
**/
|
||||||
function getAll() {
|
function getAll() {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
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() {
|
function getRequestVars() {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||||
|
|
@ -960,8 +960,8 @@ class Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief SSL로 인증되어야 할 action이 있을 경우 등록
|
* @brief Register if actions is to be encrypted by SSL
|
||||||
* common/js/xml_handler.js에서 이 action들에 대해서 https로 전송되도록 함
|
* Those actions are sent to https in common/js/xml_handler.js
|
||||||
**/
|
**/
|
||||||
function addSSLAction($action) {
|
function addSSLAction($action) {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
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') {
|
function addJsFile($file, $optimized = false, $targetie = '',$index=0, $type='head') {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
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 = '') {
|
function unloadJsFile($file, $optimized = false, $targetie = '') {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
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) {
|
function addJsFilter($path, $filename) {
|
||||||
$oXmlFilter = new XmlJSFilter($path, $filename);
|
$oXmlFilter = new XmlJSFilter($path, $filename);
|
||||||
$oXmlFilter->compile();
|
$oXmlFilter->compile();
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief array_unique와 동작은 동일하나 file 첨자에 대해서만 동작함
|
* @brief Same as array_unique but works only for file subscript
|
||||||
* @deprecated
|
* @deprecated
|
||||||
**/
|
**/
|
||||||
function _getUniqueFileList($files) {
|
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) {
|
function addCSSFile($file, $optimized=false, $media='all', $targetie='',$index=0) {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
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 = '') {
|
function unloadCSSFile($file, $optimized = false, $media = 'all', $targetie = '') {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||||
|
|
@ -1163,7 +1163,7 @@ class Context {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief HtmlHeader 추가
|
* @brief Add HtmlHeader
|
||||||
**/
|
**/
|
||||||
function addHtmlHeader($header) {
|
function addHtmlHeader($header) {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
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) {
|
function addBodyClass($class_name) {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
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() {
|
function getBodyClass() {
|
||||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
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) {
|
function transContent($content) {
|
||||||
return $content;
|
return $content;
|
||||||
|
|
|
||||||
|
|
@ -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] $query_id query id (module.queryname
|
||||||
* @param[in] $args arguments for query
|
* @param[in] $args arguments for query
|
||||||
* @return result of query
|
* @return result of query
|
||||||
|
|
|
||||||
|
|
@ -2,34 +2,34 @@
|
||||||
/**
|
/**
|
||||||
* @class DBCubrid
|
* @class DBCubrid
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief Cubrid DBMS를 이용하기 위한 class
|
* @brief Cubrid DBMS to use the class
|
||||||
* @version 0.1p1
|
* @version 0.1p1
|
||||||
*
|
*
|
||||||
* CUBRID2008 R1.3 에 대응하도록 수정 Prototype (prototype@cubrid.com) / 09.02.23
|
* Modified to work with CUBRID2008 R1.3 verion by Prototype (prototype@cubrid.com)/09.02.23
|
||||||
* 7.3 ~ 2008 R1.3 까지 테스트 완료함.
|
* Test completed for CUBRID 7.3 ~ 2008 R1.3 versions.
|
||||||
* 기본 쿼리만 사용하였기에 특화된 튜닝이 필요
|
* Only basic query used so query tunning and optimization needed
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class DBCubrid extends DB
|
class DBCubrid extends DB
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Cubrid DB에 접속하기 위한 정보
|
* @brief CUBRID DB connection information
|
||||||
**/
|
**/
|
||||||
var $hostname = '127.0.0.1'; ///< hostname
|
var $hostname = '127.0.0.1'; ///< hostname
|
||||||
var $userid = NULL; ///< user id
|
var $userid = NULL; ///< user id
|
||||||
var $password = NULL; ///< password
|
var $password = NULL; ///< password
|
||||||
var $database = NULL; ///< database
|
var $database = NULL; ///< database
|
||||||
var $port = 33000; ///< db server port
|
var $port = 33000; ///< db server port
|
||||||
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 $cutlen = 12000; ///< 큐브리드의 최대 상수 크기(스트링이 이보다 크면 '...'+'...' 방식을 사용해야 한다
|
var $cutlen = 12000; // /< max size of constant in CUBRID(if string is larger than this, '...'+'...' should be used)
|
||||||
var $comment_syntax = '/* %s */';
|
var $comment_syntax = '/* %s */';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief cubrid에서 사용될 column type
|
* @brief column type used in CUBRID
|
||||||
*
|
*
|
||||||
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
|
* column_type should be replaced for each DBMS's type
|
||||||
* 각 DBMS에 맞게 replace 해주어야 한다
|
* becasue it uses commonly defined type in the schema/query xml
|
||||||
**/
|
**/
|
||||||
var $column_type = array(
|
var $column_type = array(
|
||||||
'bignumber' => 'numeric(20)',
|
'bignumber' => 'numeric(20)',
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief Return if installable
|
||||||
**/
|
**/
|
||||||
function isSupported()
|
function isSupported()
|
||||||
{
|
{
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB정보 설정 및 connect/ close
|
* @brief DB settings and connect/close
|
||||||
**/
|
**/
|
||||||
function _setDBInfo()
|
function _setDBInfo()
|
||||||
{
|
{
|
||||||
|
|
@ -86,17 +86,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 접속
|
* @brief DB Connection
|
||||||
**/
|
**/
|
||||||
function _connect()
|
function _connect()
|
||||||
{
|
{
|
||||||
// db 정보가 없으면 무시
|
// ignore if db information not exists
|
||||||
if (!$this->hostname || !$this->userid || !$this->password || !$this->database || !$this->port) return;
|
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);
|
$this->fd = @cubrid_connect ($this->hostname, $this->port, $this->database, $this->userid, $this->password);
|
||||||
|
|
||||||
// 접속체크
|
// check connections
|
||||||
if (!$this->fd) {
|
if (!$this->fd) {
|
||||||
$this->setError (-1, 'database connect fail');
|
$this->setError (-1, 'database connect fail');
|
||||||
return $this->is_connected = false;
|
return $this->is_connected = false;
|
||||||
|
|
@ -107,7 +107,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB접속 해제
|
* @brief DB disconnect
|
||||||
**/
|
**/
|
||||||
function close()
|
function close()
|
||||||
{
|
{
|
||||||
|
|
@ -119,7 +119,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
|
* @brief handles quatation of the string variables from the query
|
||||||
**/
|
**/
|
||||||
function addQuotes($string)
|
function addQuotes($string)
|
||||||
{
|
{
|
||||||
|
|
@ -147,7 +147,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 트랜잭션 시작
|
* @brief Begin transaction
|
||||||
**/
|
**/
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
|
|
@ -156,7 +156,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 롤백
|
* @brief Rollback
|
||||||
**/
|
**/
|
||||||
function rollback()
|
function rollback()
|
||||||
{
|
{
|
||||||
|
|
@ -166,7 +166,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 커밋
|
* @brief Commit
|
||||||
**/
|
**/
|
||||||
function commit()
|
function commit()
|
||||||
{
|
{
|
||||||
|
|
@ -178,24 +178,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief : 쿼리문의 실행 및 결과의 fetch 처리
|
* @brief : executing the query and fetching the result
|
||||||
*
|
*
|
||||||
* query : query문 실행하고 result return\n
|
* query: run a query and return the result\n
|
||||||
* fetch : reutrn 된 값이 없으면 NULL\n
|
* fetch: NULL if no value returned \n
|
||||||
* rows이면 array object\n
|
* array object if rows returned \n
|
||||||
* row이면 object\n
|
* object if a row returned \n
|
||||||
* return\n
|
* return\n
|
||||||
**/
|
**/
|
||||||
function _query($query)
|
function _query($query)
|
||||||
{
|
{
|
||||||
if (!$query || !$this->isConnected ()) return;
|
if (!$query || !$this->isConnected ()) return;
|
||||||
|
|
||||||
// 쿼리 시작을 알림
|
// Notify to start a query execution
|
||||||
$this->actStart ($query);
|
$this->actStart ($query);
|
||||||
|
|
||||||
// 쿼리 문 실행
|
// Execute the query
|
||||||
$result = @cubrid_execute ($this->fd, $query);
|
$result = @cubrid_execute ($this->fd, $query);
|
||||||
// 오류 체크
|
// error check
|
||||||
if (cubrid_error_code ()) {
|
if (cubrid_error_code ()) {
|
||||||
$code = cubrid_error_code ();
|
$code = cubrid_error_code ();
|
||||||
$msg = cubrid_error_msg ();
|
$msg = cubrid_error_msg ();
|
||||||
|
|
@ -203,15 +203,15 @@
|
||||||
$this->setError ($code, $msg);
|
$this->setError ($code, $msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 쿼리 실행 종료를 알림
|
// Notify to complete a query execution
|
||||||
$this->actFinish ();
|
$this->actFinish ();
|
||||||
|
|
||||||
// 결과 리턴
|
// Return the result
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 결과를 fetch
|
* @brief Fetch the result
|
||||||
**/
|
**/
|
||||||
function _fetch($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()
|
function getNextSequence()
|
||||||
{
|
{
|
||||||
|
|
@ -260,7 +260,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 마이그레이션시 sequence 가 없을 경우 생성
|
* @brief return if the table already exists
|
||||||
**/
|
**/
|
||||||
function _makeSequence()
|
function _makeSequence()
|
||||||
{
|
{
|
||||||
|
|
@ -302,7 +302,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 테이블 기생성 여부 return
|
* brief return a table if exists
|
||||||
**/
|
**/
|
||||||
function isTableExists ($target_name)
|
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)
|
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)
|
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)
|
function isColumnExists ($table_name, $column_name)
|
||||||
{
|
{
|
||||||
|
|
@ -388,7 +388,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 테이블에 특정 인덱스 추가
|
* @brief add an index to the table
|
||||||
* $target_columns = array(col1, col2)
|
* $target_columns = array(col1, col2)
|
||||||
* $is_unique? unique : none
|
* $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)
|
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)
|
function isIndexExists ($table_name, $index_name)
|
||||||
{
|
{
|
||||||
|
|
@ -430,7 +430,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief xml 을 받아서 테이블을 생성
|
* @brief creates a table by using xml file
|
||||||
**/
|
**/
|
||||||
function createTableByXml ($xml_doc)
|
function createTableByXml ($xml_doc)
|
||||||
{
|
{
|
||||||
|
|
@ -438,19 +438,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief xml 을 받아서 테이블을 생성
|
* @brief creates a table by using xml file
|
||||||
**/
|
**/
|
||||||
function createTableByXmlFile ($file_name)
|
function createTableByXmlFile ($file_name)
|
||||||
{
|
{
|
||||||
if (!file_exists ($file_name)) return;
|
if (!file_exists ($file_name)) return;
|
||||||
// xml 파일을 읽음
|
// read xml file
|
||||||
$buff = FileHandler::readFile ($file_name);
|
$buff = FileHandler::readFile ($file_name);
|
||||||
|
|
||||||
return $this->_createTable ($buff);
|
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
|
* type : number, varchar, tinytext, text, bigtext, char, date, \n
|
||||||
* opt : notnull, default, size\n
|
* opt : notnull, default, size\n
|
||||||
|
|
@ -461,14 +461,13 @@
|
||||||
// xml parsing
|
// xml parsing
|
||||||
$oXml = new XmlParser();
|
$oXml = new XmlParser();
|
||||||
$xml_obj = $oXml->parse($xml_doc);
|
$xml_obj = $oXml->parse($xml_doc);
|
||||||
|
// Create a table schema
|
||||||
// 테이블 생성 schema 작성
|
|
||||||
$table_name = $xml_obj->table->attrs->name;
|
$table_name = $xml_obj->table->attrs->name;
|
||||||
|
|
||||||
// if the table already exists exit function
|
// if the table already exists exit function
|
||||||
if ($this->isTableExists($table_name)) return;
|
if ($this->isTableExists($table_name)) return;
|
||||||
|
|
||||||
// 만약 테이블 이름이 sequence라면 serial 생성
|
// If the table name is sequence, it creates a serial
|
||||||
if ($table_name == 'sequence') {
|
if ($table_name == 'sequence') {
|
||||||
$query = sprintf ('create serial "%s" start with 1 increment by 1'.
|
$query = sprintf ('create serial "%s" start with 1 increment by 1'.
|
||||||
' minvalue 1 '.
|
' minvalue 1 '.
|
||||||
|
|
@ -563,7 +562,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 조건문 작성하여 return
|
* @brief return the condition
|
||||||
**/
|
**/
|
||||||
function getCondition ($output)
|
function getCondition ($output)
|
||||||
{
|
{
|
||||||
|
|
@ -651,16 +650,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief insertAct 처리
|
* @brief handles insertAct
|
||||||
**/
|
**/
|
||||||
function _executeInsertAct ($output)
|
function _executeInsertAct ($output)
|
||||||
{
|
{
|
||||||
// 테이블 정리
|
// tables
|
||||||
foreach ($output->tables as $val) {
|
foreach ($output->tables as $val) {
|
||||||
$table_list[] = '"'.$this->prefix.$val.'"';
|
$table_list[] = '"'.$this->prefix.$val.'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 컬럼 정리
|
// columns
|
||||||
foreach ($output->columns as $key => $val) {
|
foreach ($output->columns as $key => $val) {
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
$value = $val['value'];
|
$value = $val['value'];
|
||||||
|
|
@ -699,18 +698,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief updateAct 처리
|
* @brief handles updateAct
|
||||||
**/
|
**/
|
||||||
function _executeUpdateAct ($output)
|
function _executeUpdateAct ($output)
|
||||||
{
|
{
|
||||||
// 테이블 정리
|
// tables
|
||||||
foreach ($output->tables as $key => $val) {
|
foreach ($output->tables as $key => $val) {
|
||||||
$table_list[] = '"'.$this->prefix.$val.'" as "'.$key.'"';
|
$table_list[] = '"'.$this->prefix.$val.'" as "'.$key.'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
$check_click_count = true;
|
$check_click_count = true;
|
||||||
|
|
||||||
// 컬럼 정리
|
// columns
|
||||||
foreach ($output->columns as $key => $val) {
|
foreach ($output->columns as $key => $val) {
|
||||||
if (!isset ($val['value'])) continue;
|
if (!isset ($val['value'])) continue;
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
|
|
@ -721,10 +720,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 0; $i < $key; $i++) {
|
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 ($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) {
|
if (strpos ($name, '.') !== false && strpos ($value, '.') !== false) {
|
||||||
$column_list[] = $name.' = '.$value;
|
$column_list[] = $name.' = '.$value;
|
||||||
|
|
@ -742,7 +741,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 조건절 정리
|
// conditional clause
|
||||||
$condition = $this->getCondition ($output);
|
$condition = $this->getCondition ($output);
|
||||||
|
|
||||||
$check_click_count_condition = false;
|
$check_click_count_condition = false;
|
||||||
|
|
@ -792,16 +791,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief deleteAct 처리
|
* @brief handles deleteAct
|
||||||
**/
|
**/
|
||||||
function _executeDeleteAct ($output)
|
function _executeDeleteAct ($output)
|
||||||
{
|
{
|
||||||
// 테이블 정리
|
// tables
|
||||||
foreach ($output->tables as $val) {
|
foreach ($output->tables as $val) {
|
||||||
$table_list[] = '"'.$this->prefix.$val.'"';
|
$table_list[] = '"'.$this->prefix.$val.'"';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 조건절 정리
|
// Conditional clauses
|
||||||
$condition = $this->getCondition ($output);
|
$condition = $this->getCondition ($output);
|
||||||
|
|
||||||
$query = sprintf ("delete from %s %s", implode (',',$table_list), $condition);
|
$query = sprintf ("delete from %s %s", implode (',',$table_list), $condition);
|
||||||
|
|
@ -812,14 +811,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief selectAct 처리
|
* @brief Handle selectAct
|
||||||
*
|
*
|
||||||
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
|
* to get a specific page list easily in select statement,\n
|
||||||
* navigation이라는 method를 제공
|
* a method, navigation, is used
|
||||||
**/
|
**/
|
||||||
function _executeSelectAct ($output)
|
function _executeSelectAct ($output)
|
||||||
{
|
{
|
||||||
// 테이블 정리
|
// tables
|
||||||
$table_list = array ();
|
$table_list = array ();
|
||||||
foreach ($output->tables as $key => $val) {
|
foreach ($output->tables as $key => $val) {
|
||||||
$table_list[] = '"'.$this->prefix.$val.'" as "'.$key.'"';
|
$table_list[] = '"'.$this->prefix.$val.'" as "'.$key.'"';
|
||||||
|
|
@ -966,7 +965,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// list_count를 사용할 경우 적용
|
// apply when using list_count
|
||||||
if ($output->list_count['value']) {
|
if ($output->list_count['value']) {
|
||||||
$start_count = 0;
|
$start_count = 0;
|
||||||
$list_count = $output->list_count['value'];
|
$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 ()
|
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) {
|
function _getNavigationData ($table_list, $columns, $left_join, $condition, $output) {
|
||||||
require_once (_XE_PATH_.'classes/page/PageHandler.class.php');
|
require_once (_XE_PATH_.'classes/page/PageHandler.class.php');
|
||||||
|
|
@ -1129,7 +1128,7 @@
|
||||||
$page = $output->page['value'];
|
$page = $output->page['value'];
|
||||||
if (!$page) $page = 1;
|
if (!$page) $page = 1;
|
||||||
|
|
||||||
// 전체 페이지를 구함
|
// total pages
|
||||||
if ($total_count) {
|
if ($total_count) {
|
||||||
$total_page = (int) (($total_count - 1) / $list_count) + 1;
|
$total_page = (int) (($total_count - 1) / $list_count) + 1;
|
||||||
}
|
}
|
||||||
|
|
@ -1137,7 +1136,7 @@
|
||||||
$total_page = 1;
|
$total_page = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 페이지 변수를 체크
|
// check the page variables
|
||||||
if ($page > $total_page) $page = $total_page;
|
if ($page > $total_page) $page = $total_page;
|
||||||
$start_count = ($page - 1) * $list_count;
|
$start_count = ($page - 1) * $list_count;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @class DBFriebird
|
* @class DBFirebird
|
||||||
* @author 김현식 (dev.hyuns@gmail.com)
|
* @author Kim Hyun Sik (dev.hyuns @ gmail.com)
|
||||||
* @brief Firebird DBMS를 이용하기 위한 class
|
* @brief class to use Firebird DBMS
|
||||||
* @version 0.3
|
* @version 0.3
|
||||||
*
|
*
|
||||||
* firebird handling class
|
* firebird handling class
|
||||||
|
|
@ -11,21 +11,21 @@
|
||||||
class DBFireBird extends DB {
|
class DBFireBird extends DB {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Firebird DB에 접속하기 위한 정보
|
* @brief connection to Firebird DB
|
||||||
**/
|
**/
|
||||||
var $hostname = '127.0.0.1'; ///< hostname
|
var $hostname = '127.0.0.1'; ///< hostname
|
||||||
var $userid = NULL; ///< user id
|
var $userid = NULL; ///< user id
|
||||||
var $password = NULL; ///< password
|
var $password = NULL; ///< password
|
||||||
var $database = NULL; ///< database
|
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 $idx_no = 0; // 인덱스 생성시 사용할 카운터
|
var $idx_no = 0; // counter for creating an index
|
||||||
var $comment_syntax = '/* %s */';
|
var $comment_syntax = '/* %s */';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief firebird에서 사용될 column type
|
* @brief column type used in firebird
|
||||||
*
|
*
|
||||||
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
|
* column_type should be replaced for each DBMS's type
|
||||||
* 각 DBMS에 맞게 replace 해주어야 한다
|
* becasue it uses commonly defined type in the schema/query xml
|
||||||
**/
|
**/
|
||||||
var $column_type = array(
|
var $column_type = array(
|
||||||
'bignumber' => 'BIGINT',
|
'bignumber' => 'BIGINT',
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief Return if installable
|
||||||
**/
|
**/
|
||||||
function isSupported() {
|
function isSupported() {
|
||||||
if(!function_exists('ibase_connect')) return false;
|
if(!function_exists('ibase_connect')) return false;
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB정보 설정 및 connect/ close
|
* @brief DB settings and connect/close
|
||||||
**/
|
**/
|
||||||
function _setDBInfo() {
|
function _setDBInfo() {
|
||||||
$db_info = Context::getDBInfo();
|
$db_info = Context::getDBInfo();
|
||||||
|
|
@ -77,16 +77,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 접속
|
* @brief DB Connection
|
||||||
**/
|
**/
|
||||||
function _connect() {
|
function _connect() {
|
||||||
// db 정보가 없으면 무시
|
// ignore if db information not exists
|
||||||
if(!$this->hostname || !$this->port || !$this->userid || !$this->password || !$this->database) return;
|
if(!$this->hostname || !$this->port || !$this->userid || !$this->password || !$this->database) return;
|
||||||
|
|
||||||
//if(strpos($this->hostname, ':')===false && $this->port) $this->hostname .= ':'.$this->port;
|
//if(strpos($this->hostname, ':')===false && $this->port) $this->hostname .= ':'.$this->port;
|
||||||
|
// attempts to connect
|
||||||
// 접속시도
|
|
||||||
|
|
||||||
$host = $this->hostname."/".$this->port.":".$this->database;
|
$host = $this->hostname."/".$this->port.":".$this->database;
|
||||||
|
|
||||||
$this->fd = @ibase_connect($host, $this->userid, $this->password);
|
$this->fd = @ibase_connect($host, $this->userid, $this->password);
|
||||||
|
|
@ -94,8 +92,7 @@
|
||||||
$this->setError(ibase_errcode(), ibase_errmsg());
|
$this->setError(ibase_errcode(), ibase_errmsg());
|
||||||
return $this->is_connected = false;
|
return $this->is_connected = false;
|
||||||
}
|
}
|
||||||
|
// Error when Firebird version is lower than 2.0
|
||||||
// Firebird 버전 확인후 2.0 이하면 오류 표시
|
|
||||||
if (($service = ibase_service_attach($this->hostname, $this->userid, $this->password)) != FALSE) {
|
if (($service = ibase_service_attach($this->hostname, $this->userid, $this->password)) != FALSE) {
|
||||||
// get server version and implementation strings
|
// get server version and implementation strings
|
||||||
$server_info = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
|
$server_info = ibase_server_info($service, IBASE_SVC_SERVER_VERSION);
|
||||||
|
|
@ -118,14 +115,13 @@
|
||||||
@ibase_close($this->fd);
|
@ibase_close($this->fd);
|
||||||
return $this->is_connected = false;
|
return $this->is_connected = false;
|
||||||
}
|
}
|
||||||
|
// Check connections
|
||||||
// 접속체크
|
|
||||||
$this->is_connected = true;
|
$this->is_connected = true;
|
||||||
$this->password = md5($this->password);
|
$this->password = md5($this->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB접속 해제
|
* @brief DB disconnect
|
||||||
**/
|
**/
|
||||||
function close() {
|
function close() {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
|
@ -135,7 +131,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
|
* @brief handles quatation of the string variables from the query
|
||||||
**/
|
**/
|
||||||
function addQuotes($string) {
|
function addQuotes($string) {
|
||||||
// if(get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$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) {
|
function addDoubleQuotes($string) {
|
||||||
if($string == "*") return $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){
|
function autoQuotes($string){
|
||||||
$string = strtolower($string);
|
$string = strtolower($string);
|
||||||
|
// for substr function
|
||||||
// substr 함수 일경우
|
|
||||||
if(strpos($string, "substr(") !== false) {
|
if(strpos($string, "substr(") !== false) {
|
||||||
$tokken = strtok($string, "(,)");
|
$tokken = strtok($string, "(,)");
|
||||||
$tokken = strtok("(,)");
|
$tokken = strtok("(,)");
|
||||||
|
|
@ -190,8 +185,7 @@
|
||||||
$as = trim($as);
|
$as = trim($as);
|
||||||
$as = $this->addDoubleQuotes($as);
|
$as = $this->addDoubleQuotes($as);
|
||||||
}
|
}
|
||||||
|
// for functions
|
||||||
// 함수 사용시
|
|
||||||
$tmpFunc1 = null;
|
$tmpFunc1 = null;
|
||||||
$tmpFunc2 = null;
|
$tmpFunc2 = null;
|
||||||
if(($no1 = strpos($string,'('))!==false && ($no2 = strpos($string, ')'))!==false) {
|
if(($no1 = strpos($string,'('))!==false && ($no2 = strpos($string, ')'))!==false) {
|
||||||
|
|
@ -199,8 +193,7 @@
|
||||||
$tmpFunc2 = substr($string, $no2, strlen($string)-$no2+1);
|
$tmpFunc2 = substr($string, $no2, strlen($string)-$no2+1);
|
||||||
$string = trim(substr($string, $no1+1, $no2-$no1-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);
|
preg_match("/((?i)[a-z0-9_-]+)[.]((?i)[a-z0-9_\-\*]+)/", $string, $matches);
|
||||||
|
|
||||||
if($matches) {
|
if($matches) {
|
||||||
|
|
@ -225,7 +218,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach($values as $val1) {
|
foreach($values as $val1) {
|
||||||
// (테이블.컬럼) 구조 일때 처리
|
// for (table.column) structure
|
||||||
preg_match("/((?i)[a-z0-9_-]+)[.]((?i)[a-z0-9_\-\*]+)/", $val1, $matches);
|
preg_match("/((?i)[a-z0-9_-]+)[.]((?i)[a-z0-9_\-\*]+)/", $val1, $matches);
|
||||||
if($matches) {
|
if($matches) {
|
||||||
$isTable = false;
|
$isTable = false;
|
||||||
|
|
@ -257,7 +250,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 트랜잭션 시작
|
* @brief Begin transaction
|
||||||
**/
|
**/
|
||||||
function begin() {
|
function begin() {
|
||||||
if(!$this->isConnected() || $this->transaction_started) return;
|
if(!$this->isConnected() || $this->transaction_started) return;
|
||||||
|
|
@ -265,7 +258,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 롤백
|
* @brief Rollback
|
||||||
**/
|
**/
|
||||||
function rollback() {
|
function rollback() {
|
||||||
if(!$this->isConnected() || !$this->transaction_started) return;
|
if(!$this->isConnected() || !$this->transaction_started) return;
|
||||||
|
|
@ -274,7 +267,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 커밋
|
* @brief Commits
|
||||||
**/
|
**/
|
||||||
function commit() {
|
function commit() {
|
||||||
if(!$force && (!$this->isConnected() || !$this->transaction_started)) return;
|
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
|
* query: run a query and return the result\n
|
||||||
* fetch : reutrn 된 값이 없으면 NULL\n
|
* fetch: NULL if no value returned \n
|
||||||
* rows이면 array object\n
|
* array object if rows returned \n
|
||||||
* row이면 object\n
|
* object if a row returned \n
|
||||||
* return\n
|
* return\n
|
||||||
**/
|
**/
|
||||||
function _query($query, $params=null) {
|
function _query($query, $params=null) {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
|
||||||
if(count($params) == 0) {
|
if(count($params) == 0) {
|
||||||
// 쿼리 시작을 알림
|
// Notify to start a query execution
|
||||||
$this->actStart($query);
|
$this->actStart($query);
|
||||||
|
// Execute the query statement
|
||||||
// 쿼리 문 실행
|
|
||||||
$result = ibase_query($this->fd, $query);
|
$result = ibase_query($this->fd, $query);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// 쿼리 시작을 알림
|
// Notify to start a query execution
|
||||||
$log = $query."\n\t\t\t";
|
$log = $query."\n\t\t\t";
|
||||||
$log .= implode(",", $params);
|
$log .= implode(",", $params);
|
||||||
$this->actStart($log);
|
$this->actStart($log);
|
||||||
|
// Execute the query(for blob type)
|
||||||
// 쿼리 문 실행 (blob type 입력하기 위한 방법)
|
|
||||||
$query = ibase_prepare($this->fd, $query);
|
$query = ibase_prepare($this->fd, $query);
|
||||||
$fnarr = array_merge(array($query), $params);
|
$fnarr = array_merge(array($query), $params);
|
||||||
$result = call_user_func_array("ibase_execute", $fnarr);
|
$result = call_user_func_array("ibase_execute", $fnarr);
|
||||||
}
|
}
|
||||||
|
// Error Check
|
||||||
// 오류 체크
|
|
||||||
if(ibase_errmsg()) $this->setError(ibase_errcode(), ibase_errmsg());
|
if(ibase_errmsg()) $this->setError(ibase_errcode(), ibase_errmsg());
|
||||||
|
// Notify to complete a query execution
|
||||||
// 쿼리 실행 종료를 알림
|
|
||||||
$this->actFinish();
|
$this->actFinish();
|
||||||
|
// Return the result
|
||||||
// 결과 리턴
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 결과를 fetch
|
* @brief Fetch the result
|
||||||
**/
|
**/
|
||||||
function _fetch($result, $output = null) {
|
function _fetch($result, $output = null) {
|
||||||
if(!$this->isConnected() || $this->isError() || !$result) return;
|
if(!$this->isConnected() || $this->isError() || !$result) return;
|
||||||
|
|
@ -332,12 +320,11 @@
|
||||||
while($tmp = ibase_fetch_object($result)) {
|
while($tmp = ibase_fetch_object($result)) {
|
||||||
foreach($tmp as $key => $val) {
|
foreach($tmp as $key => $val) {
|
||||||
$type = $output->column_type[$key];
|
$type = $output->column_type[$key];
|
||||||
|
// type value is null when $key is an alias. so get a type by finding actual coloumn name
|
||||||
// type 값이 null 일때는 $key값이 alias인 경우라 실제 column 이름을 찾아 type을 구함
|
|
||||||
if($type == null && $output->columns && count($output->columns)) {
|
if($type == null && $output->columns && count($output->columns)) {
|
||||||
foreach($output->columns as $cols) {
|
foreach($output->columns as $cols) {
|
||||||
if($cols['alias'] == $key) {
|
if($cols['alias'] == $key) {
|
||||||
// table.column 형식인지 정규식으로 검사 함
|
// checks if the format is table.column or a regular expression
|
||||||
preg_match("/\w+[.](\w+)/", $cols['name'], $matches);
|
preg_match("/\w+[.](\w+)/", $cols['name'], $matches);
|
||||||
if($matches) {
|
if($matches) {
|
||||||
$type = $output->column_type[$matches[1]];
|
$type = $output->column_type[$matches[1]];
|
||||||
|
|
@ -356,7 +343,7 @@
|
||||||
ibase_blob_close($blob_hndl);
|
ibase_blob_close($blob_hndl);
|
||||||
}
|
}
|
||||||
else if($type == "char") {
|
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() {
|
function getNextSequence() {
|
||||||
$gen = "GEN_".$this->prefix."sequence_ID";
|
$gen = "GEN_".$this->prefix."sequence_ID";
|
||||||
|
|
@ -377,7 +364,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 테이블 기생성 여부 return
|
* @brief returns if the table already exists
|
||||||
**/
|
**/
|
||||||
function isTableExists($target_name) {
|
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);
|
$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) {
|
function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) {
|
||||||
$type = $this->column_type[$type];
|
$type = $this->column_type[$type];
|
||||||
|
|
@ -412,7 +399,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 테이블에 특정 column 제거
|
* @brief drop a column from the table
|
||||||
**/
|
**/
|
||||||
function dropColumn($table_name, $column_name) {
|
function dropColumn($table_name, $column_name) {
|
||||||
$query = sprintf("alter table %s%s drop %s ", $this->prefix, $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) {
|
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);
|
$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)
|
* $target_columns = array(col1, col2)
|
||||||
* $is_unique? unique : none
|
* $is_unique? unique : none
|
||||||
**/
|
**/
|
||||||
function addIndex($table_name, $index_name, $target_columns, $is_unique = false) {
|
function addIndex($table_name, $index_name, $target_columns, $is_unique = false) {
|
||||||
// index name 크기가 31byte로 제한으로 index name을 넣지 않음
|
// index name size should be limited to 31 byte. no index name assigned
|
||||||
// Firebird에서는 index name을 넣지 않으면 "RDB$10"처럼 자동으로 이름을 부여함
|
// if index name omitted, Firebird automatically assign its name like "RDB $10"
|
||||||
// table을 삭제 할 경우 인덱스도 자동으로 삭제 됨
|
// deletes indexes when deleting the table
|
||||||
|
|
||||||
if(!is_array($target_columns)) $target_columns = array($target_columns);
|
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));
|
$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) {
|
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||||
$query = sprintf('DROP INDEX "%s" ON "%s%s"', $index_name, $this->prefix, $table_name);
|
$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) {
|
function isIndexExists($table_name, $index_name) {
|
||||||
$query = "SELECT\n";
|
$query = "SELECT\n";
|
||||||
|
|
@ -512,24 +498,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief xml 을 받아서 테이블을 생성
|
* @brief creates a table by using xml file
|
||||||
**/
|
**/
|
||||||
function createTableByXml($xml_doc) {
|
function createTableByXml($xml_doc) {
|
||||||
return $this->_createTable($xml_doc);
|
return $this->_createTable($xml_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief xml 을 받아서 테이블을 생성
|
* @brief creates a table by using xml file
|
||||||
**/
|
**/
|
||||||
function createTableByXmlFile($file_name) {
|
function createTableByXmlFile($file_name) {
|
||||||
if(!file_exists($file_name)) return;
|
if(!file_exists($file_name)) return;
|
||||||
// xml 파일을 읽음
|
// read xml file
|
||||||
$buff = FileHandler::readFile($file_name);
|
$buff = FileHandler::readFile($file_name);
|
||||||
return $this->_createTable($buff);
|
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
|
* type : number, varchar, text, char, date, \n
|
||||||
* opt : notnull, default, size\n
|
* opt : notnull, default, size\n
|
||||||
|
|
@ -539,8 +525,7 @@
|
||||||
// xml parsing
|
// xml parsing
|
||||||
$oXml = new XmlParser();
|
$oXml = new XmlParser();
|
||||||
$xml_obj = $oXml->parse($xml_doc);
|
$xml_obj = $oXml->parse($xml_doc);
|
||||||
|
// Create a table schema
|
||||||
// 테이블 생성 schema 작성
|
|
||||||
$table_name = $xml_obj->table->attrs->name;
|
$table_name = $xml_obj->table->attrs->name;
|
||||||
if($this->isTableExists($table_name)) return;
|
if($this->isTableExists($table_name)) return;
|
||||||
$table_name = $this->prefix.$table_name;
|
$table_name = $this->prefix.$table_name;
|
||||||
|
|
@ -596,10 +581,9 @@
|
||||||
|
|
||||||
if(count($index_list)) {
|
if(count($index_list)) {
|
||||||
foreach($index_list as $key => $val) {
|
foreach($index_list as $key => $val) {
|
||||||
// index name 크기가 31byte로 제한으로 index name을 넣지 않음
|
// index name size should be limited to 31 byte. no index name assigned
|
||||||
// Firebird에서는 index name을 넣지 않으면 "RDB$10"처럼 자동으로 이름을 부여함
|
// if index name omitted, Firebird automatically assign its name like "RDB $10"
|
||||||
// table을 삭제 할 경우 인덱스도 자동으로 삭제 됨
|
// deletes indexes when deleting the table
|
||||||
|
|
||||||
$schema = sprintf("CREATE INDEX \"\" ON \"%s\" (\"%s\");",
|
$schema = sprintf("CREATE INDEX \"\" ON \"%s\" (\"%s\");",
|
||||||
$table_name, implode($val, "\",\""));
|
$table_name, implode($val, "\",\""));
|
||||||
$output = $this->_query($schema);
|
$output = $this->_query($schema);
|
||||||
|
|
@ -613,12 +597,11 @@
|
||||||
$output = $this->_query($schema);
|
$output = $this->_query($schema);
|
||||||
if(!$this->transaction_started) @ibase_commit($this->fd);
|
if(!$this->transaction_started) @ibase_commit($this->fd);
|
||||||
if(!$output) return false;
|
if(!$output) return false;
|
||||||
|
// auto_increment in Firebird creates a generator which activates a trigger when insert occurs
|
||||||
// Firebird에서 auto increment는 generator를 만들어 insert 발생시 트리거를 실행시켜
|
// the generator increases the value of the generator and then insert to the table
|
||||||
// generator의 값을 증가시키고 그값을 테이블에 넣어주는 방식을 사용함.
|
// The trigger below acts like auto_increment however I commented the below because the trigger cannot be defined by a query statement
|
||||||
// 아래 트리거가 auto increment 역할을 하지만 쿼리로 트리거 등록이 되지 않아 주석처리 하였음.
|
// php api has a function to increase a generator, so
|
||||||
// php 함수에서 generator 값을 증가시켜 주는 함수가 있어 XE에서는 굳이
|
// no need to use auto increment in XE
|
||||||
// auto increment를 사용 할 필요가 없어보임.
|
|
||||||
/*
|
/*
|
||||||
$schema = 'SET TERM ^ ; ';
|
$schema = 'SET TERM ^ ; ';
|
||||||
$schema .= sprintf('CREATE TRIGGER "%s_BI" FOR "%s" ', $table_name, $table_name);
|
$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) {
|
function getCondition($output) {
|
||||||
if(!$output->conditions) return;
|
if(!$output->conditions) return;
|
||||||
|
|
@ -683,15 +666,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief insertAct 처리
|
* @brief Handle the insertAct
|
||||||
**/
|
**/
|
||||||
function _executeInsertAct($output) {
|
function _executeInsertAct($output) {
|
||||||
// 테이블 정리
|
// tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '"'.$this->prefix.$val.'"';
|
$table_list[] = '"'.$this->prefix.$val.'"';
|
||||||
}
|
}
|
||||||
|
// Columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
$value = $val['value'];
|
$value = $val['value'];
|
||||||
|
|
@ -721,15 +703,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief updateAct 처리
|
* @brief handles updateAct
|
||||||
**/
|
**/
|
||||||
function _executeUpdateAct($output) {
|
function _executeUpdateAct($output) {
|
||||||
// 테이블 정리
|
// Tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '"'.$this->prefix.$val.'"';
|
$table_list[] = '"'.$this->prefix.$val.'"';
|
||||||
}
|
}
|
||||||
|
// Columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
if(!isset($val['value'])) continue;
|
if(!isset($val['value'])) continue;
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
|
|
@ -747,7 +728,7 @@
|
||||||
else if($output->column_type[$name]=='number' ||
|
else if($output->column_type[$name]=='number' ||
|
||||||
$output->column_type[$name]=='bignumber' ||
|
$output->column_type[$name]=='bignumber' ||
|
||||||
$output->column_type[$name]=='float') {
|
$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);
|
preg_match("/(?i)[a-z][a-z0-9_]+/", $value, $matches);
|
||||||
|
|
||||||
foreach($matches as $key => $val) {
|
foreach($matches as $key => $val) {
|
||||||
|
|
@ -764,8 +745,7 @@
|
||||||
$column_list[] = sprintf('"%s" = ?', $name);
|
$column_list[] = sprintf('"%s" = ?', $name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("update %s set %s %s;", implode(',',$table_list), implode(',',$column_list), $condition);
|
$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) {
|
function _executeDeleteAct($output) {
|
||||||
// 테이블 정리
|
// Tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '"'.$this->prefix.$val.'"';
|
$table_list[] = '"'.$this->prefix.$val.'"';
|
||||||
}
|
}
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("delete from %s %s;", implode(',',$table_list), $condition);
|
$query = sprintf("delete from %s %s;", implode(',',$table_list), $condition);
|
||||||
|
|
@ -794,13 +773,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief selectAct 처리
|
* @brief Handle selectAct
|
||||||
*
|
*
|
||||||
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
|
* In order to get a list of pages easily when selecting \n
|
||||||
* navigation이라는 method를 제공
|
* it supports a method as navigation
|
||||||
**/
|
**/
|
||||||
function _executeSelectAct($output) {
|
function _executeSelectAct($output) {
|
||||||
// 테이블 정리
|
// Tables
|
||||||
$table_list = array();
|
$table_list = array();
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = sprintf("\"%s%s\" as \"%s\"", $this->prefix, $val, $key);
|
$table_list[] = sprintf("\"%s%s\" as \"%s\"", $this->prefix, $val, $key);
|
||||||
|
|
@ -839,8 +818,7 @@
|
||||||
|
|
||||||
$output->column_list = $column_list;
|
$output->column_list = $column_list;
|
||||||
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
|
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
|
||||||
|
// query added in the condition to use an index when ordering by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
||||||
|
|
@ -852,8 +830,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// apply when using list_count
|
||||||
// list_count를 사용할 경우 적용
|
|
||||||
if($output->list_count['value']) $limit = sprintf('FIRST %d', $output->list_count['value']);
|
if($output->list_count['value']) $limit = sprintf('FIRST %d', $output->list_count['value']);
|
||||||
else $limit = '';
|
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) {
|
function _getNavigationData($table_list, $columns, $left_join, $condition, $output) {
|
||||||
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
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;
|
$count_condition = strlen($query_groupby) ? sprintf('%s group by %s', $condition, $query_groupby) : $condition;
|
||||||
$total_count = $this->getCountCache($output->tables, $count_condition);
|
$total_count = $this->getCountCache($output->tables, $count_condition);
|
||||||
|
|
@ -944,8 +921,7 @@
|
||||||
$this->putCountCache($output->tables, $count_condition, $total_count);
|
$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 = 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(*)'):'';
|
$count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):'';
|
||||||
$result = $this->_query($count_query);
|
$result = $this->_query($count_query);
|
||||||
|
|
@ -960,16 +936,13 @@
|
||||||
if(!$page_count) $page_count = 10;
|
if(!$page_count) $page_count = 10;
|
||||||
$page = $output->page['value'];
|
$page = $output->page['value'];
|
||||||
if(!$page) $page = 1;
|
if(!$page) $page = 1;
|
||||||
|
// total pages
|
||||||
// 전체 페이지를 구함
|
|
||||||
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
|
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
|
||||||
else $total_page = 1;
|
else $total_page = 1;
|
||||||
|
// check the page variables
|
||||||
// 페이지 변수를 체크
|
|
||||||
if($page > $total_page) $page = $total_page;
|
if($page > $total_page) $page = $total_page;
|
||||||
$start_count = ($page-1)*$list_count;
|
$start_count = ($page-1)*$list_count;
|
||||||
|
// query added in the condition to use an index when ordering by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
||||||
|
|
@ -1025,12 +998,11 @@
|
||||||
while($tmp = ibase_fetch_object($result)) {
|
while($tmp = ibase_fetch_object($result)) {
|
||||||
foreach($tmp as $key => $val){
|
foreach($tmp as $key => $val){
|
||||||
$type = $output->column_type[$key];
|
$type = $output->column_type[$key];
|
||||||
|
// $key value is an alias when type value is null. get type by finding the actual column name
|
||||||
// type 값이 null 일때는 $key값이 alias인 경우라 실제 column 이름을 찾아 type을 구함
|
|
||||||
if($type == null && $output->columns && count($output->columns)) {
|
if($type == null && $output->columns && count($output->columns)) {
|
||||||
foreach($output->columns as $cols) {
|
foreach($output->columns as $cols) {
|
||||||
if($cols['alias'] == $key) {
|
if($cols['alias'] == $key) {
|
||||||
// table.column 형식인지 정규식으로 검사 함
|
// checks if the format is table.column or a regular expression
|
||||||
preg_match("/\w+[.](\w+)/", $cols['name'], $matches);
|
preg_match("/\w+[.](\w+)/", $cols['name'], $matches);
|
||||||
if($matches) {
|
if($matches) {
|
||||||
$type = $output->column_type[$matches[1]];
|
$type = $output->column_type[$matches[1]];
|
||||||
|
|
|
||||||
|
|
@ -3,26 +3,26 @@
|
||||||
/**
|
/**
|
||||||
* @class DBMSSQL
|
* @class DBMSSQL
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @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
|
* @version 0.1
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class DBMssql extends DB {
|
class DBMssql extends DB {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DB를 이용하기 위한 정보
|
* information to connect to DB
|
||||||
**/
|
**/
|
||||||
var $conn = NULL;
|
var $conn = NULL;
|
||||||
var $database = NULL; ///< database
|
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 $param = array();
|
||||||
var $comment_syntax = '/* %s */';
|
var $comment_syntax = '/* %s */';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mssql 에서 사용될 column type
|
* @brief column type used in mssql
|
||||||
*
|
*
|
||||||
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
|
* column_type should be replaced for each DBMS's type
|
||||||
* 각 DBMS에 맞게 replace 해주어야 한다
|
* becasue it uses commonly defined type in the schema/query xml
|
||||||
**/
|
**/
|
||||||
var $column_type = array(
|
var $column_type = array(
|
||||||
'bignumber' => 'bigint',
|
'bignumber' => 'bigint',
|
||||||
|
|
@ -52,7 +52,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief Return if installable
|
||||||
**/
|
**/
|
||||||
function isSupported() {
|
function isSupported() {
|
||||||
if (!extension_loaded("sqlsrv")) return false;
|
if (!extension_loaded("sqlsrv")) return false;
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB정보 설정 및 connect/ close
|
* @brief DB settings and connect/close
|
||||||
**/
|
**/
|
||||||
function _setDBInfo() {
|
function _setDBInfo() {
|
||||||
$db_info = Context::getDBInfo();
|
$db_info = Context::getDBInfo();
|
||||||
|
|
@ -75,10 +75,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 접속
|
* @brief DB Connection
|
||||||
**/
|
**/
|
||||||
function _connect() {
|
function _connect() {
|
||||||
// db 정보가 없으면 무시
|
// ignore if db information not exists
|
||||||
if(!$this->hostname || !$this->database) return;
|
if(!$this->hostname || !$this->database) return;
|
||||||
|
|
||||||
//sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
//sqlsrv_configure( 'WarningsReturnAsErrors', 0 );
|
||||||
|
|
@ -89,7 +89,8 @@
|
||||||
array( 'Database' => $this->database,'UID'=>$this->userid,'PWD'=>$this->password ));
|
array( 'Database' => $this->database,'UID'=>$this->userid,'PWD'=>$this->password ));
|
||||||
|
|
||||||
|
|
||||||
// 접속체크
|
// Check connections
|
||||||
|
|
||||||
if($this->conn){
|
if($this->conn){
|
||||||
$this->is_connected = true;
|
$this->is_connected = true;
|
||||||
$this->password = md5($this->password);
|
$this->password = md5($this->password);
|
||||||
|
|
@ -99,7 +100,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB접속 해제
|
* @brief DB disconnect
|
||||||
**/
|
**/
|
||||||
function close() {
|
function close() {
|
||||||
if($this->is_connected == false) return;
|
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) {
|
function addQuotes($string) {
|
||||||
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$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() {
|
function begin() {
|
||||||
if($this->is_connected == false || $this->transaction_started) return;
|
if($this->is_connected == false || $this->transaction_started) return;
|
||||||
|
|
@ -130,7 +131,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 롤백
|
* @brief Rollback
|
||||||
**/
|
**/
|
||||||
function rollback() {
|
function rollback() {
|
||||||
if($this->is_connected == false || !$this->transaction_started) return;
|
if($this->is_connected == false || !$this->transaction_started) return;
|
||||||
|
|
@ -140,7 +141,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 커밋
|
* @brief Commit
|
||||||
**/
|
**/
|
||||||
function commit($force = false) {
|
function commit($force = false) {
|
||||||
if(!$force && ($this->is_connected == false || !$this->transaction_started)) return;
|
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
|
* query: run a query and return the result\n
|
||||||
* fetch : reutrn 된 값이 없으면 NULL\n
|
* fetch: NULL if no value returned \n
|
||||||
* rows이면 array object\n
|
* array object if rows returned \n
|
||||||
* row이면 object\n
|
* object if a row returned \n
|
||||||
* return\n
|
* return\n
|
||||||
**/
|
**/
|
||||||
function _query($query) {
|
function _query($query) {
|
||||||
if($this->is_connected == false || !$query) return;
|
if($this->is_connected == false || !$query) return;
|
||||||
|
|
@ -173,21 +174,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 쿼리 시작을 알림
|
// Notify to start a query execution
|
||||||
$this->actStart($query);
|
$this->actStart($query);
|
||||||
|
|
||||||
// 쿼리 문 실행
|
// Run the query statement
|
||||||
$result = false;
|
$result = false;
|
||||||
if(count($_param)){
|
if(count($_param)){
|
||||||
$result = @sqlsrv_query($this->conn, $query, $_param);
|
$result = @sqlsrv_query($this->conn, $query, $_param);
|
||||||
}else{
|
}else{
|
||||||
$result = @sqlsrv_query($this->conn, $query);
|
$result = @sqlsrv_query($this->conn, $query);
|
||||||
}
|
}
|
||||||
|
// Error Check
|
||||||
// 오류 체크
|
|
||||||
if(!$result) $this->setError(print_r(sqlsrv_errors(),true));
|
if(!$result) $this->setError(print_r(sqlsrv_errors(),true));
|
||||||
|
|
||||||
// 쿼리 실행 종료를 알림
|
// Notify to complete a query execution
|
||||||
$this->actFinish();
|
$this->actFinish();
|
||||||
$this->param = array();
|
$this->param = array();
|
||||||
|
|
||||||
|
|
@ -195,7 +196,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 결과를 fetch
|
* @brief Fetch results
|
||||||
**/
|
**/
|
||||||
function _fetch($result) {
|
function _fetch($result) {
|
||||||
if(!$this->isConnected() || $this->isError() || !$result) return;
|
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() {
|
function getNextSequence() {
|
||||||
$query = sprintf("insert into %ssequence (seq) values (ident_incr('%ssequence'))", $this->prefix, $this->prefix);
|
$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) {
|
function isTableExists($target_name) {
|
||||||
$query = sprintf("select name from sysobjects where name = '%s%s' and xtype='U'", $this->prefix, $this->addQuotes($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) {
|
function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) {
|
||||||
if($this->isColumnExists($table_name, $column_name)) return;
|
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) {
|
function dropColumn($table_name, $column_name) {
|
||||||
if(!$this->isColumnExists($table_name, $column_name)) return;
|
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) {
|
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);
|
$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)
|
* $target_columns = array(col1, col2)
|
||||||
* $is_unique? unique : none
|
* $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) {
|
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||||
if(!$this->isIndexExists($table_name, $index_name)) return;
|
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) {
|
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);
|
$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) {
|
function createTableByXml($xml_doc) {
|
||||||
return $this->_createTable($xml_doc);
|
return $this->_createTable($xml_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief xml 을 받아서 테이블을 생성
|
* @brief Create a table by using xml file
|
||||||
**/
|
**/
|
||||||
function createTableByXmlFile($file_name) {
|
function createTableByXmlFile($file_name) {
|
||||||
if(!file_exists($file_name)) return;
|
if(!file_exists($file_name)) return;
|
||||||
// xml 파일을 읽음
|
// read xml file
|
||||||
$buff = FileHandler::readFile($file_name);
|
$buff = FileHandler::readFile($file_name);
|
||||||
return $this->_createTable($buff);
|
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
|
* type : number, varchar, text, char, date, \n
|
||||||
* opt : notnull, default, size\n
|
* opt : notnull, default, size\n
|
||||||
|
|
@ -347,8 +348,7 @@
|
||||||
// xml parsing
|
// xml parsing
|
||||||
$oXml = new XmlParser();
|
$oXml = new XmlParser();
|
||||||
$xml_obj = $oXml->parse($xml_doc);
|
$xml_obj = $oXml->parse($xml_doc);
|
||||||
|
// Create a table schema
|
||||||
// 테이블 생성 schema 작성
|
|
||||||
$table_name = $xml_obj->table->attrs->name;
|
$table_name = $xml_obj->table->attrs->name;
|
||||||
if($this->isTableExists($table_name)) return;
|
if($this->isTableExists($table_name)) return;
|
||||||
|
|
||||||
|
|
@ -409,7 +409,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 조건문 작성하여 return
|
* @brief Return conditional clause
|
||||||
**/
|
**/
|
||||||
function getCondition($output) {
|
function getCondition($output) {
|
||||||
if(!$output->conditions) return;
|
if(!$output->conditions) return;
|
||||||
|
|
@ -525,16 +525,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief insertAct 처리
|
* @brief Handle the insertAct
|
||||||
**/
|
**/
|
||||||
function _executeInsertAct($output) {
|
function _executeInsertAct($output) {
|
||||||
|
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '['.$this->prefix.$val.']';
|
$table_list[] = '['.$this->prefix.$val.']';
|
||||||
}
|
}
|
||||||
|
// List columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
$value = $val['value'];
|
$value = $val['value'];
|
||||||
|
|
@ -561,15 +560,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief updateAct 처리
|
* @brief Handle updateAct
|
||||||
**/
|
**/
|
||||||
function _executeUpdateAct($output) {
|
function _executeUpdateAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '['.$this->prefix.$val.']';
|
$table_list[] = '['.$this->prefix.$val.']';
|
||||||
}
|
}
|
||||||
|
|
||||||
// 컬럼 정리
|
// List columns
|
||||||
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
if(!isset($val['value'])) continue;
|
if(!isset($val['value'])) continue;
|
||||||
|
|
||||||
|
|
@ -597,8 +597,7 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("update %s set %s %s", implode(',',$table_list), implode(',',$column_list), $condition);
|
$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) {
|
function _executeDeleteAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '['.$this->prefix.$val.']';
|
$table_list[] = '['.$this->prefix.$val.']';
|
||||||
}
|
}
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
|
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
|
||||||
|
|
@ -624,13 +622,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief selectAct 처리
|
* @brief Handle selectAct
|
||||||
*
|
*
|
||||||
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
|
* In order to get a list of pages easily when selecting \n
|
||||||
* navigation이라는 method를 제공
|
* it supports a method as navigation
|
||||||
**/
|
**/
|
||||||
function _executeSelectAct($output) {
|
function _executeSelectAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
$table_list = array();
|
$table_list = array();
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '['.$this->prefix.$val.'] as '.$key;
|
$table_list[] = '['.$this->prefix.$val.'] as '.$key;
|
||||||
|
|
@ -675,8 +673,7 @@
|
||||||
|
|
||||||
$output->column_list = $column_list;
|
$output->column_list = $column_list;
|
||||||
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
|
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
|
||||||
|
// Add a condition to use an index when sorting in order by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
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);
|
$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);
|
if($output->list_count['value']) $query = sprintf('select top %d %s', $output->list_count['value'], $query);
|
||||||
else $query = "select ".$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) {
|
function _getNavigationData($table_list, $columns, $left_join, $condition, $output) {
|
||||||
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
||||||
|
|
||||||
$column_list = $output->column_list;
|
$column_list = $output->column_list;
|
||||||
|
|
||||||
// 전체 개수를 구함
|
// Get a total count
|
||||||
if(count($output->groups)){
|
if(count($output->groups)){
|
||||||
foreach($output->groups as $k => $v ){
|
foreach($output->groups as $k => $v ){
|
||||||
if(preg_match('/^substr\(/i',$v)) $output->groups[$k] = preg_replace('/^substr\(/i','substring(',$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;
|
if(!$page_count) $page_count = 10;
|
||||||
$page = $output->page['value'];
|
$page = $output->page['value'];
|
||||||
if(!$page) $page = 1;
|
if(!$page) $page = 1;
|
||||||
|
// Get a total page
|
||||||
// 전체 페이지를 구함
|
|
||||||
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
|
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
|
||||||
else $total_page = 1;
|
else $total_page = 1;
|
||||||
|
// Check Page variables
|
||||||
// 페이지 변수를 체크
|
|
||||||
if($page > $total_page) $page = $total_page;
|
if($page > $total_page) $page = $total_page;
|
||||||
$start_count = ($page-1)*$list_count;
|
$start_count = ($page-1)*$list_count;
|
||||||
|
// Add a condition to use an index when sorting in order by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
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)){
|
if(count($output->groups)){
|
||||||
foreach($output->groups as $k => $v ){
|
foreach($output->groups as $k => $v ){
|
||||||
if(preg_match('/^substr\(/i',$v)) $output->groups[$k] = preg_replace('/^substr\(/i','substring(',$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));
|
$group = sprintf('group by %s', implode(',',$output->groups));
|
||||||
}
|
}
|
||||||
|
|
||||||
// order 절 추가
|
// Add order by clause
|
||||||
$order_targets = array();
|
$order_targets = array();
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
foreach($output->order as $key => $val) {
|
foreach($output->order as $key => $val) {
|
||||||
|
|
@ -848,7 +842,7 @@
|
||||||
$first_sub_columns[] = $k;
|
$first_sub_columns[] = $k;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 1차로 order 대상에 해당 하는 값을 가져옴
|
// Fetch values to sort
|
||||||
$param = $this->param;
|
$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);
|
$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);
|
$result = $this->_query($first_query);
|
||||||
|
|
@ -857,7 +851,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// 1차에서 나온 값을 이용 다시 쿼리 실행
|
// Re-execute a query by using fetched values
|
||||||
$sub_cond = array();
|
$sub_cond = array();
|
||||||
foreach($order_targets as $k => $v) {
|
foreach($order_targets as $k => $v) {
|
||||||
$sub_cond[] = sprintf("%s %s '%s'", $k, $v=='asc'?'>':'<', $tmp->{$k});
|
$sub_cond[] = sprintf("%s %s '%s'", $k, $v=='asc'?'>':'<', $tmp->{$k});
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class DBMysql
|
* @class DBMysql
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief MySQL DBMS를 이용하기 위한 class
|
* @brief Class to use MySQL DBMS
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*
|
*
|
||||||
* mysql handling class
|
* mysql handling class
|
||||||
|
|
@ -11,20 +11,20 @@
|
||||||
class DBMysql extends DB {
|
class DBMysql extends DB {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Mysql DB에 접속하기 위한 정보
|
* @brief Connection information for Mysql DB
|
||||||
**/
|
**/
|
||||||
var $hostname = '127.0.0.1'; ///< hostname
|
var $hostname = '127.0.0.1'; ///< hostname
|
||||||
var $userid = NULL; ///< user id
|
var $userid = NULL; ///< user id
|
||||||
var $password = NULL; ///< password
|
var $password = NULL; ///< password
|
||||||
var $database = NULL; ///< database
|
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 */';
|
var $comment_syntax = '/* %s */';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mysql에서 사용될 column type
|
* @brief Column type used in MySQL
|
||||||
*
|
*
|
||||||
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
|
* Becasue a common column type in schema/query xml is used for colum_type,
|
||||||
* 각 DBMS에 맞게 replace 해주어야 한다
|
* it should be replaced properly for each DBMS
|
||||||
**/
|
**/
|
||||||
var $column_type = array(
|
var $column_type = array(
|
||||||
'bignumber' => 'bigint',
|
'bignumber' => 'bigint',
|
||||||
|
|
@ -50,7 +50,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief Return if it is installable
|
||||||
**/
|
**/
|
||||||
function isSupported() {
|
function isSupported() {
|
||||||
if(!function_exists('mysql_connect')) return false;
|
if(!function_exists('mysql_connect')) return false;
|
||||||
|
|
@ -58,7 +58,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB정보 설정 및 connect/ close
|
* @brief DB settings and connect/close
|
||||||
**/
|
**/
|
||||||
function _setDBInfo() {
|
function _setDBInfo() {
|
||||||
$db_info = Context::getDBInfo();
|
$db_info = Context::getDBInfo();
|
||||||
|
|
@ -72,44 +72,39 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 접속
|
* @brief DB Connection
|
||||||
**/
|
**/
|
||||||
function _connect() {
|
function _connect() {
|
||||||
// db 정보가 없으면 무시
|
// Ignore if no DB information exists
|
||||||
if(!$this->hostname || !$this->userid || !$this->password || !$this->database) return;
|
if(!$this->hostname || !$this->userid || !$this->password || !$this->database) return;
|
||||||
|
|
||||||
if(strpos($this->hostname, ':')===false && $this->port) $this->hostname .= ':'.$this->port;
|
if(strpos($this->hostname, ':')===false && $this->port) $this->hostname .= ':'.$this->port;
|
||||||
|
// Attempt to connect
|
||||||
// 접속시도
|
|
||||||
$this->fd = @mysql_connect($this->hostname, $this->userid, $this->password);
|
$this->fd = @mysql_connect($this->hostname, $this->userid, $this->password);
|
||||||
if(mysql_error()) {
|
if(mysql_error()) {
|
||||||
$this->setError(mysql_errno(), mysql_error());
|
$this->setError(mysql_errno(), mysql_error());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Error appears if the version is lower than 4.1
|
||||||
// 버전 확인후 4.1 이하면 오류 표시
|
|
||||||
if(mysql_get_server_info($this->fd)<"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());
|
$this->setError(-1, "XE cannot be installed under the version of mysql 4.1. Current mysql version is ".mysql_get_server_info());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// select db
|
||||||
// db 선택
|
|
||||||
@mysql_select_db($this->database, $this->fd);
|
@mysql_select_db($this->database, $this->fd);
|
||||||
if(mysql_error()) {
|
if(mysql_error()) {
|
||||||
$this->setError(mysql_errno(), mysql_error());
|
$this->setError(mysql_errno(), mysql_error());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Check connections
|
||||||
// 접속체크
|
|
||||||
$this->is_connected = true;
|
$this->is_connected = true;
|
||||||
$this->password = md5($this->password);
|
$this->password = md5($this->password);
|
||||||
|
// Set utf8 if a database is MySQL
|
||||||
// mysql의 경우 utf8임을 지정
|
|
||||||
$this->_query("set names 'utf8'");
|
$this->_query("set names 'utf8'");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB접속 해제
|
* @brief DB disconnection
|
||||||
**/
|
**/
|
||||||
function close() {
|
function close() {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
|
@ -117,7 +112,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
|
* @brief Add quotes on the string variables in a query
|
||||||
**/
|
**/
|
||||||
function addQuotes($string) {
|
function addQuotes($string) {
|
||||||
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$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() {
|
function begin() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 롤백
|
* @brief Rollback
|
||||||
**/
|
**/
|
||||||
function rollback() {
|
function rollback() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 커밋
|
* @brief Commits
|
||||||
**/
|
**/
|
||||||
function commit() {
|
function commit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief : 쿼리문의 실행 및 결과의 fetch 처리
|
* @brief : Run a query and fetch the result
|
||||||
*
|
*
|
||||||
* query : query문 실행하고 result return\n
|
* query: run a query and return the result \n
|
||||||
* fetch : reutrn 된 값이 없으면 NULL\n
|
* fetch: NULL if no value is returned \n
|
||||||
* rows이면 array object\n
|
* array object if rows are returned \n
|
||||||
* row이면 object\n
|
* object if a row is returned \n
|
||||||
* return\n
|
* return\n
|
||||||
**/
|
**/
|
||||||
function _query($query) {
|
function _query($query) {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
// Notify to start a query execution
|
||||||
// 쿼리 시작을 알림
|
|
||||||
$this->actStart($query);
|
$this->actStart($query);
|
||||||
|
// Run the query statement
|
||||||
// 쿼리 문 실행
|
|
||||||
$result = @mysql_query($query, $this->fd);
|
$result = @mysql_query($query, $this->fd);
|
||||||
|
// Error Check
|
||||||
// 오류 체크
|
|
||||||
if(mysql_error($this->fd)) $this->setError(mysql_errno($this->fd), mysql_error($this->fd));
|
if(mysql_error($this->fd)) $this->setError(mysql_errno($this->fd), mysql_error($this->fd));
|
||||||
|
// Notify to complete a query execution
|
||||||
// 쿼리 실행 종료를 알림
|
|
||||||
$this->actFinish();
|
$this->actFinish();
|
||||||
|
// Return result
|
||||||
// 결과 리턴
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 결과를 fetch
|
* @brief Fetch results
|
||||||
**/
|
**/
|
||||||
function _fetch($result) {
|
function _fetch($result) {
|
||||||
if(!$this->isConnected() || $this->isError() || !$result) return;
|
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() {
|
function getNextSequence() {
|
||||||
$query = sprintf("insert into `%ssequence` (seq) values ('0')", $this->prefix);
|
$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) {
|
function isValidOldPassword($password, $saved_password) {
|
||||||
$query = sprintf("select password('%s') as password, old_password('%s') as old_password", $this->addQuotes($password), $this->addQuotes($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) {
|
function isTableExists($target_name) {
|
||||||
$query = sprintf("show tables like '%s%s'", $this->prefix, $this->addQuotes($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) {
|
function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) {
|
||||||
$type = $this->column_type[$type];
|
$type = $this->column_type[$type];
|
||||||
|
|
@ -237,7 +227,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 테이블에 특정 column 제거
|
* @brief Delete a column from a table
|
||||||
**/
|
**/
|
||||||
function dropColumn($table_name, $column_name) {
|
function dropColumn($table_name, $column_name) {
|
||||||
$query = sprintf("alter table `%s%s` drop `%s` ", $this->prefix, $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) {
|
function isColumnExists($table_name, $column_name) {
|
||||||
$query = sprintf("show fields from `%s%s`", $this->prefix, $table_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)
|
* $target_columns = array(col1, col2)
|
||||||
* $is_unique? unique : none
|
* $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) {
|
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||||
$query = sprintf("alter table `%s%s` drop index `%s`", $this->prefix, $table_name, $index_name);
|
$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) {
|
function isIndexExists($table_name, $index_name) {
|
||||||
//$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $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) {
|
function createTableByXml($xml_doc) {
|
||||||
return $this->_createTable($xml_doc);
|
return $this->_createTable($xml_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief xml 을 받아서 테이블을 생성
|
* @brief Create a table by using xml file
|
||||||
**/
|
**/
|
||||||
function createTableByXmlFile($file_name) {
|
function createTableByXmlFile($file_name) {
|
||||||
if(!file_exists($file_name)) return;
|
if(!file_exists($file_name)) return;
|
||||||
// xml 파일을 읽음
|
// read xml file
|
||||||
$buff = FileHandler::readFile($file_name);
|
$buff = FileHandler::readFile($file_name);
|
||||||
return $this->_createTable($buff);
|
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
|
* type : number, varchar, text, char, date, \n
|
||||||
* opt : notnull, default, size\n
|
* opt : notnull, default, size\n
|
||||||
|
|
@ -329,8 +319,7 @@
|
||||||
// xml parsing
|
// xml parsing
|
||||||
$oXml = new XmlParser();
|
$oXml = new XmlParser();
|
||||||
$xml_obj = $oXml->parse($xml_doc);
|
$xml_obj = $oXml->parse($xml_doc);
|
||||||
|
// Create a table schema
|
||||||
// 테이블 생성 schema 작성
|
|
||||||
$table_name = $xml_obj->table->attrs->name;
|
$table_name = $xml_obj->table->attrs->name;
|
||||||
if($this->isTableExists($table_name)) return;
|
if($this->isTableExists($table_name)) return;
|
||||||
$table_name = $this->prefix.$table_name;
|
$table_name = $this->prefix.$table_name;
|
||||||
|
|
@ -386,7 +375,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 조건문 작성하여 return
|
* @brief Return conditional clause
|
||||||
**/
|
**/
|
||||||
function getCondition($output) {
|
function getCondition($output) {
|
||||||
if(!$output->conditions) return;
|
if(!$output->conditions) return;
|
||||||
|
|
@ -429,15 +418,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief insertAct 처리
|
* @brief Handle the insertAct
|
||||||
**/
|
**/
|
||||||
function _executeInsertAct($output) {
|
function _executeInsertAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '`'.$this->prefix.$val.'`';
|
$table_list[] = '`'.$this->prefix.$val.'`';
|
||||||
}
|
}
|
||||||
|
// List columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
$value = $val['value'];
|
$value = $val['value'];
|
||||||
|
|
@ -466,15 +454,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief updateAct 처리
|
* @brief Handle updateAct
|
||||||
**/
|
**/
|
||||||
function _executeUpdateAct($output) {
|
function _executeUpdateAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '`'.$this->prefix.$val.'` as '.$key;
|
$table_list[] = '`'.$this->prefix.$val.'` as '.$key;
|
||||||
}
|
}
|
||||||
|
// List columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
if(!isset($val['value'])) continue;
|
if(!isset($val['value'])) continue;
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
|
|
@ -487,8 +474,7 @@
|
||||||
$column_list[] = sprintf("`%s` = %s", $name, $value);
|
$column_list[] = sprintf("`%s` = %s", $name, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("update %s set %s %s", implode(',',$table_list), implode(',',$column_list), $condition);
|
$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) {
|
function _executeDeleteAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '`'.$this->prefix.$val.'`';
|
$table_list[] = '`'.$this->prefix.$val.'`';
|
||||||
}
|
}
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
|
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
|
||||||
|
|
@ -514,13 +499,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief selectAct 처리
|
* @brief Handle selectAct
|
||||||
*
|
*
|
||||||
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
|
* In order to get a list of pages easily when selecting \n
|
||||||
* navigation이라는 method를 제공
|
* it supports a method as navigation
|
||||||
**/
|
**/
|
||||||
function _executeSelectAct($output) {
|
function _executeSelectAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
$table_list = array();
|
$table_list = array();
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = '`'.$this->prefix.$val.'` as '.$key;
|
$table_list[] = '`'.$this->prefix.$val.'` as '.$key;
|
||||||
|
|
@ -584,8 +569,7 @@
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
|
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
|
||||||
|
// Add a condition to use an index when sorting in order by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
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);
|
$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']);
|
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):'';
|
$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) {
|
function _getNavigationData($table_list, $columns, $left_join, $condition, $output) {
|
||||||
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
||||||
|
|
||||||
$column_list = $output->column_list;
|
$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_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);
|
$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);
|
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;
|
if(!$page_count) $page_count = 10;
|
||||||
$page = $output->page['value'];
|
$page = $output->page['value'];
|
||||||
if(!$page) $page = 1;
|
if(!$page) $page = 1;
|
||||||
|
// Get a total page
|
||||||
// 전체 페이지를 구함
|
|
||||||
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
|
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
|
||||||
else $total_page = 1;
|
else $total_page = 1;
|
||||||
|
// Check Page variables
|
||||||
// 페이지 변수를 체크
|
|
||||||
if($page > $total_page) $page = $total_page;
|
if($page > $total_page) $page = $total_page;
|
||||||
$start_count = ($page-1)*$list_count;
|
$start_count = ($page-1)*$list_count;
|
||||||
|
// Add a condition to use an index when sorting in order by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
/**
|
/**
|
||||||
* @class DBMysql_innodb
|
* @class DBMysql_innodb
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief MySQL DBMS를 이용하기 위한 class
|
* @brief class to use MySQL DBMS
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*
|
*
|
||||||
* mysql innodb handling class
|
* mysql innodb handling class
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB접속 해제
|
* @brief DB disconnection
|
||||||
**/
|
**/
|
||||||
function close() {
|
function close() {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 트랜잭션 시작
|
* @brief Begin transaction
|
||||||
**/
|
**/
|
||||||
function begin() {
|
function begin() {
|
||||||
if(!$this->isConnected() || $this->transaction_started) return;
|
if(!$this->isConnected() || $this->transaction_started) return;
|
||||||
|
|
@ -47,7 +47,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 롤백
|
* @brief Rollback
|
||||||
**/
|
**/
|
||||||
function rollback() {
|
function rollback() {
|
||||||
if(!$this->isConnected() || !$this->transaction_started) return;
|
if(!$this->isConnected() || !$this->transaction_started) return;
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 커밋
|
* @brief Commits
|
||||||
**/
|
**/
|
||||||
function commit($force = false) {
|
function commit($force = false) {
|
||||||
if(!$force && (!$this->isConnected() || !$this->transaction_started)) return;
|
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
|
* query: run a query and return the result \n
|
||||||
* fetch : reutrn 된 값이 없으면 NULL\n
|
* fetch: NULL if no value is returned \n
|
||||||
* rows이면 array object\n
|
* array object if rows are returned \n
|
||||||
* row이면 object\n
|
* object if a row is returned \n
|
||||||
* return\n
|
* return\n
|
||||||
**/
|
**/
|
||||||
function _query($query) {
|
function _query($query) {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
// Notify to start a query execution
|
||||||
// 쿼리 시작을 알림
|
|
||||||
$this->actStart($query);
|
$this->actStart($query);
|
||||||
|
// Run the query statement
|
||||||
// 쿼리 문 실행
|
|
||||||
$result = @mysql_query($query, $this->fd);
|
$result = @mysql_query($query, $this->fd);
|
||||||
|
// Error Check
|
||||||
// 오류 체크
|
|
||||||
if(mysql_error($this->fd)) $this->setError(mysql_errno($this->fd), mysql_error($this->fd));
|
if(mysql_error($this->fd)) $this->setError(mysql_errno($this->fd), mysql_error($this->fd));
|
||||||
|
// Notify to complete a query execution
|
||||||
// 쿼리 실행 종료를 알림
|
|
||||||
$this->actFinish();
|
$this->actFinish();
|
||||||
|
// Return result
|
||||||
// 결과 리턴
|
|
||||||
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
|
* type : number, varchar, text, char, date, \n
|
||||||
* opt : notnull, default, size\n
|
* opt : notnull, default, size\n
|
||||||
|
|
@ -103,8 +98,7 @@
|
||||||
// xml parsing
|
// xml parsing
|
||||||
$oXml = new XmlParser();
|
$oXml = new XmlParser();
|
||||||
$xml_obj = $oXml->parse($xml_doc);
|
$xml_obj = $oXml->parse($xml_doc);
|
||||||
|
// Create a table schema
|
||||||
// 테이블 생성 schema 작성
|
|
||||||
$table_name = $xml_obj->table->attrs->name;
|
$table_name = $xml_obj->table->attrs->name;
|
||||||
if($this->isTableExists($table_name)) return;
|
if($this->isTableExists($table_name)) return;
|
||||||
$table_name = $this->prefix.$table_name;
|
$table_name = $this->prefix.$table_name;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
/**
|
/**
|
||||||
* @class DBMysqli
|
* @class DBMysqli
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief MySQL DBMS를 mysqli_* 로 이용하기 위한 class
|
* @brief Class to use MySQL DBMS as mysqli_*
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*
|
*
|
||||||
* mysql handling class
|
* mysql handling class
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief Return if it is installable
|
||||||
**/
|
**/
|
||||||
function isSupported() {
|
function isSupported() {
|
||||||
if(!function_exists('mysqli_connect')) return false;
|
if(!function_exists('mysqli_connect')) return false;
|
||||||
|
|
@ -37,13 +37,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 접속
|
* @brief DB Connection
|
||||||
**/
|
**/
|
||||||
function _connect() {
|
function _connect() {
|
||||||
// db 정보가 없으면 무시
|
// Ignore if no DB information exists
|
||||||
if(!$this->hostname || !$this->userid || !$this->password || !$this->database) return;
|
if(!$this->hostname || !$this->userid || !$this->password || !$this->database) return;
|
||||||
|
// Attempt to connect
|
||||||
// 접속시도
|
|
||||||
if($this->port){
|
if($this->port){
|
||||||
$this->fd = @mysqli_connect($this->hostname, $this->userid, $this->password, $this->database, $this->port);
|
$this->fd = @mysqli_connect($this->hostname, $this->userid, $this->password, $this->database, $this->port);
|
||||||
}else{
|
}else{
|
||||||
|
|
@ -55,14 +54,13 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mysqli_set_charset($this->fd,'utf8');
|
mysqli_set_charset($this->fd,'utf8');
|
||||||
|
// Check connections
|
||||||
// 접속체크
|
|
||||||
$this->is_connected = true;
|
$this->is_connected = true;
|
||||||
$this->password = md5($this->password);
|
$this->password = md5($this->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB접속 해제
|
* @brief DB disconnection
|
||||||
**/
|
**/
|
||||||
function close() {
|
function close() {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
|
@ -70,7 +68,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절
|
* @brief Add quotes on the string variables in a query
|
||||||
**/
|
**/
|
||||||
function addQuotes($string) {
|
function addQuotes($string) {
|
||||||
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$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
|
* query: run a query and return the result \n
|
||||||
* fetch : reutrn 된 값이 없으면 NULL\n
|
* fetch: NULL if no value is returned \n
|
||||||
* rows이면 array object\n
|
* array object if rows are returned \n
|
||||||
* row이면 object\n
|
* object if a row is returned \n
|
||||||
* return\n
|
* return\n
|
||||||
**/
|
**/
|
||||||
function _query($query) {
|
function _query($query) {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
// Notify to start a query execution
|
||||||
// 쿼리 시작을 알림
|
|
||||||
$this->actStart($query);
|
$this->actStart($query);
|
||||||
|
// Run the query statement
|
||||||
// 쿼리 문 실행
|
|
||||||
$result = mysqli_query($this->fd,$query);
|
$result = mysqli_query($this->fd,$query);
|
||||||
// 오류 체크
|
// Error Check
|
||||||
$error = mysqli_error($this->fd);
|
$error = mysqli_error($this->fd);
|
||||||
if($error){
|
if($error){
|
||||||
$this->setError(mysqli_errno($this->fd), $error);
|
$this->setError(mysqli_errno($this->fd), $error);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 쿼리 실행 종료를 알림
|
// Notify to complete a query execution
|
||||||
$this->actFinish();
|
$this->actFinish();
|
||||||
|
// Return result
|
||||||
// 결과 리턴
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,34 +2,34 @@
|
||||||
/**
|
/**
|
||||||
* @class DBPostgreSQL
|
* @class DBPostgreSQL
|
||||||
* @author ioseph (ioseph@postgresql.kr) updated by yoonjong.joh@gmail.com
|
* @author ioseph (ioseph@postgresql.kr) updated by yoonjong.joh@gmail.com
|
||||||
* @brief MySQL DBMS를 이용하기 위한 class
|
* @brief Class to use PostgreSQL DBMS
|
||||||
* @version 0.2
|
* @version 0.2
|
||||||
*
|
*
|
||||||
* postgresql handling class
|
* postgresql handling class
|
||||||
* 2009.02.10 update 와 delete query를 실행할때 table 이름에 alias 사용하는 것을 없앰. 지원 안함
|
* 2009.02.10 update and delete query for the table name at runtime, eliminating the alias to use. Not Supported
|
||||||
* order by clause를 실행할때 함수를 실행 하는 부분을 column alias로 대체.
|
* when running order by clause column alias to run a function to replace parts.
|
||||||
* 2009.02.11 dropColumn() function이 추가
|
* 2009.02.11 dropColumn() function added
|
||||||
* 2009.02.13 addColumn() 함수 변경
|
* 2009.02.13 addColumn() function changes
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class DBPostgresql extends DB
|
class DBPostgresql extends DB
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief PostgreSQL DB에 접속하기 위한 정보
|
* @brief Connection information for PostgreSQL DB
|
||||||
**/
|
**/
|
||||||
var $hostname = '127.0.0.1'; ///< hostname
|
var $hostname = '127.0.0.1'; ///< hostname
|
||||||
var $userid = null; ///< user id
|
var $userid = null; ///< user id
|
||||||
var $password = null; ///< password
|
var $password = null; ///< password
|
||||||
var $database = null; ///< database
|
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 */';
|
var $comment_syntax = '/* %s */';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief postgresql에서 사용될 column type
|
* @brief column type used in postgresql
|
||||||
*
|
*
|
||||||
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
|
* Becasue a common column type in schema/query xml is used for colum_type,
|
||||||
* 각 DBMS에 맞게 replace 해주어야 한다
|
* it should be replaced properly for each DBMS
|
||||||
**/
|
**/
|
||||||
var $column_type = array(
|
var $column_type = array(
|
||||||
'bignumber' => 'bigint',
|
'bignumber' => 'bigint',
|
||||||
|
|
@ -60,7 +60,7 @@ class DBPostgresql extends DB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief Return if it is installable
|
||||||
**/
|
**/
|
||||||
function isSupported()
|
function isSupported()
|
||||||
{
|
{
|
||||||
|
|
@ -70,7 +70,7 @@ class DBPostgresql extends DB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB정보 설정 및 connect/ close
|
* @brief DB settings and connect/close
|
||||||
**/
|
**/
|
||||||
function _setDBInfo()
|
function _setDBInfo()
|
||||||
{
|
{
|
||||||
|
|
@ -86,40 +86,36 @@ class DBPostgresql extends DB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 접속
|
* @brief DB Connection
|
||||||
**/
|
**/
|
||||||
function _connect()
|
function _connect()
|
||||||
{
|
{
|
||||||
// pg용 connection string
|
// the connection string for PG
|
||||||
$conn_string = "";
|
$conn_string = "";
|
||||||
|
// Ignore if no DB information exists
|
||||||
// db 정보가 없으면 무시
|
|
||||||
if (!$this->hostname || !$this->userid || !$this->database)
|
if (!$this->hostname || !$this->userid || !$this->database)
|
||||||
return;
|
return;
|
||||||
|
// Create connection string
|
||||||
// connection string 만들기
|
|
||||||
$conn_string .= ($this->hostname) ? " host=$this->hostname" : "";
|
$conn_string .= ($this->hostname) ? " host=$this->hostname" : "";
|
||||||
$conn_string .= ($this->userid) ? " user=$this->userid" : "";
|
$conn_string .= ($this->userid) ? " user=$this->userid" : "";
|
||||||
$conn_string .= ($this->password) ? " password=$this->password" : "";
|
$conn_string .= ($this->password) ? " password=$this->password" : "";
|
||||||
$conn_string .= ($this->database) ? " dbname=$this->database" : "";
|
$conn_string .= ($this->database) ? " dbname=$this->database" : "";
|
||||||
$conn_string .= ($this->port) ? " port=$this->port" : "";
|
$conn_string .= ($this->port) ? " port=$this->port" : "";
|
||||||
|
// Attempt to connect
|
||||||
// 접속시도
|
|
||||||
$this->fd = @pg_connect($conn_string);
|
$this->fd = @pg_connect($conn_string);
|
||||||
if (!$this->fd || pg_connection_status($this->fd) != PGSQL_CONNECTION_OK) {
|
if (!$this->fd || pg_connection_status($this->fd) != PGSQL_CONNECTION_OK) {
|
||||||
$this->setError(-1, "CONNECTION FAILURE");
|
$this->setError(-1, "CONNECTION FAILURE");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Check connections
|
||||||
// 접속체크
|
|
||||||
$this->is_connected = true;
|
$this->is_connected = true;
|
||||||
$this->password = md5($this->password);
|
$this->password = md5($this->password);
|
||||||
// utf8임을 지정
|
// Set utf8
|
||||||
//$this ->_query('set client_encoding to uhc');
|
//$this ->_query('set client_encoding to uhc');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB접속 해제
|
* @brief DB disconnection
|
||||||
**/
|
**/
|
||||||
function close()
|
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)
|
function addQuotes($string)
|
||||||
{
|
{
|
||||||
|
|
@ -141,7 +137,7 @@ class DBPostgresql extends DB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 트랜잭션 시작
|
* @brief Begin transaction
|
||||||
**/
|
**/
|
||||||
function begin()
|
function begin()
|
||||||
{
|
{
|
||||||
|
|
@ -152,7 +148,7 @@ class DBPostgresql extends DB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 롤백
|
* @brief Rollback
|
||||||
**/
|
**/
|
||||||
function rollback()
|
function rollback()
|
||||||
{
|
{
|
||||||
|
|
@ -163,7 +159,7 @@ class DBPostgresql extends DB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 커밋
|
* @brief Commits
|
||||||
**/
|
**/
|
||||||
function commit()
|
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
|
* query: run a query and return the result \n
|
||||||
* fetch : reutrn 된 값이 없으면 NULL\n
|
* fetch: NULL if no value is returned \n
|
||||||
* rows이면 array object\n
|
* array object if rows are returned \n
|
||||||
* row이면 object\n
|
* object if a row is returned \n
|
||||||
* return\n
|
* return\n
|
||||||
**/
|
**/
|
||||||
function _query($query)
|
function _query($query)
|
||||||
|
|
@ -208,16 +204,12 @@ class DBPostgresql extends DB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
// Notify to start a query execution
|
||||||
// 쿼리 시작을 알림
|
|
||||||
$this->actStart($query);
|
$this->actStart($query);
|
||||||
$arr = array('Hello', 'World!', 'Beautiful', 'Day!');
|
$arr = array('Hello', 'World!', 'Beautiful', 'Day!');
|
||||||
|
// Run the query statement
|
||||||
|
|
||||||
// 쿼리 문 실행
|
|
||||||
$result = @pg_query($this->fd, $query);
|
$result = @pg_query($this->fd, $query);
|
||||||
|
// Error Check
|
||||||
// 오류 체크
|
|
||||||
if (!$result) {
|
if (!$result) {
|
||||||
// var_dump($l_query_array);
|
// var_dump($l_query_array);
|
||||||
//var_dump($query);
|
//var_dump($query);
|
||||||
|
|
@ -225,16 +217,14 @@ class DBPostgresql extends DB
|
||||||
//var_dump(debug_backtrace());
|
//var_dump(debug_backtrace());
|
||||||
$this->setError(1, pg_last_error($this->fd));
|
$this->setError(1, pg_last_error($this->fd));
|
||||||
}
|
}
|
||||||
|
// Notify to complete a query execution
|
||||||
// 쿼리 실행 종료를 알림
|
|
||||||
$this->actFinish();
|
$this->actFinish();
|
||||||
|
// Return result
|
||||||
// 결과 리턴
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 결과를 fetch
|
* @brief Fetch results
|
||||||
**/
|
**/
|
||||||
function _fetch($result)
|
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()
|
function getNextSequence()
|
||||||
{
|
{
|
||||||
|
|
@ -260,7 +250,7 @@ class DBPostgresql extends DB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 테이블 기생성 여부 return
|
* @brief Return if a table already exists
|
||||||
**/
|
**/
|
||||||
function isTableExists($target_name)
|
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 =
|
function addColumn($table_name, $column_name, $type = 'number', $size = '', $default =
|
||||||
NULL, $notnull = false)
|
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)
|
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)
|
* $target_columns = array(col1, col2)
|
||||||
* $is_unique? unique : none
|
* $is_unique? unique : none
|
||||||
**/
|
**/
|
||||||
|
|
@ -340,8 +330,7 @@ class DBPostgresql extends DB
|
||||||
|
|
||||||
if (strpos($table_name, $this->prefix) === false)
|
if (strpos($table_name, $this->prefix) === false)
|
||||||
$table_name = $this->prefix . $table_name;
|
$table_name = $this->prefix . $table_name;
|
||||||
|
// Use a tablename before an index name to avoid defining the same index
|
||||||
// index_name의 경우 앞에 table이름을 붙여줘서 중복을 피함
|
|
||||||
$index_name = $table_name . $index_name;
|
$index_name = $table_name . $index_name;
|
||||||
|
|
||||||
$query = sprintf("create %s index %s on %s (%s);", $is_unique ? 'unique' : '', $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)
|
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)
|
function dropIndex($table_name, $index_name, $is_unique = false)
|
||||||
{
|
{
|
||||||
if (strpos($table_name, $this->prefix) === false)
|
if (strpos($table_name, $this->prefix) === false)
|
||||||
$table_name = $this->prefix . $table_name;
|
$table_name = $this->prefix . $table_name;
|
||||||
|
// Use a tablename before an index name to avoid defining the same index
|
||||||
// index_name의 경우 앞에 table이름을 붙여줘서 중복을 피함
|
|
||||||
$index_name = $table_name . $index_name;
|
$index_name = $table_name . $index_name;
|
||||||
|
|
||||||
$query = sprintf("drop index %s", $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)
|
function isIndexExists($table_name, $index_name)
|
||||||
{
|
{
|
||||||
if (strpos($table_name, $this->prefix) === false)
|
if (strpos($table_name, $this->prefix) === false)
|
||||||
$table_name = $this->prefix . $table_name;
|
$table_name = $this->prefix . $table_name;
|
||||||
|
// Use a tablename before an index name to avoid defining the same index
|
||||||
// index_name의 경우 앞에 table이름을 붙여줘서 중복을 피함
|
|
||||||
$index_name = $table_name . $index_name;
|
$index_name = $table_name . $index_name;
|
||||||
|
|
||||||
//$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $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)
|
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)
|
function createTableByXmlFile($file_name)
|
||||||
{
|
{
|
||||||
if (!file_exists($file_name))
|
if (!file_exists($file_name))
|
||||||
return;
|
return;
|
||||||
// xml 파일을 읽음
|
// read xml file
|
||||||
$buff = FileHandler::readFile($file_name);
|
$buff = FileHandler::readFile($file_name);
|
||||||
return $this->_createTable($buff);
|
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
|
* type : number, varchar, text, char, date, \n
|
||||||
* opt : notnull, default, size\n
|
* opt : notnull, default, size\n
|
||||||
|
|
@ -433,8 +420,7 @@ class DBPostgresql extends DB
|
||||||
// xml parsing
|
// xml parsing
|
||||||
$oXml = new XmlParser();
|
$oXml = new XmlParser();
|
||||||
$xml_obj = $oXml->parse($xml_doc);
|
$xml_obj = $oXml->parse($xml_doc);
|
||||||
|
// Create a table schema
|
||||||
// 테이블 생성 schema 작성
|
|
||||||
$table_name = $xml_obj->table->attrs->name;
|
$table_name = $xml_obj->table->attrs->name;
|
||||||
|
|
||||||
if ($table_name == 'sequence') {
|
if ($table_name == 'sequence') {
|
||||||
|
|
@ -508,7 +494,7 @@ class DBPostgresql extends DB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 조건문 작성하여 return
|
* @brief Return conditional clause
|
||||||
**/
|
**/
|
||||||
function getCondition($output)
|
function getCondition($output)
|
||||||
{
|
{
|
||||||
|
|
@ -564,16 +550,15 @@ class DBPostgresql extends DB
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief insertAct 처리
|
* @brief Handle the insertAct
|
||||||
**/
|
**/
|
||||||
function _executeInsertAct($output)
|
function _executeInsertAct($output)
|
||||||
{
|
{
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach ($output->tables as $key => $val) {
|
foreach ($output->tables as $key => $val) {
|
||||||
$table_list[] = $this->prefix . $val;
|
$table_list[] = $this->prefix . $val;
|
||||||
}
|
}
|
||||||
|
// List columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach ($output->columns as $key => $val) {
|
foreach ($output->columns as $key => $val) {
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
$value = $val['value'];
|
$value = $val['value'];
|
||||||
|
|
@ -594,17 +579,16 @@ class DBPostgresql extends DB
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief updateAct 처리
|
* @brief Handle updateAct
|
||||||
**/
|
**/
|
||||||
function _executeUpdateAct($output)
|
function _executeUpdateAct($output)
|
||||||
{
|
{
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach ($output->tables as $key => $val) {
|
foreach ($output->tables as $key => $val) {
|
||||||
//$table_list[] = $this->prefix.$val.' as '.$key;
|
//$table_list[] = $this->prefix.$val.' as '.$key;
|
||||||
$table_list[] = $this->prefix . $val;
|
$table_list[] = $this->prefix . $val;
|
||||||
}
|
}
|
||||||
|
// List columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach ($output->columns as $key => $val) {
|
foreach ($output->columns as $key => $val) {
|
||||||
if (!isset($val['value']))
|
if (!isset($val['value']))
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -621,8 +605,7 @@ class DBPostgresql extends DB
|
||||||
$column_list[] = sprintf("%s = %s", $name, $value);
|
$column_list[] = sprintf("%s = %s", $name, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("update %s set %s %s", implode(',', $table_list), implode(',',
|
$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)
|
function _executeDeleteAct($output)
|
||||||
{
|
{
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach ($output->tables as $key => $val) {
|
foreach ($output->tables as $key => $val) {
|
||||||
$table_list[] = $this->prefix . $val;
|
$table_list[] = $this->prefix . $val;
|
||||||
}
|
}
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("delete from %s %s", implode(',', $table_list), $condition);
|
$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
|
* In order to get a list of pages easily when selecting \n
|
||||||
* navigation이라는 method를 제공
|
* it supports a method as navigation
|
||||||
**/
|
**/
|
||||||
function _executeSelectAct($output)
|
function _executeSelectAct($output)
|
||||||
{
|
{
|
||||||
// 테이블 정리
|
// List tables
|
||||||
$table_list = array();
|
$table_list = array();
|
||||||
foreach ($output->tables as $key => $val) {
|
foreach ($output->tables as $key => $val) {
|
||||||
$table_list[] = $this->prefix . $val . ' as ' . $key;
|
$table_list[] = $this->prefix . $val . ' as ' . $key;
|
||||||
|
|
@ -709,8 +691,7 @@ class DBPostgresql extends DB
|
||||||
if ($output->list_count && $output->page)
|
if ($output->list_count && $output->page)
|
||||||
return $this->_getNavigationData($table_list, $columns, $left_join, $condition,
|
return $this->_getNavigationData($table_list, $columns, $left_join, $condition,
|
||||||
$output);
|
$output);
|
||||||
|
// Add a condition to use an index when sorting in order by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if ($output->order) {
|
if ($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if (!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
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)
|
function _getNavigationData($table_list, $columns, $left_join, $condition, $output)
|
||||||
{
|
{
|
||||||
|
|
@ -804,8 +785,8 @@ class DBPostgresql extends DB
|
||||||
|
|
||||||
$column_list = $output->column_list;
|
$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;
|
$count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition;
|
||||||
$total_count = $this->getCountCache($output->tables, $count_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 = 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(*)'):'';
|
$count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):'';
|
||||||
$result = $this->_query($count_query);
|
$result = $this->_query($count_query);
|
||||||
|
|
@ -835,15 +816,14 @@ class DBPostgresql extends DB
|
||||||
if (!$page)
|
if (!$page)
|
||||||
$page = 1;
|
$page = 1;
|
||||||
|
|
||||||
// 전체 페이지를 구함
|
// Get a total page
|
||||||
if ($total_count) $total_page = (int)(($total_count - 1) / $list_count) + 1;
|
if ($total_count) $total_page = (int)(($total_count - 1) / $list_count) + 1;
|
||||||
else $total_page = 1;
|
else $total_page = 1;
|
||||||
|
|
||||||
// 페이지 변수를 체크
|
// Check Page variables
|
||||||
if ($page > $total_page) $page = $total_page;
|
if ($page > $total_page) $page = $total_page;
|
||||||
$start_count = ($page - 1) * $list_count;
|
$start_count = ($page - 1) * $list_count;
|
||||||
|
// Add a condition to use an index when sorting in order by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if ($output->order) {
|
if ($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if (!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
if (!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class DBSqlite2
|
* @class DBSqlite2
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief SQLite ver 2.x 를 이용하기 위한 class
|
* @brief Class for using SQLite ver 2.x
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
*
|
*
|
||||||
* sqlite handling class (sqlite ver 2.x)
|
* sqlite handling class (sqlite ver 2.x)
|
||||||
|
|
@ -11,17 +11,17 @@
|
||||||
class DBSqlite2 extends DB {
|
class DBSqlite2 extends DB {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DB를 이용하기 위한 정보
|
* DB information
|
||||||
**/
|
**/
|
||||||
var $database = NULL; ///< database
|
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 */';
|
var $comment_syntax = '/* %s */';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief sqlite 에서 사용될 column type
|
* @brief sqlite column type used in
|
||||||
*
|
*
|
||||||
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
|
* Becasue a common column type in schema/query xml is used for colum_type,
|
||||||
* 각 DBMS에 맞게 replace 해주어야 한다
|
* it should be replaced properly for each DBMS
|
||||||
**/
|
**/
|
||||||
var $column_type = array(
|
var $column_type = array(
|
||||||
'bignumber' => 'INTEGER',
|
'bignumber' => 'INTEGER',
|
||||||
|
|
@ -51,7 +51,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief Return if it is installable
|
||||||
**/
|
**/
|
||||||
function isSupported() {
|
function isSupported() {
|
||||||
if(!function_exists('sqlite_open')) return false;
|
if(!function_exists('sqlite_open')) return false;
|
||||||
|
|
@ -59,7 +59,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB정보 설정 및 connect/ close
|
* @brief DB settings and connect/close
|
||||||
**/
|
**/
|
||||||
function _setDBInfo() {
|
function _setDBInfo() {
|
||||||
$db_info = Context::getDBInfo();
|
$db_info = Context::getDBInfo();
|
||||||
|
|
@ -69,27 +69,25 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 접속
|
* @brief DB Connection
|
||||||
**/
|
**/
|
||||||
function _connect() {
|
function _connect() {
|
||||||
// db 정보가 없으면 무시
|
// Ignore if no DB information exists
|
||||||
if(!$this->database) return;
|
if(!$this->database) return;
|
||||||
|
// Attempt to access the database file
|
||||||
// 데이터 베이스 파일 접속 시도
|
|
||||||
$this->fd = sqlite_open($this->database, 0666, $error);
|
$this->fd = sqlite_open($this->database, 0666, $error);
|
||||||
if(!file_exists($this->database) || $error) {
|
if(!file_exists($this->database) || $error) {
|
||||||
$this->setError(-1,$error);
|
$this->setError(-1,$error);
|
||||||
$this->is_connected = false;
|
$this->is_connected = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Check connections
|
||||||
// 접속체크
|
|
||||||
$this->is_connected = true;
|
$this->is_connected = true;
|
||||||
$this->password = md5($this->password);
|
$this->password = md5($this->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB접속 해제
|
* @brief DB disconnection
|
||||||
**/
|
**/
|
||||||
function close() {
|
function close() {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
|
@ -97,7 +95,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 트랜잭션 시작
|
* @brief Begin transaction
|
||||||
**/
|
**/
|
||||||
function begin() {
|
function begin() {
|
||||||
if(!$this->is_connected || $this->transaction_started) return;
|
if(!$this->is_connected || $this->transaction_started) return;
|
||||||
|
|
@ -105,7 +103,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 롤백
|
* @brief Rollback
|
||||||
**/
|
**/
|
||||||
function rollback() {
|
function rollback() {
|
||||||
if(!$this->is_connected || !$this->transaction_started) return;
|
if(!$this->is_connected || !$this->transaction_started) return;
|
||||||
|
|
@ -114,7 +112,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 커밋
|
* @brief Commits
|
||||||
**/
|
**/
|
||||||
function commit($force = false) {
|
function commit($force = false) {
|
||||||
if(!$force && (!$this->isConnected() || !$this->transaction_started)) return;
|
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) {
|
function addQuotes($string) {
|
||||||
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$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
|
* query: run a query and return the result \n
|
||||||
* fetch : reutrn 된 값이 없으면 NULL\n
|
* fetch: NULL if no value is returned \n
|
||||||
* rows이면 array object\n
|
* array object if rows are returned \n
|
||||||
* row이면 object\n
|
* object if a row is returned \n
|
||||||
* return\n
|
* return\n
|
||||||
**/
|
**/
|
||||||
function _query($query) {
|
function _query($query) {
|
||||||
if(!$this->isConnected()) return;
|
if(!$this->isConnected()) return;
|
||||||
|
// Notify to start a query execution
|
||||||
// 쿼리 시작을 알림
|
|
||||||
$this->actStart($query);
|
$this->actStart($query);
|
||||||
|
// Run the query statement
|
||||||
// 쿼리 문 실행
|
|
||||||
$result = @sqlite_query($query, $this->fd);
|
$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)));
|
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();
|
$this->actFinish();
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 결과를 fetch
|
* @brief Fetch results
|
||||||
**/
|
**/
|
||||||
function _fetch($result) {
|
function _fetch($result) {
|
||||||
if($this->isError() || !$result) return;
|
if($this->isError() || !$result) return;
|
||||||
|
|
@ -180,7 +174,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 1씩 증가되는 sequence값을 return
|
* @brief Return the sequence value is incremented by 1
|
||||||
**/
|
**/
|
||||||
function getNextSequence() {
|
function getNextSequence() {
|
||||||
$query = sprintf("insert into %ssequence (seq) values ('')", $this->prefix);
|
$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) {
|
function isTableExists($target_name) {
|
||||||
$query = sprintf('pragma table_info(%s%s)', $this->prefix, $this->addQuotes($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) {
|
function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) {
|
||||||
$type = $this->column_type[$type];
|
$type = $this->column_type[$type];
|
||||||
|
|
@ -221,7 +215,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 테이블에 특정 column 제거
|
* @brief Delete a column from a table
|
||||||
**/
|
**/
|
||||||
function dropColumn($table_name, $column_name) {
|
function dropColumn($table_name, $column_name) {
|
||||||
$query = sprintf("alter table %s%s drop column %s ", $this->prefix, $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) {
|
function isColumnExists($table_name, $column_name) {
|
||||||
$query = sprintf("pragma table_info(%s%s)", $this->prefix, $table_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)
|
* $target_columns = array(col1, col2)
|
||||||
* $is_unique? unique : none
|
* $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) {
|
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||||
$key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name);
|
$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) {
|
function isIndexExists($table_name, $index_name) {
|
||||||
$key_name = sprintf('%s%s_%s', $this->prefix, $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) {
|
function createTableByXml($xml_doc) {
|
||||||
return $this->_createTable($xml_doc);
|
return $this->_createTable($xml_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief xml 을 받아서 테이블을 생성
|
* @brief Create a table by using xml file
|
||||||
**/
|
**/
|
||||||
function createTableByXmlFile($file_name) {
|
function createTableByXmlFile($file_name) {
|
||||||
if(!file_exists($file_name)) return;
|
if(!file_exists($file_name)) return;
|
||||||
// xml 파일을 읽음
|
// read xml file
|
||||||
$buff = FileHandler::readFile($file_name);
|
$buff = FileHandler::readFile($file_name);
|
||||||
return $this->_createTable($buff);
|
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
|
* type : number, varchar, text, char, date, \n
|
||||||
* opt : notnull, default, size\n
|
* opt : notnull, default, size\n
|
||||||
|
|
@ -309,8 +303,7 @@
|
||||||
// xml parsing
|
// xml parsing
|
||||||
$oXml = new XmlParser();
|
$oXml = new XmlParser();
|
||||||
$xml_obj = $oXml->parse($xml_doc);
|
$xml_obj = $oXml->parse($xml_doc);
|
||||||
|
// Create a table schema
|
||||||
// 테이블 생성 schema 작성
|
|
||||||
$table_name = $xml_obj->table->attrs->name;
|
$table_name = $xml_obj->table->attrs->name;
|
||||||
if($this->isTableExists($table_name)) return;
|
if($this->isTableExists($table_name)) return;
|
||||||
$table_name = $this->prefix.$table_name;
|
$table_name = $this->prefix.$table_name;
|
||||||
|
|
@ -371,7 +364,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 조건문 작성하여 return
|
* @brief Return conditional clause
|
||||||
**/
|
**/
|
||||||
function getCondition($output) {
|
function getCondition($output) {
|
||||||
if(!$output->conditions) return;
|
if(!$output->conditions) return;
|
||||||
|
|
@ -415,15 +408,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief insertAct 처리
|
* @brief Handle the insertAct
|
||||||
**/
|
**/
|
||||||
function _executeInsertAct($output) {
|
function _executeInsertAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = $this->prefix.$val;
|
$table_list[] = $this->prefix.$val;
|
||||||
}
|
}
|
||||||
|
// List columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
$value = $val['value'];
|
$value = $val['value'];
|
||||||
|
|
@ -441,18 +433,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief updateAct 처리
|
* @brief Handle updateAct
|
||||||
**/
|
**/
|
||||||
function _executeUpdateAct($output) {
|
function _executeUpdateAct($output) {
|
||||||
$table_count = count(array_values($output->tables));
|
$table_count = count(array_values($output->tables));
|
||||||
|
// If one day the destination table
|
||||||
// 대상 테이블이 1개일 경우
|
|
||||||
if($table_count == 1) {
|
if($table_count == 1) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
list($target_table) = array_values($output->tables);
|
list($target_table) = array_values($output->tables);
|
||||||
$target_table = $this->prefix.$target_table;
|
$target_table = $this->prefix.$target_table;
|
||||||
|
// List columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
if(!isset($val['value'])) continue;
|
if(!isset($val['value'])) continue;
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
|
|
@ -465,27 +455,23 @@
|
||||||
$column_list[] = sprintf("%s = %s", $name, $value);
|
$column_list[] = sprintf("%s = %s", $name, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("update %s set %s %s", $target_table, implode(',',$column_list), $condition);
|
$query = sprintf("update %s set %s %s", $target_table, implode(',',$column_list), $condition);
|
||||||
|
// trick to handle if targt table to update is more than one (sqlite doesn't support update to multi-tables)
|
||||||
// 대상 테이블이 2개일 경우 (sqlite에서 update 테이블을 1개 이상 지정 못해서 이렇게 꽁수로... 다른 방법이 있으려나..)
|
|
||||||
} elseif($table_count == 2) {
|
} elseif($table_count == 2) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[$val] = $this->prefix.$key;
|
$table_list[$val] = $this->prefix.$key;
|
||||||
}
|
}
|
||||||
list($source_table, $target_table) = array_values($table_list);
|
list($source_table, $target_table) = array_values($table_list);
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
foreach($table_list as $key => $val) {
|
foreach($table_list as $key => $val) {
|
||||||
$condition = eregi_replace($key.'\\.', $val.'.', $condition);
|
$condition = eregi_replace($key.'\\.', $val.'.', $condition);
|
||||||
}
|
}
|
||||||
|
// List columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
if(!isset($val['value'])) continue;
|
if(!isset($val['value'])) continue;
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
|
|
@ -507,15 +493,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief deleteAct 처리
|
* @brief Handle deleteAct
|
||||||
**/
|
**/
|
||||||
function _executeDeleteAct($output) {
|
function _executeDeleteAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = $this->prefix.$val;
|
$table_list[] = $this->prefix.$val;
|
||||||
}
|
}
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
|
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
|
||||||
|
|
@ -524,13 +509,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief selectAct 처리
|
* @brief Handle selectAct
|
||||||
*
|
*
|
||||||
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
|
* In order to get a list of pages easily when selecting \n
|
||||||
* navigation이라는 method를 제공
|
* it supports a method as navigation
|
||||||
**/
|
**/
|
||||||
function _executeSelectAct($output) {
|
function _executeSelectAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
$table_list = array();
|
$table_list = array();
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = $this->prefix.$val.' as '.$key;
|
$table_list[] = $this->prefix.$val.' as '.$key;
|
||||||
|
|
@ -573,8 +558,7 @@
|
||||||
|
|
||||||
$output->column_list = $column_list;
|
$output->column_list = $column_list;
|
||||||
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
|
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
|
||||||
|
// Add a condition to use an index when sorting in order by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
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);
|
if(count($index_list)) $query .= ' order by '.implode(',',$index_list);
|
||||||
}
|
}
|
||||||
|
// Apply when using list_count
|
||||||
// list_count를 사용할 경우 적용
|
|
||||||
if($output->list_count['value']) $query = sprintf('%s limit %d', $query, $output->list_count['value']);
|
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):'';
|
$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) {
|
function _getNavigationData($table_list, $columns, $left_join, $condition, $output) {
|
||||||
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
||||||
|
|
||||||
$column_list = $output->column_list;
|
$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;
|
$count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition;
|
||||||
$total_count = $this->getCountCache($output->tables, $count_condition);
|
$total_count = $this->getCountCache($output->tables, $count_condition);
|
||||||
|
|
@ -644,8 +627,7 @@
|
||||||
$this->putCountCache($output->tables, $count_condition, $total_count);
|
$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 = 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(*)'):'';
|
$count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):'';
|
||||||
$result = $this->_query($count_query);
|
$result = $this->_query($count_query);
|
||||||
|
|
@ -658,16 +640,13 @@
|
||||||
if(!$page_count) $page_count = 10;
|
if(!$page_count) $page_count = 10;
|
||||||
$page = $output->page['value'];
|
$page = $output->page['value'];
|
||||||
if(!$page) $page = 1;
|
if(!$page) $page = 1;
|
||||||
|
// Get a total page
|
||||||
// 전체 페이지를 구함
|
|
||||||
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
|
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
|
||||||
else $total_page = 1;
|
else $total_page = 1;
|
||||||
|
// Check Page variables
|
||||||
// 페이지 변수를 체크
|
|
||||||
if($page > $total_page) $page = $total_page;
|
if($page > $total_page) $page = $total_page;
|
||||||
$start_count = ($page-1)*$list_count;
|
$start_count = ($page-1)*$list_count;
|
||||||
|
// Add a condition to use an index when sorting in order by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,21 @@
|
||||||
/**
|
/**
|
||||||
* @class DBSqlite3_pdo
|
* @class DBSqlite3_pdo
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief SQLite3를 PDO로 이용하여 class
|
* @brief class to use SQLite3 with PDO
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class DBSqlite3_pdo extends DB {
|
class DBSqlite3_pdo extends DB {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* DB를 이용하기 위한 정보
|
* DB information
|
||||||
**/
|
**/
|
||||||
var $database = NULL; ///< database
|
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 */';
|
var $comment_syntax = '/* %s */';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PDO 사용시 필요한 변수들
|
* Variables for using PDO
|
||||||
**/
|
**/
|
||||||
var $handler = NULL;
|
var $handler = NULL;
|
||||||
var $stmt = NULL;
|
var $stmt = NULL;
|
||||||
|
|
@ -24,10 +24,10 @@
|
||||||
var $bind_vars = array();
|
var $bind_vars = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief sqlite3 에서 사용될 column type
|
* @brief column type used in sqlite3
|
||||||
*
|
*
|
||||||
* column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에
|
* column_type should be replaced for each DBMS properly
|
||||||
* 각 DBMS에 맞게 replace 해주어야 한다
|
* because column_type uses a commonly defined type in schema/query xml files
|
||||||
**/
|
**/
|
||||||
var $column_type = array(
|
var $column_type = array(
|
||||||
'bignumber' => 'INTEGER',
|
'bignumber' => 'INTEGER',
|
||||||
|
|
@ -57,14 +57,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치 가능 여부를 return
|
* @brief Return if installable
|
||||||
**/
|
**/
|
||||||
function isSupported() {
|
function isSupported() {
|
||||||
return class_exists('PDO');
|
return class_exists('PDO');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB정보 설정 및 connect/ close
|
* @brief DB settings and connect/close
|
||||||
**/
|
**/
|
||||||
function _setDBInfo() {
|
function _setDBInfo() {
|
||||||
$db_info = Context::getDBInfo();
|
$db_info = Context::getDBInfo();
|
||||||
|
|
@ -74,13 +74,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 접속
|
* @brief DB Connection
|
||||||
**/
|
**/
|
||||||
function _connect() {
|
function _connect() {
|
||||||
// db 정보가 없으면 무시
|
// override if db information not exists
|
||||||
if(!$this->database) return;
|
if(!$this->database) return;
|
||||||
|
|
||||||
// 데이터 베이스 파일 접속 시도
|
// Attempt to access the database file
|
||||||
try {
|
try {
|
||||||
// PDO is only supported with PHP5,
|
// PDO is only supported with PHP5,
|
||||||
// so it is allowed to use try~catch statment in this class.
|
// so it is allowed to use try~catch statment in this class.
|
||||||
|
|
@ -91,13 +91,13 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 접속체크
|
// Check connections
|
||||||
$this->is_connected = true;
|
$this->is_connected = true;
|
||||||
$this->password = md5($this->password);
|
$this->password = md5($this->password);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB접속 해제
|
* @brief disconnect to DB
|
||||||
**/
|
**/
|
||||||
function close() {
|
function close() {
|
||||||
if(!$this->is_connected) return;
|
if(!$this->is_connected) return;
|
||||||
|
|
@ -105,7 +105,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 트랜잭션 시작
|
* @brief Begin a transaction
|
||||||
**/
|
**/
|
||||||
function begin() {
|
function begin() {
|
||||||
if(!$this->is_connected || $this->transaction_started) return;
|
if(!$this->is_connected || $this->transaction_started) return;
|
||||||
|
|
@ -113,7 +113,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 롤백
|
* @brief Rollback
|
||||||
**/
|
**/
|
||||||
function rollback() {
|
function rollback() {
|
||||||
if(!$this->is_connected || !$this->transaction_started) return;
|
if(!$this->is_connected || !$this->transaction_started) return;
|
||||||
|
|
@ -122,7 +122,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 커밋
|
* @brief Commit
|
||||||
**/
|
**/
|
||||||
function commit($force = false) {
|
function commit($force = false) {
|
||||||
if(!$force && (!$this->is_connected || !$this->transaction_started)) return;
|
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) {
|
function addQuotes($string) {
|
||||||
if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$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) {
|
function _prepare($query) {
|
||||||
if(!$this->is_connected) return;
|
if(!$this->is_connected) return;
|
||||||
|
|
||||||
// 쿼리 시작을 알림
|
// notify to start a query execution
|
||||||
$this->actStart($query);
|
$this->actStart($query);
|
||||||
|
|
||||||
$this->stmt = $this->handler->prepare($query);
|
$this->stmt = $this->handler->prepare($query);
|
||||||
|
|
@ -159,7 +159,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief : stmt에 binding params
|
* @brief : Binding params in stmt
|
||||||
**/
|
**/
|
||||||
function _bind($val) {
|
function _bind($val) {
|
||||||
if(!$this->is_connected || !$this->stmt) return;
|
if(!$this->is_connected || !$this->stmt) return;
|
||||||
|
|
@ -170,7 +170,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief : prepare된 쿼리의 execute
|
* @brief : execute the prepared statement
|
||||||
**/
|
**/
|
||||||
function _execute() {
|
function _execute() {
|
||||||
if(!$this->is_connected || !$this->stmt) return;
|
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() {
|
function getNextSequence() {
|
||||||
$query = sprintf("insert into %ssequence (seq) values (NULL)", $this->prefix);
|
$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) {
|
function isTableExists($target_name) {
|
||||||
$query = sprintf('pragma table_info(%s%s)', $this->prefix, $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) {
|
function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) {
|
||||||
$type = $this->column_type[$type];
|
$type = $this->column_type[$type];
|
||||||
|
|
@ -244,7 +244,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 테이블에 특정 column 제거
|
* @brief Remove a column from a table
|
||||||
**/
|
**/
|
||||||
function dropColumn($table_name, $column_name) {
|
function dropColumn($table_name, $column_name) {
|
||||||
$query = sprintf("alter table %s%s drop column %s ", $this->prefix, $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) {
|
function isColumnExists($table_name, $column_name) {
|
||||||
$query = sprintf("pragma table_info(%s%s)", $this->prefix, $table_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)
|
* $target_columns = array(col1, col2)
|
||||||
* $is_unique? unique : none
|
* $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) {
|
function dropIndex($table_name, $index_name, $is_unique = false) {
|
||||||
$key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name);
|
$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) {
|
function isIndexExists($table_name, $index_name) {
|
||||||
$key_name = sprintf('%s%s_%s', $this->prefix, $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) {
|
function createTableByXml($xml_doc) {
|
||||||
return $this->_createTable($xml_doc);
|
return $this->_createTable($xml_doc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief xml 을 받아서 테이블을 생성
|
* @brief create a table from xml file
|
||||||
**/
|
**/
|
||||||
function createTableByXmlFile($file_name) {
|
function createTableByXmlFile($file_name) {
|
||||||
if(!file_exists($file_name)) return;
|
if(!file_exists($file_name)) return;
|
||||||
// xml 파일을 읽음
|
// read xml file
|
||||||
$buff = FileHandler::readFile($file_name);
|
$buff = FileHandler::readFile($file_name);
|
||||||
return $this->_createTable($buff);
|
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
|
* type : number, varchar, text, char, date, \n
|
||||||
* opt : notnull, default, size\n
|
* opt : notnull, default, size\n
|
||||||
|
|
@ -334,8 +334,7 @@
|
||||||
// xml parsing
|
// xml parsing
|
||||||
$oXml = new XmlParser();
|
$oXml = new XmlParser();
|
||||||
$xml_obj = $oXml->parse($xml_doc);
|
$xml_obj = $oXml->parse($xml_doc);
|
||||||
|
// Create a table schema
|
||||||
// 테이블 생성 schema 작성
|
|
||||||
$table_name = $xml_obj->table->attrs->name;
|
$table_name = $xml_obj->table->attrs->name;
|
||||||
if($this->isTableExists($table_name)) return;
|
if($this->isTableExists($table_name)) return;
|
||||||
$table_name = $this->prefix.$table_name;
|
$table_name = $this->prefix.$table_name;
|
||||||
|
|
@ -401,7 +400,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 조건문 작성하여 return
|
* @brief Return conditional clause(where)
|
||||||
**/
|
**/
|
||||||
function getCondition($output) {
|
function getCondition($output) {
|
||||||
if(!$output->conditions) return;
|
if(!$output->conditions) return;
|
||||||
|
|
@ -445,15 +444,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief insertAct 처리
|
* @brief insertAct
|
||||||
**/
|
**/
|
||||||
function _executeInsertAct($output) {
|
function _executeInsertAct($output) {
|
||||||
// 테이블 정리
|
// list tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = $this->prefix.$val;
|
$table_list[] = $this->prefix.$val;
|
||||||
}
|
}
|
||||||
|
// list columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
$value = $val['value'];
|
$value = $val['value'];
|
||||||
|
|
@ -480,18 +478,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief updateAct 처리
|
* @brief updateAct
|
||||||
**/
|
**/
|
||||||
function _executeUpdateAct($output) {
|
function _executeUpdateAct($output) {
|
||||||
$table_count = count(array_values($output->tables));
|
$table_count = count(array_values($output->tables));
|
||||||
|
// If a target table is one
|
||||||
// 대상 테이블이 1개일 경우
|
|
||||||
if($table_count == 1) {
|
if($table_count == 1) {
|
||||||
// 테이블 정리
|
// list tables
|
||||||
list($target_table) = array_values($output->tables);
|
list($target_table) = array_values($output->tables);
|
||||||
$target_table = $this->prefix.$target_table;
|
$target_table = $this->prefix.$target_table;
|
||||||
|
// list columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
if(!isset($val['value'])) continue;
|
if(!isset($val['value'])) continue;
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
|
|
@ -504,27 +500,23 @@
|
||||||
$column_list[] = sprintf("%s = %s", $name, $value);
|
$column_list[] = sprintf("%s = %s", $name, $value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// List where cluase
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("update %s set %s %s", $target_table, implode(',',$column_list), $condition);
|
$query = sprintf("update %s set %s %s", $target_table, implode(',',$column_list), $condition);
|
||||||
|
// 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)
|
||||||
// 대상 테이블이 2개일 경우 (sqlite에서 update 테이블을 1개 이상 지정 못해서 이렇게 꽁수로... 다른 방법이 있으려나..)
|
|
||||||
} elseif($table_count == 2) {
|
} elseif($table_count == 2) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[$val] = $this->prefix.$key;
|
$table_list[$val] = $this->prefix.$key;
|
||||||
}
|
}
|
||||||
list($source_table, $target_table) = array_values($table_list);
|
list($source_table, $target_table) = array_values($table_list);
|
||||||
|
// List where cluase
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
foreach($table_list as $key => $val) {
|
foreach($table_list as $key => $val) {
|
||||||
$condition = eregi_replace($key.'\\.', $val.'.', $condition);
|
$condition = eregi_replace($key.'\\.', $val.'.', $condition);
|
||||||
}
|
}
|
||||||
|
// List columns
|
||||||
// 컬럼 정리
|
|
||||||
foreach($output->columns as $key => $val) {
|
foreach($output->columns as $key => $val) {
|
||||||
if(!isset($val['value'])) continue;
|
if(!isset($val['value'])) continue;
|
||||||
$name = $val['name'];
|
$name = $val['name'];
|
||||||
|
|
@ -547,15 +539,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief deleteAct 처리
|
* @brief deleteAct
|
||||||
**/
|
**/
|
||||||
function _executeDeleteAct($output) {
|
function _executeDeleteAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = $this->prefix.$val;
|
$table_list[] = $this->prefix.$val;
|
||||||
}
|
}
|
||||||
|
// List the conditional clause
|
||||||
// 조건절 정리
|
|
||||||
$condition = $this->getCondition($output);
|
$condition = $this->getCondition($output);
|
||||||
|
|
||||||
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
|
$query = sprintf("delete from %s %s", implode(',',$table_list), $condition);
|
||||||
|
|
@ -565,13 +556,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief selectAct 처리
|
* @brief selectAct
|
||||||
*
|
*
|
||||||
* select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n
|
* To fetch a list of the page conveniently when selecting, \n
|
||||||
* navigation이라는 method를 제공
|
* navigation method supported
|
||||||
**/
|
**/
|
||||||
function _executeSelectAct($output) {
|
function _executeSelectAct($output) {
|
||||||
// 테이블 정리
|
// List tables
|
||||||
$table_list = array();
|
$table_list = array();
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$table_list[] = $this->prefix.$val.' as '.$key;
|
$table_list[] = $this->prefix.$val.' as '.$key;
|
||||||
|
|
@ -616,8 +607,7 @@
|
||||||
|
|
||||||
$output->column_list = $column_list;
|
$output->column_list = $column_list;
|
||||||
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
|
if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output);
|
||||||
|
// add the condition to the query to use an index for ordering by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
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);
|
$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']);
|
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):'';
|
$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) {
|
function _getNavigationData($table_list, $columns, $left_join, $condition, $output) {
|
||||||
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
require_once(_XE_PATH_.'classes/page/PageHandler.class.php');
|
||||||
|
|
||||||
$column_list = $output->column_list;
|
$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;
|
$count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition;
|
||||||
$total_count = $this->getCountCache($output->tables, $count_condition);
|
$total_count = $this->getCountCache($output->tables, $count_condition);
|
||||||
|
|
@ -700,8 +690,7 @@
|
||||||
$this->putCountCache($output->tables, $count_condition, $total_count);
|
$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 = 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(*)'):'';
|
$count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):'';
|
||||||
$this->_prepare($count_query);
|
$this->_prepare($count_query);
|
||||||
|
|
@ -714,16 +703,13 @@
|
||||||
if(!$page_count) $page_count = 10;
|
if(!$page_count) $page_count = 10;
|
||||||
$page = $output->page['value'];
|
$page = $output->page['value'];
|
||||||
if(!$page) $page = 1;
|
if(!$page) $page = 1;
|
||||||
|
// Get a total page
|
||||||
// 전체 페이지를 구함
|
|
||||||
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
|
if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1;
|
||||||
else $total_page = 1;
|
else $total_page = 1;
|
||||||
|
// Check Page variables
|
||||||
// 페이지 변수를 체크
|
|
||||||
if($page > $total_page) $page = $total_page;
|
if($page > $total_page) $page = $total_page;
|
||||||
$start_count = ($page-1)*$list_count;
|
$start_count = ($page-1)*$list_count;
|
||||||
|
// Add a condition to use an index when sorting in order by list_order, update_order
|
||||||
// list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가
|
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
$conditions = $this->getConditionList($output);
|
$conditions = $this->getConditionList($output);
|
||||||
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) {
|
||||||
|
|
@ -760,7 +746,7 @@
|
||||||
$columns = join(',',$output->arg_columns);
|
$columns = join(',',$output->arg_columns);
|
||||||
}
|
}
|
||||||
|
|
||||||
// return 결과물 생성
|
// Return the result
|
||||||
$buff = new Object();
|
$buff = new Object();
|
||||||
$buff->total_count = 0;
|
$buff->total_count = 0;
|
||||||
$buff->total_page = 0;
|
$buff->total_page = 0;
|
||||||
|
|
@ -768,7 +754,7 @@
|
||||||
$buff->data = array();
|
$buff->data = array();
|
||||||
$buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count);
|
$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("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 = sprintf('%s limit %d, %d', $query, $start_count, $list_count);
|
||||||
$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):'';
|
$query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):'';
|
||||||
|
|
|
||||||
|
|
@ -10,9 +10,9 @@
|
||||||
|
|
||||||
class DisplayHandler extends Handler {
|
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;
|
var $handler = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -22,16 +22,14 @@
|
||||||
* @param[in] $oModule the module object
|
* @param[in] $oModule the module object
|
||||||
**/
|
**/
|
||||||
function printContent(&$oModule) {
|
function printContent(&$oModule) {
|
||||||
|
// Check if the gzip encoding supported
|
||||||
// gzip encoding 지원 여부 체크
|
|
||||||
if(
|
if(
|
||||||
(defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) &&
|
(defined('__OB_GZHANDLER_ENABLE__') && __OB_GZHANDLER_ENABLE__ == 1) &&
|
||||||
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')!==false &&
|
strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip')!==false &&
|
||||||
function_exists('ob_gzhandler') &&
|
function_exists('ob_gzhandler') &&
|
||||||
extension_loaded('zlib')
|
extension_loaded('zlib')
|
||||||
) $this->gz_enabled = true;
|
) $this->gz_enabled = true;
|
||||||
|
// Extract contents to display by the request method
|
||||||
// request method에 따른 컨텐츠 결과물 추출
|
|
||||||
if(Context::get('xeVirtualRequestMethod')=='xml') {
|
if(Context::get('xeVirtualRequestMethod')=='xml') {
|
||||||
require_once("./classes/display/VirtualXMLDisplayHandler.php");
|
require_once("./classes/display/VirtualXMLDisplayHandler.php");
|
||||||
$handler = new VirtualXMLDisplayHandler();
|
$handler = new VirtualXMLDisplayHandler();
|
||||||
|
|
@ -51,33 +49,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = $handler->toDoc($oModule);
|
$output = $handler->toDoc($oModule);
|
||||||
|
// call a trigger before display
|
||||||
// 출력하기 전에 trigger 호출 (before)
|
|
||||||
ModuleHandler::triggerCall('display', 'before', $output);
|
ModuleHandler::triggerCall('display', 'before', $output);
|
||||||
|
// execute add-on
|
||||||
// 애드온 실행
|
|
||||||
$called_position = 'before_display_content';
|
$called_position = 'before_display_content';
|
||||||
$oAddonController = &getController('addon');
|
$oAddonController = &getController('addon');
|
||||||
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
|
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
|
||||||
@include($addon_file);
|
@include($addon_file);
|
||||||
|
|
||||||
if(method_exists($handler, "prepareToPrint")) $handler->prepareToPrint($output);
|
if(method_exists($handler, "prepareToPrint")) $handler->prepareToPrint($output);
|
||||||
|
// header output
|
||||||
// header 출력
|
|
||||||
if($this->gz_enabled) header("Content-Encoding: gzip");
|
if($this->gz_enabled) header("Content-Encoding: gzip");
|
||||||
if(Context::getResponseMethod() == 'JSON') $this->_printJSONHeader();
|
if(Context::getResponseMethod() == 'JSON') $this->_printJSONHeader();
|
||||||
else if(Context::getResponseMethod() != 'HTML') $this->_printXMLHeader();
|
else if(Context::getResponseMethod() != 'HTML') $this->_printXMLHeader();
|
||||||
else $this->_printHTMLHeader();
|
else $this->_printHTMLHeader();
|
||||||
|
// debugOutput output
|
||||||
// debugOutput 출력
|
|
||||||
$this->content_size = strlen($output);
|
$this->content_size = strlen($output);
|
||||||
$output .= $this->_debugOutput();
|
$output .= $this->_debugOutput();
|
||||||
|
// results directly output
|
||||||
// 결과물 직접 출력
|
|
||||||
if($this->gz_enabled) print ob_gzhandler($output, 5);
|
if($this->gz_enabled) print ob_gzhandler($output, 5);
|
||||||
else print $output;
|
else print $output;
|
||||||
|
// call a trigger after display
|
||||||
// 출력 후 trigger 호출 (after)
|
|
||||||
ModuleHandler::triggerCall('display', 'after', $content);
|
ModuleHandler::triggerCall('display', 'after', $content);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -91,8 +83,7 @@
|
||||||
if(!__DEBUG__) return;
|
if(!__DEBUG__) return;
|
||||||
|
|
||||||
$end = getMicroTime();
|
$end = getMicroTime();
|
||||||
|
// Firebug console output
|
||||||
// Firebug 콘솔 출력
|
|
||||||
if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) {
|
if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) {
|
||||||
static $firephp;
|
static $firephp;
|
||||||
if(!isset($firephp)) $firephp = FirePHP::getInstance(true);
|
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.');
|
$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;
|
return;
|
||||||
}
|
}
|
||||||
|
// display total execution time and Request/Response info
|
||||||
// 전체 실행 시간 출력, Request/Response info 출력
|
|
||||||
if(__DEBUG__ & 2) {
|
if(__DEBUG__ & 2) {
|
||||||
$firephp->fb(
|
$firephp->fb(
|
||||||
array('Request / Response info >>> '.$_SERVER['REQUEST_METHOD'].' / '.Context::getResponseMethod(),
|
array('Request / Response info >>> '.$_SERVER['REQUEST_METHOD'].' / '.Context::getResponseMethod(),
|
||||||
|
|
@ -135,8 +125,7 @@
|
||||||
'TABLE'
|
'TABLE'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// display DB query history
|
||||||
// DB 쿼리 내역 출력
|
|
||||||
if((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) {
|
if((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) {
|
||||||
$queries_output = array(array('Query', 'Elapsed time', 'Result'));
|
$queries_output = array(array('Query', 'Elapsed time', 'Result'));
|
||||||
foreach($GLOBALS['__db_queries__'] as $query) {
|
foreach($GLOBALS['__db_queries__'] as $query) {
|
||||||
|
|
@ -150,43 +139,34 @@
|
||||||
'TABLE'
|
'TABLE'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// dislpay the file and HTML comments
|
||||||
|
|
||||||
// 파일 및 HTML 주석으로 출력
|
|
||||||
} else {
|
} else {
|
||||||
|
// display total execution time and Request/Response info
|
||||||
// 전체 실행 시간 출력, Request/Response info 출력
|
|
||||||
if(__DEBUG__ & 2) {
|
if(__DEBUG__ & 2) {
|
||||||
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
|
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Request/Response information
|
||||||
// Request/Response 정보 작성
|
|
||||||
$buff .= "\n- Request/ Response info\n";
|
$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 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("\tRequest method \t\t\t: %s\n", $_SERVER['REQUEST_METHOD']);
|
||||||
$buff .= sprintf("\tResponse method \t\t: %s\n", Context::getResponseMethod());
|
$buff .= sprintf("\tResponse method \t\t: %s\n", Context::getResponseMethod());
|
||||||
$buff .= sprintf("\tResponse contents size\t\t: %d byte\n", $this->content_size);
|
$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("\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("\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("\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("\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__']);
|
$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__']);
|
$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__']);
|
$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__']);
|
$buff .= sprintf("\n\tTrans Content \t\t\t: %0.5f sec\n", $GLOBALS['__trans_content_elapsed__']);
|
||||||
}
|
}
|
||||||
|
// DB Logging
|
||||||
// DB 로그 작성
|
|
||||||
if(__DEBUG__ & 4) {
|
if(__DEBUG__ & 4) {
|
||||||
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
|
if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -206,8 +186,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Output in HTML comments
|
||||||
// HTML 주석으로 출력
|
|
||||||
if($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') {
|
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));
|
$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-->";
|
return "<!--\r\n".$buff."\r\n-->";
|
||||||
}
|
}
|
||||||
|
// Output to a file
|
||||||
// 파일에 출력
|
|
||||||
if($buff && __DEBUG_OUTPUT__ == 0) {
|
if($buff && __DEBUG_OUTPUT__ == 0) {
|
||||||
$debug_file = _XE_PATH_.'files/_debug_message.php';
|
$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));
|
$buff = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true));
|
||||||
|
|
|
||||||
|
|
@ -28,21 +28,21 @@ class HTMLDisplayHandler {
|
||||||
|
|
||||||
$edited_layout_file = $oModule->getEditedLayoutFile();
|
$edited_layout_file = $oModule->getEditedLayoutFile();
|
||||||
|
|
||||||
// 현재 요청된 레이아웃 정보를 구함
|
// get the layout information currently requested
|
||||||
$oLayoutModel = &getModel('layout');
|
$oLayoutModel = &getModel('layout');
|
||||||
$layout_info = Context::get('layout_info');
|
$layout_info = Context::get('layout_info');
|
||||||
$layout_srl = $layout_info->layout_srl;
|
$layout_srl = $layout_info->layout_srl;
|
||||||
|
|
||||||
// 레이아웃과 연결되어 있으면 레이아웃 컴파일
|
// compile if connected to the layout
|
||||||
if($layout_srl > 0){
|
if($layout_srl > 0){
|
||||||
|
|
||||||
// faceoff 레이아웃일 경우 별도 처리
|
// handle separately if the layout is faceoff
|
||||||
if($layout_info && $layout_info->type == 'faceoff') {
|
if($layout_info && $layout_info->type == 'faceoff') {
|
||||||
$oLayoutModel->doActivateFaceOff($layout_info);
|
$oLayoutModel->doActivateFaceOff($layout_info);
|
||||||
Context::set('layout_info', $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);
|
$edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl);
|
||||||
|
|
||||||
if(file_exists($edited_layout_css)) Context::addCSSFile($edited_layout_css,true,'all','',100);
|
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();
|
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);
|
$output = preg_replace_callback('!<style(.*?)<\/style>!is', array($this,'_moveStyleToHeader'), $output);
|
||||||
|
|
||||||
// 메타 파일 변경 (캐싱기능등으로 인해 위젯등에서 <!--Meta:경로--> 태그를 content에 넣는 경우가 있음
|
// 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);
|
$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()) {
|
if(Context::isAllowRewrite()) {
|
||||||
$url = parse_url(Context::getRequestUri());
|
$url = parse_url(Context::getRequestUri());
|
||||||
$real_path = $url['path'];
|
$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);
|
$output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output);
|
||||||
|
|
||||||
if(__DEBUG__==3) $GLOBALS['__trans_content_elapsed__'] = getMicroTime()-$start;
|
if(__DEBUG__==3) $GLOBALS['__trans_content_elapsed__'] = getMicroTime()-$start;
|
||||||
|
|
||||||
// 불필요한 정보 제거
|
// Remove unnecessary information
|
||||||
$output = preg_replace('/member\_\-([0-9]+)/s','member_0',$output);
|
$output = preg_replace('/member\_\-([0-9]+)/s','member_0',$output);
|
||||||
|
|
||||||
// 최종 레이아웃 변환
|
// convert the final layout
|
||||||
Context::set('content', $output);
|
Context::set('content', $output);
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
if(Mobile::isFromMobilePhone()) {
|
if(Mobile::isFromMobilePhone()) {
|
||||||
|
|
@ -109,7 +109,7 @@ class HTMLDisplayHandler {
|
||||||
$output = $oTemplate->compile('./common/tpl', 'common_layout');
|
$output = $oTemplate->compile('./common/tpl', 'common_layout');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 사용자 정의 언어 변환
|
// replace the user-defined-language
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$oModuleController->replaceDefinedLangCode($output);
|
$oModuleController->replaceDefinedLangCode($output);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,15 +2,15 @@
|
||||||
/**
|
/**
|
||||||
* @class EditorHandler
|
* @class EditorHandler
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief edit component의 상위 클래스임
|
* @brief superclass of the edit component
|
||||||
*
|
*
|
||||||
* 주로 하는 일은 컴포넌트 요청시 컴포넌트에서 필요로 하는 변수를 세팅해준다
|
* set up the component variables
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class EditorHandler extends Object {
|
class EditorHandler extends Object {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컴포넌트의 xml및 관련 정보들을 설정
|
* @brief set the xml and other information of the component
|
||||||
**/
|
**/
|
||||||
function setInfo($info) {
|
function setInfo($info) {
|
||||||
Context::set('component_info', $info);
|
Context::set('component_info', $info);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class ExtraVar
|
* @class ExtraVar
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 게시글, 회원등에서 사용하는 확장변수를 핸들링하는 클래스
|
* @brief a class to handle extra variables used in posts, member and others
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
class ExtraVar {
|
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
|
* @param module_srl, idx, name, type, default, desc, is_required, search, value
|
||||||
**/
|
**/
|
||||||
function setExtraVarKeys($extra_keys) {
|
function setExtraVarKeys($extra_keys) {
|
||||||
|
|
@ -38,7 +38,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 확장변수 객체 배열 return
|
* @brief Return an array of extra vars
|
||||||
**/
|
**/
|
||||||
function getExtraVars() {
|
function getExtraVars() {
|
||||||
return $this->keys;
|
return $this->keys;
|
||||||
|
|
@ -48,7 +48,7 @@
|
||||||
/**
|
/**
|
||||||
* @class ExtraItem
|
* @class ExtraItem
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 확장변수의 개별 값
|
* @brief each value of the extra vars
|
||||||
**/
|
**/
|
||||||
class ExtraItem {
|
class ExtraItem {
|
||||||
var $module_srl = 0;
|
var $module_srl = 0;
|
||||||
|
|
@ -80,14 +80,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 값 지정
|
* @brief Values
|
||||||
**/
|
**/
|
||||||
function setValue($value) {
|
function setValue($value) {
|
||||||
$this->value = $value;
|
$this->value = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief type에 따라서 주어진 값을 변형하여 원형 값을 return
|
* @brief return a given value converted based on its type
|
||||||
**/
|
**/
|
||||||
function _getTypeValue($type, $value) {
|
function _getTypeValue($type, $value) {
|
||||||
$value = trim($value);
|
$value = trim($value);
|
||||||
|
|
@ -134,8 +134,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 값을 return
|
* @brief Return value
|
||||||
* 원형 값을 HTML 결과물로 return
|
* return the original values for HTML result
|
||||||
**/
|
**/
|
||||||
function getValueHTML() {
|
function getValueHTML() {
|
||||||
$value = $this->_getTypeValue($this->type, $this->value);
|
$value = $this->_getTypeValue($this->type, $this->value);
|
||||||
|
|
@ -174,7 +174,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief type에 따른 form을 리턴
|
* @brief return a form based on its type
|
||||||
**/
|
**/
|
||||||
function getFormHTML() {
|
function getFormHTML() {
|
||||||
static $id_num = 1000;
|
static $id_num = 1000;
|
||||||
|
|
@ -188,17 +188,15 @@
|
||||||
|
|
||||||
$buff = '';
|
$buff = '';
|
||||||
switch($type) {
|
switch($type) {
|
||||||
// 홈페이지 주소
|
// Homepage
|
||||||
case 'homepage' :
|
case 'homepage' :
|
||||||
$buff .= '<input type="text" name="'.$column_name.'" value="'.$value.'" class="homepage" />';
|
$buff .= '<input type="text" name="'.$column_name.'" value="'.$value.'" class="homepage" />';
|
||||||
break;
|
break;
|
||||||
|
// Email Address
|
||||||
// Email 주소
|
|
||||||
case 'email_address' :
|
case 'email_address' :
|
||||||
$buff .= '<input type="text" name="'.$column_name.'" value="'.$value.'" class="email_address" />';
|
$buff .= '<input type="text" name="'.$column_name.'" value="'.$value.'" class="email_address" />';
|
||||||
break;
|
break;
|
||||||
|
// Phone Number
|
||||||
// 전화번호
|
|
||||||
case 'tel' :
|
case 'tel' :
|
||||||
$buff .=
|
$buff .=
|
||||||
'<input type="text" name="'.$column_name.'" value="'.$value[0].'" size="4" class="tel" />'.
|
'<input type="text" name="'.$column_name.'" value="'.$value[0].'" size="4" class="tel" />'.
|
||||||
|
|
@ -210,8 +208,7 @@
|
||||||
case 'textarea' :
|
case 'textarea' :
|
||||||
$buff .= '<textarea name="'.$column_name.'" class="textarea">'.$value.'</textarea>';
|
$buff .= '<textarea name="'.$column_name.'" class="textarea">'.$value.'</textarea>';
|
||||||
break;
|
break;
|
||||||
|
// multiple choice
|
||||||
// 다중 선택
|
|
||||||
case 'checkbox' :
|
case 'checkbox' :
|
||||||
$buff .= '<ul>';
|
$buff .= '<ul>';
|
||||||
foreach($default as $v) {
|
foreach($default as $v) {
|
||||||
|
|
@ -225,8 +222,7 @@
|
||||||
}
|
}
|
||||||
$buff .= '</ul>';
|
$buff .= '</ul>';
|
||||||
break;
|
break;
|
||||||
|
// single choice
|
||||||
// 단일 선택
|
|
||||||
case 'select' :
|
case 'select' :
|
||||||
$buff .= '<select name="'.$column_name.'" class="select">';
|
$buff .= '<select name="'.$column_name.'" class="select">';
|
||||||
foreach($default as $v) {
|
foreach($default as $v) {
|
||||||
|
|
@ -251,8 +247,7 @@
|
||||||
}
|
}
|
||||||
$buff .= '</ul>';
|
$buff .= '</ul>';
|
||||||
break;
|
break;
|
||||||
|
// date
|
||||||
// 날짜 입력
|
|
||||||
case 'date' :
|
case 'date' :
|
||||||
// datepicker javascript plugin load
|
// datepicker javascript plugin load
|
||||||
Context::loadJavascriptPlugin('ui.datepicker');
|
Context::loadJavascriptPlugin('ui.datepicker');
|
||||||
|
|
@ -272,8 +267,7 @@
|
||||||
'})(jQuery);'."\n".
|
'})(jQuery);'."\n".
|
||||||
'</script>';
|
'</script>';
|
||||||
break;
|
break;
|
||||||
|
// address
|
||||||
// 주소 입력
|
|
||||||
case "kr_zip" :
|
case "kr_zip" :
|
||||||
// krzip address javascript plugin load
|
// krzip address javascript plugin load
|
||||||
Context::loadJavascriptPlugin('ui.krzip');
|
Context::loadJavascriptPlugin('ui.krzip');
|
||||||
|
|
@ -298,8 +292,7 @@
|
||||||
'<input type="text" name="'.$column_name.'" value="'.htmlspecialchars($value[1]).'" class="address" />'.
|
'<input type="text" name="'.$column_name.'" value="'.htmlspecialchars($value[1]).'" class="address" />'.
|
||||||
'';
|
'';
|
||||||
break;
|
break;
|
||||||
|
// General text
|
||||||
// 일반 text
|
|
||||||
default :
|
default :
|
||||||
$buff .=' <input type="text" name="'.$column_name.'" value="'.$value.'" class="text" />';
|
$buff .=' <input type="text" name="'.$column_name.'" value="'.$value.'" class="text" />';
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -30,8 +30,7 @@
|
||||||
$source_dir = FileHandler::getRealPath($source_dir);
|
$source_dir = FileHandler::getRealPath($source_dir);
|
||||||
$target_dir = FileHandler::getRealPath($target_dir);
|
$target_dir = FileHandler::getRealPath($target_dir);
|
||||||
if(!is_dir($source_dir)) return false;
|
if(!is_dir($source_dir)) return false;
|
||||||
|
// generate when no target exists
|
||||||
// target이 없을땐 생성
|
|
||||||
if(!file_exists($target_dir)) FileHandler::makeDir($target_dir);
|
if(!file_exists($target_dir)) FileHandler::makeDir($target_dir);
|
||||||
|
|
||||||
if(substr($source_dir, -1) != '/') $source_dir .= '/';
|
if(substr($source_dir, -1) != '/') $source_dir .= '/';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* @brief 메일 발송
|
* @brief Mailing
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@
|
||||||
/**
|
/**
|
||||||
* @brief sett to set the template path for refresh.html
|
* @brief sett to set the template path for refresh.html
|
||||||
* @remark refresh.html is executed as a result of method execution
|
* @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() {
|
function setRefreshPage() {
|
||||||
$this->setTemplatePath('./common/tpl');
|
$this->setTemplatePath('./common/tpl');
|
||||||
|
|
@ -76,21 +76,18 @@
|
||||||
* @param[in] $xml_info object containing module description
|
* @param[in] $xml_info object containing module description
|
||||||
**/
|
**/
|
||||||
function setModuleInfo($module_info, $xml_info) {
|
function setModuleInfo($module_info, $xml_info) {
|
||||||
// 기본 변수 설정
|
// The default variable settings
|
||||||
$this->mid = $module_info->mid;
|
$this->mid = $module_info->mid;
|
||||||
$this->module_srl = $module_info->module_srl;
|
$this->module_srl = $module_info->module_srl;
|
||||||
$this->module_info = $module_info;
|
$this->module_info = $module_info;
|
||||||
$this->xml_info = $xml_info;
|
$this->xml_info = $xml_info;
|
||||||
$this->skin_vars = $module_info->skin_vars;
|
$this->skin_vars = $module_info->skin_vars;
|
||||||
|
// validate certificate info and permission settings necessary in Web-services
|
||||||
// 웹서비스에서 꼭 필요한 인증 정보와 권한 설정 체크
|
|
||||||
$is_logged = Context::get('is_logged');
|
$is_logged = Context::get('is_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// module model create an object
|
||||||
// module model 객체 생성
|
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
// permission settings. access, manager(== is_admin) are fixed and privilege name in XE
|
||||||
// XE에서 access, manager (== is_admin) 는 고정된 권한명이며 이와 관련된 권한 설정
|
|
||||||
$module_srl = Context::get('module_srl');
|
$module_srl = Context::get('module_srl');
|
||||||
if(!$module_info->mid && preg_match('/^([0-9]+)$/',$module_srl)) {
|
if(!$module_info->mid && preg_match('/^([0-9]+)$/',$module_srl)) {
|
||||||
$request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
$request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
||||||
|
|
@ -100,19 +97,15 @@
|
||||||
} else {
|
} else {
|
||||||
$grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info);
|
$grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info);
|
||||||
}
|
}
|
||||||
|
// display no permission if the current module doesn't have an access privilege
|
||||||
// 현재 모듈의 access 권한이 없으면 권한 없음 표시
|
|
||||||
//if(!$grant->access) return $this->stop("msg_not_permitted");
|
//if(!$grant->access) return $this->stop("msg_not_permitted");
|
||||||
|
// checks permission and action if you don't have an admin privilege
|
||||||
// 관리 권한이 없으면 permision, action 확인
|
|
||||||
if(!$grant->manager) {
|
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};
|
$permission_target = $xml_info->permission->{$this->act};
|
||||||
|
// check manager if a permission in module.xml otherwise action if no permission
|
||||||
// module.xml에 명시된 퍼미션이 없을때 action명에 Admin이 있으면 manager로 체크
|
|
||||||
if(!$permission_target && substr_count($this->act, 'Admin')) $permission_target = 'manager';
|
if(!$permission_target && substr_count($this->act, 'Admin')) $permission_target = 'manager';
|
||||||
|
// Check permissions
|
||||||
// 권한 체크
|
|
||||||
switch($permission_target) {
|
switch($permission_target) {
|
||||||
case 'root' :
|
case 'root' :
|
||||||
$this->stop('msg_not_permitted_act');
|
$this->stop('msg_not_permitted_act');
|
||||||
|
|
@ -125,8 +118,7 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// permission variable settings
|
||||||
// 권한변수 설정
|
|
||||||
$this->grant = $grant;
|
$this->grant = $grant;
|
||||||
Context::set('grant', $grant);
|
Context::set('grant', $grant);
|
||||||
|
|
||||||
|
|
@ -138,14 +130,12 @@
|
||||||
* @param $msg_code an error code
|
* @param $msg_code an error code
|
||||||
**/
|
**/
|
||||||
function stop($msg_code) {
|
function stop($msg_code) {
|
||||||
// proc 수행을 중지 시키기 위한 플래그 세팅
|
// flag setting to stop the proc processing
|
||||||
$this->stop_proc = true;
|
$this->stop_proc = true;
|
||||||
|
// Error handling
|
||||||
// 에러 처리
|
|
||||||
$this->setError(-1);
|
$this->setError(-1);
|
||||||
$this->setMessage($msg_code);
|
$this->setMessage($msg_code);
|
||||||
|
// Error message display by message module
|
||||||
// message 모듈의 에러 표시
|
|
||||||
$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
|
$type = Mobile::isFromMobilePhone() ? 'mobile' : 'view';
|
||||||
$oMessageObject = &ModuleHandler::getModuleInstance('message',$type);
|
$oMessageObject = &ModuleHandler::getModuleInstance('message',$type);
|
||||||
$oMessageObject->setError(-1);
|
$oMessageObject->setError(-1);
|
||||||
|
|
@ -241,7 +231,7 @@
|
||||||
*
|
*
|
||||||
**/
|
**/
|
||||||
function proc() {
|
function proc() {
|
||||||
// stop_proc==true이면 그냥 패스
|
// pass if stop_proc is true
|
||||||
if($this->stop_proc) return false;
|
if($this->stop_proc) return false;
|
||||||
|
|
||||||
// trigger call
|
// trigger call
|
||||||
|
|
@ -252,23 +242,20 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// addon 실행(called_position 를 before_module_proc로 하여 호출)
|
// execute an addon(call called_position as before_module_proc)
|
||||||
$called_position = 'before_module_proc';
|
$called_position = 'before_module_proc';
|
||||||
$oAddonController = &getController('addon');
|
$oAddonController = &getController('addon');
|
||||||
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
|
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
|
||||||
@include($addon_file);
|
@include($addon_file);
|
||||||
|
|
||||||
if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) {
|
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");
|
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 = &getModel('module');
|
||||||
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
|
$oModuleModel->syncSkinInfoToModuleInfo($this->module_info);
|
||||||
Context::set('module_info', $this->module_info);
|
Context::set('module_info', $this->module_info);
|
||||||
|
// Run
|
||||||
// 실행
|
|
||||||
$output = $this->{$this->act}();
|
$output = $this->{$this->act}();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
@ -283,7 +270,7 @@
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// addon 실행(called_position 를 after_module_proc로 하여 호출)
|
// execute an addon(call called_position as after_module_proc)
|
||||||
$called_position = 'after_module_proc';
|
$called_position = 'after_module_proc';
|
||||||
$oAddonController = &getController('addon');
|
$oAddonController = &getController('addon');
|
||||||
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
|
$addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc");
|
||||||
|
|
@ -294,8 +281,7 @@
|
||||||
$this->setMessage($output->getMessage());
|
$this->setMessage($output->getMessage());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
// execute api methos of the module if view action is and result is XMLRPC or JSON
|
||||||
// view action이고 결과 출력이 XMLRPC 또는 JSON일 경우 해당 모듈의 api method를 실행
|
|
||||||
if($this->module_info->module_type == 'view'){
|
if($this->module_info->module_type == 'view'){
|
||||||
if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') {
|
if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') {
|
||||||
$oAPI = getAPI($this->module_info->module, 'api');
|
$oAPI = getAPI($this->module_info->module, 'api');
|
||||||
|
|
@ -304,7 +290,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9,10 +9,10 @@
|
||||||
|
|
||||||
class Object {
|
class Object {
|
||||||
|
|
||||||
var $error = 0; ///< 에러 코드 (0이면 에러 아님)
|
var $error = 0; // / "Error code (if 0, it is not an error)
|
||||||
var $message = 'success'; ///< 에러 메세지 (success이면 에러 아님)
|
var $message = 'success'; // / "Error message (if success, it is not an error)
|
||||||
|
|
||||||
var $variables = array(); ///< 추가 변수
|
var $variables = array(); // /< an additional variable
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief constructor
|
* @brief constructor
|
||||||
|
|
|
||||||
|
|
@ -151,22 +151,22 @@
|
||||||
// replace value of src in img/input/script tag
|
// replace value of src in img/input/script tag
|
||||||
$buff = preg_replace_callback('/<(img|input|script)([^>]*)src="([^"]*?)"/is', array($this, '_replacePath'), $buff);
|
$buff = preg_replace_callback('/<(img|input|script)([^>]*)src="([^"]*?)"/is', array($this, '_replacePath'), $buff);
|
||||||
|
|
||||||
// loop 템플릿 문법을 변환
|
// replace the loop template syntax
|
||||||
$buff = $this->_replaceLoop($buff);
|
$buff = $this->_replaceLoop($buff);
|
||||||
|
|
||||||
// cond 템플릿 문법을 변환
|
// |replace the cond template syntax
|
||||||
$buff = $this->_replaceCond($buff);
|
$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);
|
$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);
|
$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);
|
$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);
|
$buff = preg_replace('/<block([ ]*)>|<\/block>/is','',$buff);
|
||||||
|
|
||||||
// replace include <!--#include($filename)-->
|
// replace include <!--#include($filename)-->
|
||||||
|
|
@ -190,7 +190,7 @@
|
||||||
// replace variables
|
// replace variables
|
||||||
$buff = preg_replace_callback('/\{[^@^ ]([^\{\}\n]+)\}/i', array($this, '_compileVarToContext'), $buff);
|
$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);
|
$buff = $this->_replaceVarInPHP($buff);
|
||||||
|
|
||||||
// replace parts not displaying results
|
// replace parts not displaying results
|
||||||
|
|
@ -246,7 +246,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief loop 문법의 변환
|
* @brief replace loop syntax
|
||||||
**/
|
**/
|
||||||
function _replaceLoop($buff)
|
function _replaceLoop($buff)
|
||||||
{
|
{
|
||||||
|
|
@ -331,7 +331,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief pipe cond, |cond= 의 변환
|
* @brief replace pipe cond and |cond=
|
||||||
**/
|
**/
|
||||||
function _replacePipeCond($matches)
|
function _replacePipeCond($matches)
|
||||||
{
|
{
|
||||||
|
|
@ -346,7 +346,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief cond 문법의 변환
|
* @brief replace cond syntax
|
||||||
**/
|
**/
|
||||||
function _replaceCond($buff)
|
function _replaceCond($buff)
|
||||||
{
|
{
|
||||||
|
|
@ -406,7 +406,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 다른 template파일을 include하는 include tag의 변환
|
* @brief replace include tags which include other template files
|
||||||
**/
|
**/
|
||||||
function _replaceInclude($matches)
|
function _replaceInclude($matches)
|
||||||
{
|
{
|
||||||
|
|
@ -442,7 +442,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief load 태그의 변환
|
* @brief replace load tags
|
||||||
**/
|
**/
|
||||||
function _replaceLoad($matches) {
|
function _replaceLoad($matches) {
|
||||||
$output = $matches[0];
|
$output = $matches[0];
|
||||||
|
|
@ -539,7 +539,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief $문자 의 PHP 변수 변환
|
* @brief replace PHP variables of $ character
|
||||||
**/
|
**/
|
||||||
function _replaceVarInPHP($buff) {
|
function _replaceVarInPHP($buff) {
|
||||||
$head = $tail = '';
|
$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)
|
function _replaceVarString($matches)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -12,11 +12,11 @@
|
||||||
* <form> <-- code to validate data in the form
|
* <form> <-- code to validate data in the form
|
||||||
* <node target="name" required="true" minlength="1" maxlength="5" filter="email,userid,alpha,number" equalto="target" />
|
* <node target="name" required="true" minlength="1" maxlength="5" filter="email,userid,alpha,number" equalto="target" />
|
||||||
* </form>
|
* </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" />
|
* <param name="key" target="target" />
|
||||||
* </parameter>
|
* </parameter>
|
||||||
* <response callback_func="callback 받게 될 js function 이름 지정" > <-- 서버에 ajax로 전송하여 받을 결과값
|
* <response callback_func="specifying the name of js function to callback" > "- Result to get by sending ajax to the server
|
||||||
* <tag name="error" /> <-- error이름의 결과값을 받겠다는 것
|
* <tag name="error" /> <- get the result of error name
|
||||||
* </response>
|
* </response>
|
||||||
* </filter>
|
* </filter>
|
||||||
* }
|
* }
|
||||||
|
|
@ -36,7 +36,7 @@
|
||||||
*
|
*
|
||||||
* - parameter - param
|
* - parameter - param
|
||||||
* name = key : indicate that a new array, 'key' will be created and a value will be assigned to it
|
* 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
|
* - response
|
||||||
* tag = key : name of variable that will contain the result of the execution
|
* tag = key : name of variable that will contain the result of the execution
|
||||||
|
|
@ -45,9 +45,9 @@
|
||||||
|
|
||||||
class XmlJsFilter extends XmlParser {
|
class XmlJsFilter extends XmlParser {
|
||||||
var $version = '0.2.5';
|
var $version = '0.2.5';
|
||||||
var $compiled_path = './files/cache/js_filter_compiled/'; ///< 컴파일된 캐시 파일이 놓일 위치
|
var $compiled_path = './files/cache/js_filter_compiled/'; // / directory path for compiled cache file
|
||||||
var $xml_file = NULL; ///< 대상 xml 파일
|
var $xml_file = NULL; // / Target xml file
|
||||||
var $js_file = NULL; ///< 컴파일된 js 파일
|
var $js_file = NULL; // / Compiled js file
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief constructor
|
* @brief constructor
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
function _compile() {
|
function _compile() {
|
||||||
global $lang;
|
global $lang;
|
||||||
|
|
||||||
// xml 파일을 읽음
|
// read xml file
|
||||||
$buff = FileHandler::readFile($this->xml_file);
|
$buff = FileHandler::readFile($this->xml_file);
|
||||||
|
|
||||||
// xml parsing
|
// xml parsing
|
||||||
|
|
@ -84,7 +84,7 @@
|
||||||
$attrs = $xml_obj->filter->attrs;
|
$attrs = $xml_obj->filter->attrs;
|
||||||
$rules = $xml_obj->filter->rules;
|
$rules = $xml_obj->filter->rules;
|
||||||
|
|
||||||
// XmlJsFilter는 filter_name, field, parameter 3개의 데이터를 핸들링
|
// XmlJsFilter handles three data; filter_name, field, and parameter
|
||||||
$filter_name = $attrs->name;
|
$filter_name = $attrs->name;
|
||||||
$confirm_msg_code = $attrs->confirm_msg_code;
|
$confirm_msg_code = $attrs->confirm_msg_code;
|
||||||
$module = $attrs->module;
|
$module = $attrs->module;
|
||||||
|
|
@ -101,27 +101,27 @@
|
||||||
$response_tag = $xml_obj->filter->response->tag;
|
$response_tag = $xml_obj->filter->response->tag;
|
||||||
if($response_tag && !is_array($response_tag)) $response_tag = array($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) {
|
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';
|
$this->js_file .= '.nocache.js';
|
||||||
|
|
||||||
// extend_filter는 module.method 로 지칭되어 이를 분리
|
// Separate the extend_filter
|
||||||
list($module_name, $method) = explode('.',$extend_filter);
|
list($module_name, $method) = explode('.',$extend_filter);
|
||||||
|
|
||||||
// 모듈 이름과 method가 있을 경우 진행
|
// contibue if both module_name and methos exist.
|
||||||
if($module_name&&$method) {
|
if($module_name&&$method) {
|
||||||
// 해당 module의 model 객체를 받음
|
// get model object of the module
|
||||||
$oExtendFilter = &getModel($module_name);
|
$oExtendFilter = &getModel($module_name);
|
||||||
|
|
||||||
// method가 존재하면 실행
|
// execute if method exists
|
||||||
if(method_exists($oExtendFilter, $method)) {
|
if(method_exists($oExtendFilter, $method)) {
|
||||||
// 결과를 받음
|
// get the result
|
||||||
$extend_filter_list = $oExtendFilter->{$method}(true);
|
$extend_filter_list = $oExtendFilter->{$method}(true);
|
||||||
$extend_filter_count = count($extend_filter_list);
|
$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++) {
|
for($i=0; $i < $extend_filter_count; $i++) {
|
||||||
$name = $extend_filter_list[$i]->name;
|
$name = $extend_filter_list[$i]->name;
|
||||||
$lang_value = $extend_filter_list[$i]->lang;
|
$lang_value = $extend_filter_list[$i]->lang;
|
||||||
|
|
@ -132,7 +132,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 언어 입력을 위한 사용되는 필드 조사
|
// search the field to be used for entering language
|
||||||
$target_list = array();
|
$target_list = array();
|
||||||
$target_type_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);
|
$node_count = count($field_node);
|
||||||
if($node_count) {
|
if($node_count) {
|
||||||
foreach($field_node as $key =>$node) {
|
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');
|
$rule_types = array('homepage'=>'homepage', 'email_address'=>'email');
|
||||||
|
|
||||||
for($i=0;$i<$extend_filter_count;$i++) {
|
for($i=0;$i<$extend_filter_count;$i++) {
|
||||||
|
|
@ -188,7 +188,7 @@
|
||||||
|
|
||||||
if(!$target) continue;
|
if(!$target) continue;
|
||||||
|
|
||||||
// extend filter item의 type으로 rule을 구함
|
// get the filter from the type of extend filter item
|
||||||
$type = $filter_item->type;
|
$type = $filter_item->type;
|
||||||
$rule = $rule_types[$type]?$rule_types[$type]:'';
|
$rule = $rule_types[$type]?$rule_types[$type]:'';
|
||||||
$required = ($filter_item->required == 'true');
|
$required = ($filter_item->required == 'true');
|
||||||
|
|
@ -202,11 +202,11 @@
|
||||||
if(!$target_type_list[$target]) $target_type_list[$target] = $type;
|
if(!$target_type_list[$target]) $target_type_list[$target] = $type;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 데이터를 만들기 위한 parameter script 생성
|
// generates parameter script to create dbata
|
||||||
$rename_params = array();
|
$rename_params = array();
|
||||||
$parameter_count = count($parameter_param);
|
$parameter_count = count($parameter_param);
|
||||||
if($parameter_count) {
|
if($parameter_count) {
|
||||||
// 기본 필터 내용의 parameter로 구성
|
// contains parameter of the default filter contents
|
||||||
foreach($parameter_param as $key =>$param) {
|
foreach($parameter_param as $key =>$param) {
|
||||||
$attrs = $param->attrs;
|
$attrs = $param->attrs;
|
||||||
$name = trim($attrs->name);
|
$name = trim($attrs->name);
|
||||||
|
|
@ -217,7 +217,7 @@
|
||||||
if($name && !in_array($name, $target_list)) $target_list[] = $name;
|
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++) {
|
for($i=0;$i<$extend_filter_count;$i++) {
|
||||||
$filter_item = $extend_filter_list[$i];
|
$filter_item = $extend_filter_list[$i];
|
||||||
$target = $name = trim($filter_item->name);
|
$target = $name = trim($filter_item->name);
|
||||||
|
|
@ -227,7 +227,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// response script 생성
|
// generates the response script
|
||||||
$response_count = count($response_tag);
|
$response_count = count($response_tag);
|
||||||
$responses = array();
|
$responses = array();
|
||||||
for($i=0;$i<$response_count;$i++) {
|
for($i=0;$i<$response_count;$i++) {
|
||||||
|
|
@ -236,7 +236,7 @@
|
||||||
$responses[] = "'{$name}'";
|
$responses[] = "'{$name}'";
|
||||||
}
|
}
|
||||||
|
|
||||||
// lang : form field description
|
// writes lang values of the form field
|
||||||
$target_count = count($target_list);
|
$target_count = count($target_list);
|
||||||
for($i=0;$i<$target_count;$i++) {
|
for($i=0;$i<$target_count;$i++) {
|
||||||
$target = $target_list[$i];
|
$target = $target_list[$i];
|
||||||
|
|
@ -244,7 +244,7 @@
|
||||||
$js_messages[] = sprintf("v.cast('ADD_MESSAGE',['%s','%s']);", $target, addslashes($lang->{$target}));
|
$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);
|
$target_type_count = count($target_type_list);
|
||||||
if($target_type_count) {
|
if($target_type_count) {
|
||||||
|
|
@ -254,7 +254,7 @@
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// lang : error message
|
// writes error messages
|
||||||
foreach($lang->filter as $key => $val) {
|
foreach($lang->filter as $key => $val) {
|
||||||
if(!$val) $val = $key;
|
if(!$val) $val = $key;
|
||||||
$js_messages[] = sprintf("v.cast('ADD_MESSAGE',['%s','%s']);", $key, $val);
|
$js_messages[] = sprintf("v.cast('ADD_MESSAGE',['%s','%s']);", $key, $val);
|
||||||
|
|
@ -276,7 +276,7 @@
|
||||||
$jsdoc[] = '})(jQuery);';
|
$jsdoc[] = '})(jQuery);';
|
||||||
$jsdoc = implode("\n", $jsdoc);
|
$jsdoc = implode("\n", $jsdoc);
|
||||||
|
|
||||||
// js파일 생성
|
// generates the js file
|
||||||
FileHandler::writeFile($this->js_file, $jsdoc);
|
FileHandler::writeFile($this->js_file, $jsdoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -19,10 +19,10 @@
|
||||||
var $input = NULL; ///< input xml
|
var $input = NULL; ///< input xml
|
||||||
var $output = array(); ///< output object
|
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
|
* @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
|
* @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
|
* @return Returns a resultant data object or NULL in case of error
|
||||||
**/
|
**/
|
||||||
function parse($input = '') {
|
function parse($input = '') {
|
||||||
// 디버그를 위한 컴파일 시작 시간 저장
|
// Save the compile starting time for debugging
|
||||||
if(__DEBUG__==3) $start = getMicroTime();
|
if(__DEBUG__==3) $start = getMicroTime();
|
||||||
|
|
||||||
$this->lang = Context::getLangType();
|
$this->lang = Context::getLangType();
|
||||||
|
|
@ -48,12 +48,12 @@
|
||||||
$this->input = $input?$input:$GLOBALS['HTTP_RAW_POST_DATA'];
|
$this->input = $input?$input:$GLOBALS['HTTP_RAW_POST_DATA'];
|
||||||
$this->input = str_replace(array('',''),array('',''),$this->input);
|
$this->input = str_replace(array('',''),array('',''),$this->input);
|
||||||
|
|
||||||
// 지원언어 종류를 뽑음
|
// extracts a supported language
|
||||||
preg_match_all("/xml:lang=\"([^\"].+)\"/i", $this->input, $matches);
|
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])) {
|
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($this->lang, $supported_lang)) {
|
||||||
if(in_array('en', $supported_lang)) {
|
if(in_array('en', $supported_lang)) {
|
||||||
$this->lang = 'en';
|
$this->lang = 'en';
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
$this->lang = array_shift($supported_lang);
|
$this->lang = array_shift($supported_lang);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 특별한 언어가 지정되지 않았다면 언어체크를 하지 않음
|
// uncheck the language if no specific language is set.
|
||||||
} else {
|
} else {
|
||||||
unset($this->lang);
|
unset($this->lang);
|
||||||
}
|
}
|
||||||
|
|
@ -78,8 +78,7 @@
|
||||||
if(!count($this->output)) return;
|
if(!count($this->output)) return;
|
||||||
|
|
||||||
$output = array_shift($this->output);
|
$output = array_shift($this->output);
|
||||||
|
// Save compile starting time for debugging
|
||||||
// 디버그를 위한 컴파일 시작 시간 저장
|
|
||||||
if(__DEBUG__==3) $GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start;
|
if(__DEBUG__==3) $GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start;
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
* @remarks {there should be a way to report an error}
|
* @remarks {there should be a way to report an error}
|
||||||
**/
|
**/
|
||||||
function parse($query_id, $xml_file, $cache_file) {
|
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);
|
$buff = FileHandler::readFile($xml_file);
|
||||||
$xml_obj = parent::parse($buff);
|
$xml_obj = parent::parse($buff);
|
||||||
if(!$xml_obj) return;
|
if(!$xml_obj) return;
|
||||||
|
|
@ -40,12 +40,10 @@
|
||||||
$module = $id_args[1];
|
$module = $id_args[1];
|
||||||
$id = $id_args[2];
|
$id = $id_args[2];
|
||||||
}
|
}
|
||||||
|
// actions like insert, update, delete, select and so on
|
||||||
// insert, update, delete, select등의 action
|
|
||||||
$action = strtolower($xml_obj->query->attrs->action);
|
$action = strtolower($xml_obj->query->attrs->action);
|
||||||
if(!$action) return;
|
if(!$action) return;
|
||||||
|
// get the table list(converting an array code)
|
||||||
// 테이블 정리 (배열코드로 변환)
|
|
||||||
$tables = $xml_obj->query->tables->table;
|
$tables = $xml_obj->query->tables->table;
|
||||||
$output->left_tables = array();
|
$output->left_tables = array();
|
||||||
|
|
||||||
|
|
@ -54,8 +52,7 @@
|
||||||
if(!$tables) return;
|
if(!$tables) return;
|
||||||
if(!is_array($tables)) $tables = array($tables);
|
if(!is_array($tables)) $tables = array($tables);
|
||||||
foreach($tables as $key => $val) {
|
foreach($tables as $key => $val) {
|
||||||
|
// get the name of tables and aliases
|
||||||
// 테이블과 alias의 이름을 구함
|
|
||||||
$table_name = $val->attrs->name;
|
$table_name = $val->attrs->name;
|
||||||
$alias = $val->attrs->alias;
|
$alias = $val->attrs->alias;
|
||||||
if(!$alias) $alias = $table_name;
|
if(!$alias) $alias = $table_name;
|
||||||
|
|
@ -66,8 +63,7 @@
|
||||||
$output->left_tables[$alias] = $val->attrs->type;
|
$output->left_tables[$alias] = $val->attrs->type;
|
||||||
$left_conditions[$alias] = $val->conditions;
|
$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);
|
$table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name);
|
||||||
if(!file_exists($table_file)) {
|
if(!file_exists($table_file)) {
|
||||||
$searched_list = FileHandler::readDir(_XE_PATH_.'modules');
|
$searched_list = FileHandler::readDir(_XE_PATH_.'modules');
|
||||||
|
|
@ -93,9 +89,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Column list
|
||||||
|
|
||||||
// 컬럼 정리
|
|
||||||
$columns = $xml_obj->query->columns->column;
|
$columns = $xml_obj->query->columns->column;
|
||||||
$out = $this->_setColumn($columns);
|
$out = $this->_setColumn($columns);
|
||||||
$output->columns = $out->columns;
|
$output->columns = $out->columns;
|
||||||
|
|
@ -114,8 +108,7 @@
|
||||||
$group_list = $xml_obj->query->groups->group;
|
$group_list = $xml_obj->query->groups->group;
|
||||||
$out = $this->_setGroup($group_list);
|
$out = $this->_setGroup($group_list);
|
||||||
$output->groups = $out->groups;
|
$output->groups = $out->groups;
|
||||||
|
// Navigation
|
||||||
// 네비게이션 정리
|
|
||||||
$out = $this->_setNavigation($xml_obj);
|
$out = $this->_setNavigation($xml_obj);
|
||||||
$output->order = $out->order;
|
$output->order = $out->order;
|
||||||
$output->list_count = $out->list_count;
|
$output->list_count = $out->list_count;
|
||||||
|
|
@ -132,8 +125,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$buff .= ' );'."\n";
|
$buff .= ' );'."\n";
|
||||||
|
// generates a php script
|
||||||
// php script 생성
|
|
||||||
$buff .= '$output->_tables = array( ';
|
$buff .= '$output->_tables = array( ';
|
||||||
foreach($output->tables as $key => $val) {
|
foreach($output->tables as $key => $val) {
|
||||||
$buff .= sprintf('"%s"=>"%s",', $key, $val);
|
$buff .= sprintf('"%s"=>"%s",', $key, $val);
|
||||||
|
|
@ -147,22 +139,19 @@
|
||||||
}
|
}
|
||||||
$buff .= ' );'."\n";
|
$buff .= ' );'."\n";
|
||||||
}
|
}
|
||||||
|
// column info
|
||||||
// column 정리
|
|
||||||
if($column_count) {
|
if($column_count) {
|
||||||
$buff .= '$output->columns = array ( ';
|
$buff .= '$output->columns = array ( ';
|
||||||
$buff .= $this->_getColumn($output->columns);
|
$buff .= $this->_getColumn($output->columns);
|
||||||
$buff .= ' );'."\n";
|
$buff .= ' );'."\n";
|
||||||
}
|
}
|
||||||
|
// get conditions
|
||||||
// conditions 정리
|
|
||||||
if($condition_count) {
|
if($condition_count) {
|
||||||
$buff .= '$output->conditions = array ( ';
|
$buff .= '$output->conditions = array ( ';
|
||||||
$buff .= $this->_getConditions($output->conditions);
|
$buff .= $this->_getConditions($output->conditions);
|
||||||
$buff .= ' );'."\n";
|
$buff .= ' );'."\n";
|
||||||
}
|
}
|
||||||
|
// get conditions
|
||||||
// conditions 정리
|
|
||||||
if(count($output->left_conditions)) {
|
if(count($output->left_conditions)) {
|
||||||
$buff .= '$output->left_conditions = array ( ';
|
$buff .= '$output->left_conditions = array ( ';
|
||||||
foreach($output->left_conditions as $key => $val){
|
foreach($output->left_conditions as $key => $val){
|
||||||
|
|
@ -173,7 +162,7 @@
|
||||||
$buff .= ' );'."\n";
|
$buff .= ' );'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// args 변수 확인
|
// get arguments
|
||||||
$arg_list = $this->getArguments();
|
$arg_list = $this->getArguments();
|
||||||
if($arg_list)
|
if($arg_list)
|
||||||
{
|
{
|
||||||
|
|
@ -184,7 +173,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// order 정리
|
// order
|
||||||
if($output->order) {
|
if($output->order) {
|
||||||
$buff .= '$output->order = array(';
|
$buff .= '$output->order = array(';
|
||||||
foreach($output->order as $key => $val) {
|
foreach($output->order as $key => $val) {
|
||||||
|
|
@ -193,22 +182,22 @@
|
||||||
$buff .= ');'."\n";
|
$buff .= ');'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// list_count 정리
|
// list_count
|
||||||
if($output->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");
|
$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) {
|
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");
|
$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) {
|
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");
|
$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) {
|
if($output->groups) {
|
||||||
$buff .= sprintf('$output->groups = array("%s");%s', implode('","',$output->groups),"\n");
|
$buff .= sprintf('$output->groups = array("%s");%s', implode('","',$output->groups),"\n");
|
||||||
}
|
}
|
||||||
|
|
@ -255,7 +244,7 @@
|
||||||
. $buff
|
. $buff
|
||||||
. 'return $output; ?>';
|
. 'return $output; ?>';
|
||||||
|
|
||||||
// 저장
|
// Save
|
||||||
FileHandler::writeFile($cache_file, $buff);
|
FileHandler::writeFile($cache_file, $buff);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -301,8 +290,7 @@
|
||||||
* @result Returns $output
|
* @result Returns $output
|
||||||
*/
|
*/
|
||||||
function _setConditions($conditions){
|
function _setConditions($conditions){
|
||||||
// 조건절 정리
|
// Conditional clause
|
||||||
|
|
||||||
$condition = $conditions->condition;
|
$condition = $conditions->condition;
|
||||||
if($condition) {
|
if($condition) {
|
||||||
$obj->condition = $condition;
|
$obj->condition = $condition;
|
||||||
|
|
@ -344,7 +332,7 @@
|
||||||
* @result Returns $output
|
* @result Returns $output
|
||||||
*/
|
*/
|
||||||
function _setGroup($group_list){
|
function _setGroup($group_list){
|
||||||
// group 정리
|
// group list
|
||||||
|
|
||||||
if($group_list) {
|
if($group_list) {
|
||||||
if(!is_array($group_list)) $group_list = array($group_list);
|
if(!is_array($group_list)) $group_list = array($group_list);
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
var filebox = {
|
var filebox = {
|
||||||
selected : null,
|
selected : null,
|
||||||
/**
|
/**
|
||||||
* 파일 박스 창 팝업
|
* pop up the file box
|
||||||
*/
|
*/
|
||||||
open : function(input_obj, filter) {
|
open : function(input_obj, filter) {
|
||||||
this.selected = input_obj;
|
this.selected = input_obj;
|
||||||
|
|
@ -22,7 +22,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 파일 선택
|
* select a file
|
||||||
*/
|
*/
|
||||||
selectFile : function(file_url, module_filebox_srl){
|
selectFile : function(file_url, module_filebox_srl){
|
||||||
var target = $(opener.XE.filebox.selected);
|
var target = $(opener.XE.filebox.selected);
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 파일 선택 취소
|
* cancel
|
||||||
*/
|
*/
|
||||||
cancel : function(name) {
|
cancel : function(name) {
|
||||||
$('[name=' + name + ']').val('');
|
$('[name=' + name + ']').val('');
|
||||||
|
|
@ -46,7 +46,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 파일 삭제
|
* delete a file
|
||||||
*/
|
*/
|
||||||
deleteFile : function(module_filebox_srl){
|
deleteFile : function(module_filebox_srl){
|
||||||
var params = {
|
var params = {
|
||||||
|
|
@ -57,7 +57,7 @@
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 초기화
|
* initialize
|
||||||
*/
|
*/
|
||||||
init : function(name) {
|
init : function(name) {
|
||||||
var file;
|
var file;
|
||||||
|
|
@ -76,7 +76,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// XE에 담기
|
// put the file into XE
|
||||||
$.extend(window.XE, {'filebox' : filebox});
|
$.extend(window.XE, {'filebox' : filebox});
|
||||||
|
|
||||||
}) (jQuery);
|
}) (jQuery);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @file config/config.inc.php
|
* @file config/config.inc.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @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);
|
@error_reporting(E_ALL ^ E_NOTICE);
|
||||||
|
|
@ -10,13 +10,13 @@
|
||||||
if(!defined('__ZBXE__')) exit();
|
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');
|
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__)));
|
define('_XE_PATH_', str_replace('config/config.inc.php', '', str_replace('\\', '/', __FILE__)));
|
||||||
|
|
||||||
|
|
@ -26,8 +26,8 @@
|
||||||
ini_set('session.use_only_cookies', 0);
|
ini_set('session.use_only_cookies', 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 기본 설정에 우선하는 사용자 설정 파일
|
* @brief user configuration files which override the default settings
|
||||||
* config/config.user.inc.php 파일에 아래 내용을 저장하면 됨
|
* save the following information into config/config.user.inc.php
|
||||||
* <?php
|
* <?php
|
||||||
* define('__DEBUG__', 0);
|
* define('__DEBUG__', 0);
|
||||||
* define('__DEBUG_OUTPUT__', 0);
|
* define('__DEBUG_OUTPUT__', 0);
|
||||||
|
|
@ -45,75 +45,75 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 디버깅 메시지 출력 (비트 값)
|
* @brief output debug message(bit value)
|
||||||
* 0 : 디버그 메시지를 생성/ 출력하지 않음
|
* 0: generate debug messages/not display
|
||||||
* 1 : debugPrint() 함수를 통한 메시지 출력
|
* 1: display messages through debugPrint() function
|
||||||
* 2 : 소요시간, Request/Response info 출력
|
* 2: output execute time, Request/Response info
|
||||||
* 4 : DB 쿼리 내역 출력
|
* 4: output DB query history
|
||||||
**/
|
**/
|
||||||
if(!defined('__DEBUG__')) define('__DEBUG__', 0);
|
if(!defined('__DEBUG__')) define('__DEBUG__', 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 디버그 메세지의 출력 장소
|
* @brief output location of debug message
|
||||||
* 0 : files/_debug_message.php 에 연결하여 출력
|
* 0: connect to the files/_debug_message.php and output
|
||||||
* 1 : HTML 최하단에 주석으로 출력 (Response Method가 HTML 일 때)
|
* 1: HTML output as a comment on the bottom (when response method is the HTML)
|
||||||
* 2 : Firebug 콘솔에 출력 (PHP 4 & 5. Firebug/FirePHP 플러그인 필요)
|
* 2: Firebug console output (PHP 4 & 5. Firebug/FirePHP plug-in required)
|
||||||
**/
|
**/
|
||||||
if(!defined('__DEBUG_OUTPUT__')) define('__DEBUG_OUTPUT__', 0);
|
if(!defined('__DEBUG_OUTPUT__')) define('__DEBUG_OUTPUT__', 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief FirePHP 콘솔 및 브라우저 주석 출력 보안
|
* @brief output comments of the firePHP console and browser
|
||||||
* 0 : 제한 없음 (권장하지 않음)
|
* 0: No limit (not recommended)
|
||||||
* 1 : 지정한 IP 주소에만 허용
|
* 1: Allow only specified IP addresses
|
||||||
**/
|
**/
|
||||||
if(!defined('__DEBUG_PROTECT__')) define('__DEBUG_PROTECT__', 1);
|
if(!defined('__DEBUG_PROTECT__')) define('__DEBUG_PROTECT__', 1);
|
||||||
if(!defined('__DEBUG_PROTECT_IP__')) define('__DEBUG_PROTECT_IP__', '127.0.0.1');
|
if(!defined('__DEBUG_PROTECT_IP__')) define('__DEBUG_PROTECT_IP__', '127.0.0.1');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 오류 메세지 출력 정의
|
* @brief DB error message definition
|
||||||
* 0 : 출력하지 않음
|
* 0: No output
|
||||||
* 1 : files/_debug_db_query.php 에 연결하여 출력
|
* 1: files/_debug_db_query.php connected to the output
|
||||||
**/
|
**/
|
||||||
if(!defined('__DEBUG_DB_OUTPUT__')) define('__DEBUG_DB_OUTPUT__', 0);
|
if(!defined('__DEBUG_DB_OUTPUT__')) define('__DEBUG_DB_OUTPUT__', 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 쿼리중 정해진 시간을 넘기는 쿼리의 로그 남김
|
* @brief Query log for only timeout query among DB queries
|
||||||
* 0 : 로그를 남기지 않음
|
* 0: Do not leave a log
|
||||||
* 0 이상 : 단위를 초로 하여 지정된 초 이상의 실행시간이 걸린 쿼리를 로그로 남김
|
* = 0: leave a log when the slow query takes over specified seconds
|
||||||
* 로그파일은 ./files/_db_slow_query.php 파일로 저장됨
|
* Log file is saved as ./files/_db_slow_query.php file
|
||||||
**/
|
**/
|
||||||
if(!defined('__LOG_SLOW_QUERY__')) define('__LOG_SLOW_QUERY__', 0);
|
if(!defined('__LOG_SLOW_QUERY__')) define('__LOG_SLOW_QUERY__', 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB 쿼리 정보를 남김
|
* @brief Leave DB query information
|
||||||
* 0 : 쿼리에 정보를 추가하지 않음
|
* 0: Do not add information to the query
|
||||||
* 1 : XML Query ID를 쿼리 주석으로 남김
|
* 1: Comment the XML Query ID
|
||||||
**/
|
**/
|
||||||
if(!defined('__DEBUG_QUERY__')) define('__DEBUG_QUERY__', 0);
|
if(!defined('__DEBUG_QUERY__')) define('__DEBUG_QUERY__', 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ob_gzhandler를 이용한 압축 기능을 강제로 사용하거나 끄는 옵션
|
* @brief option to enable/disable a compression feature using ob_gzhandler
|
||||||
* 0 : 사용하지 않음
|
* 0: Not used
|
||||||
* 1 : 사용함
|
* 1: Enabled
|
||||||
* 대부분의 서버에서는 문제가 없는데 특정 서버군에서 압축전송시 IE에서 오동작을 일으키는경우가 있음
|
* Only particular servers may have a problem in IE browser when sending a compression
|
||||||
**/
|
**/
|
||||||
if(!defined('__OB_GZHANDLER_ENABLE__')) define('__OB_GZHANDLER_ENABLE__', 1);
|
if(!defined('__OB_GZHANDLER_ENABLE__')) define('__OB_GZHANDLER_ENABLE__', 1);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief php unit test (경로/tests/index.php) 의 실행 유무 지정
|
* @brief decide to use/not use the php unit test (Path/tests/index.php)
|
||||||
* 0 : 사용하지 않음
|
* 0: Not used
|
||||||
* 1 : 사용함
|
* 1: Enabled
|
||||||
**/
|
**/
|
||||||
if(!defined('__ENABLE_PHPUNIT_TEST__')) define('__ENABLE_PHPUNIT_TEST__', 0);
|
if(!defined('__ENABLE_PHPUNIT_TEST__')) define('__ENABLE_PHPUNIT_TEST__', 0);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief __PROXY_SERVER__ 는 대상 서버를 거쳐서 외부 요청을 하도록 하는 서버의 정보를 가지고 있음
|
* @brief __PROXY_SERVER__ has server information to request to the external through the target server
|
||||||
* FileHandler::getRemoteResource 에서 이 상수를 사용함
|
* FileHandler:: getRemoteResource uses the constant
|
||||||
**/
|
**/
|
||||||
if(!defined('__PROXY_SERVER__')) define('__PROXY_SERVER__', null);
|
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) {
|
if((__DEBUG_OUTPUT__ == 2) && version_compare(PHP_VERSION, '6.0.0') === -1) {
|
||||||
require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php';
|
require _XE_PATH_.'libs/FirePHPCore/FirePHP.class.php';
|
||||||
|
|
@ -129,15 +129,15 @@
|
||||||
|
|
||||||
if(!defined('__XE_LOADED_CLASS__')){
|
if(!defined('__XE_LOADED_CLASS__')){
|
||||||
/**
|
/**
|
||||||
* @brief 간단하게 사용하기 위한 함수 정의한 파일 require
|
* @brief Require a function-defined-file for simple use
|
||||||
**/
|
**/
|
||||||
require(_XE_PATH_.'config/func.inc.php');
|
require(_XE_PATH_.'config/func.inc.php');
|
||||||
|
|
||||||
if(__DEBUG__) define('__StartTime__', getMicroTime());
|
if(__DEBUG__) define('__StartTime__', getMicroTime());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 기본적인 class 파일 include
|
* @brief include the class files
|
||||||
* @TODO : PHP5 기반으로 바꾸게 되면 _autoload()를 이용할 수 있기에 제거 대상
|
* @TODO : When _autoload() can be used for PHP5 based applications, it will be removed.
|
||||||
**/
|
**/
|
||||||
if(__DEBUG__) define('__ClassLoadStartTime__', getMicroTime());
|
if(__DEBUG__) define('__ClassLoadStartTime__', getMicroTime());
|
||||||
require(_XE_PATH_.'classes/object/Object.class.php');
|
require(_XE_PATH_.'classes/object/Object.class.php');
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* @file config/func.inc.php
|
* @file config/func.inc.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 편의 목적으로 만든 함수라이브러리 파일
|
* @brief function library files for convenience
|
||||||
**/
|
**/
|
||||||
|
|
||||||
if(!defined('__ZBXE__')) exit();
|
if(!defined('__ZBXE__')) exit();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief php5에 대비하여 clone 정의
|
* @brief define clone for php5
|
||||||
**/
|
**/
|
||||||
if (version_compare(phpversion(), '5.0') < 0) {
|
if (version_compare(phpversion(), '5.0') < 0) {
|
||||||
eval('
|
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')) {
|
if(!function_exists('iconv')) {
|
||||||
eval('
|
eval('
|
||||||
|
|
@ -74,8 +74,8 @@
|
||||||
) ;
|
) ;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ModuleHandler::getModuleObject($module_name, $type)을 쓰기 쉽게 함수로 선언
|
* @brief define a function to use ModuleHandler::getModuleObject ($module_name, $type)
|
||||||
* @param module_name 모듈이름
|
* @param module_name
|
||||||
* @param type disp, proc, controller, class
|
* @param type disp, proc, controller, class
|
||||||
* @param kind admin, null
|
* @param kind admin, null
|
||||||
* @return module instance
|
* @return module instance
|
||||||
|
|
@ -85,8 +85,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module의 controller 객체 생성용
|
* @brief create a controller instance of the module
|
||||||
* @param module_name 모듈이름
|
* @param module_name
|
||||||
* @return module controller instance
|
* @return module controller instance
|
||||||
**/
|
**/
|
||||||
function &getController($module_name) {
|
function &getController($module_name) {
|
||||||
|
|
@ -94,8 +94,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module의 admin controller 객체 생성용
|
* @brief create a controller instance of the module
|
||||||
* @param module_name 모듈이름
|
* @param module_name
|
||||||
* @return module admin controller instance
|
* @return module admin controller instance
|
||||||
**/
|
**/
|
||||||
function &getAdminController($module_name) {
|
function &getAdminController($module_name) {
|
||||||
|
|
@ -103,8 +103,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module의 view 객체 생성용
|
* @brief create a view instance of the module
|
||||||
* @param module_name 모듈이름
|
* @param module_name
|
||||||
* @return module view instance
|
* @return module view instance
|
||||||
**/
|
**/
|
||||||
function &getView($module_name) {
|
function &getView($module_name) {
|
||||||
|
|
@ -112,8 +112,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module의 mobile 객체 생성용
|
* @brief create a view instance of the module
|
||||||
* @param module_name 모듈이름
|
* @param module_name
|
||||||
* @return module mobile instance
|
* @return module mobile instance
|
||||||
**/
|
**/
|
||||||
function &getMobile($module_name) {
|
function &getMobile($module_name) {
|
||||||
|
|
@ -130,8 +130,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module의 model 객체 생성용
|
* @brief create a model instance of the module
|
||||||
* @param module_name 모듈이름
|
* @param module_name
|
||||||
* @return module model instance
|
* @return module model instance
|
||||||
**/
|
**/
|
||||||
function &getModel($module_name) {
|
function &getModel($module_name) {
|
||||||
|
|
@ -139,8 +139,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module의 admin model 객체 생성용
|
* @brief create an admin model instance of the module
|
||||||
* @param module_name 모듈이름
|
* @param module_name
|
||||||
* @return module admin model instance
|
* @return module admin model instance
|
||||||
**/
|
**/
|
||||||
function &getAdminModel($module_name) {
|
function &getAdminModel($module_name) {
|
||||||
|
|
@ -148,8 +148,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module의 api 객체 생성용
|
* @brief create an api instance of the module
|
||||||
* @param module_name 모듈이름
|
* @param module_name
|
||||||
* @return module api class instance
|
* @return module api class instance
|
||||||
**/
|
**/
|
||||||
function &getAPI($module_name) {
|
function &getAPI($module_name) {
|
||||||
|
|
@ -157,8 +157,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module의 wap 객체 생성용
|
* @brief create a wap instance of the module
|
||||||
* @param module_name 모듈이름
|
* @param module_name
|
||||||
* @return module wap class instance
|
* @return module wap class instance
|
||||||
**/
|
**/
|
||||||
function &getWAP($module_name) {
|
function &getWAP($module_name) {
|
||||||
|
|
@ -166,8 +166,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module의 상위 class 객체 생성용
|
* @brief create a class instance of the module
|
||||||
* @param module_name 모듈이름
|
* @param module_name
|
||||||
* @return module class instance
|
* @return module class instance
|
||||||
**/
|
**/
|
||||||
function &getClass($module_name) {
|
function &getClass($module_name) {
|
||||||
|
|
@ -175,10 +175,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB::executeQuery() 의 alias
|
* @brief the alias of DB::executeQuery()
|
||||||
* @param query_id 쿼리 ID ( 모듈명.쿼리XML파일 )
|
* @param query_id (module name.query XML file)
|
||||||
* @param args object 변수로 선언된 인자값
|
* @param argument values of args object
|
||||||
* @return 처리결과
|
* @return results
|
||||||
**/
|
**/
|
||||||
function executeQuery($query_id, $args = null) {
|
function executeQuery($query_id, $args = null) {
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
|
|
@ -186,10 +186,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB::executeQuery() 의 결과값을 무조건 배열로 처리하도록 하는 함수
|
* @brief function to handle the result of DB::executeQuery() as an array
|
||||||
* @param query_id 쿼리 ID ( 모듈명.쿼리XML파일 )
|
* @param query_id(module name.query XML file)
|
||||||
* @param args object 변수로 선언된 인자값
|
* @param argument values of args object
|
||||||
* @return 처리결과
|
* @return results
|
||||||
**/
|
**/
|
||||||
function executeQueryArray($query_id, $args = null) {
|
function executeQueryArray($query_id, $args = null) {
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
|
|
@ -201,7 +201,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief DB::getNextSequence() 의 alias
|
* @brief DB:: alias of getNextSequence()
|
||||||
* @return big int
|
* @return big int
|
||||||
**/
|
**/
|
||||||
function getNextSequence() {
|
function getNextSequence() {
|
||||||
|
|
@ -210,14 +210,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Context::getUrl()를 쓰기 쉽게 함수로 선언
|
* @brief define a function to use Context::getUrl()
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* getUrl()은 현재 요청된 RequestURI에 주어진 인자의 값으로 변형하여 url을 리턴한다\n
|
* getUrl() returns the URL transformed from given arguments of RequestURI\n
|
||||||
* 1. 인자는 (key, value)... 의 형식으로 주어져야 한다.\n
|
* 1. argument format follows as (key, value).\.
|
||||||
* ex) getUrl('key1','val1', 'key2', '') : key1, key2를 val1과 '' 로 변형\n
|
* ex) getUrl('key1', 'val1', 'key2',''): transform key1 and key2 to val1 and '' respectively\n
|
||||||
* 2. 아무런 인자가 없으면 argument를 제외한 url을 리턴
|
* 2. returns URL without the argument if no argument is given.
|
||||||
* 3. 첫 인자값이 '' 이면 RequestUri에다가 추가된 args_list로 url을 만듬
|
* 3. URL made of args_list added to RequestUri if the first argument value is ''.
|
||||||
**/
|
**/
|
||||||
function getUrl() {
|
function getUrl() {
|
||||||
$num_args = func_num_args();
|
$num_args = func_num_args();
|
||||||
|
|
@ -238,8 +238,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getUrl()의 값에 request uri를 추가하여 reutrn
|
* @brief return the value adding request uri to getUrl()
|
||||||
* full url을 얻기 위함
|
* to get the full url
|
||||||
**/
|
**/
|
||||||
function getFullUrl() {
|
function getFullUrl() {
|
||||||
$num_args = func_num_args();
|
$num_args = func_num_args();
|
||||||
|
|
@ -271,11 +271,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Context::getUrl()를 쓰기 쉽게 함수로 선언
|
* @brief Context:: getUrl() function is declared as easier to write
|
||||||
* @return string
|
* @return string
|
||||||
*
|
*
|
||||||
* getSiteUrl()은 지정된 도메인에 대해 주어진 인자의 값으로 변형하여 url을 리턴한다\n
|
* getSiteUrl() returns the URL by transforming the given argument value of domain\n
|
||||||
* 첫 인자는 도메인(http://등이 제외된)+path 여야 함.
|
* The first argument should consist of domain("http://" not included) and path
|
||||||
|
*
|
||||||
**/
|
**/
|
||||||
function getSiteUrl() {
|
function getSiteUrl() {
|
||||||
$num_args = func_num_args();
|
$num_args = func_num_args();
|
||||||
|
|
@ -302,8 +303,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getSiteUrl()의 값에 request uri를 추가하여 reutrn
|
* @brief return the value adding request uri to the getSiteUrl()
|
||||||
* full url을 얻기 위함
|
* To get the full url
|
||||||
**/
|
**/
|
||||||
function getFullSiteUrl() {
|
function getFullSiteUrl() {
|
||||||
$num_args = func_num_args();
|
$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) {
|
function isSiteID($domain) {
|
||||||
return preg_match('/^([a-z0-9\_]+)$/i', $domain);
|
return preg_match('/^([a-z0-9\_]+)$/i', $domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 주어진 문자를 주어진 크기로 자르고 잘라졌을 경우 주어진 꼬리를 담
|
* @brief put a given tail after trimming string to the specified size
|
||||||
* @param string 자를 원 문자열
|
* @param the original string to trim
|
||||||
* @param cut_size 주어진 원 문자열을 자를 크기
|
* @param cut_size: the size to be
|
||||||
* @param tail 잘라졌을 경우 문자열의 제일 뒤에 붙을 꼬리
|
* @param tail: tail to put in the end of the string after trimming
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
function cut_str($string,$cut_size=0,$tail = '...') {
|
function cut_str($string,$cut_size=0,$tail = '...') {
|
||||||
|
|
@ -388,8 +389,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief YYYYMMDDHHIISS 형식의 시간값을 unix time으로 변경
|
* @brief YYYYMMDDHHIISS format changed to unix time value
|
||||||
* @param str YYYYMMDDHHIISS 형식의 시간값
|
* @param str: time value in format of YYYYMMDDHHIISS
|
||||||
* @return int
|
* @return int
|
||||||
**/
|
**/
|
||||||
function ztime($str) {
|
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') {
|
function getTimeGap($date, $format = 'Y.m.d') {
|
||||||
$gap = time() - ztime($date);
|
$gap = time() - ztime($date);
|
||||||
|
|
@ -425,7 +426,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 월이름을 return
|
* @brief Name of the month return
|
||||||
**/
|
**/
|
||||||
function getMonthName($month, $short = true) {
|
function getMonthName($month, $short = true) {
|
||||||
$short_month = array('','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
|
$short_month = array('','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
|
||||||
|
|
@ -434,17 +435,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief YYYYMMDDHHIISS 형식의 시간값을 원하는 시간 포맷으로 변형
|
* @brief change the time format YYYYMMDDHHIISS to the user defined format
|
||||||
* @param string|int str YYYYMMDDHHIISS 형식의 시간 값
|
* @param string|int str is YYYYMMDDHHIISS format time values
|
||||||
* @param string format php date()함수의 시간 포맷
|
* @param string format is time format of php date() function
|
||||||
* @param bool conversion 언어에 따라 날짜 포맷의 자동변환 여부
|
* @param bool conversion means whether to convert automatically according to the language
|
||||||
* @return string
|
* @return string
|
||||||
**/
|
**/
|
||||||
function zdate($str, $format = 'Y-m-d H:i:s', $conversion=true) {
|
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;
|
if(!$str) return;
|
||||||
|
// convert the date format according to the language
|
||||||
// 언어권에 따라서 지정된 날짜 포맷을 변경
|
|
||||||
if($conversion == true) {
|
if($conversion == true) {
|
||||||
switch(Context::getLangType()) {
|
switch(Context::getLangType()) {
|
||||||
case 'en' :
|
case 'en' :
|
||||||
|
|
@ -462,7 +462,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 년도가 1970년 이전이면 별도 처리
|
// If year value is less than 1970, handle it separately.
|
||||||
if((int)substr($str,0,4) < 1970) {
|
if((int)substr($str,0,4) < 1970) {
|
||||||
$hour = (int)substr($str,8,2);
|
$hour = (int)substr($str,8,2);
|
||||||
$min = (int)substr($str,10,2);
|
$min = (int)substr($str,10,2);
|
||||||
|
|
@ -493,11 +493,10 @@
|
||||||
|
|
||||||
$string = strtr($format, $trans);
|
$string = strtr($format, $trans);
|
||||||
} else {
|
} 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));
|
$string = date($format, ztime($str));
|
||||||
}
|
}
|
||||||
|
// change day and am/pm for each language
|
||||||
// 요일, am/pm을 각 언어에 맞게 변경
|
|
||||||
$unit_week = Context::getLang('unit_week');
|
$unit_week = Context::getLang('unit_week');
|
||||||
$unit_meridiem = Context::getLang('unit_meridiem');
|
$unit_meridiem = Context::getLang('unit_meridiem');
|
||||||
$string = str_replace(array('Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sunday'),$unit_week, $string);
|
$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)
|
* @param display_line boolean flag whether to print seperator (default:true)
|
||||||
* @return none
|
* @return none
|
||||||
*
|
*
|
||||||
* ./files/_debug_message.php 파일에 $buff 내용을 출력한다.
|
* Display $buff contents into the file ./files/_debug_message.php.
|
||||||
* tail -f ./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') {
|
function debugPrint($debug_output = null, $display_option = true, $file = '_debug_message.php') {
|
||||||
if(!(__DEBUG__ & 1)) return;
|
if(!(__DEBUG__ & 1)) return;
|
||||||
|
|
@ -533,11 +532,9 @@
|
||||||
{
|
{
|
||||||
$label = sprintf('[%s:%d] ', $file_name, $line_num);
|
$label = sprintf('[%s:%d] ', $file_name, $line_num);
|
||||||
}
|
}
|
||||||
|
// Check a FirePHP option
|
||||||
// FirePHP 옵션 체크
|
|
||||||
if($display_option === 'TABLE') $label = $display_option;
|
if($display_option === 'TABLE') $label = $display_option;
|
||||||
|
// Check if the IP specified by __DEBUG_PROTECT__ option is same as the access IP.
|
||||||
// __DEBUG_PROTECT__ 옵션으로 지정된 IP와 접근 IP가 동일한지 체크
|
|
||||||
if(__DEBUG_PROTECT__ === 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) {
|
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';
|
$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;
|
$label = null;
|
||||||
|
|
@ -579,9 +576,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 첫번째 인자로 오는 object var에서 2번째 object의 var들을 제거
|
* @brief Delete the second object vars from the first argument
|
||||||
* @param target_obj 원 object
|
* @param target_obj is an original object
|
||||||
* @param del_obj 원 object의 vars에서 del_obj의 vars를 제거한다
|
* @param del_obj is object vars to delete from the original object
|
||||||
* @return object
|
* @return object
|
||||||
**/
|
**/
|
||||||
function delObjectVars($target_obj, $del_obj) {
|
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 errno
|
||||||
* @param errstr
|
* @param errstr
|
||||||
* @return file
|
* @return file
|
||||||
|
|
@ -625,9 +622,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 주어진 숫자를 주어진 크기로 recursive하게 잘라줌
|
* @brief Trim a given number to a fiven size recursively
|
||||||
* @param no 주어진 숫자
|
* @param no : a given number
|
||||||
* @param size 잘라낼 크기
|
* @param size : a given digits
|
||||||
**/
|
**/
|
||||||
function getNumberingPath($no, $size=3) {
|
function getNumberingPath($no, $size=3) {
|
||||||
$mod = pow(10, $size);
|
$mod = pow(10, $size);
|
||||||
|
|
@ -637,22 +634,22 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 한글이 들어간 url의 decode
|
* @brief decode the URL in Korean
|
||||||
**/
|
**/
|
||||||
function url_decode($str) {
|
function url_decode($str) {
|
||||||
return preg_replace('/%u([[:alnum:]]{4})/', '&#x\\1;',$str);
|
return preg_replace('/%u([[:alnum:]]{4})/', '&#x\\1;',$str);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 해킹 시도로 의심되는 코드들을 미리 차단
|
* @brief Pre-block the codes which may be hacking attempts
|
||||||
**/
|
**/
|
||||||
function removeHackTag($content) {
|
function removeHackTag($content) {
|
||||||
// 특정 태그들을 일반 문자로 변경
|
// change the specific tags to the common texts
|
||||||
$content = preg_replace('/<(\/?)(iframe|script|meta|style|applet|link|base|html|body)/is', '<$1$2', $content);
|
$content = preg_replace('/<(\/?)(iframe|script|meta|style|applet|link|base|html|body)/is', '<$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);
|
$content = preg_replace_callback("!<(/?)([a-z]+)(.*?)>!is", removeSrcHack, $content);
|
||||||
|
|
||||||
|
|
@ -690,7 +687,7 @@
|
||||||
$xml_doc = $oXmlParser->parse($buff);
|
$xml_doc = $oXmlParser->parse($buff);
|
||||||
if(!$xml_doc) return sprintf("<%s>", $tag);
|
if(!$xml_doc) return sprintf("<%s>", $tag);
|
||||||
|
|
||||||
// src값에 module=admin이라는 값이 입력되어 있으면 이 값을 무효화 시킴
|
// invalidate the value if src value is module = admin.
|
||||||
$src = $xml_doc->attrs->src;
|
$src = $xml_doc->attrs->src;
|
||||||
$dynsrc = $xml_doc->attrs->dynsrc;
|
$dynsrc = $xml_doc->attrs->dynsrc;
|
||||||
$lowsrc = $xml_doc->attrs->lowsrc;
|
$lowsrc = $xml_doc->attrs->lowsrc;
|
||||||
|
|
@ -748,7 +745,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief attribute의 value를 " 로 둘러싸도록 처리하는 함수
|
* @brief function to enclose attribute values to double quotes(")
|
||||||
**/
|
**/
|
||||||
function fixQuotation($matches) {
|
function fixQuotation($matches) {
|
||||||
$key = $matches[1];
|
$key = $matches[1];
|
||||||
|
|
@ -774,8 +771,7 @@
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// convert hexa value to RGB
|
||||||
// hexa값을 RGB로 변환
|
|
||||||
if(!function_exists('hexrgb')) {
|
if(!function_exists('hexrgb')) {
|
||||||
function hexrgb($hexstr) {
|
function hexrgb($hexstr) {
|
||||||
$int = hexdec($hexstr);
|
$int = hexdec($hexstr);
|
||||||
|
|
@ -788,9 +784,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mysql old_password 의 php 구현 함수
|
* @brief php function for mysql old_password()
|
||||||
* 제로보드4나 기타 mysql4.1 이전의 old_password()함수를 쓴 데이터의 사용을 위해서
|
* provides backward compatibility for zero board4 which uses old_password() of mysql 4.1 earlier versions.
|
||||||
* mysql의 password.c 소스 참조해서 구현함
|
* the function implemented by referring to the source codes of password.c file in mysql
|
||||||
**/
|
**/
|
||||||
function mysql_pre4_hash_password($password) {
|
function mysql_pre4_hash_password($password) {
|
||||||
$nr = 1345345333;
|
$nr = 1345345333;
|
||||||
|
|
@ -816,7 +812,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 현재 요청받은 스크립트 경로를 return
|
* return the requested script path
|
||||||
**/
|
**/
|
||||||
function getScriptPath() {
|
function getScriptPath() {
|
||||||
static $url = null;
|
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).
|
* 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
|
* Modified function from http://pure-essence.net/stuff/code/utf8RawUrlDecode.phps
|
||||||
**/
|
**/
|
||||||
|
|
|
||||||
24
index.php
24
index.php
|
|
@ -2,16 +2,16 @@
|
||||||
/**
|
/**
|
||||||
* @file index.php
|
* @file index.php
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @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
|
* @mainpage XpressEngine
|
||||||
* @section intro 소개
|
* @section intro introduction
|
||||||
* XE 는 오픈 프로젝트로 개발되는 오픈 소스입니다.\n
|
* XE is an opensource and being developed in the opensource project. \N
|
||||||
* 자세한 내용은 아래 링크를 참조하세요.
|
* For more information, please see the link below.
|
||||||
* - 공식홈페이지 : http://www.xpressengine.com
|
* - Official website: http://www.xpressengine.com
|
||||||
* - SVN Repository : http://svn.xpressengine.net/xe
|
* - SVN Repository : http://svn.xpressengine.net/xe
|
||||||
* \n
|
* \n
|
||||||
* "XpressEngine (XE)" is free software; you can redistribute it and/or \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);
|
define('__ZBXE__', true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 필요한 설정 파일들을 include
|
* @brief Include the necessary configuration files
|
||||||
**/
|
**/
|
||||||
require('./config/config.inc.php');
|
require('./config/config.inc.php');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief create and initialize a Context object
|
* @brief Initialize by creating Context object
|
||||||
* 모든 Request Argument/ 환경변수등을 세팅
|
* Set all Request Argument/Environment variables
|
||||||
**/
|
**/
|
||||||
$oContext = &Context::getInstance();
|
$oContext = &Context::getInstance();
|
||||||
$oContext->init();
|
$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()) {
|
if($oContext->checkSSO()) {
|
||||||
$oModuleHandler = new ModuleHandler();
|
$oModuleHandler = new ModuleHandler();
|
||||||
|
|
|
||||||
|
|
@ -2,35 +2,33 @@
|
||||||
/**
|
/**
|
||||||
* @class addonAdminController
|
* @class addonAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief addon 모듈의 admin controller class
|
* @brief admin controller class of addon modules
|
||||||
**/
|
**/
|
||||||
include_once('addon.controller.php');
|
include_once('addon.controller.php');
|
||||||
|
|
||||||
class addonAdminController extends addonController {
|
class addonAdminController extends addonController {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온의 활성/비활성 체인지
|
* @brief Add active/inactive change
|
||||||
**/
|
**/
|
||||||
function procAddonAdminToggleActivate() {
|
function procAddonAdminToggleActivate() {
|
||||||
$oAddonModel = &getAdminModel('addon');
|
$oAddonModel = &getAdminModel('addon');
|
||||||
|
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
|
// batahom addon values
|
||||||
// addon값을 받아옴
|
|
||||||
$addon = Context::get('addon');
|
$addon = Context::get('addon');
|
||||||
$type = Context::get('type');
|
$type = Context::get('type');
|
||||||
if(!$type) $type = "pc";
|
if(!$type) $type = "pc";
|
||||||
if($addon) {
|
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($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);
|
else $this->doActivate($addon, $site_module_info->site_srl, $type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -38,7 +36,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온 설정 정보 입력
|
* @brief Add the configuration information input
|
||||||
**/
|
**/
|
||||||
function procAddonAdminSetupAddon() {
|
function procAddonAdminSetupAddon() {
|
||||||
$args = Context::getRequestVars();
|
$args = Context::getRequestVars();
|
||||||
|
|
@ -59,8 +57,8 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온 추가
|
* @brief Add-on
|
||||||
* DB에 애드온을 추가함
|
* Adds Add to DB
|
||||||
**/
|
**/
|
||||||
function doInsert($addon, $site_srl = 0) {
|
function doInsert($addon, $site_srl = 0) {
|
||||||
$args->addon = $addon;
|
$args->addon = $addon;
|
||||||
|
|
@ -71,8 +69,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온 활성화
|
* @brief Add-activated
|
||||||
* addons라는 테이블에 애드온의 활성화 상태를 on 시켜줌
|
* addons add-ons to the table on the activation state sikyeojum
|
||||||
**/
|
**/
|
||||||
function doActivate($addon, $site_srl = 0, $type = "pc") {
|
function doActivate($addon, $site_srl = 0, $type = "pc") {
|
||||||
$args->addon = $addon;
|
$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") {
|
function doDeactivate($addon, $site_srl = 0, $type = "pc") {
|
||||||
$args->addon = $addon;
|
$args->addon = $addon;
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
/**
|
/**
|
||||||
* @class addonAdminModel
|
* @class addonAdminModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief addon 모듈의 admin model class
|
* @brief admin model class of addon modules
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class addonAdminModel extends addon {
|
class addonAdminModel extends addon {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온의 경로를 구함
|
* @brief Wanted to add the path to
|
||||||
**/
|
**/
|
||||||
function getAddonPath($addon_name) {
|
function getAddonPath($addon_name) {
|
||||||
$class_path = sprintf('./addons/%s/', $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) {
|
function getAddonList($site_srl = 0) {
|
||||||
// activated된 애드온 목록을 구함
|
// Wanted to add a list of activated
|
||||||
$inserted_addons = $this->getInsertedAddons($site_srl);
|
$inserted_addons = $this->getInsertedAddons($site_srl);
|
||||||
|
// Downloaded and installed add-on to the list of Wanted
|
||||||
// 다운받은 애드온과 설치된 애드온의 목록을 구함
|
|
||||||
$searched_list = FileHandler::readDir('./addons');
|
$searched_list = FileHandler::readDir('./addons');
|
||||||
$searched_count = count($searched_list);
|
$searched_count = count($searched_list);
|
||||||
if(!$searched_count) return;
|
if(!$searched_count) return;
|
||||||
sort($searched_list);
|
sort($searched_list);
|
||||||
|
|
||||||
for($i=0;$i<$searched_count;$i++) {
|
for($i=0;$i<$searched_count;$i++) {
|
||||||
// 애드온의 이름
|
// Add the name of
|
||||||
$addon_name = $searched_list[$i];
|
$addon_name = $searched_list[$i];
|
||||||
if($addon_name == "smartphone") continue;
|
if($addon_name == "smartphone") continue;
|
||||||
|
// Add the path (files/addons precedence)
|
||||||
// 애드온의 경로 (files/addons가 우선)
|
|
||||||
$path = $this->getAddonPath($addon_name);
|
$path = $this->getAddonPath($addon_name);
|
||||||
|
// Wanted information on the add-on
|
||||||
// 해당 애드온의 정보를 구함
|
|
||||||
unset($info);
|
unset($info);
|
||||||
$info = $this->getAddonInfoXml($addon_name, $site_srl);
|
$info = $this->getAddonInfoXml($addon_name, $site_srl);
|
||||||
|
|
||||||
|
|
@ -51,14 +48,12 @@
|
||||||
$info->path = $path;
|
$info->path = $path;
|
||||||
$info->activated = false;
|
$info->activated = false;
|
||||||
$info->mactivated = false;
|
$info->mactivated = false;
|
||||||
|
// Check if a permossion is granted entered in DB
|
||||||
// DB에 입력되어 있는지 확인
|
|
||||||
if(!in_array($addon_name, array_keys($inserted_addons))) {
|
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 = &getAdminController('addon');
|
||||||
$oAddonAdminController->doInsert($addon_name, $site_srl);
|
$oAddonAdminController->doInsert($addon_name, $site_srl);
|
||||||
|
// Is activated
|
||||||
// 활성화 되어 있는지 확인
|
|
||||||
} else {
|
} else {
|
||||||
if($inserted_addons[$addon_name]->is_used=='Y') $info->activated = true;
|
if($inserted_addons[$addon_name]->is_used=='Y') $info->activated = true;
|
||||||
if($inserted_addons[$addon_name]->is_used_m=='Y') $info->mactivated = 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) {
|
function getAddonInfoXml($addon, $site_srl = 0) {
|
||||||
// 요청된 모듈의 경로를 구한다. 없으면 return
|
// Get a path of the requested module. Return if not exists.
|
||||||
$addon_path = $this->getAddonPath($addon);
|
$addon_path = $this->getAddonPath($addon);
|
||||||
if(!$addon_path) return;
|
if(!$addon_path) return;
|
||||||
|
// Read the xml file for module skin information
|
||||||
// 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음
|
|
||||||
$xml_file = sprintf("%sconf/info.xml", $addon_path);
|
$xml_file = sprintf("%sconf/info.xml", $addon_path);
|
||||||
if(!file_exists($xml_file)) return;
|
if(!file_exists($xml_file)) return;
|
||||||
|
|
||||||
|
|
@ -88,7 +82,7 @@
|
||||||
if(!$xml_obj) return;
|
if(!$xml_obj) return;
|
||||||
|
|
||||||
|
|
||||||
// DB에 설정된 내역을 가져온다
|
// DB is set to bring history
|
||||||
$db_args->addon = $addon;
|
$db_args->addon = $addon;
|
||||||
if(!$site_srl) $output = executeQuery('addon.getAddonInfo',$db_args);
|
if(!$site_srl) $output = executeQuery('addon.getAddonInfo',$db_args);
|
||||||
else {
|
else {
|
||||||
|
|
@ -104,7 +98,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 애드온 정보
|
// Add information
|
||||||
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
|
if($xml_obj->version && $xml_obj->attrs->version == '0.2') {
|
||||||
// addon format v0.2
|
// addon format v0.2
|
||||||
sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d);
|
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;
|
$addon_info->author[] = $author_obj;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 확장변수를 정리
|
// Expand the variable order
|
||||||
if($xml_obj->extra_vars) {
|
if($xml_obj->extra_vars) {
|
||||||
$extra_var_groups = $xml_obj->extra_vars->group;
|
$extra_var_groups = $xml_obj->extra_vars->group;
|
||||||
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
|
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(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
|
||||||
if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($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)) {
|
if(is_array($val->options)) {
|
||||||
$option_count = count($val->options);
|
$option_count = count($val->options);
|
||||||
|
|
||||||
|
|
@ -227,7 +221,7 @@
|
||||||
$addon_info->author[] = $author_obj;
|
$addon_info->author[] = $author_obj;
|
||||||
|
|
||||||
if($xml_obj->extra_vars) {
|
if($xml_obj->extra_vars) {
|
||||||
// 확장변수를 정리
|
// Expand the variable order
|
||||||
$extra_var_groups = $xml_obj->extra_vars->group;
|
$extra_var_groups = $xml_obj->extra_vars->group;
|
||||||
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
|
if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars;
|
||||||
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
|
if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups);
|
||||||
|
|
@ -247,8 +241,7 @@
|
||||||
$obj->value = $extra_vals->{$obj->name};
|
$obj->value = $extra_vals->{$obj->name};
|
||||||
if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
|
if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); }
|
||||||
if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
|
if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); }
|
||||||
|
// 'Select'type obtained from the option list.
|
||||||
// 'select'type에서 option목록을 구한다.
|
|
||||||
if(is_array($val->options)) {
|
if(is_array($val->options)) {
|
||||||
$option_count = count($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) {
|
function getInsertedAddons($site_srl = 0) {
|
||||||
$args->list_order = 'addon';
|
$args->list_order = 'addon';
|
||||||
|
|
@ -292,7 +285,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온이 활성화 되어 있는지 체크
|
* @brief Add-on is enabled, check whether
|
||||||
**/
|
**/
|
||||||
function isActivatedAddon($addon, $site_srl = 0, $type = "pc") {
|
function isActivatedAddon($addon, $site_srl = 0, $type = "pc") {
|
||||||
$args->addon = $addon;
|
$args->addon = $addon;
|
||||||
|
|
|
||||||
|
|
@ -2,57 +2,51 @@
|
||||||
/**
|
/**
|
||||||
* @class addonAdminView
|
* @class addonAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief addon 모듈의 admin view class
|
* @brief admin view class of addon modules
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class addonAdminView extends addon {
|
class addonAdminView extends addon {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온 관리 메인 페이지 (목록 보여줌)
|
* @brief Add Management main page (showing the list)
|
||||||
**/
|
**/
|
||||||
function dispAddonAdminIndex() {
|
function dispAddonAdminIndex() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
|
// Add to the list settings
|
||||||
// 애드온 목록을 세팅
|
|
||||||
$oAddonModel = &getAdminModel('addon');
|
$oAddonModel = &getAdminModel('addon');
|
||||||
$addon_list = $oAddonModel->getAddonList($site_module_info->site_srl);
|
$addon_list = $oAddonModel->getAddonList($site_module_info->site_srl);
|
||||||
Context::set('addon_list', $addon_list);
|
Context::set('addon_list', $addon_list);
|
||||||
|
// Template specifies the path and file
|
||||||
// 템플릿 패스 및 파일을 지정
|
|
||||||
$this->setTemplateFile('addon_list');
|
$this->setTemplateFile('addon_list');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @biref 애드온 세부 설정 팝업 출력
|
* @biref Setting out the details pop-up add-on
|
||||||
**/
|
**/
|
||||||
function dispAddonAdminSetup() {
|
function dispAddonAdminSetup() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
|
// Wanted to add the requested
|
||||||
// 요청된 애드온을 구함
|
|
||||||
$selected_addon = Context::get('selected_addon');
|
$selected_addon = Context::get('selected_addon');
|
||||||
|
// Wanted to add the requested information
|
||||||
// 요청된 애드온의 정보를 구함
|
|
||||||
$oAddonModel = &getAdminModel('addon');
|
$oAddonModel = &getAdminModel('addon');
|
||||||
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl);
|
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl);
|
||||||
Context::set('addon_info', $addon_info);
|
Context::set('addon_info', $addon_info);
|
||||||
|
// Get a mid list
|
||||||
// mid 목록을 가져옴
|
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$oModuleAdminModel = &getAdminModel('module');
|
$oModuleAdminModel = &getAdminModel('module');
|
||||||
|
|
||||||
if($site_module_info->site_srl) $args->site_srl = $site_module_info->site_srl;
|
if($site_module_info->site_srl) $args->site_srl = $site_module_info->site_srl;
|
||||||
$mid_list = $oModuleModel->getMidList($args);
|
$mid_list = $oModuleModel->getMidList($args);
|
||||||
|
// module_category and module combination
|
||||||
// module_category와 module의 조합
|
|
||||||
if(!$site_module_info->site_srl) {
|
if(!$site_module_info->site_srl) {
|
||||||
// 모듈 카테고리 목록을 구함
|
// Get a list of module categories
|
||||||
$module_categories = $oModuleModel->getModuleCategories();
|
$module_categories = $oModuleModel->getModuleCategories();
|
||||||
|
|
||||||
if($mid_list) {
|
if($mid_list) {
|
||||||
|
|
@ -65,32 +59,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
Context::set('mid_list',$module_categories);
|
Context::set('mid_list',$module_categories);
|
||||||
|
// Set the layout to be pop-up
|
||||||
// 레이아웃을 팝업으로 지정
|
|
||||||
$this->setLayoutFile('popup_layout');
|
$this->setLayoutFile('popup_layout');
|
||||||
|
// Template specifies the path and file
|
||||||
// 템플릿 패스 및 파일을 지정
|
|
||||||
$this->setTemplateFile('setup_addon');
|
$this->setTemplateFile('setup_addon');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온의 상세 정보(conf/info.xml)를 팝업 출력
|
* @brief Add details (conf/info.xml) a pop-out
|
||||||
**/
|
**/
|
||||||
function dispAddonAdminInfo() {
|
function dispAddonAdminInfo() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
|
// Wanted to add the requested
|
||||||
// 요청된 애드온을 구함
|
|
||||||
$selected_addon = Context::get('selected_addon');
|
$selected_addon = Context::get('selected_addon');
|
||||||
|
// Wanted to add the requested information
|
||||||
// 요청된 애드온의 정보를 구함
|
|
||||||
$oAddonModel = &getAdminModel('addon');
|
$oAddonModel = &getAdminModel('addon');
|
||||||
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl);
|
$addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl);
|
||||||
Context::set('addon_info', $addon_info);
|
Context::set('addon_info', $addon_info);
|
||||||
|
// Set the layout to be pop-up
|
||||||
// 레이아웃을 팝업으로 지정
|
|
||||||
$this->setLayoutFile('popup_layout');
|
$this->setLayoutFile('popup_layout');
|
||||||
|
// Template specifies the path and file
|
||||||
// 템플릿 패스 및 파일을 지정
|
|
||||||
$this->setTemplateFile('addon_info');
|
$this->setTemplateFile('addon_info');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,16 @@
|
||||||
/**
|
/**
|
||||||
* @class addon
|
* @class addon
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief addon 모듈의 high class
|
* @brief high class of addon modules
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class addon extends ModuleObject {
|
class addon extends ModuleObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치시 추가 작업이 필요할시 구현
|
* @brief Implement if additional tasks are necessary when installing
|
||||||
**/
|
**/
|
||||||
function moduleInstall() {
|
function moduleInstall() {
|
||||||
// 몇가지 애드온을 등록
|
// Register to add a few
|
||||||
$oAddonController = &getAdminController('addon');
|
$oAddonController = &getAdminController('addon');
|
||||||
$oAddonController->doInsert('autolink');
|
$oAddonController->doInsert('autolink');
|
||||||
$oAddonController->doInsert('blogapi');
|
$oAddonController->doInsert('blogapi');
|
||||||
|
|
@ -23,8 +23,7 @@
|
||||||
$oAddonController->doInsert('resize_image');
|
$oAddonController->doInsert('resize_image');
|
||||||
$oAddonController->doInsert('openid_delegation_id');
|
$oAddonController->doInsert('openid_delegation_id');
|
||||||
$oAddonController->doInsert('point_level_icon');
|
$oAddonController->doInsert('point_level_icon');
|
||||||
|
// To add a few changes to the default activation state
|
||||||
// 몇가지 애드온을 기본 활성화 상태로 변경
|
|
||||||
$oAddonController->doActivate('autolink');
|
$oAddonController->doActivate('autolink');
|
||||||
$oAddonController->doActivate('counter');
|
$oAddonController->doActivate('counter');
|
||||||
$oAddonController->doActivate('member_communication');
|
$oAddonController->doActivate('member_communication');
|
||||||
|
|
@ -37,7 +36,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치가 이상이 없는지 체크하는 method
|
* @brief a method to check if successfully installed
|
||||||
**/
|
**/
|
||||||
function checkUpdate() {
|
function checkUpdate() {
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
|
|
@ -47,7 +46,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 업데이트 실행
|
* @brief Execute update
|
||||||
**/
|
**/
|
||||||
function moduleUpdate() {
|
function moduleUpdate() {
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
|
|
@ -61,7 +60,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 캐시 파일 재생성
|
* @brief Re-generate the cache file
|
||||||
**/
|
**/
|
||||||
function recompileCache() {
|
function recompileCache() {
|
||||||
FileHandler::removeFilesInDir('./files/cache/addons');
|
FileHandler::removeFilesInDir('./files/cache/addons');
|
||||||
|
|
|
||||||
|
|
@ -2,20 +2,20 @@
|
||||||
/**
|
/**
|
||||||
* @class addonController
|
* @class addonController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief addon 모듈의 controller class
|
* @brief addon module's controller class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
class addonController extends addon {
|
class addonController extends addon {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 메인/ 가상 사이트별 애드온 캐시 파일의 위치를 구함
|
* @brief Main/Virtual-specific add-on file, the location of the cache Wanted
|
||||||
**/
|
**/
|
||||||
function getCacheFilePath($type = "pc") {
|
function getCacheFilePath($type = "pc") {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$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) {
|
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) {
|
function _setAddMid($selected_addon,$mid, $site_srl=0) {
|
||||||
|
// Wanted to add the requested information
|
||||||
// 요청된 애드온의 정보를 구함
|
|
||||||
$mid_list = $this->_getMidList($selected_addon, $site_srl);
|
$mid_list = $this->_getMidList($selected_addon, $site_srl);
|
||||||
|
|
||||||
$mid_list[] = $mid;
|
$mid_list[] = $mid;
|
||||||
|
|
@ -62,11 +61,10 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온 mid 추가 설정
|
* @brief Add-on mid settings
|
||||||
**/
|
**/
|
||||||
function _setDelMid($selected_addon,$mid,$site_srl=0) {
|
function _setDelMid($selected_addon,$mid,$site_srl=0) {
|
||||||
|
// Wanted to add the requested information
|
||||||
// 요청된 애드온의 정보를 구함
|
|
||||||
$mid_list = $this->_getMidList($selected_addon,$site_srl);
|
$mid_list = $this->_getMidList($selected_addon,$site_srl);
|
||||||
|
|
||||||
$new_mid_list = array();
|
$new_mid_list = array();
|
||||||
|
|
@ -83,7 +81,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온 mid 추가 설정
|
* @brief Add-on mid settings
|
||||||
**/
|
**/
|
||||||
function _setMid($selected_addon,$mid_list,$site_srl=0) {
|
function _setMid($selected_addon,$mid_list,$site_srl=0) {
|
||||||
$args->mid_list = join('|@|',$mid_list);
|
$args->mid_list = join('|@|',$mid_list);
|
||||||
|
|
@ -93,7 +91,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온 mid 추가
|
* @brief Add mid-on
|
||||||
**/
|
**/
|
||||||
function procAddonSetupAddonAddMid() {
|
function procAddonSetupAddonAddMid() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
|
|
@ -105,7 +103,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온 mid 삭제
|
* @brief Add mid Delete
|
||||||
**/
|
**/
|
||||||
function procAddonSetupAddonDelMid() {
|
function procAddonSetupAddonDelMid() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$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") {
|
function makeCacheFile($site_srl = 0, $type = "pc") {
|
||||||
// 모듈에서 애드온을 사용하기 위한 캐시 파일 생성
|
// Add-on module for use in creating the cache file
|
||||||
$buff = "";
|
$buff = "";
|
||||||
$oAddonModel = &getAdminModel('addon');
|
$oAddonModel = &getAdminModel('addon');
|
||||||
$addon_list = $oAddonModel->getInsertedAddons($site_srl, $type);
|
$addon_list = $oAddonModel->getInsertedAddons($site_srl, $type);
|
||||||
|
|
@ -155,7 +153,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 애드온 설정
|
* @brief Add-On Set
|
||||||
**/
|
**/
|
||||||
function doSetup($addon, $extra_vars,$site_srl=0) {
|
function doSetup($addon, $extra_vars,$site_srl=0) {
|
||||||
if($extra_vars->mid_list) $extra_vars->mid_list = explode('|@|', $extra_vars->mid_list);
|
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) {
|
function removeAddonConfig($site_srl) {
|
||||||
$addon_path = _XE_PATH_.'files/cache/addons/';
|
$addon_path = _XE_PATH_.'files/cache/addons/';
|
||||||
|
|
|
||||||
|
|
@ -150,8 +150,7 @@
|
||||||
$oAddonModel = &getAdminModel('addon');
|
$oAddonModel = &getAdminModel('addon');
|
||||||
$addon_list = $oAddonModel->getAddonList();
|
$addon_list = $oAddonModel->getAddonList();
|
||||||
Context::set('addon_list', $addon_list);
|
Context::set('addon_list', $addon_list);
|
||||||
|
// Visitors
|
||||||
// 방문자수
|
|
||||||
$time = time();
|
$time = time();
|
||||||
$w = date("D");
|
$w = date("D");
|
||||||
while(date("D",$time) != "Sat") {
|
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)]->this = (int)$visitors[date("Ymd",$i)];
|
||||||
$status->week[date("Y.m.d",$i)]->last = (int)$visitors[date("Ymd",$i-60*60*24*7)];
|
$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');
|
$output = executeQuery('admin.getTotalVisitors');
|
||||||
$status->total_visitor = $output->data->count;
|
$status->total_visitor = $output->data->count;
|
||||||
$output = executeQuery('admin.getTotalSiteVisitors');
|
$output = executeQuery('admin.getTotalSiteVisitors');
|
||||||
$status->total_visitor += $output->data->count;
|
$status->total_visitor += $output->data->count;
|
||||||
$status->visitor = $visitors[date("Ymd")];
|
$status->visitor = $visitors[date("Ymd")];
|
||||||
|
// Today's Number of Comments
|
||||||
// 오늘의 댓글 수
|
|
||||||
$args->regdate = date("Ymd");
|
$args->regdate = date("Ymd");
|
||||||
$output = executeQuery('admin.getTodayCommentCount', $args);
|
$output = executeQuery('admin.getTodayCommentCount', $args);
|
||||||
$status->comment_count = $output->data->count;
|
$status->comment_count = $output->data->count;
|
||||||
|
// Today Wed yeokingeul
|
||||||
// 오늘의 엮인글 수
|
|
||||||
$args->regdate = date("Ymd");
|
$args->regdate = date("Ymd");
|
||||||
$output = executeQuery('admin.getTodayTrackbackCount', $args);
|
$output = executeQuery('admin.getTodayTrackbackCount', $args);
|
||||||
$status->trackback_count = $output->data->count;
|
$status->trackback_count = $output->data->count;
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class autoinstallAdminController
|
* @class autoinstallAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @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');
|
require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php');
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
class autoinstallAdminController extends autoinstall {
|
class autoinstallAdminController extends autoinstall {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class autoinstallAdminView
|
* @class autoinstallAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief autoinstall 모듈의 admin view class
|
* @brief admin view class in the autoinstall module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class autoinstall
|
* @class autoinstall
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief autoinstall 모듈의 high class
|
* @brief high class of the autoinstall module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class XmlGenerater {
|
class XmlGenerater {
|
||||||
|
|
@ -36,13 +36,13 @@
|
||||||
var $tmp_dir = './files/cache/autoinstall/';
|
var $tmp_dir = './files/cache/autoinstall/';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치시 추가 작업이 필요할시 구현
|
* @brief for additional tasks required when installing
|
||||||
**/
|
**/
|
||||||
function moduleInstall() {
|
function moduleInstall() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치가 이상이 없는지 체크하는 method
|
* @brief method to check if installation is succeeded
|
||||||
**/
|
**/
|
||||||
function checkUpdate() {
|
function checkUpdate() {
|
||||||
$oDB =& DB::getInstance();
|
$oDB =& DB::getInstance();
|
||||||
|
|
@ -61,7 +61,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 업데이트 실행
|
* @brief Execute update
|
||||||
**/
|
**/
|
||||||
function moduleUpdate() {
|
function moduleUpdate() {
|
||||||
$oDB =& DB::getInstance();
|
$oDB =& DB::getInstance();
|
||||||
|
|
@ -79,7 +79,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 캐시 파일 재생성
|
* @brief Re-generate the cache file
|
||||||
**/
|
**/
|
||||||
function recompileCache() {
|
function recompileCache() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class autoinstallModel
|
* @class autoinstallModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief autoinstall 모듈의 Model class
|
* @brief Model class of the autoinstall module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class autoinstallModel extends autoinstall {
|
class autoinstallModel extends autoinstall {
|
||||||
|
|
|
||||||
|
|
@ -3,13 +3,13 @@
|
||||||
/**
|
/**
|
||||||
* @class autoinstallView
|
* @class autoinstallView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief autoinstall 모듈의 View class
|
* @brief View class of the autoinstall module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class autoinstallView extends autoinstall {
|
class autoinstallView extends autoinstall {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,23 +2,22 @@
|
||||||
/**
|
/**
|
||||||
* @class commentAdminController
|
* @class commentAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief comment 모듈의 admin controller class
|
* @brief admin controller class of the comment module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class commentAdminController extends comment {
|
class commentAdminController extends comment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 관리자 페이지에서 선택된 댓글들을 삭제
|
* @brief Delete the selected comment from the administrator page
|
||||||
**/
|
**/
|
||||||
function procCommentAdminDeleteChecked() {
|
function procCommentAdminDeleteChecked() {
|
||||||
|
// Error display if none is selected
|
||||||
// 선택된 글이 없으면 오류 표시
|
|
||||||
$cart = Context::get('cart');
|
$cart = Context::get('cart');
|
||||||
if(!$cart) return $this->stop('msg_cart_is_null');
|
if(!$cart) return $this->stop('msg_cart_is_null');
|
||||||
$comment_srl_list= explode('|@|', $cart);
|
$comment_srl_list= explode('|@|', $cart);
|
||||||
|
|
@ -28,8 +27,7 @@
|
||||||
$oCommentController = &getController('comment');
|
$oCommentController = &getController('comment');
|
||||||
|
|
||||||
$deleted_count = 0;
|
$deleted_count = 0;
|
||||||
|
// Delete the comment posting
|
||||||
// 글삭제
|
|
||||||
for($i=0;$i<$comment_count;$i++) {
|
for($i=0;$i<$comment_count;$i++) {
|
||||||
$comment_srl = trim($comment_srl_list[$i]);
|
$comment_srl = trim($comment_srl_list[$i]);
|
||||||
if(!$comment_srl) continue;
|
if(!$comment_srl) continue;
|
||||||
|
|
@ -44,7 +42,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 신고대상을 취소 시킴
|
* @brief cancel the blacklist of abused comments reported by other users
|
||||||
**/
|
**/
|
||||||
function procCommentAdminCancelDeclare() {
|
function procCommentAdminCancelDeclare() {
|
||||||
$comment_srl = trim(Context::get('comment_srl'));
|
$comment_srl = trim(Context::get('comment_srl'));
|
||||||
|
|
@ -57,7 +55,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 모듈의 모든 댓글 삭제
|
* @brief delete all comments of the specific module
|
||||||
**/
|
**/
|
||||||
function deleteModuleComments($module_srl) {
|
function deleteModuleComments($module_srl) {
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
|
|
|
||||||
|
|
@ -2,59 +2,57 @@
|
||||||
/**
|
/**
|
||||||
* @class commentAdminView
|
* @class commentAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief comment 모듈의 admin view 클래스
|
* @brief admin view class of the comment module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class commentAdminView extends comment {
|
class commentAdminView extends comment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 목록 출력 (관리자용)
|
* @brief Display the list(for administrators)
|
||||||
**/
|
**/
|
||||||
function dispCommentAdminList() {
|
function dispCommentAdminList() {
|
||||||
// 목록을 구하기 위한 옵션
|
// option to get a list
|
||||||
$args->page = Context::get('page'); ///< 페이지
|
$args->page = Context::get('page'); // /< Page
|
||||||
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
|
$args->list_count = 30; // / the number of postings to appear on a single page
|
||||||
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
|
$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');
|
$args->module_srl = Context::get('module_srl');
|
||||||
|
|
||||||
// 목록 구함, comment->getCommentList 에서 걍 알아서 다 해버리는 구조이다... (아.. 이거 나쁜 버릇인데.. ㅡ.ㅜ 어쩔수 없다)
|
// get a list by using comment->getCommentList.
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
$output = $oCommentModel->getTotalCommentList($args);
|
$output = $oCommentModel->getTotalCommentList($args);
|
||||||
|
// set values in the return object of comment_model:: getTotalCommentList() in order to use a template.
|
||||||
// 템플릿에 쓰기 위해서 comment_model::getTotalCommentList() 의 return object에 있는 값들을 세팅
|
|
||||||
Context::set('total_count', $output->total_count);
|
Context::set('total_count', $output->total_count);
|
||||||
Context::set('total_page', $output->total_page);
|
Context::set('total_page', $output->total_page);
|
||||||
Context::set('page', $output->page);
|
Context::set('page', $output->page);
|
||||||
Context::set('comment_list', $output->data);
|
Context::set('comment_list', $output->data);
|
||||||
Context::set('page_navigation', $output->page_navigation);
|
Context::set('page_navigation', $output->page_navigation);
|
||||||
|
// set the template
|
||||||
// 템플릿 지정
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('comment_list');
|
$this->setTemplateFile('comment_list');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 관리자 페이지의 신고 목록 보기
|
* @brief show the blacklist of comments in the admin page
|
||||||
**/
|
**/
|
||||||
function dispCommentAdminDeclared() {
|
function dispCommentAdminDeclared() {
|
||||||
// 목록을 구하기 위한 옵션
|
// option to get a blacklist
|
||||||
$args->page = Context::get('page'); ///< 페이지
|
$args->page = Context::get('page'); // /< Page
|
||||||
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
|
$args->list_count = 30; // /< the number of comment postings to appear on a single page
|
||||||
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
|
$args->page_count = 10; // /< the number of pages to appear on the page navigation
|
||||||
|
|
||||||
$args->sort_index = 'comment_declared.declared_count'; ///< 소팅 값
|
$args->sort_index = 'comment_declared.declared_count'; // /< sorting values
|
||||||
$args->order_type = 'desc'; ///< 소팅 정렬 값
|
$args->order_type = 'desc'; // /< sorted value
|
||||||
|
|
||||||
// 목록을 구함
|
// get a list
|
||||||
$declared_output = executeQuery('comment.getDeclaredList', $args);
|
$declared_output = executeQuery('comment.getDeclaredList', $args);
|
||||||
|
|
||||||
if($declared_output->data && count($declared_output->data)) {
|
if($declared_output->data && count($declared_output->data)) {
|
||||||
|
|
@ -68,14 +66,13 @@
|
||||||
$declared_output->data = $comment_list;
|
$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_count', $declared_output->total_count);
|
||||||
Context::set('total_page', $declared_output->total_page);
|
Context::set('total_page', $declared_output->total_page);
|
||||||
Context::set('page', $declared_output->page);
|
Context::set('page', $declared_output->page);
|
||||||
Context::set('comment_list', $declared_output->data);
|
Context::set('comment_list', $declared_output->data);
|
||||||
Context::set('page_navigation', $declared_output->page_navigation);
|
Context::set('page_navigation', $declared_output->page_navigation);
|
||||||
|
// set the template
|
||||||
// 템플릿 지정
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('declared_list');
|
$this->setTemplateFile('declared_list');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class comment
|
* @class comment
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief comment 모듈의 high class
|
* @brief comment module's high class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
require_once(_XE_PATH_.'modules/comment/comment.item.php');
|
require_once(_XE_PATH_.'modules/comment/comment.item.php');
|
||||||
|
|
@ -10,45 +10,37 @@
|
||||||
class comment extends ModuleObject {
|
class comment extends ModuleObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치시 추가 작업이 필요할시 구현
|
* @brief implemented if additional tasks are required when installing
|
||||||
**/
|
**/
|
||||||
function moduleInstall() {
|
function moduleInstall() {
|
||||||
// action forward에 등록 (관리자 모드에서 사용하기 위함)
|
// register the action forward (for using on the admin mode)
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
|
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
|
||||||
// 2007. 10. 17 게시글이 삭제될때 댓글도 삭제되도록 trigger 등록
|
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
|
$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
|
||||||
|
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
|
||||||
// 2007. 10. 17 모듈이 삭제될때 등록된 댓글도 모두 삭제하는 트리거 추가
|
|
||||||
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
|
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
|
||||||
|
// 2008. 02. 22 add comment setting when a new module added
|
||||||
// 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가
|
|
||||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
|
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치가 이상이 없는지 체크하는 method
|
* @brief method to check if installation is succeeded
|
||||||
**/
|
**/
|
||||||
function checkUpdate() {
|
function checkUpdate() {
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
|
||||||
// 2007. 10. 17 게시글이 삭제될때 댓글도 삭제되도록 trigger 등록
|
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) return true;
|
if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) return true;
|
||||||
|
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
|
||||||
// 2007. 10. 17 모듈이 삭제될때 등록된 댓글도 모두 삭제하는 트리거 추가
|
|
||||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) return true;
|
if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) return true;
|
||||||
|
// 2007. 10. 23 add a column for recommendation votes or notification of the comments
|
||||||
// 2007. 10. 23 댓글에도 추천/ 알림 기능을 위한 컬럼 추가
|
|
||||||
if(!$oDB->isColumnExists("comments","voted_count")) return true;
|
if(!$oDB->isColumnExists("comments","voted_count")) return true;
|
||||||
if(!$oDB->isColumnExists("comments","notify_message")) return true;
|
if(!$oDB->isColumnExists("comments","notify_message")) return true;
|
||||||
|
// 2008. 02. 22 add comment setting when a new module added
|
||||||
// 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가
|
|
||||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) return true;
|
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) return true;
|
||||||
|
// 2008. 05. 14 add a column for blamed count
|
||||||
// 2008. 05. 14 blamed count 컬럼 추가
|
|
||||||
if(!$oDB->isColumnExists("comments", "blamed_count")) return true;
|
if(!$oDB->isColumnExists("comments", "blamed_count")) return true;
|
||||||
if(!$oDB->isColumnExists("comment_voted_log", "point")) return true;
|
if(!$oDB->isColumnExists("comment_voted_log", "point")) return true;
|
||||||
|
|
||||||
|
|
@ -56,22 +48,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 업데이트 실행
|
* @brief Execute update
|
||||||
**/
|
**/
|
||||||
function moduleUpdate() {
|
function moduleUpdate() {
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
|
// 2007. 10. 17 add a trigger to delete comments together with posting deleted
|
||||||
// 2007. 10. 17 게시글이 삭제될때 댓글도 삭제되도록 trigger 등록
|
|
||||||
if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
|
if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'))
|
||||||
$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
|
$oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after');
|
||||||
|
// 2007. 10. 17 add a trigger to delete all of comments together with module deleted
|
||||||
// 2007. 10. 17 모듈이 삭제될때 등록된 댓글도 모두 삭제하는 트리거 추가
|
|
||||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
|
if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'))
|
||||||
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
|
$oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after');
|
||||||
|
// 2007. 10. 23 add a column for recommendation votes or notification of the comments
|
||||||
// 2007. 10. 23 댓글에도 추천/ 알림 기능을 위한 컬럼 추가
|
|
||||||
if(!$oDB->isColumnExists("comments","voted_count")) {
|
if(!$oDB->isColumnExists("comments","voted_count")) {
|
||||||
$oDB->addColumn("comments","voted_count", "number","11");
|
$oDB->addColumn("comments","voted_count", "number","11");
|
||||||
$oDB->addIndex("comments","idx_voted_count", array("voted_count"));
|
$oDB->addIndex("comments","idx_voted_count", array("voted_count"));
|
||||||
|
|
@ -80,12 +69,10 @@
|
||||||
if(!$oDB->isColumnExists("comments","notify_message")) {
|
if(!$oDB->isColumnExists("comments","notify_message")) {
|
||||||
$oDB->addColumn("comments","notify_message", "char","1");
|
$oDB->addColumn("comments","notify_message", "char","1");
|
||||||
}
|
}
|
||||||
|
// 2008. 02. 22 add comment setting when a new module added
|
||||||
// 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가
|
|
||||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
|
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'))
|
||||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
|
$oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before');
|
||||||
|
// 2008. 05. 14 add a column for blamed count
|
||||||
// 2008. 05. 14 blamed count 컬럼 추가
|
|
||||||
if(!$oDB->isColumnExists("comments", "blamed_count")) {
|
if(!$oDB->isColumnExists("comments", "blamed_count")) {
|
||||||
$oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, true);
|
$oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, true);
|
||||||
$oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count'));
|
$oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count'));
|
||||||
|
|
@ -97,7 +84,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 캐시 파일 재생성
|
* @brief Regenerate cache file
|
||||||
**/
|
**/
|
||||||
function recompileCache() {
|
function recompileCache() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
/**
|
/**
|
||||||
* @class commentController
|
* @class commentController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief comment 모듈의 controller class
|
* @brief controller class of the comment module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class commentController extends comment {
|
class commentController extends comment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 댓글의 추천을 처리하는 action (Up)
|
* @brief action to handle recommendation votes on comments (Up)
|
||||||
**/
|
**/
|
||||||
function procCommentVoteUp() {
|
function procCommentVoteUp() {
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
|
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() {
|
function procCommentVoteDown() {
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
|
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() {
|
function procCommentDeclare() {
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request');
|
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) {
|
function triggerDeleteDocumentComments(&$obj) {
|
||||||
$document_srl = $obj->document_srl;
|
$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) {
|
function triggerDeleteModuleComments(&$obj) {
|
||||||
$module_srl = $obj->module_srl;
|
$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) {
|
function addGrant($comment_srl) {
|
||||||
$_SESSION['own_comment'][$comment_srl] = true;
|
$_SESSION['own_comment'][$comment_srl] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 댓글 입력
|
* @brief Enter comments
|
||||||
**/
|
**/
|
||||||
function insertComment($obj, $manual_inserted = false) {
|
function insertComment($obj, $manual_inserted = false) {
|
||||||
$obj->__isupdate = false;
|
$obj->__isupdate = false;
|
||||||
// trigger 호출 (before)
|
// call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj);
|
$output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
// check if a posting of the corresponding document_srl exists
|
||||||
// document_srl에 해당하는 글이 있는지 확인
|
|
||||||
$document_srl = $obj->document_srl;
|
$document_srl = $obj->document_srl;
|
||||||
if(!$document_srl) return new Object(-1,'msg_invalid_document');
|
if(!$document_srl) return new Object(-1,'msg_invalid_document');
|
||||||
|
// get a object of document model
|
||||||
// document model 객체 생성
|
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
|
|
||||||
// even for manual_inserted if password exists, md5 it.
|
// even for manual_inserted if password exists, md5 it.
|
||||||
if($obj->password) $obj->password = md5($obj->password);
|
if($obj->password) $obj->password = md5($obj->password);
|
||||||
// 원본글을 가져옴
|
// get the original posting
|
||||||
if(!$manual_inserted) {
|
if(!$manual_inserted) {
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
|
|
||||||
|
|
@ -124,8 +122,7 @@
|
||||||
if($oDocument->isLocked()) return new Object(-1,'msg_invalid_request');
|
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;
|
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')) {
|
if(Context::get('is_logged')) {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$obj->member_srl = $logged_info->member_srl;
|
$obj->member_srl = $logged_info->member_srl;
|
||||||
|
|
@ -136,24 +133,20 @@
|
||||||
$obj->homepage = $logged_info->homepage;
|
$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(!$logged_info->member_srl && !$obj->nick_name) return new Object(-1,'msg_invalid_request');
|
||||||
|
|
||||||
if(!$obj->comment_srl) $obj->comment_srl = getNextSequence();
|
if(!$obj->comment_srl) $obj->comment_srl = getNextSequence();
|
||||||
|
// determine the order
|
||||||
// 순서를 정함
|
|
||||||
$obj->list_order = getNextSequence() * -1;
|
$obj->list_order = getNextSequence() * -1;
|
||||||
|
// remove XE's own tags from the contents
|
||||||
// 내용에서 XE만의 태그를 삭제
|
|
||||||
$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
|
$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
|
||||||
if(Mobile::isFromMobilePhone())
|
if(Mobile::isFromMobilePhone())
|
||||||
{
|
{
|
||||||
$obj->content = nl2br(htmlspecialchars($obj->content));
|
$obj->content = nl2br(htmlspecialchars($obj->content));
|
||||||
}
|
}
|
||||||
if(!$obj->regdate) $obj->regdate = date("YmdHis");
|
if(!$obj->regdate) $obj->regdate = date("YmdHis");
|
||||||
|
// remove iframe and script if not a top administrator on the session.
|
||||||
// 세션에서 최고 관리자가 아니면 iframe, script 제거
|
|
||||||
if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
|
if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
|
||||||
|
|
||||||
if(!$obj->notify_message) $obj->notify_message = 'N';
|
if(!$obj->notify_message) $obj->notify_message = 'N';
|
||||||
|
|
@ -162,38 +155,32 @@
|
||||||
// begin transaction
|
// begin transaction
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
// Enter a list of comments first
|
||||||
// 댓글 목록 부분을 먼저 입력
|
|
||||||
$list_args->comment_srl = $obj->comment_srl;
|
$list_args->comment_srl = $obj->comment_srl;
|
||||||
$list_args->document_srl = $obj->document_srl;
|
$list_args->document_srl = $obj->document_srl;
|
||||||
$list_args->module_srl = $obj->module_srl;
|
$list_args->module_srl = $obj->module_srl;
|
||||||
$list_args->regdate = $obj->regdate;
|
$list_args->regdate = $obj->regdate;
|
||||||
|
// If parent comment doesn't exist, set data directly
|
||||||
// 부모댓글이 없으면 바로 데이터를 설정
|
|
||||||
if(!$obj->parent_srl) {
|
if(!$obj->parent_srl) {
|
||||||
$list_args->head = $list_args->arrange = $obj->comment_srl;
|
$list_args->head = $list_args->arrange = $obj->comment_srl;
|
||||||
$list_args->depth = 0;
|
$list_args->depth = 0;
|
||||||
|
// If parent comment exists, get information of the parent comment
|
||||||
// 부모댓글이 있으면 부모글의 정보를 구해옴
|
|
||||||
} else {
|
} else {
|
||||||
// 부모댓글의 정보를 구함
|
// get information of the parent comment posting
|
||||||
$parent_args->comment_srl = $obj->parent_srl;
|
$parent_args->comment_srl = $obj->parent_srl;
|
||||||
$parent_output = executeQuery('comment.getCommentListItem', $parent_args);
|
$parent_output = executeQuery('comment.getCommentListItem', $parent_args);
|
||||||
|
// return if no parent comment exists
|
||||||
// 부모댓글이 존재하지 않으면 return
|
|
||||||
if(!$parent_output->toBool() || !$parent_output->data) return;
|
if(!$parent_output->toBool() || !$parent_output->data) return;
|
||||||
$parent = $parent_output->data;
|
$parent = $parent_output->data;
|
||||||
|
|
||||||
$list_args->head = $parent->head;
|
$list_args->head = $parent->head;
|
||||||
$list_args->depth = $parent->depth+1;
|
$list_args->depth = $parent->depth+1;
|
||||||
|
// if the depth of comments is less than 2, execute insert.
|
||||||
// depth가 2단계 미만이면 별도의 update문 없이 insert만으로 쓰레드 정리
|
|
||||||
if($list_args->depth<2) {
|
if($list_args->depth<2) {
|
||||||
$list_args->arrange = $obj->comment_srl;
|
$list_args->arrange = $obj->comment_srl;
|
||||||
|
// if the depth of comments is greater than 2, execute update.
|
||||||
// depth가 2단계 이상이면 반업데이트 실행
|
|
||||||
} else {
|
} 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->head = $parent->head;
|
||||||
$p_args->arrange = $parent->arrange;
|
$p_args->arrange = $parent->arrange;
|
||||||
$p_args->depth = $parent->depth;
|
$p_args->depth = $parent->depth;
|
||||||
|
|
@ -211,31 +198,23 @@
|
||||||
|
|
||||||
$output = executeQuery('comment.insertCommentList', $list_args);
|
$output = executeQuery('comment.insertCommentList', $list_args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
// insert comment
|
||||||
// 댓글 본문을 입력
|
|
||||||
$output = executeQuery('comment.insertComment', $obj);
|
$output = executeQuery('comment.insertComment', $obj);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// creat the comment model object
|
||||||
// comment model객체 생성
|
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
|
// get the number of all comments in the posting
|
||||||
// 해당 글의 전체 댓글 수를 구해옴
|
|
||||||
$comment_count = $oCommentModel->getCommentCount($document_srl);
|
$comment_count = $oCommentModel->getCommentCount($document_srl);
|
||||||
|
// create the controller object of the document
|
||||||
// document의 controller 객체 생성
|
|
||||||
$oDocumentController = &getController('document');
|
$oDocumentController = &getController('document');
|
||||||
|
// Update the number of comments in the post
|
||||||
// 해당글의 댓글 수를 업데이트
|
|
||||||
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, true);
|
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, true);
|
||||||
|
// grant autority of the comment
|
||||||
// 댓글의 권한을 부여
|
|
||||||
$this->addGrant($obj->comment_srl);
|
$this->addGrant($obj->comment_srl);
|
||||||
|
// call a trigger(after)
|
||||||
|
|
||||||
// trigger 호출 (after)
|
|
||||||
if($output->toBool()) {
|
if($output->toBool()) {
|
||||||
$trigger_output = ModuleHandler::triggerCall('comment.insertComment', 'after', $obj);
|
$trigger_output = ModuleHandler::triggerCall('comment.insertComment', 'after', $obj);
|
||||||
if(!$trigger_output->toBool()) {
|
if(!$trigger_output->toBool()) {
|
||||||
|
|
@ -248,10 +227,9 @@
|
||||||
$oDB->commit();
|
$oDB->commit();
|
||||||
|
|
||||||
if(!$manual_inserted) {
|
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);
|
$oDocument->notify(Context::getLang('comment'), $obj->content);
|
||||||
|
// send a message if notify_message option in enabled in the original comment
|
||||||
// 원본 댓글이 있고 원본 댓글에 알림(notify_message)가 있으면 메세지 보냄
|
|
||||||
if($obj->parent_srl) {
|
if($obj->parent_srl) {
|
||||||
$oParent = $oCommentModel->getComment($obj->parent_srl);
|
$oParent = $oCommentModel->getComment($obj->parent_srl);
|
||||||
if ($oParent->get('member_srl') != $oDocument->get('member_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) {
|
function updateComment($obj, $is_admin = false) {
|
||||||
$obj->__isupdate = true;
|
$obj->__isupdate = true;
|
||||||
// trigger 호출 (before)
|
// call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj);
|
$output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
// create a comment model object
|
||||||
// comment model 객체 생성
|
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
|
// get the original data
|
||||||
// 원본 데이터를 가져옴
|
|
||||||
$source_obj = $oCommentModel->getComment($obj->comment_srl);
|
$source_obj = $oCommentModel->getComment($obj->comment_srl);
|
||||||
if(!$source_obj->getMemberSrl()) {
|
if(!$source_obj->getMemberSrl()) {
|
||||||
$obj->member_srl = $source_obj->get('member_srl');
|
$obj->member_srl = $source_obj->get('member_srl');
|
||||||
|
|
@ -286,14 +262,12 @@
|
||||||
$obj->email_address = $source_obj->get('email_address');
|
$obj->email_address = $source_obj->get('email_address');
|
||||||
$obj->homepage = $source_obj->get('homepage');
|
$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(!$is_admin && !$source_obj->isGranted()) return new Object(-1, 'msg_not_permitted');
|
||||||
|
|
||||||
if($obj->password) $obj->password = md5($obj->password);
|
if($obj->password) $obj->password = md5($obj->password);
|
||||||
if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage;
|
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')) {
|
if(Context::get('is_logged')) {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($source_obj->member_srl == $logged_info->member_srl) {
|
if($source_obj->member_srl == $logged_info->member_srl) {
|
||||||
|
|
@ -304,8 +278,7 @@
|
||||||
$obj->homepage = $logged_info->homepage;
|
$obj->homepage = $logged_info->homepage;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// if nick_name of the logged-in author doesn't exist
|
||||||
// 로그인한 유저가 작성한 글인데 nick_name이 없을 경우
|
|
||||||
if($source_obj->get('member_srl')&& !$obj->nick_name) {
|
if($source_obj->get('member_srl')&& !$obj->nick_name) {
|
||||||
$obj->member_srl = $source_obj->get('member_srl');
|
$obj->member_srl = $source_obj->get('member_srl');
|
||||||
$obj->user_name = $source_obj->get('user_name');
|
$obj->user_name = $source_obj->get('user_name');
|
||||||
|
|
@ -316,25 +289,21 @@
|
||||||
|
|
||||||
|
|
||||||
if(!$obj->content) $obj->content = $source_obj->get('content');
|
if(!$obj->content) $obj->content = $source_obj->get('content');
|
||||||
|
// remove XE's wn tags from contents
|
||||||
// 내용에서 XE만의 태그를 삭제
|
|
||||||
$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
|
$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content);
|
||||||
|
// remove iframe and script if not a top administrator on the session
|
||||||
// 세션에서 최고 관리자가 아니면 iframe, script 제거
|
|
||||||
if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
|
if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content);
|
||||||
|
|
||||||
// begin transaction
|
// begin transaction
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
// Update
|
||||||
// 업데이트
|
|
||||||
$output = executeQuery('comment.updateComment', $obj);
|
$output = executeQuery('comment.updateComment', $obj);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// call a trigger (after)
|
||||||
// trigger 호출 (after)
|
|
||||||
if($output->toBool()) {
|
if($output->toBool()) {
|
||||||
$trigger_output = ModuleHandler::triggerCall('comment.updateComment', 'after', $obj);
|
$trigger_output = ModuleHandler::triggerCall('comment.updateComment', 'after', $obj);
|
||||||
if(!$trigger_output->toBool()) {
|
if(!$trigger_output->toBool()) {
|
||||||
|
|
@ -351,34 +320,28 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 댓글 삭제
|
* @brief Delete comment
|
||||||
**/
|
**/
|
||||||
function deleteComment($comment_srl, $is_admin = false) {
|
function deleteComment($comment_srl, $is_admin = false) {
|
||||||
|
// create the comment model object
|
||||||
// comment model 객체 생성
|
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
|
// check if comment already exists
|
||||||
// 기존 댓글이 있는지 확인
|
|
||||||
$comment = $oCommentModel->getComment($comment_srl);
|
$comment = $oCommentModel->getComment($comment_srl);
|
||||||
if($comment->comment_srl != $comment_srl) return new Object(-1, 'msg_invalid_request');
|
if($comment->comment_srl != $comment_srl) return new Object(-1, 'msg_invalid_request');
|
||||||
$document_srl = $comment->document_srl;
|
$document_srl = $comment->document_srl;
|
||||||
|
// call a trigger (before)
|
||||||
// trigger 호출 (before)
|
|
||||||
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
|
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
// check if child comment exists on the comment
|
||||||
// 해당 댓글에 child가 있는지 확인
|
|
||||||
$child_count = $oCommentModel->getChildCommentCount($comment_srl);
|
$child_count = $oCommentModel->getChildCommentCount($comment_srl);
|
||||||
if($child_count>0) return new Object(-1, 'fail_to_delete_have_children');
|
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');
|
if(!$is_admin && !$comment->isGranted()) return new Object(-1, 'msg_not_permitted');
|
||||||
|
|
||||||
// begin transaction
|
// begin transaction
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
// Delete
|
||||||
// 삭제
|
|
||||||
$args->comment_srl = $comment_srl;
|
$args->comment_srl = $comment_srl;
|
||||||
$output = executeQuery('comment.deleteComment', $args);
|
$output = executeQuery('comment.deleteComment', $args);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
|
|
@ -387,21 +350,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = executeQuery('comment.deleteCommentList', $args);
|
$output = executeQuery('comment.deleteCommentList', $args);
|
||||||
|
// update the number of comments
|
||||||
// 댓글 수를 구해서 업데이트
|
|
||||||
$comment_count = $oCommentModel->getCommentCount($document_srl);
|
$comment_count = $oCommentModel->getCommentCount($document_srl);
|
||||||
|
// create the controller object of the document
|
||||||
// document의 controller 객체 생성
|
|
||||||
$oDocumentController = &getController('document');
|
$oDocumentController = &getController('document');
|
||||||
|
// update comment count of the article posting
|
||||||
// 해당글의 댓글 수를 업데이트
|
|
||||||
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, null, false);
|
$output = $oDocumentController->updateCommentCount($document_srl, $comment_count, null, false);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// call a trigger (after)
|
||||||
// trigger 호출 (after)
|
|
||||||
if($output->toBool()) {
|
if($output->toBool()) {
|
||||||
$trigger_output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment);
|
$trigger_output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment);
|
||||||
if(!$trigger_output->toBool()) {
|
if(!$trigger_output->toBool()) {
|
||||||
|
|
@ -418,45 +377,40 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 글의 모든 댓글 삭제
|
* @brief remove all comments of the article
|
||||||
**/
|
**/
|
||||||
function deleteComments($document_srl) {
|
function deleteComments($document_srl) {
|
||||||
// document model객체 생성
|
// create the document model object
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
|
// check if permission is granted
|
||||||
// 권한이 있는지 확인
|
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
if(!$oDocument->isExists() || !$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
|
if(!$oDocument->isExists() || !$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted');
|
||||||
|
// get a list of comments and then execute a trigger(way to reduce the processing cost for delete all)
|
||||||
// 댓글 목록을 가져와서 일단 trigger만 실행 (일괄 삭제를 해야 하기에 최대한 처리 비용을 줄이기 위한 방법)
|
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
$comments = executeQueryArray('comment.getAllComments',$args);
|
$comments = executeQueryArray('comment.getAllComments',$args);
|
||||||
if($comments->data) {
|
if($comments->data) {
|
||||||
foreach($comments->data as $key => $comment) {
|
foreach($comments->data as $key => $comment) {
|
||||||
// trigger 호출 (before)
|
// call a trigger (before)
|
||||||
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
|
$output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment);
|
||||||
if(!$output->toBool()) continue;
|
if(!$output->toBool()) continue;
|
||||||
|
// call a trigger (after)
|
||||||
// trigger 호출 (after)
|
|
||||||
$output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment);
|
$output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment);
|
||||||
if(!$output->toBool()) continue;
|
if(!$output->toBool()) continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// delete the comment
|
||||||
// 댓글 본문 삭제
|
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
$output = executeQuery('comment.deleteComments', $args);
|
$output = executeQuery('comment.deleteComments', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
// Delete a list of comments
|
||||||
// 댓글 목록 삭제
|
|
||||||
$output = executeQuery('comment.deleteCommentsList', $args);
|
$output = executeQuery('comment.deleteCommentsList', $args);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 해당 comment의 추천수 증가
|
* @brief Increase vote-up counts of the comment
|
||||||
**/
|
**/
|
||||||
function updateVotedCount($comment_srl, $point = 1) {
|
function updateVotedCount($comment_srl, $point = 1) {
|
||||||
if($point > 0) {
|
if($point > 0) {
|
||||||
|
|
@ -467,31 +421,28 @@
|
||||||
$success_message = 'success_blamed';
|
$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);
|
if($_SESSION['voted_comment'][$comment_srl]) return new Object(-1, $failed_voted);
|
||||||
|
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
$oComment = $oCommentModel->getComment($comment_srl, false, false);
|
$oComment = $oCommentModel->getComment($comment_srl, false, false);
|
||||||
|
// invalid vote if both ip addresses between author's and the current user are same.
|
||||||
// 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스
|
|
||||||
if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
|
if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
|
||||||
$_SESSION['voted_comment'][$comment_srl] = true;
|
$_SESSION['voted_comment'][$comment_srl] = true;
|
||||||
return new Object(-1, $failed_voted);
|
return new Object(-1, $failed_voted);
|
||||||
}
|
}
|
||||||
|
// if the comment author is a member
|
||||||
// comment의 작성자가 회원일때 조사
|
|
||||||
if($oComment->get('member_srl')) {
|
if($oComment->get('member_srl')) {
|
||||||
|
// create the member model object
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$member_srl = $oMemberModel->getLoggedMemberSrl();
|
$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')) {
|
if($member_srl && $member_srl == $oComment->get('member_srl')) {
|
||||||
$_SESSION['voted_comment'][$comment_srl] = true;
|
$_SESSION['voted_comment'][$comment_srl] = true;
|
||||||
return new Object(-1, $failed_voted);
|
return new Object(-1, $failed_voted);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If logged-in, use the member_srl. otherwise use the ipaddress.
|
||||||
// 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단
|
|
||||||
if($member_srl) {
|
if($member_srl) {
|
||||||
$args->member_srl = $member_srl;
|
$args->member_srl = $member_srl;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -499,14 +450,13 @@
|
||||||
}
|
}
|
||||||
$args->comment_srl = $comment_srl;
|
$args->comment_srl = $comment_srl;
|
||||||
$output = executeQuery('comment.getCommentVotedLogInfo', $args);
|
$output = executeQuery('comment.getCommentVotedLogInfo', $args);
|
||||||
|
// session registered if log info contains recommendation vote log.
|
||||||
// 로그 정보에 추천 로그가 있으면 세션 등록후 패스
|
|
||||||
if($output->data->count) {
|
if($output->data->count) {
|
||||||
$_SESSION['voted_comment'][$comment_srl] = true;
|
$_SESSION['voted_comment'][$comment_srl] = true;
|
||||||
return new Object(-1, $failed_voted);
|
return new Object(-1, $failed_voted);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 추천수 업데이트
|
// update the number of votes
|
||||||
if($point < 0) {
|
if($point < 0) {
|
||||||
$args->blamed_count = $oComment->get('blamed_count') + $point;
|
$args->blamed_count = $oComment->get('blamed_count') + $point;
|
||||||
$output = executeQuery('comment.updateBlamedCount', $args);
|
$output = executeQuery('comment.updateBlamedCount', $args);
|
||||||
|
|
@ -514,54 +464,46 @@
|
||||||
$args->voted_count = $oComment->get('voted_count') + $point;
|
$args->voted_count = $oComment->get('voted_count') + $point;
|
||||||
$output = executeQuery('comment.updateVotedCount', $args);
|
$output = executeQuery('comment.updateVotedCount', $args);
|
||||||
}
|
}
|
||||||
|
// leave logs
|
||||||
// 로그 남기기
|
|
||||||
$args->point = $point;
|
$args->point = $point;
|
||||||
$output = executeQuery('comment.insertCommentVotedLog', $args);
|
$output = executeQuery('comment.insertCommentVotedLog', $args);
|
||||||
|
// leave into session information
|
||||||
// 세션 정보에 남김
|
|
||||||
$_SESSION['voted_comment'][$comment_srl] = true;
|
$_SESSION['voted_comment'][$comment_srl] = true;
|
||||||
|
|
||||||
// 결과 리턴
|
// Return the result
|
||||||
return new Object(0, $success_message);
|
return new Object(0, $success_message);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 댓글 신고
|
* @brief report a blamed comment
|
||||||
**/
|
**/
|
||||||
function declaredComment($comment_srl) {
|
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');
|
if($_SESSION['declared_comment'][$comment_srl]) return new Object(-1, 'failed_declared');
|
||||||
|
// check if already reported
|
||||||
// 이미 신고되었는지 검사
|
|
||||||
$args->comment_srl = $comment_srl;
|
$args->comment_srl = $comment_srl;
|
||||||
$output = executeQuery('comment.getDeclaredComment', $args);
|
$output = executeQuery('comment.getDeclaredComment', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
// get the original comment
|
||||||
// 문서 원본을 가져옴
|
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
$oComment = $oCommentModel->getComment($comment_srl, false, false);
|
$oComment = $oCommentModel->getComment($comment_srl, false, false);
|
||||||
|
// failed if both ip addresses between author's and the current user are same.
|
||||||
// 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스
|
|
||||||
if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
|
if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
|
||||||
$_SESSION['declared_comment'][$comment_srl] = true;
|
$_SESSION['declared_comment'][$comment_srl] = true;
|
||||||
return new Object(-1, 'failed_declared');
|
return new Object(-1, 'failed_declared');
|
||||||
}
|
}
|
||||||
|
// if the comment author is a member
|
||||||
// comment의 작성자가 회원일때 조사
|
|
||||||
if($oComment->get('member_srl')) {
|
if($oComment->get('member_srl')) {
|
||||||
// member model 객체 생성
|
// create the member model object
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$member_srl = $oMemberModel->getLoggedMemberSrl();
|
$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')) {
|
if($member_srl && $member_srl == $oComment->get('member_srl')) {
|
||||||
$_SESSION['declared_comment'][$comment_srl] = true;
|
$_SESSION['declared_comment'][$comment_srl] = true;
|
||||||
return new Object(-1, 'failed_declared');
|
return new Object(-1, 'failed_declared');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If logged-in, use the member_srl. otherwise use the ipaddress.
|
||||||
// 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단
|
|
||||||
if($member_srl) {
|
if($member_srl) {
|
||||||
$args->member_srl = $member_srl;
|
$args->member_srl = $member_srl;
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -569,29 +511,25 @@
|
||||||
}
|
}
|
||||||
$args->comment_srl = $comment_srl;
|
$args->comment_srl = $comment_srl;
|
||||||
$output = executeQuery('comment.getCommentDeclaredLogInfo', $args);
|
$output = executeQuery('comment.getCommentDeclaredLogInfo', $args);
|
||||||
|
// session registered if log info contains report log.
|
||||||
// 로그 정보에 신고 로그가 있으면 세션 등록후 패스
|
|
||||||
if($output->data->count) {
|
if($output->data->count) {
|
||||||
$_SESSION['declared_comment'][$comment_srl] = true;
|
$_SESSION['declared_comment'][$comment_srl] = true;
|
||||||
return new Object(-1, 'failed_declared');
|
return new Object(-1, 'failed_declared');
|
||||||
}
|
}
|
||||||
|
// execute insert
|
||||||
// 신고글 추가
|
|
||||||
if($output->data->declared_count > 0) $output = executeQuery('comment.updateDeclaredComment', $args);
|
if($output->data->declared_count > 0) $output = executeQuery('comment.updateDeclaredComment', $args);
|
||||||
else $output = executeQuery('comment.insertDeclaredComment', $args);
|
else $output = executeQuery('comment.insertDeclaredComment', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
// leave the log
|
||||||
// 로그 남기기
|
|
||||||
$output = executeQuery('comment.insertCommentDeclaredLog', $args);
|
$output = executeQuery('comment.insertCommentDeclaredLog', $args);
|
||||||
|
// leave into the session information
|
||||||
// 세션 정보에 남김
|
|
||||||
$_SESSION['declared_comment'][$comment_srl] = true;
|
$_SESSION['declared_comment'][$comment_srl] = true;
|
||||||
|
|
||||||
$this->setMessage('success_declared');
|
$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') {
|
function addCommentPopupMenu($url, $str, $icon = '', $target = 'self') {
|
||||||
$comment_popup_menu_list = Context::get('comment_popup_menu_list');
|
$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() {
|
function procCommentInsertModuleConfig() {
|
||||||
$module_srl = Context::get('target_module_srl');
|
$module_srl = Context::get('target_module_srl');
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class commentItem
|
* @class commentItem
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief comment 객체
|
* @brief comment Object
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class commentItem extends Object {
|
class commentItem extends Object {
|
||||||
|
|
@ -35,8 +35,7 @@
|
||||||
}
|
}
|
||||||
$this->comment_srl = $attribute->comment_srl;
|
$this->comment_srl = $attribute->comment_srl;
|
||||||
$this->adds($attribute);
|
$this->adds($attribute);
|
||||||
|
// define vars on the object for backward compatibility of skins
|
||||||
// 기존 스킨의 호환을 위해 변수를 객체 자신에 재선언
|
|
||||||
if(count($attribute)) foreach($attribute as $key => $val) $this->{$key} = $val;
|
if(count($attribute)) foreach($attribute as $key => $val) $this->{$key} = $val;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -101,28 +100,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function notify($type, $content) {
|
function notify($type, $content) {
|
||||||
// useNotify가 아니면 return
|
// return if not useNotify
|
||||||
if(!$this->useNotify()) return;
|
if(!$this->useNotify()) return;
|
||||||
|
// pass if the author is not logged-in user
|
||||||
// 글쓴이가 로그인 유저가 아니면 패스~
|
|
||||||
if(!$this->get('member_srl')) return;
|
if(!$this->get('member_srl')) return;
|
||||||
|
// return if the currently logged-in user is an author of the comment.
|
||||||
// 현재 로그인한 사용자와 글을 쓴 사용자를 비교하여 동일하면 return
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($logged_info->member_srl == $this->get('member_srl')) return;
|
if($logged_info->member_srl == $this->get('member_srl')) return;
|
||||||
|
// get where the comment belongs to
|
||||||
// 원본글의 주소를 구함
|
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
|
$oDocument = $oDocumentModel->getDocument($this->get('document_srl'));
|
||||||
|
// Variables
|
||||||
// 변수 정리
|
|
||||||
if($type) $title = "[".$type."] ";
|
if($type) $title = "[".$type."] ";
|
||||||
$title .= cut_str(strip_tags($content), 30, '...');
|
$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')));
|
$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');
|
$receiver_srl = $this->get('member_srl');
|
||||||
$sender_member_srl = $logged_info->member_srl;
|
$sender_member_srl = $logged_info->member_srl;
|
||||||
|
// send a message
|
||||||
// 쪽지 발송
|
|
||||||
$oCommunicationController = &getController('communication');
|
$oCommunicationController = &getController('communication');
|
||||||
$oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false);
|
$oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false);
|
||||||
}
|
}
|
||||||
|
|
@ -177,8 +171,7 @@
|
||||||
|
|
||||||
$content = $this->get('content');
|
$content = $this->get('content');
|
||||||
stripEmbedTagForAdmin($content, $this->get('member_srl'));
|
stripEmbedTagForAdmin($content, $this->get('member_srl'));
|
||||||
|
// when displaying the comment on the pop-up menu
|
||||||
// 이 댓글을... 팝업메뉴를 출력할 경우
|
|
||||||
if($add_popup_menu && Context::get('is_logged') ) {
|
if($add_popup_menu && Context::get('is_logged') ) {
|
||||||
$content = sprintf(
|
$content = sprintf(
|
||||||
'%s<div class="comment_popup_menu"><a href="#popup_menu_area" class="comment_%d" onclick="return false">%s</a></div>',
|
'%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')
|
$this->comment_srl, Context::getLang('cmd_comment_do')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// if additional information which can access contents is set
|
||||||
// 컨텐츠에 대한 조작이 가능한 추가 정보를 설정하였을 경우
|
|
||||||
if($add_content_info) {
|
if($add_content_info) {
|
||||||
$content = sprintf(
|
$content = sprintf(
|
||||||
'<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->',
|
'<!--BeforeComment(%d,%d)--><div class="comment_%d_%d xe_content">%s</div><!--AfterComment(%d,%d)-->',
|
||||||
|
|
@ -196,7 +188,7 @@
|
||||||
$content,
|
$content,
|
||||||
$this->comment_srl, $this->get('member_srl')
|
$this->comment_srl, $this->get('member_srl')
|
||||||
);
|
);
|
||||||
// 컨텐츠에 대한 조작이 필요하지 않더라도 xe_content라는 클래스명을 꼭 부여
|
// xe_content class name should be specified although content access is not necessary.
|
||||||
} else {
|
} else {
|
||||||
if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
|
if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
|
||||||
}
|
}
|
||||||
|
|
@ -206,26 +198,19 @@
|
||||||
|
|
||||||
function getSummary($str_size = 50, $tail = '...') {
|
function getSummary($str_size = 50, $tail = '...') {
|
||||||
$content = $this->getContent(false, false);
|
$content = $this->getContent(false, false);
|
||||||
|
// for newline, insert a blank.
|
||||||
// 줄바꿈이 있을 때, 공백문자 삽입
|
|
||||||
$content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content);
|
$content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content);
|
||||||
|
// replace tags such as </p> , </div> , </li> by blanks.
|
||||||
// </p>, </div>, </li> 등의 태그를 공백 문자로 치환
|
|
||||||
$content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content);
|
$content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content);
|
||||||
|
// Remove tags
|
||||||
// 태그 제거
|
|
||||||
$content = preg_replace('!<([^>]*?)>!is','', $content);
|
$content = preg_replace('!<([^>]*?)>!is','', $content);
|
||||||
|
// replace < , >, "
|
||||||
// < , > , " 를 치환
|
|
||||||
$content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content);
|
$content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content);
|
||||||
|
// delete a series of blanks
|
||||||
// 연속된 공백문자 삭제
|
|
||||||
$content = preg_replace('/ ( +)/is', ' ', $content);
|
$content = preg_replace('/ ( +)/is', ' ', $content);
|
||||||
|
// truncate strings
|
||||||
// 문자열을 자름
|
|
||||||
$content = trim(cut_str($content, $str_size, $tail));
|
$content = trim(cut_str($content, $str_size, $tail));
|
||||||
|
// restore >, <, , "\
|
||||||
// >, <, "를 다시 복구
|
|
||||||
$content = str_replace(array('<','>','"'),array('<','>','"'), $content);
|
$content = str_replace(array('<','>','"'),array('<','>','"'), $content);
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
|
|
@ -288,7 +273,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 에디터 html을 구해서 return
|
* @brief return the editor html
|
||||||
**/
|
**/
|
||||||
function getEditor() {
|
function getEditor() {
|
||||||
$module_srl = $this->get('module_srl');
|
$module_srl = $this->get('module_srl');
|
||||||
|
|
@ -298,7 +283,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 작성자의 프로필 이미지를 return
|
* @brief return author's profile image
|
||||||
**/
|
**/
|
||||||
function getProfileImage() {
|
function getProfileImage() {
|
||||||
if(!$this->isExists() || !$this->get('member_srl')) return;
|
if(!$this->isExists() || !$this->get('member_srl')) return;
|
||||||
|
|
@ -310,17 +295,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 작성자의 서명을 return
|
* @brief return author's signiture
|
||||||
**/
|
**/
|
||||||
function getSignature() {
|
function getSignature() {
|
||||||
// 존재하지 않는 글이면 패스~
|
// pass if the posting not exists.
|
||||||
if(!$this->isExists() || !$this->get('member_srl')) return;
|
if(!$this->isExists() || !$this->get('member_srl')) return;
|
||||||
|
// get the signiture information
|
||||||
// 서명정보를 구함
|
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$signature = $oMemberModel->getSignature($this->get('member_srl'));
|
$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'])) {
|
if(!isset($GLOBALS['__member_signature_max_height'])) {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$member_config = $oModuleModel->getModuleConfig('member');
|
$member_config = $oModuleModel->getModuleConfig('member');
|
||||||
|
|
@ -339,34 +322,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') {
|
function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') {
|
||||||
// 존재하지 않는 문서일 경우 return false
|
// return false if no doc exists
|
||||||
if(!$this->comment_srl) return;
|
if(!$this->comment_srl) return;
|
||||||
|
// If signiture height setting is omitted, create a square
|
||||||
// 높이 지정이 별도로 없으면 정사각형으로 생성
|
|
||||||
if(!$height) $height = $width;
|
if(!$height) $height = $width;
|
||||||
|
// return false if neigher attached file nor image;
|
||||||
// 첨부파일이 없거나 내용중 이미지가 없으면 return false;
|
|
||||||
if(!$this->hasUploadedFiles() && !preg_match("!<img!is", $this->get('content'))) return;
|
if(!$this->hasUploadedFiles() && !preg_match("!<img!is", $this->get('content'))) return;
|
||||||
|
// get thumbail generation info on the doc module configuration.
|
||||||
// 문서 모듈의 기본 설정에서 Thumbnail의 생성 방법을 구함
|
|
||||||
if(!in_array($thumbnail_type, array('crop','ratio'))) $thumbnail_type = 'crop';
|
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_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_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
|
||||||
$thumbnail_url = Context::getRequestUri().$thumbnail_file;
|
$thumbnail_url = Context::getRequestUri().$thumbnail_file;
|
||||||
|
// return false if a size of existing thumbnail file is 0. otherwise return the file path
|
||||||
// 섬네일 파일이 있을 경우 파일의 크기가 0 이면 return false 아니면 경로 return
|
|
||||||
if(file_exists($thumbnail_file)) {
|
if(file_exists($thumbnail_file)) {
|
||||||
if(filesize($thumbnail_file)<1) return false;
|
if(filesize($thumbnail_file)<1) return false;
|
||||||
else return $thumbnail_url;
|
else return $thumbnail_url;
|
||||||
}
|
}
|
||||||
|
// Target file
|
||||||
// 대상 파일
|
|
||||||
$source_file = null;
|
$source_file = null;
|
||||||
$is_tmp_file = false;
|
$is_tmp_file = false;
|
||||||
|
// find an image file among attached files
|
||||||
// 첨부된 파일중 이미지 파일이 있으면 찾음
|
|
||||||
if($this->hasUploadedFiles()) {
|
if($this->hasUploadedFiles()) {
|
||||||
$file_list = $this->getUploadedFiles();
|
$file_list = $this->getUploadedFiles();
|
||||||
if(count($file_list)) {
|
if(count($file_list)) {
|
||||||
|
|
@ -380,8 +356,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// get an image file from the doc content if no file attached.
|
||||||
// 첨부된 파일이 없으면 내용중 이미지 파일을 구함
|
|
||||||
if(!$source_file) {
|
if(!$source_file) {
|
||||||
$content = $this->get('content');
|
$content = $this->get('content');
|
||||||
$target_src = null;
|
$target_src = null;
|
||||||
|
|
@ -411,11 +386,9 @@
|
||||||
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
|
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
|
||||||
|
|
||||||
if($is_tmp_file) FileHandler::removeFile($source_file);
|
if($is_tmp_file) FileHandler::removeFile($source_file);
|
||||||
|
// return the thumbnail path if successfully generated.
|
||||||
// 섬네일 생성 성공시 경로 return
|
|
||||||
if($output) return $thumbnail_url;
|
if($output) return $thumbnail_url;
|
||||||
|
// create an empty file not to attempt to generate the thumbnail afterwards
|
||||||
// 차후 다시 섬네일 생성을 시도하지 않기 위해 빈 파일을 생성
|
|
||||||
else FileHandler::writeFile($thumbnail_file, '','w');
|
else FileHandler::writeFile($thumbnail_file, '','w');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -2,39 +2,36 @@
|
||||||
/**
|
/**
|
||||||
* @class commentModel
|
* @class commentModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief comment 모듈의 model class
|
* @brief model class of the comment module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class commentModel extends comment {
|
class commentModel extends comment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
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() {
|
function getCommentMenu() {
|
||||||
|
// get the post's id number and the current login information
|
||||||
// 요청된 게시물 번호와 현재 로그인 정보 구함
|
|
||||||
$comment_srl = Context::get('target_srl');
|
$comment_srl = Context::get('target_srl');
|
||||||
$mid = Context::get('cur_mid');
|
$mid = Context::get('cur_mid');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$act = Context::get('cur_act');
|
$act = Context::get('cur_act');
|
||||||
|
|
||||||
// menu_list 에 "표시할글,target,url" 을 배열로 넣는다
|
// array values for menu_list, "comment post, target, url"
|
||||||
$menu_list = array();
|
$menu_list = array();
|
||||||
|
// call a trigger
|
||||||
// trigger 호출
|
|
||||||
ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list);
|
ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list);
|
||||||
|
|
||||||
$oCommentController = &getController('comment');
|
$oCommentController = &getController('comment');
|
||||||
|
// feature that only member can do
|
||||||
// 회원이어야만 가능한 기능
|
|
||||||
if($logged_info->member_srl) {
|
if($logged_info->member_srl) {
|
||||||
|
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
|
|
@ -45,31 +42,29 @@
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$comment_config = $oModuleModel->getModulePartConfig('document',$module_srl);
|
$comment_config = $oModuleModel->getModulePartConfig('document',$module_srl);
|
||||||
if($comment_config->use_vote_up!='N' && $member_srl!=$logged_info->member_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);
|
$url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl);
|
||||||
$oCommentController->addCommentPopupMenu($url,'cmd_vote','./modules/document/tpl/icons/vote_up.gif','javascript');
|
$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){
|
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);
|
$url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl);
|
||||||
$oCommentController->addCommentPopupMenu($url,'cmd_vote_down','./modules/document/tpl/icons/vote_down.gif','javascript');
|
$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);
|
$url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl);
|
||||||
$oCommentController->addCommentPopupMenu($url,'cmd_declare','./modules/document/tpl/icons/declare.gif','javascript');
|
$oCommentController->addCommentPopupMenu($url,'cmd_declare','./modules/document/tpl/icons/declare.gif','javascript');
|
||||||
}
|
}
|
||||||
|
// call a trigger (after)
|
||||||
// trigger 호출 (after)
|
|
||||||
ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
|
ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list);
|
||||||
|
// find a comment by IP matching if an administrator.
|
||||||
// 관리자일 경우 ip로 글 찾기
|
|
||||||
if($logged_info->is_admin == 'Y') {
|
if($logged_info->is_admin == 'Y') {
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
$oComment = $oCommentModel->getComment($comment_srl);
|
$oComment = $oCommentModel->getComment($comment_srl);
|
||||||
|
|
||||||
if($oComment->isExists()) {
|
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'));
|
$url = getUrl('','module','admin','act','dispCommentAdminList','search_target','ipaddress','search_keyword',$oComment->get('ipaddress'));
|
||||||
$icon_path = './modules/member/tpl/images/icon_management.gif';
|
$icon_path = './modules/member/tpl/images/icon_management.gif';
|
||||||
$oCommentController->addCommentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
|
$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');
|
$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 = Context::get('comment_popup_menu_list');
|
||||||
$menus_count = count($menus);
|
$menus_count = count($menus);
|
||||||
for($i=0;$i<$menus_count;$i++) {
|
for($i=0;$i<$menus_count;$i++) {
|
||||||
$menus[$i]->str = Context::getLang($menus[$i]->str);
|
$menus[$i]->str = Context::getLang($menus[$i]->str);
|
||||||
}
|
}
|
||||||
|
// get a list of final organized pop-up menus
|
||||||
// 최종적으로 정리된 팝업메뉴 목록을 구함
|
|
||||||
$this->add('menus', $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) {
|
function isGranted($comment_srl) {
|
||||||
return $_SESSION['own_comment'][$comment_srl];
|
return $_SESSION['own_comment'][$comment_srl];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 자식 답글의 갯수 리턴
|
* @brief Returns the number of child comments
|
||||||
**/
|
**/
|
||||||
function getChildCommentCount($comment_srl) {
|
function getChildCommentCount($comment_srl) {
|
||||||
$args->comment_srl = $comment_srl;
|
$args->comment_srl = $comment_srl;
|
||||||
|
|
@ -110,7 +103,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 댓글 가져오기
|
* @brief get the comment
|
||||||
**/
|
**/
|
||||||
function getComment($comment_srl=0, $is_admin = false) {
|
function getComment($comment_srl=0, $is_admin = false) {
|
||||||
$oComment = new commentItem($comment_srl);
|
$oComment = new commentItem($comment_srl);
|
||||||
|
|
@ -120,12 +113,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 여러개의 댓글들을 가져옴 (페이징 아님)
|
* @brief get the multiple comments(not paginating)
|
||||||
**/
|
**/
|
||||||
function getComments($comment_srl_list) {
|
function getComments($comment_srl_list) {
|
||||||
if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list);
|
if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list);
|
||||||
|
// fetch from a database
|
||||||
// DB에서 가져옴
|
|
||||||
$args->comment_srls = $comment_srls;
|
$args->comment_srls = $comment_srls;
|
||||||
$output = executeQuery('comment.getComments', $args);
|
$output = executeQuery('comment.getComments', $args);
|
||||||
if(!$output->toBool()) return;
|
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) {
|
function getCommentCount($document_srl) {
|
||||||
$args->document_srl = $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) {
|
function getCommentAllCount($module_srl) {
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
|
|
@ -170,7 +162,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief mid 에 해당하는 댓글을 가져옴
|
* @brief get the comment in corresponding with mid.
|
||||||
**/
|
**/
|
||||||
function getNewestCommentList($obj) {
|
function getNewestCommentList($obj) {
|
||||||
if($obj->mid) {
|
if($obj->mid) {
|
||||||
|
|
@ -178,8 +170,7 @@
|
||||||
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
||||||
unset($obj->mid);
|
unset($obj->mid);
|
||||||
}
|
}
|
||||||
|
// check if module_srl is an arrary.
|
||||||
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
|
|
||||||
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||||
else $args->module_srl = $obj->module_srl;
|
else $args->module_srl = $obj->module_srl;
|
||||||
$args->list_count = $obj->list_count;
|
$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) {
|
function getCommentList($document_srl, $page = 0, $is_admin = false, $count = 0) {
|
||||||
// 해당 문서의 모듈에 해당하는 댓글 수를 구함
|
// get the number of comments on the document module
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
|
// return if no doc exists.
|
||||||
// 문서가 존재하지 않으면 return~
|
|
||||||
if(!$oDocument->isExists()) return;
|
if(!$oDocument->isExists()) return;
|
||||||
|
// return if no comment exists
|
||||||
// 댓글수가 없으면 return~
|
|
||||||
if($oDocument->getCommentCount()<1) return;
|
if($oDocument->getCommentCount()<1) return;
|
||||||
|
// get a list of comments
|
||||||
// 정해진 댓글수에 따른 댓글 목록 구함
|
|
||||||
$module_srl = $oDocument->get('module_srl');
|
$module_srl = $oDocument->get('module_srl');
|
||||||
|
|
||||||
if(!$count) {
|
if(!$count) {
|
||||||
|
|
@ -228,21 +216,17 @@
|
||||||
} else {
|
} else {
|
||||||
$comment_count = $count;
|
$comment_count = $count;
|
||||||
}
|
}
|
||||||
|
// get a very last page if no page exists
|
||||||
// 페이지가 없으면 제일 뒤 페이지를 구함
|
|
||||||
if(!$page) $page = (int)( ($oDocument->getCommentCount()-1) / $comment_count) + 1;
|
if(!$page) $page = (int)( ($oDocument->getCommentCount()-1) / $comment_count) + 1;
|
||||||
|
// get a list of comments
|
||||||
// 정해진 수에 따라 목록을 구해옴
|
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
$args->list_count = $comment_count;
|
$args->list_count = $comment_count;
|
||||||
$args->page = $page;
|
$args->page = $page;
|
||||||
$args->page_count = 10;
|
$args->page_count = 10;
|
||||||
$output = executeQueryArray('comment.getCommentPageList', $args);
|
$output = executeQueryArray('comment.getCommentPageList', $args);
|
||||||
|
// return if an error occurs in the query results
|
||||||
// 쿼리 결과에서 오류가 생기면 그냥 return
|
|
||||||
if(!$output->toBool()) return;
|
if(!$output->toBool()) return;
|
||||||
|
// insert data into CommentPageList table if the number of results is different from stored comments
|
||||||
// 만약 구해온 결과값이 저장된 댓글수와 다르다면 기존의 데이터로 판단하고 댓글 목록 테이블에 데이터 입력
|
|
||||||
if(!$output->data) {
|
if(!$output->data) {
|
||||||
$this->fixCommentList($oDocument->get('module_srl'), $document_srl);
|
$this->fixCommentList($oDocument->get('module_srl'), $document_srl);
|
||||||
$output = executeQueryArray('comment.getCommentPageList', $args);
|
$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) {
|
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;
|
$lock_file = "./files/cache/tmp/lock.".$document_srl;
|
||||||
if(file_exists($lock_file) && filemtime($lock_file)+60*60*10<time()) return;
|
if(file_exists($lock_file) && filemtime($lock_file)+60*60*10<time()) return;
|
||||||
FileHandler::writeFile($lock_file, '');
|
FileHandler::writeFile($lock_file, '');
|
||||||
|
// get a list
|
||||||
// 목록을 구함
|
|
||||||
$args->document_srl = $document_srl;
|
$args->document_srl = $document_srl;
|
||||||
$args->list_order = 'list_order';
|
$args->list_order = 'list_order';
|
||||||
$output = executeQuery('comment.getCommentList', $args);
|
$output = executeQuery('comment.getCommentList', $args);
|
||||||
|
|
@ -270,25 +253,20 @@
|
||||||
|
|
||||||
$source_list = $output->data;
|
$source_list = $output->data;
|
||||||
if(!is_array($source_list)) $source_list = array($source_list);
|
if(!is_array($source_list)) $source_list = array($source_list);
|
||||||
|
// Sort comments by the hierarchical structure
|
||||||
// 댓글를 계층형 구조로 정렬
|
|
||||||
$comment_count = count($source_list);
|
$comment_count = count($source_list);
|
||||||
|
|
||||||
$root = NULL;
|
$root = NULL;
|
||||||
$list = NULL;
|
$list = NULL;
|
||||||
$comment_list = array();
|
$comment_list = array();
|
||||||
|
// get the log-in information for logged-in users
|
||||||
// 로그인 사용자의 경우 로그인 정보를 일단 구해 놓음
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// generate a hierarchical structure of comments for loop
|
||||||
|
|
||||||
// loop를 돌면서 코멘트의 계층 구조 만듬
|
|
||||||
for($i=$comment_count-1;$i>=0;$i--) {
|
for($i=$comment_count-1;$i>=0;$i--) {
|
||||||
$comment_srl = $source_list[$i]->comment_srl;
|
$comment_srl = $source_list[$i]->comment_srl;
|
||||||
$parent_srl = $source_list[$i]->parent_srl;
|
$parent_srl = $source_list[$i]->parent_srl;
|
||||||
if(!$comment_srl) continue;
|
if(!$comment_srl) continue;
|
||||||
|
// generate a list
|
||||||
// 목록을 만듬
|
|
||||||
$list[$comment_srl] = $source_list[$i];
|
$list[$comment_srl] = $source_list[$i];
|
||||||
|
|
||||||
if($parent_srl) {
|
if($parent_srl) {
|
||||||
|
|
@ -298,8 +276,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->_arrangeComment($comment_list, $root->child, 0, null);
|
$this->_arrangeComment($comment_list, $root->child, 0, null);
|
||||||
|
// insert values to the database
|
||||||
// 구해진 값을 db에 입력함
|
|
||||||
if(count($comment_list)) {
|
if(count($comment_list)) {
|
||||||
foreach($comment_list as $comment_srl => $item) {
|
foreach($comment_list as $comment_srl => $item) {
|
||||||
$comment_args = null;
|
$comment_args = null;
|
||||||
|
|
@ -314,13 +291,12 @@
|
||||||
executeQuery('comment.insertCommentList', $comment_args);
|
executeQuery('comment.insertCommentList', $comment_args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// remove the lock file if successful.
|
||||||
// 성공시 lock파일 제거
|
|
||||||
FileHandler::removeFile($lock_file);
|
FileHandler::removeFile($lock_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 댓글을 계층형으로 재배치
|
* @brief relocate comments in the hierarchical structure
|
||||||
**/
|
**/
|
||||||
function _arrangeComment(&$comment_list, $list, $depth, $parent = null) {
|
function _arrangeComment(&$comment_list, $list, $depth, $parent = null) {
|
||||||
if(!count($list)) return;
|
if(!count($list)) return;
|
||||||
|
|
@ -343,20 +319,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모든 댓글를 시간 역순으로 가져옴 (관리자용)
|
* @brief get all the comments in time decending order(for administrators)
|
||||||
**/
|
**/
|
||||||
function getTotalCommentList($obj) {
|
function getTotalCommentList($obj) {
|
||||||
$query_id = 'comment.getTotalCommentList';
|
$query_id = 'comment.getTotalCommentList';
|
||||||
|
// Variables
|
||||||
// 변수 설정
|
|
||||||
$args->sort_index = 'list_order';
|
$args->sort_index = 'list_order';
|
||||||
$args->page = $obj->page?$obj->page:1;
|
$args->page = $obj->page?$obj->page:1;
|
||||||
$args->list_count = $obj->list_count?$obj->list_count:20;
|
$args->list_count = $obj->list_count?$obj->list_count:20;
|
||||||
$args->page_count = $obj->page_count?$obj->page_count:10;
|
$args->page_count = $obj->page_count?$obj->page_count:10;
|
||||||
$args->s_module_srl = $obj->module_srl;
|
$args->s_module_srl = $obj->module_srl;
|
||||||
$args->exclude_module_srl = $obj->exclude_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_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'));
|
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
|
||||||
if($search_target && $search_keyword) {
|
if($search_target && $search_keyword) {
|
||||||
|
|
@ -401,11 +375,9 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// comment.getTotalCommentList query execution
|
||||||
// comment.getTotalCommentList 쿼리 실행
|
|
||||||
$output = executeQueryArray($query_id, $args);
|
$output = executeQueryArray($query_id, $args);
|
||||||
|
// return when no result or error occurance
|
||||||
// 결과가 없거나 오류 발생시 그냥 return
|
|
||||||
if(!$output->toBool()||!count($output->data)) return $output;
|
if(!$output->toBool()||!count($output->data)) return $output;
|
||||||
foreach($output->data as $key => $val) {
|
foreach($output->data as $key => $val) {
|
||||||
unset($_oComment);
|
unset($_oComment);
|
||||||
|
|
@ -418,7 +390,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모듈별 댓글 설정을 return
|
* @brief return a configuration of comments for each module
|
||||||
**/
|
**/
|
||||||
function getCommentConfig($module_srl) {
|
function getCommentConfig($module_srl) {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
|
|
||||||
|
|
@ -2,42 +2,39 @@
|
||||||
/**
|
/**
|
||||||
* @class commentView
|
* @class commentView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief comment 모듈의 view 클래스
|
* @brief comment module's view class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class commentView extends comment {
|
class commentView extends comment {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모듈의 추가 설정에서 댓글 설정을 하는 form 추가
|
* @brief add a form fot comment setting on the additional setting of module
|
||||||
**/
|
**/
|
||||||
function triggerDispCommentAdditionSetup(&$obj) {
|
function triggerDispCommentAdditionSetup(&$obj) {
|
||||||
$current_module_srl = Context::get('module_srl');
|
$current_module_srl = Context::get('module_srl');
|
||||||
$current_module_srls = Context::get('module_srls');
|
$current_module_srls = Context::get('module_srls');
|
||||||
|
|
||||||
if(!$current_module_srl && !$current_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_info = Context::get('current_module_info');
|
||||||
$current_module_srl = $current_module_info->module_srl;
|
$current_module_srl = $current_module_info->module_srl;
|
||||||
if(!$current_module_srl) return new Object();
|
if(!$current_module_srl) return new Object();
|
||||||
}
|
}
|
||||||
|
// get the comment configuration
|
||||||
// 댓글 설정을 구함
|
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
$comment_config = $oCommentModel->getCommentConfig($current_module_srl);
|
$comment_config = $oCommentModel->getCommentConfig($current_module_srl);
|
||||||
Context::set('comment_config', $comment_config);
|
Context::set('comment_config', $comment_config);
|
||||||
|
// get a group list
|
||||||
// 그룹 목록을 구함
|
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$group_list = $oMemberModel->getGroups();
|
$group_list = $oMemberModel->getGroups();
|
||||||
Context::set('group_list', $group_list);
|
Context::set('group_list', $group_list);
|
||||||
|
// Set a template file
|
||||||
// 템플릿 파일 지정
|
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'comment_module_config');
|
$tpl = $oTemplate->compile($this->module_path.'tpl', 'comment_module_config');
|
||||||
$obj .= $tpl;
|
$obj .= $tpl;
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,28 @@
|
||||||
/**
|
/**
|
||||||
* @class communicationAdminController
|
* @class communicationAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief communication module의 admin controller class
|
* @brief communication module of the admin controller class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class communicationAdminController extends communication {
|
class communicationAdminController extends communication {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief communication 모듈 설정 저장
|
* @brief save configurations of the communication module
|
||||||
**/
|
**/
|
||||||
function procCommunicationAdminInsertConfig() {
|
function procCommunicationAdminInsertConfig() {
|
||||||
// 기본 정보를 받음
|
// get the default information
|
||||||
$args = Context::gets('skin','colorset','editor_skin','editor_colorset');
|
$args = Context::gets('skin','colorset','editor_skin','editor_colorset');
|
||||||
|
|
||||||
if(!$args->skin) $args->skin = "default";
|
if(!$args->skin) $args->skin = "default";
|
||||||
if(!$args->colorset) $args->colorset = "white";
|
if(!$args->colorset) $args->colorset = "white";
|
||||||
if(!$args->editor_skin) $args->editor_skin = "default";
|
if(!$args->editor_skin) $args->editor_skin = "default";
|
||||||
|
// create the module module Controller object
|
||||||
// module Controller 객체 생성하여 입력
|
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$output = $oModuleController->insertModuleConfig('communication',$args);
|
$output = $oModuleController->insertModuleConfig('communication',$args);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
/**
|
/**
|
||||||
* @class communicationAdminModel
|
* @class communicationAdminModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief communication module의 admin model class
|
* @brief communication module of the admin model class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class communicationAdminModel extends communication {
|
class communicationAdminModel extends communication {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 지정된 스킨의 컬러셋 선택을 위한 html을 return
|
* @brief return the html to select colorset of the skin
|
||||||
**/
|
**/
|
||||||
function getCommunicationAdminColorset() {
|
function getCommunicationAdminColorset() {
|
||||||
$skin = Context::get('skin');
|
$skin = Context::get('skin');
|
||||||
|
|
|
||||||
|
|
@ -2,36 +2,32 @@
|
||||||
/**
|
/**
|
||||||
* @class communicationAdminView
|
* @class communicationAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief communication module의 admin view class
|
* @brief communication module of the admin view class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class communicationAdminView extends communication {
|
class communicationAdminView extends communication {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쪽지 및 친구등의 관리를 위한 설정
|
* @brief configuration to manage messages and friends
|
||||||
**/
|
**/
|
||||||
function dispCommunicationAdminConfig() {
|
function dispCommunicationAdminConfig() {
|
||||||
// 객체 생성
|
// Creating an object
|
||||||
$oEditorModel = &getModel('editor');
|
$oEditorModel = &getModel('editor');
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
|
// get the configurations of communication module
|
||||||
// communication 모듈의 모듈설정 읽음
|
|
||||||
Context::set('communication_config', $oCommunicationModel->getConfig() );
|
Context::set('communication_config', $oCommunicationModel->getConfig() );
|
||||||
|
// get a list of editor skins
|
||||||
// 에디터 스킨 목록을 구함
|
|
||||||
Context::set('editor_skin_list', $oEditorModel->getEditorSkinList() );
|
Context::set('editor_skin_list', $oEditorModel->getEditorSkinList() );
|
||||||
|
// get a list of communication skins
|
||||||
// 커뮤니케이션 스킨 목록을 구함
|
|
||||||
Context::set('communication_skin_list', $oModuleModel->getSkins($this->module_path) );
|
Context::set('communication_skin_list', $oModuleModel->getSkins($this->module_path) );
|
||||||
|
// specify a template
|
||||||
// template 지정
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('index');
|
$this->setTemplateFile('index');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,22 +2,22 @@
|
||||||
/**
|
/**
|
||||||
* @class communication
|
* @class communication
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief communication module의 high class
|
* @brief communication module of the high class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class communication extends ModuleObject {
|
class communication extends ModuleObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치시 추가 작업이 필요할시 구현
|
* @brief Implement if additional tasks are necessary when installing
|
||||||
**/
|
**/
|
||||||
function moduleInstall() {
|
function moduleInstall() {
|
||||||
// 새쪽지 알림을 위한 임시 파일 저장소 생성
|
// Create a temporary file storage for one new private message notification
|
||||||
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
|
FileHandler::makeDir('./files/member_extra_info/new_message_flags');
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치가 이상이 없는지 체크하는 method
|
* @brief method to check if successfully installed.
|
||||||
**/
|
**/
|
||||||
function checkUpdate() {
|
function checkUpdate() {
|
||||||
if(!is_dir("./files/member_extra_info/new_message_flags")) return true;
|
if(!is_dir("./files/member_extra_info/new_message_flags")) return true;
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 업데이트 실행
|
* @brief Update
|
||||||
**/
|
**/
|
||||||
function moduleUpdate() {
|
function moduleUpdate() {
|
||||||
if(!is_dir("./files/member_extra_info/new_message_flags"))
|
if(!is_dir("./files/member_extra_info/new_message_flags"))
|
||||||
|
|
@ -34,7 +34,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 캐시 파일 재생성
|
* @brief Re-generate the cache file
|
||||||
**/
|
**/
|
||||||
function recompileCache() {
|
function recompileCache() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
/**
|
/**
|
||||||
* @class communicationController
|
* @class communicationController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief communication module의 Controller class
|
* @brief communication module of the Controller class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class communicationController extends communication {
|
class communicationController extends communication {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쪽지함 설정 변경
|
* @brief change the settings of message box
|
||||||
**/
|
**/
|
||||||
function procCommunicationUpdateAllowMessage() {
|
function procCommunicationUpdateAllowMessage() {
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
|
|
@ -31,14 +31,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쪽지 발송
|
* @brief Send a message
|
||||||
**/
|
**/
|
||||||
function procCommunicationSendMessage() {
|
function procCommunicationSendMessage() {
|
||||||
// 로그인 정보 체크
|
// Check login information
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// Check variables
|
||||||
// 변수 검사
|
|
||||||
$receiver_srl = Context::get('receiver_srl');
|
$receiver_srl = Context::get('receiver_srl');
|
||||||
if(!$receiver_srl) return new Object(-1, 'msg_not_exists_member');
|
if(!$receiver_srl) return new Object(-1, 'msg_not_exists_member');
|
||||||
|
|
||||||
|
|
@ -50,14 +49,12 @@
|
||||||
|
|
||||||
$send_mail = Context::get('send_mail');
|
$send_mail = Context::get('send_mail');
|
||||||
if($send_mail != 'Y') $send_mail = 'N';
|
if($send_mail != 'Y') $send_mail = 'N';
|
||||||
|
// Check if there is a member to receive a message
|
||||||
// 받을 회원이 있는지에 대한 검사
|
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
$receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
|
$receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
|
||||||
if($receiver_member_info->member_srl != $receiver_srl) return new Object(-1, 'msg_not_exists_member');
|
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($logged_info->is_admin != 'Y') {
|
||||||
if($receiver_member_info->allow_message == 'F') {
|
if($receiver_member_info->allow_message == 'F') {
|
||||||
if(!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) return new object(-1, 'msg_allow_message_to_friend');
|
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');
|
return new object(-1, 'msg_disallow_message');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// send a message
|
||||||
// 쪽지 발송
|
|
||||||
$output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
|
$output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content);
|
||||||
|
// send an e-mail
|
||||||
// 메일로도 발송
|
|
||||||
if($output->toBool() && $send_mail == 'Y') {
|
if($output->toBool() && $send_mail == 'Y') {
|
||||||
$view_url = Context::getRequestUri();
|
$view_url = Context::getRequestUri();
|
||||||
$content = sprintf("%s<br /><br />From : <a href=\"%s\" target=\"_blank\">%s</a>",$content, $view_url, $view_url);
|
$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) {
|
function sendMessage($sender_srl, $receiver_srl, $title, $content, $sender_log = true) {
|
||||||
$content = removeHackTag($content);
|
$content = removeHackTag($content);
|
||||||
$title = htmlspecialchars($title);
|
$title = htmlspecialchars($title);
|
||||||
|
// messages to save in the sendor's message box
|
||||||
// 보내는 사용자의 쪽지함에 넣을 쪽지
|
|
||||||
$sender_args->sender_srl = $sender_srl;
|
$sender_args->sender_srl = $sender_srl;
|
||||||
$sender_args->receiver_srl = $receiver_srl;
|
$sender_args->receiver_srl = $receiver_srl;
|
||||||
$sender_args->message_type = 'S';
|
$sender_args->message_type = 'S';
|
||||||
|
|
@ -99,8 +93,7 @@
|
||||||
$sender_args->related_srl = getNextSequence();
|
$sender_args->related_srl = getNextSequence();
|
||||||
$sender_args->message_srl = getNextSequence();
|
$sender_args->message_srl = getNextSequence();
|
||||||
$sender_args->list_order = getNextSequence()*-1;
|
$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->message_srl = $sender_args->related_srl;
|
||||||
$receiver_args->related_srl = 0;
|
$receiver_args->related_srl = 0;
|
||||||
$receiver_args->list_order = $sender_args->related_srl*-1;
|
$receiver_args->list_order = $sender_args->related_srl*-1;
|
||||||
|
|
@ -115,8 +108,7 @@
|
||||||
|
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oDB->begin();
|
$oDB->begin();
|
||||||
|
// messages to save in the sendor's message box
|
||||||
// 발송하는 회원의 쪽지함에 넣을 쪽지
|
|
||||||
if($sender_srl && $sender_log) {
|
if($sender_srl && $sender_log) {
|
||||||
$output = executeQuery('communication.sendMessage', $sender_args);
|
$output = executeQuery('communication.sendMessage', $sender_args);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
|
|
@ -124,15 +116,13 @@
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// messages to save in the receiver's message box
|
||||||
// 받을 회원의 쪽지함에 넣을 쪽지
|
|
||||||
$output = executeQuery('communication.sendMessage', $receiver_args);
|
$output = executeQuery('communication.sendMessage', $receiver_args);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// create a flag that message is sent (in file format)
|
||||||
// 받는 회원의 쪽지 발송 플래그 생성 (파일로 생성)
|
|
||||||
$flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($receiver_srl);
|
$flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($receiver_srl);
|
||||||
FileHandler::makeDir($flag_path);
|
FileHandler::makeDir($flag_path);
|
||||||
$flag_file = sprintf('%s%s', $flag_path, $receiver_srl);
|
$flag_file = sprintf('%s%s', $flag_path, $receiver_srl);
|
||||||
|
|
@ -145,18 +135,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 쪽지를 보관함으로 보냄
|
* @brief store a specific message into the archive
|
||||||
**/
|
**/
|
||||||
function procCommunicationStoreMessage() {
|
function procCommunicationStoreMessage() {
|
||||||
// 로그인 정보 체크
|
// Check login information
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// Check variable
|
||||||
// 변수 체크
|
|
||||||
$message_srl = Context::get('message_srl');
|
$message_srl = Context::get('message_srl');
|
||||||
if(!$message_srl) return new Object(-1,'msg_invalid_request');
|
if(!$message_srl) return new Object(-1,'msg_invalid_request');
|
||||||
|
// get the message
|
||||||
// 쪽지를 가져옴
|
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
$message = $oCommunicationModel->getSelectedMessage($message_srl);
|
$message = $oCommunicationModel->getSelectedMessage($message_srl);
|
||||||
if(!$message || $message->message_type != 'R') return new Object(-1,'msg_invalid_request');
|
if(!$message || $message->message_type != 'R') return new Object(-1,'msg_invalid_request');
|
||||||
|
|
@ -170,31 +158,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쪽지 삭제
|
* @brief Delete a message
|
||||||
**/
|
**/
|
||||||
function procCommunicationDeleteMessage() {
|
function procCommunicationDeleteMessage() {
|
||||||
// 로그인 정보 체크
|
// Check login information
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$member_srl = $logged_info->member_srl;
|
$member_srl = $logged_info->member_srl;
|
||||||
|
// Check the variable
|
||||||
// 변수 체크
|
|
||||||
$message_srl = Context::get('message_srl');
|
$message_srl = Context::get('message_srl');
|
||||||
if(!$message_srl) return new Object(-1,'msg_invalid_request');
|
if(!$message_srl) return new Object(-1,'msg_invalid_request');
|
||||||
|
// Get the message
|
||||||
// 쪽지를 가져옴
|
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
$message = $oCommunicationModel->getSelectedMessage($message_srl);
|
$message = $oCommunicationModel->getSelectedMessage($message_srl);
|
||||||
if(!$message) return new Object(-1,'msg_invalid_request');
|
if(!$message) return new Object(-1,'msg_invalid_request');
|
||||||
|
// Check a message type if 'S' or 'R'
|
||||||
// 발송인+type=S or 수신인+type=R 검사
|
|
||||||
if($message->sender_srl == $member_srl && $message->message_type == 'S') {
|
if($message->sender_srl == $member_srl && $message->message_type == 'S') {
|
||||||
if(!$message_srl) return new Object(-1, 'msg_invalid_request');
|
if(!$message_srl) return new Object(-1, 'msg_invalid_request');
|
||||||
} elseif($message->receiver_srl == $member_srl && $message->message_type == 'R') {
|
} elseif($message->receiver_srl == $member_srl && $message->message_type == 'R') {
|
||||||
if(!$message_srl) return new Object(-1, 'msg_invalid_request');
|
if(!$message_srl) return new Object(-1, 'msg_invalid_request');
|
||||||
}
|
}
|
||||||
|
// Delete
|
||||||
// 삭제
|
|
||||||
$args->message_srl = $message_srl;
|
$args->message_srl = $message_srl;
|
||||||
$output = executeQuery('communication.deleteMessage', $args);
|
$output = executeQuery('communication.deleteMessage', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
|
@ -203,15 +187,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 선택된 다수의 쪽지 삭제
|
* @brief Delete the multiple messages
|
||||||
**/
|
**/
|
||||||
function procCommunicationDeleteMessages() {
|
function procCommunicationDeleteMessages() {
|
||||||
// 로그인 정보 체크
|
// Check login information
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$member_srl = $logged_info->member_srl;
|
$member_srl = $logged_info->member_srl;
|
||||||
|
// check variables
|
||||||
// 변수 체크
|
|
||||||
$message_srl_list = trim(Context::get('message_srl_list'));
|
$message_srl_list = trim(Context::get('message_srl_list'));
|
||||||
if(!$message_srl_list) return new Object(-1, 'msg_cart_is_null');
|
if(!$message_srl_list) return new Object(-1, 'msg_cart_is_null');
|
||||||
|
|
||||||
|
|
@ -229,8 +212,7 @@
|
||||||
$target[] = $message_srl;
|
$target[] = $message_srl;
|
||||||
}
|
}
|
||||||
if(!count($target)) return new Object(-1,'msg_cart_is_null');
|
if(!count($target)) return new Object(-1,'msg_cart_is_null');
|
||||||
|
// Delete
|
||||||
// 삭제
|
|
||||||
$args->message_srls = implode(',',$target);
|
$args->message_srls = implode(',',$target);
|
||||||
$args->message_type = $message_type;
|
$args->message_type = $message_type;
|
||||||
|
|
||||||
|
|
@ -244,17 +226,16 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 친구 추가
|
* @brief Add a friend
|
||||||
**/
|
**/
|
||||||
function procCommunicationAddFriend() {
|
function procCommunicationAddFriend() {
|
||||||
// 로그인 정보 체크
|
// Check login information
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
$target_srl = (int)trim(Context::get('target_srl'));
|
$target_srl = (int)trim(Context::get('target_srl'));
|
||||||
if(!$target_srl) return new Object(-1,'msg_invalid_request');
|
if(!$target_srl) return new Object(-1,'msg_invalid_request');
|
||||||
|
// Variable
|
||||||
// 변수 정리
|
|
||||||
$args->friend_srl = getNextSequence();
|
$args->friend_srl = getNextSequence();
|
||||||
$args->list_order = $args->friend_srl * -1;
|
$args->list_order = $args->friend_srl * -1;
|
||||||
$args->friend_group_srl = Context::get('friend_group_srl');
|
$args->friend_group_srl = Context::get('friend_group_srl');
|
||||||
|
|
@ -268,14 +249,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 등록된 친구의 그룹 이동
|
* @brief Move a group of the friend
|
||||||
**/
|
**/
|
||||||
function procCommunicationMoveFriend() {
|
function procCommunicationMoveFriend() {
|
||||||
// 로그인 정보 체크
|
// Check login information
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// Check variables
|
||||||
// 변수 체크
|
|
||||||
$friend_srl_list = trim(Context::get('friend_srl_list'));
|
$friend_srl_list = trim(Context::get('friend_srl_list'));
|
||||||
if(!$friend_srl_list) return new Object(-1, 'msg_cart_is_null');
|
if(!$friend_srl_list) return new Object(-1, 'msg_cart_is_null');
|
||||||
|
|
||||||
|
|
@ -290,8 +270,7 @@
|
||||||
$target[] = $friend_srl;
|
$target[] = $friend_srl;
|
||||||
}
|
}
|
||||||
if(!count($target)) return new Object(-1,'msg_cart_is_null');
|
if(!count($target)) return new Object(-1,'msg_cart_is_null');
|
||||||
|
// Variables
|
||||||
// 변수 정리
|
|
||||||
$args->friend_srls = implode(',',$target);
|
$args->friend_srls = implode(',',$target);
|
||||||
$args->member_srl = $logged_info->member_srl;
|
$args->member_srl = $logged_info->member_srl;
|
||||||
$args->friend_group_srl = Context::get('target_friend_group_srl');
|
$args->friend_group_srl = Context::get('target_friend_group_srl');
|
||||||
|
|
@ -303,15 +282,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 친구 삭제
|
* @brief Delete a friend
|
||||||
**/
|
**/
|
||||||
function procCommunicationDeleteFriend() {
|
function procCommunicationDeleteFriend() {
|
||||||
// 로그인 정보 체크
|
// Check login information
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$member_srl = $logged_info->member_srl;
|
$member_srl = $logged_info->member_srl;
|
||||||
|
// Check variables
|
||||||
// 변수 체크
|
|
||||||
$friend_srl_list = trim(Context::get('friend_srl_list'));
|
$friend_srl_list = trim(Context::get('friend_srl_list'));
|
||||||
if(!$friend_srl_list) return new Object(-1, 'msg_cart_is_null');
|
if(!$friend_srl_list) return new Object(-1, 'msg_cart_is_null');
|
||||||
|
|
||||||
|
|
@ -326,8 +304,7 @@
|
||||||
$target[] = $friend_srl;
|
$target[] = $friend_srl;
|
||||||
}
|
}
|
||||||
if(!count($target)) return new Object(-1,'msg_cart_is_null');
|
if(!count($target)) return new Object(-1,'msg_cart_is_null');
|
||||||
|
// Delete
|
||||||
// 삭제
|
|
||||||
$args->friend_srls = implode(',',$target);
|
$args->friend_srls = implode(',',$target);
|
||||||
$args->member_srl = $logged_info->member_srl;
|
$args->member_srl = $logged_info->member_srl;
|
||||||
$output = executeQuery('communication.deleteFriend', $args);
|
$output = executeQuery('communication.deleteFriend', $args);
|
||||||
|
|
@ -337,26 +314,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 친구 그룹 추가
|
* @brief Add a group of friends
|
||||||
**/
|
**/
|
||||||
function procCommunicationAddFriendGroup() {
|
function procCommunicationAddFriendGroup() {
|
||||||
// 로그인 정보 체크
|
// Check login information
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// Variables
|
||||||
// 변수 정리
|
|
||||||
$args->friend_group_srl = trim(Context::get('friend_group_srl'));
|
$args->friend_group_srl = trim(Context::get('friend_group_srl'));
|
||||||
$args->member_srl = $logged_info->member_srl;
|
$args->member_srl = $logged_info->member_srl;
|
||||||
$args->title = Context::get('title');
|
$args->title = Context::get('title');
|
||||||
$args->title = htmlspecialchars($args->title);
|
$args->title = htmlspecialchars($args->title);
|
||||||
if(!$args->title) return new Object(-1, 'msg_invalid_request');
|
if(!$args->title) return new Object(-1, 'msg_invalid_request');
|
||||||
|
// modify if friend_group_srl exists.
|
||||||
// friend_group_srl이 있으면 수정
|
|
||||||
if($args->friend_group_srl) {
|
if($args->friend_group_srl) {
|
||||||
$output = executeQuery('communication.renameFriendGroup', $args);
|
$output = executeQuery('communication.renameFriendGroup', $args);
|
||||||
$msg_code = 'success_updated';
|
$msg_code = 'success_updated';
|
||||||
|
// add if not exists
|
||||||
// 아니면 입력
|
|
||||||
} else {
|
} else {
|
||||||
$output = executeQuery('communication.addFriendGroup', $args);
|
$output = executeQuery('communication.addFriendGroup', $args);
|
||||||
$msg_code = 'success_registed';
|
$msg_code = 'success_registed';
|
||||||
|
|
@ -368,14 +342,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 친구 그룹 이름 변경
|
* @brief change a name of friend group
|
||||||
**/
|
**/
|
||||||
function procCommunicationRenameFriendGroup() {
|
function procCommunicationRenameFriendGroup() {
|
||||||
// 로그인 정보 체크
|
// Check login information
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// Variables
|
||||||
// 변수 정리
|
|
||||||
$args->friend_group_srl= Context::get('friend_group_srl');
|
$args->friend_group_srl= Context::get('friend_group_srl');
|
||||||
$args->member_srl = $logged_info->member_srl;
|
$args->member_srl = $logged_info->member_srl;
|
||||||
$args->title = Context::get('title');
|
$args->title = Context::get('title');
|
||||||
|
|
@ -389,14 +362,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 친구 그룹 삭제
|
* @brief Delete a group of friends
|
||||||
**/
|
**/
|
||||||
function procCommunicationDeleteFriendGroup() {
|
function procCommunicationDeleteFriendGroup() {
|
||||||
// 로그인 정보 체크
|
// Check login information
|
||||||
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// Variables
|
||||||
// 변수 정리
|
|
||||||
$args->friend_group_srl = Context::get('friend_group_srl');
|
$args->friend_group_srl = Context::get('friend_group_srl');
|
||||||
$args->member_srl = $logged_info->member_srl;
|
$args->member_srl = $logged_info->member_srl;
|
||||||
$output = executeQuery('communication.deleteFriendGroup', $args);
|
$output = executeQuery('communication.deleteFriendGroup', $args);
|
||||||
|
|
@ -406,7 +378,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 쪽지의 상태를 읽은 상태로 변경
|
* @brief set a message status to be 'already read'
|
||||||
**/
|
**/
|
||||||
function setMessageReaded($message_srl) {
|
function setMessageReaded($message_srl) {
|
||||||
$args->message_srl = $message_srl;
|
$args->message_srl = $message_srl;
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
/**
|
/**
|
||||||
* @class communicationModel
|
* @class communicationModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief communication module의 Model class
|
* @brief communication module of the Model class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class communicationModel extends communication {
|
class communicationModel extends communication {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설정된 내용을 구함
|
* @brief get the configuration
|
||||||
**/
|
**/
|
||||||
function getConfig() {
|
function getConfig() {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
|
@ -28,7 +28,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쪽지 내용을 가져옴
|
* @brief get the message contents
|
||||||
**/
|
**/
|
||||||
function getSelectedMessage($message_srl) {
|
function getSelectedMessage($message_srl) {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
@ -37,12 +37,10 @@
|
||||||
$output = executeQuery('communication.getMessage',$args);
|
$output = executeQuery('communication.getMessage',$args);
|
||||||
$message = $output->data;
|
$message = $output->data;
|
||||||
if(!$message) return ;
|
if(!$message) return ;
|
||||||
|
// get recipient's information if it is a sent message
|
||||||
// 보낸 쪽지일 경우 받는 사람 정보를 구함
|
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
if($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S') $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->receiver_srl);
|
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);
|
else $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->sender_srl);
|
||||||
|
|
||||||
if($member_info) {
|
if($member_info) {
|
||||||
|
|
@ -50,8 +48,7 @@
|
||||||
if($key != 'regdate') $message->{$key} = $val;
|
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') {
|
if($message->message_type == 'R' && $message->readed != 'Y') {
|
||||||
$oCommunicationController = &getController('communication');
|
$oCommunicationController = &getController('communication');
|
||||||
$oCommunicationController->setMessageReaded($message_srl);
|
$oCommunicationController->setMessageReaded($message_srl);
|
||||||
|
|
@ -62,7 +59,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 새 쪽지를 가져옴
|
* @brief get a new message
|
||||||
**/
|
**/
|
||||||
function getNewMessage() {
|
function getNewMessage() {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
@ -80,10 +77,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쪽지 목록 가져오기
|
* @brief get a message list
|
||||||
* type = R : 받은 쪽지
|
* type = R: Received Message
|
||||||
* type = S : 보낸 쪽지
|
* type = S: Sent Message
|
||||||
* type = T : 보관함
|
* type = T: Archive
|
||||||
**/
|
**/
|
||||||
function getMessages($message_type = "R") {
|
function getMessages($message_type = "R") {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
@ -106,8 +103,7 @@
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Other variables
|
||||||
// 기타 변수들 정리
|
|
||||||
$args->sort_index = 'message.list_order';
|
$args->sort_index = 'message.list_order';
|
||||||
$args->page = Context::get('page');
|
$args->page = Context::get('page');
|
||||||
$args->list_count = 20;
|
$args->list_count = 20;
|
||||||
|
|
@ -116,15 +112,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 친구 목록 가져오기
|
* @brief Get a list of friends
|
||||||
**/
|
**/
|
||||||
function getFriends($friend_group_srl = 0) {
|
function getFriends($friend_group_srl = 0) {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
$args->friend_group_srl = $friend_group_srl;
|
$args->friend_group_srl = $friend_group_srl;
|
||||||
$args->member_srl = $logged_info->member_srl;
|
$args->member_srl = $logged_info->member_srl;
|
||||||
|
// Other variables
|
||||||
// 기타 변수들 정리
|
|
||||||
$args->page = Context::get('page');
|
$args->page = Context::get('page');
|
||||||
$args->sort_index = 'friend.list_order';
|
$args->sort_index = 'friend.list_order';
|
||||||
$args->list_count = 10;
|
$args->list_count = 10;
|
||||||
|
|
@ -134,7 +129,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 이미 친구로 등록되었는지 검사
|
* @brief check if a friend is already added
|
||||||
**/
|
**/
|
||||||
function isAddedFriend($member_srl) {
|
function isAddedFriend($member_srl) {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
@ -146,7 +141,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 친구 그룹 가져오기
|
* @brief Get a group of friends
|
||||||
**/
|
**/
|
||||||
function getFriendGroupInfo($friend_group_srl) {
|
function getFriendGroupInfo($friend_group_srl) {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
@ -159,7 +154,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 그룹 목록 가져오기
|
* @brief Get a list of groups
|
||||||
**/
|
**/
|
||||||
function getFriendGroups() {
|
function getFriendGroups() {
|
||||||
$logged_info = Context::get('logged_info');
|
$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) {
|
function isFriend($target_srl) {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
|
||||||
|
|
@ -2,13 +2,13 @@
|
||||||
/**
|
/**
|
||||||
* @class communicationView
|
* @class communicationView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief communication module의 View class
|
* @brief View class of communication module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class communicationView extends communication {
|
class communicationView extends communication {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
|
|
@ -23,14 +23,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쪽지함 출력
|
* @brief Display message box
|
||||||
**/
|
**/
|
||||||
function dispCommunicationMessages() {
|
function dispCommunicationMessages() {
|
||||||
// 로그인이 되어 있지 않으면 오류 표시
|
// Error appears if not logged-in
|
||||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// Set the variables
|
||||||
// 변수 설정
|
|
||||||
$message_srl = Context::get('message_srl');
|
$message_srl = Context::get('message_srl');
|
||||||
$message_type = Context::get('message_type');
|
$message_type = Context::get('message_type');
|
||||||
if(!in_array($message_type, array('R','S','T'))) {
|
if(!in_array($message_type, array('R','S','T'))) {
|
||||||
|
|
@ -39,8 +38,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
|
// extract contents if message_srl exists
|
||||||
// message_srl이 있으면 내용 추출
|
|
||||||
if($message_srl) {
|
if($message_srl) {
|
||||||
$message = $oCommunicationModel->getSelectedMessage($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) ) {
|
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);
|
Context::set('message', $message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Extract a list
|
||||||
// 목록 추출
|
|
||||||
$output = $oCommunicationModel->getMessages($message_type);
|
$output = $oCommunicationModel->getMessages($message_type);
|
||||||
|
// set a template file
|
||||||
// 템플릿에 쓰기 위해서 context::set
|
|
||||||
Context::set('total_count', $output->total_count);
|
Context::set('total_count', $output->total_count);
|
||||||
Context::set('total_page', $output->total_page);
|
Context::set('total_page', $output->total_page);
|
||||||
Context::set('page', $output->page);
|
Context::set('page', $output->page);
|
||||||
|
|
@ -63,25 +59,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 새 쪽지 보여줌
|
* @brief display a new message
|
||||||
**/
|
**/
|
||||||
function dispCommunicationNewMessage() {
|
function dispCommunicationNewMessage() {
|
||||||
$this->setLayoutFile('popup_layout');
|
$this->setLayoutFile('popup_layout');
|
||||||
|
// Error appears if not logged-in
|
||||||
// 로그인이 되어 있지 않으면 오류 표시
|
|
||||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
|
// get a new message
|
||||||
// 새 쪽지를 가져옴
|
|
||||||
$message = $oCommunicationModel->getNewMessage();
|
$message = $oCommunicationModel->getNewMessage();
|
||||||
if($message) {
|
if($message) {
|
||||||
stripEmbedTagForAdmin($message->content, $message->sender_srl);
|
stripEmbedTagForAdmin($message->content, $message->sender_srl);
|
||||||
Context::set('message', $message);
|
Context::set('message', $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 플래그 삭제
|
// Delete a flag
|
||||||
$flag_path = './files/communication_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl);
|
$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);
|
$flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl);
|
||||||
FileHandler::removeFile($flag_file);
|
FileHandler::removeFile($flag_file);
|
||||||
|
|
@ -90,22 +84,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 쪽지 발송 출력
|
* @brief Display message sending
|
||||||
**/
|
**/
|
||||||
function dispCommunicationSendMessage() {
|
function dispCommunicationSendMessage() {
|
||||||
$this->setLayoutFile("popup_layout");
|
$this->setLayoutFile("popup_layout");
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
|
// Error appears if not logged-in
|
||||||
// 로그인이 되어 있지 않으면 오류 표시
|
|
||||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// get receipient's information
|
||||||
// 쪽지 받을 사용자 정보 구함
|
|
||||||
$receiver_srl = Context::get('receiver_srl');
|
$receiver_srl = Context::get('receiver_srl');
|
||||||
if(!$receiver_srl || $logged_info->member_srl == $receiver_srl) return $this->stop('msg_not_logged');
|
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');
|
$message_srl = Context::get('message_srl');
|
||||||
if($message_srl) {
|
if($message_srl) {
|
||||||
$source_message = $oCommunicationModel->getSelectedMessage($message_srl);
|
$source_message = $oCommunicationModel->getSelectedMessage($message_srl);
|
||||||
|
|
@ -118,8 +109,7 @@
|
||||||
|
|
||||||
$receiver_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
|
$receiver_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl);
|
||||||
Context::set('receiver_info', $receiver_info);
|
Context::set('receiver_info', $receiver_info);
|
||||||
|
// set a signiture by calling getEditor of the editor module
|
||||||
// 에디터 모듈의 getEditor를 호출하여 서명용으로 세팅
|
|
||||||
$oEditorModel = &getModel('editor');
|
$oEditorModel = &getModel('editor');
|
||||||
$option->primary_key_name = 'receiver_srl';
|
$option->primary_key_name = 'receiver_srl';
|
||||||
$option->content_key_name = 'content';
|
$option->content_key_name = 'content';
|
||||||
|
|
@ -139,21 +129,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 친구 목록 보기
|
* @brief display a list of friends
|
||||||
**/
|
**/
|
||||||
function dispCommunicationFriend() {
|
function dispCommunicationFriend() {
|
||||||
// 로그인이 되어 있지 않으면 오류 표시
|
// Error appears if not logged-in
|
||||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||||
|
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
|
// get a group list
|
||||||
// 그룹 목록을 가져옴
|
|
||||||
$tmp_group_list = $oCommunicationModel->getFriendGroups();
|
$tmp_group_list = $oCommunicationModel->getFriendGroups();
|
||||||
$group_count = count($tmp_group_list);
|
$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];
|
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);
|
Context::set('friend_group_list', $friend_group_list);
|
||||||
|
// get a list of friends
|
||||||
// 친구 목록을 가져옴
|
|
||||||
$friend_group_srl = Context::get('friend_group_srl');
|
$friend_group_srl = Context::get('friend_group_srl');
|
||||||
$output = $oCommunicationModel->getFriends($friend_group_srl);
|
$output = $oCommunicationModel->getFriends($friend_group_srl);
|
||||||
$friend_count = count($output->data);
|
$friend_count = count($output->data);
|
||||||
|
|
@ -165,8 +153,7 @@
|
||||||
$output->data[$key]->group_title = $group_title;
|
$output->data[$key]->group_title = $group_title;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// set a template file
|
||||||
// 템플릿에 쓰기 위해서 context::set
|
|
||||||
Context::set('total_count', $output->total_count);
|
Context::set('total_count', $output->total_count);
|
||||||
Context::set('total_page', $output->total_page);
|
Context::set('total_page', $output->total_page);
|
||||||
Context::set('page', $output->page);
|
Context::set('page', $output->page);
|
||||||
|
|
@ -177,26 +164,23 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 친구 추가
|
* @brief Add a friend
|
||||||
**/
|
**/
|
||||||
function dispCommunicationAddFriend() {
|
function dispCommunicationAddFriend() {
|
||||||
$this->setLayoutFile("popup_layout");
|
$this->setLayoutFile("popup_layout");
|
||||||
|
// error appears if not logged-in
|
||||||
// 로그인이 되어 있지 않으면 오류 표시
|
|
||||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
||||||
$target_srl = Context::get('target_srl');
|
$target_srl = Context::get('target_srl');
|
||||||
if(!$target_srl) return $this->stop('msg_invalid_request');
|
if(!$target_srl) return $this->stop('msg_invalid_request');
|
||||||
|
// get information of the member
|
||||||
// 대상 회원의 정보를 구함
|
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
$communication_info = $oMemberModel->getMemberInfoByMemberSrl($target_srl);
|
$communication_info = $oMemberModel->getMemberInfoByMemberSrl($target_srl);
|
||||||
if($communication_info->member_srl != $target_srl) return $this->stop('msg_invalid_request');
|
if($communication_info->member_srl != $target_srl) return $this->stop('msg_invalid_request');
|
||||||
Context::set('target_info', $communication_info);
|
Context::set('target_info', $communication_info);
|
||||||
|
// get a group list
|
||||||
// 그룹의 목록을 구함
|
|
||||||
$friend_group_list = $oCommunicationModel->getFriendGroups();
|
$friend_group_list = $oCommunicationModel->getFriendGroups();
|
||||||
Context::set('friend_group_list', $friend_group_list);
|
Context::set('friend_group_list', $friend_group_list);
|
||||||
|
|
||||||
|
|
@ -204,16 +188,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 친구 그룹 추가
|
* @brief Add a group of friends
|
||||||
**/
|
**/
|
||||||
function dispCommunicationAddFriendGroup() {
|
function dispCommunicationAddFriendGroup() {
|
||||||
$this->setLayoutFile("popup_layout");
|
$this->setLayoutFile("popup_layout");
|
||||||
|
// error apprears if not logged-in
|
||||||
// 로그인이 되어 있지 않으면 오류 표시
|
|
||||||
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
if(!Context::get('is_logged')) return $this->stop('msg_not_logged');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
// change to edit mode when getting the group_srl
|
||||||
// 그룹 번호가 넘어오면 수정모드로..
|
|
||||||
$friend_group_srl = Context::get('friend_group_srl');
|
$friend_group_srl = Context::get('friend_group_srl');
|
||||||
if($friend_group_srl) {
|
if($friend_group_srl) {
|
||||||
$oCommunicationModel = &getModel('communication');
|
$oCommunicationModel = &getModel('communication');
|
||||||
|
|
|
||||||
|
|
@ -2,38 +2,35 @@
|
||||||
/**
|
/**
|
||||||
* @class counterAdminView
|
* @class counterAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief counter 모듈의 Admin view class
|
* @brief Admin view class of counter module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class counterAdminView extends counter {
|
class counterAdminView extends counter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
// 템플릿 경로 지정
|
// set the template path
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 관리자 페이지 초기화면
|
* @brief Admin page
|
||||||
**/
|
**/
|
||||||
function dispCounterAdminIndex() {
|
function dispCounterAdminIndex() {
|
||||||
// 정해진 일자가 없으면 오늘자로 설정
|
// set today's if no date is given
|
||||||
$selected_date = Context::get('selected_date');
|
$selected_date = Context::get('selected_date');
|
||||||
if(!$selected_date) $selected_date = date("Ymd");
|
if(!$selected_date) $selected_date = date("Ymd");
|
||||||
Context::set('selected_date', $selected_date);
|
Context::set('selected_date', $selected_date);
|
||||||
|
// create the counter model object
|
||||||
// counter model 객체 생성
|
|
||||||
$oCounterModel = &getModel('counter');
|
$oCounterModel = &getModel('counter');
|
||||||
|
// get a total count and daily count
|
||||||
// 전체 카운터 및 지정된 일자의 현황 가져오기
|
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$status = $oCounterModel->getStatus(array(0,$selected_date),$site_module_info->site_srl);
|
$status = $oCounterModel->getStatus(array(0,$selected_date),$site_module_info->site_srl);
|
||||||
Context::set('total_counter', $status[0]);
|
Context::set('total_counter', $status[0]);
|
||||||
Context::set('selected_day_counter', $status[$selected_date]);
|
Context::set('selected_day_counter', $status[$selected_date]);
|
||||||
|
// get data by time, day, month, and year
|
||||||
// 시간, 일, 월, 년도별로 데이터 가져오기
|
|
||||||
$type = Context::get('type');
|
$type = Context::get('type');
|
||||||
if(!$type) {
|
if(!$type) {
|
||||||
$type = 'day';
|
$type = 'day';
|
||||||
|
|
@ -42,7 +39,7 @@
|
||||||
$detail_status = $oCounterModel->getHourlyStatus($type, $selected_date, $site_module_info->site_srl);
|
$detail_status = $oCounterModel->getHourlyStatus($type, $selected_date, $site_module_info->site_srl);
|
||||||
Context::set('detail_status', $detail_status);
|
Context::set('detail_status', $detail_status);
|
||||||
|
|
||||||
// 표시
|
// display
|
||||||
$this->setTemplateFile('index');
|
$this->setTemplateFile('index');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,31 +2,29 @@
|
||||||
/**
|
/**
|
||||||
* @class counter
|
* @class counter
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief counter 모듈의 high class
|
* @brief high class of counter module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class counter extends ModuleObject {
|
class counter extends ModuleObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치시 추가 작업이 필요할시 구현
|
* @brief Implement if additional tasks are necessary when installing
|
||||||
**/
|
**/
|
||||||
function moduleInstall() {
|
function moduleInstall() {
|
||||||
$oCounterController = &getController('counter');
|
$oCounterController = &getController('counter');
|
||||||
|
// add a row for the total visit history
|
||||||
// 0 일자로 기록될 전체 방문 기록 row 추가
|
|
||||||
//$oCounterController->insertTotalStatus();
|
//$oCounterController->insertTotalStatus();
|
||||||
|
// add a row for today's status
|
||||||
// 오늘자 row입력
|
|
||||||
//$oCounterController->insertTodayStatus();
|
//$oCounterController->insertTodayStatus();
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치가 이상이 없는지 체크하는 method
|
* @brief method if successfully installed
|
||||||
**/
|
**/
|
||||||
function checkUpdate() {
|
function checkUpdate() {
|
||||||
// 카운터에 site_srl추가
|
// Add site_srl to the counter
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
if(!$oDB->isColumnExists('counter_log', 'site_srl')) return true;
|
if(!$oDB->isColumnExists('counter_log', 'site_srl')) return true;
|
||||||
if(!$oDB->isIndexExists('counter_log','idx_site_counter_log')) return true;
|
if(!$oDB->isIndexExists('counter_log','idx_site_counter_log')) return true;
|
||||||
|
|
@ -35,10 +33,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 업데이트 실행
|
* @brief Update
|
||||||
**/
|
**/
|
||||||
function moduleUpdate() {
|
function moduleUpdate() {
|
||||||
// 카운터에 site_srl추가
|
// Add site_srl to the counter
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
if(!$oDB->isColumnExists('counter_log', 'site_srl')) $oDB->addColumn('counter_log','site_srl','number',11,0,true);
|
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);
|
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() {
|
function recompileCache() {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
/**
|
/**
|
||||||
* @class counterController
|
* @class counterController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief counter 모듈의 controller class
|
* @brief counter module's controller class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class counterController extends counter {
|
class counterController extends counter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 카운터 기록
|
* @brief Counter logs
|
||||||
**/
|
**/
|
||||||
function procCounterExecute() {
|
function procCounterExecute() {
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
|
|
@ -22,26 +22,21 @@
|
||||||
|
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$site_srl = (int)$site_module_info->site_srl;
|
$site_srl = (int)$site_module_info->site_srl;
|
||||||
|
// Check the logs
|
||||||
// 로그를 검사
|
|
||||||
$oCounterModel = &getModel('counter');
|
$oCounterModel = &getModel('counter');
|
||||||
|
// Register today's row if not exist
|
||||||
// 오늘자 row가 있는지 체크하여 없으면 등록
|
|
||||||
if(!$oCounterModel->isInsertedTodayStatus($site_srl)) {
|
if(!$oCounterModel->isInsertedTodayStatus($site_srl)) {
|
||||||
$this->insertTodayStatus(0,$site_srl);
|
$this->insertTodayStatus(0,$site_srl);
|
||||||
|
// check user if the previous row exists
|
||||||
// 기존 row가 있으면 사용자 체크
|
|
||||||
} else {
|
} else {
|
||||||
|
// If unregistered IP
|
||||||
// 등록되어 있지 않은 아이피일 경우
|
|
||||||
if(!$oCounterModel->isLogged($site_srl)) {
|
if(!$oCounterModel->isLogged($site_srl)) {
|
||||||
// 로그 등록
|
// Leave logs
|
||||||
$this->insertLog($site_srl);
|
$this->insertLog($site_srl);
|
||||||
|
// Register unique and pageview
|
||||||
// unique 및 pageview 등록
|
|
||||||
$this->insertUniqueVisitor($site_srl);
|
$this->insertUniqueVisitor($site_srl);
|
||||||
} else {
|
} else {
|
||||||
// pageview 등록
|
// Register pageview
|
||||||
$this->insertPageView($site_srl);
|
$this->insertPageView($site_srl);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -50,7 +45,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 로그 등록
|
* @brief Leave logs
|
||||||
**/
|
**/
|
||||||
function insertLog($site_srl=0) {
|
function insertLog($site_srl=0) {
|
||||||
$args->regdate = date("YmdHis");
|
$args->regdate = date("YmdHis");
|
||||||
|
|
@ -60,7 +55,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief unique visitor 등록
|
* @brief Register the unique visitor
|
||||||
**/
|
**/
|
||||||
function insertUniqueVisitor($site_srl=0) {
|
function insertUniqueVisitor($site_srl=0) {
|
||||||
if($site_srl) {
|
if($site_srl) {
|
||||||
|
|
@ -78,7 +73,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief pageview 등록
|
* @brief Register pageview
|
||||||
**/
|
**/
|
||||||
function insertPageView($site_srl=0) {
|
function insertPageView($site_srl=0) {
|
||||||
if($site_srl) {
|
if($site_srl) {
|
||||||
|
|
@ -96,7 +91,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 전체 카운터 status 추가
|
* @brief Add the total counter status
|
||||||
**/
|
**/
|
||||||
function insertTotalStatus($site_srl=0) {
|
function insertTotalStatus($site_srl=0) {
|
||||||
$args->regdate = 0;
|
$args->regdate = 0;
|
||||||
|
|
@ -109,7 +104,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 오늘자 카운터 status 추가
|
* @brief Add today's counter status
|
||||||
**/
|
**/
|
||||||
function insertTodayStatus($regdate = 0, $site_srl=0) {
|
function insertTodayStatus($regdate = 0, $site_srl=0) {
|
||||||
if($regdate) $args->regdate = $regdate;
|
if($regdate) $args->regdate = $regdate;
|
||||||
|
|
@ -118,23 +113,21 @@
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
$query_id = 'counter.insertSiteTodayStatus';
|
$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);
|
executeQuery($query_id, $u_args);
|
||||||
} else {
|
} else {
|
||||||
$query_id = 'counter.insertTodayStatus';
|
$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);
|
$output = executeQuery($query_id, $args);
|
||||||
|
// Leave logs
|
||||||
// 로그 등록
|
|
||||||
$this->insertLog($site_srl);
|
$this->insertLog($site_srl);
|
||||||
|
// Register unique and pageview
|
||||||
// unique 및 pageview 등록
|
|
||||||
$this->insertUniqueVisitor($site_srl);
|
$this->insertUniqueVisitor($site_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 가상 사이트의 카운터 로그 삭제
|
* @brief Delete counter logs of the specific virtual site
|
||||||
**/
|
**/
|
||||||
function deleteSiteCounterLogs($site_srl) {
|
function deleteSiteCounterLogs($site_srl) {
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
/**
|
/**
|
||||||
* @class counterModel
|
* @class counterModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief counter 모듈의 Model class
|
* @brief Model class of counter module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class counterModel extends counter {
|
class counterModel extends counter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 로그 검사
|
* @brief Verify logs
|
||||||
**/
|
**/
|
||||||
function isLogged($site_srl=0) {
|
function isLogged($site_srl=0) {
|
||||||
$args->regdate = date("Ymd");
|
$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) {
|
function isInsertedTodayStatus($site_srl=0) {
|
||||||
$args->regdate = date("Ymd");
|
$args->regdate = date("Ymd");
|
||||||
|
|
@ -39,15 +39,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 일의 접속 통계를 가져옴
|
* @brief Get access statistics for a given date
|
||||||
**/
|
**/
|
||||||
function getStatus($selected_date, $site_srl=0) {
|
function getStatus($selected_date, $site_srl=0) {
|
||||||
// 여러개의 날짜 로그를 가져올 경우
|
// If more than one date logs are selected
|
||||||
if(is_array($selected_date)) {
|
if(is_array($selected_date)) {
|
||||||
$date_count = count($selected_date);
|
$date_count = count($selected_date);
|
||||||
$args->regdate = implode(',',$selected_date);
|
$args->regdate = implode(',',$selected_date);
|
||||||
|
// If a single date log is selected
|
||||||
// 단일 날짜의 로그를 가져올 경우
|
|
||||||
} else {
|
} else {
|
||||||
if(strlen($selected_date)==8) $selected_date = $selected_date;
|
if(strlen($selected_date)==8) $selected_date = $selected_date;
|
||||||
$args->regdate = $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) {
|
function getHourlyStatus($type='hour', $selected_date, $site_srl=0) {
|
||||||
$max = 0;
|
$max = 0;
|
||||||
$sum = 0;
|
$sum = 0;
|
||||||
switch($type) {
|
switch($type) {
|
||||||
case 'year' :
|
case 'year' :
|
||||||
// 카운터 시작일 구함
|
// Get a date to start counting
|
||||||
if($site_srl) {
|
if($site_srl) {
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
$output = executeQuery('counter.getSiteStartLogDate', $args);
|
$output = executeQuery('counter.getSiteStartLogDate', $args);
|
||||||
|
|
|
||||||
|
|
@ -2,29 +2,28 @@
|
||||||
/**
|
/**
|
||||||
* @class documentAdminController
|
* @class documentAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief document 모듈의 admin controller 클래스
|
* @brief document the module's admin controller class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class documentAdminController extends document {
|
class documentAdminController extends document {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 관리자 페이지에서 선택된 문서들 삭제
|
* @brief Remove the selected docs from admin page
|
||||||
**/
|
**/
|
||||||
function procDocumentAdminDeleteChecked() {
|
function procDocumentAdminDeleteChecked() {
|
||||||
// 선택된 글이 없으면 오류 표시
|
// error appears if no doc is selected
|
||||||
$cart = Context::get('cart');
|
$cart = Context::get('cart');
|
||||||
if(!$cart) return $this->stop('msg_cart_is_null');
|
if(!$cart) return $this->stop('msg_cart_is_null');
|
||||||
$document_srl_list= explode('|@|', $cart);
|
$document_srl_list= explode('|@|', $cart);
|
||||||
$document_count = count($document_srl_list);
|
$document_count = count($document_srl_list);
|
||||||
if(!$document_count) return $this->stop('msg_cart_is_null');
|
if(!$document_count) return $this->stop('msg_cart_is_null');
|
||||||
|
// Delete a doc
|
||||||
// 글삭제
|
|
||||||
$oDocumentController = &getController('document');
|
$oDocumentController = &getController('document');
|
||||||
for($i=0;$i<$document_count;$i++) {
|
for($i=0;$i<$document_count;$i++) {
|
||||||
$document_srl = trim($document_srl_list[$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) {
|
function moveDocumentModule($document_srl_list, $module_srl, $category_srl) {
|
||||||
if(!count($document_srl_list)) return;
|
if(!count($document_srl_list)) return;
|
||||||
|
|
@ -51,8 +50,7 @@
|
||||||
$triggerObj->document_srls = implode(',',$document_srl_list);
|
$triggerObj->document_srls = implode(',',$document_srl_list);
|
||||||
$triggerObj->module_srl = $module_srl;
|
$triggerObj->module_srl = $module_srl;
|
||||||
$triggerObj->category_srl = $category_srl;
|
$triggerObj->category_srl = $category_srl;
|
||||||
|
// Call a trigger (before)
|
||||||
// Call trigger (before)
|
|
||||||
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj);
|
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
|
|
@ -68,8 +66,7 @@
|
||||||
|
|
||||||
unset($obj);
|
unset($obj);
|
||||||
$obj = $oDocument->getObjectVars();
|
$obj = $oDocument->getObjectVars();
|
||||||
|
// Move the attached file if the target module is different
|
||||||
// 대상 모듈이 다를 경우 첨부파일 이동
|
|
||||||
if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) {
|
if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) {
|
||||||
$oFileController = &getController('file');
|
$oFileController = &getController('file');
|
||||||
|
|
||||||
|
|
@ -80,24 +77,21 @@
|
||||||
$file_info['name'] = $val->source_filename;
|
$file_info['name'] = $val->source_filename;
|
||||||
$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true);
|
$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true);
|
||||||
if($inserted_file && $inserted_file->toBool()) {
|
if($inserted_file && $inserted_file->toBool()) {
|
||||||
// 이미지/동영상등일 경우
|
// for image/video files
|
||||||
if($val->direct_download == 'Y') {
|
if($val->direct_download == 'Y') {
|
||||||
$source_filename = substr($val->uploaded_filename,2);
|
$source_filename = substr($val->uploaded_filename,2);
|
||||||
$target_filename = substr($inserted_file->get('uploaded_filename'),2);
|
$target_filename = substr($inserted_file->get('uploaded_filename'),2);
|
||||||
$obj->content = str_replace($source_filename, $target_filename, $obj->content);
|
$obj->content = str_replace($source_filename, $target_filename, $obj->content);
|
||||||
|
// For binary files
|
||||||
// binary 파일일 경우
|
|
||||||
} else {
|
} else {
|
||||||
$obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content);
|
$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);
|
$obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Delete an existing file
|
||||||
// 기존 파일 삭제
|
|
||||||
$oFileController->deleteFile($val->file_srl);
|
$oFileController->deleteFile($val->file_srl);
|
||||||
}
|
}
|
||||||
|
// Set the all files to be valid
|
||||||
// 등록된 모든 파일을 유효로 변경
|
|
||||||
$oFileController->setFilesValid($obj->document_srl);
|
$oFileController->setFilesValid($obj->document_srl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -105,8 +99,7 @@
|
||||||
{
|
{
|
||||||
$oDocumentController->deleteDocumentAliasByDocument($obj->document_srl);
|
$oDocumentController->deleteDocumentAliasByDocument($obj->document_srl);
|
||||||
}
|
}
|
||||||
|
// Move a module of the article
|
||||||
// 게시물의 모듈 이동
|
|
||||||
$obj->module_srl = $module_srl;
|
$obj->module_srl = $module_srl;
|
||||||
$obj->category_srl = $category_srl;
|
$obj->category_srl = $category_srl;
|
||||||
$output = executeQuery('document.updateDocumentModule', $obj);
|
$output = executeQuery('document.updateDocumentModule', $obj);
|
||||||
|
|
@ -114,8 +107,7 @@
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// Set 0 if a new category doesn't exist after catergory change
|
||||||
// 카테고리가 변경되었으면 검사후 없는 카테고리면 0으로 세팅
|
|
||||||
if($source_category_srl != $category_srl) {
|
if($source_category_srl != $category_srl) {
|
||||||
if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
|
if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl);
|
||||||
if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl);
|
if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl);
|
||||||
|
|
@ -125,8 +117,7 @@
|
||||||
|
|
||||||
$args->document_srls = implode(',',$document_srl_list);
|
$args->document_srls = implode(',',$document_srl_list);
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
|
// move the comment
|
||||||
// 댓글의 이동
|
|
||||||
$output = executeQuery('comment.updateCommentModule', $args);
|
$output = executeQuery('comment.updateCommentModule', $args);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
|
|
@ -138,22 +129,19 @@
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// move the trackback
|
||||||
// 엮인글의 이동
|
|
||||||
$output = executeQuery('trackback.updateTrackbackModule', $args);
|
$output = executeQuery('trackback.updateTrackbackModule', $args);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// Tags
|
||||||
// 태그
|
|
||||||
$output = executeQuery('tag.updateTagModule', $args);
|
$output = executeQuery('tag.updateTagModule', $args);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// Call a trigger (before)
|
||||||
// Call trigger (before)
|
|
||||||
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj);
|
$output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
|
|
@ -165,7 +153,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 게시글의 복사
|
* @brief Copy the post
|
||||||
**/
|
**/
|
||||||
function copyDocumentModule($document_srl_list, $module_srl, $category_srl) {
|
function copyDocumentModule($document_srl_list, $module_srl, $category_srl) {
|
||||||
if(!count($document_srl_list)) return;
|
if(!count($document_srl_list)) return;
|
||||||
|
|
@ -191,8 +179,7 @@
|
||||||
$obj->password_is_hashed = true;
|
$obj->password_is_hashed = true;
|
||||||
$obj->comment_count = 0;
|
$obj->comment_count = 0;
|
||||||
$obj->trackback_count = 0;
|
$obj->trackback_count = 0;
|
||||||
|
// Pre-register the attachment
|
||||||
// 첨부파일 미리 등록
|
|
||||||
if($oDocument->hasUploadedFiles()) {
|
if($oDocument->hasUploadedFiles()) {
|
||||||
$files = $oDocument->getUploadedFiles();
|
$files = $oDocument->getUploadedFiles();
|
||||||
foreach($files as $key => $val) {
|
foreach($files as $key => $val) {
|
||||||
|
|
@ -201,14 +188,12 @@
|
||||||
$file_info['name'] = $val->source_filename;
|
$file_info['name'] = $val->source_filename;
|
||||||
$oFileController = &getController('file');
|
$oFileController = &getController('file');
|
||||||
$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true);
|
$inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true);
|
||||||
|
// if image/video files
|
||||||
// 이미지/동영상등일 경우
|
|
||||||
if($val->direct_download == 'Y') {
|
if($val->direct_download == 'Y') {
|
||||||
$source_filename = substr($val->uploaded_filename,2);
|
$source_filename = substr($val->uploaded_filename,2);
|
||||||
$target_filename = substr($inserted_file->get('uploaded_filename'),2);
|
$target_filename = substr($inserted_file->get('uploaded_filename'),2);
|
||||||
$obj->content = str_replace($source_filename, $target_filename, $obj->content);
|
$obj->content = str_replace($source_filename, $target_filename, $obj->content);
|
||||||
|
// If binary file
|
||||||
// binary 파일일 경우
|
|
||||||
} else {
|
} else {
|
||||||
$obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content);
|
$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);
|
$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);
|
$output = $oDocumentController->insertDocument($obj, true);
|
||||||
if(!$output->toBool()) {
|
if(!$output->toBool()) {
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// Move the comments
|
||||||
// 댓글 이전
|
|
||||||
if($oDocument->getCommentCount()) {
|
if($oDocument->getCommentCount()) {
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
$comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999);
|
$comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999);
|
||||||
|
|
@ -250,8 +234,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Move the trackbacks
|
||||||
// 엮인글 이전
|
|
||||||
if($oDocument->getTrackbackCount()) {
|
if($oDocument->getTrackbackCount()) {
|
||||||
$oTrackbackModel = &getModel('trackback');
|
$oTrackbackModel = &getModel('trackback');
|
||||||
$trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl);
|
$trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl);
|
||||||
|
|
@ -264,8 +247,7 @@
|
||||||
$output = executeQuery('trackback.insertTrackback', $trackback_obj);
|
$output = executeQuery('trackback.insertTrackback', $trackback_obj);
|
||||||
if($output->toBool()) $success_count++;
|
if($output->toBool()) $success_count++;
|
||||||
}
|
}
|
||||||
|
// Update the number of trackbacks
|
||||||
// 엮인글 수 업데이트
|
|
||||||
$oDocumentController->updateTrackbackCount($obj->document_srl, $success_count);
|
$oDocumentController->updateTrackbackCount($obj->document_srl, $success_count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -280,7 +262,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 모듈의 전체 문서 삭제
|
* @brief Delete all documents of the module
|
||||||
**/
|
**/
|
||||||
function deleteModuleDocument($module_srl) {
|
function deleteModuleDocument($module_srl) {
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
|
|
@ -289,20 +271,19 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 문서 모듈의 기본설정 저장
|
* @brief Save the default settings of the document module
|
||||||
**/
|
**/
|
||||||
function procDocumentAdminInsertConfig() {
|
function procDocumentAdminInsertConfig() {
|
||||||
// 기본 정보를 받음
|
// Get the basic information
|
||||||
$config = Context::gets('thumbnail_type');
|
$config = Context::gets('thumbnail_type');
|
||||||
|
// Insert by creating the module Controller object
|
||||||
// module Controller 객체 생성하여 입력
|
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$output = $oModuleController->insertModuleConfig('document',$config);
|
$output = $oModuleController->insertModuleConfig('document',$config);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 선택된 글들에 대해 신고 취소
|
* @brief Revoke declaration of the blacklisted posts
|
||||||
**/
|
**/
|
||||||
function procDocumentAdminCancelDeclare() {
|
function procDocumentAdminCancelDeclare() {
|
||||||
$document_srl = trim(Context::get('document_srl'));
|
$document_srl = trim(Context::get('document_srl'));
|
||||||
|
|
@ -315,14 +296,12 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모든 생성된 섬네일 삭제
|
* @brief Delete all thumbnails
|
||||||
**/
|
**/
|
||||||
function procDocumentAdminDeleteAllThumbnail() {
|
function procDocumentAdminDeleteAllThumbnail() {
|
||||||
|
// delete all of thumbnail_ *. jpg files from files/attaches/images/ directory (prior versions to 1.0.4)
|
||||||
// files/attaches/images/ 디렉토리를 순환하면서 thumbnail_*.jpg 파일을 모두 삭제 (1.0.4 이전까지)
|
|
||||||
$this->deleteThumbnailFile('./files/attach/images');
|
$this->deleteThumbnailFile('./files/attach/images');
|
||||||
|
// delete a directory itself, files/cache/thumbnails (thumbnail policies have changed since version 1.0.5)
|
||||||
// files/cache/thumbnails 디렉토리 자체를 삭제 (1.0.5 이후 변경된 섬네일 정책)
|
|
||||||
FileHandler::removeFilesInDir('./files/cache/thumbnails');
|
FileHandler::removeFilesInDir('./files/cache/thumbnails');
|
||||||
|
|
||||||
$this->setMessage('success_deleted');
|
$this->setMessage('success_deleted');
|
||||||
|
|
@ -344,7 +323,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모듈의 확장 변수 추가 또는 수정
|
* @brief Add or modify extra variables of the module
|
||||||
**/
|
**/
|
||||||
function procDocumentAdminInsertExtraVar() {
|
function procDocumentAdminInsertExtraVar() {
|
||||||
$module_srl = Context::get('module_srl');
|
$module_srl = Context::get('module_srl');
|
||||||
|
|
@ -358,15 +337,14 @@
|
||||||
$eid = Context::get('eid');
|
$eid = Context::get('eid');
|
||||||
|
|
||||||
if(!$module_srl || !$name || !$eid) return new Object(-1,'msg_invalid_request');
|
if(!$module_srl || !$name || !$eid) return new Object(-1,'msg_invalid_request');
|
||||||
|
// set the max value if idx is not specified
|
||||||
// idx가 지정되어 있지 않으면 최고 값을 지정
|
|
||||||
if(!$var_idx) {
|
if(!$var_idx) {
|
||||||
$obj->module_srl = $module_srl;
|
$obj->module_srl = $module_srl;
|
||||||
$output = executeQuery('document.getDocumentMaxExtraKeyIdx', $obj);
|
$output = executeQuery('document.getDocumentMaxExtraKeyIdx', $obj);
|
||||||
$var_idx = $output->data->var_idx+1;
|
$var_idx = $output->data->var_idx+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 이미 존재하는 모듈 이름인지 체크
|
// Check if the module name already exists
|
||||||
$obj->module_srl = $module_srl;
|
$obj->module_srl = $module_srl;
|
||||||
$obj->var_idx = $var_idx;
|
$obj->var_idx = $var_idx;
|
||||||
$obj->eid = $eid;
|
$obj->eid = $eid;
|
||||||
|
|
@ -384,7 +362,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모듈의 확장 변수 삭제
|
* @brief delete extra variables of the module
|
||||||
**/
|
**/
|
||||||
function procDocumentAdminDeleteExtraVar() {
|
function procDocumentAdminDeleteExtraVar() {
|
||||||
$module_srl = Context::get('module_srl');
|
$module_srl = Context::get('module_srl');
|
||||||
|
|
@ -399,7 +377,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 확장변수 순서 조절
|
* @brief control the order of extra variables
|
||||||
**/
|
**/
|
||||||
function procDocumentAdminMoveExtraVar() {
|
function procDocumentAdminMoveExtraVar() {
|
||||||
$type = Context::get('type');
|
$type = Context::get('type');
|
||||||
|
|
@ -419,8 +397,7 @@
|
||||||
if($type == 'up') $new_idx = $var_idx-1;
|
if($type == 'up') $new_idx = $var_idx-1;
|
||||||
else $new_idx = $var_idx+1;
|
else $new_idx = $var_idx+1;
|
||||||
if($new_idx<1) return new Object(-1,'msg_invalid_request');
|
if($new_idx<1) return new Object(-1,'msg_invalid_request');
|
||||||
|
// update immediately if there is no idx to change
|
||||||
// 바꿀 idx가 없으면 바로 업데이트
|
|
||||||
if(!$extra_keys[$new_idx]) {
|
if(!$extra_keys[$new_idx]) {
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$args->var_idx = $var_idx;
|
$args->var_idx = $var_idx;
|
||||||
|
|
@ -429,7 +406,7 @@
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
|
$output = executeQuery('document.updateDocumentExtraVarIdx', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
// 있으면 기존의 꺼랑 교체
|
// replace if exists
|
||||||
} else {
|
} else {
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$args->var_idx = $new_idx;
|
$args->var_idx = $new_idx;
|
||||||
|
|
@ -521,15 +498,13 @@
|
||||||
$oDB->rollback();
|
$oDB->rollback();
|
||||||
return $output;
|
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) {
|
if($oDocument->hasUploadedFiles() && $document_args->member_srl != $document_args->module_srl) {
|
||||||
$args->upload_target_srl = $oDocument->document_srl;
|
$args->upload_target_srl = $oDocument->document_srl;
|
||||||
$args->isvalid = 'Y';
|
$args->isvalid = 'Y';
|
||||||
executeQuery('file.updateFileValid', $args);
|
executeQuery('file.updateFileValid', $args);
|
||||||
}
|
}
|
||||||
|
// call a trigger (after)
|
||||||
// trigger 호출 (after)
|
|
||||||
if($output->toBool()) {
|
if($output->toBool()) {
|
||||||
$trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $document_args);
|
$trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $document_args);
|
||||||
if(!$trigger_output->toBool()) {
|
if(!$trigger_output->toBool()) {
|
||||||
|
|
|
||||||
|
|
@ -3,51 +3,45 @@
|
||||||
* @class documentAdminModel
|
* @class documentAdminModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @version 0.1
|
* @version 0.1
|
||||||
* @brief document 모듈의 admin model class
|
* @brief document the module's admin model class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class documentAdminModel extends document {
|
class documentAdminModel extends document {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 휴지통에 존재하는 문서 목록을 가져옴
|
* @brief get a document list from the trash
|
||||||
**/
|
**/
|
||||||
function getDocumentTrashList($obj) {
|
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->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';
|
if (!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc';
|
||||||
|
// get a module_srl if mid is returned instead of modul_srl
|
||||||
// module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌
|
|
||||||
if ($obj->mid) {
|
if ($obj->mid) {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
||||||
unset($obj->mid);
|
unset($obj->mid);
|
||||||
}
|
}
|
||||||
|
// check if the module_srl is an array
|
||||||
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
|
|
||||||
if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||||
else $args->module_srl = $obj->module_srl;
|
else $args->module_srl = $obj->module_srl;
|
||||||
|
// Variable check
|
||||||
// 변수 체크
|
|
||||||
$args->sort_index = $obj->sort_index;
|
$args->sort_index = $obj->sort_index;
|
||||||
$args->order_type = $obj->order_type;
|
$args->order_type = $obj->order_type;
|
||||||
$args->page = $obj->page?$obj->page:1;
|
$args->page = $obj->page?$obj->page:1;
|
||||||
$args->list_count = $obj->list_count?$obj->list_count:20;
|
$args->list_count = $obj->list_count?$obj->list_count:20;
|
||||||
$args->page_count = $obj->page_count?$obj->page_count:10;
|
$args->page_count = $obj->page_count?$obj->page_count:10;
|
||||||
$args->member_srl = $obj->member_srl;
|
$args->member_srl = $obj->member_srl;
|
||||||
|
// Specify query_id
|
||||||
// query_id 지정
|
|
||||||
$query_id = 'document.getTrashList';
|
$query_id = 'document.getTrashList';
|
||||||
|
// Execute a query
|
||||||
// query 실행
|
|
||||||
$output = executeQueryArray($query_id, $args);
|
$output = executeQueryArray($query_id, $args);
|
||||||
|
// Return if no result or an error occurs
|
||||||
// 결과가 없거나 오류 발생시 그냥 return
|
|
||||||
if (!$output->toBool() || !count($output->data)) return $output;
|
if (!$output->toBool() || !count($output->data)) return $output;
|
||||||
|
|
||||||
$idx = 0;
|
$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) {
|
function getDocumentTrash($trash_srl) {
|
||||||
$args->trash_srl = $trash_srl;
|
$args->trash_srl = $trash_srl;
|
||||||
|
|
|
||||||
|
|
@ -2,82 +2,82 @@
|
||||||
/**
|
/**
|
||||||
* @class documentAdminView
|
* @class documentAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief document 모듈의 admin view 클래스
|
* @brief document admin view of the module class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class documentAdminView extends document {
|
class documentAdminView extends document {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 목록 출력 (관리자용)
|
* @brief Display a list(administrative)
|
||||||
**/
|
**/
|
||||||
function dispDocumentAdminList() {
|
function dispDocumentAdminList() {
|
||||||
// 목록을 구하기 위한 옵션
|
// option to get a list
|
||||||
$args->page = Context::get('page'); ///< 페이지
|
$args->page = Context::get('page'); // /< Page
|
||||||
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
|
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||||
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
|
$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_target = Context::get('search_target'); // /< search (title, contents ...)
|
||||||
$args->search_keyword = Context::get('search_keyword'); ///< 검색어
|
$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');
|
$args->module_srl = Context::get('module_srl');
|
||||||
|
|
||||||
// 목록 구함, document->getDocumentList 에서 걍 알아서 다 해버리는 구조이다... (아.. 이거 나쁜 버릇인데.. ㅡ.ㅜ 어쩔수 없다)
|
// get a list
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$output = $oDocumentModel->getDocumentList($args);
|
$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_count', $output->total_count);
|
||||||
Context::set('total_page', $output->total_page);
|
Context::set('total_page', $output->total_page);
|
||||||
Context::set('page', $output->page);
|
Context::set('page', $output->page);
|
||||||
Context::set('document_list', $output->data);
|
Context::set('document_list', $output->data);
|
||||||
Context::set('page_navigation', $output->page_navigation);
|
Context::set('page_navigation', $output->page_navigation);
|
||||||
|
|
||||||
// 템플릿에서 사용할 검색옵션 세팅
|
// set a search option used in the template
|
||||||
$count_search_option = count($this->search_option);
|
$count_search_option = count($this->search_option);
|
||||||
for($i=0;$i<$count_search_option;$i++) {
|
for($i=0;$i<$count_search_option;$i++) {
|
||||||
$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
|
$search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]);
|
||||||
}
|
}
|
||||||
Context::set('search_option', $search_option);
|
Context::set('search_option', $search_option);
|
||||||
|
|
||||||
// 템플릿 지정
|
// Specify a template
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('document_list');
|
$this->setTemplateFile('document_list');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 문서 모듈 설정
|
* @brief Set a document module
|
||||||
**/
|
**/
|
||||||
function dispDocumentAdminConfig() {
|
function dispDocumentAdminConfig() {
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$config = $oDocumentModel->getDocumentConfig();
|
$config = $oDocumentModel->getDocumentConfig();
|
||||||
Context::set('config',$config);
|
Context::set('config',$config);
|
||||||
|
|
||||||
// 템플릿 파일 지정
|
// Set the template file
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('document_config');
|
$this->setTemplateFile('document_config');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 관리자 페이지의 신고 목록 보기
|
* @brief display a report list on the admin page
|
||||||
**/
|
**/
|
||||||
function dispDocumentAdminDeclared() {
|
function dispDocumentAdminDeclared() {
|
||||||
// 목록을 구하기 위한 옵션
|
// option for a list
|
||||||
$args->page = Context::get('page'); ///< 페이지
|
$args->page = Context::get('page'); // /< Page
|
||||||
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
|
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||||
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
|
$args->page_count = 10; // /< the number of pages that appear in the page navigation
|
||||||
|
|
||||||
$args->sort_index = 'document_declared.declared_count'; ///< 소팅 값
|
$args->sort_index = 'document_declared.declared_count'; // /< sorting values
|
||||||
$args->order_type = 'desc'; ///< 소팅 정렬 값
|
$args->order_type = 'desc'; // /< sorting values by order
|
||||||
|
|
||||||
// 목록을 구함
|
// get a list
|
||||||
$declared_output = executeQuery('document.getDeclaredList', $args);
|
$declared_output = executeQuery('document.getDeclaredList', $args);
|
||||||
|
|
||||||
if($declared_output->data && count($declared_output->data)) {
|
if($declared_output->data && count($declared_output->data)) {
|
||||||
|
|
@ -91,14 +91,13 @@
|
||||||
$declared_output->data = $document_list;
|
$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_count', $declared_output->total_count);
|
||||||
Context::set('total_page', $declared_output->total_page);
|
Context::set('total_page', $declared_output->total_page);
|
||||||
Context::set('page', $declared_output->page);
|
Context::set('page', $declared_output->page);
|
||||||
Context::set('document_list', $declared_output->data);
|
Context::set('document_list', $declared_output->data);
|
||||||
Context::set('page_navigation', $declared_output->page_navigation);
|
Context::set('page_navigation', $declared_output->page_navigation);
|
||||||
|
// Set the template
|
||||||
// 템플릿 지정
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('declared_list');
|
$this->setTemplateFile('declared_list');
|
||||||
}
|
}
|
||||||
|
|
@ -130,28 +129,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function dispDocumentAdminTrashList() {
|
function dispDocumentAdminTrashList() {
|
||||||
// 목록을 구하기 위한 옵션
|
// options for a list
|
||||||
$args->page = Context::get('page'); ///< 페이지
|
$args->page = Context::get('page'); // /< Page
|
||||||
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
|
$args->list_count = 30; // /< the number of posts to display on a single page
|
||||||
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
|
$args->page_count = 10; // /< the number of pages that appear in the page navigation
|
||||||
|
|
||||||
$args->sort_index = 'list_order'; ///< 소팅 값
|
$args->sort_index = 'list_order'; // /< sorting values
|
||||||
$args->order_type = 'desc'; ///< 소팅 정렬 값
|
$args->order_type = 'desc'; // /< sorting values by order
|
||||||
|
|
||||||
$args->module_srl = Context::get('module_srl');
|
$args->module_srl = Context::get('module_srl');
|
||||||
|
|
||||||
// 목록을 구함
|
// get a list
|
||||||
$oDocumentAdminModel = &getAdminModel('document');
|
$oDocumentAdminModel = &getAdminModel('document');
|
||||||
$output = $oDocumentAdminModel->getDocumentTrashList($args);
|
$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_count', $output->total_count);
|
||||||
Context::set('total_page', $output->total_page);
|
Context::set('total_page', $output->total_page);
|
||||||
Context::set('page', $output->page);
|
Context::set('page', $output->page);
|
||||||
Context::set('document_list', $output->data);
|
Context::set('document_list', $output->data);
|
||||||
Context::set('page_navigation', $output->page_navigation);
|
Context::set('page_navigation', $output->page_navigation);
|
||||||
|
// set the template
|
||||||
// 템플릿 지정
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('document_trash_list');
|
$this->setTemplateFile('document_trash_list');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,21 +2,21 @@
|
||||||
/**
|
/**
|
||||||
* @class document
|
* @class document
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief document 모듈의 high 클래스
|
* @brief document the module's high class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
require_once(_XE_PATH_.'modules/document/document.item.php');
|
require_once(_XE_PATH_.'modules/document/document.item.php');
|
||||||
|
|
||||||
class document extends ModuleObject {
|
class document extends ModuleObject {
|
||||||
|
|
||||||
// 관리자페이지에서 사용할 검색 옵션
|
// search option to use in admin page
|
||||||
var $search_option = array('title','content','title_content','user_name',); ///< 검색 옵션
|
var $search_option = array('title','content','title_content','user_name',); // /< Search options
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치시 추가 작업이 필요할시 구현
|
* @brief Implement if additional tasks are necessary when installing
|
||||||
**/
|
**/
|
||||||
function moduleInstall() {
|
function moduleInstall() {
|
||||||
// action forward에 등록 (관리자 모드에서 사용하기 위함)
|
// Register action forward (to use in administrator mode)
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
|
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
|
|
@ -29,8 +29,7 @@
|
||||||
$oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count"));
|
$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_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);
|
$oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true);
|
||||||
|
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
|
||||||
// 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가
|
|
||||||
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
|
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
|
||||||
|
|
||||||
// 2009. 01. 29 Added a trigger for additional setup
|
// 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() {
|
function checkUpdate() {
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
$oModuleModel = &getModel('module');
|
$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;
|
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_list_order")) return true;
|
||||||
if(!$oDB->isIndexExists("documents","idx_module_update_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_readed_count")) return true;
|
||||||
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
|
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true;
|
||||||
|
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
|
||||||
// 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가
|
|
||||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
|
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true;
|
||||||
|
// 2007. 10. 25 add parent_srl, expand to the document category
|
||||||
// 2007. 10. 25 문서 분류에 parent_srl, expand를 추가
|
|
||||||
if(!$oDB->isColumnExists("document_categories","parent_srl")) return true;
|
if(!$oDB->isColumnExists("document_categories","parent_srl")) return true;
|
||||||
if(!$oDB->isColumnExists("document_categories","expand")) return true;
|
if(!$oDB->isColumnExists("document_categories","expand")) return true;
|
||||||
if(!$oDB->isColumnExists("document_categories","group_srls")) return true;
|
if(!$oDB->isColumnExists("document_categories","group_srls")) return true;
|
||||||
|
// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
|
||||||
// 2007. 11. 20 게시글에 module_srl + is_notice 복합인덱스 만들기
|
|
||||||
if(!$oDB->isIndexExists("documents","idx_module_notice")) return true;
|
if(!$oDB->isIndexExists("documents","idx_module_notice")) return true;
|
||||||
|
// 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian))
|
||||||
// 2008. 02. 18 게시글에 module_srl + document_srl 복합인덱스 만들기 (manian님 확인)
|
|
||||||
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true;
|
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;
|
if(!$oDB->isColumnExists("documents","extra_vars")) return true;
|
||||||
|
// 2008. 04. 23 Add a column(blamed_count)
|
||||||
// 2008. 04. 23 blamed count 컬럼 추가
|
|
||||||
if(!$oDB->isColumnExists("documents", "blamed_count")) return true;
|
if(!$oDB->isColumnExists("documents", "blamed_count")) return true;
|
||||||
if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true;
|
if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true;
|
||||||
if(!$oDB->isColumnExists("document_voted_log", "point")) return true;
|
if(!$oDB->isColumnExists("document_voted_log", "point")) return true;
|
||||||
|
// 2008-12-15 Add a column(color)
|
||||||
// 2008-12-15 문서 분류에 color를 추가
|
|
||||||
if(!$oDB->isColumnExists("document_categories", "color")) return true;
|
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(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true;
|
||||||
|
|
||||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
|
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true;
|
||||||
|
// 2009. 03. 09 Add a column(lang_code) to the documnets table
|
||||||
// 2009. 03. 09 documents에 lang_code 컬럼 추가
|
|
||||||
if(!$oDB->isColumnExists("documents","lang_code")) return true;
|
if(!$oDB->isColumnExists("documents","lang_code")) return true;
|
||||||
|
// 2009. 03. 11 check the index in the document_extra_vars table
|
||||||
// 2009. 03. 11 확장변수 값 테이블의 인덱스 점검
|
|
||||||
if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true;
|
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_keys","eid")) return true;
|
||||||
if(!$oDB->isColumnExists("document_extra_vars","eid")) return true;
|
if(!$oDB->isColumnExists("document_extra_vars","eid")) return true;
|
||||||
|
|
@ -112,7 +103,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 업데이트 실행
|
* @brief Execute update
|
||||||
**/
|
**/
|
||||||
function moduleUpdate() {
|
function moduleUpdate() {
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
|
|
@ -120,14 +111,14 @@
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 2007. 7. 25 : 알림 필드(notify_message) 추가
|
* 2007. 7. 25: Add a column(notify_message) for notification
|
||||||
**/
|
**/
|
||||||
if(!$oDB->isColumnExists("documents","notify_message")) {
|
if(!$oDB->isColumnExists("documents","notify_message")) {
|
||||||
$oDB->addColumn('documents',"notify_message","char",1);
|
$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")) {
|
if(!$oDB->isIndexExists("documents","idx_module_list_order")) {
|
||||||
$oDB->addIndex("documents","idx_module_list_order", array("module_srl","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")) {
|
if(!$oDB->isIndexExists("documents","idx_module_voted_count")) {
|
||||||
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
|
$oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count"));
|
||||||
}
|
}
|
||||||
|
// 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted
|
||||||
// 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가
|
|
||||||
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
|
if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'))
|
||||||
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
|
$oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after');
|
||||||
|
// 2007. 10. 25 add columns(parent_srl, expand)
|
||||||
// 2007. 10. 25 문서 분류에 parent_srl, expand를 추가
|
|
||||||
if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0);
|
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","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N");
|
||||||
if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text");
|
if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text");
|
||||||
|
// 2007. 11. 20 create a composite index on the columns(module_srl + is_notice)
|
||||||
// 2007. 11. 20 게시글에 module_srl + is_notice 복합인덱스 만들기
|
|
||||||
if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("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');
|
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"));
|
if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl"));
|
||||||
|
// 2008. 04. 23 Add a column(blamed count)
|
||||||
// 2008. 04. 23 blamed count 컬럼 추가
|
|
||||||
if(!$oDB->isColumnExists("documents", "blamed_count")) {
|
if(!$oDB->isColumnExists("documents", "blamed_count")) {
|
||||||
$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
|
$oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true);
|
||||||
$oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count'));
|
$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);
|
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);
|
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
|
// 2009. 01. 29 Added a trigger for additional setup
|
||||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
|
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'))
|
||||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
|
$oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before');
|
||||||
|
// 2009. 03. 09 Add a column(lang_code) to the documnets table
|
||||||
// 2009. 03. 09 documents에 lang_code 컬럼 추가
|
|
||||||
if(!$oDB->isColumnExists("documents","lang_code")) {
|
if(!$oDB->isColumnExists("documents","lang_code")) {
|
||||||
$db_info = Context::getDBInfo();
|
$db_info = Context::getDBInfo();
|
||||||
$oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code);
|
$oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code);
|
||||||
$obj->lang_code = $db_info->lang_type;
|
$obj->lang_code = $db_info->lang_type;
|
||||||
executeQuery('document.updateDocumentsLangCode', $obj);
|
executeQuery('document.updateDocumentsLangCode', $obj);
|
||||||
}
|
}
|
||||||
|
// 2009. 03. 11 Check the index in the document_extra_vars table
|
||||||
// 2009. 03. 11 확장변수 값 테이블의 인덱스 점검
|
|
||||||
if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) {
|
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);
|
$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. 03. 19: Add a column(eid)
|
||||||
* 2009. 04. 12 : eid를 등록할 때 다른 필드 값이 변경되는 문제 수정 #17922959
|
* 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column
|
||||||
**/
|
**/
|
||||||
if(!$oDB->isColumnExists("document_extra_keys","eid")) {
|
if(!$oDB->isColumnExists("document_extra_keys","eid")) {
|
||||||
$oDB->addColumn("document_extra_keys","eid","varchar",40);
|
$oDB->addColumn("document_extra_keys","eid","varchar",40);
|
||||||
|
|
@ -251,10 +236,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 캐시 파일 재생성
|
* @brief Re-generate the cache file
|
||||||
**/
|
**/
|
||||||
function recompileCache() {
|
function recompileCache() {
|
||||||
// 게시글 분류 캐시 파일 삭제
|
// Delete the cache files of document_category
|
||||||
FileHandler::removeFilesInDir(_XE_PATH_."files/cache/document_category");
|
FileHandler::removeFilesInDir(_XE_PATH_."files/cache/document_category");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class documentItem
|
* @class documentItem
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief document 객체
|
* @brief document object
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class documentItem extends Object {
|
class documentItem extends Object {
|
||||||
|
|
@ -40,8 +40,7 @@
|
||||||
$this->document_srl = $attribute->document_srl;
|
$this->document_srl = $attribute->document_srl;
|
||||||
$this->lang_code = $attribute->lang_code;
|
$this->lang_code = $attribute->lang_code;
|
||||||
$this->adds($attribute);
|
$this->adds($attribute);
|
||||||
|
// Tags
|
||||||
// 태그 정리
|
|
||||||
if($this->get('tags')) {
|
if($this->get('tags')) {
|
||||||
$tags = explode(',',$this->get('tags'));
|
$tags = explode(',',$this->get('tags'));
|
||||||
$tag_count = count($tags);
|
$tag_count = count($tags);
|
||||||
|
|
@ -95,15 +94,14 @@
|
||||||
function allowTrackback() {
|
function allowTrackback() {
|
||||||
static $allow_trackback_status = null;
|
static $allow_trackback_status = null;
|
||||||
if(is_null($allow_trackback_status)) {
|
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');
|
$oModuleModel = &getModel('module');
|
||||||
$trackback_config = $oModuleModel->getModuleConfig('trackback');
|
$trackback_config = $oModuleModel->getModuleConfig('trackback');
|
||||||
if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
|
if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y';
|
||||||
if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
|
if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false;
|
||||||
else {
|
else {
|
||||||
$module_srl = $this->get('module_srl');
|
$module_srl = $this->get('module_srl');
|
||||||
|
// Check settings of each module
|
||||||
// 모듈별 설정을 체크
|
|
||||||
$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
|
$module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl);
|
||||||
if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
|
if($module_config->enable_trackback == 'N') $allow_trackback_status = false;
|
||||||
else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
|
else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true;
|
||||||
|
|
@ -153,25 +151,20 @@
|
||||||
|
|
||||||
function notify($type, $content) {
|
function notify($type, $content) {
|
||||||
if(!$this->document_srl) return;
|
if(!$this->document_srl) return;
|
||||||
|
// return if it is not useNotify
|
||||||
// useNotify가 아니면 return
|
|
||||||
if(!$this->useNotify()) return;
|
if(!$this->useNotify()) return;
|
||||||
|
// Pass if an author is not a logged-in user
|
||||||
// 글쓴이가 로그인 유저가 아니면 패스~
|
|
||||||
if(!$this->get('member_srl')) return;
|
if(!$this->get('member_srl')) return;
|
||||||
|
// Return if the currently logged-in user is an author
|
||||||
// 현재 로그인한 사용자와 글을 쓴 사용자를 비교하여 동일하면 return
|
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
if($logged_info->member_srl == $this->get('member_srl')) return;
|
if($logged_info->member_srl == $this->get('member_srl')) return;
|
||||||
|
// List variables
|
||||||
// 변수 정리
|
|
||||||
if($type) $title = "[".$type."] ";
|
if($type) $title = "[".$type."] ";
|
||||||
$title .= cut_str(strip_tags($content), 10, '...');
|
$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));
|
$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');
|
$receiver_srl = $this->get('member_srl');
|
||||||
$sender_member_srl = $logged_info->member_srl;
|
$sender_member_srl = $logged_info->member_srl;
|
||||||
|
// Send a message
|
||||||
// 쪽지 발송
|
|
||||||
$oCommunicationController = &getController('communication');
|
$oCommunicationController = &getController('communication');
|
||||||
$oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false);
|
$oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false);
|
||||||
}
|
}
|
||||||
|
|
@ -263,13 +256,12 @@
|
||||||
$content = $this->get('content');
|
$content = $this->get('content');
|
||||||
if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
|
if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl'));
|
||||||
|
|
||||||
// rewrite모듈을 사용하면 링크 재정의
|
// Define a link if using a rewrite module
|
||||||
$oContext = &Context::getInstance();
|
$oContext = &Context::getInstance();
|
||||||
if($oContext->allow_rewrite) {
|
if($oContext->allow_rewrite) {
|
||||||
$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
|
$content = preg_replace('/<a([ \t]+)href=("|\')\.\/\?/i',"<a href=\\2". Context::getRequestUri() ."?", $content);
|
||||||
}
|
}
|
||||||
|
// To display a pop-up menu
|
||||||
// 이 게시글을... 팝업메뉴를 출력할 경우
|
|
||||||
if($add_popup_menu) {
|
if($add_popup_menu) {
|
||||||
$content = sprintf(
|
$content = sprintf(
|
||||||
'%s<div class="document_popup_menu"><a href="#popup_menu_area" class="document_%d" onclick="return false">%s</a></div>',
|
'%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')
|
$this->document_srl, Context::getLang('cmd_document_do')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// If additional content information is set
|
||||||
// 컨텐츠에 대한 조작이 가능한 추가 정보를 설정하였을 경우
|
|
||||||
if($add_content_info) {
|
if($add_content_info) {
|
||||||
$content = sprintf(
|
$content = sprintf(
|
||||||
'<!--BeforeDocument(%d,%d)--><div class="document_%d_%d xe_content">%s</div><!--AfterDocument(%d,%d)-->',
|
'<!--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'),
|
||||||
$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 {
|
} else {
|
||||||
if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
|
if($add_xe_content_class) $content = sprintf('<div class="xe_content">%s</div>', $content);
|
||||||
}
|
}
|
||||||
|
// Change the image path to a valid absolute path if resource_realpath is true
|
||||||
// resource_realpath가 true이면 내용내 이미지의 경로를 절대 경로로 변경
|
|
||||||
if($resource_realpath) {
|
if($resource_realpath) {
|
||||||
$content = preg_replace_callback('/<img([^>]+)>/i',array($this,'replaceResourceRealPath'), $content);
|
$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) {
|
function getTransContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true) {
|
||||||
$oEditorController = &getController('editor');
|
$oEditorController = &getController('editor');
|
||||||
|
|
@ -316,25 +306,25 @@
|
||||||
function getSummary($str_size = 50, $tail = '...') {
|
function getSummary($str_size = 50, $tail = '...') {
|
||||||
$content = $this->getContent(false,false);
|
$content = $this->getContent(false,false);
|
||||||
|
|
||||||
// 줄바꿈이 있을 때, 공백문자 삽입
|
// For a newlink, inert a whitespace
|
||||||
$content = preg_replace('!(<br[\s]*/{0,1}>[\s]*)+!is', ' ', $content);
|
$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);
|
$content = str_replace(array('</p>', '</div>', '</li>'), ' ', $content);
|
||||||
|
|
||||||
// 태그 제거
|
// Remove Tags
|
||||||
$content = preg_replace('!<([^>]*?)>!is','', $content);
|
$content = preg_replace('!<([^>]*?)>!is','', $content);
|
||||||
|
|
||||||
// < , > , " 를 치환
|
// Replace < , >, "
|
||||||
$content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content);
|
$content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content);
|
||||||
|
|
||||||
// 연속된 공백문자 삭제
|
// Delete a series of whitespaces
|
||||||
$content = preg_replace('/ ( +)/is', ' ', $content);
|
$content = preg_replace('/ ( +)/is', ' ', $content);
|
||||||
|
|
||||||
// 문자열을 자름
|
// Truncate string
|
||||||
$content = trim(cut_str($content, $str_size, $tail));
|
$content = trim(cut_str($content, $str_size, $tail));
|
||||||
|
|
||||||
// >, <, "를 다시 복구
|
// Replace back < , <, "
|
||||||
$content = str_replace(array('<','>','"'),array('<','>','"'), $content);
|
$content = str_replace(array('<','>','"'),array('<','>','"'), $content);
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
|
|
@ -383,8 +373,7 @@
|
||||||
|
|
||||||
function getTrackbackUrl() {
|
function getTrackbackUrl() {
|
||||||
if(!$this->document_srl) return;
|
if(!$this->document_srl) return;
|
||||||
|
// Generate a key to prevent spams
|
||||||
// 스팸을 막기 위한 key 생성
|
|
||||||
$oTrackbackModel = &getModel('trackback');
|
$oTrackbackModel = &getModel('trackback');
|
||||||
return $oTrackbackModel->getTrackbackUrl($this->document_srl);
|
return $oTrackbackModel->getTrackbackUrl($this->document_srl);
|
||||||
}
|
}
|
||||||
|
|
@ -431,7 +420,7 @@
|
||||||
|
|
||||||
if($extra_vars)
|
if($extra_vars)
|
||||||
{
|
{
|
||||||
// eid 명칭으로 확장변수 처리
|
// Handle extra variable(eid)
|
||||||
foreach($extra_vars as $idx => $key) {
|
foreach($extra_vars as $idx => $key) {
|
||||||
$extra_eid[$key->eid] = $key;
|
$extra_eid[$key->eid] = $key;
|
||||||
}
|
}
|
||||||
|
|
@ -441,7 +430,7 @@
|
||||||
|
|
||||||
function getExtraEidValueHTML($eid) {
|
function getExtraEidValueHTML($eid) {
|
||||||
$extra_vars = $this->getExtraVars();
|
$extra_vars = $this->getExtraVars();
|
||||||
// eid 명칭으로 확장변수 처리
|
// Handle extra variable(eid)
|
||||||
foreach($extra_vars as $idx => $key) {
|
foreach($extra_vars as $idx => $key) {
|
||||||
$extra_eid[$key->eid] = $key;
|
$extra_eid[$key->eid] = $key;
|
||||||
}
|
}
|
||||||
|
|
@ -461,33 +450,27 @@
|
||||||
function getComments() {
|
function getComments() {
|
||||||
if(!$this->allowComment() || !$this->getCommentCount()) return;
|
if(!$this->allowComment() || !$this->getCommentCount()) return;
|
||||||
if(!$this->isGranted() && $this->isSecret()) return;
|
if(!$this->isGranted() && $this->isSecret()) return;
|
||||||
|
// cpage is a number of comment pages
|
||||||
// cpage는 댓글페이지의 번호
|
|
||||||
$cpage = Context::get('cpage');
|
$cpage = Context::get('cpage');
|
||||||
|
// Get a list of comments
|
||||||
// 댓글 목록을 구해옴
|
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
|
$output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin);
|
||||||
if(!$output->toBool() || !count($output->data)) return;
|
if(!$output->toBool() || !count($output->data)) return;
|
||||||
|
// Create commentItem object from a comment list
|
||||||
// 구해온 목록을 commentItem 객체로 만듬
|
// If admin priviledge is granted on parent posts, you can read its child posts.
|
||||||
// 계층구조에 따라 부모글에 관리권한이 있으면 자식글에는 보기 권한을 줌
|
|
||||||
$accessible = array();
|
$accessible = array();
|
||||||
foreach($output->data as $key => $val) {
|
foreach($output->data as $key => $val) {
|
||||||
$oCommentItem = new commentItem();
|
$oCommentItem = new commentItem();
|
||||||
$oCommentItem->setAttribute($val);
|
$oCommentItem->setAttribute($val);
|
||||||
|
// If permission is granted to the post, you can access it temporarily
|
||||||
// 권한이 있는 글에 대해 임시로 권한이 있음을 설정
|
|
||||||
if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true;
|
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) {
|
if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) {
|
||||||
$oCommentItem->setAccessible();
|
$oCommentItem->setAccessible();
|
||||||
}
|
}
|
||||||
$comment_list[$val->comment_srl] = $oCommentItem;
|
$comment_list[$val->comment_srl] = $oCommentItem;
|
||||||
}
|
}
|
||||||
|
// Variable setting to be displayed on the skin
|
||||||
// 스킨에서 출력하기 위한 변수 설정
|
|
||||||
Context::set('cpage', $output->page_navigation->cur_page);
|
Context::set('cpage', $output->page_navigation->cur_page);
|
||||||
if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
|
if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation;
|
||||||
|
|
||||||
|
|
@ -514,16 +497,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') {
|
function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') {
|
||||||
// 존재하지 않는 문서일 경우 return false
|
// Return false if the document doesn't exist
|
||||||
if(!$this->document_srl) return;
|
if(!$this->document_srl) return;
|
||||||
|
// If not specify its height, create a square
|
||||||
// 높이 지정이 별도로 없으면 정사각형으로 생성
|
|
||||||
if(!$height) $height = $width;
|
if(!$height) $height = $width;
|
||||||
|
// Return false if neither attachement nor image files in the document
|
||||||
// 첨부파일이 없거나 내용중 이미지가 없으면 return false;
|
|
||||||
if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return;
|
if(!$this->get('uploaded_count') && !preg_match("!<img!is", $this->get('content'))) return;
|
||||||
|
// Get thumbnai_type information from document module's configuration
|
||||||
// 문서 모듈의 기본 설정에서 Thumbnail의 생성 방법을 구함
|
|
||||||
if(!in_array($thumbnail_type, array('crop','ratio'))) {
|
if(!in_array($thumbnail_type, array('crop','ratio'))) {
|
||||||
$config = $GLOBALS['__document_config__'];
|
$config = $GLOBALS['__document_config__'];
|
||||||
if(!$config) {
|
if(!$config) {
|
||||||
|
|
@ -533,23 +513,19 @@
|
||||||
}
|
}
|
||||||
$thumbnail_type = $config->thumbnail_type;
|
$thumbnail_type = $config->thumbnail_type;
|
||||||
}
|
}
|
||||||
|
// Define thumbnail information
|
||||||
// 섬네일 정보 정의
|
|
||||||
$thumbnail_path = sprintf('files/cache/thumbnails/%s',getNumberingPath($this->document_srl, 3));
|
$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_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type);
|
||||||
$thumbnail_url = Context::getRequestUri().$thumbnail_file;
|
$thumbnail_url = Context::getRequestUri().$thumbnail_file;
|
||||||
|
// Return false if thumbnail file exists and its size is 0. Otherwise, return its path
|
||||||
// 섬네일 파일이 있을 경우 파일의 크기가 0 이면 return false 아니면 경로 return
|
|
||||||
if(file_exists($thumbnail_file)) {
|
if(file_exists($thumbnail_file)) {
|
||||||
if(filesize($thumbnail_file)<1) return false;
|
if(filesize($thumbnail_file)<1) return false;
|
||||||
else return $thumbnail_url;
|
else return $thumbnail_url;
|
||||||
}
|
}
|
||||||
|
// Target File
|
||||||
// 대상 파일
|
|
||||||
$source_file = null;
|
$source_file = null;
|
||||||
$is_tmp_file = false;
|
$is_tmp_file = false;
|
||||||
|
// Find an iamge file among attached files if exists
|
||||||
// 첨부된 파일중 이미지 파일이 있으면 찾음
|
|
||||||
if($this->get('uploaded_count')) {
|
if($this->get('uploaded_count')) {
|
||||||
$oFileModel = &getModel('file');
|
$oFileModel = &getModel('file');
|
||||||
$file_list = $oFileModel->getFiles($this->document_srl);
|
$file_list = $oFileModel->getFiles($this->document_srl);
|
||||||
|
|
@ -564,8 +540,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// If not exists, file an image file from the content
|
||||||
// 첨부된 파일이 없으면 내용중 이미지 파일을 구함
|
|
||||||
if(!$source_file) {
|
if(!$source_file) {
|
||||||
$content = $this->get('content');
|
$content = $this->get('content');
|
||||||
$target_src = null;
|
$target_src = null;
|
||||||
|
|
@ -597,42 +572,39 @@
|
||||||
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
|
$output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type);
|
||||||
}
|
}
|
||||||
if($is_tmp_file) FileHandler::removeFile($source_file);
|
if($is_tmp_file) FileHandler::removeFile($source_file);
|
||||||
|
// Return its path if a thumbnail is successfully genetated
|
||||||
// 섬네일 생성 성공시 경로 return
|
|
||||||
if($output) return $thumbnail_url;
|
if($output) return $thumbnail_url;
|
||||||
|
// Create an empty file not to re-generate the thumbnail
|
||||||
// 차후 다시 섬네일 생성을 시도하지 않기 위해 빈 파일을 생성
|
|
||||||
else FileHandler::writeFile($thumbnail_file, '','w');
|
else FileHandler::writeFile($thumbnail_file, '','w');
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 새글, 최신 업데이트글, 비밀글, 이미지/동영상/첨부파일등의 아이콘 출력용 함수
|
* @brief Functions to display icons for new post, latest update, secret(private) post, image/video/attachment
|
||||||
* $time_interval 에 지정된 시간(초)로 새글/최신 업데이트글의 판별
|
* Determine new post and latest update by $time_interval
|
||||||
**/
|
**/
|
||||||
function getExtraImages($time_interval = 43200) {
|
function getExtraImages($time_interval = 43200) {
|
||||||
if(!$this->document_srl) return;
|
if(!$this->document_srl) return;
|
||||||
|
// variables for icon list
|
||||||
// 아이콘 목록을 담을 변수 미리 설정
|
|
||||||
$buffs = array();
|
$buffs = array();
|
||||||
|
|
||||||
$check_files = false;
|
$check_files = false;
|
||||||
|
|
||||||
// 비밀글 체크
|
// Check if secret post is
|
||||||
if($this->isSecret()) $buffs[] = "secret";
|
if($this->isSecret()) $buffs[] = "secret";
|
||||||
|
|
||||||
// 최신 시간 설정
|
// Set the latest time
|
||||||
$time_check = date("YmdHis", time()-$time_interval);
|
$time_check = date("YmdHis", time()-$time_interval);
|
||||||
|
|
||||||
// 새글 체크
|
// Check new post
|
||||||
if($this->get('regdate')>$time_check) $buffs[] = "new";
|
if($this->get('regdate')>$time_check) $buffs[] = "new";
|
||||||
else if($this->get('last_update')>$time_check) $buffs[] = "update";
|
else if($this->get('last_update')>$time_check) $buffs[] = "update";
|
||||||
|
|
||||||
/*
|
/*
|
||||||
$content = $this->get('content');
|
$content = $this->get('content');
|
||||||
|
|
||||||
// 사진 이미지 체크
|
// Check image files
|
||||||
preg_match_all('!<img([^>]*?)>!is', $content, $matches);
|
preg_match_all('!<img([^>]*?)>!is', $content, $matches);
|
||||||
$cnt = count($matches[0]);
|
$cnt = count($matches[0]);
|
||||||
for($i=0;$i<$cnt;$i++) {
|
for($i=0;$i<$cnt;$i++) {
|
||||||
|
|
@ -642,26 +614,25 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 동영상 체크
|
// Check video files
|
||||||
if(preg_match('!<embed([^>]*?)>!is', $content) || preg_match('/editor_component=("|\')*multimedia_link/i', $content) ) {
|
if(preg_match('!<embed([^>]*?)>!is', $content) || preg_match('/editor_component=("|\')*multimedia_link/i', $content) ) {
|
||||||
$buffs[] = "movie";
|
$buffs[] = "movie";
|
||||||
$check_files = true;
|
$check_files = true;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// 첨부파일 체크
|
// Check the attachment
|
||||||
if($this->hasUploadedFiles()) $buffs[] = "file";
|
if($this->hasUploadedFiles()) $buffs[] = "file";
|
||||||
|
|
||||||
return $buffs;
|
return $buffs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief getExtraImages로 구한 값을 이미지 태그를 씌워서 리턴
|
* @brief Return the value obtained from getExtraImages with image tag
|
||||||
**/
|
**/
|
||||||
function printExtraImages($time_check = 43200) {
|
function printExtraImages($time_check = 43200) {
|
||||||
if(!$this->document_srl) return;
|
if(!$this->document_srl) return;
|
||||||
|
// Get the icon directory
|
||||||
// 아이콘 디렉토리 구함
|
|
||||||
$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
|
$path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/');
|
||||||
|
|
||||||
$buffs = $this->getExtraImages($time_check);
|
$buffs = $this->getExtraImages($time_check);
|
||||||
|
|
@ -693,7 +664,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 에디터 html을 구해서 return
|
* @brief Return Editor html
|
||||||
**/
|
**/
|
||||||
function getEditor() {
|
function getEditor() {
|
||||||
$module_srl = $this->get('module_srl');
|
$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() {
|
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;
|
if(!$this->isGranted() && ( $this->isSecret() || $this->isLocked() || !$this->allowComment() ) ) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 댓글 에디터 html을 구해서 return
|
* @brief Return comment editor's html
|
||||||
**/
|
**/
|
||||||
function getCommentEditor() {
|
function getCommentEditor() {
|
||||||
if(!$this->isEnableComment()) return;
|
if(!$this->isEnableComment()) return;
|
||||||
|
|
@ -725,7 +696,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 작성자의 프로필 이미지를 return
|
* @brief Return author's profile image
|
||||||
**/
|
**/
|
||||||
function getProfileImage() {
|
function getProfileImage() {
|
||||||
if(!$this->isExists() || !$this->get('member_srl')) return;
|
if(!$this->isExists() || !$this->get('member_srl')) return;
|
||||||
|
|
@ -737,17 +708,15 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 작성자의 서명을 return
|
* @brief Return author's signiture
|
||||||
**/
|
**/
|
||||||
function getSignature() {
|
function getSignature() {
|
||||||
// 존재하지 않는 글이면 패스~
|
// Pass if a document doesn't exist
|
||||||
if(!$this->isExists() || !$this->get('member_srl')) return;
|
if(!$this->isExists() || !$this->get('member_srl')) return;
|
||||||
|
// Get signature information
|
||||||
// 서명정보를 구함
|
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$signature = $oMemberModel->getSignature($this->get('member_srl'));
|
$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'])) {
|
if(!isset($GLOBALS['__member_signature_max_height'])) {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$member_config = $oModuleModel->getModuleConfig('member');
|
$member_config = $oModuleModel->getModuleConfig('member');
|
||||||
|
|
@ -762,7 +731,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 내용내의 이미지 경로를 절대 경로로 변경
|
* @brief Change an image path in the content to absolute path
|
||||||
**/
|
**/
|
||||||
function replaceResourceRealPath($matches) {
|
function replaceResourceRealPath($matches) {
|
||||||
return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
|
return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]);
|
||||||
|
|
|
||||||
|
|
@ -2,45 +2,41 @@
|
||||||
/**
|
/**
|
||||||
* @class documentModel
|
* @class documentModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief document 모듈의 model 클래스
|
* @brief model class of the module document
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class documentModel extends document {
|
class documentModel extends document {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief document에 대한 권한을 세션값으로 체크
|
* @brief document checked the permissions on the session values
|
||||||
**/
|
**/
|
||||||
function isGranted($document_srl) {
|
function isGranted($document_srl) {
|
||||||
return $_SESSION['own_document'][$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() {
|
function setToAllDocumentExtraVars() {
|
||||||
static $checked_documents = array();
|
static $checked_documents = array();
|
||||||
|
// XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings
|
||||||
// XE에서 모든 문서 객체는 XE_DOCUMENT_LIST라는 전역 변수에 세팅을 함
|
|
||||||
if(!count($GLOBALS['XE_DOCUMENT_LIST'])) return;
|
if(!count($GLOBALS['XE_DOCUMENT_LIST'])) return;
|
||||||
|
// Find all called the document object variable has been set extension
|
||||||
// 모든 호출된 문서 객체를 찾아서 확장변수가 설정되었는지를 확인
|
|
||||||
$document_srls = array();
|
$document_srls = array();
|
||||||
foreach($GLOBALS['XE_DOCUMENT_LIST'] as $key => $val) {
|
foreach($GLOBALS['XE_DOCUMENT_LIST'] as $key => $val) {
|
||||||
if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
|
if(!$val->document_srl || $checked_documents[$val->document_srl]) continue;
|
||||||
$checked_documents[$val->document_srl] = true;
|
$checked_documents[$val->document_srl] = true;
|
||||||
$document_srls[] = $val->document_srl;
|
$document_srls[] = $val->document_srl;
|
||||||
}
|
}
|
||||||
|
// If the document number, return detected
|
||||||
// 검출된 문서 번호가 없으면 return
|
|
||||||
if(!count($document_srls)) return;
|
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);
|
$obj->document_srl = implode(',',$document_srls);
|
||||||
$output = executeQueryArray('document.getDocumentExtraVars', $obj);
|
$output = executeQueryArray('document.getDocumentExtraVars', $obj);
|
||||||
if($output->toBool() && $output->data) {
|
if($output->toBool() && $output->data) {
|
||||||
|
|
@ -62,8 +58,7 @@
|
||||||
$extra_keys = $this->getExtraKeys($module_srl);
|
$extra_keys = $this->getExtraKeys($module_srl);
|
||||||
$vars = $extra_vars[$document_srl];
|
$vars = $extra_vars[$document_srl];
|
||||||
$document_lang_code = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->get('lang_code');
|
$document_lang_code = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->get('lang_code');
|
||||||
|
// Expand the variable processing
|
||||||
// 확장변수 처리
|
|
||||||
if(count($extra_keys)) {
|
if(count($extra_keys)) {
|
||||||
foreach($extra_keys as $idx => $key) {
|
foreach($extra_keys as $idx => $key) {
|
||||||
$val = $vars[$idx];
|
$val = $vars[$idx];
|
||||||
|
|
@ -78,11 +73,9 @@
|
||||||
unset($evars);
|
unset($evars);
|
||||||
$evars = new ExtraVar($module_srl);
|
$evars = new ExtraVar($module_srl);
|
||||||
$evars->setExtraVarKeys($extra_keys);
|
$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]);
|
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[-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]){
|
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) {
|
function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true) {
|
||||||
if(!$document_srl) return new documentItem();
|
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) {
|
function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true) {
|
||||||
if(is_array($document_srls)) {
|
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) {
|
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->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';
|
if(!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc';
|
||||||
|
// If that came across mid module_srl instead of a direct module_srl guhaejum
|
||||||
// module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌
|
|
||||||
if($obj->mid) {
|
if($obj->mid) {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
||||||
unset($obj->mid);
|
unset($obj->mid);
|
||||||
}
|
}
|
||||||
|
// Module_srl passed the array may be a check whether the array
|
||||||
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
|
|
||||||
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||||
else $args->module_srl = $obj->module_srl;
|
else $args->module_srl = $obj->module_srl;
|
||||||
|
// Except for the test module_srl
|
||||||
// 제외 module_srl에 대한 검사
|
|
||||||
if(is_array($obj->exclude_module_srl)) $args->exclude_module_srl = implode(',', $obj->exclude_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;
|
else $args->exclude_module_srl = $obj->exclude_module_srl;
|
||||||
|
// Variable check
|
||||||
// 변수 체크
|
|
||||||
$args->category_srl = $obj->category_srl?$obj->category_srl:null;
|
$args->category_srl = $obj->category_srl?$obj->category_srl:null;
|
||||||
$args->sort_index = $obj->sort_index;
|
$args->sort_index = $obj->sort_index;
|
||||||
$args->order_type = $obj->order_type;
|
$args->order_type = $obj->order_type;
|
||||||
|
|
@ -189,39 +178,35 @@
|
||||||
$args->start_date = $obj->start_date?$obj->start_date:null;
|
$args->start_date = $obj->start_date?$obj->start_date:null;
|
||||||
$args->end_date = $obj->end_date?$obj->end_date:null;
|
$args->end_date = $obj->end_date?$obj->end_date:null;
|
||||||
$args->member_srl = $obj->member_srl;
|
$args->member_srl = $obj->member_srl;
|
||||||
|
// Category is selected, further sub-categories until all conditions
|
||||||
// 카테고리가 선택되어 있으면 하부 카테고리까지 모두 조건에 추가
|
|
||||||
if($args->category_srl) {
|
if($args->category_srl) {
|
||||||
$category_list = $this->getCategoryList($args->module_srl);
|
$category_list = $this->getCategoryList($args->module_srl);
|
||||||
$category_info = $category_list[$args->category_srl];
|
$category_info = $category_list[$args->category_srl];
|
||||||
$category_info->childs[] = $args->category_srl;
|
$category_info->childs[] = $args->category_srl;
|
||||||
$args->category_srl = implode(',',$category_info->childs);
|
$args->category_srl = implode(',',$category_info->childs);
|
||||||
}
|
}
|
||||||
|
// Used to specify the default query id (based on several search options to query id modified)
|
||||||
// 기본으로 사용할 query id 지정 (몇가지 검색 옵션에 따라 query id가 변경됨)
|
|
||||||
$query_id = 'document.getDocumentList';
|
$query_id = 'document.getDocumentList';
|
||||||
|
// If the search by specifying the document division naeyonggeomsaekil processed for
|
||||||
// 내용검색일 경우 document division을 지정하여 검색하기 위한 처리
|
|
||||||
$use_division = false;
|
$use_division = false;
|
||||||
|
|
||||||
// 검색 옵션 정리
|
// Search options
|
||||||
$searchOpt->search_target = $obj->search_target;
|
$searchOpt->search_target = $obj->search_target;
|
||||||
$searchOpt->search_keyword = $obj->search_keyword;
|
$searchOpt->search_keyword = $obj->search_keyword;
|
||||||
$this->_setSearchOption($searchOpt, &$args, &$query_id, &$use_division);
|
$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;
|
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) {
|
if($use_division) {
|
||||||
// 시작 division
|
// Division begins
|
||||||
$division = (int)Context::get('division');
|
$division = (int)Context::get('division');
|
||||||
|
// If you do not value the best division top
|
||||||
// division값이 없다면 제일 상위
|
|
||||||
if(!$division) {
|
if(!$division) {
|
||||||
$division_args->module_srl = $args->module_srl;
|
$division_args->module_srl = $args->module_srl;
|
||||||
$division_args->exclude_module_srl = $args->exclude_module_srl;
|
$division_args->exclude_module_srl = $args->exclude_module_srl;
|
||||||
|
|
@ -235,11 +220,9 @@
|
||||||
}
|
}
|
||||||
$division_args = null;
|
$division_args = null;
|
||||||
}
|
}
|
||||||
|
// The last division
|
||||||
// 마지막 division
|
|
||||||
$last_division = (int)Context::get('last_division');
|
$last_division = (int)Context::get('last_division');
|
||||||
|
// Division after division from the 5000 value of the specified Wanted
|
||||||
// 지정된 division에서부터 5000개 후의 division값을 구함
|
|
||||||
if(!$last_division) {
|
if(!$last_division) {
|
||||||
$last_division_args->module_srl = $args->module_srl;
|
$last_division_args->module_srl = $args->module_srl;
|
||||||
$last_division_args->exclude_module_srl = $args->exclude_module_srl;
|
$last_division_args->exclude_module_srl = $args->exclude_module_srl;
|
||||||
|
|
@ -255,8 +238,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// Make sure that after last_division article
|
||||||
// last_division 이후로 글이 있는지 확인
|
|
||||||
if($last_division) {
|
if($last_division) {
|
||||||
$last_division_args = null;
|
$last_division_args = null;
|
||||||
$last_division_args->module_srl = $args->module_srl;
|
$last_division_args->module_srl = $args->module_srl;
|
||||||
|
|
@ -271,9 +253,8 @@
|
||||||
Context::set('division', $division);
|
Context::set('division', $division);
|
||||||
Context::set('last_division', $last_division);
|
Context::set('last_division', $last_division);
|
||||||
}
|
}
|
||||||
|
// document.getDocumentList query execution
|
||||||
// document.getDocumentList 쿼리 실행
|
// Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because
|
||||||
// 만약 query_id가 getDocumentListWithinComment 또는 getDocumentListWithinTag일 경우 group by 절 사용 때문에 쿼리를 한번더 수행
|
|
||||||
if(in_array($query_id, array('document.getDocumentListWithinComment', 'document.getDocumentListWithinTag'))) {
|
if(in_array($query_id, array('document.getDocumentListWithinComment', 'document.getDocumentListWithinTag'))) {
|
||||||
$group_args = clone($args);
|
$group_args = clone($args);
|
||||||
$group_args->sort_index = 'documents.'.$args->sort_index;
|
$group_args->sort_index = 'documents.'.$args->sort_index;
|
||||||
|
|
@ -301,8 +282,7 @@
|
||||||
} else {
|
} else {
|
||||||
$output = executeQueryArray($query_id, $args);
|
$output = executeQueryArray($query_id, $args);
|
||||||
}
|
}
|
||||||
|
// Return if no result or an error occurs
|
||||||
// 결과가 없거나 오류 발생시 그냥 return
|
|
||||||
if(!$output->toBool()||!count($output->data)) return $output;
|
if(!$output->toBool()||!count($output->data)) return $output;
|
||||||
|
|
||||||
$idx = 0;
|
$idx = 0;
|
||||||
|
|
@ -349,7 +329,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module_srl값을 가지는 문서의 공지사항만 가져옴
|
* @brief module_srl value, bringing the document's gongjisa Port
|
||||||
**/
|
**/
|
||||||
function getNoticeList($obj) {
|
function getNoticeList($obj) {
|
||||||
$args->module_srl = $obj->module_srl;
|
$args->module_srl = $obj->module_srl;
|
||||||
|
|
@ -378,8 +358,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief document의 확장 변수 키값을 가져오는 함수
|
* @brief function to retrieve the key values of the extended variable document
|
||||||
* $form_include : 글 작성시에 필요한 확장변수의 input form 추가 여부
|
* $Form_include: writing articles whether to add the necessary extensions of the variable input form
|
||||||
**/
|
**/
|
||||||
function getExtraKeys($module_srl) {
|
function getExtraKeys($module_srl) {
|
||||||
if(is_null($GLOBALS['XE_EXTRA_KEYS'][$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) {
|
function getExtraVars($module_srl, $document_srl) {
|
||||||
if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) {
|
if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) {
|
||||||
// 확장변수 값을 추출하여 세팅
|
// Extended to extract the values of variables set
|
||||||
$oDocument = $this->getDocument($document_srl, false);
|
$oDocument = $this->getDocument($document_srl, false);
|
||||||
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
|
$GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument;
|
||||||
$this->setToAllDocumentExtraVars();
|
$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() {
|
function getDocumentMenu() {
|
||||||
|
// Post number and the current login information requested Wanted
|
||||||
// 요청된 게시물 번호와 현재 로그인 정보 구함
|
|
||||||
$document_srl = Context::get('target_srl');
|
$document_srl = Context::get('target_srl');
|
||||||
$mid = Context::get('cur_mid');
|
$mid = Context::get('cur_mid');
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$act = Context::get('cur_act');
|
$act = Context::get('cur_act');
|
||||||
|
// to menu_list "pyosihalgeul, target, url" put into an array
|
||||||
// menu_list 에 "표시할글,target,url" 을 배열로 넣는다
|
|
||||||
$menu_list = array();
|
$menu_list = array();
|
||||||
|
// call trigger
|
||||||
// trigger 호출
|
|
||||||
ModuleHandler::triggerCall('document.getDocumentMenu', 'before', $menu_list);
|
ModuleHandler::triggerCall('document.getDocumentMenu', 'before', $menu_list);
|
||||||
|
|
||||||
$oDocumentController = &getController('document');
|
$oDocumentController = &getController('document');
|
||||||
|
// Members must be a possible feature
|
||||||
// 회원이어야만 가능한 기능
|
|
||||||
if($logged_info->member_srl) {
|
if($logged_info->member_srl) {
|
||||||
|
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
|
|
@ -444,40 +420,37 @@
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
|
$document_config = $oModuleModel->getModulePartConfig('document',$module_srl);
|
||||||
if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_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);
|
$url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl);
|
||||||
$oDocumentController->addDocumentPopupMenu($url,'cmd_vote','./modules/document/tpl/icons/vote_up.gif','javascript');
|
$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){
|
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);
|
$url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl);
|
||||||
$oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','./modules/document/tpl/icons/vote_down.gif','javascript');
|
$oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','./modules/document/tpl/icons/vote_down.gif','javascript');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 신고 기능 추가
|
// Adding Report
|
||||||
$url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
|
$url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl);
|
||||||
$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','./modules/document/tpl/icons/declare.gif','javascript');
|
$oDocumentController->addDocumentPopupMenu($url,'cmd_declare','./modules/document/tpl/icons/declare.gif','javascript');
|
||||||
|
|
||||||
// 스크랩 버튼 추가
|
// Add Bookmark button
|
||||||
$url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);
|
$url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl);
|
||||||
$oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','./modules/document/tpl/icons/scrap.gif','javascript');
|
$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);
|
$url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl);
|
||||||
$oDocumentController->addDocumentPopupMenu($url,'cmd_print','./modules/document/tpl/icons/print.gif','printDocument');
|
$oDocumentController->addDocumentPopupMenu($url,'cmd_print','./modules/document/tpl/icons/print.gif','printDocument');
|
||||||
|
// Call a trigger (after)
|
||||||
// trigger 호출 (after)
|
|
||||||
ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list);
|
ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list);
|
||||||
|
// If you are managing to find posts by ip
|
||||||
// 관리자일 경우 ip로 글 찾기
|
|
||||||
if($logged_info->is_admin == 'Y') {
|
if($logged_info->is_admin == 'Y') {
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl);
|
$oDocument = $oDocumentModel->getDocument($document_srl);
|
||||||
|
|
||||||
if($oDocument->isExists()) {
|
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'));
|
$url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->get('ipaddress'));
|
||||||
$icon_path = './modules/member/tpl/images/icon_management.gif';
|
$icon_path = './modules/member/tpl/images/icon_management.gif';
|
||||||
$oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress');
|
$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');
|
$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 = Context::get('document_popup_menu_list');
|
||||||
$menus_count = count($menus);
|
$menus_count = count($menus);
|
||||||
for($i=0;$i<$menus_count;$i++) {
|
for($i=0;$i<$menus_count;$i++) {
|
||||||
$menus[$i]->str = Context::getLang($menus[$i]->str);
|
$menus[$i]->str = Context::getLang($menus[$i]->str);
|
||||||
}
|
}
|
||||||
|
// Wanted to finally clean pop-up menu list
|
||||||
// 최종적으로 정리된 팝업메뉴 목록을 구함
|
|
||||||
$this->add('menus', $menus);
|
$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) {
|
function getDocumentCount($module_srl, $search_obj = NULL) {
|
||||||
// 검색 옵션 추가
|
// Additional search options
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$args->s_title = $search_obj->s_title;
|
$args->s_title = $search_obj->s_title;
|
||||||
$args->s_content = $search_obj->s_content;
|
$args->s_content = $search_obj->s_content;
|
||||||
|
|
@ -513,16 +484,15 @@
|
||||||
$args->category_srl = $search_obj->category_srl;
|
$args->category_srl = $search_obj->category_srl;
|
||||||
|
|
||||||
$output = executeQuery('document.getDocumentCount', $args);
|
$output = executeQuery('document.getDocumentCount', $args);
|
||||||
|
// Return total number of
|
||||||
// 전체 갯수를 return
|
|
||||||
$total_count = $output->data->count;
|
$total_count = $output->data->count;
|
||||||
return (int)$total_count;
|
return (int)$total_count;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* @brief 해당 document의 page 가져오기, module_srl이 없으면 전체에서..
|
* @brief Import page of the document, module_srl Without throughout ..
|
||||||
**/
|
**/
|
||||||
function getDocumentPage($oDocument, $opt) {
|
function getDocumentPage($oDocument, $opt) {
|
||||||
// 정렬 형식에 따라서 query args 변경
|
// Sort type changes depending on the query args
|
||||||
switch($opt->sort_index) {
|
switch($opt->sort_index) {
|
||||||
case 'update_order' :
|
case 'update_order' :
|
||||||
if($opt->order_type == 'desc') $args->rev_update_order = $oDocument->get('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;
|
$searchOpt->search_keyword = $opt->search_keyword;
|
||||||
$this->_setSearchOption($searchOpt, &$args, &$query_id, &$use_division);
|
$this->_setSearchOption($searchOpt, &$args, &$query_id, &$use_division);
|
||||||
|
|
||||||
// 전체 갯수를 구한후 해당 글의 페이지를 검색
|
// Guhanhu total number of the article search page
|
||||||
$output = executeQuery('document.getDocumentPage', $args);
|
$output = executeQuery('document.getDocumentPage', $args);
|
||||||
$count = $output->data->count;
|
$count = $output->data->count;
|
||||||
$page = (int)(($count-1)/$opt->list_count)+1;
|
$page = (int)(($count-1)/$opt->list_count)+1;
|
||||||
|
|
@ -560,7 +530,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 카테고리의 정보를 가져옴
|
* @brief Imported Category of information
|
||||||
**/
|
**/
|
||||||
function getCategory($category_srl) {
|
function getCategory($category_srl) {
|
||||||
$args->category_srl = $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) {
|
function getCategoryChlidCount($category_srl) {
|
||||||
$args->category_srl = $category_srl;
|
$args->category_srl = $category_srl;
|
||||||
|
|
@ -591,29 +561,27 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 모듈의 카테고리 목록을 가져옴
|
* @brief Bringing the Categories list the specific module
|
||||||
* 속도나 여러가지 상황을 고려해서 카테고리 목록은 php로 생성된 script를 include하여 사용하는 것을 원칙으로 함
|
* 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) {
|
function getCategoryList($module_srl) {
|
||||||
// 대상 모듈의 카테고리 파일을 불러옴
|
// Category of the target module file swollen
|
||||||
$filename = sprintf("./files/cache/document_category/%s.php", $module_srl);
|
$filename = sprintf("./files/cache/document_category/%s.php", $module_srl);
|
||||||
|
// If the target file to the cache file regeneration category
|
||||||
// 대상 파일이 없으면 카테고리 캐시 파일을 재생성
|
|
||||||
if(!file_exists($filename)) {
|
if(!file_exists($filename)) {
|
||||||
$oDocumentController = &getController('document');
|
$oDocumentController = &getController('document');
|
||||||
if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
|
if(!$oDocumentController->makeCategoryFile($module_srl)) return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
@include($filename);
|
@include($filename);
|
||||||
|
// Cleanup of category
|
||||||
// 카테고리의 정리
|
|
||||||
$document_category = array();
|
$document_category = array();
|
||||||
$this->_arrangeCategory($document_category, $menu->list, 0);
|
$this->_arrangeCategory($document_category, $menu->list, 0);
|
||||||
return $document_category;
|
return $document_category;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 카테고리를 1차 배열 형식으로 변경하는 내부 method
|
* @brief Category within a primary method to change the array type
|
||||||
**/
|
**/
|
||||||
function _arrangeCategory(&$document_category, $list, $depth) {
|
function _arrangeCategory(&$document_category, $list, $depth) {
|
||||||
if(!count($list)) return;
|
if(!count($list)) return;
|
||||||
|
|
@ -640,8 +608,7 @@
|
||||||
$obj->selected = $selected;
|
$obj->selected = $selected;
|
||||||
|
|
||||||
$list_order[$idx++] = $obj->category_srl;
|
$list_order[$idx++] = $obj->category_srl;
|
||||||
|
// If you have a parent category of child nodes apply data
|
||||||
// 부모 카테고리가 있으면 자식노드들의 데이터를 적용
|
|
||||||
if($obj->parent_srl) {
|
if($obj->parent_srl) {
|
||||||
|
|
||||||
$parent_srl = $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) {
|
function getCategoryDocumentCount($module_srl, $category_srl) {
|
||||||
$args->module_srl = $module_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) {
|
function getCategoryXmlFile($module_srl) {
|
||||||
$xml_file = sprintf('files/cache/document_category/%s.xml.php',$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) {
|
function getCategoryPhpFile($module_srl) {
|
||||||
$php_file = sprintf('files/cache/document_category/%s.php',$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) {
|
function getMonthlyArchivedList($obj) {
|
||||||
if($obj->mid) {
|
if($obj->mid) {
|
||||||
|
|
@ -710,8 +677,7 @@
|
||||||
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
||||||
unset($obj->mid);
|
unset($obj->mid);
|
||||||
}
|
}
|
||||||
|
// Module_srl passed the array may be a check whether the array
|
||||||
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
|
|
||||||
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||||
else $args->module_srl = $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) {
|
function getDailyArchivedList($obj) {
|
||||||
if($obj->mid) {
|
if($obj->mid) {
|
||||||
|
|
@ -732,8 +698,7 @@
|
||||||
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
$obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid);
|
||||||
unset($obj->mid);
|
unset($obj->mid);
|
||||||
}
|
}
|
||||||
|
// Module_srl passed the array may be a check whether the array
|
||||||
// 넘어온 module_srl은 array일 수도 있기에 array인지를 체크
|
|
||||||
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl);
|
||||||
else $args->module_srl = $obj->module_srl;
|
else $args->module_srl = $obj->module_srl;
|
||||||
$args->regdate = $obj->regdate;
|
$args->regdate = $obj->regdate;
|
||||||
|
|
@ -747,15 +712,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 모듈의 분류를 구함
|
* @brief Get a list for a particular module
|
||||||
**/
|
**/
|
||||||
function getDocumentCategories() {
|
function getDocumentCategories() {
|
||||||
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
||||||
$module_srl = Context::get('module_srl');
|
$module_srl = Context::get('module_srl');
|
||||||
$categories= $this->getCategoryList($module_srl);
|
$categories= $this->getCategoryList($module_srl);
|
||||||
$lang = Context::get('lang');
|
$lang = Context::get('lang');
|
||||||
|
// No additional category
|
||||||
// 분류 없음 추가
|
|
||||||
$output = "0,0,{$lang->none_category}\n";
|
$output = "0,0,{$lang->none_category}\n";
|
||||||
if($categories){
|
if($categories){
|
||||||
foreach($categories as $category_srl => $category) {
|
foreach($categories as $category_srl => $category) {
|
||||||
|
|
@ -766,7 +730,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 문서 설정 정보를 구함
|
* @brief Wanted to set document information
|
||||||
**/
|
**/
|
||||||
function getDocumentConfig() {
|
function getDocumentConfig() {
|
||||||
if(!$GLOBALS['__document_config__']) {
|
if(!$GLOBALS['__document_config__']) {
|
||||||
|
|
@ -779,21 +743,20 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 공통 :: 모듈의 확장 변수 관리
|
* @brief Common:: Module extensions of variable management
|
||||||
* 모듈의 확장변수 관리는 모든 모듈에서 document module instance를 이용할때 사용할 수 있음
|
* Expansion parameter management module in the document module instance, when using all the modules available
|
||||||
**/
|
**/
|
||||||
function getExtraVarsHTML($module_srl) {
|
function getExtraVarsHTML($module_srl) {
|
||||||
// 기존의 extra_keys 가져옴
|
// Bringing existing extra_keys
|
||||||
$extra_keys = $this->getExtraKeys($module_srl);
|
$extra_keys = $this->getExtraKeys($module_srl);
|
||||||
Context::set('extra_keys', $extra_keys);
|
Context::set('extra_keys', $extra_keys);
|
||||||
|
// Get information of module_grants
|
||||||
// grant 정보를 추출
|
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
return $oTemplate->compile($this->module_path.'tpl', 'extra_keys');
|
return $oTemplate->compile($this->module_path.'tpl', 'extra_keys');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 공통 :: 모듈의 카테고리 변수 관리
|
* @brief Common:: Category parameter management module
|
||||||
**/
|
**/
|
||||||
function getCategoryHTML($module_srl) {
|
function getCategoryHTML($module_srl) {
|
||||||
$category_xml_file = $this->getCategoryXmlFile($module_srl);
|
$category_xml_file = $this->getCategoryXmlFile($module_srl);
|
||||||
|
|
@ -801,50 +764,43 @@
|
||||||
Context::set('category_xml_file', $category_xml_file);
|
Context::set('category_xml_file', $category_xml_file);
|
||||||
|
|
||||||
Context::loadJavascriptPlugin('ui.tree');
|
Context::loadJavascriptPlugin('ui.tree');
|
||||||
// grant 정보를 추출
|
// Get information of module_grants
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
return $oTemplate->compile($this->module_path.'tpl', 'category_list');
|
return $oTemplate->compile($this->module_path.'tpl', 'category_list');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 카테고리의 정보를 이용하여 템플릿을 구한후 return
|
* @brief Certain categories of information, return the template guhanhu
|
||||||
* 관리자 페이지에서 특정 메뉴의 정보를 추가하기 위해 서버에서 tpl을 컴파일 한후 컴파일 된 html을 직접 return
|
* Manager on the page to add information about a particular menu from the server after compiling tpl compiled a direct return html
|
||||||
**/
|
**/
|
||||||
function getDocumentCategoryTplInfo() {
|
function getDocumentCategoryTplInfo() {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
|
// Get information on the menu for the parameter settings
|
||||||
// 해당 메뉴의 정보를 가져오기 위한 변수 설정
|
|
||||||
$module_srl = Context::get('module_srl');
|
$module_srl = Context::get('module_srl');
|
||||||
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl);
|
||||||
|
// Check permissions
|
||||||
// 권한 체크
|
|
||||||
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
|
$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info'));
|
||||||
if(!$grant->manager) return new Object(-1,'msg_not_permitted');
|
if(!$grant->manager) return new Object(-1,'msg_not_permitted');
|
||||||
|
|
||||||
$category_srl = Context::get('category_srl');
|
$category_srl = Context::get('category_srl');
|
||||||
$parent_srl = Context::get('parent_srl');
|
$parent_srl = Context::get('parent_srl');
|
||||||
|
// Get a list of member groups
|
||||||
// 회원 그룹의 목록을 가져옴
|
|
||||||
$group_list = $oMemberModel->getGroups($module_info->site_srl);
|
$group_list = $oMemberModel->getGroups($module_info->site_srl);
|
||||||
Context::set('group_list', $group_list);
|
Context::set('group_list', $group_list);
|
||||||
|
// Without the sub-menu has parent_srl category_srl chugaim
|
||||||
// parent_srl이 있고 category_srl 이 없으면 하부 메뉴 추가임
|
|
||||||
if(!$category_srl && $parent_srl) {
|
if(!$category_srl && $parent_srl) {
|
||||||
// 상위 메뉴의 정보를 가져옴
|
// Get information of the parent menu
|
||||||
$parent_info = $this->getCategory($parent_srl);
|
$parent_info = $this->getCategory($parent_srl);
|
||||||
|
// Default parameter settings for a new menu
|
||||||
// 추가하려는 메뉴의 기본 변수 설정
|
|
||||||
$category_info->category_srl = getNextSequence();
|
$category_info->category_srl = getNextSequence();
|
||||||
$category_info->parent_srl = $parent_srl;
|
$category_info->parent_srl = $parent_srl;
|
||||||
$category_info->parent_category_title = $parent_info->title;
|
$category_info->parent_category_title = $parent_info->title;
|
||||||
|
// Add to the root menu, or if an existing menu Modified
|
||||||
// root에 메뉴 추가하거나 기존 메뉴의 수정일 경우
|
|
||||||
} else {
|
} else {
|
||||||
// category_srl 이 있으면 해당 메뉴의 정보를 가져온다
|
// If category_srl the menu brings the information
|
||||||
if($category_srl) $category_info = $this->getCategory($category_srl);
|
if($category_srl) $category_info = $this->getCategory($category_srl);
|
||||||
|
// If you do not add value d which pertain to the menu to see the new values guhaejum category_srl
|
||||||
// 찾아진 값이 없다면 신규 메뉴 추가로 보고 category_srl값만 구해줌
|
|
||||||
if(!$category_info->category_srl) {
|
if(!$category_info->category_srl) {
|
||||||
$category_info->category_srl = getNextSequence();
|
$category_info->category_srl = getNextSequence();
|
||||||
}
|
}
|
||||||
|
|
@ -853,17 +809,14 @@
|
||||||
|
|
||||||
$category_info->title = htmlspecialchars($category_info->title);
|
$category_info->title = htmlspecialchars($category_info->title);
|
||||||
Context::set('category_info', $category_info);
|
Context::set('category_info', $category_info);
|
||||||
|
// tpl template file directly compile and will return a variable and puts it on.
|
||||||
// template 파일을 직접 컴파일한후 tpl변수에 담아서 return한다.
|
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
$tpl = $oTemplate->compile('./modules/document/tpl', 'category_info');
|
$tpl = $oTemplate->compile('./modules/document/tpl', 'category_info');
|
||||||
$tpl = str_replace("\n",'',$tpl);
|
$tpl = str_replace("\n",'',$tpl);
|
||||||
|
// Changing user-defined language
|
||||||
// 사용자 정의 언어 변경
|
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$oModuleController->replaceDefinedLangCode($tpl);
|
$oModuleController->replaceDefinedLangCode($tpl);
|
||||||
|
// set of variables to return
|
||||||
// return 할 변수 설정
|
|
||||||
$this->add('tpl', $tpl);
|
$this->add('tpl', $tpl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -906,20 +859,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief module_srl값을 가지는 문서의 목록을 가져옴
|
* @brief module_srl value, bringing the list of documents
|
||||||
**/
|
**/
|
||||||
function getTrashList($obj) {
|
function getTrashList($obj) {
|
||||||
|
// Variable check
|
||||||
// 변수 체크
|
|
||||||
$args->category_srl = $obj->category_srl?$obj->category_srl:null;
|
$args->category_srl = $obj->category_srl?$obj->category_srl:null;
|
||||||
$args->sort_index = $obj->sort_index;
|
$args->sort_index = $obj->sort_index;
|
||||||
$args->order_type = $obj->order_type?$obj->order_type:'desc';
|
$args->order_type = $obj->order_type?$obj->order_type:'desc';
|
||||||
$args->page = $obj->page?$obj->page:1;
|
$args->page = $obj->page?$obj->page:1;
|
||||||
$args->list_count = $obj->list_count?$obj->list_count:20;
|
$args->list_count = $obj->list_count?$obj->list_count:20;
|
||||||
$args->page_count = $obj->page_count?$obj->page_count:10;
|
$args->page_count = $obj->page_count?$obj->page_count:10;
|
||||||
|
// Search options
|
||||||
|
|
||||||
// 검색 옵션 정리
|
|
||||||
$search_target = $obj->search_target;
|
$search_target = $obj->search_target;
|
||||||
$search_keyword = $obj->search_keyword;
|
$search_keyword = $obj->search_keyword;
|
||||||
if($search_target && $search_keyword) {
|
if($search_target && $search_keyword) {
|
||||||
|
|
|
||||||
|
|
@ -2,42 +2,37 @@
|
||||||
/**
|
/**
|
||||||
* @class documentView
|
* @class documentView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief document 모듈의 View class
|
* @brief View class of the module document
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class documentView extends document {
|
class documentView extends document {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 문서 인쇄 기능
|
* @brief Document printing
|
||||||
* 해당 글만 찾아서 그냥 출력해버린다;;
|
* I make it out to find the geulman;;
|
||||||
**/
|
**/
|
||||||
function dispDocumentPrint() {
|
function dispDocumentPrint() {
|
||||||
// 목록 구현에 필요한 변수들을 가져온다
|
// Bring a list of variables needed to implement
|
||||||
$document_srl = Context::get('document_srl');
|
$document_srl = Context::get('document_srl');
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
|
$module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl);
|
||||||
|
// Create the document object. If the document module of basic data structures, write it all works .. -_-;
|
||||||
// document 객체를 생성. 기본 데이터 구조의 경우 document모듈만 쓰면 만사 해결.. -_-;
|
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
|
// Creates an object for displaying the selected document
|
||||||
// 선택된 문서 표시를 위한 객체 생성
|
|
||||||
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
|
$oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager);
|
||||||
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
|
if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request');
|
||||||
|
// Check permissions
|
||||||
// 권한 체크
|
|
||||||
if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
|
if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted');
|
||||||
|
// Information setting module
|
||||||
// 모듈 정보 세팅
|
|
||||||
Context::set('module_info', $module_info);
|
Context::set('module_info', $module_info);
|
||||||
|
// Browser title settings
|
||||||
// 브라우저 타이틀 설정
|
|
||||||
Context::setBrowserTitle($oDocument->getTitleText());
|
Context::setBrowserTitle($oDocument->getTitleText());
|
||||||
Context::set('oDocument', $oDocument);
|
Context::set('oDocument', $oDocument);
|
||||||
|
|
||||||
|
|
@ -47,7 +42,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 미리 보기
|
* @brief Preview
|
||||||
**/
|
**/
|
||||||
function dispDocumentPreview() {
|
function dispDocumentPreview() {
|
||||||
Context::set('layout','none');
|
Context::set('layout','none');
|
||||||
|
|
@ -58,12 +53,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 관리자가 선택한 문서에 대한 관리
|
* @brief Selected by the administrator for the document management
|
||||||
**/
|
**/
|
||||||
function dispDocumentManageDocument() {
|
function dispDocumentManageDocument() {
|
||||||
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted');
|
||||||
|
// Taken from a list of selected sessions
|
||||||
// 선택한 목록을 세션에서 가져옴
|
|
||||||
$flag_list = $_SESSION['document_management'];
|
$flag_list = $_SESSION['document_management'];
|
||||||
if(count($flag_list)) {
|
if(count($flag_list)) {
|
||||||
foreach($flag_list as $key => $val) {
|
foreach($flag_list as $key => $val) {
|
||||||
|
|
@ -79,11 +73,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
$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);
|
if(count($module_list)>1) Context::set('module_list', $module_categories);
|
||||||
|
// Select Pop-up layout
|
||||||
// 팝업 레이아웃 선택
|
|
||||||
$this->setLayoutPath('./common/tpl');
|
$this->setLayoutPath('./common/tpl');
|
||||||
$this->setLayoutFile('popup_layout');
|
$this->setLayoutFile('popup_layout');
|
||||||
|
|
||||||
|
|
@ -96,7 +88,7 @@
|
||||||
$current_module_srls = Context::get('module_srls');
|
$current_module_srls = Context::get('module_srls');
|
||||||
|
|
||||||
if(!$current_module_srl && !$current_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_info = Context::get('current_module_info');
|
||||||
$current_module_srl = $current_module_info->module_srl;
|
$current_module_srl = $current_module_info->module_srl;
|
||||||
if(!$current_module_srl) return new Object();
|
if(!$current_module_srl) return new Object();
|
||||||
|
|
|
||||||
|
|
@ -2,18 +2,17 @@
|
||||||
/**
|
/**
|
||||||
* @class emoticon
|
* @class emoticon
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 이모티콘 이미지 연결 컴포넌트
|
* @brief Emoticons image connected components
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class emoticon extends EditorHandler {
|
class emoticon extends EditorHandler {
|
||||||
|
// editor_sequence from the editor must attend mandatory wearing ....
|
||||||
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
|
|
||||||
var $editor_sequence = 0;
|
var $editor_sequence = 0;
|
||||||
var $component_path = '';
|
var $component_path = '';
|
||||||
var $emoticon_path = '';
|
var $emoticon_path = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief editor_sequence과 컴포넌트의 경로를 받음
|
* @brief editor_sequence and components out of the path
|
||||||
**/
|
**/
|
||||||
function emoticon($editor_sequence, $component_path) {
|
function emoticon($editor_sequence, $component_path) {
|
||||||
$this->editor_sequence = $editor_sequence;
|
$this->editor_sequence = $editor_sequence;
|
||||||
|
|
@ -22,7 +21,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 이모티콘 파일 목록을 리턴
|
* @brief Returns a list of emoticons file
|
||||||
**/
|
**/
|
||||||
function getEmoticonList() {
|
function getEmoticonList() {
|
||||||
$emoticon = Context::get('emoticon');
|
$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) {
|
function getEmoticons($path) {
|
||||||
$emoticon_path = sprintf("%s/%s", $this->emoticon_path, $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() {
|
function getPopupContent() {
|
||||||
// 이모티콘 디렉토리 목록을 가져옴
|
// Bringing a list of emoticons directory
|
||||||
$emoticon_dirs = FileHandler::readDir($this->emoticon_path);
|
$emoticon_dirs = FileHandler::readDir($this->emoticon_path);
|
||||||
$emoticon_list = array();
|
$emoticon_list = array();
|
||||||
if($emoticon_dirs) {
|
if($emoticon_dirs) {
|
||||||
|
|
@ -63,12 +62,10 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Context::set('emoticon_list', $emoticon_list);
|
Context::set('emoticon_list', $emoticon_list);
|
||||||
|
// The first emoticon image files in the directory Wanted
|
||||||
// 첫번째 이모티콘 디렉토리의 이미지 파일을 구함
|
|
||||||
$emoticons = $this->getEmoticons($emoticon_list[0]);
|
$emoticons = $this->getEmoticons($emoticon_list[0]);
|
||||||
Context::set('emoticons', $emoticons);
|
Context::set('emoticons', $emoticons);
|
||||||
|
// Pre-compiled source code to compile template return to
|
||||||
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
|
|
||||||
$tpl_path = $this->component_path.'tpl';
|
$tpl_path = $this->component_path.'tpl';
|
||||||
$tpl_file = 'popup.html';
|
$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) {
|
function transHTML($xml_obj) {
|
||||||
$src = $xml_obj->attrs->src;
|
$src = $xml_obj->attrs->src;
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,16 @@
|
||||||
/**
|
/**
|
||||||
* @class image_gallery
|
* @class image_gallery
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 업로드된 이미지로 이미지갤러리를 만듬
|
* @brief Making images uploaded to the image gallery
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class image_gallery extends EditorHandler {
|
class image_gallery extends EditorHandler {
|
||||||
|
// editor_sequence from the editor must attend mandatory wearing ....
|
||||||
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
|
|
||||||
var $editor_sequence = 0;
|
var $editor_sequence = 0;
|
||||||
var $component_path = '';
|
var $component_path = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief editor_sequence과 컴포넌트의 경로를 받음
|
* @brief editor_sequence and components out of the path
|
||||||
**/
|
**/
|
||||||
function image_gallery($editor_sequence, $component_path) {
|
function image_gallery($editor_sequence, $component_path) {
|
||||||
$this->editor_sequence = $editor_sequence;
|
$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() {
|
function getPopupContent() {
|
||||||
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
|
// Pre-compiled source code to compile template return to
|
||||||
$tpl_path = $this->component_path.'tpl';
|
$tpl_path = $this->component_path.'tpl';
|
||||||
$tpl_file = 'popup.html';
|
$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
|
||||||
*
|
*
|
||||||
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
|
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
|
||||||
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
|
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
|
||||||
**/
|
**/
|
||||||
function transHTML($xml_obj) {
|
function transHTML($xml_obj) {
|
||||||
$gallery_info->srl = rand(111111,999999);
|
$gallery_info->srl = rand(111111,999999);
|
||||||
|
|
@ -50,8 +49,7 @@
|
||||||
$images_list = $xml_obj->attrs->images_list;
|
$images_list = $xml_obj->attrs->images_list;
|
||||||
$images_list = preg_replace('/\.(gif|jpg|jpeg|png) /i',".\\1\n",$images_list);
|
$images_list = preg_replace('/\.(gif|jpg|jpeg|png) /i',".\\1\n",$images_list);
|
||||||
$gallery_info->images_list = explode("\n",trim($images_list));
|
$gallery_info->images_list = explode("\n",trim($images_list));
|
||||||
|
// If you set the output to output the XML code generated a list of the image
|
||||||
// 만약 출력설정이 XML일 경우 이미지 목록만 출력하도록 코드 생성
|
|
||||||
if(Context::getResponseMethod() == 'XMLRPC') {
|
if(Context::getResponseMethod() == 'XMLRPC') {
|
||||||
$output = '';
|
$output = '';
|
||||||
for($i=0;$i<count($gallery_info->images_list);$i++) {
|
for($i=0;$i<count($gallery_info->images_list);$i++) {
|
||||||
|
|
@ -59,8 +57,7 @@
|
||||||
}
|
}
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
// HTML gallery output, the output settings via the template for the conversion to generate the html code should
|
||||||
// HTML 출력일 경우 템플릿 변환을 거쳐서 갤러리 출력 설정에 맞는 html코드를 생성하도록 함
|
|
||||||
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
|
preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches);
|
||||||
$gallery_info->width = trim($matches[3][0]);
|
$gallery_info->width = trim($matches[3][0]);
|
||||||
if(!$gallery_info->width) $gallery_info->width = 400;
|
if(!$gallery_info->width) $gallery_info->width = 400;
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,16 @@
|
||||||
/**
|
/**
|
||||||
* @class image_link
|
* @class image_link
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 이미지를 추가하거나 속성을 수정하는 컴포넌트
|
* @brief Add an image, or to modify the properties of components
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class image_link extends EditorHandler {
|
class image_link extends EditorHandler {
|
||||||
|
// editor_sequence from the editor must attend mandatory wearing ....
|
||||||
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
|
|
||||||
var $editor_sequence = 0;
|
var $editor_sequence = 0;
|
||||||
var $component_path = '';
|
var $component_path = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief editor_sequence과 컴포넌트의 경로를 받음
|
* @brief editor_sequence and components out of the path
|
||||||
**/
|
**/
|
||||||
function image_link($editor_sequence, $component_path) {
|
function image_link($editor_sequence, $component_path) {
|
||||||
$this->editor_sequence = $editor_sequence;
|
$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() {
|
function getPopupContent() {
|
||||||
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
|
// Pre-compiled source code to compile template return to
|
||||||
$tpl_path = $this->component_path.'tpl';
|
$tpl_path = $this->component_path.'tpl';
|
||||||
$tpl_file = 'popup.html';
|
$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
|
||||||
*
|
*
|
||||||
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
|
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
|
||||||
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
|
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
|
||||||
**/
|
**/
|
||||||
function transHTML($xml_obj) {
|
function transHTML($xml_obj) {
|
||||||
$src = $xml_obj->attrs->src;
|
$src = $xml_obj->attrs->src;
|
||||||
|
|
@ -60,7 +59,7 @@
|
||||||
$src = str_replace('&amp;', '&', $src);
|
$src = str_replace('&amp;', '&', $src);
|
||||||
|
|
||||||
if(!$alt) $alt = $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);
|
$temp_src = explode('/', $src);
|
||||||
if(substr($src, 0,2)=='./') $src = Context::getRequestUri().substr($src, 2);
|
if(substr($src, 0,2)=='./') $src = Context::getRequestUri().substr($src, 2);
|
||||||
elseif(substr($src , 0, 1)=='/') {
|
elseif(substr($src , 0, 1)=='/') {
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,16 @@
|
||||||
/**
|
/**
|
||||||
* @class multimedia_link
|
* @class multimedia_link
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 본문에 멀티미디어 자료를 연결하는 컴포넌트
|
* @brief The components connected to the body of multimedia data
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class multimedia_link extends EditorHandler {
|
class multimedia_link extends EditorHandler {
|
||||||
|
// editor_sequence from the editor must attend mandatory wearing ....
|
||||||
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
|
|
||||||
var $editor_sequence = 0;
|
var $editor_sequence = 0;
|
||||||
var $component_path = '';
|
var $component_path = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief editor_sequence과 컴포넌트의 경로를 받음
|
* @brief editor_sequence and components out of the path
|
||||||
**/
|
**/
|
||||||
function multimedia_link($editor_sequence, $component_path) {
|
function multimedia_link($editor_sequence, $component_path) {
|
||||||
$this->editor_sequence = $editor_sequence;
|
$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() {
|
function getPopupContent() {
|
||||||
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
|
// Pre-compiled source code to compile template return to
|
||||||
$tpl_path = $this->component_path.'tpl';
|
$tpl_path = $this->component_path.'tpl';
|
||||||
$tpl_file = 'popup.html';
|
$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
|
||||||
*
|
*
|
||||||
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
|
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
|
||||||
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
|
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
|
||||||
**/
|
**/
|
||||||
function transHTML($xml_obj) {
|
function transHTML($xml_obj) {
|
||||||
$src = $xml_obj->attrs->multimedia_src;
|
$src = $xml_obj->attrs->multimedia_src;
|
||||||
|
|
|
||||||
|
|
@ -2,17 +2,16 @@
|
||||||
/**
|
/**
|
||||||
* @class poll_maker
|
* @class poll_maker
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief 에디터에서 url링크하는 기능 제공.
|
* @brief Editor provides the ability to link to the url.
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class poll_maker extends EditorHandler {
|
class poll_maker extends EditorHandler {
|
||||||
|
// editor_sequence from the editor must attend mandatory wearing ....
|
||||||
// editor_sequence 는 에디터에서 필수로 달고 다녀야 함....
|
|
||||||
var $editor_sequence = 0;
|
var $editor_sequence = 0;
|
||||||
var $component_path = '';
|
var $component_path = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief editor_sequence과 컴포넌트의 경로를 받음
|
* @brief editor_sequence and components out of the path
|
||||||
**/
|
**/
|
||||||
function poll_maker($editor_sequence, $component_path) {
|
function poll_maker($editor_sequence, $component_path) {
|
||||||
$this->editor_sequence = $editor_sequence;
|
$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() {
|
function getPopupContent() {
|
||||||
// 설문조사 스킨을 구함
|
// Wanted Skins survey
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$skin_list = $oModuleModel->getSkins("./modules/poll/");
|
$skin_list = $oModuleModel->getSkins("./modules/poll/");
|
||||||
Context::set('skin_list', $skin_list);
|
Context::set('skin_list', $skin_list);
|
||||||
|
// Pre-compiled source code to compile template return to
|
||||||
// 템플릿을 미리 컴파일해서 컴파일된 소스를 return
|
|
||||||
$tpl_path = $this->component_path.'tpl';
|
$tpl_path = $this->component_path.'tpl';
|
||||||
$tpl_file = 'popup.html';
|
$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
|
||||||
*
|
*
|
||||||
* 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서
|
* Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then
|
||||||
* DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경
|
* DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own
|
||||||
**/
|
**/
|
||||||
function transHTML($xml_obj) {
|
function transHTML($xml_obj) {
|
||||||
$poll_srl = $xml_obj->attrs->poll_srl;
|
$poll_srl = $xml_obj->attrs->poll_srl;
|
||||||
|
|
@ -51,8 +49,7 @@
|
||||||
$width = $matches[2];
|
$width = $matches[2];
|
||||||
if(!$width) $width = 400;
|
if(!$width) $width = 400;
|
||||||
$style = sprintf('width:%dpx', $width);
|
$style = sprintf('width:%dpx', $width);
|
||||||
|
// poll model object creation to come get it return html
|
||||||
// poll model 객체 생성해서 html 얻어와서 return
|
|
||||||
$oPollModel = &getModel('poll');
|
$oPollModel = &getModel('poll');
|
||||||
return $oPollModel->getPollHtml($poll_srl, $style, $skin);
|
return $oPollModel->getPollHtml($poll_srl, $style, $skin);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
/**
|
/**
|
||||||
* @class editorAdminController
|
* @class editorAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief editor 모듈의 admin controller class
|
* @brief editor of the module admin controller class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class editorAdminController extends editor {
|
class editorAdminController extends editor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컴포넌트의 활성화
|
* @brief Activate components
|
||||||
**/
|
**/
|
||||||
function procEditorAdminEnableComponent() {
|
function procEditorAdminEnableComponent() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컴포넌트의 비활성화
|
* @brief Deactivate components
|
||||||
**/
|
**/
|
||||||
function procEditorAdminDisableComponent() {
|
function procEditorAdminDisableComponent() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
|
|
@ -52,15 +52,14 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컴포넌트의 위치 변경
|
* @brief Change a location of the component
|
||||||
**/
|
**/
|
||||||
function procEditorAdminMoveListOrder() {
|
function procEditorAdminMoveListOrder() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$args->site_srl = (int)$site_module_info->site_srl;
|
$args->site_srl = (int)$site_module_info->site_srl;
|
||||||
$args->component_name = Context::get('component_name');
|
$args->component_name = Context::get('component_name');
|
||||||
$mode = Context::get('mode');
|
$mode = Context::get('mode');
|
||||||
|
// Get a full list of components from the DB
|
||||||
// DB에서 전체 목록 가져옴
|
|
||||||
if(!$args->site_srl) $output = executeQuery('editor.getComponentList', $args);
|
if(!$args->site_srl) $output = executeQuery('editor.getComponentList', $args);
|
||||||
else $output = executeQuery('editor.getSiteComponentList', $args);
|
else $output = executeQuery('editor.getSiteComponentList', $args);
|
||||||
|
|
||||||
|
|
@ -108,7 +107,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컴포넌트 설정
|
* @brief Set components
|
||||||
**/
|
**/
|
||||||
function procEditorAdminSetupComponent() {
|
function procEditorAdminSetupComponent() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$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) {
|
function insertComponent($component_name, $enabled = false, $site_srl = 0) {
|
||||||
if($enabled) $enabled = 'Y';
|
if($enabled) $enabled = 'Y';
|
||||||
|
|
@ -147,13 +146,11 @@
|
||||||
$args->component_name = $component_name;
|
$args->component_name = $component_name;
|
||||||
$args->enabled = $enabled;
|
$args->enabled = $enabled;
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
|
// Check if the component exists
|
||||||
// 컴포넌트가 있는지 확인
|
|
||||||
if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args);
|
if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args);
|
||||||
else $output = executeQuery('editor.isSiteComponentInserted', $args);
|
else $output = executeQuery('editor.isSiteComponentInserted', $args);
|
||||||
if($output->data->count) return new Object(-1, 'msg_component_is_not_founded');
|
if($output->data->count) return new Object(-1, 'msg_component_is_not_founded');
|
||||||
|
// Inert a component
|
||||||
// 입력
|
|
||||||
$args->list_order = getNextSequence();
|
$args->list_order = getNextSequence();
|
||||||
if(!$site_srl) $output = executeQuery('editor.insertComponent', $args);
|
if(!$site_srl) $output = executeQuery('editor.insertComponent', $args);
|
||||||
else $output = executeQuery('editor.insertSiteComponent', $args);
|
else $output = executeQuery('editor.insertSiteComponent', $args);
|
||||||
|
|
|
||||||
|
|
@ -2,26 +2,25 @@
|
||||||
/**
|
/**
|
||||||
* @class editorAdminView
|
* @class editorAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief editor 모듈의 admin view 클래스
|
* @brief editor admin view of the module class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class editorAdminView extends editor {
|
class editorAdminView extends editor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 관리자 설정 페이지
|
* @brief Administrator Setting page
|
||||||
* 에디터 컴포넌트의 on/off 및 설정을 담당
|
* Settings to enable/disable editor component and other features
|
||||||
**/
|
**/
|
||||||
function dispEditorAdminIndex() {
|
function dispEditorAdminIndex() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$site_srl = (int)$site_module_info->site_srl;
|
$site_srl = (int)$site_module_info->site_srl;
|
||||||
|
// Get a type of component
|
||||||
// 컴포넌트의 종류를 구해옴
|
|
||||||
$oEditorModel = &getModel('editor');
|
$oEditorModel = &getModel('editor');
|
||||||
$component_list = $oEditorModel->getComponentList(false, $site_srl, true);
|
$component_list = $oEditorModel->getComponentList(false, $site_srl, true);
|
||||||
|
|
||||||
|
|
@ -32,33 +31,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컴퍼넌트 setup
|
* @brief Component setup
|
||||||
**/
|
**/
|
||||||
function dispEditorAdminSetupComponent() {
|
function dispEditorAdminSetupComponent() {
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$site_srl = (int)$site_module_info->site_srl;
|
$site_srl = (int)$site_module_info->site_srl;
|
||||||
|
|
||||||
$component_name = Context::get('component_name');
|
$component_name = Context::get('component_name');
|
||||||
|
// Get information of the editor component
|
||||||
// 에디터 컴포넌트의 정보를 구함
|
|
||||||
$oEditorModel = &getModel('editor');
|
$oEditorModel = &getModel('editor');
|
||||||
$component = $oEditorModel->getComponent($component_name,$site_srl);
|
$component = $oEditorModel->getComponent($component_name,$site_srl);
|
||||||
Context::set('component', $component);
|
Context::set('component', $component);
|
||||||
|
// Get a group list to set a group
|
||||||
// 그룹 설정을 위한 그룹 목록을 구함
|
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$group_list = $oMemberModel->getGroups($site_srl);
|
$group_list = $oMemberModel->getGroups($site_srl);
|
||||||
Context::set('group_list', $group_list);
|
Context::set('group_list', $group_list);
|
||||||
|
// Get a mid list
|
||||||
// mid 목록을 가져옴
|
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
$mid_list = $oModuleModel->getMidList($args);
|
$mid_list = $oModuleModel->getMidList($args);
|
||||||
|
// Combination of module_category and module
|
||||||
// module_category와 module의 조합
|
|
||||||
if(!$args->site_srl) {
|
if(!$args->site_srl) {
|
||||||
// 모듈 카테고리 목록을 구함
|
// Get a list of module category
|
||||||
$module_categories = $oModuleModel->getModuleCategories();
|
$module_categories = $oModuleModel->getModuleCategories();
|
||||||
|
|
||||||
if(!is_array($mid_list)) $mid_list = array($mid_list);
|
if(!is_array($mid_list)) $mid_list = array($mid_list);
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,18 @@
|
||||||
/**
|
/**
|
||||||
* @class editor
|
* @class editor
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief editor 모듈의 high class
|
* @brief high class of the editor odule
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class editor extends ModuleObject {
|
class editor extends ModuleObject {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치시 추가 작업이 필요할시 구현
|
* @brief Implement if additional tasks are necessary when installing
|
||||||
**/
|
**/
|
||||||
function moduleInstall() {
|
function moduleInstall() {
|
||||||
// action forward에 등록 (관리자 모드에서 사용하기 위함)
|
// Register action forward (to use in administrator mode)
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
|
// Add the default editor component
|
||||||
// 기본 에디터 컴포넌트를 추가
|
|
||||||
$oEditorController = &getAdminController('editor');
|
$oEditorController = &getAdminController('editor');
|
||||||
$oEditorController->insertComponent('colorpicker_text',true);
|
$oEditorController->insertComponent('colorpicker_text',true);
|
||||||
$oEditorController->insertComponent('colorpicker_bg',true);
|
$oEditorController->insertComponent('colorpicker_bg',true);
|
||||||
|
|
@ -26,83 +25,71 @@
|
||||||
$oEditorController->insertComponent('table_maker',true);
|
$oEditorController->insertComponent('table_maker',true);
|
||||||
$oEditorController->insertComponent('poll_maker',true);
|
$oEditorController->insertComponent('poll_maker',true);
|
||||||
$oEditorController->insertComponent('image_gallery',true);
|
$oEditorController->insertComponent('image_gallery',true);
|
||||||
|
// Create a directory to use in the editor module
|
||||||
// 에디터 모듈에서 사용할 디렉토리 생성
|
|
||||||
FileHandler::makeDir('./files/cache/editor');
|
FileHandler::makeDir('./files/cache/editor');
|
||||||
|
// 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified
|
||||||
// 2007. 10. 17 글의 입력(신규 or 수정)이 일어날때마다 자동 저장된 문서를 삭제하는 trigger 추가
|
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
|
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
|
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
|
||||||
|
// 2007. 10. 23 Add an editor trigger on the module addition setup
|
||||||
// 2007. 10. 23 모듈의 추가 설정에서 에디터 trigger 추가
|
|
||||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
|
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
|
||||||
|
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
|
||||||
// 2009. 04. 14 editor component 변환 코드를 trigger로 독립
|
|
||||||
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
|
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
|
||||||
|
|
||||||
return new Object();
|
return new Object();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 설치가 이상이 없는지 체크하는 method
|
* @brief a method to check if successfully installed
|
||||||
**/
|
**/
|
||||||
function checkUpdate() {
|
function checkUpdate() {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
|
// 2009. 06. 15 Save module_srl when auto-saving
|
||||||
// 2009. 06. 15 자동저장시 module_srl 을 저장
|
|
||||||
if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true;
|
if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true;
|
||||||
if(!$oDB->isIndexExists("editor_autosave","idx_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.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
|
||||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
|
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true;
|
||||||
|
// 2007. 10. 23 Add an editor trigger on the module addition setup
|
||||||
// 2007. 10. 23 모듈의 추가 설정에서 에디터 trigger 추가
|
|
||||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true;
|
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true;
|
||||||
|
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
|
||||||
// 2009. 04. 14 editor component 변환 코드를 trigger로 독립
|
|
||||||
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true;
|
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true;
|
||||||
|
// 2009. 06. 19 Remove unused trigger
|
||||||
// 2009. 06. 19 사용하지 않는 트리거 제거
|
|
||||||
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
|
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 업데이트 실행
|
* @brief Execute update
|
||||||
**/
|
**/
|
||||||
function moduleUpdate() {
|
function moduleUpdate() {
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
|
|
||||||
$oDB = &DB::getInstance();
|
$oDB = &DB::getInstance();
|
||||||
|
// Save module_srl when auto-saving 15/06/2009
|
||||||
// 자동저장시 module_srl 을 저장 2009.6.15
|
|
||||||
if(!$oDB->isColumnExists("editor_autosave","module_srl"))
|
if(!$oDB->isColumnExists("editor_autosave","module_srl"))
|
||||||
$oDB->addColumn("editor_autosave","module_srl","number",11);
|
$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");
|
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'))
|
if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
|
||||||
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
|
$oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
|
||||||
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
|
if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'))
|
||||||
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
|
$oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after');
|
||||||
|
// 2007. 10. Add an editor trigger on the module addition setup
|
||||||
// 2007. 10. 23 모듈의 추가 설정에서 에디터 trigger 추가
|
|
||||||
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'))
|
if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'))
|
||||||
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
|
$oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before');
|
||||||
|
// 2009. 04. 14 Add a trigger from compiled codes of the editor component
|
||||||
// 2009. 04. 14 editor component 변환 코드를 trigger로 독립
|
|
||||||
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'))
|
if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'))
|
||||||
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
|
$oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before');
|
||||||
|
// 2009. 06. 19 Remove unused trigger
|
||||||
// 2009. 06. 19 사용하지 않는 트리거 제거
|
|
||||||
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'))
|
if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'))
|
||||||
$oModuleController->deleteTrigger('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() {
|
function recompileCache() {
|
||||||
// 에디터 컴포넌트 캐시 파일 삭제
|
// Delete the cache file editor component
|
||||||
FileHandler::removeFilesInDir("./files/cache/editor");
|
FileHandler::removeFilesInDir("./files/cache/editor");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,19 @@
|
||||||
/**
|
/**
|
||||||
* @class editor
|
* @class editor
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief editor 모듈의 controller class
|
* @brief editor module's controller class
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class editorController extends editor {
|
class editorController extends editor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 자동 저장
|
* @brief AutoSave
|
||||||
**/
|
**/
|
||||||
function procEditorSaveDoc() {
|
function procEditorSaveDoc() {
|
||||||
|
|
||||||
|
|
@ -29,7 +29,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 자동저장된 문서 삭제
|
* @brief Delete autosaved documents
|
||||||
**/
|
**/
|
||||||
function procEditorRemoveSavedDoc() {
|
function procEditorRemoveSavedDoc() {
|
||||||
$oEditorController = &getController('editor');
|
$oEditorController = &getController('editor');
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컴포넌트에서 ajax요청시 해당 컴포넌트의 method를 실행
|
* @brief Execute a method of the component when the component requests ajax
|
||||||
**/
|
**/
|
||||||
function procEditorCall() {
|
function procEditorCall() {
|
||||||
$component = Context::get('component');
|
$component = Context::get('component');
|
||||||
|
|
@ -67,12 +67,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 에디터의 모듈별 추가 확장 폼을 저장
|
* @brief Save Editor's additional form for each module
|
||||||
**/
|
**/
|
||||||
function procEditorInsertModuleConfig() {
|
function procEditorInsertModuleConfig() {
|
||||||
$module_srl = Context::get('target_module_srl');
|
$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);
|
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
|
||||||
else $module_srl = array($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) {
|
function triggerEditorComponentCompile(&$content) {
|
||||||
if(Context::getResponseMethod()!='HTML') return new Object();
|
if(Context::getResponseMethod()!='HTML') return new Object();
|
||||||
|
|
@ -189,7 +188,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 에디터 컴포넌트코드를 결과물로 변환
|
* @brief Convert editor component codes to be returned
|
||||||
**/
|
**/
|
||||||
function transComponent($content) {
|
function transComponent($content) {
|
||||||
$content = preg_replace_callback('!<div([^\>]*)editor_component=([^\>]*)>(.*?)\<\/div\>!is', array($this,'transEditorComponent'), $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) {
|
function transEditorComponent($matches) {
|
||||||
$script = sprintf(' %s editor_component=%s', $matches[1], $matches[2]);
|
$script = sprintf(' %s editor_component=%s', $matches[1], $matches[2]);
|
||||||
|
|
@ -210,8 +209,7 @@
|
||||||
$xml_obj->body = $matches[3];
|
$xml_obj->body = $matches[3];
|
||||||
|
|
||||||
if(!$xml_obj->attrs->editor_component) return $matches[0];
|
if(!$xml_obj->attrs->editor_component) return $matches[0];
|
||||||
|
// Get converted codes by using component::transHTML()
|
||||||
// component::transHTML() 을 이용하여 변환된 코드를 받음
|
|
||||||
$oEditorModel = &getModel('editor');
|
$oEditorModel = &getModel('editor');
|
||||||
$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
|
$oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0);
|
||||||
if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $matches[0];
|
if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $matches[0];
|
||||||
|
|
@ -221,7 +219,7 @@
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 자동 저장
|
* @brief AutoSave
|
||||||
**/
|
**/
|
||||||
function doSaveDoc($args) {
|
function doSaveDoc($args) {
|
||||||
|
|
||||||
|
|
@ -232,7 +230,7 @@
|
||||||
} else {
|
} else {
|
||||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
// module_srl이 없으면 현재 모듈
|
// Get the current module if module_srl doesn't exist
|
||||||
if(!$args->module_srl) {
|
if(!$args->module_srl) {
|
||||||
$args->module_srl = Context::get('module_srl');
|
$args->module_srl = Context::get('module_srl');
|
||||||
}
|
}
|
||||||
|
|
@ -240,13 +238,12 @@
|
||||||
$current_module_info = Context::get('current_module_info');
|
$current_module_info = Context::get('current_module_info');
|
||||||
$args->module_srl = $current_module_info->module_srl;
|
$args->module_srl = $current_module_info->module_srl;
|
||||||
}
|
}
|
||||||
|
// Save
|
||||||
// 저장
|
|
||||||
return executeQuery('editor.insertSavedDoc', $args);
|
return executeQuery('editor.insertSavedDoc', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 자동 저장글 Srl 로드 - XE 이전 버전 사용자를 위함.
|
* @brief Load the srl of autosaved document - for those who uses XE older versions.
|
||||||
**/
|
**/
|
||||||
function procEditorLoadSavedDocument() {
|
function procEditorLoadSavedDocument() {
|
||||||
$editor_sequence = Context::get('editor_sequence');
|
$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) {
|
function triggerDeleteSavedDoc(&$obj) {
|
||||||
$this->deleteSavedDoc(false);
|
$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) {
|
function deleteSavedDoc($mode = false) {
|
||||||
if(Context::get('is_logged')) {
|
if(Context::get('is_logged')) {
|
||||||
|
|
@ -286,13 +283,12 @@
|
||||||
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
$args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
$args->module_srl = Context::get('module_srl');
|
$args->module_srl = Context::get('module_srl');
|
||||||
// module_srl이 없으면 현재 모듈
|
// Get the current module if module_srl doesn't exist
|
||||||
if(!$args->module_srl) {
|
if(!$args->module_srl) {
|
||||||
$current_module_info = Context::get('current_module_info');
|
$current_module_info = Context::get('current_module_info');
|
||||||
$args->module_srl = $current_module_info->module_srl;
|
$args->module_srl = $current_module_info->module_srl;
|
||||||
}
|
}
|
||||||
|
// Check if the auto-saved document already exists
|
||||||
// 자동저장된 값이 혹시 이미 등록된 글인지 확인
|
|
||||||
$output = executeQuery('editor.getSavedDocument', $args);
|
$output = executeQuery('editor.getSavedDocument', $args);
|
||||||
$saved_doc = $output->data;
|
$saved_doc = $output->data;
|
||||||
if(!$saved_doc) return;
|
if(!$saved_doc) return;
|
||||||
|
|
@ -305,13 +301,12 @@
|
||||||
$output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc);
|
$output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Delete the saved document
|
||||||
// 일단 이전 저장본 삭제
|
|
||||||
return executeQuery('editor.deleteSavedDoc', $args);
|
return executeQuery('editor.deleteSavedDoc', $args);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 가상 사이트에서 사용된 에디터 컴포넌트 정보를 제거
|
* @brief ERemove editor component information used on the virtual site
|
||||||
**/
|
**/
|
||||||
function removeEditorConfig($site_srl) {
|
function removeEditorConfig($site_srl) {
|
||||||
$args->site_srl = $site_srl;
|
$args->site_srl = $site_srl;
|
||||||
|
|
@ -319,8 +314,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 에디터 컴포넌트 목록 캐싱 (editorModel::getComponentList)
|
* @brief Caching a list of editor component (editorModel::getComponentList)
|
||||||
* 에디터 컴포넌트 목록의 경우 DB query + Xml Parsing 때문에 캐싱 파일을 이용하도록 함
|
* For the editor component list, use a caching file because of DB query and Xml parsing
|
||||||
**/
|
**/
|
||||||
function makeCache($filter_enabled = true, $site_srl) {
|
function makeCache($filter_enabled = true, $site_srl) {
|
||||||
$oEditorModel = &getModel('editor');
|
$oEditorModel = &getModel('editor');
|
||||||
|
|
@ -332,11 +327,9 @@
|
||||||
$output = executeQuery('editor.getSiteComponentList', $args);
|
$output = executeQuery('editor.getSiteComponentList', $args);
|
||||||
} else $output = executeQuery('editor.getComponentList', $args);
|
} else $output = executeQuery('editor.getComponentList', $args);
|
||||||
$db_list = $output->data;
|
$db_list = $output->data;
|
||||||
|
// Get a list of files
|
||||||
// 파일목록을 구함
|
|
||||||
$downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components');
|
$downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components');
|
||||||
|
// Get information about log-in status and its group
|
||||||
// 로그인 여부 및 소속 그룹 구함
|
|
||||||
$is_logged = Context::get('is_logged');
|
$is_logged = Context::get('is_logged');
|
||||||
if($is_logged) {
|
if($is_logged) {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
|
|
@ -344,8 +337,7 @@
|
||||||
$group_list = array_keys($logged_info->group_list);
|
$group_list = array_keys($logged_info->group_list);
|
||||||
} else $group_list = array();
|
} else $group_list = array();
|
||||||
}
|
}
|
||||||
|
// Get xml information for looping DB list
|
||||||
// DB 목록을 loop돌면서 xml정보까지 구함
|
|
||||||
if(!is_array($db_list)) $db_list = array($db_list);
|
if(!is_array($db_list)) $db_list = array($db_list);
|
||||||
foreach($db_list as $component) {
|
foreach($db_list as $component) {
|
||||||
if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
|
if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue;
|
||||||
|
|
@ -370,12 +362,11 @@
|
||||||
$xml_info->mid_list = $extra_vars->mid_list;
|
$xml_info->mid_list = $extra_vars->mid_list;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
// 사용권한이 있으면 권한 체크
|
// Permisshin check if you are granted
|
||||||
if($extra_vars->target_group) {
|
if($extra_vars->target_group) {
|
||||||
// 사용권한이 체크되어 있는데 로그인이 되어 있지 않으면 무조건 사용 중지
|
// Stop using if not logged-in
|
||||||
if(!$is_logged) continue;
|
if(!$is_logged) continue;
|
||||||
|
// Compare a target group with the current logged-in user group
|
||||||
// 대상 그룹을 구해서 현재 로그인 사용자의 그룹과 비교
|
|
||||||
$target_group = $extra_vars->target_group;
|
$target_group = $extra_vars->target_group;
|
||||||
unset($extra_vars->target_group);
|
unset($extra_vars->target_group);
|
||||||
|
|
||||||
|
|
@ -388,13 +379,11 @@
|
||||||
}
|
}
|
||||||
if(!$is_granted) continue;
|
if(!$is_granted) continue;
|
||||||
}
|
}
|
||||||
|
// Check if the target module exists
|
||||||
// 대상 모듈이 있으면 체크
|
|
||||||
if($extra_vars->mid_list && count($extra_vars->mid_list) && Context::get('mid')) {
|
if($extra_vars->mid_list && count($extra_vars->mid_list) && Context::get('mid')) {
|
||||||
if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue;
|
if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue;
|
||||||
}*/
|
}*/
|
||||||
|
// Check the configuration of the editor component
|
||||||
// 에디터 컴포넌트의 설정 정보를 체크
|
|
||||||
if($xml_info->extra_vars) {
|
if($xml_info->extra_vars) {
|
||||||
foreach($xml_info->extra_vars as $key => $val) {
|
foreach($xml_info->extra_vars as $key => $val) {
|
||||||
$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
|
$xml_info->extra_vars->{$key}->value = $extra_vars->{$key};
|
||||||
|
|
@ -403,34 +392,28 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
$component_list->{$component_name} = $xml_info;
|
$component_list->{$component_name} = $xml_info;
|
||||||
|
// Get buttons, icons, images
|
||||||
// 버튼, 아이콘 이미지 구함
|
|
||||||
$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
|
$icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif';
|
||||||
$component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_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($icon_file)) $component_list->{$component_name}->icon = true;
|
||||||
if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
|
if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true;
|
||||||
}
|
}
|
||||||
|
// Return if it checks enabled only
|
||||||
// enabled만 체크하도록 하였으면 그냥 return
|
|
||||||
if($filter_enabled) {
|
if($filter_enabled) {
|
||||||
$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
|
$cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl);
|
||||||
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
|
$buff = sprintf('<?php if(!defined("__ZBXE__")) exit(); $component_list = unserialize("%s"); ?>', str_replace('"','\\"',serialize($component_list)));
|
||||||
FileHandler::writeFile($cache_file, $buff);
|
FileHandler::writeFile($cache_file, $buff);
|
||||||
return $component_list;
|
return $component_list;
|
||||||
}
|
}
|
||||||
|
// Get xml_info of downloaded list
|
||||||
// 다운로드된 목록의 xml_info를 마저 구함
|
|
||||||
foreach($downloaded_list as $component_name) {
|
foreach($downloaded_list as $component_name) {
|
||||||
if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
|
if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue;
|
||||||
|
// Pass if configured
|
||||||
// 설정된 것이라면 패스
|
|
||||||
if($component_list->{$component_name}) continue;
|
if($component_list->{$component_name}) continue;
|
||||||
|
// Insert data into the DB
|
||||||
// DB에 입력
|
|
||||||
$oEditorController = &getAdminController('editor');
|
$oEditorController = &getAdminController('editor');
|
||||||
$oEditorController->insertComponent($component_name, false, $site_srl);
|
$oEditorController->insertComponent($component_name, false, $site_srl);
|
||||||
|
// Add to component_list
|
||||||
// component_list에 추가
|
|
||||||
unset($xml_info);
|
unset($xml_info);
|
||||||
$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
|
$xml_info = $oEditorModel->getComponentXmlInfo($component_name);
|
||||||
$xml_info->enabled = 'N';
|
$xml_info->enabled = 'N';
|
||||||
|
|
@ -446,7 +429,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 캐시 파일 삭제
|
* @brief Delete cache files
|
||||||
**/
|
**/
|
||||||
function removeCache($site_srl = 0) {
|
function removeCache($site_srl = 0) {
|
||||||
$oEditorModel = &getModel('editor');
|
$oEditorModel = &getModel('editor');
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
/**
|
/**
|
||||||
* @class editorModel
|
* @class editorModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief editor 모듈의 model 클래스
|
* @brief model class of the editor odule
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class editorModel extends editor {
|
class editorModel extends editor {
|
||||||
|
|
@ -10,21 +10,21 @@
|
||||||
var $loaded_component_list = array();
|
var $loaded_component_list = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 에디터를 return
|
* @brief Return the editor
|
||||||
*
|
*
|
||||||
* 에디터의 경우 내부적으로 1~30까지의 임시 editor_seuqnece를 생성한다.
|
* Editor internally generates editor_sequence from 1 to 30 for temporary use.
|
||||||
* 즉 한페이지에 30개 이상의 에디터를 출력하지는 못하도록 제한되어 있다.
|
* That means there is a limitation that more than 30 editors cannot be displayed on a single page.
|
||||||
*
|
*
|
||||||
* 단, 수정하는 경우 또는 파일업로드를 한 자동저장본의 경우는 getNextSequence() 값으로 저장된 editor_seqnece가
|
* However, editor_sequence can be value from getNextSequence() in case of the modified or the auto-saved for file upload
|
||||||
* 설정된다.
|
*
|
||||||
**/
|
**/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모듈별 에디터 설정을 return
|
* @brief Return editor setting for each module
|
||||||
**/
|
**/
|
||||||
function getEditorConfig($module_srl) {
|
function getEditorConfig($module_srl) {
|
||||||
if(!$GLOBALS['__editor_module_config__'][$module_srl]) {
|
if(!$GLOBALS['__editor_module_config__'][$module_srl]) {
|
||||||
// 선택된 모듈의 trackback설정을 가져옴
|
// Get trackback settings of the selected module
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
$GLOBALS['__editor_module_config__'][$module_srl] = $oModuleModel->getModulePartConfig('editor', $module_srl);
|
$GLOBALS['__editor_module_config__'][$module_srl] = $oModuleModel->getModulePartConfig('editor', $module_srl);
|
||||||
}
|
}
|
||||||
|
|
@ -75,20 +75,17 @@
|
||||||
|
|
||||||
function getDrComponentXmlInfo($drComponentName){
|
function getDrComponentXmlInfo($drComponentName){
|
||||||
$lang_type = Context::getLangType();
|
$lang_type = Context::getLangType();
|
||||||
|
// Get the xml file path of requested component
|
||||||
// 요청된 컴포넌트의 xml파일 위치를 구함
|
|
||||||
$component_path = sprintf('%s/skins/dreditor/drcomponents/%s/', $this->module_path, $drComponentName);
|
$component_path = sprintf('%s/skins/dreditor/drcomponents/%s/', $this->module_path, $drComponentName);
|
||||||
|
|
||||||
$xml_file = sprintf('%sinfo.xml', $component_path);
|
$xml_file = sprintf('%sinfo.xml', $component_path);
|
||||||
$cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type);
|
$cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type);
|
||||||
|
// Return information after including it after cached xml file exists
|
||||||
// 캐시된 xml파일이 있으면 include 후 정보 return
|
|
||||||
if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) {
|
if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) {
|
||||||
include($cache_file);
|
include($cache_file);
|
||||||
return $xml_info;
|
return $xml_info;
|
||||||
}
|
}
|
||||||
|
// Return after parsing and caching if the cached file does not exist
|
||||||
// 캐시된 파일이 없으면 파싱후 캐싱 후 return
|
|
||||||
$oParser = new XmlParser();
|
$oParser = new XmlParser();
|
||||||
$xml_doc = $oParser->loadXmlFile($xml_file);
|
$xml_doc = $oParser->loadXmlFile($xml_file);
|
||||||
|
|
||||||
|
|
@ -111,7 +108,7 @@
|
||||||
$buff .= sprintf('$xml_info->license = "%s";', $component_info->license);
|
$buff .= sprintf('$xml_info->license = "%s";', $component_info->license);
|
||||||
$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
|
$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;
|
if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
|
||||||
else $author_list = $xml_doc->component->author;
|
else $author_list = $xml_doc->component->author;
|
||||||
|
|
||||||
|
|
@ -154,8 +151,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// List extra variables (text type only in the editor component)
|
||||||
// 추가 변수 정리 (에디터 컴포넌트에서는 text형만 가능)
|
|
||||||
$extra_vars = $xml_doc->component->extra_vars->var;
|
$extra_vars = $xml_doc->component->extra_vars->var;
|
||||||
if($extra_vars) {
|
if($extra_vars) {
|
||||||
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
|
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
|
||||||
|
|
@ -182,48 +178,40 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 에디터 template을 return
|
* @brief Return the editor template
|
||||||
* upload_target_srl은 글의 수정시 호출하면 됨.
|
* You can call upload_target_srl when modifying content
|
||||||
* 이 upload_target_srl은 첨부파일의 유무를 체크하기 위한 루틴을 구현하는데 사용됨.
|
* The upload_target_srl is used for a routine to check if an attachment exists
|
||||||
**/
|
**/
|
||||||
function getEditor($upload_target_srl = 0, $option = null) {
|
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;
|
if(!$option->allow_fileupload) $allow_fileupload = false;
|
||||||
else $allow_fileupload = true;
|
else $allow_fileupload = true;
|
||||||
|
// content_style setting
|
||||||
// content_style 세팅
|
|
||||||
if(!$option->content_style) $option->content_style = 'default';
|
if(!$option->content_style) $option->content_style = 'default';
|
||||||
Context::set('content_style', $option->content_style);
|
Context::set('content_style', $option->content_style);
|
||||||
|
// Default font setting
|
||||||
// 기본 글꼴 지정
|
|
||||||
Context::set('content_font', $option->content_font);
|
Context::set('content_font', $option->content_font);
|
||||||
Context::set('content_font_size', $option->content_font_size);
|
Context::set('content_font_size', $option->content_font_size);
|
||||||
|
// Option setting to allow auto-save
|
||||||
// 자동 저장 유무 옵션 설정 글 수정시는 사용 안함
|
|
||||||
if(!$option->enable_autosave) $enable_autosave = false;
|
if(!$option->enable_autosave) $enable_autosave = false;
|
||||||
elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
|
elseif(Context::get($option->primary_key_name)) $enable_autosave = false;
|
||||||
else $enable_autosave = true;
|
else $enable_autosave = true;
|
||||||
|
// Option setting to allow the default editor component
|
||||||
// 기본 에디터 컴포넌트 사용 설정
|
|
||||||
if(!$option->enable_default_component) $enable_default_component = false;
|
if(!$option->enable_default_component) $enable_default_component = false;
|
||||||
else $enable_default_component = true;
|
else $enable_default_component = true;
|
||||||
|
// Option setting to allow other extended components
|
||||||
// 확장 컴포넌트 사용 설정
|
|
||||||
if(!$option->enable_component) $enable_component = false;
|
if(!$option->enable_component) $enable_component = false;
|
||||||
else $enable_component = true;
|
else $enable_component = true;
|
||||||
|
// Setting for html-mode
|
||||||
// html 모드 조절
|
|
||||||
if($option->disable_html) $html_mode = false;
|
if($option->disable_html) $html_mode = false;
|
||||||
else $html_mode = true;
|
else $html_mode = true;
|
||||||
|
// Set Height
|
||||||
// 높이 설정
|
|
||||||
if(!$option->height) $editor_height = 400;
|
if(!$option->height) $editor_height = 400;
|
||||||
else $editor_height = $option->height;
|
else $editor_height = $option->height;
|
||||||
|
// Skin Setting
|
||||||
// 스킨 설정
|
|
||||||
$skin = $option->skin;
|
$skin = $option->skin;
|
||||||
if(!$skin) $skin = 'xpresseditor';
|
if(!$skin) $skin = 'xpresseditor';
|
||||||
|
|
||||||
|
|
@ -236,19 +224,18 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 자동백업 기능 체크 (글 수정일 경우는 사용하지 않음)
|
* Check the automatic backup feature (do not use if the post is edited)
|
||||||
**/
|
**/
|
||||||
if($enable_autosave) {
|
if($enable_autosave) {
|
||||||
// 자동 저장된 데이터를 추출
|
// Extract auto-saved data
|
||||||
$saved_doc = $this->getSavedDoc($upload_target_srl);
|
$saved_doc = $this->getSavedDoc($upload_target_srl);
|
||||||
|
// Context setting auto-saved data
|
||||||
// 자동 저장 데이터를 context setting
|
|
||||||
Context::set('saved_doc', $saved_doc);
|
Context::set('saved_doc', $saved_doc);
|
||||||
}
|
}
|
||||||
Context::set('enable_autosave', $enable_autosave);
|
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;
|
if($option->editor_sequence) $editor_sequence = $option->editor_sequence;
|
||||||
else {
|
else {
|
||||||
|
|
@ -257,50 +244,42 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 업로드 활성화시 내부적으로 file 모듈의 환경설정을 이용하여 설정
|
* Upload setting by using configuration of the file module internally
|
||||||
**/
|
**/
|
||||||
$files_count = 0;
|
$files_count = 0;
|
||||||
if($allow_fileupload) {
|
if($allow_fileupload) {
|
||||||
$oFileModel = &getModel('file');
|
$oFileModel = &getModel('file');
|
||||||
|
// Get upload configuration to set on SWFUploader
|
||||||
// SWFUploader에 세팅할 업로드 설정 구함
|
|
||||||
$file_config = $oFileModel->getUploadConfig();
|
$file_config = $oFileModel->getUploadConfig();
|
||||||
$file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024;
|
$file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024;
|
||||||
$file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024;
|
$file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024;
|
||||||
|
|
||||||
Context::set('file_config',$file_config);
|
Context::set('file_config',$file_config);
|
||||||
|
// Configure upload status such as file size
|
||||||
// 업로드 가능 용량등에 대한 정보를 세팅
|
|
||||||
$upload_status = $oFileModel->getUploadStatus();
|
$upload_status = $oFileModel->getUploadStatus();
|
||||||
Context::set('upload_status', $upload_status);
|
Context::set('upload_status', $upload_status);
|
||||||
|
// Upload enabled (internally caching)
|
||||||
// upload가능하다고 설정 (내부적으로 캐싱하여 처리)
|
|
||||||
$oFileController = &getController('file');
|
$oFileController = &getController('file');
|
||||||
$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
|
$oFileController->setUploadInfo($editor_sequence, $upload_target_srl);
|
||||||
|
// Check if the file already exists
|
||||||
// 이미 등록된 파일이 있는지 검사
|
|
||||||
if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
|
if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl);
|
||||||
}
|
}
|
||||||
Context::set('files_count', (int)$files_count);
|
Context::set('files_count', (int)$files_count);
|
||||||
|
|
||||||
Context::set('allow_fileupload', $allow_fileupload);
|
Context::set('allow_fileupload', $allow_fileupload);
|
||||||
|
// Set editor_sequence value
|
||||||
// 에디터 동작을 위한 editor_sequence값 설정
|
|
||||||
Context::set('editor_sequence', $editor_sequence);
|
Context::set('editor_sequence', $editor_sequence);
|
||||||
|
// Set the document number to upload_target_srl for file attachments
|
||||||
// 파일 첨부 관련 행동을 하기 위해 문서 번호를 upload_target_srl로 설정
|
// If a new document, upload_target_srl = 0. The value becomes changed when file attachment is requested
|
||||||
// 신규문서일 경우 upload_target_srl=0 이고 첨부파일 관련 동작이 요청될때 이 값이 변경됨
|
|
||||||
Context::set('upload_target_srl', $upload_target_srl);
|
Context::set('upload_target_srl', $upload_target_srl);
|
||||||
|
// Set the primary key valueof the document or comments
|
||||||
// 문서 혹은 댓글의 primary key값을 세팅한다.
|
|
||||||
Context::set('editor_primary_key_name', $option->primary_key_name);
|
Context::set('editor_primary_key_name', $option->primary_key_name);
|
||||||
|
// Set content column name to sync contents
|
||||||
// 내용을 sync 맞추기 위한 content column name을 세팅한다
|
|
||||||
Context::set('editor_content_key_name', $option->content_key_name);
|
Context::set('editor_content_key_name', $option->content_key_name);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 에디터 컴포넌트 체크
|
* Check editor component
|
||||||
**/
|
**/
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$site_srl = (int)$site_module_info->site_srl;
|
$site_srl = (int)$site_module_info->site_srl;
|
||||||
|
|
@ -314,20 +293,19 @@
|
||||||
Context::set('enable_default_component', $enable_default_component);
|
Context::set('enable_default_component', $enable_default_component);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* html_mode 가능한지 변수 설정
|
* Variable setting if html_mode is available
|
||||||
**/
|
**/
|
||||||
Context::set('html_mode', $html_mode);
|
Context::set('html_mode', $html_mode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 에디터 세로 크기 설정
|
* Set a height of editor
|
||||||
**/
|
**/
|
||||||
Context::set('editor_height', $editor_height);
|
Context::set('editor_height', $editor_height);
|
||||||
|
// Check an option whether to start the editor manually
|
||||||
// 에디터의 초기화를 수동으로하는 것에 대한 값 체크
|
|
||||||
Context::set('editor_manual_start', $option->manual_start);
|
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_path = sprintf('%sskins/%s/', $this->module_path, $skin);
|
||||||
$tpl_file = 'editor.html';
|
$tpl_file = 'editor.html';
|
||||||
|
|
@ -340,24 +318,22 @@
|
||||||
|
|
||||||
// load editor skin lang
|
// load editor skin lang
|
||||||
Context::loadLang($tpl_path.'lang');
|
Context::loadLang($tpl_path.'lang');
|
||||||
|
// Return the compiled result from tpl file
|
||||||
// tpl 파일을 compile한 결과를 return
|
|
||||||
$oTemplate = new TemplateHandler();
|
$oTemplate = new TemplateHandler();
|
||||||
return $oTemplate->compile($tpl_path, $tpl_file);
|
return $oTemplate->compile($tpl_path, $tpl_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모듈별 설정이 반영된 에디터 template을 return
|
* @brief Return editor template which contains settings of each module
|
||||||
* getEditor() 와 동일한 결과물을 return하지만 getModuleEditor()는 각 모듈별 추가 설정을 통해 직접 제어되는 설정을 이용하여 에디터를 생성함
|
* Result of getModuleEditor() is as same as getEditor(). But getModuleEditor()uses additional settings of each module to generate an editor
|
||||||
*
|
*
|
||||||
* document/ comment 2가지 종류를 이용함.
|
* 2 types of editors supported; document and comment.
|
||||||
* 굳이 나눈 이유는 하나의 모듈에서 2개 종류의 에디터 사용을 위해서인데 게시판이나 블로그등 원글과 그에 연관된 글(댓글)을 위한 용도임.
|
* 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) {
|
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);
|
$editor_config = $this->getEditorConfig($module_srl);
|
||||||
|
// Configurations listed according to a type
|
||||||
// type에 따른 설정 정리
|
|
||||||
if($type == 'document') {
|
if($type == 'document') {
|
||||||
$config->editor_skin = $editor_config->editor_skin;
|
$config->editor_skin = $editor_config->editor_skin;
|
||||||
$config->content_style = $editor_config->content_style;
|
$config->content_style = $editor_config->content_style;
|
||||||
|
|
@ -383,23 +359,20 @@
|
||||||
$config->editor_height = $editor_config->comment_editor_height;
|
$config->editor_height = $editor_config->comment_editor_height;
|
||||||
$config->enable_autosave = 'N';
|
$config->enable_autosave = 'N';
|
||||||
}
|
}
|
||||||
|
// Check a group_list of the currently logged-in user for permission check
|
||||||
// 권한 체크를 위한 현재 로그인 사용자의 그룹 설정 체크
|
|
||||||
if(Context::get('is_logged')) {
|
if(Context::get('is_logged')) {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$group_list = $logged_info->group_list;
|
$group_list = $logged_info->group_list;
|
||||||
} else {
|
} else {
|
||||||
$group_list = array();
|
$group_list = array();
|
||||||
}
|
}
|
||||||
|
// Pre-set option variables of editor
|
||||||
// 에디터 옵션 변수를 미리 설정
|
|
||||||
$option->skin = $config->editor_skin;
|
$option->skin = $config->editor_skin;
|
||||||
$option->content_style = $config->content_style;
|
$option->content_style = $config->content_style;
|
||||||
$option->content_font = $config->content_font;
|
$option->content_font = $config->content_font;
|
||||||
$option->content_font_size = $config->content_font_size;
|
$option->content_font_size = $config->content_font_size;
|
||||||
$option->colorset = $config->sel_editor_colorset;
|
$option->colorset = $config->sel_editor_colorset;
|
||||||
|
// Permission check for file upload
|
||||||
// 파일 업로드 권한 체크
|
|
||||||
$option->allow_fileupload = false;
|
$option->allow_fileupload = false;
|
||||||
if(count($config->upload_file_grant)) {
|
if(count($config->upload_file_grant)) {
|
||||||
foreach($group_list as $group_srl => $group_info) {
|
foreach($group_list as $group_srl => $group_info) {
|
||||||
|
|
@ -409,8 +382,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else $option->allow_fileupload = true;
|
} else $option->allow_fileupload = true;
|
||||||
|
// Permission check for using default components
|
||||||
// 기본 컴포넌트 사용 권한
|
|
||||||
$option->enable_default_component = false;
|
$option->enable_default_component = false;
|
||||||
if(count($config->enable_default_component_grant)) {
|
if(count($config->enable_default_component_grant)) {
|
||||||
foreach($group_list as $group_srl => $group_info) {
|
foreach($group_list as $group_srl => $group_info) {
|
||||||
|
|
@ -420,8 +392,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else $option->enable_default_component = true;
|
} else $option->enable_default_component = true;
|
||||||
|
// Permisshion check for using extended components
|
||||||
// 확장 컴포넌트 사용 권한
|
|
||||||
$option->enable_component = false;
|
$option->enable_component = false;
|
||||||
if(count($config->enable_component_grant)) {
|
if(count($config->enable_component_grant)) {
|
||||||
foreach($group_list as $group_srl => $group_info) {
|
foreach($group_list as $group_srl => $group_info) {
|
||||||
|
|
@ -431,8 +402,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else $option->enable_component = true;
|
} else $option->enable_component = true;
|
||||||
|
// HTML editing privileges
|
||||||
// HTML 편집 권한
|
|
||||||
$enable_html = false;
|
$enable_html = false;
|
||||||
if(count($config->enable_html_grant)) {
|
if(count($config->enable_html_grant)) {
|
||||||
foreach($group_list as $group_srl => $group_info) {
|
foreach($group_list as $group_srl => $group_info) {
|
||||||
|
|
@ -445,14 +415,11 @@
|
||||||
|
|
||||||
if($enable_html) $option->disable_html = false;
|
if($enable_html) $option->disable_html = false;
|
||||||
else $option->disable_html = true;
|
else $option->disable_html = true;
|
||||||
|
// Set Height
|
||||||
// 높이 설정
|
|
||||||
$option->height = $config->editor_height;
|
$option->height = $config->editor_height;
|
||||||
|
// Set an option for Auto-save
|
||||||
// 자동 저장 유무 옵션 설정
|
|
||||||
$option->enable_autosave = $config->enable_autosave=='Y'?true:false;
|
$option->enable_autosave = $config->enable_autosave=='Y'?true:false;
|
||||||
|
// Other settings
|
||||||
// 기타 설정
|
|
||||||
$option->primary_key_name = $primary_key_name;
|
$option->primary_key_name = $primary_key_name;
|
||||||
$option->content_key_name = $content_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) {
|
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')) {
|
if(Context::get('is_logged')) {
|
||||||
$logged_info = Context::get('logged_info');
|
$logged_info = Context::get('logged_info');
|
||||||
$auto_save_args->member_srl = $logged_info->member_srl;
|
$auto_save_args->member_srl = $logged_info->member_srl;
|
||||||
|
|
@ -471,34 +438,29 @@
|
||||||
$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
$auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
$auto_save_args->module_srl = Context::get('module_srl');
|
$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) {
|
if(!$auto_save_args->module_srl) {
|
||||||
$current_module_info = Context::get('current_module_info');
|
$current_module_info = Context::get('current_module_info');
|
||||||
$auto_save_args->module_srl = $current_module_info->module_srl;
|
$auto_save_args->module_srl = $current_module_info->module_srl;
|
||||||
}
|
}
|
||||||
|
// Extract auto-saved data from the DB
|
||||||
// DB에서 자동저장 데이터 추출
|
|
||||||
$output = executeQuery('editor.getSavedDocument', $auto_save_args);
|
$output = executeQuery('editor.getSavedDocument', $auto_save_args);
|
||||||
$saved_doc = $output->data;
|
$saved_doc = $output->data;
|
||||||
|
// Return null if no result is auto-saved
|
||||||
// 자동저장한 결과가 없으면 null값 return
|
|
||||||
if(!$saved_doc) return;
|
if(!$saved_doc) return;
|
||||||
|
// Check if the auto-saved document already exists
|
||||||
// 자동저장된 값이 혹시 이미 등록된 글인지 확인
|
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
|
$oSaved = $oDocumentModel->getDocument($saved_doc->document_srl);
|
||||||
if($oSaved->isExists()) return;
|
if($oSaved->isExists()) return;
|
||||||
|
// Move all the files if the auto-saved data contains document_srl and file
|
||||||
// 자동저장 데이터에 문서번호가 있고 이 번호에 파일이 있다면 파일을 모두 이동하고
|
// Then set document_srl to editor_sequence
|
||||||
// 해당 문서 번호를 editor_sequence로 세팅함
|
|
||||||
if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) {
|
if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) {
|
||||||
$saved_doc->module_srl = $auto_save_args->module_srl;
|
$saved_doc->module_srl = $auto_save_args->module_srl;
|
||||||
$oFileController = &getController('file');
|
$oFileController = &getController('file');
|
||||||
$oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl);
|
$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;
|
else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl;
|
||||||
|
// Change auto-saved data
|
||||||
// 자동 저장 데이터 변경
|
|
||||||
$oEditorController = &getController('editor');
|
$oEditorController = &getController('editor');
|
||||||
$oEditorController->deleteSavedDoc(false);
|
$oEditorController->deleteSavedDoc(false);
|
||||||
$oEditorController->doSaveDoc($saved_doc);
|
$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) {
|
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(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return;
|
||||||
|
|
||||||
if(!$this->loaded_component_list[$component][$editor_sequence]) {
|
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_path = sprintf('%scomponents/%s/', $this->module_path, $component);
|
||||||
$class_file = sprintf('%s%s.class.php', $class_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));
|
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);
|
require_once($class_file);
|
||||||
$tmp_fn = create_function('$seq,$path', "return new {$component}(\$seq,\$path);");
|
$tmp_fn = create_function('$seq,$path', "return new {$component}(\$seq,\$path);");
|
||||||
$oComponent = $tmp_fn($editor_sequence, $class_path);
|
$oComponent = $tmp_fn($editor_sequence, $class_path);
|
||||||
if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component));
|
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);
|
$component_info = $this->getComponent($component, $site_srl);
|
||||||
$oComponent->setInfo($component_info);
|
$oComponent->setInfo($component_info);
|
||||||
$this->loaded_component_list[$component][$editor_sequence] = $oComponent;
|
$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() {
|
function getEditorSkinList() {
|
||||||
return FileHandler::readDir('./modules/editor/skins');
|
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) {
|
function getCacheFile($filter_enabled= true, $site_srl = 0) {
|
||||||
$lang = Context::getLangType();
|
$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) {
|
function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false) {
|
||||||
$cache_file = $this->getCacheFile(false, $site_srl);
|
$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) {
|
function getComponent($component_name, $site_srl = 0) {
|
||||||
$args->component_name = $component_name;
|
$args->component_name = $component_name;
|
||||||
|
|
@ -667,28 +627,24 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief component의 xml정보를 읽음
|
* @brief Read xml information of the component
|
||||||
**/
|
**/
|
||||||
function getComponentXmlInfo($component) {
|
function getComponentXmlInfo($component) {
|
||||||
$lang_type = Context::getLangType();
|
$lang_type = Context::getLangType();
|
||||||
|
// Get xml file path of the requested components
|
||||||
// 요청된 컴포넌트의 xml파일 위치를 구함
|
|
||||||
$component_path = sprintf('%s/components/%s/', $this->module_path, $component);
|
$component_path = sprintf('%s/components/%s/', $this->module_path, $component);
|
||||||
|
|
||||||
$xml_file = sprintf('%sinfo.xml', $component_path);
|
$xml_file = sprintf('%sinfo.xml', $component_path);
|
||||||
$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
|
$cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type);
|
||||||
|
// Include and return xml file information if cached file exists
|
||||||
// 캐시된 xml파일이 있으면 include 후 정보 return
|
|
||||||
if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) {
|
if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) {
|
||||||
include($cache_file);
|
include($cache_file);
|
||||||
return $xml_info;
|
return $xml_info;
|
||||||
}
|
}
|
||||||
|
// Parse, cache and then return if the cached file doesn't exist
|
||||||
// 캐시된 파일이 없으면 파싱후 캐싱 후 return
|
|
||||||
$oParser = new XmlParser();
|
$oParser = new XmlParser();
|
||||||
$xml_doc = $oParser->loadXmlFile($xml_file);
|
$xml_doc = $oParser->loadXmlFile($xml_file);
|
||||||
|
// Component information listed
|
||||||
// 정보 정리
|
|
||||||
if($xml_doc->component->version && $xml_doc->component->attrs->version == '0.2') {
|
if($xml_doc->component->version && $xml_doc->component->attrs->version == '0.2') {
|
||||||
$component_info->component_name = $component;
|
$component_info->component_name = $component;
|
||||||
$component_info->title = $xml_doc->component->title->body;
|
$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->homepage = "%s";', $component_info->homepage);
|
||||||
$buff .= sprintf('$xml_info->license = "%s";', $component_info->license);
|
$buff .= sprintf('$xml_info->license = "%s";', $component_info->license);
|
||||||
$buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link);
|
$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;
|
if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author;
|
||||||
else $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]->email_address = "%s";', $xml_info->author->email_address);
|
||||||
$buff .= sprintf('$xml_info->author[0]->homepage = "%s";', $xml_info->author->homepage);
|
$buff .= sprintf('$xml_info->author[0]->homepage = "%s";', $xml_info->author->homepage);
|
||||||
}
|
}
|
||||||
|
// List extra variables (text type only for editor component)
|
||||||
// 추가 변수 정리 (에디터 컴포넌트에서는 text형만 가능)
|
|
||||||
$extra_vars = $xml_doc->component->extra_vars->var;
|
$extra_vars = $xml_doc->component->extra_vars->var;
|
||||||
if($extra_vars) {
|
if($extra_vars) {
|
||||||
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
|
if(!is_array($extra_vars)) $extra_vars = array($extra_vars);
|
||||||
|
|
|
||||||
|
|
@ -2,32 +2,30 @@
|
||||||
/**
|
/**
|
||||||
* @class editorView
|
* @class editorView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief editor 모듈의 view 클래스
|
* @brief view class of the editor module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class editorView extends editor {
|
class editorView extends editor {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컴포넌트의 팝업 출력을 요청을 받는 action
|
* @brief Action to get a request to display compoenet pop-up
|
||||||
**/
|
**/
|
||||||
function dispEditorPopup() {
|
function dispEditorPopup() {
|
||||||
// css 파일 추가
|
// add a css file
|
||||||
Context::addCssFile($this->module_path."tpl/css/editor.css");
|
Context::addCssFile($this->module_path."tpl/css/editor.css");
|
||||||
|
// List variables
|
||||||
// 변수 정리
|
|
||||||
$editor_sequence = Context::get('editor_sequence');
|
$editor_sequence = Context::get('editor_sequence');
|
||||||
$component = Context::get('component');
|
$component = Context::get('component');
|
||||||
|
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$site_srl = (int)$site_module_info->site_srl;
|
$site_srl = (int)$site_module_info->site_srl;
|
||||||
|
// Get compoenet object
|
||||||
// component 객체를 받음
|
|
||||||
$oEditorModel = &getModel('editor');
|
$oEditorModel = &getModel('editor');
|
||||||
$oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl);
|
$oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl);
|
||||||
if(!$oComponent->toBool()) {
|
if(!$oComponent->toBool()) {
|
||||||
|
|
@ -35,22 +33,19 @@
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('component_not_founded');
|
$this->setTemplateFile('component_not_founded');
|
||||||
} else {
|
} else {
|
||||||
|
// Get the result after executing a method to display popup url of the component
|
||||||
// 컴포넌트의 popup url을 출력하는 method실행후 결과를 받음
|
|
||||||
$popup_content = $oComponent->getPopupContent();
|
$popup_content = $oComponent->getPopupContent();
|
||||||
Context::set('popup_content', $popup_content);
|
Context::set('popup_content', $popup_content);
|
||||||
|
// Set layout to popup_layout
|
||||||
// 레이아웃을 popup_layout으로 설정
|
|
||||||
$this->setLayoutFile('popup_layout');
|
$this->setLayoutFile('popup_layout');
|
||||||
|
// Set a template
|
||||||
// 템플릿 지정
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('popup');
|
$this->setTemplateFile('popup');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 컴퍼넌트 정보 보기
|
* @brief Get component information
|
||||||
**/
|
**/
|
||||||
function dispEditorComponentInfo() {
|
function dispEditorComponentInfo() {
|
||||||
$component_name = Context::get('component_name');
|
$component_name = Context::get('component_name');
|
||||||
|
|
@ -68,28 +63,26 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모듈의 추가 설정에서 에디터 설정을 하는 form 추가
|
* @brief Add a form for editor addition setup
|
||||||
**/
|
**/
|
||||||
function triggerDispEditorAdditionSetup(&$obj) {
|
function triggerDispEditorAdditionSetup(&$obj) {
|
||||||
$current_module_srl = Context::get('module_srl');
|
$current_module_srl = Context::get('module_srl');
|
||||||
$current_module_srls = Context::get('module_srls');
|
$current_module_srls = Context::get('module_srls');
|
||||||
|
|
||||||
if(!$current_module_srl && !$current_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_info = Context::get('current_module_info');
|
||||||
$current_module_srl = $current_module_info->module_srl;
|
$current_module_srl = $current_module_info->module_srl;
|
||||||
if(!$current_module_srl) return new Object();
|
if(!$current_module_srl) return new Object();
|
||||||
}
|
}
|
||||||
|
// Get editors settings
|
||||||
// 에디터 설정을 구함
|
|
||||||
$oEditorModel = &getModel('editor');
|
$oEditorModel = &getModel('editor');
|
||||||
$editor_config = $oEditorModel->getEditorConfig($current_module_srl);
|
$editor_config = $oEditorModel->getEditorConfig($current_module_srl);
|
||||||
|
|
||||||
Context::set('editor_config', $editor_config);
|
Context::set('editor_config', $editor_config);
|
||||||
|
|
||||||
$oModuleModel = &getModel('module');
|
$oModuleModel = &getModel('module');
|
||||||
|
// Get a list of editor skin
|
||||||
// 에디터 스킨 목록을 구함
|
|
||||||
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
|
$editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins');
|
||||||
Context::set('editor_skin_list', $editor_skin_list);
|
Context::set('editor_skin_list', $editor_skin_list);
|
||||||
|
|
||||||
|
|
@ -105,15 +98,12 @@
|
||||||
$content_style_list[$style]->title = $info->title;
|
$content_style_list[$style]->title = $info->title;
|
||||||
}
|
}
|
||||||
Context::set('content_style_list', $content_style_list);
|
Context::set('content_style_list', $content_style_list);
|
||||||
|
// Get a group list
|
||||||
|
|
||||||
// 그룹 목록을 구함
|
|
||||||
$oMemberModel = &getModel('member');
|
$oMemberModel = &getModel('member');
|
||||||
$site_module_info = Context::get('site_module_info');
|
$site_module_info = Context::get('site_module_info');
|
||||||
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
|
$group_list = $oMemberModel->getGroups($site_module_info->site_srl);
|
||||||
Context::set('group_list', $group_list);
|
Context::set('group_list', $group_list);
|
||||||
|
// Set a template file
|
||||||
// 템플릿 파일 지정
|
|
||||||
$oTemplate = &TemplateHandler::getInstance();
|
$oTemplate = &TemplateHandler::getInstance();
|
||||||
$tpl = $oTemplate->compile($this->module_path.'tpl', 'editor_module_config');
|
$tpl = $oTemplate->compile($this->module_path.'tpl', 'editor_module_config');
|
||||||
$obj .= $tpl;
|
$obj .= $tpl;
|
||||||
|
|
|
||||||
|
|
@ -2,37 +2,34 @@
|
||||||
/**
|
/**
|
||||||
* @class fileAdminController
|
* @class fileAdminController
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief file 모듈의 admin controller 클래스
|
* @brief admin controller class of the file module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class fileAdminController extends file {
|
class fileAdminController extends file {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 특정 모듈의 첨부파일 모두 삭제
|
* @brief Delete the attachment of a particular module
|
||||||
**/
|
**/
|
||||||
function deleteModuleFiles($module_srl) {
|
function deleteModuleFiles($module_srl) {
|
||||||
// 전체 첨부파일 목록을 구함
|
// Get a full list of attachments
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$output = executeQueryArray('file.getModuleFiles',$args);
|
$output = executeQueryArray('file.getModuleFiles',$args);
|
||||||
if(!$output) return $output;
|
if(!$output) return $output;
|
||||||
$files = $output->data;
|
$files = $output->data;
|
||||||
|
// Remove from the DB
|
||||||
// DB에서 삭제
|
|
||||||
$args->module_srl = $module_srl;
|
$args->module_srl = $module_srl;
|
||||||
$output = executeQuery('file.deleteModuleFiles', $args);
|
$output = executeQuery('file.deleteModuleFiles', $args);
|
||||||
if(!$output->toBool()) return $output;
|
if(!$output->toBool()) return $output;
|
||||||
|
// Remove the file
|
||||||
// 실제 파일 삭제 (일단 약속에 따라서 한번에 삭제)
|
|
||||||
FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
|
FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ;
|
||||||
FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
|
FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) );
|
||||||
|
// Remove the file list obtained from the DB
|
||||||
// DB에서 구한 파일 목록을 삭제
|
|
||||||
$path = array();
|
$path = array();
|
||||||
$cnt = count($files);
|
$cnt = count($files);
|
||||||
for($i=0;$i<$cnt;$i++) {
|
for($i=0;$i<$cnt;$i++) {
|
||||||
|
|
@ -42,18 +39,17 @@
|
||||||
$path_info = pathinfo($uploaded_filename);
|
$path_info = pathinfo($uploaded_filename);
|
||||||
if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname'];
|
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]);
|
for($i=0;$i<count($path);$i++) FileHandler::removeBlankDir($path[$i]);
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 관리자 페이지에서 선택된 파일들을 삭제
|
* @brief Delete selected files from the administrator page
|
||||||
**/
|
**/
|
||||||
function procFileAdminDeleteChecked() {
|
function procFileAdminDeleteChecked() {
|
||||||
// 선택된 글이 없으면 오류 표시
|
// An error appears if no document is selected
|
||||||
$cart = Context::get('cart');
|
$cart = Context::get('cart');
|
||||||
if(!$cart) return $this->stop('msg_cart_is_null');
|
if(!$cart) return $this->stop('msg_cart_is_null');
|
||||||
$file_srl_list= explode('|@|', $cart);
|
$file_srl_list= explode('|@|', $cart);
|
||||||
|
|
@ -61,8 +57,7 @@
|
||||||
if(!$file_count) return $this->stop('msg_cart_is_null');
|
if(!$file_count) return $this->stop('msg_cart_is_null');
|
||||||
|
|
||||||
$oFileController = &getController('file');
|
$oFileController = &getController('file');
|
||||||
|
// Delete the post
|
||||||
// 글삭제
|
|
||||||
for($i=0;$i<$file_count;$i++) {
|
for($i=0;$i<$file_count;$i++) {
|
||||||
$file_srl = trim($file_srl_list[$i]);
|
$file_srl = trim($file_srl_list[$i]);
|
||||||
if(!$file_srl) continue;
|
if(!$file_srl) continue;
|
||||||
|
|
@ -74,31 +69,29 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 파일 기본 정보의 추가
|
* @brief Add file information
|
||||||
**/
|
**/
|
||||||
function procFileAdminInsertConfig() {
|
function procFileAdminInsertConfig() {
|
||||||
// 설정 정보를 받아옴 (module model 객체를 이용)
|
// Get configurations (using module model object)
|
||||||
$config->allowed_filesize = Context::get('allowed_filesize');
|
$config->allowed_filesize = Context::get('allowed_filesize');
|
||||||
$config->allowed_attach_size = Context::get('allowed_attach_size');
|
$config->allowed_attach_size = Context::get('allowed_attach_size');
|
||||||
$config->allowed_filetypes = Context::get('allowed_filetypes');
|
$config->allowed_filetypes = Context::get('allowed_filetypes');
|
||||||
$config->allow_outlink = Context::get('allow_outlink');
|
$config->allow_outlink = Context::get('allow_outlink');
|
||||||
$config->allow_outlink_format = Context::get('allow_outlink_format');
|
$config->allow_outlink_format = Context::get('allow_outlink_format');
|
||||||
$config->allow_outlink_site = Context::get('allow_outlink_site');
|
$config->allow_outlink_site = Context::get('allow_outlink_site');
|
||||||
|
// Create module Controller object
|
||||||
// module Controller 객체 생성하여 입력
|
|
||||||
$oModuleController = &getController('module');
|
$oModuleController = &getController('module');
|
||||||
$output = $oModuleController->insertModuleConfig('file',$config);
|
$output = $oModuleController->insertModuleConfig('file',$config);
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모듈별 파일 기본 정보의 추가
|
* @brief Add file information for each module
|
||||||
**/
|
**/
|
||||||
function procFileAdminInsertModuleConfig() {
|
function procFileAdminInsertModuleConfig() {
|
||||||
// 필요한 변수를 받아옴
|
// Get variables
|
||||||
$module_srl = Context::get('target_module_srl');
|
$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);
|
if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl);
|
||||||
else $module_srl = array($module_srl);
|
else $module_srl = array($module_srl);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,22 +2,22 @@
|
||||||
/**
|
/**
|
||||||
* @class fileAdminModel
|
* @class fileAdminModel
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief file 모듈의 admin model 클래스
|
* @brief admin model class of the file module
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class fileAdminModel extends file {
|
class fileAdminModel extends file {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 모든 첨부파일을 시간 역순으로 가져옴 (관리자용)
|
* @brief Get all the attachments in order by time descending (for administrators)
|
||||||
**/
|
**/
|
||||||
function getFileList($obj) {
|
function getFileList($obj) {
|
||||||
// 검색 옵션 정리
|
// Search options
|
||||||
$search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target'));
|
$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'));
|
$search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword'));
|
||||||
|
|
||||||
|
|
@ -59,27 +59,22 @@
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Set valid/invalid state
|
||||||
// 유효/대기 상태 설정
|
|
||||||
if($obj->isvalid == 'Y') $args->isvalid = 'Y';
|
if($obj->isvalid == 'Y') $args->isvalid = 'Y';
|
||||||
elseif($obj->isvalid == 'N') $args->isvalid = 'N';
|
elseif($obj->isvalid == 'N') $args->isvalid = 'N';
|
||||||
|
// Set multimedia/common file
|
||||||
// 멀티미디어/ 일반 상태 설정
|
|
||||||
if($obj->direct_download == 'Y') $args->direct_download = 'Y';
|
if($obj->direct_download == 'Y') $args->direct_download = 'Y';
|
||||||
elseif($obj->direct_download == 'N') $args->direct_download= 'N';
|
elseif($obj->direct_download == 'N') $args->direct_download= 'N';
|
||||||
|
// Set variables
|
||||||
// 변수 설정
|
|
||||||
$args->sort_index = $obj->sort_index;
|
$args->sort_index = $obj->sort_index;
|
||||||
$args->page = $obj->page?$obj->page:1;
|
$args->page = $obj->page?$obj->page:1;
|
||||||
$args->list_count = $obj->list_count?$obj->list_count:20;
|
$args->list_count = $obj->list_count?$obj->list_count:20;
|
||||||
$args->page_count = $obj->page_count?$obj->page_count:10;
|
$args->page_count = $obj->page_count?$obj->page_count:10;
|
||||||
$args->s_module_srl = $obj->module_srl;
|
$args->s_module_srl = $obj->module_srl;
|
||||||
$args->exclude_module_srl = $obj->exclude_module_srl;
|
$args->exclude_module_srl = $obj->exclude_module_srl;
|
||||||
|
// Execute the file.getFileList query
|
||||||
// file.getFileList쿼리 실행
|
|
||||||
$output = executeQuery('file.getFileList', $args);
|
$output = executeQuery('file.getFileList', $args);
|
||||||
|
// Return if no result or an error occurs
|
||||||
// 결과가 없거나 오류 발생시 그냥 return
|
|
||||||
if(!$output->toBool()||!count($output->data)) return $output;
|
if(!$output->toBool()||!count($output->data)) return $output;
|
||||||
|
|
||||||
$oFileModel = &getModel('file');
|
$oFileModel = &getModel('file');
|
||||||
|
|
|
||||||
|
|
@ -2,35 +2,33 @@
|
||||||
/**
|
/**
|
||||||
* @class fileAdminView
|
* @class fileAdminView
|
||||||
* @author NHN (developers@xpressengine.com)
|
* @author NHN (developers@xpressengine.com)
|
||||||
* @brief file 모듈의 admin view 클래스
|
* @brief admin view of the module class file
|
||||||
**/
|
**/
|
||||||
|
|
||||||
class fileAdminView extends file {
|
class fileAdminView extends file {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 초기화
|
* @brief Initialization
|
||||||
**/
|
**/
|
||||||
function init() {
|
function init() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 목록 출력 (관리자용)
|
* @brief Display output list (for administrator)
|
||||||
**/
|
**/
|
||||||
function dispFileAdminList() {
|
function dispFileAdminList() {
|
||||||
// 목록을 구하기 위한 옵션
|
// Options to get a list
|
||||||
$args->page = Context::get('page'); ///< 페이지
|
$args->page = Context::get('page'); // /< Page
|
||||||
$args->list_count = 30; ///< 한페이지에 보여줄 글 수
|
$args->list_count = 30; // /< Number of documents that appear on a single page
|
||||||
$args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수
|
$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->isvalid = Context::get('isvalid');
|
||||||
$args->module_srl = Context::get('module_srl');
|
$args->module_srl = Context::get('module_srl');
|
||||||
|
// Get a list
|
||||||
// 목록 구함
|
|
||||||
$oFileModel = &getAdminModel('file');
|
$oFileModel = &getAdminModel('file');
|
||||||
$output = $oFileModel->getFileList($args);
|
$output = $oFileModel->getFileList($args);
|
||||||
|
// Get the document for looping a list
|
||||||
// 목록의 loop를 돌면서 document를 구하기
|
|
||||||
if($output->data) {
|
if($output->data) {
|
||||||
$oCommentModel = &getModel('comment');
|
$oCommentModel = &getModel('comment');
|
||||||
$oDocumentModel = &getModel('document');
|
$oDocumentModel = &getModel('document');
|
||||||
|
|
@ -50,10 +48,9 @@
|
||||||
$target_srl = $file->upload_target_srl;
|
$target_srl = $file->upload_target_srl;
|
||||||
$file_update_args = null;
|
$file_update_args = null;
|
||||||
$file_update_args->file_srl = $file_srl;
|
$file_update_args->file_srl = $file_srl;
|
||||||
|
// Find and update if upload_target_type doesn't exist
|
||||||
// upload_target_type이 없으면 찾아서 업데이트
|
|
||||||
if(!$file->upload_target_type) {
|
if(!$file->upload_target_type) {
|
||||||
// 찾아둔게 있으면 패스
|
// Pass if upload_target_type is already found
|
||||||
if($document_list[$target_srl]) {
|
if($document_list[$target_srl]) {
|
||||||
$file->upload_target_type = 'doc';
|
$file->upload_target_type = 'doc';
|
||||||
} else if($comment_list[$target_srl]) {
|
} else if($comment_list[$target_srl]) {
|
||||||
|
|
@ -79,7 +76,7 @@
|
||||||
$doc_srls[] = $comment->document_srl;
|
$doc_srls[] = $comment->document_srl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// module (페이지인 경우)
|
// module (for a page)
|
||||||
if(!$file->upload_target_type) {
|
if(!$file->upload_target_type) {
|
||||||
$module = $oModuleModel->getModulesInfo($target_srl);
|
$module = $oModuleModel->getModulesInfo($target_srl);
|
||||||
if($module) {
|
if($module) {
|
||||||
|
|
@ -92,8 +89,7 @@
|
||||||
executeQuery('file.updateFileTargetType', $file_update_args);
|
executeQuery('file.updateFileTargetType', $file_update_args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Check if data is already obtained
|
||||||
// 이미 구해진 데이터가 있는 확인
|
|
||||||
for($i = 0; $i < $com_srls_count; ++$i) {
|
for($i = 0; $i < $com_srls_count; ++$i) {
|
||||||
if($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
|
if($comment_list[$com_srls[$i]]) delete($com_srls[$i]);
|
||||||
}
|
}
|
||||||
|
|
@ -114,13 +110,11 @@
|
||||||
$file_list[$file_srl] = $file;
|
$file_list[$file_srl] = $file;
|
||||||
$mod_srls[] = $file->module_srl;
|
$mod_srls[] = $file->module_srl;
|
||||||
}
|
}
|
||||||
|
// Remove duplication
|
||||||
// 중복 제거
|
|
||||||
$doc_srls = array_unique($doc_srls);
|
$doc_srls = array_unique($doc_srls);
|
||||||
$com_srls = array_unique($com_srls);
|
$com_srls = array_unique($com_srls);
|
||||||
$mod_srls = array_unique($mod_srls);
|
$mod_srls = array_unique($mod_srls);
|
||||||
|
// Comment list
|
||||||
// 댓글 목록
|
|
||||||
$com_srls_count = count($com_srls);
|
$com_srls_count = count($com_srls);
|
||||||
if($com_srls_count) {
|
if($com_srls_count) {
|
||||||
$comment_output = $oCommentModel->getComments($com_srls);
|
$comment_output = $oCommentModel->getComments($com_srls);
|
||||||
|
|
@ -129,8 +123,7 @@
|
||||||
$doc_srls[] = $comment->document_srl;
|
$doc_srls[] = $comment->document_srl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Document list
|
||||||
// 문서 목록
|
|
||||||
$doc_srls_count = count($doc_srls);
|
$doc_srls_count = count($doc_srls);
|
||||||
if($doc_srls_count) {
|
if($doc_srls_count) {
|
||||||
$document_output = $oDocumentModel->getDocuments($doc_srls);
|
$document_output = $oDocumentModel->getDocuments($doc_srls);
|
||||||
|
|
@ -138,8 +131,7 @@
|
||||||
$document_list[$document->document_srl] = $document;
|
$document_list[$document->document_srl] = $document;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Module List
|
||||||
// 모듈 목록
|
|
||||||
$mod_srls_count = count($mod_srls);
|
$mod_srls_count = count($mod_srls);
|
||||||
if($mod_srls_count) {
|
if($mod_srls_count) {
|
||||||
$module_output = $oModuleModel->getModulesInfo($mod_srls);
|
$module_output = $oModuleModel->getModulesInfo($mod_srls);
|
||||||
|
|
@ -164,21 +156,19 @@
|
||||||
Context::set('total_page', $output->total_page);
|
Context::set('total_page', $output->total_page);
|
||||||
Context::set('page', $output->page);
|
Context::set('page', $output->page);
|
||||||
Context::set('page_navigation', $output->page_navigation);
|
Context::set('page_navigation', $output->page_navigation);
|
||||||
|
// Set a template
|
||||||
// 템플릿 지정
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('file_list');
|
$this->setTemplateFile('file_list');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 첨부파일 정보 설정 (관리자용)
|
* @brief Set attachment information (for administrator)
|
||||||
**/
|
**/
|
||||||
function dispFileAdminConfig() {
|
function dispFileAdminConfig() {
|
||||||
$oFileModel = &getModel('file');
|
$oFileModel = &getModel('file');
|
||||||
$config = $oFileModel->getFileConfig();
|
$config = $oFileModel->getFileConfig();
|
||||||
Context::set('config',$config);
|
Context::set('config',$config);
|
||||||
|
// Set a template file
|
||||||
// 템플릿 파일 지정
|
|
||||||
$this->setTemplatePath($this->module_path.'tpl');
|
$this->setTemplatePath($this->module_path.'tpl');
|
||||||
$this->setTemplateFile('file_config');
|
$this->setTemplateFile('file_config');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue