로그인

검색

조회 수 19542 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 게시글 수정 내역 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 게시글 수정 내역 댓글로 가기 인쇄


사이트를 운영하다보니 관리자에게만 가능한 몇가지들이 필요하더군요..

 

추천, 신고기능을 관리자만 제한을 해제하도록 수정하였습니다. 1.5.2.2 에서 작업하였습니다.

아래 내용을 modules/document/document.controller.php  의 updateVotedCount 와 그 바로 아래의 declaredDocument 함수를 교체해 주시면

됩니다.. 사실 기존것을 else로 묵어버리고 관리자만 새로 만들어 넣은것입니다..

 

추천, 신고 - 관리자 해제





/**
     * @brief Increase the number of vote-up of the document
     **/
    function updateVotedCount($document_srl, $point = 1) {
        if($point > 0) $failed_voted = 'failed_voted';
        else $failed_voted = 'failed_blamed';
 
        // Create a member model object
        $oMemberModel = &getModel('member');
        $member_srl = $oMemberModel->getLoggedMemberSrl();
        $logged_info = Context::get('logged_info');
         
        // Get the original document
        $oDocumentModel = &getModel('document');
        $oDocument = $oDocumentModel->getDocument($document_srl, false, false);
 
        if ($logged_info->is_admin == 'Y') {
            $args->member_srl = $member_srl;
            $args->document_srl = $document_srl;
            // Update the voted count
            if($point < 0)
            {
                $args->blamed_count = $oDocument->get('blamed_count') + $point;
                $output = executeQuery('document.updateBlamedCount', $args);
            }
            else
            {
                $args->voted_count = $oDocument->get('voted_count') + $point;
                $output = executeQuery('document.updateVotedCount', $args);
            }
            if(!$output->toBool()) return $output;
            // Leave logs
            $args->point = $point;
            $output = executeQuery('document.insertDocumentVotedLog', $args);
            if(!$output->toBool()) return $output;
    }
        else {
            // Return fail if session already has information about votes
            if($_SESSION['voted_document'][$document_srl]) return new Object(-1, $failed_voted);
            // Pass if the author's IP address is as same as visitor's.
            if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
                $_SESSION['voted_document'][$document_srl] = true;
                return new Object(-1, $failed_voted);
            }
            // Check if document's author is a member.
            if($oDocument->get('member_srl')) {
                // Pass after registering a session if author's information is same as the currently logged-in user's.
                if($member_srl && $member_srl == $oDocument->get('member_srl')) {
                    $_SESSION['voted_document'][$document_srl] = true;
                    return new Object(-1, $failed_voted);
                }
            }
            // Use member_srl for logged-in members and IP address for non-members.
            if($member_srl) {
                $args->member_srl = $member_srl;
            } else {
                $args->ipaddress = $_SERVER['REMOTE_ADDR'];
            }
            $args->document_srl = $document_srl;
            $output = executeQuery('document.getDocumentVotedLogInfo', $args);
            // Pass after registering a session if log information has vote-up logs
            if($output->data->count) {
                $_SESSION['voted_document'][$document_srl] = true;
                return new Object(-1, $failed_voted);
            }
            // Update the voted count
            if($point < 0)
            {
                $args->blamed_count = $oDocument->get('blamed_count') + $point;
                $output = executeQuery('document.updateBlamedCount', $args);
            }
            else
            {
                $args->voted_count = $oDocument->get('voted_count') + $point;
                $output = executeQuery('document.updateVotedCount', $args);
            }
            if(!$output->toBool()) return $output;
            // Leave logs
            $args->point = $point;
            $output = executeQuery('document.insertDocumentVotedLog', $args);
            if(!$output->toBool()) return $output;
            // Leave in the session information
            $_SESSION['voted_document'][$document_srl] = true;
     
            $obj->member_srl = $oDocument->get('member_srl');
            $obj->module_srl = $oDocument->get('module_srl');
            $obj->document_srl = $oDocument->get('document_srl');
            $obj->update_target = ($point < 0) ? 'blamed_count' : 'voted_count';
            $obj->point = $point;
            $obj->before_point = ($point < 0) ? $oDocument->get('blamed_count') : $oDocument->get('voted_count');
            $obj->after_point = ($point < 0) ? $args->blamed_count : $args->voted_count;
            $output = ModuleHandler::triggerCall('document.updateVotedCount', 'after', $obj);
            if(!$output->toBool()) return $output;
        }
        // Return result
        if($point > 0)
        {
            return new Object(0, 'success_voted');
        }
        else
        {
            return new Object(0, 'success_blamed');
        }
    }
 
    /**
     * @brief Report posts
     **/
    function declaredDocument($document_srl) {
         
        // Create a member model object
        $oMemberModel = &getModel('member');
        $member_srl = $oMemberModel->getLoggedMemberSrl();
        $logged_info = Context::get('logged_info');
         
        // Get the original document
        $oDocumentModel = &getModel('document');
        $oDocument = $oDocumentModel->getDocument($document_srl, false, false);
         
        if ($logged_info->is_admin == 'Y') {
            $args->member_srl = $member_srl;
            $args->document_srl = $document_srl;
            $output = executeQuery('document.getDeclaredDocument', $args);
            if(!$output->toBool()) return $output;
            $declared_count = $output->data->declared_count;
             
            // Add the declared document
            if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
            else $output = executeQuery('document.insertDeclaredDocument', $args);
            if(!$output->toBool()) return $output;
            // Leave logs
            $output = executeQuery('document.insertDocumentDeclaredLog', $args);
     
            $this->setMessage('success_declared');
        }
        else {
            // Fail if session information already has a reported document
            if($_SESSION['declared_document'][$document_srl]) return new Object(-1, 'failed_declared');
            // Check if previously reported
            $args->document_srl = $document_srl;
            $output = executeQuery('document.getDeclaredDocument', $args);
            if(!$output->toBool()) return $output;
            $declared_count = $output->data->declared_count;
     
            // Pass if the author's IP address is as same as visitor's.
            /*if($oDocument->get('ipaddress') == $_SERVER['REMOTE_ADDR']) {
                $_SESSION['declared_document'][$document_srl] = true;
                return new Object(-1, 'failed_declared');
            }*/
            // Check if document's author is a member.
            if($oDocument->get('member_srl')) {
                // Pass after registering a session if author's information is same as the currently logged-in user's.
                if($member_srl && $member_srl == $oDocument->get('member_srl')) {
                    $_SESSION['declared_document'][$document_srl] = true;
                    return new Object(-1, 'failed_declared');
                }
            }
            // Use member_srl for logged-in members and IP address for non-members.
            if($member_srl) {
                $args->member_srl = $member_srl;
            } else {
                $args->ipaddress = $_SERVER['REMOTE_ADDR'];
            }
            $args->document_srl = $document_srl;
            $output = executeQuery('document.getDocumentDeclaredLogInfo', $args);
            // Pass after registering a sesson if reported/declared documents are in the logs.
            if($output->data->count) {
                $_SESSION['declared_document'][$document_srl] = true;
                return new Object(-1, 'failed_declared');
            }
            // Add the declared document
            if($declared_count > 0) $output = executeQuery('document.updateDeclaredDocument', $args);
            else $output = executeQuery('document.insertDeclaredDocument', $args);
            if(!$output->toBool()) return $output;
            // Leave logs
            $output = executeQuery('document.insertDocumentDeclaredLog', $args);
            // Leave in the session information
            $_SESSION['declared_document'][$document_srl] = true;
     
            $this->setMessage('success_declared');
            }
        }



