묻고답하기


저는 아래 빨간부분만 추가했습니다. \modules\board\board.controller.php

정상적인 방법은 아닌듯 하지만...일단 저는 성공했고..현재까지는 잘 됩니다.

이런식으로 했을때 문제가 발생도리 소지가 있거나 좀더 나은 방법 (예를 들어 함수를 만들어 사용하는 방법)이 있다면..한수 가르쳐 주시기 바랍니다.

제가 사용한 방법의 문제는 글주소가 링크가 안된다는 것입니다.

메일은 오지만..그냥 텍스트로 오지..링크는 안 걸리더군요,,

링크부분만 어느분이 수정해주시면 감사히 쓰겠습니다.

<a herf= 태그는 사용해 봤는데..메일에는 저 태그는 빠지고 오더군요..

고수님들께 조언 부탁드립니다.

편집한 파일 \modules\board\board.controller.php


<?php
    /**
     * @class  boardController
     * @author zero (
zero@nzeo.com)
     * @brief  board 모듈의 Controller class
     **/

    class boardController extends board {

        /**
         * @brief 초기화
         **/
        function init() {
        }

        /**
         * @brief 문서 입력
         **/
        function procBoardInsertDocument() {
            // 권한 체크
            if(!$this->grant->write_document) return new Object(-1, 'msg_not_permitted');

            // 글작성시 필요한 변수를 세팅
            $obj = Context::getRequestVars();
            $obj->module_srl = $this->module_srl;
            if($obj->is_notice!='Y'||!$this->grant->manager) $obj->is_notice = 'N';

            if(!$obj->title) $obj->title = cut_str(strip_tags($obj->content),20,'...');

            // 관리자가 아니라면 게시글 색상/굵기 제거
            if(!$this->grant->manager) {
                unset($obj->title_color);
                unset($obj->title_bold);
            }

            // document module의 model 객체 생성
            $oDocumentModel = &getModel('document');

            // document module의 controller 객체 생성
            $oDocumentController = &getController('document');

            // 이미 존재하는 글인지 체크
            $oDocument = $oDocumentModel->getDocument($obj->document_srl, $this->grant->manager);

            // 이미 존재하는 경우 수정
            if($oDocument->isExists() && $oDocument->document_srl == $obj->document_srl) {
                // Modify
                $msg_head = "■수정■ ";
                $output = $oDocumentController->updateDocument($oDocument, $obj);
                $msg_code = 'success_updated';

            // 그렇지 않으면 신규 등록
            } else {
                // Modify
                $msg_head = "■등록■ ";
                $output = $oDocumentController->insertDocument($obj);
                $msg_code = 'success_registed';
                $obj->document_srl = $output->get('document_srl'+ '+ ');
            }

            // 오류 발생시 멈춤
            if(!$output->toBool()) return $output;

                // Modify
                $logged_info = Context::get('logged_info');
                $msg_url = "
http://www.본인도메인.co.kr/?document_srl=".$obj->document_srl;
                $oMail = new Mail();
                $oMail->setTitle($msg_head.$obj->title);
                $oMail->setContent($msg_url."\n".$obj->content);
                $oMail->setSender($logged_info->user_name, $logged_info->email_address);
                $oMail->setReceiptor("[ 운영자 ]", "받고싶은메일주소");
                $oMail->send();

            // 결과를 리턴
            $this->add('mid', Context::get('mid'));
            $this->add('+ 'document_srl', $output->get('document_srl'));

            // 성공 메세지 등록
            $this->setMessage($msg_code);
        }

        /**
         * @brief 문서 삭제
         **/
        function procBoardDeleteDocument() {
            // 문서 번호 확인
            $document_srl = Context::get('document_srl');

            // 문서 번호가 없다면 오류 발생
            if(!$document_srl) return $this->doError('msg_invalid_document');

            // document module model 객체 생성
            $oDocumentController = &getController('document');

            // 삭제 시도
            $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');
        }

        /**
         * @brief 추천
         **/
        function procBoardVoteDocument() {
            // document module controller 객체 생성
            $oDocumentController = &getController('+ 'document');

            $document_srl = Context::get('document_srl');
            return $oDocumentController->updateVotedCount($document_srl);
        }

        /**
         * @brief 코멘트 추가
         **/
        function procBoardInsertComment() {
            // 권한 체크
            if(!$this->grant->write_comment) return new Object(-1, 'msg_not_permitted');

            // 댓글 입력에 필요한 데이터 추출
            $obj = Context::gets('document_srl','comment_srl','parent_srl','content','password','nick_name','nick_name','member_srl','email_address','homepage','is_secret','+ 'notify_message');
            $obj->module_srl = $this->module_srl;

            // comment 모듈의 model 객체 생성
            $oCommentModel = &getModel('+ 'comment');

            // comment 모듈의 controller 객체 생성
            $oCommentController = &getController('comment');

            // comment_srl이 존재하는지 체크
                        // 만일 comment_srl이 n/a라면 getNextSequence()로 값을 얻어온다.
                        if(!$obj->comment_srl) {
                $obj->comment_srl = getNextSequence();
            } else {
                $comment = $oCommentModel->getComment($obj->comment_srl, $this->grant->manager);
            }

            // comment_srl이 없을 경우 신규 입력
            if($comment->comment_srl != $obj->comment_srl) {

                // parent_srl이 있으면 답변으로
                if($obj->parent_srl) {
                    $parent_comment = $oCommentModel->getComment($obj->parent_srl);
                    if(!$parent_comment->comment_srl) return new Object(-1, 'msg_invalid_request'+ ');

                    $output = $oCommentController->insertComment($obj);
                    // Modify
                    $msg_head = "■댓글답변■ ";

                // 없으면 신규
                } else {
                    $output = $oCommentController->insertComment($obj);
                    // Modify
                    $msg_head = "■댓글등록■ ";
                }

            // comment_srl이 있으면 수정으로
            } else {
                $obj->parent_srl = $comment->parent_srl;
                $output = $oCommentController->updateComment($obj, $this->grant->manager);
                $comment_srl = $obj->comment_srl;
                // Modify
                $msg_head = "■댓글수정■ ";
            }

            if(!$output->toBool()) return $output;

                // Modify
                $logged_info = Context::get('logged_info');
                $msg_url = "
http://www.본인도메인.co.kr/?document_srl=".$obj->document_srl;
                $oMail = new Mail();
                if(!$obj->title) $obj->title = cut_str(strip_tags($obj->content),20,'...');
                $oMail->setTitle($msg_head.$obj->title);
                $oMail->setContent($msg_url."\n".$obj->content);
                $oMail->setSender($logged_info->user_name, $logged_info->email_address);
                $oMail->setReceiptor("[ 운영자 ]", "받고싶은메일주소");
                $oMail->send();

            $this->setMessage('success_registed');
            $this->add('mid', Context::get('mid'));
            $this->add('document_srl', $obj->document_srl);
            $this->add('comment_srl', $obj->comment_srl);
        }

        /**
         * @brief 코멘트 삭제
         **/
        function procBoardDeleteComment() {
            // 댓글 번호 확인
            $comment_srl = Context::get('comment_srl');
            if(!$comment_srl) return $this->doError('msg_invalid_request'+ ');

            // comment 모듈의 controller 객체 생성
            $oCommentController = &getController('comment');

            $output = $oCommentController->deleteComment($comment_srl, $this->grant->manager);
            if(!$output->toBool()) return $output;

            $this->add('mid', Context::get('mid'));
            $this->add('page', Context::get('page'));
            $this->add('document_srl', $output->get('document_srl'));
            $this->setMessage('success_deleted');
        }

        /**
         * @brief 엮인글 삭제
         **/
        function procBoardDeleteTrackback() {
            $trackback_srl = Context::get('trackback_srl');

            // trackback module의 controller 객체 생성
            $oTrackbackController = &getController('trackback');
            $output = $oTrackbackController->deleteTrackback($trackback_srl, $this->grant->manager);
            if(!$output->toBool()) return $output;

            $this->add('mid', Context::get('mid'));
            $this->add('page', Context::get('page'));
            $this->add('document_srl', $output->get('document_srl'));
            $this->setMessage('success_deleted');
        }

        /**
         * @brief 문서와 댓글의 비밀번호를 확인
         **/
        function procBoardVerificationPassword() {
            // 비밀번호와 문서 번호를 받음
            $password = Context::get('password');
            $document_srl = Context::get('document_srl');
            $comment_srl = Context::get('comment_srl');

            $oMemberModel = &getModel('member');

            // comment_srl이 있을 경우 댓글이 대상
            if($comment_srl) {
                // 문서번호에 해당하는 글이 있는지 확인
                $oCommentModel = &getModel('comment');
                $oComment = $oCommentModel->getComment($comment_srl);
                if(!$oComment->isExists()) return new Object(-1, 'msg_invalid_request');

                // 문서의 비밀번호와 입력한 비밀번호의 비교
                if(!$oMemberModel->isValidPassword($oComment->get('password'),$password)) return new Object(-1, 'msg_invalid_password');

                $oComment->setGrant();
            } else {
                // 문서번호에 해당하는 글이 있는지 확인
                $oDocumentModel = &getModel('document');
                $oDocument = $oDocumentModel->getDocument($document_srl);
                if(!$oDocument->isExists()) return new Object(-1, 'msg_invalid_request');

                // 문서의 비밀번호와 입력한 비밀번호의 비교
                if(!$oMemberModel->isValidPassword($oDocument->get('password'),$password)) return new Object(-1, 'msg_invalid_password');

                $oDocument->setGrant();
            }
        }

        /**
         * @brief 아이디 클릭시 나타나는 팝업메뉴에 "작성글 보기" 메뉴를 추가하는 trigger
         **/
        function triggerMemberMenu(&$obj) {
            $member_srl = Context::get('target_srl');
            $mid = Context::get('cur_mid');

            if(!$member_srl || !$mid) return new Object();

            $logged_info = Context::get('logged_info');

            // 호출된 모듈의 정보 구함
            $oModuleModel = &getModel('module');
            $cur_module_info = $oModuleModel->getModuleInfoByMid($mid);

            if($cur_module_info->module != 'board') return new Object();

            // 자신의 아이디를 클릭한 경우
            if($member_srl == $logged_info->member_srl) $member_info = $logged_info;
            else {
                $oMemberModel = &getModel('member');
                $member_info = $oMemberModel->getMemberInfoByMemberSrl($member_srl);
            }

            if(!$member_info->user_id) return new Object();

            // 아이디로 검색
            $menu_str = Context::getLang('cmd_view_own_document');
            $menu_url = sprintf('./?mid=%s&amp;search_target=user_id&amp;search_keyword=%s', $mid, $member_info->user_id);
            $obj[] = sprintf('%s,%s,move_url(\'%s\')', Context::getRequestUri().'/modules/member/tpl/images/icon_view_written.gif',$menu_str, $menu_url);

            return new Object();
        }

    }
?>

글쓴이 제목 최종 글
XE 공지 글 쓰기,삭제 운영방식 변경 공지 [16] 2019.03.05 by 남기남
똑디 타 게시판 회원정보 옮기는 방법 아시는분?  
김병화999 테두리들이 매끄럽지 않게 로딩되는건 서버 사양때문일까요?  
jacdoo.myid.net RSS 를 읽어오다가 못읽어오다가 그럽니다  
Jmelody 최근 설문 기능  
채연파파 회원이 글을 쓰면 입력해 놓은 메일로 글 주소를 알려주는 방법  
웹조리 로그아웃 안됨 회원가입 안됨  
포트거스.D.에이스 포인트 차감 [1] 2008.03.11 by 백성찬
조재민987 회원 로그인이 되지 않습니다.  
타이황 게시판을 이용한 회원관리... [1] 2008.03.11 by 타이황
불붕어 제로보드 삽입방법좀 알려주세요. [1] 2008.03.11 by 백성찬
허접영맨 내컴에 ftp서버만들어서 실행시 웹에서 설치가안되요;;ㅠㅠ [2] file 2008.03.11 by 영맨
의대생 안녕하세요. 게시판 질문 입니다^^  
알수없는오류 하위메뉴의 [+] 표시가 뜨지 않습니다. file  
안원석334 레이아웃에서 메뉴의 언어별 값을 가지고 오려면 어떻게 합니까? ^^ [1] 2008.03.11 by SensePlus1
WarYi 댓글 접어서 페이지 띄우는 방법은 없을까요?  
연군 DOCTYPE 수정은 어디서 가능한가요...??? [1] 2008.03.12 by 연군
taenie 이미지 본문 삽입  
샤오린 PHP에 대해 질문 드립니다. [1] 2008.03.12 by rhythm*
영달이 애플스킨 질문이있습니다~ [1] file 2008.03.12 by 우야노닷컴
이진규665 설치 마지막 등록이 안됩니다. 도와주세요 file  
mmx900 RAW 액션?같은 게 있을까요  
임수형 분류 추가가 안됩니다 file  
모든배려 게시판 백업 말고 홈페이지를 통으로 백업가능한가요.  
라르게덴 고수님들 document_controller.php 파일 소스에 대해 질문... [2] 2008.03.12 by 라르게덴
데미 게시물 수정했을때 뜨는 U마크 있잖아요..  
flowerrain 파이어폭스에서 로고이미지의 위치가 다르게 나타납니다. [2] file 2008.03.12 by flowerrain
붉게파란 게시판관리>추가설정>권한관리 부분에서..질문입니다. file  
조재민987 재설치를 했더니 로그인이 되지 않습니다;;  
likesea 설치문의  
엠비 RSS 게시물 웹진형으로 뽑아오기