웹마스터 팁
page_full_width" class="col-xs-12" |cond="$__Context->page_full_width">
추천, 신고 제한 해제 (관리자만 v1.5.2.2)
2012.04.09 16:32
사이트를 운영하다보니 관리자에게만 가능한 몇가지들이 필요하더군요..
추천, 신고기능을 관리자만 제한을 해제하도록 수정하였습니다. 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'); } }
댓글 4
-
포토올/wow
2012.04.13 10:01
-
mugenk
2012.04.13 23:28
다른 많은 부분도 수정해서 쓰고 있기에.. 가지고 있는 파일을 올리기가 그랬습니다;
단순히 위 함수만 통째로 교체만 하면 되는 타입이라..; ^^;
-
포토올/wow
2012.04.15 09:03
넵...감사합니다...그런 남모를 속사정이 있었군요~^^*
성공했습니다.~^^*
-
ChoiJS
2012.08.10 10:55
1.5.3 적용 무리없이 잘 됩니다. 감사합니다. ^^
제목 | 글쓴이 | 날짜 |
---|---|---|
관리자페이지 게시판목록에서 일괄 권한 설정 안 되는 버그 수정법 [1] | sejin7940 | 2012.05.17 |
추천, 신고 제한 해제 (관리자만 v1.5.2.2) [4] | mugenk | 2012.04.09 |
관리자메뉴에 사이트메뉴 안나오시는분 수정 하세요!!
[5]
![]() | 박인영647 | 2012.02.16 |
v1.5 관리자 페이지에서 v1.4처럼 모듈 목록 펼쳐놓기
[14]
![]() | 우진홈 | 2012.01.21 |
XE관리자 메뉴 활용 방법 ^^
[24]
![]() | 똥똥 | 2011.12.09 |
갑자기 로그인(관리자 및 회원)이 안되는 경우 [2] | 비밀얌 | 2011.10.02 |
관리자 무한추천 팁과 추천인/비추천인 표시팁의 충돌 [1] | ForHanbi | 2011.09.10 |
회원 관리자 두기.. | DaKi | 2011.05.09 |
관리자페이지 회원목록을 일반페이지에서 사용하기(수정)
[4]
![]() | 늘푸른이 | 2011.04.27 |
갑자기 관리자 페이지가 안보이거나 330 오류가 날 때는 이렇게 해결!
[2]
![]() | 세라오빠 | 2011.04.13 |
관리자페이지 레이아웃에 게시판을 달아보자 [3] | 푸름빠 | 2011.03.29 |
관리자가 회원목록에서 한번에 보이는 회원수 늘리고플때 | sejin7940 | 2011.02.10 |
게시판 관리자 표시하기...
[6]
![]() | 카르마 | 2011.02.05 |
에러페이지를 서버관리자가 지정한 페이지로. [1] | teenteenv | 2002.02.21 |
관리자모드 - 관리자그룹만 모든 회원리스트보기 [2] | 이지혜609 | 2007.10.23 |
세션을 이용한 관리자 모드 구축하기 3강 [6] | 박정호 | 2003.12.09 |
세션을 이용한 관리자 모드 구축하기 2강 [6] | 박정호 | 2003.12.09 |
세션을 이용한 관리자 모드 구축하기 1강(중복?) | 박정호 | 2003.12.09 |
홈페이지 관리자 모드 구축하기 (HTTP 인증, 중복 맞음)
[10]
![]() | 9000㎒ | 2003.11.01 |
{로그인}관리자 로그인 폼 간단함 [2] | 김민환 | 2006.10.10 |
좋은 정보 감사합니다.
같은 값이면 완성된 파일을 첨부해서 올려주시면 더 좋을텐데요~~.^^*
감사합니다.