diff --git a/common/lang/en.php b/common/lang/en.php index 5f9b3325d..99dfc2c60 100644 --- a/common/lang/en.php +++ b/common/lang/en.php @@ -281,11 +281,18 @@ $lang->fail_to_registed = 'Failed to register.'; $lang->fail_to_update = 'Fail to update.'; $lang->fail_to_delete = 'Failed to delete.'; $lang->fail_to_move = 'Failed to move.'; -$lang->failed_voted = 'No permission to upvote.'; +$lang->failed_voted = 'No permission to upvote this post.'; +$lang->failed_voted_already = 'You have already voted on this post.'; +$lang->failed_voted_self = 'You cannot upvote your own post.'; $lang->failed_voted_canceled = 'You cannot cancel an upvote that you did\'t make.'; -$lang->failed_blamed = 'No permission to downvote.'; +$lang->failed_voted_cancel = 'You cannot cancel an upvote.'; +$lang->failed_blamed = 'No permission to downvote this post.'; +$lang->failed_blamed_self = 'You cannot downvote your own post.'; $lang->failed_blamed_canceled = 'You cannot cancel a downvote that you did\'t make.'; -$lang->failed_declared = 'No permission to Report.'; +$lang->failed_blamed_cancel = 'You cannot cancel a downvote.'; +$lang->failed_declared = 'No permission to report this post.'; +$lang->failed_declared_already = 'You have already reported this post.'; +$lang->failed_declared_self = 'You cannot report your own post.'; $lang->failed_declared_cancel = 'You cannot cancel the report.'; $lang->fail_to_delete_have_children = 'Cannot delete the article with comments.'; $lang->confirm_submit = 'Are you sure you want to submit?'; diff --git a/common/lang/ko.php b/common/lang/ko.php index f605fed42..8aeeca919 100644 --- a/common/lang/ko.php +++ b/common/lang/ko.php @@ -284,11 +284,17 @@ $lang->fail_to_update = '수정하지 못했습니다.'; $lang->fail_to_delete = '삭제 실패했습니다.'; $lang->fail_to_move = '이동 실패했습니다.'; $lang->failed_voted = '추천할 수 없습니다.'; +$lang->failed_voted_already = '이미 추천 또는 비추천한 게시물입니다.'; +$lang->failed_voted_self = '자신의 게시물을 추천할 수 없습니다.'; $lang->failed_voted_canceled = '추천한 적이 없으므로 취소할 수 없습니다.'; $lang->failed_voted_cancel = '추천을 취소할 수 없습니다.'; $lang->failed_blamed = '비추천할 수 없습니다.'; +$lang->failed_blamed_self = '자신의 게시물을 비추천할 수 없습니다.'; $lang->failed_blamed_canceled = '비추천한 적이 없으므로 취소할 수 없습니다.'; +$lang->failed_blamed_cancel = '비추천을 취소할 수 없습니다.'; $lang->failed_declared = '신고할 수 없습니다.'; +$lang->failed_declared_already = '이미 신고한 게시물입니다.'; +$lang->failed_declared_self = '자신의 게시물을 신고할 수 없습니다.'; $lang->failed_declared_cancel = '신고를 취소할 수 없습니다.'; $lang->fail_to_delete_have_children = '댓글이 있어서 삭제할 수 없습니다.'; $lang->confirm_submit = '등록하시겠습니까?'; diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index 27c243016..195ce2f70 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -266,7 +266,8 @@ class CommentController extends Comment function updateVotedCountCancel($comment_srl, $oComment, $point) { - if(!$_SESSION['voted_comment'][$comment_srl] && !$this->user->member_srl) + // Guests can only cancel votes that are registered in the current session. + if(!$this->user->member_srl && empty($_SESSION['voted_comment'][$comment_srl])) { return new BaseObject(-1, $point > 0 ? 'failed_voted_canceled' : 'failed_blamed_canceled'); } @@ -1568,9 +1569,9 @@ class CommentController extends Comment } // invalid vote if vote info exists in the session info. - if($_SESSION['voted_comment'][$comment_srl]) + if(!empty($_SESSION['voted_comment'][$comment_srl])) { - return new BaseObject(-1, $failed_voted); + return new BaseObject(-1, $failed_voted . '_already'); } // Get the original comment @@ -1592,7 +1593,7 @@ class CommentController extends Comment if($member_srl && $member_srl == abs($oComment->get('member_srl'))) { $_SESSION['voted_comment'][$comment_srl] = false; - return new BaseObject(-1, $failed_voted); + return new BaseObject(-1, $failed_voted . '_self'); } } @@ -1687,9 +1688,9 @@ class CommentController extends Comment function declaredComment($comment_srl, $declare_message) { // Fail if session information already has a reported document - if(isset($_SESSION['declared_comment'][$comment_srl])) + if(!empty($_SESSION['declared_comment'][$comment_srl])) { - return new BaseObject(-1, 'failed_declared'); + return new BaseObject(-1, 'failed_declared_already'); } // check if already reported @@ -1738,7 +1739,7 @@ class CommentController extends Comment if($member_srl && $member_srl == abs($oComment->get('member_srl'))) { $_SESSION['declared_comment'][$comment_srl] = FALSE; - return new BaseObject(-1, 'failed_declared'); + return new BaseObject(-1, 'failed_declared_self'); } } @@ -1757,7 +1758,7 @@ class CommentController extends Comment if($log_output->data->count) { $_SESSION['declared_comment'][$comment_srl] = FALSE; - return new BaseObject(-1, 'failed_declared'); + return new BaseObject(-1, 'failed_declared_already'); } // Fill in remaining information for logging. diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index caf03fbfb..dfe23d2a8 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -285,7 +285,8 @@ class DocumentController extends Document */ function updateVotedCountCancel($document_srl, $oDocument, $point) { - if(!$_SESSION['voted_document'][$document_srl] && !$this->user->member_srl) + // Guests can only cancel votes that are registered in the current session. + if(!$this->user->member_srl && empty($_SESSION['voted_document'][$document_srl])) { return new BaseObject(-1, $point > 0 ? 'failed_voted_canceled' : 'failed_blamed_canceled'); } @@ -1800,9 +1801,9 @@ class DocumentController extends Document } // Return fail if session already has information about votes - if($_SESSION['voted_document'][$document_srl]) + if(!empty($_SESSION['voted_document'][$document_srl])) { - return new BaseObject(-1, $failed_voted); + return new BaseObject(-1, $failed_voted . '_already'); } // Get the original document @@ -1824,7 +1825,7 @@ class DocumentController extends Document if($member_srl && $member_srl == abs($oDocument->get('member_srl'))) { $_SESSION['voted_document'][$document_srl] = false; - return new BaseObject(-1, $failed_voted); + return new BaseObject(-1, $failed_voted . '_self'); } } @@ -1931,9 +1932,9 @@ class DocumentController extends Document function declaredDocument($document_srl, $declare_message = '') { // Fail if session already tried to report the document - if(isset($_SESSION['declared_document'][$document_srl])) + if(!empty($_SESSION['declared_document'][$document_srl])) { - return new BaseObject(-1, 'failed_declared'); + return new BaseObject(-1, 'failed_declared_already'); } // Check if previously reported @@ -1982,7 +1983,7 @@ class DocumentController extends Document if($member_srl && $member_srl == abs($oDocument->get('member_srl'))) { $_SESSION['declared_document'][$document_srl] = false; - return new BaseObject(-1, 'failed_declared'); + return new BaseObject(-1, 'failed_declared_self'); } } @@ -2001,7 +2002,7 @@ class DocumentController extends Document if($output->data->count) { $_SESSION['declared_document'][$document_srl] = false; - return new BaseObject(-1, 'failed_declared'); + return new BaseObject(-1, 'failed_declared_already'); } // Fill in remaining information for logging.