리눅스

유용한 정보 및 자료

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
104 XE XE 추천수가 일정수준을 넘으면 게시판 이동시키기 6 보석 2013.03.07 27084
103 XE XE 추천수 비추천수 문구 수정 보석 2012.01.13 16526
102 XE XE 추천수 5이상일때 게시글 이동 보석 2012.03.02 14243
101 XE XE 추천/비추천 버튼 노출 애드온 비추천 없애는 방법 file 보석 2012.03.02 14011
» XE XE 추천, 신고 제한 해제 (관리자만 v1.5.2.2) 보석 2012.05.24 19542
99 XE XE 추천 비추천시 새로고침 없이 적용하기 보석 2013.02.17 19523
98 XE XE 추천 비추천수 로그확인 보석 2011.09.07 18801
97 XE XE 추천 누른 사람 출력되게 하는방법 보석 2012.03.02 13883
96 XE XE 최근게시물에 움직이는 GIF 출력하기 보석 2013.08.23 19050
95 XE XE 최근 친구글 출력 위젯 file 보석 2012.12.04 19521
94 XE xe 첨부파일 스팸필터 보석 2011.09.15 17129
93 XE XE 첨부파일 목록 그림 제거 2 보석 2011.12.29 20729
92 XE XE 쪽지 알림이 계속 나타나게 하기 보석 2012.03.14 13331
91 XE XE 지식인 오류 해결 보석 2012.09.14 12121
90 XE XE 정지된 회원 팝업 메시지에 정지사유 표현하기 file 보석 2013.08.25 20437
89 XE XE 자료저장용 슬라이드배너 file 보석 2012.01.31 11489
88 XE XE 자료저장용 링크게시판 1 file 보석 2012.01.31 12260
87 XE XE 자료저장용 gyQuickBox file 보석 2012.01.31 11184
86 XE XE 자기글에 댓글 작성시 포인트 증가 보석 2012.08.16 19351
85 XE XE 일정기간 로그인하지 않는 회원 삭제 1 보석 2012.04.26 14613
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11