웹마스터 팁


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

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

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

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

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

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

<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();
        }

    }
?>

제목 글쓴이 날짜
웹서버 php에서 한글언어 깨지거나 오류날때 방법@ 뭘봐첨봐 2015.01.19
사이트 종합해서 접속자 아이피 검색 file StyleRoot 2015.01.19
kin 모듈 게시물 -> board로 게시물 옮기기 편법 file 꾸링 2015.01.20
누리고 쇼핑몰 상품취소 혹은 반품시 마일리지 자동회복하기 [6] garnecia 2015.01.21
익명게시판에서 임시저장된 글을 불러와 등록하면 익명처리되지 않고 글쓴이 정보가 기록되는 버그 수정 [1] sejin7940 2015.01.23
사용자 매뉴에 회원정보와 포인트설정 바로가기 기능 삽입 [1] file 간장게장같은남자 2015.01.23
사용자정의 중 전화번호 형식을 쓰는경우 - 사이에 한칸씩 여백이 생기는 걸 없애는방법 [1] sejin7940 2015.01.23
게시판에서 태그 기준으로 검색하면 임시저장글들도 노출되는 버그 수정 sejin7940 2015.01.23
DB LOCK으로 인한 사이트 마비와 사례, 조치 [2] onTrust 2015.01.24
부트스트랩 관련 버튼안에 체크박스 돼지코구뇽 2015.01.25
xe 폰갭 제작시 admob 광고 글쓰기 방해 하지 않으려면 한꼬마 2015.01.26
템플릿등에서 PHP 제어 구조(if, for, foreach)의 대체 문법 적용 [3] 총모아 2015.01.30
누리고 쇼핑몰 - 배송비가 표시 안되는 경우에 [7] garnecia 2015.01.31
회원가입후 24시간 이후 글작성 가능하기 [2] 샵사이드 2015.02.09
카카오 API로 로그인창 만들어 봤어요~~ ^^ [6] file 컴박살 2015.02.12
300기가 Zboard4->XE 이전기 [14] file forest535 2015.02.13
snoop가 안될때 curl 로 가져오기 [3] 한꼬마 2015.02.13
데이타 이전 시 xml 파일 임포트 속도 높이기 ^^ forest535 2015.02.17
xe core 설치 화면 오류 있습니다. 이렇게 바꿔주세요. [2] 한꼬마 2015.02.18
스케치북 최신버전에서 미리 덧글 입력해두기 [5] file LI-NA 2015.02.18