From 248fb7b786c254fc14fbfe1d8ad9357ee6905296 Mon Sep 17 00:00:00 2001 From: zero Date: Mon, 18 Jun 2007 04:25:01 +0000 Subject: [PATCH] git-svn-id: http://xe-core.googlecode.com/svn/trunk@1638 201d5d3c-b55e-5fd7-737f-ddc643e51545 --- modules/board/board.controller.php | 28 +++++++++++++--------------- modules/document/document.item.php | 4 ++-- 2 files changed, 15 insertions(+), 17 deletions(-) diff --git a/modules/board/board.controller.php b/modules/board/board.controller.php index ed1151b89..7b9ecaffc 100644 --- a/modules/board/board.controller.php +++ b/modules/board/board.controller.php @@ -186,6 +186,7 @@ function procBoardVerificationPassword() { // 비밀번호와 문서 번호를 받음 $password = md5(Context::get('password')); + $document_srl = Context::get('document_srl'); $comment_srl = Context::get('comment_srl'); @@ -194,26 +195,23 @@ // 문서번호에 해당하는 글이 있는지 확인 $oCommentModel = &getModel('comment'); $data = $oCommentModel->getComment($comment_srl); - // comment_srl이 없으면 문서가 대상 - } else { - // 문서번호에 해당하는 글이 있는지 확인 - $oDocumentModel = &getModel('document'); - $data = $oDocumentModel->getDocument($document_srl); - } + if(!$data) return new Object(-1, 'msg_invalid_request'); - // 글이 없을 경우 에러 - if(!$data) return new Object(-1, 'msg_invalid_request'); + // 문서의 비밀번호와 입력한 비밀번호의 비교 + if($data->password != $password) return new Object(-1, 'msg_invalid_password'); - // 문서의 비밀번호와 입력한 비밀번호의 비교 - if($data->password != $password) return new Object(-1, 'msg_invalid_password'); - - // 해당 글에 대한 권한 부여 - if($comment_srl) { $oCommentController = &getController('comment'); $oCommentController->addGrant($comment_srl); } else { - $oDocumentController = &getController('document'); - $oDocumentController->addGrant($document_srl); + // 문서번호에 해당하는 글이 있는지 확인 + $oDocumentModel = &getModel('document'); + $oDocument = $oDocumentModel->getDocument($document_srl); + if(!$oDocument->isExists()) return new Object(-1, 'msg_invalid_request'); + + // 문서의 비밀번호와 입력한 비밀번호의 비교 + if($oDocument->get('password') != $password) return new Object(-1, 'msg_invalid_password'); + + $oDocument->setGrant(); } } diff --git a/modules/document/document.item.php b/modules/document/document.item.php index df51b6633..fcb5a292a 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -50,7 +50,7 @@ } function isGranted() { - if($_SESSION['own_attribute'][$this->document_srl]) return true; + if($_SESSION['own_document'][$this->document_srl]) return true; if(!Context::get('is_logged')) return false; @@ -64,7 +64,7 @@ } function setGrant() { - $_SESSION['own_attribute'][$this->document_srl] = true; + $_SESSION['own_document'][$this->document_srl] = true; } function allowComment() {