From 4d272994dd9bcb141f9a023e584e9fc675d1604e Mon Sep 17 00:00:00 2001 From: mosmartin Date: Wed, 6 Apr 2011 16:48:06 +0000 Subject: [PATCH] english comments added git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0_english@8278 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- addons/autolink/autolink.addon.php | 2 +- addons/blogapi/blogapi.addon.php | 122 +- addons/blogapi/blogapi.func.php | 13 +- addons/captcha/captcha.addon.php | 55 +- addons/counter/counter.addon.php | 4 +- .../member_communication.addon.php | 50 +- .../member_extra_info.addon.php | 14 +- .../member_extra_info.lib.php | 14 +- addons/mobile/classes/hdml.class.php | 16 +- addons/mobile/classes/mhtml.class.php | 16 +- addons/mobile/classes/mobile.class.php | 177 +- addons/mobile/classes/wml.class.php | 22 +- addons/mobile/lang/jp.lang.php | 7 +- addons/mobile/lang/ko.lang.php | 5 +- addons/mobile/lang/ru.lang.php | 5 +- addons/mobile/lang/zh-CN.lang.php | 4 +- addons/mobile/lang/zh-TW.lang.php | 4 +- addons/mobile/mobile.addon.php | 47 +- .../openid_delegation_id.addon.php | 12 +- .../point_level_icon.addon.php | 7 +- .../point_level_icon/point_level_icon.lib.php | 19 +- addons/resize_image/resize_image.addon.php | 2 +- classes/context/Context.class.php | 38 +- classes/db/DB.class.php | 2 +- classes/db/DBCubrid.class.php | 143 +- classes/db/DBFirebird.class.php | 220 +- classes/db/DBMssql.class.php | 146 +- classes/db/DBMysql.class.php | 155 +- classes/db/DBMysql_innodb.class.php | 40 +- classes/db/DBMysqli.class.php | 41 +- classes/db/DBPostgresql.class.php | 170 +- classes/db/DBSqlite2.class.php | 161 +- classes/db/DBSqlite3_pdo.class.php | 148 +- classes/display/DisplayHandler.class.php | 68 +- classes/display/HTMLDisplayHandler.php | 24 +- classes/editor/EditorHandler.class.php | 6 +- classes/extravar/Extravar.class.php | 41 +- classes/file/FileHandler.class.php | 3 +- classes/mail/Mail.class.php | 2 +- classes/module/ModuleObject.class.php | 57 +- classes/object/Object.class.php | 6 +- classes/template/TemplateHandler.class.php | 28 +- classes/xml/XmlJsFilter.class.php | 58 +- classes/xml/XmlParser.class.php | 17 +- classes/xml/XmlQueryParser.class.php | 52 +- common/js/plugins/filebox/filebox.js | 12 +- config/config.inc.php | 82 +- config/func.inc.php | 180 +- index.php | 24 +- modules/addon/addon.admin.controller.php | 28 +- modules/addon/addon.admin.model.php | 53 +- modules/addon/addon.admin.view.php | 48 +- modules/addon/addon.class.php | 15 +- modules/addon/addon.controller.php | 32 +- modules/admin/admin.admin.view.php | 12 +- .../autoinstall.admin.controller.php | 4 +- .../autoinstall/autoinstall.admin.view.php | 2 +- modules/autoinstall/autoinstall.class.php | 10 +- modules/autoinstall/autoinstall.model.php | 2 +- modules/autoinstall/autoinstall.view.php | 4 +- modules/comment/comment.admin.controller.php | 16 +- modules/comment/comment.admin.view.php | 45 +- modules/comment/comment.class.php | 51 +- modules/comment/comment.controller.php | 248 +- modules/comment/comment.item.php | 97 +- modules/comment/comment.model.php | 132 +- modules/comment/comment.view.php | 17 +- .../communication.admin.controller.php | 11 +- .../communication.admin.model.php | 6 +- .../communication.admin.view.php | 20 +- modules/communication/communication.class.php | 12 +- .../communication.controller.php | 132 +- modules/communication/communication.model.php | 43 +- modules/communication/communication.view.php | 76 +- modules/counter/counter.admin.view.php | 21 +- modules/counter/counter.class.php | 20 +- modules/counter/counter.controller.php | 47 +- modules/counter/counter.model.php | 19 +- .../document/document.admin.controller.php | 111 +- modules/document/document.admin.model.php | 28 +- modules/document/document.admin.view.php | 72 +- modules/document/document.class.php | 87 +- modules/document/document.controller.php | 3057 ++++++++--------- modules/document/document.item.php | 161 +- modules/document/document.model.php | 254 +- modules/document/document.view.php | 40 +- .../components/emoticon/emoticon.class.php | 23 +- .../image_gallery/image_gallery.class.php | 23 +- .../image_link/image_link.class.php | 19 +- .../multimedia_link/multimedia_link.class.php | 17 +- .../poll_maker/poll_maker.class.php | 23 +- modules/editor/editor.admin.controller.php | 23 +- modules/editor/editor.admin.view.php | 27 +- modules/editor/editor.class.php | 59 +- modules/editor/editor.controller.php | 95 +- modules/editor/editor.model.php | 216 +- modules/editor/editor.view.php | 42 +- modules/file/file.admin.controller.php | 41 +- modules/file/file.admin.model.php | 23 +- modules/file/file.admin.view.php | 52 +- modules/file/file.class.php | 60 +- modules/file/file.controller.php | 198 +- modules/file/file.model.php | 48 +- modules/file/file.view.php | 19 +- modules/importer/extract.class.php | 15 +- .../importer/importer.admin.controller.php | 282 +- modules/importer/importer.admin.view.php | 8 +- modules/importer/importer.class.php | 10 +- modules/importer/ttimport.class.php | 128 +- modules/install/install.admin.controller.php | 12 +- modules/install/install.class.php | 10 +- modules/install/install.controller.php | 104 +- modules/install/install.view.php | 36 +- .../integration_search.admin.controller.php | 50 +- .../integration_search.admin.view.php | 29 +- .../integration_search.class.php | 12 +- .../integration_search.model.php | 37 +- .../integration_search.view.php | 23 +- modules/krzip/krzip.admin.controller.php | 11 +- modules/krzip/krzip.admin.view.php | 11 +- modules/krzip/krzip.class.php | 10 +- modules/krzip/krzip.model.php | 16 +- modules/layout/layout.admin.controller.php | 115 +- modules/layout/layout.admin.view.php | 119 +- modules/layout/layout.class.php | 26 +- modules/layout/layout.model.php | 122 +- modules/layout/layout.view.php | 14 +- modules/member/member.admin.controller.php | 146 +- modules/member/member.admin.model.php | 19 +- modules/member/member.admin.view.php | 29 +- modules/member/member.api.php | 4 +- modules/member/member.class.php | 74 +- modules/member/member.controller.php | 668 ++-- modules/member/member.mobile.php | 28 +- modules/member/member.model.php | 167 +- modules/member/member.view.php | 109 +- modules/menu/menu.admin.controller.php | 208 +- modules/menu/menu.admin.model.php | 61 +- modules/menu/menu.admin.view.php | 41 +- modules/menu/menu.class.php | 26 +- modules/message/message.admin.controller.php | 11 +- modules/message/message.admin.view.php | 14 +- modules/message/message.class.php | 10 +- modules/message/message.mobile.php | 15 +- modules/message/message.view.php | 17 +- modules/module/module.admin.controller.php | 145 +- modules/module/module.admin.model.php | 40 +- modules/module/module.admin.view.php | 114 +- modules/module/module.class.php | 111 +- modules/module/module.controller.php | 150 +- modules/module/module.model.php | 293 +- modules/module/module.view.php | 40 +- modules/opage/opage.admin.controller.php | 32 +- modules/opage/opage.admin.view.php | 58 +- modules/opage/opage.class.php | 16 +- modules/opage/opage.controller.php | 25 +- modules/opage/opage.mobile.php | 8 +- modules/opage/opage.model.php | 8 +- modules/opage/opage.view.php | 74 +- modules/page/page.admin.controller.php | 72 +- modules/page/page.admin.view.php | 105 +- modules/page/page.api.php | 4 +- modules/page/page.class.php | 14 +- modules/page/page.mobile.php | 4 +- modules/page/page.view.php | 13 +- modules/page/page.wap.php | 9 +- modules/point/point.admin.controller.php | 88 +- modules/point/point.admin.view.php | 47 +- modules/point/point.class.php | 95 +- modules/point/point.controller.php | 311 +- modules/point/point.model.php | 21 +- modules/point/point.view.php | 16 +- modules/poll/poll.admin.controller.php | 17 +- modules/poll/poll.admin.model.php | 8 +- modules/poll/poll.admin.view.php | 49 +- modules/poll/poll.class.php | 27 +- modules/poll/poll.controller.php | 62 +- modules/poll/poll.model.php | 32 +- modules/rss/rss.admin.controller.php | 41 +- modules/rss/rss.admin.view.php | 8 +- modules/rss/rss.class.php | 36 +- modules/rss/rss.controller.php | 11 +- modules/rss/rss.model.php | 12 +- modules/rss/rss.view.php | 57 +- modules/session/session.admin.controller.php | 6 +- modules/session/session.admin.view.php | 8 +- modules/session/session.class.php | 14 +- modules/session/session.controller.php | 4 +- modules/session/session.model.php | 22 +- .../spamfilter.admin.controller.php | 31 +- modules/spamfilter/spamfilter.admin.view.php | 27 +- modules/spamfilter/spamfilter.class.php | 37 +- modules/spamfilter/spamfilter.controller.php | 75 +- modules/spamfilter/spamfilter.model.php | 28 +- .../syndication.admin.controller.php | 2 +- modules/syndication/syndication.class.php | 2 +- .../syndication/syndication.controller.php | 2 +- modules/syndication/syndication.model.php | 2 +- modules/tag/tag.admin.controller.php | 4 +- modules/tag/tag.class.php | 34 +- modules/tag/tag.controller.php | 25 +- modules/tag/tag.model.php | 17 +- .../trackback/trackback.admin.controller.php | 23 +- modules/trackback/trackback.admin.model.php | 17 +- modules/trackback/trackback.admin.view.php | 27 +- modules/trackback/trackback.class.php | 48 +- modules/trackback/trackback.controller.php | 148 +- modules/trackback/trackback.model.php | 37 +- modules/trackback/trackback.view.php | 24 +- modules/widget/widget.admin.view.php | 13 +- modules/widget/widget.class.php | 26 +- modules/widget/widget.controller.php | 221 +- modules/widget/widget.model.php | 88 +- modules/widget/widget.view.php | 70 +- widgets/content/content.class.php | 150 +- .../counter_status/counter_status.class.php | 19 +- .../language_select/language_select.class.php | 12 +- widgets/login_info/login_info.class.php | 24 +- widgets/mcontent/mcontent.class.php | 123 +- 219 files changed, 6407 insertions(+), 8705 deletions(-) diff --git a/addons/autolink/autolink.addon.php b/addons/autolink/autolink.addon.php index 831254057..56ad64f85 100644 --- a/addons/autolink/autolink.addon.php +++ b/addons/autolink/autolink.addon.php @@ -4,7 +4,7 @@ /** * @file autolink.addon.php * @author NHN (developers@xpressengine.com) - * @brief 자동 링크 애드온 + * @brief Automatic link add-on **/ if($called_position == 'after_module_proc' && Context::getResponseMethod()!="XMLRPC") { Context::addJsFile('./addons/autolink/autolink.js', false ,'', null, 'body'); diff --git a/addons/blogapi/blogapi.addon.php b/addons/blogapi/blogapi.addon.php index 6fc86aadc..c17ecb9ed 100644 --- a/addons/blogapi/blogapi.addon.php +++ b/addons/blogapi/blogapi.addon.php @@ -4,57 +4,47 @@ /** * @file blogapicounter.addon.php * @author NHN (developers@xpressengine.com) - * @brief blogAPI 애드온 + * @brief Add blogAPI * - * ms live writer, 파이어폭스의 performancing, zoundry 등의 외부 툴을 이용하여 글을 입력할 수 있게 합니다. - * 모듈 실행 이전(before_module_proc)에 호출이 되어야 하며 정상동작후에는 강제 종료를 한다. + * It enables to write a post by using an external tool such as ms live writer, firefox performancing, zoundry and so on. + * It should be called before executing the module(before_module_proc). If not, it is forced to shut down. **/ - - // called_position가 after_module_proc일때 rsd 태그 삽입 + // Insert a rsd tag when called_position is after_module_proc if($called_position == 'after_module_proc') { - // 현재 모듈의 rsd주소를 만듬 + // Create rsd address of the current module $site_module_info = Context::get('site_module_info'); $rsd_url = getFullSiteUrl($site_module_info->domain, '', 'mid',$site_module_info->mid, 'act','api'); - - // 헤더에 rsd태그 삽입 + // Insert rsd tag into the header Context::addHtmlHeader(" ".''); } - - // act가 api가 아니면 그냥 리턴~ + // If act isnot api, just return if($_REQUEST['act']!='api') return; - - // 관련 func 파일 읽음 + // Read func file require_once('./addons/blogapi/blogapi.func.php'); - - // xmlprc 파싱 - // 요청된 xmlrpc를 파싱 + // xmlprc parsing + // Parse the requested xmlrpc $oXmlParser = new XmlParser(); $xmlDoc = $oXmlParser->parse(); $method_name = $xmlDoc->methodcall->methodname->body; $params = $xmlDoc->methodcall->params->param; if($params && !is_array($params)) $params = array($params); - - // 일부 methodname에 대한 호환 + // Compatible with some of methodname if(in_array($method_name, array('metaWeblog.deletePost', 'metaWeblog.getUsersBlogs', 'metaWeblog.getUserInfo'))) { $method_name = str_replace('metaWeblog.', 'blogger.', $method_name); } - - // blogger.deletePost일 경우 첫번째 인자 값 삭제 + // Delete the first argument if it is blogger.deletePost if($method_name == 'blogger.deletePost') array_shift($params); - - // user_id, password를 구해서 로그인 시도 + // Get user_id, password and attempt log-in $user_id = trim($params[1]->value->string->body); $password = trim($params[2]->value->string->body); - - // 모듈 실행전이라면 인증을 처리한다. + // Before executing the module, authentication is processed. if($called_position == 'before_module_init') { - - // member controller을 이용해서 로그인 시도 + // Attempt log-in by using member controller if($user_id && $password) { $oMemberController = &getController('member'); $output = $oMemberController->doLogin($user_id, $password); - // 로그인 실패시 에러 메시지 출력 + // If login fails, an error message appears if(!$output->toBool()) { $content = getXmlRpcFailure(1, $output->getMessage()); printContent($content); @@ -64,25 +54,21 @@ printContent($content); } } - - // 모듈에서 무언가 작업을 하기 전에 blogapi tool의 요청에 대한 처리를 하고 강제 종료한다. + // Before module processing, handle requests from blogapi tool and then terminate. if($called_position == 'before_module_proc') { - - // 글쓰기 권한 체크 (권한명의 경우 약속이 필요할듯..) + // Check writing permission if(!$this->grant->write_document) { printContent( getXmlRpcFailure(1, 'no permission') ); } - - // 카테고리의 정보를 구해옴 + // Get information of the categories $oDocumentModel = &getModel('document'); $category_list = $oDocumentModel->getCategoryList($this->module_srl); - - // 임시 파일 저장 장소 지정 + // Specifies a temporary file storage $tmp_uploaded_path = sprintf('./files/cache/blogapi/%s/%s/', $this->mid, $user_id); $uploaded_target_path = sprintf('/files/cache/blogapi/%s/%s/', $this->mid, $user_id); switch($method_name) { - // 블로그 정보 + // Blog information case 'blogger.getUsersBlogs' : $obj->url = getFullSiteUrl(''); $obj->blogid = $this->mid; @@ -92,8 +78,7 @@ $content = getXmlRpcResponse($blog_list); printContent($content); break; - - // 카테고리 목록 return + // Return a list of categories case 'metaWeblog.getCategories' : $category_obj_list = array(); if($category_list) { @@ -111,10 +96,9 @@ $content = getXmlRpcResponse($category_obj_list); printContent($content); break; - - // 파일 업로드 + // Upload file case 'metaWeblog.newMediaObject' : - // 파일 업로드 권한 체크 + // Check a file upload permission $oFileModel = &getModel('file'); $file_module_config = $oFileModel->getFileModuleConfig($this->module_srl); if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant)>0) { @@ -151,8 +135,7 @@ $content = getXmlRpcResponse($obj); printContent($content); break; - - // 글 가져오기 + // Get posts case 'metaWeblog.getPost' : $document_srl = $params[0]->value->string->body; if(!$document_srl) { @@ -163,7 +146,7 @@ if(!$oDocument->isExists() || !$oDocument->isGranted()) { printContent( getXmlRpcFailure(1, 'no permission') ); } else { - // 카테고리를 사용하는지 확인후 사용시 카테고리 목록을 구해와서 Context에 세팅 + // Get a list of categories and set Context $category = ""; if($oDocument->get('category_srl')) { $oDocumentModel = &getModel('document'); @@ -203,12 +186,11 @@ } } break; - - // 글작성 + // Write a new post case 'metaWeblog.newPost' : unset($obj); $info = $params[3]; - // 글, 제목, 카테고리 정보 구함 + // Get information of post, title, and category for($i=0;$ivalue->struct->member);$i++) { $val = $info->value->struct->member[$i]; switch($val->name->body) { @@ -239,13 +221,11 @@ } } - - // 문서 번호 설정 + // Set document srl $document_srl = getNextSequence(); $obj->document_srl = $document_srl; $obj->module_srl = $this->module_srl; - - // 첨부파일 정리 + // Attachment if(is_dir($tmp_uploaded_path)) { $file_list = FileHandler::readDir($tmp_uploaded_path); $file_count = count($file_list); @@ -276,8 +256,7 @@ printContent($content); break; - - // 글 수정 + // Edit post case 'metaWeblog.editPost' : $tmp_val = $params[0]->value->string->body; if(!$tmp_val) $tmp_val = $params[0]->value->i4->body; @@ -294,8 +273,7 @@ $oDocumentModel = &getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); - - // 글 수정 권한 체크 + // Check if a permission to modify a document is granted if(!$oDocument->isGranted()) { $content = getXmlRpcFailure(1, 'no permission'); break; @@ -304,8 +282,7 @@ $obj = $oDocument->getObjectVars(); $info = $params[3]; - - // 글, 제목, 카테고리 정보 구함 + // Get information of post, title, and category for($i=0;$ivalue->struct->member);$i++) { $val = $info->value->struct->member[$i]; switch($val->name->body) { @@ -336,12 +313,10 @@ } } - - // 문서 번호 설정 + // Document srl $obj->document_srl = $document_srl; $obj->module_srl = $this->module_srl; - - // 첨부파일 정리 + // Attachment if(is_dir($tmp_uploaded_path)) { $file_list = FileHandler::readDir($tmp_uploaded_path); $file_count = count($file_list); @@ -374,27 +349,22 @@ printContent($content); break; - - // 글삭제 + // Delete the post case 'blogger.deletePost' : $tmp_val = $params[0]->value->string->body; $tmp_arr = explode('/', $tmp_val); $document_srl = array_pop($tmp_arr); - - // 글 받아오기 + // Get a document $oDocumentModel = &getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); - - // 글 존재 + // If the document exists if(!$oDocument->isExists()) { $content = getXmlRpcFailure(1, 'not exists'); - - // 글 삭제 권한 체크 + // Check if a permission to delete a document is granted } elseif(!$oDocument->isGranted()) { $content = getXmlRpcFailure(1, 'no permission'); break; - - // 삭제 + // Delete } else { $oDocumentController = &getController('document'); $output = $oDocumentController->deleteDocument($document_srl); @@ -404,14 +374,13 @@ printContent($content); break; - - // 최신글 받기 + // Get recent posts case 'metaWeblog.getRecentPosts' : - // 목록을 구하기 위한 옵션 - $args->module_srl = $this->module_srl; ///< 현재 모듈의 module_srl + // Options to get a list + $args->module_srl = $this->module_srl; // /< module_srl of the current module $args->page = 1; $args->list_count = 20; - $args->sort_index = 'list_order'; ///< 소팅 값 + $args->sort_index = 'list_order'; // /< Sorting values $logged_info = Context::get('logged_info'); $args->search_target = 'member_srl'; $args->search_keyword = $logged_info->member_srl; @@ -441,8 +410,7 @@ printContent($content); } break; - - // 아무런 요청이 없을 경우 RSD 출력 + // Display RSD if there is no request default : $homepagelink = getUrl('','mid',$this->mid); diff --git a/addons/blogapi/blogapi.func.php b/addons/blogapi/blogapi.func.php index f89fff237..8d779a0c9 100644 --- a/addons/blogapi/blogapi.func.php +++ b/addons/blogapi/blogapi.func.php @@ -4,10 +4,10 @@ /** * @file ./addons/blogapi/blogapi.func.php * @author NHN (developers@xpressengine.com) - * @brief blogapi구현을 위한 함수 모음집 + * @brief Function collections for the implementation of blogapi **/ - // 오류 표시 + // Error messages function getXmlRpcFailure($error, $message) { return sprintf( @@ -16,8 +16,7 @@ htmlspecialchars($message) ); } - - // 결과 표시 + // Display results function getXmlRpcResponse($params) { $buff = ''."\n"; $buff .= _getEncodedVal($params); @@ -25,8 +24,7 @@ return $buff; } - - // 인코딩 처리 + // Encoding function _getEncodedVal($val, $is_sub_set = false) { if(is_int($val)) $buff = sprintf("%d", $val); elseif(is_string($val)&&preg_match('/^([0-9]+)T([0-9\:]+)$/', $val)) $buff = sprintf("%s\n", $val); @@ -53,8 +51,7 @@ if(!$is_sub_set) return sprintf("\n%s", $buff); return $buff; } - - // 결과 출력 + // Display the result function printContent($content) { header("Content-Type: text/xml; charset=UTF-8"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); diff --git a/addons/captcha/captcha.addon.php b/addons/captcha/captcha.addon.php index 4bc424d4e..a80984e2a 100644 --- a/addons/captcha/captcha.addon.php +++ b/addons/captcha/captcha.addon.php @@ -4,8 +4,8 @@ /** * @file captcha.addon.php * @author NHN (developers@xpressengine.com) - * @brief 특정 action을 실행할때 captcha를 띄우도록 함 - * 영어 알파벳을 입력, 음성기능 추가 + * @brief Captcha for a particular action + * English alphabets and voice verification added **/ if(!class_exists('AddonCaptcha')) @@ -43,8 +43,8 @@ Context::addHtmlHeader(''); Context::addJsFile('./addons/captcha/captcha.js',false, '', null, 'body'); } - - // 게시판/ 이슈트래커의 글쓰기/댓글쓰기 액션 호출시 세션 비교 + // compare session when calling actions such as writing a post or a comment on the board/issue tracker module + if(!$_SESSION['captcha_authed'] && in_array(Context::get('act'), $target_acts)) { Context::loadLang('./addons/captcha/lang'); $ModuleHandler->error = "captcha_denied"; @@ -56,11 +56,11 @@ function before_module_init_setCaptchaSession() { if($_SESSION['captcha_authed']) return false; - - // 언어파일 로드 + // Load language files + Context::loadLang(_XE_PATH_.'addons/captcha/lang'); - - // 키워드 생성 + // Generate keywords + $arr = range('A','Y'); shuffle($arr); $arr = array_slice($arr,0,6); @@ -106,31 +106,31 @@ { $arr = array(); for($i=0,$c=strlen($string);$i<$c;$i++) $arr[] = $string{$i}; - - // 글자 하나 사이즈 + // Font site + $w = 18; $h = 25; - - // 글자 수 + // Character length + $c = count($arr); - - // 글자 이미지 + // Character image + $im = array(); - - // 총사이즈로 바탕 이미지 생성 + // Create an image by total size + $im[] = imagecreate(($w+2)*count($arr), $h); $deg = range(-30,30); shuffle($deg); - - // 글자별 이미지 생성 + // Create an image for each letter + foreach($arr as $i => $str) { $im[$i+1] = @imagecreate($w, $h); $background_color = imagecolorallocate($im[$i+1], 255, 255, 255); $text_color = imagecolorallocate($im[$i+1], 0, 0, 0); - - // 글자폰트(사이즈) 조절 + // Control font size + $ran = range(1,20); shuffle($ran); @@ -148,22 +148,23 @@ } } - // 각글자 이미지를 합침 + // Combine images of each character + for($i=1;$iprocCounterExecute(); diff --git a/addons/member_communication/member_communication.addon.php b/addons/member_communication/member_communication.addon.php index 1222339e0..e018e1b78 100644 --- a/addons/member_communication/member_communication.addon.php +++ b/addons/member_communication/member_communication.addon.php @@ -4,31 +4,27 @@ /** * @file member_communication.addon.php * @author NHN (developers@xpressengine.com) - * @brief 사용자의 커뮤니케이션 기능을 활성화 + * @brief Promote user communication * - * - 새로운 쪽지가 왔을 경우 팝업으로 띄움 - * - MemberModel::getMemberMenu 호출시 대상이 회원일 경우 쪽지 보내기 기능 추가합니다. - * - MemberModel::getMemberMenu 호출시 친구 등록 메뉴를 추가합니다. + * - Pop-up the message if new message comes in + * - When calling MemberModel::getMemberMenu, feature to send a message is added + * - When caliing MemberModel::getMemberMenu, feature to add a friend is added **/ - - // 비로그인 사용자면 중지 + // Stop if non-logged-in user is $logged_info = Context::get('logged_info'); if(!$logged_info) return; /** - * 기능 수행 : 팝업 및 회원정보 보기에서 쪽지/친구 메뉴 추가. 시작할때 새쪽지가 왔는지 검사 + * Message/Friend munus are added on the pop-up window and member profile. Check if a new message is received **/ if($called_position == 'before_module_init' && $this->module != 'member') { - - // 커뮤니케이션 모듈의 언어파일을 읽음 + // Load a language file from the communication module Context::loadLang('./modules/communication/lang'); - - // 회원 로그인 정보중에서 쪽지등의 메뉴를 추가 + // Add menus on the member login information $oMemberController = &getController('member'); $oMemberController->addMemberMenu('dispCommunicationFriend', 'cmd_view_friend'); $oMemberController->addMemberMenu('dispCommunicationMessages', 'cmd_view_message_box'); - - // 새로운 쪽지에 대한 플래그가 있으면 쪽지 보기 팝업 띄움 + // Pop-up to display messages if a flag on new message is set $flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl); $flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl); @@ -43,41 +39,33 @@ } /** - * 기능 수행 : 사용자 이름을 클릭시 요청되는 팝업메뉴의 메뉴에 쪽지 발송, 친구추가등의 링크 추가 + * Links are added on the pop-up menu which appears when clicking user name **/ } elseif($called_position == 'before_module_proc' && $this->act == 'getMemberMenu') { $oMemberController = &getController('member'); $member_srl = Context::get('target_srl'); $mid = Context::get('cur_mid'); - - // communication 모델 객체 생성 + // Creates communication model object $oCommunicationModel = &getModel('communication'); - - // 자신이라면 쪽지함 보기 기능 추가 + // Add a feature to display own message box. if($logged_info->member_srl == $member_srl) { - - // 자신의 쪽지함 보기 기능 추가 + // Add your own viewing Note Template $oMemberController->addMemberPopupMenu(getUrl('','mid',$mid,'act','dispCommunicationMessages'), 'cmd_view_message_box', './modules/communication/tpl/images/icon_message_box.gif', 'self'); - - // 친구 목록 보기 + // Display a list of friends $oMemberController->addMemberPopupMenu(getUrl('','mid',$mid,'act','dispCommunicationFriend'), 'cmd_view_friend', './modules/communication/tpl/images/icon_friend_box.gif', 'self'); - - // 아니라면 쪽지 발송, 친구 등록 추가 + // If not, Add menus to send message and to add friends } else { - // 대상 회원의 정보를 가져옴 + // Get member information $oMemberModel = &getModel('member'); $target_member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); if(!$target_member_info->member_srl) return; - - // 로그인된 사용자 정보를 구함 + // Get logged-in user information $logged_info = Context::get('logged_info'); - - // 쪽지 발송 메뉴를 만듬 + // Add a menu for sending message if( $logged_info->is_admin == 'Y' || $target_member_info->allow_message =='Y' || ($target_member_info->allow_message == 'F' && $oCommunicationModel->isFriend($member_srl))) $oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationSendMessage','receiver_srl',$member_srl), 'cmd_send_message', './modules/communication/tpl/images/icon_write_message.gif', 'popup'); - - // 친구 등록 메뉴를 만듬 (이미 등록된 친구가 아닐 경우) + // Add a menu for listing friends (if a friend is new) if(!$oCommunicationModel->isAddedFriend($member_srl)) $oMemberController->addMemberPopupMenu(getUrl('','module','communication','act','dispCommunicationAddFriend','target_srl',$member_srl), 'cmd_add_friend', './modules/communication/tpl/images/icon_add_friend.gif', 'popup'); } diff --git a/addons/member_extra_info/member_extra_info.addon.php b/addons/member_extra_info/member_extra_info.addon.php index 9dfcb9b16..df80261d1 100644 --- a/addons/member_extra_info/member_extra_info.addon.php +++ b/addons/member_extra_info/member_extra_info.addon.php @@ -4,20 +4,18 @@ /** * @file image_name.addon.php * @author NHN (developers@xpressengine.com) - * @brief 사용자의 이미지이름/ 이미지마크등을 출력 + * @brief Display user image name/image mark * - *
....
로 정의가 된 부분을 찾아 회원번호를 구해서 - * 이미지이름, 이미지마크가 있는지를 확인하여 있으면 내용을 변경해버립니다. + * Find member_srl in the part with
....
+ * Check if ther is image name and image mark. Then change it. **/ /** - * 출력되기 바로 직전일 경우에 이미지이름/이미지마크등을 변경 + * Just before displaying, change image name/ image mark **/ if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return; - - // 회원 이미지이름/ 마크/ 찾아서 대체할 함수를 담고 있는 파일을 include + // Include a file having functions to replace member image name/mark require_once('./addons/member_extra_info/member_extra_info.lib.php'); - - // 1. 출력문서중에서
content
를 찾아 MemberController::transImageName() 를 이용하여 이미지이름/마크로 변경 + // 1. Find a part
content
in the output document, change it to image name/mark by using MemberController::transImageName() $output = preg_replace_callback('!<(div|span|a)([^\>]*)member_([0-9]+)([^\>]*)>(.*?)\<\/(div|span|a)\>!is', 'memberTransImageName', $output); ?> diff --git a/addons/member_extra_info/member_extra_info.lib.php b/addons/member_extra_info/member_extra_info.lib.php index 10d6ef72c..3cb808e31 100644 --- a/addons/member_extra_info/member_extra_info.lib.php +++ b/addons/member_extra_info/member_extra_info.lib.php @@ -1,22 +1,19 @@ getGroupImageMark($member_srl,$site_module_info->site_srl); - - // 회원이 아닐경우(member_srl = 0) 본문 전체를 return + // If member_srl=o(not a member), return the entire body $nick_name = $matches[5]; if(!$member_srl) return $matches[0]; - - // 전역변수에 미리 설정한 데이터가 있다면 그걸 return + // If pre-defined data in the global variablesm return it if(!$GLOBALS['_transImageNameList'][$member_srl]->cached) { $GLOBALS['_transImageNameList'][$member_srl]->cached = true; $image_name_file = sprintf('files/member_extra_info/image_name/%s%d.gif', getNumberingPath($member_srl), $member_srl); @@ -29,8 +26,7 @@ $image_name_file = $GLOBALS['_transImageNameList'][$member_srl]->image_name_file; $image_mark_file = $GLOBALS['_transImageNameList'][$member_srl]->image_mark_file; } - - // 이미지이름이나 마크가 없으면 원본 정보를 세팅 + // If image name and mark doesn't exist, set the original information if(!$image_name_file && !$image_mark_file && !$group_image) return $matches[0]; if($image_name_file) $nick_name = sprintf('id: %s', Context::getRequestUri(),$image_name_file, strip_tags($nick_name), strip_tags($nick_name)); diff --git a/addons/mobile/classes/hdml.class.php b/addons/mobile/classes/hdml.class.php index bb20afef1..fbad40d06 100644 --- a/addons/mobile/classes/hdml.class.php +++ b/addons/mobile/classes/hdml.class.php @@ -13,7 +13,7 @@ } /** - * @brief hdml 헤더 출력 + * @brief hdml header output **/ function printHeader() { header("Content-Type:text/x-hdml; charset=".$this->charset); @@ -33,7 +33,7 @@ } /** - * @brief 제목을 출력 + * @brief Output title **/ function printTitle() { if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage); @@ -41,8 +41,8 @@ } /** - * @brief 내용을 출력 - * hasChilds()가 있으면 목록형을 그렇지 않으면 컨텐츠를 출력 + * @brief Output information + * hasChilds() if there is a list of content types, otherwise output **/ function printContent() { if($this->hasChilds()) { @@ -56,10 +56,10 @@ } /** - * @brief 버튼을 출력함 + * @brief Button to output **/ function printBtn() { - // 메뉴 형식 + // Menu Types if($this->hasChilds()) { if($this->nextUrl) { $url = $this->nextUrl; @@ -73,7 +73,7 @@ $url = $this->homeUrl; printf('%s%s', $url->text, $url->url, $url->text, "\n"); } - // 컨텐츠 형식 + // Content Types } else { if($this->nextUrl) { $url = $this->nextUrl; @@ -91,7 +91,7 @@ } /** - * @brief 푸터 정보를 출력 + * @brief Footer information output **/ function printFooter() { print $this->hasChilds()?'':''; diff --git a/addons/mobile/classes/mhtml.class.php b/addons/mobile/classes/mhtml.class.php index 32626e155..a03ffb20b 100644 --- a/addons/mobile/classes/mhtml.class.php +++ b/addons/mobile/classes/mhtml.class.php @@ -13,23 +13,22 @@ } /** - * @brief hdml 헤더 출력 + * @brief hdml header output **/ function printHeader() { print("\n"); if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage); printf("%s%s\n", htmlspecialchars($this->title),htmlspecialchars($titlePageStr)); } - - // 제목을 출력 + // Output title function printTitle() { if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage); printf('<%s%s>
%s', htmlspecialchars($this->title),htmlspecialchars($titlePageStr),"\n"); } /** - * @brief 내용을 출력 - * hasChilds()가 있으면 목록형을 그렇지 않으면 컨텐츠를 출력 + * @brief Output information + * hasChilds() if there is a list of content types, otherwise output **/ function printContent() { if($this->hasChilds()) { @@ -45,7 +44,7 @@ } /** - * @brief 버튼을 출력함 + * @brief Button to output **/ function printBtn() { if($this->nextUrl) { @@ -56,7 +55,7 @@ $url = $this->prevUrl; printf('%s
%s', $url->url, $url->text, "\n"); } - // 언어선택 + // Select Language if(!parent::isLangChange()){ $url = getUrl('','lcm','1','sel_lang',Context::getLangType(),'return_uri',Context::get('current_url')); printf('%s
%s', $url, 'Language : '.Context::getLang('select_lang'), "\n"); @@ -73,8 +72,7 @@ printf('%s
%s', $url->text, $url->url, $url->text, "\n"); } } - - // 푸터 정보를 출력 + // Footer information output function printFooter() { print("\n"); } diff --git a/addons/mobile/classes/mobile.class.php b/addons/mobile/classes/mobile.class.php index 5fb4a843a..e59b1ebf9 100644 --- a/addons/mobile/classes/mobile.class.php +++ b/addons/mobile/classes/mobile.class.php @@ -2,48 +2,40 @@ /** * Mobile XE Library Class ver 0.1 * @author NHN (developers@xpressengine.com) / lang_select : misol - * @brief WAP 태그 출력을 위한 XE 라이브러리 + * @brief XE library for WAP tag output **/ class mobileXE { - - // 기본 url + // Base url var $homeUrl = NULL; var $upperUrl = NULL; var $nextUrl = NULL; var $prevUrl = NULL; var $etcBtn = NULL; - - // 메뉴 네비게이션을 위한 변수 + // Variable for menu navigation var $childs = null; - - // 기본 변수 + // Basic variable var $title = NULL; var $content = NULL; var $mobilePage = 0; var $totalPage = 1; var $charset = 'UTF-8'; var $no = 0; - - // 네비게이션 관련 변수 + // Navigation-related variables var $menu = null; var $listed_items = null; var $node_list = null; var $index_mid = null; - - // Navigation On/ Off 상태 값 + // Navigation On/Off status value var $navigationMode = 0; - - // 현재 요청된 XE 모듈 정보 + // XE module information currently requested var $module_info = null; - - // 현재 실행중인 모듈의 instance + // Currently running instance of the module var $oModule = null; // Deck size var $deckSize = 1024; - - // 언어 설정 변경 + // Changing the language setting var $languageMode = 0; var $lang = null; /** @@ -59,8 +51,7 @@ $class_file = sprintf('%saddons/mobile/classes/%s.class.php', _XE_PATH_, $browserType); require_once($class_file); - - // 모바일 언어설정 로드(쿠키가 안되어 생각해낸 방법...-캐시파일 재생성을 클릭하면 초기화된다..) + // Download mobile language settings (cookies, not willing to come up when you click create cache file ...- is initialized ..) $this->lang = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); if($this->lang) { $lang_supported = Context::get('lang_supported'); @@ -85,7 +76,7 @@ * @brief constructor **/ function mobileXE() { - // navigation mode 체크 + // Check navigation mode if(Context::get('nm')) { $this->navigationMode = 1; $this->cmid = (int)Context::get('cmid'); @@ -98,16 +89,16 @@ } /** - * @brief navigation mode 체크 - * navigationMode 세팅과 모듈 정보의 menu_srl이 있어야 navigation mode = true로 return + * @brief Check navigation mode + * navigationMode settings and modules of information must be menu_srl return to navigation mode = true **/ function isNavigationMode() { return ($this->navigationMode && $this->module_info->menu_srl)?true:false; } /** - * @brief langchange mode 체크 - * languageMode 세팅 있어야 true return + * @brief Check langchange mode + * true return should be set languageMode **/ function isLangChange() { if($this->languageMode) return true; @@ -115,12 +106,12 @@ } /** - * @brief 언어 설정 - * 쿠키가 안되기 때문에 휴대전화마다 고유한 파일로 언어설정을 저장하는 파일 생성 + * @brief Language settings + * Cookies Since you set your phone to store language-specific file, file creation **/ function setLangType() { $lang_supported = Context::get('lang_supported'); - // 언어 변수가 있는지 확인하고 변수가 유효한지 확인 + // Make sure that the language variables and parameters are valid if($this->lang && isset($lang_supported[$this->lang])) { $langbuff = FileHandler::readFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); if($langbuff) FileHandler::removeFile('./files/cache/addons/mobile/setLangType/personal_settings/'.md5(trim($_SERVER['HTTP_USER_AGENT']).trim($_SERVER['HTTP_PHONE_NUMBER']).trim($_SERVER['HTTP_HTTP_PHONE_NUMBER'])).'.php'); @@ -130,7 +121,7 @@ } /** - * @brief 현재 요청된 모듈 정보 세팅 + * @brief Information currently requested module settings **/ function setModuleInfo(&$module_info) { if($this->module_info) return; @@ -138,21 +129,18 @@ } /** - * @brief 현재 실행중인 모듈 instance 세팅 + * @brief Set the module instance is currently running **/ function setModuleInstance(&$oModule) { if($this->oModule) return; - - // instance 저장 + // Save instance $this->oModule = $oModule; - - // 현재 모듈의 메뉴가 설정되어 있으면 메뉴 정리 + // Of the current module if there is a menu by menu $menu_cache_file = sprintf(_XE_PATH_.'files/cache/menu/%d.php', $this->module_info->menu_srl); if(!file_exists($menu_cache_file)) return; include $menu_cache_file; - - // 정리된 menu들을 1차원으로 변경 + // One-dimensional arrangement of menu changes $this->getListedItems($menu->list, $listed_items, $node_list); $this->listed_items = $listed_items; @@ -162,8 +150,7 @@ $k = array_keys($node_list); $v = array_values($node_list); $this->index_mid = $k[0]; - - // 현재 메뉴의 depth가 1이상이면 상위 버튼을 지정 + // The depth of the current menu, the top button to specify if one or more $cur_menu_item = $listed_items[$node_list[$this->module_info->mid]]; if($cur_menu_item['parent_srl']) { $parent_srl = $cur_menu_item['parent_srl']; @@ -177,12 +164,12 @@ } /** - * @brief 접속 브라우저의 헤더를 판단하여 브라우저 타입을 return - * 모바일 브라우저가 아닐 경우 null return + * @brief Access the browser's header to determine the return type of the browser + * Mobile browser, if not null return **/ function getBrowserType() { if(Context::get('smartphone')) return null; - // 브라우저 타입을 판별 + // Determine the type of browser $browserAccept = $_SERVER['HTTP_ACCEPT']; $userAgent = $_SERVER['HTTP_USER_AGENT']; $wap_sid = $_SERVER['HTTP_X_UP_SUBNO']; @@ -197,19 +184,18 @@ } /** - * @brief charset 지정 + * @brief Specify charset **/ function setCharSet($charset = 'UTF-8') { if(!$charset) $charset = 'UTF-8'; - - //SKT는 euc-kr만 지원 + // SKT supports the euc-kr if(Context::get('mobile_skt')==1) $charset = 'euc-kr'; $this->charset = $charset; } /** - * @brief 모바일 기기의 용량 제한에 다른 가상 페이지 지정 + * @brief Limited capacity of mobile devices, specifying a different virtual page **/ function setMobilePage($page=1) { if(!$page) $page = 1; @@ -217,10 +203,10 @@ } /** - * @brief 목록형 데이터 설정을 위한 child menu지정 + * @brief Mokrokhyeong child menu for specifying the data set **/ function setChilds($childs) { - // menu개수가 9개 이상일 경우 자체 페이징 처리 + // If more than nine the number of menu paging processing itself $menu_count = count($childs); if($menu_count>9) { $startNum = ($this->mobilePage-1)*9; @@ -235,8 +221,7 @@ $childs = $new_childs; $this->totalPage = (int)(($menu_count-1)/9)+1; - - // next/prevUrl 지정 + // next/prevUrl specify if($this->mobilePage>1) { $url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage-1); $text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage-1, $this->totalPage); @@ -253,21 +238,21 @@ } /** - * @brief menu 출력대상이 있는지 확인 + * @brief Check the menu to be output **/ function hasChilds() { return count($this->childs)?true:0; } /** - * @brief child menu반환 + * @brief Returns the child menu **/ function getChilds() { return $this->childs; } /** - * @brief title 지정 + * @brief Specify title **/ function setTitle($title) { $oModuleController = &getController('module'); @@ -276,28 +261,24 @@ } /** - * @brief title 반환 + * @brief return title **/ function getTitle() { return $this->title; } /** - * @brief 컨텐츠 정리 - * HTML 컨텐츠에서 텍스트와 링크만 추출하는 기능 + * @brief Content Cleanup + * In HTML content, the ability to extract text and links **/ function setContent($content) { $oModuleController = &getController('module'); $allow_tag_array = array('','
','

','','','','','','','','','','
'); - - - // 링크/ 줄바꿈, 강조만 제외하고 모든 태그 제거 + // Links/wrap, remove all tags except gangjoman $content = strip_tags($content, implode($allow_tag_array)); - - // 탭 여백 제거 + // Margins tab removed $content = str_replace("\t", "", $content); - - // 2번 이상 반복되는 공백과 줄나눔을 제거 + // Repeat two more times the space and remove julnanumeul $content = preg_replace('/( ){2,}/s', '', $content); $content = preg_replace("/([\r\n]+)/s", "\r\n", $content); $content = preg_replace(array("/
')) { $content = str_replace('

','
',$content); } - - // 모바일의 경우 한 덱에 필요한 사이즈가 적어서 내용을 모두 페이지로 나눔 + // If the required size of a deck of mobile content to write down all the dividing pages $contents = array(); while($content) { $tmp = $this->cutStr($content, $this->deckSize, ''); @@ -335,8 +315,7 @@ } $this->totalPage = count($contents); - - // next/prevUrl 지정 + // next/prevUrl specify if($this->mobilePage>1) { $url = getUrl('mid',$_GET['mid'],'mpage',$this->mobilePage-1); $text = sprintf('%s (%d/%d)', Context::getLang('cmd_prev'), $this->mobilePage-1, $this->totalPage); @@ -355,21 +334,21 @@ } /** - * @brief byte수로 자르는 함수 + * @brief cutting the number of byte functions **/ function cutStr($string, $cut_size) { return preg_match('/.{'.$cut_size.'}/su', $string, $arr) ? $arr[0] : $string; } /** - * @brief 컨텐츠 반환 + * @brief Return content **/ function getContent() { return $this->content; } /** - * @brief home url 지정 + * @brief Specifies the home url **/ function setHomeUrl($url, $text) { if(!$url) $url = '#'; @@ -378,7 +357,7 @@ } /** - * @brief upper url 지정 + * @brief Specify upper url **/ function setUpperUrl($url, $text) { if(!$url) $url = '#'; @@ -387,7 +366,7 @@ } /** - * @brief prev url 지정 + * @brief Specify prev url **/ function setPrevUrl($url, $text) { if(!$url) $url = '#'; @@ -396,7 +375,7 @@ } /** - * @brief next url 지정 + * @brief Specify next url **/ function setNextUrl($url, $text) { if(!$url) $url = '#'; @@ -405,7 +384,7 @@ } /** - * @brief 다음, 이전, 상위 이외에 기타 버튼 지정 + * @brief Next, Previous, Top button assignments other than **/ function setEtcBtn($url, $text) { if(!$url) $url = '#'; @@ -418,32 +397,25 @@ * @brief display **/ function display() { - // 홈버튼 지정 + // Home button assignments $this->setHomeUrl(getUrl(), Context::getLang('cmd_go_home')); - - // 제목 지정 + // Specify the title if(!$this->title) $this->setTitle(Context::getBrowserTitle()); ob_start(); - - // 헤더를 출력 + // Output header $this->printHeader(); - - // 제목을 출력 + // Output title $this->printTitle(); - - // 내용 출력 + // Information output $this->printContent(); - - // 버튼 출력 + // Button output $this->printBtn(); - - // 푸터를 출력 + // Footer output $this->printFooter(); $content = ob_get_clean(); - - // 변환 후 출력 + // After conversion output if(strtolower($this->charset) == 'utf-8') print $content; else print iconv('UTF-8',$this->charset."//TRANSLIT//IGNORE", $content); @@ -451,7 +423,7 @@ } /** - * @brief 페이지 이동 + * @brief Move page **/ function movepage($url) { header("location:$url"); @@ -459,7 +431,7 @@ } /** - * @brief 목록등에서 일련 번호를 리턴한다 + * @brief And returns a list of serial numbers in **/ function getNo() { $this->no++; @@ -468,7 +440,7 @@ } /** - * @brief XE의 Menu 모듈이 값을 사용하기 쉽게 정리해주는 함수 + * @brief XE is easy to use Menu module is relieved during the function, value **/ function getListedItems($menu, &$listed_items, &$node_list) { if(!count($menu)) return; @@ -486,7 +458,7 @@ } /** - * @brief XE 네비게이션 출력 + * @brief XE navigation output **/ function displayNavigationContent() { $childs = array(); @@ -523,13 +495,12 @@ } $this->setChilds($childs); } - - // 출력 + // Output $this->display(); } /** - * @brief 언어설정 메뉴 출력 + * @brief Language Settings menu, the output **/ function displayLangSelect() { $childs = array(); @@ -561,37 +532,33 @@ } /** - * @brief 모듈의 WAP 클래스 객체 생성하여 WAP 준비 + * @brief Module to create a class object of the WAP WAP ready **/ function displayModuleContent() { - // 선택된 모듈의 WAP class 객체 생성 + // Create WAP class objects of the selected module $oModule = &getWap($this->module_info->module); if(!$oModule || !method_exists($oModule, 'procWAP') ) return; $vars = get_object_vars($this->oModule); if(count($vars)) foreach($vars as $key => $val) $oModule->{$key} = $val; - - // 실행 + // Run $oModule->procWAP($this); - - // 출력 + // Output $this->display(); } /** - * @brief WAP 컨텐츠를 별도로 구할 수 없으면 최종 결과물을 출력 + * @brief WAP content is available as a separate output if the final results **/ function displayContent() { Context::set('layout','none'); - - // 템플릿 컴파일 + // Compile a template $oTemplate = new TemplateHandler(); $oContext = &Context::getInstance(); $content = $oTemplate->compile($this->oModule->getTemplatePath(), $this->oModule->getTemplateFile()); $this->setContent($content); - - // 출력 + // Output $this->display(); } } diff --git a/addons/mobile/classes/wml.class.php b/addons/mobile/classes/wml.class.php index 11e6ae35e..a9a91fb95 100644 --- a/addons/mobile/classes/wml.class.php +++ b/addons/mobile/classes/wml.class.php @@ -13,19 +13,19 @@ } /** - * @brief wml 헤더 출력 + * @brief wml header output **/ function printHeader() { header("Content-Type: text/vnd.wap.wml"); header("charset: ".$this->charset); if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage); print("charset."\"?>\n"); - // 카드제목 + // Card Title printf("\n\n

\n",htmlspecialchars($this->title),htmlspecialchars($titlePageStr)); } /** - * @brief 제목을 출력 + * @brief Output title **/ function printTitle() { if($this->totalPage > $this->mobilePage) $titlePageStr = sprintf("(%d/%d)",$this->mobilePage, $this->totalPage); @@ -33,8 +33,8 @@ } /** - * @brief 내용을 출력 - * hasChilds()가 있으면 목록형을 그렇지 않으면 컨텐츠를 출력 + * @brief Output information + * hasChilds() if there is a list of content types, otherwise output **/ function printContent() { if($this->hasChilds()) { @@ -50,7 +50,7 @@ } /** - * @brief 버튼을 출력함 + * @brief Button to output **/ function printBtn() { if($this->nextUrl) { @@ -61,7 +61,7 @@ $url = $this->prevUrl; printf('%s', $url->text, $url->url, "\n"); } - // 기타 해당사항 없는 버튼 출력 담당 (array로 전달) type?? + // Others are not applicable in charge of the button output (array passed) type?? if($this->etcBtn) { if(is_array($this->etcBtn)) { foreach($this->etcBtn as $key=>$val) { @@ -69,7 +69,7 @@ } } } - // 언어선택 + // Select Language if(!parent::isLangChange()){ $url = getUrl('','lcm','1','sel_lang',Context::getLangType(),'return_uri',Context::get('current_url')); printf('%s', 'Language : '.Context::getLang('select_lang'), $url, "\n"); @@ -86,13 +86,11 @@ printf('%s', $url->text, $url->url, "\n"); } } - - // 푸터 정보를 출력 + // Footer information output function printFooter() { print("

\n
\n
"); } - - // 목록등에서 일련 번호를 리턴한다 + // And returns a list of serial numbers in function getNo() { if(Context::get('mobile_skt')==1) { return "vnd.skmn".parent::getNo(); diff --git a/addons/mobile/lang/jp.lang.php b/addons/mobile/lang/jp.lang.php index fc891f187..6cbbed47f 100644 --- a/addons/mobile/lang/jp.lang.php +++ b/addons/mobile/lang/jp.lang.php @@ -1,11 +1,10 @@ president_lang = '現在言語'; $lang->select_lang = '言語選択'; $lang->lang_return = '戻る'; diff --git a/addons/mobile/lang/ko.lang.php b/addons/mobile/lang/ko.lang.php index 90b08f866..746da3c3c 100644 --- a/addons/mobile/lang/ko.lang.php +++ b/addons/mobile/lang/ko.lang.php @@ -2,10 +2,9 @@ /** * @file addons/mobile/lang/ko.lang.php * @author NHN (developers@xpressengine.com) - * @brief 한국어 언어팩 (기본적인 내용만 수록) + * @brief Korean language pack (only the more basic) **/ - - // 언어 선택부분 by misol + // Language selection by misol $lang->president_lang = '현재 언어'; $lang->select_lang = '언어 선택'; $lang->lang_return = '돌아가기'; diff --git a/addons/mobile/lang/ru.lang.php b/addons/mobile/lang/ru.lang.php index 929a5689c..1ddc447e5 100644 --- a/addons/mobile/lang/ru.lang.php +++ b/addons/mobile/lang/ru.lang.php @@ -2,10 +2,9 @@ /** * @file addons/mobile/lang/ko.lang.php * @author NHN (developers@xpressengine.com) - * @brief 한국어 언어팩 (기본적인 내용만 수록) + * @brief Korean language pack (only the more basic) **/ - - // 언어 선택부분 by misol + // Language selection by misol $lang->president_lang = 'Дейсвующй язык'; $lang->select_lang = 'Выбор языка'; $lang->lang_return = 'Вернуться'; diff --git a/addons/mobile/lang/zh-CN.lang.php b/addons/mobile/lang/zh-CN.lang.php index 96dc8d5cb..974687c74 100644 --- a/addons/mobile/lang/zh-CN.lang.php +++ b/addons/mobile/lang/zh-CN.lang.php @@ -1,8 +1,8 @@ cmd_go_upper = '上一级'; diff --git a/addons/mobile/lang/zh-TW.lang.php b/addons/mobile/lang/zh-TW.lang.php index 0435b4be0..1c7bb7b55 100644 --- a/addons/mobile/lang/zh-TW.lang.php +++ b/addons/mobile/lang/zh-TW.lang.php @@ -1,8 +1,8 @@ president_lang = '已選擇語言'; diff --git a/addons/mobile/mobile.addon.php b/addons/mobile/mobile.addon.php index ce99e39ea..79d50e7c0 100644 --- a/addons/mobile/mobile.addon.php +++ b/addons/mobile/mobile.addon.php @@ -4,58 +4,47 @@ /** * @file mobile.addon.php * @author NHN (developers@xpressengine.com) - * @brief 모바일XE 애드온 + * @brief Mobile XE add-on * - * 헤더정보를 가로채서 모바일에서의 접속일 경우 WAP 태그로 컨텐츠를 출력함 + * If a mobile connection is made (see the header information), display contents with WAP tags * - * 동작 시점 + * Time to call * - * before_module_proc > 모바일 처리를 위해 모듈의 일반 설정을 변경해야 할 경우 호출 + * before_module_proc > call when changing general settings for mobile * - * after_module_proc > 모바일 컨텐츠 출력 - * 동작 조건 + * after_module_proc > display mobile content + * Condition **/ - - // 관리자 페이지는 무시 + // Ignore admin page if(Context::get('module')=='admin') return; - - // 동작 시점 관리 + // Manage when to call it if($called_position != 'before_module_proc' && $called_position != 'after_module_proc' ) return; - - // 모바일 브라우저가 아니라면 무시 + // Ignore if not mobile browser require_once(_XE_PATH_.'addons/mobile/classes/mobile.class.php'); if(!mobileXE::getBrowserType()) return; - - // mobile instance 생성 + // Generate mobile instance $oMobile = &mobileXE::getInstance(); if(!$oMobile) return; - - // 애드온 설정에서 지정된 charset으로 지정 + // Specify charset on the add-on settings $oMobile->setCharSet($addon_info->charset); - - // 모듈의 정보를 세팅 + // Set module information $oMobile->setModuleInfo($this->module_info); - - // 현재 모듈 객체 등록 + // Register the current module object $oMobile->setModuleInstance($this); - - // 네비게이트 모드이거나 WAP class가 있을 경우 미리 컨텐츠를 추출하여 출력/ 종료 + // Extract content and display/exit if navigate mode is or if WAP class exists if($called_position == 'before_module_proc') { if($oMobile->isLangChange()) { $oMobile->setLangType(); $oMobile->displayLangSelect(); } - - // 네비게이트 모드이면 네비게이션 컨텐츠 출력 + // On navigation mode, display navigation content if($oMobile->isNavigationMode()) $oMobile->displayNavigationContent(); - - // WAP class가 있으면 WAP class를 통해 컨텐츠 출력 + // If you have a WAP class content output via WAP class else $oMobile->displayModuleContent(); - - // 네비게이트 모드가 아니고 WAP 클래스가 아니면 모듈의 결과를 출력 + // If neither navigation mode nor WAP class is, display the module's result } else if($called_position == 'after_module_proc') { - // 내용 준비 + // Display $oMobile->displayContent(); } ?> diff --git a/addons/openid_delegation_id/openid_delegation_id.addon.php b/addons/openid_delegation_id/openid_delegation_id.addon.php index be01816ff..4207ef43f 100644 --- a/addons/openid_delegation_id/openid_delegation_id.addon.php +++ b/addons/openid_delegation_id/openid_delegation_id.addon.php @@ -4,16 +4,14 @@ /** * @file openid_delegation_id.addon.php * @author NHN (developers@xpressengine.com) - * @brief OpenID Delegation ID 애드온 + * @brief OpenID Delegation ID Add-on * - * 오픈아이디를 자신의 홈페이지나 블로그 주소로 이용할 수 있도록 해줍니다. - * 꼭 설정을 통해서 사용하시는 오픈아이디 서비스에 해당하는 정보를 입력해주세요. + * This enables to use openID as user's homepage or blog url. + * Enter your open ID service information on the configuration. **/ - - // called_position이 before_module_init일때만 실행 + // Execute only wen called_position is before_module_init if($called_position != 'before_module_init') return; - - // openid_delegation_id 애드온 설정 정보를 가져옴 + // Get add-on settings(openid_delegation_id) if(!$addon_info->server||!$addon_info->delegate||!$addon_info->xrds) return; $header_script = sprintf( diff --git a/addons/point_level_icon/point_level_icon.addon.php b/addons/point_level_icon/point_level_icon.addon.php index 6395590c3..77fa75fb4 100644 --- a/addons/point_level_icon/point_level_icon.addon.php +++ b/addons/point_level_icon/point_level_icon.addon.php @@ -4,12 +4,11 @@ /** * @file point.addon.php * @author NHN (developers@xpressengine.com) - * @brief 포인트 레벨 아이콘 표시 애드온 + * @brief Icon-on-point level * - * 포인트 시스템 사용중일때 사용자 이름 앞에 포인트 레벨 아이콘을 표시합니다. + * Display point level icon before user name when point system is enabled. **/ - - // before_display_content 가 아니면 return + // return unless before_display_content if($called_position != "before_display_content" || Context::get('act')=='dispPageAdminContentModify') return; require_once('./addons/point_level_icon/point_level_icon.lib.php'); diff --git a/addons/point_level_icon/point_level_icon.lib.php b/addons/point_level_icon/point_level_icon.lib.php index 471025c80..014e31e23 100644 --- a/addons/point_level_icon/point_level_icon.lib.php +++ b/addons/point_level_icon/point_level_icon.lib.php @@ -1,34 +1,29 @@ getModuleConfig('point'); } $config = $GLOBALS['_pointConfig']; - - // 포인트 모델을 구해 놓음 + // Get point model if(!$GLOBALS['_pointModel']) $GLOBALS['_pointModel'] = getModel('point'); $oPointModel = &$GLOBALS['_pointModel']; - - // 포인트를 구함 + // Get points $point = $oPointModel->getPoint($member_srl); - - // 레벨을 구함 + // Get level $level = $oPointModel->getLevel($point, $config->level_step); $text = $matches[5]; - - // 레벨 아이콘의 위치를 구함 + // Get a path where level icon is $level_icon = sprintf('%smodules/point/icons/%s/%d.gif', Context::getRequestUri(), $config->level_icon, $level); - - // 최고 레벨이 아니면 다음 레벨로 가기 위한 per을 구함 :: 주석과 실제 내용이 맞지 않아 실제 내용을 수정 + // Get per to go to the next level if not a top level if($level < $config->max_level) { $next_point = $config->level_step[$level+1]; $present_point = $config->level_step[$level]; diff --git a/addons/resize_image/resize_image.addon.php b/addons/resize_image/resize_image.addon.php index b6b3ecdfc..758a20249 100644 --- a/addons/resize_image/resize_image.addon.php +++ b/addons/resize_image/resize_image.addon.php @@ -4,7 +4,7 @@ /** * @file resize_image.addon.php * @author NHN (developers@xpressengine.com) - * @brief 본문내 이미지 조절 애드온 + * @brief Add-on to resize images in the body **/ if($called_position == 'after_module_proc' && Context::getResponseMethod()=="HTML") { diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index c5e315fc8..5ac4d029a 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -857,7 +857,7 @@ class Context { } /** - * @brief 요청이 들어온 URL에서 argument를 제거하여 return + * @brief Return after removing an argument on the requested URL **/ function getRequestUri($ssl_mode = FOLLOW_REQUEST_SSL, $domain = null) { static $url = array(); @@ -919,7 +919,7 @@ class Context { } /** - * @brief key값에 해당하는 값을 return + * @brief return key value **/ function get($key) { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -927,9 +927,9 @@ class Context { } /** - * @brief 받고자 하는 변수만 object에 입력하여 받음 - * - * key1, key2, key3 .. 등의 인자를 주어 여러개의 변수를 object vars로 세팅하여 받을 수 있음 + * @brief get a specified var in object + * + * get one more vars in object vars with given arguments(key1, key2, key3,...) **/ function gets() { $num_args = func_num_args(); @@ -944,7 +944,7 @@ class Context { } /** - * @brief 모든 데이터를 return + * @brief Return all data **/ function getAll() { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -952,7 +952,7 @@ class Context { } /** - * @brief GET/POST/XMLRPC에서 넘어온 변수값을 return + * @brief Return values from the GET/POST/XMLRPC **/ function getRequestVars() { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -960,8 +960,8 @@ class Context { } /** - * @brief SSL로 인증되어야 할 action이 있을 경우 등록 - * common/js/xml_handler.js에서 이 action들에 대해서 https로 전송되도록 함 + * @brief Register if actions is to be encrypted by SSL + * Those actions are sent to https in common/js/xml_handler.js **/ function addSSLAction($action) { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -992,7 +992,7 @@ class Context { } /** - * @brief js file을 추가 + * @brief Add the js file **/ function addJsFile($file, $optimized = false, $targetie = '',$index=0, $type='head') { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -1009,7 +1009,7 @@ class Context { } /** - * @brief js file을 제거 + * @brief Remove the js file **/ function unloadJsFile($file, $optimized = false, $targetie = '') { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -1034,14 +1034,14 @@ class Context { } /** - * @brief javascript filter 추가 + * @brief Add javascript filter **/ function addJsFilter($path, $filename) { $oXmlFilter = new XmlJSFilter($path, $filename); $oXmlFilter->compile(); } /** - * @brief array_unique와 동작은 동일하나 file 첨자에 대해서만 동작함 + * @brief Same as array_unique but works only for file subscript * @deprecated **/ function _getUniqueFileList($files) { @@ -1080,7 +1080,7 @@ class Context { } /** - * @brief CSS file 추가 + * @brief Add CSS file **/ function addCSSFile($file, $optimized=false, $media='all', $targetie='',$index=0) { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -1092,7 +1092,7 @@ class Context { } /** - * @brief css file을 제거 + * @brief Remove css file **/ function unloadCSSFile($file, $optimized = false, $media = 'all', $targetie = '') { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -1163,7 +1163,7 @@ class Context { } /** - * @brief HtmlHeader 추가 + * @brief Add HtmlHeader **/ function addHtmlHeader($header) { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -1179,7 +1179,7 @@ class Context { } /** - * @brief Html Body에 css class 추가 + * @brief Add css class to Html Body **/ function addBodyClass($class_name) { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -1187,7 +1187,7 @@ class Context { } /** - * @brief Html Body에 css class return + * @brief Return css class to Html Body **/ function getBodyClass() { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); @@ -1251,7 +1251,7 @@ class Context { } /** - * @brief 내용의 위젯이나 기타 기능에 대한 code를 실제 code로 변경 + * @brief Transforms codes about widget or other features into the actual code, deprecatred **/ function transContent($content) { return $content; diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index 0c58dee8c..dffd0ed42 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -241,7 +241,7 @@ } /** - * @brief query xml 파일을 실행하여 결과를 return + * @brief Run the result of the query xml file * @param[in] $query_id query id (module.queryname * @param[in] $args arguments for query * @return result of query diff --git a/classes/db/DBCubrid.class.php b/classes/db/DBCubrid.class.php index 493db32bb..8fa85b48f 100644 --- a/classes/db/DBCubrid.class.php +++ b/classes/db/DBCubrid.class.php @@ -2,34 +2,34 @@ /** * @class DBCubrid * @author NHN (developers@xpressengine.com) - * @brief Cubrid DBMS를 이용하기 위한 class + * @brief Cubrid DBMS to use the class * @version 0.1p1 * - * CUBRID2008 R1.3 에 대응하도록 수정 Prototype (prototype@cubrid.com) / 09.02.23 - * 7.3 ~ 2008 R1.3 까지 테스트 완료함. - * 기본 쿼리만 사용하였기에 특화된 튜닝이 필요 + * Modified to work with CUBRID2008 R1.3 verion by Prototype (prototype@cubrid.com)/09.02.23 + * Test completed for CUBRID 7.3 ~ 2008 R1.3 versions. + * Only basic query used so query tunning and optimization needed **/ class DBCubrid extends DB { /** - * @brief Cubrid DB에 접속하기 위한 정보 + * @brief CUBRID DB connection information **/ var $hostname = '127.0.0.1'; ///< hostname var $userid = NULL; ///< user id var $password = NULL; ///< password var $database = NULL; ///< database var $port = 33000; ///< db server port - var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE 설치 가능) - var $cutlen = 12000; ///< 큐브리드의 최대 상수 크기(스트링이 이보다 크면 '...'+'...' 방식을 사용해야 한다 + var $prefix = 'xe'; // / 'numeric(20)', @@ -61,7 +61,7 @@ } /** - * @brief 설치 가능 여부를 return + * @brief Return if installable **/ function isSupported() { @@ -70,7 +70,7 @@ } /** - * @brief DB정보 설정 및 connect/ close + * @brief DB settings and connect/close **/ function _setDBInfo() { @@ -86,17 +86,17 @@ } /** - * @brief DB 접속 + * @brief DB Connection **/ function _connect() { - // db 정보가 없으면 무시 + // ignore if db information not exists if (!$this->hostname || !$this->userid || !$this->password || !$this->database || !$this->port) return; - // 접속시도 + // attempts to connect $this->fd = @cubrid_connect ($this->hostname, $this->port, $this->database, $this->userid, $this->password); - // 접속체크 + // check connections if (!$this->fd) { $this->setError (-1, 'database connect fail'); return $this->is_connected = false; @@ -107,7 +107,7 @@ } /** - * @brief DB접속 해제 + * @brief DB disconnect **/ function close() { @@ -119,7 +119,7 @@ } /** - * @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절 + * @brief handles quatation of the string variables from the query **/ function addQuotes($string) { @@ -147,7 +147,7 @@ } /** - * @brief 트랜잭션 시작 + * @brief Begin transaction **/ function begin() { @@ -156,7 +156,7 @@ } /** - * @brief 롤백 + * @brief Rollback **/ function rollback() { @@ -166,7 +166,7 @@ } /** - * @brief 커밋 + * @brief Commit **/ function commit() { @@ -178,24 +178,24 @@ } /** - * @brief : 쿼리문의 실행 및 결과의 fetch 처리 + * @brief : executing the query and fetching the result * - * query : query문 실행하고 result return\n - * fetch : reutrn 된 값이 없으면 NULL\n - * rows이면 array object\n - * row이면 object\n - * return\n + * query: run a query and return the result\n + * fetch: NULL if no value returned \n + * array object if rows returned \n + * object if a row returned \n + * return\n **/ function _query($query) { if (!$query || !$this->isConnected ()) return; - // 쿼리 시작을 알림 + // Notify to start a query execution $this->actStart ($query); - // 쿼리 문 실행 + // Execute the query $result = @cubrid_execute ($this->fd, $query); - // 오류 체크 + // error check if (cubrid_error_code ()) { $code = cubrid_error_code (); $msg = cubrid_error_msg (); @@ -203,15 +203,15 @@ $this->setError ($code, $msg); } - // 쿼리 실행 종료를 알림 + // Notify to complete a query execution $this->actFinish (); - // 결과 리턴 + // Return the result return $result; } /** - * @brief 결과를 fetch + * @brief Fetch the result **/ function _fetch($result) { @@ -246,7 +246,7 @@ } /** - * @brief 1씩 증가되는 sequence 값을 return (cubrid의 auto_increment는 sequence테이블에서만 사용) + * @brief return the sequence value incremented by 1(auto_increment column only used in the CUBRID sequence table) **/ function getNextSequence() { @@ -260,7 +260,7 @@ } /** - * @brief 마이그레이션시 sequence 가 없을 경우 생성 + * @brief return if the table already exists **/ function _makeSequence() { @@ -302,7 +302,7 @@ /** - * @brief 테이블 기생성 여부 return + * brief return a table if exists **/ function isTableExists ($target_name) { @@ -327,7 +327,7 @@ } /** - * @brief 특정 테이블에 특정 column 추가 + * @brief add a column to the table **/ function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = '', $notnull = false) { @@ -362,7 +362,7 @@ } /** - * @brief 특정 테이블에 특정 column 제거 + * @brief drop a column from the table **/ function dropColumn ($table_name, $column_name) { @@ -372,7 +372,7 @@ } /** - * @brief 특정 테이블의 column의 정보를 return + * @brief return column information of the table **/ function isColumnExists ($table_name, $column_name) { @@ -388,7 +388,7 @@ } /** - * @brief 특정 테이블에 특정 인덱스 추가 + * @brief add an index to the table * $target_columns = array(col1, col2) * $is_unique? unique : none **/ @@ -404,7 +404,7 @@ } /** - * @brief 특정 테이블의 특정 인덱스 삭제 + * @brief drop an index from the table **/ function dropIndex ($table_name, $index_name, $is_unique = false) { @@ -414,7 +414,7 @@ } /** - * @brief 특정 테이블의 index 정보를 return + * @brief return index information of the table **/ function isIndexExists ($table_name, $index_name) { @@ -430,7 +430,7 @@ } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief creates a table by using xml file **/ function createTableByXml ($xml_doc) { @@ -438,19 +438,19 @@ } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief creates a table by using xml file **/ function createTableByXmlFile ($file_name) { if (!file_exists ($file_name)) return; - // xml 파일을 읽음 + // read xml file $buff = FileHandler::readFile ($file_name); return $this->_createTable ($buff); } /** - * @brief schema xml을 이용하여 create class query생성 + * @brief create table by using the schema xml * * type : number, varchar, tinytext, text, bigtext, char, date, \n * opt : notnull, default, size\n @@ -461,14 +461,13 @@ // xml parsing $oXml = new XmlParser(); $xml_obj = $oXml->parse($xml_doc); - - // 테이블 생성 schema 작성 + // Create a table schema $table_name = $xml_obj->table->attrs->name; // if the table already exists exit function if ($this->isTableExists($table_name)) return; - // 만약 테이블 이름이 sequence라면 serial 생성 + // If the table name is sequence, it creates a serial if ($table_name == 'sequence') { $query = sprintf ('create serial "%s" start with 1 increment by 1'. ' minvalue 1 '. @@ -563,7 +562,7 @@ } /** - * @brief 조건문 작성하여 return + * @brief return the condition **/ function getCondition ($output) { @@ -651,16 +650,16 @@ } /** - * @brief insertAct 처리 + * @brief handles insertAct **/ function _executeInsertAct ($output) { - // 테이블 정리 + // tables foreach ($output->tables as $val) { $table_list[] = '"'.$this->prefix.$val.'"'; } - // 컬럼 정리 + // columns foreach ($output->columns as $key => $val) { $name = $val['name']; $value = $val['value']; @@ -699,18 +698,18 @@ } /** - * @brief updateAct 처리 + * @brief handles updateAct **/ function _executeUpdateAct ($output) { - // 테이블 정리 + // tables foreach ($output->tables as $key => $val) { $table_list[] = '"'.$this->prefix.$val.'" as "'.$key.'"'; } $check_click_count = true; - // 컬럼 정리 + // columns foreach ($output->columns as $key => $val) { if (!isset ($val['value'])) continue; $name = $val['name']; @@ -721,10 +720,10 @@ } for ($i = 0; $i < $key; $i++) { - /* 한문장에 같은 속성에 대한 중복 설정은 큐브리드에서는 허용치 않음 */ + // not allows to define the same property repeatedly in a single query in CUBRID if ($output->columns[$i]['name'] == $name) break; } - if ($i < $key) continue; // 중복이 발견되면 이후의 설정은 무시 + if ($i < $key) continue; // ignore the rest of properties if duplicated property found if (strpos ($name, '.') !== false && strpos ($value, '.') !== false) { $column_list[] = $name.' = '.$value; @@ -742,7 +741,7 @@ } } - // 조건절 정리 + // conditional clause $condition = $this->getCondition ($output); $check_click_count_condition = false; @@ -792,16 +791,16 @@ } /** - * @brief deleteAct 처리 + * @brief handles deleteAct **/ function _executeDeleteAct ($output) { - // 테이블 정리 + // tables foreach ($output->tables as $val) { $table_list[] = '"'.$this->prefix.$val.'"'; } - // 조건절 정리 + // Conditional clauses $condition = $this->getCondition ($output); $query = sprintf ("delete from %s %s", implode (',',$table_list), $condition); @@ -812,14 +811,14 @@ } /** - * @brief selectAct 처리 + * @brief Handle selectAct * - * select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n - * navigation이라는 method를 제공 + * to get a specific page list easily in select statement,\n + * a method, navigation, is used **/ function _executeSelectAct ($output) { - // 테이블 정리 + // tables $table_list = array (); foreach ($output->tables as $key => $val) { $table_list[] = '"'.$this->prefix.$val.'" as "'.$key.'"'; @@ -966,7 +965,7 @@ } - // list_count를 사용할 경우 적용 + // apply when using list_count if ($output->list_count['value']) { $start_count = 0; $list_count = $output->list_count['value']; @@ -1050,7 +1049,7 @@ } /** - * @brief 현재 시점의 Stack trace를 보여줌.결과를 fetch + * @brief displays the current stack trace. Fetch the result **/ function backtrace () { @@ -1102,9 +1101,9 @@ } /** - * @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다 + * @brief paginates when navigation info exists in the query xml * - * 그닥 좋지는 않은 구조이지만 편리하다.. -_-; + * it is convenient although its structure is not good .. -_-; **/ function _getNavigationData ($table_list, $columns, $left_join, $condition, $output) { require_once (_XE_PATH_.'classes/page/PageHandler.class.php'); @@ -1129,7 +1128,7 @@ $page = $output->page['value']; if (!$page) $page = 1; - // 전체 페이지를 구함 + // total pages if ($total_count) { $total_page = (int) (($total_count - 1) / $list_count) + 1; } @@ -1137,7 +1136,7 @@ $total_page = 1; } - // 페이지 변수를 체크 + // check the page variables if ($page > $total_page) $page = $total_page; $start_count = ($page - 1) * $list_count; diff --git a/classes/db/DBFirebird.class.php b/classes/db/DBFirebird.class.php index 12ab747a4..239903d58 100644 --- a/classes/db/DBFirebird.class.php +++ b/classes/db/DBFirebird.class.php @@ -1,8 +1,8 @@ 'BIGINT', @@ -55,7 +55,7 @@ } /** - * @brief 설치 가능 여부를 return + * @brief Return if installable **/ function isSupported() { if(!function_exists('ibase_connect')) return false; @@ -63,7 +63,7 @@ } /** - * @brief DB정보 설정 및 connect/ close + * @brief DB settings and connect/close **/ function _setDBInfo() { $db_info = Context::getDBInfo(); @@ -77,16 +77,14 @@ } /** - * @brief DB 접속 + * @brief DB Connection **/ function _connect() { - // db 정보가 없으면 무시 + // ignore if db information not exists if(!$this->hostname || !$this->port || !$this->userid || !$this->password || !$this->database) return; //if(strpos($this->hostname, ':')===false && $this->port) $this->hostname .= ':'.$this->port; - - // 접속시도 - + // attempts to connect $host = $this->hostname."/".$this->port.":".$this->database; $this->fd = @ibase_connect($host, $this->userid, $this->password); @@ -94,8 +92,7 @@ $this->setError(ibase_errcode(), ibase_errmsg()); return $this->is_connected = false; } - - // Firebird 버전 확인후 2.0 이하면 오류 표시 + // Error when Firebird version is lower than 2.0 if (($service = ibase_service_attach($this->hostname, $this->userid, $this->password)) != FALSE) { // get server version and implementation strings $server_info = ibase_server_info($service, IBASE_SVC_SERVER_VERSION); @@ -118,14 +115,13 @@ @ibase_close($this->fd); return $this->is_connected = false; } - - // 접속체크 + // Check connections $this->is_connected = true; $this->password = md5($this->password); } /** - * @brief DB접속 해제 + * @brief DB disconnect **/ function close() { if(!$this->isConnected()) return; @@ -135,7 +131,7 @@ } /** - * @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절 + * @brief handles quatation of the string variables from the query **/ function addQuotes($string) { // if(get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string)); @@ -144,7 +140,7 @@ } /** - * @brief 쿼리에서 입력되는 table, column 명에 더블쿼터를 넣어줌 + * @brief put double quotes for tabls, column names in the query statement **/ function addDoubleQuotes($string) { if($string == "*") return $string; @@ -162,12 +158,11 @@ } /** - * @brief 쿼리에서 입력되는 table, column 명에 더블쿼터를 넣어줌 + * @brief put double quotes for tabls, column names in the query statement **/ function autoQuotes($string){ $string = strtolower($string); - - // substr 함수 일경우 + // for substr function if(strpos($string, "substr(") !== false) { $tokken = strtok($string, "(,)"); $tokken = strtok("(,)"); @@ -190,8 +185,7 @@ $as = trim($as); $as = $this->addDoubleQuotes($as); } - - // 함수 사용시 + // for functions $tmpFunc1 = null; $tmpFunc2 = null; if(($no1 = strpos($string,'('))!==false && ($no2 = strpos($string, ')'))!==false) { @@ -199,8 +193,7 @@ $tmpFunc2 = substr($string, $no2, strlen($string)-$no2+1); $string = trim(substr($string, $no1+1, $no2-$no1-1)); } - - // (테이블.컬럼) 구조 일때 처리 + // for (table.column) structure preg_match("/((?i)[a-z0-9_-]+)[.]((?i)[a-z0-9_\-\*]+)/", $string, $matches); if($matches) { @@ -225,7 +218,7 @@ } foreach($values as $val1) { - // (테이블.컬럼) 구조 일때 처리 + // for (table.column) structure preg_match("/((?i)[a-z0-9_-]+)[.]((?i)[a-z0-9_\-\*]+)/", $val1, $matches); if($matches) { $isTable = false; @@ -257,7 +250,7 @@ } /** - * @brief 트랜잭션 시작 + * @brief Begin transaction **/ function begin() { if(!$this->isConnected() || $this->transaction_started) return; @@ -265,7 +258,7 @@ } /** - * @brief 롤백 + * @brief Rollback **/ function rollback() { if(!$this->isConnected() || !$this->transaction_started) return; @@ -274,7 +267,7 @@ } /** - * @brief 커밋 + * @brief Commits **/ function commit() { if(!$force && (!$this->isConnected() || !$this->transaction_started)) return; @@ -283,48 +276,43 @@ } /** - * @brief : 쿼리문의 실행 및 결과의 fetch 처리 + * @brief : Run a query and fetch the result * - * query : query문 실행하고 result return\n - * fetch : reutrn 된 값이 없으면 NULL\n - * rows이면 array object\n - * row이면 object\n - * return\n + * query: run a query and return the result\n + * fetch: NULL if no value returned \n + * array object if rows returned \n + * object if a row returned \n + * return\n **/ function _query($query, $params=null) { if(!$this->isConnected()) return; if(count($params) == 0) { - // 쿼리 시작을 알림 + // Notify to start a query execution $this->actStart($query); - - // 쿼리 문 실행 + // Execute the query statement $result = ibase_query($this->fd, $query); } else { - // 쿼리 시작을 알림 + // Notify to start a query execution $log = $query."\n\t\t\t"; $log .= implode(",", $params); $this->actStart($log); - - // 쿼리 문 실행 (blob type 입력하기 위한 방법) + // Execute the query(for blob type) $query = ibase_prepare($this->fd, $query); $fnarr = array_merge(array($query), $params); $result = call_user_func_array("ibase_execute", $fnarr); } - - // 오류 체크 + // Error Check if(ibase_errmsg()) $this->setError(ibase_errcode(), ibase_errmsg()); - - // 쿼리 실행 종료를 알림 + // Notify to complete a query execution $this->actFinish(); - - // 결과 리턴 + // Return the result return $result; } /** - * @brief 결과를 fetch + * @brief Fetch the result **/ function _fetch($result, $output = null) { if(!$this->isConnected() || $this->isError() || !$result) return; @@ -332,12 +320,11 @@ while($tmp = ibase_fetch_object($result)) { foreach($tmp as $key => $val) { $type = $output->column_type[$key]; - - // type 값이 null 일때는 $key값이 alias인 경우라 실제 column 이름을 찾아 type을 구함 + // type value is null when $key is an alias. so get a type by finding actual coloumn name if($type == null && $output->columns && count($output->columns)) { foreach($output->columns as $cols) { if($cols['alias'] == $key) { - // table.column 형식인지 정규식으로 검사 함 + // checks if the format is table.column or a regular expression preg_match("/\w+[.](\w+)/", $cols['name'], $matches); if($matches) { $type = $output->column_type[$matches[1]]; @@ -356,7 +343,7 @@ ibase_blob_close($blob_hndl); } else if($type == "char") { - $tmp->{$key} = trim($tmp->{$key}); // DB의 character set이 UTF8일때 생기는 빈칸을 제거 + $tmp->{$key} = trim($tmp->{$key}); // remove blanks generated when DB character set is UTF8 } } @@ -368,7 +355,7 @@ } /** - * @brief 1씩 증가되는 sequence값을 return (firebird의 generator 값을 증가) + * @brief return sequence value incremented by 1(increase the value of the generator in firebird) **/ function getNextSequence() { $gen = "GEN_".$this->prefix."sequence_ID"; @@ -377,7 +364,7 @@ } /** - * @brief 테이블 기생성 여부 return + * @brief returns if the table already exists **/ function isTableExists($target_name) { $query = sprintf("select rdb\$relation_name from rdb\$relations where rdb\$system_flag=0 and rdb\$relation_name = '%s%s';", $this->prefix, $target_name); @@ -392,7 +379,7 @@ } /** - * @brief 특정 테이블에 특정 column 추가 + * @brief add a column to the table **/ function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) { $type = $this->column_type[$type]; @@ -412,7 +399,7 @@ } /** - * @brief 특정 테이블에 특정 column 제거 + * @brief drop a column from the table **/ function dropColumn($table_name, $column_name) { $query = sprintf("alter table %s%s drop %s ", $this->prefix, $table_name, $column_name); @@ -422,7 +409,7 @@ /** - * @brief 특정 테이블의 column의 정보를 return + * @brief return column information of the table **/ function isColumnExists($table_name, $column_name) { $query = sprintf("SELECT RDB\$FIELD_NAME as \"FIELD\" FROM RDB\$RELATION_FIELDS WHERE RDB\$RELATION_NAME = '%s%s'", $this->prefix, $table_name); @@ -446,15 +433,14 @@ } /** - * @brief 특정 테이블에 특정 인덱스 추가 + * @brief add an index to the table * $target_columns = array(col1, col2) * $is_unique? unique : none **/ function addIndex($table_name, $index_name, $target_columns, $is_unique = false) { - // index name 크기가 31byte로 제한으로 index name을 넣지 않음 - // Firebird에서는 index name을 넣지 않으면 "RDB$10"처럼 자동으로 이름을 부여함 - // table을 삭제 할 경우 인덱스도 자동으로 삭제 됨 - + // index name size should be limited to 31 byte. no index name assigned + // if index name omitted, Firebird automatically assign its name like "RDB $10" + // deletes indexes when deleting the table if(!is_array($target_columns)) $target_columns = array($target_columns); $query = sprintf('CREATE %s INDEX "" ON "%s%s" ("%s");', $is_unique?'UNIQUE':'', $this->prefix, $table_name, implode('", "',$target_columns)); @@ -464,7 +450,7 @@ } /** - * @brief 특정 테이블의 특정 인덱스 삭제 + * @brief drop an index from the table **/ function dropIndex($table_name, $index_name, $is_unique = false) { $query = sprintf('DROP INDEX "%s" ON "%s%s"', $index_name, $this->prefix, $table_name); @@ -475,7 +461,7 @@ /** - * @brief 특정 테이블의 index 정보를 return + * @brief return index information of the table **/ function isIndexExists($table_name, $index_name) { $query = "SELECT\n"; @@ -512,24 +498,24 @@ } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief creates a table by using xml file **/ function createTableByXml($xml_doc) { return $this->_createTable($xml_doc); } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief creates a table by using xml file **/ function createTableByXmlFile($file_name) { if(!file_exists($file_name)) return; - // xml 파일을 읽음 + // read xml file $buff = FileHandler::readFile($file_name); return $this->_createTable($buff); } /** - * @brief schema xml을 이용하여 create table query생성 + * @brief create table by using the schema xml * * type : number, varchar, text, char, date, \n * opt : notnull, default, size\n @@ -539,8 +525,7 @@ // xml parsing $oXml = new XmlParser(); $xml_obj = $oXml->parse($xml_doc); - - // 테이블 생성 schema 작성 + // Create a table schema $table_name = $xml_obj->table->attrs->name; if($this->isTableExists($table_name)) return; $table_name = $this->prefix.$table_name; @@ -596,10 +581,9 @@ if(count($index_list)) { foreach($index_list as $key => $val) { - // index name 크기가 31byte로 제한으로 index name을 넣지 않음 - // Firebird에서는 index name을 넣지 않으면 "RDB$10"처럼 자동으로 이름을 부여함 - // table을 삭제 할 경우 인덱스도 자동으로 삭제 됨 - + // index name size should be limited to 31 byte. no index name assigned + // if index name omitted, Firebird automatically assign its name like "RDB $10" + // deletes indexes when deleting the table $schema = sprintf("CREATE INDEX \"\" ON \"%s\" (\"%s\");", $table_name, implode($val, "\",\"")); $output = $this->_query($schema); @@ -613,12 +597,11 @@ $output = $this->_query($schema); if(!$this->transaction_started) @ibase_commit($this->fd); if(!$output) return false; - - // Firebird에서 auto increment는 generator를 만들어 insert 발생시 트리거를 실행시켜 - // generator의 값을 증가시키고 그값을 테이블에 넣어주는 방식을 사용함. - // 아래 트리거가 auto increment 역할을 하지만 쿼리로 트리거 등록이 되지 않아 주석처리 하였음. - // php 함수에서 generator 값을 증가시켜 주는 함수가 있어 XE에서는 굳이 - // auto increment를 사용 할 필요가 없어보임. + // auto_increment in Firebird creates a generator which activates a trigger when insert occurs + // the generator increases the value of the generator and then insert to the table + // The trigger below acts like auto_increment however I commented the below because the trigger cannot be defined by a query statement + // php api has a function to increase a generator, so + // no need to use auto increment in XE /* $schema = 'SET TERM ^ ; '; $schema .= sprintf('CREATE TRIGGER "%s_BI" FOR "%s" ', $table_name, $table_name); @@ -634,7 +617,7 @@ } /** - * @brief 조건문 작성하여 return + * @brief Return conditional clause **/ function getCondition($output) { if(!$output->conditions) return; @@ -683,15 +666,14 @@ } /** - * @brief insertAct 처리 + * @brief Handle the insertAct **/ function _executeInsertAct($output) { - // 테이블 정리 + // tables foreach($output->tables as $key => $val) { $table_list[] = '"'.$this->prefix.$val.'"'; } - - // 컬럼 정리 + // Columns foreach($output->columns as $key => $val) { $name = $val['name']; $value = $val['value']; @@ -721,15 +703,14 @@ } /** - * @brief updateAct 처리 + * @brief handles updateAct **/ function _executeUpdateAct($output) { - // 테이블 정리 + // Tables foreach($output->tables as $key => $val) { $table_list[] = '"'.$this->prefix.$val.'"'; } - - // 컬럼 정리 + // Columns foreach($output->columns as $key => $val) { if(!isset($val['value'])) continue; $name = $val['name']; @@ -747,7 +728,7 @@ else if($output->column_type[$name]=='number' || $output->column_type[$name]=='bignumber' || $output->column_type[$name]=='float') { - // 연산식이 들어갔을 경우 컬럼명이 있는 지 체크해 더블쿼터를 넣어줌 + // put double-quotes on column name if an expression is entered preg_match("/(?i)[a-z][a-z0-9_]+/", $value, $matches); foreach($matches as $key => $val) { @@ -764,8 +745,7 @@ $column_list[] = sprintf('"%s" = ?', $name); } } - - // 조건절 정리 + // conditional clause $condition = $this->getCondition($output); $query = sprintf("update %s set %s %s;", implode(',',$table_list), implode(',',$column_list), $condition); @@ -775,15 +755,14 @@ } /** - * @brief deleteAct 처리 + * @brief handles deleteAct **/ function _executeDeleteAct($output) { - // 테이블 정리 + // Tables foreach($output->tables as $key => $val) { $table_list[] = '"'.$this->prefix.$val.'"'; } - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); $query = sprintf("delete from %s %s;", implode(',',$table_list), $condition); @@ -794,13 +773,13 @@ } /** - * @brief selectAct 처리 + * @brief Handle selectAct * - * select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n - * navigation이라는 method를 제공 + * In order to get a list of pages easily when selecting \n + * it supports a method as navigation **/ function _executeSelectAct($output) { - // 테이블 정리 + // Tables $table_list = array(); foreach($output->tables as $key => $val) { $table_list[] = sprintf("\"%s%s\" as \"%s\"", $this->prefix, $val, $key); @@ -839,8 +818,7 @@ $output->column_list = $column_list; if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output); - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // query added in the condition to use an index when ordering by list_order, update_order if($output->order) { $conditions = $this->getConditionList($output); if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { @@ -852,8 +830,7 @@ } } } - - // list_count를 사용할 경우 적용 + // apply when using list_count if($output->list_count['value']) $limit = sprintf('FIRST %d', $output->list_count['value']); else $limit = ''; @@ -910,9 +887,9 @@ } /** - * @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다 + * @brief paginates when navigation info exists in the query xml * - * 그닥 좋지는 않은 구조이지만 편리하다.. -_-; + * it is convenient although its structure is not good .. -_-; **/ function _getNavigationData($table_list, $columns, $left_join, $condition, $output) { require_once(_XE_PATH_.'classes/page/PageHandler.class.php'); @@ -929,8 +906,8 @@ } /* - // group by 절이 포함된 SELECT 쿼리의 전체 갯수를 구하기 위한 수정 - // 정상적인 동작이 확인되면 주석으로 막아둔 부분으로 대체합니다. + // modified to get the number of rows by SELECT query with group by clause + // activate the commented codes when you confirm it works correctly // $count_condition = strlen($query_groupby) ? sprintf('%s group by %s', $condition, $query_groupby) : $condition; $total_count = $this->getCountCache($output->tables, $count_condition); @@ -944,8 +921,7 @@ $this->putCountCache($output->tables, $count_condition, $total_count); } */ - - // 전체 개수를 구함 + // total number of rows $count_query = sprintf("select count(*) as \"count\" from %s %s %s", implode(',',$table_list),implode(' ',$left_join), $condition); $count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):''; $result = $this->_query($count_query); @@ -960,16 +936,13 @@ if(!$page_count) $page_count = 10; $page = $output->page['value']; if(!$page) $page = 1; - - // 전체 페이지를 구함 + // total pages if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1; else $total_page = 1; - - // 페이지 변수를 체크 + // check the page variables if($page > $total_page) $page = $total_page; $start_count = ($page-1)*$list_count; - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // query added in the condition to use an index when ordering by list_order, update_order if($output->order) { $conditions = $this->getConditionList($output); if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { @@ -1025,12 +998,11 @@ while($tmp = ibase_fetch_object($result)) { foreach($tmp as $key => $val){ $type = $output->column_type[$key]; - - // type 값이 null 일때는 $key값이 alias인 경우라 실제 column 이름을 찾아 type을 구함 + // $key value is an alias when type value is null. get type by finding the actual column name if($type == null && $output->columns && count($output->columns)) { foreach($output->columns as $cols) { if($cols['alias'] == $key) { - // table.column 형식인지 정규식으로 검사 함 + // checks if the format is table.column or a regular expression preg_match("/\w+[.](\w+)/", $cols['name'], $matches); if($matches) { $type = $output->column_type[$matches[1]]; diff --git a/classes/db/DBMssql.class.php b/classes/db/DBMssql.class.php index 3a0b75bb0..0bebd948c 100644 --- a/classes/db/DBMssql.class.php +++ b/classes/db/DBMssql.class.php @@ -3,26 +3,26 @@ /** * @class DBMSSQL * @author NHN (developers@xpressengine.com) - * @brief MSSQL driver로 수정 sol (sol@ngleader.com) + * @brief Modified to use MSSQL driver by sol (sol@ngleader.com) * @version 0.1 **/ class DBMssql extends DB { /** - * DB를 이용하기 위한 정보 + * information to connect to DB **/ var $conn = NULL; var $database = NULL; ///< database - var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE 설치 가능) + var $prefix = 'xe'; // / 'bigint', @@ -52,7 +52,7 @@ } /** - * @brief 설치 가능 여부를 return + * @brief Return if installable **/ function isSupported() { if (!extension_loaded("sqlsrv")) return false; @@ -60,7 +60,7 @@ } /** - * @brief DB정보 설정 및 connect/ close + * @brief DB settings and connect/close **/ function _setDBInfo() { $db_info = Context::getDBInfo(); @@ -75,10 +75,10 @@ } /** - * @brief DB 접속 + * @brief DB Connection **/ function _connect() { - // db 정보가 없으면 무시 + // ignore if db information not exists if(!$this->hostname || !$this->database) return; //sqlsrv_configure( 'WarningsReturnAsErrors', 0 ); @@ -89,7 +89,8 @@ array( 'Database' => $this->database,'UID'=>$this->userid,'PWD'=>$this->password )); - // 접속체크 +// Check connections + if($this->conn){ $this->is_connected = true; $this->password = md5($this->password); @@ -99,7 +100,7 @@ } /** - * @brief DB접속 해제 + * @brief DB disconnect **/ function close() { if($this->is_connected == false) return; @@ -110,7 +111,7 @@ } /** - * @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절 + * @brief handles quatation of the string variables from the query **/ function addQuotes($string) { if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string)); @@ -120,7 +121,7 @@ } /** - * @brief 트랜잭션 시작 + * @brief Begin transaction **/ function begin() { if($this->is_connected == false || $this->transaction_started) return; @@ -130,7 +131,7 @@ } /** - * @brief 롤백 + * @brief Rollback **/ function rollback() { if($this->is_connected == false || !$this->transaction_started) return; @@ -140,7 +141,7 @@ } /** - * @brief 커밋 + * @brief Commit **/ function commit($force = false) { if(!$force && ($this->is_connected == false || !$this->transaction_started)) return; @@ -150,13 +151,13 @@ } /** - * @brief : 쿼리문의 실행 및 결과의 fetch 처리 + * @brief : executing the query and fetching the result * - * query : query문 실행하고 result return\n - * fetch : reutrn 된 값이 없으면 NULL\n - * rows이면 array object\n - * row이면 object\n - * return\n + * query: run a query and return the result\n + * fetch: NULL if no value returned \n + * array object if rows returned \n + * object if a row returned \n + * return\n **/ function _query($query) { if($this->is_connected == false || !$query) return; @@ -173,21 +174,21 @@ } } - // 쿼리 시작을 알림 + // Notify to start a query execution $this->actStart($query); - // 쿼리 문 실행 + // Run the query statement $result = false; if(count($_param)){ $result = @sqlsrv_query($this->conn, $query, $_param); }else{ $result = @sqlsrv_query($this->conn, $query); } - - // 오류 체크 +// Error Check + if(!$result) $this->setError(print_r(sqlsrv_errors(),true)); - // 쿼리 실행 종료를 알림 + // Notify to complete a query execution $this->actFinish(); $this->param = array(); @@ -195,7 +196,7 @@ } /** - * @brief 결과를 fetch + * @brief Fetch results **/ function _fetch($result) { if(!$this->isConnected() || $this->isError() || !$result) return; @@ -219,7 +220,7 @@ } /** - * @brief 1씩 증가되는 sequence값을 return (mssql의 auto_increment는 sequence테이블에서만 사용) + * @brief Return sequence value incremented by 1(auto_increment is usd in the sequence table only) **/ function getNextSequence() { $query = sprintf("insert into %ssequence (seq) values (ident_incr('%ssequence'))", $this->prefix, $this->prefix); @@ -234,7 +235,7 @@ } /** - * @brief 테이블 기생성 여부 return + * @brief Return if a table already exists **/ function isTableExists($target_name) { $query = sprintf("select name from sysobjects where name = '%s%s' and xtype='U'", $this->prefix, $this->addQuotes($target_name)); @@ -246,7 +247,7 @@ } /** - * @brief 특정 테이블에 특정 column 추가 + * @brief Add a column to a table **/ function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) { if($this->isColumnExists($table_name, $column_name)) return; @@ -263,7 +264,7 @@ } /** - * @brief 특정 테이블에 특정 column 제거 + * @brief Delete a column from a table **/ function dropColumn($table_name, $column_name) { if(!$this->isColumnExists($table_name, $column_name)) return; @@ -272,7 +273,7 @@ } /** - * @brief 특정 테이블의 column의 정보를 return + * @brief Return column information of a table **/ function isColumnExists($table_name, $column_name) { $query = sprintf("select syscolumns.name as name from syscolumns, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = syscolumns.id and syscolumns.name = '%s'", $this->prefix, $table_name, $column_name); @@ -284,7 +285,7 @@ } /** - * @brief 특정 테이블에 특정 인덱스 추가 + * @brief Add an index to a table * $target_columns = array(col1, col2) * $is_unique? unique : none **/ @@ -297,7 +298,7 @@ } /** - * @brief 특정 테이블의 특정 인덱스 삭제 + * @brief Drop an index from a table **/ function dropIndex($table_name, $index_name, $is_unique = false) { if(!$this->isIndexExists($table_name, $index_name)) return; @@ -306,7 +307,7 @@ } /** - * @brief 특정 테이블의 index 정보를 return + * @brief Return index information of a table **/ function isIndexExists($table_name, $index_name) { $query = sprintf("select sysindexes.name as name from sysindexes, sysobjects where sysobjects.name = '%s%s' and sysobjects.id = sysindexes.id and sysindexes.name = '%s'", $this->prefix, $table_name, $index_name); @@ -320,24 +321,24 @@ } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief Create a table by using xml file **/ function createTableByXml($xml_doc) { return $this->_createTable($xml_doc); } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief Create a table by using xml file **/ function createTableByXmlFile($file_name) { if(!file_exists($file_name)) return; - // xml 파일을 읽음 + // read xml file $buff = FileHandler::readFile($file_name); return $this->_createTable($buff); } /** - * @brief schema xml을 이용하여 create table query생성 + * @brief generate a query statement to create a table by using schema xml * * type : number, varchar, text, char, date, \n * opt : notnull, default, size\n @@ -347,8 +348,7 @@ // xml parsing $oXml = new XmlParser(); $xml_obj = $oXml->parse($xml_doc); - - // 테이블 생성 schema 작성 + // Create a table schema $table_name = $xml_obj->table->attrs->name; if($this->isTableExists($table_name)) return; @@ -409,7 +409,7 @@ } /** - * @brief 조건문 작성하여 return + * @brief Return conditional clause **/ function getCondition($output) { if(!$output->conditions) return; @@ -525,16 +525,15 @@ } /** - * @brief insertAct 처리 + * @brief Handle the insertAct **/ function _executeInsertAct($output) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[] = '['.$this->prefix.$val.']'; } - - // 컬럼 정리 + // List columns foreach($output->columns as $key => $val) { $name = $val['name']; $value = $val['value']; @@ -561,15 +560,16 @@ } /** - * @brief updateAct 처리 + * @brief Handle updateAct **/ function _executeUpdateAct($output) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[] = '['.$this->prefix.$val.']'; } - // 컬럼 정리 +// List columns + foreach($output->columns as $key => $val) { if(!isset($val['value'])) continue; @@ -597,8 +597,7 @@ } } - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); $query = sprintf("update %s set %s %s", implode(',',$table_list), implode(',',$column_list), $condition); @@ -607,15 +606,14 @@ } /** - * @brief deleteAct 처리 + * @brief Handle deleteAct **/ function _executeDeleteAct($output) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[] = '['.$this->prefix.$val.']'; } - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); $query = sprintf("delete from %s %s", implode(',',$table_list), $condition); @@ -624,13 +622,13 @@ } /** - * @brief selectAct 처리 + * @brief Handle selectAct * - * select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n - * navigation이라는 method를 제공 + * In order to get a list of pages easily when selecting \n + * it supports a method as navigation **/ function _executeSelectAct($output) { - // 테이블 정리 + // List tables $table_list = array(); foreach($output->tables as $key => $val) { $table_list[] = '['.$this->prefix.$val.'] as '.$key; @@ -675,8 +673,7 @@ $output->column_list = $column_list; if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output); - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // Add a condition to use an index when sorting in order by list_order, update_order if($output->order) { $conditions = $this->getConditionList($output); if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { @@ -718,7 +715,7 @@ } $query = sprintf("%s from %s %s %s %s", $columns, implode(',',$table_list),implode(' ',$left_join), $condition, $groupby_query.$orderby_query); - // list_count를 사용할 경우 적용 + // Apply when using list_count if($output->list_count['value']) $query = sprintf('select top %d %s', $output->list_count['value'], $query); else $query = "select ".$query; @@ -741,16 +738,16 @@ } /** - * @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다 + * @brief Paging is handled if navigation information exists in the query xml * - * 그닥 좋지는 않은 구조이지만 편리하다.. -_-; + * It is quite convenient although its structure is not good at all .. -_-; **/ function _getNavigationData($table_list, $columns, $left_join, $condition, $output) { require_once(_XE_PATH_.'classes/page/PageHandler.class.php'); $column_list = $output->column_list; - // 전체 개수를 구함 + // Get a total count if(count($output->groups)){ foreach($output->groups as $k => $v ){ if(preg_match('/^substr\(/i',$v)) $output->groups[$k] = preg_replace('/^substr\(/i','substring(',$v); @@ -780,16 +777,13 @@ if(!$page_count) $page_count = 10; $page = $output->page['value']; if(!$page) $page = 1; - - // 전체 페이지를 구함 + // Get a total page if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1; else $total_page = 1; - - // 페이지 변수를 체크 + // Check Page variables if($page > $total_page) $page = $total_page; $start_count = ($page-1)*$list_count; - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // Add a condition to use an index when sorting in order by list_order, update_order $conditions = $this->getConditionList($output); if($output->order) { if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { @@ -802,7 +796,7 @@ } } - // group by 절 추가 + // Add group by clause if(count($output->groups)){ foreach($output->groups as $k => $v ){ if(preg_match('/^substr\(/i',$v)) $output->groups[$k] = preg_replace('/^substr\(/i','substring(',$v); @@ -812,7 +806,7 @@ $group = sprintf('group by %s', implode(',',$output->groups)); } - // order 절 추가 + // Add order by clause $order_targets = array(); if($output->order) { foreach($output->order as $key => $val) { @@ -848,7 +842,7 @@ $first_sub_columns[] = $k; } - // 1차로 order 대상에 해당 하는 값을 가져옴 + // Fetch values to sort $param = $this->param; $first_query = sprintf("select %s from (select top %d %s from %s %s %s %s %s) xet", implode(',',$first_columns), $start_count, implode(',',$first_sub_columns), implode(',',$table_list), implode(' ',$left_join), $condition, $group, $order); $result = $this->_query($first_query); @@ -857,7 +851,7 @@ - // 1차에서 나온 값을 이용 다시 쿼리 실행 + // Re-execute a query by using fetched values $sub_cond = array(); foreach($order_targets as $k => $v) { $sub_cond[] = sprintf("%s %s '%s'", $k, $v=='asc'?'>':'<', $tmp->{$k}); diff --git a/classes/db/DBMysql.class.php b/classes/db/DBMysql.class.php index 1caab871c..e34fe35d9 100644 --- a/classes/db/DBMysql.class.php +++ b/classes/db/DBMysql.class.php @@ -2,7 +2,7 @@ /** * @class DBMysql * @author NHN (developers@xpressengine.com) - * @brief MySQL DBMS를 이용하기 위한 class + * @brief Class to use MySQL DBMS * @version 0.1 * * mysql handling class @@ -11,20 +11,20 @@ class DBMysql extends DB { /** - * @brief Mysql DB에 접속하기 위한 정보 + * @brief Connection information for Mysql DB **/ var $hostname = '127.0.0.1'; ///< hostname var $userid = NULL; ///< user id var $password = NULL; ///< password var $database = NULL; ///< database - var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE 설치 가능) + var $prefix = 'xe'; // / 'bigint', @@ -50,7 +50,7 @@ } /** - * @brief 설치 가능 여부를 return + * @brief Return if it is installable **/ function isSupported() { if(!function_exists('mysql_connect')) return false; @@ -58,7 +58,7 @@ } /** - * @brief DB정보 설정 및 connect/ close + * @brief DB settings and connect/close **/ function _setDBInfo() { $db_info = Context::getDBInfo(); @@ -72,44 +72,39 @@ } /** - * @brief DB 접속 + * @brief DB Connection **/ function _connect() { - // db 정보가 없으면 무시 + // Ignore if no DB information exists if(!$this->hostname || !$this->userid || !$this->password || !$this->database) return; if(strpos($this->hostname, ':')===false && $this->port) $this->hostname .= ':'.$this->port; - - // 접속시도 + // Attempt to connect $this->fd = @mysql_connect($this->hostname, $this->userid, $this->password); if(mysql_error()) { $this->setError(mysql_errno(), mysql_error()); return; } - - // 버전 확인후 4.1 이하면 오류 표시 + // Error appears if the version is lower than 4.1 if(mysql_get_server_info($this->fd)<"4.1") { $this->setError(-1, "XE cannot be installed under the version of mysql 4.1. Current mysql version is ".mysql_get_server_info()); return; } - - // db 선택 + // select db @mysql_select_db($this->database, $this->fd); if(mysql_error()) { $this->setError(mysql_errno(), mysql_error()); return; } - - // 접속체크 + // Check connections $this->is_connected = true; $this->password = md5($this->password); - - // mysql의 경우 utf8임을 지정 + // Set utf8 if a database is MySQL $this->_query("set names 'utf8'"); } /** - * @brief DB접속 해제 + * @brief DB disconnection **/ function close() { if(!$this->isConnected()) return; @@ -117,7 +112,7 @@ } /** - * @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절 + * @brief Add quotes on the string variables in a query **/ function addQuotes($string) { if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string)); @@ -126,53 +121,48 @@ } /** - * @brief 트랜잭션 시작 + * @brief Begin transaction **/ function begin() { } /** - * @brief 롤백 + * @brief Rollback **/ function rollback() { } /** - * @brief 커밋 + * @brief Commits **/ function commit() { } /** - * @brief : 쿼리문의 실행 및 결과의 fetch 처리 + * @brief : Run a query and fetch the result * - * query : query문 실행하고 result return\n - * fetch : reutrn 된 값이 없으면 NULL\n - * rows이면 array object\n - * row이면 object\n + * query: run a query and return the result \n + * fetch: NULL if no value is returned \n + * array object if rows are returned \n + * object if a row is returned \n * return\n **/ function _query($query) { if(!$this->isConnected()) return; - - // 쿼리 시작을 알림 + // Notify to start a query execution $this->actStart($query); - - // 쿼리 문 실행 + // Run the query statement $result = @mysql_query($query, $this->fd); - - // 오류 체크 + // Error Check if(mysql_error($this->fd)) $this->setError(mysql_errno($this->fd), mysql_error($this->fd)); - - // 쿼리 실행 종료를 알림 + // Notify to complete a query execution $this->actFinish(); - - // 결과 리턴 + // Return result return $result; } /** - * @brief 결과를 fetch + * @brief Fetch results **/ function _fetch($result) { if(!$this->isConnected() || $this->isError() || !$result) return; @@ -184,7 +174,7 @@ } /** - * @brief 1씩 증가되는 sequence값을 return (mysql의 auto_increment는 sequence테이블에서만 사용) + * @brief Return sequence value incremented by 1(auto_increment is used in sequence table only in MySQL) **/ function getNextSequence() { $query = sprintf("insert into `%ssequence` (seq) values ('0')", $this->prefix); @@ -199,7 +189,7 @@ } /** - * @brief mysql old password를 가져오는 함수 (mysql에서만 사용) + * @brief Function to obtain mysql old password(mysql only) **/ function isValidOldPassword($password, $saved_password) { $query = sprintf("select password('%s') as password, old_password('%s') as old_password", $this->addQuotes($password), $this->addQuotes($password)); @@ -210,7 +200,7 @@ } /** - * @brief 테이블 기생성 여부 return + * @brief Return if a table already exists **/ function isTableExists($target_name) { $query = sprintf("show tables like '%s%s'", $this->prefix, $this->addQuotes($target_name)); @@ -221,7 +211,7 @@ } /** - * @brief 특정 테이블에 특정 column 추가 + * @brief Add a column to a table **/ function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) { $type = $this->column_type[$type]; @@ -237,7 +227,7 @@ } /** - * @brief 특정 테이블에 특정 column 제거 + * @brief Delete a column from a table **/ function dropColumn($table_name, $column_name) { $query = sprintf("alter table `%s%s` drop `%s` ", $this->prefix, $table_name, $column_name); @@ -245,7 +235,7 @@ } /** - * @brief 특정 테이블의 column의 정보를 return + * @brief Return column information of a table **/ function isColumnExists($table_name, $column_name) { $query = sprintf("show fields from `%s%s`", $this->prefix, $table_name); @@ -263,7 +253,7 @@ } /** - * @brief 특정 테이블에 특정 인덱스 추가 + * @brief Add an index to a table * $target_columns = array(col1, col2) * $is_unique? unique : none **/ @@ -275,7 +265,7 @@ } /** - * @brief 특정 테이블의 특정 인덱스 삭제 + * @brief Drop an index from a table **/ function dropIndex($table_name, $index_name, $is_unique = false) { $query = sprintf("alter table `%s%s` drop index `%s`", $this->prefix, $table_name, $index_name); @@ -284,7 +274,7 @@ /** - * @brief 특정 테이블의 index 정보를 return + * @brief Return index information of a table **/ function isIndexExists($table_name, $index_name) { //$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name); @@ -302,24 +292,24 @@ } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief Create a table by using xml file **/ function createTableByXml($xml_doc) { return $this->_createTable($xml_doc); } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief Create a table by using xml file **/ function createTableByXmlFile($file_name) { if(!file_exists($file_name)) return; - // xml 파일을 읽음 + // read xml file $buff = FileHandler::readFile($file_name); return $this->_createTable($buff); } /** - * @brief schema xml을 이용하여 create table query생성 + * @brief generate a query statement to create a table by using schema xml * * type : number, varchar, text, char, date, \n * opt : notnull, default, size\n @@ -329,8 +319,7 @@ // xml parsing $oXml = new XmlParser(); $xml_obj = $oXml->parse($xml_doc); - - // 테이블 생성 schema 작성 + // Create a table schema $table_name = $xml_obj->table->attrs->name; if($this->isTableExists($table_name)) return; $table_name = $this->prefix.$table_name; @@ -386,7 +375,7 @@ } /** - * @brief 조건문 작성하여 return + * @brief Return conditional clause **/ function getCondition($output) { if(!$output->conditions) return; @@ -429,15 +418,14 @@ } /** - * @brief insertAct 처리 + * @brief Handle the insertAct **/ function _executeInsertAct($output) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[] = '`'.$this->prefix.$val.'`'; } - - // 컬럼 정리 + // List columns foreach($output->columns as $key => $val) { $name = $val['name']; $value = $val['value']; @@ -466,15 +454,14 @@ } /** - * @brief updateAct 처리 + * @brief Handle updateAct **/ function _executeUpdateAct($output) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[] = '`'.$this->prefix.$val.'` as '.$key; } - - // 컬럼 정리 + // List columns foreach($output->columns as $key => $val) { if(!isset($val['value'])) continue; $name = $val['name']; @@ -487,8 +474,7 @@ $column_list[] = sprintf("`%s` = %s", $name, $value); } } - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); $query = sprintf("update %s set %s %s", implode(',',$table_list), implode(',',$column_list), $condition); @@ -497,15 +483,14 @@ } /** - * @brief deleteAct 처리 + * @brief Handle deleteAct **/ function _executeDeleteAct($output) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[] = '`'.$this->prefix.$val.'`'; } - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); $query = sprintf("delete from %s %s", implode(',',$table_list), $condition); @@ -514,13 +499,13 @@ } /** - * @brief selectAct 처리 + * @brief Handle selectAct * - * select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n - * navigation이라는 method를 제공 + * In order to get a list of pages easily when selecting \n + * it supports a method as navigation **/ function _executeSelectAct($output) { - // 테이블 정리 + // List tables $table_list = array(); foreach($output->tables as $key => $val) { $table_list[] = '`'.$this->prefix.$val.'` as '.$key; @@ -584,8 +569,7 @@ $condition = $this->getCondition($output); if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output); - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // Add a condition to use an index when sorting in order by list_order, update_order if($output->order) { $conditions = $this->getConditionList($output); if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { @@ -633,7 +617,7 @@ $query = sprintf("select %s from %s %s %s %s", $columns, implode(',',$table_list),implode(' ',$left_join), $condition, $groupby_query.$orderby_query); - // list_count를 사용할 경우 적용 + // Apply when using list_count if($output->list_count['value']) $query = sprintf('%s limit %d', $query, $output->list_count['value']); $query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):''; @@ -656,16 +640,16 @@ } /** - * @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다 + * @brief Paging is handled if navigation information exists in the query xml * - * 그닥 좋지는 않은 구조이지만 편리하다.. -_-; + * It is quite convenient although its structure is not good at all .. -_-; **/ function _getNavigationData($table_list, $columns, $left_join, $condition, $output) { require_once(_XE_PATH_.'classes/page/PageHandler.class.php'); $column_list = $output->column_list; - // 전체 개수를 구함 + // Get a total count $count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition; $count_query = sprintf("select count(*) as count from %s %s %s", implode(', ', $table_list), implode(' ', $left_join), $count_condition); if (count($output->groups)) $count_query = sprintf('select count(*) as count from (%s) xet', $count_query); @@ -681,16 +665,13 @@ if(!$page_count) $page_count = 10; $page = $output->page['value']; if(!$page) $page = 1; - - // 전체 페이지를 구함 + // Get a total page if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1; else $total_page = 1; - - // 페이지 변수를 체크 + // Check Page variables if($page > $total_page) $page = $total_page; $start_count = ($page-1)*$list_count; - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // Add a condition to use an index when sorting in order by list_order, update_order if($output->order) { $conditions = $this->getConditionList($output); if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { diff --git a/classes/db/DBMysql_innodb.class.php b/classes/db/DBMysql_innodb.class.php index 2ada937b0..0c0a6bc87 100644 --- a/classes/db/DBMysql_innodb.class.php +++ b/classes/db/DBMysql_innodb.class.php @@ -4,7 +4,7 @@ /** * @class DBMysql_innodb * @author NHN (developers@xpressengine.com) - * @brief MySQL DBMS를 이용하기 위한 class + * @brief class to use MySQL DBMS * @version 0.1 * * mysql innodb handling class @@ -29,7 +29,7 @@ } /** - * @brief DB접속 해제 + * @brief DB disconnection **/ function close() { if(!$this->isConnected()) return; @@ -38,7 +38,7 @@ } /** - * @brief 트랜잭션 시작 + * @brief Begin transaction **/ function begin() { if(!$this->isConnected() || $this->transaction_started) return; @@ -47,7 +47,7 @@ } /** - * @brief 롤백 + * @brief Rollback **/ function rollback() { if(!$this->isConnected() || !$this->transaction_started) return; @@ -56,7 +56,7 @@ } /** - * @brief 커밋 + * @brief Commits **/ function commit($force = false) { if(!$force && (!$this->isConnected() || !$this->transaction_started)) return; @@ -65,35 +65,30 @@ } /** - * @brief : 쿼리문의 실행 및 결과의 fetch 처리 + * @brief : Run a query and fetch the result * - * query : query문 실행하고 result return\n - * fetch : reutrn 된 값이 없으면 NULL\n - * rows이면 array object\n - * row이면 object\n + * query: run a query and return the result \n + * fetch: NULL if no value is returned \n + * array object if rows are returned \n + * object if a row is returned \n * return\n **/ function _query($query) { if(!$this->isConnected()) return; - - // 쿼리 시작을 알림 + // Notify to start a query execution $this->actStart($query); - - // 쿼리 문 실행 + // Run the query statement $result = @mysql_query($query, $this->fd); - - // 오류 체크 + // Error Check if(mysql_error($this->fd)) $this->setError(mysql_errno($this->fd), mysql_error($this->fd)); - - // 쿼리 실행 종료를 알림 + // Notify to complete a query execution $this->actFinish(); - - // 결과 리턴 + // Return result return $result; } /** - * @brief schema xml을 이용하여 create table query생성 + * @brief generate a query statement to create a table by using schema xml * * type : number, varchar, text, char, date, \n * opt : notnull, default, size\n @@ -103,8 +98,7 @@ // xml parsing $oXml = new XmlParser(); $xml_obj = $oXml->parse($xml_doc); - - // 테이블 생성 schema 작성 + // Create a table schema $table_name = $xml_obj->table->attrs->name; if($this->isTableExists($table_name)) return; $table_name = $this->prefix.$table_name; diff --git a/classes/db/DBMysqli.class.php b/classes/db/DBMysqli.class.php index 354571fd8..ff37d9871 100644 --- a/classes/db/DBMysqli.class.php +++ b/classes/db/DBMysqli.class.php @@ -3,7 +3,7 @@ /** * @class DBMysqli * @author NHN (developers@xpressengine.com) - * @brief MySQL DBMS를 mysqli_* 로 이용하기 위한 class + * @brief Class to use MySQL DBMS as mysqli_* * @version 0.1 * * mysql handling class @@ -21,7 +21,7 @@ } /** - * @brief 설치 가능 여부를 return + * @brief Return if it is installable **/ function isSupported() { if(!function_exists('mysqli_connect')) return false; @@ -37,13 +37,12 @@ } /** - * @brief DB 접속 + * @brief DB Connection **/ function _connect() { - // db 정보가 없으면 무시 + // Ignore if no DB information exists if(!$this->hostname || !$this->userid || !$this->password || !$this->database) return; - - // 접속시도 + // Attempt to connect if($this->port){ $this->fd = @mysqli_connect($this->hostname, $this->userid, $this->password, $this->database, $this->port); }else{ @@ -55,14 +54,13 @@ return; } mysqli_set_charset($this->fd,'utf8'); - - // 접속체크 + // Check connections $this->is_connected = true; $this->password = md5($this->password); } /** - * @brief DB접속 해제 + * @brief DB disconnection **/ function close() { if(!$this->isConnected()) return; @@ -70,7 +68,7 @@ } /** - * @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절 + * @brief Add quotes on the string variables in a query **/ function addQuotes($string) { if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string)); @@ -79,32 +77,29 @@ } /** - * @brief : 쿼리문의 실행 및 결과의 fetch 처리 + * @brief : Run a query and fetch the result * - * query : query문 실행하고 result return\n - * fetch : reutrn 된 값이 없으면 NULL\n - * rows이면 array object\n - * row이면 object\n + * query: run a query and return the result \n + * fetch: NULL if no value is returned \n + * array object if rows are returned \n + * object if a row is returned \n * return\n **/ function _query($query) { if(!$this->isConnected()) return; - - // 쿼리 시작을 알림 + // Notify to start a query execution $this->actStart($query); - - // 쿼리 문 실행 + // Run the query statement $result = mysqli_query($this->fd,$query); - // 오류 체크 + // Error Check $error = mysqli_error($this->fd); if($error){ $this->setError(mysqli_errno($this->fd), $error); } - // 쿼리 실행 종료를 알림 + // Notify to complete a query execution $this->actFinish(); - - // 결과 리턴 + // Return result return $result; } diff --git a/classes/db/DBPostgresql.class.php b/classes/db/DBPostgresql.class.php index 308b495b4..a9fa38653 100644 --- a/classes/db/DBPostgresql.class.php +++ b/classes/db/DBPostgresql.class.php @@ -2,34 +2,34 @@ /** * @class DBPostgreSQL * @author ioseph (ioseph@postgresql.kr) updated by yoonjong.joh@gmail.com - * @brief MySQL DBMS를 이용하기 위한 class + * @brief Class to use PostgreSQL DBMS * @version 0.2 * * postgresql handling class - * 2009.02.10 update 와 delete query를 실행할때 table 이름에 alias 사용하는 것을 없앰. 지원 안함 - * order by clause를 실행할때 함수를 실행 하는 부분을 column alias로 대체. - * 2009.02.11 dropColumn() function이 추가 - * 2009.02.13 addColumn() 함수 변경 + * 2009.02.10 update and delete query for the table name at runtime, eliminating the alias to use. Not Supported + * when running order by clause column alias to run a function to replace parts. + * 2009.02.11 dropColumn() function added + * 2009.02.13 addColumn() function changes **/ class DBPostgresql extends DB { /** - * @brief PostgreSQL DB에 접속하기 위한 정보 + * @brief Connection information for PostgreSQL DB **/ var $hostname = '127.0.0.1'; ///< hostname var $userid = null; ///< user id var $password = null; ///< password var $database = null; ///< database - var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE설치 가능) + var $prefix = 'xe'; // / 'bigint', @@ -60,7 +60,7 @@ class DBPostgresql extends DB } /** - * @brief 설치 가능 여부를 return + * @brief Return if it is installable **/ function isSupported() { @@ -70,7 +70,7 @@ class DBPostgresql extends DB } /** - * @brief DB정보 설정 및 connect/ close + * @brief DB settings and connect/close **/ function _setDBInfo() { @@ -86,40 +86,36 @@ class DBPostgresql extends DB } /** - * @brief DB 접속 + * @brief DB Connection **/ function _connect() { - // pg용 connection string + // the connection string for PG $conn_string = ""; - - // db 정보가 없으면 무시 + // Ignore if no DB information exists if (!$this->hostname || !$this->userid || !$this->database) return; - - // connection string 만들기 + // Create connection string $conn_string .= ($this->hostname) ? " host=$this->hostname" : ""; $conn_string .= ($this->userid) ? " user=$this->userid" : ""; $conn_string .= ($this->password) ? " password=$this->password" : ""; $conn_string .= ($this->database) ? " dbname=$this->database" : ""; $conn_string .= ($this->port) ? " port=$this->port" : ""; - - // 접속시도 + // Attempt to connect $this->fd = @pg_connect($conn_string); if (!$this->fd || pg_connection_status($this->fd) != PGSQL_CONNECTION_OK) { $this->setError(-1, "CONNECTION FAILURE"); return; } - - // 접속체크 + // Check connections $this->is_connected = true; $this->password = md5($this->password); - // utf8임을 지정 + // Set utf8 //$this ->_query('set client_encoding to uhc'); } /** - * @brief DB접속 해제 + * @brief DB disconnection **/ function close() { @@ -129,7 +125,7 @@ class DBPostgresql extends DB } /** - * @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절 + * @brief Add quotes on the string variables in a query **/ function addQuotes($string) { @@ -141,7 +137,7 @@ class DBPostgresql extends DB } /** - * @brief 트랜잭션 시작 + * @brief Begin transaction **/ function begin() { @@ -152,7 +148,7 @@ class DBPostgresql extends DB } /** - * @brief 롤백 + * @brief Rollback **/ function rollback() { @@ -163,7 +159,7 @@ class DBPostgresql extends DB } /** - * @brief 커밋 + * @brief Commits **/ function commit() { @@ -174,12 +170,12 @@ class DBPostgresql extends DB } /** - * @brief : 쿼리문의 실행 및 결과의 fetch 처리 + * @brief : Run a query and fetch the result * - * query : query문 실행하고 result return\n - * fetch : reutrn 된 값이 없으면 NULL\n - * rows이면 array object\n - * row이면 object\n + * query: run a query and return the result \n + * fetch: NULL if no value is returned \n + * array object if rows are returned \n + * object if a row is returned \n * return\n **/ function _query($query) @@ -208,16 +204,12 @@ class DBPostgresql extends DB } } */ - - // 쿼리 시작을 알림 + // Notify to start a query execution $this->actStart($query); $arr = array('Hello', 'World!', 'Beautiful', 'Day!'); - - - // 쿼리 문 실행 + // Run the query statement $result = @pg_query($this->fd, $query); - - // 오류 체크 + // Error Check if (!$result) { // var_dump($l_query_array); //var_dump($query); @@ -225,16 +217,14 @@ class DBPostgresql extends DB //var_dump(debug_backtrace()); $this->setError(1, pg_last_error($this->fd)); } - - // 쿼리 실행 종료를 알림 + // Notify to complete a query execution $this->actFinish(); - - // 결과 리턴 + // Return result return $result; } /** - * @brief 결과를 fetch + * @brief Fetch results **/ function _fetch($result) { @@ -249,7 +239,7 @@ class DBPostgresql extends DB } /** - * @brief 1씩 증가되는 sequence값을 return (postgresql의 auto_increment는 sequence테이블에서만 사용) + * @brief Return sequence value incremented by 1(in postgresql, auto_increment is used in the sequence table only) **/ function getNextSequence() { @@ -260,7 +250,7 @@ class DBPostgresql extends DB } /** - * @brief 테이블 기생성 여부 return + * @brief Return if a table already exists **/ function isTableExists($target_name) { @@ -277,7 +267,7 @@ class DBPostgresql extends DB } /** - * @brief 특정 테이블에 특정 column 추가 + * @brief Add a column to a table **/ function addColumn($table_name, $column_name, $type = 'number', $size = '', $default = NULL, $notnull = false) @@ -309,7 +299,7 @@ class DBPostgresql extends DB /** - * @brief 특정 테이블의 column의 정보를 return + * @brief Return column information of a table **/ function isColumnExists($table_name, $column_name) { @@ -329,7 +319,7 @@ class DBPostgresql extends DB } /** - * @brief 특정 테이블에 특정 인덱스 추가 + * @brief Add an index to a table * $target_columns = array(col1, col2) * $is_unique? unique : none **/ @@ -340,8 +330,7 @@ class DBPostgresql extends DB if (strpos($table_name, $this->prefix) === false) $table_name = $this->prefix . $table_name; - - // index_name의 경우 앞에 table이름을 붙여줘서 중복을 피함 + // Use a tablename before an index name to avoid defining the same index $index_name = $table_name . $index_name; $query = sprintf("create %s index %s on %s (%s);", $is_unique ? 'unique' : '', $index_name, @@ -350,7 +339,7 @@ class DBPostgresql extends DB } /** - * @brief 특정 테이블에 특정 column 제거 + * @brief Delete a column from a table **/ function dropColumn($table_name, $column_name) { @@ -359,14 +348,13 @@ class DBPostgresql extends DB } /** - * @brief 특정 테이블의 특정 인덱스 삭제 + * @brief Drop an index from a table **/ function dropIndex($table_name, $index_name, $is_unique = false) { if (strpos($table_name, $this->prefix) === false) $table_name = $this->prefix . $table_name; - - // index_name의 경우 앞에 table이름을 붙여줘서 중복을 피함 + // Use a tablename before an index name to avoid defining the same index $index_name = $table_name . $index_name; $query = sprintf("drop index %s", $index_name); @@ -375,14 +363,13 @@ class DBPostgresql extends DB /** - * @brief 특정 테이블의 index 정보를 return + * @brief Return index information of a table **/ function isIndexExists($table_name, $index_name) { if (strpos($table_name, $this->prefix) === false) $table_name = $this->prefix . $table_name; - - // index_name의 경우 앞에 table이름을 붙여줘서 중복을 피함 + // Use a tablename before an index name to avoid defining the same index $index_name = $table_name . $index_name; //$query = sprintf("show indexes from %s%s where key_name = '%s' ", $this->prefix, $table_name, $index_name); @@ -402,7 +389,7 @@ class DBPostgresql extends DB } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief Create a table by using xml file **/ function createTableByXml($xml_doc) { @@ -410,19 +397,19 @@ class DBPostgresql extends DB } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief Create a table by using xml file **/ function createTableByXmlFile($file_name) { if (!file_exists($file_name)) return; - // xml 파일을 읽음 + // read xml file $buff = FileHandler::readFile($file_name); return $this->_createTable($buff); } /** - * @brief schema xml을 이용하여 create table query생성 + * @brief generate a query statement to create a table by using schema xml * * type : number, varchar, text, char, date, \n * opt : notnull, default, size\n @@ -433,8 +420,7 @@ class DBPostgresql extends DB // xml parsing $oXml = new XmlParser(); $xml_obj = $oXml->parse($xml_doc); - - // 테이블 생성 schema 작성 + // Create a table schema $table_name = $xml_obj->table->attrs->name; if ($table_name == 'sequence') { @@ -508,7 +494,7 @@ class DBPostgresql extends DB } /** - * @brief 조건문 작성하여 return + * @brief Return conditional clause **/ function getCondition($output) { @@ -564,16 +550,15 @@ class DBPostgresql extends DB /** - * @brief insertAct 처리 + * @brief Handle the insertAct **/ function _executeInsertAct($output) { - // 테이블 정리 + // List tables foreach ($output->tables as $key => $val) { $table_list[] = $this->prefix . $val; } - - // 컬럼 정리 + // List columns foreach ($output->columns as $key => $val) { $name = $val['name']; $value = $val['value']; @@ -594,17 +579,16 @@ class DBPostgresql extends DB } /** - * @brief updateAct 처리 + * @brief Handle updateAct **/ function _executeUpdateAct($output) { - // 테이블 정리 + // List tables foreach ($output->tables as $key => $val) { //$table_list[] = $this->prefix.$val.' as '.$key; $table_list[] = $this->prefix . $val; } - - // 컬럼 정리 + // List columns foreach ($output->columns as $key => $val) { if (!isset($val['value'])) continue; @@ -621,8 +605,7 @@ class DBPostgresql extends DB $column_list[] = sprintf("%s = %s", $name, $value); } } - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); $query = sprintf("update %s set %s %s", implode(',', $table_list), implode(',', @@ -632,16 +615,15 @@ class DBPostgresql extends DB } /** - * @brief deleteAct 처리 + * @brief Handle deleteAct **/ function _executeDeleteAct($output) { - // 테이블 정리 + // List tables foreach ($output->tables as $key => $val) { $table_list[] = $this->prefix . $val; } - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); $query = sprintf("delete from %s %s", implode(',', $table_list), $condition); @@ -650,14 +632,14 @@ class DBPostgresql extends DB } /** - * @brief selectAct 처리 + * @brief Handle selectAct * - * select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n - * navigation이라는 method를 제공 + * In order to get a list of pages easily when selecting \n + * it supports a method as navigation **/ function _executeSelectAct($output) { - // 테이블 정리 + // List tables $table_list = array(); foreach ($output->tables as $key => $val) { $table_list[] = $this->prefix . $val . ' as ' . $key; @@ -709,8 +691,7 @@ class DBPostgresql extends DB if ($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output); - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // Add a condition to use an index when sorting in order by list_order, update_order if ($output->order) { $conditions = $this->getConditionList($output); if (!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { @@ -794,9 +775,9 @@ class DBPostgresql extends DB } /** - * @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다 + * @brief Paging is handled if navigation information exists in the query xml * - * 그닥 좋지는 않은 구조이지만 편리하다.. -_-; + * It is quite convenient although its structure is not good at all .. -_-; **/ function _getNavigationData($table_list, $columns, $left_join, $condition, $output) { @@ -804,8 +785,8 @@ class DBPostgresql extends DB $column_list = $output->column_list; /* - // group by 절이 포함된 SELECT 쿼리의 전체 갯수를 구하기 위한 수정 - // 정상적인 동작이 확인되면 주석으로 막아둔 부분으로 대체합니다. + // Modified to find total number of SELECT queries having group by clause + // If it works correctly, uncomment the following codes // $count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition; $total_count = $this->getCountCache($output->tables, $count_condition); @@ -820,7 +801,7 @@ class DBPostgresql extends DB } */ - // 전체 개수를 구함 + // Get a total count $count_query = sprintf("select count(*) as count from %s %s %s", implode(',', $table_list), implode(' ', $left_join), $condition); $count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):''; $result = $this->_query($count_query); @@ -835,15 +816,14 @@ class DBPostgresql extends DB if (!$page) $page = 1; - // 전체 페이지를 구함 + // Get a total page if ($total_count) $total_page = (int)(($total_count - 1) / $list_count) + 1; else $total_page = 1; - // 페이지 변수를 체크 + // Check Page variables if ($page > $total_page) $page = $total_page; $start_count = ($page - 1) * $list_count; - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // Add a condition to use an index when sorting in order by list_order, update_order if ($output->order) { $conditions = $this->getConditionList($output); if (!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { diff --git a/classes/db/DBSqlite2.class.php b/classes/db/DBSqlite2.class.php index 5d4c447b7..ad4a83c37 100644 --- a/classes/db/DBSqlite2.class.php +++ b/classes/db/DBSqlite2.class.php @@ -2,7 +2,7 @@ /** * @class DBSqlite2 * @author NHN (developers@xpressengine.com) - * @brief SQLite ver 2.x 를 이용하기 위한 class + * @brief Class for using SQLite ver 2.x * @version 0.1 * * sqlite handling class (sqlite ver 2.x) @@ -11,17 +11,17 @@ class DBSqlite2 extends DB { /** - * DB를 이용하기 위한 정보 + * DB information **/ var $database = NULL; ///< database - var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE설치 가능) + var $prefix = 'xe'; // / 'INTEGER', @@ -51,7 +51,7 @@ } /** - * @brief 설치 가능 여부를 return + * @brief Return if it is installable **/ function isSupported() { if(!function_exists('sqlite_open')) return false; @@ -59,7 +59,7 @@ } /** - * @brief DB정보 설정 및 connect/ close + * @brief DB settings and connect/close **/ function _setDBInfo() { $db_info = Context::getDBInfo(); @@ -69,27 +69,25 @@ } /** - * @brief DB 접속 + * @brief DB Connection **/ function _connect() { - // db 정보가 없으면 무시 + // Ignore if no DB information exists if(!$this->database) return; - - // 데이터 베이스 파일 접속 시도 + // Attempt to access the database file $this->fd = sqlite_open($this->database, 0666, $error); if(!file_exists($this->database) || $error) { $this->setError(-1,$error); $this->is_connected = false; return; } - - // 접속체크 + // Check connections $this->is_connected = true; $this->password = md5($this->password); } /** - * @brief DB접속 해제 + * @brief DB disconnection **/ function close() { if(!$this->isConnected()) return; @@ -97,7 +95,7 @@ } /** - * @brief 트랜잭션 시작 + * @brief Begin transaction **/ function begin() { if(!$this->is_connected || $this->transaction_started) return; @@ -105,7 +103,7 @@ } /** - * @brief 롤백 + * @brief Rollback **/ function rollback() { if(!$this->is_connected || !$this->transaction_started) return; @@ -114,7 +112,7 @@ } /** - * @brief 커밋 + * @brief Commits **/ function commit($force = false) { if(!$force && (!$this->isConnected() || !$this->transaction_started)) return; @@ -124,7 +122,7 @@ } /** - * @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절 + * @brief Add quotes on the string variables in a query **/ function addQuotes($string) { if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string)); @@ -133,34 +131,30 @@ } /** - * @brief : 쿼리문의 실행 및 결과의 fetch 처리 + * @brief : Run a query and fetch the result * - * query : query문 실행하고 result return\n - * fetch : reutrn 된 값이 없으면 NULL\n - * rows이면 array object\n - * row이면 object\n + * query: run a query and return the result \n + * fetch: NULL if no value is returned \n + * array object if rows are returned \n + * object if a row is returned \n * return\n **/ function _query($query) { if(!$this->isConnected()) return; - - // 쿼리 시작을 알림 + // Notify to start a query execution $this->actStart($query); - - // 쿼리 문 실행 + // Run the query statement $result = @sqlite_query($query, $this->fd); - - // 오류 체크 + // Error Check if(sqlite_last_error($this->fd)) $this->setError(sqlite_last_error($this->fd), sqlite_error_string(sqlite_last_error($this->fd))); - - // 쿼리 실행 알림 + // Notify to complete a query execution $this->actFinish(); return $result; } /** - * @brief 결과를 fetch + * @brief Fetch results **/ function _fetch($result) { if($this->isError() || !$result) return; @@ -180,7 +174,7 @@ } /** - * @brief 1씩 증가되는 sequence값을 return + * @brief Return the sequence value is incremented by 1 **/ function getNextSequence() { $query = sprintf("insert into %ssequence (seq) values ('')", $this->prefix); @@ -195,7 +189,7 @@ } /** - * @brief 테이블 기생성 여부 return + * @brief Return if a table already exists **/ function isTableExists($target_name) { $query = sprintf('pragma table_info(%s%s)', $this->prefix, $this->addQuotes($target_name)); @@ -205,7 +199,7 @@ } /** - * @brief 특정 테이블에 특정 column 추가 + * @brief Add a column to a table **/ function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) { $type = $this->column_type[$type]; @@ -221,7 +215,7 @@ } /** - * @brief 특정 테이블에 특정 column 제거 + * @brief Delete a column from a table **/ function dropColumn($table_name, $column_name) { $query = sprintf("alter table %s%s drop column %s ", $this->prefix, $table_name, $column_name); @@ -229,7 +223,7 @@ } /** - * @brief 특정 테이블의 column의 정보를 return + * @brief Return column information of a table **/ function isColumnExists($table_name, $column_name) { $query = sprintf("pragma table_info(%s%s)", $this->prefix, $table_name); @@ -246,7 +240,7 @@ } /** - * @brief 특정 테이블에 특정 인덱스 추가 + * @brief Add an index to a table * $target_columns = array(col1, col2) * $is_unique? unique : none **/ @@ -261,7 +255,7 @@ } /** - * @brief 특정 테이블의 특정 인덱스 삭제 + * @brief Drop an index from a table **/ function dropIndex($table_name, $index_name, $is_unique = false) { $key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name); @@ -270,7 +264,7 @@ } /** - * @brief 특정 테이블의 index 정보를 return + * @brief Return index information of a table **/ function isIndexExists($table_name, $index_name) { $key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name); @@ -282,24 +276,24 @@ } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief Create a table by using xml file **/ function createTableByXml($xml_doc) { return $this->_createTable($xml_doc); } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief Create a table by using xml file **/ function createTableByXmlFile($file_name) { if(!file_exists($file_name)) return; - // xml 파일을 읽음 + // read xml file $buff = FileHandler::readFile($file_name); return $this->_createTable($buff); } /** - * @brief schema xml을 이용하여 create table query생성 + * @brief generate a query statement to create a table by using schema xml * * type : number, varchar, text, char, date, \n * opt : notnull, default, size\n @@ -309,8 +303,7 @@ // xml parsing $oXml = new XmlParser(); $xml_obj = $oXml->parse($xml_doc); - - // 테이블 생성 schema 작성 + // Create a table schema $table_name = $xml_obj->table->attrs->name; if($this->isTableExists($table_name)) return; $table_name = $this->prefix.$table_name; @@ -371,7 +364,7 @@ } /** - * @brief 조건문 작성하여 return + * @brief Return conditional clause **/ function getCondition($output) { if(!$output->conditions) return; @@ -415,15 +408,14 @@ } /** - * @brief insertAct 처리 + * @brief Handle the insertAct **/ function _executeInsertAct($output) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[] = $this->prefix.$val; } - - // 컬럼 정리 + // List columns foreach($output->columns as $key => $val) { $name = $val['name']; $value = $val['value']; @@ -441,18 +433,16 @@ } /** - * @brief updateAct 처리 + * @brief Handle updateAct **/ function _executeUpdateAct($output) { $table_count = count(array_values($output->tables)); - - // 대상 테이블이 1개일 경우 + // If one day the destination table if($table_count == 1) { - // 테이블 정리 + // List tables list($target_table) = array_values($output->tables); $target_table = $this->prefix.$target_table; - - // 컬럼 정리 + // List columns foreach($output->columns as $key => $val) { if(!isset($val['value'])) continue; $name = $val['name']; @@ -465,27 +455,23 @@ $column_list[] = sprintf("%s = %s", $name, $value); } } - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); $query = sprintf("update %s set %s %s", $target_table, implode(',',$column_list), $condition); - - // 대상 테이블이 2개일 경우 (sqlite에서 update 테이블을 1개 이상 지정 못해서 이렇게 꽁수로... 다른 방법이 있으려나..) + // trick to handle if targt table to update is more than one (sqlite doesn't support update to multi-tables) } elseif($table_count == 2) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[$val] = $this->prefix.$key; } list($source_table, $target_table) = array_values($table_list); - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); foreach($table_list as $key => $val) { $condition = eregi_replace($key.'\\.', $val.'.', $condition); } - - // 컬럼 정리 + // List columns foreach($output->columns as $key => $val) { if(!isset($val['value'])) continue; $name = $val['name']; @@ -507,15 +493,14 @@ } /** - * @brief deleteAct 처리 + * @brief Handle deleteAct **/ function _executeDeleteAct($output) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[] = $this->prefix.$val; } - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); $query = sprintf("delete from %s %s", implode(',',$table_list), $condition); @@ -524,13 +509,13 @@ } /** - * @brief selectAct 처리 + * @brief Handle selectAct * - * select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n - * navigation이라는 method를 제공 + * In order to get a list of pages easily when selecting \n + * it supports a method as navigation **/ function _executeSelectAct($output) { - // 테이블 정리 + // List tables $table_list = array(); foreach($output->tables as $key => $val) { $table_list[] = $this->prefix.$val.' as '.$key; @@ -573,8 +558,7 @@ $output->column_list = $column_list; if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output); - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // Add a condition to use an index when sorting in order by list_order, update_order if($output->order) { $conditions = $this->getConditionList($output); if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { @@ -597,8 +581,7 @@ } if(count($index_list)) $query .= ' order by '.implode(',',$index_list); } - - // list_count를 사용할 경우 적용 + // Apply when using list_count if($output->list_count['value']) $query = sprintf('%s limit %d', $query, $output->list_count['value']); $query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):''; @@ -620,17 +603,17 @@ } /** - * @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다 + * @brief Paging is handled if navigation information exists in the query xml * - * 그닥 좋지는 않은 구조이지만 편리하다.. -_-; + * It is quite convenient although its structure is not good at all .. -_-; **/ function _getNavigationData($table_list, $columns, $left_join, $condition, $output) { require_once(_XE_PATH_.'classes/page/PageHandler.class.php'); $column_list = $output->column_list; /* - // group by 절이 포함된 SELECT 쿼리의 전체 갯수를 구하기 위한 수정 - // 정상적인 동작이 확인되면 주석으로 막아둔 부분으로 대체합니다. + // Modified to find total number of SELECT queries having group by clause + // If it works correctly, uncomment the following codes // $count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition; $total_count = $this->getCountCache($output->tables, $count_condition); @@ -644,8 +627,7 @@ $this->putCountCache($output->tables, $count_condition, $total_count); } */ - - // 전체 개수를 구함 + // Get a total count $count_query = sprintf("select count(*) as count from %s %s %s", implode(',',$table_list),implode(' ',$left_join), $condition); $count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):''; $result = $this->_query($count_query); @@ -658,16 +640,13 @@ if(!$page_count) $page_count = 10; $page = $output->page['value']; if(!$page) $page = 1; - - // 전체 페이지를 구함 + // Get a total page if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1; else $total_page = 1; - - // 페이지 변수를 체크 + // Check Page variables if($page > $total_page) $page = $total_page; $start_count = ($page-1)*$list_count; - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // Add a condition to use an index when sorting in order by list_order, update_order if($output->order) { $conditions = $this->getConditionList($output); if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { diff --git a/classes/db/DBSqlite3_pdo.class.php b/classes/db/DBSqlite3_pdo.class.php index e1ed6168a..e734bc53e 100644 --- a/classes/db/DBSqlite3_pdo.class.php +++ b/classes/db/DBSqlite3_pdo.class.php @@ -2,21 +2,21 @@ /** * @class DBSqlite3_pdo * @author NHN (developers@xpressengine.com) - * @brief SQLite3를 PDO로 이용하여 class + * @brief class to use SQLite3 with PDO * @version 0.1 **/ class DBSqlite3_pdo extends DB { /** - * DB를 이용하기 위한 정보 + * DB information **/ var $database = NULL; ///< database - var $prefix = 'xe'; ///< XE에서 사용할 테이블들의 prefix (한 DB에서 여러개의 XE 설치 가능) + var $prefix = 'xe'; // /< prefix of a tablename (many XEs can be installed in a single DB) var $comment_syntax = '/* %s */'; /** - * PDO 사용시 필요한 변수들 + * Variables for using PDO **/ var $handler = NULL; var $stmt = NULL; @@ -24,10 +24,10 @@ var $bind_vars = array(); /** - * @brief sqlite3 에서 사용될 column type + * @brief column type used in sqlite3 * - * column_type은 schema/query xml에서 공통 선언된 type을 이용하기 때문에 - * 각 DBMS에 맞게 replace 해주어야 한다 + * column_type should be replaced for each DBMS properly + * because column_type uses a commonly defined type in schema/query xml files **/ var $column_type = array( 'bignumber' => 'INTEGER', @@ -57,14 +57,14 @@ } /** - * @brief 설치 가능 여부를 return + * @brief Return if installable **/ function isSupported() { return class_exists('PDO'); } /** - * @brief DB정보 설정 및 connect/ close + * @brief DB settings and connect/close **/ function _setDBInfo() { $db_info = Context::getDBInfo(); @@ -74,13 +74,13 @@ } /** - * @brief DB 접속 + * @brief DB Connection **/ function _connect() { - // db 정보가 없으면 무시 + // override if db information not exists if(!$this->database) return; - // 데이터 베이스 파일 접속 시도 + // Attempt to access the database file try { // PDO is only supported with PHP5, // so it is allowed to use try~catch statment in this class. @@ -91,13 +91,13 @@ return; } - // 접속체크 + // Check connections $this->is_connected = true; $this->password = md5($this->password); } /** - * @brief DB접속 해제 + * @brief disconnect to DB **/ function close() { if(!$this->is_connected) return; @@ -105,7 +105,7 @@ } /** - * @brief 트랜잭션 시작 + * @brief Begin a transaction **/ function begin() { if(!$this->is_connected || $this->transaction_started) return; @@ -113,7 +113,7 @@ } /** - * @brief 롤백 + * @brief Rollback **/ function rollback() { if(!$this->is_connected || !$this->transaction_started) return; @@ -122,7 +122,7 @@ } /** - * @brief 커밋 + * @brief Commit **/ function commit($force = false) { if(!$force && (!$this->is_connected || !$this->transaction_started)) return; @@ -131,7 +131,7 @@ } /** - * @brief 쿼리에서 입력되는 문자열 변수들의 quotation 조절 + * @brief Add or change quotes to the query string variables **/ function addQuotes($string) { if(version_compare(PHP_VERSION, "5.9.0", "<") && get_magic_quotes_gpc()) $string = stripslashes(str_replace("\\","\\\\",$string)); @@ -140,12 +140,12 @@ } /** - * @brief : 쿼리문의 prepare + * @brief : Prepare a query statement **/ function _prepare($query) { if(!$this->is_connected) return; - // 쿼리 시작을 알림 + // notify to start a query execution $this->actStart($query); $this->stmt = $this->handler->prepare($query); @@ -159,7 +159,7 @@ } /** - * @brief : stmt에 binding params + * @brief : Binding params in stmt **/ function _bind($val) { if(!$this->is_connected || !$this->stmt) return; @@ -170,7 +170,7 @@ } /** - * @brief : prepare된 쿼리의 execute + * @brief : execute the prepared statement **/ function _execute() { if(!$this->is_connected || !$this->stmt) return; @@ -200,7 +200,7 @@ } /** - * @brief 1씩 증가되는 sequence값을 return + * @brief Return the sequence value incremented by 1 **/ function getNextSequence() { $query = sprintf("insert into %ssequence (seq) values (NULL)", $this->prefix); @@ -217,7 +217,7 @@ } /** - * @brief 테이블 기생성 여부 return + * @brief return if the table already exists **/ function isTableExists($target_name) { $query = sprintf('pragma table_info(%s%s)', $this->prefix, $target_name); @@ -227,7 +227,7 @@ } /** - * @brief 특정 테이블에 특정 column 추가 + * @brief Add a column to a table **/ function addColumn($table_name, $column_name, $type='number', $size='', $default = '', $notnull=false) { $type = $this->column_type[$type]; @@ -244,7 +244,7 @@ } /** - * @brief 특정 테이블에 특정 column 제거 + * @brief Remove a column from a table **/ function dropColumn($table_name, $column_name) { $query = sprintf("alter table %s%s drop column %s ", $this->prefix, $table_name, $column_name); @@ -252,7 +252,7 @@ } /** - * @brief 특정 테이블의 column의 정보를 return + * @brief Return column information of a table **/ function isColumnExists($table_name, $column_name) { $query = sprintf("pragma table_info(%s%s)", $this->prefix, $table_name); @@ -270,7 +270,7 @@ } /** - * @brief 특정 테이블에 특정 인덱스 추가 + * @brief Add an index to a table * $target_columns = array(col1, col2) * $is_unique? unique : none **/ @@ -285,7 +285,7 @@ } /** - * @brief 특정 테이블의 특정 인덱스 삭제 + * @brief Drop an index from a table **/ function dropIndex($table_name, $index_name, $is_unique = false) { $key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name); @@ -294,7 +294,7 @@ } /** - * @brief 특정 테이블의 index 정보를 return + * @brief Return index information of a table **/ function isIndexExists($table_name, $index_name) { $key_name = sprintf('%s%s_%s', $this->prefix, $table_name, $index_name); @@ -307,24 +307,24 @@ } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief create a table from xml file **/ function createTableByXml($xml_doc) { return $this->_createTable($xml_doc); } /** - * @brief xml 을 받아서 테이블을 생성 + * @brief create a table from xml file **/ function createTableByXmlFile($file_name) { if(!file_exists($file_name)) return; - // xml 파일을 읽음 + // read xml file $buff = FileHandler::readFile($file_name); return $this->_createTable($buff); } /** - * @brief schema xml을 이용하여 create table query생성 + * @brief generate a query to create a table using the schema xml * * type : number, varchar, text, char, date, \n * opt : notnull, default, size\n @@ -334,8 +334,7 @@ // xml parsing $oXml = new XmlParser(); $xml_obj = $oXml->parse($xml_doc); - - // 테이블 생성 schema 작성 + // Create a table schema $table_name = $xml_obj->table->attrs->name; if($this->isTableExists($table_name)) return; $table_name = $this->prefix.$table_name; @@ -401,7 +400,7 @@ } /** - * @brief 조건문 작성하여 return + * @brief Return conditional clause(where) **/ function getCondition($output) { if(!$output->conditions) return; @@ -445,15 +444,14 @@ } /** - * @brief insertAct 처리 + * @brief insertAct **/ function _executeInsertAct($output) { - // 테이블 정리 + // list tables foreach($output->tables as $key => $val) { $table_list[] = $this->prefix.$val; } - - // 컬럼 정리 + // list columns foreach($output->columns as $key => $val) { $name = $val['name']; $value = $val['value']; @@ -480,18 +478,16 @@ } /** - * @brief updateAct 처리 + * @brief updateAct **/ function _executeUpdateAct($output) { $table_count = count(array_values($output->tables)); - - // 대상 테이블이 1개일 경우 + // If a target table is one if($table_count == 1) { - // 테이블 정리 + // list tables list($target_table) = array_values($output->tables); $target_table = $this->prefix.$target_table; - - // 컬럼 정리 + // list columns foreach($output->columns as $key => $val) { if(!isset($val['value'])) continue; $name = $val['name']; @@ -504,27 +500,23 @@ $column_list[] = sprintf("%s = %s", $name, $value); } } - - // 조건절 정리 + // List where cluase $condition = $this->getCondition($output); $query = sprintf("update %s set %s %s", $target_table, implode(',',$column_list), $condition); - - // 대상 테이블이 2개일 경우 (sqlite에서 update 테이블을 1개 이상 지정 못해서 이렇게 꽁수로... 다른 방법이 있으려나..) + // If tables to update are morea than two (In sqlite, it is possible to update a single table only. Let me know if you know a better way) } elseif($table_count == 2) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[$val] = $this->prefix.$key; } list($source_table, $target_table) = array_values($table_list); - - // 조건절 정리 + // List where cluase $condition = $this->getCondition($output); foreach($table_list as $key => $val) { $condition = eregi_replace($key.'\\.', $val.'.', $condition); } - - // 컬럼 정리 + // List columns foreach($output->columns as $key => $val) { if(!isset($val['value'])) continue; $name = $val['name']; @@ -547,15 +539,14 @@ } /** - * @brief deleteAct 처리 + * @brief deleteAct **/ function _executeDeleteAct($output) { - // 테이블 정리 + // List tables foreach($output->tables as $key => $val) { $table_list[] = $this->prefix.$val; } - - // 조건절 정리 + // List the conditional clause $condition = $this->getCondition($output); $query = sprintf("delete from %s %s", implode(',',$table_list), $condition); @@ -565,13 +556,13 @@ } /** - * @brief selectAct 처리 + * @brief selectAct * - * select의 경우 특정 페이지의 목록을 가져오는 것을 편하게 하기 위해\n - * navigation이라는 method를 제공 + * To fetch a list of the page conveniently when selecting, \n + * navigation method supported **/ function _executeSelectAct($output) { - // 테이블 정리 + // List tables $table_list = array(); foreach($output->tables as $key => $val) { $table_list[] = $this->prefix.$val.' as '.$key; @@ -616,8 +607,7 @@ $output->column_list = $column_list; if($output->list_count && $output->page) return $this->_getNavigationData($table_list, $columns, $left_join, $condition, $output); - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // add the condition to the query to use an index for ordering by list_order, update_order if($output->order) { $conditions = $this->getConditionList($output); if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { @@ -655,7 +645,7 @@ } $query = sprintf("select %s from %s %s %s %s", $columns, implode(',',$table_list),implode(' ',$left_join), $condition, $groupby_query.$orderby_query); - // list_count를 사용할 경우 적용 + // apply when using list_count if($output->list_count['value']) $query = sprintf('%s limit %d', $query, $output->list_count['value']); $query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):''; @@ -676,17 +666,17 @@ } /** - * @brief query xml에 navigation 정보가 있을 경우 페이징 관련 작업을 처리한다 + * @brief Paging is handled if navigation information exists in the query xml * - * 그닥 좋지는 않은 구조이지만 편리하다.. -_-; + * It is quite convenient although its structure is not good at all .. -_-; **/ function _getNavigationData($table_list, $columns, $left_join, $condition, $output) { require_once(_XE_PATH_.'classes/page/PageHandler.class.php'); $column_list = $output->column_list; /* - // group by 절이 포함된 SELECT 쿼리의 전체 갯수를 구하기 위한 수정 - // 정상적인 동작이 확인되면 주석으로 막아둔 부분으로 대체합니다. + // Modified to find total number of SELECT queries having group by clause + // If it works correctly, uncomment the following codes // $count_condition = count($output->groups) ? sprintf('%s group by %s', $condition, implode(', ', $output->groups)) : $condition; $total_count = $this->getCountCache($output->tables, $count_condition); @@ -700,8 +690,7 @@ $this->putCountCache($output->tables, $count_condition, $total_count); } */ - - // 전체 개수를 구함 + // Get a total count $count_query = sprintf("select count(*) as count from %s %s %s", implode(',',$table_list),implode(' ',$left_join), $condition); $count_query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id . ' count(*)'):''; $this->_prepare($count_query); @@ -714,16 +703,13 @@ if(!$page_count) $page_count = 10; $page = $output->page['value']; if(!$page) $page = 1; - - // 전체 페이지를 구함 + // Get a total page if($total_count) $total_page = (int)( ($total_count-1) / $list_count) + 1; else $total_page = 1; - - // 페이지 변수를 체크 + // Check Page variables if($page > $total_page) $page = $total_page; $start_count = ($page-1)*$list_count; - - // list_order, update_order 로 정렬시에 인덱스 사용을 위해 condition에 쿼리 추가 + // Add a condition to use an index when sorting in order by list_order, update_order if($output->order) { $conditions = $this->getConditionList($output); if(!in_array('list_order', $conditions) && !in_array('update_order', $conditions)) { @@ -760,7 +746,7 @@ $columns = join(',',$output->arg_columns); } - // return 결과물 생성 + // Return the result $buff = new Object(); $buff->total_count = 0; $buff->total_page = 0; @@ -768,7 +754,7 @@ $buff->data = array(); $buff->page_navigation = new PageHandler($total_count, $total_page, $page, $page_count); - // 쿼리 실행 + // Query Execution $query = sprintf("select %s from %s %s %s %s", $columns, implode(',',$table_list),implode(' ',$left_join), $condition, $groupby_query.$orderby_query); $query = sprintf('%s limit %d, %d', $query, $start_count, $list_count); $query .= (__DEBUG_QUERY__&1 && $output->query_id)?sprintf(' '.$this->comment_syntax,$this->query_id):''; diff --git a/classes/display/DisplayHandler.class.php b/classes/display/DisplayHandler.class.php index 251605ac7..84d0a8c32 100644 --- a/classes/display/DisplayHandler.class.php +++ b/classes/display/DisplayHandler.class.php @@ -10,9 +10,9 @@ class DisplayHandler extends Handler { - var $content_size = 0; ///< 출력하는 컨텐츠의 사이즈 + var $content_size = 0; // /< The size of displaying contents - var $gz_enabled = false; ///< gzip 압축하여 컨텐츠 호출할 것인지에 대한 flag변수 + var $gz_enabled = false; // /
gz_enabled = true; - - // request method에 따른 컨텐츠 결과물 추출 + // Extract contents to display by the request method if(Context::get('xeVirtualRequestMethod')=='xml') { require_once("./classes/display/VirtualXMLDisplayHandler.php"); $handler = new VirtualXMLDisplayHandler(); @@ -51,33 +49,27 @@ } $output = $handler->toDoc($oModule); - - // 출력하기 전에 trigger 호출 (before) + // call a trigger before display ModuleHandler::triggerCall('display', 'before', $output); - - // 애드온 실행 + // execute add-on $called_position = 'before_display_content'; $oAddonController = &getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc"); @include($addon_file); if(method_exists($handler, "prepareToPrint")) $handler->prepareToPrint($output); - - // header 출력 + // header output if($this->gz_enabled) header("Content-Encoding: gzip"); if(Context::getResponseMethod() == 'JSON') $this->_printJSONHeader(); else if(Context::getResponseMethod() != 'HTML') $this->_printXMLHeader(); else $this->_printHTMLHeader(); - - // debugOutput 출력 + // debugOutput output $this->content_size = strlen($output); $output .= $this->_debugOutput(); - - // 결과물 직접 출력 + // results directly output if($this->gz_enabled) print ob_gzhandler($output, 5); else print $output; - - // 출력 후 trigger 호출 (after) + // call a trigger after display ModuleHandler::triggerCall('display', 'after', $content); } @@ -91,8 +83,7 @@ if(!__DEBUG__) return; $end = getMicroTime(); - - // Firebug 콘솔 출력 + // Firebug console output if(__DEBUG_OUTPUT__ == 2 && version_compare(PHP_VERSION, '6.0.0') === -1) { static $firephp; if(!isset($firephp)) $firephp = FirePHP::getInstance(true); @@ -101,8 +92,7 @@ $firephp->fb('Change the value of __DEBUG_PROTECT_IP__ into your IP address in config/config.user.inc.php or config/config.inc.php', 'The IP address is not allowed.'); return; } - - // 전체 실행 시간 출력, Request/Response info 출력 + // display total execution time and Request/Response info if(__DEBUG__ & 2) { $firephp->fb( array('Request / Response info >>> '.$_SERVER['REQUEST_METHOD'].' / '.Context::getResponseMethod(), @@ -135,8 +125,7 @@ 'TABLE' ); } - - // DB 쿼리 내역 출력 + // display DB query history if((__DEBUG__ & 4) && $GLOBALS['__db_queries__']) { $queries_output = array(array('Query', 'Elapsed time', 'Result')); foreach($GLOBALS['__db_queries__'] as $query) { @@ -150,43 +139,34 @@ 'TABLE' ); } - - - // 파일 및 HTML 주석으로 출력 + // dislpay the file and HTML comments } else { - - // 전체 실행 시간 출력, Request/Response info 출력 + // display total execution time and Request/Response info if(__DEBUG__ & 2) { if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) { return; } - - // Request/Response 정보 작성 + // Request/Response information $buff .= "\n- Request/ Response info\n"; $buff .= sprintf("\tRequest URI \t\t\t: %s:%s%s%s%s\n", $_SERVER['SERVER_NAME'], $_SERVER['SERVER_PORT'], $_SERVER['PHP_SELF'], $_SERVER['QUERY_STRING']?'?':'', $_SERVER['QUERY_STRING']); $buff .= sprintf("\tRequest method \t\t\t: %s\n", $_SERVER['REQUEST_METHOD']); $buff .= sprintf("\tResponse method \t\t: %s\n", Context::getResponseMethod()); $buff .= sprintf("\tResponse contents size\t\t: %d byte\n", $this->content_size); - - // 전체 실행 시간 + // total execution time $buff .= sprintf("\n- Total elapsed time : %0.5f sec\n", $end-__StartTime__); $buff .= sprintf("\tclass file load elapsed time \t: %0.5f sec\n", $GLOBALS['__elapsed_class_load__']); $buff .= sprintf("\tTemplate compile elapsed time\t: %0.5f sec (%d called)\n", $GLOBALS['__template_elapsed__'], $GLOBALS['__TemplateHandlerCalled__']); $buff .= sprintf("\tXmlParse compile elapsed time\t: %0.5f sec\n", $GLOBALS['__xmlparse_elapsed__']); $buff .= sprintf("\tPHP elapsed time \t\t: %0.5f sec\n", $end-__StartTime__-$GLOBALS['__template_elapsed__']-$GLOBALS['__xmlparse_elapsed__']-$GLOBALS['__db_elapsed_time__']-$GLOBALS['__elapsed_class_load__']); - - // 위젯 실행 시간 작성 + // widget execution time $buff .= sprintf("\n\tWidgets elapsed time \t\t: %0.5f sec", $GLOBALS['__widget_excute_elapsed__']); - - // 레이아웃 실행 시간 + // layout execution time $buff .= sprintf("\n\tLayout compile elapsed time \t: %0.5f sec", $GLOBALS['__layout_compile_elapsed__']); - - // 위젯, 에디터 컴포넌트 치환 시간 + // Widgets, the editor component replacement time $buff .= sprintf("\n\tTrans Content \t\t\t: %0.5f sec\n", $GLOBALS['__trans_content_elapsed__']); } - - // DB 로그 작성 + // DB Logging if(__DEBUG__ & 4) { if(__DEBUG_PROTECT__ == 1 && __DEBUG_PROTECT_IP__ != $_SERVER['REMOTE_ADDR']) { return; @@ -206,8 +186,7 @@ } } } - - // HTML 주석으로 출력 + // Output in HTML comments if($buff && __DEBUG_OUTPUT__ == 1 && Context::getResponseMethod() == 'HTML') { $buff = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true)); @@ -217,8 +196,7 @@ return ""; } - - // 파일에 출력 + // Output to a file if($buff && __DEBUG_OUTPUT__ == 0) { $debug_file = _XE_PATH_.'files/_debug_message.php'; $buff = sprintf("[%s %s:%d]\n%s\n", date('Y-m-d H:i:s'), $file_name, $line_num, print_r($buff, true)); diff --git a/classes/display/HTMLDisplayHandler.php b/classes/display/HTMLDisplayHandler.php index 577f98163..8a8c5a93f 100644 --- a/classes/display/HTMLDisplayHandler.php +++ b/classes/display/HTMLDisplayHandler.php @@ -28,21 +28,21 @@ class HTMLDisplayHandler { $edited_layout_file = $oModule->getEditedLayoutFile(); - // 현재 요청된 레이아웃 정보를 구함 + // get the layout information currently requested $oLayoutModel = &getModel('layout'); $layout_info = Context::get('layout_info'); $layout_srl = $layout_info->layout_srl; - // 레이아웃과 연결되어 있으면 레이아웃 컴파일 + // compile if connected to the layout if($layout_srl > 0){ - // faceoff 레이아웃일 경우 별도 처리 + // handle separately if the layout is faceoff if($layout_info && $layout_info->type == 'faceoff') { $oLayoutModel->doActivateFaceOff($layout_info); Context::set('layout_info', $layout_info); } - // 관리자 레이아웃 수정화면에서 변경된 CSS가 있는지 조사 + // search if the changes CSS exists in the admin layout edit window $edited_layout_css = $oLayoutModel->getUserLayoutCss($layout_srl); if(file_exists($edited_layout_css)) Context::addCSSFile($edited_layout_css,true,'all','',100); @@ -66,13 +66,13 @@ class HTMLDisplayHandler { if(__DEBUG__==3) $start = getMicroTime(); - // body 내의 를 header로 이동 + // move in body to the header $output = preg_replace_callback('!!is', array($this,'_moveStyleToHeader'), $output); - // 메타 파일 변경 (캐싱기능등으로 인해 위젯등에서 태그를 content에 넣는 경우가 있음 - $output = preg_replace_callback('//is', array($this,'_transMeta'), $output); + // change a meta fine(widget often put the tag like to the content because of caching) + $output = preg_replace_callback('//is', array($this,'_transMeta'), $output); - // rewrite module 사용시 생기는 상대경로에 대한 처리를 함 + // handles a relative path generated by using the rewrite module if(Context::isAllowRewrite()) { $url = parse_url(Context::getRequestUri()); $real_path = $url['path']; @@ -89,15 +89,15 @@ class HTMLDisplayHandler { } } - // 간혹 background-image에 url(none) 때문에 request가 한번 더 일어나는 경우가 생기는 것을 방지 + // prevent the 2nd request due to url(none) of the background-image $output = preg_replace('/url\((["\']?)none(["\']?)\)/is', 'none', $output); if(__DEBUG__==3) $GLOBALS['__trans_content_elapsed__'] = getMicroTime()-$start; - // 불필요한 정보 제거 + // Remove unnecessary information $output = preg_replace('/member\_\-([0-9]+)/s','member_0',$output); - // 최종 레이아웃 변환 + // convert the final layout Context::set('content', $output); $oTemplate = &TemplateHandler::getInstance(); if(Mobile::isFromMobilePhone()) { @@ -109,7 +109,7 @@ class HTMLDisplayHandler { $output = $oTemplate->compile('./common/tpl', 'common_layout'); } - // 사용자 정의 언어 변환 + // replace the user-defined-language $oModuleController = &getController('module'); $oModuleController->replaceDefinedLangCode($output); } diff --git a/classes/editor/EditorHandler.class.php b/classes/editor/EditorHandler.class.php index 806b30008..0db5f451e 100644 --- a/classes/editor/EditorHandler.class.php +++ b/classes/editor/EditorHandler.class.php @@ -2,15 +2,15 @@ /** * @class EditorHandler * @author NHN (developers@xpressengine.com) - * @brief edit component의 상위 클래스임 + * @brief superclass of the edit component * - * 주로 하는 일은 컴포넌트 요청시 컴포넌트에서 필요로 하는 변수를 세팅해준다 + * set up the component variables **/ class EditorHandler extends Object { /** - * @brief 컴포넌트의 xml및 관련 정보들을 설정 + * @brief set the xml and other information of the component **/ function setInfo($info) { Context::set('component_info', $info); diff --git a/classes/extravar/Extravar.class.php b/classes/extravar/Extravar.class.php index 443b98fa1..80a40776e 100644 --- a/classes/extravar/Extravar.class.php +++ b/classes/extravar/Extravar.class.php @@ -2,7 +2,7 @@ /** * @class ExtraVar * @author NHN (developers@xpressengine.com) - * @brief 게시글, 회원등에서 사용하는 확장변수를 핸들링하는 클래스 + * @brief a class to handle extra variables used in posts, member and others * **/ class ExtraVar { @@ -25,7 +25,7 @@ } /** - * @brief 확장변수 키를 등록 + * @brief register a key of extra variable * @param module_srl, idx, name, type, default, desc, is_required, search, value **/ function setExtraVarKeys($extra_keys) { @@ -38,7 +38,7 @@ } /** - * @brief 확장변수 객체 배열 return + * @brief Return an array of extra vars **/ function getExtraVars() { return $this->keys; @@ -48,7 +48,7 @@ /** * @class ExtraItem * @author NHN (developers@xpressengine.com) - * @brief 확장변수의 개별 값 + * @brief each value of the extra vars **/ class ExtraItem { var $module_srl = 0; @@ -80,14 +80,14 @@ } /** - * @brief 값 지정 + * @brief Values **/ function setValue($value) { $this->value = $value; } /** - * @brief type에 따라서 주어진 값을 변형하여 원형 값을 return + * @brief return a given value converted based on its type **/ function _getTypeValue($type, $value) { $value = trim($value); @@ -134,8 +134,8 @@ } /** - * @brief 값을 return - * 원형 값을 HTML 결과물로 return + * @brief Return value + * return the original values for HTML result **/ function getValueHTML() { $value = $this->_getTypeValue($this->type, $this->value); @@ -174,7 +174,7 @@ } /** - * @brief type에 따른 form을 리턴 + * @brief return a form based on its type **/ function getFormHTML() { static $id_num = 1000; @@ -188,17 +188,15 @@ $buff = ''; switch($type) { - // 홈페이지 주소 + // Homepage case 'homepage' : $buff .= ''; break; - - // Email 주소 + // Email Address case 'email_address' : $buff .= ''; break; - - // 전화번호 + // Phone Number case 'tel' : $buff .= ''. @@ -210,8 +208,7 @@ case 'textarea' : $buff .= ''; break; - - // 다중 선택 + // multiple choice case 'checkbox' : $buff .= '
    '; foreach($default as $v) { @@ -225,8 +222,7 @@ } $buff .= '
'; break; - - // 단일 선택 + // single choice case 'select' : $buff .= ''. ''; break; - - // 일반 text + // General text default : $buff .=' '; break; diff --git a/classes/file/FileHandler.class.php b/classes/file/FileHandler.class.php index ee87578a9..86342c665 100644 --- a/classes/file/FileHandler.class.php +++ b/classes/file/FileHandler.class.php @@ -30,8 +30,7 @@ $source_dir = FileHandler::getRealPath($source_dir); $target_dir = FileHandler::getRealPath($target_dir); if(!is_dir($source_dir)) return false; - - // target이 없을땐 생성 + // generate when no target exists if(!file_exists($target_dir)) FileHandler::makeDir($target_dir); if(substr($source_dir, -1) != '/') $source_dir .= '/'; diff --git a/classes/mail/Mail.class.php b/classes/mail/Mail.class.php index 3af574210..9605670ba 100644 --- a/classes/mail/Mail.class.php +++ b/classes/mail/Mail.class.php @@ -1,6 +1,6 @@ setTemplatePath('./common/tpl'); @@ -76,21 +76,18 @@ * @param[in] $xml_info object containing module description **/ function setModuleInfo($module_info, $xml_info) { - // 기본 변수 설정 + // The default variable settings $this->mid = $module_info->mid; $this->module_srl = $module_info->module_srl; $this->module_info = $module_info; $this->xml_info = $xml_info; $this->skin_vars = $module_info->skin_vars; - - // 웹서비스에서 꼭 필요한 인증 정보와 권한 설정 체크 + // validate certificate info and permission settings necessary in Web-services $is_logged = Context::get('is_logged'); $logged_info = Context::get('logged_info'); - - // module model 객체 생성 + // module model create an object $oModuleModel = &getModel('module'); - - // XE에서 access, manager (== is_admin) 는 고정된 권한명이며 이와 관련된 권한 설정 + // permission settings. access, manager(== is_admin) are fixed and privilege name in XE $module_srl = Context::get('module_srl'); if(!$module_info->mid && preg_match('/^([0-9]+)$/',$module_srl)) { $request_module = $oModuleModel->getModuleInfoByModuleSrl($module_srl); @@ -100,19 +97,15 @@ } else { $grant = $oModuleModel->getGrant($module_info, $logged_info, $xml_info); } - - // 현재 모듈의 access 권한이 없으면 권한 없음 표시 + // display no permission if the current module doesn't have an access privilege //if(!$grant->access) return $this->stop("msg_not_permitted"); - - // 관리 권한이 없으면 permision, action 확인 + // checks permission and action if you don't have an admin privilege if(!$grant->manager) { - // 현재 요청된 action의 퍼미션 type(guest, member, manager, root)를 구함 + // get permission types(guest, member, manager, root) of the currently requested action $permission_target = $xml_info->permission->{$this->act}; - - // module.xml에 명시된 퍼미션이 없을때 action명에 Admin이 있으면 manager로 체크 + // check manager if a permission in module.xml otherwise action if no permission if(!$permission_target && substr_count($this->act, 'Admin')) $permission_target = 'manager'; - - // 권한 체크 + // Check permissions switch($permission_target) { case 'root' : $this->stop('msg_not_permitted_act'); @@ -125,8 +118,7 @@ break; } } - - // 권한변수 설정 + // permission variable settings $this->grant = $grant; Context::set('grant', $grant); @@ -138,14 +130,12 @@ * @param $msg_code an error code **/ function stop($msg_code) { - // proc 수행을 중지 시키기 위한 플래그 세팅 + // flag setting to stop the proc processing $this->stop_proc = true; - - // 에러 처리 + // Error handling $this->setError(-1); $this->setMessage($msg_code); - - // message 모듈의 에러 표시 + // Error message display by message module $type = Mobile::isFromMobilePhone() ? 'mobile' : 'view'; $oMessageObject = &ModuleHandler::getModuleInstance('message',$type); $oMessageObject->setError(-1); @@ -241,7 +231,7 @@ * **/ function proc() { - // stop_proc==true이면 그냥 패스 + // pass if stop_proc is true if($this->stop_proc) return false; // trigger call @@ -252,23 +242,20 @@ return false; } - // addon 실행(called_position 를 before_module_proc로 하여 호출) + // execute an addon(call called_position as before_module_proc) $called_position = 'before_module_proc'; $oAddonController = &getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc"); @include($addon_file); if(isset($this->xml_info->action->{$this->act}) && method_exists($this, $this->act)) { - - // 권한 체크 + // Check permissions if(!$this->grant->access) return $this->stop("msg_not_permitted_act"); - - // 모듈의 스킨 정보를 연동 (스킨 정보의 테이블 분리로 동작대상 모듈에만 스킨 정보를 싱크시키도록 변경) + // integrate skin information of the module(change to sync skin info with the target module only by seperating its table) $oModuleModel = &getModel('module'); $oModuleModel->syncSkinInfoToModuleInfo($this->module_info); Context::set('module_info', $this->module_info); - - // 실행 + // Run $output = $this->{$this->act}(); } else { @@ -283,7 +270,7 @@ return false; } - // addon 실행(called_position 를 after_module_proc로 하여 호출) + // execute an addon(call called_position as after_module_proc) $called_position = 'after_module_proc'; $oAddonController = &getController('addon'); $addon_file = $oAddonController->getCacheFilePath(Mobile::isFromMobilePhone()?"mobile":"pc"); @@ -294,8 +281,7 @@ $this->setMessage($output->getMessage()); return false; } - - // view action이고 결과 출력이 XMLRPC 또는 JSON일 경우 해당 모듈의 api method를 실행 + // execute api methos of the module if view action is and result is XMLRPC or JSON if($this->module_info->module_type == 'view'){ if(Context::getResponseMethod() == 'XMLRPC' || Context::getResponseMethod() == 'JSON') { $oAPI = getAPI($this->module_info->module, 'api'); @@ -304,7 +290,6 @@ } } } - return true; } } diff --git a/classes/object/Object.class.php b/classes/object/Object.class.php index fe4cab0ea..0f65631ec 100644 --- a/classes/object/Object.class.php +++ b/classes/object/Object.class.php @@ -9,10 +9,10 @@ class Object { - var $error = 0; ///< 에러 코드 (0이면 에러 아님) - var $message = 'success'; ///< 에러 메세지 (success이면 에러 아님) + var $error = 0; // / "Error code (if 0, it is not an error) + var $message = 'success'; // / "Error message (if success, it is not an error) - var $variables = array(); ///< 추가 변수 + var $variables = array(); // /< an additional variable /** * @brief constructor diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 41ddcb057..bc58d2aa0 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -151,22 +151,22 @@ // replace value of src in img/input/script tag $buff = preg_replace_callback('/<(img|input|script)([^>]*)src="([^"]*?)"/is', array($this, '_replacePath'), $buff); - // loop 템플릿 문법을 변환 + // replace the loop template syntax $buff = $this->_replaceLoop($buff); - // cond 템플릿 문법을 변환 + // |replace the cond template syntax $buff = $this->_replaceCond($buff); - // |cond 템플릿 문법을 변환 + // replace the cond template syntax $buff = preg_replace_callback("/<\/?(\w+)((\s+\w+(\s*=\s*(?:\".*?\"|'.*?'|[^'\">\s]+))?)+\s*|\s*)\/?>/i", array($this, '_replacePipeCond'), $buff); - // include 태그의 변환 + // replace the include tags $buff = preg_replace_callback('!]+)>!is', array($this, '_replaceInclude'), $buff); - // unload/ load 태그의 변환 + // replace unload/load tags $buff = preg_replace_callback('!<(unload|load) ([^>]+)>!is', array($this, '_replaceLoad'), $buff); - // 가상 태그인 block의 변환 + // replace block which is a virtual tag $buff = preg_replace('/|<\/block>/is','',$buff); // replace include @@ -190,7 +190,7 @@ // replace variables $buff = preg_replace_callback('/\{[^@^ ]([^\{\}\n]+)\}/i', array($this, '_compileVarToContext'), $buff); - // PHP 변수형의 변환 ($문자등을 공유 context로 변환) + // replace PHP variable types(converts characters like $ into shared context) $buff = $this->_replaceVarInPHP($buff); // replace parts not displaying results @@ -246,7 +246,7 @@ } /** - * @brief loop 문법의 변환 + * @brief replace loop syntax **/ function _replaceLoop($buff) { @@ -331,7 +331,7 @@ } /** - * @brief pipe cond, |cond= 의 변환 + * @brief replace pipe cond and |cond= **/ function _replacePipeCond($matches) { @@ -346,7 +346,7 @@ } /** - * @brief cond 문법의 변환 + * @brief replace cond syntax **/ function _replaceCond($buff) { @@ -406,7 +406,7 @@ } /** - * @brief 다른 template파일을 include하는 include tag의 변환 + * @brief replace include tags which include other template files **/ function _replaceInclude($matches) { @@ -442,7 +442,7 @@ } /** - * @brief load 태그의 변환 + * @brief replace load tags **/ function _replaceLoad($matches) { $output = $matches[0]; @@ -539,7 +539,7 @@ } /** - * @brief $문자 의 PHP 변수 변환 + * @brief replace PHP variables of $ character **/ function _replaceVarInPHP($buff) { $head = $tail = ''; @@ -558,7 +558,7 @@ /** - * @brief php5의 class::$변수명의 경우 context를 사용하지 않아야 하기에 함수로 대체 + * @brief if class::$variable_name in php5, replace the function not to use context **/ function _replaceVarString($matches) { diff --git a/classes/xml/XmlJsFilter.class.php b/classes/xml/XmlJsFilter.class.php index 10fb03246..7e8ae0122 100644 --- a/classes/xml/XmlJsFilter.class.php +++ b/classes/xml/XmlJsFilter.class.php @@ -12,11 +12,11 @@ *
<-- code to validate data in the form * * - * <-- 폼 항목을 조합하여 key=val 의 js array로 return, act는 필수 + * "- A form of key = val combination of items to js array return, act required * * - * <-- 서버에 ajax로 전송하여 받을 결과값 - * <-- error이름의 결과값을 받겠다는 것 + * "- Result to get by sending ajax to the server + * <- get the result of error name * * * } @@ -36,7 +36,7 @@ * * - parameter - param * name = key : indicate that a new array, 'key' will be created and a value will be assigned to it - * target = target_name : target form element의 값을 가져옴 + * target = target_name: get the value of the target form element * * - response * tag = key : name of variable that will contain the result of the execution @@ -45,9 +45,9 @@ class XmlJsFilter extends XmlParser { var $version = '0.2.5'; - var $compiled_path = './files/cache/js_filter_compiled/'; ///< 컴파일된 캐시 파일이 놓일 위치 - var $xml_file = NULL; ///< 대상 xml 파일 - var $js_file = NULL; ///< 컴파일된 js 파일 + var $compiled_path = './files/cache/js_filter_compiled/'; // / directory path for compiled cache file + var $xml_file = NULL; // / Target xml file + var $js_file = NULL; // / Compiled js file /** * @brief constructor @@ -75,7 +75,7 @@ function _compile() { global $lang; - // xml 파일을 읽음 + // read xml file $buff = FileHandler::readFile($this->xml_file); // xml parsing @@ -84,7 +84,7 @@ $attrs = $xml_obj->filter->attrs; $rules = $xml_obj->filter->rules; - // XmlJsFilter는 filter_name, field, parameter 3개의 데이터를 핸들링 + // XmlJsFilter handles three data; filter_name, field, and parameter $filter_name = $attrs->name; $confirm_msg_code = $attrs->confirm_msg_code; $module = $attrs->module; @@ -101,27 +101,27 @@ $response_tag = $xml_obj->filter->response->tag; if($response_tag && !is_array($response_tag)) $response_tag = array($response_tag); - // extend_filter가 있을 경우 해당 method를 호출하여 결과를 받음 + // If extend_filter exists, result returned by calling the method if($extend_filter) { - // extend_filter가 있을 경우 캐시 사용을 못하도록 js 캐시 파일명을 변경 + // If extend_filter exists, it changes the name of cache not to use cache $this->js_file .= '.nocache.js'; - // extend_filter는 module.method 로 지칭되어 이를 분리 + // Separate the extend_filter list($module_name, $method) = explode('.',$extend_filter); - // 모듈 이름과 method가 있을 경우 진행 + // contibue if both module_name and methos exist. if($module_name&&$method) { - // 해당 module의 model 객체를 받음 + // get model object of the module $oExtendFilter = &getModel($module_name); - // method가 존재하면 실행 + // execute if method exists if(method_exists($oExtendFilter, $method)) { - // 결과를 받음 + // get the result $extend_filter_list = $oExtendFilter->{$method}(true); $extend_filter_count = count($extend_filter_list); - // 결과에서 lang값을 이용 문서 변수에 적용 + // apply lang_value from the result to the variable for($i=0; $i < $extend_filter_count; $i++) { $name = $extend_filter_list[$i]->name; $lang_value = $extend_filter_list[$i]->lang; @@ -132,7 +132,7 @@ } } - // 언어 입력을 위한 사용되는 필드 조사 + // search the field to be used for entering language $target_list = array(); $target_type_list = array(); @@ -152,7 +152,7 @@ } } - // field, 즉 체크항목의 script 생성 + // generates a field, which is a script of the checked item $node_count = count($field_node); if($node_count) { foreach($field_node as $key =>$node) { @@ -179,7 +179,7 @@ } } - // extend_filter_item 체크 + // Check extend_filter_item $rule_types = array('homepage'=>'homepage', 'email_address'=>'email'); for($i=0;$i<$extend_filter_count;$i++) { @@ -188,7 +188,7 @@ if(!$target) continue; - // extend filter item의 type으로 rule을 구함 + // get the filter from the type of extend filter item $type = $filter_item->type; $rule = $rule_types[$type]?$rule_types[$type]:''; $required = ($filter_item->required == 'true'); @@ -202,11 +202,11 @@ if(!$target_type_list[$target]) $target_type_list[$target] = $type; } - // 데이터를 만들기 위한 parameter script 생성 + // generates parameter script to create dbata $rename_params = array(); $parameter_count = count($parameter_param); if($parameter_count) { - // 기본 필터 내용의 parameter로 구성 + // contains parameter of the default filter contents foreach($parameter_param as $key =>$param) { $attrs = $param->attrs; $name = trim($attrs->name); @@ -217,7 +217,7 @@ if($name && !in_array($name, $target_list)) $target_list[] = $name; } - // extend_filter_item 체크 + // Check extend_filter_item for($i=0;$i<$extend_filter_count;$i++) { $filter_item = $extend_filter_list[$i]; $target = $name = trim($filter_item->name); @@ -227,7 +227,7 @@ } } - // response script 생성 + // generates the response script $response_count = count($response_tag); $responses = array(); for($i=0;$i<$response_count;$i++) { @@ -236,7 +236,7 @@ $responses[] = "'{$name}'"; } - // lang : form field description + // writes lang values of the form field $target_count = count($target_list); for($i=0;$i<$target_count;$i++) { $target = $target_list[$i]; @@ -244,7 +244,7 @@ $js_messages[] = sprintf("v.cast('ADD_MESSAGE',['%s','%s']);", $target, addslashes($lang->{$target})); } - // target type을 기록 + // writes the target type /* $target_type_count = count($target_type_list); if($target_type_count) { @@ -254,7 +254,7 @@ } */ - // lang : error message + // writes error messages foreach($lang->filter as $key => $val) { if(!$val) $val = $key; $js_messages[] = sprintf("v.cast('ADD_MESSAGE',['%s','%s']);", $key, $val); @@ -276,7 +276,7 @@ $jsdoc[] = '})(jQuery);'; $jsdoc = implode("\n", $jsdoc); - // js파일 생성 + // generates the js file FileHandler::writeFile($this->js_file, $jsdoc); } diff --git a/classes/xml/XmlParser.class.php b/classes/xml/XmlParser.class.php index 04469a3a1..adc564b5d 100644 --- a/classes/xml/XmlParser.class.php +++ b/classes/xml/XmlParser.class.php @@ -19,10 +19,10 @@ var $input = NULL; ///< input xml var $output = array(); ///< output object - var $lang = "en"; ///< 기본 언어타입 + var $lang = "en"; // /< The default language type /** - * @brief load a xml file specified by a filename and parse it to return the resultant data object + * @brief load a xml file specified by a filename and parse it to Return the resultant data object * @param[in] $filename a file path of file * @return Returns a data object containing data extracted from a xml file or NULL if a specified file does not exist **/ @@ -40,7 +40,7 @@ * @return Returns a resultant data object or NULL in case of error **/ function parse($input = '') { - // 디버그를 위한 컴파일 시작 시간 저장 + // Save the compile starting time for debugging if(__DEBUG__==3) $start = getMicroTime(); $this->lang = Context::getLangType(); @@ -48,12 +48,12 @@ $this->input = $input?$input:$GLOBALS['HTTP_RAW_POST_DATA']; $this->input = str_replace(array('',''),array('',''),$this->input); - // 지원언어 종류를 뽑음 + // extracts a supported language preg_match_all("/xml:lang=\"([^\"].+)\"/i", $this->input, $matches); - // xml:lang이 쓰였을 경우 지원하는 언어종류를 뽑음 + // extracts the supported lanuage when xml:lang is used if(count($matches[1]) && $supported_lang = array_unique($matches[1])) { - // supported_lang에 현재 접속자의 lang이 없으면 en이 있는지 확인하여 en이 있으면 en을 기본, 아니면 첫번째것을.. + // if lang of the first log-in user doesn't exist, apply en by default if exists. Otherwise apply the first lang. if(!in_array($this->lang, $supported_lang)) { if(in_array('en', $supported_lang)) { $this->lang = 'en'; @@ -61,7 +61,7 @@ $this->lang = array_shift($supported_lang); } } - // 특별한 언어가 지정되지 않았다면 언어체크를 하지 않음 + // uncheck the language if no specific language is set. } else { unset($this->lang); } @@ -78,8 +78,7 @@ if(!count($this->output)) return; $output = array_shift($this->output); - - // 디버그를 위한 컴파일 시작 시간 저장 + // Save compile starting time for debugging if(__DEBUG__==3) $GLOBALS['__xmlparse_elapsed__'] += getMicroTime() - $start; return $output; diff --git a/classes/xml/XmlQueryParser.class.php b/classes/xml/XmlQueryParser.class.php index cd474162e..660c1ba58 100644 --- a/classes/xml/XmlQueryParser.class.php +++ b/classes/xml/XmlQueryParser.class.php @@ -23,7 +23,7 @@ * @remarks {there should be a way to report an error} **/ function parse($query_id, $xml_file, $cache_file) { - // query xml 파일을 찾아서 파싱, 결과가 없으면 return + // parse the query xml file. Return if get no result $buff = FileHandler::readFile($xml_file); $xml_obj = parent::parse($buff); if(!$xml_obj) return; @@ -40,12 +40,10 @@ $module = $id_args[1]; $id = $id_args[2]; } - - // insert, update, delete, select등의 action + // actions like insert, update, delete, select and so on $action = strtolower($xml_obj->query->attrs->action); if(!$action) return; - - // 테이블 정리 (배열코드로 변환) + // get the table list(converting an array code) $tables = $xml_obj->query->tables->table; $output->left_tables = array(); @@ -54,8 +52,7 @@ if(!$tables) return; if(!is_array($tables)) $tables = array($tables); foreach($tables as $key => $val) { - - // 테이블과 alias의 이름을 구함 + // get the name of tables and aliases $table_name = $val->attrs->name; $alias = $val->attrs->alias; if(!$alias) $alias = $table_name; @@ -66,8 +63,7 @@ $output->left_tables[$alias] = $val->attrs->type; $left_conditions[$alias] = $val->conditions; } - - // 테이블을 찾아서 컬럼의 속성을 구함 + // get column properties from the table $table_file = sprintf('%s%s/%s/schemas/%s.xml', _XE_PATH_, 'modules', $module, $table_name); if(!file_exists($table_file)) { $searched_list = FileHandler::readDir(_XE_PATH_.'modules'); @@ -93,9 +89,7 @@ } } } - - - // 컬럼 정리 + // Column list $columns = $xml_obj->query->columns->column; $out = $this->_setColumn($columns); $output->columns = $out->columns; @@ -114,8 +108,7 @@ $group_list = $xml_obj->query->groups->group; $out = $this->_setGroup($group_list); $output->groups = $out->groups; - - // 네비게이션 정리 + // Navigation $out = $this->_setNavigation($xml_obj); $output->order = $out->order; $output->list_count = $out->list_count; @@ -132,8 +125,7 @@ } } $buff .= ' );'."\n"; - - // php script 생성 + // generates a php script $buff .= '$output->_tables = array( '; foreach($output->tables as $key => $val) { $buff .= sprintf('"%s"=>"%s",', $key, $val); @@ -147,22 +139,19 @@ } $buff .= ' );'."\n"; } - - // column 정리 + // column info if($column_count) { $buff .= '$output->columns = array ( '; $buff .= $this->_getColumn($output->columns); $buff .= ' );'."\n"; } - - // conditions 정리 + // get conditions if($condition_count) { $buff .= '$output->conditions = array ( '; $buff .= $this->_getConditions($output->conditions); $buff .= ' );'."\n"; } - - // conditions 정리 + // get conditions if(count($output->left_conditions)) { $buff .= '$output->left_conditions = array ( '; foreach($output->left_conditions as $key => $val){ @@ -173,7 +162,7 @@ $buff .= ' );'."\n"; } - // args 변수 확인 + // get arguments $arg_list = $this->getArguments(); if($arg_list) { @@ -184,7 +173,7 @@ } } - // order 정리 + // order if($output->order) { $buff .= '$output->order = array('; foreach($output->order as $key => $val) { @@ -193,22 +182,22 @@ $buff .= ');'."\n"; } - // list_count 정리 + // list_count if($output->list_count) { $buff .= sprintf('$output->list_count = array("var"=>"%s", "value"=>$args->%s?$args->%s:"%s");%s', $output->list_count->var, $output->list_count->var, $output->list_count->var, $output->list_count->default,"\n"); } - // page_count 정리 + // page_count if($output->page_count) { $buff .= sprintf('$output->page_count = array("var"=>"%s", "value"=>$args->%s?$args->%s:"%s");%s', $output->page_count->var, $output->page_count->var, $output->page_count->var, $output->list_count->default,"\n"); } - // page 정리 + // page order if($output->page) { $buff .= sprintf('$output->page = array("var"=>"%s", "value"=>$args->%s?$args->%s:"%s");%s', $output->page->var, $output->page->var, $output->page->var, $output->list->default,"\n"); } - // group by 정리 + // group by if($output->groups) { $buff .= sprintf('$output->groups = array("%s");%s', implode('","',$output->groups),"\n"); } @@ -255,7 +244,7 @@ . $buff . 'return $output; ?>'; - // 저장 + // Save FileHandler::writeFile($cache_file, $buff); } @@ -301,8 +290,7 @@ * @result Returns $output */ function _setConditions($conditions){ - // 조건절 정리 - + // Conditional clause $condition = $conditions->condition; if($condition) { $obj->condition = $condition; @@ -344,7 +332,7 @@ * @result Returns $output */ function _setGroup($group_list){ - // group 정리 + // group list if($group_list) { if(!is_array($group_list)) $group_list = array($group_list); diff --git a/common/js/plugins/filebox/filebox.js b/common/js/plugins/filebox/filebox.js index ed05a9df1..92137822a 100644 --- a/common/js/plugins/filebox/filebox.js +++ b/common/js/plugins/filebox/filebox.js @@ -7,7 +7,7 @@ var filebox = { selected : null, /** - * 파일 박스 창 팝업 + * pop up the file box */ open : function(input_obj, filter) { this.selected = input_obj; @@ -22,7 +22,7 @@ }, /** - * 파일 선택 + * select a file */ selectFile : function(file_url, module_filebox_srl){ var target = $(opener.XE.filebox.selected); @@ -37,7 +37,7 @@ }, /** - * 파일 선택 취소 + * cancel */ cancel : function(name) { $('[name=' + name + ']').val(''); @@ -46,7 +46,7 @@ }, /** - * 파일 삭제 + * delete a file */ deleteFile : function(module_filebox_srl){ var params = { @@ -57,7 +57,7 @@ }, /** - * 초기화 + * initialize */ init : function(name) { var file; @@ -76,7 +76,7 @@ } }; - // XE에 담기 + // put the file into XE $.extend(window.XE, {'filebox' : filebox}); }) (jQuery); diff --git a/config/config.inc.php b/config/config.inc.php index 3465faffa..a9198238d 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -2,7 +2,7 @@ /** * @file config/config.inc.php * @author NHN (developers@xpressengine.com) - * @brief 기본적으로 사용하는 class파일의 include 및 환경 설정을 함 + * @brief set the include of the class file and other environment configurations **/ @error_reporting(E_ALL ^ E_NOTICE); @@ -10,13 +10,13 @@ if(!defined('__ZBXE__')) exit(); /** - * @brief XE의 전체 버전 표기 - * 이 파일의 수정이 없더라도 공식 릴리즈시에 수정되어 함께 배포되어야 함 + * @brief display XE's full version + * Even The file should be revised when releasing altough no change is made **/ define('__ZBXE_VERSION__', '1.4.5.2'); /** - * @brief zbXE가 설치된 장소의 base path를 구함 + * @brief The base path to where you installed zbXE Wanted **/ define('_XE_PATH_', str_replace('config/config.inc.php', '', str_replace('\\', '/', __FILE__))); @@ -26,8 +26,8 @@ ini_set('session.use_only_cookies', 0); /** - * @brief 기본 설정에 우선하는 사용자 설정 파일 - * config/config.user.inc.php 파일에 아래 내용을 저장하면 됨 + * @brief user configuration files which override the default settings + * save the following information into config/config.user.inc.php * !is", removeSrcHack, $content); @@ -690,7 +687,7 @@ $xml_doc = $oXmlParser->parse($buff); if(!$xml_doc) return sprintf("<%s>", $tag); - // src값에 module=admin이라는 값이 입력되어 있으면 이 값을 무효화 시킴 + // invalidate the value if src value is module = admin. $src = $xml_doc->attrs->src; $dynsrc = $xml_doc->attrs->dynsrc; $lowsrc = $xml_doc->attrs->lowsrc; @@ -748,7 +745,7 @@ } /** - * @brief attribute의 value를 " 로 둘러싸도록 처리하는 함수 + * @brief function to enclose attribute values to double quotes(") **/ function fixQuotation($matches) { $key = $matches[1]; @@ -774,8 +771,7 @@ return $output; } - - // hexa값을 RGB로 변환 + // convert hexa value to RGB if(!function_exists('hexrgb')) { function hexrgb($hexstr) { $int = hexdec($hexstr); @@ -788,9 +784,9 @@ } /** - * @brief mysql old_password 의 php 구현 함수 - * 제로보드4나 기타 mysql4.1 이전의 old_password()함수를 쓴 데이터의 사용을 위해서 - * mysql의 password.c 소스 참조해서 구현함 + * @brief php function for mysql old_password() + * provides backward compatibility for zero board4 which uses old_password() of mysql 4.1 earlier versions. + * the function implemented by referring to the source codes of password.c file in mysql **/ function mysql_pre4_hash_password($password) { $nr = 1345345333; @@ -816,7 +812,7 @@ } /** - * 현재 요청받은 스크립트 경로를 return + * return the requested script path **/ function getScriptPath() { static $url = null; @@ -825,7 +821,7 @@ } /** - * javascript의 escape의 php unescape 함수 + * php unescape function of javascript's escape * Function converts an Javascript escaped string back into a string with specified charset (default is UTF-8). * Modified function from http://pure-essence.net/stuff/code/utf8RawUrlDecode.phps **/ diff --git a/index.php b/index.php index 4e22923dc..8aaeb4356 100644 --- a/index.php +++ b/index.php @@ -2,16 +2,16 @@ /** * @file index.php * @author NHN (developers@xpressengine.com) - * @brief 시작 페이지 + * @brief Start page * - * Request Argument에서 mid, act로 module 객체를 찾아서 생성하고 \n - * 모듈 정보를 세팅함 + * Find and create module object by mif, act in Request Argument \n + * Set module information * * @mainpage XpressEngine - * @section intro 소개 - * XE 는 오픈 프로젝트로 개발되는 오픈 소스입니다.\n - * 자세한 내용은 아래 링크를 참조하세요. - * - 공식홈페이지 : http://www.xpressengine.com + * @section intro introduction + * XE is an opensource and being developed in the opensource project. \N + * For more information, please see the link below. + * - Official website: http://www.xpressengine.com * - SVN Repository : http://svn.xpressengine.net/xe * \n * "XpressEngine (XE)" is free software; you can redistribute it and/or \n @@ -31,24 +31,24 @@ **/ /** - * @brief 기본적인 상수 선언, 웹에서 직접 호출되는 것을 막기 위해 체크하는 상수 선언 + * @brief Declare constants for generic use and for checking to avoid a direct call from the Web **/ define('__ZBXE__', true); /** - * @brief 필요한 설정 파일들을 include + * @brief Include the necessary configuration files **/ require('./config/config.inc.php'); /** - * @brief create and initialize a Context object - * 모든 Request Argument/ 환경변수등을 세팅 + * @brief Initialize by creating Context object + * Set all Request Argument/Environment variables **/ $oContext = &Context::getInstance(); $oContext->init(); /** - * @brief default_url 이 설정되어 있고 현재 url이 default_url과 다르면 SSO인증을 위한 rediret 시도 후 모듈 동작 + * @brief If default_url is set and it is different from the current url, attempt to redirect for SSO authentication and then process the module **/ if($oContext->checkSSO()) { $oModuleHandler = new ModuleHandler(); diff --git a/modules/addon/addon.admin.controller.php b/modules/addon/addon.admin.controller.php index 93934cc04..0af987029 100644 --- a/modules/addon/addon.admin.controller.php +++ b/modules/addon/addon.admin.controller.php @@ -2,35 +2,33 @@ /** * @class addonAdminController * @author NHN (developers@xpressengine.com) - * @brief addon 모듈의 admin controller class + * @brief admin controller class of addon modules **/ include_once('addon.controller.php'); class addonAdminController extends addonController { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 애드온의 활성/비활성 체인지 + * @brief Add active/inactive change **/ function procAddonAdminToggleActivate() { $oAddonModel = &getAdminModel('addon'); $site_module_info = Context::get('site_module_info'); - - // addon값을 받아옴 + // batahom addon values $addon = Context::get('addon'); $type = Context::get('type'); if(!$type) $type = "pc"; if($addon) { - // 활성화 되어 있으면 비활성화 시킴 + // If enabled Disables if($oAddonModel->isActivatedAddon($addon, $site_module_info->site_srl, $type)) $this->doDeactivate($addon, $site_module_info->site_srl, $type); - - // 비활성화 되어 있으면 활성화 시킴 + // If it is disabled Activate else $this->doActivate($addon, $site_module_info->site_srl, $type); } @@ -38,7 +36,7 @@ } /** - * @brief 애드온 설정 정보 입력 + * @brief Add the configuration information input **/ function procAddonAdminSetupAddon() { $args = Context::getRequestVars(); @@ -59,8 +57,8 @@ /** - * @brief 애드온 추가 - * DB에 애드온을 추가함 + * @brief Add-on + * Adds Add to DB **/ function doInsert($addon, $site_srl = 0) { $args->addon = $addon; @@ -71,8 +69,8 @@ } /** - * @brief 애드온 활성화 - * addons라는 테이블에 애드온의 활성화 상태를 on 시켜줌 + * @brief Add-activated + * addons add-ons to the table on the activation state sikyeojum **/ function doActivate($addon, $site_srl = 0, $type = "pc") { $args->addon = $addon; @@ -84,9 +82,9 @@ } /** - * @brief 애드온 비활성화 + * @brief Disable Add-ons * - * addons라는 테이블에 애드온의 이름을 제거하는 것으로 비활성화를 시키게 된다 + * addons add a table to remove the name of the deactivation is sikige **/ function doDeactivate($addon, $site_srl = 0, $type = "pc") { $args->addon = $addon; diff --git a/modules/addon/addon.admin.model.php b/modules/addon/addon.admin.model.php index 23c9125ac..e066f28a9 100644 --- a/modules/addon/addon.admin.model.php +++ b/modules/addon/addon.admin.model.php @@ -2,19 +2,19 @@ /** * @class addonAdminModel * @author NHN (developers@xpressengine.com) - * @brief addon 모듈의 admin model class + * @brief admin model class of addon modules **/ class addonAdminModel extends addon { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 애드온의 경로를 구함 + * @brief Wanted to add the path to **/ function getAddonPath($addon_name) { $class_path = sprintf('./addons/%s/', $addon_name); @@ -23,27 +23,24 @@ } /** - * @brief 애드온의 종류와 정보를 구함 + * @brief Wanted to add the kind of information and **/ function getAddonList($site_srl = 0) { - // activated된 애드온 목록을 구함 + // Wanted to add a list of activated $inserted_addons = $this->getInsertedAddons($site_srl); - - // 다운받은 애드온과 설치된 애드온의 목록을 구함 + // Downloaded and installed add-on to the list of Wanted $searched_list = FileHandler::readDir('./addons'); $searched_count = count($searched_list); if(!$searched_count) return; sort($searched_list); for($i=0;$i<$searched_count;$i++) { - // 애드온의 이름 + // Add the name of $addon_name = $searched_list[$i]; if($addon_name == "smartphone") continue; - - // 애드온의 경로 (files/addons가 우선) + // Add the path (files/addons precedence) $path = $this->getAddonPath($addon_name); - - // 해당 애드온의 정보를 구함 + // Wanted information on the add-on unset($info); $info = $this->getAddonInfoXml($addon_name, $site_srl); @@ -51,14 +48,12 @@ $info->path = $path; $info->activated = false; $info->mactivated = false; - - // DB에 입력되어 있는지 확인 + // Check if a permossion is granted entered in DB if(!in_array($addon_name, array_keys($inserted_addons))) { - // DB에 입력되어 있지 않으면 입력 (model에서 이런짓 하는거 싫지만 귀찮아서.. ㅡ.ㅜ) + // If not, type in the DB type (model, perhaps because of the hate doing this haneungeo .. ㅡ. ㅜ) $oAddonAdminController = &getAdminController('addon'); $oAddonAdminController->doInsert($addon_name, $site_srl); - - // 활성화 되어 있는지 확인 + // Is activated } else { if($inserted_addons[$addon_name]->is_used=='Y') $info->activated = true; if($inserted_addons[$addon_name]->is_used_m=='Y') $info->mactivated = true; @@ -70,14 +65,13 @@ } /** - * @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함 + * @brief Modules conf/info.xml wanted to read the information **/ function getAddonInfoXml($addon, $site_srl = 0) { - // 요청된 모듈의 경로를 구한다. 없으면 return + // Get a path of the requested module. Return if not exists. $addon_path = $this->getAddonPath($addon); if(!$addon_path) return; - - // 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음 + // Read the xml file for module skin information $xml_file = sprintf("%sconf/info.xml", $addon_path); if(!file_exists($xml_file)) return; @@ -88,7 +82,7 @@ if(!$xml_obj) return; - // DB에 설정된 내역을 가져온다 + // DB is set to bring history $db_args->addon = $addon; if(!$site_srl) $output = executeQuery('addon.getAddonInfo',$db_args); else { @@ -104,7 +98,7 @@ } - // 애드온 정보 + // Add information if($xml_obj->version && $xml_obj->attrs->version == '0.2') { // addon format v0.2 sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); @@ -129,7 +123,7 @@ $addon_info->author[] = $author_obj; } - // 확장변수를 정리 + // Expand the variable order if($xml_obj->extra_vars) { $extra_var_groups = $xml_obj->extra_vars->group; if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; @@ -152,7 +146,7 @@ if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } - // 'select'type에서 option목록을 구한다. + // 'Select'type obtained from the option list. if(is_array($val->options)) { $option_count = count($val->options); @@ -227,7 +221,7 @@ $addon_info->author[] = $author_obj; if($xml_obj->extra_vars) { - // 확장변수를 정리 + // Expand the variable order $extra_var_groups = $xml_obj->extra_vars->group; if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); @@ -247,8 +241,7 @@ $obj->value = $extra_vals->{$obj->name}; if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } - - // 'select'type에서 option목록을 구한다. + // 'Select'type obtained from the option list. if(is_array($val->options)) { $option_count = count($val->options); @@ -271,7 +264,7 @@ } /** - * @brief 활성화된 애드온 목록을 구해옴 + * @brief Add to the list of active guhaeom **/ function getInsertedAddons($site_srl = 0) { $args->list_order = 'addon'; @@ -292,7 +285,7 @@ } /** - * @brief 애드온이 활성화 되어 있는지 체크 + * @brief Add-on is enabled, check whether **/ function isActivatedAddon($addon, $site_srl = 0, $type = "pc") { $args->addon = $addon; diff --git a/modules/addon/addon.admin.view.php b/modules/addon/addon.admin.view.php index bc4c6c04e..b390745cd 100644 --- a/modules/addon/addon.admin.view.php +++ b/modules/addon/addon.admin.view.php @@ -2,57 +2,51 @@ /** * @class addonAdminView * @author NHN (developers@xpressengine.com) - * @brief addon 모듈의 admin view class + * @brief admin view class of addon modules **/ class addonAdminView extends addon { /** - * @brief 초기화 + * @brief Initialization **/ function init() { $this->setTemplatePath($this->module_path.'tpl'); } /** - * @brief 애드온 관리 메인 페이지 (목록 보여줌) + * @brief Add Management main page (showing the list) **/ function dispAddonAdminIndex() { $site_module_info = Context::get('site_module_info'); - - // 애드온 목록을 세팅 + // Add to the list settings $oAddonModel = &getAdminModel('addon'); $addon_list = $oAddonModel->getAddonList($site_module_info->site_srl); Context::set('addon_list', $addon_list); - - // 템플릿 패스 및 파일을 지정 + // Template specifies the path and file $this->setTemplateFile('addon_list'); } /** - * @biref 애드온 세부 설정 팝업 출력 + * @biref Setting out the details pop-up add-on **/ function dispAddonAdminSetup() { $site_module_info = Context::get('site_module_info'); - - // 요청된 애드온을 구함 + // Wanted to add the requested $selected_addon = Context::get('selected_addon'); - - // 요청된 애드온의 정보를 구함 + // Wanted to add the requested information $oAddonModel = &getAdminModel('addon'); $addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl); Context::set('addon_info', $addon_info); - - // mid 목록을 가져옴 + // Get a mid list $oModuleModel = &getModel('module'); $oModuleAdminModel = &getAdminModel('module'); if($site_module_info->site_srl) $args->site_srl = $site_module_info->site_srl; $mid_list = $oModuleModel->getMidList($args); - - // module_category와 module의 조합 + // module_category and module combination if(!$site_module_info->site_srl) { - // 모듈 카테고리 목록을 구함 + // Get a list of module categories $module_categories = $oModuleModel->getModuleCategories(); if($mid_list) { @@ -65,32 +59,26 @@ } Context::set('mid_list',$module_categories); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 패스 및 파일을 지정 + // Template specifies the path and file $this->setTemplateFile('setup_addon'); } /** - * @brief 애드온의 상세 정보(conf/info.xml)를 팝업 출력 + * @brief Add details (conf/info.xml) a pop-out **/ function dispAddonAdminInfo() { $site_module_info = Context::get('site_module_info'); - - // 요청된 애드온을 구함 + // Wanted to add the requested $selected_addon = Context::get('selected_addon'); - - // 요청된 애드온의 정보를 구함 + // Wanted to add the requested information $oAddonModel = &getAdminModel('addon'); $addon_info = $oAddonModel->getAddonInfoXml($selected_addon, $site_module_info->site_srl); Context::set('addon_info', $addon_info); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 패스 및 파일을 지정 + // Template specifies the path and file $this->setTemplateFile('addon_info'); } diff --git a/modules/addon/addon.class.php b/modules/addon/addon.class.php index f75dbc47e..c02df08c0 100644 --- a/modules/addon/addon.class.php +++ b/modules/addon/addon.class.php @@ -2,16 +2,16 @@ /** * @class addon * @author NHN (developers@xpressengine.com) - * @brief addon 모듈의 high class + * @brief high class of addon modules **/ class addon extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // 몇가지 애드온을 등록 + // Register to add a few $oAddonController = &getAdminController('addon'); $oAddonController->doInsert('autolink'); $oAddonController->doInsert('blogapi'); @@ -23,8 +23,7 @@ $oAddonController->doInsert('resize_image'); $oAddonController->doInsert('openid_delegation_id'); $oAddonController->doInsert('point_level_icon'); - - // 몇가지 애드온을 기본 활성화 상태로 변경 + // To add a few changes to the default activation state $oAddonController->doActivate('autolink'); $oAddonController->doActivate('counter'); $oAddonController->doActivate('member_communication'); @@ -37,7 +36,7 @@ } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { $oDB = &DB::getInstance(); @@ -47,7 +46,7 @@ } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { $oDB = &DB::getInstance(); @@ -61,7 +60,7 @@ } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { FileHandler::removeFilesInDir('./files/cache/addons'); diff --git a/modules/addon/addon.controller.php b/modules/addon/addon.controller.php index 205f377fc..c5141118e 100644 --- a/modules/addon/addon.controller.php +++ b/modules/addon/addon.controller.php @@ -2,20 +2,20 @@ /** * @class addonController * @author NHN (developers@xpressengine.com) - * @brief addon 모듈의 controller class + * @brief addon module's controller class **/ class addonController extends addon { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 메인/ 가상 사이트별 애드온 캐시 파일의 위치를 구함 + * @brief Main/Virtual-specific add-on file, the location of the cache Wanted **/ function getCacheFilePath($type = "pc") { $site_module_info = Context::get('site_module_info'); @@ -36,7 +36,7 @@ /** - * @brief 애드온 mid 추가 설정 + * @brief Add-on mid settings **/ function _getMidList($selected_addon, $site_srl = 0) { @@ -48,11 +48,10 @@ /** - * @brief 애드온 mid 추가 설정 + * @brief Add-on mid settings **/ function _setAddMid($selected_addon,$mid, $site_srl=0) { - - // 요청된 애드온의 정보를 구함 + // Wanted to add the requested information $mid_list = $this->_getMidList($selected_addon, $site_srl); $mid_list[] = $mid; @@ -62,11 +61,10 @@ /** - * @brief 애드온 mid 추가 설정 + * @brief Add-on mid settings **/ function _setDelMid($selected_addon,$mid,$site_srl=0) { - - // 요청된 애드온의 정보를 구함 + // Wanted to add the requested information $mid_list = $this->_getMidList($selected_addon,$site_srl); $new_mid_list = array(); @@ -83,7 +81,7 @@ } /** - * @brief 애드온 mid 추가 설정 + * @brief Add-on mid settings **/ function _setMid($selected_addon,$mid_list,$site_srl=0) { $args->mid_list = join('|@|',$mid_list); @@ -93,7 +91,7 @@ /** - * @brief 애드온 mid 추가 + * @brief Add mid-on **/ function procAddonSetupAddonAddMid() { $site_module_info = Context::get('site_module_info'); @@ -105,7 +103,7 @@ } /** - * @brief 애드온 mid 삭제 + * @brief Add mid Delete **/ function procAddonSetupAddonDelMid() { $site_module_info = Context::get('site_module_info'); @@ -118,10 +116,10 @@ } /** - * @brief 캐시 파일 생성 + * @brief Re-generate the cache file **/ function makeCacheFile($site_srl = 0, $type = "pc") { - // 모듈에서 애드온을 사용하기 위한 캐시 파일 생성 + // Add-on module for use in creating the cache file $buff = ""; $oAddonModel = &getAdminModel('addon'); $addon_list = $oAddonModel->getInsertedAddons($site_srl, $type); @@ -155,7 +153,7 @@ } /** - * @brief 애드온 설정 + * @brief Add-On Set **/ function doSetup($addon, $extra_vars,$site_srl=0) { if($extra_vars->mid_list) $extra_vars->mid_list = explode('|@|', $extra_vars->mid_list); @@ -167,7 +165,7 @@ } /** - * @brief 가상 사이트에서의 애드온 정보 제거 + * @brief Remove add-on information in the virtual site **/ function removeAddonConfig($site_srl) { $addon_path = _XE_PATH_.'files/cache/addons/'; diff --git a/modules/admin/admin.admin.view.php b/modules/admin/admin.admin.view.php index ff7d3e896..95b339565 100644 --- a/modules/admin/admin.admin.view.php +++ b/modules/admin/admin.admin.view.php @@ -150,8 +150,7 @@ $oAddonModel = &getAdminModel('addon'); $addon_list = $oAddonModel->getAddonList(); Context::set('addon_list', $addon_list); - - // 방문자수 + // Visitors $time = time(); $w = date("D"); while(date("D",$time) != "Sat") { @@ -193,20 +192,17 @@ $status->week[date("Y.m.d",$i)]->this = (int)$visitors[date("Ymd",$i)]; $status->week[date("Y.m.d",$i)]->last = (int)$visitors[date("Ymd",$i-60*60*24*7)]; } - - // 각종 통계 정보를 구함 + // Wanted various statistical information $output = executeQuery('admin.getTotalVisitors'); $status->total_visitor = $output->data->count; $output = executeQuery('admin.getTotalSiteVisitors'); $status->total_visitor += $output->data->count; $status->visitor = $visitors[date("Ymd")]; - - // 오늘의 댓글 수 + // Today's Number of Comments $args->regdate = date("Ymd"); $output = executeQuery('admin.getTodayCommentCount', $args); $status->comment_count = $output->data->count; - - // 오늘의 엮인글 수 + // Today Wed yeokingeul $args->regdate = date("Ymd"); $output = executeQuery('admin.getTodayTrackbackCount', $args); $status->trackback_count = $output->data->count; diff --git a/modules/autoinstall/autoinstall.admin.controller.php b/modules/autoinstall/autoinstall.admin.controller.php index 7541ac768..7c61f96b8 100644 --- a/modules/autoinstall/autoinstall.admin.controller.php +++ b/modules/autoinstall/autoinstall.admin.controller.php @@ -2,7 +2,7 @@ /** * @class autoinstallAdminController * @author NHN (developers@xpressengine.com) - * @brief autoinstall 모듈의 admin controller class + * @brief autoinstall module admin controller class **/ require_once(_XE_PATH_.'modules/autoinstall/autoinstall.lib.php'); @@ -10,7 +10,7 @@ class autoinstallAdminController extends autoinstall { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } diff --git a/modules/autoinstall/autoinstall.admin.view.php b/modules/autoinstall/autoinstall.admin.view.php index 2917987e7..54e0ed7af 100644 --- a/modules/autoinstall/autoinstall.admin.view.php +++ b/modules/autoinstall/autoinstall.admin.view.php @@ -2,7 +2,7 @@ /** * @class autoinstallAdminView * @author NHN (developers@xpressengine.com) - * @brief autoinstall 모듈의 admin view class + * @brief admin view class in the autoinstall module **/ diff --git a/modules/autoinstall/autoinstall.class.php b/modules/autoinstall/autoinstall.class.php index 5fc257d1c..4d4dbc062 100644 --- a/modules/autoinstall/autoinstall.class.php +++ b/modules/autoinstall/autoinstall.class.php @@ -2,7 +2,7 @@ /** * @class autoinstall * @author NHN (developers@xpressengine.com) - * @brief autoinstall 모듈의 high class + * @brief high class of the autoinstall module **/ class XmlGenerater { @@ -36,13 +36,13 @@ var $tmp_dir = './files/cache/autoinstall/'; /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief for additional tasks required when installing **/ function moduleInstall() { } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief method to check if installation is succeeded **/ function checkUpdate() { $oDB =& DB::getInstance(); @@ -61,7 +61,7 @@ } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { $oDB =& DB::getInstance(); @@ -79,7 +79,7 @@ } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { } diff --git a/modules/autoinstall/autoinstall.model.php b/modules/autoinstall/autoinstall.model.php index 8813d98b3..726d3497b 100644 --- a/modules/autoinstall/autoinstall.model.php +++ b/modules/autoinstall/autoinstall.model.php @@ -2,7 +2,7 @@ /** * @class autoinstallModel * @author NHN (developers@xpressengine.com) - * @brief autoinstall 모듈의 Model class + * @brief Model class of the autoinstall module **/ class autoinstallModel extends autoinstall { diff --git a/modules/autoinstall/autoinstall.view.php b/modules/autoinstall/autoinstall.view.php index 6aa3830a7..dc8b10307 100644 --- a/modules/autoinstall/autoinstall.view.php +++ b/modules/autoinstall/autoinstall.view.php @@ -3,13 +3,13 @@ /** * @class autoinstallView * @author NHN (developers@xpressengine.com) - * @brief autoinstall 모듈의 View class + * @brief View class of the autoinstall module **/ class autoinstallView extends autoinstall { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } diff --git a/modules/comment/comment.admin.controller.php b/modules/comment/comment.admin.controller.php index c52dc2b6a..c14534f6b 100644 --- a/modules/comment/comment.admin.controller.php +++ b/modules/comment/comment.admin.controller.php @@ -2,23 +2,22 @@ /** * @class commentAdminController * @author NHN (developers@xpressengine.com) - * @brief comment 모듈의 admin controller class + * @brief admin controller class of the comment module **/ class commentAdminController extends comment { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 관리자 페이지에서 선택된 댓글들을 삭제 + * @brief Delete the selected comment from the administrator page **/ function procCommentAdminDeleteChecked() { - - // 선택된 글이 없으면 오류 표시 + // Error display if none is selected $cart = Context::get('cart'); if(!$cart) return $this->stop('msg_cart_is_null'); $comment_srl_list= explode('|@|', $cart); @@ -28,8 +27,7 @@ $oCommentController = &getController('comment'); $deleted_count = 0; - - // 글삭제 + // Delete the comment posting for($i=0;$i<$comment_count;$i++) { $comment_srl = trim($comment_srl_list[$i]); if(!$comment_srl) continue; @@ -44,7 +42,7 @@ } /** - * @brief 신고대상을 취소 시킴 + * @brief cancel the blacklist of abused comments reported by other users **/ function procCommentAdminCancelDeclare() { $comment_srl = trim(Context::get('comment_srl')); @@ -57,7 +55,7 @@ } /** - * @brief 특정 모듈의 모든 댓글 삭제 + * @brief delete all comments of the specific module **/ function deleteModuleComments($module_srl) { $args->module_srl = $module_srl; diff --git a/modules/comment/comment.admin.view.php b/modules/comment/comment.admin.view.php index 0a5b10a74..41a8b335f 100644 --- a/modules/comment/comment.admin.view.php +++ b/modules/comment/comment.admin.view.php @@ -2,59 +2,57 @@ /** * @class commentAdminView * @author NHN (developers@xpressengine.com) - * @brief comment 모듈의 admin view 클래스 + * @brief admin view class of the comment module **/ class commentAdminView extends comment { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 목록 출력 (관리자용) + * @brief Display the list(for administrators) **/ function dispCommentAdminList() { - // 목록을 구하기 위한 옵션 - $args->page = Context::get('page'); ///< 페이지 - $args->list_count = 30; ///< 한페이지에 보여줄 글 수 - $args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수 + // option to get a list + $args->page = Context::get('page'); // /< Page + $args->list_count = 30; // / the number of postings to appear on a single page + $args->page_count = 10; // / the number of pages to appear on the page navigation - $args->sort_index = 'list_order'; ///< 소팅 값 + $args->sort_index = 'list_order'; // /< Sorting values $args->module_srl = Context::get('module_srl'); - // 목록 구함, comment->getCommentList 에서 걍 알아서 다 해버리는 구조이다... (아.. 이거 나쁜 버릇인데.. ㅡ.ㅜ 어쩔수 없다) + // get a list by using comment->getCommentList. $oCommentModel = &getModel('comment'); $output = $oCommentModel->getTotalCommentList($args); - - // 템플릿에 쓰기 위해서 comment_model::getTotalCommentList() 의 return object에 있는 값들을 세팅 + // set values in the return object of comment_model:: getTotalCommentList() in order to use a template. Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page', $output->page); Context::set('comment_list', $output->data); Context::set('page_navigation', $output->page_navigation); - - // 템플릿 지정 + // set the template $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('comment_list'); } /** - * @brief 관리자 페이지의 신고 목록 보기 + * @brief show the blacklist of comments in the admin page **/ function dispCommentAdminDeclared() { - // 목록을 구하기 위한 옵션 - $args->page = Context::get('page'); ///< 페이지 - $args->list_count = 30; ///< 한페이지에 보여줄 글 수 - $args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수 + // option to get a blacklist + $args->page = Context::get('page'); // /< Page + $args->list_count = 30; // /< the number of comment postings to appear on a single page + $args->page_count = 10; // /< the number of pages to appear on the page navigation - $args->sort_index = 'comment_declared.declared_count'; ///< 소팅 값 - $args->order_type = 'desc'; ///< 소팅 정렬 값 + $args->sort_index = 'comment_declared.declared_count'; // /< sorting values + $args->order_type = 'desc'; // /< sorted value - // 목록을 구함 + // get a list $declared_output = executeQuery('comment.getDeclaredList', $args); if($declared_output->data && count($declared_output->data)) { @@ -68,14 +66,13 @@ $declared_output->data = $comment_list; } - // 템플릿에 쓰기 위해서 comment_model::getCommentList() 의 return object에 있는 값들을 세팅 + // set values in the return object of comment_model:: getCommentList() in order to use a template. Context::set('total_count', $declared_output->total_count); Context::set('total_page', $declared_output->total_page); Context::set('page', $declared_output->page); Context::set('comment_list', $declared_output->data); Context::set('page_navigation', $declared_output->page_navigation); - - // 템플릿 지정 + // set the template $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('declared_list'); } diff --git a/modules/comment/comment.class.php b/modules/comment/comment.class.php index b17b44d62..e51ab28ed 100644 --- a/modules/comment/comment.class.php +++ b/modules/comment/comment.class.php @@ -2,7 +2,7 @@ /** * @class comment * @author NHN (developers@xpressengine.com) - * @brief comment 모듈의 high class + * @brief comment module's high class **/ require_once(_XE_PATH_.'modules/comment/comment.item.php'); @@ -10,45 +10,37 @@ class comment extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief implemented if additional tasks are required when installing **/ function moduleInstall() { - // action forward에 등록 (관리자 모드에서 사용하기 위함) + // register the action forward (for using on the admin mode) $oModuleController = &getController('module'); - - // 2007. 10. 17 게시글이 삭제될때 댓글도 삭제되도록 trigger 등록 + // 2007. 10. 17 add a trigger to delete comments together with posting deleted $oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'); - - // 2007. 10. 17 모듈이 삭제될때 등록된 댓글도 모두 삭제하는 트리거 추가 + // 2007. 10. 17 add a trigger to delete all of comments together with module deleted $oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'); - - // 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가 + // 2008. 02. 22 add comment setting when a new module added $oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'); return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief method to check if installation is succeeded **/ function checkUpdate() { $oDB = &DB::getInstance(); $oModuleModel = &getModel('module'); - - // 2007. 10. 17 게시글이 삭제될때 댓글도 삭제되도록 trigger 등록 + // 2007. 10. 17 add a trigger to delete comments together with posting deleted if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) return true; - - // 2007. 10. 17 모듈이 삭제될때 등록된 댓글도 모두 삭제하는 트리거 추가 + // 2007. 10. 17 add a trigger to delete all of comments together with module deleted if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) return true; - - // 2007. 10. 23 댓글에도 추천/ 알림 기능을 위한 컬럼 추가 + // 2007. 10. 23 add a column for recommendation votes or notification of the comments if(!$oDB->isColumnExists("comments","voted_count")) return true; if(!$oDB->isColumnExists("comments","notify_message")) return true; - - // 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가 + // 2008. 02. 22 add comment setting when a new module added if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) return true; - - // 2008. 05. 14 blamed count 컬럼 추가 + // 2008. 05. 14 add a column for blamed count if(!$oDB->isColumnExists("comments", "blamed_count")) return true; if(!$oDB->isColumnExists("comment_voted_log", "point")) return true; @@ -56,22 +48,19 @@ } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { $oDB = &DB::getInstance(); $oModuleModel = &getModel('module'); $oModuleController = &getController('module'); - - // 2007. 10. 17 게시글이 삭제될때 댓글도 삭제되도록 trigger 등록 + // 2007. 10. 17 add a trigger to delete comments together with posting deleted if(!$oModuleModel->getTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after')) $oModuleController->insertTrigger('document.deleteDocument', 'comment', 'controller', 'triggerDeleteDocumentComments', 'after'); - - // 2007. 10. 17 모듈이 삭제될때 등록된 댓글도 모두 삭제하는 트리거 추가 + // 2007. 10. 17 add a trigger to delete all of comments together with module deleted if(!$oModuleModel->getTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after')) $oModuleController->insertTrigger('module.deleteModule', 'comment', 'controller', 'triggerDeleteModuleComments', 'after'); - - // 2007. 10. 23 댓글에도 추천/ 알림 기능을 위한 컬럼 추가 + // 2007. 10. 23 add a column for recommendation votes or notification of the comments if(!$oDB->isColumnExists("comments","voted_count")) { $oDB->addColumn("comments","voted_count", "number","11"); $oDB->addIndex("comments","idx_voted_count", array("voted_count")); @@ -80,12 +69,10 @@ if(!$oDB->isColumnExists("comments","notify_message")) { $oDB->addColumn("comments","notify_message", "char","1"); } - - // 2008. 02. 22 모듈의 추가 설정에서 댓글 추가 설정 추가 + // 2008. 02. 22 add comment setting when a new module added if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before')) $oModuleController->insertTrigger('module.dispAdditionSetup', 'comment', 'view', 'triggerDispCommentAdditionSetup', 'before'); - - // 2008. 05. 14 blamed count 컬럼 추가 + // 2008. 05. 14 add a column for blamed count if(!$oDB->isColumnExists("comments", "blamed_count")) { $oDB->addColumn('comments', 'blamed_count', 'number', 11, 0, true); $oDB->addIndex('comments', 'idx_blamed_count', array('blamed_count')); @@ -97,7 +84,7 @@ } /** - * @brief 캐시 파일 재생성 + * @brief Regenerate cache file **/ function recompileCache() { } diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index 9e84d6ac0..007e5e3d8 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -2,19 +2,19 @@ /** * @class commentController * @author NHN (developers@xpressengine.com) - * @brief comment 모듈의 controller class + * @brief controller class of the comment module **/ class commentController extends comment { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 댓글의 추천을 처리하는 action (Up) + * @brief action to handle recommendation votes on comments (Up) **/ function procCommentVoteUp() { if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); @@ -36,7 +36,7 @@ } /** - * @brief 댓글의 추천을 처리하는 action (Down) + * @brief action to handle recommendation votes on comments (Down) **/ function procCommentVoteDown() { if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); @@ -58,7 +58,7 @@ } /** - * @brief 댓글이 신고될 경우 호출되는 action + * @brief action to be called when a comment posting is reported **/ function procCommentDeclare() { if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); @@ -70,7 +70,7 @@ } /** - * @brief document삭제시 해당 document의 댓글을 삭제하는 trigger + * @brief trigger to delete its comments together with document deleted **/ function triggerDeleteDocumentComments(&$obj) { $document_srl = $obj->document_srl; @@ -80,7 +80,7 @@ } /** - * @brief module 삭제시 해당 댓글을 모두 삭제하는 trigger + * @brief trigger to delete corresponding comments when deleting a module **/ function triggerDeleteModuleComments(&$obj) { $module_srl = $obj->module_srl; @@ -91,32 +91,30 @@ } /** - * @brief 코멘트의 권한 부여 - * 세션값으로 현 접속상태에서만 사용 가능 + * @brief Authorization of the comments + * available only in the current connection of the session value **/ function addGrant($comment_srl) { $_SESSION['own_comment'][$comment_srl] = true; } /** - * @brief 댓글 입력 + * @brief Enter comments **/ function insertComment($obj, $manual_inserted = false) { $obj->__isupdate = false; - // trigger 호출 (before) + // call a trigger (before) $output = ModuleHandler::triggerCall('comment.insertComment', 'before', $obj); if(!$output->toBool()) return $output; - - // document_srl에 해당하는 글이 있는지 확인 + // check if a posting of the corresponding document_srl exists $document_srl = $obj->document_srl; if(!$document_srl) return new Object(-1,'msg_invalid_document'); - - // document model 객체 생성 + // get a object of document model $oDocumentModel = &getModel('document'); // even for manual_inserted if password exists, md5 it. if($obj->password) $obj->password = md5($obj->password); - // 원본글을 가져옴 + // get the original posting if(!$manual_inserted) { $oDocument = $oDocumentModel->getDocument($document_srl); @@ -124,8 +122,7 @@ if($oDocument->isLocked()) return new Object(-1,'msg_invalid_request'); if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; - - // 로그인 된 회원일 경우 회원의 정보를 입력 + // input the member's information if logged-in if(Context::get('is_logged')) { $logged_info = Context::get('logged_info'); $obj->member_srl = $logged_info->member_srl; @@ -136,24 +133,20 @@ $obj->homepage = $logged_info->homepage; } } - - // 로그인정보가 없고 사용자 이름이 없으면 오류 표시 + // error display if neither of log-in info and user name exist. if(!$logged_info->member_srl && !$obj->nick_name) return new Object(-1,'msg_invalid_request'); if(!$obj->comment_srl) $obj->comment_srl = getNextSequence(); - - // 순서를 정함 + // determine the order $obj->list_order = getNextSequence() * -1; - - // 내용에서 XE만의 태그를 삭제 + // remove XE's own tags from the contents $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); if(Mobile::isFromMobilePhone()) { $obj->content = nl2br(htmlspecialchars($obj->content)); } if(!$obj->regdate) $obj->regdate = date("YmdHis"); - - // 세션에서 최고 관리자가 아니면 iframe, script 제거 + // remove iframe and script if not a top administrator on the session. if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content); if(!$obj->notify_message) $obj->notify_message = 'N'; @@ -162,38 +155,32 @@ // begin transaction $oDB = &DB::getInstance(); $oDB->begin(); - - // 댓글 목록 부분을 먼저 입력 + // Enter a list of comments first $list_args->comment_srl = $obj->comment_srl; $list_args->document_srl = $obj->document_srl; $list_args->module_srl = $obj->module_srl; $list_args->regdate = $obj->regdate; - - // 부모댓글이 없으면 바로 데이터를 설정 + // If parent comment doesn't exist, set data directly if(!$obj->parent_srl) { $list_args->head = $list_args->arrange = $obj->comment_srl; $list_args->depth = 0; - - // 부모댓글이 있으면 부모글의 정보를 구해옴 + // If parent comment exists, get information of the parent comment } else { - // 부모댓글의 정보를 구함 + // get information of the parent comment posting $parent_args->comment_srl = $obj->parent_srl; $parent_output = executeQuery('comment.getCommentListItem', $parent_args); - - // 부모댓글이 존재하지 않으면 return + // return if no parent comment exists if(!$parent_output->toBool() || !$parent_output->data) return; $parent = $parent_output->data; $list_args->head = $parent->head; $list_args->depth = $parent->depth+1; - - // depth가 2단계 미만이면 별도의 update문 없이 insert만으로 쓰레드 정리 + // if the depth of comments is less than 2, execute insert. if($list_args->depth<2) { $list_args->arrange = $obj->comment_srl; - - // depth가 2단계 이상이면 반업데이트 실행 + // if the depth of comments is greater than 2, execute update. } else { - // 부모 댓글과 같은 head를 가지고 depth가 같거나 작은 댓글중 제일 위 댓글을 구함 + // get the top listed comment among those in lower depth and same head with parent's. $p_args->head = $parent->head; $p_args->arrange = $parent->arrange; $p_args->depth = $parent->depth; @@ -211,31 +198,23 @@ $output = executeQuery('comment.insertCommentList', $list_args); if(!$output->toBool()) return $output; - - // 댓글 본문을 입력 + // insert comment $output = executeQuery('comment.insertComment', $obj); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // comment model객체 생성 + // creat the comment model object $oCommentModel = &getModel('comment'); - - // 해당 글의 전체 댓글 수를 구해옴 + // get the number of all comments in the posting $comment_count = $oCommentModel->getCommentCount($document_srl); - - // document의 controller 객체 생성 + // create the controller object of the document $oDocumentController = &getController('document'); - - // 해당글의 댓글 수를 업데이트 + // Update the number of comments in the post $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, $obj->nick_name, true); - - // 댓글의 권한을 부여 + // grant autority of the comment $this->addGrant($obj->comment_srl); - - - // trigger 호출 (after) + // call a trigger(after) if($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('comment.insertComment', 'after', $obj); if(!$trigger_output->toBool()) { @@ -248,10 +227,9 @@ $oDB->commit(); if(!$manual_inserted) { - // 원본글에 알림(notify_message)가 설정되어 있으면 메세지 보냄 + // send a message if notify_message option in enabled in the original article $oDocument->notify(Context::getLang('comment'), $obj->content); - - // 원본 댓글이 있고 원본 댓글에 알림(notify_message)가 있으면 메세지 보냄 + // send a message if notify_message option in enabled in the original comment if($obj->parent_srl) { $oParent = $oCommentModel->getComment($obj->parent_srl); if ($oParent->get('member_srl') != $oDocument->get('member_srl')) { @@ -266,18 +244,16 @@ } /** - * @brief 댓글 수정 + * @brief fix the comment **/ function updateComment($obj, $is_admin = false) { $obj->__isupdate = true; - // trigger 호출 (before) + // call a trigger (before) $output = ModuleHandler::triggerCall('comment.updateComment', 'before', $obj); if(!$output->toBool()) return $output; - - // comment model 객체 생성 + // create a comment model object $oCommentModel = &getModel('comment'); - - // 원본 데이터를 가져옴 + // get the original data $source_obj = $oCommentModel->getComment($obj->comment_srl); if(!$source_obj->getMemberSrl()) { $obj->member_srl = $source_obj->get('member_srl'); @@ -286,14 +262,12 @@ $obj->email_address = $source_obj->get('email_address'); $obj->homepage = $source_obj->get('homepage'); } - - // 권한이 있는지 확인 + // check if permission is granted if(!$is_admin && !$source_obj->isGranted()) return new Object(-1, 'msg_not_permitted'); if($obj->password) $obj->password = md5($obj->password); if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; - - // 로그인 되어 있고 작성자와 수정자가 동일하면 수정자의 정보를 세팅 + // set modifier's information if logged-in and posting author and modifier are matched. if(Context::get('is_logged')) { $logged_info = Context::get('logged_info'); if($source_obj->member_srl == $logged_info->member_srl) { @@ -304,8 +278,7 @@ $obj->homepage = $logged_info->homepage; } } - - // 로그인한 유저가 작성한 글인데 nick_name이 없을 경우 + // if nick_name of the logged-in author doesn't exist if($source_obj->get('member_srl')&& !$obj->nick_name) { $obj->member_srl = $source_obj->get('member_srl'); $obj->user_name = $source_obj->get('user_name'); @@ -316,25 +289,21 @@ if(!$obj->content) $obj->content = $source_obj->get('content'); - - // 내용에서 XE만의 태그를 삭제 + // remove XE's wn tags from contents $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); - - // 세션에서 최고 관리자가 아니면 iframe, script 제거 + // remove iframe and script if not a top administrator on the session if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content); // begin transaction $oDB = &DB::getInstance(); $oDB->begin(); - - // 업데이트 + // Update $output = executeQuery('comment.updateComment', $obj); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // trigger 호출 (after) + // call a trigger (after) if($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('comment.updateComment', 'after', $obj); if(!$trigger_output->toBool()) { @@ -351,34 +320,28 @@ } /** - * @brief 댓글 삭제 + * @brief Delete comment **/ function deleteComment($comment_srl, $is_admin = false) { - - // comment model 객체 생성 + // create the comment model object $oCommentModel = &getModel('comment'); - - // 기존 댓글이 있는지 확인 + // check if comment already exists $comment = $oCommentModel->getComment($comment_srl); if($comment->comment_srl != $comment_srl) return new Object(-1, 'msg_invalid_request'); $document_srl = $comment->document_srl; - - // trigger 호출 (before) + // call a trigger (before) $output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment); if(!$output->toBool()) return $output; - - // 해당 댓글에 child가 있는지 확인 + // check if child comment exists on the comment $child_count = $oCommentModel->getChildCommentCount($comment_srl); if($child_count>0) return new Object(-1, 'fail_to_delete_have_children'); - - // 권한이 있는지 확인 + // check if permission is granted if(!$is_admin && !$comment->isGranted()) return new Object(-1, 'msg_not_permitted'); // begin transaction $oDB = &DB::getInstance(); $oDB->begin(); - - // 삭제 + // Delete $args->comment_srl = $comment_srl; $output = executeQuery('comment.deleteComment', $args); if(!$output->toBool()) { @@ -387,21 +350,17 @@ } $output = executeQuery('comment.deleteCommentList', $args); - - // 댓글 수를 구해서 업데이트 + // update the number of comments $comment_count = $oCommentModel->getCommentCount($document_srl); - - // document의 controller 객체 생성 + // create the controller object of the document $oDocumentController = &getController('document'); - - // 해당글의 댓글 수를 업데이트 + // update comment count of the article posting $output = $oDocumentController->updateCommentCount($document_srl, $comment_count, null, false); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // trigger 호출 (after) + // call a trigger (after) if($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment); if(!$trigger_output->toBool()) { @@ -418,45 +377,40 @@ } /** - * @brief 특정 글의 모든 댓글 삭제 + * @brief remove all comments of the article **/ function deleteComments($document_srl) { - // document model객체 생성 + // create the document model object $oDocumentModel = &getModel('document'); $oCommentModel = &getModel('comment'); - - // 권한이 있는지 확인 + // check if permission is granted $oDocument = $oDocumentModel->getDocument($document_srl); if(!$oDocument->isExists() || !$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted'); - - // 댓글 목록을 가져와서 일단 trigger만 실행 (일괄 삭제를 해야 하기에 최대한 처리 비용을 줄이기 위한 방법) + // get a list of comments and then execute a trigger(way to reduce the processing cost for delete all) $args->document_srl = $document_srl; $comments = executeQueryArray('comment.getAllComments',$args); if($comments->data) { foreach($comments->data as $key => $comment) { - // trigger 호출 (before) + // call a trigger (before) $output = ModuleHandler::triggerCall('comment.deleteComment', 'before', $comment); if(!$output->toBool()) continue; - - // trigger 호출 (after) + // call a trigger (after) $output = ModuleHandler::triggerCall('comment.deleteComment', 'after', $comment); if(!$output->toBool()) continue; } } - - // 댓글 본문 삭제 + // delete the comment $args->document_srl = $document_srl; $output = executeQuery('comment.deleteComments', $args); if(!$output->toBool()) return $output; - - // 댓글 목록 삭제 + // Delete a list of comments $output = executeQuery('comment.deleteCommentsList', $args); return $output; } /** - * @brief 해당 comment의 추천수 증가 + * @brief Increase vote-up counts of the comment **/ function updateVotedCount($comment_srl, $point = 1) { if($point > 0) { @@ -467,31 +421,28 @@ $success_message = 'success_blamed'; } - // 세션 정보에 추천 정보가 있으면 중단 + // invalid vote if vote info exists in the session info. if($_SESSION['voted_comment'][$comment_srl]) return new Object(-1, $failed_voted); $oCommentModel = &getModel('comment'); $oComment = $oCommentModel->getComment($comment_srl, false, false); - - // 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스 + // invalid vote if both ip addresses between author's and the current user are same. if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { $_SESSION['voted_comment'][$comment_srl] = true; return new Object(-1, $failed_voted); } - - // comment의 작성자가 회원일때 조사 + // if the comment author is a member if($oComment->get('member_srl')) { + // create the member model object $oMemberModel = &getModel('member'); $member_srl = $oMemberModel->getLoggedMemberSrl(); - - // 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 생각하고 세션 등록후 패스 + // session registered if the author information matches to the current logged-in user's. if($member_srl && $member_srl == $oComment->get('member_srl')) { $_SESSION['voted_comment'][$comment_srl] = true; return new Object(-1, $failed_voted); } } - - // 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단 + // If logged-in, use the member_srl. otherwise use the ipaddress. if($member_srl) { $args->member_srl = $member_srl; } else { @@ -499,14 +450,13 @@ } $args->comment_srl = $comment_srl; $output = executeQuery('comment.getCommentVotedLogInfo', $args); - - // 로그 정보에 추천 로그가 있으면 세션 등록후 패스 + // session registered if log info contains recommendation vote log. if($output->data->count) { $_SESSION['voted_comment'][$comment_srl] = true; return new Object(-1, $failed_voted); } - // 추천수 업데이트 + // update the number of votes if($point < 0) { $args->blamed_count = $oComment->get('blamed_count') + $point; $output = executeQuery('comment.updateBlamedCount', $args); @@ -514,54 +464,46 @@ $args->voted_count = $oComment->get('voted_count') + $point; $output = executeQuery('comment.updateVotedCount', $args); } - - // 로그 남기기 + // leave logs $args->point = $point; $output = executeQuery('comment.insertCommentVotedLog', $args); - - // 세션 정보에 남김 + // leave into session information $_SESSION['voted_comment'][$comment_srl] = true; - // 결과 리턴 + // Return the result return new Object(0, $success_message); } /** - * @brief 댓글 신고 + * @brief report a blamed comment **/ function declaredComment($comment_srl) { - // 세션 정보에 신고 정보가 있으면 중단 + // Fail if session information already has a reported document if($_SESSION['declared_comment'][$comment_srl]) return new Object(-1, 'failed_declared'); - - // 이미 신고되었는지 검사 + // check if already reported $args->comment_srl = $comment_srl; $output = executeQuery('comment.getDeclaredComment', $args); if(!$output->toBool()) return $output; - - // 문서 원본을 가져옴 + // get the original comment $oCommentModel = &getModel('comment'); $oComment = $oCommentModel->getComment($comment_srl, false, false); - - // 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스 + // failed if both ip addresses between author's and the current user are same. if($oComment->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { $_SESSION['declared_comment'][$comment_srl] = true; return new Object(-1, 'failed_declared'); } - - // comment의 작성자가 회원일때 조사 + // if the comment author is a member if($oComment->get('member_srl')) { - // member model 객체 생성 + // create the member model object $oMemberModel = &getModel('member'); $member_srl = $oMemberModel->getLoggedMemberSrl(); - - // 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 생각하고 세션 등록후 패스 + // session registered if the author information matches to the current logged-in user's. if($member_srl && $member_srl == $oComment->get('member_srl')) { $_SESSION['declared_comment'][$comment_srl] = true; return new Object(-1, 'failed_declared'); } } - - // 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단 + // If logged-in, use the member_srl. otherwise use the ipaddress. if($member_srl) { $args->member_srl = $member_srl; } else { @@ -569,29 +511,25 @@ } $args->comment_srl = $comment_srl; $output = executeQuery('comment.getCommentDeclaredLogInfo', $args); - - // 로그 정보에 신고 로그가 있으면 세션 등록후 패스 + // session registered if log info contains report log. if($output->data->count) { $_SESSION['declared_comment'][$comment_srl] = true; return new Object(-1, 'failed_declared'); } - - // 신고글 추가 + // execute insert if($output->data->declared_count > 0) $output = executeQuery('comment.updateDeclaredComment', $args); else $output = executeQuery('comment.insertDeclaredComment', $args); if(!$output->toBool()) return $output; - - // 로그 남기기 + // leave the log $output = executeQuery('comment.insertCommentDeclaredLog', $args); - - // 세션 정보에 남김 + // leave into the session information $_SESSION['declared_comment'][$comment_srl] = true; $this->setMessage('success_declared'); } /** - * @brief 댓글의 이 댓글을.. 클릭시 나타나는 팝업 메뉴를 추가하는 method + * @brief method to add a pop-up menu when clicking for displaying child comments **/ function addCommentPopupMenu($url, $str, $icon = '', $target = 'self') { $comment_popup_menu_list = Context::get('comment_popup_menu_list'); @@ -607,7 +545,7 @@ } /** - * @brief 댓글의 모듈별 추가 확장 폼을 저장 + * @brief save the comment extension form for each module **/ function procCommentInsertModuleConfig() { $module_srl = Context::get('target_module_srl'); diff --git a/modules/comment/comment.item.php b/modules/comment/comment.item.php index 83a653e49..0bd5c918f 100644 --- a/modules/comment/comment.item.php +++ b/modules/comment/comment.item.php @@ -2,7 +2,7 @@ /** * @class commentItem * @author NHN (developers@xpressengine.com) - * @brief comment 객체 + * @brief comment Object **/ class commentItem extends Object { @@ -35,8 +35,7 @@ } $this->comment_srl = $attribute->comment_srl; $this->adds($attribute); - - // 기존 스킨의 호환을 위해 변수를 객체 자신에 재선언 + // define vars on the object for backward compatibility of skins if(count($attribute)) foreach($attribute as $key => $val) $this->{$key} = $val; } @@ -101,28 +100,23 @@ } function notify($type, $content) { - // useNotify가 아니면 return + // return if not useNotify if(!$this->useNotify()) return; - - // 글쓴이가 로그인 유저가 아니면 패스~ + // pass if the author is not logged-in user if(!$this->get('member_srl')) return; - - // 현재 로그인한 사용자와 글을 쓴 사용자를 비교하여 동일하면 return + // return if the currently logged-in user is an author of the comment. $logged_info = Context::get('logged_info'); if($logged_info->member_srl == $this->get('member_srl')) return; - - // 원본글의 주소를 구함 + // get where the comment belongs to $oDocumentModel = &getModel('document'); $oDocument = $oDocumentModel->getDocument($this->get('document_srl')); - - // 변수 정리 + // Variables if($type) $title = "[".$type."] "; $title .= cut_str(strip_tags($content), 30, '...'); $content = sprintf('%s

from :
%s',$content, getFullUrl('','document_srl',$this->get('document_srl')), $this->get('comment_srl'), getFullUrl('','document_srl',$this->get('document_srl'))); $receiver_srl = $this->get('member_srl'); $sender_member_srl = $logged_info->member_srl; - - // 쪽지 발송 + // send a message $oCommunicationController = &getController('communication'); $oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false); } @@ -177,8 +171,7 @@ $content = $this->get('content'); stripEmbedTagForAdmin($content, $this->get('member_srl')); - - // 이 댓글을... 팝업메뉴를 출력할 경우 + // when displaying the comment on the pop-up menu if($add_popup_menu && Context::get('is_logged') ) { $content = sprintf( '%s', @@ -186,8 +179,7 @@ $this->comment_srl, Context::getLang('cmd_comment_do') ); } - - // 컨텐츠에 대한 조작이 가능한 추가 정보를 설정하였을 경우 + // if additional information which can access contents is set if($add_content_info) { $content = sprintf( '
%s
', @@ -196,7 +188,7 @@ $content, $this->comment_srl, $this->get('member_srl') ); - // 컨텐츠에 대한 조작이 필요하지 않더라도 xe_content라는 클래스명을 꼭 부여 + // xe_content class name should be specified although content access is not necessary. } else { if($add_xe_content_class) $content = sprintf('
%s
', $content); } @@ -206,26 +198,19 @@ function getSummary($str_size = 50, $tail = '...') { $content = $this->getContent(false, false); - - // 줄바꿈이 있을 때, 공백문자 삽입 + // for newline, insert a blank. $content = preg_replace('!([\s]*)+!is', ' ', $content); - - //

, , 등의 태그를 공백 문자로 치환 + // replace tags such as

, , by blanks. $content = str_replace(array('

', '', ''), ' ', $content); - - // 태그 제거 + // Remove tags $content = preg_replace('!<([^>]*?)>!is','', $content); - - // < , > , " 를 치환 + // replace < , >, " $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); - - // 연속된 공백문자 삭제 + // delete a series of blanks $content = preg_replace('/ ( +)/is', ' ', $content); - - // 문자열을 자름 + // truncate strings $content = trim(cut_str($content, $str_size, $tail)); - - // >, <, "를 다시 복구 + // restore >, <, , "\ $content = str_replace(array('<','>','"'),array('<','>','"'), $content); return $content; @@ -288,7 +273,7 @@ } /** - * @brief 에디터 html을 구해서 return + * @brief return the editor html **/ function getEditor() { $module_srl = $this->get('module_srl'); @@ -298,7 +283,7 @@ } /** - * @brief 작성자의 프로필 이미지를 return + * @brief return author's profile image **/ function getProfileImage() { if(!$this->isExists() || !$this->get('member_srl')) return; @@ -310,17 +295,15 @@ } /** - * @brief 작성자의 서명을 return + * @brief return author's signiture **/ function getSignature() { - // 존재하지 않는 글이면 패스~ + // pass if the posting not exists. if(!$this->isExists() || !$this->get('member_srl')) return; - - // 서명정보를 구함 + // get the signiture information $oMemberModel = &getModel('member'); $signature = $oMemberModel->getSignature($this->get('member_srl')); - - // 회원모듈에서 서명 최고 높이 지정되었는지 검사 + // check if max height of the signiture is specified on the member module if(!isset($GLOBALS['__member_signature_max_height'])) { $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); @@ -339,34 +322,27 @@ } function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') { - // 존재하지 않는 문서일 경우 return false + // return false if no doc exists if(!$this->comment_srl) return; - - // 높이 지정이 별도로 없으면 정사각형으로 생성 + // If signiture height setting is omitted, create a square if(!$height) $height = $width; - - // 첨부파일이 없거나 내용중 이미지가 없으면 return false; + // return false if neigher attached file nor image; if(!$this->hasUploadedFiles() && !preg_match("!get('content'))) return; - - // 문서 모듈의 기본 설정에서 Thumbnail의 생성 방법을 구함 + // get thumbail generation info on the doc module configuration. if(!in_array($thumbnail_type, array('crop','ratio'))) $thumbnail_type = 'crop'; - - // 섬네일 정보 정의 + // Define thumbnail information $thumbnail_path = sprintf('files/cache/thumbnails/%s',getNumberingPath($this->comment_srl, 3)); $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); $thumbnail_url = Context::getRequestUri().$thumbnail_file; - - // 섬네일 파일이 있을 경우 파일의 크기가 0 이면 return false 아니면 경로 return + // return false if a size of existing thumbnail file is 0. otherwise return the file path if(file_exists($thumbnail_file)) { if(filesize($thumbnail_file)<1) return false; else return $thumbnail_url; } - - // 대상 파일 + // Target file $source_file = null; $is_tmp_file = false; - - // 첨부된 파일중 이미지 파일이 있으면 찾음 + // find an image file among attached files if($this->hasUploadedFiles()) { $file_list = $this->getUploadedFiles(); if(count($file_list)) { @@ -380,8 +356,7 @@ } } } - - // 첨부된 파일이 없으면 내용중 이미지 파일을 구함 + // get an image file from the doc content if no file attached. if(!$source_file) { $content = $this->get('content'); $target_src = null; @@ -411,11 +386,9 @@ $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); if($is_tmp_file) FileHandler::removeFile($source_file); - - // 섬네일 생성 성공시 경로 return + // return the thumbnail path if successfully generated. if($output) return $thumbnail_url; - - // 차후 다시 섬네일 생성을 시도하지 않기 위해 빈 파일을 생성 + // create an empty file not to attempt to generate the thumbnail afterwards else FileHandler::writeFile($thumbnail_file, '','w'); return; diff --git a/modules/comment/comment.model.php b/modules/comment/comment.model.php index 23655f76b..da9061936 100644 --- a/modules/comment/comment.model.php +++ b/modules/comment/comment.model.php @@ -2,39 +2,36 @@ /** * @class commentModel * @author NHN (developers@xpressengine.com) - * @brief comment 모듈의 model class + * @brief model class of the comment module **/ class commentModel extends comment { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 선택된 게시물의 팝업메뉴 표시 + * @brief display the pop-up menu of the post * - * 인쇄, 스크랩, 추천, 비추천, 신고 기능 추가 + * Print, scrap, vote-up(recommen), vote-down(non-recommend), report features added **/ function getCommentMenu() { - - // 요청된 게시물 번호와 현재 로그인 정보 구함 + // get the post's id number and the current login information $comment_srl = Context::get('target_srl'); $mid = Context::get('cur_mid'); $logged_info = Context::get('logged_info'); $act = Context::get('cur_act'); - // menu_list 에 "표시할글,target,url" 을 배열로 넣는다 + // array values for menu_list, "comment post, target, url" $menu_list = array(); - - // trigger 호출 + // call a trigger ModuleHandler::triggerCall('comment.getCommentMenu', 'before', $menu_list); $oCommentController = &getController('comment'); - - // 회원이어야만 가능한 기능 + // feature that only member can do if($logged_info->member_srl) { $oCommentModel = &getModel('comment'); @@ -45,31 +42,29 @@ $oModuleModel = &getModel('module'); $comment_config = $oModuleModel->getModulePartConfig('document',$module_srl); if($comment_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl){ - // 추천 버튼 추가 + // Add a vote-up button for positive feedback $url = sprintf("doCallModuleAction('comment','procCommentVoteUp','%s')", $comment_srl); $oCommentController->addCommentPopupMenu($url,'cmd_vote','./modules/document/tpl/icons/vote_up.gif','javascript'); } if($comment_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl){ - // 비추천 버튼 추가 + // Add a vote-down button for negative feedback $url = sprintf("doCallModuleAction('comment','procCommentVoteDown','%s')", $comment_srl); $oCommentController->addCommentPopupMenu($url,'cmd_vote_down','./modules/document/tpl/icons/vote_down.gif','javascript'); } - // 신고 기능 추가 + // Add the report feature against abused posts $url = sprintf("doCallModuleAction('comment','procCommentDeclare','%s')", $comment_srl); $oCommentController->addCommentPopupMenu($url,'cmd_declare','./modules/document/tpl/icons/declare.gif','javascript'); } - - // trigger 호출 (after) + // call a trigger (after) ModuleHandler::triggerCall('comment.getCommentMenu', 'after', $menu_list); - - // 관리자일 경우 ip로 글 찾기 + // find a comment by IP matching if an administrator. if($logged_info->is_admin == 'Y') { $oCommentModel = &getModel('comment'); $oComment = $oCommentModel->getComment($comment_srl); if($oComment->isExists()) { - // ip주소에 해당하는 글 찾기 + // Find a post of the corresponding ip address $url = getUrl('','module','admin','act','dispCommentAdminList','search_target','ipaddress','search_keyword',$oComment->get('ipaddress')); $icon_path = './modules/member/tpl/images/icon_management.gif'; $oCommentController->addCommentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress'); @@ -78,30 +73,28 @@ $oCommentController->addCommentPopupMenu($url,'cmd_add_ip_to_spamfilter','./modules/document/tpl/icons/declare.gif','javascript'); } } - - // 팝업메뉴의 언어 변경 + // Changing a language of pop-up menu $menus = Context::get('comment_popup_menu_list'); $menus_count = count($menus); for($i=0;$i<$menus_count;$i++) { $menus[$i]->str = Context::getLang($menus[$i]->str); } - - // 최종적으로 정리된 팝업메뉴 목록을 구함 + // get a list of final organized pop-up menus $this->add('menus', $menus); } /** - * @brief comment_srl에 권한이 있는지 체크 + * @brief check if you have a permission to comment_srl * - * 세션 정보만 이용 + * use only session information **/ function isGranted($comment_srl) { return $_SESSION['own_comment'][$comment_srl]; } /** - * @brief 자식 답글의 갯수 리턴 + * @brief Returns the number of child comments **/ function getChildCommentCount($comment_srl) { $args->comment_srl = $comment_srl; @@ -110,7 +103,7 @@ } /** - * @brief 댓글 가져오기 + * @brief get the comment **/ function getComment($comment_srl=0, $is_admin = false) { $oComment = new commentItem($comment_srl); @@ -120,12 +113,11 @@ } /** - * @brief 여러개의 댓글들을 가져옴 (페이징 아님) + * @brief get the multiple comments(not paginating) **/ function getComments($comment_srl_list) { if(is_array($comment_srl_list)) $comment_srls = implode(',',$comment_srl_list); - - // DB에서 가져옴 + // fetch from a database $args->comment_srls = $comment_srls; $output = executeQuery('comment.getComments', $args); if(!$output->toBool()) return; @@ -147,7 +139,7 @@ } /** - * @brief document_srl 에 해당하는 댓글의 전체 갯수를 가져옴 + * @brief get the total number of comments in corresponding with document_srl. **/ function getCommentCount($document_srl) { $args->document_srl = $document_srl; @@ -158,7 +150,7 @@ /** - * @brief module_srl 에 해당하는 댓글의 전체 갯수를 가져옴 + * @brief get the total number of comments in corresponding with module_srl. **/ function getCommentAllCount($module_srl) { $args->module_srl = $module_srl; @@ -170,7 +162,7 @@ /** - * @brief mid 에 해당하는 댓글을 가져옴 + * @brief get the comment in corresponding with mid. **/ function getNewestCommentList($obj) { if($obj->mid) { @@ -178,8 +170,7 @@ $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); unset($obj->mid); } - - // 넘어온 module_srl은 array일 수도 있기에 array인지를 체크 + // check if module_srl is an arrary. if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); else $args->module_srl = $obj->module_srl; $args->list_count = $obj->list_count; @@ -205,20 +196,17 @@ } /** - * @brief document_srl에 해당하는 문서의 댓글 목록을 가져옴 + * @brief get a comment list of the doc in corresponding woth document_srl. **/ function getCommentList($document_srl, $page = 0, $is_admin = false, $count = 0) { - // 해당 문서의 모듈에 해당하는 댓글 수를 구함 + // get the number of comments on the document module $oDocumentModel = &getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); - - // 문서가 존재하지 않으면 return~ + // return if no doc exists. if(!$oDocument->isExists()) return; - - // 댓글수가 없으면 return~ + // return if no comment exists if($oDocument->getCommentCount()<1) return; - - // 정해진 댓글수에 따른 댓글 목록 구함 + // get a list of comments $module_srl = $oDocument->get('module_srl'); if(!$count) { @@ -228,21 +216,17 @@ } else { $comment_count = $count; } - - // 페이지가 없으면 제일 뒤 페이지를 구함 + // get a very last page if no page exists if(!$page) $page = (int)( ($oDocument->getCommentCount()-1) / $comment_count) + 1; - - // 정해진 수에 따라 목록을 구해옴 + // get a list of comments $args->document_srl = $document_srl; $args->list_count = $comment_count; $args->page = $page; $args->page_count = 10; $output = executeQueryArray('comment.getCommentPageList', $args); - - // 쿼리 결과에서 오류가 생기면 그냥 return + // return if an error occurs in the query results if(!$output->toBool()) return; - - // 만약 구해온 결과값이 저장된 댓글수와 다르다면 기존의 데이터로 판단하고 댓글 목록 테이블에 데이터 입력 + // insert data into CommentPageList table if the number of results is different from stored comments if(!$output->data) { $this->fixCommentList($oDocument->get('module_srl'), $document_srl); $output = executeQueryArray('comment.getCommentPageList', $args); @@ -253,16 +237,15 @@ } /** - * @brief document_srl에 해당하는 댓글 목록을 갱신 - * 정식버전 이전에 사용되던 데이터를 위한 처리 + * @brief update a list of comments in corresponding with document_srl + * take care of previously used data than GA version **/ function fixCommentList($module_srl, $document_srl) { - // 일괄 작업이라서 lock 파일을 생성하여 중복 작업이 되지 않도록 한다 + // create a lock file to prevent repeated work when performing a batch job $lock_file = "./files/cache/tmp/lock.".$document_srl; if(file_exists($lock_file) && filemtime($lock_file)+60*60*10document_srl = $document_srl; $args->list_order = 'list_order'; $output = executeQuery('comment.getCommentList', $args); @@ -270,25 +253,20 @@ $source_list = $output->data; if(!is_array($source_list)) $source_list = array($source_list); - - // 댓글를 계층형 구조로 정렬 + // Sort comments by the hierarchical structure $comment_count = count($source_list); $root = NULL; $list = NULL; $comment_list = array(); - - // 로그인 사용자의 경우 로그인 정보를 일단 구해 놓음 + // get the log-in information for logged-in users $logged_info = Context::get('logged_info'); - - - // loop를 돌면서 코멘트의 계층 구조 만듬 + // generate a hierarchical structure of comments for loop for($i=$comment_count-1;$i>=0;$i--) { $comment_srl = $source_list[$i]->comment_srl; $parent_srl = $source_list[$i]->parent_srl; if(!$comment_srl) continue; - - // 목록을 만듬 + // generate a list $list[$comment_srl] = $source_list[$i]; if($parent_srl) { @@ -298,8 +276,7 @@ } } $this->_arrangeComment($comment_list, $root->child, 0, null); - - // 구해진 값을 db에 입력함 + // insert values to the database if(count($comment_list)) { foreach($comment_list as $comment_srl => $item) { $comment_args = null; @@ -314,13 +291,12 @@ executeQuery('comment.insertCommentList', $comment_args); } } - - // 성공시 lock파일 제거 + // remove the lock file if successful. FileHandler::removeFile($lock_file); } /** - * @brief 댓글을 계층형으로 재배치 + * @brief relocate comments in the hierarchical structure **/ function _arrangeComment(&$comment_list, $list, $depth, $parent = null) { if(!count($list)) return; @@ -343,20 +319,18 @@ } /** - * @brief 모든 댓글를 시간 역순으로 가져옴 (관리자용) + * @brief get all the comments in time decending order(for administrators) **/ function getTotalCommentList($obj) { $query_id = 'comment.getTotalCommentList'; - - // 변수 설정 + // Variables $args->sort_index = 'list_order'; $args->page = $obj->page?$obj->page:1; $args->list_count = $obj->list_count?$obj->list_count:20; $args->page_count = $obj->page_count?$obj->page_count:10; $args->s_module_srl = $obj->module_srl; $args->exclude_module_srl = $obj->exclude_module_srl; - - // 검색 옵션 정리 + // Search options $search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target')); $search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword')); if($search_target && $search_keyword) { @@ -401,11 +375,9 @@ break; } } - - // comment.getTotalCommentList 쿼리 실행 + // comment.getTotalCommentList query execution $output = executeQueryArray($query_id, $args); - - // 결과가 없거나 오류 발생시 그냥 return + // return when no result or error occurance if(!$output->toBool()||!count($output->data)) return $output; foreach($output->data as $key => $val) { unset($_oComment); @@ -418,7 +390,7 @@ } /** - * @brief 모듈별 댓글 설정을 return + * @brief return a configuration of comments for each module **/ function getCommentConfig($module_srl) { $oModuleModel = &getModel('module'); diff --git a/modules/comment/comment.view.php b/modules/comment/comment.view.php index 9dd377efc..93f3fef20 100644 --- a/modules/comment/comment.view.php +++ b/modules/comment/comment.view.php @@ -2,42 +2,39 @@ /** * @class commentView * @author NHN (developers@xpressengine.com) - * @brief comment 모듈의 view 클래스 + * @brief comment module's view class **/ class commentView extends comment { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 모듈의 추가 설정에서 댓글 설정을 하는 form 추가 + * @brief add a form fot comment setting on the additional setting of module **/ function triggerDispCommentAdditionSetup(&$obj) { $current_module_srl = Context::get('module_srl'); $current_module_srls = Context::get('module_srls'); if(!$current_module_srl && !$current_module_srls) { - // 선택된 모듈의 정보를 가져옴 + // get information of the selected module $current_module_info = Context::get('current_module_info'); $current_module_srl = $current_module_info->module_srl; if(!$current_module_srl) return new Object(); } - - // 댓글 설정을 구함 + // get the comment configuration $oCommentModel = &getModel('comment'); $comment_config = $oCommentModel->getCommentConfig($current_module_srl); Context::set('comment_config', $comment_config); - - // 그룹 목록을 구함 + // get a group list $oMemberModel = &getModel('member'); $group_list = $oMemberModel->getGroups(); Context::set('group_list', $group_list); - - // 템플릿 파일 지정 + // Set a template file $oTemplate = &TemplateHandler::getInstance(); $tpl = $oTemplate->compile($this->module_path.'tpl', 'comment_module_config'); $obj .= $tpl; diff --git a/modules/communication/communication.admin.controller.php b/modules/communication/communication.admin.controller.php index 45b514919..fbf41757a 100644 --- a/modules/communication/communication.admin.controller.php +++ b/modules/communication/communication.admin.controller.php @@ -2,29 +2,28 @@ /** * @class communicationAdminController * @author NHN (developers@xpressengine.com) - * @brief communication module의 admin controller class + * @brief communication module of the admin controller class **/ class communicationAdminController extends communication { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief communication 모듈 설정 저장 + * @brief save configurations of the communication module **/ function procCommunicationAdminInsertConfig() { - // 기본 정보를 받음 + // get the default information $args = Context::gets('skin','colorset','editor_skin','editor_colorset'); if(!$args->skin) $args->skin = "default"; if(!$args->colorset) $args->colorset = "white"; if(!$args->editor_skin) $args->editor_skin = "default"; - - // module Controller 객체 생성하여 입력 + // create the module module Controller object $oModuleController = &getController('module'); $output = $oModuleController->insertModuleConfig('communication',$args); diff --git a/modules/communication/communication.admin.model.php b/modules/communication/communication.admin.model.php index 594bc75e2..862eac520 100644 --- a/modules/communication/communication.admin.model.php +++ b/modules/communication/communication.admin.model.php @@ -2,19 +2,19 @@ /** * @class communicationAdminModel * @author NHN (developers@xpressengine.com) - * @brief communication module의 admin model class + * @brief communication module of the admin model class **/ class communicationAdminModel extends communication { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 지정된 스킨의 컬러셋 선택을 위한 html을 return + * @brief return the html to select colorset of the skin **/ function getCommunicationAdminColorset() { $skin = Context::get('skin'); diff --git a/modules/communication/communication.admin.view.php b/modules/communication/communication.admin.view.php index 9dbc01a65..9e751746c 100644 --- a/modules/communication/communication.admin.view.php +++ b/modules/communication/communication.admin.view.php @@ -2,36 +2,32 @@ /** * @class communicationAdminView * @author NHN (developers@xpressengine.com) - * @brief communication module의 admin view class + * @brief communication module of the admin view class **/ class communicationAdminView extends communication { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 쪽지 및 친구등의 관리를 위한 설정 + * @brief configuration to manage messages and friends **/ function dispCommunicationAdminConfig() { - // 객체 생성 + // Creating an object $oEditorModel = &getModel('editor'); $oModuleModel = &getModel('module'); $oCommunicationModel = &getModel('communication'); - - // communication 모듈의 모듈설정 읽음 + // get the configurations of communication module Context::set('communication_config', $oCommunicationModel->getConfig() ); - - // 에디터 스킨 목록을 구함 + // get a list of editor skins Context::set('editor_skin_list', $oEditorModel->getEditorSkinList() ); - - // 커뮤니케이션 스킨 목록을 구함 + // get a list of communication skins Context::set('communication_skin_list', $oModuleModel->getSkins($this->module_path) ); - - // template 지정 + // specify a template $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('index'); } diff --git a/modules/communication/communication.class.php b/modules/communication/communication.class.php index 57c0fca58..075dc57a6 100644 --- a/modules/communication/communication.class.php +++ b/modules/communication/communication.class.php @@ -2,22 +2,22 @@ /** * @class communication * @author NHN (developers@xpressengine.com) - * @brief communication module의 high class + * @brief communication module of the high class **/ class communication extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // 새쪽지 알림을 위한 임시 파일 저장소 생성 + // Create a temporary file storage for one new private message notification FileHandler::makeDir('./files/member_extra_info/new_message_flags'); return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief method to check if successfully installed. **/ function checkUpdate() { if(!is_dir("./files/member_extra_info/new_message_flags")) return true; @@ -25,7 +25,7 @@ } /** - * @brief 업데이트 실행 + * @brief Update **/ function moduleUpdate() { if(!is_dir("./files/member_extra_info/new_message_flags")) @@ -34,7 +34,7 @@ } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { } diff --git a/modules/communication/communication.controller.php b/modules/communication/communication.controller.php index 1360d6cec..4849d8189 100644 --- a/modules/communication/communication.controller.php +++ b/modules/communication/communication.controller.php @@ -2,19 +2,19 @@ /** * @class communicationController * @author NHN (developers@xpressengine.com) - * @brief communication module의 Controller class + * @brief communication module of the Controller class **/ class communicationController extends communication { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 쪽지함 설정 변경 + * @brief change the settings of message box **/ function procCommunicationUpdateAllowMessage() { if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); @@ -31,14 +31,13 @@ } /** - * @brief 쪽지 발송 + * @brief Send a message **/ function procCommunicationSendMessage() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); - - // 변수 검사 + // Check variables $receiver_srl = Context::get('receiver_srl'); if(!$receiver_srl) return new Object(-1, 'msg_not_exists_member'); @@ -50,14 +49,12 @@ $send_mail = Context::get('send_mail'); if($send_mail != 'Y') $send_mail = 'N'; - - // 받을 회원이 있는지에 대한 검사 + // Check if there is a member to receive a message $oMemberModel = &getModel('member'); $oCommunicationModel = &getModel('communication'); $receiver_member_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl); if($receiver_member_info->member_srl != $receiver_srl) return new Object(-1, 'msg_not_exists_member'); - - // 받을 회원의 쪽지 수신여부 검사 (최고관리자이면 패스) + // check whether to allow to receive the message(pass if a top-administrator) if($logged_info->is_admin != 'Y') { if($receiver_member_info->allow_message == 'F') { if(!$oCommunicationModel->isFriend($receiver_member_info->member_srl)) return new object(-1, 'msg_allow_message_to_friend'); @@ -65,11 +62,9 @@ return new object(-1, 'msg_disallow_message'); } } - - // 쪽지 발송 + // send a message $output = $this->sendMessage($logged_info->member_srl, $receiver_srl, $title, $content); - - // 메일로도 발송 + // send an e-mail if($output->toBool() && $send_mail == 'Y') { $view_url = Context::getRequestUri(); $content = sprintf("%s

From : %s",$content, $view_url, $view_url); @@ -87,8 +82,7 @@ function sendMessage($sender_srl, $receiver_srl, $title, $content, $sender_log = true) { $content = removeHackTag($content); $title = htmlspecialchars($title); - - // 보내는 사용자의 쪽지함에 넣을 쪽지 + // messages to save in the sendor's message box $sender_args->sender_srl = $sender_srl; $sender_args->receiver_srl = $receiver_srl; $sender_args->message_type = 'S'; @@ -99,8 +93,7 @@ $sender_args->related_srl = getNextSequence(); $sender_args->message_srl = getNextSequence(); $sender_args->list_order = getNextSequence()*-1; - - // 받는 회원의 쪽지함에 넣을 쪽지 + // messages to save in the receiver's message box $receiver_args->message_srl = $sender_args->related_srl; $receiver_args->related_srl = 0; $receiver_args->list_order = $sender_args->related_srl*-1; @@ -115,8 +108,7 @@ $oDB = &DB::getInstance(); $oDB->begin(); - - // 발송하는 회원의 쪽지함에 넣을 쪽지 + // messages to save in the sendor's message box if($sender_srl && $sender_log) { $output = executeQuery('communication.sendMessage', $sender_args); if(!$output->toBool()) { @@ -124,15 +116,13 @@ return $output; } } - - // 받을 회원의 쪽지함에 넣을 쪽지 + // messages to save in the receiver's message box $output = executeQuery('communication.sendMessage', $receiver_args); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // 받는 회원의 쪽지 발송 플래그 생성 (파일로 생성) + // create a flag that message is sent (in file format) $flag_path = './files/member_extra_info/new_message_flags/'.getNumberingPath($receiver_srl); FileHandler::makeDir($flag_path); $flag_file = sprintf('%s%s', $flag_path, $receiver_srl); @@ -145,18 +135,16 @@ } /** - * @brief 특정 쪽지를 보관함으로 보냄 + * @brief store a specific message into the archive **/ function procCommunicationStoreMessage() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); - - // 변수 체크 + // Check variable $message_srl = Context::get('message_srl'); if(!$message_srl) return new Object(-1,'msg_invalid_request'); - - // 쪽지를 가져옴 + // get the message $oCommunicationModel = &getModel('communication'); $message = $oCommunicationModel->getSelectedMessage($message_srl); if(!$message || $message->message_type != 'R') return new Object(-1,'msg_invalid_request'); @@ -170,31 +158,27 @@ } /** - * @brief 쪽지 삭제 + * @brief Delete a message **/ function procCommunicationDeleteMessage() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); $member_srl = $logged_info->member_srl; - - // 변수 체크 + // Check the variable $message_srl = Context::get('message_srl'); if(!$message_srl) return new Object(-1,'msg_invalid_request'); - - // 쪽지를 가져옴 + // Get the message $oCommunicationModel = &getModel('communication'); $message = $oCommunicationModel->getSelectedMessage($message_srl); if(!$message) return new Object(-1,'msg_invalid_request'); - - // 발송인+type=S or 수신인+type=R 검사 + // Check a message type if 'S' or 'R' if($message->sender_srl == $member_srl && $message->message_type == 'S') { if(!$message_srl) return new Object(-1, 'msg_invalid_request'); } elseif($message->receiver_srl == $member_srl && $message->message_type == 'R') { if(!$message_srl) return new Object(-1, 'msg_invalid_request'); } - - // 삭제 + // Delete $args->message_srl = $message_srl; $output = executeQuery('communication.deleteMessage', $args); if(!$output->toBool()) return $output; @@ -203,15 +187,14 @@ } /** - * @brief 선택된 다수의 쪽지 삭제 + * @brief Delete the multiple messages **/ function procCommunicationDeleteMessages() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); $member_srl = $logged_info->member_srl; - - // 변수 체크 + // check variables $message_srl_list = trim(Context::get('message_srl_list')); if(!$message_srl_list) return new Object(-1, 'msg_cart_is_null'); @@ -229,8 +212,7 @@ $target[] = $message_srl; } if(!count($target)) return new Object(-1,'msg_cart_is_null'); - - // 삭제 + // Delete $args->message_srls = implode(',',$target); $args->message_type = $message_type; @@ -244,17 +226,16 @@ } /** - * @brief 친구 추가 + * @brief Add a friend **/ function procCommunicationAddFriend() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); $target_srl = (int)trim(Context::get('target_srl')); if(!$target_srl) return new Object(-1,'msg_invalid_request'); - - // 변수 정리 + // Variable $args->friend_srl = getNextSequence(); $args->list_order = $args->friend_srl * -1; $args->friend_group_srl = Context::get('friend_group_srl'); @@ -268,14 +249,13 @@ } /** - * @brief 등록된 친구의 그룹 이동 + * @brief Move a group of the friend **/ function procCommunicationMoveFriend() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); - - // 변수 체크 + // Check variables $friend_srl_list = trim(Context::get('friend_srl_list')); if(!$friend_srl_list) return new Object(-1, 'msg_cart_is_null'); @@ -290,8 +270,7 @@ $target[] = $friend_srl; } if(!count($target)) return new Object(-1,'msg_cart_is_null'); - - // 변수 정리 + // Variables $args->friend_srls = implode(',',$target); $args->member_srl = $logged_info->member_srl; $args->friend_group_srl = Context::get('target_friend_group_srl'); @@ -303,15 +282,14 @@ } /** - * @brief 친구 삭제 + * @brief Delete a friend **/ function procCommunicationDeleteFriend() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); $member_srl = $logged_info->member_srl; - - // 변수 체크 + // Check variables $friend_srl_list = trim(Context::get('friend_srl_list')); if(!$friend_srl_list) return new Object(-1, 'msg_cart_is_null'); @@ -326,8 +304,7 @@ $target[] = $friend_srl; } if(!count($target)) return new Object(-1,'msg_cart_is_null'); - - // 삭제 + // Delete $args->friend_srls = implode(',',$target); $args->member_srl = $logged_info->member_srl; $output = executeQuery('communication.deleteFriend', $args); @@ -337,26 +314,23 @@ } /** - * @brief 친구 그룹 추가 + * @brief Add a group of friends **/ function procCommunicationAddFriendGroup() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); - - // 변수 정리 + // Variables $args->friend_group_srl = trim(Context::get('friend_group_srl')); $args->member_srl = $logged_info->member_srl; $args->title = Context::get('title'); $args->title = htmlspecialchars($args->title); if(!$args->title) return new Object(-1, 'msg_invalid_request'); - - // friend_group_srl이 있으면 수정 + // modify if friend_group_srl exists. if($args->friend_group_srl) { $output = executeQuery('communication.renameFriendGroup', $args); $msg_code = 'success_updated'; - - // 아니면 입력 + // add if not exists } else { $output = executeQuery('communication.addFriendGroup', $args); $msg_code = 'success_registed'; @@ -368,14 +342,13 @@ } /** - * @brief 친구 그룹 이름 변경 + * @brief change a name of friend group **/ function procCommunicationRenameFriendGroup() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); - - // 변수 정리 + // Variables $args->friend_group_srl= Context::get('friend_group_srl'); $args->member_srl = $logged_info->member_srl; $args->title = Context::get('title'); @@ -389,14 +362,13 @@ } /** - * @brief 친구 그룹 삭제 + * @brief Delete a group of friends **/ function procCommunicationDeleteFriendGroup() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); - - // 변수 정리 + // Variables $args->friend_group_srl = Context::get('friend_group_srl'); $args->member_srl = $logged_info->member_srl; $output = executeQuery('communication.deleteFriendGroup', $args); @@ -406,7 +378,7 @@ } /** - * @brief 특정 쪽지의 상태를 읽은 상태로 변경 + * @brief set a message status to be 'already read' **/ function setMessageReaded($message_srl) { $args->message_srl = $message_srl; diff --git a/modules/communication/communication.model.php b/modules/communication/communication.model.php index bf93c4206..1cd45b98a 100644 --- a/modules/communication/communication.model.php +++ b/modules/communication/communication.model.php @@ -2,19 +2,19 @@ /** * @class communicationModel * @author NHN (developers@xpressengine.com) - * @brief communication module의 Model class + * @brief communication module of the Model class **/ class communicationModel extends communication { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 설정된 내용을 구함 + * @brief get the configuration **/ function getConfig() { $oModuleModel = &getModel('module'); @@ -28,7 +28,7 @@ } /** - * @brief 쪽지 내용을 가져옴 + * @brief get the message contents **/ function getSelectedMessage($message_srl) { $logged_info = Context::get('logged_info'); @@ -37,12 +37,10 @@ $output = executeQuery('communication.getMessage',$args); $message = $output->data; if(!$message) return ; - - // 보낸 쪽지일 경우 받는 사람 정보를 구함 + // get recipient's information if it is a sent message $oMemberModel = &getModel('member'); if($message->sender_srl == $logged_info->member_srl && $message->message_type == 'S') $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->receiver_srl); - - // 보관/받은 쪽지일 경우 보낸 사람 정보를 구함 + // get sendor's information if it is a received/archived message else $member_info = $oMemberModel->getMemberInfoByMemberSrl($message->sender_srl); if($member_info) { @@ -50,8 +48,7 @@ if($key != 'regdate') $message->{$key} = $val; } } - - // 받은 쪽지이고 아직 읽지 않았을 경우 읽은 상태로 변경 + // change the status if is a received and not yet read message if($message->message_type == 'R' && $message->readed != 'Y') { $oCommunicationController = &getController('communication'); $oCommunicationController->setMessageReaded($message_srl); @@ -62,7 +59,7 @@ } /** - * @brief 새 쪽지를 가져옴 + * @brief get a new message **/ function getNewMessage() { $logged_info = Context::get('logged_info'); @@ -80,10 +77,10 @@ } /** - * @brief 쪽지 목록 가져오기 - * type = R : 받은 쪽지 - * type = S : 보낸 쪽지 - * type = T : 보관함 + * @brief get a message list + * type = R: Received Message + * type = S: Sent Message + * type = T: Archive **/ function getMessages($message_type = "R") { $logged_info = Context::get('logged_info'); @@ -106,8 +103,7 @@ break; } - - // 기타 변수들 정리 + // Other variables $args->sort_index = 'message.list_order'; $args->page = Context::get('page'); $args->list_count = 20; @@ -116,15 +112,14 @@ } /** - * @brief 친구 목록 가져오기 + * @brief Get a list of friends **/ function getFriends($friend_group_srl = 0) { $logged_info = Context::get('logged_info'); $args->friend_group_srl = $friend_group_srl; $args->member_srl = $logged_info->member_srl; - - // 기타 변수들 정리 + // Other variables $args->page = Context::get('page'); $args->sort_index = 'friend.list_order'; $args->list_count = 10; @@ -134,7 +129,7 @@ } /** - * @brief 이미 친구로 등록되었는지 검사 + * @brief check if a friend is already added **/ function isAddedFriend($member_srl) { $logged_info = Context::get('logged_info'); @@ -146,7 +141,7 @@ } /** - * @brief 특정 친구 그룹 가져오기 + * @brief Get a group of friends **/ function getFriendGroupInfo($friend_group_srl) { $logged_info = Context::get('logged_info'); @@ -159,7 +154,7 @@ } /** - * @brief 그룹 목록 가져오기 + * @brief Get a list of groups **/ function getFriendGroups() { $logged_info = Context::get('logged_info'); @@ -174,7 +169,7 @@ } /** - * @brief 특정 회원의 친구 목록에 포함되어 있는지를 확인 + * @brief check whether to be added in the friend list **/ function isFriend($target_srl) { $logged_info = Context::get('logged_info'); diff --git a/modules/communication/communication.view.php b/modules/communication/communication.view.php index 6213523e5..b7048ec88 100644 --- a/modules/communication/communication.view.php +++ b/modules/communication/communication.view.php @@ -2,13 +2,13 @@ /** * @class communicationView * @author NHN (developers@xpressengine.com) - * @brief communication module의 View class + * @brief View class of communication module **/ class communicationView extends communication { /** - * @brief 초기화 + * @brief Initialization **/ function init() { $oCommunicationModel = &getModel('communication'); @@ -23,14 +23,13 @@ } /** - * @brief 쪽지함 출력 + * @brief Display message box **/ function dispCommunicationMessages() { - // 로그인이 되어 있지 않으면 오류 표시 + // Error appears if not logged-in if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); - - // 변수 설정 + // Set the variables $message_srl = Context::get('message_srl'); $message_type = Context::get('message_type'); if(!in_array($message_type, array('R','S','T'))) { @@ -39,8 +38,7 @@ } $oCommunicationModel = &getModel('communication'); - - // message_srl이 있으면 내용 추출 + // extract contents if message_srl exists if($message_srl) { $message = $oCommunicationModel->getSelectedMessage($message_srl); if($message->message_srl == $message_srl && ($message->receiver_srl == $logged_info->member_srl || $message->sender_srl == $logged_info->member_srl) ) { @@ -48,11 +46,9 @@ Context::set('message', $message); } } - - // 목록 추출 + // Extract a list $output = $oCommunicationModel->getMessages($message_type); - - // 템플릿에 쓰기 위해서 context::set + // set a template file Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page', $output->page); @@ -63,25 +59,23 @@ } /** - * @brief 새 쪽지 보여줌 + * @brief display a new message **/ function dispCommunicationNewMessage() { $this->setLayoutFile('popup_layout'); - - // 로그인이 되어 있지 않으면 오류 표시 + // Error appears if not logged-in if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); $oCommunicationModel = &getModel('communication'); - - // 새 쪽지를 가져옴 + // get a new message $message = $oCommunicationModel->getNewMessage(); if($message) { stripEmbedTagForAdmin($message->content, $message->sender_srl); Context::set('message', $message); } - // 플래그 삭제 + // Delete a flag $flag_path = './files/communication_extra_info/new_message_flags/'.getNumberingPath($logged_info->member_srl); $flag_file = sprintf('%s%s', $flag_path, $logged_info->member_srl); FileHandler::removeFile($flag_file); @@ -90,22 +84,19 @@ } /** - * @brief 쪽지 발송 출력 + * @brief Display message sending **/ function dispCommunicationSendMessage() { $this->setLayoutFile("popup_layout"); $oCommunicationModel = &getModel('communication'); $oMemberModel = &getModel('member'); - - // 로그인이 되어 있지 않으면 오류 표시 + // Error appears if not logged-in if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); - - // 쪽지 받을 사용자 정보 구함 + // get receipient's information $receiver_srl = Context::get('receiver_srl'); if(!$receiver_srl || $logged_info->member_srl == $receiver_srl) return $this->stop('msg_not_logged'); - - // 답글 쪽지일 경우 원본 메세지의 글번호를 구함 + // get message_srl of the original message if it is a reply $message_srl = Context::get('message_srl'); if($message_srl) { $source_message = $oCommunicationModel->getSelectedMessage($message_srl); @@ -118,8 +109,7 @@ $receiver_info = $oMemberModel->getMemberInfoByMemberSrl($receiver_srl); Context::set('receiver_info', $receiver_info); - - // 에디터 모듈의 getEditor를 호출하여 서명용으로 세팅 + // set a signiture by calling getEditor of the editor module $oEditorModel = &getModel('editor'); $option->primary_key_name = 'receiver_srl'; $option->content_key_name = 'content'; @@ -139,21 +129,19 @@ } /** - * @brief 친구 목록 보기 + * @brief display a list of friends **/ function dispCommunicationFriend() { - // 로그인이 되어 있지 않으면 오류 표시 + // Error appears if not logged-in if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); $oCommunicationModel = &getModel('communication'); - - // 그룹 목록을 가져옴 + // get a group list $tmp_group_list = $oCommunicationModel->getFriendGroups(); $group_count = count($tmp_group_list); for($i=0;$i<$group_count;$i++) $friend_group_list[$tmp_group_list[$i]->friend_group_srl] = $tmp_group_list[$i]; Context::set('friend_group_list', $friend_group_list); - - // 친구 목록을 가져옴 + // get a list of friends $friend_group_srl = Context::get('friend_group_srl'); $output = $oCommunicationModel->getFriends($friend_group_srl); $friend_count = count($output->data); @@ -165,8 +153,7 @@ $output->data[$key]->group_title = $group_title; } } - - // 템플릿에 쓰기 위해서 context::set + // set a template file Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page', $output->page); @@ -177,26 +164,23 @@ } /** - * @brief 친구 추가 + * @brief Add a friend **/ function dispCommunicationAddFriend() { $this->setLayoutFile("popup_layout"); - - // 로그인이 되어 있지 않으면 오류 표시 + // error appears if not logged-in if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); $target_srl = Context::get('target_srl'); if(!$target_srl) return $this->stop('msg_invalid_request'); - - // 대상 회원의 정보를 구함 + // get information of the member $oMemberModel = &getModel('member'); $oCommunicationModel = &getModel('communication'); $communication_info = $oMemberModel->getMemberInfoByMemberSrl($target_srl); if($communication_info->member_srl != $target_srl) return $this->stop('msg_invalid_request'); Context::set('target_info', $communication_info); - - // 그룹의 목록을 구함 + // get a group list $friend_group_list = $oCommunicationModel->getFriendGroups(); Context::set('friend_group_list', $friend_group_list); @@ -204,16 +188,14 @@ } /** - * @brief 친구 그룹 추가 + * @brief Add a group of friends **/ function dispCommunicationAddFriendGroup() { $this->setLayoutFile("popup_layout"); - - // 로그인이 되어 있지 않으면 오류 표시 + // error apprears if not logged-in if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); - - // 그룹 번호가 넘어오면 수정모드로.. + // change to edit mode when getting the group_srl $friend_group_srl = Context::get('friend_group_srl'); if($friend_group_srl) { $oCommunicationModel = &getModel('communication'); diff --git a/modules/counter/counter.admin.view.php b/modules/counter/counter.admin.view.php index 92851917c..5e3565892 100644 --- a/modules/counter/counter.admin.view.php +++ b/modules/counter/counter.admin.view.php @@ -2,38 +2,35 @@ /** * @class counterAdminView * @author NHN (developers@xpressengine.com) - * @brief counter 모듈의 Admin view class + * @brief Admin view class of counter module **/ class counterAdminView extends counter { /** - * @brief 초기화 + * @brief Initialization **/ function init() { - // 템플릿 경로 지정 + // set the template path $this->setTemplatePath($this->module_path.'tpl'); } /** - * @brief 관리자 페이지 초기화면 + * @brief Admin page **/ function dispCounterAdminIndex() { - // 정해진 일자가 없으면 오늘자로 설정 + // set today's if no date is given $selected_date = Context::get('selected_date'); if(!$selected_date) $selected_date = date("Ymd"); Context::set('selected_date', $selected_date); - - // counter model 객체 생성 + // create the counter model object $oCounterModel = &getModel('counter'); - - // 전체 카운터 및 지정된 일자의 현황 가져오기 + // get a total count and daily count $site_module_info = Context::get('site_module_info'); $status = $oCounterModel->getStatus(array(0,$selected_date),$site_module_info->site_srl); Context::set('total_counter', $status[0]); Context::set('selected_day_counter', $status[$selected_date]); - - // 시간, 일, 월, 년도별로 데이터 가져오기 + // get data by time, day, month, and year $type = Context::get('type'); if(!$type) { $type = 'day'; @@ -42,7 +39,7 @@ $detail_status = $oCounterModel->getHourlyStatus($type, $selected_date, $site_module_info->site_srl); Context::set('detail_status', $detail_status); - // 표시 + // display $this->setTemplateFile('index'); } diff --git a/modules/counter/counter.class.php b/modules/counter/counter.class.php index 39bbe0c95..80dcfe842 100644 --- a/modules/counter/counter.class.php +++ b/modules/counter/counter.class.php @@ -2,31 +2,29 @@ /** * @class counter * @author NHN (developers@xpressengine.com) - * @brief counter 모듈의 high class + * @brief high class of counter module **/ class counter extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { $oCounterController = &getController('counter'); - - // 0 일자로 기록될 전체 방문 기록 row 추가 + // add a row for the total visit history //$oCounterController->insertTotalStatus(); - - // 오늘자 row입력 + // add a row for today's status //$oCounterController->insertTodayStatus(); return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief method if successfully installed **/ function checkUpdate() { - // 카운터에 site_srl추가 + // Add site_srl to the counter $oDB = &DB::getInstance(); if(!$oDB->isColumnExists('counter_log', 'site_srl')) return true; if(!$oDB->isIndexExists('counter_log','idx_site_counter_log')) return true; @@ -35,10 +33,10 @@ } /** - * @brief 업데이트 실행 + * @brief Update **/ function moduleUpdate() { - // 카운터에 site_srl추가 + // Add site_srl to the counter $oDB = &DB::getInstance(); if(!$oDB->isColumnExists('counter_log', 'site_srl')) $oDB->addColumn('counter_log','site_srl','number',11,0,true); if(!$oDB->isIndexExists('counter_log','idx_site_counter_log')) $oDB->addIndex('counter_log','idx_site_counter_log',array('site_srl','ipaddress'),false); @@ -47,7 +45,7 @@ } /** - * @brief 캐시 파일 재생성 + * @brief re-generate the cache file **/ function recompileCache() { } diff --git a/modules/counter/counter.controller.php b/modules/counter/counter.controller.php index cb013787e..3fab1ed1c 100644 --- a/modules/counter/counter.controller.php +++ b/modules/counter/counter.controller.php @@ -2,19 +2,19 @@ /** * @class counterController * @author NHN (developers@xpressengine.com) - * @brief counter 모듈의 controller class + * @brief counter module's controller class **/ class counterController extends counter { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 카운터 기록 + * @brief Counter logs **/ function procCounterExecute() { $oDB = &DB::getInstance(); @@ -22,26 +22,21 @@ $site_module_info = Context::get('site_module_info'); $site_srl = (int)$site_module_info->site_srl; - - // 로그를 검사 + // Check the logs $oCounterModel = &getModel('counter'); - - // 오늘자 row가 있는지 체크하여 없으면 등록 + // Register today's row if not exist if(!$oCounterModel->isInsertedTodayStatus($site_srl)) { $this->insertTodayStatus(0,$site_srl); - - // 기존 row가 있으면 사용자 체크 + // check user if the previous row exists } else { - - // 등록되어 있지 않은 아이피일 경우 + // If unregistered IP if(!$oCounterModel->isLogged($site_srl)) { - // 로그 등록 + // Leave logs $this->insertLog($site_srl); - - // unique 및 pageview 등록 + // Register unique and pageview $this->insertUniqueVisitor($site_srl); } else { - // pageview 등록 + // Register pageview $this->insertPageView($site_srl); } } @@ -50,7 +45,7 @@ } /** - * @brief 로그 등록 + * @brief Leave logs **/ function insertLog($site_srl=0) { $args->regdate = date("YmdHis"); @@ -60,7 +55,7 @@ } /** - * @brief unique visitor 등록 + * @brief Register the unique visitor **/ function insertUniqueVisitor($site_srl=0) { if($site_srl) { @@ -78,7 +73,7 @@ } /** - * @brief pageview 등록 + * @brief Register pageview **/ function insertPageView($site_srl=0) { if($site_srl) { @@ -96,7 +91,7 @@ } /** - * @brief 전체 카운터 status 추가 + * @brief Add the total counter status **/ function insertTotalStatus($site_srl=0) { $args->regdate = 0; @@ -109,7 +104,7 @@ } /** - * @brief 오늘자 카운터 status 추가 + * @brief Add today's counter status **/ function insertTodayStatus($regdate = 0, $site_srl=0) { if($regdate) $args->regdate = $regdate; @@ -118,23 +113,21 @@ $args->site_srl = $site_srl; $query_id = 'counter.insertSiteTodayStatus'; - $u_args->site_srl = $site_srl; ///< 일별 row입력시 전체 row (regdate=0)도 같이 입력 시도 + $u_args->site_srl = $site_srl; // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together executeQuery($query_id, $u_args); } else { $query_id = 'counter.insertTodayStatus'; - executeQuery($query_id); ///< 일별 row입력시 전체 row (regdate=0)도 같이 입력 시도 + executeQuery($query_id); // /< when inserting a daily row, attempt to inser total rows(where regdate=0) together } $output = executeQuery($query_id, $args); - - // 로그 등록 + // Leave logs $this->insertLog($site_srl); - - // unique 및 pageview 등록 + // Register unique and pageview $this->insertUniqueVisitor($site_srl); } /** - * @brief 특정 가상 사이트의 카운터 로그 삭제 + * @brief Delete counter logs of the specific virtual site **/ function deleteSiteCounterLogs($site_srl) { $args->site_srl = $site_srl; diff --git a/modules/counter/counter.model.php b/modules/counter/counter.model.php index 7d137c32c..9b26f33fe 100644 --- a/modules/counter/counter.model.php +++ b/modules/counter/counter.model.php @@ -2,19 +2,19 @@ /** * @class counterModel * @author NHN (developers@xpressengine.com) - * @brief counter 모듈의 Model class + * @brief Model class of counter module **/ class counterModel extends counter { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 로그 검사 + * @brief Verify logs **/ function isLogged($site_srl=0) { $args->regdate = date("Ymd"); @@ -25,7 +25,7 @@ } /** - * @brief 오늘자 카운터 현황 row 있는지 체크 + * @brief Check if a row of today's counter status exists **/ function isInsertedTodayStatus($site_srl=0) { $args->regdate = date("Ymd"); @@ -39,15 +39,14 @@ } /** - * @brief 특정 일의 접속 통계를 가져옴 + * @brief Get access statistics for a given date **/ function getStatus($selected_date, $site_srl=0) { - // 여러개의 날짜 로그를 가져올 경우 + // If more than one date logs are selected if(is_array($selected_date)) { $date_count = count($selected_date); $args->regdate = implode(',',$selected_date); - - // 단일 날짜의 로그를 가져올 경우 + // If a single date log is selected } else { if(strlen($selected_date)==8) $selected_date = $selected_date; $args->regdate = $selected_date; @@ -73,14 +72,14 @@ } /** - * @brief 지정된 일자의 시간대별 로그 가져오기 + * @brief Select hourly logs of a given date **/ function getHourlyStatus($type='hour', $selected_date, $site_srl=0) { $max = 0; $sum = 0; switch($type) { case 'year' : - // 카운터 시작일 구함 + // Get a date to start counting if($site_srl) { $args->site_srl = $site_srl; $output = executeQuery('counter.getSiteStartLogDate', $args); diff --git a/modules/document/document.admin.controller.php b/modules/document/document.admin.controller.php index 4c8c16d40..8528b5fe1 100644 --- a/modules/document/document.admin.controller.php +++ b/modules/document/document.admin.controller.php @@ -2,29 +2,28 @@ /** * @class documentAdminController * @author NHN (developers@xpressengine.com) - * @brief document 모듈의 admin controller 클래스 + * @brief document the module's admin controller class **/ class documentAdminController extends document { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 관리자 페이지에서 선택된 문서들 삭제 + * @brief Remove the selected docs from admin page **/ function procDocumentAdminDeleteChecked() { - // 선택된 글이 없으면 오류 표시 + // error appears if no doc is selected $cart = Context::get('cart'); if(!$cart) return $this->stop('msg_cart_is_null'); $document_srl_list= explode('|@|', $cart); $document_count = count($document_srl_list); if(!$document_count) return $this->stop('msg_cart_is_null'); - - // 글삭제 + // Delete a doc $oDocumentController = &getController('document'); for($i=0;$i<$document_count;$i++) { $document_srl = trim($document_srl_list[$i]); @@ -37,7 +36,7 @@ } /** - * @brief 특정 게시물들의 소속 모듈 변경 (게시글 이동시에 사용) + * @brief change the module to move a specific article **/ function moveDocumentModule($document_srl_list, $module_srl, $category_srl) { if(!count($document_srl_list)) return; @@ -51,8 +50,7 @@ $triggerObj->document_srls = implode(',',$document_srl_list); $triggerObj->module_srl = $module_srl; $triggerObj->category_srl = $category_srl; - - // Call trigger (before) + // Call a trigger (before) $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'before', $triggerObj); if(!$output->toBool()) { $oDB->rollback(); @@ -68,8 +66,7 @@ unset($obj); $obj = $oDocument->getObjectVars(); - - // 대상 모듈이 다를 경우 첨부파일 이동 + // Move the attached file if the target module is different if($module_srl != $obj->module_srl && $oDocument->hasUploadedFiles()) { $oFileController = &getController('file'); @@ -80,24 +77,21 @@ $file_info['name'] = $val->source_filename; $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, $val->download_count, true); if($inserted_file && $inserted_file->toBool()) { - // 이미지/동영상등일 경우 + // for image/video files if($val->direct_download == 'Y') { $source_filename = substr($val->uploaded_filename,2); $target_filename = substr($inserted_file->get('uploaded_filename'),2); $obj->content = str_replace($source_filename, $target_filename, $obj->content); - - // binary 파일일 경우 + // For binary files } else { $obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content); $obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content); } } - - // 기존 파일 삭제 + // Delete an existing file $oFileController->deleteFile($val->file_srl); } - - // 등록된 모든 파일을 유효로 변경 + // Set the all files to be valid $oFileController->setFilesValid($obj->document_srl); } @@ -105,8 +99,7 @@ { $oDocumentController->deleteDocumentAliasByDocument($obj->document_srl); } - - // 게시물의 모듈 이동 + // Move a module of the article $obj->module_srl = $module_srl; $obj->category_srl = $category_srl; $output = executeQuery('document.updateDocumentModule', $obj); @@ -114,8 +107,7 @@ $oDB->rollback(); return $output; } - - // 카테고리가 변경되었으면 검사후 없는 카테고리면 0으로 세팅 + // Set 0 if a new category doesn't exist after catergory change if($source_category_srl != $category_srl) { if($source_category_srl) $oDocumentController->updateCategoryCount($oDocument->get('module_srl'), $source_category_srl); if($category_srl) $oDocumentController->updateCategoryCount($module_srl, $category_srl); @@ -125,8 +117,7 @@ $args->document_srls = implode(',',$document_srl_list); $args->module_srl = $module_srl; - - // 댓글의 이동 + // move the comment $output = executeQuery('comment.updateCommentModule', $args); if(!$output->toBool()) { $oDB->rollback(); @@ -138,22 +129,19 @@ $oDB->rollback(); return $output; } - - // 엮인글의 이동 + // move the trackback $output = executeQuery('trackback.updateTrackbackModule', $args); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // 태그 + // Tags $output = executeQuery('tag.updateTagModule', $args); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // Call trigger (before) + // Call a trigger (before) $output = ModuleHandler::triggerCall('document.moveDocumentModule', 'after', $triggerObj); if(!$output->toBool()) { $oDB->rollback(); @@ -165,7 +153,7 @@ } /** - * @brief 게시글의 복사 + * @brief Copy the post **/ function copyDocumentModule($document_srl_list, $module_srl, $category_srl) { if(!count($document_srl_list)) return; @@ -191,8 +179,7 @@ $obj->password_is_hashed = true; $obj->comment_count = 0; $obj->trackback_count = 0; - - // 첨부파일 미리 등록 + // Pre-register the attachment if($oDocument->hasUploadedFiles()) { $files = $oDocument->getUploadedFiles(); foreach($files as $key => $val) { @@ -201,14 +188,12 @@ $file_info['name'] = $val->source_filename; $oFileController = &getController('file'); $inserted_file = $oFileController->insertFile($file_info, $module_srl, $obj->document_srl, 0, true); - - // 이미지/동영상등일 경우 + // if image/video files if($val->direct_download == 'Y') { $source_filename = substr($val->uploaded_filename,2); $target_filename = substr($inserted_file->get('uploaded_filename'),2); $obj->content = str_replace($source_filename, $target_filename, $obj->content); - - // binary 파일일 경우 + // If binary file } else { $obj->content = str_replace('file_srl='.$val->file_srl, 'file_srl='.$inserted_file->get('file_srl'), $obj->content); $obj->content = str_replace('sid='.$val->sid, 'sid='.$inserted_file->get('sid'), $obj->content); @@ -216,14 +201,13 @@ } } - // 글의 등록 + // Write a post $output = $oDocumentController->insertDocument($obj, true); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // 댓글 이전 + // Move the comments if($oDocument->getCommentCount()) { $oCommentModel = &getModel('comment'); $comment_output = $oCommentModel->getCommentList($document_srl, 0, true, 99999999); @@ -250,8 +234,7 @@ } } - - // 엮인글 이전 + // Move the trackbacks if($oDocument->getTrackbackCount()) { $oTrackbackModel = &getModel('trackback'); $trackbacks = $oTrackbackModel->getTrackbackList($oDocument->document_srl); @@ -264,8 +247,7 @@ $output = executeQuery('trackback.insertTrackback', $trackback_obj); if($output->toBool()) $success_count++; } - - // 엮인글 수 업데이트 + // Update the number of trackbacks $oDocumentController->updateTrackbackCount($obj->document_srl, $success_count); } } @@ -280,7 +262,7 @@ } /** - * @brief 특정 모듈의 전체 문서 삭제 + * @brief Delete all documents of the module **/ function deleteModuleDocument($module_srl) { $args->module_srl = $module_srl; @@ -289,20 +271,19 @@ } /** - * @brief 문서 모듈의 기본설정 저장 + * @brief Save the default settings of the document module **/ function procDocumentAdminInsertConfig() { - // 기본 정보를 받음 + // Get the basic information $config = Context::gets('thumbnail_type'); - - // module Controller 객체 생성하여 입력 + // Insert by creating the module Controller object $oModuleController = &getController('module'); $output = $oModuleController->insertModuleConfig('document',$config); return $output; } /** - * @brief 선택된 글들에 대해 신고 취소 + * @brief Revoke declaration of the blacklisted posts **/ function procDocumentAdminCancelDeclare() { $document_srl = trim(Context::get('document_srl')); @@ -315,14 +296,12 @@ } /** - * @brief 모든 생성된 섬네일 삭제 + * @brief Delete all thumbnails **/ function procDocumentAdminDeleteAllThumbnail() { - - // files/attaches/images/ 디렉토리를 순환하면서 thumbnail_*.jpg 파일을 모두 삭제 (1.0.4 이전까지) + // delete all of thumbnail_ *. jpg files from files/attaches/images/ directory (prior versions to 1.0.4) $this->deleteThumbnailFile('./files/attach/images'); - - // files/cache/thumbnails 디렉토리 자체를 삭제 (1.0.5 이후 변경된 섬네일 정책) + // delete a directory itself, files/cache/thumbnails (thumbnail policies have changed since version 1.0.5) FileHandler::removeFilesInDir('./files/cache/thumbnails'); $this->setMessage('success_deleted'); @@ -344,7 +323,7 @@ } /** - * @brief 모듈의 확장 변수 추가 또는 수정 + * @brief Add or modify extra variables of the module **/ function procDocumentAdminInsertExtraVar() { $module_srl = Context::get('module_srl'); @@ -358,15 +337,14 @@ $eid = Context::get('eid'); if(!$module_srl || !$name || !$eid) return new Object(-1,'msg_invalid_request'); - - // idx가 지정되어 있지 않으면 최고 값을 지정 + // set the max value if idx is not specified if(!$var_idx) { $obj->module_srl = $module_srl; $output = executeQuery('document.getDocumentMaxExtraKeyIdx', $obj); $var_idx = $output->data->var_idx+1; } - // 이미 존재하는 모듈 이름인지 체크 + // Check if the module name already exists $obj->module_srl = $module_srl; $obj->var_idx = $var_idx; $obj->eid = $eid; @@ -384,7 +362,7 @@ } /** - * @brief 모듈의 확장 변수 삭제 + * @brief delete extra variables of the module **/ function procDocumentAdminDeleteExtraVar() { $module_srl = Context::get('module_srl'); @@ -399,7 +377,7 @@ } /** - * @brief 확장변수 순서 조절 + * @brief control the order of extra variables **/ function procDocumentAdminMoveExtraVar() { $type = Context::get('type'); @@ -419,8 +397,7 @@ if($type == 'up') $new_idx = $var_idx-1; else $new_idx = $var_idx+1; if($new_idx<1) return new Object(-1,'msg_invalid_request'); - - // 바꿀 idx가 없으면 바로 업데이트 + // update immediately if there is no idx to change if(!$extra_keys[$new_idx]) { $args->module_srl = $module_srl; $args->var_idx = $var_idx; @@ -429,7 +406,7 @@ if(!$output->toBool()) return $output; $output = executeQuery('document.updateDocumentExtraVarIdx', $args); if(!$output->toBool()) return $output; - // 있으면 기존의 꺼랑 교체 + // replace if exists } else { $args->module_srl = $module_srl; $args->var_idx = $new_idx; @@ -521,15 +498,13 @@ $oDB->rollback(); return $output; } - - // 임시 저장되었던 글이 아닌 경우, 등록된 첨부파일의 상태를 유효로 지정 + // If the post was not temorarily saved, set the attachment's status to be valid if($oDocument->hasUploadedFiles() && $document_args->member_srl != $document_args->module_srl) { $args->upload_target_srl = $oDocument->document_srl; $args->isvalid = 'Y'; executeQuery('file.updateFileValid', $args); } - - // trigger 호출 (after) + // call a trigger (after) if($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('document.restoreTrash', 'after', $document_args); if(!$trigger_output->toBool()) { diff --git a/modules/document/document.admin.model.php b/modules/document/document.admin.model.php index 98d2ddfc1..14dac38ac 100644 --- a/modules/document/document.admin.model.php +++ b/modules/document/document.admin.model.php @@ -3,51 +3,45 @@ * @class documentAdminModel * @author NHN (developers@xpressengine.com) * @version 0.1 - * @brief document 모듈의 admin model class + * @brief document the module's admin model class **/ class documentAdminModel extends document { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 휴지통에 존재하는 문서 목록을 가져옴 + * @brief get a document list from the trash **/ function getDocumentTrashList($obj) { - // 정렬 대상과 순서 체크 + // check a list and its order if (!in_array($obj->sort_index, array('list_order','delete_date','title'))) $obj->sort_index = 'list_order'; if (!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc'; - - // module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌 + // get a module_srl if mid is returned instead of modul_srl if ($obj->mid) { $oModuleModel = &getModel('module'); $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); unset($obj->mid); } - - // 넘어온 module_srl은 array일 수도 있기에 array인지를 체크 + // check if the module_srl is an array if (is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); else $args->module_srl = $obj->module_srl; - - // 변수 체크 + // Variable check $args->sort_index = $obj->sort_index; $args->order_type = $obj->order_type; $args->page = $obj->page?$obj->page:1; $args->list_count = $obj->list_count?$obj->list_count:20; $args->page_count = $obj->page_count?$obj->page_count:10; $args->member_srl = $obj->member_srl; - - // query_id 지정 + // Specify query_id $query_id = 'document.getTrashList'; - - // query 실행 + // Execute a query $output = executeQueryArray($query_id, $args); - - // 결과가 없거나 오류 발생시 그냥 return + // Return if no result or an error occurs if (!$output->toBool() || !count($output->data)) return $output; $idx = 0; @@ -71,7 +65,7 @@ } /** - * @brief trash_srl값을 가지는 휴지통 문서를 가져옴 + * @brief get the doc which has trash_srl from the trash can **/ function getDocumentTrash($trash_srl) { $args->trash_srl = $trash_srl; diff --git a/modules/document/document.admin.view.php b/modules/document/document.admin.view.php index 8448c406f..4dea2efcc 100644 --- a/modules/document/document.admin.view.php +++ b/modules/document/document.admin.view.php @@ -2,82 +2,82 @@ /** * @class documentAdminView * @author NHN (developers@xpressengine.com) - * @brief document 모듈의 admin view 클래스 + * @brief document admin view of the module class **/ class documentAdminView extends document { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 목록 출력 (관리자용) + * @brief Display a list(administrative) **/ function dispDocumentAdminList() { - // 목록을 구하기 위한 옵션 - $args->page = Context::get('page'); ///< 페이지 - $args->list_count = 30; ///< 한페이지에 보여줄 글 수 - $args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수 + // option to get a list + $args->page = Context::get('page'); // /< Page + $args->list_count = 30; // /< the number of posts to display on a single page + $args->page_count = 10; // /< the number of pages that appear in the page navigation - $args->search_target = Context::get('search_target'); ///< 검색 대상 (title, contents...) - $args->search_keyword = Context::get('search_keyword'); ///< 검색어 + $args->search_target = Context::get('search_target'); // /< search (title, contents ...) + $args->search_keyword = Context::get('search_keyword'); // /< keyword to search - $args->sort_index = 'list_order'; ///< 소팅 값 + $args->sort_index = 'list_order'; // /< sorting value $args->module_srl = Context::get('module_srl'); - // 목록 구함, document->getDocumentList 에서 걍 알아서 다 해버리는 구조이다... (아.. 이거 나쁜 버릇인데.. ㅡ.ㅜ 어쩔수 없다) + // get a list $oDocumentModel = &getModel('document'); $output = $oDocumentModel->getDocumentList($args); - // 템플릿에 쓰기 위해서 document_model::getDocumentList() 의 return object에 있는 값들을 세팅 + // Set values of document_model::getDocumentList() objects for a template Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page', $output->page); Context::set('document_list', $output->data); Context::set('page_navigation', $output->page_navigation); - // 템플릿에서 사용할 검색옵션 세팅 + // set a search option used in the template $count_search_option = count($this->search_option); for($i=0;$i<$count_search_option;$i++) { $search_option[$this->search_option[$i]] = Context::getLang($this->search_option[$i]); } Context::set('search_option', $search_option); - // 템플릿 지정 + // Specify a template $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('document_list'); } /** - * @brief 문서 모듈 설정 + * @brief Set a document module **/ function dispDocumentAdminConfig() { $oDocumentModel = &getModel('document'); $config = $oDocumentModel->getDocumentConfig(); Context::set('config',$config); - // 템플릿 파일 지정 + // Set the template file $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('document_config'); } /** - * @brief 관리자 페이지의 신고 목록 보기 + * @brief display a report list on the admin page **/ function dispDocumentAdminDeclared() { - // 목록을 구하기 위한 옵션 - $args->page = Context::get('page'); ///< 페이지 - $args->list_count = 30; ///< 한페이지에 보여줄 글 수 - $args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수 + // option for a list + $args->page = Context::get('page'); // /< Page + $args->list_count = 30; // /< the number of posts to display on a single page + $args->page_count = 10; // /< the number of pages that appear in the page navigation - $args->sort_index = 'document_declared.declared_count'; ///< 소팅 값 - $args->order_type = 'desc'; ///< 소팅 정렬 값 + $args->sort_index = 'document_declared.declared_count'; // /< sorting values + $args->order_type = 'desc'; // /< sorting values by order - // 목록을 구함 + // get a list $declared_output = executeQuery('document.getDeclaredList', $args); if($declared_output->data && count($declared_output->data)) { @@ -91,14 +91,13 @@ $declared_output->data = $document_list; } - // 템플릿에 쓰기 위해서 document_model::getDocumentList() 의 return object에 있는 값들을 세팅 + // Set values of document_model::getDocumentList() objects for a template Context::set('total_count', $declared_output->total_count); Context::set('total_page', $declared_output->total_page); Context::set('page', $declared_output->page); Context::set('document_list', $declared_output->data); Context::set('page_navigation', $declared_output->page_navigation); - - // 템플릿 지정 + // Set the template $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('declared_list'); } @@ -130,28 +129,27 @@ } function dispDocumentAdminTrashList() { - // 목록을 구하기 위한 옵션 - $args->page = Context::get('page'); ///< 페이지 - $args->list_count = 30; ///< 한페이지에 보여줄 글 수 - $args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수 + // options for a list + $args->page = Context::get('page'); // /< Page + $args->list_count = 30; // /< the number of posts to display on a single page + $args->page_count = 10; // /< the number of pages that appear in the page navigation - $args->sort_index = 'list_order'; ///< 소팅 값 - $args->order_type = 'desc'; ///< 소팅 정렬 값 + $args->sort_index = 'list_order'; // /< sorting values + $args->order_type = 'desc'; // /< sorting values by order $args->module_srl = Context::get('module_srl'); - // 목록을 구함 + // get a list $oDocumentAdminModel = &getAdminModel('document'); $output = $oDocumentAdminModel->getDocumentTrashList($args); - // 템플릿에 쓰기 위해서 document_admin_model::getDocumentTrashList() 의 return object에 있는 값들을 세팅 + // Set values of document_admin_model::getDocumentTrashList() objects for a template Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page', $output->page); Context::set('document_list', $output->data); Context::set('page_navigation', $output->page_navigation); - - // 템플릿 지정 + // set the template $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('document_trash_list'); } diff --git a/modules/document/document.class.php b/modules/document/document.class.php index b51d0ed12..fb584e8a0 100644 --- a/modules/document/document.class.php +++ b/modules/document/document.class.php @@ -2,21 +2,21 @@ /** * @class document * @author NHN (developers@xpressengine.com) - * @brief document 모듈의 high 클래스 + * @brief document the module's high class **/ require_once(_XE_PATH_.'modules/document/document.item.php'); class document extends ModuleObject { - // 관리자페이지에서 사용할 검색 옵션 - var $search_option = array('title','content','title_content','user_name',); ///< 검색 옵션 + // search option to use in admin page + var $search_option = array('title','content','title_content','user_name',); // /< Search options /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // action forward에 등록 (관리자 모드에서 사용하기 위함) + // Register action forward (to use in administrator mode) $oModuleController = &getController('module'); $oDB = &DB::getInstance(); @@ -29,8 +29,7 @@ $oDB->addIndex("documents","idx_module_blamed_count", array("module_srl","blamed_count")); $oDB->addIndex("document_aliases", "idx_module_title", array("module_srl","alias_title"), true); $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); - - // 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가 + // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); // 2009. 01. 29 Added a trigger for additional setup @@ -40,67 +39,59 @@ } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { $oDB = &DB::getInstance(); $oModuleModel = &getModel('module'); /** - * 2007. 7. 25 : 알림 필드(notify_message) 추가 + * 2007. 7. 25: Add a column(notify_message) for notification **/ if(!$oDB->isColumnExists("documents","notify_message")) return true; /** - * 2007. 8. 23 : document테이블에 결합 인덱스 적용 + * 2007. 8. 23: create a clustered index in the document table **/ if(!$oDB->isIndexExists("documents","idx_module_list_order")) return true; if(!$oDB->isIndexExists("documents","idx_module_update_order")) return true; if(!$oDB->isIndexExists("documents","idx_module_readed_count")) return true; if(!$oDB->isIndexExists("documents","idx_module_voted_count")) return true; - - // 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가 + // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) return true; - - // 2007. 10. 25 문서 분류에 parent_srl, expand를 추가 + // 2007. 10. 25 add parent_srl, expand to the document category if(!$oDB->isColumnExists("document_categories","parent_srl")) return true; if(!$oDB->isColumnExists("document_categories","expand")) return true; if(!$oDB->isColumnExists("document_categories","group_srls")) return true; - - // 2007. 11. 20 게시글에 module_srl + is_notice 복합인덱스 만들기 + // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) if(!$oDB->isIndexExists("documents","idx_module_notice")) return true; - - // 2008. 02. 18 게시글에 module_srl + document_srl 복합인덱스 만들기 (manian님 확인) + // 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) if(!$oDB->isIndexExists("documents","idx_module_document_srl")) return true; /** - * 2007. 12. 03 : 확장변수(extra_vars) 컬럼이 없을 경우 추가 + * 2007. 12. 03: Add if the colume(extra_vars) doesn't exist **/ if(!$oDB->isColumnExists("documents","extra_vars")) return true; - - // 2008. 04. 23 blamed count 컬럼 추가 + // 2008. 04. 23 Add a column(blamed_count) if(!$oDB->isColumnExists("documents", "blamed_count")) return true; if(!$oDB->isIndexExists("documents","idx_module_blamed_count")) return true; if(!$oDB->isColumnExists("document_voted_log", "point")) return true; - - // 2008-12-15 문서 분류에 color를 추가 + // 2008-12-15 Add a column(color) if(!$oDB->isColumnExists("document_categories", "color")) return true; /** - * 2009. 01. 29 : 확장변수 값 테이블에 lang_code가 없을 경우 추가 + * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table **/ if(!$oDB->isColumnExists("document_extra_vars","lang_code")) return true; if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) return true; - - // 2009. 03. 09 documents에 lang_code 컬럼 추가 + // 2009. 03. 09 Add a column(lang_code) to the documnets table if(!$oDB->isColumnExists("documents","lang_code")) return true; - - // 2009. 03. 11 확장변수 값 테이블의 인덱스 점검 + // 2009. 03. 11 check the index in the document_extra_vars table if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) return true; /** - * 2009. 03. 19 : 확장변수 값 테이블에 eid가 없을 경우 추가 + * 2009. 03. 19: Add a column(eid) if not exist in the table **/ if(!$oDB->isColumnExists("document_extra_keys","eid")) return true; if(!$oDB->isColumnExists("document_extra_vars","eid")) return true; @@ -112,7 +103,7 @@ } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { $oDB = &DB::getInstance(); @@ -120,14 +111,14 @@ $oModuleController = &getController('module'); /** - * 2007. 7. 25 : 알림 필드(notify_message) 추가 + * 2007. 7. 25: Add a column(notify_message) for notification **/ if(!$oDB->isColumnExists("documents","notify_message")) { $oDB->addColumn('documents',"notify_message","char",1); } /** - * 2007. 8. 23 : document테이블에 결합 인덱스 적용 + * 2007. 8. 23: create a clustered index in the document table **/ if(!$oDB->isIndexExists("documents","idx_module_list_order")) { $oDB->addIndex("documents","idx_module_list_order", array("module_srl","list_order")); @@ -144,30 +135,26 @@ if(!$oDB->isIndexExists("documents","idx_module_voted_count")) { $oDB->addIndex("documents","idx_module_voted_count", array("module_srl","voted_count")); } - - // 2007. 10. 17 모듈이 삭제될때 등록된 글도 모두 삭제하는 트리거 추가 + // 2007. 10. 17 Add a trigger to delete all posts together when the module is deleted if(!$oModuleModel->getTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after')) $oModuleController->insertTrigger('module.deleteModule', 'document', 'controller', 'triggerDeleteModuleDocuments', 'after'); - - // 2007. 10. 25 문서 분류에 parent_srl, expand를 추가 + // 2007. 10. 25 add columns(parent_srl, expand) if(!$oDB->isColumnExists("document_categories","parent_srl")) $oDB->addColumn('document_categories',"parent_srl","number",12,0); if(!$oDB->isColumnExists("document_categories","expand")) $oDB->addColumn('document_categories',"expand","char",1,"N"); if(!$oDB->isColumnExists("document_categories","group_srls")) $oDB->addColumn('document_categories',"group_srls","text"); - - // 2007. 11. 20 게시글에 module_srl + is_notice 복합인덱스 만들기 + // 2007. 11. 20 create a composite index on the columns(module_srl + is_notice) if(!$oDB->isIndexExists("documents","idx_module_notice")) $oDB->addIndex("documents","idx_module_notice", array("module_srl","is_notice")); /** - * 2007. 12. 03 : 확장변수(extra_vars) 컬럼이 없을 경우 추가 + * 2007. 12. 03: Add if the colume(extra_vars) doesn't exist **/ if(!$oDB->isColumnExists("documents","extra_vars")) $oDB->addColumn('documents','extra_vars','text'); /** - * 2008. 02. 18 게시글에 module_srl + document_srl 복합인덱스 만들기 (manian님 확인) + * 2008. 02. 18 create a composite index on the columns(module_srl + document_srl) (checked by Manian)) **/ if(!$oDB->isIndexExists("documents","idx_module_document_srl")) $oDB->addIndex("documents","idx_module_document_srl", array("module_srl","document_srl")); - - // 2008. 04. 23 blamed count 컬럼 추가 + // 2008. 04. 23 Add a column(blamed count) if(!$oDB->isColumnExists("documents", "blamed_count")) { $oDB->addColumn('documents', 'blamed_count', 'number', 11, 0, true); $oDB->addIndex('documents', 'idx_blamed_count', array('blamed_count')); @@ -184,23 +171,21 @@ if(!$oDB->isColumnExists("document_categories","color")) $oDB->addColumn('document_categories',"color","char",7); /** - * 2009. 01. 29 : 확장변수 값 테이블에 lang_code가 없을 경우 추가 + * 2009. 01. 29: Add a column(lang_code) if not exist in the document_extra_vars table **/ if(!$oDB->isColumnExists("document_extra_vars","lang_code")) $oDB->addColumn('document_extra_vars',"lang_code","varchar",10); // 2009. 01. 29 Added a trigger for additional setup if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before')) $oModuleController->insertTrigger('module.dispAdditionSetup', 'document', 'view', 'triggerDispDocumentAdditionSetup', 'before'); - - // 2009. 03. 09 documents에 lang_code 컬럼 추가 + // 2009. 03. 09 Add a column(lang_code) to the documnets table if(!$oDB->isColumnExists("documents","lang_code")) { $db_info = Context::getDBInfo(); $oDB->addColumn('documents',"lang_code","varchar",10, $db_info->lang_code); $obj->lang_code = $db_info->lang_type; executeQuery('document.updateDocumentsLangCode', $obj); } - - // 2009. 03. 11 확장변수 값 테이블의 인덱스 점검 + // 2009. 03. 11 Check the index in the document_extra_vars table if(!$oDB->isIndexExists("document_extra_vars", "unique_extra_vars")) { $oDB->addIndex("document_extra_vars", "unique_extra_vars", array("module_srl","document_srl","var_idx","lang_code"), true); } @@ -210,8 +195,8 @@ } /** - * 2009. 03. 19 : 확장변수 값 테이블에 eid 없을 경우 추가 - * 2009. 04. 12 : eid를 등록할 때 다른 필드 값이 변경되는 문제 수정 #17922959 + * 2009. 03. 19: Add a column(eid) + * 2009. 04. 12: Fixed the issue(#17922959) that changes another column values when adding eid column **/ if(!$oDB->isColumnExists("document_extra_keys","eid")) { $oDB->addColumn("document_extra_keys","eid","varchar",40); @@ -251,10 +236,10 @@ } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { - // 게시글 분류 캐시 파일 삭제 + // Delete the cache files of document_category FileHandler::removeFilesInDir(_XE_PATH_."files/cache/document_category"); } diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index 9cb8e658b..0240367f4 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -2,1322 +2,1200 @@ /** * @class documentController * @author NHN (developers@xpressengine.com) - * @brief document 모듈의 controller 클래스 + * @brief document the module's controller class **/ class documentController extends document { - /** - * @brief 초기화 - **/ - function init() { - } - - /** - * @breif 게시글의 추천을 처리하는 action (Up) - **/ - function procDocumentVoteUp() { - if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); - - $document_srl = Context::get('target_srl'); - if(!$document_srl) return new Object(-1, 'msg_invalid_request'); - - $oDocumentModel = &getModel('document'); - $oDocument = $oDocumentModel->getDocument($document_srl, false, false); - $module_srl = $oDocument->get('module_srl'); - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); - - $oModuleModel = &getModel('module'); - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); - if($document_config->use_vote_up=='N') return new Object(-1, 'msg_invalid_request'); - - $point = 1; - return $this->updateVotedCount($document_srl, $point); - } - - function insertAlias($module_srl, $document_srl, $alias_title) { - $args->alias_srl = getNextSequence(); - $args->module_srl = $module_srl; - $args->document_srl = $document_srl; - $args->alias_title = urldecode($alias_title); - $query = "document.insertAlias"; - $output = executeQuery($query, $args); - return $output; - } - - /** - * @breif 게시글의 추천을 처리하는 action (Down) - **/ - function procDocumentVoteDown() { - if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); - - $document_srl = Context::get('target_srl'); - if(!$document_srl) return new Object(-1, 'msg_invalid_request'); - - $oDocumentModel = &getModel('document'); - $oDocument = $oDocumentModel->getDocument($document_srl, false, false); - $module_srl = $oDocument->get('module_srl'); - if(!$module_srl) return new Object(-1, 'msg_invalid_request'); - - $oModuleModel = &getModel('module'); - $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); - if($document_config->use_vote_down=='N') return new Object(-1, 'msg_invalid_request'); - - $point = -1; - return $this->updateVotedCount($document_srl, $point); - } - - /** - * @brief 게시글이 신고될 경우 호출되는 action - **/ - function procDocumentDeclare() { - if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); - - $document_srl = Context::get('target_srl'); - if(!$document_srl) return new Object(-1, 'msg_invalid_request'); - - return $this->declaredDocument($document_srl); - } - - function deleteDocumentAliasByModule($module_srl) - { - $args->module_srl = $module_srl; - executeQuery("document.deleteAlias", $args); - } - - function deleteDocumentAliasByDocument($document_srl) - { - $args->document_srl = $document_srl; - executeQuery("document.deleteAlias", $args); - } - - function deleteDocumentHistory($history_srl, $document_srl, $module_srl) - { - $args->history_srl = $history_srl; - $args->module_srl = $module_srl; - $args->document_srl = $document_srl; - if(!$args->history_srl && !$args->module_srl && !$args->document_srl) return; - executeQuery("document.deleteHistory", $args); - } - - /** - * @brief 모듈이 삭제될때 등록된 모든 글을 삭제하는 trigger - **/ - function triggerDeleteModuleDocuments(&$obj) { - $module_srl = $obj->module_srl; - if(!$module_srl) return new Object(); - - // document 삭제 - $oDocumentAdminController = &getAdminController('document'); - $output = $oDocumentAdminController->deleteModuleDocument($module_srl); - if(!$output->toBool()) return $output; - - // category 삭제 - $oDocumentController = &getController('document'); - $output = $oDocumentController->deleteModuleCategory($module_srl); - if(!$output->toBool()) return $output; - - // 확장변수 삭제 - $this->deleteDocumentExtraVars($module_srl); - - // remove aliases - $this->deleteDocumentAliasByModule($module_srl); - - // remove histories - $this->deleteDocumentHistory(null, null, $module_srl); - - return new Object(); - } - - /** - * @brief 문서의 권한 부여 - * 세션값으로 현 접속상태에서만 사용 가능 - **/ - function addGrant($document_srl) { - $_SESSION['own_document'][$document_srl] = true; - } - - /** - * @brief 문서 입력 - **/ - function insertDocument($obj, $manual_inserted = false) { - // begin transaction - $oDB = &DB::getInstance(); - $oDB->begin(); - - // 기본 변수들 정리 - if($obj->is_secret!='Y') $obj->is_secret = 'N'; - if($obj->allow_comment!='Y') $obj->allow_comment = 'N'; - if($obj->lock_comment!='Y') $obj->lock_comment = 'N'; - if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; - if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; - if($obj->notify_message != 'Y') $obj->notify_message = 'N'; - $obj->ipaddress = $_SERVER['REMOTE_ADDR']; //board에서 form key값으로 ipaddress를 사용하면 엄한 ip가 등록됨. 필터와는 상관없슴 - - // $extra_vars를 serialize - $obj->extra_vars = serialize($obj->extra_vars); - - // 자동저장용 필드 제거 - unset($obj->_saved_doc_srl); - unset($obj->_saved_doc_title); - unset($obj->_saved_doc_content); - unset($obj->_saved_doc_message); - - // trigger 호출 (before) - $output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj); - if(!$output->toBool()) return $output; - - // 주어진 문서 번호가 없으면 문서 번호 등록 - if(!$obj->document_srl) $obj->document_srl = getNextSequence(); - - $oDocumentModel = &getModel('document'); - - // 카테고리가 있나 검사하여 없는 카테고리면 0으로 세팅 - if($obj->category_srl) { - $category_list = $oDocumentModel->getCategoryList($obj->module_srl); - if(!$category_list[$obj->category_srl]) $obj->category_srl = 0; - } - - // 조회수, 등록순서 설정 - if(!$obj->readed_count) $obj->readed_count = 0; - $obj->update_order = $obj->list_order = getNextSequence() * -1; - - // 수동입력을 대비해서 비밀번호의 hash상태를 점검, 수동입력이 아니면 무조건 md5 hash - if($obj->password && !$obj->password_is_hashed) $obj->password = md5($obj->password); - - // 수동 등록이 아니고 로그인 된 회원일 경우 회원의 정보를 입력 - if(Context::get('is_logged')&&!$manual_inserted) { - $logged_info = Context::get('logged_info'); - $obj->member_srl = $logged_info->member_srl; - $obj->user_id = $logged_info->user_id; - $obj->user_name = $logged_info->user_name; - $obj->nick_name = $logged_info->nick_name; - $obj->email_address = $logged_info->email_address; - $obj->homepage = $logged_info->homepage; - } - - // 제목이 없으면 내용에서 추출 - settype($obj->title, "string"); - if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...'); - //그래도 없으면 Untitled - if($obj->title == '') $obj->title = 'Untitled'; - - // 내용에서 XE만의 태그를 삭제 - $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); - if(Mobile::isFromMobilePhone()) - { - $obj->content = nl2br(htmlspecialchars($obj->content)); - } - - // 세션에서 최고 관리자가 아니면 iframe, script 제거 - if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content); - - // 로그인정보가 없고 사용자 이름이 없으면 오류 표시 - if(!$logged_info->member_srl && !$obj->nick_name) return new Object(-1,'msg_invalid_request'); - - $obj->lang_code = Context::getLangType(); - - // DB에 입력 - $output = executeQuery('document.insertDocument', $obj); - if(!$output->toBool()) { - $oDB->rollback(); - return $output; - } - - // 등록 성공시 확장 변수 등록 - $extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl); - if(count($extra_keys)) { - foreach($extra_keys as $idx => $extra_item) { - $value = ''; - if(isset($obj->{'extra_vars'.$idx})) $value = trim($obj->{'extra_vars'.$idx}); - elseif(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name}); - if(!isset($value)) continue; - $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid); - } - } - - // 성공하였을 경우 category_srl이 있으면 카테고리 update - if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl); - - // trigger 호출 (after) - if($output->toBool()) { - $trigger_output = ModuleHandler::triggerCall('document.insertDocument', 'after', $obj); - if(!$trigger_output->toBool()) { - $oDB->rollback(); - return $trigger_output; - } - } - - // commit - $oDB->commit(); - - // return - $this->addGrant($obj->document_srl); - $output->add('document_srl',$obj->document_srl); - $output->add('category_srl',$obj->category_srl); - return $output; - } - - /** - * @brief 문서 수정 - **/ - function updateDocument($source_obj, $obj) { - if(!$source_obj->document_srl || !$obj->document_srl) return new Object(-1,'msg_invalied_request'); - - // trigger 호출 (before) - $output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj); - if(!$output->toBool()) return $output; - - // begin transaction - $oDB = &DB::getInstance(); - $oDB->begin(); - - $oModuleModel = &getModel('module'); - if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl'); - $module_srl = $obj->module_srl; - $document_config = $oModuleModel->getModulePartConfig('document', $module_srl); - if(!isset($document_config->use_history)) $document_config->use_history = 'N'; - $bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace'; - - if($bUseHistory) { - $args->history_srl = getNextSequence(); - $args->document_srl = $obj->document_srl; - $args->module_srl = $module_srl; - if($document_config->use_history == 'Y') $args->content = $source_obj->get('content'); - $args->nick_name = $source_obj->get('nick_name'); - $args->member_srl = $source_obj->get('member_srl'); - $args->regdate = $source_obj->get('last_update'); - $args->ipaddress = $source_obj->get('ipaddress'); - $output = executeQuery("document.insertHistory", $args); - } - else - { - $obj->ipaddress = $source_obj->get('ipaddress'); - } - - // 기본 변수들 정리 - if($obj->is_secret!='Y') $obj->is_secret = 'N'; - if($obj->allow_comment!='Y') $obj->allow_comment = 'N'; - if($obj->lock_comment!='Y') $obj->lock_comment = 'N'; - if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; - if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; - if($obj->notify_message != 'Y') $obj->notify_message = 'N'; - - // $extra_vars를 serialize - $obj->extra_vars = serialize($obj->extra_vars); - - // 자동저장용 필드 제거 - unset($obj->_saved_doc_srl); - unset($obj->_saved_doc_title); - unset($obj->_saved_doc_content); - unset($obj->_saved_doc_message); - - $oDocumentModel = &getModel('document'); - - // 카테고리가 변경되었으면 검사후 없는 카테고리면 0으로 세팅 - if($source_obj->get('category_srl')!=$obj->category_srl) { - $category_list = $oDocumentModel->getCategoryList($obj->module_srl); - if(!$category_list[$obj->category_srl]) $obj->category_srl = 0; - } - - // 수정 순서를 조절 - $obj->update_order = getNextSequence() * -1; - - // 비밀번호가 있으면 md5 hash - if($obj->password) $obj->password = md5($obj->password); - - // 원본 작성인과 수정하려는 수정인이 동일할 시에 또는 History를 사용하면 로그인된 사용자 정보를 입력 - if(Context::get('is_logged')) { - $logged_info = Context::get('logged_info'); - if($source_obj->get('member_srl')==$logged_info->member_srl || $bUseHistory) { - $obj->member_srl = $logged_info->member_srl; - $obj->user_name = $logged_info->user_name; - $obj->nick_name = $logged_info->nick_name; - $obj->email_address = $logged_info->email_address; - $obj->homepage = $logged_info->homepage; - } - } - - // 로그인한 유저가 작성한 글인데 nick_name이 없을 경우 - if($source_obj->get('member_srl')&& !$obj->nick_name) { - $obj->member_srl = $source_obj->get('member_srl'); - $obj->user_name = $source_obj->get('user_name'); - $obj->nick_name = $source_obj->get('nick_name'); - $obj->email_address = $source_obj->get('email_address'); - $obj->homepage = $source_obj->get('homepage'); - } - - // 제목이 없으면 내용에서 추출 - settype($obj->title, "string"); - if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...'); - //그래도 없으면 Untitled - if($obj->title == '') $obj->title = 'Untitled'; - - // 내용에서 XE만의 태그를 삭제 - $obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); - - // 글쓴이의 언어변수와 원문의 언어변수가 다르면 확장변수로 처리 - if($source_obj->get('lang_code') != Context::getLangType()) { - // 원문의 언어변수가 없을경우 확장변수가 아닌 원문의 언어변수를 변경 - if(!$source_obj->get('lang_code')) { - $lang_code_args->document_srl = $source_obj->get('document_srl'); - $lang_code_args->lang_code = Context::getLangType(); - $output = executeQuery('document.updateDocumentsLangCode', $lang_code_args); - } else { - $extra_content->title = $obj->title; - $extra_content->content = $obj->content; - - $document_args->document_srl = $source_obj->get('document_srl'); - $document_output = executeQuery('document.getDocument', $document_args); - $obj->title = $document_output->data->title; - $obj->content = $document_output->data->content; - } - } - - // 세션에서 최고 관리자가 아니면 iframe, script 제거 - if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content); - - // DB에 입력 - $output = executeQuery('document.updateDocument', $obj); - if(!$output->toBool()) { - $oDB->rollback(); - return $output; - } - - // 모든 확장 변수 삭제 - $this->deleteDocumentExtraVars($source_obj->get('module_srl'), $obj->document_srl, null, Context::getLangType()); - - // 등록 성공시 확장 변수 등록 - $extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl); - if(count($extra_keys)) { - foreach($extra_keys as $idx => $extra_item) { - $value = ''; - if(isset($obj->{'extra_vars'.$idx})) $value = trim($obj->{'extra_vars'.$idx}); - elseif(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name}); - if(!isset($value)) continue; - $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid); - } - } - - // 제목/내용의 다국어 확장변수 등록 - if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType()); - if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType()); - - // 성공하였을 경우 category_srl이 있으면 카테고리 update - if($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl) { - if($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl')); - if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl); - } - - // trigger 호출 (after) - if($output->toBool()) { - $trigger_output = ModuleHandler::triggerCall('document.updateDocument', 'after', $obj); - if(!$trigger_output->toBool()) { - $oDB->rollback(); - return $trigger_output; - } - } - - // commit - $oDB->commit(); - - // 섬네일 파일 제거 - FileHandler::removeDir(sprintf('files/cache/thumbnails/%s',getNumberingPath($obj->document_srl, 3))); - - $output->add('document_srl',$obj->document_srl); - return $output; - } - - /** - * @brief 문서 삭제 - **/ - function deleteDocument($document_srl, $is_admin = false) { - // trigger 호출 (before) - $trigger_obj->document_srl = $document_srl; - $output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj); - if(!$output->toBool()) return $output; - - // begin transaction - $oDB = &DB::getInstance(); - $oDB->begin(); - - // document의 model 객체 생성 - $oDocumentModel = &getModel('document'); - - // 기존 문서가 있는지 확인 - $oDocument = $oDocumentModel->getDocument($document_srl, $is_admin); - if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document'); - - // 권한이 있는지 확인 - if(!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted'); - - // 글 삭제 - $args->document_srl = $document_srl; - $output = executeQuery('document.deleteDocument', $args); - if(!$output->toBool()) { - $oDB->rollback(); - return $output; - } - - $this->deleteDocumentAliasByDocument($document_srl); - - $this->deleteDocumentHistory(null, $document_srl, null); - - // 카테고리가 있으면 카테고리 정보 변경 - if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl')); - - // 신고 삭제 - executeQuery('document.deleteDeclared', $args); - - // 확장 변수 삭제 - $this->deleteDocumentExtraVars($oDocument->get('module_srl'), $oDocument->document_srl); - - // trigger 호출 (after) - if($output->toBool()) { - $trigger_obj = $oDocument->getObjectVars(); - $trigger_output = ModuleHandler::triggerCall('document.deleteDocument', 'after', $trigger_obj); - if(!$trigger_output->toBool()) { - $oDB->rollback(); - return $trigger_output; - } - } - - // 섬네일 파일 제거 - FileHandler::removeDir(sprintf('files/cache/thumbnails/%s',getNumberingPath($document_srl, 3))); - - // commit - $oDB->commit(); - - return $output; - } - - /** - * @brief 문서를 휴지통으로 옮김 - **/ - function moveDocumentToTrash($obj) { - // 주어진 trash_srl이 없으면 trash_srl 등록 - if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence(); - else $trash_args->trash_srl = $obj->trash_srl; - - // 해당 document가 속해 있는 module_srl을 구한다 - $oDocumentModel = &getModel('document'); - $oDocument = $oDocumentModel->getDocument($obj->document_srl); - - $trash_args->module_srl = $oDocument->get('module_srl'); - $obj->module_srl = $oDocument->get('module_srl'); - - // 휴지통 문서를 두번 휴지통에 버릴 수 없음. - if($trash_args->module_srl == 0) return false; - - // 데이터 설정 - $trash_args->document_srl = $obj->document_srl; - $trash_args->description = $obj->description; - - // 수동 등록이 아니고 로그인 된 회원일 경우 회원의 정보를 입력 - if(Context::get('is_logged')&&!$manual_inserted) { - $logged_info = Context::get('logged_info'); - $trash_args->member_srl = $logged_info->member_srl; - $trash_args->user_id = $logged_info->user_id; - $trash_args->user_name = $logged_info->user_name; - $trash_args->nick_name = $logged_info->nick_name; - } - - // documents update를 위한 데이터 설정 - $document_args->module_srl = 0; - $document_args->document_srl = $obj->document_srl; - - // begin transaction - $oDB = &DB::getInstance(); - $oDB->begin(); - - $output = executeQuery('document.insertTrash', $trash_args); - if (!$output->toBool()) { - $oDB->rollback(); - return $output; - } - - $output = executeQuery('document.updateDocument', $document_args); - if (!$output->toBool()) { - $oDB->rollback(); - return $output; - } - - // update category - if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl')); - - // remove thumbnails - FileHandler::removeDir(sprintf('files/cache/thumbnails/%s',getNumberingPath($obj->document_srl, 3))); - - // 등록된 첨부파일의 상태를 무효로 지정 - if($oDocument->hasUploadedFiles()) { - $args->upload_target_srl = $oDocument->document_srl; - $args->isvalid = 'N'; - executeQuery('file.updateFileValid', $args); - } - - // trigger 호출 (after) - if($output->toBool()) { - $trigger_output = ModuleHandler::triggerCall('document.moveDocumentToTrash', 'after', $obj); - if(!$trigger_output->toBool()) { - $oDB->rollback(); - return $trigger_output; - } - } - - // commit - $oDB->commit(); - - return $output; - } - - /** - * @brief 해당 document의 조회수 증가 - **/ - function updateReadedCount(&$oDocument) { - $document_srl = $oDocument->document_srl; - $member_srl = $oDocument->get('member_srl'); - $logged_info = Context::get('logged_info'); - - // 조회수 업데이트가 되면 trigger 호출 (after) - $output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument); - if(!$output->toBool()) return $output; - // session에 정보로 조회수를 증가하였다고 생각하면 패스 - if($_SESSION['readed_document'][$document_srl]) return false; - - // 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스 - if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { - $_SESSION['readed_document'][$document_srl] = true; - return false; - } - - // document의 작성자가 회원일때 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 판단후 세션 등록하고 패스 - if($member_srl && $logged_info->member_srl == $member_srl) { - $_SESSION['readed_document'][$document_srl] = true; - return false; - } - - // 조회수 업데이트 - $args->document_srl = $document_srl; - $output = executeQuery('document.updateReadedCount', $args); - - // 세션 등록 - $_SESSION['readed_document'][$document_srl] = true; - } - - /** - * @breif documents 테이블의 확장 변수 등록 - **/ - function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid) { - if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new Object(-1,'msg_invalid_request'); - - $obj->module_srl = $module_srl; - $obj->var_idx = $var_idx; - $obj->var_name = $var_name; - $obj->var_type = $var_type; - $obj->var_is_required = $var_is_required=='Y'?'Y':'N'; - $obj->var_search = $var_search=='Y'?'Y':'N'; - $obj->var_default = $var_default; - $obj->var_desc = $var_desc; - $obj->eid = $eid; - - $output = executeQuery('document.getDocumentExtraKeys', $obj); - if(!$output->data) return executeQuery('document.insertDocumentExtraKey', $obj); - $output = executeQuery('document.updateDocumentExtraKey', $obj); - - // extra_vars에서 확장 변수 eid를 일괄 업데이트 - $output = executeQuery('document.updateDocumentExtraVar', $obj); - - return $output; - } - - /** - * @brief documents 확장변수 제거 - **/ - function deleteDocumentExtraKeys($module_srl, $var_idx = null) { - if(!$module_srl) return new Object(-1,'msg_invalid_request'); - $obj->module_srl = $module_srl; - if(!is_null($var_idx)) $obj->var_idx = $var_idx; - $output = executeQuery('document.deleteDocumentExtraKeys', $obj); - if(!$output->toBool()) return $output; - - return executeQuery('document.deleteDocumentExtraVars', $obj); - } - - /** - * @breif documents 테이블의 확장 변수 값 등록 - **/ - function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '') { - if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1,'msg_invalid_request'); - if(!$lang_code) $lang_code = Context::getLangType(); - - $obj->module_srl = $module_srl; - $obj->document_srl = $document_srl; - $obj->var_idx = $var_idx; - $obj->value = $value; - $obj->lang_code = $lang_code; - $obj->eid = $eid; - - executeQuery('document.insertDocumentExtraVar', $obj); - } - - /** - * @brief documents 확장변수 값 제거 - **/ - function deleteDocumentExtraVars($module_srl, $document_srl = null, $var_idx = null, $lang_code = null, $eid = null) { - $obj->module_srl = $module_srl; - if(!is_null($document_srl)) $obj->document_srl = $document_srl; - if(!is_null($var_idx)) $obj->var_idx = $var_idx; - if(!is_null($lang_code)) $obj->lang_code = $lang_code; - if(!is_null($eid)) $obj->eid = $eid; - $output = executeQuery('document.deleteDocumentExtraVars', $obj); - return $output; - } - - - /** - * @brief 해당 document의 추천수 증가 - **/ - function updateVotedCount($document_srl, $point = 1) { - if($point > 0) $failed_voted = 'failed_voted'; - else $failed_voted = 'failed_blamed'; - - // 세션 정보에 추천 정보가 있으면 중단 - if($_SESSION['voted_document'][$document_srl]) return new Object(-1, $failed_voted); - - // 문서 원본을 가져옴 - $oDocumentModel = &getModel('document'); - $oDocument = $oDocumentModel->getDocument($document_srl, false, false); - - // 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스 - if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { - $_SESSION['voted_document'][$document_srl] = true; - return new Object(-1, $failed_voted); - } - - // document의 작성자가 회원일때 조사 - if($oDocument->get('member_srl')) { - // member model 객체 생성 - $oMemberModel = &getModel('member'); - $member_srl = $oMemberModel->getLoggedMemberSrl(); - - // 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 생각하고 세션 등록후 패스 - if($member_srl && $member_srl == $oDocument->get('member_srl')) { - $_SESSION['voted_document'][$document_srl] = true; - return new Object(-1, $failed_voted); - } - } - - // 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단 - if($member_srl) { - $args->member_srl = $member_srl; - } else { - $args->ipaddress = $_SERVER['REMOTE_ADDR']; - } - $args->document_srl = $document_srl; - $output = executeQuery('document.getDocumentVotedLogInfo', $args); - - // 로그 정보에 추천 로그가 있으면 세션 등록후 패스 - if($output->data->count) { - $_SESSION['voted_document'][$document_srl] = true; - return new Object(-1, $failed_voted); - } - - // 추천수 업데이트 - if($point < 0) - { - $args->blamed_count = $oDocument->get('blamed_count') + $point; - $output = executeQuery('document.updateBlamedCount', $args); - } - else - { - $args->voted_count = $oDocument->get('voted_count') + $point; - $output = executeQuery('document.updateVotedCount', $args); - } - if(!$output->toBool()) return $output; - - // 로그 남기기 - $args->point = $point; - $output = executeQuery('document.insertDocumentVotedLog', $args); - if(!$output->toBool()) return $output; - - // 세션 정보에 남김 - $_SESSION['voted_document'][$document_srl] = true; - - $obj->member_srl = $oDocument->get('member_srl'); - $obj->module_srl = $oDocument->get('module_srl'); - $obj->document_srl = $oDocument->get('document_srl'); - $obj->update_target = ($point < 0) ? 'blamed_count' : 'voted_count'; - $obj->point = $point; - $obj->before_point = ($point < 0) ? $oDocument->get('blamed_count') : $oDocument->get('voted_count'); - $obj->after_point = ($point < 0) ? $args->blamed_count : $args->voted_count; - $output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $obj); - if(!$output->toBool()) return $output; - - // 결과 리턴 - if($point > 0) - { - return new Object(0, 'success_voted'); - } - else - { - return new Object(0, 'success_blamed'); - } - } - - /** - * @brief 게시글 신고 - **/ - function declaredDocument($document_srl) { - // 세션 정보에 신고 정보가 있으면 중단 - if($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared'); - - // 이미 신고되었는지 검사 - $args->document_srl = $document_srl; - $output = executeQuery('document.getDeclaredDocument', $args); - if(!$output->toBool()) return $output; - $declared_count = $output->data->declared_count; - - // 문서 원본을 가져옴 - $oDocumentModel = &getModel('document'); - $oDocument = $oDocumentModel->getDocument($document_srl, false, false); - - // 글의 작성 ip와 현재 접속자의 ip가 동일하면 패스 - if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { - $_SESSION['declared_document'][$document_srl] = true; - return new Object(-1, 'failed_declared'); - } - - // document의 작성자가 회원일때 조사 - if($oDocument->get('member_srl')) { - // member model 객체 생성 - $oMemberModel = &getModel('member'); - $member_srl = $oMemberModel->getLoggedMemberSrl(); - - // 글쓴이와 현재 로그인 사용자의 정보가 일치하면 읽었다고 생각하고 세션 등록후 패스 - if($member_srl && $member_srl == $oDocument->get('member_srl')) { - $_SESSION['declared_document'][$document_srl] = true; - return new Object(-1, 'failed_declared'); - } - } - - // 로그인 사용자이면 member_srl, 비회원이면 ipaddress로 판단 - if($member_srl) { - $args->member_srl = $member_srl; - } else { - $args->ipaddress = $_SERVER['REMOTE_ADDR']; - } - $args->document_srl = $document_srl; - $output = executeQuery('document.getDocumentDeclaredLogInfo', $args); - - // 로그 정보에 신고 로그가 있으면 세션 등록후 패스 - if($output->data->count) { - $_SESSION['declared_document'][$document_srl] = true; - return new Object(-1, 'failed_declared'); - } - - // 신고글 추가 - if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args); - else $output = executeQuery('document.insertDeclaredDocument', $args); - if(!$output->toBool()) return $output; - - // 로그 남기기 - $output = executeQuery('document.insertDocumentDeclaredLog', $args); - - // 세션 정보에 남김 - $_SESSION['declared_document'][$document_srl] = true; - - $this->setMessage('success_declared'); - } - - /** - * @brief 해당 document의 댓글 수 증가 - * 댓글수를 증가시키면서 수정 순서와 수정일, 수정자를 등록 - **/ - function updateCommentCount($document_srl, $comment_count, $last_updater, $comment_inserted = false) { - $args->document_srl = $document_srl; - $args->comment_count = $comment_count; - - if($comment_inserted) { - $args->update_order = -1*getNextSequence(); - $args->last_updater = $last_updater; - } - - return executeQuery('document.updateCommentCount', $args); - } - - /** - * @brief 해당 document의 엮인글 수증가 - **/ - function updateTrackbackCount($document_srl, $trackback_count) { - $args->document_srl = $document_srl; - $args->trackback_count = $trackback_count; - - return executeQuery('document.updateTrackbackCount', $args); - } - - /** - * @brief 카테고리 추가 - **/ - function insertCategory($obj) { - // 특정 카테고리의 하단으로 추가시 정렬순서 재정렬 - if($obj->parent_srl) { - // 부모 카테고리 구함 - $oDocumentModel = &getModel('document'); - $parent_category = $oDocumentModel->getCategory($obj->parent_srl); - $obj->list_order = $parent_category->list_order; - $this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order+1); - if(!$obj->category_srl) $obj->category_srl = getNextSequence(); - } else { - $obj->list_order = $obj->category_srl = getNextSequence(); - } - - $output = executeQuery('document.insertCategory', $obj); - if($output->toBool()) { - $output->add('category_srl', $obj->category_srl); - $this->makeCategoryFile($obj->module_srl); - } - - return $output; - } - - /** - * @brief 특정 카테고리 부터 list_count 증가 - **/ - function updateCategoryListOrder($module_srl, $list_order) { - $args->module_srl = $module_srl; - $args->list_order = $list_order; - return executeQuery('document.updateCategoryOrder', $args); - } - - /** - * @brief 카테고리에 문서의 숫자를 변경 - **/ - function updateCategoryCount($module_srl, $category_srl, $document_count = 0) { - // document model 객체 생성 - $oDocumentModel = &getModel('document'); - if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl); - - $args->category_srl = $category_srl; - $args->document_count = $document_count; - $output = executeQuery('document.updateCategoryCount', $args); - if($output->toBool()) $this->makeCategoryFile($module_srl); - - return $output; - } - - /** - * @brief 카테고리의 정보를 수정 - **/ - function updateCategory($obj) { - $output = executeQuery('document.updateCategory', $obj); - if($output->toBool()) $this->makeCategoryFile($obj->module_srl); - return $output; - } - - /** - /** - * @brief 카테고리 삭제 - **/ - function deleteCategory($category_srl) { - $args->category_srl = $category_srl; - $oDocumentModel = &getModel('document'); - $category_info = $oDocumentModel->getCategory($category_srl); - - // 자식 카테고리가 있는지 체크하여 있으면 삭제 못한다는 에러 출력 - $output = executeQuery('document.getChildCategoryCount', $args); - if(!$output->toBool()) return $output; - if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child'); - - // 카테고리 정보를 삭제 - $output = executeQuery('document.deleteCategory', $args); - if(!$output->toBool()) return $output; - - $this->makeCategoryFile($category_info->module_srl); - - // 현 카테고리 값을 가지는 문서들의 category_srl을 0 으로 세팅 - unset($args); - - $args->target_category_srl = 0; - $args->source_category_srl = $category_srl; - $output = executeQuery('document.updateDocumentCategory', $args); - - return $output; - } - - /** - * @brief 특정 모듈의 카테고리를 모두 삭제 - **/ - function deleteModuleCategory($module_srl) { - $args->module_srl = $module_srl; - $output = executeQuery('document.deleteModuleCategory', $args); - return $output; - } - - /** - * @brief 카테고리를 상단으로 이동 - **/ - function moveCategoryUp($category_srl) { - $oDocumentModel = &getModel('document'); - - // 선택된 카테고리의 정보를 구한다 - $args->category_srl = $category_srl; - $output = executeQuery('document.getCategory', $args); - - $category = $output->data; - $list_order = $category->list_order; - $module_srl = $category->module_srl; - - // 전체 카테고리 목록을 구한다 - $category_list = $oDocumentModel->getCategoryList($module_srl); - $category_srl_list = array_keys($category_list); - if(count($category_srl_list)<2) return new Object(); - - $prev_category = NULL; - foreach($category_list as $key => $val) { - if($key==$category_srl) break; - $prev_category = $val; - } - - // 이전 카테고리가 없으면 그냥 return - if(!$prev_category) return new Object(-1,Context::getLang('msg_category_not_moved')); - - // 선택한 카테고리가 가장 위의 카테고리이면 그냥 return - if($category_srl_list[0]==$category_srl) return new Object(-1,Context::getLang('msg_category_not_moved')); - - // 선택한 카테고리의 정보 - $cur_args->category_srl = $category_srl; - $cur_args->list_order = $prev_category->list_order; - $cur_args->title = $category->title; - $this->updateCategory($cur_args); - - // 대상 카테고리의 정보 - $prev_args->category_srl = $prev_category->category_srl; - $prev_args->list_order = $list_order; - $prev_args->title = $prev_category->title; - $this->updateCategory($prev_args); - - return new Object(); - } - - /** - * @brief 카테고리를 아래로 이동 - **/ - function moveCategoryDown($category_srl) { - $oDocumentModel = &getModel('document'); - - // 선택된 카테고리의 정보를 구한다 - $args->category_srl = $category_srl; - $output = executeQuery('document.getCategory', $args); - - $category = $output->data; - $list_order = $category->list_order; - $module_srl = $category->module_srl; - - // 전체 카테고리 목록을 구한다 - $category_list = $oDocumentModel->getCategoryList($module_srl); - $category_srl_list = array_keys($category_list); - if(count($category_srl_list)<2) return new Object(); - - for($i=0;$icategory_srl = $category_srl; - $cur_args->list_order = $next_category->list_order; - $cur_args->title = $category->title; - $this->updateCategory($cur_args); - - // 대상 카테고리의 정보 - $next_args->category_srl = $next_category->category_srl; - $next_args->list_order = $list_order; - $next_args->title = $next_category->title; - $this->updateCategory($next_args); - - return new Object(); - } - - /** - * @brief 특정 module_srl에 해당하는 document_extra_keys type, required등의 값을 체크하여 header에 javascript 코드 추가 - **/ - function addXmlJsFilter($module_srl) { - $oDocumentModel = &getModel('document'); - $extra_keys = $oDocumentModel->getExtraKeys($module_srl); - if(!count($extra_keys)) return; - - $js_code = array(); - $js_code[] = ''; - $js_code = implode("\n", $js_code); - - Context::addHtmlHeader($js_code); - } - - /** - * @brief 카테고리 추가 - **/ - function procDocumentInsertCategory($args = null) { - // 입력할 변수 정리 - if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','title','expand','group_srls','color','mid'); - - if(!$args->module_srl && $args->mid){ - $mid = $args->mid; - unset($args->mid); - $args->module_srl = $this->module_srl; - } - - // 권한 체크 - $oModuleModel = &getModel('module'); - $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); - $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); - - if($args->expand !="Y") $args->expand = "N"; - $args->group_srls = str_replace('|@|',',',$args->group_srls); - $args->parent_srl = (int)$args->parent_srl; - - $oDocumentModel = &getModel('document'); - - $oDB = &DB::getInstance(); - $oDB->begin(); - - // 이미 존재하는지를 확인 - if($args->category_srl) { - $category_info = $oDocumentModel->getCategory($args->category_srl); - if($category_info->category_srl != $args->category_srl) $args->category_srl = null; - } - - // 존재하게 되면 update를 해준다 - if($args->category_srl) { - $output = $this->updateCategory($args); - if(!$output->toBool()) { - $oDB->rollback(); - return $output; - } - - // 존재하지 않으면 insert를 해준다 - } else { - $output = $this->insertCategory($args); - if(!$output->toBool()) { - $oDB->rollback(); - return $output; - } - } - - // XML 파일을 갱신하고 위치을 넘겨 받음 - $xml_file = $this->makeCategoryFile($args->module_srl); - - $oDB->commit(); - - $this->add('xml_file', $xml_file); - $this->add('module_srl', $args->module_srl); - $this->add('category_srl', $args->category_srl); - $this->add('parent_srl', $args->parent_srl); - } - - - function procDocumentMoveCategory() { - $source_category_srl = Context::get('source_srl'); - - // parent_srl 이 있으면 첫 자식으로 들어간다 - $parent_category_srl = Context::get('parent_srl'); - - // target_srl 이 있으면 target_srl 아래로 형제로 들어간다 - $target_category_srl = Context::get('target_srl'); - - $oDocumentModel = &getModel('document'); - $source_category = $oDocumentModel->getCategory($source_category_srl); - - // 권한 체크 - $oModuleModel = &getModel('module'); - $module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl); - $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); - - //parent_category_srl 의 첫 자식으로 넣자 - if($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0)){ - $parent_category = $oDocumentModel->getCategory($parent_category_srl); - - $args->module_srl = $source_category->module_srl; - $args->parent_srl = $parent_category_srl; - $output = executeQuery('document.getChildCategoryMinListOrder', $args); - - if(!$output->toBool()) return $output; - $args->list_order = (int)$output->data->list_order; - if(!$args->list_order) $args->list_order = 0; - $args->list_order--; - - - $source_args->category_srl = $source_category_srl; - $source_args->parent_srl = $parent_category_srl; - $source_args->list_order = $args->list_order; - $output = $this->updateCategory($source_args); - if(!$output->toBool()) return $output; - - - // $target_category_srl의 아래동생으로 - }else if($target_category_srl > 0){ - $target_category = $oDocumentModel->getCategory($target_category_srl); - - //$target_category의 아래 동생을 모두 내린다 - $output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order+1); - if(!$output->toBool()) return $output; - - - $source_args->category_srl = $source_category_srl; - $source_args->parent_srl = $target_category->parent_srl; - $source_args->list_order = $target_category->list_order+1; - $output = $this->updateCategory($source_args); - if(!$output->toBool()) return $output; - } - - // xml파일 재생성 - $xml_file = $this->makeCategoryFile($source_category->module_srl); - - // return 변수 설정 - $this->add('xml_file', $xml_file); - $this->add('source_category_srl', $source_category_srl); - - } - - /** - * @brief 카테고리 삭제 - **/ - function procDocumentDeleteCategory() { - // 변수 정리 - $args = Context::gets('module_srl','category_srl'); - - $oDB = &DB::getInstance(); - $oDB->begin(); - - // 권한 체크 - $oModuleModel = &getModel('module'); - $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); - $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); - - $oDocumentModel = &getModel('document'); - - // 원정보를 가져옴 - $category_info = $oDocumentModel->getCategory($args->category_srl); - if($category_info->parent_srl) $parent_srl = $category_info->parent_srl; - - // 자식 노드가 있는지 체크하여 있으면 삭제 못한다는 에러 출력 - if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new Object(-1, 'msg_cannot_delete_for_child'); - - // DB에서 삭제 - $output = $this->deleteCategory($args->category_srl); - if(!$output->toBool()) { - $oDB->rollback(); - return $output; - } - - // XML 파일을 갱신하고 위치을 넘겨 받음 - $xml_file = $this->makeCategoryFile($args->module_srl); - - $oDB->commit(); - - $this->add('xml_file', $xml_file); - $this->add('category_srl', $parent_srl); - $this->setMessage('success_deleted'); - } - - /** - * @brief xml 파일을 갱신 - * 관리자페이지에서 메뉴 구성 후 간혹 xml파일이 재생성 안되는 경우가 있는데\n - * 이럴 경우 관리자의 수동 갱신 기능을 구현해줌\n - * 개발 중간의 문제인 것 같고 현재는 문제가 생기지 않으나 굳이 없앨 필요 없는 기능 - **/ - function procDocumentMakeXmlFile() { - // 입력값을 체크 - $module_srl = Context::get('module_srl'); - - // 권한 체크 - $oModuleModel = &getModel('module'); - $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); - $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); - if(!$grant->manager) return new Object(-1,'msg_not_permitted'); - - $xml_file = $this->makeCategoryFile($module_srl); - - // return 값 설정 - $this->add('xml_file',$xml_file); - } - - /** - * @brief 카테고리를 캐시 파일로 저장 - **/ - function makeCategoryFile($module_srl) { - // 캐시 파일 생성시 필요한 정보가 없으면 그냥 return - if(!$module_srl) return false; - - // 모듈 정보를 가져옴 (mid를 구하기 위해) - $oModuleModel = &getModel('module'); - $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); - $mid = $module_info->mid; - - if(!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category'); - - // 캐시 파일의 이름을 지정 - $xml_file = sprintf("./files/cache/document_category/%s.xml.php", $module_srl); - $php_file = sprintf("./files/cache/document_category/%s.php", $module_srl); - - // 카테고리 목록을 구함 - $args->module_srl = $module_srl; - $args->sort_index = 'list_order'; - $output = executeQuery('document.getCategoryList', $args); - - $category_list = $output->data; - - if(!$category_list) { - FileHandler::removeFile($xml_file); - FileHandler::removeFile($php_file); - return false; - } - if(!is_array($category_list)) $category_list = array($category_list); - - $category_count = count($category_list); - for($i=0;$i<$category_count;$i++) { - $category_srl = $category_list[$i]->category_srl; - if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = ''; - $list[$category_srl] = $category_list[$i]; - } - - // 구해온 데이터가 없다면 노드데이터가 없는 xml 파일만 생성 - if(!$list) { - $xml_buff = ""; - FileHandler::writeFile($xml_file, $xml_buff); - FileHandler::writeFile($php_file, ''); - return $xml_file; - } - - // 구해온 데이터가 하나라면 array로 바꾸어줌 - if(!is_array($list)) $list = array($list); - - // 루프를 돌면서 tree 구성 - foreach($list as $category_srl => $node) { - $node->mid = $mid; - $parent_srl = (int)$node->parent_srl; - $tree[$parent_srl][$category_srl] = $node; - } - - // 캐시 파일의 권한과 그룹 설정을 위한 공통 헤더 - $header_script = +/** + * @brief Initialization + **/ +function init() { +} + +/** + * @breif action to handle vote-up of the post (Up) + **/ +function procDocumentVoteUp() { +if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); + +$document_srl = Context::get('target_srl'); +if(!$document_srl) return new Object(-1, 'msg_invalid_request'); + +$oDocumentModel = &getModel('document'); +$oDocument = $oDocumentModel->getDocument($document_srl, false, false); +$module_srl = $oDocument->get('module_srl'); +if(!$module_srl) return new Object(-1, 'msg_invalid_request'); + +$oModuleModel = &getModel('module'); +$document_config = $oModuleModel->getModulePartConfig('document',$module_srl); +if($document_config->use_vote_up=='N') return new Object(-1, 'msg_invalid_request'); + +$point = 1; +return $this->updateVotedCount($document_srl, $point); +} + +function insertAlias($module_srl, $document_srl, $alias_title) { +$args->alias_srl = getNextSequence(); +$args->module_srl = $module_srl; +$args->document_srl = $document_srl; +$args->alias_title = urldecode($alias_title); +$query = "document.insertAlias"; +$output = executeQuery($query, $args); +return $output; +} + +/** + * @breif action to handle vote-up of the post (Down) + **/ +function procDocumentVoteDown() { +if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); + +$document_srl = Context::get('target_srl'); +if(!$document_srl) return new Object(-1, 'msg_invalid_request'); + +$oDocumentModel = &getModel('document'); +$oDocument = $oDocumentModel->getDocument($document_srl, false, false); +$module_srl = $oDocument->get('module_srl'); +if(!$module_srl) return new Object(-1, 'msg_invalid_request'); + +$oModuleModel = &getModel('module'); +$document_config = $oModuleModel->getModulePartConfig('document',$module_srl); +if($document_config->use_vote_down=='N') return new Object(-1, 'msg_invalid_request'); + +$point = -1; +return $this->updateVotedCount($document_srl, $point); +} + +/** + * @brief Action called when the post is reported by other member + **/ +function procDocumentDeclare() { +if(!Context::get('is_logged')) return new Object(-1, 'msg_invalid_request'); + +$document_srl = Context::get('target_srl'); +if(!$document_srl) return new Object(-1, 'msg_invalid_request'); + +return $this->declaredDocument($document_srl); +} + +function deleteDocumentAliasByModule($module_srl) +{ +$args->module_srl = $module_srl; +executeQuery("document.deleteAlias", $args); +} + +function deleteDocumentAliasByDocument($document_srl) +{ +$args->document_srl = $document_srl; +executeQuery("document.deleteAlias", $args); +} + +function deleteDocumentHistory($history_srl, $document_srl, $module_srl) +{ +$args->history_srl = $history_srl; +$args->module_srl = $module_srl; +$args->document_srl = $document_srl; +if(!$args->history_srl && !$args->module_srl && !$args->document_srl) return; +executeQuery("document.deleteHistory", $args); +} + +/** + * @brief A trigger to delete all posts together when the module is deleted + **/ +function triggerDeleteModuleDocuments(&$obj) { +$module_srl = $obj->module_srl; +if(!$module_srl) return new Object(); +// Delete the document +$oDocumentAdminController = &getAdminController('document'); +$output = $oDocumentAdminController->deleteModuleDocument($module_srl); +if(!$output->toBool()) return $output; +// Delete the category +$oDocumentController = &getController('document'); +$output = $oDocumentController->deleteModuleCategory($module_srl); +if(!$output->toBool()) return $output; +// Delete extra variable +$this->deleteDocumentExtraVars($module_srl); + +// remove aliases +$this->deleteDocumentAliasByModule($module_srl); + +// remove histories +$this->deleteDocumentHistory(null, null, $module_srl); + +return new Object(); +} + +/** + * @brief Grant a permisstion of the document + * Available in the current connection with session value + **/ +function addGrant($document_srl) { +$_SESSION['own_document'][$document_srl] = true; +} + +/** + * @brief Insert the document + **/ +function insertDocument($obj, $manual_inserted = false) { +// begin transaction +$oDB = &DB::getInstance(); +$oDB->begin(); +// List variables +if($obj->is_secret!='Y') $obj->is_secret = 'N'; +if($obj->allow_comment!='Y') $obj->allow_comment = 'N'; +if($obj->lock_comment!='Y') $obj->lock_comment = 'N'; +if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; +if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; +if($obj->notify_message != 'Y') $obj->notify_message = 'N'; +$obj->ipaddress = $_SERVER['REMOTE_ADDR']; //board에서 form key값으로 ipaddress를 사용하면 엄한 ip가 등록됨. 필터와는 상관없슴 + +// Serialize the $extra_vars +$obj->extra_vars = serialize($obj->extra_vars); +// Remove the columns for automatic saving +unset($obj->_saved_doc_srl); +unset($obj->_saved_doc_title); +unset($obj->_saved_doc_content); +unset($obj->_saved_doc_message); +// Call a trigger (before) +$output = ModuleHandler::triggerCall('document.insertDocument', 'before', $obj); +if(!$output->toBool()) return $output; +// Register it if no given document_srl exists +if(!$obj->document_srl) $obj->document_srl = getNextSequence(); + +$oDocumentModel = &getModel('document'); +// Set to 0 if the category_srl doesn't exist +if($obj->category_srl) { +$category_list = $oDocumentModel->getCategoryList($obj->module_srl); +if(!$category_list[$obj->category_srl]) $obj->category_srl = 0; +} +// Set the read counts and update order. +if(!$obj->readed_count) $obj->readed_count = 0; +$obj->update_order = $obj->list_order = getNextSequence() * -1; +// Check the status of password hash for manually inserting. Apply md5 hashing for otherwise. +if($obj->password && !$obj->password_is_hashed) $obj->password = md5($obj->password); +// Insert member's information only if the member is logged-in and not manually registered. +if(Context::get('is_logged')&&!$manual_inserted) { +$logged_info = Context::get('logged_info'); +$obj->member_srl = $logged_info->member_srl; +$obj->user_id = $logged_info->user_id; +$obj->user_name = $logged_info->user_name; +$obj->nick_name = $logged_info->nick_name; +$obj->email_address = $logged_info->email_address; +$obj->homepage = $logged_info->homepage; +} +// If the tile is empty, extract string from the contents. +settype($obj->title, "string"); +if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...'); +// If no tile extracted from the contents, leave it untitled. +if($obj->title == '') $obj->title = 'Untitled'; +// Remove XE's own tags from the contents. +$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); +if(Mobile::isFromMobilePhone()) +{ +$obj->content = nl2br(htmlspecialchars($obj->content)); +} +// Remove iframe and script if not a top adminisrator in the session. +if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content); +// An error appears if both log-in info and user name don't exist. +if(!$logged_info->member_srl && !$obj->nick_name) return new Object(-1,'msg_invalid_request'); + +$obj->lang_code = Context::getLangType(); +// Insert data into the DB +$output = executeQuery('document.insertDocument', $obj); +if(!$output->toBool()) { +$oDB->rollback(); +return $output; +} +// Insert extra variables if the document successfully inserted. +$extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl); +if(count($extra_keys)) { +foreach($extra_keys as $idx => $extra_item) { +$value = ''; +if(isset($obj->{'extra_vars'.$idx})) $value = trim($obj->{'extra_vars'.$idx}); +elseif(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name}); +if(!isset($value)) continue; +$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid); +} +} +// Update the category if the category_srl exists. +if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl); +// Call a trigger (after) +if($output->toBool()) { +$trigger_output = ModuleHandler::triggerCall('document.insertDocument', 'after', $obj); +if(!$trigger_output->toBool()) { +$oDB->rollback(); +return $trigger_output; +} +} + +// commit +$oDB->commit(); + +// return +$this->addGrant($obj->document_srl); +$output->add('document_srl',$obj->document_srl); +$output->add('category_srl',$obj->category_srl); +return $output; +} + +/** + * @brief Update the document + **/ +function updateDocument($source_obj, $obj) { +if(!$source_obj->document_srl || !$obj->document_srl) return new Object(-1,'msg_invalied_request'); +// Call a trigger (before) +$output = ModuleHandler::triggerCall('document.updateDocument', 'before', $obj); +if(!$output->toBool()) return $output; + +// begin transaction +$oDB = &DB::getInstance(); +$oDB->begin(); + +$oModuleModel = &getModel('module'); +if(!$obj->module_srl) $obj->module_srl = $source_obj->get('module_srl'); +$module_srl = $obj->module_srl; +$document_config = $oModuleModel->getModulePartConfig('document', $module_srl); +if(!isset($document_config->use_history)) $document_config->use_history = 'N'; +$bUseHistory = $document_config->use_history == 'Y' || $document_config->use_history == 'Trace'; + +if($bUseHistory) { +$args->history_srl = getNextSequence(); +$args->document_srl = $obj->document_srl; +$args->module_srl = $module_srl; +if($document_config->use_history == 'Y') $args->content = $source_obj->get('content'); +$args->nick_name = $source_obj->get('nick_name'); +$args->member_srl = $source_obj->get('member_srl'); +$args->regdate = $source_obj->get('last_update'); +$args->ipaddress = $source_obj->get('ipaddress'); +$output = executeQuery("document.insertHistory", $args); +} +else +{ +$obj->ipaddress = $source_obj->get('ipaddress'); +} +// List variables +if($obj->is_secret!='Y') $obj->is_secret = 'N'; +if($obj->allow_comment!='Y') $obj->allow_comment = 'N'; +if($obj->lock_comment!='Y') $obj->lock_comment = 'N'; +if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; +if($obj->homepage && !preg_match('/^[a-z]+:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; +if($obj->notify_message != 'Y') $obj->notify_message = 'N'; +// Serialize the $extra_vars +$obj->extra_vars = serialize($obj->extra_vars); +// Remove the columns for automatic saving +unset($obj->_saved_doc_srl); +unset($obj->_saved_doc_title); +unset($obj->_saved_doc_content); +unset($obj->_saved_doc_message); + +$oDocumentModel = &getModel('document'); +// Set the category_srl to 0 if the changed category is not exsiting. +if($source_obj->get('category_srl')!=$obj->category_srl) { +$category_list = $oDocumentModel->getCategoryList($obj->module_srl); +if(!$category_list[$obj->category_srl]) $obj->category_srl = 0; +} +// Change the update order +$obj->update_order = getNextSequence() * -1; +// Hash by md5 if the password exists +if($obj->password) $obj->password = md5($obj->password); +// If an author is identical to the modifier or history is used, use the logged-in user's information. +if(Context::get('is_logged')) { +$logged_info = Context::get('logged_info'); +if($source_obj->get('member_srl')==$logged_info->member_srl || $bUseHistory) { +$obj->member_srl = $logged_info->member_srl; +$obj->user_name = $logged_info->user_name; +$obj->nick_name = $logged_info->nick_name; +$obj->email_address = $logged_info->email_address; +$obj->homepage = $logged_info->homepage; +} +} +// For the document written by logged-in user however no nick_name exists +if($source_obj->get('member_srl')&& !$obj->nick_name) { +$obj->member_srl = $source_obj->get('member_srl'); +$obj->user_name = $source_obj->get('user_name'); +$obj->nick_name = $source_obj->get('nick_name'); +$obj->email_address = $source_obj->get('email_address'); +$obj->homepage = $source_obj->get('homepage'); +} +// If the tile is empty, extract string from the contents. +settype($obj->title, "string"); +if($obj->title == '') $obj->title = cut_str(strip_tags($obj->content),20,'...'); +// If no tile extracted from the contents, leave it untitled. +if($obj->title == '') $obj->title = 'Untitled'; +// Remove XE's own tags from the contents. +$obj->content = preg_replace('!<\!--(Before|After)(Document|Comment)\(([0-9]+),([0-9]+)\)-->!is', '', $obj->content); +// Change not extra vars but language code of the original document if document's lang_code is different from author's setting. +if($source_obj->get('lang_code') != Context::getLangType()) { +// Change not extra vars but language code of the original document if document's lang_code doesn't exist. +if(!$source_obj->get('lang_code')) { +$lang_code_args->document_srl = $source_obj->get('document_srl'); +$lang_code_args->lang_code = Context::getLangType(); +$output = executeQuery('document.updateDocumentsLangCode', $lang_code_args); +} else { +$extra_content->title = $obj->title; +$extra_content->content = $obj->content; + +$document_args->document_srl = $source_obj->get('document_srl'); +$document_output = executeQuery('document.getDocument', $document_args); +$obj->title = $document_output->data->title; +$obj->content = $document_output->data->content; +} +} +// Remove iframe and script if not a top adminisrator in the session. +if($logged_info->is_admin != 'Y') $obj->content = removeHackTag($obj->content); +// Insert data into the DB +$output = executeQuery('document.updateDocument', $obj); +if(!$output->toBool()) { +$oDB->rollback(); +return $output; +} +// Remove all extra variables +$this->deleteDocumentExtraVars($source_obj->get('module_srl'), $obj->document_srl, null, Context::getLangType()); +// Insert extra variables if the document successfully inserted. +$extra_keys = $oDocumentModel->getExtraKeys($obj->module_srl); +if(count($extra_keys)) { +foreach($extra_keys as $idx => $extra_item) { +$value = ''; +if(isset($obj->{'extra_vars'.$idx})) $value = trim($obj->{'extra_vars'.$idx}); +elseif(isset($obj->{$extra_item->name})) $value = trim($obj->{$extra_item->name}); +if(!isset($value)) continue; +$this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, $idx, $value, $extra_item->eid); +} +} +// Inert extra vars for multi-language support of title and contents. +if($extra_content->title) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -1, $extra_content->title, 'title_'.Context::getLangType()); +if($extra_content->content) $this->insertDocumentExtraVar($obj->module_srl, $obj->document_srl, -2, $extra_content->content, 'content_'.Context::getLangType()); +// Update the category if the category_srl exists. +if($source_obj->get('category_srl') != $obj->category_srl || $source_obj->get('module_srl') == $logged_info->member_srl) { +if($source_obj->get('category_srl') != $obj->category_srl) $this->updateCategoryCount($obj->module_srl, $source_obj->get('category_srl')); +if($obj->category_srl) $this->updateCategoryCount($obj->module_srl, $obj->category_srl); +} +// Call a trigger (after) +if($output->toBool()) { +$trigger_output = ModuleHandler::triggerCall('document.updateDocument', 'after', $obj); +if(!$trigger_output->toBool()) { +$oDB->rollback(); +return $trigger_output; +} +} + +// commit +$oDB->commit(); +// Remove the thumbnail file +FileHandler::removeDir(sprintf('files/cache/thumbnails/%s',getNumberingPath($obj->document_srl, 3))); + +$output->add('document_srl',$obj->document_srl); +return $output; +} + +/** + * @brief Deleting Documents + **/ +function deleteDocument($document_srl, $is_admin = false) { +// Call a trigger (before) +$trigger_obj->document_srl = $document_srl; +$output = ModuleHandler::triggerCall('document.deleteDocument', 'before', $trigger_obj); +if(!$output->toBool()) return $output; + +// begin transaction +$oDB = &DB::getInstance(); +$oDB->begin(); +// get model object of the document +$oDocumentModel = &getModel('document'); +// Check if the documnet exists +$oDocument = $oDocumentModel->getDocument($document_srl, $is_admin); +if(!$oDocument->isExists() || $oDocument->document_srl != $document_srl) return new Object(-1, 'msg_invalid_document'); +// Check if a permossion is granted +if(!$oDocument->isGranted()) return new Object(-1, 'msg_not_permitted'); +// Delete the document +$args->document_srl = $document_srl; +$output = executeQuery('document.deleteDocument', $args); +if(!$output->toBool()) { +$oDB->rollback(); +return $output; +} + +$this->deleteDocumentAliasByDocument($document_srl); + +$this->deleteDocumentHistory(null, $document_srl, null); +// Update category information if the category_srl exists. +if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl')); +// Delete a declared list +executeQuery('document.deleteDeclared', $args); +// Delete extra variable +$this->deleteDocumentExtraVars($oDocument->get('module_srl'), $oDocument->document_srl); +// Call a trigger (after) +if($output->toBool()) { +$trigger_obj = $oDocument->getObjectVars(); +$trigger_output = ModuleHandler::triggerCall('document.deleteDocument', 'after', $trigger_obj); +if(!$trigger_output->toBool()) { +$oDB->rollback(); +return $trigger_output; +} +} +// Remove the thumbnail file +FileHandler::removeDir(sprintf('files/cache/thumbnails/%s',getNumberingPath($document_srl, 3))); + +// commit +$oDB->commit(); + +return $output; +} + +/** + * @brief Move the doc into the trash + **/ +function moveDocumentToTrash($obj) { +// Get trash_srl if a given trash_srl doesn't exist +if(!$obj->trash_srl) $trash_args->trash_srl = getNextSequence(); +else $trash_args->trash_srl = $obj->trash_srl; +// Get its module_srl which the document belongs to +$oDocumentModel = &getModel('document'); +$oDocument = $oDocumentModel->getDocument($obj->document_srl); + +$trash_args->module_srl = $oDocument->get('module_srl'); +$obj->module_srl = $oDocument->get('module_srl'); +// Cannot throw data from the trash to the trash +if($trash_args->module_srl == 0) return false; +// Data setting +$trash_args->document_srl = $obj->document_srl; +$trash_args->description = $obj->description; +// Insert member's information only if the member is logged-in and not manually registered. +if(Context::get('is_logged')&&!$manual_inserted) { +$logged_info = Context::get('logged_info'); +$trash_args->member_srl = $logged_info->member_srl; +$trash_args->user_id = $logged_info->user_id; +$trash_args->user_name = $logged_info->user_name; +$trash_args->nick_name = $logged_info->nick_name; +} +// Date setting for updating documents +$document_args->module_srl = 0; +$document_args->document_srl = $obj->document_srl; + +// begin transaction +$oDB = &DB::getInstance(); +$oDB->begin(); + +$output = executeQuery('document.insertTrash', $trash_args); +if (!$output->toBool()) { +$oDB->rollback(); +return $output; +} + +$output = executeQuery('document.updateDocument', $document_args); +if (!$output->toBool()) { +$oDB->rollback(); +return $output; +} + +// update category +if($oDocument->get('category_srl')) $this->updateCategoryCount($oDocument->get('module_srl'),$oDocument->get('category_srl')); + +// remove thumbnails +FileHandler::removeDir(sprintf('files/cache/thumbnails/%s',getNumberingPath($obj->document_srl, 3))); +// Set the attachment to be invalid state +if($oDocument->hasUploadedFiles()) { +$args->upload_target_srl = $oDocument->document_srl; +$args->isvalid = 'N'; +executeQuery('file.updateFileValid', $args); +} +// Call a trigger (after) +if($output->toBool()) { +$trigger_output = ModuleHandler::triggerCall('document.moveDocumentToTrash', 'after', $obj); +if(!$trigger_output->toBool()) { +$oDB->rollback(); +return $trigger_output; +} +} + +// commit +$oDB->commit(); + +return $output; +} + +/** + * @brief Update read counts of the document + **/ +function updateReadedCount(&$oDocument) { +$document_srl = $oDocument->document_srl; +$member_srl = $oDocument->get('member_srl'); +$logged_info = Context::get('logged_info'); +// Call a trigger when the read count is updated (after) +$output = ModuleHandler::triggerCall('document.updateReadedCount', 'after', $oDocument); +if(!$output->toBool()) return $output; +// Pass if read count is increaded on the session information +if($_SESSION['readed_document'][$document_srl]) return false; + +// Pass if the author's IP address is as same as visitor's. +if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { +$_SESSION['readed_document'][$document_srl] = true; +return false; +} +// Pass ater registering sesscion if the author is a member and has same information as the currently logged-in user. +if($member_srl && $logged_info->member_srl == $member_srl) { +$_SESSION['readed_document'][$document_srl] = true; +return false; +} +// Update read counts +$args->document_srl = $document_srl; +$output = executeQuery('document.updateReadedCount', $args); +// Register session +$_SESSION['readed_document'][$document_srl] = true; +} + +/** + * @breif Insert extra variables into the document table + **/ +function insertDocumentExtraKey($module_srl, $var_idx, $var_name, $var_type, $var_is_required = 'N', $var_search = 'N', $var_default = '', $var_desc = '', $eid) { +if(!$module_srl || !$var_idx || !$var_name || !$var_type || !$eid) return new Object(-1,'msg_invalid_request'); + +$obj->module_srl = $module_srl; +$obj->var_idx = $var_idx; +$obj->var_name = $var_name; +$obj->var_type = $var_type; +$obj->var_is_required = $var_is_required=='Y'?'Y':'N'; +$obj->var_search = $var_search=='Y'?'Y':'N'; +$obj->var_default = $var_default; +$obj->var_desc = $var_desc; +$obj->eid = $eid; + +$output = executeQuery('document.getDocumentExtraKeys', $obj); +if(!$output->data) return executeQuery('document.insertDocumentExtraKey', $obj); +$output = executeQuery('document.updateDocumentExtraKey', $obj); +// Update the extra var(eid) +$output = executeQuery('document.updateDocumentExtraVar', $obj); + +return $output; +} + +/** + * @brief Remove the extra variables of the documents + **/ +function deleteDocumentExtraKeys($module_srl, $var_idx = null) { +if(!$module_srl) return new Object(-1,'msg_invalid_request'); +$obj->module_srl = $module_srl; +if(!is_null($var_idx)) $obj->var_idx = $var_idx; +$output = executeQuery('document.deleteDocumentExtraKeys', $obj); +if(!$output->toBool()) return $output; + +return executeQuery('document.deleteDocumentExtraVars', $obj); +} + +/** + * @breif Insert extra vaiable to the documents table + **/ +function insertDocumentExtraVar($module_srl, $document_srl, $var_idx, $value, $eid = null, $lang_code = '') { +if(!$module_srl || !$document_srl || !$var_idx || !isset($value)) return new Object(-1,'msg_invalid_request'); +if(!$lang_code) $lang_code = Context::getLangType(); + +$obj->module_srl = $module_srl; +$obj->document_srl = $document_srl; +$obj->var_idx = $var_idx; +$obj->value = $value; +$obj->lang_code = $lang_code; +$obj->eid = $eid; + +executeQuery('document.insertDocumentExtraVar', $obj); +} + +/** + * @brief Remove values of extra variable from the document + **/ +function deleteDocumentExtraVars($module_srl, $document_srl = null, $var_idx = null, $lang_code = null, $eid = null) { +$obj->module_srl = $module_srl; +if(!is_null($document_srl)) $obj->document_srl = $document_srl; +if(!is_null($var_idx)) $obj->var_idx = $var_idx; +if(!is_null($lang_code)) $obj->lang_code = $lang_code; +if(!is_null($eid)) $obj->eid = $eid; +$output = executeQuery('document.deleteDocumentExtraVars', $obj); +return $output; +} + + +/** + * @brief Increase the number of vote-up of the document + **/ +function updateVotedCount($document_srl, $point = 1) { +if($point > 0) $failed_voted = 'failed_voted'; +else $failed_voted = 'failed_blamed'; +// Return fail if session already has information about votes +if($_SESSION['voted_document'][$document_srl]) return new Object(-1, $failed_voted); +// Get the original document +$oDocumentModel = &getModel('document'); +$oDocument = $oDocumentModel->getDocument($document_srl, false, false); +// Pass if the author's IP address is as same as visitor's. +if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { +$_SESSION['voted_document'][$document_srl] = true; +return new Object(-1, $failed_voted); +} +// Check if document's author is a member. +if($oDocument->get('member_srl')) { +// Create a member model object +$oMemberModel = &getModel('member'); +$member_srl = $oMemberModel->getLoggedMemberSrl(); +// Pass after registering a session if author's information is same as the currently logged-in user's. +if($member_srl && $member_srl == $oDocument->get('member_srl')) { +$_SESSION['voted_document'][$document_srl] = true; +return new Object(-1, $failed_voted); +} +} +// Use member_srl for logged-in members and IP address for non-members. +if($member_srl) { +$args->member_srl = $member_srl; +} else { +$args->ipaddress = $_SERVER['REMOTE_ADDR']; +} +$args->document_srl = $document_srl; +$output = executeQuery('document.getDocumentVotedLogInfo', $args); +// Pass after registering a session if log information has vote-up logs +if($output->data->count) { +$_SESSION['voted_document'][$document_srl] = true; +return new Object(-1, $failed_voted); +} +// Update the voted count +if($point < 0) +{ +$args->blamed_count = $oDocument->get('blamed_count') + $point; +$output = executeQuery('document.updateBlamedCount', $args); +} +else +{ +$args->voted_count = $oDocument->get('voted_count') + $point; +$output = executeQuery('document.updateVotedCount', $args); +} +if(!$output->toBool()) return $output; +// Leave logs +$args->point = $point; +$output = executeQuery('document.insertDocumentVotedLog', $args); +if(!$output->toBool()) return $output; +// Leave in the session information +$_SESSION['voted_document'][$document_srl] = true; + +$obj->member_srl = $oDocument->get('member_srl'); +$obj->module_srl = $oDocument->get('module_srl'); +$obj->document_srl = $oDocument->get('document_srl'); +$obj->update_target = ($point < 0) ? 'blamed_count' : 'voted_count'; +$obj->point = $point; +$obj->before_point = ($point < 0) ? $oDocument->get('blamed_count') : $oDocument->get('voted_count'); +$obj->after_point = ($point < 0) ? $args->blamed_count : $args->voted_count; +$output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $obj); +if(!$output->toBool()) return $output; +// Return result +if($point > 0) +{ +return new Object(0, 'success_voted'); +} +else +{ +return new Object(0, 'success_blamed'); +} +} + +/** + * @brief Report posts + **/ +function declaredDocument($document_srl) { +// Fail if session information already has a reported document +if($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared'); +// Check if previously reported +$args->document_srl = $document_srl; +$output = executeQuery('document.getDeclaredDocument', $args); +if(!$output->toBool()) return $output; +$declared_count = $output->data->declared_count; +// Get the original document +$oDocumentModel = &getModel('document'); +$oDocument = $oDocumentModel->getDocument($document_srl, false, false); +// Pass if the author's IP address is as same as visitor's. +if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) { +$_SESSION['declared_document'][$document_srl] = true; +return new Object(-1, 'failed_declared'); +} +// Check if document's author is a member. +if($oDocument->get('member_srl')) { +// Create a member model object +$oMemberModel = &getModel('member'); +$member_srl = $oMemberModel->getLoggedMemberSrl(); +// Pass after registering a session if author's information is same as the currently logged-in user's. +if($member_srl && $member_srl == $oDocument->get('member_srl')) { +$_SESSION['declared_document'][$document_srl] = true; +return new Object(-1, 'failed_declared'); +} +} +// Use member_srl for logged-in members and IP address for non-members. +if($member_srl) { +$args->member_srl = $member_srl; +} else { +$args->ipaddress = $_SERVER['REMOTE_ADDR']; +} +$args->document_srl = $document_srl; +$output = executeQuery('document.getDocumentDeclaredLogInfo', $args); +// Pass after registering a sesson if reported/declared documents are in the logs. +if($output->data->count) { +$_SESSION['declared_document'][$document_srl] = true; +return new Object(-1, 'failed_declared'); +} +// Add the declared document +if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args); +else $output = executeQuery('document.insertDeclaredDocument', $args); +if(!$output->toBool()) return $output; +// Leave logs +$output = executeQuery('document.insertDocumentDeclaredLog', $args); +// Leave in the session information +$_SESSION['declared_document'][$document_srl] = true; + +$this->setMessage('success_declared'); +} + +/** + * @brief Increase the number of comments in the document + * Update modified date, modifier, and order with increasing comment count + **/ +function updateCommentCount($document_srl, $comment_count, $last_updater, $comment_inserted = false) { +$args->document_srl = $document_srl; +$args->comment_count = $comment_count; + +if($comment_inserted) { +$args->update_order = -1*getNextSequence(); +$args->last_updater = $last_updater; +} + +return executeQuery('document.updateCommentCount', $args); +} + +/** + * @brief Increase trackback count of the document + **/ +function updateTrackbackCount($document_srl, $trackback_count) { +$args->document_srl = $document_srl; +$args->trackback_count = $trackback_count; + +return executeQuery('document.updateTrackbackCount', $args); +} + +/** + * @brief Add a category + **/ +function insertCategory($obj) { +// Sort the order to display if a child category is added +if($obj->parent_srl) { +// Get its parent category +$oDocumentModel = &getModel('document'); +$parent_category = $oDocumentModel->getCategory($obj->parent_srl); +$obj->list_order = $parent_category->list_order; +$this->updateCategoryListOrder($parent_category->module_srl, $parent_category->list_order+1); +if(!$obj->category_srl) $obj->category_srl = getNextSequence(); +} else { +$obj->list_order = $obj->category_srl = getNextSequence(); +} + +$output = executeQuery('document.insertCategory', $obj); +if($output->toBool()) { +$output->add('category_srl', $obj->category_srl); +$this->makeCategoryFile($obj->module_srl); +} + +return $output; +} + +/** + * @brief Increase list_count from a specific category + **/ +function updateCategoryListOrder($module_srl, $list_order) { +$args->module_srl = $module_srl; +$args->list_order = $list_order; +return executeQuery('document.updateCategoryOrder', $args); +} + +/** + * @brief Update document_count in the category. + **/ +function updateCategoryCount($module_srl, $category_srl, $document_count = 0) { +// Create a document model object +$oDocumentModel = &getModel('document'); +if(!$document_count) $document_count = $oDocumentModel->getCategoryDocumentCount($module_srl,$category_srl); + +$args->category_srl = $category_srl; +$args->document_count = $document_count; +$output = executeQuery('document.updateCategoryCount', $args); +if($output->toBool()) $this->makeCategoryFile($module_srl); + +return $output; +} + +/** + * @brief Update category information + **/ +function updateCategory($obj) { +$output = executeQuery('document.updateCategory', $obj); +if($output->toBool()) $this->makeCategoryFile($obj->module_srl); +return $output; +} + +/** + /** + * @brief Delete a category + **/ +function deleteCategory($category_srl) { +$args->category_srl = $category_srl; +$oDocumentModel = &getModel('document'); +$category_info = $oDocumentModel->getCategory($category_srl); +// Display an error that the category cannot be deleted if it has a child +$output = executeQuery('document.getChildCategoryCount', $args); +if(!$output->toBool()) return $output; +if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child'); +// Delete a category information +$output = executeQuery('document.deleteCategory', $args); +if(!$output->toBool()) return $output; + +$this->makeCategoryFile($category_info->module_srl); +// Update category_srl of the documents in the same category to 0 +unset($args); + +$args->target_category_srl = 0; +$args->source_category_srl = $category_srl; +$output = executeQuery('document.updateDocumentCategory', $args); + +return $output; +} + +/** + * @brief Delete all categories in a module + **/ +function deleteModuleCategory($module_srl) { +$args->module_srl = $module_srl; +$output = executeQuery('document.deleteModuleCategory', $args); +return $output; +} + +/** + * @brief Move the category level to higher + **/ +function moveCategoryUp($category_srl) { +$oDocumentModel = &getModel('document'); +// Get information of the selected category +$args->category_srl = $category_srl; +$output = executeQuery('document.getCategory', $args); + +$category = $output->data; +$list_order = $category->list_order; +$module_srl = $category->module_srl; +// Seek a full list of categories +$category_list = $oDocumentModel->getCategoryList($module_srl); +$category_srl_list = array_keys($category_list); +if(count($category_srl_list)<2) return new Object(); + +$prev_category = NULL; +foreach($category_list as $key => $val) { +if($key==$category_srl) break; +$prev_category = $val; +} +// Return if the previous category doesn't exist +if(!$prev_category) return new Object(-1,Context::getLang('msg_category_not_moved')); +// Return if the selected category is the top level +if($category_srl_list[0]==$category_srl) return new Object(-1,Context::getLang('msg_category_not_moved')); +// Information of the selected category +$cur_args->category_srl = $category_srl; +$cur_args->list_order = $prev_category->list_order; +$cur_args->title = $category->title; +$this->updateCategory($cur_args); +// Category information +$prev_args->category_srl = $prev_category->category_srl; +$prev_args->list_order = $list_order; +$prev_args->title = $prev_category->title; +$this->updateCategory($prev_args); + +return new Object(); +} + +/** + * @brief Move the category down + **/ +function moveCategoryDown($category_srl) { +$oDocumentModel = &getModel('document'); +// Get information of the selected category +$args->category_srl = $category_srl; +$output = executeQuery('document.getCategory', $args); + +$category = $output->data; +$list_order = $category->list_order; +$module_srl = $category->module_srl; +// Seek a full list of categories +$category_list = $oDocumentModel->getCategoryList($module_srl); +$category_srl_list = array_keys($category_list); +if(count($category_srl_list)<2) return new Object(); + +for($i=0;$icategory_srl = $category_srl; +$cur_args->list_order = $next_category->list_order; +$cur_args->title = $category->title; +$this->updateCategory($cur_args); +// Category information +$next_args->category_srl = $next_category->category_srl; +$next_args->list_order = $list_order; +$next_args->title = $next_category->title; +$this->updateCategory($next_args); + +return new Object(); +} + +/** + * @brief Add javascript codes into the header by checking values of document_extra_keys type, required and others + **/ +function addXmlJsFilter($module_srl) { +$oDocumentModel = &getModel('document'); +$extra_keys = $oDocumentModel->getExtraKeys($module_srl); +if(!count($extra_keys)) return; + +$js_code = array(); +$js_code[] = ''; +$js_code = implode("\n", $js_code); + +Context::addHtmlHeader($js_code); +} + +/** + * @brief Add a category + **/ +function procDocumentInsertCategory($args = null) { +// List variables +if(!$args) $args = Context::gets('module_srl','category_srl','parent_srl','title','expand','group_srls','color','mid'); + +if(!$args->module_srl && $args->mid){ +$mid = $args->mid; +unset($args->mid); +$args->module_srl = $this->module_srl; +} +// Check permissions +$oModuleModel = &getModel('module'); +$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); +$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); +if(!$grant->manager) return new Object(-1,'msg_not_permitted'); + +if($args->expand !="Y") $args->expand = "N"; +$args->group_srls = str_replace('|@|',',',$args->group_srls); +$args->parent_srl = (int)$args->parent_srl; + +$oDocumentModel = &getModel('document'); + +$oDB = &DB::getInstance(); +$oDB->begin(); +// Check if already exists +if($args->category_srl) { +$category_info = $oDocumentModel->getCategory($args->category_srl); +if($category_info->category_srl != $args->category_srl) $args->category_srl = null; +} +// Update if exists +if($args->category_srl) { +$output = $this->updateCategory($args); +if(!$output->toBool()) { +$oDB->rollback(); +return $output; +} +// Insert if not exist +} else { +$output = $this->insertCategory($args); +if(!$output->toBool()) { +$oDB->rollback(); +return $output; +} +} +// Update the xml file and get its location +$xml_file = $this->makeCategoryFile($args->module_srl); + +$oDB->commit(); + +$this->add('xml_file', $xml_file); +$this->add('module_srl', $args->module_srl); +$this->add('category_srl', $args->category_srl); +$this->add('parent_srl', $args->parent_srl); +} + + +function procDocumentMoveCategory() { +$source_category_srl = Context::get('source_srl'); +// If parent_srl exists, be the first child +$parent_category_srl = Context::get('parent_srl'); +// If target_srl exists, be a sibling +$target_category_srl = Context::get('target_srl'); + +$oDocumentModel = &getModel('document'); +$source_category = $oDocumentModel->getCategory($source_category_srl); +// Check permissions +$oModuleModel = &getModel('module'); +$module_info = $oModuleModel->getModuleInfoByModuleSrl($source_category->module_srl); +$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); +if(!$grant->manager) return new Object(-1,'msg_not_permitted'); +// First child of the parent_category_srl +if($parent_category_srl > 0 || ($parent_category_srl == 0 && $target_category_srl == 0)){ +$parent_category = $oDocumentModel->getCategory($parent_category_srl); + +$args->module_srl = $source_category->module_srl; +$args->parent_srl = $parent_category_srl; +$output = executeQuery('document.getChildCategoryMinListOrder', $args); + +if(!$output->toBool()) return $output; +$args->list_order = (int)$output->data->list_order; +if(!$args->list_order) $args->list_order = 0; +$args->list_order--; + + +$source_args->category_srl = $source_category_srl; +$source_args->parent_srl = $parent_category_srl; +$source_args->list_order = $args->list_order; +$output = $this->updateCategory($source_args); +if(!$output->toBool()) return $output; +// Sibling of the $target_category_srl +}else if($target_category_srl > 0){ +$target_category = $oDocumentModel->getCategory($target_category_srl); +// Move all siblings of the $target_category down +$output = $this->updateCategoryListOrder($target_category->module_srl, $target_category->list_order+1); +if(!$output->toBool()) return $output; + + +$source_args->category_srl = $source_category_srl; +$source_args->parent_srl = $target_category->parent_srl; +$source_args->list_order = $target_category->list_order+1; +$output = $this->updateCategory($source_args); +if(!$output->toBool()) return $output; +} +// Re-generate the xml file +$xml_file = $this->makeCategoryFile($source_category->module_srl); +// Variable settings +$this->add('xml_file', $xml_file); +$this->add('source_category_srl', $source_category_srl); + +} + +/** + * @brief Delete a category + **/ +function procDocumentDeleteCategory() { +// List variables +$args = Context::gets('module_srl','category_srl'); + +$oDB = &DB::getInstance(); +$oDB->begin(); +// Check permissions +$oModuleModel = &getModel('module'); +$module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); +$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); +if(!$grant->manager) return new Object(-1,'msg_not_permitted'); + +$oDocumentModel = &getModel('document'); +// Get original information +$category_info = $oDocumentModel->getCategory($args->category_srl); +if($category_info->parent_srl) $parent_srl = $category_info->parent_srl; +// Display an error that the category cannot be deleted if it has a child node +if($oDocumentModel->getCategoryChlidCount($args->category_srl)) return new Object(-1, 'msg_cannot_delete_for_child'); +// Remove from the DB +$output = $this->deleteCategory($args->category_srl); +if(!$output->toBool()) { +$oDB->rollback(); +return $output; +} +// Update the xml file and get its location +$xml_file = $this->makeCategoryFile($args->module_srl); + +$oDB->commit(); + +$this->add('xml_file', $xml_file); +$this->add('category_srl', $parent_srl); +$this->setMessage('success_deleted'); +} + +/** + * @brief xml files updated + * Occasionally the xml file is not generated after menu is configued on the admin page \n + * The administrator can manually update the file in this case \n + * Although the issue is not currently reproduced, it is unnecessay to remove. + **/ +function procDocumentMakeXmlFile() { +// Check input values +$module_srl = Context::get('module_srl'); +// Check permissions +$oModuleModel = &getModel('module'); +$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); +$grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); +if(!$grant->manager) return new Object(-1,'msg_not_permitted'); + +$xml_file = $this->makeCategoryFile($module_srl); +// Set return value +$this->add('xml_file',$xml_file); +} + +/** + * @brief Save the category in a cache file + **/ +function makeCategoryFile($module_srl) { +// Return if there is no information you need for creating a cache file +if(!$module_srl) return false; +// Get module information (to obtain mid) +$oModuleModel = &getModel('module'); +$module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); +$mid = $module_info->mid; + +if(!is_dir('./files/cache/document_category')) FileHandler::makeDir('./files/cache/document_category'); +// Cache file's name +$xml_file = sprintf("./files/cache/document_category/%s.xml.php", $module_srl); +$php_file = sprintf("./files/cache/document_category/%s.php", $module_srl); +// Get a category list +$args->module_srl = $module_srl; +$args->sort_index = 'list_order'; +$output = executeQuery('document.getCategoryList', $args); + +$category_list = $output->data; + +if(!$category_list) { +FileHandler::removeFile($xml_file); +FileHandler::removeFile($php_file); +return false; +} +if(!is_array($category_list)) $category_list = array($category_list); + +$category_count = count($category_list); +for($i=0;$i<$category_count;$i++) { +$category_srl = $category_list[$i]->category_srl; +if(!preg_match('/^[0-9,]+$/', $category_list[$i]->group_srls)) $category_list[$i]->group_srls = ''; +$list[$category_srl] = $category_list[$i]; +} +// Create the xml file without node data if no data is obtained +if(!$list) { +$xml_buff = ""; +FileHandler::writeFile($xml_file, $xml_buff); +FileHandler::writeFile($php_file, ''); +return $xml_file; +} +// Change to an array if only a single data is obtained +if(!is_array($list)) $list = array($list); +// Create a tree for loop +foreach($list as $category_srl => $node) { +$node->mid = $mid; +$parent_srl = (int)$node->parent_srl; +$tree[$parent_srl][$category_srl] = $node; +} +// A common header to set permissions and groups of the cache file +$header_script = '$lang_type = Context::getLangType(); '. '$is_logged = Context::get(\'is_logged\'); '. '$logged_info = Context::get(\'logged_info\'); '. @@ -1330,10 +1208,10 @@ class documentController extends document { '$group_srsl = array(); '. '} '."\n"; - // xml 캐시 파일 생성 (xml캐시는 따로 동작하기에 session 지정을 해주어야 함) - $xml_header_buff = ''; - $xml_body_buff = $this->getXmlTree($tree[0], $tree, $module_info->site_srl, $xml_header_buff); - $xml_buff = sprintf( +// Create the xml cache file (a separate session is needed for xml cache) +$xml_header_buff = ''; +$xml_body_buff = $this->getXmlTree($tree[0], $tree, $module_info->site_srl, $xml_header_buff); +$xml_buff = sprintf( 'close();'. '?>'. '%s', - $header_script, - $xml_header_buff, - $xml_body_buff - ); - - // php 캐시 파일 생성 - $php_output = $this->getPhpCacheCode($tree[0], $tree, $module_info->site_srl, $php_header_buff); - $php_buff = sprintf( +$header_script, +$xml_header_buff, +$xml_body_buff +); +// Create php cache file +$php_output = $this->getPhpCacheCode($tree[0], $tree, $module_info->site_srl, $php_header_buff); +$php_buff = sprintf( 'list = array(%s); '. '?>', - $header_script, - $php_header_buff, - $php_output['buff'] - ); +$header_script, +$php_header_buff, +$php_output['buff'] +); +// Save File +FileHandler::writeFile($xml_file, $xml_buff); +FileHandler::writeFile($php_file, $php_buff); +return $xml_file; +} - // 파일 저장 - FileHandler::writeFile($xml_file, $xml_buff); - FileHandler::writeFile($php_file, $php_buff); - return $xml_file; - } +/** + * @brief Create the xml data recursively referring to parent_srl + * In the menu xml file, node tag is nested and xml doc enables the admin page to have a menu\n + * (tree menu is implemented by reading xml file from the tree_menu.js) + **/ +function getXmlTree($source_node, $tree, $site_srl, &$xml_header_buff) { +if(!$source_node) return; - /** - * @brief array로 정렬된 노드들을 parent_srl을 참조하면서 recursive하게 돌면서 xml 데이터 생성 - * 메뉴 xml파일은 node라는 tag가 중첩으로 사용되며 이 xml doc으로 관리자 페이지에서 메뉴를 구성해줌\n - * (tree_menu.js 에서 xml파일을 바로 읽고 tree menu를 구현) - **/ - function getXmlTree($source_node, $tree, $site_srl, &$xml_header_buff) { - if(!$source_node) return; +foreach($source_node as $category_srl => $node) { +$child_buff = ""; +// Get data of the child nodes +if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff); +// List variables +$expand = $node->expand; +$group_srls = $node->group_srls; +$mid = $node->mid; +$module_srl = $node->module_srl; +$parent_srl = $node->parent_srl; +$color = $node->color; +// If node->group_srls value exists +if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls); +else $group_check_code = "true"; - foreach($source_node as $category_srl => $node) { - $child_buff = ""; +$title = $node->title; +$oModuleAdminModel = &getAdminModel('module'); +$langs = $oModuleAdminModel->getLangCode($site_srl, $title); +if(count($langs)) foreach($langs as $key => $val) $xml_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val))); - // 자식 노드의 데이터 가져옴 - if($category_srl && $tree[$category_srl]) $child_buff = $this->getXmlTree($tree[$category_srl], $tree, $site_srl, $xml_header_buff); - - // 변수 정리 - $expand = $node->expand; - $group_srls = $node->group_srls; - $mid = $node->mid; - $module_srl = $node->module_srl; - $parent_srl = $node->parent_srl; - $color = $node->color; - // node->group_srls값이 있으면 - if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls); - else $group_check_code = "true"; - - $title = $node->title; - $oModuleAdminModel = &getAdminModel('module'); - $langs = $oModuleAdminModel->getLangCode($site_srl, $title); - if(count($langs)) foreach($langs as $key => $val) $xml_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val))); - - $attribute = sprintf( +$attribute = sprintf( 'mid="%s" module_srl="%d" node_srl="%d" parent_srl="%d" category_srl="%d" text="" url="%s" expand="%s" color="%s" document_count="%d" ', - $mid, - $module_srl, - $category_srl, - $parent_srl, - $category_srl, - $group_check_code, - $category_srl, - getUrl('','mid',$node->mid,'category',$category_srl), - $expand, - $color, - $node->document_count - ); +$mid, +$module_srl, +$category_srl, +$parent_srl, +$category_srl, +$group_check_code, +$category_srl, +getUrl('','mid',$node->mid,'category',$category_srl), +$expand, +$color, +$node->document_count +); - if($child_buff) $buff .= sprintf('%s', $attribute, $child_buff); - else $buff .= sprintf('', $attribute); - } - return $buff; - } +if($child_buff) $buff .= sprintf('%s', $attribute, $child_buff); +else $buff .= sprintf('', $attribute); +} +return $buff; +} - /** - * @brief array로 정렬된 노드들을 php code로 변경하여 return - * 메뉴에서 메뉴를 tpl에 사용시 xml데이터를 사용할 수도 있지만 별도의 javascript 사용이 필요하기에 - * php로 된 캐시파일을 만들어서 db이용없이 바로 메뉴 정보를 구할 수 있도록 한다 - * 이 캐시는 ModuleHandler::displayContent() 에서 include하여 Context::set() 한다 - **/ - function getPhpCacheCode($source_node, $tree, $site_srl, &$php_header_buff) { - $output = array("buff"=>"", "category_srl_list"=>array()); - if(!$source_node) return $output; +/** + * @brief change sorted nodes in an array to the php code and then return + * when using menu on tpl, you can directly xml data. howver you may need javascrips additionally. + * therefore, you can configure the menu info directly from php cache file, not through DB. + * You may include the cache in the ModuleHandler::displayContent() + **/ +function getPhpCacheCode($source_node, $tree, $site_srl, &$php_header_buff) { +$output = array("buff"=>"", "category_srl_list"=>array()); +if(!$source_node) return $output; +// Set to an arraty for looping and then generate php script codes to be included +foreach($source_node as $category_srl => $node) { +// Get data from child nodes first if exist. +if($category_srl&&$tree[$category_srl]) $child_output = $this->getPhpCacheCode($tree[$category_srl], $tree, $site_srl, $php_header_buff); +else $child_output = array("buff"=>"", "category_srl_list"=>array()); +// Set values into category_srl_list arrary if url of the current node is not empty +$child_output['category_srl_list'][] = $node->category_srl; +$output['category_srl_list'] = array_merge($output['category_srl_list'], $child_output['category_srl_list']); +// If node->group_srls value exists +if($node->group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$node->group_srls); +else $group_check_code = "true"; +// List variables +$selected = '"'.implode('","',$child_output['category_srl_list']).'"'; +$child_buff = $child_output['buff']; +$expand = $node->expand; - // 루프를 돌면서 1차 배열로 정리하고 include할 수 있는 php script 코드를 생성 - foreach($source_node as $category_srl => $node) { - - // 자식 노드가 있으면 자식 노드의 데이터를 먼저 얻어옴 - if($category_srl&&$tree[$category_srl]) $child_output = $this->getPhpCacheCode($tree[$category_srl], $tree, $site_srl, $php_header_buff); - else $child_output = array("buff"=>"", "category_srl_list"=>array()); - - // 현재 노드의 url값이 공란이 아니라면 category_srl_list 배열값에 입력 - $child_output['category_srl_list'][] = $node->category_srl; - $output['category_srl_list'] = array_merge($output['category_srl_list'], $child_output['category_srl_list']); - - // node->group_srls값이 있으면 - if($node->group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$node->group_srls); - else $group_check_code = "true"; - - // 변수 정리 - $selected = '"'.implode('","',$child_output['category_srl_list']).'"'; - $child_buff = $child_output['buff']; - $expand = $node->expand; - - $title = $node->title; - $oModuleAdminModel = &getAdminModel('module'); - $langs = $oModuleAdminModel->getLangCode($site_srl, $title); - if(count($langs)) foreach($langs as $key => $val) $php_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val))); - - // 속성을 생성한다 ( category_srl_list를 이용해서 선택된 메뉴의 노드에 속하는지를 검사한다. 꽁수지만 빠르고 강력하다고 생각;;) - $attribute = sprintf( +$title = $node->title; +$oModuleAdminModel = &getAdminModel('module'); +$langs = $oModuleAdminModel->getLangCode($site_srl, $title); +if(count($langs)) foreach($langs as $key => $val) $php_header_buff .= sprintf('$_titles[%d]["%s"] = "%s"; ', $category_srl, $key, str_replace('"','\\"',htmlspecialchars($val))); +// Create attributes(Use the category_srl_list to check whether to belong to the menu's node. It seems to be tricky but fast fast and powerful;) +$attribute = sprintf( '"mid" => "%s", "module_srl" => "%d","node_srl"=>"%s","category_srl"=>"%s","parent_srl"=>"%s","text"=>$_titles[%d][$lang_type],"selected"=>(in_array(Context::get("category"),array(%s))?1:0),"expand"=>"%s","color"=>"%s", "list"=>array(%s),"document_count"=>"%d","grant"=>%s?true:false', - $node->mid, - $node->module_srl, - $node->category_srl, - $node->category_srl, - $node->parent_srl, - $node->category_srl, - $selected, - $expand, - $node->color, - $child_buff, - $node->document_count, - $group_check_code - ); +$node->mid, +$node->module_srl, +$node->category_srl, +$node->category_srl, +$node->parent_srl, +$node->category_srl, +$selected, +$expand, +$node->color, +$child_buff, +$node->document_count, +$group_check_code +); - // buff 데이터를 생성한다 - $output['buff'] .= sprintf('%s=>array(%s),', $node->category_srl, $attribute); - } - return $output; - } +// Generate buff data +$output['buff'] .= sprintf('%s=>array(%s),', $node->category_srl, $attribute); +} +return $output; +} - /** - * @brief 게시물의 이 게시물을.. 클릭시 나타나는 팝업 메뉴를 추가하는 method - **/ - function addDocumentPopupMenu($url, $str, $icon = '', $target = 'self') { - $document_popup_menu_list = Context::get('document_popup_menu_list'); - if(!is_array($document_popup_menu_list)) $document_popup_menu_list = array(); +/** + * @brief A method to add a pop-up menu which appears when clicking + **/ +function addDocumentPopupMenu($url, $str, $icon = '', $target = 'self') { +$document_popup_menu_list = Context::get('document_popup_menu_list'); +if(!is_array($document_popup_menu_list)) $document_popup_menu_list = array(); - $obj->url = $url; - $obj->str = $str; - $obj->icon = $icon; - $obj->target = $target; - $document_popup_menu_list[] = $obj; +$obj->url = $url; +$obj->str = $str; +$obj->icon = $icon; +$obj->target = $target; +$document_popup_menu_list[] = $obj; - Context::set('document_popup_menu_list', $document_popup_menu_list); - } +Context::set('document_popup_menu_list', $document_popup_menu_list); +} - /** - * @brief 관리자가 글 선택시 세션에 담음 - **/ - function procDocumentAddCart() { - if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); +/** + * @brief Saved in the session when an administrator selects a post + **/ +function procDocumentAddCart() { +if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); +// Get document_srl +$srls = explode(',',Context::get('srls')); +for($i=0;$ilist_count = count($document_srls); +$args->document_srls = implode(',',$document_srls); +$args->order_type = 'asc'; +$output = executeQueryArray('document.getDocuments', $args); +if(!$output->data) return new Object(); - // 게시글 번호 구함 - $srls = explode(',',Context::get('srls')); - for($i=0;$idata as $key => $val) { +$document_srls[$val->module_srl][] = $val->document_srl; +} +if(!$document_srls || !count($document_srls)) return new Object(); +// Check if each of module administrators exists. Top-level administator will have a permission to modify every document of all modules.(Even to modify temporarily saved or trashed documents) +$oModuleModel = &getModel('module'); +$module_srls = array_keys($document_srls); +for($i=0;$igetModuleInfoByModuleSrl($module_srl); +$logged_info = Context::get('logged_info'); +if($logged_info->is_admin != 'Y') { +if(!$module_info) { +unset($document_srls[$module_srl]); +continue; +} +$grant = $oModuleModel->getGrant($module_info, $logged_info); +if(!$grant->manager) { +unset($document_srls[$module_srl]); +continue; +} +} - // 게시글들의 모듈 번호를 구함 - $args->list_count = count($document_srls); - $args->document_srls = implode(',',$document_srls); - $args->order_type = 'asc'; - $output = executeQueryArray('document.getDocuments', $args); - if(!$output->data) return new Object(); +} +if(!count($document_srls)) return new Object(); - unset($document_srls); - foreach($output->data as $key => $val) { - $document_srls[$val->module_srl][] = $val->document_srl; - } - if(!$document_srls || !count($document_srls)) return new Object(); +foreach($document_srls as $module_srl => $documents) { +$cnt = count($documents); +for($i=0;$i<$cnt;$i++) { +$document_srl = (int)trim($documents[$i]); +if(!$document_srls) continue; +if($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]); +else $_SESSION['document_management'][$document_srl] = true; +} +} +} - // 각 문서들의 모듈 관리자 여부 확인, 최고 관리자는 모든 모듈의 문서에 수정 권한 가짐. (임시저장이나 휴지통 문서 포함.) - $oModuleModel = &getModel('module'); - $module_srls = array_keys($document_srls); - for($i=0;$igetModuleInfoByModuleSrl($module_srl); - $logged_info = Context::get('logged_info'); - if($logged_info->is_admin != 'Y') { - if(!$module_info) { - unset($document_srls[$module_srl]); - continue; - } - $grant = $oModuleModel->getGrant($module_info, $logged_info); - if(!$grant->manager) { - unset($document_srls[$module_srl]); - continue; - } - } +/** + * @brief Move/ Delete the document in the seession + **/ +function procDocumentManageCheckedDocument() { +if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); - } - if(!count($document_srls)) return new Object(); +$type = Context::get('type'); +$module_srl = Context::get('target_module'); +$category_srl = Context::get('target_category'); +$message_content = Context::get('message_content'); +if($message_content) $message_content = nl2br($message_content); - foreach($document_srls as $module_srl => $documents) { - $cnt = count($documents); - for($i=0;$i<$cnt;$i++) { - $document_srl = (int)trim($documents[$i]); - if(!$document_srls) continue; - if($_SESSION['document_management'][$document_srl]) unset($_SESSION['document_management'][$document_srl]); - else $_SESSION['document_management'][$document_srl] = true; - } - } - } +$cart = Context::get('cart'); +if($cart) $document_srl_list = explode('|@|', $cart); +else $document_srl_list = array(); - /** - * @brief 세션에 담긴 선택글의 이동/ 삭제 - **/ - function procDocumentManageCheckedDocument() { - if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); +$document_srl_count = count($document_srl_list); +// Send a message +if($message_content) { - $type = Context::get('type'); - $module_srl = Context::get('target_module'); - $category_srl = Context::get('target_category'); - $message_content = Context::get('message_content'); - if($message_content) $message_content = nl2br($message_content); +$oCommunicationController = &getController('communication'); +$oDocumentModel = &getModel('document'); - $cart = Context::get('cart'); - if($cart) $document_srl_list = explode('|@|', $cart); - else $document_srl_list = array(); +$logged_info = Context::get('logged_info'); - $document_srl_count = count($document_srl_list); +$title = cut_str($message_content,10,'...'); +$sender_member_srl = $logged_info->member_srl; - // 쪽지 발송 - if($message_content) { +for($i=0;$i<$document_srl_count;$i++) { +$document_srl = $document_srl_list[$i]; +$oDocument = $oDocumentModel->getDocument($document_srl); +if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue; - $oCommunicationController = &getController('communication'); - $oDocumentModel = &getModel('document'); +if($type=='move') $purl = sprintf("%s", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl()); +else $purl = ""; +$content .= sprintf("
%s

%s
%s
%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false)); - $logged_info = Context::get('logged_info'); +$oCommunicationController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false); +} +} +// Set a spam-filer not to be filtered to spams +$oSpamController = &getController('spamfilter'); +$oSpamController->setAvoidLog(); +$oDocumentAdminController = &getAdminController('document'); - $title = cut_str($message_content,10,'...'); - $sender_member_srl = $logged_info->member_srl; +if($type == 'move') { +if(!$module_srl) return new Object(-1, 'fail_to_move'); - for($i=0;$i<$document_srl_count;$i++) { - $document_srl = $document_srl_list[$i]; - $oDocument = $oDocumentModel->getDocument($document_srl); - if(!$oDocument->get('member_srl') || $oDocument->get('member_srl')==$sender_member_srl) continue; +$output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $module_srl, $category_srl); +if(!$output->toBool()) return new Object(-1, 'fail_to_move'); - if($type=='move') $purl = sprintf("%s", $oDocument->getPermanentUrl(), $oDocument->getPermanentUrl()); - else $purl = ""; - $content .= sprintf("
%s

%s
%s
%s",$message_content, $purl, $oDocument->getTitleText(), $oDocument->getContent(false, false, false)); +$msg_code = 'success_moved'; - $oCommunicationController->sendMessage($sender_member_srl, $oDocument->get('member_srl'), $title, $content, false); - } - } +} elseif($type == 'copy') { +if(!$module_srl) return new Object(-1, 'fail_to_move'); - // 스팸 처리가 되지 않도록 스팸필터 설정 - $oSpamController = &getController('spamfilter'); - $oSpamController->setAvoidLog(); - $oDocumentAdminController = &getAdminController('document'); +$output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl); +if(!$output->toBool()) return new Object(-1, 'fail_to_move'); - if($type == 'move') { - if(!$module_srl) return new Object(-1, 'fail_to_move'); +$msg_code = 'success_registed'; - $output = $oDocumentAdminController->moveDocumentModule($document_srl_list, $module_srl, $category_srl); - if(!$output->toBool()) return new Object(-1, 'fail_to_move'); +} elseif($type =='delete') { +$oDB = &DB::getInstance(); +$oDB->begin(); +for($i=0;$i<$document_srl_count;$i++) { +$document_srl = $document_srl_list[$i]; +$output = $this->deleteDocument($document_srl, true); +if(!$output->toBool()) return new Object(-1, 'fail_to_delete'); +} +$oDB->commit(); +$msg_code = 'success_deleted'; +} elseif($type == 'trash') { +$args->description = $message_content; - $msg_code = 'success_moved'; +$oDB = &DB::getInstance(); +$oDB->begin(); +for($i=0;$i<$document_srl_count;$i++) { +$args->document_srl = $document_srl_list[$i]; +$output = $this->moveDocumentToTrash($args); +if(!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash'); +} +$oDB->commit(); +$msg_code = 'success_trashed'; +} - } elseif($type == 'copy') { - if(!$module_srl) return new Object(-1, 'fail_to_move'); +$_SESSION['document_management'] = array(); - $output = $oDocumentAdminController->copyDocumentModule($document_srl_list, $module_srl, $category_srl); - if(!$output->toBool()) return new Object(-1, 'fail_to_move'); +$this->setMessage($msg_code); +} - $msg_code = 'success_registed'; +function procDocumentInsertModuleConfig() +{ +$module_srl = Context::get('target_module_srl'); +if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); +else $module_srl = array($module_srl); - } elseif($type =='delete') { - $oDB = &DB::getInstance(); - $oDB->begin(); - for($i=0;$i<$document_srl_count;$i++) { - $document_srl = $document_srl_list[$i]; - $output = $this->deleteDocument($document_srl, true); - if(!$output->toBool()) return new Object(-1, 'fail_to_delete'); - } - $oDB->commit(); - $msg_code = 'success_deleted'; - } elseif($type == 'trash') { - $args->description = $message_content; +$document_config = null; +$document_config->use_history = Context::get('use_history'); +if(!$document_config->use_history) $document_config->use_history = 'N'; - $oDB = &DB::getInstance(); - $oDB->begin(); - for($i=0;$i<$document_srl_count;$i++) { - $args->document_srl = $document_srl_list[$i]; - $output = $this->moveDocumentToTrash($args); - if(!$output || !$output->toBool()) return new Object(-1, 'fail_to_trash'); - } - $oDB->commit(); - $msg_code = 'success_trashed'; - } +$document_config->use_vote_up = Context::get('use_vote_up'); +if(!$document_config->use_vote_up) $document_config->use_vote_up = 'Y'; - $_SESSION['document_management'] = array(); +$document_config->use_vote_down = Context::get('use_vote_down'); +if(!$document_config->use_vote_down) $document_config->use_vote_down = 'Y'; - $this->setMessage($msg_code); - } - - function procDocumentInsertModuleConfig() - { - $module_srl = Context::get('target_module_srl'); - if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); - else $module_srl = array($module_srl); - - $document_config = null; - $document_config->use_history = Context::get('use_history'); - if(!$document_config->use_history) $document_config->use_history = 'N'; - - $document_config->use_vote_up = Context::get('use_vote_up'); - if(!$document_config->use_vote_up) $document_config->use_vote_up = 'Y'; - - $document_config->use_vote_down = Context::get('use_vote_down'); - if(!$document_config->use_vote_down) $document_config->use_vote_down = 'Y'; - - $oModuleController = &getController('module'); - for($i=0;$iinsertModulePartConfig('document',$srl,$document_config); - } - $this->setError(-1); - $this->setMessage('success_updated'); - } +$oModuleController = &getController('module'); +for($i=0;$iinsertModulePartConfig('document',$srl,$document_config); +} +$this->setError(-1); +$this->setMessage('success_updated'); +} } ?> \ No newline at end of file diff --git a/modules/document/document.item.php b/modules/document/document.item.php index 559adeaa5..bd4d96c11 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -2,7 +2,7 @@ /** * @class documentItem * @author NHN (developers@xpressengine.com) - * @brief document 객체 + * @brief document object **/ class documentItem extends Object { @@ -40,8 +40,7 @@ $this->document_srl = $attribute->document_srl; $this->lang_code = $attribute->lang_code; $this->adds($attribute); - - // 태그 정리 + // Tags if($this->get('tags')) { $tags = explode(',',$this->get('tags')); $tag_count = count($tags); @@ -95,15 +94,14 @@ function allowTrackback() { static $allow_trackback_status = null; if(is_null($allow_trackback_status)) { - // 엮인글 관리 모듈의 사용금지 설정 상태이면 무조건 금지, 그렇지 않으면 개별 체크 + // If the trackback module is configured to be disabled, do not allow. Otherwise, check the setting of each module. $oModuleModel = &getModel('module'); $trackback_config = $oModuleModel->getModuleConfig('trackback'); if(!isset($trackback_config->enable_trackback)) $trackback_config->enable_trackback = 'Y'; if($trackback_config->enable_trackback != 'Y') $allow_trackback_status = false; else { $module_srl = $this->get('module_srl'); - - // 모듈별 설정을 체크 + // Check settings of each module $module_config = $oModuleModel->getModulePartConfig('trackback', $module_srl); if($module_config->enable_trackback == 'N') $allow_trackback_status = false; else if($this->get('allow_trackback')=='Y' || !$this->isExists()) $allow_trackback_status = true; @@ -153,25 +151,20 @@ function notify($type, $content) { if(!$this->document_srl) return; - - // useNotify가 아니면 return + // return if it is not useNotify if(!$this->useNotify()) return; - - // 글쓴이가 로그인 유저가 아니면 패스~ + // Pass if an author is not a logged-in user if(!$this->get('member_srl')) return; - - // 현재 로그인한 사용자와 글을 쓴 사용자를 비교하여 동일하면 return + // Return if the currently logged-in user is an author $logged_info = Context::get('logged_info'); if($logged_info->member_srl == $this->get('member_srl')) return; - - // 변수 정리 + // List variables if($type) $title = "[".$type."] "; $title .= cut_str(strip_tags($content), 10, '...'); $content = sprintf('%s

from : %s',$content, getFullUrl('','document_srl',$this->document_srl), getFullUrl('','document_srl',$this->document_srl)); $receiver_srl = $this->get('member_srl'); $sender_member_srl = $logged_info->member_srl; - - // 쪽지 발송 + // Send a message $oCommunicationController = &getController('communication'); $oCommunicationController->sendMessage($sender_member_srl, $receiver_srl, $title, $content, false); } @@ -263,13 +256,12 @@ $content = $this->get('content'); if(!$stripEmbedTagException) stripEmbedTagForAdmin($content, $this->get('member_srl')); - // rewrite모듈을 사용하면 링크 재정의 + // Define a link if using a rewrite module $oContext = &Context::getInstance(); if($oContext->allow_rewrite) { $content = preg_replace('/%s', @@ -277,8 +269,7 @@ $this->document_srl, Context::getLang('cmd_document_do') ); } - - // 컨텐츠에 대한 조작이 가능한 추가 정보를 설정하였을 경우 + // If additional content information is set if($add_content_info) { $content = sprintf( '
%s
', @@ -288,12 +279,11 @@ $this->document_srl, $this->get('member_srl'), $this->document_srl, $this->get('member_srl') ); - // 컨텐츠에 대한 조작이 필요하지 않더라도 xe_content라는 클래스명을 꼭 부여 + // Add xe_content class although accessing content is not required } else { if($add_xe_content_class) $content = sprintf('
%s
', $content); } - - // resource_realpath가 true이면 내용내 이미지의 경로를 절대 경로로 변경 + // Change the image path to a valid absolute path if resource_realpath is true if($resource_realpath) { $content = preg_replace_callback('/]+)>/i',array($this,'replaceResourceRealPath'), $content); } @@ -302,7 +292,7 @@ } /** - * 에디터 코드가 변환된 내용 반환 + * Return transformed content by Editor codes **/ function getTransContent($add_popup_menu = true, $add_content_info = true, $resource_realpath = false, $add_xe_content_class = true) { $oEditorController = &getController('editor'); @@ -316,25 +306,25 @@ function getSummary($str_size = 50, $tail = '...') { $content = $this->getContent(false,false); - // 줄바꿈이 있을 때, 공백문자 삽입 + // For a newlink, inert a whitespace $content = preg_replace('!([\s]*)+!is', ' ', $content); - //

, , 등의 태그를 공백 문자로 치환 + // Replace tags such as

, , and others to a whitespace $content = str_replace(array('

', '', ''), ' ', $content); - // 태그 제거 + // Remove Tags $content = preg_replace('!<([^>]*?)>!is','', $content); - // < , > , " 를 치환 + // Replace < , >, " $content = str_replace(array('<','>','"',' '), array('<','>','"',' '), $content); - // 연속된 공백문자 삭제 + // Delete a series of whitespaces $content = preg_replace('/ ( +)/is', ' ', $content); - // 문자열을 자름 + // Truncate string $content = trim(cut_str($content, $str_size, $tail)); - // >, <, "를 다시 복구 + // Replace back < , <, " $content = str_replace(array('<','>','"'),array('<','>','"'), $content); return $content; @@ -383,8 +373,7 @@ function getTrackbackUrl() { if(!$this->document_srl) return; - - // 스팸을 막기 위한 key 생성 + // Generate a key to prevent spams $oTrackbackModel = &getModel('trackback'); return $oTrackbackModel->getTrackbackUrl($this->document_srl); } @@ -431,7 +420,7 @@ if($extra_vars) { - // eid 명칭으로 확장변수 처리 + // Handle extra variable(eid) foreach($extra_vars as $idx => $key) { $extra_eid[$key->eid] = $key; } @@ -441,7 +430,7 @@ function getExtraEidValueHTML($eid) { $extra_vars = $this->getExtraVars(); - // eid 명칭으로 확장변수 처리 + // Handle extra variable(eid) foreach($extra_vars as $idx => $key) { $extra_eid[$key->eid] = $key; } @@ -461,33 +450,27 @@ function getComments() { if(!$this->allowComment() || !$this->getCommentCount()) return; if(!$this->isGranted() && $this->isSecret()) return; - - // cpage는 댓글페이지의 번호 + // cpage is a number of comment pages $cpage = Context::get('cpage'); - - // 댓글 목록을 구해옴 + // Get a list of comments $oCommentModel = &getModel('comment'); $output = $oCommentModel->getCommentList($this->document_srl, $cpage, $is_admin); if(!$output->toBool() || !count($output->data)) return; - - // 구해온 목록을 commentItem 객체로 만듬 - // 계층구조에 따라 부모글에 관리권한이 있으면 자식글에는 보기 권한을 줌 + // Create commentItem object from a comment list + // If admin priviledge is granted on parent posts, you can read its child posts. $accessible = array(); foreach($output->data as $key => $val) { $oCommentItem = new commentItem(); $oCommentItem->setAttribute($val); - - // 권한이 있는 글에 대해 임시로 권한이 있음을 설정 + // If permission is granted to the post, you can access it temporarily if($oCommentItem->isGranted()) $accessible[$val->comment_srl] = true; - - // 현재 댓글이 비밀글이고 부모글이 있는 답글이고 부모글에 대해 관리 권한이 있으면 보기 가능하도록 수정 + // If the comment is set to private and it belongs child post, it is allowable to read the comment for who has a admin privilege on its parent post if($val->parent_srl>0 && $val->is_secret == 'Y' && !$oCommentItem->isAccessible() && $accessible[$val->parent_srl]===true) { $oCommentItem->setAccessible(); } $comment_list[$val->comment_srl] = $oCommentItem; } - - // 스킨에서 출력하기 위한 변수 설정 + // Variable setting to be displayed on the skin Context::set('cpage', $output->page_navigation->cur_page); if($output->total_page>1) $this->comment_page_navigation = $output->page_navigation; @@ -514,16 +497,13 @@ } function getThumbnail($width = 80, $height = 0, $thumbnail_type = '') { - // 존재하지 않는 문서일 경우 return false + // Return false if the document doesn't exist if(!$this->document_srl) return; - - // 높이 지정이 별도로 없으면 정사각형으로 생성 + // If not specify its height, create a square if(!$height) $height = $width; - - // 첨부파일이 없거나 내용중 이미지가 없으면 return false; + // Return false if neither attachement nor image files in the document if(!$this->get('uploaded_count') && !preg_match("!get('content'))) return; - - // 문서 모듈의 기본 설정에서 Thumbnail의 생성 방법을 구함 + // Get thumbnai_type information from document module's configuration if(!in_array($thumbnail_type, array('crop','ratio'))) { $config = $GLOBALS['__document_config__']; if(!$config) { @@ -533,23 +513,19 @@ } $thumbnail_type = $config->thumbnail_type; } - - // 섬네일 정보 정의 + // Define thumbnail information $thumbnail_path = sprintf('files/cache/thumbnails/%s',getNumberingPath($this->document_srl, 3)); $thumbnail_file = sprintf('%s%dx%d.%s.jpg', $thumbnail_path, $width, $height, $thumbnail_type); $thumbnail_url = Context::getRequestUri().$thumbnail_file; - - // 섬네일 파일이 있을 경우 파일의 크기가 0 이면 return false 아니면 경로 return + // Return false if thumbnail file exists and its size is 0. Otherwise, return its path if(file_exists($thumbnail_file)) { if(filesize($thumbnail_file)<1) return false; else return $thumbnail_url; } - - // 대상 파일 + // Target File $source_file = null; $is_tmp_file = false; - - // 첨부된 파일중 이미지 파일이 있으면 찾음 + // Find an iamge file among attached files if exists if($this->get('uploaded_count')) { $oFileModel = &getModel('file'); $file_list = $oFileModel->getFiles($this->document_srl); @@ -564,8 +540,7 @@ } } } - - // 첨부된 파일이 없으면 내용중 이미지 파일을 구함 + // If not exists, file an image file from the content if(!$source_file) { $content = $this->get('content'); $target_src = null; @@ -597,42 +572,39 @@ $output = FileHandler::createImageFile($source_file, $thumbnail_file, $width, $height, 'jpg', $thumbnail_type); } if($is_tmp_file) FileHandler::removeFile($source_file); - - // 섬네일 생성 성공시 경로 return + // Return its path if a thumbnail is successfully genetated if($output) return $thumbnail_url; - - // 차후 다시 섬네일 생성을 시도하지 않기 위해 빈 파일을 생성 + // Create an empty file not to re-generate the thumbnail else FileHandler::writeFile($thumbnail_file, '','w'); return; } /** - * @brief 새글, 최신 업데이트글, 비밀글, 이미지/동영상/첨부파일등의 아이콘 출력용 함수 - * $time_interval 에 지정된 시간(초)로 새글/최신 업데이트글의 판별 + * @brief Functions to display icons for new post, latest update, secret(private) post, image/video/attachment + * Determine new post and latest update by $time_interval **/ function getExtraImages($time_interval = 43200) { if(!$this->document_srl) return; - - // 아이콘 목록을 담을 변수 미리 설정 + // variables for icon list $buffs = array(); $check_files = false; - // 비밀글 체크 + // Check if secret post is if($this->isSecret()) $buffs[] = "secret"; - // 최신 시간 설정 + // Set the latest time $time_check = date("YmdHis", time()-$time_interval); - // 새글 체크 + // Check new post if($this->get('regdate')>$time_check) $buffs[] = "new"; else if($this->get('last_update')>$time_check) $buffs[] = "update"; /* $content = $this->get('content'); - // 사진 이미지 체크 + // Check image files preg_match_all('!]*?)>!is', $content, $matches); $cnt = count($matches[0]); for($i=0;$i<$cnt;$i++) { @@ -642,26 +614,25 @@ break; } - // 동영상 체크 + // Check video files if(preg_match('!]*?)>!is', $content) || preg_match('/editor_component=("|\')*multimedia_link/i', $content) ) { $buffs[] = "movie"; $check_files = true; } */ - // 첨부파일 체크 + // Check the attachment if($this->hasUploadedFiles()) $buffs[] = "file"; return $buffs; } /** - * @brief getExtraImages로 구한 값을 이미지 태그를 씌워서 리턴 + * @brief Return the value obtained from getExtraImages with image tag **/ function printExtraImages($time_check = 43200) { if(!$this->document_srl) return; - - // 아이콘 디렉토리 구함 + // Get the icon directory $path = sprintf('%s%s',getUrl(), 'modules/document/tpl/icons/'); $buffs = $this->getExtraImages($time_check); @@ -693,7 +664,7 @@ } /** - * @brief 에디터 html을 구해서 return + * @brief Return Editor html **/ function getEditor() { $module_srl = $this->get('module_srl'); @@ -704,18 +675,18 @@ } /** - * @brief 댓글을 달 수 있는지에 대한 권한 체크 - * 게시글의 댓글 권한과 또 다른 부분 + * @brief Check whether to have a permission to write comment + * Authority to write a comment and to write a document is separated **/ function isEnableComment() { - // 권한이 없고 비밀글 or 댓글금지 or 댓글허용금지이면 return false + // Return false if not authorized, if a secret document, if the document is set not to allow any comment if(!$this->isGranted() && ( $this->isSecret() || $this->isLocked() || !$this->allowComment() ) ) return false; return true; } /** - * @brief 댓글 에디터 html을 구해서 return + * @brief Return comment editor's html **/ function getCommentEditor() { if(!$this->isEnableComment()) return; @@ -725,7 +696,7 @@ } /** - * @brief 작성자의 프로필 이미지를 return + * @brief Return author's profile image **/ function getProfileImage() { if(!$this->isExists() || !$this->get('member_srl')) return; @@ -737,17 +708,15 @@ } /** - * @brief 작성자의 서명을 return + * @brief Return author's signiture **/ function getSignature() { - // 존재하지 않는 글이면 패스~ + // Pass if a document doesn't exist if(!$this->isExists() || !$this->get('member_srl')) return; - - // 서명정보를 구함 + // Get signature information $oMemberModel = &getModel('member'); $signature = $oMemberModel->getSignature($this->get('member_srl')); - - // 회원모듈에서 서명 최고 높이 지정되었는지 검사 + // Check if a maximum height of signiture is set in the member module if(!isset($GLOBALS['__member_signature_max_height'])) { $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); @@ -762,7 +731,7 @@ } /** - * @brief 내용내의 이미지 경로를 절대 경로로 변경 + * @brief Change an image path in the content to absolute path **/ function replaceResourceRealPath($matches) { return preg_replace('/src=(["\']?)files/i','src=$1'.Context::getRequestUri().'files', $matches[0]); diff --git a/modules/document/document.model.php b/modules/document/document.model.php index a43c7c405..a03c312da 100644 --- a/modules/document/document.model.php +++ b/modules/document/document.model.php @@ -2,45 +2,41 @@ /** * @class documentModel * @author NHN (developers@xpressengine.com) - * @brief document 모듈의 model 클래스 + * @brief model class of the module document **/ class documentModel extends document { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief document에 대한 권한을 세션값으로 체크 + * @brief document checked the permissions on the session values **/ function isGranted($document_srl) { return $_SESSION['own_document'][$document_srl]; } /** - * @brief 확장변수를 매 문서마다 처리하지 않기 위해 매크로성으로 일괄 select 및 적용 + * @brief extra variables for each article will not be processed bulk select and apply the macro city **/ function setToAllDocumentExtraVars() { static $checked_documents = array(); - - // XE에서 모든 문서 객체는 XE_DOCUMENT_LIST라는 전역 변수에 세팅을 함 + // XE XE_DOCUMENT_LIST all documents that the object referred to the global variable settings if(!count($GLOBALS['XE_DOCUMENT_LIST'])) return; - - // 모든 호출된 문서 객체를 찾아서 확장변수가 설정되었는지를 확인 + // Find all called the document object variable has been set extension $document_srls = array(); foreach($GLOBALS['XE_DOCUMENT_LIST'] as $key => $val) { if(!$val->document_srl || $checked_documents[$val->document_srl]) continue; $checked_documents[$val->document_srl] = true; $document_srls[] = $val->document_srl; } - - // 검출된 문서 번호가 없으면 return + // If the document number, return detected if(!count($document_srls)) return; - - // 확장변수 미지정된 문서에 대해서 일단 현재 접속자의 언어코드로 확장변수를 검색 + // Expand variables mijijeongdoen article about a current visitor to the extension of the language code, the search variable $obj->document_srl = implode(',',$document_srls); $output = executeQueryArray('document.getDocumentExtraVars', $obj); if($output->toBool() && $output->data) { @@ -62,8 +58,7 @@ $extra_keys = $this->getExtraKeys($module_srl); $vars = $extra_vars[$document_srl]; $document_lang_code = $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->get('lang_code'); - - // 확장변수 처리 + // Expand the variable processing if(count($extra_keys)) { foreach($extra_keys as $idx => $key) { $val = $vars[$idx]; @@ -78,11 +73,9 @@ unset($evars); $evars = new ExtraVar($module_srl); $evars->setExtraVarKeys($extra_keys); - - // 제목 처리 + // Title Processing if($vars[-1][$user_lang_code]) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->add('title',$vars[-1][$user_lang_code]); - - // 내용 처리 + // Information processing if($vars[-2][$user_lang_code]) $GLOBALS['XE_DOCUMENT_LIST'][$document_srl]->add('content',$vars[-2][$user_lang_code]); if($vars[-1][$user_lang_code] || $vars[-2][$user_lang_code]){ @@ -94,7 +87,7 @@ } /** - * @brief 문서 가져오기 + * @brief Import Document **/ function getDocument($document_srl=0, $is_admin = false, $load_extra_vars=true) { if(!$document_srl) return new documentItem(); @@ -110,7 +103,7 @@ } /** - * @brief 여러개의 문서들을 가져옴 (페이징 아님) + * @brief Bringing multiple documents (or paging) **/ function getDocuments($document_srls, $is_admin = false, $load_extra_vars=true) { if(is_array($document_srls)) { @@ -157,29 +150,25 @@ } /** - * @brief module_srl값을 가지는 문서의 목록을 가져옴 + * @brief module_srl value, bringing the list of documents **/ function getDocumentList($obj, $except_notice = false, $load_extra_vars=true) { - // 정렬 대상과 순서 체크 + // Check the target and sequence alignment if(!in_array($obj->sort_index, array('list_order','regdate','last_update','update_order','readed_count','voted_count','comment_count','trackback_count','uploaded_count','title','category_srl'))) $obj->sort_index = 'list_order'; if(!in_array($obj->order_type, array('desc','asc'))) $obj->order_type = 'asc'; - - // module_srl 대신 mid가 넘어왔을 경우는 직접 module_srl을 구해줌 + // If that came across mid module_srl instead of a direct module_srl guhaejum if($obj->mid) { $oModuleModel = &getModel('module'); $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); unset($obj->mid); } - - // 넘어온 module_srl은 array일 수도 있기에 array인지를 체크 + // Module_srl passed the array may be a check whether the array if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); else $args->module_srl = $obj->module_srl; - - // 제외 module_srl에 대한 검사 + // Except for the test module_srl if(is_array($obj->exclude_module_srl)) $args->exclude_module_srl = implode(',', $obj->exclude_module_srl); else $args->exclude_module_srl = $obj->exclude_module_srl; - - // 변수 체크 + // Variable check $args->category_srl = $obj->category_srl?$obj->category_srl:null; $args->sort_index = $obj->sort_index; $args->order_type = $obj->order_type; @@ -189,39 +178,35 @@ $args->start_date = $obj->start_date?$obj->start_date:null; $args->end_date = $obj->end_date?$obj->end_date:null; $args->member_srl = $obj->member_srl; - - // 카테고리가 선택되어 있으면 하부 카테고리까지 모두 조건에 추가 + // Category is selected, further sub-categories until all conditions if($args->category_srl) { $category_list = $this->getCategoryList($args->module_srl); $category_info = $category_list[$args->category_srl]; $category_info->childs[] = $args->category_srl; $args->category_srl = implode(',',$category_info->childs); } - - // 기본으로 사용할 query id 지정 (몇가지 검색 옵션에 따라 query id가 변경됨) + // Used to specify the default query id (based on several search options to query id modified) $query_id = 'document.getDocumentList'; - - // 내용검색일 경우 document division을 지정하여 검색하기 위한 처리 + // If the search by specifying the document division naeyonggeomsaekil processed for $use_division = false; - // 검색 옵션 정리 + // Search options $searchOpt->search_target = $obj->search_target; $searchOpt->search_keyword = $obj->search_keyword; $this->_setSearchOption($searchOpt, &$args, &$query_id, &$use_division); /** - * division은 list_order의 asc 정렬일때만 사용할 수 있음 + * list_order asc sort of division that can be used only when **/ if($args->sort_index != 'list_order' || $args->order_type != 'asc') $use_division = false; /** - * 만약 use_division이 true일 경우 document division을 이용하도록 변경 + * If it is true, use_division changed to use the document division **/ if($use_division) { - // 시작 division + // Division begins $division = (int)Context::get('division'); - - // division값이 없다면 제일 상위 + // If you do not value the best division top if(!$division) { $division_args->module_srl = $args->module_srl; $division_args->exclude_module_srl = $args->exclude_module_srl; @@ -235,11 +220,9 @@ } $division_args = null; } - - // 마지막 division + // The last division $last_division = (int)Context::get('last_division'); - - // 지정된 division에서부터 5000개 후의 division값을 구함 + // Division after division from the 5000 value of the specified Wanted if(!$last_division) { $last_division_args->module_srl = $args->module_srl; $last_division_args->exclude_module_srl = $args->exclude_module_srl; @@ -255,8 +238,7 @@ } } - - // last_division 이후로 글이 있는지 확인 + // Make sure that after last_division article if($last_division) { $last_division_args = null; $last_division_args->module_srl = $args->module_srl; @@ -271,9 +253,8 @@ Context::set('division', $division); Context::set('last_division', $last_division); } - - // document.getDocumentList 쿼리 실행 - // 만약 query_id가 getDocumentListWithinComment 또는 getDocumentListWithinTag일 경우 group by 절 사용 때문에 쿼리를 한번더 수행 + // document.getDocumentList query execution + // Query_id if you have a group by clause getDocumentListWithinTag getDocumentListWithinComment or used again to perform the query because if(in_array($query_id, array('document.getDocumentListWithinComment', 'document.getDocumentListWithinTag'))) { $group_args = clone($args); $group_args->sort_index = 'documents.'.$args->sort_index; @@ -301,8 +282,7 @@ } else { $output = executeQueryArray($query_id, $args); } - - // 결과가 없거나 오류 발생시 그냥 return + // Return if no result or an error occurs if(!$output->toBool()||!count($output->data)) return $output; $idx = 0; @@ -349,7 +329,7 @@ } /** - * @brief module_srl값을 가지는 문서의 공지사항만 가져옴 + * @brief module_srl value, bringing the document's gongjisa Port **/ function getNoticeList($obj) { $args->module_srl = $obj->module_srl; @@ -378,8 +358,8 @@ } /** - * @brief document의 확장 변수 키값을 가져오는 함수 - * $form_include : 글 작성시에 필요한 확장변수의 input form 추가 여부 + * @brief function to retrieve the key values of the extended variable document + * $Form_include: writing articles whether to add the necessary extensions of the variable input form **/ function getExtraKeys($module_srl) { if(is_null($GLOBALS['XE_EXTRA_KEYS'][$module_srl])) { @@ -398,11 +378,11 @@ } /** - * @brief 특정 document의 확장 변수 값을 가져오는 함수 + * @brief A particular document to get the value of the extra variable function **/ function getExtraVars($module_srl, $document_srl) { if(!isset($GLOBALS['XE_EXTRA_VARS'][$document_srl])) { - // 확장변수 값을 추출하여 세팅 + // Extended to extract the values of variables set $oDocument = $this->getDocument($document_srl, false); $GLOBALS['XE_DOCUMENT_LIST'][$document_srl] = $oDocument; $this->setToAllDocumentExtraVars(); @@ -412,27 +392,23 @@ } /** - * @brief 선택된 게시물의 팝업메뉴 표시 + * @brief Show pop-up menu of the selected posts * - * 인쇄, 스크랩, 추천, 비추천, 신고 기능 추가 + * Printing, scrap, recommendations and negative, reported the Add Features **/ function getDocumentMenu() { - - // 요청된 게시물 번호와 현재 로그인 정보 구함 + // Post number and the current login information requested Wanted $document_srl = Context::get('target_srl'); $mid = Context::get('cur_mid'); $logged_info = Context::get('logged_info'); $act = Context::get('cur_act'); - - // menu_list 에 "표시할글,target,url" 을 배열로 넣는다 + // to menu_list "pyosihalgeul, target, url" put into an array $menu_list = array(); - - // trigger 호출 + // call trigger ModuleHandler::triggerCall('document.getDocumentMenu', 'before', $menu_list); $oDocumentController = &getController('document'); - - // 회원이어야만 가능한 기능 + // Members must be a possible feature if($logged_info->member_srl) { $oDocumentModel = &getModel('document'); @@ -444,40 +420,37 @@ $oModuleModel = &getModel('module'); $document_config = $oModuleModel->getModulePartConfig('document',$module_srl); if($document_config->use_vote_up!='N' && $member_srl!=$logged_info->member_srl){ - // 추천 버튼 추가 + // Add a Referral Button $url = sprintf("doCallModuleAction('document','procDocumentVoteUp','%s')", $document_srl); $oDocumentController->addDocumentPopupMenu($url,'cmd_vote','./modules/document/tpl/icons/vote_up.gif','javascript'); } if($document_config->use_vote_down!='N' && $member_srl!=$logged_info->member_srl){ - // 비추천 버튼 추가 + // Add button to negative $url= sprintf("doCallModuleAction('document','procDocumentVoteDown','%s')", $document_srl); $oDocumentController->addDocumentPopupMenu($url,'cmd_vote_down','./modules/document/tpl/icons/vote_down.gif','javascript'); } - // 신고 기능 추가 + // Adding Report $url = sprintf("doCallModuleAction('document','procDocumentDeclare','%s')", $document_srl); $oDocumentController->addDocumentPopupMenu($url,'cmd_declare','./modules/document/tpl/icons/declare.gif','javascript'); - // 스크랩 버튼 추가 + // Add Bookmark button $url = sprintf("doCallModuleAction('member','procMemberScrapDocument','%s')", $document_srl); $oDocumentController->addDocumentPopupMenu($url,'cmd_scrap','./modules/document/tpl/icons/scrap.gif','javascript'); } - - // 인쇄 버튼 추가 + // Add print button $url = getUrl('','module','document','act','dispDocumentPrint','document_srl',$document_srl); $oDocumentController->addDocumentPopupMenu($url,'cmd_print','./modules/document/tpl/icons/print.gif','printDocument'); - - // trigger 호출 (after) + // Call a trigger (after) ModuleHandler::triggerCall('document.getDocumentMenu', 'after', $menu_list); - - // 관리자일 경우 ip로 글 찾기 + // If you are managing to find posts by ip if($logged_info->is_admin == 'Y') { $oDocumentModel = &getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); if($oDocument->isExists()) { - // ip주소에 해당하는 글 찾기 + // Find a post equivalent to ip address $url = getUrl('','module','admin','act','dispDocumentAdminList','search_target','ipaddress','search_keyword',$oDocument->get('ipaddress')); $icon_path = './modules/member/tpl/images/icon_management.gif'; $oDocumentController->addDocumentPopupMenu($url,'cmd_search_by_ipaddress',$icon_path,'TraceByIpaddress'); @@ -486,23 +459,21 @@ $oDocumentController->addDocumentPopupMenu($url,'cmd_add_ip_to_spamfilter','./modules/document/tpl/icons/declare.gif','javascript'); } } - - // 팝업메뉴의 언어 변경 + // Changing the language of pop-up menu $menus = Context::get('document_popup_menu_list'); $menus_count = count($menus); for($i=0;$i<$menus_count;$i++) { $menus[$i]->str = Context::getLang($menus[$i]->str); } - - // 최종적으로 정리된 팝업메뉴 목록을 구함 + // Wanted to finally clean pop-up menu list $this->add('menus', $menus); } /** - * @brief module_srl에 해당하는 문서의 전체 갯수를 가져옴 + * @brief module_srl the total number of documents that are bringing **/ function getDocumentCount($module_srl, $search_obj = NULL) { - // 검색 옵션 추가 + // Additional search options $args->module_srl = $module_srl; $args->s_title = $search_obj->s_title; $args->s_content = $search_obj->s_content; @@ -513,16 +484,15 @@ $args->category_srl = $search_obj->category_srl; $output = executeQuery('document.getDocumentCount', $args); - - // 전체 갯수를 return + // Return total number of $total_count = $output->data->count; return (int)$total_count; } /** - * @brief 해당 document의 page 가져오기, module_srl이 없으면 전체에서.. + * @brief Import page of the document, module_srl Without throughout .. **/ function getDocumentPage($oDocument, $opt) { - // 정렬 형식에 따라서 query args 변경 + // Sort type changes depending on the query args switch($opt->sort_index) { case 'update_order' : if($opt->order_type == 'desc') $args->rev_update_order = $oDocument->get('update_order'); @@ -552,7 +522,7 @@ $searchOpt->search_keyword = $opt->search_keyword; $this->_setSearchOption($searchOpt, &$args, &$query_id, &$use_division); - // 전체 갯수를 구한후 해당 글의 페이지를 검색 + // Guhanhu total number of the article search page $output = executeQuery('document.getDocumentPage', $args); $count = $output->data->count; $page = (int)(($count-1)/$opt->list_count)+1; @@ -560,7 +530,7 @@ } /** - * @brief 카테고리의 정보를 가져옴 + * @brief Imported Category of information **/ function getCategory($category_srl) { $args->category_srl = $category_srl; @@ -581,7 +551,7 @@ } /** - * @brief 특정 카테고리에 child가 있는지 체크 + * @brief Check whether the child has a specific category **/ function getCategoryChlidCount($category_srl) { $args->category_srl = $category_srl; @@ -591,29 +561,27 @@ } /** - * @brief 특정 모듈의 카테고리 목록을 가져옴 - * 속도나 여러가지 상황을 고려해서 카테고리 목록은 php로 생성된 script를 include하여 사용하는 것을 원칙으로 함 + * @brief Bringing the Categories list the specific module + * Speed and variety of categories, considering the situation created by the php script to include a list of the must, in principle, to use **/ function getCategoryList($module_srl) { - // 대상 모듈의 카테고리 파일을 불러옴 + // Category of the target module file swollen $filename = sprintf("./files/cache/document_category/%s.php", $module_srl); - - // 대상 파일이 없으면 카테고리 캐시 파일을 재생성 + // If the target file to the cache file regeneration category if(!file_exists($filename)) { $oDocumentController = &getController('document'); if(!$oDocumentController->makeCategoryFile($module_srl)) return array(); } @include($filename); - - // 카테고리의 정리 + // Cleanup of category $document_category = array(); $this->_arrangeCategory($document_category, $menu->list, 0); return $document_category; } /** - * @brief 카테고리를 1차 배열 형식으로 변경하는 내부 method + * @brief Category within a primary method to change the array type **/ function _arrangeCategory(&$document_category, $list, $depth) { if(!count($list)) return; @@ -640,8 +608,7 @@ $obj->selected = $selected; $list_order[$idx++] = $obj->category_srl; - - // 부모 카테고리가 있으면 자식노드들의 데이터를 적용 + // If you have a parent category of child nodes apply data if($obj->parent_srl) { $parent_srl = $obj->parent_srl; @@ -668,7 +635,7 @@ } /** - * @brief 카테고리에 속한 문서의 갯수를 구함 + * @brief Wanted number of documents belonging to category **/ function getCategoryDocumentCount($module_srl, $category_srl) { $args->module_srl = $module_srl; @@ -678,7 +645,7 @@ } /** - * @brief 문서 category정보의 xml 캐시 파일을 return + * @brief Xml cache file of the document category return information **/ function getCategoryXmlFile($module_srl) { $xml_file = sprintf('files/cache/document_category/%s.xml.php',$module_srl); @@ -690,7 +657,7 @@ } /** - * @brief 문서 category정보의 php 캐시 파일을 return + * @brief Php cache files in the document category return information **/ function getCategoryPhpFile($module_srl) { $php_file = sprintf('files/cache/document_category/%s.php',$module_srl); @@ -702,7 +669,7 @@ } /** - * @brief 월별 글 보관현황을 가져옴 + * @brief Imported post monthly archive status **/ function getMonthlyArchivedList($obj) { if($obj->mid) { @@ -710,8 +677,7 @@ $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); unset($obj->mid); } - - // 넘어온 module_srl은 array일 수도 있기에 array인지를 체크 + // Module_srl passed the array may be a check whether the array if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); else $args->module_srl = $obj->module_srl; @@ -724,7 +690,7 @@ } /** - * @brief 특정달의 일별 글 현황을 가져옴 + * @brief Bringing a month on the status of the daily posts **/ function getDailyArchivedList($obj) { if($obj->mid) { @@ -732,8 +698,7 @@ $obj->module_srl = $oModuleModel->getModuleSrlByMid($obj->mid); unset($obj->mid); } - - // 넘어온 module_srl은 array일 수도 있기에 array인지를 체크 + // Module_srl passed the array may be a check whether the array if(is_array($obj->module_srl)) $args->module_srl = implode(',', $obj->module_srl); else $args->module_srl = $obj->module_srl; $args->regdate = $obj->regdate; @@ -747,15 +712,14 @@ } /** - * @brief 특정 모듈의 분류를 구함 + * @brief Get a list for a particular module **/ function getDocumentCategories() { if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); $module_srl = Context::get('module_srl'); $categories= $this->getCategoryList($module_srl); $lang = Context::get('lang'); - - // 분류 없음 추가 + // No additional category $output = "0,0,{$lang->none_category}\n"; if($categories){ foreach($categories as $category_srl => $category) { @@ -766,7 +730,7 @@ } /** - * @brief 문서 설정 정보를 구함 + * @brief Wanted to set document information **/ function getDocumentConfig() { if(!$GLOBALS['__document_config__']) { @@ -779,21 +743,20 @@ } /** - * @brief 공통 :: 모듈의 확장 변수 관리 - * 모듈의 확장변수 관리는 모든 모듈에서 document module instance를 이용할때 사용할 수 있음 + * @brief Common:: Module extensions of variable management + * Expansion parameter management module in the document module instance, when using all the modules available **/ function getExtraVarsHTML($module_srl) { - // 기존의 extra_keys 가져옴 + // Bringing existing extra_keys $extra_keys = $this->getExtraKeys($module_srl); Context::set('extra_keys', $extra_keys); - - // grant 정보를 추출 + // Get information of module_grants $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($this->module_path.'tpl', 'extra_keys'); } /** - * @brief 공통 :: 모듈의 카테고리 변수 관리 + * @brief Common:: Category parameter management module **/ function getCategoryHTML($module_srl) { $category_xml_file = $this->getCategoryXmlFile($module_srl); @@ -801,50 +764,43 @@ Context::set('category_xml_file', $category_xml_file); Context::loadJavascriptPlugin('ui.tree'); - // grant 정보를 추출 + // Get information of module_grants $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($this->module_path.'tpl', 'category_list'); } /** - * @brief 특정 카테고리의 정보를 이용하여 템플릿을 구한후 return - * 관리자 페이지에서 특정 메뉴의 정보를 추가하기 위해 서버에서 tpl을 컴파일 한후 컴파일 된 html을 직접 return + * @brief Certain categories of information, return the template guhanhu + * Manager on the page to add information about a particular menu from the server after compiling tpl compiled a direct return html **/ function getDocumentCategoryTplInfo() { $oModuleModel = &getModel('module'); $oMemberModel = &getModel('member'); - - // 해당 메뉴의 정보를 가져오기 위한 변수 설정 + // Get information on the menu for the parameter settings $module_srl = Context::get('module_srl'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); - - // 권한 체크 + // Check permissions $grant = $oModuleModel->getGrant($module_info, Context::get('logged_info')); if(!$grant->manager) return new Object(-1,'msg_not_permitted'); $category_srl = Context::get('category_srl'); $parent_srl = Context::get('parent_srl'); - - // 회원 그룹의 목록을 가져옴 + // Get a list of member groups $group_list = $oMemberModel->getGroups($module_info->site_srl); Context::set('group_list', $group_list); - - // parent_srl이 있고 category_srl 이 없으면 하부 메뉴 추가임 + // Without the sub-menu has parent_srl category_srl chugaim if(!$category_srl && $parent_srl) { - // 상위 메뉴의 정보를 가져옴 + // Get information of the parent menu $parent_info = $this->getCategory($parent_srl); - - // 추가하려는 메뉴의 기본 변수 설정 + // Default parameter settings for a new menu $category_info->category_srl = getNextSequence(); $category_info->parent_srl = $parent_srl; $category_info->parent_category_title = $parent_info->title; - - // root에 메뉴 추가하거나 기존 메뉴의 수정일 경우 + // Add to the root menu, or if an existing menu Modified } else { - // category_srl 이 있으면 해당 메뉴의 정보를 가져온다 + // If category_srl the menu brings the information if($category_srl) $category_info = $this->getCategory($category_srl); - - // 찾아진 값이 없다면 신규 메뉴 추가로 보고 category_srl값만 구해줌 + // If you do not add value d which pertain to the menu to see the new values guhaejum category_srl if(!$category_info->category_srl) { $category_info->category_srl = getNextSequence(); } @@ -853,17 +809,14 @@ $category_info->title = htmlspecialchars($category_info->title); Context::set('category_info', $category_info); - - // template 파일을 직접 컴파일한후 tpl변수에 담아서 return한다. + // tpl template file directly compile and will return a variable and puts it on. $oTemplate = &TemplateHandler::getInstance(); $tpl = $oTemplate->compile('./modules/document/tpl', 'category_info'); $tpl = str_replace("\n",'',$tpl); - - // 사용자 정의 언어 변경 + // Changing user-defined language $oModuleController = &getController('module'); $oModuleController->replaceDefinedLangCode($tpl); - - // return 할 변수 설정 + // set of variables to return $this->add('tpl', $tpl); } @@ -906,20 +859,17 @@ } /** - * @brief module_srl값을 가지는 문서의 목록을 가져옴 + * @brief module_srl value, bringing the list of documents **/ function getTrashList($obj) { - - // 변수 체크 + // Variable check $args->category_srl = $obj->category_srl?$obj->category_srl:null; $args->sort_index = $obj->sort_index; $args->order_type = $obj->order_type?$obj->order_type:'desc'; $args->page = $obj->page?$obj->page:1; $args->list_count = $obj->list_count?$obj->list_count:20; $args->page_count = $obj->page_count?$obj->page_count:10; - - - // 검색 옵션 정리 + // Search options $search_target = $obj->search_target; $search_keyword = $obj->search_keyword; if($search_target && $search_keyword) { diff --git a/modules/document/document.view.php b/modules/document/document.view.php index a88b17986..81db1b98f 100644 --- a/modules/document/document.view.php +++ b/modules/document/document.view.php @@ -2,42 +2,37 @@ /** * @class documentView * @author NHN (developers@xpressengine.com) - * @brief document 모듈의 View class + * @brief View class of the module document **/ class documentView extends document { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 문서 인쇄 기능 - * 해당 글만 찾아서 그냥 출력해버린다;; + * @brief Document printing + * I make it out to find the geulman;; **/ function dispDocumentPrint() { - // 목록 구현에 필요한 변수들을 가져온다 + // Bring a list of variables needed to implement $document_srl = Context::get('document_srl'); $oModuleModel = &getModel('module'); $module_info = $oModuleModel->getModuleInfoByDocumentSrl($document_srl); - - // document 객체를 생성. 기본 데이터 구조의 경우 document모듈만 쓰면 만사 해결.. -_-; + // Create the document object. If the document module of basic data structures, write it all works .. -_-; $oDocumentModel = &getModel('document'); - - // 선택된 문서 표시를 위한 객체 생성 + // Creates an object for displaying the selected document $oDocument = $oDocumentModel->getDocument($document_srl, $this->grant->manager); if(!$oDocument->isExists()) return new Object(-1,'msg_invalid_request'); - - // 권한 체크 + // Check permissions if(!$oDocument->isAccessible()) return new Object(-1,'msg_not_permitted'); - - // 모듈 정보 세팅 + // Information setting module Context::set('module_info', $module_info); - - // 브라우저 타이틀 설정 + // Browser title settings Context::setBrowserTitle($oDocument->getTitleText()); Context::set('oDocument', $oDocument); @@ -47,7 +42,7 @@ } /** - * @brief 미리 보기 + * @brief Preview **/ function dispDocumentPreview() { Context::set('layout','none'); @@ -58,12 +53,11 @@ } /** - * @brief 관리자가 선택한 문서에 대한 관리 + * @brief Selected by the administrator for the document management **/ function dispDocumentManageDocument() { if(!Context::get('is_logged')) return new Object(-1,'msg_not_permitted'); - - // 선택한 목록을 세션에서 가져옴 + // Taken from a list of selected sessions $flag_list = $_SESSION['document_management']; if(count($flag_list)) { foreach($flag_list as $key => $val) { @@ -79,11 +73,9 @@ } $oModuleModel = &getModel('module'); - - // 모듈 카테고리 목록과 모듈 목록의 조합 + // The combination of module categories list and the list of modules if(count($module_list)>1) Context::set('module_list', $module_categories); - - // 팝업 레이아웃 선택 + // Select Pop-up layout $this->setLayoutPath('./common/tpl'); $this->setLayoutFile('popup_layout'); @@ -96,7 +88,7 @@ $current_module_srls = Context::get('module_srls'); if(!$current_module_srl && !$current_module_srls) { - // 선택된 모듈의 정보를 가져옴 + // Get information of the current module $current_module_info = Context::get('current_module_info'); $current_module_srl = $current_module_info->module_srl; if(!$current_module_srl) return new Object(); diff --git a/modules/editor/components/emoticon/emoticon.class.php b/modules/editor/components/emoticon/emoticon.class.php index 2f7eacfc0..9fc8d1b23 100644 --- a/modules/editor/components/emoticon/emoticon.class.php +++ b/modules/editor/components/emoticon/emoticon.class.php @@ -2,18 +2,17 @@ /** * @class emoticon * @author NHN (developers@xpressengine.com) - * @brief 이모티콘 이미지 연결 컴포넌트 + * @brief Emoticons image connected components **/ class emoticon extends EditorHandler { - - // editor_sequence 는 에디터에서 필수로 달고 다녀야 함.... + // editor_sequence from the editor must attend mandatory wearing .... var $editor_sequence = 0; var $component_path = ''; var $emoticon_path = ''; /** - * @brief editor_sequence과 컴포넌트의 경로를 받음 + * @brief editor_sequence and components out of the path **/ function emoticon($editor_sequence, $component_path) { $this->editor_sequence = $editor_sequence; @@ -22,7 +21,7 @@ } /** - * @brief 이모티콘 파일 목록을 리턴 + * @brief Returns a list of emoticons file **/ function getEmoticonList() { $emoticon = Context::get('emoticon'); @@ -34,7 +33,7 @@ } /** - * @brief 재귀적으로 이모티콘이 될 법한 파일들을 하위 디렉토리까지 전부 검색한다. 8,000개까지는 테스트 해봤는데 스택오버프로우를 일으킬지 어떨지는 잘 모르겠음.(2007.9.6, 베니) + * @brief Likely to be recursively emoticons will search all the files to a subdirectory. 8000 gaekkajineun ran tests whether the stack and raise beef pro-overs and Unsure. (06/09/2007, Benny) **/ function getEmoticons($path) { $emoticon_path = sprintf("%s/%s", $this->emoticon_path, $path); @@ -51,10 +50,10 @@ } /** - * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다 + * @brief popup window to display in popup window request is to add content **/ function getPopupContent() { - // 이모티콘 디렉토리 목록을 가져옴 + // Bringing a list of emoticons directory $emoticon_dirs = FileHandler::readDir($this->emoticon_path); $emoticon_list = array(); if($emoticon_dirs) { @@ -63,12 +62,10 @@ } } Context::set('emoticon_list', $emoticon_list); - - // 첫번째 이모티콘 디렉토리의 이미지 파일을 구함 + // The first emoticon image files in the directory Wanted $emoticons = $this->getEmoticons($emoticon_list[0]); Context::set('emoticons', $emoticons); - - // 템플릿을 미리 컴파일해서 컴파일된 소스를 return + // Pre-compiled source code to compile template return to $tpl_path = $this->component_path.'tpl'; $tpl_file = 'popup.html'; @@ -77,7 +74,7 @@ } /** - * @brief 이모티콘의 경로 문제 해결을 하기 위해 추가하였다. (2007.9.6 베니) + * @brief Emoticon of the path were added to solve the problem. (06/09/2007 Benny) **/ function transHTML($xml_obj) { $src = $xml_obj->attrs->src; diff --git a/modules/editor/components/image_gallery/image_gallery.class.php b/modules/editor/components/image_gallery/image_gallery.class.php index 3aa0b2e86..8c4426ac2 100644 --- a/modules/editor/components/image_gallery/image_gallery.class.php +++ b/modules/editor/components/image_gallery/image_gallery.class.php @@ -2,17 +2,16 @@ /** * @class image_gallery * @author NHN (developers@xpressengine.com) - * @brief 업로드된 이미지로 이미지갤러리를 만듬 + * @brief Making images uploaded to the image gallery **/ class image_gallery extends EditorHandler { - - // editor_sequence 는 에디터에서 필수로 달고 다녀야 함.... + // editor_sequence from the editor must attend mandatory wearing .... var $editor_sequence = 0; var $component_path = ''; /** - * @brief editor_sequence과 컴포넌트의 경로를 받음 + * @brief editor_sequence and components out of the path **/ function image_gallery($editor_sequence, $component_path) { $this->editor_sequence = $editor_sequence; @@ -20,10 +19,10 @@ } /** - * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다 + * @brief popup window to display in popup window request is to add content **/ function getPopupContent() { - // 템플릿을 미리 컴파일해서 컴파일된 소스를 return + // Pre-compiled source code to compile template return to $tpl_path = $this->component_path.'tpl'; $tpl_file = 'popup.html'; @@ -34,10 +33,10 @@ } /** - * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method + * @brief Editor of the components separately if you use a unique code to the html code for a method to change * - * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서 - * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경 + * Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then + * DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own **/ function transHTML($xml_obj) { $gallery_info->srl = rand(111111,999999); @@ -50,8 +49,7 @@ $images_list = $xml_obj->attrs->images_list; $images_list = preg_replace('/\.(gif|jpg|jpeg|png) /i',".\\1\n",$images_list); $gallery_info->images_list = explode("\n",trim($images_list)); - - // 만약 출력설정이 XML일 경우 이미지 목록만 출력하도록 코드 생성 + // If you set the output to output the XML code generated a list of the image if(Context::getResponseMethod() == 'XMLRPC') { $output = ''; for($i=0;$iimages_list);$i++) { @@ -59,8 +57,7 @@ } return $output; } - - // HTML 출력일 경우 템플릿 변환을 거쳐서 갤러리 출력 설정에 맞는 html코드를 생성하도록 함 + // HTML gallery output, the output settings via the template for the conversion to generate the html code should preg_match_all('/(width|height)([^[:digit:]]+)([0-9]+)/i',$xml_obj->attrs->style,$matches); $gallery_info->width = trim($matches[3][0]); if(!$gallery_info->width) $gallery_info->width = 400; diff --git a/modules/editor/components/image_link/image_link.class.php b/modules/editor/components/image_link/image_link.class.php index ab771e421..3fd9e88c2 100644 --- a/modules/editor/components/image_link/image_link.class.php +++ b/modules/editor/components/image_link/image_link.class.php @@ -2,17 +2,16 @@ /** * @class image_link * @author NHN (developers@xpressengine.com) - * @brief 이미지를 추가하거나 속성을 수정하는 컴포넌트 + * @brief Add an image, or to modify the properties of components **/ class image_link extends EditorHandler { - - // editor_sequence 는 에디터에서 필수로 달고 다녀야 함.... + // editor_sequence from the editor must attend mandatory wearing .... var $editor_sequence = 0; var $component_path = ''; /** - * @brief editor_sequence과 컴포넌트의 경로를 받음 + * @brief editor_sequence and components out of the path **/ function image_link($editor_sequence, $component_path) { $this->editor_sequence = $editor_sequence; @@ -20,10 +19,10 @@ } /** - * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다 + * @brief popup window to display in popup window request is to add content **/ function getPopupContent() { - // 템플릿을 미리 컴파일해서 컴파일된 소스를 return + // Pre-compiled source code to compile template return to $tpl_path = $this->component_path.'tpl'; $tpl_file = 'popup.html'; @@ -34,10 +33,10 @@ } /** - * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method + * @brief Editor of the components separately if you use a unique code to the html code for a method to change * - * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서 - * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경 + * Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then + * DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own **/ function transHTML($xml_obj) { $src = $xml_obj->attrs->src; @@ -60,7 +59,7 @@ $src = str_replace('&amp;', '&', $src); if(!$alt) $alt = $src; - // 이미지 주소를 request uri가 포함된 주소로 변환 (rss출력, 등등을 위함) + // Image containing the address to the address conversion request uri (rss output, etc. purposes) $temp_src = explode('/', $src); if(substr($src, 0,2)=='./') $src = Context::getRequestUri().substr($src, 2); elseif(substr($src , 0, 1)=='/') { diff --git a/modules/editor/components/multimedia_link/multimedia_link.class.php b/modules/editor/components/multimedia_link/multimedia_link.class.php index 5a226f677..0147db01f 100644 --- a/modules/editor/components/multimedia_link/multimedia_link.class.php +++ b/modules/editor/components/multimedia_link/multimedia_link.class.php @@ -2,17 +2,16 @@ /** * @class multimedia_link * @author NHN (developers@xpressengine.com) - * @brief 본문에 멀티미디어 자료를 연결하는 컴포넌트 + * @brief The components connected to the body of multimedia data **/ class multimedia_link extends EditorHandler { - - // editor_sequence 는 에디터에서 필수로 달고 다녀야 함.... + // editor_sequence from the editor must attend mandatory wearing .... var $editor_sequence = 0; var $component_path = ''; /** - * @brief editor_sequence과 컴포넌트의 경로를 받음 + * @brief editor_sequence and components out of the path **/ function multimedia_link($editor_sequence, $component_path) { $this->editor_sequence = $editor_sequence; @@ -20,10 +19,10 @@ } /** - * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다 + * @brief popup window to display in popup window request is to add content **/ function getPopupContent() { - // 템플릿을 미리 컴파일해서 컴파일된 소스를 return + // Pre-compiled source code to compile template return to $tpl_path = $this->component_path.'tpl'; $tpl_file = 'popup.html'; @@ -34,10 +33,10 @@ } /** - * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method + * @brief Editor of the components separately if you use a unique code to the html code for a method to change * - * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서 - * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경 + * Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then + * DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own **/ function transHTML($xml_obj) { $src = $xml_obj->attrs->multimedia_src; diff --git a/modules/editor/components/poll_maker/poll_maker.class.php b/modules/editor/components/poll_maker/poll_maker.class.php index be43dcb95..d84d89c5a 100644 --- a/modules/editor/components/poll_maker/poll_maker.class.php +++ b/modules/editor/components/poll_maker/poll_maker.class.php @@ -2,17 +2,16 @@ /** * @class poll_maker * @author NHN (developers@xpressengine.com) - * @brief 에디터에서 url링크하는 기능 제공. + * @brief Editor provides the ability to link to the url. **/ class poll_maker extends EditorHandler { - - // editor_sequence 는 에디터에서 필수로 달고 다녀야 함.... + // editor_sequence from the editor must attend mandatory wearing .... var $editor_sequence = 0; var $component_path = ''; /** - * @brief editor_sequence과 컴포넌트의 경로를 받음 + * @brief editor_sequence and components out of the path **/ function poll_maker($editor_sequence, $component_path) { $this->editor_sequence = $editor_sequence; @@ -20,15 +19,14 @@ } /** - * @brief popup window요청시 popup window에 출력할 내용을 추가하면 된다 + * @brief popup window to display in popup window request is to add content **/ function getPopupContent() { - // 설문조사 스킨을 구함 + // Wanted Skins survey $oModuleModel = &getModel('module'); $skin_list = $oModuleModel->getSkins("./modules/poll/"); Context::set('skin_list', $skin_list); - - // 템플릿을 미리 컴파일해서 컴파일된 소스를 return + // Pre-compiled source code to compile template return to $tpl_path = $this->component_path.'tpl'; $tpl_file = 'popup.html'; @@ -37,10 +35,10 @@ } /** - * @brief 에디터 컴포넌트가 별도의 고유 코드를 이용한다면 그 코드를 html로 변경하여 주는 method + * @brief Editor of the components separately if you use a unique code to the html code for a method to change * - * 이미지나 멀티미디어, 설문등 고유 코드가 필요한 에디터 컴포넌트는 고유코드를 내용에 추가하고 나서 - * DocumentModule::transContent() 에서 해당 컴포넌트의 transHtml() method를 호출하여 고유코드를 html로 변경 + * Images and multimedia, seolmundeung unique code is required for the editor component added to its own code, and then + * DocumentModule:: transContent() of its components transHtml() method call to change the html code for your own **/ function transHTML($xml_obj) { $poll_srl = $xml_obj->attrs->poll_srl; @@ -51,8 +49,7 @@ $width = $matches[2]; if(!$width) $width = 400; $style = sprintf('width:%dpx', $width); - - // poll model 객체 생성해서 html 얻어와서 return + // poll model object creation to come get it return html $oPollModel = &getModel('poll'); return $oPollModel->getPollHtml($poll_srl, $style, $skin); } diff --git a/modules/editor/editor.admin.controller.php b/modules/editor/editor.admin.controller.php index 016855db7..057db5172 100644 --- a/modules/editor/editor.admin.controller.php +++ b/modules/editor/editor.admin.controller.php @@ -2,19 +2,19 @@ /** * @class editorAdminController * @author NHN (developers@xpressengine.com) - * @brief editor 모듈의 admin controller class + * @brief editor of the module admin controller class **/ class editorAdminController extends editor { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 컴포넌트의 활성화 + * @brief Activate components **/ function procEditorAdminEnableComponent() { $site_module_info = Context::get('site_module_info'); @@ -33,7 +33,7 @@ } /** - * @brief 컴포넌트의 비활성화 + * @brief Deactivate components **/ function procEditorAdminDisableComponent() { $site_module_info = Context::get('site_module_info'); @@ -52,15 +52,14 @@ } /** - * @brief 컴포넌트의 위치 변경 + * @brief Change a location of the component **/ function procEditorAdminMoveListOrder() { $site_module_info = Context::get('site_module_info'); $args->site_srl = (int)$site_module_info->site_srl; $args->component_name = Context::get('component_name'); $mode = Context::get('mode'); - - // DB에서 전체 목록 가져옴 + // Get a full list of components from the DB if(!$args->site_srl) $output = executeQuery('editor.getComponentList', $args); else $output = executeQuery('editor.getSiteComponentList', $args); @@ -108,7 +107,7 @@ } /** - * @brief 컴포넌트 설정 + * @brief Set components **/ function procEditorAdminSetupComponent() { $site_module_info = Context::get('site_module_info'); @@ -138,7 +137,7 @@ } /** - * @brief 컴포넌트를 DB에 추가 + * @brief Add a component to DB **/ function insertComponent($component_name, $enabled = false, $site_srl = 0) { if($enabled) $enabled = 'Y'; @@ -147,13 +146,11 @@ $args->component_name = $component_name; $args->enabled = $enabled; $args->site_srl = $site_srl; - - // 컴포넌트가 있는지 확인 + // Check if the component exists if(!$site_srl) $output = executeQuery('editor.isComponentInserted', $args); else $output = executeQuery('editor.isSiteComponentInserted', $args); if($output->data->count) return new Object(-1, 'msg_component_is_not_founded'); - - // 입력 + // Inert a component $args->list_order = getNextSequence(); if(!$site_srl) $output = executeQuery('editor.insertComponent', $args); else $output = executeQuery('editor.insertSiteComponent', $args); diff --git a/modules/editor/editor.admin.view.php b/modules/editor/editor.admin.view.php index 61f2e175f..7e641ebfe 100644 --- a/modules/editor/editor.admin.view.php +++ b/modules/editor/editor.admin.view.php @@ -2,26 +2,25 @@ /** * @class editorAdminView * @author NHN (developers@xpressengine.com) - * @brief editor 모듈의 admin view 클래스 + * @brief editor admin view of the module class **/ class editorAdminView extends editor { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 관리자 설정 페이지 - * 에디터 컴포넌트의 on/off 및 설정을 담당 + * @brief Administrator Setting page + * Settings to enable/disable editor component and other features **/ function dispEditorAdminIndex() { $site_module_info = Context::get('site_module_info'); $site_srl = (int)$site_module_info->site_srl; - - // 컴포넌트의 종류를 구해옴 + // Get a type of component $oEditorModel = &getModel('editor'); $component_list = $oEditorModel->getComponentList(false, $site_srl, true); @@ -32,33 +31,29 @@ } /** - * @brief 컴퍼넌트 setup + * @brief Component setup **/ function dispEditorAdminSetupComponent() { $site_module_info = Context::get('site_module_info'); $site_srl = (int)$site_module_info->site_srl; $component_name = Context::get('component_name'); - - // 에디터 컴포넌트의 정보를 구함 + // Get information of the editor component $oEditorModel = &getModel('editor'); $component = $oEditorModel->getComponent($component_name,$site_srl); Context::set('component', $component); - - // 그룹 설정을 위한 그룹 목록을 구함 + // Get a group list to set a group $oMemberModel = &getModel('member'); $group_list = $oMemberModel->getGroups($site_srl); Context::set('group_list', $group_list); - - // mid 목록을 가져옴 + // Get a mid list $oModuleModel = &getModel('module'); $args->site_srl = $site_srl; $mid_list = $oModuleModel->getMidList($args); - - // module_category와 module의 조합 + // Combination of module_category and module if(!$args->site_srl) { - // 모듈 카테고리 목록을 구함 + // Get a list of module category $module_categories = $oModuleModel->getModuleCategories(); if(!is_array($mid_list)) $mid_list = array($mid_list); diff --git a/modules/editor/editor.class.php b/modules/editor/editor.class.php index 1e61f1b93..198bc84cb 100644 --- a/modules/editor/editor.class.php +++ b/modules/editor/editor.class.php @@ -2,19 +2,18 @@ /** * @class editor * @author NHN (developers@xpressengine.com) - * @brief editor 모듈의 high class + * @brief high class of the editor odule **/ class editor extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // action forward에 등록 (관리자 모드에서 사용하기 위함) + // Register action forward (to use in administrator mode) $oModuleController = &getController('module'); - - // 기본 에디터 컴포넌트를 추가 + // Add the default editor component $oEditorController = &getAdminController('editor'); $oEditorController->insertComponent('colorpicker_text',true); $oEditorController->insertComponent('colorpicker_bg',true); @@ -26,83 +25,71 @@ $oEditorController->insertComponent('table_maker',true); $oEditorController->insertComponent('poll_maker',true); $oEditorController->insertComponent('image_gallery',true); - - // 에디터 모듈에서 사용할 디렉토리 생성 + // Create a directory to use in the editor module FileHandler::makeDir('./files/cache/editor'); - - // 2007. 10. 17 글의 입력(신규 or 수정)이 일어날때마다 자동 저장된 문서를 삭제하는 trigger 추가 + // 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified $oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'); $oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'); - - // 2007. 10. 23 모듈의 추가 설정에서 에디터 trigger 추가 + // 2007. 10. 23 Add an editor trigger on the module addition setup $oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'); - - // 2009. 04. 14 editor component 변환 코드를 trigger로 독립 + // 2009. 04. 14 Add a trigger from compiled codes of the editor component $oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'); return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { $oModuleModel = &getModel('module'); $oDB = &DB::getInstance(); - - // 2009. 06. 15 자동저장시 module_srl 을 저장 + // 2009. 06. 15 Save module_srl when auto-saving if(!$oDB->isColumnExists("editor_autosave","module_srl")) return true; if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) return true; - // 2007. 10. 17 글의 입력(신규 or 수정)이 일어날때마다 자동 저장된 문서를 삭제하는 trigger 추가 + // 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true; if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) return true; - - // 2007. 10. 23 모듈의 추가 설정에서 에디터 trigger 추가 + // 2007. 10. 23 Add an editor trigger on the module addition setup if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) return true; - - // 2009. 04. 14 editor component 변환 코드를 trigger로 독립 + // 2009. 04. 14 Add a trigger from compiled codes of the editor component if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) return true; - - // 2009. 06. 19 사용하지 않는 트리거 제거 + // 2009. 06. 19 Remove unused trigger if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) return true; return false; } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { $oModuleModel = &getModel('module'); $oModuleController = &getController('module'); $oDB = &DB::getInstance(); - - // 자동저장시 module_srl 을 저장 2009.6.15 + // Save module_srl when auto-saving 15/06/2009 if(!$oDB->isColumnExists("editor_autosave","module_srl")) $oDB->addColumn("editor_autosave","module_srl","number",11); - // module_srl을 인덱스로 + // create an index on module_srl if(!$oDB->isIndexExists("editor_autosave","idx_module_srl")) $oDB->addIndex("editor_autosave","idx_module_srl", "module_srl"); - // 2007. 10. 17 글의 입력(신규 or 수정)이 일어날때마다 자동 저장된 문서를 삭제하는 trigger 추가 + // 2007. 10. 17 Add a trigger to delete automatically saved document whenever the document(insert or update) is modified if(!$oModuleModel->getTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) $oModuleController->insertTrigger('document.insertDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'); if(!$oModuleModel->getTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after')) $oModuleController->insertTrigger('document.updateDocument', 'editor', 'controller', 'triggerDeleteSavedDoc', 'after'); - - // 2007. 10. 23 모듈의 추가 설정에서 에디터 trigger 추가 + // 2007. 10. Add an editor trigger on the module addition setup if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before')) $oModuleController->insertTrigger('module.dispAdditionSetup', 'editor', 'view', 'triggerDispEditorAdditionSetup', 'before'); - - // 2009. 04. 14 editor component 변환 코드를 trigger로 독립 + // 2009. 04. 14 Add a trigger from compiled codes of the editor component if(!$oModuleModel->getTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before')) $oModuleController->insertTrigger('display', 'editor', 'controller', 'triggerEditorComponentCompile', 'before'); - - // 2009. 06. 19 사용하지 않는 트리거 제거 + // 2009. 06. 19 Remove unused trigger if($oModuleModel->getTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before')) $oModuleController->deleteTrigger('file.getIsPermitted', 'editor', 'controller', 'triggerSrlSetting', 'before'); @@ -110,10 +97,10 @@ } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { - // 에디터 컴포넌트 캐시 파일 삭제 + // Delete the cache file editor component FileHandler::removeFilesInDir("./files/cache/editor"); } } diff --git a/modules/editor/editor.controller.php b/modules/editor/editor.controller.php index 2a481b6e6..ba5fc5a7e 100644 --- a/modules/editor/editor.controller.php +++ b/modules/editor/editor.controller.php @@ -2,19 +2,19 @@ /** * @class editor * @author NHN (developers@xpressengine.com) - * @brief editor 모듈의 controller class + * @brief editor module's controller class **/ class editorController extends editor { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 자동 저장 + * @brief AutoSave **/ function procEditorSaveDoc() { @@ -29,7 +29,7 @@ } /** - * @brief 자동저장된 문서 삭제 + * @brief Delete autosaved documents **/ function procEditorRemoveSavedDoc() { $oEditorController = &getController('editor'); @@ -37,7 +37,7 @@ } /** - * @brief 컴포넌트에서 ajax요청시 해당 컴포넌트의 method를 실행 + * @brief Execute a method of the component when the component requests ajax **/ function procEditorCall() { $component = Context::get('component'); @@ -67,12 +67,11 @@ } /** - * @brief 에디터의 모듈별 추가 확장 폼을 저장 + * @brief Save Editor's additional form for each module **/ function procEditorInsertModuleConfig() { $module_srl = Context::get('target_module_srl'); - - // 여러개의 모듈 일괄 설정일 경우 + // To configure many of modules at once if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); else $module_srl = array($module_srl); @@ -149,7 +148,7 @@ } /** - * @brief 에디터컴포넌트의 코드를 결과물로 변환 + 문서서식 style 지정 + * @brief convert editor component codes to be returned and specify content style. **/ function triggerEditorComponentCompile(&$content) { if(Context::getResponseMethod()!='HTML') return new Object(); @@ -189,7 +188,7 @@ } /** - * @brief 에디터 컴포넌트코드를 결과물로 변환 + * @brief Convert editor component codes to be returned **/ function transComponent($content) { $content = preg_replace_callback('!]*)editor_component=([^\>]*)>(.*?)\<\/div\>!is', array($this,'transEditorComponent'), $content); @@ -198,7 +197,7 @@ } /** - * @brief 내용의 에디터 컴포넌트 코드를 변환 + * @brief Convert editor component code of the contents **/ function transEditorComponent($matches) { $script = sprintf(' %s editor_component=%s', $matches[1], $matches[2]); @@ -210,8 +209,7 @@ $xml_obj->body = $matches[3]; if(!$xml_obj->attrs->editor_component) return $matches[0]; - - // component::transHTML() 을 이용하여 변환된 코드를 받음 + // Get converted codes by using component::transHTML() $oEditorModel = &getModel('editor'); $oComponent = &$oEditorModel->getComponentObject($xml_obj->attrs->editor_component, 0); if(!is_object($oComponent)||!method_exists($oComponent, 'transHTML')) return $matches[0]; @@ -221,7 +219,7 @@ /** - * @brief 자동 저장 + * @brief AutoSave **/ function doSaveDoc($args) { @@ -232,7 +230,7 @@ } else { $args->ipaddress = $_SERVER['REMOTE_ADDR']; } - // module_srl이 없으면 현재 모듈 + // Get the current module if module_srl doesn't exist if(!$args->module_srl) { $args->module_srl = Context::get('module_srl'); } @@ -240,13 +238,12 @@ $current_module_info = Context::get('current_module_info'); $args->module_srl = $current_module_info->module_srl; } - - // 저장 + // Save return executeQuery('editor.insertSavedDoc', $args); } /** - * @brief 자동 저장글 Srl 로드 - XE 이전 버전 사용자를 위함. + * @brief Load the srl of autosaved document - for those who uses XE older versions. **/ function procEditorLoadSavedDocument() { $editor_sequence = Context::get('editor_sequence'); @@ -267,7 +264,7 @@ /** - * @brief 게시글의 입력/수정이 일어났을 경우 자동 저장문서를 제거하는 trigger + * @brief A trigger to remove auto-saved document when inserting/updating the document **/ function triggerDeleteSavedDoc(&$obj) { $this->deleteSavedDoc(false); @@ -275,8 +272,8 @@ } /** - * @brief 자동 저장된 글을 삭제 - * 현재 접속한 사용자를 기준 + * @brief Delete the auto-saved document + * Based on the current logged-in user **/ function deleteSavedDoc($mode = false) { if(Context::get('is_logged')) { @@ -286,13 +283,12 @@ $args->ipaddress = $_SERVER['REMOTE_ADDR']; } $args->module_srl = Context::get('module_srl'); - // module_srl이 없으면 현재 모듈 + // Get the current module if module_srl doesn't exist if(!$args->module_srl) { $current_module_info = Context::get('current_module_info'); $args->module_srl = $current_module_info->module_srl; } - - // 자동저장된 값이 혹시 이미 등록된 글인지 확인 + // Check if the auto-saved document already exists $output = executeQuery('editor.getSavedDocument', $args); $saved_doc = $output->data; if(!$saved_doc) return; @@ -305,13 +301,12 @@ $output = ModuleHandler::triggerCall('editor.deleteSavedDoc', 'after', $saved_doc); } } - - // 일단 이전 저장본 삭제 + // Delete the saved document return executeQuery('editor.deleteSavedDoc', $args); } /** - * @brief 가상 사이트에서 사용된 에디터 컴포넌트 정보를 제거 + * @brief ERemove editor component information used on the virtual site **/ function removeEditorConfig($site_srl) { $args->site_srl = $site_srl; @@ -319,8 +314,8 @@ } /** - * @brief 에디터 컴포넌트 목록 캐싱 (editorModel::getComponentList) - * 에디터 컴포넌트 목록의 경우 DB query + Xml Parsing 때문에 캐싱 파일을 이용하도록 함 + * @brief Caching a list of editor component (editorModel::getComponentList) + * For the editor component list, use a caching file because of DB query and Xml parsing **/ function makeCache($filter_enabled = true, $site_srl) { $oEditorModel = &getModel('editor'); @@ -332,11 +327,9 @@ $output = executeQuery('editor.getSiteComponentList', $args); } else $output = executeQuery('editor.getComponentList', $args); $db_list = $output->data; - - // 파일목록을 구함 + // Get a list of files $downloaded_list = FileHandler::readDir(_XE_PATH_.'modules/editor/components'); - - // 로그인 여부 및 소속 그룹 구함 + // Get information about log-in status and its group $is_logged = Context::get('is_logged'); if($is_logged) { $logged_info = Context::get('logged_info'); @@ -344,8 +337,7 @@ $group_list = array_keys($logged_info->group_list); } else $group_list = array(); } - - // DB 목록을 loop돌면서 xml정보까지 구함 + // Get xml information for looping DB list if(!is_array($db_list)) $db_list = array($db_list); foreach($db_list as $component) { if(in_array($component->component_name, array('colorpicker_text','colorpicker_bg'))) continue; @@ -370,12 +362,11 @@ $xml_info->mid_list = $extra_vars->mid_list; } /* - // 사용권한이 있으면 권한 체크 + // Permisshin check if you are granted if($extra_vars->target_group) { - // 사용권한이 체크되어 있는데 로그인이 되어 있지 않으면 무조건 사용 중지 + // Stop using if not logged-in if(!$is_logged) continue; - - // 대상 그룹을 구해서 현재 로그인 사용자의 그룹과 비교 + // Compare a target group with the current logged-in user group $target_group = $extra_vars->target_group; unset($extra_vars->target_group); @@ -388,13 +379,11 @@ } if(!$is_granted) continue; } - - // 대상 모듈이 있으면 체크 + // Check if the target module exists if($extra_vars->mid_list && count($extra_vars->mid_list) && Context::get('mid')) { if(!in_array(Context::get('mid'), $extra_vars->mid_list)) continue; }*/ - - // 에디터 컴포넌트의 설정 정보를 체크 + // Check the configuration of the editor component if($xml_info->extra_vars) { foreach($xml_info->extra_vars as $key => $val) { $xml_info->extra_vars->{$key}->value = $extra_vars->{$key}; @@ -403,34 +392,28 @@ } $component_list->{$component_name} = $xml_info; - - // 버튼, 아이콘 이미지 구함 + // Get buttons, icons, images $icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/icon.gif'; $component_icon_file = _XE_PATH_.'modules/editor/components/'.$component_name.'/component_icon.gif'; if(file_exists($icon_file)) $component_list->{$component_name}->icon = true; if(file_exists($component_icon_file)) $component_list->{$component_name}->component_icon = true; } - - // enabled만 체크하도록 하였으면 그냥 return + // Return if it checks enabled only if($filter_enabled) { $cache_file = $oEditorModel->getCacheFile($filter_enabled, $site_srl); $buff = sprintf('', str_replace('"','\\"',serialize($component_list))); FileHandler::writeFile($cache_file, $buff); return $component_list; } - - // 다운로드된 목록의 xml_info를 마저 구함 + // Get xml_info of downloaded list foreach($downloaded_list as $component_name) { if(in_array($component_name, array('colorpicker_text','colorpicker_bg'))) continue; - - // 설정된 것이라면 패스 + // Pass if configured if($component_list->{$component_name}) continue; - - // DB에 입력 + // Insert data into the DB $oEditorController = &getAdminController('editor'); $oEditorController->insertComponent($component_name, false, $site_srl); - - // component_list에 추가 + // Add to component_list unset($xml_info); $xml_info = $oEditorModel->getComponentXmlInfo($component_name); $xml_info->enabled = 'N'; @@ -446,7 +429,7 @@ } /** - * @brief 캐시 파일 삭제 + * @brief Delete cache files **/ function removeCache($site_srl = 0) { $oEditorModel = &getModel('editor'); diff --git a/modules/editor/editor.model.php b/modules/editor/editor.model.php index 0c090b664..bc67c11a4 100644 --- a/modules/editor/editor.model.php +++ b/modules/editor/editor.model.php @@ -2,7 +2,7 @@ /** * @class editorModel * @author NHN (developers@xpressengine.com) - * @brief editor 모듈의 model 클래스 + * @brief model class of the editor odule **/ class editorModel extends editor { @@ -10,21 +10,21 @@ var $loaded_component_list = array(); /** - * @brief 에디터를 return + * @brief Return the editor * - * 에디터의 경우 내부적으로 1~30까지의 임시 editor_seuqnece를 생성한다. - * 즉 한페이지에 30개 이상의 에디터를 출력하지는 못하도록 제한되어 있다. + * Editor internally generates editor_sequence from 1 to 30 for temporary use. + * That means there is a limitation that more than 30 editors cannot be displayed on a single page. * - * 단, 수정하는 경우 또는 파일업로드를 한 자동저장본의 경우는 getNextSequence() 값으로 저장된 editor_seqnece가 - * 설정된다. + * However, editor_sequence can be value from getNextSequence() in case of the modified or the auto-saved for file upload + * **/ /** - * @brief 모듈별 에디터 설정을 return + * @brief Return editor setting for each module **/ function getEditorConfig($module_srl) { if(!$GLOBALS['__editor_module_config__'][$module_srl]) { - // 선택된 모듈의 trackback설정을 가져옴 + // Get trackback settings of the selected module $oModuleModel = &getModel('module'); $GLOBALS['__editor_module_config__'][$module_srl] = $oModuleModel->getModulePartConfig('editor', $module_srl); } @@ -75,20 +75,17 @@ function getDrComponentXmlInfo($drComponentName){ $lang_type = Context::getLangType(); - - // 요청된 컴포넌트의 xml파일 위치를 구함 + // Get the xml file path of requested component $component_path = sprintf('%s/skins/dreditor/drcomponents/%s/', $this->module_path, $drComponentName); $xml_file = sprintf('%sinfo.xml', $component_path); $cache_file = sprintf('./files/cache/editor/dr_%s.%s.php', $drComponentName, $lang_type); - - // 캐시된 xml파일이 있으면 include 후 정보 return + // Return information after including it after cached xml file exists if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) { include($cache_file); return $xml_info; } - - // 캐시된 파일이 없으면 파싱후 캐싱 후 return + // Return after parsing and caching if the cached file does not exist $oParser = new XmlParser(); $xml_doc = $oParser->loadXmlFile($xml_file); @@ -111,7 +108,7 @@ $buff .= sprintf('$xml_info->license = "%s";', $component_info->license); $buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link); - // 작성자 정보 + // Author information if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; else $author_list = $xml_doc->component->author; @@ -154,8 +151,7 @@ } } } - - // 추가 변수 정리 (에디터 컴포넌트에서는 text형만 가능) + // List extra variables (text type only in the editor component) $extra_vars = $xml_doc->component->extra_vars->var; if($extra_vars) { if(!is_array($extra_vars)) $extra_vars = array($extra_vars); @@ -182,48 +178,40 @@ } /** - * @brief 에디터 template을 return - * upload_target_srl은 글의 수정시 호출하면 됨. - * 이 upload_target_srl은 첨부파일의 유무를 체크하기 위한 루틴을 구현하는데 사용됨. + * @brief Return the editor template + * You can call upload_target_srl when modifying content + * The upload_target_srl is used for a routine to check if an attachment exists **/ function getEditor($upload_target_srl = 0, $option = null) { /** - * 기본적인 에디터의 옵션을 정리 + * Editor's default options **/ - // 파일 업로드 유무 옵션 설정 + // Option setting to allow file upload if(!$option->allow_fileupload) $allow_fileupload = false; else $allow_fileupload = true; - - // content_style 세팅 + // content_style setting if(!$option->content_style) $option->content_style = 'default'; Context::set('content_style', $option->content_style); - - // 기본 글꼴 지정 + // Default font setting Context::set('content_font', $option->content_font); Context::set('content_font_size', $option->content_font_size); - - // 자동 저장 유무 옵션 설정 글 수정시는 사용 안함 + // Option setting to allow auto-save if(!$option->enable_autosave) $enable_autosave = false; elseif(Context::get($option->primary_key_name)) $enable_autosave = false; else $enable_autosave = true; - - // 기본 에디터 컴포넌트 사용 설정 + // Option setting to allow the default editor component if(!$option->enable_default_component) $enable_default_component = false; else $enable_default_component = true; - - // 확장 컴포넌트 사용 설정 + // Option setting to allow other extended components if(!$option->enable_component) $enable_component = false; else $enable_component = true; - - // html 모드 조절 + // Setting for html-mode if($option->disable_html) $html_mode = false; else $html_mode = true; - - // 높이 설정 + // Set Height if(!$option->height) $editor_height = 400; else $editor_height = $option->height; - - // 스킨 설정 + // Skin Setting $skin = $option->skin; if(!$skin) $skin = 'xpresseditor'; @@ -236,19 +224,18 @@ } /** - * 자동백업 기능 체크 (글 수정일 경우는 사용하지 않음) + * Check the automatic backup feature (do not use if the post is edited) **/ if($enable_autosave) { - // 자동 저장된 데이터를 추출 + // Extract auto-saved data $saved_doc = $this->getSavedDoc($upload_target_srl); - - // 자동 저장 데이터를 context setting + // Context setting auto-saved data Context::set('saved_doc', $saved_doc); } Context::set('enable_autosave', $enable_autosave); /** - * 에디터의 고유 번호 추출 (한 페이지에 여러개의 에디터를 출력하는 경우를 대비) + * Extract editor's unique number (in order to display multiple editors on a single page) **/ if($option->editor_sequence) $editor_sequence = $option->editor_sequence; else { @@ -257,50 +244,42 @@ } /** - * 업로드 활성화시 내부적으로 file 모듈의 환경설정을 이용하여 설정 + * Upload setting by using configuration of the file module internally **/ $files_count = 0; if($allow_fileupload) { $oFileModel = &getModel('file'); - - // SWFUploader에 세팅할 업로드 설정 구함 + // Get upload configuration to set on SWFUploader $file_config = $oFileModel->getUploadConfig(); $file_config->allowed_attach_size = $file_config->allowed_attach_size*1024*1024; $file_config->allowed_filesize = $file_config->allowed_filesize*1024*1024; Context::set('file_config',$file_config); - - // 업로드 가능 용량등에 대한 정보를 세팅 + // Configure upload status such as file size $upload_status = $oFileModel->getUploadStatus(); Context::set('upload_status', $upload_status); - - // upload가능하다고 설정 (내부적으로 캐싱하여 처리) + // Upload enabled (internally caching) $oFileController = &getController('file'); $oFileController->setUploadInfo($editor_sequence, $upload_target_srl); - - // 이미 등록된 파일이 있는지 검사 + // Check if the file already exists if($upload_target_srl) $files_count = $oFileModel->getFilesCount($upload_target_srl); } Context::set('files_count', (int)$files_count); Context::set('allow_fileupload', $allow_fileupload); - - // 에디터 동작을 위한 editor_sequence값 설정 + // Set editor_sequence value Context::set('editor_sequence', $editor_sequence); - - // 파일 첨부 관련 행동을 하기 위해 문서 번호를 upload_target_srl로 설정 - // 신규문서일 경우 upload_target_srl=0 이고 첨부파일 관련 동작이 요청될때 이 값이 변경됨 + // Set the document number to upload_target_srl for file attachments + // If a new document, upload_target_srl = 0. The value becomes changed when file attachment is requested Context::set('upload_target_srl', $upload_target_srl); - - // 문서 혹은 댓글의 primary key값을 세팅한다. + // Set the primary key valueof the document or comments Context::set('editor_primary_key_name', $option->primary_key_name); - - // 내용을 sync 맞추기 위한 content column name을 세팅한다 + // Set content column name to sync contents Context::set('editor_content_key_name', $option->content_key_name); /** - * 에디터 컴포넌트 체크 + * Check editor component **/ $site_module_info = Context::get('site_module_info'); $site_srl = (int)$site_module_info->site_srl; @@ -314,20 +293,19 @@ Context::set('enable_default_component', $enable_default_component); /** - * html_mode 가능한지 변수 설정 + * Variable setting if html_mode is available **/ Context::set('html_mode', $html_mode); /** - * 에디터 세로 크기 설정 + * Set a height of editor **/ Context::set('editor_height', $editor_height); - - // 에디터의 초기화를 수동으로하는 것에 대한 값 체크 + // Check an option whether to start the editor manually Context::set('editor_manual_start', $option->manual_start); /** - * 템플릿을 미리 컴파일해서 컴파일된 소스를 하기 위해 스킨의 경로를 설정 + * Set a skin path to pre-compile the template ?**/ $tpl_path = sprintf('%sskins/%s/', $this->module_path, $skin); $tpl_file = 'editor.html'; @@ -340,24 +318,22 @@ // load editor skin lang Context::loadLang($tpl_path.'lang'); - - // tpl 파일을 compile한 결과를 return + // Return the compiled result from tpl file $oTemplate = new TemplateHandler(); return $oTemplate->compile($tpl_path, $tpl_file); } /** - * @brief 모듈별 설정이 반영된 에디터 template을 return - * getEditor() 와 동일한 결과물을 return하지만 getModuleEditor()는 각 모듈별 추가 설정을 통해 직접 제어되는 설정을 이용하여 에디터를 생성함 + * @brief Return editor template which contains settings of each module + * Result of getModuleEditor() is as same as getEditor(). But getModuleEditor()uses additional settings of each module to generate an editor * - * document/ comment 2가지 종류를 이용함. - * 굳이 나눈 이유는 하나의 모듈에서 2개 종류의 에디터 사용을 위해서인데 게시판이나 블로그등 원글과 그에 연관된 글(댓글)을 위한 용도임. + * 2 types of editors supported; document and comment. + * 2 types of editors can be used on a single module. For instance each for original post and reply port. **/ function getModuleEditor($type = 'document', $module_srl, $upload_target_srl, $primary_key_name, $content_key_name) { - // 지정된 모듈의 에디터 설정을 구해옴 + // Get editor settings of the module $editor_config = $this->getEditorConfig($module_srl); - - // type에 따른 설정 정리 + // Configurations listed according to a type if($type == 'document') { $config->editor_skin = $editor_config->editor_skin; $config->content_style = $editor_config->content_style; @@ -383,23 +359,20 @@ $config->editor_height = $editor_config->comment_editor_height; $config->enable_autosave = 'N'; } - - // 권한 체크를 위한 현재 로그인 사용자의 그룹 설정 체크 + // Check a group_list of the currently logged-in user for permission check if(Context::get('is_logged')) { $logged_info = Context::get('logged_info'); $group_list = $logged_info->group_list; } else { $group_list = array(); } - - // 에디터 옵션 변수를 미리 설정 + // Pre-set option variables of editor $option->skin = $config->editor_skin; $option->content_style = $config->content_style; $option->content_font = $config->content_font; $option->content_font_size = $config->content_font_size; $option->colorset = $config->sel_editor_colorset; - - // 파일 업로드 권한 체크 + // Permission check for file upload $option->allow_fileupload = false; if(count($config->upload_file_grant)) { foreach($group_list as $group_srl => $group_info) { @@ -409,8 +382,7 @@ } } } else $option->allow_fileupload = true; - - // 기본 컴포넌트 사용 권한 + // Permission check for using default components $option->enable_default_component = false; if(count($config->enable_default_component_grant)) { foreach($group_list as $group_srl => $group_info) { @@ -420,8 +392,7 @@ } } } else $option->enable_default_component = true; - - // 확장 컴포넌트 사용 권한 + // Permisshion check for using extended components $option->enable_component = false; if(count($config->enable_component_grant)) { foreach($group_list as $group_srl => $group_info) { @@ -431,8 +402,7 @@ } } } else $option->enable_component = true; - - // HTML 편집 권한 + // HTML editing privileges $enable_html = false; if(count($config->enable_html_grant)) { foreach($group_list as $group_srl => $group_info) { @@ -445,14 +415,11 @@ if($enable_html) $option->disable_html = false; else $option->disable_html = true; - - // 높이 설정 + // Set Height $option->height = $config->editor_height; - - // 자동 저장 유무 옵션 설정 + // Set an option for Auto-save $option->enable_autosave = $config->enable_autosave=='Y'?true:false; - - // 기타 설정 + // Other settings $option->primary_key_name = $primary_key_name; $option->content_key_name = $content_key_name; @@ -460,10 +427,10 @@ } /** - * @brief 자동저장되어 있는 정보를 가져옴 + * @brief Get information which has been auto-saved **/ function getSavedDoc($upload_target_srl) { - // 로그인 회원이면 member_srl, 아니면 ipaddress로 저장되어 있는 문서를 찾음 + // Find a document by using member_srl for logged-in user and ipaddress for non-logged user if(Context::get('is_logged')) { $logged_info = Context::get('logged_info'); $auto_save_args->member_srl = $logged_info->member_srl; @@ -471,34 +438,29 @@ $auto_save_args->ipaddress = $_SERVER['REMOTE_ADDR']; } $auto_save_args->module_srl = Context::get('module_srl'); - // module_srl이 없으면 현재 모듈 + // Get the current module if module_srl doesn't exist if(!$auto_save_args->module_srl) { $current_module_info = Context::get('current_module_info'); $auto_save_args->module_srl = $current_module_info->module_srl; } - - // DB에서 자동저장 데이터 추출 + // Extract auto-saved data from the DB $output = executeQuery('editor.getSavedDocument', $auto_save_args); $saved_doc = $output->data; - - // 자동저장한 결과가 없으면 null값 return + // Return null if no result is auto-saved if(!$saved_doc) return; - - // 자동저장된 값이 혹시 이미 등록된 글인지 확인 + // Check if the auto-saved document already exists $oDocumentModel = &getModel('document'); $oSaved = $oDocumentModel->getDocument($saved_doc->document_srl); if($oSaved->isExists()) return; - - // 자동저장 데이터에 문서번호가 있고 이 번호에 파일이 있다면 파일을 모두 이동하고 - // 해당 문서 번호를 editor_sequence로 세팅함 + // Move all the files if the auto-saved data contains document_srl and file + // Then set document_srl to editor_sequence if($saved_doc->document_srl && $upload_target_srl && !Context::get('document_srl')) { $saved_doc->module_srl = $auto_save_args->module_srl; $oFileController = &getController('file'); $oFileController->moveFile($saved_doc->document_srl, $saved_doc->module_srl, $upload_target_srl); } else if($upload_target_srl) $saved_doc->document_srl = $upload_target_srl; - - // 자동 저장 데이터 변경 + // Change auto-saved data $oEditorController = &getController('editor'); $oEditorController->deleteSavedDoc(false); $oEditorController->doSaveDoc($saved_doc); @@ -507,24 +469,22 @@ } /** - * @brief component의 객체 생성 + * @brief create objects of the component **/ function getComponentObject($component, $editor_sequence = 0, $site_srl = 0) { if(!preg_match('/^[a-zA-Z0-9_-]+$/',$component) || !preg_match('/^[0-9]+$/', $editor_sequence . $site_srl)) return; if(!$this->loaded_component_list[$component][$editor_sequence]) { - // 해당 컴포넌트의 객체를 생성해서 실행 + // Create an object of the component and execute $class_path = sprintf('%scomponents/%s/', $this->module_path, $component); $class_file = sprintf('%s%s.class.php', $class_path, $component); if(!file_exists($class_file)) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); - - // 클래스 파일을 읽은 후 객체 생성 + // Create an object after loading the class file require_once($class_file); $tmp_fn = create_function('$seq,$path', "return new {$component}(\$seq,\$path);"); $oComponent = $tmp_fn($editor_sequence, $class_path); if(!$oComponent) return new Object(-1, sprintf(Context::getLang('msg_component_is_not_founded'), $component)); - - // 설정 정보를 추가 + // Add configuration information $component_info = $this->getComponent($component, $site_srl); $oComponent->setInfo($component_info); $this->loaded_component_list[$component][$editor_sequence] = $oComponent; @@ -534,14 +494,14 @@ } /** - * @brief editor skin 목록을 return + * @brief Return a list of the editor skin **/ function getEditorSkinList() { return FileHandler::readDir('./modules/editor/skins'); } /** - * @brief 에디터 컴포넌트 목록 캐시 파일 이름 return + * @brief Return the cache file name of editor component list **/ function getCacheFile($filter_enabled= true, $site_srl = 0) { $lang = Context::getLangType(); @@ -555,7 +515,7 @@ } /** - * @brief component 목록을 return (DB정보 보함) + * @brief Return a component list (DB Information included) **/ function getComponentList($filter_enabled = true, $site_srl=0, $from_db=false) { $cache_file = $this->getCacheFile(false, $site_srl); @@ -619,7 +579,7 @@ } /** - * @brief compnent의 xml+db정보를 구함 + * @brief Get xml and db information of the component **/ function getComponent($component_name, $site_srl = 0) { $args->component_name = $component_name; @@ -667,28 +627,24 @@ } /** - * @brief component의 xml정보를 읽음 + * @brief Read xml information of the component **/ function getComponentXmlInfo($component) { $lang_type = Context::getLangType(); - - // 요청된 컴포넌트의 xml파일 위치를 구함 + // Get xml file path of the requested components $component_path = sprintf('%s/components/%s/', $this->module_path, $component); $xml_file = sprintf('%sinfo.xml', $component_path); $cache_file = sprintf('./files/cache/editor/%s.%s.php', $component, $lang_type); - - // 캐시된 xml파일이 있으면 include 후 정보 return + // Include and return xml file information if cached file exists if(file_exists($cache_file) && file_exists($xml_file) && filemtime($cache_file) > filemtime($xml_file)) { include($cache_file); return $xml_info; } - - // 캐시된 파일이 없으면 파싱후 캐싱 후 return + // Parse, cache and then return if the cached file doesn't exist $oParser = new XmlParser(); $xml_doc = $oParser->loadXmlFile($xml_file); - - // 정보 정리 + // Component information listed if($xml_doc->component->version && $xml_doc->component->attrs->version == '0.2') { $component_info->component_name = $component; $component_info->title = $xml_doc->component->title->body; @@ -708,8 +664,7 @@ $buff .= sprintf('$xml_info->homepage = "%s";', $component_info->homepage); $buff .= sprintf('$xml_info->license = "%s";', $component_info->license); $buff .= sprintf('$xml_info->license_link = "%s";', $component_info->license_link); - - // 작성자 정보 + // Author information if(!is_array($xml_doc->component->author)) $author_list[] = $xml_doc->component->author; else $author_list = $xml_doc->component->author; @@ -776,8 +731,7 @@ $buff .= sprintf('$xml_info->author[0]->email_address = "%s";', $xml_info->author->email_address); $buff .= sprintf('$xml_info->author[0]->homepage = "%s";', $xml_info->author->homepage); } - - // 추가 변수 정리 (에디터 컴포넌트에서는 text형만 가능) + // List extra variables (text type only for editor component) $extra_vars = $xml_doc->component->extra_vars->var; if($extra_vars) { if(!is_array($extra_vars)) $extra_vars = array($extra_vars); diff --git a/modules/editor/editor.view.php b/modules/editor/editor.view.php index f0ddaa973..8ebd7feb8 100644 --- a/modules/editor/editor.view.php +++ b/modules/editor/editor.view.php @@ -2,32 +2,30 @@ /** * @class editorView * @author NHN (developers@xpressengine.com) - * @brief editor 모듈의 view 클래스 + * @brief view class of the editor module **/ class editorView extends editor { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 컴포넌트의 팝업 출력을 요청을 받는 action + * @brief Action to get a request to display compoenet pop-up **/ function dispEditorPopup() { - // css 파일 추가 + // add a css file Context::addCssFile($this->module_path."tpl/css/editor.css"); - - // 변수 정리 + // List variables $editor_sequence = Context::get('editor_sequence'); $component = Context::get('component'); $site_module_info = Context::get('site_module_info'); $site_srl = (int)$site_module_info->site_srl; - - // component 객체를 받음 + // Get compoenet object $oEditorModel = &getModel('editor'); $oComponent = &$oEditorModel->getComponentObject($component, $editor_sequence, $site_srl); if(!$oComponent->toBool()) { @@ -35,22 +33,19 @@ $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('component_not_founded'); } else { - - // 컴포넌트의 popup url을 출력하는 method실행후 결과를 받음 + // Get the result after executing a method to display popup url of the component $popup_content = $oComponent->getPopupContent(); Context::set('popup_content', $popup_content); - - // 레이아웃을 popup_layout으로 설정 + // Set layout to popup_layout $this->setLayoutFile('popup_layout'); - - // 템플릿 지정 + // Set a template $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('popup'); } } /** - * @brief 컴퍼넌트 정보 보기 + * @brief Get component information **/ function dispEditorComponentInfo() { $component_name = Context::get('component_name'); @@ -68,28 +63,26 @@ } /** - * @brief 모듈의 추가 설정에서 에디터 설정을 하는 form 추가 + * @brief Add a form for editor addition setup **/ function triggerDispEditorAdditionSetup(&$obj) { $current_module_srl = Context::get('module_srl'); $current_module_srls = Context::get('module_srls'); if(!$current_module_srl && !$current_module_srls) { - // 선택된 모듈의 정보를 가져옴 + // Get information of the current module $current_module_info = Context::get('current_module_info'); $current_module_srl = $current_module_info->module_srl; if(!$current_module_srl) return new Object(); } - - // 에디터 설정을 구함 + // Get editors settings $oEditorModel = &getModel('editor'); $editor_config = $oEditorModel->getEditorConfig($current_module_srl); Context::set('editor_config', $editor_config); $oModuleModel = &getModel('module'); - - // 에디터 스킨 목록을 구함 + // Get a list of editor skin $editor_skin_list = FileHandler::readDir(_XE_PATH_.'modules/editor/skins'); Context::set('editor_skin_list', $editor_skin_list); @@ -105,15 +98,12 @@ $content_style_list[$style]->title = $info->title; } Context::set('content_style_list', $content_style_list); - - - // 그룹 목록을 구함 + // Get a group list $oMemberModel = &getModel('member'); $site_module_info = Context::get('site_module_info'); $group_list = $oMemberModel->getGroups($site_module_info->site_srl); Context::set('group_list', $group_list); - - // 템플릿 파일 지정 + // Set a template file $oTemplate = &TemplateHandler::getInstance(); $tpl = $oTemplate->compile($this->module_path.'tpl', 'editor_module_config'); $obj .= $tpl; diff --git a/modules/file/file.admin.controller.php b/modules/file/file.admin.controller.php index 8fb12ec46..084fdd274 100644 --- a/modules/file/file.admin.controller.php +++ b/modules/file/file.admin.controller.php @@ -2,37 +2,34 @@ /** * @class fileAdminController * @author NHN (developers@xpressengine.com) - * @brief file 모듈의 admin controller 클래스 + * @brief admin controller class of the file module **/ class fileAdminController extends file { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 특정 모듈의 첨부파일 모두 삭제 + * @brief Delete the attachment of a particular module **/ function deleteModuleFiles($module_srl) { - // 전체 첨부파일 목록을 구함 + // Get a full list of attachments $args->module_srl = $module_srl; $output = executeQueryArray('file.getModuleFiles',$args); if(!$output) return $output; $files = $output->data; - - // DB에서 삭제 + // Remove from the DB $args->module_srl = $module_srl; $output = executeQuery('file.deleteModuleFiles', $args); if(!$output->toBool()) return $output; - - // 실제 파일 삭제 (일단 약속에 따라서 한번에 삭제) + // Remove the file FileHandler::removeDir( sprintf("./files/attach/images/%s/", $module_srl) ) ; FileHandler::removeDir( sprintf("./files/attach/binaries/%s/", $module_srl) ); - - // DB에서 구한 파일 목록을 삭제 + // Remove the file list obtained from the DB $path = array(); $cnt = count($files); for($i=0;$i<$cnt;$i++) { @@ -42,18 +39,17 @@ $path_info = pathinfo($uploaded_filename); if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; } - - // 해당 글의 첨부파일 디렉토리 삭제 + // Remove a file directory of the document for($i=0;$istop('msg_cart_is_null'); $file_srl_list= explode('|@|', $cart); @@ -61,8 +57,7 @@ if(!$file_count) return $this->stop('msg_cart_is_null'); $oFileController = &getController('file'); - - // 글삭제 + // Delete the post for($i=0;$i<$file_count;$i++) { $file_srl = trim($file_srl_list[$i]); if(!$file_srl) continue; @@ -74,31 +69,29 @@ } /** - * @brief 파일 기본 정보의 추가 + * @brief Add file information **/ function procFileAdminInsertConfig() { - // 설정 정보를 받아옴 (module model 객체를 이용) + // Get configurations (using module model object) $config->allowed_filesize = Context::get('allowed_filesize'); $config->allowed_attach_size = Context::get('allowed_attach_size'); $config->allowed_filetypes = Context::get('allowed_filetypes'); $config->allow_outlink = Context::get('allow_outlink'); $config->allow_outlink_format = Context::get('allow_outlink_format'); $config->allow_outlink_site = Context::get('allow_outlink_site'); - - // module Controller 객체 생성하여 입력 + // Create module Controller object $oModuleController = &getController('module'); $output = $oModuleController->insertModuleConfig('file',$config); return $output; } /** - * @brief 모듈별 파일 기본 정보의 추가 + * @brief Add file information for each module **/ function procFileAdminInsertModuleConfig() { - // 필요한 변수를 받아옴 + // Get variables $module_srl = Context::get('target_module_srl'); - - // 여러개의 모듈 일괄 설정일 경우 + // In order to configure multiple modules at once if(preg_match('/^([0-9,]+)$/',$module_srl)) $module_srl = explode(',',$module_srl); else $module_srl = array($module_srl); diff --git a/modules/file/file.admin.model.php b/modules/file/file.admin.model.php index ea3386510..3e58858f0 100644 --- a/modules/file/file.admin.model.php +++ b/modules/file/file.admin.model.php @@ -2,22 +2,22 @@ /** * @class fileAdminModel * @author NHN (developers@xpressengine.com) - * @brief file 모듈의 admin model 클래스 + * @brief admin model class of the file module **/ class fileAdminModel extends file { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 모든 첨부파일을 시간 역순으로 가져옴 (관리자용) + * @brief Get all the attachments in order by time descending (for administrators) **/ function getFileList($obj) { - // 검색 옵션 정리 + // Search options $search_target = $obj->search_target?$obj->search_target:trim(Context::get('search_target')); $search_keyword = $obj->search_keyword?$obj->search_keyword:trim(Context::get('search_keyword')); @@ -59,27 +59,22 @@ break; } } - - // 유효/대기 상태 설정 + // Set valid/invalid state if($obj->isvalid == 'Y') $args->isvalid = 'Y'; elseif($obj->isvalid == 'N') $args->isvalid = 'N'; - - // 멀티미디어/ 일반 상태 설정 + // Set multimedia/common file if($obj->direct_download == 'Y') $args->direct_download = 'Y'; elseif($obj->direct_download == 'N') $args->direct_download= 'N'; - - // 변수 설정 + // Set variables $args->sort_index = $obj->sort_index; $args->page = $obj->page?$obj->page:1; $args->list_count = $obj->list_count?$obj->list_count:20; $args->page_count = $obj->page_count?$obj->page_count:10; $args->s_module_srl = $obj->module_srl; $args->exclude_module_srl = $obj->exclude_module_srl; - - // file.getFileList쿼리 실행 + // Execute the file.getFileList query $output = executeQuery('file.getFileList', $args); - - // 결과가 없거나 오류 발생시 그냥 return + // Return if no result or an error occurs if(!$output->toBool()||!count($output->data)) return $output; $oFileModel = &getModel('file'); diff --git a/modules/file/file.admin.view.php b/modules/file/file.admin.view.php index 5945b7324..1c23107e3 100644 --- a/modules/file/file.admin.view.php +++ b/modules/file/file.admin.view.php @@ -2,35 +2,33 @@ /** * @class fileAdminView * @author NHN (developers@xpressengine.com) - * @brief file 모듈의 admin view 클래스 + * @brief admin view of the module class file **/ class fileAdminView extends file { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 목록 출력 (관리자용) + * @brief Display output list (for administrator) **/ function dispFileAdminList() { - // 목록을 구하기 위한 옵션 - $args->page = Context::get('page'); ///< 페이지 - $args->list_count = 30; ///< 한페이지에 보여줄 글 수 - $args->page_count = 10; ///< 페이지 네비게이션에 나타날 페이지의 수 + // Options to get a list + $args->page = Context::get('page'); // /< Page + $args->list_count = 30; // /< Number of documents that appear on a single page + $args->page_count = 10; // /< Number of pages that appear in the page navigation - $args->sort_index = 'file_srl'; ///< 소팅 값 + $args->sort_index = 'file_srl'; // /< Sorting values $args->isvalid = Context::get('isvalid'); $args->module_srl = Context::get('module_srl'); - - // 목록 구함 + // Get a list $oFileModel = &getAdminModel('file'); $output = $oFileModel->getFileList($args); - - // 목록의 loop를 돌면서 document를 구하기 + // Get the document for looping a list if($output->data) { $oCommentModel = &getModel('comment'); $oDocumentModel = &getModel('document'); @@ -50,10 +48,9 @@ $target_srl = $file->upload_target_srl; $file_update_args = null; $file_update_args->file_srl = $file_srl; - - // upload_target_type이 없으면 찾아서 업데이트 + // Find and update if upload_target_type doesn't exist if(!$file->upload_target_type) { - // 찾아둔게 있으면 패스 + // Pass if upload_target_type is already found if($document_list[$target_srl]) { $file->upload_target_type = 'doc'; } else if($comment_list[$target_srl]) { @@ -79,7 +76,7 @@ $doc_srls[] = $comment->document_srl; } } - // module (페이지인 경우) + // module (for a page) if(!$file->upload_target_type) { $module = $oModuleModel->getModulesInfo($target_srl); if($module) { @@ -92,8 +89,7 @@ executeQuery('file.updateFileTargetType', $file_update_args); } } - - // 이미 구해진 데이터가 있는 확인 + // Check if data is already obtained for($i = 0; $i < $com_srls_count; ++$i) { if($comment_list[$com_srls[$i]]) delete($com_srls[$i]); } @@ -114,13 +110,11 @@ $file_list[$file_srl] = $file; $mod_srls[] = $file->module_srl; } - - // 중복 제거 + // Remove duplication $doc_srls = array_unique($doc_srls); $com_srls = array_unique($com_srls); $mod_srls = array_unique($mod_srls); - - // 댓글 목록 + // Comment list $com_srls_count = count($com_srls); if($com_srls_count) { $comment_output = $oCommentModel->getComments($com_srls); @@ -129,8 +123,7 @@ $doc_srls[] = $comment->document_srl; } } - - // 문서 목록 + // Document list $doc_srls_count = count($doc_srls); if($doc_srls_count) { $document_output = $oDocumentModel->getDocuments($doc_srls); @@ -138,8 +131,7 @@ $document_list[$document->document_srl] = $document; } } - - // 모듈 목록 + // Module List $mod_srls_count = count($mod_srls); if($mod_srls_count) { $module_output = $oModuleModel->getModulesInfo($mod_srls); @@ -164,21 +156,19 @@ Context::set('total_page', $output->total_page); Context::set('page', $output->page); Context::set('page_navigation', $output->page_navigation); - - // 템플릿 지정 + // Set a template $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('file_list'); } /** - * @brief 첨부파일 정보 설정 (관리자용) + * @brief Set attachment information (for administrator) **/ function dispFileAdminConfig() { $oFileModel = &getModel('file'); $config = $oFileModel->getFileConfig(); Context::set('config',$config); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('file_config'); } diff --git a/modules/file/file.class.php b/modules/file/file.class.php index 722000cf3..596f7ca78 100644 --- a/modules/file/file.class.php +++ b/modules/file/file.class.php @@ -2,29 +2,26 @@ /** * @class file * @author NHN (developers@xpressengine.com) - * @brief file 모듈의 high 클래스 + * @brief high class of the file module **/ class file extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // action forward에 등록 (관리자 모드에서 사용하기 위함) + // Register action forward (to use in administrator mode) $oModuleController = &getController('module'); - - // 첨부파일의 기본 설정 저장 + // Save the default settings for attachments $config->allowed_filesize = '2'; $config->allowed_attach_size = '2'; $config->allowed_filetypes = '*.*'; $oModuleController->insertModuleConfig('file', $config); - - // file 모듈에서 사용할 디렉토리 생성 + // Generate a directory for the file module FileHandler::makeDir('./files/attach/images'); FileHandler::makeDir('./files/attach/binaries'); - - // 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록 + // 2007. 10. 17 Create a trigger to insert, update, delete documents and comments $oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before'); $oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after'); $oModuleController->insertTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before'); @@ -35,27 +32,23 @@ $oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before'); $oModuleController->insertTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after'); $oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'); - - // 2009. 6. 9 자동저장문서 삭제시 첨부 파일도 같이 삭제 + // 2009. 6. 9 Delete all the attachements when auto-saved document is deleted $oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after'); - - // 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가 + // 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted $oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after'); - - // 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출 + // 2007. 10. 19 Call a trigger to set up the file permissions before displaying $oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before'); return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { $oDB = &DB::getInstance(); $oModuleModel = &getModel('module'); - - // 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록 + // 2007. 10. 17 Create a trigger to insert, update, delete documents and comments if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true; if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerAttachFiles', 'after')) return true; if(!$oModuleModel->getTrigger('document.updateDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) return true; @@ -66,31 +59,26 @@ if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentCheckAttached', 'before')) return true; if(!$oModuleModel->getTrigger('comment.updateComment', 'file', 'controller', 'triggerCommentAttachFiles', 'after')) return true; if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) return true; - - // 2009. 6. 9 자동저장문서 삭제시 첨부 파일도 같이 삭제 + // 2009. 6. 9 Delete all the attachements when auto-saved document is deleted if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) return true; - - // 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가 + // 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) return true; - - // 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출 + // 2007. 10. 19 Call a trigger to set up the file permissions before displaying if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) return true; - - // 타겟 판별용 필드 + // A column to determine a target type if(!$oDB->isColumnExists('files', 'upload_target_type')) return true; return false; } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { $oDB = &DB::getInstance(); $oModuleModel = &getModel('module'); $oModuleController = &getController('module'); - - // 2007. 10. 17 글/댓글의 입력/수정/삭제에 대한 trigger 등록 + // 2007. 10. 17 Create a trigger to insert, update, delete documents and comments if(!$oModuleModel->getTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before')) $oModuleController->insertTrigger('document.insertDocument', 'file', 'controller', 'triggerCheckAttached', 'before'); @@ -120,27 +108,23 @@ if(!$oModuleModel->getTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after')) $oModuleController->insertTrigger('comment.deleteComment', 'file', 'controller', 'triggerCommentDeleteAttached', 'after'); - - // 2009. 6. 9 자동저장문서 삭제시 첨부 파일도 같이 삭제 + // 2009. 6. 9 Delete all the attachements when auto-saved document is deleted if(!$oModuleModel->getTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after')) $oModuleController->insertTrigger('editor.deleteSavedDoc', 'file', 'controller', 'triggerDeleteAttached', 'after'); - - // 2007. 10. 17 모듈이 삭제될때 등록된 첨부파일도 모두 삭제하는 트리거 추가 + // 2007. 10. 17 Create a trigger to delete all the attachements when the module is deleted if(!$oModuleModel->getTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after')) $oModuleController->insertTrigger('module.deleteModule', 'file', 'controller', 'triggerDeleteModuleFiles', 'after'); - - // 2007. 10. 19 출력하기 전에 file 권한등을 세팅하는 트리거 호출 + // 2007. 10. 19 Call a trigger to set up the file permissions before displaying if(!$oModuleModel->getTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before')) $oModuleController->insertTrigger('module.dispAdditionSetup', 'file', 'view', 'triggerDispFileAdditionSetup', 'before'); - - // 타겟 판별용 필드 + // A column to determine a target type if(!$oDB->isColumnExists('files', 'upload_target_type')) $oDB->addColumn('files', 'upload_target_type', 'char', '3'); return new Object(0, 'success_updated'); } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { } diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index 89c4abf04..8efc2e040 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -2,44 +2,41 @@ /** * @class fileController * @author NHN (developers@xpressengine.com) - * @brief file 모듈의 controller 클래스 + * @brief controller class of the file module **/ class fileController extends file { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 에디터에서 첨부파일 업로드 - * editor_sequence, uploadTargetSrl 변수값을 받아서 이를 바탕으로 첨부 대상 srl을 결정함. - * 만약 uploadTargetSrl이 없다면 새로 생성하고 return 하여 UI에서 이에 대한 값을 재설정하도록 하여 - * sync이상없도록 함 + * @brief Upload attachments in the editor + * Determine the upload target srl from editor_sequence and uploadTargetSrl variables. + * Create and return the UploadTargetSrl if not exists so that UI can use the value + * for sync. **/ function procFileUpload() { $file_info = Context::get('Filedata'); - // 정상적으로 업로드된 파일이 아니면 오류 출력 + // An error appears if not a normally uploaded file if(!is_uploaded_file($file_info['tmp_name'])) exit(); - // 기본적으로 필요한 변수 설정 + // Basic variables setting $oFileModel = &getModel('file'); $editor_sequence = Context::get('editor_sequence'); $upload_target_srl = intval(Context::get('uploadTargetSrl')); if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); $module_srl = $this->module_srl; - - // 업로드 권한이 없거나 정보가 없을시 종료 + // Exit a session if there is neither upload permission nor information if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); - - // upload_target_srl 값이 명시되지 않았을 경우 세션정보에서 추출 + // Extract from session information if upload_target_srl is not specified if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; - - // 세션정보에도 정의되지 않았다면 새로 생성 + // Create if upload_target_srl is not defined in the session information if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); @@ -48,32 +45,28 @@ /** - * @brief iframe 첨부파일 업로드 + * @brief iframe upload attachments **/ function procFileIframeUpload() { - // 기본적으로 필요한 변수 설정 + // Basic variables setting $editor_sequence = Context::get('editor_sequence'); $callback = Context::get('callback'); $module_srl = $this->module_srl; $upload_target_srl = intval(Context::get('uploadTargetSrl')); if(!$upload_target_srl) $upload_target_srl = intval(Context::get('upload_target_srl')); - // 업로드 권한이 없거나 정보가 없을시 종료 + // Exit a session if there is neither upload permission nor information if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); - - // upload_target_srl 값이 명시되지 않았을 경우 세션정보에서 추출 + // Extract from session information if upload_target_srl is not specified if(!$upload_target_srl) $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; - - // 세션정보에도 정의되지 않았다면 새로 생성 + // Create if upload_target_srl is not defined in the session information if(!$upload_target_srl) $_SESSION['upload_info'][$editor_sequence]->upload_target_srl = $upload_target_srl = getNextSequence(); - - // file_srl이 요청되었을 경우 삭제 후 재업로드 시도 + // Delete and then attempt to re-upload if file_srl is requested $file_srl = Context::get('file_srl'); if($file_srl) $this->deleteFile($file_srl); $file_info = Context::get('Filedata'); - - // 정상적으로 업로드된 파일이 아니면 오류 출력 + // An error appears if not a normally uploaded file if(is_uploaded_file($file_info['tmp_name'])) { $output = $this->insertFile($file_info, $module_srl, $upload_target_srl); Context::set('uploaded_fileinfo',$output); @@ -116,10 +109,10 @@ /** - * @brief 첨부파일 다운로드 - * 직접 요청을 받음 - * file_srl : 파일의 sequence - * sid : db에 저장된 비교 값, 틀리면 다운로드 하지 않음 + * @brief Download Attachment + * Receive a request directly + * file_srl: File sequence + * sid : value in DB for comparison, No download if not matched **/ function procFileDownload() { $oFileModel = &getModel('file'); @@ -127,23 +120,18 @@ $file_srl = Context::get('file_srl'); $sid = Context::get('sid'); $logged_info = Context::get('logged_info'); - - // 파일의 정보를 DB에서 받아옴 + // Get file information from the DB $file_obj = $oFileModel->getFile($file_srl); - - // 요청된 파일 정보가 잘못되었다면 파일을 찾을 수 없다는 오류 출력 + // If the requested file information is incorrect, an error that file cannot be found appears if($file_obj->file_srl!=$file_srl || $file_obj->sid!=$sid) return $this->stop('msg_file_not_found'); - - // 대기 상태일 경우 파일 다운로드 권한이 없음을 알림 (최고관리자는 다운 로드 허용) + // Notify that file download is not allowed when standing-by(Only a top-administrator is permitted) if($logged_info->is_admin != 'Y' && $file_obj->isvalid!='Y') return $this->stop('msg_not_permitted_download'); - - // 파일 이름 + // File name $filename = $file_obj->source_filename; $file_module_config = $oFileModel->getFileModuleConfig($file_obj->module_srl); - - // 파일 외부링크 차단 + // Not allow the file outlink if($file_module_config->allow_outlink == 'N') { - //외부링크 허용 확장자 처리 + // Handles extension to allow outlink if($file_module_config->allow_outlink_format) { $allow_outlink_format_array = array(); $allow_outlink_format_array = explode(',', $file_module_config->allow_outlink_format); @@ -157,7 +145,7 @@ } } } - //외부링크 허용 사이트 처리 + // Sites that outlink is allowed if($file_module_config->allow_outlink != 'Y') { $referer = parse_url($_SERVER["HTTP_REFERER"]); if($referer['host'] != $_SERVER['HTTP_HOST']) { @@ -179,8 +167,7 @@ } if($file_module_config->allow_outlink != 'Y') return $this->stop('msg_not_allowed_outlink'); } - - // 파일 다운로드 권한이 있는지 확인 + // Check if a permission for file download is granted if(is_array($file_module_config->download_grant) && count($file_module_config->download_grant)>0) { if(!Context::get('is_logged')) return $this->stop('msg_not_permitted_download'); $logged_info = Context::get('logged_info'); @@ -206,12 +193,10 @@ } } } - - // trigger 호출 (before) + // Call a trigger (before) $output = ModuleHandler::triggerCall('file.downloadFile', 'before', $file_obj); if(!$output->toBool()) return $this->stop(($output->message)?$output->message:'msg_not_permitted_download'); - - // 파일 출력 + // File Output if(strstr($_SERVER['HTTP_USER_AGENT'], "MSIE")) { $filename = rawurlencode($filename); $filename = preg_replace('/\./', '%2e', $filename, substr_count($filename, '.') - 1); @@ -240,11 +225,10 @@ fpassthru($fp); } - // 이상이 없으면 download_count 증가 + // Increase download_count $args->file_srl = $file_srl; executeQuery('file.updateFileDownloadCount', $args); - - // trigger 호출 (after) + // Call a trigger (after) $output = ModuleHandler::triggerCall('file.downloadFile', 'after', $file_obj); Context::close(); @@ -253,16 +237,15 @@ } /** - * @brief 에디터에서 첨부 파일 삭제 + * @brief Delete an attachment from the editor **/ function procFileDelete() { - // 기본적으로 필요한 변수인 upload_target_srl, module_srl을 설정 + // Basic variable setting(upload_target_srl and module_srl set) $editor_sequence = Context::get('editor_sequence'); $file_srl = Context::get('file_srl'); $file_srls = Context::get('file_srls'); if($file_srls) $file_srl = $file_srls; - - // 업로드 권한이 없거나 정보가 없을시 종료 + // Exit a session if there is neither upload permission nor information if(!$_SESSION['upload_info'][$editor_sequence]->enabled) exit(); $upload_target_srl = $_SESSION['upload_info'][$editor_sequence]->upload_target_srl; @@ -270,13 +253,12 @@ } /** - * @brief 특정 upload_target_srl(document_srl)에 등록된 첨부파일의 갯수를 return하는 trigger + * @brief A trigger to return numbers of attachments in the upload_target_srl (document_srl) **/ function triggerCheckAttached(&$obj) { $document_srl = $obj->document_srl; if(!$document_srl) return new Object(); - - // 첨부 파일의 갯수를 구함 + // Get numbers of attachments $oFileModel = &getModel('file'); $obj->uploaded_count = $oFileModel->getFilesCount($document_srl); @@ -284,7 +266,7 @@ } /** - * @brief 특정 upload_target_srl(document_srl)에 등록된 첨부파일을 연결하는 trigger + * @brief A trigger to link the attachment with the upload_target_srl (document_srl) **/ function triggerAttachFiles(&$obj) { $document_srl = $obj->document_srl; @@ -297,7 +279,7 @@ } /** - * @brief 특정 upload_target_srl(document_srl)에 등록된 첨부파일을 삭제하는 trigger + * @brief A trigger to delete the attachment in the upload_target_srl (document_srl) **/ function triggerDeleteAttached(&$obj) { $document_srl = $obj->document_srl; @@ -308,13 +290,12 @@ } /** - * @brief 특정 upload_target_srl(comment_srl)에 등록된 첨부파일의 갯수를 return하는 trigger + * @brief A trigger to return numbers of attachments in the upload_target_srl (comment_srl) **/ function triggerCommentCheckAttached(&$obj) { $comment_srl = $obj->comment_srl; if(!$comment_srl) return new Object(); - - // 첨부 파일의 갯수를 구함 + // Get numbers of attachments $oFileModel = &getModel('file'); $obj->uploaded_count = $oFileModel->getFilesCount($comment_srl); @@ -322,7 +303,7 @@ } /** - * @brief 특정 upload_target_srl(comment_srl)에 등록된 첨부파일을 연결하는 trigger + * @brief A trigger to link the attachment with the upload_target_srl (comment_srl) **/ function triggerCommentAttachFiles(&$obj) { $comment_srl = $obj->comment_srl; @@ -336,7 +317,7 @@ } /** - * @brief 특정 upload_target_srl(comment_srl)에 등록된 첨부파일을 삭제하는 trigger + * @brief A trigger to delete the attachment in the upload_target_srl (comment_srl) **/ function triggerCommentDeleteAttached(&$obj) { $comment_srl = $obj->comment_srl; @@ -347,7 +328,7 @@ } /** - * @brief module 삭제시 해당 첨부파일 모두 삭제하는 trigger + * @brief A trigger to delete all the attachements when deleting the module **/ function triggerDeleteModuleFiles(&$obj) { $module_srl = $obj->module_srl; @@ -358,7 +339,7 @@ } /** - * @brief 업로드 가능하다고 세팅 + * @brief Upload enabled **/ function setUploadInfo($editor_sequence, $upload_target_srl=0) { $_SESSION['upload_info'][$editor_sequence]->enabled = true; @@ -366,8 +347,8 @@ } /** - * @brief 특정 upload_target_srl의 첨부파일들의 상태를 유효로 변경 - * 글이 등록될때 글에 첨부된 파일들의 상태를 유효상태로 변경함으로서 관리시 불필요 파일로 인식되지 않도록 함 + * @brief Set the attachements of the upload_target_srl to be valid + * By changing its state to valid when a document is inserted, it prevents from being considered as a unnecessary file **/ function setFilesValid($upload_target_srl) { $args->upload_target_srl = $upload_target_srl; @@ -375,10 +356,10 @@ } /** - * @brief 첨부파일 추가 + * @brief Add an attachement **/ function insertFile($file_info, $module_srl, $upload_target_srl, $download_count = 0, $manual_insert = false) { - // trigger 호출 (before) + // Call a trigger (before) $trigger_obj->module_srl = $module_srl; $trigger_obj->upload_target_srl = $upload_target_srl; $output = ModuleHandler::triggerCall('file.insertFile', 'before', $trigger_obj); @@ -390,19 +371,16 @@ } if(!$manual_insert) { - // 첨부파일 설정 가져옴 + // Get the file configurations $logged_info = Context::get('logged_info'); if($logged_info->is_admin != 'Y') { $oFileModel = &getModel('file'); $config = $oFileModel->getFileConfig($module_srl); $allowed_filesize = $config->allowed_filesize * 1024 * 1024; $allowed_attach_size = $config->allowed_attach_size * 1024 * 1024; - - // 한 파일당 허용 용량 초과시 오류 출력 + // An error appears if file size exceeds a limit if($allowed_filesize < filesize($file_info['tmp_name'])) return new Object(-1, 'msg_exceeds_limit_size'); - - - // 해당 문서에 첨부된 모든 파일의 용량을 가져옴 (DB에서 가져옴) + // Get total file size of all attachements (from DB) $size_args->upload_target_srl = $upload_target_srl; $output = executeQuery('file.getAttachedFileSize', $size_args); $attached_size = (int)$output->data->attached_size + filesize($file_info['tmp_name']); @@ -410,9 +388,9 @@ } } - // 이미지인지 기타 파일인지 체크하여 upload path 지정 + // Set upload path by checking if the attachement is an image or other kinds of file if(preg_match("/\.(jpe?g|gif|png|wm[va]|mpe?g|avi|swf|flv|mp[1-4]|as[fx]|wav|midi?|moo?v|qt|r[am]{1,2}|m4v)$/i", $file_info['name'])) { - // direct 파일에 해킹을 의심할 수 있는 확장자가 포함되어 있으면 바로 삭제함 + // Immediately remove the direct file if it has any kind of extensions for hacking $file_info['name'] = preg_replace('/\.(php|phtm|html?|cgi|pl|exe|jsp|asp|inc)/i', '$0-x',$file_info['name']); $file_info['name'] = str_replace(array('<','>'),array('%3C','%3E'),$file_info['name']); @@ -435,11 +413,9 @@ $filename = $path.md5(crypt(rand(1000000,900000), rand(0,100))); $direct_download = 'N'; } - - // 디렉토리 생성 + // Create a directory if(!FileHandler::makeDir($path)) return new Object(-1,'msg_not_permitted_create'); - - // 파일 이동 + // Move the file if($manual_insert) { @copy($file_info['tmp_name'], $filename); if(!file_exists($filename)) { @@ -452,12 +428,10 @@ if(!@move_uploaded_file($file_info['tmp_name'], $filename)) return new Object(-1,'msg_file_upload_error'); } } - - // 사용자 정보를 구함 + // Get member information $oMemberModel = &getModel('member'); $member_srl = $oMemberModel->getLoggedMemberSrl(); - - // 파일 정보를 정리 + // List file information $args->file_srl = getNextSequence(); $args->upload_target_srl = $upload_target_srl; $args->module_srl = $module_srl; @@ -472,8 +446,7 @@ $output = executeQuery('file.insertFile', $args); if(!$output->toBool()) return $output; - - // trigger 호출 (after) + // Call a trigger (after) $trigger_output = ModuleHandler::triggerCall('file.insertFile', 'after', $args); if(!$trigger_output->toBool()) return $trigger_output; @@ -488,7 +461,7 @@ } /** - * @brief 첨부파일 삭제 + * @brief Delete the attachment **/ function deleteFile($file_srl) { if(!$file_srl) return; @@ -510,21 +483,17 @@ $source_filename = $output->data->source_filename; $uploaded_filename = $output->data->uploaded_filename; - - // trigger 호출 (before) + // Call a trigger (before) $trigger_obj = $output->data; $output = ModuleHandler::triggerCall('file.deleteFile', 'before', $trigger_obj); if(!$output->toBool()) return $output; - - // DB에서 삭제 + // Remove from the DB $output = executeQuery('file.deleteFile', $args); if(!$output->toBool()) return $output; - - // trigger 호출 (after) + // Call a trigger (after) $trigger_output = ModuleHandler::triggerCall('file.deleteFile', 'after', $trigger_obj); if(!$trigger_output->toBool()) return $trigger_output; - - // 삭제 성공하면 파일 삭제 + // If successfully deleted, remove the file FileHandler::removeFile($uploaded_filename); } @@ -532,22 +501,19 @@ } /** - * @brief 특정 문서의 첨부파일을 모두 삭제 + * @brief Delete all attachments of a particular document **/ function deleteFiles($upload_target_srl) { - // 첨부파일 목록을 받음 + // Get a list of attachements $oFileModel = &getModel('file'); $file_list = $oFileModel->getFiles($upload_target_srl); - - // 첨부파일이 없으면 성공 return + // Success returned if no attachement exists if(!is_array($file_list)||!count($file_list)) return new Object(); - - // DB에서 삭제 + // Remove from the DB $args->upload_target_srl = $upload_target_srl; $output = executeQuery('file.deleteFiles', $args); if(!$output->toBool()) return $output; - - // 실제 파일 삭제 + // Delete the file $path = array(); $file_count = count($file_list); for($i=0;$i<$file_count;$i++) { @@ -558,15 +524,14 @@ $path_info = pathinfo($uploaded_filename); if(!in_array($path_info['dirname'], $path)) $path[] = $path_info['dirname']; } - - // 해당 글의 첨부파일 디렉토리 삭제 + // Remove a file directory of the document for($i=0;$iuploaded_filename; - - // 이미지인지 기타 파일인지 체크하여 이동할 위치 정함 + // Determine the file path by checking if the file is an image or other kinds if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_info->source_filename)) { $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl); $new_file = $path.$file_info->source_filename; @@ -591,17 +555,13 @@ $path = sprintf("./files/attach/binaries/%s/%s/", $target_module_srl, $target_srl); $new_file = $path.md5(crypt(rand(1000000,900000), rand(0,100))); } - - // 이전 대상이 동일하면 그냥 패스 + // Pass if a target document to move is same if($old_file == $new_file) continue; - - // 디렉토리 생성 + // Create a directory FileHandler::makeDir($path); - - // 파일 이동 + // Move the file FileHandler::rename($old_file, $new_file); - - // DB 정보도 수정 + // Update DB information unset($args); $args->file_srl = $file_info->file_srl; $args->uploaded_filename = $new_file; @@ -612,7 +572,7 @@ } /** - * @brief upload_target_srl을 키로 하는 첨부파일을 찾아서 java script 코드로 return + * @brief Find the attachment where a key is upload_target_srl and then return java script code **/ function printUploadedFileList($editor_sequence, $upload_target_srl) { return; diff --git a/modules/file/file.model.php b/modules/file/file.model.php index d1f9e961e..d95daca9d 100644 --- a/modules/file/file.model.php +++ b/modules/file/file.model.php @@ -2,21 +2,21 @@ /** * @class fileModel * @author NHN (developers@xpressengine.com) - * @brief file 모듈의 model 클래스 + * @brief model class of the file module **/ class fileModel extends file { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 특정 문서에 속한 첨부파일 목록을 return - * 문서 생성/ 수정시 ajax로 특정 upload_target_srl에 대해서 파일 목록을 요청받을 때 사용됨. - * upload_target_srl이 정해지지 않은 경우 서버측 session의 값으로 대체 시도 + * @brief Return a file list attached in the document + * It is used when a file list of the upload_target_srl is requested for creating/updating a document. + * Attempt to replace with sever-side session if upload_target_srl is not yet determined **/ function getFileList() { $oModuleModel = &getModel('module'); @@ -50,16 +50,13 @@ $attached_size = 0; $files = array(); } - - // 업로드 상태 표시 작성 + // Display upload status $upload_status = $this->getUploadStatus($attached_size); - - // 남은 용량 체크 + // Check remained file size until upload complete $config = $oModuleModel->getModuleInfoByMid($mid); $file_config = $this->getUploadConfig(); $left_size = $file_config->allowed_attach_size*1024*1024 - $attached_size; - - // 필요한 정보들 세팅 + // Settings of required information $this->add("files",$files); $this->add("editor_sequence",$editor_sequence); $this->add("upload_target_srl",$upload_target_srl); @@ -68,7 +65,7 @@ } /** - * @brief 특정 문서에 속한 첨부파일의 개수를 return + * @brief Return number of attachments which belongs to a specific document **/ function getFilesCount($upload_target_srl) { $args->upload_target_srl = $upload_target_srl; @@ -77,17 +74,17 @@ } /** - * @brief 다운로드 경로를 구함 + * @brief Get a download path **/ function getDownloadUrl($file_srl, $sid) { return sprintf('?module=%s&act=%s&file_srl=%s&sid=%s', 'file', 'procFileDownload', $file_srl, $sid); } /** - * @brief 파일 설정 정보를 구함 + * @brief Get file cinfigurations **/ function getFileConfig($module_srl = null) { - // 설정 정보를 받아옴 (module model 객체를 이용) + // Get configurations (using module model object) $oModuleModel = &getModel('module'); $file_module_config = $oModuleModel->getModuleConfig('file'); @@ -104,8 +101,7 @@ $config->allow_outlink_site = $file_config->allow_outlink_site; $config->allow_outlink_format = $file_config->allow_outlink_format; } - - // 전체 파일첨부 속성을 먼저 따른다 + // Property for all files comes first than each property if(!$config->allowed_filesize) $config->allowed_filesize = $file_module_config->allowed_filesize; if(!$config->allowed_attach_size) $config->allowed_attach_size = $file_module_config->allowed_attach_size; if(!$config->allowed_filetypes) $config->allowed_filetypes = $file_module_config->allowed_filetypes; @@ -113,8 +109,7 @@ if(!$config->allow_outlink_site) $config->allow_outlink_site = $file_module_config->allow_outlink_site; if(!$config->allow_outlink_format) $config->allow_outlink_format = $file_module_config->allow_outlink_format; if(!$config->download_grant) $config->download_grant = $file_module_config->download_grant; - - // 그래도 없으면 default로 + // Default setting if not exists if(!$config->allowed_filesize) $config->allowed_filesize = '2'; if(!$config->allowed_attach_size) $config->allowed_attach_size = '3'; if(!$config->allowed_filetypes) $config->allowed_filetypes = '*.*'; @@ -125,7 +120,7 @@ } /** - * @brief 파일 정보를 구함 + * @brief Get file information **/ function getFile($file_srl) { $args->file_srl = $file_srl; @@ -139,7 +134,7 @@ } /** - * @brief 특정 문서에 속한 파일을 모두 return + * @brief Return all files which belong to a specific document **/ function getFiles($upload_target_srl) { $args->upload_target_srl = $upload_target_srl; @@ -163,7 +158,7 @@ } /** - * @brief 첨부파일에 대한 설정을 return (관리자/비관리자 자동 구분) + * @brief Return configurations of the attachement (it automatically checks if an administrator is) **/ function getUploadConfig() { $logged_info = Context::get('logged_info'); @@ -173,7 +168,7 @@ $file_config->allowed_filetypes = '*.*'; } else { $module_srl = Context::get('module_srl'); - // module_srl이 없으면 현재 모듈 + // Get the current module if module_srl doesn't exist if(!$module_srl) { $current_module_info = Context::get('current_module_info'); $module_srl = $current_module_info->module_srl; @@ -184,12 +179,11 @@ } /** - * @brief 파일 업로드를 위한 관리자/비관리자에 따른 안내문구 return + * @brief Return messages for file upload and it depends whether an admin is or not **/ function getUploadStatus($attached_size = 0) { $file_config = $this->getUploadConfig(); - - // 업로드 상태 표시 작성 + // Display upload status $upload_status = sprintf( '%s : %s/ %s
%s : %s (%s : %s)', Context::getLang('allowed_attach_size'), @@ -204,7 +198,7 @@ } /** - * @brief 특정 모듈의 file 설정을 return + * @brief Return file configuration of the module **/ function getFileModuleConfig($module_srl) { return $this->getFileConfig($module_srl); diff --git a/modules/file/file.view.php b/modules/file/file.view.php index aba3b46b6..823d14c1c 100644 --- a/modules/file/file.view.php +++ b/modules/file/file.view.php @@ -2,7 +2,7 @@ /** * @class fileView * @author NHN (developers@xpressengine.com) - * @brief file module의 view class + * @brief The view class file module * * * @@ -11,38 +11,35 @@ class fileView extends file { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 서비스형 모듈의 추가 설정을 위한 부분 - * file의 사용 형태에 대한 설정만 받음 + * @brief This is for additional configuration for service module + * It only receives file configurations **/ function triggerDispFileAdditionSetup(&$obj) { $current_module_srl = Context::get('module_srl'); $current_module_srls = Context::get('module_srls'); if(!$current_module_srl && !$current_module_srls) { - // 선택된 모듈의 정보를 가져옴 + // Get information of the current module $current_module_info = Context::get('current_module_info'); $current_module_srl = $current_module_info->module_srl; if(!$current_module_srl) return new Object(); } - - // 선택된 모듈의 file설정을 가져옴 + // Get file configurations of the module $oFileModel = &getModel('file'); $file_config = $oFileModel->getFileModuleConfig($current_module_srl); Context::set('file_config', $file_config); - - // 그룹의 설정을 위한 권한 가져오기 + // Get a permission for group setting $oMemberModel = &getModel('member'); $site_module_info = Context::get('site_module_info'); $group_list = $oMemberModel->getGroups($site_module_info->site_srl); Context::set('group_list', $group_list); - - // 템플릿 파일 지정 + // Set a template file $oTemplate = &TemplateHandler::getInstance(); $tpl = $oTemplate->compile($this->module_path.'tpl', 'file_module_config'); $obj .= $tpl; diff --git a/modules/importer/extract.class.php b/modules/importer/extract.class.php index c1b192105..e9da32693 100644 --- a/modules/importer/extract.class.php +++ b/modules/importer/extract.class.php @@ -2,7 +2,7 @@ /** * @class extract * @author NHN (developers@xpressengine.com) - * @brief 대용량의 xml파일을 특정 태그를 중심으로 개별 파일로 저장하는 클래스 + * @brief Class to save each file by using tags in the large xml **/ class extract { var $key = ''; @@ -26,7 +26,7 @@ var $index = 0; /** - * @brief 생성자, 대상 파일이름과 시작-끝 태그명, 그리고 각 개별 아이템 태그명을 인자로 받음 + * @brief Get arguments for constructor, file name, start tag, end tag, tag name for each item **/ function set($filename, $startTag, $endTag, $itemTag, $itemEndTag) { $this->filename = $filename; @@ -47,18 +47,16 @@ } /** - * @brief 지정된 파일의 지시자를 염 + * @brief Open an indicator of the file **/ function openFile() { FileHandler::removeFile($this->cache_index_file); $this->index_fd = fopen($this->cache_index_file,"a"); - - // local 파일일 경우 + // If local file if(!preg_match('/^http:/i',$this->filename)) { if(!file_exists($this->filename)) return new Object(-1,'msg_no_xml_file'); $this->fd = fopen($this->filename,"r"); - - // remote 파일일 경우 + // If remote file } else { $url_info = parse_url($this->filename); if(!$url_info['port']) $url_info['port'] = 80; @@ -66,8 +64,7 @@ $this->fd = @fsockopen($url_info['host'], $url_info['port']); if(!$this->fd) return new Object(-1,'msg_no_xml_file'); - - // 한글 파일이 있으면 한글파일 부분만 urlencode하여 처리 (iconv 필수) + // If the file name contains Korean, do urlencode(iconv required) $path = $url_info['path']; if(preg_match('/[\xEA-\xED][\x80-\xFF]{2}/', $path)&&function_exists('iconv')) { $path_list = explode('/',$path); diff --git a/modules/importer/importer.admin.controller.php b/modules/importer/importer.admin.controller.php index 3e223cbe6..ce8e16438 100644 --- a/modules/importer/importer.admin.controller.php +++ b/modules/importer/importer.admin.controller.php @@ -2,7 +2,7 @@ /** * @class importerAdminController * @author NHN (developers@xpressengine.com) - * @brief importer 모듈의 admin controller class + * @brief admin controller class of importer module **/ @set_time_limit(0); @@ -14,13 +14,13 @@ var $oXmlParser = null; /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 회원정보와 게시물 정보를 싱크 + * @brief sync member information with document information **/ function procImporterAdminSync() { /* DBMS가 CUBRID인 경우 MySQL과 동일한 방법으로는 문서 및 댓글에 대한 사용자 정보를 동기화 할 수 없으므로 예외 처리 합니다. @@ -74,16 +74,14 @@ } /** - * @brief XML파일을 미리 분석하여 개발 단위로 캐싱 + * @brief Pre-analyze the xml file and cache it **/ function procImporterAdminPreProcessing() { - // 이전할 대상 xml파일을 구함 + // Get the target xml file to import $xml_file = Context::get('xml_file'); - - // 이전할 대상의 type을 구함 + // Get a type of the target $type = Context::get('type'); - - // xml파일에서 정해진 규칙으로 캐싱 + // Extract and cache information from the xml file $oExtract = new extract(); switch($type) { @@ -96,10 +94,10 @@ if($output->toBool()) $oExtract->saveItems(); break; case 'ttxml' : - // 카테고리 정보를 구함 + // Category information $output = $oExtract->set($xml_file, '', '', '', ''); if ($output->toBool()) { - // ttxml 카테고리는 별도로 구함 + // Get a category of ttxml separately $started = false; $buff = ''; while (!feof($oExtract->fd)) { @@ -117,7 +115,7 @@ FileHandler::writeFile($category_filename, $buff); - // 방명록 정보를 구함 + // Guestbook information $output = $oExtract->set($xml_file, '', '', '', ''); if ($output->toBool()) { $started = false; @@ -140,8 +138,7 @@ $oExtract->closeFile(); $guestbook_filename = sprintf('%s/%s', $oExtract->cache_path, 'guestbook.xml'); FileHandler::writeFile($guestbook_filename, $buff); - - // 개별 아이템 구함 + // Individual items $output = $oExtract->set($xml_file,'', ''); if($output->toBool()) $oExtract->saveItems(); @@ -149,12 +146,11 @@ } break; default : - // 카테고리 정보를 먼저 구함 + // First get category information $output = $oExtract->set($xml_file,'', '', ''); if($output->toBool()) { $oExtract->mergeItems('category.xml'); - - // 개별 아이템 구함 + // Get each item $output = $oExtract->set($xml_file,'', '', ''); if($output->toBool()) $oExtract->saveItems(); } @@ -168,8 +164,7 @@ $this->setMessage($output->getMessage()); return; } - - // extract가 종료됨을 알림 + // Notify that all data completely extracted $this->add('type',$type); $this->add('total',$oExtract->getTotalCount()); $this->add('cur',0); @@ -178,11 +173,10 @@ } /** - * @brief xml파일의 내용이 extract되고 난후 차례대로 마이그레이션 + * @brief Migrate data after completing xml file extraction **/ function procImporterAdminImport() { - - // 변수 설정 + // Variable setting $type = Context::get('type'); $total = Context::get('total'); $cur = Context::get('cur'); @@ -191,9 +185,7 @@ $target_module = Context::get('target_module'); $guestbook_target_module = Context::get('guestbook_target_module'); $this->unit_count = Context::get('unit_count'); - - - // index파일이 있는지 확인 + // Check if an index file exists $index_file = './files/cache/importer/'.$key.'/index'; if(!file_exists($index_file)) return new Object(-1, 'msg_invalid_xml_file'); @@ -215,20 +207,18 @@ $cur = $this->importMember($key, $cur, $index_file); break; case 'module' : - // 타켓 모듈의 유무 체크 + // Check if the target module exists if(!$target_module) return new Object(-1,'msg_invalid_request'); $cur = $this->importModule($key, $cur, $index_file, $target_module); break; } - - // extract가 종료됨을 알림 + // Notify that all data completely extracted $this->add('type',$type); $this->add('total',$total); $this->add('cur',$cur); $this->add('key', $key); $this->add('target_module', $target_module); - - // 모두 입력시 성공 메세지 출력하고 cache 파일제거 + // When completing, success message appears and remove the cache files if($total <= $cur) { $this->setMessage( sprintf(Context::getLang('msg_import_finished'), $cur, $total) ); FileHandler::removeFilesInDir('./files/cache/importer/'.$key); @@ -236,41 +226,32 @@ } /** - * @brief 회원 정보 입력 + * @brief Import member information **/ function importMember($key, $cur, $index_file) { if(!$cur) $cur = 0; - - // xmlParser객체 생성 + // Create the xmlParser object $oXmlParser = new XmlParser(); - - // 회원 입력을 위한 기본 객체들 생성 + // Create objects for importing member information $this->oMemberController = &getController('member'); $this->oMemberModel = &getModel('member'); - - // 기본 회원 그룹을 구함 + // Get a default member group $default_group = $this->oMemberModel->getDefaultGroup(); $default_group_srl = $default_group->group_srl; - - // index파일을 염 + // Open an index file $f = fopen($index_file,"r"); - - // 이미 읽혀진 것은 패스 + // Pass if already read for($i=0;$i<$cur;$i++) fgets($f, 1024); - - // 라인단위로 읽어들이면서 $cur보다 커지고 $cur+$this->unit_count개보다 작으면 중지 + // Read by each line until the condition meets for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) { if(feof($f)) break; - - // 정해진 위치를 찾음 + // Find a given location $target_file = trim(fgets($f, 1024)); - - // 대상 파일을 읽여서 파싱후 입력 + // Load and parse the file $xmlObj = $oXmlParser->loadXmlFile($target_file); FileHandler::removeFile($target_file); if(!$xmlObj) continue; - - // 객체 정리 + // List Objects $obj = null; $obj->user_id = base64_decode($xmlObj->member->user_id->body); $obj->password = base64_decode($xmlObj->member->password->body); @@ -296,71 +277,56 @@ $obj->extra_vars->{$key} = base64_decode($val->body); } } - - // homepage, blog의 url을 정확히 만듬 + // Create url for homepage and blog if($obj->homepage && !preg_match("/^http:\/\//i",$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; if($obj->blog && !preg_match("/^http:\/\//i",$obj->blog)) $obj->blog = 'http://'.$obj->blog; - - // email address 필드 정리 + // email address column $obj->email_address = $obj->email; list($obj->email_id, $obj->email_host) = explode('@', $obj->email); - - // 메일링 허용 체크 + // Set the mailing option if($obj->allow_mailing!='Y') $obj->allow_mailing = 'N'; - - // 쪽지 수신 체크 + // Set the message option $obj->allow_message = 'Y'; if(!in_array($obj->allow_message, array('Y','N','F'))) $obj->allow_message= 'Y'; - - // 최종 로그인 시간이 없으면 가입일을 입력 + // Get member-join date if the last login time is not found if(!$obj->last_login) $obj->last_login = $obj->regdate; - - // 회원 번호를 구함 + // Get a member_srl $obj->member_srl = getNextSequence(); - - // 확장변수의 정리 + // List extra vars $extra_vars = $obj->extra_vars; unset($obj->extra_vars); $obj->extra_vars = serialize($extra_vars); - - // 중복되는 nick_name 데이터가 있는지 체크 + // Check if the same nickname is existing $nick_args = null; $nick_args->nick_name = $obj->nick_name; $nick_output = executeQuery('member.getMemberSrl', $nick_args); if(!$nick_output->toBool()) $obj->nick_name .= '_'.$obj->member_srl; - - // 회원 추가 + // Add a member $output = executeQuery('member.insertMember', $obj); - - // 입력 성공시 그룹 가입/ 이미지이름-마크-서명등을 추가 + // add group join/image name-mark-signiture and so on if a new member successfully added if($output->toBool()) { - - // 기본 그룹 가입 시킴 + // Join to the default group $obj->group_srl = $default_group_srl; executeQuery('member.addMemberToGroup',$obj); - - // 이미지네임 + // Image name if($obj->image_nickname) { $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($obj->member_srl)); $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); FileHandler::writeFile($target_filename, $obj->image_nickname); } - - // 이미지마크 + // Image mark if($obj->image_mark && file_exists($obj->image_mark)) { $target_path = sprintf('files/member_extra_info/image_mark/%s/', getNumberingPath($obj->member_srl)); $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); FileHandler::writeFile($target_filename, $obj->image_mark); } - - // 프로필 이미지 + // Profile image if($obj->profile_image) { $target_path = sprintf('files/member_extra_info/profile_image/%s/', getNumberingPath($obj->member_srl)); $target_filename = sprintf('%s%d.gif', $target_path, $obj->member_srl); FileHandler::writeFile($target_filename, $obj->profile_image); } - - // 서명 + // Signiture if($obj->signature) { $signature = removeHackTag($obj->signature); $signature_buff = sprintf('%s', $signature); @@ -380,33 +346,26 @@ } /** - * @brief 주어진 xml 파일을 파싱해서 쪽지 정보 입력 + * @brief Import message information parsed from a given xml file **/ function importMessage($key, $cur, $index_file) { if(!$cur) $cur = 0; - - // xmlParser객체 생성 + // Create the xmlParser object $oXmlParser = new XmlParser(); - - // index파일을 염 + // Open an index file $f = fopen($index_file,"r"); - - // 이미 읽혀진 것은 패스 + // Pass if already read for($i=0;$i<$cur;$i++) fgets($f, 1024); - - // 라인단위로 읽어들이면서 $cur보다 커지고 $cur+$this->unit_count개보다 작으면 중지 + // Read each line until the condition meets for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) { if(feof($f)) break; - - // 정해진 위치를 찾음 + // Find a location $target_file = trim(fgets($f, 1024)); - - // 대상 파일을 읽여서 파싱후 입력 + // Load and parse the file $xmlObj = $oXmlParser->loadXmlFile($target_file); FileHandler::removeFile($target_file); if(!$xmlObj) continue; - - // 객체 정리 + // List objects $obj = null; $obj->receiver = base64_decode($xmlObj->message->receiver->body); $obj->sender = base64_decode($xmlObj->message->sender->body); @@ -416,8 +375,7 @@ $obj->regdate = base64_decode($xmlObj->message->regdate->body); $obj->readed_date = base64_decode($xmlObj->message->readed_date->body); $obj->receiver = base64_decode($xmlObj->message->receiver->body); - - // 보낸이/ 받는이의 member_srl을 구함 (존재하지 않으면 그냥 pass..) + // Get member_srl of sender/recipient (If not exists, pass) if(!$obj->sender) continue; $sender_args->user_id = $obj->sender; $sender_output = executeQuery('member.getMemberInfo',$sender_args); @@ -429,8 +387,7 @@ $receiver_output = executeQuery('member.getMemberInfo',$receiver_args); $receiver_srl = $receiver_output->data->member_srl; if(!$receiver_srl) continue; - - // 보내는 사용자의 쪽지함에 넣을 쪽지 + // Message to save into sender's message box $sender_args->sender_srl = $sender_srl; $sender_args->receiver_srl = $receiver_srl; $sender_args->message_type = 'S'; @@ -445,7 +402,7 @@ $output = executeQuery('communication.sendMessage', $sender_args); if($output->toBool()) { - // 받는 회원의 쪽지함에 넣을 쪽지 + // Message to save into recipient's massage box $receiver_args->message_srl = $sender_args->related_srl; $receiver_args->list_order = $sender_args->related_srl*-1; $receiver_args->sender_srl = $sender_srl; @@ -467,25 +424,23 @@ } /** - * @brief module.xml 형식의 데이터 import + * @brief Import data in module.xml format **/ function importModule($key, $cur, $index_file, $module_srl) { - // 필요한 객체 미리 생성 + // Pre-create the objects needed $this->oXmlParser = new XmlParser(); - - // 타겟 모듈의 카테고리 정보 구함 + // Get category information of the target module $oDocumentController = &getController('document'); $oDocumentModel = &getModel('document'); $category_list = $category_titles = array(); $category_list = $oDocumentModel->getCategoryList($module_srl); if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; - - // 먼저 카테고리 정보를 입력함 + // Extract category information $category_file = preg_replace('/index$/i', 'category.xml', $index_file); if(file_exists($category_file)) { $buff = FileHandler::readFile($category_file); - // xmlParser객체 생성 + // Create the xmlParser object $xmlDoc = $this->oXmlParser->loadXmlFile($category_file); $categories = $xmlDoc->items->category; @@ -524,23 +479,18 @@ } if(!$cur) $cur = 0; - - // index파일을 염 + // Open an index file $f = fopen($index_file,"r"); - - // 이미 읽혀진 것은 패스 + // Pass if already read for($i=0;$i<$cur;$i++) fgets($f, 1024); - - // 라인단위로 읽어들이면서 $cur보다 커지고 $cur+$this->unit_count개보다 작으면 중지 + // Read each line until the condition meets for($idx=$cur;$idx<$cur+$this->unit_count;$idx++) { if(feof($f)) break; - - // 정해진 위치를 찾음 + // Find a location $target_file = trim(fgets($f, 1024)); if(!file_exists($target_file)) continue; - - // 이제부터 데이터를 가져오면서 처리 + // Importing data from now on $fp = fopen($target_file,"r"); if(!$fp) continue; @@ -553,31 +503,25 @@ $started = false; $buff = null; - - // 본문 데이터부터 처리 시작 + // Start from the body data while(!feof($fp)) { $str = fgets($fp, 1024); - - // 한 아이템 준비 시작 + // Prepare an item if(trim($str) == '') { $started = true; - - // 엮인글 입력 + // Trackback inserted } else if(substr($str,0,11) == 'trackback_count = $this->importTrackbacks($fp, $module_srl, $obj->document_srl); continue; - - // 댓글 입력 + // Comments inserted } else if(substr($str,0,9) == 'comment_count = $this->importComments($fp, $module_srl, $obj->document_srl); continue; - - // 첨부파일 입력 + // Attachment inserted } else if(substr($str,0,9) == 'uploaded_count = $this->importAttaches($fp, $module_srl, $obj->document_srl, $files); continue; - - // 추가 변수 시작 일 경우 + // When starting extra variabls } elseif(trim($str) == '') { $extra_vars = $this->importExtraVars($fp); continue; @@ -618,8 +562,7 @@ $obj->lock_comment = base64_decode($xmlDoc->post->lock_comment->body)=='Y'?'Y':'N'; $obj->allow_trackback = base64_decode($xmlDoc->post->allow_trackback->body)!='N'?'Y':'N'; $obj->notify_message = base64_decode($xmlDoc->post->is_notice->body); - - // content 정보 변경 (첨부파일) + // Change content information (attachment) if(count($files)) { foreach($files as $key => $val) { $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); @@ -645,8 +588,7 @@ } } - - // 확장변수 추가 + // Add extra variables if(count($extra_vars)) { foreach($extra_vars as $key => $val) { if(!$val->value) continue; @@ -657,8 +599,7 @@ $e_args->value = $val->value; $e_args->lang_code = $val->lang_code; $e_args->eid = $val->eid; - - // 등록된 확장변수 키가 없으면 생성(제목/내용 언어별 변수는 제외) + // Create a key for extra vars if not exists (except vars for title and content) if(!preg_match('/^(title|content)_(.+)$/i',$e_args->eid) && !$extra_keys[$e_args->eid]) { unset($ek_args); $ek_args->module_srl = $module_srl; @@ -681,15 +622,14 @@ } fclose($f); - - // 카테고리별 개수 동기화 + // Sync category counts if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); return $idx-1; } /** - * @brief 엮인글 정리 + * @brief Trackbacks **/ function importTrackbacks($fp, $module_srl, $document_srl) { $started = false; @@ -698,16 +638,13 @@ while(!feof($fp)) { $str = fgets($fp, 1024); - - // 이면 중단 + // If is, break if(trim($str) == '') break; - - // 면 시작 + // If , start importing if(trim($str) == '') $started = true; if($started) $buff .= $str; - - // 이면 DB에 입력 + // If , insert to the DB if(trim($str) == '') { $xmlDoc = $this->oXmlParser->parse($buff); @@ -733,7 +670,7 @@ } /** - * @brief 댓글 정리 + * @brief Comments **/ function importComments($fp, $module_srl, $document_srl) { $started = false; @@ -745,27 +682,23 @@ while(!feof($fp)) { $str = fgets($fp, 1024); - - // 이면 중단 + // If is, break if(trim($str) == '') break; - - // 면 시작 + // If is, start importing if(trim($str) == '') { $started = true; $obj = null; $obj->comment_srl = getNextSequence(); $files = array(); } - - // attaches로 시작하면 첨부파일 시작 + // If uploaded_count = $this->importAttaches($fp, $module_srl, $obj->comment_srl, $files); continue; } if($started) $buff .= $str; - - // 이면 DB에 입력 + // If is, insert to the DB if(trim($str) == '') { $xmlDoc = $this->oXmlParser->parse($buff); @@ -797,33 +730,28 @@ if(!$obj->last_update) $obj->last_update = $obj->regdate; $obj->ipaddress = base64_decode($xmlDoc->comment->ipaddress->body); $obj->list_order = $obj->comment_srl*-1; - - // content 정보 변경 (첨부파일) + // Change content information (attachment) if(count($files)) { foreach($files as $key => $val) { $obj->content = preg_replace('/(src|href)\=(["\']?)'.preg_quote($key).'(["\']?)/i','$1="'.$val.'"',$obj->content); } } - - // 댓글 목록 부분을 먼저 입력 + // Comment list first $list_args = null; $list_args->comment_srl = $obj->comment_srl; $list_args->document_srl = $obj->document_srl; $list_args->module_srl = $obj->module_srl; $list_args->regdate = $obj->regdate; - - // 부모댓글이 없으면 바로 데이터를 설정 + // Set data directly if parent comment doesn't exist if(!$obj->parent_srl) { $list_args->head = $list_args->arrange = $obj->comment_srl; $list_args->depth = 0; - - // 부모댓글이 있으면 부모글의 정보를 구해옴 + // Get parent_srl if parent comment exists } else { - // 부모댓글의 정보를 구함 + // Get parent comment infomation $parent_args->comment_srl = $obj->parent_srl; $parent_output = executeQuery('comment.getCommentListItem', $parent_args); - - // 부모댓글이 존재하지 않으면 return + // Return if parent comment doesn't exist if(!$parent_output->toBool() || !$parent_output->data) continue; $parent = $parent_output->data; @@ -851,7 +779,7 @@ } /** - * @brief 첨부파일 정리 + * @brief Import attachment **/ function importAttaches($fp, $module_srl, $upload_target_srl, &$files) { $uploaded_count = 0; @@ -861,11 +789,9 @@ while(!feof($fp)) { $str = trim(fgets($fp, 1024)); - - // 로 끝나면 중단 + // If it ends with , break if(trim($str) == '') break; - - // 로 시작하면 첨부파일 수집 + // If it starts with , collect attachments if(trim($str) == '') { $file_obj = null; $file_obj->file_srl = getNextSequence(); @@ -874,15 +800,14 @@ $started = true; $buff = null; - // 로 시작하면 xml파일내의 첨부파일로 처리 + // If it starts with , handle the attachement in xml file } else if(trim($str) == '') { $file_obj->file = $this->saveTemporaryFile($fp); continue; } if($started) $buff .= $str; - - // 로 끝나면 첨부파일 정리 + // If it ends with , handle attachements if(trim($str) == '') { $xmlDoc = $this->oXmlParser->parse($buff.$str); @@ -900,8 +825,7 @@ } if(file_exists($file_obj->file)) { - - // 이미지인지 기타 파일인지 체크하여 upload path 지정 + // Set upload path by checking if the attachement is an image or other kind of file if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_obj->source_filename)) { $path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3)); $filename = $path.$file_obj->source_filename; @@ -911,14 +835,12 @@ $filename = $path.md5(crypt(rand(1000000,900000), rand(0,100))); $file_obj->direct_download = 'N'; } - - // 디렉토리 생성 + // Create a directory if(!FileHandler::makeDir($path)) continue; if(preg_match('/^\.\/files\/cache\/importer/i',$file_obj->file)) FileHandler::rename($file_obj->file, $filename); else @copy($file_obj->file, $filename); - - // DB입력 + // Insert the file to the DB unset($file_obj->file); if(file_exists($filename)) { $file_obj->uploaded_filename = $filename; @@ -944,7 +866,7 @@ } /** - * @biref 임의로 사용할 파일이름을 return + * @biref Return a filename to temporarily use **/ function getTmpFilename() { $path = "./files/cache/importer"; @@ -955,7 +877,7 @@ } /** - * @brief 특정 파일포인트로부터 key에 해당하는 값이 나타날때까지 buff를 읽음 + * @brief Read buff until key value comes out from a specific file point **/ function saveTemporaryFile($fp) { $temp_filename = $this->getTmpFilename(); @@ -979,7 +901,7 @@ /** - * @brief 게시글 추가 변수 설정 + * @brief Set extra variables **/ function importExtraVars($fp) { $buff = null; diff --git a/modules/importer/importer.admin.view.php b/modules/importer/importer.admin.view.php index 7b9560e3d..88f724930 100644 --- a/modules/importer/importer.admin.view.php +++ b/modules/importer/importer.admin.view.php @@ -2,21 +2,21 @@ /** * @class importerAdminView * @author NHN (developers@xpressengine.com) - * @brief importer 모듈의 admin view class + * @brief admin view class of the importer module **/ class importerAdminView extends importer { /** - * @brief 초기화 + * @brief Initialization * - * importer 모듈은 일반 사용과 관리자용으로 나누어진다.\n + * Importer module is divided by general use and administrative use \n **/ function init() { } /** - * @brief XML 파일을 업로드하는 form 출력 + * @brief Display a form to upload the xml file **/ function dispImporterAdminContent() { $this->setTemplatePath($this->module_path.'tpl'); diff --git a/modules/importer/importer.class.php b/modules/importer/importer.class.php index 2ed263270..79c8fa834 100644 --- a/modules/importer/importer.class.php +++ b/modules/importer/importer.class.php @@ -2,34 +2,34 @@ /** * @class importer * @author NHN (developers@xpressengine.com) - * @brief importer 모듈의 high class + * @brief high class of importer module **/ class importer extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { return false; } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { return new Object(); } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { } diff --git a/modules/importer/ttimport.class.php b/modules/importer/ttimport.class.php index 987a02bfd..c198626a5 100644 --- a/modules/importer/ttimport.class.php +++ b/modules/importer/ttimport.class.php @@ -13,26 +13,23 @@ var $oXmlParser = null; /** - * @brief module.xml 형식의 데이터 import + * @brief import data in module.xml format **/ function importModule($key, $cur, $index_file, $unit_count, $module_srl, $guestbook_module_srl, $user_id, $module_name=null) { - // 필요한 객체 미리 생성 + // Pre-create the objects needed $this->oXmlParser = new XmlParser(); - - // 타겟 모듈의 카테고리 정보 구함 + // Get category information of the target module $oDocumentController = &getController('document'); $oDocumentModel = &getModel('document'); $category_list = $category_titles = array(); $category_list = $oDocumentModel->getCategoryList($module_srl); if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; - - // 먼저 카테고리 정보를 입력함 + // First handle categorty information $category_file = preg_replace('/index$/i', 'category.xml', $index_file); if(file_exists($category_file)) { - // xmlParser객체 생성 + // Create the xmlParser object $xmlDoc = $this->oXmlParser->loadXmlFile($category_file); - - // 카테고리 정보를 정리 + // List category information if($xmlDoc->categories->category) { $categories = array(); $idx = 0; @@ -58,30 +55,24 @@ $category_list = $category_titles = array(); $category_list = $oDocumentModel->getCategoryList($module_srl); if(count($category_list)) foreach($category_list as $key => $val) $category_titles[$val->title] = $val->category_srl; - - // 관리자 정보를 구함 + // Get administrator information $oMemberModel = &getModel('member'); $member_info = $oMemberModel->getMemberInfoByUserID($user_id); $author_xml_id = 0; if(!$cur) $cur = 0; - - // index파일을 염 + // Open an index file $f = fopen($index_file,"r"); - - // 이미 읽혀진 것은 패스 + // Pass if already read for($i=0;$i<$cur;$i++) fgets($f, 1024); - - // 라인단위로 읽어들이면서 $cur보다 커지고 $cur+$unit_count개보다 작으면 중지 + // Read each line until the codition meets for($idx=$cur;$idx<$cur+$unit_count;$idx++) { if(feof($f)) break; - - // 정해진 위치를 찾음 + // Find a location $target_file = trim(fgets($f, 1024)); if(!file_exists($target_file)) continue; - - // 이제부터 데이터를 가져오면서 처리 + // Start importing data $fp = fopen($target_file,"r"); if(!$fp) continue; @@ -94,17 +85,14 @@ $started = false; $buff = null; - - // 본문 데이터부터 처리 시작 + // Start importing from the body data while(!feof($fp)) { $str = fgets($fp, 1024); - - // 한 아이템 준비 시작 + // Prepare an item if(substr($str,0,5) == 'importAttaches($fp, $module_srl, $obj->document_srl, $files, $str)) $obj->uploaded_count++; continue; @@ -158,8 +146,7 @@ $obj->list_order = $obj->update_order = $obj->document_srl*-1; $obj->lock_comment = 'N'; $obj->notify_message = 'N'; - - // content 정보 변경 (첨부파일) + // Change content information (attachment) $obj->content = str_replace('[##_ATTACH_PATH_##]/','',$obj->content); if(count($files)) { foreach($files as $key => $val) { @@ -173,8 +160,7 @@ $this->files = $files; $obj->content = preg_replace_callback('!\[##_([a-z0-9]+)\|([^\|]*)\|([^\|]*)\|(.*?)_##\]!is', array($this, '_replaceTTAttach'), $obj->content); } - - // 역인글 입력 + // Trackback inserted $obj->trackback_count = 0; if($xmlDoc->post->trackback) { $trackbacks = $xmlDoc->post->trackback; @@ -197,8 +183,7 @@ } } } - - // 댓글입력 + // Comment $obj->comment_count = 0; if($xmlDoc->post->comment) { $comment = $xmlDoc->post->comment; @@ -224,20 +209,18 @@ $args->module_srl = $obj->module_srl; $args->logs = serialize(null); $output = executeQuery('textyle.insertPublishLog', $args); - - // 발행 상태의 visibility 값 + // Visibility value of published state $status_published = array('public', 'syndicated'); - // 발행이 아닌 것들은 저장상태로 + // Save state if not published if(!in_array($xmlDoc->post->visibility->body, $status_published)) { $obj->module_srl = $member_info->member_srl; } } - - // 문서 입력 + // Document $output = executeQuery('document.insertDocument', $obj); if($output->toBool()) { - // 태그 입력 + // Tags if($obj->tags) { $tag_list = explode(',',$obj->tags); $tag_count = count($tag_list); @@ -261,15 +244,12 @@ fclose($f); if(count($category_list)) foreach($category_list as $key => $val) $oDocumentController->updateCategoryCount($module_srl, $val->category_srl); - - - // 방명록 정보를 입력함 + // Guestbook information $guestbook_file = preg_replace('/index$/i', 'guestbook.xml', $index_file); if (file_exists($guestbook_file)) { - // xmlParser객체 생성 + // Create the xmlParser object $xmlDoc = $this->oXmlParser->loadXmlFile($guestbook_file); - - // 방명록 정보를 처리 + // Handle guest book information if($guestbook_module_srl && $xmlDoc->guestbook->comment) { $comment = $xmlDoc->guestbook->comment; if(!is_array($comment)) $comment = array($comment); @@ -298,7 +278,7 @@ $obj->is_secret = $val->secret->body=='1'?'Y':'N'; $obj->content = nl2br($val->content->body); - // 본문에서 제목 추출 + // Extract a title form the bocy $obj->title = cut_str(strip_tags($obj->content),20,'...'); if ($obj->title == '') $obj->title = 'Untitled'; @@ -341,7 +321,7 @@ } } - // 문서 입력 + // Document $output = executeQuery('document.insertDocument', $obj); } } @@ -395,7 +375,7 @@ /** - * @brief 첨부파일 정리 + * @brief Attachment **/ function importAttaches($fp, $module_srl, $upload_target_srl, &$files, $buff) { $uploaded_count = 0; @@ -407,11 +387,9 @@ while(!feof($fp)) { $str = fgets($fp, 1024); - - // 로 끝나면 중단 + // If it ends with , break if(trim($str) == '') break; - - // 로 시작하면 xml파일내의 첨부파일로 처리 + // If it starts with , handle the attachement in the xml file if(substr($str, 0, 9)=='') { $file_obj->file = $this->saveTemporaryFile($fp, $str); continue; @@ -428,8 +406,7 @@ $file_obj->source_filename = $xmlDoc->attachment->label->body; $file_obj->download_count = $xmlDoc->attachment->downloads->body; $name = $xmlDoc->attachment->name->body; - - // 이미지인지 기타 파일인지 체크하여 upload path 지정 + // Set upload path by checking if the attachement is an image or other kind of file if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp1|mp2|mp3|mp4|asf|wav|asx|mid|midi|asf|mov|moov|qt|rm|ram|ra|rmm|m4v)$/i", $file_obj->source_filename)) { $path = sprintf("./files/attach/images/%s/%s", $module_srl,getNumberingPath($upload_target_srl,3)); $filename = $path.$file_obj->source_filename; @@ -439,13 +416,11 @@ $filename = $path.md5(crypt(rand(1000000,900000), rand(0,100))); $file_obj->direct_download = 'N'; } - - // 디렉토리 생성 + // Create a directory if(!FileHandler::makeDir($path)) return; FileHandler::rename($file_obj->file, $filename); - - // DB입력 + // Insert to the DB unset($file_obj->file); $file_obj->uploaded_filename = $filename; $file_obj->file_size = filesize($filename); @@ -469,7 +444,7 @@ } /** - * @biref 임의로 사용할 파일이름을 return + * @biref Return a filename to temporarily use **/ function getTmpFilename() { $path = "./files/cache/importer"; @@ -480,7 +455,7 @@ } /** - * @brief 특정 파일포인트로부터 key에 해당하는 값이 나타날때까지 buff를 읽음 + * @brief Read buff until key value comes out from a specific file point **/ function saveTemporaryFile($fp, $buff) { $temp_filename = $this->getTmpFilename(); @@ -501,32 +476,30 @@ } /** - * @brief ttxml의 자체 img 태그를 치환 + * @brief Replace img tag in the ttxml **/ function _replaceTTAttach($matches) { $name = $matches[2]; if(!$name) return $matches[0]; $obj = $this->files[$name]; - - // 멀티미디어성 파일의 경우 + // If multimedia file is, if($obj->direct_download == 'Y') { - // 이미지의 경우 + // If image file is if(preg_match('/\.(jpg|gif|jpeg|png)$/i', $obj->source_filename)) { return sprintf('%s', $obj->url, str_replace('"','\\"',$matches[4])); - // 이미지 외의 멀티미디어성 파일의 경우 + // If other multimedia file but image is, } else { return sprintf('', $obj->url); } - - // binary파일일 경우 + // If binary file is } else { return sprintf('%s', $obj->url, $obj->source_filename); } } /** - * @brief ttxml의 동영상 변환 + * @brief Convert the video file **/ function _replaceTTMovie($matches) { $key = $matches[1]; @@ -543,7 +516,7 @@ } /** - * @brief 댓글 입력 + * @brief Comment **/ function insertComment($val, $module_srl, $document_srl, $member_info, $parent_srl = 0, $author_xml_id) { $tobj = null; @@ -573,26 +546,22 @@ $tobj->list_order = $tobj->comment_srl*-1; $tobj->sequence = $sequence; $tobj->parent_srl = $parent_srl; - - // 댓글 목록 부분을 먼저 입력 + // Comment list first $list_args = null; $list_args->comment_srl = $tobj->comment_srl; $list_args->document_srl = $tobj->document_srl; $list_args->module_srl = $tobj->module_srl; $list_args->regdate = $tobj->regdate; - - // 부모댓글이 없으면 바로 데이터를 설정 + // Set data directly if parent comment doesn't exist if(!$tobj->parent_srl) { $list_args->head = $list_args->arrange = $tobj->comment_srl; $list_args->depth = 0; - - // 부모댓글이 있으면 부모글의 정보를 구해옴 + // Get parent_srl if parent comment exists } else { - // 부모댓글의 정보를 구함 + // Get parent_srl $parent_args->comment_srl = $tobj->parent_srl; $parent_output = executeQuery('comment.getCommentListItem', $parent_args); - - // 부모댓글이 존재하지 않으면 return + // Return if parent comment doesn't exist if(!$parent_output->toBool() || !$parent_output->data) return false; $parent = $parent_output->data; @@ -613,8 +582,7 @@ } return false; } - - // 카테고리 정리 + // List category function arrangeCategory($obj, &$category, &$idx, $parent = 0) { if(!$obj->category) return; if(!is_array($obj->category)) $c = array($obj->category); diff --git a/modules/install/install.admin.controller.php b/modules/install/install.admin.controller.php index f1e3270fc..190ebf924 100644 --- a/modules/install/install.admin.controller.php +++ b/modules/install/install.admin.controller.php @@ -2,20 +2,20 @@ /** * @class installAdminController * @author NHN (developers@xpressengine.com) - * @brief install module의 admin controller class + * @brief admin controller class of the install module **/ class installAdminController extends install { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 모듈 설치 + * @brief Install the module **/ function procInstallAdminInstall() { $module_name = Context::get('module_name'); @@ -28,7 +28,7 @@ } /** - * @brief 모듈 업데이트 + * @brief Upate the module **/ function procInstallAdminUpdate() { $module_name = Context::get('module_name'); @@ -42,7 +42,7 @@ } /** - * @brief 설정 변경 + * @brief Change settings **/ function procInstallAdminSaveTimeZone() { $use_rewrite = Context::get('use_rewrite'); @@ -101,7 +101,7 @@ } /** - * @brief 지원 언어 선택 + * @brief Supported languages **/ function procInstallAdminSaveLangSelected() { $selected_lang = trim(Context::get('selected_lang')); diff --git a/modules/install/install.class.php b/modules/install/install.class.php index a3ca6b977..6a0d04fcf 100644 --- a/modules/install/install.class.php +++ b/modules/install/install.class.php @@ -2,34 +2,34 @@ /** * @class install * @author NHN (developers@xpressengine.com) - * @brief install module의 high class + * @brief install module of the high class **/ class install extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { return false; } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { return new Object(); } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { } diff --git a/modules/install/install.controller.php b/modules/install/install.controller.php index 68d3d3109..3408b7aff 100644 --- a/modules/install/install.controller.php +++ b/modules/install/install.controller.php @@ -2,58 +2,50 @@ /** * @class installController * @author NHN (developers@xpressengine.com) - * @brief install module의 Controller class + * @brief install module of the Controller class **/ class installController extends install { /** - * @brief 초기화 + * @brief Initialization **/ function init() { - // 설치가 되어 있으면 오류 + // Error occurs if already installed if(Context::isInstalled()) { return new Object(-1, 'msg_already_installed'); } } /** - * @brief 입력받은 정보로 설치를 함 + * @brief Install with received information **/ function procInstall() { - // 설치가 되어 있는지에 대한 체크 + // Check if it is already installed if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); - - // 설치시 임시로 최고관리자로 지정 + // Assign a temporary administrator when installing $logged_info->is_admin = 'Y'; $_SESSION['logged_info'] = $logged_info; Context::set('logged_info', $logged_info); - - // DB와 관련된 변수를 받음 + // Get DB-related variables $db_info = Context::gets('db_type','db_port','db_hostname','db_userid','db_password','db_database','db_table_prefix','time_zone','use_rewrite'); if($db_info->use_rewrite!='Y') $db_info->use_rewrite = 'N'; if(!$db_info->default_url) $db_info->default_url = Context::getRequestUri(); $db_info->lang_type = Context::getLangType(); - - // DB의 타입과 정보를 등록 + // Set DB type and information Context::setDBInfo($db_info); - - // DB Instance 생성 + // Create DB Instance $oDB = &DB::getInstance(); - - // DB접속이 가능한지 체크 + // Check if available to connect to the DB $output = $oDB->getError(); if(!$oDB->isConnected()) return $oDB->getError(); - - // firebird는 설치시에 트랜젝션을 사용하지 않음 + // When installing firebire DB, transaction will not be used if($db_info->db_type != "firebird") $oDB->begin(); - - // 모든 모듈의 설치 + // Install all the modules $this->installDownloadedModule(); if($db_info->db_type != "firebird") $oDB->commit(); - - // config 파일 생성 + // Create a config file if(!$this->makeConfigFile()) return new Object(-1, 'msg_install_failed'); // load script @@ -65,12 +57,12 @@ } } - // 설치 완료 메세지 출력 + // Display a message that installation is completed $this->setMessage('msg_install_completed'); } /** - * @brief FTP 정보 등록 + * @brief Set FTP Information **/ function procInstallFTP() { if(Context::isInstalled()) return new Object(-1, 'msg_already_installed'); @@ -85,8 +77,7 @@ $buff .= sprintf("\$ftp_info->%s = '%s';\n", $key, str_replace("'","\\'",$val)); } $buff .= "?>"; - - // safe_mode 일 경우 + // If safe_mode if(ini_get('safe_mode')) { if(!$ftp_info->ftp_user || !$ftp_info->ftp_password) return new Object(-1,'msg_safe_mode_ftp_needed'); @@ -160,40 +151,33 @@ } /** - * @brief 인스톨 환경을 체크하여 결과 return + * @brief Result returned after checking the installation environment **/ function checkInstallEnv() { - // 각 필요한 항목 체크 + // Check each item $checklist = array(); - - // 0. php 버전 체크 (5.2.2는 설치 불가) + // 0. check your version of php (5.2.2 is not supported) if(phpversion()=='5.2.2') $checklist['php_version'] = false; else $checklist['php_version'] = true; - - // 1. permission 체크 + // 1. Check permission if(is_writable('./')||is_writable('./files')) $checklist['permission'] = true; else $checklist['permission'] = false; - - // 2. xml_parser_create함수 유무 체크 + // 2. Check if xml_parser_create exists if(function_exists('xml_parser_create')) $checklist['xml'] = true; else $checklist['xml'] = false; - - // 3. ini_get(session.auto_start)==1 체크 + // 3. Check if ini_get (session.auto_start) == 1 if(ini_get(session.auto_start)!=1) $checklist['session'] = true; else $checklist['session'] = false; - - // 4. iconv 체크 + // 4. Check if iconv exists if(function_exists('iconv')) $checklist['iconv'] = true; else $checklist['iconv'] = false; - - // 5. gd 체크 (imagecreatefromgif함수) + // 5. Check gd(imagecreatefromgif function) if(function_exists('imagecreatefromgif')) $checklist['gd'] = true; else $checklist['gd'] = false; if(!$checklist['php_version'] || !$checklist['permission'] || !$checklist['xml'] || !$checklist['session']) $install_enable = false; else $install_enable = true; - - // 체크 결과를 Context에 저장 + // Save the checked result to the Context Context::set('checklist', $checklist); Context::set('install_enable', $install_enable); @@ -201,8 +185,8 @@ } /** - * @brief files 및 하위 디렉토리 생성 - * DB 정보를 바탕으로 실제 install하기 전에 로컬 환경 설저d + * @brief Create files and subdirectories + * Local evironment setting before installation by using DB information **/ function makeDefaultDirectory() { $directory_list = array( @@ -218,17 +202,16 @@ } /** - * @brief 모든 모듈의 설치 + * @brief Install all the modules * - * 모든 module의 schemas 디렉토리를 확인하여 schema xml을 이용, 테이블 생성 + * Create a table by using schema xml file in the shcema directory of each module **/ function installDownloadedModule() { $oModuleModel = &getModel('module'); - - // 각 모듈의 schemas/*.xml 파일을 모두 찾아서 table 생성 + // Create a table ny finding schemas/*.xml file in each module $module_list = FileHandler::readDir('./modules/', NULL, false, true); foreach($module_list as $module_path) { - // 모듈 이름을 구함 + // Get module name $tmp_arr = explode('/',$module_path); $module = $tmp_arr[count($tmp_arr)-1]; @@ -236,15 +219,13 @@ if(!$xml_info) continue; $modules[$xml_info->category][] = $module; } - - // module 모듈은 미리 설치 + // Install "module" module in advance $this->installModule('module','./modules/module'); $oModule = &getClass('module'); if($oModule->checkUpdate()) $oModule->moduleUpdate(); - - // 모듈을 category에 의거 설치 순서를 정함 + // Determine the order of module installation depending on category $install_step = array('system','content','member'); - // 나머지 모든 모듈 설치 + // Install all the remaining modules foreach($install_step as $category) { if(count($modules[$category])) { foreach($modules[$category] as $module) { @@ -257,8 +238,7 @@ unset($modules[$category]); } } - - // 나머지 모든 모듈 설치 + // Install all the remaining modules if(count($modules)) { foreach($modules as $category => $module_list) { if(count($module_list)) { @@ -280,13 +260,12 @@ } /** - * @brief 개별 모듈의 설치 + * @brief Install an each module **/ function installModule($module, $module_path) { - // db instance생성 + // create db instance $oDB = &DB::getInstance(); - - // 해당 모듈의 schemas 디렉토리를 검사하여 schema xml파일이 있으면 생성 + // Create a table if the schema xml exists in the "schemas" directory of the module $schema_dir = sprintf('%s/schemas/', $module_path); $schema_files = FileHandler::readDir($schema_dir, NULL, false, true); @@ -296,8 +275,7 @@ if(!$file || substr($file,-4)!='.xml') continue; $output = $oDB->createTableByXmlFile($file); } - - // 테이블 설치후 module instance를 만들고 install() method를 실행 + // Create a table and module instance and then execute install() method unset($oModule); $oModule = &getClass($module); if(method_exists($oModule, 'moduleInstall')) $oModule->moduleInstall(); @@ -306,8 +284,8 @@ } /** - * @brief config 파일을 생성 - * 모든 설정이 이상없이 끝난 후에 config파일 생성 + * @brief Create config file + * Create the config file when all settings are completed **/ function makeConfigFile() { $config_file = Context::getConfigFile(); diff --git a/modules/install/install.view.php b/modules/install/install.view.php index 77996e4da..ae4dfab34 100644 --- a/modules/install/install.view.php +++ b/modules/install/install.view.php @@ -2,7 +2,7 @@ /** * @class installView * @author NHN (developers@xpressengine.com) - * @brief install module의 View class + * @brief View class of install module **/ class installView extends install { @@ -10,25 +10,22 @@ var $install_enable = false; /** - * @brief 초기화 + * @brief Initialization **/ function init() { - // template 경로를 지정 + // Specify the template path $this->setTemplatePath($this->module_path.'tpl'); - - // 설치가 되어 있으면 오류 + // Error occurs if already installed if(Context::isInstalled()) return $this->stop('msg_already_installed'); - - // 컨트롤러 생성 + // Install a controller $oInstallController = &getController('install'); $this->install_enable = $oInstallController->checkInstallEnv(); - - // 설치 가능한 환경이라면 installController::makeDefaultDirectory() 실행 + // If the environment is installable, execute installController::makeDefaultDirectory() if($this->install_enable) $oInstallController->makeDefaultDirectory(); } /** - * @brief license 메세지 노출 + * @brief Display license messages **/ function dispInstallIntroduce() { $install_config_file = FileHandler::getRealPath('./config/install.config.php'); @@ -48,7 +45,7 @@ } /** - * @brief 설치 환경에 대한 메세지 보여줌 + * @brief Display messages about installation environment **/ function dispInstallCheckEnv() { $this->setTemplateFile('check_env'); @@ -56,13 +53,12 @@ /** - * @brief DB 선택 화면 + * @brief Choose a DB **/ function dispInstallSelectDB() { - // 설치 불가능하다면 check_env를 출력 + // Display check_env if it is not installable if(!$this->install_enable) return $this->dispInstallCheckEnv(); - - // ftp 정보 입력 + // Enter ftp information if(ini_get('safe_mode') && !Context::isFTPRegisted()) { $this->setTemplateFile('ftp'); } else { @@ -71,18 +67,16 @@ } /** - * @brief DB 정보/ 최고 관리자 정보 입력 화면을 보여줌 + * @brief Display a screen to enter DB and administrator's information **/ function dispInstallForm() { - // 설치 불가능하다면 check_env를 출력 + // Display check_env if not installable if(!$this->install_enable) return $this->dispInstallCheckEnv(); - - // db_type이 지정되지 않았다면 다시 초기화면 출력 + // Return to the start-up screen if db_type is not specified if(!Context::get('db_type')) return $this->dispInstallSelectDB(); Context::set('time_zone', $GLOBALS['time_zone']); - - // disp_db_info_form.html 파일 출력 + // Output the file, disp_db_info_form.html $tpl_filename = sprintf('form.%s', Context::get('db_type')); $this->setTemplateFile($tpl_filename); } diff --git a/modules/integration_search/integration_search.admin.controller.php b/modules/integration_search/integration_search.admin.controller.php index 1b7d129bb..f9f1353ee 100644 --- a/modules/integration_search/integration_search.admin.controller.php +++ b/modules/integration_search/integration_search.admin.controller.php @@ -2,23 +2,23 @@ /** * @class integration_searchAdminController * @author NHN (developers@xpressengine.com) - * @brief integration_search module의 admin view class + * @brief admin view class of the integration_search module * - * 통합검색 관리 + * Search Management * **/ class integration_searchAdminController extends integration_search { /** - * @brief 초기화 + * @brief Initialization **/ function init() {} /** - * @brief 설정 저장 + * @brief Save Settings **/ function procIntegration_searchAdminInsertConfig() { - // 설정 정보를 받아옴 (module model 객체를 이용) + // Get configurations (using module model object) $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('integration_search'); @@ -33,79 +33,67 @@ } /** - * @brief 스킨 정보 저장 + * @brief Save the skin information **/ function procIntegration_searchAdminInsertSkin() { - // 설정 정보를 받아옴 (module model 객체를 이용) + // Get configurations (using module model object) $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('integration_search'); $args->skin = $config->skin; $args->target_module_srl = $config->target_module_srl; - - // 스킨의 정보를 구해옴 (extra_vars를 체크하기 위해서) + // Get skin information (to check extra_vars) $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $config->skin); - - // 입력받은 변수들을 체크 (mo, act, module_srl, page등 기본적인 변수들 없앰) + // Check received variables (delete the basic variables such as mo, act, module_srl, page) $obj = Context::getRequestVars(); unset($obj->act); unset($obj->module_srl); unset($obj->page); - - // 원 skin_info에서 extra_vars의 type이 image일 경우 별도 처리를 해줌 + // Separately handle if the extra_vars is an image type in the original skin_info if($skin_info->extra_vars) { foreach($skin_info->extra_vars as $vars) { if($vars->type!='image') continue; $image_obj = $obj->{$vars->name}; - - // 삭제 요청에 대한 변수를 구함 + // Get a variable on a request to delete $del_var = $obj->{"del_".$vars->name}; unset($obj->{"del_".$vars->name}); if($del_var == 'Y') { FileHandler::removeFile($module_info->{$vars->name}); continue; } - - // 업로드 되지 않았다면 이전 데이터를 그대로 사용 + // Use the previous data if not uploaded if(!$image_obj['tmp_name']) { $obj->{$vars->name} = $module_info->{$vars->name}; continue; } - - // 정상적으로 업로드된 파일이 아니면 무시 + // Ignore if the file is not successfully uploaded if(!is_uploaded_file($image_obj['tmp_name'])) { unset($obj->{$vars->name}); continue; } - - // 이미지 파일이 아니어도 무시 + // Ignore if the file is not an image if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { unset($obj->{$vars->name}); continue; } - - // 경로를 정해서 업로드 + // Upload the file to a path $path = sprintf("./files/attach/images/%s/", $module_srl); - - // 디렉토리 생성 + // Create a directory if(!FileHandler::makeDir($path)) return false; $filename = $path.$image_obj['name']; - - // 파일 이동 + // Move the file if(!move_uploaded_file($image_obj['tmp_name'], $filename)) { unset($obj->{$vars->name}); continue; } - - // 변수를 바꿈 + // Change a variable unset($obj->{$vars->name}); $obj->{$vars->name} = $filename; } } - - // serialize하여 저장 + // Serialize and save $args->skin_vars = serialize($obj); $oModuleController = &getController('module'); diff --git a/modules/integration_search/integration_search.admin.view.php b/modules/integration_search/integration_search.admin.view.php index dd4976a2d..c0195c7e1 100644 --- a/modules/integration_search/integration_search.admin.view.php +++ b/modules/integration_search/integration_search.admin.view.php @@ -2,9 +2,9 @@ /** * @class integration_searchAdminView * @author NHN (developers@xpressengine.com) - * @brief integration_search module의 admin view class + * @brief admin view class of the integration_search module * - * 통합검색 관리 + * Search Management * **/ @@ -13,10 +13,10 @@ var $config = null; /** - * @brief 초기화 + * @brief Initialization **/ function init() { - // 설정 정보를 받아옴 (module model 객체를 이용) + // Get configurations (using module model object) $oModuleModel = &getModel('module'); $this->config = $oModuleModel->getModuleConfig('integration_search'); Context::set('config',$this->config); @@ -25,22 +25,19 @@ } /** - * @brief 모듈 선정 및 스킨 설정 + * @brief Module selection and skin set **/ function dispIntegration_searchAdminContent() { - // 스킨 목록을 구해옴 + // Get a list of skins(themes) $oModuleModel = &getModel('module'); $skin_list = $oModuleModel->getSkins($this->module_path); Context::set('skin_list',$skin_list); - - // 모듈 카테고리 목록을 구함 + // Get a list of module categories $module_categories = $oModuleModel->getModuleCategories(); - - // 생성된 mid목록을 구함 + // Generated mid Wanted list $obj->site_srl = 0; $mid_list = $oModuleModel->getMidList($obj); - - // module_category와 module의 조합 + // module_category and module combination if($module_categories) { foreach($mid_list as $module_srl => $module) { $module_categories[$module->module_category_srl]->list[$module_srl] = $module; @@ -50,22 +47,20 @@ } Context::set('mid_list',$module_categories); - - // 샘플코드 + // Sample Code Context::set('sample_code', htmlspecialchars('
') ); $this->setTemplateFile("index"); } /** - * @brief 스킨 설정 + * @brief Skin Settings **/ function dispIntegration_searchAdminSkinInfo() { $oModuleModel = &getModel('module'); $skin_info = $oModuleModel->loadSkinInfo($this->module_path, $this->config->skin); $skin_vars = unserialize($this->config->skin_vars); - - // skin_info에 extra_vars 값을 지정 + // value for skin_info extra_vars if(count($skin_info->extra_vars)) { foreach($skin_info->extra_vars as $key => $val) { $name = $val->name; diff --git a/modules/integration_search/integration_search.class.php b/modules/integration_search/integration_search.class.php index 414e16453..f82c2aa0a 100644 --- a/modules/integration_search/integration_search.class.php +++ b/modules/integration_search/integration_search.class.php @@ -2,16 +2,16 @@ /** * @class integration_search * @author NHN (developers@xpressengine.com) - * @brief integration_search module의 view class + * @brief view class of the integration_search module **/ class integration_search extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // action forward에 등록 + // Registered in action forward $oModuleController = &getController('module'); $oModuleController->insertActionForward('integration_search', 'view', 'IS'); @@ -19,21 +19,21 @@ } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { return false; } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { return new Object(0, 'success_updated'); } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { } diff --git a/modules/integration_search/integration_search.model.php b/modules/integration_search/integration_search.model.php index 5694667bf..50539b82f 100644 --- a/modules/integration_search/integration_search.model.php +++ b/modules/integration_search/integration_search.model.php @@ -2,18 +2,18 @@ /** * @class integrationModel * @author NHN (developers@xpressengine.com) - * @brief integration 모듈의 Model class + * @brief Model class of integration module **/ class integration_searchModel extends module { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 게시글 검색 + * @brief Search documents **/ function getDocuments($target, $module_srls_list, $search_target, $search_keyword, $page=1, $list_count = 20) { if(is_array($module_srls_list)) $module_srls_list = implode(',',$module_srls_list); @@ -35,15 +35,14 @@ $args->sort_index = 'list_order'; $args->order_type = 'asc'; if(!$args->module_srl) unset($args->module_srl); - - // 대상 문서들을 가져옴 + // Get a list of documents $oDocumentModel = &getModel('document'); return $oDocumentModel->getDocumentList($args); } /** - * @brief 댓글 검색 + * @brief Comment Search **/ function getComments($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) { if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); @@ -57,8 +56,7 @@ $args->search_keyword = $search_keyword; $args->sort_index = 'list_order'; $args->order_type = 'asc'; - - // 대상 문서들을 가져옴 + // Get a list of documents $oCommentModel = &getModel('comment'); $output = $oCommentModel->getTotalCommentList($args); if(!$output->toBool()|| !$output->data) return $output; @@ -66,7 +64,7 @@ } /** - * @brief 엮인글 검색 + * @brief Search trackbacks **/ function getTrackbacks($target, $module_srls_list, $search_target = "title", $search_keyword, $page=1, $list_count = 20) { if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); @@ -80,8 +78,7 @@ $args->search_keyword = $search_keyword; $args->sort_index = 'list_order'; $args->order_type = 'asc'; - - // 대상 문서들을 가져옴 + // Get a list of documents $oTrackbackModel = &getAdminModel('trackback'); $output = $oTrackbackModel->getTotalTrackbackList($args); if(!$output->toBool()|| !$output->data) return $output; @@ -89,7 +86,7 @@ } /** - * @brief 파일 검색 + * @brief File Search **/ function _getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, $direct_download = 'Y') { if(is_array($module_srls_list)) $module_srls = implode(',',$module_srls_list); @@ -105,8 +102,7 @@ $args->order_type = 'desc'; $args->isvalid = 'Y'; $args->direct_download = $direct_download=='Y'?'Y':'N'; - - // 대상 문서들을 가져옴 + // Get a list of documents $oFileAdminModel = &getAdminModel('file'); $output = $oFileAdminModel->getFileList($args); if(!$output->toBool() || !$output->data) return $output; @@ -120,8 +116,7 @@ $obj->download_url = Context::getRequestUri().$val->download_url; $obj->target_srl = $val->upload_target_srl; $obj->file_size = $val->file_size; - - // 이미지 + // Images if(preg_match('/\.(jpg|jpeg|gif|png)$/i', $val->source_filename)) { $obj->type = 'image'; @@ -131,13 +126,11 @@ $thumbnail_url = Context::getRequestUri().$thumbnail_file; if(!file_exists($thumbnail_file)) FileHandler::createImageFile($val->uploaded_filename, $thumbnail_file, 120, 120, 'jpg', 'crop'); $obj->src = sprintf('%s', $thumbnail_url, htmlspecialchars($obj->filename), 120, 120); - - // 동영상 + // Videos } elseif(preg_match('/\.(swf|flv|wmv|avi|mpg|mpeg|asx|asf|mp3)$/i', $val->source_filename)) { $obj->type = 'multimedia'; $obj->src = sprintf('', $obj->download_url); - - // 기타 + // Others } else { $obj->type = 'binary'; $obj->src = ''; @@ -176,14 +169,14 @@ } /** - * @brief 멀티미디어 검색 + * @brief Multimedia Search **/ function getImages($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) { return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count); } /** - * @brief 첨부파일 검색 + * @brief Search for attachments **/ function getFiles($target, $module_srls_list, $search_keyword, $page=1, $list_count = 20) { return $this->_getFiles($target, $module_srls_list, $search_keyword, $page, $list_count, 'N'); diff --git a/modules/integration_search/integration_search.view.php b/modules/integration_search/integration_search.view.php index 81b27e4e1..bc53ac871 100644 --- a/modules/integration_search/integration_search.view.php +++ b/modules/integration_search/integration_search.view.php @@ -2,9 +2,9 @@ /** * @class integration_searchView * @author NHN (developers@xpressengine.com) - * @brief integration_search module의 view class + * @brief view class of the integration_search module * - * 통합검색 출력 + * Search Output * **/ @@ -14,19 +14,18 @@ var $skin = 'default'; /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 통합 검색 출력 + * @brief Search Result **/ function IS() { $oFile = &getClass('file'); $oModuleModel = &getModel('module'); - - // 권한 체크 + // Check permissions if(!$this->grant->access) return new Object(-1,'msg_not_permitted'); $config = $oModuleModel->getModuleConfig('integration_search'); @@ -37,18 +36,14 @@ $target = $config->target; if(!$target) $target = 'include'; $module_srl_list = explode(',',$config->target_module_srl); - - // 검색어 변수 설정 + // Set a variable for search keyword $is_keyword = Context::get('is_keyword'); - - // 페이지 변수 설정 + // Set page variables $page = (int)Context::get('page'); if(!$page) $page = 1; - - // 검색탭에 따른 검색 + // Search by search tab $where = Context::get('where'); - - // integration search model객체 생성 + // Create integration search model object if($is_keyword) { $oIS = &getModel('integration_search'); switch($where) { diff --git a/modules/krzip/krzip.admin.controller.php b/modules/krzip/krzip.admin.controller.php index f6f2671d9..7d6f4523f 100644 --- a/modules/krzip/krzip.admin.controller.php +++ b/modules/krzip/krzip.admin.controller.php @@ -2,28 +2,27 @@ /** * @class krzipAdminController * @author NHN (developers@xpressengine.com) - * @brief krzip 모듈의 admin controller class + * @brief admin controller class of the krzip module **/ class krzipAdminController extends krzip { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 설정 + * @brief Configuration **/ function procKrzipAdminInsertConfig() { - // 기본 정보를 받음 + // Get the basic information $args = Context::gets('krzip_server_hostname','krzip_server_port','krzip_server_query'); if(!$args->krzip_server_hostname) $args->krzip_server_hostname = $this->hostname; if(!$args->krzip_server_port) $args->krzip_server_port = $this->port; if(!$args->krzip_server_query) $args->krzip_server_query = $this->query; - - // module Controller 객체 생성하여 입력 + // Insert by creating the module Controller object $oModuleController = &getController('module'); $output = $oModuleController->insertModuleConfig('krzip',$args); return $output; diff --git a/modules/krzip/krzip.admin.view.php b/modules/krzip/krzip.admin.view.php index 4290e7e66..8101619b0 100644 --- a/modules/krzip/krzip.admin.view.php +++ b/modules/krzip/krzip.admin.view.php @@ -2,27 +2,26 @@ /** * @class krzipAdminView * @author NHN (developers@xpressengine.com) - * @brief krzip 모듈의 admin view class + * @brief admin view class of the krzip module **/ class krzipAdminView extends krzip { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 설정 + * @brief Configuration **/ function dispKrzipAdminConfig() { - // 설정 정보를 받아옴 (module model 객체를 이용) + // Get configurations (using module model object) $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('krzip'); Context::set('config',$config); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('index'); } diff --git a/modules/krzip/krzip.class.php b/modules/krzip/krzip.class.php index b75be2115..f7fc5c64b 100644 --- a/modules/krzip/krzip.class.php +++ b/modules/krzip/krzip.class.php @@ -2,7 +2,7 @@ /** * @class krzip * @author NHN (developers@xpressengine.com) - * @brief 우편번호 검색 모듈인 krzip의 상위 클래스 + * @brief Super class of krzip, which is a zip code search module **/ class krzip extends ModuleObject { @@ -12,28 +12,28 @@ var $query = '/server.php?addr3='; /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { return false; } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { return new Object(); } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { } diff --git a/modules/krzip/krzip.model.php b/modules/krzip/krzip.model.php index 2c3f223de..98b78eebd 100644 --- a/modules/krzip/krzip.model.php +++ b/modules/krzip/krzip.model.php @@ -2,34 +2,32 @@ /** * @class krzipModel * @author NHN (developers@xpressengine.com) - * @brief krzip 모듈의 model 클래스 + * @brief model class of the krzip module **/ class krzipModel extends krzip { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 우편 번호 검색 - * 동이름을 입력받아서 지정된 서버에 우편번호 목록을 요청한다 + * @brief Zip Code Search + * Request a zip code to the server with user-entered address **/ function getKrzipCodeList() { - // 설정 정보를 받아옴 (module model 객체를 이용) + // Get configurations (using module model object) $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('krzip'); if($config->krzip_server_hostname) $this->hostname = $config->krzip_server_hostname; if($config->krzip_server_port) $this->port = $config->krzip_server_port; if($config->krzip_server_query) $this->query = $config->krzip_server_query; - - // 동네 이름을 받음 + // Get address(town) $addr = trim(Context::get('addr')); if(!$addr) return new Object(-1,'msg_not_exists_addr'); - - // 지정된 서버에 요청을 시도한다 + // Attempt to request to the server $query_string = $this->query.urlencode($addr); $fp = @fsockopen($this->hostname, $this->port, $errno, $errstr); diff --git a/modules/layout/layout.admin.controller.php b/modules/layout/layout.admin.controller.php index 4ff46fb7a..fecd2bd37 100644 --- a/modules/layout/layout.admin.controller.php +++ b/modules/layout/layout.admin.controller.php @@ -2,23 +2,23 @@ /** * @class layoutAdminController * @author NHN (developers@xpressengine.com) - * @brief layout 모듈의 admin controller class + * @brief admin controller class of the layout module **/ class layoutAdminController extends layout { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 레이아웃 신규 생성 - * 레이아웃의 신규 생성은 제목만 받아서 layouts테이블에 입력함 + * @brief Create a new layout + * Insert a title into "layouts" table in order to create a layout **/ function procLayoutAdminInsert() { - // 레이아웃 생성과 관련된 기본 정보를 받음 + // Get information to create a layout $site_module_info = Context::get('site_module_info'); $args->site_srl = (int)$site_module_info->site_srl; $args->layout_srl = getNextSequence(); @@ -26,43 +26,37 @@ $args->title = Context::get('title'); $args->layout_type = Context::get('layout_type'); if(!$args->layout_type) $args->layout_type = "P"; - - // DB 입력 + // Insert into the DB $output = $this->insertLayout($args); if(!$output->toBool()) return $output; - - // faceOff 레이아웃일 경우 init 필요 + // initiate if it is faceoff layout $this->initLayout($args->layout_srl, $args->layout); - - // 결과 리턴 + // Return result $this->add('layout_srl', $args->layout_srl); } - - // 레이아웃 정보를 DB에 입력 + // Insert layout information into the DB function insertLayout($args) { $output = executeQuery("layout.insertLayout", $args); return $output; } - - // faceOff 레이아웃을 경우 init + // Initiate if it is faceoff layout function initLayout($layout_srl, $layout_name){ $oLayoutModel = &getModel('layout'); - - // faceOff일 경우 sample import + // Import a sample layout if it is faceoff if($oLayoutModel->useDefaultLayout($layout_name)) { $this->importLayout($layout_srl, $this->module_path.'tpl/faceOff_sample.tar'); - // 디렉토리 제거 + // Remove a directory } else { FileHandler::removeDir($oLayoutModel->getUserLayoutPath($layout_srl)); } } /** - * @brief 레이아웃 정보 변경 - * 생성된 레이아웃의 제목과 확장변수(extra_vars)를 적용한다 + * @brief Update layout information + * Apply a title of the new layout and extra vars **/ function procLayoutAdminUpdate() { - // module, act, layout_srl, layout, title을 제외하면 확장변수로 판단.. 좀 구리다.. + // Consider the rest of items as extra vars, except module, act, layout_srl, layout, and title .. Some gurida .. $extra_vars = Context::getRequestVars(); unset($extra_vars->module); unset($extra_vars->act); @@ -73,8 +67,7 @@ unset($extra_vars->apply_mobile_view); $args = Context::gets('layout_srl','title'); - - // 레이아웃의 정보를 가져옴 + // Get layout information $oLayoutModel = &getModel('layout'); $oMenuAdminModel = &getAdminModel('menu'); $layout_info = $oLayoutModel->getLayout($args->layout_srl); @@ -124,56 +117,46 @@ } } } - - // extra_vars의 type이 image일 경우 별도 처리를 해줌 + // Separately handle if a type of extra_vars is an image if($layout_info->extra_var) { foreach($layout_info->extra_var as $name => $vars) { if($vars->type!='image') continue; $image_obj = $extra_vars->{$name}; $extra_vars->{$name} = $layout_info->extra_var->{$name}->value; - - // 삭제 요청에 대한 변수를 구함 + // Get a variable on a request to delete $del_var = $extra_vars->{"del_".$name}; unset($extra_vars->{"del_".$name}); - // 삭제 요청이 있거나, 새로운 파일이 업로드 되면, 기존 파일 삭제 + // Delete the old file if there is a request to delete or a new file is uploaded if($del_var == 'Y' || $image_obj['tmp_name']) { FileHandler::removeFile($extra_vars->{$name}); $extra_vars->{$name} = ''; if($del_var == 'Y' && !$image_obj['tmp_name']) continue; } - - // 정상적으로 업로드된 파일이 아니면 무시 + // Ignore if the file is not successfully uploaded if(!$image_obj['tmp_name'] || !is_uploaded_file($image_obj['tmp_name'])) continue; - - // 이미지 파일이 아니어도 무시 (swf는 패스~) + // Ignore if the file is not an image (swf the paths ~) if(!preg_match("/\.(jpg|jpeg|gif|png|swf)$/i", $image_obj['name'])) continue; - - // 경로를 정해서 업로드 + // Upload the file to a path $path = sprintf("./files/attach/images/%s/", $args->layout_srl); - - // 디렉토리 생성 + // Create a directory if(!FileHandler::makeDir($path)) continue; $filename = $path.$image_obj['name']; - - // 파일 이동 + // Move the file if(!move_uploaded_file($image_obj['tmp_name'], $filename)) continue; $extra_vars->{$name} = $filename; } } - - // header script를 레이아웃 모듈의 config에 저장 + // Save header script into "config" of layout module $oModuleModel = &getModel('module'); $oModuleController = &getController('module'); $layout_config->header_script = Context::get('header_script'); $oModuleController->insertModulePartConfig('layout',$args->layout_srl,$layout_config); - - //menu의 title도 저장하자 + // Save a title of the menu $extra_vars->menu_name_list = $menu_name_list; - - // DB에 입력하기 위한 변수 설정 + // Variable setting for DB insert $args->extra_vars = serialize($extra_vars); $output = $this->updateLayout($args); @@ -196,8 +179,8 @@ } /** - * @brief 레이아웃 삭제 - * 삭제시 메뉴 xml 캐시 파일도 삭제 + * @brief Delete Layout + * Delete xml cache file too when deleting a layout **/ function procLayoutAdminDelete() { $layout_srl = Context::get('layout_srl'); @@ -212,8 +195,7 @@ $layout_file = $oLayoutModel->getUserLayoutHtml($layout_srl); if(file_exists($layout_file)) FileHandler::removeFile($layout_file); - - // 레이아웃 삭제 + // Delete Layout $args->layout_srl = $layout_srl; $output = executeQuery("layout.deleteLayout", $args); if(!$output->toBool()) return $output; @@ -222,7 +204,7 @@ } /** - * @brief 레이아웃 코드 추가 + * @brief Adding Layout Code **/ function procLayoutAdminCodeUpdate() { $layout_srl = Context::get('layout_srl'); @@ -248,7 +230,7 @@ } /** - * @brief 레이아웃 코드 초기화 + * @brief Reset layout code **/ function procLayoutAdminCodeReset() { $layout_srl = Context::get('layout_srl'); @@ -274,7 +256,7 @@ /** - * @brief 레이아웃 설정페이지 -> 이미지 업로드 + * @brief Layout setting page -> Upload an image * **/ function procLayoutAdminUserImageUpload(){ @@ -294,7 +276,7 @@ } /** - * @brief 레이아웃 설정페이지 -> 이미지 업로드 + * @brief Layout setting page -> Upload an image * **/ function insertUserLayoutImage($layout_srl,$source){ @@ -315,7 +297,7 @@ /** - * @brief 레이아웃 설정페이지 -> 이미지 삭제 + * @brief Layout setting page -> Delete an image * **/ function removeUserLayoutImage($layout_srl,$filename){ @@ -325,7 +307,7 @@ } /** - * @brief 레이아웃 설정페이지 -> 이미지 삭제 + * @brief Layout setting page -> Delete an image * **/ function procLayoutAdminUserImageDelete(){ @@ -337,8 +319,8 @@ /** - * @brief 레이아웃 설정 저장 - * ini 로 저장한다 faceoff 용 + * @brief Save layout configuration + * save in "ini" format for faceoff **/ function procLayoutAdminUserValueInsert(){ $oModuleModel = &getModel('module'); @@ -387,7 +369,7 @@ } /** - * @brief 레이아웃 설정 ini 저장 + * @brief Layout setting, save "ini" * **/ function insertUserLayoutValue($layout_srl,$arr){ @@ -401,7 +383,7 @@ } /** - * @brief faceoff용 위젯코드를 사용자 layout 파일에 직접 추가한다 + * @brief Add the widget code for faceoff into user layout file * **/ function addExtension($layout_srl,$arg,$content){ @@ -426,7 +408,7 @@ /** - * @brief faceoff용 temp file들을 지운다 + * @brief Delete temp files for faceoff * **/ function deleteUserLayoutTempFile($layout_srl){ @@ -446,12 +428,10 @@ if(!$layout_srl) return new Object('-1','msg_invalid_request'); require_once(_XE_PATH_.'libs/tar.class.php'); - - // 압축할 파일 목록을 가져온다 + // Get a list of files to zip $oLayoutModel = &getModel('layout'); $file_list = $oLayoutModel->getUserLayoutFileList($layout_srl); - - // 압축을 한다. + // Compress the files $tar = new tar(); $user_layout_path = FileHandler::getRealPath($oLayoutModel->getUserLayoutPath($layout_srl)); chdir($user_layout_path); @@ -468,8 +448,7 @@ header('Content-Disposition: attachment; filename="'. $filename .'"'); header("Content-Transfer-Encoding: binary\n"); echo $stream; - - // Context를 강제로 닫고 종료한다. + // Close Context and then exit Context::close(); exit(); } @@ -508,16 +487,14 @@ FileHandler::makeDir($image_path); $tar = new tar(); $tar->openTAR($source_file); - - // layout.ini 파일이 없으면 + // If layout.ini file does not exist if(!$tar->getFile('layout.ini')) return; $replace_path = getNumberingPath($layout_srl,3); foreach($tar->files as $key => $info) { FileHandler::writeFile($user_layout_path . $info['name'],str_replace('__LAYOUT_PATH__',$replace_path,$info['file'])); } - - // 업로드한 파일을 삭제 + // Remove uploaded file FileHandler::removeFile($source_file); } } diff --git a/modules/layout/layout.admin.view.php b/modules/layout/layout.admin.view.php index f868a95b8..0e3e72c01 100644 --- a/modules/layout/layout.admin.view.php +++ b/modules/layout/layout.admin.view.php @@ -2,20 +2,20 @@ /** * @class layoutAdminView * @author NHN (developers@xpressengine.com) - * @brief layout 모듈의 admin view class + * @brief admin view class of the layout module **/ class layoutAdminView extends layout { /** - * @brief 초기화 + * @brief Initialization **/ function init() { $this->setTemplatePath($this->module_path.'tpl'); } /** - * @brief 레이아웃 관리의 첫 페이지 + * @brief The first page of the layout admin **/ function dispLayoutAdminContent() { $oLayoutModel = &getModel('layout'); @@ -35,11 +35,11 @@ } /** - * @brief 레이아웃 등록 페이지 - * 1차적으로 레이아웃만 선택한 후 DB 에 빈 값을 넣고 그 후 상세 값 설정하는 단계를 거침 + * @brief Layout setting page + * Once select a layout with empty value in the DB, then adjust values **/ function dispLayoutAdminInsert() { - // 레이아웃 목록을 세팅 + // Set layout list $oLayoutModel = &getModel('layout'); $layout_type = Context::get('layout_type'); $layout_list = $oLayoutModel->getDownloadedLayoutList($layout_type); @@ -49,25 +49,20 @@ } /** - * @brief 레이아웃 세부 정보 입력 + * @brief Insert Layout details **/ function dispLayoutAdminModify() { - - // 선택된 레이아웃의 정보르 구해서 세팅 + // Set the layout after getting layout information $layout_srl = Context::get('layout_srl'); - - // 레이아웃의 정보를 가져옴 + // Get layout information $oLayoutModel = &getModel('layout'); $layout_info = $oLayoutModel->getLayout($layout_srl); - - // 등록된 레이아웃이 없으면 오류 표시 + // Error appears if there is no layout information is registered if(!$layout_info) return $this->dispLayoutAdminContent(); - - // faceoff면 경로를 보여줄 필요는 없다 + // If faceoff, no need to display the path if($layout_info->type == 'faceoff') unset($layout_info->path); Context::set('selected_layout', $layout_info); - - // 메뉴 목록을 가져옴 + // Get a menu list $oMenuAdminModel = &getAdminModel('menu'); $menu_list = $oMenuAdminModel->getMenus(); Context::set('menu_list', $menu_list); @@ -76,25 +71,22 @@ } /** - * @brief 레이아웃 코드 편집 + * @brief Edit layout codes **/ function dispLayoutAdminEdit() { - // 선택된 레이아웃의 정보르 구해서 세팅 + // Set the layout with its information $layout_srl = Context::get('layout_srl'); - - // 레이아웃의 정보를 가져옴 + // Get layout information $oLayoutModel = &getModel('layout'); $layout_info = $oLayoutModel->getLayout($layout_srl); - - // 등록된 레이아웃이 없으면 오류 표시 + // Error appears if there is no layout information is registered if(!$layout_info) return $this->dispLayoutAdminContent(); Context::set('selected_layout', $layout_info); - - // 레이아웃 코드 가져오기 + // Get Layout Code $oLayoutModel = &getModel('layout'); $layout_file = $oLayoutModel->getUserLayoutHtml($layout_info->layout_srl); if(!file_exists($layout_file)){ - // faceoff 면 + // If faceoff if($oLayoutModel->useDefaultLayout($layout_info->layout_srl)){ $layout_file = $oLayoutModel->getDefaultLayoutHtml($layout_info->layout); }else{ @@ -117,8 +109,7 @@ $layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_info->layout_srl); Context::set('layout_image_path', $layout_image_path); - - // 위젯 목록을 세팅 + // Set widget list $oWidgetModel = &getModel('widget'); $widget_list = $oWidgetModel->getDownloadedWidgetList(); Context::set('widget_list', $widget_list); @@ -127,10 +118,10 @@ } /** - * @brief 레이아웃 목록을 보여줌 + * @brief Display a layout list **/ function dispLayoutAdminDownloadedList() { - // 레이아웃 목록을 세팅 + // Set a layout list $oLayoutModel = &getModel('layout'); $layout_list = $oLayoutModel->getDownloadedLayoutList(); Context::set('layout_list', $layout_list); @@ -139,7 +130,7 @@ } function dispLayoutAdminDownloadedMobileList() { - // 레이아웃 목록을 세팅 + // Set a layout list $oLayoutModel = &getModel('layout'); $layout_list = $oLayoutModel->getDownloadedLayoutList(0, "M"); Context::set('layout_list', $layout_list); @@ -148,33 +139,28 @@ } /** - * @brief 레이아웃 미리 보기 + * @brief Preview a layout **/ function dispLayoutAdminPreview() { $layout_srl = Context::get('layout_srl'); $code = Context::get('code'); $code_css = Context::get('code_css'); if(!$layout_srl || !$code) return new Object(-1, 'msg_invalid_request'); - - // 레이아웃 정보 가져오기 + // Get the layout information $oLayoutModel = &getModel('layout'); $layout_info = $oLayoutModel->getLayout($layout_srl); if(!$layout_info) return new Object(-1, 'msg_invalid_request'); - - // faceoff 레이아웃일 경우 별도 처리 + // Separately handle the layout if its type is faceoff if($layout_info && $layout_info->type == 'faceoff') $oLayoutModel->doActivateFaceOff($layout_info); - - // 직접 입력된 CSS 적용 + // Apply CSS directly Context::addHtmlHeader(""); - - // 레이아웃 정보중 extra_vars의 이름과 값을 $layout_info에 입력 + // Set names and values of extra_vars to $layout_info if($layout_info->extra_var_count) { foreach($layout_info->extra_var as $var_id => $val) { $layout_info->{$var_id} = $val->value; } } - - // 레이아웃 정보중 menu를 Context::set + // menu in layout information becomes an argument for Context:: set if($layout_info->menu_count) { foreach($layout_info->menu as $menu_id => $menu) { if(file_exists($menu->php_file)) @include($menu->php_file); @@ -184,12 +170,10 @@ Context::set('layout_info', $layout_info); Context::set('content', Context::getLang('layout_preview_content')); - - // 코드를 임시로 저장 + // Temporary save the codes $edited_layout_file = sprintf('./files/cache/layout/tmp.tpl'); FileHandler::writeFile($edited_layout_file, $code); - - // 컴파일 + // Compile $oTemplate = &TemplateHandler::getInstance(); $layout_path = $layout_info->path; @@ -197,44 +181,39 @@ $layout_tpl = $oTemplate->compile($layout_path, $layout_file, $edited_layout_file); Context::set('layout','none'); - - // 위젯등을 변환 + // Convert widgets and others $oContext = &Context::getInstance(); Context::set('layout_tpl', $layout_tpl); - - // 임시 파일 삭제 + // Delete Temporary Files FileHandler::removeFile($edited_layout_file); $this->setTemplateFile('layout_preview'); } /** - * @brief 레이아웃의 상세 정보(conf/info.xml)를 팝업 출력 + * @brief Pop-up details of the layout(conf/info.xml) **/ function dispLayoutAdminInfo() { - // 선택된 레이아웃 정보를 구함 + // Get the layout information $oLayoutModel = &getModel('layout'); $layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout')); Context::set('layout_info', $layout_info); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('layout_detail_info'); } /** - * @brief faceoff의 관리자 layout 수정 + * @brief Modify admin layout of faceoff **/ function dispLayoutAdminLayoutModify(){ - //layout_srl 를 가져온다 + // Get layout_srl $current_module_info = Context::get('current_module_info'); $layout_srl = $current_module_info->layout_srl; - - // 파일로 임시저장을 하기때문에 남아 있을지 모르는 tmp를 지운다 - // to do 개선이 필요 + // Remove the remaining tmp files because of temporarily saving + // This part needs to be modified $delete_tmp = Context::get('delete_tmp'); if($delete_tmp =='Y'){ $oLayoutAdminController = &getAdminController('layout'); @@ -242,11 +221,9 @@ } $oLayoutModel = &getModel('layout'); - - // layout file들은 temp로 사용한다. + // layout file is used as a temp. $oLayoutModel->setUseUserLayoutTemp(); - - // css 를 inline style로 뽑는다 + // Apply CSS in inline style $faceoffcss = $oLayoutModel->_getUserLayoutFaceOffCss($current_module_info->layout_srl); $css = FileHandler::readFile($faceoffcss); @@ -267,24 +244,20 @@ $oTemplate = &TemplateHandler::getInstance(); Context::set('content', $oTemplate->compile($this->module_path.'tpl','about_faceoff')); - - // 위젯 코드를 Javascript 수정모드로 변경 + // Change widget codes in Javascript mode $oWidgetController = &getController('widget'); $oWidgetController->setWidgetCodeInJavascriptMode(); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('faceoff_layout_edit'); } function dispLayoutAdminLayoutImageList(){ $layout_srl = Context::get('layout_srl'); $oLayoutModel = &getModel('layout'); - - // 이미지 목록 + // Image List $layout_image_list = $oLayoutModel->getUserLayoutImageList($layout_srl); Context::set('layout_image_list',$layout_image_list); - - // 경로 + // Path $layout_image_path = $oLayoutModel->getUserLayoutImagePath($layout_srl); Context::set('layout_image_path',$layout_image_path); diff --git a/modules/layout/layout.class.php b/modules/layout/layout.class.php index 72339bb91..dcf4e3540 100644 --- a/modules/layout/layout.class.php +++ b/modules/layout/layout.class.php @@ -2,31 +2,29 @@ /** * @class layout * @author NHN (developers@xpressengine.com) - * @brief layout 모듈의 high class + * @brief high class of the layout module **/ class layout extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // 레이아웃에서 사용할 디렉토리 생성 + // Create a directory to be used in the layout FileHandler::makeDir('./files/cache/layout'); return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { $oDB = &DB::getInstance(); - - // 2009. 02. 11 layout 테이블에 site_srl 추가 + // 2009. 02. 11 Add site_srl to layout table if(!$oDB->isColumnExists('layouts', 'site_srl')) return true; - - // 2009. 02. 26 faceOff에 맞춰 기존 레이아웃 편집본을 이동 + // 2009. 02. 26 Move the previous layout for faceoff $files = FileHandler::readDir('./files/cache/layout'); for($i=0,$c=count($files);$i<$c;$i++) { $filename = $files[$i]; @@ -39,17 +37,15 @@ } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { $oDB = &DB::getInstance(); - - // 2009. 02. 11 menu 테이블에 site_srl 추가 + // 2009. 02. 11 Add site_srl to menu table if(!$oDB->isColumnExists('layouts', 'site_srl')) { $oDB->addColumn('layouts','site_srl','number',11,0,true); } - - // 2009. 02. 26 faceOff에 맞춰 기존 레이아웃 편집본을 이동 + // 2009. 02. 26 Move the previous layout for faceoff $oLayoutModel = &getModel('layout'); $files = FileHandler::readDir('./files/cache/layout'); for($i=0,$c=count($files);$i<$c;$i++) { @@ -72,10 +68,10 @@ /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { - // 레이아웃 캐시 삭제 (수정본은 지우지 않음) + // Remove layout cache(modified layout is not deleted) $path = './files/cache/layout'; if(!is_dir($path)) { FileHandler::makeDir($path); diff --git a/modules/layout/layout.model.php b/modules/layout/layout.model.php index 5874b9ce8..e7b19b8bd 100644 --- a/modules/layout/layout.model.php +++ b/modules/layout/layout.model.php @@ -3,21 +3,21 @@ * @class layoutModel * @author NHN (developers@xpressengine.com) * @version 0.1 - * @brief layout 모듈의 Model class + * @brief Model class of the layout module **/ class layoutModel extends layout { var $useUserLayoutTemp = null; /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief DB 에 생성된 레이아웃의 목록을 구함 - * 생성되었다는 것은 DB에 등록이 되었다는 것을 의미 + * @brief Get a layout list created in the DB + * If you found a new list, it means that the layout list is inserted to the DB **/ function getLayoutList($site_srl = 0, $layout_type="P") { if(!$site_srl) { @@ -33,22 +33,21 @@ } /** - * @brief DB 에 생성된 한개의 레이아웃 정보를 구함 - * 생성된 레이아웃의 DB정보+XML정보를 return + * @brief Get one of layout information created in the DB + * Return DB info + XML info of the generated layout **/ function getLayout($layout_srl) { - // 일단 DB에서 정보를 가져옴 + // Get information from the DB $args->layout_srl = $layout_srl; $output = executeQuery('layout.getLayout', $args); if(!$output->data) return; - - // layout, extra_vars를 정리한 후 xml 파일 정보를 정리해서 return + // Return xml file informaton after listing up the layout and extra_vars $layout_info = $this->getLayoutInfo($layout, $output->data, $output->data->layout_type); return $layout_info; } /** - * @brief 레이아웃의 경로를 구함 + * @brief Get a layout path **/ function getLayoutPath($layout_name, $layout_type = "P") { if($layout_name == 'faceoff'){ @@ -65,11 +64,11 @@ } /** - * @brief 레이아웃의 종류와 정보를 구함 - * 다운로드되어 있는 레이아웃의 종류 (생성과 다른 의미) + * @brief Get a type and information of the layout + * A type of downloaded layout **/ function getDownloadedLayoutList($layout_type = "P") { - // 다운받은 레이아웃과 설치된 레이아웃의 목록을 구함 + // Get a list of downloaded layout and installed layout if($layout_type == "M") { $directory = "./m.layouts"; @@ -84,13 +83,11 @@ if(!$searched_count) return; natcasesort($searched_list); - - // 찾아진 레이아웃 목록을 loop돌면서 필요한 정보를 간추려 return + // Return information for looping searched list of layouts for($i=0;$i<$searched_count;$i++) { - // 레이아웃의 이름 + // Name of the layout $layout = $searched_list[$i]; - - // 해당 레이아웃의 정보를 구함 + // Get information of the layout $layout_info = $this->getLayoutInfo($layout, null, $layout_type); $list[] = $layout_info; @@ -99,8 +96,8 @@ } /** - * @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함 - * 이것 역시 캐싱을 통해서 xml parsing 시간을 줄인다.. + * @brief Get information by reading conf/info.xml in the module + * It uses caching to reduce time for xml parsing .. **/ function getLayoutInfo($layout, $info = null, $layout_type = "P") { if($info) { @@ -115,12 +112,10 @@ $xml_file = sprintf('%sskin.xml', $layout_path); } } - - // 요청된 모듈의 경로를 구한다. 없으면 return + // Get a path of the requested module. Return if not exists. if(!$layout_path) $layout_path = $this->getLayoutPath($layout, $layout_type); if(!is_dir($layout_path)) return; - - // 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음 + // Read the xml file for module skin information if(!$xml_file) $xml_file = sprintf("%sconf/info.xml", $layout_path); if(!file_exists($xml_file)) { $layout_info->layout = $layout; @@ -130,8 +125,7 @@ $layout_info->layout_type = $layout_type; return $layout_info; } - - // cache 파일을 비교하여 문제 없으면 include하고 $layout_info 변수를 return + // Include the cache file if it is valid and then return $layout_info variable if(!$layout_srl){ $cache_file = $this->getLayoutCache($layout, Context::getLangType()); }else{ @@ -149,8 +143,7 @@ } return $layout_info; } - - // cache 파일이 없으면 xml parsing하고 변수화 한 후에 캐시 파일에 쓰고 변수 바로 return + // If no cache file exists, parse the xml and then return the variable. $oXmlParser = new XmlParser(); $tmp_xml_obj = $oXmlParser->loadXmlFile($xml_file); if($tmp_xml_obj->layout) $xml_obj = $tmp_xml_obj->layout; @@ -162,7 +155,7 @@ $buff .= sprintf('$layout_info->site_srl = "%s";', $site_srl); if($xml_obj->version && $xml_obj->attrs->version == '0.2') { - // 레이아웃의 제목, 버전 + // Layout title, version and other information sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); $date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); $buff .= sprintf('$layout_info->layout = "%s";', $layout); @@ -178,8 +171,7 @@ $buff .= sprintf('$layout_info->license = "%s";', $xml_obj->license->body); $buff .= sprintf('$layout_info->license_link = "%s";', $xml_obj->license->attrs->link); $buff .= sprintf('$layout_info->layout_type = "%s";', $layout_type); - - // 작성자 정보 + // Author information if(!is_array($xml_obj->author)) $author_list[] = $xml_obj->author; else $author_list = $xml_obj->author; @@ -188,10 +180,7 @@ $buff .= sprintf('$layout_info->author['.$i.']->email_address = "%s";', $author_list[$i]->attrs->email_address); $buff .= sprintf('$layout_info->author['.$i.']->homepage = "%s";', $author_list[$i]->attrs->link); } - - - - // 추가 변수 (템플릿에서 사용할 제작자 정의 변수) + // Extra vars (user defined variables to use in a template) $extra_var_groups = $xml_obj->extra_vars->group; if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); @@ -239,8 +228,7 @@ } } } - - // 메뉴 + // Menu if($xml_obj->menus->menu) { $menus = $xml_obj->menus->menu; if(!is_array($menus)) $menus = array($menus); @@ -297,8 +285,7 @@ } else { - - // 레이아웃의 제목, 버전 + // Layout title, version and other information sscanf($xml_obj->author->attrs->date, '%d. %d. %d', $date_obj->y, $date_obj->m, $date_obj->d); $date = sprintf('%04d%02d%02d', $date_obj->y, $date_obj->m, $date_obj->d); $buff .= sprintf('$layout_info->layout = "%s";', $layout); @@ -309,13 +296,11 @@ $buff .= sprintf('$layout_info->date = "%s";', $date); $buff .= sprintf('$layout_info->layout_srl = $layout_srl;'); $buff .= sprintf('$layout_info->layout_title = $layout_title;'); - - // 작성자 정보 + // Author information $buff .= sprintf('$layout_info->author[0]->name = "%s";', $xml_obj->author->name->body); $buff .= sprintf('$layout_info->author[0]->email_address = "%s";', $xml_obj->author->attrs->email_address); $buff .= sprintf('$layout_info->author[0]->homepage = "%s";', $xml_obj->author->attrs->link); - - // 추가 변수 (템플릿에서 사용할 제작자 정의 변수) + // Extra vars (user defined variables to use in a template) $extra_var_groups = $xml_obj->extra_vars->group; if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); @@ -350,8 +335,7 @@ } } } - - // 메뉴 + // Menu if($xml_obj->menus->menu) { $menus = $xml_obj->menus->menu; if(!is_array($menus)) $menus = array($menus); @@ -389,7 +373,7 @@ /** - * @brief layout설정화면에서의 업로드한 이미지목록을 반환한다 + * @brief Return a list of images which are uploaded on the layout setting page **/ function getUserLayoutImageList($layout_srl){ $path = $this->getUserLayoutImagePath($layout_srl); @@ -399,7 +383,7 @@ /** - * @brief ini config들을 가져온다 array다. + * @brief Get ini configurations and make them an array. **/ function getUserLayoutIniConfig($layout_srl, $layout_name=null){ $file = $this->getUserLayoutIni($layout_srl); @@ -426,7 +410,7 @@ } /** - * @brief user layout css 관리자가 설정화면에서 저장한 css + * @brief css which is set by an administrator on the layout setting page **/ function getUserLayoutCss($layout_srl){ return $this->getUserLayoutPath($layout_srl). 'layout.css'; @@ -434,7 +418,7 @@ /** - * @brief faceoff용 css module handler에서 import 한다 + * @brief Import faceoff css from css module handler **/ function getUserLayoutFaceOffCss($layout_srl){ $src = $this->_getUserLayoutFaceOffCss($layout_srl); @@ -444,7 +428,7 @@ /** - * @brief faceoff용 css module handler에서 import 한다 + * @brief Import faceoff css from css module handler **/ function _getUserLayoutFaceOffCss($layout_srl){ return $this->getUserLayoutPath($layout_srl). 'faceoff.css'; @@ -504,7 +488,7 @@ /** * @brief user layout cache - * todo 파일 자체를 삭제 필요가 있다 + * todo It may need to remove the file itself **/ function getUserLayoutCache($layout_srl,$lang_type){ return $this->getUserLayoutPath($layout_srl). "{$lang_type}.cache.php"; @@ -518,28 +502,28 @@ } /** - * @brief default layout ini 사용자의 임의 수정을 막기 위해 + * @brief default layout ini to prevent arbitrary changes by a user **/ function getDefaultLayoutIni($layout_name){ return $this->getDefaultLayoutPath($layout_name). 'layout.ini'; } /** - * @brief default layout html 사용자의 임의 수정을 막기 위해 + * @brief default layout html to prevent arbitrary changes by a user **/ function getDefaultLayoutHtml($layout_name){ return $this->getDefaultLayoutPath($layout_name). 'layout.html'; } /** - * @brief default layout css 사용자의 임의 수정을 막기 위해 + * @brief default layout css to prevent arbitrary changes by a user **/ function getDefaultLayoutCss($layout_name){ return $this->getDefaultLayoutPath($layout_name). 'css/layout.css'; } /** - * @brief default layout path 사용자의 임의 수정을 막기 위해 + * @brief default layout path to prevent arbitrary changes by a user **/ function getDefaultLayoutPath() { return "./modules/layout/faceoff/"; @@ -547,7 +531,7 @@ /** - * @brief faceoff 인지 + * @brief faceoff is **/ function useDefaultLayout($layout_name){ $info = $this->getLayoutInfo($layout_name); @@ -557,7 +541,7 @@ /** - * @brief User Layout 을 임시 저장 모드로 + * @brief Set user layout as temporary save mode **/ function setUseUserLayoutTemp($flag='temp'){ $this->useUserLayoutTemp = $flag; @@ -565,7 +549,7 @@ /** - * @brief User Layout 임시 저장 파일 목록. + * @brief Temp file list for User Layout **/ function getUserLayoutTempFileList($layout_srl){ $file_list = array( @@ -578,7 +562,7 @@ /** - * @brief User Layout 저장 파일 목록. + * @brief Saved file list for User Layout **/ function getUserLayoutFileList($layout_srl){ $file_list = array( @@ -596,32 +580,26 @@ } /** - * @brief faceOff관련 서비스 출력을 위한 동작 실행 + * @brief faceOff related services for the operation run out **/ function doActivateFaceOff(&$layout_info) { $layout_info->faceoff_ini_config = $this->getUserLayoutIniConfig($layout_info->layout_srl, $layout_info->layout); - - // 기본 faceoff layout CSS + // faceoff layout CSS Context::addCSSFile($this->getDefaultLayoutCss($layout_info->layout)); - - // 레이아웃 매니져에서 생성된 CSS + // CSS generated in the layout manager $faceoff_layout_css = $this->getUserLayoutFaceOffCss($layout_info->layout_srl); if($faceoff_layout_css) Context::addCSSFile($faceoff_layout_css); - - // 레이아웃의 위젯을 위한 css출력 + // CSS output for the widget Context::addCSSFile($this->module_path.'/tpl/css/widget.css'); if($layout_info->extra_var->colorset->value == 'black') Context::addCSSFile($this->module_path.'/tpl/css/widget@black.css'); else Context::addCSSFile($this->module_path.'/tpl/css/widget@white.css'); - - // 권한에 따른 다른 내용 출력 + // Different page displayed upon user's permission $logged_info = Context::get('logged_info'); - - // faceOff 레이아웃 편집 버튼 노출 + // Display edit button for faceoff layout if(Context::get('module')!='admin' && strpos(Context::get('act'),'Admin')===false && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) { Context::addHtmlFooter(""); } - - // faceOff페이지 수정시에 메뉴 출력 + // Display menu when editing the faceOff page if(Context::get('act')=='dispLayoutAdminLayoutModify' && ($logged_info->is_admin == 'Y' || $logged_info->is_site_admin)) { $oTemplate = &TemplateHandler::getInstance(); Context::addBodyHeader($oTemplate->compile($this->module_path.'/tpl', 'faceoff_layout_menu')); diff --git a/modules/layout/layout.view.php b/modules/layout/layout.view.php index c0d4f25d5..c1aed24ff 100644 --- a/modules/layout/layout.view.php +++ b/modules/layout/layout.view.php @@ -2,32 +2,30 @@ /** * @class layoutView * @author NHN (developers@xpressengine.com) - * @brief layout 모듈의 admin view class + * @brief admin view class of the layout module **/ class layoutView extends layout { /** - * @brief 초기화 + * @brief Initialization **/ function init() { $this->setTemplatePath($this->module_path.'tpl'); } /** - * @brief 레이아웃의 상세 정보(conf/info.xml)를 팝업 출력 + * @brief Pop-up layout details(conf/info.xml) **/ function dispLayoutInfo() { - // 선택된 레이아웃 정보를 구함 + // Get the layout information $oLayoutModel = &getModel('layout'); $layout_info = $oLayoutModel->getLayoutInfo(Context::get('selected_layout')); if(!$layout_info) exit(); Context::set('layout_info', $layout_info); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('layout_detail_info'); } } diff --git a/modules/member/member.admin.controller.php b/modules/member/member.admin.controller.php index caab036e7..25e095afc 100644 --- a/modules/member/member.admin.controller.php +++ b/modules/member/member.admin.controller.php @@ -2,50 +2,44 @@ /** * @class memberAdminController * @author NHN (developers@xpressengine.com) - * @brief member module의 admin controller class + * @brief member module of the admin controller class **/ class memberAdminController extends member { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 사용자 추가 (관리자용) + * @brief Add a user (Administrator) **/ function procMemberAdminInsert() { if(Context::getRequestMethod() == "GET") return new Object(-1, "msg_invalid_request"); - // 필수 정보들을 미리 추출 + // Extract the necessary information in advance $args = Context::gets('member_srl','user_id','user_name','nick_name','homepage','blog','birthday','email_address','password','allow_mailing','allow_message','denied','is_admin','description','group_srl_list','limit_date'); - - // 넘어온 모든 변수중에서 몇가지 불필요한 것들 삭제 + // Remove some unnecessary variables from all the vars $all_args = Context::getRequestVars(); unset($all_args->module); unset($all_args->act); if(!isset($args->limit_date)) $args->limit_date = ""; - - // 모든 request argument에서 필수 정보만 제외 한 후 추가 데이터로 입력 + // Add extra vars after excluding necessary information from all the requested arguments $extra_vars = delObjectVars($all_args, $args); $args->extra_vars = serialize($extra_vars); - - // member_srl이 넘어오면 원 회원이 있는지 확인 + // Check if an original member exists having the member_srl if($args->member_srl) { - // 멤버 모델 객체 생성 + // Create a member model object $oMemberModel = &getModel('member'); - - // 회원 정보 구하기 + // Get memebr profile $member_info = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); - - // 만약 원래 회원이 없으면 새로 입력하기 위한 처리 + // If no original member exists, make a new one if($member_info->member_srl != $args->member_srl) unset($args->member_srl); } $oMemberController = &getController('member'); - - // member_srl의 값에 따라 insert/update + // Execute insert or update depending on the value of member_srl if(!$args->member_srl) { $output = $oMemberController->insertMember($args); $msg_code = 'success_registed'; @@ -55,21 +49,19 @@ } if(!$output->toBool()) return $output; - - // 서명 저장 + // Save Signature $signature = Context::get('signature'); $oMemberController->putSignature($args->member_srl, $signature); - - // 결과 리턴 + // Return result $this->add('member_srl', $args->member_srl); $this->setMessage($msg_code); } /** - * @brief 사용자 삭제 (관리자용) + * @brief Delete a user (Administrator) **/ function procMemberAdminDelete() { - // 일단 입력된 값들을 모두 받아서 db 입력항목과 그외 것으로 분리 + // Separate all the values into DB entries and others $member_srl = Context::get('member_srl'); $oMemberController = &getController('member'); @@ -81,10 +73,10 @@ } /** - * @brief 회원 관리용 기본 정보의 추가 + * @brief Add information for member administration **/ function procMemberAdminInsertConfig() { - // 기본 정보를 받음 + // Get the basic information $args = Context::gets( 'webmaster_name', 'webmaster_email', 'skin', 'colorset', @@ -119,7 +111,7 @@ } /** - * @brief 사용자 그룹 추가 + * @brief Add a user group **/ function procMemberAdminInsertGroup() { $args = Context::gets('title','description','is_default','image_mark'); @@ -132,7 +124,7 @@ } /** - * @brief 사용자 그룹 정보 수정 + * @brief Update user group information **/ function procMemberAdminUpdateGroup() { $group_srl = Context::get('group_srl'); @@ -159,7 +151,7 @@ } /** - * @brief 가입 항목 추가 + * @brief Add a join form **/ function procMemberAdminInsertJoinForm() { $args->member_join_form_srl = Context::get('member_join_form_srl'); @@ -173,15 +165,13 @@ $args->required = Context::get('required'); if(!in_array(strtoupper($args->required), array('Y','N'))) $args->required = 'N'; $args->description = Context::get('description'); - - // 기본값의 정리 + // Default values if(in_array($args->column_type, array('checkbox','select','radio')) && count($args->default_value) ) { $args->default_value = serialize($args->default_value); } else { $args->default_value = ''; } - - // member_join_form_srl이 있으면 수정, 없으면 추가 + // Fix if member_join_form_srl exists. Add if not exists. if(!$args->member_join_form_srl){ $args->list_order = getNextSequence(); $output = executeQuery('member.insertJoinForm', $args); @@ -196,7 +186,7 @@ } /** - * @brief 가입 항목의 상/하 이동 및 내용 수정 + * @brief Move up/down the member join form and modify it **/ function procMemberAdminUpdateJoinForm() { $member_join_form_srl = Context::get('member_join_form_srl'); @@ -224,7 +214,7 @@ } /** - * @brief 선택된 회원들을 일괄 삭제 + * @brief Delete the selected members */ function procMemberAdminDeleteMembers() { $target_member_srls = Context::get('target_member_srls'); @@ -244,7 +234,7 @@ } /** - * @brief 선택된 회원들의 그룹을 일괄 변경 + * @brief Update a group of selected memebrs **/ function procMemberAdminUpdateMembersGroup() { $member_srl = Context::get('member_srl'); @@ -257,16 +247,14 @@ $oDB = &DB::getInstance(); $oDB->begin(); - - // 선택된 회원들의 그룹을 삭제 + // Delete a group of selected members $args->member_srl = $member_srl; $output = executeQuery('member.deleteMembersGroup', $args); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // 선택된 그룹으로 추가 + // Add to a selected group $group_count = count($group_srls); $member_count = count($member_srls); for($j=0;$j<$group_count;$j++) { @@ -293,7 +281,7 @@ } /** - * @brief 금지 아이디 추가 + * @brief Add a denied ID **/ function procMemberAdminInsertDeniedID() { $user_id = Context::get('user_id'); @@ -308,7 +296,7 @@ } /** - * @brief 금지 아이디 업데이트 + * @brief Update denied ID **/ function procMemberAdminUpdateDeniedID() { $user_id = Context::get('user_id'); @@ -327,13 +315,12 @@ } /** - * @brief 관리자를 추가한다 + * @brief Add an administrator **/ function insertAdmin($args) { - // 관리자임을 설정 + // Assign an administrator $args->is_admin = 'Y'; - - // 관리자 그룹을 구해와서 설정 + // Get admin group and set $oMemberModel = &getModel('member'); $admin_group = $oMemberModel->getAdminGroup(); $args->group_srl_list = $admin_group->group_srl; @@ -343,7 +330,7 @@ } /** - * @brief 회원의 그룹값을 변경 + * @brief Change the group values of member **/ function changeGroup($source_group_srl, $target_group_srl) { $args->source_group_srl = $source_group_srl; @@ -353,11 +340,11 @@ } /** - * @brief 그룹 등록 + * @brief Insert a group **/ function insertGroup($args) { if(!$args->site_srl) $args->site_srl = 0; - // is_default값을 체크, Y일 경우 일단 모든 is_default에 대해서 N 처리 + // Check the value of is_default. if($args->is_default!='Y') { $args->is_default = 'N'; } else { @@ -369,10 +356,10 @@ } /** - * @brief 그룹 정보 수정 + * @brief Modify Group Information **/ function updateGroup($args) { - // is_default값을 체크, Y일 경우 일단 모든 is_default에 대해서 N 처리 + // Check the value of is_default. if($args->is_default!='Y') $args->is_default = 'N'; else { $output = executeQuery('member.updateGroupDefaultClear', $args); @@ -383,23 +370,20 @@ } /** - * 그룹 삭제 + * Delete a Group **/ function deleteGroup($group_srl, $site_srl = null) { - // 멤버모델 객체 생성 + // Create a member model object $oMemberModel = &getModel('member'); - - // 삭제 대상 그룹을 가져와서 체크 (is_default == 'Y'일 경우 삭제 불가) + // Check the group_srl (If is_default == 'Y', it cannot be deleted) $group_info = $oMemberModel->getGroup($group_srl); if(!$group_info) return new Object(-1, 'lang->msg_not_founded'); if($group_info->is_default == 'Y') return new Object(-1, 'msg_not_delete_default'); - - // is_default == 'Y'인 그룹을 가져옴 + // Get groups where is_default == 'Y' $default_group = $oMemberModel->getDefaultGroup($site_srl); $default_group_srl = $default_group->group_srl; - - // default_group_srl로 변경 + // Change to default_group_srl $this->changeGroup($group_srl, $default_group_srl); $args->group_srl = $group_srl; @@ -418,7 +402,7 @@ } /** - * @brief 금지아이디 등록 + * @brief Register denied ID **/ function insertDeniedID($user_id, $description = '') { $args->user_id = $user_id; @@ -429,7 +413,7 @@ } /** - * @brief 금지아이디 삭제 + * @brief Delete a denied ID **/ function deleteDeniedID($user_id) { $args->user_id = $user_id; @@ -437,7 +421,7 @@ } /** - * @brief 가입폼 항목을 삭제 + * @brief Delete a join form **/ function deleteJoinForm($member_join_form_srl) { $args->member_join_form_srl = $member_join_form_srl; @@ -446,19 +430,17 @@ } /** - * @brief 가입항목을 상단으로 이동 + * @brief Move up a join form **/ function moveJoinFormUp($member_join_form_srl) { $oMemberModel = &getModel('member'); - - // 선택된 가입항목의 정보를 구한다 + // Get information of the join form $args->member_join_form_srl = $member_join_form_srl; $output = executeQuery('member.getJoinForm', $args); $join_form = $output->data; $list_order = $join_form->list_order; - - // 전체 가입항목 목록을 구한다 + // Get a list of all join forms $join_form_list = $oMemberModel->getJoinFormList(); $join_form_srl_list = array_keys($join_form_list); if(count($join_form_srl_list)<2) return new Object(); @@ -468,19 +450,15 @@ if($val->member_join_form_srl == $member_join_form_srl) break; $prev_member_join_form = $val; } - - // 이전 가입항목가 없으면 그냥 return + // Return if no previous join form exists if(!$prev_member_join_form) return new Object(); - - // 선택한 가입항목의 정보 + // Information of the join form $cur_args->member_join_form_srl = $member_join_form_srl; $cur_args->list_order = $prev_member_join_form->list_order; - - // 대상 가입항목의 정보 + // Information of the target join form $prev_args->member_join_form_srl = $prev_member_join_form->member_join_form_srl; $prev_args->list_order = $list_order; - - // DB 처리 + // Execute Query $output = executeQuery('member.updateMemberJoinFormListorder', $cur_args); if(!$output->toBool()) return $output; @@ -491,19 +469,17 @@ } /** - * @brief 가입항목을 하단으로 이동 + * @brief Move down a join form **/ function moveJoinFormDown($member_join_form_srl) { $oMemberModel = &getModel('member'); - - // 선택된 가입항목의 정보를 구한다 + // Get information of the join form $args->member_join_form_srl = $member_join_form_srl; $output = executeQuery('member.getJoinForm', $args); $join_form = $output->data; $list_order = $join_form->list_order; - - // 전체 가입항목 목록을 구한다 + // Get information of all join forms $join_form_list = $oMemberModel->getJoinFormList(); $join_form_srl_list = array_keys($join_form_list); if(count($join_form_srl_list)<2) return new Object(); @@ -513,20 +489,16 @@ } $next_member_join_form_srl = $join_form_srl_list[$i+1]; - - // 이전 가입항목가 없으면 그냥 return + // Return if no previous join form exists if(!$next_member_join_form_srl) return new Object(); $next_member_join_form = $join_form_list[$next_member_join_form_srl]; - - // 선택한 가입항목의 정보 + // Information of the join form $cur_args->member_join_form_srl = $member_join_form_srl; $cur_args->list_order = $next_member_join_form->list_order; - - // 대상 가입항목의 정보 + // Information of the target join form $next_args->member_join_form_srl = $next_member_join_form->member_join_form_srl; $next_args->list_order = $list_order; - - // DB 처리 + // Execute Query $output = executeQuery('member.updateMemberJoinFormListorder', $cur_args); if(!$output->toBool()) return $output; diff --git a/modules/member/member.admin.model.php b/modules/member/member.admin.model.php index efc5cc72d..bed2aca44 100644 --- a/modules/member/member.admin.model.php +++ b/modules/member/member.admin.model.php @@ -2,29 +2,29 @@ /** * @class memberAdminModel * @author NHN (developers@xpressengine.com) - * @brief member module의 admin model class + * @brief admin model class of member module **/ class memberAdminModel extends member { /** - * @brief 자주 호출될거라 예상되는 데이터는 내부적으로 가지고 있자... + * @brief Keep data internally which may be frequently called. **/ var $member_info = NULL; var $member_groups = NULL; var $join_form_list = NULL; /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 회원 목록을 구함 + * @brief Get a member list **/ function getMemberList() { - // 검색 옵션 정리 + // Search options $args->is_admin = Context::get('is_admin')=='Y'?'Y':''; $args->is_denied = Context::get('is_denied')=='Y'?'Y':''; $args->selected_group_srl = Context::get('selected_group_srl'); @@ -74,7 +74,7 @@ } } - // selected_group_srl이 있으면 query id를 변경 (table join때문에) + // Change the query id if selected_group_srl exists (for table join) $sort_order = Context::get('sort_order'); $sort_index = Context::get('sort_index'); if($sort_index != 'last_login') { @@ -92,8 +92,7 @@ if($sort_order != "desc") $sort_order = "asc"; $args->sort_order = $sort_order; Context::set('sort_order', $sort_order); - - // 기타 변수들 정리 + // Other variables $args->page = Context::get('page'); $args->list_count = 40; $args->page_count = 10; @@ -102,7 +101,7 @@ } /** - * @brief 사이트별 회원 목록을 구함 + * @brief Get a memebr list for each site **/ function getSiteMemberList($site_srl, $page = 1) { $args->site_srl = $site_srl; @@ -115,7 +114,7 @@ } /** - * @brief 회원 모듈의 특정 스킨에 속한 컬러셋 목록을 return + * @brief Return colorset list of a skin in the member module **/ function getMemberAdminColorset() { $skin = Context::get('skin'); diff --git a/modules/member/member.admin.view.php b/modules/member/member.admin.view.php index 6da3e2e9a..3cd995e81 100644 --- a/modules/member/member.admin.view.php +++ b/modules/member/member.admin.view.php @@ -160,13 +160,12 @@ } /** - * @brief 회원 가입 폼 목록 출력 + * @brief Display a list of member join form **/ function dispMemberAdminJoinFormList() { - // 멤버모델 객체 생성 + // Create a member model object $oMemberModel = &getModel('member'); - - // 추가로 설정한 가입 항목 가져오기 + // Get join form list which is additionally set $form_list = $oMemberModel->getJoinFormList(); Context::set('form_list', $form_list); @@ -174,10 +173,10 @@ } /** - * @brief 회원 가입 폼 관리 화면 출력 + * @brief Display an admin page for memebr join forms **/ function dispMemberAdminInsertJoinForm() { - // 수정일 경우 대상 join_form의 값을 구함 + // Get the value of join_form $member_join_form_srl = Context::get('member_join_form_srl'); if($member_join_form_srl) { $oMemberModel = &getModel('member'); @@ -190,13 +189,12 @@ } /** - * @brief 금지 목록 아이디 출력 + * @brief Display denied ID list **/ function dispMemberAdminDeniedIDList() { - // 멤버모델 객체 생성 + // Create a member model object $oMemberModel = &getModel('member'); - - // 사용금지 목록 가져오기 + // Get a denied ID list $output = $oMemberModel->getDeniedIDList(); Context::set('total_count', $output->total_count); @@ -209,15 +207,14 @@ } /** - * @brief 회원 그룹 일괄 변경 + * @brief Update all the member groups **/ function dispMemberAdminManageGroup() { - // 선택된 회원 목록을 구함 + // Get a list of the selected member $args->member_srl = trim(Context::get('member_srls')); $output = executeQueryArray('member.getMembers', $args); Context::set('member_list', $output->data); - - // 회원 그룹 목록을 구함 + // Get a list of the selected member $oMemberModel = &getModel('member'); Context::set('member_groups', $oMemberModel->getGroups()); @@ -226,10 +223,10 @@ } /** - * @brief 회원 일괄 삭제 + * @brief Delete all members **/ function dispMemberAdminDeleteMembers() { - // 선택된 회원 목록을 구함 + // Get a list of the selected member $args->member_srl = trim(Context::get('member_srls')); $output = executeQueryArray('member.getMembers', $args); Context::set('member_list', $output->data); diff --git a/modules/member/member.api.php b/modules/member/member.api.php index 619ae2308..87c2cb696 100644 --- a/modules/member/member.api.php +++ b/modules/member/member.api.php @@ -2,14 +2,14 @@ /** * @class memberAPI * @author NHN (developers@xpressengine.com) - * @brief member 모듈의 View Action에 대한 API 처리 + * @brief API Processing of View Action in the member module **/ class memberAPI extends member { /** - * @brief 컨텐츠 목록 + * @brief Content List **/ function dispSavedDocumentList(&$oModule) { $document_list = $this->arrangeContentList(Context::get('document_list')); diff --git a/modules/member/member.class.php b/modules/member/member.class.php index 88a9fd88b..a67571416 100644 --- a/modules/member/member.class.php +++ b/modules/member/member.class.php @@ -2,7 +2,7 @@ /** * @class member * @author NHN (developers@xpressengine.com) - * @brief member module의 high class + * @brief high class of the member module **/ class member extends ModuleObject { @@ -14,8 +14,7 @@ $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); - - // SSL 사용시 회원가입/정보/비밀번호등과 관련된 action에 대해 SSL 전송하도록 지정 + // Set to use SSL upon actions related member join/information/password and so on if(Context::get('_use_ssl') == 'optional') { Context::addSSLAction('dispMemberModifyPassword'); Context::addSSLAction('dispMemberSignUpForm'); @@ -29,10 +28,10 @@ } /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // action forward에 등록 (관리자 모드에서 사용하기 위함) + // Register action forward (to use in administrator mode) $oModuleController = &getController('module'); $oDB = &DB::getInstance(); @@ -40,8 +39,7 @@ $oModuleModel = &getModel('module'); $args = $oModuleModel->getModuleConfig('member'); - - // 기본 정보를 세팅 + // Set the basic information $args->enable_join = 'Y'; if(!$args->enable_openid) $args->enable_openid = 'N'; if(!$args->enable_auth_mail) $args->enable_auth_mail = 'N'; @@ -57,15 +55,14 @@ if($args->group_image_mark!='Y') $args->group_image_mark = 'N'; $oModuleController->insertModuleConfig('member',$args); - - // 멤버 컨트롤러 객체 생성 + // Create a member controller object $oMemberModel = &getModel('member'); $oMemberController = &getController('member'); $oMemberAdminController = &getAdminController('member'); $groups = $oMemberModel->getGroups(); if(!count($groups)) { - // 관리자, 정회원, 준회원 그룹을 입력 + // Set an administrator, regular member(group1), and associate member(group2) $group_args->title = Context::getLang('admin_group'); $group_args->is_default = 'N'; $group_args->is_admin = 'Y'; @@ -83,22 +80,19 @@ $group_args->is_admin = 'N'; $oMemberAdminController->insertGroup($group_args); } - - // 관리자 정보 세팅 + // Configure administrator information $admin_args->is_admin = 'Y'; $output = executeQuery('member.getMemberList', $admin_args); if(!$output->data) { $admin_info = Context::gets('user_id','password','nick_name','user_name', 'email_address'); if($admin_info->user_id) { - // 관리자 정보 입력 + // Insert admin information $oMemberAdminController->insertAdmin($admin_info); - - // 로그인 처리시킴 + // Log-in Processing $output = $oMemberController->doLogin($admin_info->user_id); } } - - // 금지 아이디 등록 (기본 + 모듈명) + // Register denied ID(default + module name) $oModuleModel = &getModel('module'); $module_list = $oModuleModel->getModuleList(); foreach($module_list as $key => $val) { @@ -110,8 +104,7 @@ $oMemberAdminController->insertDeniedID('telnet',''); $oMemberAdminController->insertDeniedID('ftp',''); $oMemberAdminController->insertDeniedID('http',''); - - // member 에서 사용할 cache디렉토리 생성 + // Create cache directory to use in the member module FileHandler::makeDir('./files/member_extra_info/image_name'); FileHandler::makeDir('./files/member_extra_info/image_mark'); FileHandler::makeDir('./files/member_extra_info/profile_image'); @@ -122,34 +115,28 @@ } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { $oDB = &DB::getInstance(); $oModuleModel = &getModel('module'); - - // member 디렉토리 체크 (2007. 8. 11 추가) + // check member directory (11/08/2007 added) if(!is_dir("./files/member_extra_info")) return true; - - // member 디렉토리 체크 (2007. 10. 22 추가) + // check member directory (22/10/2007 added) if(!is_dir("./files/member_extra_info/profile_image")) return true; - - // member_auth_mail 테이블에 is_register 필드 추가 (2008. 04. 22) + // Add a column(is_register) to "member_auth_mail" table (22/04/2008) $act = $oDB->isColumnExists("member_auth_mail", "is_register"); if(!$act) return true; - - // member_group_member 테이블에 site_srl 추가 (2008. 11. 15) + // Add a column(site_srl) to "member_group_member" table (11/15/2008) if(!$oDB->isColumnExists("member_group_member", "site_srl")) return true; if(!$oDB->isColumnExists("member_group", "site_srl")) return true; if($oDB->isIndexExists("member_group","uni_member_group_title")) return true; - - // image_mark 추가 (2009. 02. 14) + // Add a column for image_mark (02/14/2009) if(!$oDB->isColumnExists("member_group", "image_mark")) return true; - - // password 유효기간을 위한 추가 + // Add c column for password expiration date if(!$oDB->isColumnExists("member", "change_password_date")) return true; - // 비밀번호 찾기 질문/답변을 위한 추가 + // Add columns of question and answer to verify a password if(!$oDB->isColumnExists("member", "find_account_question")) return true; if(!$oDB->isColumnExists("member", "find_account_answer")) return true; @@ -160,24 +147,21 @@ } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { $oDB = &DB::getInstance(); $oModuleController = &getController('module'); - - // member 디렉토리 체크 + // Check member directory FileHandler::makeDir('./files/member_extra_info/image_name'); FileHandler::makeDir('./files/member_extra_info/image_mark'); FileHandler::makeDir('./files/member_extra_info/signature'); FileHandler::makeDir('./files/member_extra_info/profile_image'); - - // DB 필드 추가 + // Add a column if (!$oDB->isColumnExists("member_auth_mail", "is_register")) { $oDB->addColumn("member_auth_mail", "is_register", "char", 1, "N", true); } - - // member_group_member 테이블에 site_srl 추가 (2008. 11. 15) + // Add a column(site_srl) to "member_group_member" table (11/15/2008) if (!$oDB->isColumnExists("member_group_member", "site_srl")) { $oDB->addColumn("member_group_member", "site_srl", "number", 11, 0, true); $oDB->addIndex("member_group_member", "idx_site_srl", "site_srl", false); @@ -189,19 +173,17 @@ if($oDB->isIndexExists("member_group","uni_member_group_title")) { $oDB->dropIndex("member_group","uni_member_group_title",true); } - - // image_mark 추가 (2009. 02. 14) + // Add a column for image_mark (02/14/2009) if(!$oDB->isColumnExists("member_group", "image_mark")) { $oDB->addColumn("member_group", "image_mark", "text"); } - - // password 유효기간을 위한 추가 + // Add a column for password expiration date if(!$oDB->isColumnExists("member", "change_password_date")) { $oDB->addColumn("member", "change_password_date", "date"); executeQuery('member.updateAllChangePasswordDate'); } - // 비밀번호 찾기 질문/답변을 위한 추가 + // Add columns of question and answer to verify a password if(!$oDB->isColumnExists("member", "find_account_question")) { $oDB->addColumn("member", "find_account_question", "number", 11); } @@ -225,7 +207,7 @@ } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { set_include_path(_XE_PATH_."modules/member/php-openid-1.2.3"); diff --git a/modules/member/member.controller.php b/modules/member/member.controller.php index 26dd1560d..da539239b 100644 --- a/modules/member/member.controller.php +++ b/modules/member/member.controller.php @@ -2,22 +2,22 @@ /** * @class memberController * @author NHN (developers@xpressengine.com) - * @brief member module의 Controller class + * @brief Controller class of member module **/ class memberController extends member { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief user_id, password를 체크하여 로그인 시킴 + * @brief Log-in by checking user_id and password **/ function procMemberLogin($user_id = null, $password = null, $keep_signed = null) { - // 변수 정리 + // Variables if(!$user_id) $user_id = Context::get('user_id'); $user_id = trim($user_id); @@ -25,8 +25,7 @@ $password = trim($password); if(!$keep_signed) $keep_signed = Context::get('keep_signed'); - - // 아이디나 비밀번호가 없을때 오류 return + // Return an error when id and password doesn't exist if(!$user_id) return new Object(-1,'null_user_id'); if(!$password) return new Object(-1,'null_password'); @@ -36,10 +35,10 @@ $config = $oModuleModel->getModuleConfig('member'); if($config->after_login_url) $this->setRedirectUrl($config->after_login_url); - // 설정된 change_password_date 확인 + // Check change_password_date $limit_date = $config->change_password_date; - // change_password_date가 설정되어 있으면 확인 + // Check if change_password_date is set if ($limit_date > 0) { $oMemberModel = &getModel('member'); $member_info = $oMemberModel->getMemberInfoByUserID($user_id); @@ -57,7 +56,7 @@ } /** - * @brief openid로그인 + * @brief Login by openid **/ function procMemberOpenIDLogin($validator = "procMemberOpenIDValidate") { $oModuleModel = &getModel('module'); @@ -141,7 +140,7 @@ } /** - * @brief openid 인증 체크 + * @brief openid authentication check **/ function procMemberOpenIDValidate() { set_include_path(_XE_PATH_."modules/member/php-openid-1.2.3"); @@ -155,22 +154,20 @@ $response = $consumer->complete($_GET); switch($response->status) { case Auth_OpenID_CANCEL : - // 사용자가 인증을 취소했을 때의 처리 + // Handle if user authentication is canceled return $this->stop('authorization_canceled'); case Auth_OpenID_FAILURE : - // 무언가의 문제로 인해 인증이 실패했을 때의 처리(인증을 요구한 openid가 없다든가..) + // Handle if user authentication is failed due to a certain problem (for example, openid doesn't exist) (there is no authentication required deunga openid ..) return $this->stop('invalid_authorization'); case Auth_OpenID_SUCCESS : - // 인증성공!! + // Authentication success! break; default: return $this->stop('invalid_authorization'); } - - // 인증 성공 + // Authentication success $oMemberModel = &getModel('member'); - - // 이 오픈아이디와 연결된 (또는 연결되어 있을 가능성이 있는) 제로보드 아이디들을 받아온다. + // Get zeroboard ID which is corresponded to the openID ID. $login_success = false; $assoc_member_info = null; $openid_identity = $response->signed_args["openid.identity"]; @@ -195,13 +192,12 @@ foreach($user_id_candidates as $user_id) { $args->user_id = $args->nick_name = $user_id; - // 기본 정보들을 받음 + // Get basic information $args->email_address = $sreg['email']; $args->user_name = $sreg['fullname']; if(!$args->user_name) list($args->user_name) = explode('@', $args->email_address); $args->birthday = str_replace('-','',$sreg['dob']); - - // 자체 인증 시도 + // Attempts self-authentication $output = $this->doLogin($args->user_id); if ($output->toBool()) { @@ -215,8 +211,7 @@ break; } } - - // 자체 인증 실패시 회원 가입시킴 + // Member join if self-authentication is failed if(!$login_success) { $args->user_id = $args->nick_name = $default_user_id; $args->password = md5(getmicrotime()); @@ -233,8 +228,7 @@ } Context::close(); - - // 페이지 이동 + // Move the page if(Context::get('goto')) { $goto = Context::get('goto'); header("location:" . $goto); @@ -246,14 +240,14 @@ } /** - * @brief 오픈아이디 연결 요청 + * @brief Request member join by openID **/ function procMemberAddOpenIDToMember() { return $this->procMemberOpenIDLogin("procMemberValidateAddOpenIDToMember"); } /** - * @brief 오픈아이디 연결 요청 마무리 + * @brief Validate openID processing **/ function procMemberValidateAddOpenIDToMember() { set_include_path(_XE_PATH_."modules/member/php-openid-1.2.3"); @@ -268,10 +262,10 @@ switch($response->status) { case Auth_OpenID_CANCEL : - // 사용자가 인증을 취소했을 때의 처리 + // Handle if user authentication is canceled return $this->stop('authorization_canceled'); case Auth_OpenID_FAILURE : - // 무언가의 문제로 인해 인증이 실패했을 때의 처리(인증을 요구한 openid가 없다든가..) + // Handle if user authentication is failed due to a certain problem (for example, openid doesn't exist) (there is no authentication required deunga openid ..) return $this->stop('invalid_authorization'); case Auth_OpenID_SUCCESS : { @@ -297,7 +291,7 @@ } exit(); } - // 인증성공!! + // Authentication success! break; default: return $this->stop('invalid_authorization'); @@ -305,7 +299,7 @@ } /** - * @brief 오픈아이디 연결 해제 + * @brief Disconnect OpenID **/ function procMemberDeleteOpenIDFromMember() { $logged_info = Context::get('logged_info'); @@ -337,18 +331,16 @@ /** - * @brief 로그아웃 + * @brief Log-out **/ function procMemberLogout() { - // 로그아웃 이전에 trigger 호출 (before) + // Call a trigger before log-out (before) $logged_info = Context::get('logged_info'); $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'before', $logged_info); if(!$trigger_output->toBool()) return $trigger_output; - - // 세션 정보 파기 + // Destroy session information $this->destroySessionInfo(); - - // 로그아웃 이후 trigger 호출 (after) + // Call a trigger after log-out (after) $trigger_output = ModuleHandler::triggerCall('member.doLogout', 'after', $logged_info); if(!$trigger_output->toBool()) return $trigger_output; @@ -362,22 +354,20 @@ } /** - * @brief 스크랩 기능 + * @brief Scrap **/ function procMemberScrapDocument() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); $document_srl = (int)Context::get('document_srl'); if(!$document_srl) $document_srl = (int)Context::get('target_srl'); if(!$document_srl) return new Object(-1,'msg_invalid_request'); - - // 문서 가져오기 + // Get document $oDocumentModel = &getModel('document'); $oDocument = $oDocumentModel->getDocument($document_srl); - - // 변수 정리 + // Variables $args->document_srl = $document_srl; $args->member_srl = $logged_info->member_srl; $args->user_id = $oDocument->get('user_id'); @@ -385,12 +375,10 @@ $args->nick_name = $oDocument->get('nick_name'); $args->target_member_srl = $oDocument->get('member_srl'); $args->title = $oDocument->get('title'); - - // 있는지 조사 + // Check if already scrapped $output = executeQuery('member.getScrapDocument', $args); if($output->data->count) return new Object(-1, 'msg_alreay_scrapped'); - - // 입력 + // Insert $output = executeQuery('member.addScrapDocument', $args); if(!$output->toBool()) return $output; @@ -399,63 +387,56 @@ } /** - * @brief 스크랩 삭제 + * @brief Delete a scrap **/ function procMemberDeleteScrap() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); $document_srl = (int)Context::get('document_srl'); if(!$document_srl) return new Object(-1,'msg_invalid_request'); - - // 변수 정리 + // Variables $args->member_srl = $logged_info->member_srl; $args->document_srl = $document_srl; return executeQuery('member.deleteScrapDocument', $args); } /** - * @brief 게시글 저장 + * @brief Save posts **/ function procMemberSaveDocument() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); - - // form 정보를 모두 받음 + // Get form information $obj = Context::getRequestVars(); - - // 글의 대상 모듈을 회원 정보로 변경 + // Change the target module to log-in information $obj->module_srl = $logged_info->member_srl; unset($obj->is_notice); - // 제목을 사용하지 않는 방명록 등에서 내용 앞 부분을 제목 가져오기 + // Extract from beginning part of contents in the guestbook if(!$obj->title) { $obj->title = cut_str(strip_tags($obj->content), 20, '...'); } $oDocumentModel = &getModel('document'); $oDocumentController = &getController('document'); - - // 이미 존재하는 글인지 체크 + // Check if already exist geulinji $oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager); - - // 이미 존재하는 경우 수정 + // Update if already exists if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) { $output = $oDocumentController->updateDocument($oDocument, $obj); $msg_code = 'success_updated'; - - // 그렇지 않으면 신규 등록 + // Otherwise, get a new } else { $output = $oDocumentController->insertDocument($obj); $msg_code = 'success_registed'; $obj->document_srl = $output->get('document_srl'); $oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager); } - - // 등록된 첨부파일의 상태를 무효로 지정 + // Set the attachment to be invalid state if($oDocument->hasUploadedFiles()) { $args->upload_target_srl = $oDocument->document_srl; $args->isvalid = 'N'; @@ -467,23 +448,22 @@ } /** - * @brief 저장된 글 삭제 + * @brief Delete the post **/ function procMemberDeleteSavedDocument() { - // 로그인 정보 체크 + // Check login information if(!Context::get('is_logged')) return new Object(-1, 'msg_not_logged'); $logged_info = Context::get('logged_info'); $document_srl = (int)Context::get('document_srl'); if(!$document_srl) return new Object(-1,'msg_invalid_request'); - - // 변수 정리 + // Variables $oDocumentController = &getController('document'); $oDocumentController->deleteDocument($document_srl, true); } /** - * @brief 회원 가입시 특정 항목들에 대한 값 체크 + * @brief Check values when member joining **/ function procMemberCheckValue() { $name = Context::get('name'); @@ -491,28 +471,26 @@ if(!$value) return; $oMemberModel = &getModel('member'); - - // 로그인 여부 체크 + // Check if logged-in $logged_info = Context::get('logged_info'); switch($name) { case 'user_id' : - // 금지 아이디 검사 + // Check denied ID if($oMemberModel->isDeniedID($value)) return new Object(0,'denied_user_id'); - - // 중복 검사 + // Check if duplicated $member_srl = $oMemberModel->getMemberSrlByUserID($value); if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_user_id'); break; case 'nick_name' : - // 중복 검사 + // Check if duplicated $member_srl = $oMemberModel->getMemberSrlByNickName($value); if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_nick_name'); break; case 'email_address' : - // 중복 검사 + // Check if duplicated $member_srl = $oMemberModel->getMemberSrlByEmailAddress($value); if($member_srl && $logged_info->member_srl != $member_srl ) return new Object(0,'msg_exists_email_address'); break; @@ -520,29 +498,29 @@ } /** - * @brief 회원 가입 + * @brief Join Membership **/ function procMemberInsert() { if (Context::getRequestMethod () == "GET") return new Object (-1, "msg_invalid_request"); $oMemberModel = &getModel ('member'); $config = $oMemberModel->getMemberConfig (); - // before 트리거 호출 + // call a trigger (before) $trigger_output = ModuleHandler::triggerCall ('member.procMemberInsert', 'before', $config); if (!$trigger_output->toBool ()) return $trigger_output; - // 관리자가 회원가입을 허락하였는지 검사 + // Check if an administrator allows a membership if ($config->enable_join != 'Y') return $this->stop ('msg_signup_disabled'); - // 약관에 동의하였는지 검사 (약관이 있을 경우만) + // Check if the user accept the license terms (only if terms exist) if ($config->agreement && Context::get('accept_agreement')!='Y') return $this->stop('msg_accept_agreement'); - // 필수 정보들을 미리 추출 + // Extract the necessary information in advance $args = Context::gets('user_id','user_name','nick_name','homepage','blog','birthday','email_address','password','allow_mailing','find_account_question','find_account_answer'); $args->member_srl = getNextSequence(); $args->list_order = -1 * $args->member_srl; - // 넘어온 모든 변수중에서 몇가지 불필요한 것들 삭제 + // Remove some unnecessary variables from all the vars $all_args = Context::getRequestVars(); unset($all_args->module); unset($all_args->act); @@ -554,18 +532,15 @@ unset($all_args->signature); unset($all_args->password2); - // 메일 인증 기능 사용시 회원 상태를 denied로 설정 + // Set the user state as "denied" when using mail authentication if ($config->enable_confirm == 'Y') $args->denied = 'Y'; - - // 모든 request argument에서 필수 정보만 제외 한 후 추가 데이터로 입력 + // Add extra vars after excluding necessary information from all the requested arguments $extra_vars = delObjectVars($all_args, $args); $args->extra_vars = serialize($extra_vars); - - // member_srl의 값에 따라 insert/update + // Execute insert or update depending on the value of member_srl $output = $this->insertMember($args); if(!$output->toBool()) return $output; - - // 가상사이트일 경우 사이트 가입 + // If a virtual site, join the site $site_module_info = Context::get('site_module_info'); if($site_module_info->site_srl > 0) { $default_group = $oMemberModel->getDefaultGroup($site_module_info->site_srl); @@ -574,11 +549,9 @@ } } - - // 로그인 시킴 + // Log-in if ($config->enable_confirm != 'Y') $this->doLogin($args->user_id); - - // 결과 정리 + // Results $this->add('member_srl', $args->member_srl); if($config->redirect_url) $this->add('redirect_url', $config->redirect_url); if ($config->enable_confirm == 'Y') { @@ -586,26 +559,22 @@ $this->setMessage($msg); } else $this->setMessage('success_registed'); - - // after 트리거 호출 + // Call a trigger (after) $trigger_output = ModuleHandler::triggerCall('member.procMemberInsert', 'after', $config); if(!$trigger_output->toBool()) return $trigger_output; } /** - * @brief 회원 정보 수정 + * @brief Edit member profile **/ function procMemberModifyInfo() { if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); - - // 필수 정보들을 미리 추출 + // Extract the necessary information in advance $args = Context::gets('user_name','nick_name','homepage','blog','birthday','email_address','allow_mailing','find_account_question','find_account_answer'); - - // 로그인 정보 + // Login Information $logged_info = Context::get('logged_info'); $args->member_srl = $logged_info->member_srl; - - // 넘어온 모든 변수중에서 몇가지 불필요한 것들 삭제 + // Remove some unnecessary variables from all the vars $all_args = Context::getRequestVars(); unset($all_args->module); unset($all_args->act); @@ -617,62 +586,51 @@ unset($all_args->signature); unset($all_args->_filter); - // 모든 request argument에서 필수 정보만 제외 한 후 추가 데이터로 입력 + // Add extra vars after excluding necessary information from all the requested arguments $extra_vars = delObjectVars($all_args, $args); $args->extra_vars = serialize($extra_vars); - - // 멤버 모델 객체 생성 + // Create a member model object $oMemberModel = &getModel('member'); - - // member_srl의 값에 따라 insert/update + // Execute insert or update depending on the value of member_srl $output = $this->updateMember($args); if(!$output->toBool()) return $output; - - // 서명 저장 + // Save Signature $signature = Context::get('signature'); $this->putSignature($args->member_srl, $signature); - - // user_id 에 따른 정보 가져옴 + // Get user_id information $member_info = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); - - // 로그인 성공후 trigger 호출 (after) + // Call a trigger after successfully log-in (after) $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $member_info); if(!$trigger_output->toBool()) return $trigger_output; $this->setSessionInfo($member_info); - - // 결과 리턴 + // Return result $this->add('member_srl', $args->member_srl); $this->setMessage('success_updated'); } /** - * @brief 회원 비밀번호 수정 + * @brief Change the user password **/ function procMemberModifyPassword() { if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); - - // 필수 정보들을 미리 추출 + // Extract the necessary information in advance $current_password = trim(Context::get('current_password')); $password = trim(Context::get('password')); - - // 로그인한 유저의 정보를 가져옴 + // Get information of logged-in user $logged_info = Context::get('logged_info'); $member_srl = $logged_info->member_srl; - - // member model 객체 생성 + // Create a member model object $oMemberModel = &getModel('member'); - - // member_srl 에 따른 정보 가져옴 + // Get information of member_srl $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); - - // 현재 비밀번호가 맞는지 확인 + // Verify the cuttent password if(!$oMemberModel->isValidPassword($member_info->password, $current_password)) return new Object(-1, 'invalid_password'); - // 이전 비밀번호와 같은지 확인 + // Check if a new password is as same as the previous password if ($current_password == $password) return new Object(-1, 'invalid_new_password'); - // member_srl의 값에 따라 insert/update + // Execute insert or update depending on the value of member_srl $args->member_srl = $member_srl; $args->password = $password; $output = $this->updateMemberPassword($args); @@ -683,166 +641,141 @@ } /** - * @brief 탈퇴 + * @brief Membership withdrawal **/ function procMemberLeave() { if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); - - // 필수 정보들을 미리 추출 + // Extract the necessary information in advance $password = trim(Context::get('password')); - - // 로그인한 유저의 정보를 가져옴 + // Get information of logged-in user $logged_info = Context::get('logged_info'); $member_srl = $logged_info->member_srl; - - // member model 객체 생성 + // Create a member model object $oMemberModel = &getModel('member'); - - // member_srl 에 따른 정보 가져옴 + // Get information of member_srl $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); - - // 현재 비밀번호가 맞는지 확인 + // Verify the cuttent password if(!$oMemberModel->isValidPassword($member_info->password, $password)) return new Object(-1, 'invalid_password'); $output = $this->deleteMember($member_srl); if(!$output->toBool()) return $output; - - // 모든 세션 정보 파기 + // Destroy all session information $this->destroySessionInfo(); - - // 성공 메세지 리턴 + // Return success message $this->setMessage('success_leaved'); } /** - * @brief 오픈아이디 탈퇴 + * @brief OpenID Withdrawal **/ function procMemberOpenIDLeave() { - // 비로그인 상태이면 에러 + // Return an error if in the non-login state if(!Context::get('is_logged')) return $this->stop('msg_not_logged'); - - // 현재 ip와 세션 아이피 비교 + // Compare the current IP with session IP if($_SESSION['ipaddress']!=$_SERVER['REMOTE_ADDR']) return $this->stop('msg_not_permitted'); - - // 로그인한 유저의 정보를 가져옴 + // Get information of logged-in user $logged_info = Context::get('logged_info'); $member_srl = $logged_info->member_srl; $output = $this->deleteMember($member_srl); if(!$output->toBool()) return $output; - - // 모든 세션 정보 파기 + // Destroy all session information $this->destroySessionInfo(); - - // 성공 메세지 리턴 + // Return success message $this->setMessage('success_leaved'); } /** - * @brief 프로필 이미지 추가 + * @brief Add a profile image **/ function procMemberInsertProfileImage() { - // 정상적으로 업로드 된 파일인지 검사 + // Check if the file is successfully uploaded $file = $_FILES['profile_image']; if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_profile_image'); - - // 회원 정보를 검사해서 회원번호가 없거나 관리자가 아니고 회원번호가 틀리면 무시 + // Ignore if member_srl is invalid or doesn't exist. $member_srl = Context::get('member_srl'); if(!$member_srl) return $this->stop('msg_not_uploaded_profile_image'); $logged_info = Context::get('logged_info'); if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_profile_image'); - - // 회원 모듈 설정에서 이미지 이름 사용 금지를 하였을 경우 관리자가 아니면 return; + // Return if member module is set not to use an image name or the user is not an administrator ; $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('member'); if($logged_info->is_admin != 'Y' && $config->profile_image != 'Y') return $this->stop('msg_not_uploaded_profile_image'); $this->insertProfileImage($member_srl, $file['tmp_name']); - - // 페이지 리프레쉬 + // Page refresh $this->setRefreshPage(); } function insertProfileImage($member_srl, $target_file) { $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('member'); - - // 정해진 사이즈를 구함 + // Get an image size $max_width = $config->profile_image_max_width; if(!$max_width) $max_width = "90"; $max_height = $config->profile_image_max_height; if(!$max_height) $max_height = "20"; - - // 저장할 위치 구함 + // Get a target path to save $target_path = sprintf('files/member_extra_info/profile_image/%s', getNumberingPath($member_srl)); FileHandler::makeDir($target_path); - - // 파일 정보 구함 + // Get file information list($width, $height, $type, $attrs) = @getimagesize($target_file); if($type == 3) $ext = 'png'; elseif($type == 2) $ext = 'jpg'; else $ext = 'gif'; $target_filename = sprintf('%s%d.%s', $target_path, $member_srl, $ext); - - // 지정된 사이즈보다 크거나 gif가 아니면 변환 + // Convert if the image size is larger than a given size or if the format is not a gif if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, $ext); else @copy($target_file, $target_filename); } /** - * @brief 이미지 이름을 추가 + * @brief Add an image name **/ function procMemberInsertImageName() { - // 정상적으로 업로드 된 파일인지 검사 + // Check if the file is successfully uploaded $file = $_FILES['image_name']; if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_name'); - - // 회원 정보를 검사해서 회원번호가 없거나 관리자가 아니고 회원번호가 틀리면 무시 + // Ignore if member_srl is invalid or doesn't exist. $member_srl = Context::get('member_srl'); if(!$member_srl) return $this->stop('msg_not_uploaded_image_name'); $logged_info = Context::get('logged_info'); if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_name'); - - // 회원 모듈 설정에서 이미지 이름 사용 금지를 하였을 경우 관리자가 아니면 return; + // Return if member module is set not to use an image name or the user is not an administrator ; $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('member'); if($logged_info->is_admin != 'Y' && $config->image_name != 'Y') return $this->stop('msg_not_uploaded_image_name'); $this->insertImageName($member_srl, $file['tmp_name']); - - // 페이지 리프레쉬 + // Page refresh $this->setRefreshPage(); } function insertImageName($member_srl, $target_file) { $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('member'); - - // 정해진 사이즈를 구함 + // Get an image size $max_width = $config->image_name_max_width; if(!$max_width) $max_width = "90"; $max_height = $config->image_name_max_height; if(!$max_height) $max_height = "20"; - - // 저장할 위치 구함 + // Get a target path to save $target_path = sprintf('files/member_extra_info/image_name/%s/', getNumberingPath($member_srl)); FileHandler::makeDir($target_path); $target_filename = sprintf('%s%d.gif', $target_path, $member_srl); - - // 파일 정보 구함 + // Get file information list($width, $height, $type, $attrs) = @getimagesize($target_file); - - // 지정된 사이즈보다 크거나 gif가 아니면 변환 + // Convert if the image size is larger than a given size or if the format is not a gif if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); else @copy($target_file, $target_filename); } /** - * @brief 프로필 이미지를 삭제 + * @brief Delete profile image **/ function procMemberDeleteProfileImage() { $member_srl = Context::get('member_srl'); @@ -865,7 +798,7 @@ } /** - * @brief 이미지 이름을 삭제 + * @brief Delete Image name **/ function procMemberDeleteImageName() { $member_srl = Context::get('member_srl'); @@ -888,36 +821,32 @@ } /** - * @brief 이미지 마크를 추가 + * @brief Add an image to mark **/ function procMemberInsertImageMark() { - // 정상적으로 업로드 된 파일인지 검사 + // Check if the file is successfully uploaded $file = $_FILES['image_mark']; if(!is_uploaded_file($file['tmp_name'])) return $this->stop('msg_not_uploaded_image_mark'); - - // 회원 정보를 검사해서 회원번호가 없거나 관리자가 아니고 회원번호가 틀리면 무시 + // Ignore if member_srl is invalid or doesn't exist. $member_srl = Context::get('member_srl'); if(!$member_srl) return $this->stop('msg_not_uploaded_image_mark'); $logged_info = Context::get('logged_info'); if($logged_info->is_admin != 'Y' && $logged_info->member_srl != $member_srl) return $this->stop('msg_not_uploaded_image_mark'); - - // 회원 모듈 설정에서 이미지 마크 사용 금지를 하였을 경우 관리자가 아니면 return; + // Membership in the images mark the module using the ban was set by an administrator or return; $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('member'); if($logged_info->is_admin != 'Y' && $config->image_mark != 'Y') return $this->stop('msg_not_uploaded_image_mark'); $this->insertImageMark($member_srl, $file['tmp_name']); - - // 페이지 리프레쉬 + // Page refresh $this->setRefreshPage(); } function insertImageMark($member_srl, $target_file) { $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('member'); - - // 정해진 사이즈를 구함 + // Get an image size $max_width = $config->image_mark_max_width; if(!$max_width) $max_width = "20"; $max_height = $config->image_mark_max_height; @@ -927,8 +856,7 @@ FileHandler::makeDir($target_path); $target_filename = sprintf('%s%d.gif', $target_path, $member_srl); - - // 파일 정보 구함 + // Get file information list($width, $height, $type, $attrs) = @getimagesize($target_file); if($width > $max_width || $height > $max_height || $type!=1) FileHandler::createImageFile($target_file, $target_filename, $max_width, $max_height, 'gif'); @@ -937,7 +865,7 @@ } /** - * @brief 이미지 마크를 삭제 + * @brief Delete Image Mark **/ function procMemberDeleteImageMark() { $member_srl = Context::get('member_srl'); @@ -953,7 +881,7 @@ } /** - * @brief 아이디/ 비밀번호 찾기 + * @brief Find ID/Password **/ function procMemberFindAccount() { $email_address = Context::get('email_address'); @@ -961,22 +889,18 @@ $oMemberModel = &getModel('member'); $oModuleModel = &getModel('module'); - - // 메일 주소에 해당하는 회원이 있는지 검사 + // Check if a member having the same email address exists $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); - - // 회원의 정보를 가져옴 + // Get information of the member $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); - - // 아이디/비밀번호 찾기가 가능한 상태의 회원인지 검사 + // Check if possible to find member's ID and password if ($member_info->denied == 'Y') { $chk_args->member_srl = $member_info->member_srl; $output = executeQuery('member.chkAuthMail', $chk_args); if ($output->toBool() && $output->data->count != '0') return new Object(-1, 'msg_user_not_confirmed'); } - - // 인증 DB에 데이터를 넣음 + // Insert data into the authentication DB $args->user_id = $member_info->user_id; $args->member_srl = $member_info->member_srl; $args->new_password = rand(111111,999999); @@ -985,8 +909,7 @@ $output = executeQuery('member.insertAuthMail', $args); if(!$output->toBool()) return $output; - - // 메일 내용을 구함 + // Get content of the email to send a member Context::set('auth_args', $args); Context::set('member_info', $member_info); @@ -1004,27 +927,24 @@ $oTemplate = &TemplateHandler::getInstance(); $content = $oTemplate->compile($tpl_path, 'find_member_account_mail'); - - // 사이트 웹마스터 정보를 구함 + // Get information of the Webmaster $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); - - // 메일 발송 + // Send a mail $oMail = new Mail(); $oMail->setTitle( Context::getLang('msg_find_account_title') ); $oMail->setContent($content); $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); $oMail->send(); - - // 메세지 return + // Return message $msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address); return new Object(0,$msg); } /** - * @brief 질문/답변을 통한 임시 비밀번호 생성 + * @brief Generate a temp password by answering to the pre-determined question **/ function procMemberFindAccountByQuestion() { $email_address = Context::get('email_address'); @@ -1036,20 +956,18 @@ $oMemberModel = &getModel('member'); $oModuleModel = &getModel('module'); - - // 메일 주소에 해당하는 회원이 있는지 검사 + // Check if a member having the same email address exists $member_srl = $oMemberModel->getMemberSrlByEmailAddress($email_address); if(!$member_srl) return new Object(-1, 'msg_email_not_exists'); - - // 회원의 정보를 가져옴 + // Get information of the member $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); - // 질문 응답이 없으면 + // Display a message if no answer is entered if (!$member_info->find_account_question || !$member_info->find_account_answer) return new Object(-1, 'msg_question_not_exists'); if(trim($member_info->find_account_question) != $find_account_question || trim($member_info->find_account_answer) != $find_account_answer) return new Object(-1, 'msg_answer_not_matches'); - // 임시비밀번호로 변경 및 비밀번호 변경시간을 1로 설정 + // Update to a temporary password and set change_password_date to 1 $args->member_srl = $member_srl; list($usec, $sec) = explode(" ", microtime()); $temp_password = substr(md5($user_id . $member_info->find_account_answer. $usec . $sec),0,15); @@ -1065,22 +983,20 @@ } /** - * @brief 아이디/비밀번호 찾기 기능 실행 - * 메일에 등록된 링크를 선택시 호출되는 method로 비밀번호를 바꾸고 인증을 시켜버림 + * @brief Execute finding ID/Passoword + * When clicking the link in the verification email, a method is called to change the old password and to authenticate it **/ function procMemberAuthAccount() { - // user_id, authkey 검사 + // Test user_id and authkey $member_srl = Context::get('member_srl'); $auth_key = Context::get('auth_key'); if(!$member_srl || !$auth_key) return $this->stop('msg_invalid_request'); - - // user_id, authkey로 비밀번호 찾기 로그 검사 + // Test logs for finding password by user_id and authkey $args->member_srl = $member_srl; $args->auth_key = $auth_key; $output = executeQuery('member.getAuthMail', $args); if(!$output->toBool() || $output->data->auth_key != $auth_key) return $this->stop('msg_invalid_auth_key'); - - // 인증 정보가 맞다면 새비밀번호로 비밀번호를 바꿈 + // If credentials are correct, change the password to a new one if ($output->data->is_register == 'Y') { $args->password = $output->data->new_password; $args->denied = 'N'; @@ -1088,44 +1004,38 @@ $args->password = md5($output->data->new_password); unset($args->denied); } - - // $output->data->is_register 값을 백업해 둔다. + // Back up the value of $Output->data->is_register $is_register = $output->data->is_register; $output = executeQuery('member.updateMemberPassword', $args); if(!$output->toBool()) return $this->stop($output->getMessage()); - - // 인증 테이블에서 member_srl에 해당하는 모든 값을 지움 + // Remove all values having the member_srl from authentication table executeQuery('member.deleteAuthMail',$args); - - // 결과를 통보 + // Notify the result Context::set('is_register', $is_register); $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('msg_success_authed'); } /** - * @brief 아이디/비밀번호 찾기 기능 실행 - * 메일에 등록된 링크를 선택시 호출되는 method로 비밀번호를 바꾸고 인증을 시켜버림 + * @brief Execute finding ID/Passoword + * When clicking the link in the verification email, a method is called to change the old password and to authenticate it **/ function procMemberUpdateAuthMail() { $member_srl = Context::get('member_srl'); if(!$member_srl) return new Object(-1, 'msg_invalid_request'); $oMemberModel = &getModel('member'); - - // 회원의 정보를 가져옴 + // Get information of the member $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); - - // 인증메일 재발송 요청이 가능한 상태의 회원인지 검사 + // Check if the member is set to allow a request to re-send an authentication mail if ($member_info->denied != 'Y') return new Object(-1, 'msg_invalid_request'); $chk_args->member_srl = $member_srl; $output = executeQuery('member.chkAuthMail', $chk_args); if ($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); - - // 인증 DB에 데이터를 넣음 + // Insert data into the authentication DB $auth_args->member_srl = $member_srl; $auth_args->auth_key = md5(rand(0, 999999)); @@ -1134,8 +1044,7 @@ $oDB->rollback(); return $output; } - - // 메일 내용을 구함 + // Get content of the email to send a member Context::set('auth_args', $auth_args); Context::set('member_info', $member_info); @@ -1154,33 +1063,29 @@ $oTemplate = &TemplateHandler::getInstance(); $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); - - // 사이트 웹마스터 정보를 구함 + // Get information of the Webmaster $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); - - // 메일 발송 + // Send a mail $oMail = new Mail(); $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); $oMail->setContent($content); $oMail->setSender( $member_config->webmaster_name?$member_config->webmaster_name:'webmaster', $member_config->webmaster_email); $oMail->setReceiptor( $member_info->user_name, $member_info->email_address ); $oMail->send(); - - // 메세지 return + // Return message $msg = sprintf(Context::getLang('msg_auth_mail_sent'), $member_info->email_address); return new Object(-1, $msg); } /** - * @brief 인증 메일 재발송 + * @brief Request to re-send the authentication mail **/ function procMemberResendAuthMail() { - // email_address 검사 + // Get an email_address $email_address = Context::get('email_address'); if(!$email_address) return $this->stop('msg_invalid_request'); - - // email_address로 비밀번호 찾기 로그 검사 + // Log test by using email_address $oMemberModel = &getModel('member'); $args->email_address = $email_address; @@ -1189,7 +1094,7 @@ $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_info); - // 이전에 인증 메일을 보냈는지 확인 + // Check if a authentication mail has been sent previously $chk_args->member_srl = $member_info->member_srl; $output = executeQuery('member.chkAuthMail', $chk_args); if($output->toBool() && $output->data->count == '0') return new Object(-1, 'msg_invalid_request'); @@ -1198,8 +1103,7 @@ $output = executeQueryArray('member.getAuthMailInfo', $auth_args); if(!$output->data || !$output->data[0]->auth_key) return new Object(-1, 'msg_invalid_request'); $auth_info = $output->data[0]; - - // 메일 내용을 구함 + // Get content of the email to send a member Context::set('member_info', $member_info); $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); @@ -1216,12 +1120,10 @@ $oTemplate = &TemplateHandler::getInstance(); $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); - - // 사이트 웹마스터 정보를 구함 + // Get information of the Webmaster $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); - - // 메일 발송 + // Send a mail $oMail = new Mail(); $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); $oMail->setContent($content); @@ -1234,7 +1136,7 @@ } /** - * @brief 가상 사이트 가입 + * @brief Join a virtual site **/ function procModuleSiteSignUp() { $site_module_info = Context::get('site_module_info'); @@ -1249,7 +1151,7 @@ } /** - * @brief 가상 사이트 탈퇴 + * @brief Leave the virtual site **/ function procModuleSiteLeave() { $site_module_info = Context::get('site_module_info'); @@ -1264,7 +1166,7 @@ } /** - * @brief 회원 설정 정보를 저장 + * @brief Save the member configurations **/ function setMemberConfig($args) { if(!$args->skin) $args->skin = "default"; @@ -1294,7 +1196,7 @@ } /** - * @brief 서명을 파일로 저장 + * @brief Save the signature as a file **/ function putSignature($member_srl, $signature) { $signature = trim(removeHackTag($signature)); @@ -1312,7 +1214,7 @@ } /** - * @brief 서명 파일 삭제 + * @brief Delete the signature file **/ function delSignature($member_srl) { $filename = sprintf('files/member_extra_info/signature/%s%d.gif', getNumberingPath($member_srl), $member_srl); @@ -1320,7 +1222,7 @@ } /** - * @brief member_srl에 group_srl을 추가 + * @brief Add group_srl to member_srl **/ function addMemberToGroup($member_srl,$group_srl,$site_srl=0) { $args->member_srl = $member_srl; @@ -1331,7 +1233,7 @@ $groups = $oModel->getMemberGroups($member_srl, $site_srl, true); if($groups[$group_srl]) return new Object(); - // 추가 + // Add $output = executeQuery('member.addMemberToGroup',$args); $output2 = ModuleHandler::triggerCall('member.addMemberToGroup', 'after', $args); @@ -1339,8 +1241,8 @@ } /** - * @brief 특정 회원들의 그룹을 일괄 변경 - * 가상 사이트와 같이 한 회원이 하나의 그룹만 가질 경우 사용할 수 있음 + * @brief Change a group of certain members + * Available only when a member has a single group **/ function replaceMemberGroup($args) { $obj->site_srl = $args->site_srl; @@ -1370,16 +1272,14 @@ /** - * @brief 자동 로그인 시킴 + * @brief Auto-login **/ function doAutologin() { - // 자동 로그인 키 값을 구함 + // Get a key value of auto log-in $args->autologin_key = $_COOKIE['xeak']; - - // 키값에 해당하는 정보 구함 + // Get information of the key $output = executeQuery('member.getAutologin', $args); - - // 정보가 없으면 쿠키 삭제 + // If no information exists, delete a cookie if(!$output->toBool() || !$output->data) { setCookie('xeak',null,time()+60*60*24*365, '/'); return; @@ -1394,17 +1294,17 @@ $do_auto_login = false; - // 정보를 바탕으로 키값 비교 + // Compare key values based on the information $key = md5($user_id.$password.$_SERVER['REMOTE_ADDR']); if($key == $args->autologin_key) { - // 설정된 change_password_date 확인 + // Check change_password_date $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); $limit_date = $member_config->change_password_date; - // change_password_date가 설정되어 있으면 확인 + // Check if change_password_date is set if($limit_date > 0) { $oMemberModel = &getModel('member'); $member_info = $oMemberModel->getMemberInfoByUserID($user_id); @@ -1428,51 +1328,41 @@ } /** - * @brief 로그인 시킴 + * @brief Log-in **/ function doLogin($user_id, $password = '', $keep_signed = false) { $user_id = strtolower($user_id); - - // 로그인 이전에 trigger 호출 (before) + // Call a trigger before log-in (before) $trigger_obj->user_id = $user_id; $trigger_obj->password = $password; $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'before', $trigger_obj); if(!$trigger_output->toBool()) return $trigger_output; - - // member model 객체 생성 + // Create a member model object $oMemberModel = &getModel('member'); - - // user_id 에 따른 정보 가져옴 + // Get user_id information $member_info = $oMemberModel->getMemberInfoByUserID($user_id); - - // return 값이 없으면 존재하지 않는 사용자로 지정 + // Set an invalid user if no value returned if(!$user_id || strtolower($member_info->user_id) != strtolower($user_id)) return new Object(-1, 'invalid_user_id'); - - // 비밀번호 검사 + // Password Check if($password && !$oMemberModel->isValidPassword($member_info->password, $password)) return new Object(-1, 'invalid_password'); - - // denied == 'Y' 이면 알림 + // If denied == 'Y', notify if($member_info->denied == 'Y') { $args->member_srl = $member_info->member_srl; $output = executeQuery('member.chkAuthMail', $args); if ($output->toBool() && $output->data->count != '0') return new Object(-1,'msg_user_not_confirmed'); return new Object(-1,'msg_user_denied'); } - - // denied_date가 현 시간보다 적으면 알림 + // Notify if denied_date is less than the current time if($member_info->limit_date && substr($member_info->limit_date,0,8) >= date("Ymd")) return new Object(-1,sprintf(Context::getLang('msg_user_limited'),zdate($member_info->limit_date,"Y-m-d"))); - - // 사용자 정보의 최근 로그인 시간을 기록 + // Update the latest login time $args->member_srl = $member_info->member_srl; $output = executeQuery('member.updateLastLogin', $args); - - // 로그인 성공후 trigger 호출 (after) + // Call a trigger after successfully log-in (after) $trigger_output = ModuleHandler::triggerCall('member.doLogin', 'after', $member_info); if(!$trigger_output->toBool()) return $trigger_output; - - // 자동 로그인 사용시 정보 처리 + // When user checked to use auto-login if($keep_signed) { - // 자동 로그인 키 생성 + // Key generate for auto login $autologin_args->autologin_key = md5(strtolower($user_id).$member_info->password.$_SERVER['REMOTE_ADDR']); $autologin_args->member_srl = $member_info->member_srl; executeQuery('member.deleteAutologin', $autologin_args); @@ -1486,60 +1376,50 @@ } /** - * @brief 세션 정보 갱싱 또는 생성 + * @brief Update or create session information **/ function setSessionInfo($member_info = null) { $oMemberModel = &getModel('member'); - - // 사용자 정보가 넘어오지 않았다면 현재 세션 정보에서 사용자 정보를 추출 + // If your information came through the current session information to extract information from the users if(!$member_info && $_SESSION['member_srl'] && $oMemberModel->isLogged() ) { $member_info = $oMemberModel->getMemberInfoByMemberSrl($_SESSION['member_srl']); - - // 회원정보가 없다면 세션 파기 + // If you do not destroy the session Profile if($member_info->member_srl != $_SESSION['member_srl']) { $this->destroySessionInfo(); return; } } - - // 사용중지 아이디이면 세션 파기 + // Stop using the session id is destroyed if($member_info->denied=='Y') { $this->destroySessionInfo(); return; } - - // 오픈아이디인지 체크 (일단 아이디 형식으로만 결정) + // OpenID is a check (only for a determined identity types) if(preg_match("/^([_0-9a-zA-Z]+)$/is", $member_info->user_id)) $member_info->is_openid = false; else $member_info->is_openid = true; - - // 로그인 처리를 위한 세션 설정 + // Log in for treatment sessions set $_SESSION['is_logged'] = true; $_SESSION['ipaddress'] = $_SERVER['REMOTE_ADDR']; $_SESSION['member_srl'] = $member_info->member_srl; $_SESSION['is_admin'] = ''; - - // 비밀번호는 세션에 저장되지 않도록 지워줌;; + // Do not save your password in the session jiwojum;; //unset($member_info->password); - - // 사용자 그룹 설정 + // User Group Settings /* if($member_info->group_list) { $group_srl_list = array_keys($member_info->group_list); $_SESSION['group_srls'] = $group_srl_list; - - // 관리자 그룹일 경우 관리자로 지정 + // If the group is designated as an administrator administrator $oMemberModel = &getModel('member'); $admin_group = $oMemberModel->getAdminGroup(); if($admin_group->group_srl && in_array($admin_group->group_srl, $group_srl_list)) $_SESSION['is_admin'] = 'Y'; } */ - - // 세션에 로그인 사용자 정보 저장 + // Information stored in the session login user $_SESSION['logged_info'] = $member_info; Context::set('is_logged', true); Context::set('logged_info', $member_info); - - // 사용자의 전용 메뉴 구성 (이 메뉴는 애드온등으로 변경될 수 있음) + // Only the menu configuration of the user (such as an add-on to the menu can be changed) $this->addMemberMenu( 'dispMemberInfo', 'cmd_view_member_info'); $this->addMemberMenu( 'dispMemberScrappedDocument', 'cmd_view_scrapped_document'); $this->addMemberMenu( 'dispMemberSavedDocument', 'cmd_view_saved_document'); @@ -1547,8 +1427,8 @@ } /** - * @brief 로그인한 사용자의 개인화된 메뉴 제공을 위한 method - * 로그인 정보 출력 위젯 또는 개인화 페이지에서 사용됨 + * @brief Logged method for providing a personalized menu + * Login information is used in the output widget, or personalized page **/ function addMemberMenu($act, $str) { $logged_info = Context::get('logged_info'); @@ -1560,7 +1440,7 @@ } /** - * @brief 로그인 회원의 닉네임등을 클릭할때 나타나는 팝업 메뉴를 추가하는 method + * @brief Nickname and click Log In to add a pop-up menu that appears when the method **/ function addMemberPopupMenu($url, $str, $icon = '', $target = 'self') { $member_popup_menu_list = Context::get('member_popup_menu_list'); @@ -1576,26 +1456,22 @@ } /** - * @brief member 테이블에 사용자 추가 + * @brief Add users to the member table **/ function insertMember(&$args, $password_is_hashed = false) { - // trigger 호출 (before) + // Call a trigger (before) $output = ModuleHandler::triggerCall('member.insertMember', 'before', $args); if(!$output->toBool()) return $output; - - // 멤버 설정 정보에서 가입약관 부분을 재확인 + // Terms and Conditions portion of the information set up by members reaffirmed $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('member'); $logged_info = Context::get('logged_info'); - - // 임시 제한 일자가 있을 경우 제한 일자에 내용 추가 + // If the date of the temporary restrictions limit further information on the date of if($config->limit_day) $args->limit_date = date("YmdHis", time()+$config->limit_day*60*60*24); - - // 입력할 사용자의 아이디를 소문자로 변경 + // Enter the user's identity changed to lowercase $args->user_id = strtolower($args->user_id); - - // 필수 변수들의 조절 + // Control of essential parameters if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; if($args->denied!='Y') $args->denied = 'N'; $args->allow_message= 'Y'; @@ -1607,17 +1483,14 @@ } list($args->email_id, $args->email_host) = explode('@', $args->email_address); - - // 홈페이지, 블로그의 주소 검사 + // Website, blog, checks the address if($args->homepage && !preg_match("/^[a-z]+:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; if($args->blog && !preg_match("/^[a-z]+:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; - - // 모델 객체 생성 + // Create a model object $oMemberModel = &getModel('member'); - // 금지 아이디인지 체크 + // ID check is prohibited if($oMemberModel->isDeniedID($args->user_id)) return new Object(-1,'denied_user_id'); - - // 아이디, 닉네임, email address 의 중복 체크 + // ID, nickname, email address of the redundancy check $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); if($member_srl) return new Object(-1,'msg_exists_user_id'); @@ -1629,8 +1502,7 @@ $oDB = &DB::getInstance(); $oDB->begin(); - - // DB에 입력 + // Insert data into the DB $args->member_srl = getNextSequence(); $args->list_order = -1 * $args->member_srl; if($args->password && !$password_is_hashed) $args->password = md5($args->password); @@ -1641,19 +1513,16 @@ $oDB->rollback(); return $output; } - - // 입력된 그룹 값이 없으면 기본 그룹의 값을 등록 + // If no value is entered the default group, the value of group registration if(!$args->group_srl_list) { $default_group = $oMemberModel->getDefaultGroup(0); - - // 기본 그룹에 추가 + // Add to the default group $output = $this->addMemberToGroup($args->member_srl,$default_group->group_srl); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // 입력된 그룹 값이 있으면 해당 그룹의 값을 등록 + // If the value is the value of the group entered the group registration } else { $group_srl_list = explode('|@|', $args->group_srl_list); for($i=0;$idenied == 'Y') { - // 인증 DB에 데이터를 넣음 + // Insert data into the authentication DB $auth_args->user_id = $args->user_id; $auth_args->member_srl = $args->member_srl; $auth_args->new_password = $args->password; @@ -1680,8 +1548,7 @@ $oDB->rollback(); return $output; } - - // 메일 내용을 구함 + // Get content of the email to send a member Context::set('auth_args', $auth_args); Context::set('member_info', $args); @@ -1699,12 +1566,10 @@ $oTemplate = &TemplateHandler::getInstance(); $content = $oTemplate->compile($tpl_path, 'confirm_member_account_mail'); - - // 사이트 웹마스터 정보를 구함 + // Get information of the Webmaster $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); - - // 메일 발송 + // Send a mail $oMail = new Mail(); $oMail->setTitle( Context::getLang('msg_confirm_account_title') ); $oMail->setContent($content); @@ -1712,8 +1577,7 @@ $oMail->setReceiptor( $args->user_name, $args->email_address ); $oMail->send(); } - - // trigger 호출 (after) + // Call a trigger (after) if($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('member.insertMember', 'after', $args); if(!$trigger_output->toBool()) { @@ -1729,23 +1593,20 @@ } /** - * @brief member 정보 수정 + * @brief Modify member information **/ function updateMember($args) { - // trigger 호출 (before) + // Call a trigger (before) $output = ModuleHandler::triggerCall('member.updateMember', 'before', $args); if(!$output->toBool()) return $output; - - // 모델 객체 생성 + // Create a model object $oMemberModel = &getModel('member'); $logged_info = Context::get('logged_info'); - - // 수정하려는 대상의 원래 정보 가져오기 + // Get what you want to modify the original information $member_info = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); if(!$args->user_id) $args->user_id = $member_info->user_id; - - // 필수 변수들의 조절 + // Control of essential parameters if($args->allow_mailing!='Y') $args->allow_mailing = 'N'; if($args->allow_message && !in_array($args->allow_message, array('Y','N','F'))) $args->allow_message = 'Y'; @@ -1758,12 +1619,10 @@ } list($args->email_id, $args->email_host) = explode('@', $args->email_address); - - // 홈페이지, 블로그의 주소 검사 + // Website, blog, checks the address if($args->homepage && !preg_match("/^[a-z]+:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; if($args->blog && !preg_match("/^[a-z]+:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; - - // 아이디, 닉네임, email address 의 중복 체크 + // ID, nickname, email address of the redundancy check $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); if($member_srl&&$args->member_srl!=$member_srl) return new Object(-1,'msg_exists_user_id'); @@ -1775,8 +1634,7 @@ $oDB = &DB::getInstance(); $oDB->begin(); - - // DB에 update + // DB in the update if($args->password) $args->password = md5($args->password); else $args->password = $member_info->password; if(!$args->user_name) $args->user_name = $member_info->user_name; @@ -1787,20 +1645,17 @@ $oDB->rollback(); return $output; } - - // 그룹 정보가 있으면 그룹 정보를 변경 + // If the group information, group information changes if($args->group_srl_list) { $group_srl_list = explode('|@|', $args->group_srl_list); $args->site_srl = 0; - - // 일단 해당 회원의 모든 그룹 정보를 삭제 + // One of its members to delete all the group $output = executeQuery('member.deleteMemberGroupMember', $args); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // 하나 하나 루프를 돌면서 입력 + // Enter one of the loop a for($i=0;$iaddMemberToGroup($args->member_srl,$group_srl_list[$i]); if(!$output->toBool()) { @@ -1809,8 +1664,7 @@ } } } - - // trigger 호출 (after) + // Call a trigger (after) if($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('member.updateMember', 'after', $args); if(!$trigger_output->toBool()) { @@ -1820,8 +1674,7 @@ } $oDB->commit(); - - // 세션에 저장 + // Save Session $member_info = $oMemberModel->getMemberInfoByMemberSrl($args->member_srl); $logged_info = Context::get('logged_info'); @@ -1834,7 +1687,7 @@ } /** - * @brief member 비밀번호 수정 + * @brief Modify member password **/ function updateMemberPassword($args) { $output = executeQuery('member.updateChangePasswordDate', $args); @@ -1843,61 +1696,53 @@ } /** - * @brief 사용자 삭제 + * @brief Delete User **/ function deleteMember($member_srl) { - // trigger 호출 (before) + // Call a trigger (before) $trigger_obj->member_srl = $member_srl; $output = ModuleHandler::triggerCall('member.deleteMember', 'before', $trigger_obj); if(!$output->toBool()) return $output; - - // 모델 객체 생성 + // Create a model object $oMemberModel = &getModel('member'); - - // 해당 사용자의 정보를 가져옴 + // Bringing the user's information $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); if(!$member_info) return new Object(-1, 'msg_not_exists_member'); - - // 관리자의 경우 삭제 불가능 + // If managers can not be deleted if($member_info->is_admin == 'Y') return new Object(-1, 'msg_cannot_delete_admin'); $oDB = &DB::getInstance(); $oDB->begin(); $args->member_srl = $member_srl; - // member_auth_mail에서 해당 항목들 삭제 + // Delete the entries in member_auth_mail $output = executeQuery('member.deleteAuthMail', $args); if (!$output->toBool()) { $oDB->rollback(); return $output; } - - // member_openid에서 해당 항목들 삭제 + // Delete the entries in member_openid $output = executeQuery('member.deleteMemberOpenIDByMemberSrl', $ags); - - // TODO: 테이블 업그레이드를 하지 않은 경우에 실패할 수 있다. + // TODO: If the table is not an upgrade may fail. /* if(!$output->toBool()) { $oDB->rollback(); return $output; } */ - - // member_group_member에서 해당 항목들 삭제 + // Delete the entries in member_group_member $output = executeQuery('member.deleteMemberGroupMember', $args); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // member 테이블에서 삭제 + // member removed from the table $output = executeQuery('member.deleteMember', $args); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // trigger 호출 (after) + // Call a trigger (after) if($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('member.deleteMember', 'after', $trigger_obj); if(!$trigger_output->toBool()) { @@ -1907,8 +1752,7 @@ } $oDB->commit(); - - // 이름이미지, 이미지마크, 서명 삭제 + // Name, image, image, mark, sign, delete $this->procMemberDeleteImageName(); $this->procMemberDeleteImageMark(); $this->delSignature($member_srl); @@ -1917,7 +1761,7 @@ } /** - * @brief 모든 세션 정보 파기 + * @brief Destroy all session information **/ function destroySessionInfo() { if(!$_SESSION || !is_array($_SESSION)) return; diff --git a/modules/member/member.mobile.php b/modules/member/member.mobile.php index 990179938..3a67c783f 100644 --- a/modules/member/member.mobile.php +++ b/modules/member/member.mobile.php @@ -3,7 +3,7 @@ class memberMobile extends member { function init() { - // 회원 관리 정보를 받음 + // Get the member configuration $oModuleModel = &getModel('module'); $this->member_config = $oModuleModel->getModuleConfig('member'); @@ -20,7 +20,7 @@ class memberMobile extends member return; } - // 템플릿 파일 지정 + // Set a template file Context::set('referer_url', $_SERVER['HTTP_REFERER']); $this->setTemplateFile('login_form'); @@ -47,7 +47,7 @@ class memberMobile extends member $oMemberModel = &getModel('member'); $logged_info = Context::get('logged_info'); - // 비회원일 경우 정보 열람 중지 + // Don't display member info to non-logged user if(!$logged_info->member_srl) return $this->stop('msg_not_permitted'); $member_srl = Context::get('member_srl'); if(!$member_srl && Context::get('is_logged')) { @@ -73,14 +73,14 @@ class memberMobile extends member } /** - * @brief 회원 정보 수정 + * @brief Edit member profile **/ function dispMemberModifyInfo() { $oMemberModel = &getModel('member'); $oModuleModel = &getModel('module'); $memberModuleConfig = $oModuleModel->getModuleConfig('member'); - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); @@ -90,12 +90,12 @@ class memberMobile extends member $member_info->signature = $oMemberModel->getSignature($member_srl); Context::set('member_info',$member_info); - // 추가 가입폼 목록을 받음 + // Receive a member join form Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info)); Context::set('openids', $oMemberModel->getMemberOpenIDByMemberSrl($member_srl)); - // 에디터 모듈의 getEditor를 호출하여 서명용으로 세팅 + // Call getEditor of the editor module and set it for signiture if($member_info->member_srl) { $oEditorModel = &getModel('editor'); $option->primary_key_name = 'member_srl'; @@ -113,17 +113,17 @@ class memberMobile extends member Context::set('editor', $editor); } - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('modify_info'); } /** - * @brief 회원 비밀번호 수정 + * @brief Change the user password **/ function dispMemberModifyPassword() { $oMemberModel = &getModel('member'); - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); @@ -132,17 +132,17 @@ class memberMobile extends member $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); Context::set('member_info',$member_info); - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('modify_password'); } /** - * @brief 탈퇴 화면 + * @brief Member withdrawl **/ function dispMemberLeave() { $oMemberModel = &getModel('member'); - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); @@ -151,7 +151,7 @@ class memberMobile extends member $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); Context::set('member_info',$member_info); - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('leave_form'); } } diff --git a/modules/member/member.model.php b/modules/member/member.model.php index e495cd87d..1012da27e 100644 --- a/modules/member/member.model.php +++ b/modules/member/member.model.php @@ -2,31 +2,30 @@ /** * @class memberModel * @author NHN (developers@xpressengine.com) - * @brief member module의 Model class + * @brief Model class of the member module **/ class memberModel extends member { /** - * @brief 자주 호출될거라 예상되는 데이터는 내부적으로 가지고 있자... + * @brief Keep data internally which may be frequently called ... **/ var $join_form_list = NULL; /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 회원 설정 정보를 return + * @brief Return member's configuration **/ function getMemberConfig() { - // DB에 저장되는 회원 설정 정보 구함 + // Get member configuration stored in the DB $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('member'); - - // 회원가입 약관 구함 + // Get terms of user $agreement_file = _XE_PATH_.'files/member_extra_info/agreement.txt'; if(file_exists($agreement_file)) $config->agreement = FileHandler::readFile($agreement_file); @@ -45,62 +44,52 @@ } /** - * @brief 선택된 회원의 간단한 메뉴를 표시 + * @brief Display menus of the member **/ function getMemberMenu() { - // 요청된 회원 번호와 현재 사용자의 로그인 정보 구함 + // Get member_srl of he target member and logged info of the current user $member_srl = Context::get('target_srl'); $mid = Context::get('cur_mid'); $logged_info = Context::get('logged_info'); $act = Context::get('cur_act'); - - // 자신의 아이디를 클릭한 경우 + // When click user's own nickname if($member_srl == $logged_info->member_srl) $member_info = $logged_info; - - // 다른 사람의 아이디를 클릭한 경우 + // When click other's nickname else $member_info = $this->getMemberInfoByMemberSrl($member_srl); $member_srl = $member_info->member_srl; if(!$member_srl) return; - - // 변수 정리 + // List variables $user_id = $member_info->user_id; $user_name = $member_info->user_name; ModuleHandler::triggerCall('member.getMemberMenu', 'before', $null); $oMemberController = &getController('member'); - - // 회원 정보 보기 (비회원일 경우 볼 수 없도록 수정) + // Display member information (Don't display to non-logged user) if($logged_info->member_srl) { $url = getUrl('','mid',$mid,'act','dispMemberInfo','member_srl',$member_srl); $icon_path = './modules/member/tpl/images/icon_view_info.gif'; $oMemberController->addMemberPopupMenu($url,'cmd_view_member_info',$icon_path,'self'); } - - // 다른 사람의 아이디를 클릭한 경우 + // When click other's nickname if($member_srl != $logged_info->member_srl) { - - // 메일 보내기 + // Send an email if($member_info->email_address) { $url = 'mailto:'.htmlspecialchars($member_info->email_address); $icon_path = './modules/member/tpl/images/icon_sendmail.gif'; $oMemberController->addMemberPopupMenu($url,'cmd_send_email',$icon_path); } } - - // 홈페이지 보기 + // View homepage info if($member_info->homepage) $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->homepage), 'homepage', './modules/member/tpl/images/icon_homepage.gif','blank'); - - // 블로그 보기 + // View blog info if($member_info->blog) $oMemberController->addMemberPopupMenu(htmlspecialchars($member_info->blog), 'blog', './modules/member/tpl/images/icon_blog.gif','blank'); - - // trigger 호출 (after) + // Call a trigger (after) ModuleHandler::triggerCall('member.getMemberMenu', 'after', $null); - - // 최고 관리자라면 회원정보 수정 메뉴 만듬 + // Display a menu for editting member info to a top administrator if($logged_info->is_admin == 'Y') { $url = getUrl('','module','admin','act','dispMemberAdminInsert','member_srl',$member_srl); $icon_path = './modules/member/tpl/images/icon_management.gif'; @@ -114,20 +103,18 @@ $icon_path = './modules/member/tpl/images/icon_trace_comment.gif'; $oMemberController->addMemberPopupMenu($url,'cmd_trace_comment',$icon_path,'TraceMemberComment'); } - - // 팝업메뉴의 언어 변경 + // Change a language of pop-up menu $menus = Context::get('member_popup_menu_list'); $menus_count = count($menus); for($i=0;$i<$menus_count;$i++) { $menus[$i]->str = Context::getLang($menus[$i]->str); } - - // 최종적으로 정리된 팝업메뉴 목록을 구함 + // Get a list of finalized pop-up menu $this->add('menus', $menus); } /** - * @brief 로그인 되어 있는지에 대한 체크 + * @brief Check if logged-in **/ function isLogged() { if($_SESSION['is_logged']&&$_SESSION['ipaddress']==$_SERVER['REMOTE_ADDR']) return true; @@ -138,24 +125,22 @@ } /** - * @brief 인증된 사용자의 정보 return + * @brief Return session information of the logged-in user **/ function getLoggedInfo() { - // 로그인 되어 있고 세션 정보를 요청하면 세션 정보를 return + // Return session info if session info is requested and the user is logged-in if($this->isLogged()) { $logged_info = $_SESSION['logged_info']; - - // site_module_info에 따라서 관리자/ 그룹 목록을 매번 재지정 + // Admin/Group list defined depending on site_module_info $site_module_info = Context::get('site_module_info'); if($site_module_info->site_srl) { $logged_info->group_list = $this->getMemberGroups($logged_info->member_srl, $site_module_info->site_srl); - - // 사이트 관리자이면 로그인 정보에 is_site_admin bool변수를 추가 + // Add is_site_admin bool variable into logged_info if site_administrator is $oModuleModel = &getModel('module'); if($oModuleModel->isSiteAdmin($logged_info)) $logged_info->is_site_admin = true; else $logged_info->is_site_admin = false; } else { - // 만약 기본 사이트인데 회원 그룹이 존재하지 않으면 등록 + // Register a default group if the site doesn't have a member group if(!count($logged_info->group_list)) { $default_group = $this->getDefaultGroup(0); $oMemberController = &getController('member'); @@ -175,7 +160,7 @@ } /** - * @brief user_id에 해당하는 사용자 정보 return + * @brief Return member information with user_id **/ function getMemberInfoByUserID($user_id) { if(!$user_id) return; @@ -191,7 +176,7 @@ } /** - * @brief member_srl로 사용자 정보 return + * @brief Return member information with member_srl **/ function getMemberInfoByMemberSrl($member_srl, $site_srl = 0) { if(!$member_srl) return; @@ -208,7 +193,7 @@ } /** - * @brief 사용자 정보 중 extra_vars와 기타 정보를 알맞게 편집 + * @brief Add member info from extra_vars and other information **/ function arrangeMemberInfo($info, $site_srl = 0) { if(!$GLOBALS['__member_info__'][$info->member_srl]) { @@ -241,7 +226,7 @@ } /** - * @brief userid에 해당하는 member_srl을 구함 + * @brief Get member_srl corresponding to userid **/ function getMemberSrlByUserID($user_id) { $args->user_id = $user_id; @@ -250,7 +235,7 @@ } /** - * @brief EmailAddress에 해당하는 member_srl을 구함 + * @brief Get member_srl corresponding to EmailAddress **/ function getMemberSrlByEmailAddress($email_address) { $args->email_address = $email_address; @@ -259,7 +244,7 @@ } /** - * @brief NickName에 해당하는 member_srl을 구함 + * @brief Get member_srl corresponding to nickname **/ function getMemberSrlByNickName($nick_name) { $args->nick_name = $nick_name; @@ -268,7 +253,7 @@ } /** - * @brief 현재 접속자의 member_srl을 return + * @brief Return member_srl of the current logged-in user **/ function getLoggedMemberSrl() { if(!$this->isLogged()) return; @@ -276,7 +261,7 @@ } /** - * @brief 현재 접속자의 user_id을 return + * @brief Return user_id of the current logged-in user **/ function getLoggedUserID() { if(!$this->isLogged()) return; @@ -285,7 +270,7 @@ } /** - * @brief member_srl이 속한 group 목록을 가져옴 + * @brief Get a list of groups which the member_srl belongs to **/ function getMemberGroups($member_srl, $site_srl = 0, $force_reload = false) { static $member_groups = array(); @@ -307,7 +292,7 @@ } /** - * @brief member_srl들이 속한 group 목록을 가져옴 + * @brief Get a list of groups which member_srls belong to **/ function getMembersGroups($member_srls, $site_srl = 0) { $args->member_srls = implode(',',$member_srls); @@ -323,7 +308,7 @@ } /** - * @brief 기본 그룹을 가져옴 + * @brief Get a default group **/ function getDefaultGroup($site_srl = 0) { $args->site_srl = $site_srl; @@ -332,7 +317,7 @@ } /** - * @brief 관리자 그룹을 가져옴 + * @brief Get an admin group **/ function getAdminGroup() { $output = executeQuery('member.getAdminGroup'); @@ -340,7 +325,7 @@ } /** - * @brief group_srl에 해당하는 그룹 정보 가져옴 + * @brief Get group info corresponding to group_srl **/ function getGroup($group_srl) { $args->group_srl = $group_srl; @@ -349,7 +334,7 @@ } /** - * @brief 그룹 목록을 가져옴 + * @brief Get a list of groups **/ function getGroups($site_srl = 0) { if(!$GLOBALS['__group_info__'][$site_srl]) { @@ -370,28 +355,25 @@ } /** - * @brief 회원 가입폼 추가 확장 목록 가져오기 + * @brief Get a list of member join forms * - * 이 메소드는 modules/member/tpl/filter/insert.xml 의 extend_filter로 동작을 한다. - * extend_filter로 사용을 하기 위해서는 인자값으로 boolean값을 받도록 규정한다. - * 이 인자값이 true일 경우 filter 타입에 맞는 형태의 object로 결과를 return하여야 한다. + * This method works as an extend filter of modules/member/tpl/filter/insert.xml. + * To use as extend_filter, the argument should be boolean. + * When the argument is true, it returns object result in type of filter. **/ function getJoinFormList($filter_response = false) { global $lang; - - // 최고관리자는 무시하도록 설정 + // Set to ignore if a super administrator. $logged_info = Context::get('logged_info'); if(!$this->join_form_list) { - // list_order 컬럼의 정렬을 위한 인자 세팅 + // Argument setting to sort list_order column $args->sort_index = "list_order"; $output = executeQuery('member.getJoinFormList', $args); - - // 결과 데이터가 없으면 NULL return + // NULL if output data deosn't exist $join_form_list = $output->data; if(!$join_form_list) return NULL; - - // default_value의 경우 DB에 array가 serialize되어 입력되므로 unserialize가 필요 + // Need to unserialize because serialized array is inserted into DB in case of default_value if(!is_array($join_form_list)) $join_form_list = array($join_form_list); $join_form_count = count($join_form_list); for($i=0;$i<$join_form_count;$i++) { @@ -402,11 +384,9 @@ $column_name = $join_form_list[$i]->column_name; $column_title = $join_form_list[$i]->column_title; $default_value = $join_form_list[$i]->default_value; - - // 언어변수에 추가 + // Add language variable $lang->extend_vars[$column_name] = $column_title; - - // checkbox, select등 다수 데이터 형식일 경우 unserialize해줌 + // unserialize if the data type if checkbox, select and so on if(in_array($column_type, array('checkbox','select','radio'))) { $join_form_list[$i]->default_value = unserialize($default_value); if(!$join_form_list[$i]->default_value[0]) $join_form_list[$i]->default_value = ''; @@ -418,8 +398,7 @@ } $this->join_form_list = $list; } - - // filter_response가 true일 경우 object 스타일을 구함 + // Get object style if the filter_response is true if($filter_response && count($this->join_form_list)) { foreach($this->join_form_list as $key => $val) { @@ -441,19 +420,17 @@ return $filter_output; } - - // 결과 리턴 + // Return the result return $this->join_form_list; } /** - * @brief 추가 회원가입폼과 특정 회원의 정보를 조합 (회원정보 수정등에 사용) + * @brief Combine extend join form and member information (used to modify member information) **/ function getCombineJoinForm($member_info) { $extend_form_list = $this->getJoinFormlist(); if(!$extend_form_list) return; - - // 관리자이거나 자기 자신이 아니면 비공개의 경우 무조건 패스해버림 + // Member info is open only to an administrator and him/herself when is_private is true. $logged_info = Context::get('logged_info'); foreach($extend_form_list as $srl => $item) { @@ -464,8 +441,7 @@ $extend_form_list[$srl]->is_private = true; continue; } - - // 추가 확장폼의 종류에 따라 값을 변경 + // Change values depening on the type of extend form switch($item->column_type) { case 'checkbox' : if($value && !is_array($value)) $value = array($value); @@ -489,7 +465,7 @@ } /** - * @brief 한개의 가입항목을 가져옴 + * @brief Get a join form **/ function getJoinForm($member_join_form_srl) { $args->member_join_form_srl = $member_join_form_srl; @@ -510,7 +486,7 @@ } /** - * @brief 금지 아이디 목록 가져오기 + * @brief Get a list of denied IDs **/ function getDeniedIDList() { if(!$this->denied_id_list) { @@ -526,7 +502,7 @@ } /** - * @brief 금지 아이디인지 확인 + * @brief Verify if ID is denied **/ function isDeniedID($user_id) { $args->user_id = $user_id; @@ -536,7 +512,7 @@ } /** - * @brief 프로필 이미지의 정보를 구함 + * @brief Get information of the profile image **/ function getProfileImage($member_srl) { if(!isset($GLOBALS['__member_info__']['profile_image'][$member_srl])) { @@ -561,7 +537,7 @@ } /** - * @brief 이미지이름의 정보를 구함 + * @brief Get the image name **/ function getImageName($member_srl) { if(!isset($GLOBALS['__member_info__']['image_name'][$member_srl])) { @@ -579,7 +555,7 @@ } /** - * @brief 이미지마크의 정보를 구함 + * @brief Get the image mark **/ function getImageMark($member_srl) { if(!isset($GLOBALS['__member_info__']['image_mark'][$member_srl])) { @@ -599,7 +575,7 @@ /** - * @brief group의 이미지마크 정보를 구함 + * @brief Get the image mark of the group **/ function getGroupImageMark($member_srl,$site_srl=0) { $oModuleModel = &getModel('module'); @@ -626,7 +602,7 @@ } /** - * @brief 사용자의 signature를 구함 + * @brief Get user's signature **/ function getSignature($member_srl) { if(!isset($GLOBALS['__member_info__']['signature'][$member_srl])) { @@ -641,19 +617,16 @@ } /** - * @brief 입력된 plain text 비밀번호와 DB에 저장된 비밀번호와의 비교 + * @brief Compare plain text password to the password saved in DB **/ function isValidPassword($hashed_password, $password_text) { - // 입력된 비밀번호가 없으면 무조건 falase + // False if no password in entered if(!$password_text) return false; - - // md5 해쉬된값가 맞으면 return true + // Return true if the user input is equal to md5 hash value if($hashed_password == md5($password_text)) return true; - - // mysql_pre4_hash_password함수의 값과 동일하면 return true + // Return true if the user input is equal to the value of mysql_pre4_hash_password if(mysql_pre4_hash_password($password_text) == $hashed_password) return true; - - // 현재 DB에서 mysql DB를 이용시 직접 old_password를 이용하여 검사하고 맞으면 비밀번호를 변경 + // Verify the password by using old_password if the current db is MySQL. If correct, return true. if(substr(Context::getDBType(),0,5)=='mysql') { $oDB = &DB::getInstance(); if($oDB->isValidOldPassword($password_text, $hashed_password)) return true; @@ -663,7 +636,7 @@ } /** - * @brief 멤버와 연결된 오픈아이디들을 모두 리턴한다. + * @brief Return all the open IDs of the member **/ function getMemberOpenIDByMemberSrl($member_srl) { $oModuleModel = &getModel('module'); @@ -697,7 +670,7 @@ } /** - * @brief 오픈아이디에 연결된 멤버를 리턴한다. + * @brief Return the member of the open ID. **/ function getMemberSrlByOpenID($openid) { $oModuleModel = &getModel('module'); diff --git a/modules/member/member.view.php b/modules/member/member.view.php index 4b9cf74f3..fc7a986c3 100644 --- a/modules/member/member.view.php +++ b/modules/member/member.view.php @@ -2,20 +2,20 @@ /** * @class memberView * @author NHN (developers@xpressengine.com) - * @brief member module의 View class + * @brief View class of member module **/ class memberView extends member { - var $group_list = NULL; ///< 그룹 목록 정보 - var $member_info = NULL; ///< 선택된 사용자의 정보 + var $group_list = NULL; // /< Group list information + var $member_info = NULL; // /< Member information of the user var $skin = 'default'; /** - * @brief 초기화 + * @brief Initialization **/ function init() { - // 회원 관리 정보를 받음 + // Get the member configuration $oModuleModel = &getModel('module'); $this->member_config = $oModuleModel->getModuleConfig('member'); if(!$this->member_config->skin) $this->member_config->skin = "default"; @@ -23,21 +23,19 @@ Context::set('member_config', $this->member_config); $skin = $this->member_config->skin; - - // template path 지정 + // Set the template path $tpl_path = sprintf('%sskins/%s', $this->module_path, $skin); if(!is_dir($tpl_path)) $tpl_path = sprintf('%sskins/%s', $this->module_path, 'default'); $this->setTemplatePath($tpl_path); } /** - * @brief 회원 정보 출력 + * @brief Display member information **/ function dispMemberInfo() { $oMemberModel = &getModel('member'); $logged_info = Context::get('logged_info'); - - // 비회원일 경우 정보 열람 중지 + // Don't display member info to non-logged user if(!$logged_info->member_srl) return $this->stop('msg_not_permitted'); $member_srl = Context::get('member_srl'); @@ -65,38 +63,33 @@ } /** - * @brief 회원 가입 폼 출력 + * @brief Display member join form **/ function dispMemberSignUpForm() { $oMemberModel = &getModel('member'); - - // 로그인한 회원일 경우 해당 회원의 정보를 받음 + // Get the member information if logged-in if($oMemberModel->isLogged()) return $this->stop('msg_already_logged'); - - // before 트리거 호출 + // call a trigger (before) $trigger_output = ModuleHandler::triggerCall('member.dispMemberSignUpForm', 'before', $this->member_config); if(!$trigger_output->toBool()) return $trigger_output; - - // 회원가입을 중지시켰을 때는 에러 표시 + // Error appears if the member is not allowed to join if($this->member_config->enable_join != 'Y') return $this->stop('msg_signup_disabled'); Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info)); $member_config = $oMemberModel->getMemberConfig(); Context::set('member_config', $member_config); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('signup_form'); } /** - * @brief 회원 정보 수정 + * @brief Modify member information **/ function dispMemberModifyInfo() { $oMemberModel = &getModel('member'); $oModuleModel = &getModel('module'); $memberModuleConfig = $oModuleModel->getModuleConfig('member'); - - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); @@ -105,13 +98,11 @@ $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); $member_info->signature = $oMemberModel->getSignature($member_srl); Context::set('member_info',$member_info); - - // 추가 가입폼 목록을 받음 + // Get a list of extend join form Context::set('extend_form_list', $oMemberModel->getCombineJoinForm($member_info)); Context::set('openids', $oMemberModel->getMemberOpenIDByMemberSrl($member_srl)); - - // 에디터 모듈의 getEditor를 호출하여 서명용으로 세팅 + // Editor of the module set for signing by calling getEditor if($member_info->member_srl) { $oEditorModel = &getModel('editor'); $option->primary_key_name = 'member_srl'; @@ -128,19 +119,17 @@ $editor = $oEditorModel->getEditor($member_info->member_srl, $option); Context::set('editor', $editor); } - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('modify_info'); } /** - * @brief 회원 작성글 보기 + * @brief Display documents written by the member **/ function dispMemberOwnDocument() { $oMemberModel = &getModel('member'); - - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); @@ -159,12 +148,11 @@ } /** - * @brief 회원 스크랩 게시물 보기 + * @brief Display documents scrapped by the member **/ function dispMemberScrappedDocument() { $oMemberModel = &getModel('member'); - - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); @@ -182,15 +170,13 @@ } /** - * @brief 회원의 저장함 보기 + * @brief Display documents saved by the member **/ function dispMemberSavedDocument() { $oMemberModel = &getModel('member'); - - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); - - // 저장함에 보관된 글을 가져옴 (저장함은 module_srl이 member_srl로 세팅되어 있음) + // Get the saved document(module_srl is set to member_srl instead) $logged_info = Context::get('logged_info'); $args->module_srl = $logged_info->member_srl; $args->page = (int)Context::get('page'); @@ -207,7 +193,7 @@ } /** - * @brief 로그인 폼 출력 + * @brief Display the login form **/ function dispMemberLoginForm() { if(Context::get('is_logged')) { @@ -216,19 +202,17 @@ $this->setTemplateFile('redirect.html'); return; } - - // 템플릿 파일 지정 + // Set a template file Context::set('referer_url', $_SERVER['HTTP_REFERER']); $this->setTemplateFile('login_form'); } /** - * @brief 회원 비밀번호 수정 + * @brief Change the user password **/ function dispMemberModifyPassword() { $oMemberModel = &getModel('member'); - - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); @@ -236,18 +220,16 @@ $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); Context::set('member_info',$member_info); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('modify_password'); } /** - * @brief 탈퇴 화면 + * @brief Member withdrawl **/ function dispMemberLeave() { $oMemberModel = &getModel('member'); - - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); @@ -255,18 +237,16 @@ $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); Context::set('member_info',$member_info); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('leave_form'); } /** - * @brief 오픈 아이디 탈퇴 화면 + * @brief OpenID member withdrawl **/ function dispMemberOpenIDLeave() { $oMemberModel = &getModel('member'); - - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); $logged_info = Context::get('logged_info'); @@ -274,13 +254,12 @@ $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl); Context::set('member_info',$member_info); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('openid_leave_form'); } /** - * @brief 로그아웃 출력 + * @brief Member log-out **/ function dispMemberLogout() { $oMemberController = &getController('member'); @@ -292,17 +271,15 @@ } /** - * @brief 저장된 글 목록을 보여줌 + * @brief Display a list of saved articles **/ function dispSavedDocumentList() { $this->setLayoutFile('popup_layout'); $oMemberModel = &getModel('member'); - - // 로그인 되어 있지 않을 경우 로그인 되어 있지 않다는 메세지 출력 + // A message appears if the user is not logged-in if(!$oMemberModel->isLogged()) return $this->stop('msg_not_logged'); - - // 저장함에 보관된 글을 가져옴 (저장함은 module_srl이 member_srl로 세팅되어 있음) + // Get the saved document (module_srl is set to member_srl instead) $logged_info = Context::get('logged_info'); $args->module_srl = $logged_info->member_srl; $args->page = (int)Context::get('page'); @@ -320,7 +297,7 @@ } /** - * @brief 아이디/ 비밀번호 찾기 기능 + * @brief Find user ID and password **/ function dispMemberFindAccount() { if(Context::get('is_logged')) return $this->stop('already_logged'); @@ -329,7 +306,7 @@ } /** - * @brief 임시 비밀번호 발급 + * @brief Generate a temporary password **/ function dispMemberGetTempPassword() { if(Context::get('is_logged')) return $this->stop('already_logged'); @@ -346,7 +323,7 @@ } /** - * @brief 인증 메일 재발송 페이지 + * @brief Page of re-sending an authentication mail **/ function dispMemberResendAuthMail() { if(Context::get('is_logged')) return $this->stop('already_logged'); diff --git a/modules/menu/menu.admin.controller.php b/modules/menu/menu.admin.controller.php index 7645dfb51..b22dc059e 100644 --- a/modules/menu/menu.admin.controller.php +++ b/modules/menu/menu.admin.controller.php @@ -2,22 +2,22 @@ /** * @class menuAdminController * @author NHN (developers@xpressengine.com) - * @brief menu 모듈의 admin controller class + * @brief admin controller class of the menu module **/ class menuAdminController extends menu { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 메뉴 추가 + * @brief Add a menu **/ function procMenuAdminInsert() { - // 입력할 변수 정리 + // List variables $site_module_info = Context::get('site_module_info'); $args->site_srl = (int)$site_module_info->site_srl; $args->title = Context::get('title'); @@ -32,10 +32,10 @@ } /** - * @brief 메뉴 제목 변경 + * @brief Change the menu title **/ function procMenuAdminUpdate() { - // 입력할 변수 정리 + // List variables $args->title = Context::get('title'); $args->menu_srl = Context::get('menu_srl'); @@ -46,8 +46,8 @@ } /** - * @brief 메뉴 삭제 - * menu_item과 xml 캐시 파일 모두 삭제 + * @brief Delete menu + * Delete menu_item and xml cache files **/ function procMenuAdminDelete() { $menu_srl = Context::get('menu_srl'); @@ -55,7 +55,7 @@ } function deleteMenu($menu_srl) { - // 캐시 파일 삭제 + // Delete cache files $cache_list = FileHandler::readDir("./files/cache/menu","",false,true); if(count($cache_list)) { foreach($cache_list as $cache_file) { @@ -63,18 +63,15 @@ if($pos>0)FileHandler::removeFile($cache_file); } } - - // 이미지 버튼 모두 삭제 + // Delete images of menu buttons $image_path = sprintf('./files/attach/menu_button/%s', $menu_srl); FileHandler::removeDir($image_path); $args->menu_srl = $menu_srl; - - // 메뉴 메뉴 삭제 + // Delete menu items $output = executeQuery("menu.deleteMenuItems", $args); if(!$output->toBool()) return $output; - - // 메뉴 삭제 + // Delete the menu $output = executeQuery("menu.deleteMenu", $args); if(!$output->toBool()) return $output; @@ -82,10 +79,10 @@ } /** - * @brief 메뉴에 아이템 추가 + * @brief Add an item to the menu **/ function procMenuAdminInsertItem() { - // 입력할 변수 정리 + // List variables to insert $source_args = Context::getRequestVars(); unset($source_args->module); unset($source_args->act); @@ -93,8 +90,7 @@ if($source_args->menu_expand !="Y") $source_args->menu_expand = "N"; $source_args->group_srls = str_replace('|@|',',',$source_args->group_srls); $source_args->parent_srl = (int)$source_args->parent_srl; - - // 변수를 다시 정리 (form문의 column과 DB column이 달라서) + // Re-order variables (Column's order is different between form and DB) $args->menu_srl = $source_args->menu_srl; $args->menu_item_srl = $source_args->menu_item_srl; $args->parent_srl = $source_args->parent_srl; @@ -108,46 +104,37 @@ $args->hover_btn = $source_args->hover_btn; $args->active_btn = $source_args->active_btn; $args->group_srls = $source_args->group_srls; - - // 이미 존재하는지를 확인 + // Check if already exists $oMenuModel = &getAdminModel('menu'); $item_info = $oMenuModel->getMenuItemInfo($args->menu_item_srl); - - // 존재하게 되면 update를 해준다 + // Update if exists if($item_info->menu_item_srl == $args->menu_item_srl) { $output = executeQuery('menu.updateMenuItem', $args); if(!$output->toBool()) return $output; - - // 존재하지 않으면 insert를 해준다 + // Insert if not exist } else { $args->listorder = -1*$args->menu_item_srl; $output = executeQuery('menu.insertMenuItem', $args); if(!$output->toBool()) return $output; } - - // 해당 메뉴의 정보를 구함 + // Get information of the menu $menu_info = $oMenuModel->getMenu($args->menu_srl); $menu_title = $menu_info->title; - - // XML 파일을 갱신하고 위치을 넘겨 받음 + // Update the xml file and get its location $xml_file = $this->makeXmlFile($args->menu_srl); - - // url이 mid일 경우 기록 남김 + // If a new menu item that mid is URL is added, the current layout is applied if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $args->url)) { $mid = $args->url; $mid_args->menu_srl = $args->menu_srl; $mid_args->mid = $mid; - - // menu_srl에 해당하는 레이아웃 값을 구함 + // Get layout value of menu_srl $output = executeQuery('menu.getMenuLayout', $args); - - // 해당 모듈에 레이아웃 값이 정해져 있지 않으면 지정 + // Set if layout value is not specified in the module $oModuleModel = &getModel('module'); $module_info = $oModuleModel->getModuleInfoByMid($mid); if(!$module_info->layout_srl&&$output->data->layout_srl) $mid_args->layout_srl = $output->data->layout_srl; - - // 해당 mid의 메뉴값을 선택된 메뉴로 변경 + // Change menu value of the mid to the menu $oModuleController = &getController('module'); $oModuleController->updateModuleMenu($mid_args); } @@ -160,35 +147,29 @@ } /** - * @brief 메뉴 메뉴 삭제 + * @brief Delete menu item(menu of the menu) **/ function procMenuAdminDeleteItem() { - // 변수 정리 + // List variables $args = Context::gets('menu_srl','menu_item_srl'); $oMenuAdminModel = &getAdminModel('menu'); - - // 원정보를 가져옴 + // Get original information $item_info = $oMenuAdminModel->getMenuItemInfo($args->menu_item_srl); if($item_info->parent_srl) $parent_srl = $item_info->parent_srl; - - // 자식 노드가 있는지 체크하여 있으면 삭제 못한다는 에러 출력 + // Display an error that the category cannot be deleted if it has a child node $output = executeQuery('menu.getChildMenuCount', $args); if(!$output->toBool()) return $output; if($output->data->count>0) return new Object(-1, 'msg_cannot_delete_for_child'); - - // DB에서 삭제 + // Remove from the DB $output = executeQuery("menu.deleteMenuItem", $args); if(!$output->toBool()) return $output; - - // 해당 메뉴의 정보를 구함 + // Get information of the menu $menu_info = $oMenuAdminModel->getMenu($args->menu_srl); $menu_title = $menu_info->title; - - // XML 파일을 갱신하고 위치을 넘겨 받음 + // Update the xml file and get its location $xml_file = $this->makeXmlFile($args->menu_srl); - - // 이미지 버튼 모두 삭제 + // Delete all of image buttons if($item_info->normal_btn) FileHandler::removeFile($item_info->normal_btn); if($item_info->hover_btn) FileHandler::removeFile($item_info->hover_btn); if($item_info->active_btn) FileHandler::removeFile($item_info->active_btn); @@ -200,7 +181,7 @@ } /** - * @brief 메뉴의 메뉴를 이동 + * @brief Move menu items **/ function procMenuAdminMoveItem() { $menu_srl = Context::get('menu_srl'); @@ -214,13 +195,12 @@ } function moveMenuItem($menu_srl,$parent_srl,$source_srl,$target_srl,$mode){ - // 원본 메뉴들을 구함 + // Get the original menus $oMenuAdminModel = &getAdminModel('menu'); $target_item = $oMenuAdminModel->getMenuItemInfo($target_srl); if($target_item->menu_item_srl != $target_srl) return new Object(-1,'msg_invalid_request'); - - // 위치 이동 (순서 조절) + // Move the menu location(change the order menu appears) if($mode == 'move') { $args->parent_srl = $parent_srl; $args->menu_srl = $menu_srl; @@ -243,7 +223,7 @@ $args->menu_item_srl = $target_srl; $output = executeQuery('menu.updateMenuItemNode', $args); if(!$output->toBool()) return $output; - // 자식으로 추가 + // Add a child } elseif($mode == 'insert') { $args->menu_item_srl = $target_srl; $args->parent_srl = $parent_srl; @@ -257,42 +237,37 @@ } /** - * @brief xml 파일을 갱신 - * 관리자페이지에서 메뉴 구성 후 간혹 xml파일이 재생성 안되는 경우가 있는데\n - * 이럴 경우 관리자의 수동 갱신 기능을 구현해줌\n - * 개발 중간의 문제인 것 같고 현재는 문제가 생기지 않으나 굳이 없앨 필요 없는 기능 + * @brief Update xml file + * XML file is not often generated after setting menus on the admin page\n + * For this occasional cases, manually update was implemented. \n + * It looks unnecessary at this moment however no need to eliminate the feature. Just leave it. **/ function procMenuAdminMakeXmlFile() { - // 입력값을 체크 + // Check input value $menu_srl = Context::get('menu_srl'); - - // 해당 메뉴의 정보를 구함 + // Get information of the menu $oMenuAdminModel = &getAdminModel('menu'); $menu_info = $oMenuAdminModel->getMenu($menu_srl); $menu_title = $menu_info->title; - - // xml파일 재생성 + // Re-generate the xml file $xml_file = $this->makeXmlFile($menu_srl); - - // return 값 설정 + // Set return value $this->add('menu_title',$menu_title); $this->add('xml_file',$xml_file); } /** - * @brief 메뉴 이미지 버튼을 등록 + * @brief Register a menu image button **/ function procMenuAdminUploadButton() { $menu_srl = Context::get('menu_srl'); $menu_item_srl = Context::get('menu_item_srl'); $target = Context::get('target'); $target_file = Context::get($target); - - // 필수 요건이 없거나 업로드된 파일이 아니면 오류 발생 + // Error occurs when the target is neither a uploaded file nor a valid file if(!$menu_srl || !$menu_item_srl || !$target_file || !is_uploaded_file($target_file['tmp_name']) || !preg_match('/\.(gif|jpeg|jpg|png)/i',$target_file['name'])) { Context::set('error_messge', Context::getLang('msg_invalid_request')); - - // 요건을 만족하고 업로드된 파일이면 지정된 위치로 이동 + // Move the file to a specific director if the uploaded file meets requirement } else { $tmp_arr = explode('.',$target_file['name']); $ext = $tmp_arr[count($tmp_arr)-1]; @@ -312,7 +287,7 @@ } /** - * @brief 등록된 메뉴 이미지 제거 + * @brief Remove the menu image button **/ function procMenuAdminDeleteButton() { $menu_srl = Context::get('menu_srl'); @@ -325,13 +300,12 @@ } /** - * @brief 메뉴의 xml 파일을 만들고 위치를 return + * @brief Generate XML file for menu and return its location **/ function makeXmlFile($menu_srl) { - // xml파일 생성시 필요한 정보가 없으면 그냥 return + // Return if there is no information when creating the xml file if(!$menu_srl) return; - - // 메뉴 정보를 구함 + // Get menu informaton $args->menu_srl = $menu_srl; $output = executeQuery('menu.getMenu', $args); if(!$output->toBool() || !$output->data) return $output; @@ -342,18 +316,15 @@ $site_info = $oModuleModel->getSiteInfo($site_srl); $domain = $site_info->domain; } - - // DB에서 menu_srl에 해당하는 메뉴 아이템 목록을 listorder순으로 구해옴 + // Get a list of menu items corresponding to menu_srl by listorder $args->menu_srl = $menu_srl; $args->sort_index = 'listorder'; $output = executeQuery('menu.getMenuItems', $args); if(!$output->toBool()) return; - - // 캐시 파일의 이름을 지정 + // Specify the name of the cache file $xml_file = sprintf("./files/cache/menu/%s.xml.php", $menu_srl); $php_file = sprintf("./files/cache/menu/%s.php", $menu_srl); - - // 구해온 데이터가 없다면 노드데이터가 없는 xml 파일만 생성 + // If no data found, generate an XML file without node data $list = $output->data; if(!$list) { $xml_buff = ""; @@ -361,11 +332,9 @@ FileHandler::writeFile($php_file, ''); return $xml_file; } - - // 구해온 데이터가 하나라면 array로 바꾸어줌 + // Change to an array if only a single data is obtained if(!is_array($list)) $list = array($list); - - // 루프를 돌면서 tree 구성 + // Create a tree for loop $list_count = count($list); for($i=0;$i<$list_count;$i++) { $node = $list[$i]; @@ -374,8 +343,7 @@ $tree[$parent_srl][$menu_item_srl] = $node; } - - // 캐시 파일의 권한과 그룹 설정을 위한 공통 헤더 + // A common header to set permissions of the cache file and groups $header_script = '$lang_type = Context::getLangType(); '. '$is_logged = Context::get(\'is_logged\'); '. @@ -397,8 +365,7 @@ '$is_admin = false; '. '$group_srsl = array(); '. '} '; - - // xml 캐시 파일 생성 (xml캐시는 따로 동작하기에 session 지정을 해주어야 함) + // Create the xml cache file (a separate session is needed for xml cache) $xml_buff = sprintf( 'getXmlTree($tree[0], $tree, $site_srl, $domain) ); - - // php 캐시 파일 생성 + // Create php cache file $php_output = $this->getPhpCacheCode($tree[0], $tree, $site_srl, $domain); $php_buff = sprintf( ' $node) { $child_buff = ""; - - // 자식 노드의 데이터 가져옴 + // Get data of the child nodes if($menu_item_srl&&$tree[$menu_item_srl]) $child_buff = $this->getXmlTree($tree[$menu_item_srl], $tree, $site_srl, $domain); - - // 변수 정리 + // List variables $names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl); foreach($names as $key => $val) { $name_arr_str .= sprintf('"%s"=>"%s",',$key, str_replace('\\','\\\\',htmlspecialchars($val))); @@ -492,8 +455,7 @@ } else { $link = ''; } - - // node->group_srls값이 있으면 + // If the value of node->group_srls exists if($group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$group_srls); else $group_check_code = "true"; $attribute = sprintf( @@ -522,10 +484,10 @@ } /** - * @brief array로 정렬된 노드들을 php code로 변경하여 return - * 메뉴에서 메뉴를 tpl에 사용시 xml데이터를 사용할 수도 있지만 별도의 javascript 사용이 필요하기에 - * php로 된 캐시파일을 만들어서 db이용없이 바로 메뉴 정보를 구할 수 있도록 한다 - * 이 캐시는 ModuleHandler::displayContent() 에서 include하여 Context::set() 한다 + * @brief Return php code converted from nodes in an array + * Although xml data can be used for tpl, menu to menu, it needs to use javascript separately + * By creating cache file in php and then you can get menu information without DB + * This cache includes in ModuleHandler::displayContent() and then Context::set() **/ function getPhpCacheCode($source_node, $tree, $site_srl, $domain) { $output = array("buff"=>"", "url_list"=>array()); @@ -534,26 +496,22 @@ $oMenuAdminModel = &getAdminModel('menu'); foreach($source_node as $menu_item_srl => $node) { - // 자식 노드가 있으면 자식 노드의 데이터를 먼저 얻어옴 + // Get data from child nodes if exist. if($menu_item_srl&&$tree[$menu_item_srl]) $child_output = $this->getPhpCacheCode($tree[$menu_item_srl], $tree, $site_srl, $domain); else $child_output = array("buff"=>"", "url_list"=>array()); - - // 변수 정리 + // List variables $names = $oMenuAdminModel->getMenuItemNames($node->name, $site_srl); foreach($names as $key => $val) { $name_arr_str .= sprintf('"%s"=>"%s",',$key, str_replace(array('\\','"'),array('\\\\','"'),$val)); } $name_str = sprintf('$_menu_names[%d] = array(%s); %s', $node->menu_item_srl, $name_arr_str, $child_output['name']); - - // 현재 노드의 url값이 공란이 아니라면 url_list 배열값에 입력 + // If url value is not empty in the current node, put the value into an array url_list if($node->url) $child_output['url_list'][] = $node->url; $output['url_list'] = array_merge($output['url_list'], $child_output['url_list']); - - // node->group_srls값이 있으면 + // If node->group_srls value exists if($node->group_srls) $group_check_code = sprintf('($is_admin==true||(is_array($group_srls)&&count(array_intersect($group_srls, array(%s)))))',$node->group_srls); else $group_check_code = "true"; - - // 변수 정리 + // List variables $href = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->href); $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url); if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url)) { @@ -594,8 +552,7 @@ } else { $link_active = $link = sprintf('$_menu_names[%d][$lang_type]', $node->menu_item_srl); } - - // 속성을 생성한다 ( url_list를 이용해서 선택된 메뉴의 노드에 속하는지를 검사한다. 꽁수지만 빠르고 강력하다고 생각;;) + // Create properties (check if it belongs to the menu node by url_list. It looks a trick but fast and powerful) $attribute = sprintf( '"node_srl"=>"%s","parent_srl"=>"%s","text"=>(%s?$_menu_names[%d][$lang_type]:""),"href"=>(%s?"%s":""),"url"=>(%s?"%s":""),"open_window"=>"%s","normal_btn"=>"%s","hover_btn"=>"%s","active_btn"=>"%s","selected"=>(array(%s)&&in_array(Context::get("mid"),array(%s))?1:0),"expand"=>"%s", "list"=>array(%s), "link"=>(%s? ( array(%s)&&in_array(Context::get("mid"),array(%s)) ?%s:%s):""),', $node->menu_item_srl, @@ -620,8 +577,7 @@ $link_active, $link ); - - // buff 데이터를 생성한다 + // Generate buff data $output['buff'] .= sprintf('%s=>array(%s),', $node->menu_item_srl, $attribute); $output['name'] .= $name_str; } @@ -629,20 +585,18 @@ } /** - * @brief 메뉴와 레이아웃 매핑 - * 레이아웃에서 메뉴를 지정할때 지정된 메뉴의 기본 레이아웃을 매핑 + * @brief Mapping menu and layout + * When setting menu on the layout, map the default layout **/ function updateMenuLayout($layout_srl, $menu_srl_list) { if(!count($menu_srl_list)) return; - - // 일단 menu_srls의 값을 지움 + // Delete the value of menu_srls $args->menu_srls = implode(',',$menu_srl_list); $output = executeQuery('menu.deleteMenuLayout', $args); if(!$output->toBool()) return $output; $args->layout_srl = $layout_srl; - - // menu_srls, layout_srl 매핑 + // Mapping menu_srls, layout_srl for($i=0;$imenu_srl = $menu_srl_list[$i]; $output = executeQuery('menu.insertMenuLayout', $args); diff --git a/modules/menu/menu.admin.model.php b/modules/menu/menu.admin.model.php index c65dc3937..6f999cdfd 100644 --- a/modules/menu/menu.admin.model.php +++ b/modules/menu/menu.admin.model.php @@ -3,19 +3,19 @@ * @class menuAdminModel * @author NHN (developers@xpressengine.com) * @version 0.1 - * @brief menu 모듈의 admin model class + * @brief admin model class of the menu module **/ class menuAdminModel extends menu { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 전체 메뉴 목록을 구해옴 + * @brief Get a list of all menus **/ function getMenuList($obj) { if(!$obj->site_srl) { @@ -27,25 +27,23 @@ $args->page = $obj->page?$obj->page:1; $args->list_count = $obj->list_count?$obj->list_count:20; $args->page_count = $obj->page_count?$obj->page_count:10; - - // document.getDocumentList 쿼리 실행 + // document.getDocumentList query execution $output = executeQuery('menu.getMenuList', $args); - - // 결과가 없거나 오류 발생시 그냥 return + // Return if no result or an error occurs if(!$output->toBool()||!count($output->data)) return $output; return $output; } /** - * @brief 등록된 모든 메뉴를 return + * @brief Return all menus **/ function getMenus($site_srl = null) { if(!isset($site_srl)) { $site_module_info = Context::get('site_module_info'); $site_srl = (int)$site_module_info->site_srl; } - // 일단 DB에서 정보를 가져옴 + // Get information from the DB $args->site_srl = $site_srl ; $args->menu_srl = $menu_srl; $output = executeQuery('menu.getMenus', $args); @@ -56,11 +54,11 @@ } /** - * @brief DB 에 생성된 한개의 메뉴 정보를 구함 - * 생성된 메뉴의 DB정보+XML정보를 return + * @brief Get information of a new menu from the DB + * Return DB and XML information of the menu **/ function getMenu($menu_srl) { - // 일단 DB에서 정보를 가져옴 + // Get information from the DB $args->menu_srl = $menu_srl; $output = executeQuery('menu.getMenu', $args); if(!$output->data) return; @@ -72,11 +70,11 @@ } /** - * @brief 특정 menu_srl의 아이템 정보를 return - * 이 정보중에 group_srls의 경우는 , 로 연결되어 들어가며 사용시에는 explode를 통해 array로 변환 시킴 + * @brief Return item information of the menu_srl + * group_srls uses a seperator with comma(,) and converts to an array by explode **/ function getMenuItemInfo($menu_item_srl) { - // menu_item_srl이 있으면 해당 메뉴의 정보를 가져온다 + // Get the menu information if menu_item_srl exists $args->menu_item_srl = $menu_item_srl; $output = executeQuery('menu.getMenuItem', $args); $node = $output->data; @@ -94,56 +92,49 @@ } /** - * @brief 다국어 지원을 위해 menu의 name을 언어별로 나눠서 return + * @brief Return menu name in each language to support multi-language */ function getMenuItemNames($source_name, $site_srl = null) { if(!$site_srl) { $site_module_info = Context::get('site_module_info'); $site_srl = (int)$site_module_info->site_srl; } - - // 언어코드 구함 + // Get language code $oModuleAdminModel = &getAdminModel('module'); return $oModuleAdminModel->getLangCode($site_srl, $source_name); } /** - * @brief 특정 menu_srl의 정보를 이용하여 템플릿을 구한후 return - * 관리자 페이지에서 특정 메뉴의 정보를 추가하기 위해 서버에서 tpl을 컴파일 한후 컴파일 된 html을 직접 return + * @brief Get a template by using the menu_srl and retrun. + * Return html after compiling tpl on the server in order to add menu information on the admin page **/ function getMenuAdminTplInfo() { - // 해당 메뉴의 정보를 가져오기 위한 변수 설정 + // Get information on the menu for the parameter settings $menu_item_srl = Context::get('menu_item_srl'); $parent_srl = Context::get('parent_srl'); - - // 회원 그룹의 목록을 가져옴 + // Get a list of member groups $oMemberModel = &getModel('member'); $group_list = $oMemberModel->getGroups(); Context::set('group_list', $group_list); - - // parent_srl이 있고 menu_item_srl이 없으면 하부 메뉴 추가임 + // Add a sub-menu if there is parent_srl but not menu_item_srl if(!$menu_item_srl && $parent_srl) { - // 상위 메뉴의 정보를 가져옴 + // Get information of the parent menu $parent_info = $this->getMenuItemInfo($parent_srl); - - // 추가하려는 메뉴의 기본 변수 설정 + // Default parameter settings for a new menu $item_info->menu_item_srl = getNextSequence(); $item_info->parent_srl = $parent_srl; $item_info->parent_menu_name = $parent_info->name; - - // root에 메뉴 추가하거나 기존 메뉴의 수정일 경우 + // In case of modifying the existing menu or addting a new menu to the root } else { - // menu_item_srl 이 있으면 해당 메뉴의 정보를 가져온다 + // Get information of the menu if menu_item_srl exists if($menu_item_srl) $item_info = $this->getMenuItemInfo($menu_item_srl); - - // 찾아진 값이 없다면 신규 메뉴 추가로 보고 menu_item_srl값만 구해줌 + // Get only menu_item_srl if no values found, considering it as adding a new menu if(!$item_info->menu_item_srl) { $item_info->menu_item_srl = getNextSequence(); } } Context::set('item_info', $item_info); - - // template 파일을 직접 컴파일한후 tpl변수에 담아서 return한다. + // Compile the template file into tpl variable and then return it $oTemplate = &TemplateHandler::getInstance(); $tpl = $oTemplate->compile($this->module_path.'tpl', 'menu_item_info'); diff --git a/modules/menu/menu.admin.view.php b/modules/menu/menu.admin.view.php index 23435a494..11e7d3f7c 100644 --- a/modules/menu/menu.admin.view.php +++ b/modules/menu/menu.admin.view.php @@ -2,23 +2,23 @@ /** * @class menuAdminView * @author NHN (developers@xpressengine.com) - * @brief menu 모듈의 admin view class + * @brief admin view class of the menu module **/ class menuAdminView extends menu { /** - * @brief 초기화 + * @brief Initialization **/ function init() { $this->setTemplatePath($this->module_path.'tpl'); } /** - * @brief 메뉴 관리의 첫 페이지 + * @brief The first page of the menu admin **/ function dispMenuAdminContent() { - // 등록된 메뉴 목록을 구해옴 + // Get a list of registered menus $obj->page = Context::get('page'); $obj->sort_index = 'listorder'; $obj->list_count = 20; @@ -37,14 +37,14 @@ } /** - * @brief 메뉴 등록 페이지 + * @brief Page to insert a menu **/ function dispMenuAdminInsert() { - // 선택된 메뉴의 정보르 구해서 세팅 + // Set the menu with menu information $menu_srl = Context::get('menu_srl'); if($menu_srl) { - // 메뉴의 정보를 가져옴 + // Get information of the menu $oMenuModel = &getAdminModel('menu'); $menu_info = $oMenuModel->getMenu($menu_srl); if($menu_info->menu_srl == $menu_srl) Context::set('menu_info', $menu_info); @@ -54,50 +54,43 @@ } /** - * @brief 메뉴 관리 페이지 + * @brief Menu admin page **/ function dispMenuAdminManagement() { - // 선택된 메뉴의 정보르 구해서 세팅 + // Get information of the menu $menu_srl = Context::get('menu_srl'); if(!$menu_srl) return $this->dispMenuAdminContent(); - - // 메뉴의 정보를 가져옴 + // Get information of the menu $oMenuModel = &getAdminModel('menu'); $menu_info = $oMenuModel->getMenu($menu_srl); if($menu_info->menu_srl != $menu_srl) return $this->dispMenuAdminContent(); Context::set('menu_info', $menu_info); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setTemplateFile('menu_management'); } /** - * @brief 메뉴에서 선택할 수 있는 mid목록을 보여줌 + * @brief Display a mid list to be able to select on the menu **/ function dispMenuAdminMidList() { $oModuleModel = &getModel('module'); - - // 모듈 카테고리 목록을 구함 + // Get a list of module categories $module_category = $oModuleModel->getModuleCategories(); Context::set('module_category', $module_category); - - // 모듈 목록을 구함 + // Get a list of modules $module_list = $oModuleModel->getModuleList(); Context::set('module_list', $module_list); - - // mid 목록을 구해옴 + // Get a list of mid $args->module_category_srl = Context::get('module_category_srl'); $args->module = Context::get('target_module'); $mid_list = $oModuleModel->getMidList($args); Context::set('mid_list', $mid_list); - - // 메뉴을 팝업으로 지정 + // Set the menu as a pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('mid_list'); } } diff --git a/modules/menu/menu.class.php b/modules/menu/menu.class.php index f16fccce9..3e3bb6310 100644 --- a/modules/menu/menu.class.php +++ b/modules/menu/menu.class.php @@ -2,40 +2,38 @@ /** * @class menu * @author NHN (developers@xpressengine.com) - * @brief menu 모듈의 high class + * @brief high class of the menu module **/ class menu extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // 메뉴 사용할 디렉토리 생성 + // Create a directory to use menu FileHandler::makeDir('./files/cache/menu'); return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { $oDB = &DB::getInstance(); - - // 2009. 02. 11 menu 테이블에 site_srl 추가 + // 2009. 02. 11 menu added to the table site_srl if(!$oDB->isColumnExists('menu', 'site_srl')) return true; return false; } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { $oDB = &DB::getInstance(); - - // 2009. 02. 11 menu 테이블에 site_srl 추가 + // 2009. 02. 11 menu added to the table site_srl if(!$oDB->isColumnExists('menu', 'site_srl')) { $oDB->addColumn('menu','site_srl','number',11,0,true); } @@ -44,20 +42,18 @@ } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { - // 메뉴 모듈의 캐시 파일 모두 삭제 + // Delete all cache files in the menu module FileHandler::removeFilesInDir("./files/cache/menu"); $oMenuAdminController = &getAdminController('menu'); - - // 블로그 모듈 목록을 모두 구함 + // Wanted list of all the blog module $output = executeQueryArray("menu.getMenus"); $list = $output->data; if(!count($list)) return; - - // 메뉴 모듈에서 사용되는 모든 메뉴 목록을 재 생성 + // The menu module is used in the re-create all the menu list foreach($list as $menu_item) { $menu_srl = $menu_item->menu_srl; $oMenuAdminController->makeXmlFile($menu_srl); diff --git a/modules/message/message.admin.controller.php b/modules/message/message.admin.controller.php index 2c28995c4..6d59b1706 100644 --- a/modules/message/message.admin.controller.php +++ b/modules/message/message.admin.controller.php @@ -2,25 +2,24 @@ /** * @class messageAdminController * @author NHN (developers@xpressengine.com) - * @brief message module의 admin controller class + * @brief admin controller class of message module **/ class messageAdminController extends message { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 설정 + * @brief Configuration **/ function procMessageAdminInsertConfig() { - // 기본 정보를 받음 + // Get information $args->skin = Context::get('skin'); - - // module Controller 객체 생성하여 입력 + // Create a module Controller object $oModuleController = &getController('module'); $output = $oModuleController->insertModuleConfig('message',$args); if(!$output->toBool()) return $output; diff --git a/modules/message/message.admin.view.php b/modules/message/message.admin.view.php index a8f4855b9..4797e8699 100644 --- a/modules/message/message.admin.view.php +++ b/modules/message/message.admin.view.php @@ -2,31 +2,29 @@ /** * @class messageAdminView * @author NHN (developers@xpressengine.com) - * @brief message모듈의 admin view class + * @brief admin view class of the message module **/ class messageAdminView extends message { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 설정 + * @brief Configuration **/ function dispMessageAdminConfig() { - // 스킨 목록을 구해옴 + // Get a list of skins(themes) $oModuleModel = &getModel('module'); $skin_list = $oModuleModel->getskins($this->module_path); Context::set('skin_list', $skin_list); - - // 설정 정보를 받아옴 (module model 객체를 이용) + // Get configurations (using module model object) $config = $oModuleModel->getModuleConfig('message'); Context::set('config',$config); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplatePath($this->module_path.'tpl'); $this->setTemplateFile('config'); } diff --git a/modules/message/message.class.php b/modules/message/message.class.php index a3dcbcb9c..748f61962 100644 --- a/modules/message/message.class.php +++ b/modules/message/message.class.php @@ -2,34 +2,34 @@ /** * @class message * @author NHN (developers@xpressengine.com) - * @brief message모듈의 high class + * @brief high class of message module **/ class message extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { return false; } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { return new Object(); } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { } diff --git a/modules/message/message.mobile.php b/modules/message/message.mobile.php index 458b091b2..08180b96d 100644 --- a/modules/message/message.mobile.php +++ b/modules/message/message.mobile.php @@ -4,29 +4,26 @@ class messageMobile extends messageView { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 메세지 출력 + * @brief Message output **/ function dispMessage() { - // 설정 정보를 받아옴 (module model 객체를 이용) + // Get configurations (using module model object) $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('message'); if(!$config->skin) $config->skin = 'default'; - - // 템플릿 경로를 지정 + // Set the template path $template_path = sprintf('%sm.skins/%s', $this->module_path, $config->skin); - - // 회원 관리 정보를 받음 + // Get the member configuration $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); Context::set('member_config', $member_config); - - // ssl 사용시 현재 https접속상태인지에 대한 flag및 https url 생성 + // Set a flag to check if the https connection is made when using SSL and create https url $ssl_mode = false; if($member_config->enable_ssl == 'Y') { if(preg_match('/^https:\/\//i',Context::getRequestUri())) $ssl_mode = true; diff --git a/modules/message/message.view.php b/modules/message/message.view.php index 0f5250923..9251c1fb7 100644 --- a/modules/message/message.view.php +++ b/modules/message/message.view.php @@ -2,35 +2,32 @@ /** * @class messageView * @author NHN (developers@xpressengine.com) - * @brief message모듈의 view class + * @brief view class of the message module **/ class messageView extends message { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 메세지 출력 + * @brief Display messages **/ function dispMessage() { - // 설정 정보를 받아옴 (module model 객체를 이용) + // Get configurations (using module model object) $oModuleModel = &getModel('module'); $config = $oModuleModel->getModuleConfig('message'); if(!$config->skin) $config->skin = 'default'; - - // 템플릿 경로를 지정 + // Template path $template_path = sprintf('%sskins/%s', $this->module_path, $config->skin); - - // 회원 관리 정보를 받음 + // Get the member configuration $oModuleModel = &getModel('module'); $member_config = $oModuleModel->getModuleConfig('member'); Context::set('member_config', $member_config); - - // ssl 사용시 현재 https접속상태인지에 대한 flag및 https url 생성 + // Set a flag to check if the https connection is made when using SSL and create https url $ssl_mode = false; if($member_config->enable_ssl == 'Y') { if(preg_match('/^https:\/\//i',Context::getRequestUri())) $ssl_mode = true; diff --git a/modules/module/module.admin.controller.php b/modules/module/module.admin.controller.php index a4eadaa7a..ab47fd954 100644 --- a/modules/module/module.admin.controller.php +++ b/modules/module/module.admin.controller.php @@ -2,19 +2,19 @@ /** * @class moduleAdminController * @author NHN (developers@xpressengine.com) - * @brief module 모듈의 admin controller class + * @brief admin controller class of the module module **/ class moduleAdminController extends module { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 모듈 카테고리 추가 + * @brief Add the module category **/ function procModuleAdminInsertCategory() { $args->title = Context::get('title'); @@ -25,7 +25,7 @@ } /** - * @brief 카테고리의 내용 수정 + * @brief Update category **/ function procModuleAdminUpdateCategory() { $mode = Context::get('mode'); @@ -46,7 +46,7 @@ } /** - * @brief 모듈 카테고리의 제목 변경 + * @brief Change the title of the module category **/ function doUpdateModuleCategory() { $args->title = Context::get('title'); @@ -55,7 +55,7 @@ } /** - * @brief 모듈 카테고리 삭제 + * @brief Delete the module category **/ function doDeleteModuleCategory() { $args->module_category_srl = Context::get('module_category_srl'); @@ -63,14 +63,13 @@ } /** - * @brief 모듈 복사 + * @brief Copy Module **/ function procModuleAdminCopyModule() { - // 복사하려는 대상 모듈의 정보를 구함 + // Get information of the target module to copy $module_srl = Context::get('module_srl'); if(!$module_srl) return; - - // 새로 생성하려는 모듈들의 이름/브라우저 제목을 구함 + // Get module name to create and browser title $clones = array(); $args = Context::getAll(); for($i=1;$i<=10;$i++) { @@ -86,11 +85,9 @@ $oModuleModel = &getModel('module'); $oModuleController = &getController('module'); - - // 모듈 정보 가져옴 + // Get module information $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); - - // 권한 정보 가져옴 + // Get permission information $module_args->module_srl = $module_srl; $output = executeQueryArray('module.getModuleGrants', $module_args); $grant = array(); @@ -101,8 +98,7 @@ $oDB = &DB::getInstance(); $oDB->begin(); - - // 모듈 복사 + // Copy a module foreach($clones as $mid => $browser_title) { $clone_args = null; $clone_args = clone($module_info); @@ -111,12 +107,10 @@ $clone_args->mid = $mid; $clone_args->browser_title = $browser_title; $clone_args->is_default = 'N'; - - // 모듈 생성 + // Create a module $output = $oModuleController->insertModule($clone_args); $module_srl = $output->get('module_srl'); - - // 권한 정보 등록 + // Grant module permissions if(count($grant)) $oModuleController->insertModuleGrants($module_srl, $grant); } @@ -125,20 +119,17 @@ } /** - * @brief 모듈 권한 저장 + * @brief Save the module permissions **/ function procModuleAdminInsertGrant() { $oModuleController = &getController('module'); $oModuleModel = &getModel('module'); - - // 모듈 번호 구함 + // Get module_srl $module_srl = Context::get('module_srl'); - - // 해당 모듈의 정보를 구함 + // Get information of the module $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); if(!$module_info) return new Object(-1,'msg_invalid_request'); - - // 관리자 아이디 등록 + // Register Admin ID $oModuleController->deleteAdminId($module_srl); $admin_member = Context::get('admin_member'); if($admin_member) { @@ -150,8 +141,7 @@ } } - - // 권한 정리 + // List permissions $xml_info = $oModuleModel->getModuleActionXML($module_info->module); $grant_list = $xml_info->grant; @@ -160,15 +150,13 @@ $grant_list->manager->default = 'manager'; foreach($grant_list as $grant_name => $grant_info) { - // default값을 구함 + // Get the default value $default = Context::get($grant_name.'_default'); - - // -1 = 로그인 사용자만, -2 = 사이트 가입자만, 0 = 모든 사용자 + // -1 = Log-in user only, -2 = site members only, 0 = all users if(strlen($default)){ $grant->{$grant_name}[] = $default; continue; - - // 특정 그룹 사용자 + // users in a particular group } else { $group_srls = Context::get($grant_name); if($group_srls) { @@ -182,12 +170,11 @@ $grant->{$group_srls} = array(); } - // DB에 저장 + // Stored in the DB $args->module_srl = $module_srl; $output = executeQuery('module.deleteModuleGrants', $args); if(!$output->toBool()) return $output; - - // DB에 권한 저장 + // Permissions stored in the DB foreach($grant as $grant_name => $group_srls) { foreach($group_srls as $key => $val) { $args = null; @@ -202,84 +189,74 @@ } /** - * @brief 스킨 정보 업데이트 + * @brief Updating Skins **/ function procModuleAdminUpdateSkinInfo() { - // module_srl에 해당하는 정보들을 가져오기 + // Get information of the module_srl $module_srl = Context::get('module_srl'); $oModuleModel = &getModel('module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); if($module_info->module_srl) { $skin = $module_info->skin; - - // 스킨의 정보를 구해옴 (extra_vars를 체크하기 위해서) + // Get skin information (to check extra_vars) $module_path = './modules/'.$module_info->module; $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); $skin_vars = $oModuleModel->getModuleSkinVars($module_srl); - // 입력받은 변수들을 체크 (mo, act, module_srl, page등 기본적인 변수들 없앰) + // Check received variables (unset such variables as act, module_srl, page, mid, module) $obj = Context::getRequestVars(); unset($obj->act); unset($obj->module_srl); unset($obj->page); unset($obj->mid); unset($obj->module); - - // 원 skin_info에서 extra_vars의 type이 image일 경우 별도 처리를 해줌 + // Separately handle if a type of extra_vars is an image in the original skin_info if($skin_info->extra_vars) { foreach($skin_info->extra_vars as $vars) { if($vars->type!='image') continue; $image_obj = $obj->{$vars->name}; - - // 삭제 요청에 대한 변수를 구함 + // Get a variable to delete $del_var = $obj->{"del_".$vars->name}; unset($obj->{"del_".$vars->name}); if($del_var == 'Y') { FileHandler::removeFile($skin_vars[$vars->name]->value); continue; } - - // 업로드 되지 않았다면 이전 데이터를 그대로 사용 + // Use the previous data if not uploaded if(!$image_obj['tmp_name']) { $obj->{$vars->name} = $skin_vars[$vars->name]->value; continue; } - - // 정상적으로 업로드된 파일이 아니면 무시 + // Ignore if the file is not successfully uploaded if(!is_uploaded_file($image_obj['tmp_name'])) { unset($obj->{$vars->name}); continue; } - - // 이미지 파일이 아니어도 무시 + // Ignore if the file is not an image if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { unset($obj->{$vars->name}); continue; } - - // 경로를 정해서 업로드 + // Upload the file to a path $path = sprintf("./files/attach/images/%s/", $module_srl); - - // 디렉토리 생성 + // Create a directory if(!FileHandler::makeDir($path)) return false; $filename = $path.$image_obj['name']; - - // 파일 이동 + // Move the file if(!move_uploaded_file($image_obj['tmp_name'], $filename)) { unset($obj->{$vars->name}); continue; } - - // 정상 파일 업로드 + // Upload the file FileHandler::removeFile($skin_vars[$vars->name]->value); - // 변수를 바꿈 + // Change a variable unset($obj->{$vars->name}); $obj->{$vars->name} = $filename; } } - // 해당 모듈의 전체 스킨 불러와서 이미지는 제거 + // Load the entire skin of the module and then remove the image /* if($skin_info->extra_vars) { foreach($skin_info->extra_vars as $vars) { @@ -291,8 +268,7 @@ */ $oModuleController = &getController('module'); $oModuleController->deleteModuleSkinVars($module_srl); - - // 등록 + // Register $oModuleController->insertModuleSkinVars($module_srl, $obj); } @@ -303,7 +279,7 @@ } /** - * @brief 모듈 일괄 정리 + * @brief List module information **/ function procModuleAdminModuleSetup() { $vars = Context::getRequestVars(); @@ -330,7 +306,7 @@ } /** - * @brief 모듈 권한 일괄 정리 + * @brief List permissions of the module **/ function procModuleAdminModuleGrantSetup() { $module_srls = Context::get('module_srls'); @@ -350,15 +326,13 @@ $grant_list->manager->default = 'manager'; foreach($grant_list as $grant_name => $grant_info) { - // default값을 구함 + // Get the default value $default = Context::get($grant_name.'_default'); - - // -1 = 로그인 사용자만, 0 = 모든 사용자 + // -1 = Sign only, 0 = all users if(strlen($default)){ $grant->{$grant_name}[] = $default; continue; - - // 특정 그룹 사용자 + // Users in a particular group } else { $group_srls = Context::get($grant_name); if($group_srls) { @@ -373,14 +347,13 @@ } - // DB에 저장 + // Stored in the DB foreach($modules as $module_srl) { $args = null; $args->module_srl = $module_srl; $output = executeQuery('module.deleteModuleGrants', $args); if(!$output->toBool()) continue; - - // DB에 권한 저장 + // Permissions stored in the DB foreach($grant as $grant_name => $group_srls) { foreach($group_srls as $key => $val) { $args = null; @@ -396,24 +369,21 @@ } /** - * @brief 언어 추가/ 업데이트 + * @brief Add/Update language **/ function procModuleAdminInsertLang() { - // 언어코드명 가져옴 + // Get language code $site_module_info = Context::get('site_module_info'); $args->site_srl = (int)$site_module_info->site_srl; $args->name = str_replace(' ','_',Context::get('lang_code')); if(!$args->name) return new Object(-1,'msg_invalid_request'); - - // 언어코드가 있는지 조사 + // Check whether a language code exists $output = executeQueryArray('module.getLang', $args); if(!$output->toBool()) return $output; - - // 있으면 업데이트를 위해 기존 값들을 지움 + // If exists, clear the old values for updating if($output->data) $output = executeQuery('module.deleteLang', $args); if(!$output->toBool()) return $output; - - // 입력 + // Enter $lang_supported = Context::get('lang_supported'); foreach($lang_supported as $key => $val) { $args->lang_code = $key; @@ -431,10 +401,10 @@ } /** - * @brief 언어 제거 + * @brief Remove language **/ function procModuleAdminDeleteLang() { - // 언어코드명 가져옴 + // Get language code $site_module_info = Context::get('site_module_info'); $args->site_srl = (int)$site_module_info->site_srl; $args->name = str_replace(' ','_',Context::get('name')); @@ -446,10 +416,10 @@ } /** - * @brief 사용자 정이 언어코드 파일 저장 + * @brief Save the file of user-defined language code **/ function makeCacheDefinedLangCode($site_srl = 0) { - // 현재 사이트의 언어파일 가져오기 + // Get the language file of the current site if(!$site_srl) { $site_module_info = Context::get('site_module_info'); $args->site_srl = (int)$site_module_info->site_srl; @@ -458,8 +428,7 @@ } $output = executeQueryArray('module.getLang', $args); if(!$output->toBool() || !$output->data) return; - - // 캐시 디렉토리 설정 + // Set the cache directory $cache_path = _XE_PATH_.'files/cache/lang_defined/'; if(!is_dir($cache_path)) FileHandler::makeDir($cache_path); diff --git a/modules/module/module.admin.model.php b/modules/module/module.admin.model.php index 12faafa23..ff92fa690 100644 --- a/modules/module/module.admin.model.php +++ b/modules/module/module.admin.model.php @@ -3,20 +3,20 @@ * @class moduleAdminModel * @author NHN (developers@xpressengine.com) * @version 0.1 - * @brief module 모듈의 AdminModel class + * @brief AdminModel class of the "module" module **/ class moduleAdminModel extends module { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief module_srl (,콤마로 연결된)로 대상 모듈들의 목록을 return) - * 모듈 선택기(ModuleSelector)에서 사용됨 + * @brief Return a list of target modules by using module_srls separated by comma(,) + * Used in the ModuleSelector **/ function getModuleAdminModuleList() { $args->module_srls = Context::get('module_srls'); @@ -47,15 +47,14 @@ } /** - * @brief 공통 :: 모듈의 모듈 권한 출력 페이지 - * 모듈의 모듈 권한 출력은 모든 모듈에서 module instance를 이용할때 사용할 수 있음 + * @brief Common:: module's permission displaying page in the module + * Available when using module instance in all the modules **/ function getModuleGrantHTML($module_srl, $source_grant_list) { $oModuleModel = &getModel('module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); - - // access, manager 권한은 가상 권한으로 설정 + // Grant virtual permission for access and manager $grant_list->access->title = Context::getLang('grant_access'); $grant_list->access->default = 'guest'; if(count($source_grant_list)) { @@ -68,8 +67,7 @@ $grant_list->manager->title = Context::getLang('grant_manager'); $grant_list->manager->default = 'manager'; Context::set('grant_list', $grant_list); - - // 현재 모듈에 설정된 권한 그룹을 가져옴 + // Get a permission group granted to the current module $default_grant = array(); $args->module_srl = $module_srl; $output = executeQueryArray('module.getModuleGrants', $args); @@ -87,22 +85,20 @@ Context::set('selected_group', $selected_group); Context::set('default_grant', $default_grant); Context::set('module_srl', $module_srl); - // 현재 모듈에 설정된 관리자 아이디를 추출 + // Extract admin ID set in the current module $admin_member = $oModuleModel->getAdminId($module_srl); Context::set('admin_member', $admin_member); - - // 그룹을 가져옴 + // Get a list of groups $oMemberModel = &getModel('member'); $group_list = $oMemberModel->getGroups($module_info->site_srl); Context::set('group_list', $group_list); - - // grant 정보를 추출 + // Get information of module_grants $oTemplate = &TemplateHandler::getInstance(); return $oTemplate->compile($this->module_path.'tpl', 'module_grants'); } /** - * @brief 공통 :: 모듈의 스킨 설정 출력 페이지 + * @brief Common:: skin setting page for the module **/ function getModuleSkinHTML($module_srl) { $oModuleModel = &getModel('module'); @@ -111,11 +107,9 @@ $skin = $module_info->skin; $module_path = './modules/'.$module_info->module; - - // 스킨의 XML 정보를 구함 + // Get XML information of the skin $skin_info = $oModuleModel->loadSkinInfo($module_path, $skin); - - // DB에 설정된 스킨 정보를 구함 + // Get skin information set in DB $skin_vars = $oModuleModel->getModuleSkinVars($module_srl); if(count($skin_info->extra_vars)) { @@ -141,8 +135,8 @@ } /** - * @brief 특정 언어 코드에 대한 값들을 가져오기 - * lang_code를 직접 기입하면 해당 언어코드에 대해서만 가져오고 값이 없으면 $name을 그대로 return + * @brief Get values for a particular language code + * Return its corresponding value if lang_code is specified. Otherwise return $name. **/ function getLangCode($site_srl, $name) { $lang_supported = Context::get('lang_supported'); @@ -176,7 +170,7 @@ } /** - * @brief 모듈 언어를 ajax로 요청시 return + * @brief Return if the module language in ajax is requested **/ function getModuleAdminLangCode() { $name = Context::get('name'); diff --git a/modules/module/module.admin.view.php b/modules/module/module.admin.view.php index c4445c659..9b58c582a 100644 --- a/modules/module/module.admin.view.php +++ b/modules/module/module.admin.view.php @@ -2,103 +2,93 @@ /** * @class moduleAdminView * @author NHN (developers@xpressengine.com) - * @brief module 모듈의 admin view class + * @brief admin view class of the module module **/ class moduleAdminView extends module { /** - * @brief 초기화 + * @brief Initialization **/ function init() { - // template path 지정 + // Set the template path $this->setTemplatePath($this->module_path.'tpl'); } /** - * @brief 모듈 관리자 페이지 + * @brief Module admin page **/ function dispModuleAdminContent() { $this->dispModuleAdminList(); } /** - * @brief 모듈 목록 출력 + * @brief Display a lost of modules **/ function dispModuleAdminList() { - // 모듈 목록을 구해서 + // Obtain a list of modules $oModuleModel = &getModel('module'); $module_list = $oModuleModel->getModuleList(); Context::set('module_list', $module_list); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('module_list'); } /** - * @brief 모듈의 상세 정보(conf/info.xml)를 팝업 출력 + * @brief Pop-up details of the module (conf/info.xml) **/ function dispModuleAdminInfo() { - // 모듈 목록을 구해서 + // Obtain a list of modules $oModuleModel = &getModel('module'); $module_info = $oModuleModel->getModuleInfoXml(Context::get('selected_module')); Context::set('module_info', $module_info); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('module_info'); } /** - * @brief 모듈 카테고리 목록 + * @brief Module Categories **/ function dispModuleAdminCategory() { $module_category_srl = Context::get('module_category_srl'); - // 모듈 목록을 구해서 + // Obtain a list of modules $oModuleModel = &getModel('module'); - - // 선택된 카테고리가 있으면 해당 카테고리의 정보 수정 페이지로 + // Display the category page if a category is selected if($module_category_srl) { $selected_category = $oModuleModel->getModuleCategory($module_category_srl); Context::set('selected_category', $selected_category); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('category_update_form'); - - // 아니면 전체 목록 + // If not selected, display a list of categories } else { $category_list = $oModuleModel->getModuleCategories(); Context::set('category_list', $category_list); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('category_list'); } } /** - * @brief 모듈 복사 기능 + * @brief Feature to copy module **/ function dispModuleAdminCopyModule() { - // 복사하려는 대상 모듈을 구함 + // Get a target module to copy $module_srl = Context::get('module_srl'); - - // 해당 모듈의 정보를 구함 + // Get information of the module $oModuleModel = &getModel('module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); Context::set('module_info', $module_info); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('copy_module'); } /** - * @brief 모듈 기본 설정 일괄 적용 + * @brief Applying the default settings to all modules **/ function dispModuleAdminModuleSetup() { $module_srls = Context::get('module_srls'); @@ -108,54 +98,45 @@ $oModuleModel = &getModel('module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0]); - - // 모듈의 스킨 목록을 구함 + // Get a skin list of the module $skin_list = $oModuleModel->getSkins('./modules/'.$module_info->module); Context::set('skin_list',$skin_list); - - // 레이아웃 목록을 구해옴 + // Get a layout list $oLayoutMode = &getModel('layout'); $layout_list = $oLayoutMode->getLayoutList(); Context::set('layout_list', $layout_list); - - // 모듈 카테고리 목록을 구함 + // Get a list of module categories $module_category = $oModuleModel->getModuleCategories(); Context::set('module_category', $module_category); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('module_setup'); } /** - * @brief 모듈 추가 설정 일괄 적용 + * @brief Apply module addition settings to all modules **/ function dispModuleAdminModuleAdditionSetup() { $module_srls = Context::get('module_srls'); $modules = explode(',',$module_srls); if(!count($modules)) if(!$module_srls) return new Object(-1,'msg_invalid_request'); - - // content는 다른 모듈에서 call by reference로 받아오기에 미리 변수 선언만 해 놓음 + // pre-define variables because you can get contents from other module (call by reference) $content = ''; - - // 추가 설정을 위한 트리거 호출 - // 게시판 모듈이지만 차후 다른 모듈에서의 사용도 고려하여 trigger 이름을 공용으로 사용할 수 있도록 하였음 + // Call a trigger for additional settings + // Considering uses in the other modules, trigger name cen be publicly used $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'before', $content); $output = ModuleHandler::triggerCall('module.dispAdditionSetup', 'after', $content); Context::set('setup_content', $content); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('module_addition_setup'); } /** - * @brief 모듈 권한 설정 일괄 적용 + * @brief Applying module permission settings to all modules **/ function dispModuleAdminModuleGrantSetup() { $module_srls = Context::get('module_srls'); @@ -167,8 +148,7 @@ $module_info = $oModuleModel->getModuleInfoByModuleSrl($modules[0]); $xml_info = $oModuleModel->getModuleActionXml($module_info->module); $source_grant_list = $xml_info->grant; - - // access, manager 권한은 가상 권한으로 설정 + // Grant virtual permissions for access and manager $grant_list->access->title = Context::getLang('grant_access'); $grant_list->access->default = 'guest'; if(count($source_grant_list)) { @@ -181,42 +161,36 @@ $grant_list->manager->title = Context::getLang('grant_manager'); $grant_list->manager->default = 'manager'; Context::set('grant_list', $grant_list); - - // 그룹을 가져옴 + // Get a list of groups $oMemberModel = &getModel('member'); $group_list = $oMemberModel->getGroups($module_info->site_srl); Context::set('group_list', $group_list); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('module_grant_setup'); } /** - * @brief 언어 코드 + * @brief Language codes **/ function dispModuleAdminLangcode() { - // 현재 사이트의 언어파일 가져오기 + // Get the language file of the current site $site_module_info = Context::get('site_module_info'); $args->site_srl = (int)$site_module_info->site_srl; $args->sort_index = 'name'; $args->order_type = 'asc'; $output = executeQueryArray('module.getLangList', $args); Context::set('lang_list', $output->data); - - // 현재 선택된 언어 가져오기 + // Get the currently selected language $name = Context::get('name'); if($name) { $oModuleAdminModel = &getAdminModel('module'); Context::set('selected_lang', $oModuleAdminModel->getLangCode($args->site_srl,'$user_lang->'.$name)); } - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('module_langcode'); } diff --git a/modules/module/module.class.php b/modules/module/module.class.php index 487e8c100..8c75264b0 100644 --- a/modules/module/module.class.php +++ b/modules/module/module.class.php @@ -2,27 +2,25 @@ /** * @class module * @author NHN (developers@xpressengine.com) - * @brief module 모듈의 high class + * @brief high class of the module module **/ class module extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // action forward에 등록 (관리자 모드에서 사용하기 위함) + // Register action forward (to use in administrator mode) $oModuleController = &getController('module'); $oDB = &DB::getInstance(); $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"), true); $oDB->addIndex('sites','unique_domain',array('domain'),true); - - // module 모듈에서 사용할 디렉토리 생성 + // Create a directory to use in the module module FileHandler::makeDir('./files/cache/module_info'); FileHandler::makeDir('./files/cache/triggers'); - - // sites 테이블에 기본 사이트 정보 입력 + // Insert site information into the sites table $args->site_srl = 0; $output = $oDB->executeQuery('module.getSite', $args); if(!$output->data || !$output->data->index_module_srl) { @@ -43,34 +41,28 @@ } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { $oDB = &DB::getInstance(); - - // 2008. 10. 27 module_part_config 테이블의 결합 인덱스 추가 + // 2008. 10. 27 Add multi-index in the table, the module_part_config if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) return true; - - // 2008. 11. 13 modules 의 mid를 unique를 없애고 site_srl을 추가 후에 site_srl + mid unique index + // 2008. 11. 13 Delete unique constraint on mid in modules. Add site_srl and then create unique index on site_srl and mid if(!$oDB->isIndexExists('modules',"idx_site_mid")) return true; - - // 모든 모듈의 권한/스킨정보를 grants 테이블로 이전시키는 업데이트 + // Move permissions/skin information of all modules to the table, grants. if($oDB->isColumnExists('modules', 'grants')) return true; - - // 모든 모듈의 권한/스킨정보를 grants 테이블로 이전시키는 업데이트 + // Move permissions/skin information of all modules to the table, grants. if(!$oDB->isColumnExists('sites', 'default_language')) return true; - - // extra_vars* 컬럼 제거 + // Delete extra_vars* column for($i=1;$i<=20;$i++) { if($oDB->isColumnExists("documents","extra_vars".$i)) return true; } - - // sites 테이블에 기본 사이트 정보 입력 + // Insert site information to the table, sites $args->site_srl = 0; $output = $oDB->executeQuery('module.getSite', $args); if(!$output->data) return true; - // sites 테이블에서 도메인이 인덱스로 걸린경우 + // If domain index is defined on the table, sites if($oDB->isIndexExists('sites', 'idx_domain')) return true; if(!$oDB->isIndexExists('sites','unique_domain')) return true; @@ -83,12 +75,11 @@ } /** - * @brief 업데이트 실행 + * @brief Execute update **/ function moduleUpdate() { $oDB = &DB::getInstance(); - - // 2008. 10. 27 module_part_config 테이블의 결합 인덱스 추가하고 기존에 module_config에 몰려 있던 모든 정보를 재점검 + // 2008. 10. 27 module_part_config Add a multi-index to the table and check all information of module_configg if(!$oDB->isIndexExists("module_part_config","idx_module_part_config")) { $oModuleModel = &getModel('module'); $oModuleController = &getController('module'); @@ -140,43 +131,35 @@ } $oDB->addIndex("module_part_config","idx_module_part_config", array("module","module_srl")); } - - // 2008. 11. 13 modules 의 mid를 unique를 없애고 site_srl을 추가 후에 site_srl + mid unique index + // 2008. 11. 13 drop index(unique_mid). Add a column and index on site_srl and mid columns if(!$oDB->isIndexExists('modules',"idx_site_mid")) { $oDB->dropIndex("modules","unique_mid",true); $oDB->addColumn('modules','site_srl','number',11,0,true); $oDB->addIndex("modules","idx_site_mid", array("site_srl","mid"),true); } - - // document 확장변수의 확장을 위한 처리 + // document extra vars if(!$oDB->isTableExists('document_extra_vars')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_vars.xml'); if(!$oDB->isTableExists('document_extra_keys')) $oDB->createTableByXmlFile('./modules/document/schemas/document_extra_keys.xml'); - - // 모든 모듈의 권한, 스킨정보, 확장정보, 관리자 아이디를 grants 테이블로 이전시키는 업데이트 + // Move permission, skin info, extection info, admin ID of all modules to the table, grants if($oDB->isColumnExists('modules', 'grants')) { $oModuleController = &getController('module'); $oDocumentController = &getController('document'); - - // 현재 시스템 언어 코드값을 가져옴 + // Get a value of the current system language code $lang_code = Context::getLangType(); - - // 모든 모듈의 module_info를 가져옴 + // Get module_info of all modules $output = executeQueryArray('module.getModuleInfos'); if(count($output->data)) { foreach($output->data as $module_info) { - // 모듈들의 권한/ 확장변수(게시글 확장 포함)/ 스킨 변수/ 최고관리권한 정보 분리 + // Separate information about permission granted to the module, extra vars, skin vars, super-admin's authority $module_srl = trim($module_info->module_srl); - - // 권한 등록 + // grant an authority $grants = unserialize($module_info->grants); if($grants) $oModuleController->insertModuleGrants($module_srl, $grants); - - // 스킨 변수 등록 + // Insert skin vars $skin_vars = unserialize($module_info->skin_vars); if($skin_vars) $oModuleController->insertModuleSkinVars($module_srl, $skin_vars); - - // 최고 관리자 아이디 등록 + // Insert super admin's ID $admin_id = trim($module_info->admin_id); if($admin_id && $admin_id != 'Array') { $admin_ids = explode(',',$admin_id); @@ -186,8 +169,7 @@ } } } - - // 모듈별 추가 설정 저장 (기본 modules에 없던 컬럼 데이터) + // Save extra configurations for each module(column data which doesn't exist in the defaut modules) $extra_vars = unserialize($module_info->extra_vars); $document_extra_keys = null; if($extra_vars->extra_vars && count($extra_vars->extra_vars)) { @@ -197,9 +179,9 @@ if($extra_vars) $oModuleController->insertModuleExtraVars($module_srl, $extra_vars); /** - * 게시글 확장변수 이동 (documents모듈에서 해야 하지만 modules 테이블의 추가 변수들이 정리되기에 여기서 함) + * Move document extra vars(it should have conducted in the documents module however extra vars in modules table should be listed up in this module) **/ - // 플래닛모듈의 경우 직접 추가 변수 입력 + // Insert extra vars if planet module is if($module_info->module == 'planet') { if(!$document_extra_keys || !is_array($document_extra_keys)) $document_extra_keys = array(); $planet_extra_keys->name = 'postscript'; @@ -210,22 +192,19 @@ $planet_extra_keys->desc = ''; $document_extra_keys[20] = $planet_extra_keys; } - - // 게시글 확장변수 키 등록 + // Register keys for document extra vars if(count($document_extra_keys)) { foreach($document_extra_keys as $var_idx => $val) { $oDocumentController->insertDocumentExtraKey($module_srl, $var_idx, $val->name, $val->type, $val->is_required, $val->search, $val->default, $val->desc, 'extra_vars'.$var_idx); } - - // 2009-04-14 #17923809 게시물 100개의 확장 변수만 이전되는 문제점 수정 + // 2009-04-14 Fixed a bug that only 100 extra vars are moved $oDocumentModel = &getModel('document'); $total_count = $oDocumentModel->getDocumentCount($module_srl); if ($total_count > 0) { $per_page = 100; $total_pages = (int) (($total_count - 1) / $per_page) + 1; - - // 확장변수가 존재하면 확장변수 가져오기 + // Get extra vars if exist $doc_args = null; $doc_args->module_srl = $module_srl; $doc_args->list_count = $per_page; @@ -248,8 +227,7 @@ } // for total_pages } // if count } - - // 해당 모듈들의 추가 변수들 제거 + // Additional variables of the module, remove $module_info->grant = null; $module_info->extra_vars = null; $module_info->skin_vars = null; @@ -257,30 +235,26 @@ executeQuery('module.updateModule', $module_info); } } - - // 각종 column drop + // Various column drop $oDB->dropColumn('modules','grants'); $oDB->dropColumn('modules','admin_id'); $oDB->dropColumn('modules','skin_vars'); $oDB->dropColumn('modules','extra_vars'); } - - // 모든 모듈의 권한/스킨정보를 grants 테이블로 이전시키는 업데이트 + // Rights of all modules/skins transferring the information into a table Update grants if(!$oDB->isColumnExists('sites', 'default_language')) { $oDB->addColumn('sites','default_language','varchar',255,0,false); } - - // extra_vars* 컬럼 제거 + // extra_vars * Remove Column for($i=1;$i<=20;$i++) { if(!$oDB->isColumnExists("documents","extra_vars".$i)) continue; $oDB->dropColumn('documents','extra_vars'.$i); } - - // sites 테이블에 기본 사이트 정보 입력 + // Enter the main site information sites on the table $args->site_srl = 0; $output = $oDB->executeQuery('module.getSite', $args); if(!$output->data) { - // 기본 mid, 언어 구함 + // Basic mid, language Wanted $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); $db_info = Context::getDBInfo(); $domain = Context::getDefaultUrl(); @@ -348,19 +322,16 @@ } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { - // 모듈 정보 캐시 파일 모두 삭제 + // Delete all cache files, the module information FileHandler::removeFilesInDir("./files/cache/module_info"); - - // 트리거 정보가 있는 파일 모두 삭제 + // Delete all the files that trigger information FileHandler::removeFilesInDir("./files/cache/triggers"); - - // DB캐시 파일을 모두 삭제 + // DB cache, delete all the files FileHandler::removeFilesInDir("./files/cache/db"); - - // 기타 캐시 삭제 + // Other Cache FileHandler::removeDir("./files/cache/tmp"); } } diff --git a/modules/module/module.controller.php b/modules/module/module.controller.php index 298455ccf..c42dc4f1c 100644 --- a/modules/module/module.controller.php +++ b/modules/module/module.controller.php @@ -2,21 +2,21 @@ /** * @class moduleController * @author NHN (developers@xpressengine.com) - * @brief module 모듈의 controller class + * @brief controller class of the module module **/ class moduleController extends module { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief action forward 추가 - * action foward는 등록된 action이 요청된 모듈에 없을 경우 찾아서 포워딩을 하는 구조이다 - * 모듈의 설치시에 사용된다. + * @brief Add action forward + * Action forward finds and forwards if an action is not in the requested module + * This is used when installing a module **/ function insertActionForward($module, $type, $act) { $args->module = $module; @@ -28,7 +28,7 @@ } /** - * @brief action forward 삭제 + * @brief Delete action forward **/ function deleteActionForward($module, $type, $act) { $args->module = $module; @@ -40,8 +40,8 @@ } /** - * @brief module trigger 추가 - * module trigger는 trigger 대상이 등록된 대상을 호출하는 방법이다. + * @brief Add module trigger + * module trigger is to call a trigger to a target module * **/ function insertTrigger($trigger_name, $module, $type, $called_method, $called_position) { @@ -52,15 +52,14 @@ $args->called_position = $called_position; $output = executeQuery('module.insertTrigger', $args); - - // 트리거 정보가 있는 파일 모두 삭제 + // Delete all the files which contain trigger information FileHandler::removeFilesInDir("./files/cache/triggers"); return $output; } /** - * @brief module trigger 삭제 + * @brief Delete module trigger * **/ function deleteTrigger($trigger_name, $module, $type, $called_method, $called_position) { @@ -71,15 +70,14 @@ $args->called_position = $called_position; $output = executeQuery('module.deleteTrigger', $args); - - // 트리거 캐시 삭제 + // Remove the trigger cache FileHandler::removeFilesInDir('./files/cache/triggers'); return $output; } /** - * @brief module extend 추가 + * @brief Add module extend * **/ function insertModuleExtend($parent_module, $extend_module, $type, $kind=''){ @@ -103,7 +101,7 @@ } /** - * @brief module extend 삭제 + * @brief Delete module extend * **/ function deleteModuleExtend($parent_module, $extend_module, $type, $kind=''){ @@ -121,8 +119,8 @@ } /** - * @brief 특정 모듈의 설정 입력 - * board, member등 특정 모듈의 global config 관리용 + * @brief Enter a specific set of modules + * In order to manage global configurations of modules such as board, member and so on **/ function insertModuleConfig($module, $config) { $args->module = $module; @@ -136,8 +134,8 @@ } /** - * @brief 특정 mid의 모듈 설정 정보 저장 - * mid의 모듈 의존적인 설정을 관리 + * @brief Save module configurations of the mid + * Manage mid configurations depending on module **/ function insertModulePartConfig($module, $module_srl, $config) { $args->module = $module; @@ -152,7 +150,7 @@ } /** - * @brief virtual site 생성 + * @brief create virtual site **/ function insertSite($domain, $index_module_srl) { if(isSiteID($domain)) { @@ -177,7 +175,7 @@ } /** - * @brief virtual site 수정 + * @brief modify virtual site **/ function updateSite($args) { $oModuleModel = &getModel('module'); @@ -197,18 +195,16 @@ } /** - * @brief 모듈 정보 정리 + * @brief Arrange module information **/ function arrangeModuleInfo(&$args, &$extra_vars) { - // 불필요한 내용 제거 + // Remove unnecessary information unset($args->body); unset($args->act); unset($args->page); - - // mid값 검사 + // Test mid value if(!preg_match("/^[a-z][a-z0-9_]+$/i", $args->mid)) return new Object(-1, 'msg_limit_mid'); - - // 변수를 검사 (modules의 기본 변수와 그렇지 않은 변수로 분리) + // Test variables (separate basic vars and other vars in modules) $extra_vars = clone($args); unset($extra_vars->module_srl); unset($extra_vars->module); @@ -235,13 +231,12 @@ } /** - * @brief 모듈 입력 + * @brief Insert module **/ function insertModule($args) { $output = $this->arrangeModuleInfo($args, $extra_vars); if(!$output->toBool()) return $output; - - // 이미 존재하는 모듈 이름인지 체크 + // Check whether the module name already exists if(!$args->site_srl) $args->site_srl = 0; $oModuleModel = &getModel('module'); if($oModuleModel->isIDExists($args->mid, $args->site_srl)) return new Object(-1, 'msg_module_name_exists'); @@ -249,23 +244,19 @@ // begin transaction $oDB = &DB::getInstance(); $oDB->begin(); - - // 선택된 스킨정보에서 colorset을 구함 + // Get colorset from the skin information $module_path = ModuleHandler::getModulePath($args->module); $skin_info = $oModuleModel->loadSkinInfo($module_path, $args->skin); $skin_vars->colorset = $skin_info->colorset[0]->name; - - // 변수 정리후 query 실행 + // Arrange variables and then execute a query if(!$args->module_srl) $args->module_srl = getNextSequence(); - - // 모듈 등록 + // Insert a module $output = executeQuery('module.insertModule', $args); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // 모듈 추가 변수 등록 + // Insert module extra vars $this->insertModuleExtraVars($args->module_srl, $extra_vars); // commit @@ -276,7 +267,7 @@ } /** - * @brief 모듈의 정보를 수정 + * @brief Modify module information **/ function updateModule($args) { $output = $this->arrangeModuleInfo($args, $extra_vars); @@ -303,8 +294,7 @@ $oDB->rollback(); return $output; } - - // 모듈 추가 변수 등록 + // Insert module extra vars $this->insertModuleExtraVars($args->module_srl, $extra_vars); $oDB->commit(); @@ -314,7 +304,7 @@ } /** - * @brief 모듈의 가상사이트 변경 + * @brief Change the module's virtual site **/ function updateModuleSite($module_srl, $site_srl, $layout_srl = 0) { $args->module_srl = $module_srl; @@ -324,14 +314,13 @@ } /** - * @brief 모듈을 삭제 + * @brief Delete module * - * 모듈 삭제시는 관련 정보들을 모두 삭제 시도한다. + * Attempt to delete all related information when deleting a module. **/ function deleteModule($module_srl) { if(!$module_srl) return new Object(-1,'msg_invalid_request'); - - // trigger 호출 (before) + // Call a trigger (before) $trigger_obj->module_srl = $module_srl; $output = ModuleHandler::triggerCall('module.deleteModule', 'before', $trigger_obj); if(!$output->toBool()) return $output; @@ -341,27 +330,21 @@ $oDB->begin(); $args->module_srl = $module_srl; - - // module 정보를 DB에서 삭제 + // Delete module information from the DB $output = executeQuery('module.deleteModule', $args); if(!$output->toBool()) { $oDB->rollback(); return $output; } - - // 권한 정보 삭제 + // Delete permission information $this->deleteModuleGrants($module_srl); - - // 스킨 정보 삭제 + // Remove skin information $this->deleteModuleSkinVars($module_srl); - - // 모듈 추가 변수 삭제 + // Delete module extra vars $this->deleteModuleExtraVars($module_srl); - - // 모듈 관리자 제거 + // Remove the module manager $this->deleteAdminId($module_srl); - - // trigger 호출 (after) + // Call a trigger (after) if($output->toBool()) { $trigger_output = ModuleHandler::triggerCall('module.deleteModule', 'after', $trigger_obj); if(!$trigger_output->toBool()) { @@ -377,10 +360,10 @@ } /** - * @brief 모듈의 기타 정보를 변경 + * @brief Change other information of the module **/ function updateModuleSkinVars($module_srl, $skin_vars) { - // skin_vars 정보 세팅 + // skin_vars setting $args->module_srl = $module_srl; $args->skin_vars = $skin_vars; $output = executeQuery('module.updateModuleSkinVars', $args); @@ -390,7 +373,7 @@ } /** - * @brief 모든 모듈의 is_default값을 N 으로 세팅 (기본 모듈 해제) + * @brief Set is_default as N in all modules(the default module is disabled) **/ function clearDefaultModule() { $output = executeQuery('module.clearDefaultModule'); @@ -400,14 +383,14 @@ } /** - * @brief 지정된 menu_srl에 속한 mid 의 menu_srl 을 변경 + * @brief Update menu_srl of mid which belongs to menu_srl **/ function updateModuleMenu($args) { return executeQuery('module.updateModuleMenu', $args); } /** - * @brief 지정된 menu_srl에 속한 mid 의 layout_srl을 변경 + * @brief Update layout_srl of mid which belongs to menu_srl **/ function updateModuleLayout($layout_srl, $menu_srl_list) { if(!count($menu_srl_list)) return; @@ -419,15 +402,14 @@ } /** - * @brief 사이트의 관리를 변경 + * @brief Change the site administrator **/ function insertSiteAdmin($site_srl, $arr_admins) { - // 사이트 관리자 제거 + // Remove the site administrator $args->site_srl = $site_srl; $output = executeQuery('module.deleteSiteAdmin', $args); if(!$output->toBool()) return $output; - - // 관리자 대상 멤버 번호를 구함 + // Get user id of an administrator if(!is_array($arr_admins) || !count($arr_admins)) return new Object(); foreach($arr_admins as $key => $user_id) { if(!trim($user_id)) continue; @@ -450,7 +432,7 @@ } /** - * @brief 특정 모듈에 관리자 아이디 지정 + * @brief Specify the admin ID to a module **/ function insertAdminId($module_srl, $admin_id) { $oMemberModel = &getModel('member'); @@ -462,7 +444,7 @@ } /** - * @brief 특정 모듈의 관리자 아이디 제거 + * @brief Remove the admin ID from a module **/ function deleteAdminId($module_srl, $admin_id = '') { $args->module_srl = $module_srl; @@ -476,7 +458,7 @@ } /** - * @brief 특정 모듈에 스킨 변수 등록 + * @brief Insert skin vars to a module **/ function insertModuleSkinVars($module_srl, $obj) { $this->deleteModuleSkinVars($module_srl); @@ -484,10 +466,10 @@ $args->module_srl = $module_srl; foreach($obj as $key => $val) { - // #17927989 예전 블로그 모듈을 사용하던 게시판의 경우 - // 스킨 정보 필드에 메뉴 항목(stdClass)을 저장해놓은 경우가 있어 - // 1.2.0 이상 버전으로 업그레이드한 후 모듈 업데이트할 때 - // 오류가 발생하는 문제 수정 + // #17927989 For an old board which used the old blog module + // it often saved menu item(stdClass) on the skin info column + // When updating the module on XE core 1.2.0 later versions, it occurs an error + // fixed the error if (is_object($val)) continue; if (is_array($val)) $val = serialize($val); @@ -499,7 +481,7 @@ } /** - * @brief 특정 모듈의 스킨 변수 제거 + * @brief Remove skin vars of a module **/ function deleteModuleSkinVars($module_srl) { $args->module_srl = $module_srl; @@ -507,7 +489,7 @@ } /** - * @brief 특정 모듈에 확장 변수 등록 + * @brief Register extra vars to the module **/ function insertModuleExtraVars($module_srl, $obj) { $this->deleteModuleExtraVars($module_srl); @@ -524,7 +506,7 @@ } /** - * @brief 특정 모듈의 확장 변수 제거 + * @brief Remove extra vars from the module **/ function deleteModuleExtraVars($module_srl) { $args->module_srl = $module_srl; @@ -532,7 +514,7 @@ } /** - * @brief 특정 모듈에 권한 등록 + * @brief Grant permission to the module **/ function insertModuleGrants($module_srl, $obj) { $this->deleteModuleGrants($module_srl); @@ -554,7 +536,7 @@ } /** - * @brief 특정 모듈의 권한 제거 + * @brief Remove permission from the module **/ function deleteModuleGrants($module_srl) { $args->module_srl = $module_srl; @@ -562,7 +544,7 @@ } /** - * @brief 사용자 정의 언어 변경 + * @brief Change user-defined language **/ function replaceDefinedLangCode(&$output) { $output = preg_replace_callback('!\$user_lang->([a-z0-9\_]+)!is', array($this,'_replaceLangCode'), $output); @@ -586,7 +568,7 @@ /** - * @brief 파일박스에 파일 추가 및 업데이트 + * @brief Add and update a file into the file box **/ function procModuleFileBoxAdd(){ @@ -627,7 +609,7 @@ /** - * @brief 파일박스에 파일 업데이트 + * @brief Update a file into the file box **/ function updateModuleFileBox($vars){ @@ -661,7 +643,7 @@ /** - * @brief 파일박스에 파일 추가 + * @brief Add a file into the file box **/ function insertModuleFileBox($vars){ // set module_filebox_srl @@ -694,7 +676,7 @@ /** - * @brief 파일박스에 파일 삭제 + * @brief Delete a file from the file box **/ function procModuleFileBoxDelete(){ diff --git a/modules/module/module.model.php b/modules/module/module.model.php index 86f47fca0..e2251e4a2 100644 --- a/modules/module/module.model.php +++ b/modules/module/module.model.php @@ -2,37 +2,34 @@ /** * @class moduleModel * @author NHN (developers@xpressengine.com) - * @brief module 모듈의 Model class + * @brief Model class of module module **/ class moduleModel extends module { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief mid, vid 사용할 수 있는지 검사 + * @brief Check if mid, vid are available **/ function isIDExists($id, $site_srl = 0) { if(!preg_match('/^[a-z]{1}([a-z0-9_]+)$/i',$id)) return true; - - // directory 및 rss/atom/api 등 예약어 검사 + // directory and rss/atom/api reserved checking, etc. $dirs = FileHandler::readDir(_XE_PATH_); $dirs[] = 'rss'; $dirs[] = 'atom'; $dirs[] = 'api'; if(in_array($id, $dirs)) return true; - - // mid 검사 + // mid test $args->mid = $id; $args->site_srl = $site_srl; $output = executeQuery('module.isExistsModuleName', $args); if($output->data->count) return true; - - // vid 검사 (site_srl이 0일때 즉 가상사이트가 아닌 경우 mid != vid임을 체크) + // vid test (check mid != vid if site_srl=0, which means it is not a virtual site) if(!$site_srl) { $site_args->domain = $id; $output = executeQuery('module.isExistsSiteDomain', $site_args); @@ -43,7 +40,7 @@ } /** - * @brief site 정보를 구함 + * @brief Get site information **/ function getSiteInfo($site_srl) { $args->site_srl = $site_srl; @@ -58,8 +55,8 @@ } /** - * @brief document_srl로 모듈의 정보르 구함 - * 이 경우는 캐시파일을 이용할 수가 없음 + * @brief Get module information with document_srl + * In this case, it is unable to use the cache file **/ function getModuleInfoByDocumentSrl($document_srl) { $args->document_srl = $document_srl; @@ -68,15 +65,14 @@ } /** - * @brief domain에 따른 기본 mid를 구함 + * @brief Get the defaul mid according to the domain **/ function getDefaultMid() { $default_url = preg_replace('/\/$/','',Context::getDefaultUrl()); $request_url = preg_replace('/\/$/','',Context::getRequestUri()); $vid = Context::get('vid'); $mid = Context::get('mid'); - - // 기본 URL이 설정되어 있고 이 기본 URL과 요청 URL이 다르면 가상 사이트 확인 + // Check a virtual site if the default URL is already set and is is defferent from a requested URL if($default_url && $default_url != $request_url) { $url_info = parse_url($request_url); $hostname = $url_info['host']; @@ -96,20 +92,17 @@ } } } - - // 가상 사이트가 아닐 경우 기본 사이트 정보를 구함 + // If it is not a virtual site, get a default site information if(!$output->data) { $args->site_srl = 0; $output = executeQuery('module.getSiteInfo', $args); - - // 기본 사이트 정보가 없으면 관련된 정보를 갱신 + // Update the related informaion if there is no default site info if(!$output->data) { - // sites 테이블이 없을 경우 생성 + // Create a table if sites table doesn't exist $oDB = &DB::getInstance(); if(!$oDB->isTableExists('sites')) $oDB->createTableByXmlFile(_XE_PATH_.'modules/module/schemas/sites.xml'); if(!$oDB->isTableExists('sites')) return; - - // 기본 mid, 언어 구함 + // Get mid, language $mid_output = $oDB->executeQuery('module.getDefaultMidInfo', $args); $db_info = Context::getDBInfo(); $domain = Context::getDefaultUrl(); @@ -136,7 +129,7 @@ } /** - * @brief mid로 모듈의 정보를 구함 + * @brief Get module information by mid **/ function getModuleInfoByMid($mid, $site_srl = 0) { $args->mid = $mid; @@ -148,10 +141,10 @@ } /** - * @brief module_srl에 해당하는 모듈의 정보를 구함 + * @brief Get module information corresponding to module_srl **/ function getModuleInfoByModuleSrl($module_srl) { - // 데이터를 가져옴 + // Get data $args->module_srl = $module_srl; $output = executeQuery('module.getMidInfo', $args); if(!$output->data) return; @@ -160,10 +153,10 @@ } /** - * @brief layout_srl에 해당하는 모듈의 정보를 구함 + * @brief Get module information corresponding to layout_srl **/ function getModulesInfoByLayout($layout_srl) { - // 데이터를 가져옴 + // Imported data $args->layout_srl = $layout_srl; $output = executeQueryArray('module.getModulesByLayout', $args); @@ -177,7 +170,7 @@ } /** - * @brief 여러개의 module_srl에 해당하는 모듈의 정보를 구함 + * @brief Get module information corresponding to multiple module_srls **/ function getModulesInfo($module_srls) { if(is_array($module_srls)) $module_srls = implode(',',$module_srls); @@ -188,22 +181,20 @@ } /** - * @brief 모듈의 기본 정보에 추가 변수 구함 + * @brief Add extra vars to the module basic information **/ function addModuleExtraVars($module_info) { - // 1개 이상의 모듈정보를 요청받아도 처리 가능하도록 + // Process although one or more module informaion is requested if(!is_array($module_info)) $target_module_info = array($module_info); else $target_module_info = $module_info; - - // 모듈 번호를 구함 + // Get module_srl $module_srls = array(); foreach($target_module_info as $key => $val) { $module_srl = $val->module_srl; if(!$module_srl) continue; $module_srls[] = $val->module_srl; } - - // 모듈의 추가정보/ 스킨 정보를 추출 + // Extract extra information of the module and skin $extra_vars = $this->getModuleExtraVars($module_srls); if(!count($module_srls) || !count($extra_vars)) return $module_info; @@ -219,7 +210,7 @@ } /** - * @brief DB에 생성된 mid 전체 목록을 구해옴 + * @brief Get a complete list of mid, which is created in the DB **/ function getMidList($args = null) { $output = executeQuery('module.getMidList', $args); @@ -237,7 +228,7 @@ } /** - * @brief mid 목록에 대응하는 module_srl을 배열로 return + * @brief Return an array of module_srl corresponding to a mid list **/ function getModuleSrlByMid($mid) { if($mid && !is_array($mid)) $mid = explode(',',$mid); @@ -262,7 +253,7 @@ } /** - * @brief act 값에 의한 forward 값을 구함 + * @brief Get forward value by the value of act **/ function getActionForward($act, $module = "") { $args->act = $act; @@ -273,7 +264,7 @@ } /** - * @brief trigger_name에 등록된 모든 목록을 추출 + * @brief Get a list of all triggers on the trigger_name **/ function getTriggers($trigger_name, $called_position) { $args->trigger_name = $trigger_name; @@ -283,7 +274,7 @@ } /** - * @brief 특정 trigger_name의 특정 대상을 추출 + * @brief Get specific triggers from the trigger_name **/ function getTrigger($trigger_name, $module, $type, $called_method, $called_position) { $args->trigger_name = $trigger_name; @@ -296,7 +287,7 @@ } /** - * @brief 특정 module extend 가져옴 + * @brief Get module extend **/ function getModuleExtend($parent_module, $type, $kind='') { $key = $parent_module.'.'.$kind.'.'.$type; @@ -311,7 +302,7 @@ } /** - * @brief 모든 module extend 가져옴 + * @brief Get all the module extend **/ function loadModuleExtends() { $cache_file = './files/config/module_extend.php'; @@ -347,14 +338,13 @@ } /** - * @brief 모듈의 conf/info.xml 을 읽어서 정보를 구함 + * @brief Get information from conf/info.xml **/ function getModuleInfoXml($module) { - // 요청된 모듈의 경로를 구한다. 없으면 return + // Get a path of the requested module. Return if not exists. $module_path = ModuleHandler::getModulePath($module); if(!$module_path) return; - - // 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음 + // Read the xml file for module skin information $xml_file = sprintf("%s/conf/info.xml", $module_path); if(!file_exists($xml_file)) return; @@ -363,8 +353,7 @@ $xml_obj = $tmp_xml_obj->module; if(!$xml_obj) return; - - // 모듈 정보 + // Module Information if($xml_obj->version && $xml_obj->attrs->version == '0.2') { // module format 0.2 $module_info->title = $xml_obj->title->body; @@ -446,8 +435,7 @@ $author_obj->homepage = $xml_obj->author->attrs->link; $module_info->author[] = $author_obj; } - - // action 정보를 얻어서 admin_index를 추가 + // Add admin_index by using action information $action_info = $this->getModuleActionXml($module); $module_info->admin_index_act = $action_info->admin_index_act; $module_info->default_index_act = $action_info->default_index_act; @@ -457,39 +445,35 @@ } /** - * @brief module의 conf/module.xml 을 통해 grant(권한) 및 action 데이터를 return - * module.xml 파일의 경우 파싱하는데 시간이 걸리기에 캐싱을 한다... - * 캐싱을 할때 바로 include 할 수 있도록 역시 코드까지 추가하여 캐싱을 한다. - * 이게 퍼포먼스 상으로는 좋은데 어떤 부정적인 결과를 유도할지는 잘 모르겠... + * @brief Return permisson and action data by conf/module.xml in the module + * Cache it because it takes too long to parse module.xml file + * When caching, add codes so to include it directly + * This is apparently good for performance, but not sure about its side-effects **/ function getModuleActionXml($module) { - // 요청된 모듈의 경로를 구한다. 없으면 return + // Get a path of the requested module. Return if not exists. $class_path = ModuleHandler::getModulePath($module); if(!$class_path) return; - - // 해당 경로에 module.xml 파일이 있는지 체크한다. 없으면 return + // Check if module.xml exists in the path. Return if not exist $xml_file = sprintf("%sconf/module.xml", $class_path); if(!file_exists($xml_file)) return; - - // 캐시된 파일이 있는지 확인 + // Check if cached file exists $cache_file = sprintf("./files/cache/module_info/%s.%s.php", $module, Context::getLangType()); - - // 캐시 파일이 없거나 캐시 파일이 xml 파일보다 오래되었으면 내용 다시 갱신 + // Update if no cache file exists or it is older than xml file if(!file_exists($cache_file) || filemtime($cache_file)module)) return; ///< xml 내용중에 module 태그가 없다면 오류;; + if(!count($xml_obj->module)) return; // /< Error occurs if module tag doesn't included in the xml - $grants = $xml_obj->module->grants->grant; ///< 권한 정보 (없는 경우도 있음) - $permissions = $xml_obj->module->permissions->permission; ///< 권한 대행 (없는 경우도 있음) - $actions = $xml_obj->module->actions->action; ///< action list (필수) + $grants = $xml_obj->module->grants->grant; // /< Permission information + $permissions = $xml_obj->module->permissions->permission; // /< Acting permission + $actions = $xml_obj->module->actions->action; // /< Action list (required) $default_index = $admin_index = ''; - - // 권한 정보의 정리 + // Arrange permission information if($grants) { if(is_array($grants)) $grant_list = $grants; else $grant_list[] = $grants; @@ -506,8 +490,7 @@ $buff .= sprintf('$info->grant->%s->default=\'%s\';', $name, $default); } } - - // 권한 허용 정리 + // Permissions to grant if($permissions) { if(is_array($permissions)) $permission_list = $permissions; else $permission_list[] = $permissions; @@ -521,8 +504,7 @@ $buff .= sprintf('$info->permission->%s = \'%s\';', $action, $target); } } - - // actions 정리 + // actions if($actions) { if(is_array($actions)) $action_list = $actions; else $action_list[] = $actions; @@ -578,8 +560,8 @@ /** - * @brief 주어진 곳의 스킨 목록을 구함 - * 스킨과 skin.xml 파일을 분석 정리한 결과를 return + * @brief Get a list of skins for the module + * Return file analysis of skin and skin.xml **/ function getSkins($path, $dir = 'skins') { $skin_path = sprintf("%s/%s/", $path, $dir); @@ -600,28 +582,22 @@ } /** - * @brief 특정 위치의 특정 스킨의 정보를 구해옴 + * @brief Get skin information on a specific location **/ function loadSkinInfo($path, $skin, $dir = 'skins') { - - // 모듈의 스킨의 정보 xml 파일을 읽음 + // Read xml file having skin information if(substr($path,-1)!='/') $path .= '/'; $skin_xml_file = sprintf("%s%s/%s/skin.xml", $path, $dir, $skin); if(!file_exists($skin_xml_file)) return; - - // XmlParser 객체 생성 + // Create XmlParser object $oXmlParser = new XmlParser(); $_xml_obj = $oXmlParser->loadXmlFile($skin_xml_file); - - // 스킨 정보가 없으면 return + // Return if no skin information is if(!$_xml_obj->skin) return; $xml_obj = $_xml_obj->skin; - - // 스킨이름 + // Skin Name $skin_info->title = $xml_obj->title->body; - - - // 작성자 정보 + // Author information if($xml_obj->version && $xml_obj->attrs->version == '0.2') { // skin format v0.2 sscanf($xml_obj->date->body, '%d-%d-%d', $date_obj->y, $date_obj->m, $date_obj->d); @@ -642,8 +618,7 @@ $author_obj->homepage = $author->attrs->link; $skin_info->author[] = $author_obj; } - - // 확장변수를 정리 + // List extra vars if($xml_obj->extra_vars) { $extra_var_groups = $xml_obj->extra_vars->group; if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; @@ -666,8 +641,7 @@ $obj->default = $val->attrs->default; if(strpos($obj->value, '|@|') != false) { $obj->value = explode('|@|', $obj->value); } if($obj->type == 'mid_list' && !is_array($obj->value)) { $obj->value = array($obj->value); } - - // 'select'type에서 option목록을 구한다. + // Get an option list from 'select'type if(is_array($val->options)) { $option_count = count($val->options); @@ -743,8 +717,7 @@ $skin_info->author[0]->name = $xml_obj->maker->name->body; $skin_info->author[0]->email_address = $xml_obj->maker->attrs->email_address; $skin_info->author[0]->homepage = $xml_obj->maker->attrs->link; - - // 스킨에서 사용되는 변수들 + // Variables used in the skin $extra_var_groups = $xml_obj->extra_vars->group; if(!$extra_var_groups) $extra_var_groups = $xml_obj->extra_vars; if(!is_array($extra_var_groups)) $extra_var_groups = array($extra_var_groups); @@ -765,8 +738,7 @@ $type = $var->attrs->type; $title = $var->title->body; $description = $var->description->body; - - // 'select'type에서 option목록을 구한다. + // Get an option list from 'select'type. if(is_array($var->default)) { $option_count = count($var->default); @@ -820,8 +792,7 @@ $skin_info->colorset[] = $obj; } } - - // 메뉴 종류 (레이아웃을 위한 설정) + // Menu type (settings for layout) if($xml_obj->menus->menu) { $menus = $xml_obj->menus->menu; if(!is_array($menus)) $menus = array($menus); @@ -844,7 +815,7 @@ } /** - * @brief 특정 가상 사이트에 등록된 특정 모듈의 개수를 return + * @brief Return the number of modules which are registered on a virtual site **/ function getModuleCount($site_srl, $module = null) { $args->site_srl = $site_srl; @@ -854,8 +825,8 @@ } /** - * @brief 특정 모듈의 설정 return - * board, member등 특정 모듈의 global config 관리용 + * @brief Return module configurations + * Global configuration is used to manage board, member and others **/ function getModuleConfig($module) { if(!$GLOBALS['__ModuleConfig__'][$module]) { @@ -868,8 +839,8 @@ } /** - * @brief 특정 mid의 모듈 설정 정보 return - * mid의 모듈 의존적인 설정을 관리 + * @brief Return the module configuration of mid + * Manage mid configurations which depend on module **/ function getModulePartConfig($module, $module_srl) { if(!$GLOBALS['__ModulePartConfig__'][$module][$module_srl]) { @@ -883,7 +854,7 @@ } /** - * @brief mid별 모듈 설정 정보 전체를 구함 + * @brief Get all of module configurations for each mid **/ function getModulePartConfigs($module, $site_srl = 0) { $args->module = $module; @@ -899,10 +870,10 @@ /** - * @brief 모듈 카테고리의 목록을 구함 + * @brief Get a list of module category **/ function getModuleCategories() { - // 데이터를 DB에서 가져옴 + // Get data from the DB $output = executeQuery('module.getModuleCategories'); if(!$output->toBool()) return $output; $list = $output->data; @@ -916,10 +887,10 @@ } /** - * @brief 특정 모듈 카테고리의 내용을 구함 + * @brief Get content from the module category **/ function getModuleCategory($module_category_srl) { - // 데이터를 DB에서 가져옴 + // Get data from the DB $args->module_category_srl = $module_category_srl; $output = executeQuery('module.getModuleCategory', $args); if(!$output->toBool()) return $output; @@ -927,22 +898,21 @@ } /** - * @brief 모듈의 xml 정보만 구함 + * @brief Get xml information of the module **/ function getModulesXmlInfo() { - // 다운받은 모듈과 설치된 모듈의 목록을 구함 + // Get a list of downloaded and installed modules $searched_list = FileHandler::readDir('./modules'); $searched_count = count($searched_list); if(!$searched_count) return; sort($searched_list); for($i=0;$i<$searched_count;$i++) { - // 모듈의 이름 + // Module name $module_name = $searched_list[$i]; $path = ModuleHandler::getModulePath($module_name); - - // 해당 모듈의 정보를 구함 + // Get information of the module $info = $this->getModuleInfoXml($module_name); unset($obj); @@ -966,15 +936,13 @@ { $tmp_files = FileHandler::readDir($moduledir."schemas", '/(\.xml)$/'); $table_count = count($tmp_files); - - // 테이블이 설치되어 있는지 체크 + // Check if the table is created $created_table_count = 0; for($j=0;$jisTableExists($table_name)) $created_table_count ++; } - - // 설치 유무 체크 (설치는 DB의 설치만 관리) + // Check if DB is installed if($table_count > $created_table_count) return true; else return false; } @@ -983,7 +951,7 @@ function checkNeedUpdate($module_name) { - // 각 모듈의 module.class.php로 upgrade 유무 체크 + // Check if it is upgraded to module.class.php on each module $oDummy = &getModule($module_name, 'class'); if($oDummy && method_exists($oDummy, "checkUpdate")) { return $oDummy->checkUpdate(); @@ -992,13 +960,12 @@ } /** - * @brief 모듈의 종류와 정보를 구함 + * @brief Get a type and information of the module **/ function getModuleList() { - // DB 객체 생성 + // Create DB Object $oDB = &DB::getInstance(); - - // 다운받은 모듈과 설치된 모듈의 목록을 구함 + // Get a list of downloaded and installed modules $searched_list = FileHandler::readDir('./modules'); sort($searched_list); @@ -1006,23 +973,20 @@ if(!$searched_count) return; for($i=0;$i<$searched_count;$i++) { - // 모듈의 이름 + // module name $module_name = $searched_list[$i]; $path = ModuleHandler::getModulePath($module_name); - - // schemas내의 테이블 생성 xml파일수를 구함 + // Get the number of xml files to create a table in schemas $tmp_files = FileHandler::readDir($path."schemas", '/(\.xml)$/'); $table_count = count($tmp_files); - - // 테이블이 설치되어 있는지 체크 + // Check if the table is created $created_table_count = 0; for($j=0;$jisTableExists($table_name)) $created_table_count ++; } - - // 해당 모듈의 정보를 구함 + // Get information of the module $info = $this->getModuleInfoXml($module_name); unset($obj); @@ -1032,12 +996,10 @@ $info->table_count = $table_count; $info->path = $path; $info->admin_index_act = $info->admin_index_act; - - // 설치 유무 체크 (설치는 DB의 설치만 관리) + // Check if DB is installed if($table_count > $created_table_count) $info->need_install = true; else $info->need_install = false; - - // 각 모듈의 module.class.php로 upgrade 유무 체크 + // Check if it is upgraded to module.class.php on each module $oDummy = null; $oDummy = &getModule($module_name, 'class'); if($oDummy && method_exists($oDummy, "checkUpdate")) { @@ -1054,9 +1016,9 @@ } /** - * @brief 특정 module srls를 sites의 domain과 결합 - * 아직 XE DBHandler에서 left outer join이 안되어서.. - * $output->data[]->module_srl 과 같은 구조여야 함 + * @brief Combine module_srls with domain of sites + * Because XE DBHandler doesn't support left outer join, + * it should be as same as $Output->data[]->module_srl. **/ function syncModuleToSite(&$data) { if(!$data) return; @@ -1087,7 +1049,7 @@ } /** - * @brief site_module_info의 관리자 인지 체크 + * @brief Check if it is an administrator of site_module_info **/ function isSiteAdmin($member_info, $site_srl = null) { if(!$member_info->member_srl) return false; @@ -1112,7 +1074,7 @@ } /** - * @brief site의 관리자 정보를 구함 + * @brief Get admin information of the site **/ function getSiteAdmin($site_srl) { $args->site_srl = $site_srl; @@ -1121,7 +1083,7 @@ } /** - * @brief 특정 모듈의 관리자 아이디 구함 + * @brief Get admin ID of the module **/ function getAdminId($module_srl) { $obj->module_srl = $module_srl; @@ -1132,8 +1094,8 @@ } /** - * @brief 특정 모듈의 추가 변수를 구함 - * modules 테이블의 기본 정보 이외의 것 + * @brief Get extra vars of the module + * Extra information, not in the modules table **/ function getModuleExtraVars($module_srl) { if(is_array($module_srl)) $module_srl = implode(',',$module_srl); @@ -1150,7 +1112,7 @@ } /** - * @brief 특정 모듈의 스킨 정보를 구함 + * @brief Get skin information of the module **/ function getModuleSkinVars($module_srl) { $args->module_srl = $module_srl; @@ -1163,7 +1125,7 @@ } /** - * @brief 특정 모듈의 스킨 정보를 모듈 정보와 결합 + * @brief Combine skin information with module information **/ function syncSkinInfoToModuleInfo(&$module_info) { if(!$module_info->module_srl) return; @@ -1179,14 +1141,14 @@ } /** - * @brief 특정 모듈정보와 XML, 그리고 회원 정보로 권한을 return + * @brief Return permission by using module info, xml info and member info **/ function getGrant($module_info, $member_info, $xml_info = '') { if(!$xml_info) { $module = $module_info->module; $xml_info = $this->getModuleActionXml($module); } - // 그룹 권한 설정에 필요한 변수를 세팅 + // Set variables to grant group permission $module_srl = $module_info->module_srl; $grant_info = $xml_info->grant; if($member_info->member_srl) { @@ -1195,32 +1157,26 @@ } else { $group_list = array(); } - - // module_srl이 없는 즉 별도의 권한 설정이 안되는 경우 + // If module_srl doesn't exist(if unable to set permissions) if(!$module_srl) { $grant->access = true; if($this->isSiteAdmin($member_info)) $grant->access = $grant->is_admin = $grant->manager = true; else $grant->is_admin = $grant->manager = $member_info->is_admin=='Y'?true:false; - - // module_srl이 있는 경우 + // If module_srl exists } else { - - // grant 종류를 구함 + // Get a type of granted permission $grant->access = $grant->is_admin = $grant->manager = ($member_info->is_admin=='Y'||$this->isSiteAdmin($member_info))?true:false; - - // 관리자가 아니라 로그인 회원일 경우 이 모듈의 관리자인지 확인 + // If a just logged-in member is, check if the member is a module administrator if(!$grant->manager && $member_info->member_srl) { $args->module_srl = $module_srl; $args->member_srl = $member_info->member_srl; $output = executeQuery('module.getModuleAdmin',$args); if($output->data && $output->data->member_srl == $member_info->member_srl) $grant->manager = $grant->is_admin = true; } - - // 관리자가 아니면 직접 DB에서 정보를 구해서 권한 설정 + // If not an administrator, get information from the DB and grant manager privilege. if(!$grant->manager) { $args = null; - - // 플래닛인 경우 planet home의 권한 설정을 가져온다 + // If planet, get permission settings from the planet home if ($module_info->module == 'planet') { $output = executeQueryArray('module.getPlanetGrants', $args); } @@ -1232,35 +1188,32 @@ $grant_exists = $granted = array(); if($output->data) { - // 1차적으로 권한 대상 이름과 그룹을 정리 + // Arrange names and groups who has privileges foreach($output->data as $val) { $grant_exists[$val->name] = true; if($granted[$val->name]) continue; - - // 로그인 회원만 + // Log-in member only if($val->group_srl == -1) { $granted[$val->name] = true; if($member_info->member_srl) $grant->{$val->name} = true; - - // 사이트 가입한 회원만 + // Site-joined member only } elseif($val->group_srl == -2) { $granted[$val->name] = true; - // 비로그인 회원이면 권한 미부여 + // Do not grant any permission for non-logged member if(!$member_info->member_srl) $grant->{$val->name} = false; - // 로그인 회원 + // Log-in member else { $site_module_info = Context::get('site_module_info'); - // 현재 접속된 사이트 정보가 없으면 권한 부여 + // Permission granted if no information of the currently connected site exists if(!$site_module_info->site_srl) $grant->{$val->name} = true; - // 현재 접속된 사이트의 그룹 정보가 있 으면 권한 미부여 + // Permission is not granted if information of the currently connected site exists elseif(count($group_list)) $grant->{$val->name} = true; } - - // 비로그인 회원 모두 + // All of non-logged members } elseif($val->group_srl == 0) { $granted[$val->name] = true; $grant->{$val->name} = true; - // 특정 그룹 대상일 경우 + // If a target is a group } else { if($group_list && count($group_list) && in_array($val->group_srl, $group_list)) { $grant->{$val->name} = true; @@ -1269,8 +1222,7 @@ } } } - - // 가상 그룹인 access에 대해서 별도 처리 + // Separate processing for the virtual group access if(!$grant_exists['access']) $grant->access = true; if(count($grant_info)) { foreach($grant_info as $grant_name => $grant_item) { @@ -1297,8 +1249,7 @@ } } } - - // 관리자일 경우 모든 권한에 대해 true 지정 + // Set true to grant all privileges if an administrator is if($grant->manager) { $grant->access = true; if(count($grant_info)) { diff --git a/modules/module/module.view.php b/modules/module/module.view.php index 16982fcc6..f111814e3 100644 --- a/modules/module/module.view.php +++ b/modules/module/module.view.php @@ -2,27 +2,26 @@ /** * @class moduleView * @author NHN (developers@xpressengine.com) - * @brief module 모듈의 view class + * @brief view class of the module module **/ class moduleView extends module { /** - * @brief 초기화 + * @brief Initialization **/ function init() { - // template path 지정 + // Set the template path $this->setTemplatePath($this->module_path.'tpl'); } /** - * @brief 스킨 정보 출력 + * @brief Display skin information **/ function dispModuleSkinInfo() { $selected_module = Context::get('selected_module'); $skin = Context::get('skin'); - - // 모듈/스킨 정보를 구함 + // Get modules/skin information $module_path = sprintf("./modules/%s/", $selected_module); if(!is_dir($module_path)) $this->stop("msg_invalid_request"); @@ -38,22 +37,19 @@ } /** - * @brief 모듈 선택기 + * @brief Select a module **/ function dispModuleSelectList() { if(!Context::get('is_logged')) return new Object(-1, 'msg_not_permitted'); $oModuleModel = &getModel('module'); - - // virtual site의 개수를 추출 + // Extract the number of virtual sites $output = executeQuery('module.getSiteCount'); $site_count = $output->data->count; Context::set('site_count', $site_count); - - // 사이트 검색어 변수 설정 + // Variable setting for site keyword $site_keyword = Context::get('site_keyword'); - - // 사이트 검색어가 없으면 현재 가상 사이트의 정보를 설정 + // If there is no site keyword, use as information of the current virtual site $args = null; $logged_info = Context::get('logged_info'); if($logged_info->is_admin == 'Y') { @@ -70,7 +66,7 @@ $args->site_srl = 0; $module_category_exists = true; } - // 사이트 검색어가 있으면 해당 사이트(들)의 정보를 추출 + // If site keyword exists, extract information from the sites } else { $args->site_keyword = $site_keyword; } @@ -80,8 +76,7 @@ $args->site_srl = (int)$site_module_info->site_srl; } //if(is_null($args->site_srl)) $query_id = 'module.getDefaultModules'; - - // 지정된 사이트(혹은 전체)의 module 목록을 구함 + // Get a list of modules at the site $output = executeQueryArray($query_id, $args); $category_list = $mid_list = array(); if(count($output->data)) { @@ -110,16 +105,12 @@ Context::set('selected_module', $selected_module); Context::set('selected_mids', $mid_list[$selected_module]->list); Context::set('module_category_exists', $module_category_exists); - - // 레이아웃을 팝업으로 지정 + // Set the layout to be pop-up $this->setLayoutFile('popup_layout'); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('module_selector'); } - - - // 파일 박스 보기 + // See the file box function dispModuleFileBox(){ $logged_info = Context::get('logged_info'); if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); @@ -145,8 +136,7 @@ $this->setLayoutFile('popup_layout'); $this->setTemplateFile('filebox_list'); } - - // 파일 박스 등록화면 + // Screen to add a file box function dispModuleFileBoxAdd(){ $logged_info = Context::get('logged_info'); if($logged_info->is_admin !='Y' && !$logged_info->is_site_admin) return new Object(-1, 'msg_not_permitted'); diff --git a/modules/opage/opage.admin.controller.php b/modules/opage/opage.admin.controller.php index 532c6d032..88ffe1b5e 100644 --- a/modules/opage/opage.admin.controller.php +++ b/modules/opage/opage.admin.controller.php @@ -2,38 +2,35 @@ /** * @class opageAdminController * @author NHN (developers@xpressengine.com) - * @brief opage 모듈의 admin controller class + * @brief admin controller class of the opage module **/ class opageAdminController extends opage { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 외부페이지 추가 + * @brief Add an external page **/ function procOpageAdminInsert() { - // module 모듈의 model/controller 객체 생성 + // Create model/controller object of the module module $oModuleController = &getController('module'); $oModuleModel = &getModel('module'); - - // 게시판 모듈의 정보 설정 + // Set board module $args = Context::getRequestVars(); $args->module = 'opage'; $args->mid = $args->opage_name; unset($args->opage_name); - - // module_srl이 넘어오면 원 모듈이 있는지 확인 + // Check if an original module exists by using module_srl if($args->module_srl) { $module_info = $oModuleModel->getModuleInfoByModuleSrl($args->module_srl); if($module_info->module_srl != $args->module_srl) unset($args->module_srl); } - - // module_srl의 값에 따라 insert/update + // Insert/update depending on module_srl if(!$args->module_srl) { $args->module_srl = getNextSequence(); $output = $oModuleController->insertModule($args); @@ -41,27 +38,24 @@ } else { $output = $oModuleController->updateModule($args); $msg_code = 'success_updated'; - - // 캐시 파일 삭제 + // Delete cache files $cache_file = sprintf("./files/cache/opage/%d.cache.php", $module_info->module_srl); if(file_exists($cache_file)) FileHandler::removeFile($cache_file); } if(!$output->toBool()) return $output; - - // 등록 성공후 return될 메세지 정리 + // Messages to output when successfully registered $this->add("module_srl", $output->get('module_srl')); $this->add("opage", Context::get('opage')); $this->setMessage($msg_code); } /** - * @brief 외부페이지 삭제 + * @brief Delete an external page **/ function procOpageAdminDelete() { $module_srl = Context::get('module_srl'); - - // 원본을 구해온다 + // Get an original $oModuleController = &getController('module'); $output = $oModuleController->deleteModule($module_srl); if(!$output->toBool()) return $output; @@ -72,10 +66,10 @@ } /** - * @brief 외부페이지 기본 정보의 추가 + * @brief Add information of an external page **/ function procOpageAdminInsertConfig() { - // 기본 정보를 받음 + // Get the basic info $args = Context::gets('test'); } diff --git a/modules/opage/opage.admin.view.php b/modules/opage/opage.admin.view.php index b4e5bd8c3..d6d559017 100644 --- a/modules/opage/opage.admin.view.php +++ b/modules/opage/opage.admin.view.php @@ -2,7 +2,7 @@ /** * @class opageAdminView * @author NHN (developers@xpressengine.com) - * @brief opage 모듈의 admin view 클래스 + * @brief admin view clas of the opage module **/ class opageAdminView extends opage { @@ -12,25 +12,22 @@ var $page_count = 10; /** - * @brief 초기화 + * @brief Initialization **/ function init() { - // module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅 + // Pre-check if module_srl exists. Set module_info if exists $module_srl = Context::get('module_srl'); - - // module model 객체 생성 + // Create module model object $oModuleModel = &getModel('module'); - - // 모듈 카테고리 목록을 구함 + // Get a list of module categories $module_category = $oModuleModel->getModuleCategories(); Context::set('module_category', $module_category); - - // 템플릿 경로 구함 (opage의 경우 tpl에 관리자용 템플릿 모아놓음) + // Get a template path (admin templates are collected on the tpl for opage) $this->setTemplatePath($this->module_path.'tpl'); } /** - * @brief 외부페이지 관리 목록 보여줌 + * @brief Display a list of external pages **/ function dispOpageAdminContent() { $args->sort_index = "module_srl"; @@ -39,35 +36,30 @@ $args->page_count = 10; $args->s_module_category_srl = Context::get('module_category_srl'); $output = executeQuery('opage.getOpageList', $args); - - // 템플릿에 쓰기 위해서 context::set + // context setting to use a template Context::set('total_count', $output->total_count); Context::set('total_page', $output->total_page); Context::set('page', $output->page); Context::set('opage_list', $output->data); Context::set('page_navigation', $output->page_navigation); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('index'); } /** - * @brief 외부페이지 추가 폼 출력 + * @brief Form to add an external page **/ function dispOpageAdminInsert() { - // 권한 그룹의 목록을 가져온다 + // Get a list of groups $oMemberModel = &getModel('member'); $group_list = $oMemberModel->getGroups(); Context::set('group_list', $group_list); - - // module.xml에서 권한 관련 목록을 구해옴 + // Get a list of permissions from the module.xml $grant_list = $this->xml_info->grant; Context::set('grant_list', $grant_list); - - // GET parameter에서 module_srl을 가져옴 + // Get module_srl $module_srl = Context::get('module_srl'); - - // module_srl이 있으면 해당 모듈의 정보를 구해서 세팅 + // Get and set module information if module_srl exists if($module_srl) { $oModuleModel = &getModel('module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); @@ -77,22 +69,20 @@ unset($module_srl); } } - - // 레이아웃 목록을 구해옴 + // Get a layout list $oLayoutModel = &getModel('layout'); $layout_list = $oLayoutModel->getLayoutList(); Context::set('layout_list', $layout_list); $mobile_layout_list = $oLayoutModel->getLayoutList(0,"M"); Context::set('mlayout_list', $mobile_layout_list); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('opage_insert'); } /** - * @brief 외부페이지 삭제 화면 출력 + * @brief Screen to delete an external page **/ function dispOpageAdminDelete() { $module_srl = Context::get('module_srl'); @@ -101,21 +91,18 @@ $oModuleModel = &getModel('module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); Context::set('module_info',$module_info); - - // 템플릿 파일 지정 + // Set a template file $this->setTemplateFile('opage_delete'); } /** - * @brief 권한 목록 출력 + * @brief Display a list of permissions **/ function dispOpageAdminGrantInfo() { - - // GET parameter에서 module_srl을 가져옴 + // Get module_srl $module_srl = Context::get('module_srl'); - - // module_srl이 있으면 해당 모듈의 정보를 구해서 세팅 + // Get and set module information if module_srl exists if($module_srl) { $oModuleModel = &getModel('module'); $module_info = $oModuleModel->getModuleInfoByModuleSrl($module_srl); @@ -127,8 +114,7 @@ } $this->module_info = $module_info; - - // 공통 모듈 권한 설정 페이지 호출 + // Call a page to set permission for common module $oModuleAdminModel = &getAdminModel('module'); $grant_content = $oModuleAdminModel->getModuleGrantHTML($this->module_info->module_srl, $this->xml_info->grant); Context::set('grant_content', $grant_content); diff --git a/modules/opage/opage.class.php b/modules/opage/opage.class.php index a83a81421..d78a4fdd0 100644 --- a/modules/opage/opage.class.php +++ b/modules/opage/opage.class.php @@ -2,43 +2,43 @@ /** * @class opage * @author NHN (developers@xpressengine.com) - * @brief opage 모듈의 high class + * @brief high class of opage module **/ class opage extends ModuleObject { /** - * @brief 설치시 추가 작업이 필요할시 구현 + * @brief Implement if additional tasks are necessary when installing **/ function moduleInstall() { - // opage 에서 사용할 cache디렉토리 생성 + // Create cache directory to use in the opage FileHandler::makeDir('./files/cache/opage'); return new Object(); } /** - * @brief 설치가 이상이 없는지 체크하는 method + * @brief a method to check if successfully installed **/ function checkUpdate() { - // cache 디렉토리가 없으면 바로 디렉토리 생성 + // Create a directory ditectly if no cache directory exists if(!is_dir('./files/cache/opage')) FileHandler::makeDir('./files/cache/opage'); return false; } /** - * @brief 업데이트 실행 + * @brief Update **/ function moduleUpdate() { return new Object(0, 'success_updated'); } /** - * @brief 캐시 파일 재생성 + * @brief Re-generate the cache file **/ function recompileCache() { - // 외부 페이지 캐시 파일 삭제 + // Remove cache file for external pages FileHandler::removeFilesInDir("./files/cache/opage"); } } diff --git a/modules/opage/opage.controller.php b/modules/opage/opage.controller.php index eb86d8c7e..d514d80c5 100644 --- a/modules/opage/opage.controller.php +++ b/modules/opage/opage.controller.php @@ -2,7 +2,7 @@ /** * @class documentController * @author NHN (developers@xpressengine.com) - * @brief document 모듈의 controller 클래스 + * @brief controller class of the document module **/ class opageController extends opage { @@ -10,12 +10,12 @@ var $target_path = ''; /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 타이틀 추출 + * @brief Extract a title **/ function getTitle($content) { preg_match('!]*)>(.*?)<\/title>!is', $content, $buff); @@ -23,16 +23,14 @@ } /** - * @brief header script 추출 + * @brief Extract header script **/ function getHeadScript($content) { - // title 태그 제거 + // remove the title tag $content = preg_replace('!]*)>(.*?)<\/title>!is','', $content); - - // meta 태그 제거 + // Remove meta tags $content = preg_replace('!<(\/){0,1}meta([^>]*)>!is','', $content); - - // ]*)>!is', $content, $link_buff); for($i=0;$i]*)>(.*?)<\/body>!is', $content, $body_buff); $body_script = $body_buff[2]; - - // link, style, script등 제거 + // Remove link, style, script, etc. $body_script = preg_replace('!]*)>!is', '', $body_script); $body_script = preg_replace('!<(style|script)(.*?)<\/(style|script)>!is', '', $body_script); return $body_script; } /** - * @brief 내용에 포함된 src, href의 값을 변경 + * @brief Change the value of src, href in the content **/ function replaceSrc($content, $path) { $url_info = parse_url($path); diff --git a/modules/opage/opage.mobile.php b/modules/opage/opage.mobile.php index c4b86ae80..01d76fb59 100644 --- a/modules/opage/opage.mobile.php +++ b/modules/opage/opage.mobile.php @@ -3,19 +3,17 @@ require_once(_XE_PATH_.'modules/opage/opage.view.php'); class opageMobile extends opageView { function init() { - // 템플릿 경로 구함 (opage의 경우 tpl에 관리자용 템플릿 모아놓음) + // Get a template path (admin templates are collected on the tpl for opage) $this->setTemplatePath($this->module_path.'tpl'); $oOpageModel = &getModel('opage'); $module_info = $oOpageModel->getOpage($this->module_srl); Context::set('module_info', $module_info); - - // 외부 페이지에서 명시된 외부 페이지 경로/ 캐싱 간격을 를 구함 + // Get a path/caching interval on the external page if($module_info->mpath) $this->path = $module_info->mpath; else $this->path = $module_info->path; $this->caching_interval = $module_info->caching_interval; - - // 캐시 파일 지정 + // Specify the cache file $this->cache_file = sprintf("./files/cache/opage/%d.m.cache.php", $module_info->module_srl); } diff --git a/modules/opage/opage.model.php b/modules/opage/opage.model.php index b1856a62d..31921cb49 100644 --- a/modules/opage/opage.model.php +++ b/modules/opage/opage.model.php @@ -2,19 +2,19 @@ /** * @class opageModel * @author NHN (developers@xpressengine.com) - * @brief opage 모듈의 model 클래스 + * @brief model class of the opage module **/ class opageModel extends opage { /** - * @brief 초기화 + * @brief Initialization **/ function init() { } /** - * @brief 특정 외부 페이지의 정보를 return - * 외부 페이지의 경우 기본 모듈의 정보와 설정정보를 함께 다루기 때문에 별도의 model method를 이용하게 한다 + * @brief Return information on the external page + * Use a separate model method because external page handles information and configurations of the defaul module either. **/ function getOpage($module_srl) { $oModuleModel = &getModel('module'); diff --git a/modules/opage/opage.view.php b/modules/opage/opage.view.php index b86a7c156..061a1a53a 100644 --- a/modules/opage/opage.view.php +++ b/modules/opage/opage.view.php @@ -2,7 +2,7 @@ /** * @class opageView * @author NHN (developers@xpressengine.com) - * @brief opage 모듈의 view 클래스 + * @brief view class of the opage module **/ class opageView extends opage { @@ -12,48 +12,42 @@ var $caching_interval; /** - * @brief 초기화 + * @brief Initialization **/ function init() { - // 템플릿 경로 구함 (opage의 경우 tpl에 관리자용 템플릿 모아놓음) + // Get a template path (admin templates are collected on the tpl for opage) $this->setTemplatePath($this->module_path.'tpl'); - - // 외부 페이지 모듈의 정보를 구함 + // Get information of the external page module $oOpageModel = &getModel('opage'); $module_info = $oOpageModel->getOpage($this->module_srl); Context::set('module_info', $module_info); - - // 외부 페이지에서 명시된 외부 페이지 경로/ 캐싱 간격을 를 구함 + // Get a path/caching interval on the external page $this->path = $module_info->path; $this->caching_interval = $module_info->caching_interval; - - // 캐시 파일 지정 + // Specify the cache file $this->cache_file = sprintf("./files/cache/opage/%d.cache.php", $module_info->module_srl); } /** - * @brief 일반 요청시 출력 + * @brief Display when receiving a request **/ function dispOpageIndex() { - - // http 인지 내부 파일인지 점검 + // check if it is http or internal file if($this->path) { if(preg_match("/^([a-z]+):\/\//i",$this->path)) $content = $this->getHtmlPage($this->path, $this->caching_interval, $this->cache_file); else $content = $this->executeFile($this->path, $this->caching_interval, $this->cache_file); } Context::set('opage_content', $content); - - // 결과 출력 템플릿 지정 + // Set a template for result output $this->setTemplateFile('content'); } /** - * @brief 외부 http로 요청되는 파일일 경우 파일을 받아와서 저장 후 return + * @brief Save the file and return if a file is requested by http **/ function getHtmlPage($path, $caching_interval, $cache_file) { - - // 캐시 검사 + // Verify cache if($caching_interval > 0 && file_exists($cache_file) && filemtime($cache_file) + $caching_interval*60 > time()) { $content = FileHandler::readFile($cache_file); @@ -64,27 +58,21 @@ $content = FileHandler::readFile($cache_file); } - - // opage controller 생성 + // Create opage controller $oOpageController = &getController('opage'); - - // 외부 서버의 페이지 일 경우 이미지, css, javascript등의 url을 변경 + // change url of image, css, javascript and so on if the page is from external server $content = $oOpageController->replaceSrc($content, $path); - - // 해당 문서를 utf-8로 변경 + // Change the document to utf-8 format $buff->content = $content; $buff = Context::convertEncoding($buff); $content = $buff->content; - - // title 추출 + // Extract a title $title = $oOpageController->getTitle($content); if($title) Context::setBrowserTitle($title); - - // header script 추출 + // Extract header script $head_script = $oOpageController->getHeadScript($content); if($head_script) Context::addHtmlHeader($head_script); - - // body 내용 추출 + // Extract content from the body $body_script = $oOpageController->getBodyScript($content); if(!$body_script) $body_script = $content; @@ -92,38 +80,32 @@ } /** - * @brief 내부 파일일 경우 include하도록 캐시파일을 만들고 처리 + * @brief Create a cache file in order to include if it is an internal file **/ function executeFile($path, $caching_interval, $cache_file) { - // 파일이 없으면 취소 + // Cancel if the file doesn't exist if(!file_exists($path)) return; - - // 경로와 파일이름을 구함 + // Get a path and filename $tmp_path = explode('/',$cache_file); $filename = $tmp_path[count($tmp_path)-1]; $filepath = preg_replace('/'.$filename."$/i","",$cache_file); - - // 캐시 검사 + // Verify cache if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= time() || filemtime($cache_file)path = str_replace('\\', '/', realpath($path_info['dirname'])).'/'; $content = preg_replace_callback('/(target=|src=|href=|url\()("|\')?([^"\'\)]+)("|\'\))?/is',array($this,'_replacePath'),$content); $content = preg_replace_callback('/(