From 3aeb57a11ccf69f1347280548b96cfc9fa439caf Mon Sep 17 00:00:00 2001 From: zero Date: Fri, 30 Mar 2007 13:47:32 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@838 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- classes/module/ModuleObject.class.php | 4 +- config/func.inc.php | 16 ++++ modules/board/board.controller.php | 14 +++- modules/board/board.view.php | 74 +++---------------- .../components/image_link/tpl/popup.html | 2 +- .../editor/components/image_link/tpl/popup.js | 1 + modules/file/file.controller.php | 7 +- 7 files changed, 44 insertions(+), 74 deletions(-) diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php index 747a65b88..0d7ca9723 100644 --- a/classes/module/ModuleObject.class.php +++ b/classes/module/ModuleObject.class.php @@ -92,9 +92,7 @@ } // act값에 admin이 들어 있는데 관리자가 아닌 경우 오류 표시 - if(!$grant->is_admin && eregi('admin', $this->act)) { - return $this->stop('msg_not_permitted_act'); - } + if(!$grant->is_admin && substr_count($this->act, 'Admin')) return $this->stop('msg_not_permitted_act'); // 권한 설정 if($xml_info->grant) { diff --git a/config/func.inc.php b/config/func.inc.php index d23924668..e17f48766 100644 --- a/config/func.inc.php +++ b/config/func.inc.php @@ -73,6 +73,15 @@ return $oDB->executeQuery($query_id, $args); } + /** + * @brief DB::getNextSequence() 의 alias + * @return big int + **/ + function getNextSequence() { + $oDB = &DB::getInstance(); + return $oDB->getNextSequence(); + } + /** * @brief Context::getUrl($args_list)를 쓰기 쉽게 함수로 선언 * @return string @@ -210,4 +219,11 @@ if($no >= $mod) $output .= getNumberingPath((int)$no/$mod, $size); return $output; } + + /** + * @brief 한글이 들어간 url의 decode + **/ + function url_decode($str) { + return ereg_replace('%u([[:alnum:]]{4})', '&#x\1;',$str); + } ?> diff --git a/modules/board/board.controller.php b/modules/board/board.controller.php index 3a1d04782..30eebfe54 100644 --- a/modules/board/board.controller.php +++ b/modules/board/board.controller.php @@ -42,9 +42,11 @@ $msg_code = 'success_registed'; $obj->document_srl = $output->get('document_srl'); } + + // 오류 발생시 멈춤 if(!$output->toBool()) return $output; - // 트랙백 발송 + // 트랙백이 있으면 트랙백 발송 $trackback_url = Context::get('trackback_url'); $trackback_charset = Context::get('trackback_charset'); if($trackback_url) { @@ -52,8 +54,11 @@ $oTrackbackController->sendTrackback($obj, $trackback_url, $trackback_charset); } + // 결과를 리턴 $this->add('mid', Context::get('mid')); $this->add('document_srl', $output->get('document_srl')); + + // 성공 메세지 등록 $this->setMessage($msg_code); } @@ -63,6 +68,8 @@ function procBoardDeleteDocument() { // 문서 번호 확인 $document_srl = Context::get('document_srl'); + + // 문서 번호가 없다면 오류 발생 if(!$document_srl) return $this->doError('msg_invalid_document'); // document module model 객체 생성 @@ -72,6 +79,7 @@ $output = $oDocumentController->deleteDocument($document_srl, $this->grant->manager); if(!$output->toBool()) return $output; + // 성공 메세지 등록 $this->add('mid', Context::get('mid')); $this->add('page', $output->get('page')); $this->setMessage('success_deleted'); @@ -143,7 +151,6 @@ $comment_srl = Context::get('comment_srl'); if(!$comment_srl) return $this->doError('msg_invalid_request'); - // 삭제 // comment 모듈의 controller 객체 생성 $oCommentController = &getController('comment'); @@ -324,8 +331,7 @@ $oModuleController = &getController('module'); $oModuleController->updateModuleSkinVars($module_srl, $skin_vars); - $url = sprintf("./?module=admin&mo=board&module_srl=%s&act=dispAdminSkinInfo&page=%s", $module_srl, Context::get('page')); - print ""; + print ""; exit(); } diff --git a/modules/board/board.view.php b/modules/board/board.view.php index 06c144be4..3671d4476 100644 --- a/modules/board/board.view.php +++ b/modules/board/board.view.php @@ -13,10 +13,12 @@ * board 모듈은 일반 사용과 관리자용으로 나누어진다.\n **/ function init() { + if(substr_count($this->act, 'Admin')) $this->initAdmin(); + else $this->initNormal(); } /** - * @brief 관리자 기능 호출시에 관련 정보들 세팅해줌 + * @brief 관리자 act 호출시에 관련 정보들 세팅해줌 **/ function initAdmin() { // module_srl이 있으면 미리 체크하여 존재하는 모듈이면 module_info 세팅 @@ -41,10 +43,8 @@ $module_category = $oModuleModel->getModuleCategories(); Context::set('module_category', $module_category); - // 템플릿 경로 구함 (board의 경우 tpl에 관리자용 템플릿 모아놓음) + // 템플릿 경로 지정 (board의 경우 tpl에 관리자용 템플릿 모아놓음) $template_path = sprintf("%stpl/",$this->module_path); - - // 템플릿 경로 지정 $this->setTemplatePath($template_path); } @@ -52,7 +52,6 @@ * @brief 일반 게시판 호출시에 관련 정보를 세팅해줌 **/ function initNormal() { - // 카테고리를 사용하는지 확인후 사용시 카테고리 목록을 구해와서 Context에 세팅 if($this->module_info->use_category=='Y') { $oDocumentModel = &getModel('document'); @@ -69,10 +68,8 @@ $this->list_count = $this->module_info->list_count?$this->module_info->list_count:20; $this->page_count = $this->module_info->page_count?$this->module_info->page_count:10; - // 스킨 템플릿 경로 구함 + // 스킨 템플릿 경로 지정 $template_path = sprintf("%sskins/%s/",$this->module_path, $this->skin); - - // 템플릿 경로 지정 $this->setTemplatePath($template_path); } @@ -80,9 +77,6 @@ * @brief 목록 및 선택된 글 출력 **/ function dispBoardContent() { - // 모듈 관련 정보 세팅 - $this->initNormal(); - // 권한 체크 if(!$this->grant->list) return $this->dispBoardMessage('msg_not_permitted'); @@ -96,7 +90,9 @@ // document_srl이 있다면 해당 글을 구해오자 if($this->grant->view && $document_srl) { + // 글을 구함 $document = $oDocumentModel->getDocument($document_srl, $this->grant->manager, true); + // 찾아지지 않았다면 초기화 if($document->document_srl != $document_srl) { unset($document); @@ -129,6 +125,7 @@ $args->list_count = $this->list_count; ///< 한페이지에 보여줄 글 수 $args->page_count = $this->page_count; ///< 페이지 네비게이션에 나타날 페이지의 수 + // 검색 옵션 $args->search_target = Context::get('search_target'); ///< 검색 대상 (title, contents...) $args->search_keyword = Context::get('search_keyword'); ///< 검색어 if($this->module_info->use_category=='Y') $args->category_srl = Context::get('category'); ///< 카테고리 사용시 선택된 카테고리 @@ -159,9 +156,6 @@ * @brief 글 작성 화면 출력 **/ function dispBoardWrite() { - // 모듈 관련 정보 세팅 - $this->initNormal(); - // 권한 체크 if(!$this->grant->write_document) return $this->dispBoardMessage('msg_not_permitted'); @@ -180,10 +174,7 @@ } } - if(!$document_srl) { - $oDB = &DB::getInstance(); - $document_srl = $oDB->getNextSequence(); - } + if(!$document_srl) $document_srl = getNextSequence(); // 글을 수정하려고 할 경우 권한이 없는 경우 비밀번호 입력화면으로 if($document&&!$document->is_granted) return $this->setTemplateFile('input_password_form'); @@ -203,9 +194,6 @@ * @brief 문서 삭제 화면 출력 **/ function dispBoardDelete() { - // 모듈 관련 정보 세팅 - $this->initNormal(); - // 권한 체크 if(!$this->grant->write_document) return $this->dispBoardMessage('msg_not_permitted'); @@ -233,9 +221,6 @@ * @brief 댓글의 답글 화면 출력 **/ function dispBoardReplyComment() { - // 모듈 관련 정보 세팅 - $this->initNormal(); - // 권한 체크 if(!$this->grant->write_comment) return $this->dispBoardMessage('msg_not_permitted'); @@ -269,9 +254,6 @@ * @brief 댓글 수정 폼 출력 **/ function dispBoardModifyComment() { - // 모듈 관련 정보 세팅 - $this->initNormal(); - // 권한 체크 if(!$this->grant->write_comment) return $this->dispBoardMessage('msg_not_permitted'); @@ -307,9 +289,6 @@ * @brief 댓글 삭제 화면 출력 **/ function dispBoardDeleteComment() { - // 모듈 관련 정보 세팅 - $this->initNormal(); - // 권한 체크 if(!$this->grant->write_comment) return $this->dispBoardMessage('msg_not_permitted'); @@ -337,9 +316,6 @@ * @brief 엮인글 삭제 화면 출력 **/ function dispBoardDeleteTrackback() { - // 모듈 관련 정보 세팅 - $this->initNormal(); - // 삭제할 댓글번호를 가져온다 $trackback_srl = Context::get('trackback_srl'); @@ -359,10 +335,7 @@ /** * @brief 메세지 출력 **/ - function dispMessage($msg_code) { - // 모듈 관련 정보 세팅 - $this->initNormal(); - + function dispBoardMessage($msg_code) { $msg = Context::getLang($msg_code); if(!$msg) $msg = $msg_code; Context::set('message', $msg); @@ -373,9 +346,6 @@ * @brief RSS 출력 **/ function dispBoardRss() { - // 모듈 관련 정보 세팅 - $this->initNormal(); - // 권한 체크 if(!$this->grant->list) return $this->dispBoardMessage('msg_not_permitted'); @@ -419,8 +389,7 @@ **/ function setCommentEditor($comment_srl=0) { if(!$comment_srl) { - $oDB = &DB::getInstance(); - $comment_srl = $oDB->getNextSequence(); + $comment_srl = getNextSequence(); Context::set('comment_srl', $comment_srl); } @@ -434,17 +403,13 @@ * @brief 게시판 관리 목록 보여줌 **/ function dispBoardAdminContent() { - // 관리자 관련 정보 세팅 - $this->initAdmin(); - // 등록된 board 모듈을 불러와 세팅 - $oDB = &DB::getInstance(); $args->sort_index = "module_srl"; $args->page = Context::get('page'); $args->list_count = 40; $args->page_count = 10; $args->s_module_category_srl = Context::get('module_category_srl'); - $output = $oDB->executeQuery('board.getBoardList', $args); + $output = executeQuery('board.getBoardList', $args); // 템플릿에 쓰기 위해서 context::set Context::set('total_count', $output->total_count); @@ -461,8 +426,6 @@ * @brief 게시판에 필요한 기본 설정들 **/ function dispBoardAdminModuleConfig() { - // 관리자 관련 정보 세팅 - $this->initAdmin(); // 설정 정보를 받아옴 (module model 객체를 이용) $oModuleModel = &getModel('module'); @@ -478,8 +441,6 @@ * @brief 선택된 게시판의 정보 출력 **/ function dispBoardAdminBoardInfo() { - // 관리자 관련 정보 세팅 - $this->initAdmin(); // module_srl 값이 없다면 그냥 index 페이지를 보여줌 if(!Context::get('module_srl')) return $this->dispAdminContent(); @@ -507,8 +468,6 @@ * @brief 게시판 추가 폼 출력 **/ function dispBoardAdminInsertBoard() { - // 관리자 관련 정보 세팅 - $this->initAdmin(); // 스킨 목록을 구해옴 $oModuleModel = &getModel('module'); @@ -528,8 +487,6 @@ * @brief 게시판 삭제 화면 출력 **/ function dispBoardAdminDeleteBoard() { - // 관리자 관련 정보 세팅 - $this->initAdmin(); if(!Context::get('module_srl')) return $this->dispContent(); @@ -549,8 +506,6 @@ * @brief 스킨 정보 보여줌 **/ function dispBoardAdminSkinInfo() { - // 관리자 관련 정보 세팅 - $this->initAdmin(); // 현재 선택된 모듈의 스킨의 정보 xml 파일을 읽음 $module_info = Context::get('module_info'); @@ -578,8 +533,6 @@ * @brief 카테고리의 정보 출력 **/ function dispBoardAdminCategoryInfo() { - // 관리자 관련 정보 세팅 - $this->initAdmin(); // module_srl을 구함 $module_srl = Context::get('module_srl'); @@ -612,9 +565,6 @@ * @brief 권한 목록 출력 **/ function dispBoardAdminGrantInfo() { - // 관리자 관련 정보 세팅 - $this->initAdmin(); - // module_srl을 구함 $module_srl = Context::get('module_srl'); diff --git a/modules/editor/components/image_link/tpl/popup.html b/modules/editor/components/image_link/tpl/popup.html index cde6e4a0b..b932f72d5 100644 --- a/modules/editor/components/image_link/tpl/popup.html +++ b/modules/editor/components/image_link/tpl/popup.html @@ -8,7 +8,7 @@
{$component_info->title} ver. {$component_info->version} {$lang->about_component}
{$lang->image_url}
-
+
{$lang->image_scale}
diff --git a/modules/editor/components/image_link/tpl/popup.js b/modules/editor/components/image_link/tpl/popup.js index 0f4fc1b39..9e20f4a73 100644 --- a/modules/editor/components/image_link/tpl/popup.js +++ b/modules/editor/components/image_link/tpl/popup.js @@ -56,6 +56,7 @@ function insertImage(obj) { if(typeof(opener)=="undefined") return; var url = xGetElementById("image_url").value; + alert(url); var alt = xGetElementById("image_alt").value; var align = ""; if(xGetElementById("align_normal").checked==true) align = ""; diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index e43351302..7246d102a 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -38,12 +38,11 @@ // 기본적으로 필요한 변수인 upload_target_srl, module_srl을 설정 $upload_target_srl = Context::get('upload_target_srl'); $file_srl = Context::get('file_srl'); - if(!$file_srl) exit(); // 업로드 권한이 없거나 정보가 없을시 종료 if(!$_SESSION['upload_enable'][$upload_target_srl]) exit(); - $output = $this->deleteFile($file_srl, $this->grant->manager); + if($file_srl) $output = $this->deleteFile($file_srl); // 첨부파일의 목록을 java script로 출력 $this->printUploadedFileList($upload_target_srl); @@ -113,7 +112,7 @@ /** * @brief 첨부파일 삭제 **/ - function deleteFile($file_srl, $is_admin = false) { + function deleteFile($file_srl) { $oDB = &DB::getInstance(); // 파일 정보를 가져옴 @@ -269,7 +268,7 @@ $file_srl = trim($file_srl_list[$i]); if(!$file_srl) continue; - $this->deleteFile($file_srl, true); + $this->deleteFile($file_srl); } $this->setMessage( sprintf(Context::getLang('msg_checked_file_is_deleted'), $file_count) );