웹마스터 팁


저는 아래 빨간부분만 추가했습니다.

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

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

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

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

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

<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 템플릿에서 $_SESSION 변수 사용하기 신평 2014.12.21
CSS 코드를 손쉽게 prefix/minify 변환해주는 사이트 file sojumeister 2014.12.18
날짜비교 함수 [1] 별을따는소년 2014.12.17
제이쿼리 충돌시 팁 바나나소프트 2014.12.15
여러게시물을 작성시 쓰기버튼 노출의 여부로 고생할 때.. file BJ람보 2014.12.15
위젯 많은 페이지 - 부하 분산으로 속도 향상하기 [4] 엘카 2014.12.12
파일 삭제시 (글 수정시 파일삭제 / 파일관리에서 삭제 등) 사용자정의값이 삭제되지 않도록 패치 [3] sejin7940 2014.12.11
폰갭 작업시 폰 내부 html에 변수 전달 방법 (get) Happyphp 2014.12.09
IE에서 스크립트 생성 iframe 요소에 name 속성 지정이 무시될 때 신평 2014.12.08
PDF 뷰어 팁 [4] 돼지코구뇽 2014.12.06
페이지에 명언,좋은글,책속의 한줄 랜덤으로 뿌리기 [1] file 고니 2014.12.02
jq로 데이터 입력시 enter키 먹게 하기 [3] Happyphp 2014.11.27
bing 번역 함수 만들어 사용하기 Happyphp 2014.11.26
Animate 사용 돼지코구뇽 2014.11.26
xe 어플 개발시 키캡 4.4.4 미만 업로드 문제 [3] Happyphp 2014.11.25
XE 코어의 메일전송을 우리알림 모듈로 대체하는 방법 [30] file GG 2014.11.24
누리고쇼핑몰-모바일 이니시스 결제에서 필수요청값 누락 에러로 결제 안되는것 해결하는 미봉책 garnecia 2014.11.23
누리고 쇼핑몰 - 모바일 버전에서 상품몰에 취소/환불 부분이 적용안되는부분 해결 하는 팁 garnecia 2014.11.23
파일첨부 된 글을 게시글 이동시, 사용자정의 값이 전부 삭제되는 버그 패치 [5] sejin7940 2014.11.20
회원포인트 목록에서 검색 후 포인트 업데이트시 검색 상황이 그대로 유지되도록 sejin7940 2014.11.20