웹마스터 팁


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

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

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

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

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

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

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

    }
?>

제목 글쓴이 날짜
정식버전 후 갤러리 스킨 사용시 이미지 정렬 안되시는 분들~ 다케루 2008.02.29
홈페이지에 국경일이면 태극기 다는법이에요~ ^^ [11] [1] file jaehee_91 2008.03.01
게시판 확장 변수에 그림 입력받기 [7] 대암지기 2008.03.04
게시판 확장변수에 라디오버튼 추가해서 사용하기 [6] file 똑디 2008.03.04
utf-8 저장시 레이아웃 윗부분 빈공간이 생기는 문제 (BOM)처리 [8] file 주금보 2008.03.04
회원 기본정보 공개여부 및 정보변경 옵션으로 처리하기(Member Moudle) [18] file 대암지기 2008.03.04
확장변수 쉽게 출력하기 [7] lightnsalt 2008.03.04
리스트를 작성날짜(regdate)로 정렬하기 [7] JAMSUN2 2008.03.05
우분투에서 rewrite 모드 사용하기 [2] 용꿍 2008.03.06
기초적인 배경등록시 게시판투명되는것 고치는법[초보만] [3] file 이정제421 2008.03.07
제로보드 XE에 연동 가능 채팅, 100% 플래시, 1:1 채팅 지원, 필요하면 음성/화상 채팅 지원 [2] digirave 2008.03.09
애드온에서 그룹 별로 실행여부 설정 [1] imsoo.net 2008.03.09
[수정 했습니다.]본문 입력없이 확장 변수로만 글작성 작성하기(그림삽입포함) [13] file 대암지기 2008.03.09
글작성및수정, 코멘트작성및 수정을 하면 미리 입력한 메일주소로 메일발송 [18] 채연파파 2008.03.12
동창회 사이트용 프로필 이미지 두개 출력하기 [1] file 지연아빠 2008.03.12
zbXE에 퍼머링크 달기 [3] file 라르게덴 2008.03.13
관리 화면의 회원 목록에서 소속 그룹 출력하기 [6] 띵야 2008.03.14
큰 파일의 썸네일이 안생기는 경우 해결방법(수정) [12] file 얼터 2008.03.15
팝업창 띄우기 [16] 레망 2008.03.16
큰 파일의 썸네일이 안생길때 해결방법-추가 [7] HIKARU 2008.03.18