로그인

검색

조회 수 19721 추천 수 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
번호 분류 제목 글쓴이 날짜 조회 수
124 XE XE 게시글 기본양식 게시판에 등록 하기 보석 2013.01.28 22675
123 XE XE 위젯 이미지 클릭시 확장변후 링크로 이동 보석 2013.01.18 16474
122 XE XE CSS, JS파일, gzip으로 한꺼번에 압축해서 전송하기 gzip압축 디렉터리로 시스템 메모리 사용하기 보석 2013.01.16 18871
121 XE [XE] 위젯 스타일 제목 클릭시 해당 게시판으로 링크 걸기 3 file 보석 2012.12.04 19415
120 XE XE 최근 친구글 출력 위젯 file 보석 2012.12.04 19986
119 Server 우분투 innoDB 활성화하기 보석 2012.11.16 9004
118 XE XE DB 오류 해결방법 입니다. 보석 2012.11.12 18281
117 Server 우분투 업데이트 서버 변경 보석 2012.11.11 12230
116 Server 우분투 트림활성화 및 수동 트림하기 보석 2012.11.04 20311
115 XE XE 관리그룹만 글쓰기버튼 보이게 하기 보석 2012.11.02 32118
114 Server 우분투 레이드0 설치 install Ubuntu RAID0 보석 2012.10.23 12286
113 XE XE 닉네임 아이디 패스워드 길이제한 하기 보석 2012.10.20 13404
112 XE XE 1.4 스팸필터 1.5호환 file 보석 2012.10.05 13094
111 Pydio 웹하드 솔루션 - AjaXplorer 4.0 한글패치 file 보석 2012.09.30 10494
110 XE [XE] 관리자 페이지 댓글 목록수 변경 보석 2012.09.25 14899
109 XE XE 닉네임 글자수 제한 보석 2012.09.19 31307
108 XE [XE] 회원 정보에 순위(랭킹) 출력 보석 2012.09.18 13672
107 XE XE 지식인 오류 해결 보석 2012.09.14 12229
106 XE XE 게시물 자동삭제 애드온 file 보석 2012.09.13 14773
105 XE XE 포인트 수정 최고관리자만 가능 2 보석 2012.09.09 14503
Board Pagination Prev 1 2 3 4 5 6 7 8 9 10 11 Next
/ 11