From c2b78f4468525d15fc53471c7d8a1d0f30de0057 Mon Sep 17 00:00:00 2001 From: qw5414 Date: Sat, 23 Jan 2016 19:22:11 +0900 Subject: [PATCH] =?UTF-8?q?=EC=BD=94=EB=93=9C=20=EA=B0=9C=EC=84=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules/document/document.controller.php | 12 ++++++------ modules/document/document.item.php | 16 ++++------------ 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index 1fe270edb..3c9a81cae 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -133,8 +133,8 @@ class documentController extends document /** * Update Document Voted Cancel - * @param stdClass $args - * @param stdClass $d_args + * @param int $document_srl + * @param Document $oDocument * @param int $point * @return object */ @@ -148,12 +148,12 @@ class documentController extends document $d_args->member_srl = $logged_info->member_srl; if($point > 0) { - $args->voted_count = $oDocument->get('voted_count') - 1; + $args->voted_count = $oDocument->get('voted_count') - $point; $output = executeQuery('document.updateVotedCount', $args); } else { - $args->blamed_count = $oDocument->get('blamed_count') + 1; + $args->blamed_count = $oDocument->get('blamed_count') - $point; $output = executeQuery('document.updateBlamedCount', $args); } $d_output = executeQuery('document.deleteDocumentVotedLog', $d_args); @@ -1295,14 +1295,14 @@ class documentController extends document { $args->blamed_count = $oDocument->get('blamed_count') + $point; // Leave in the session information - $_SESSION['voted_document'][$document_srl] = -1; + $_SESSION['voted_document'][$document_srl] = $point; $output = executeQuery('document.updateBlamedCount', $args); } else { $args->voted_count = $oDocument->get('voted_count') + $point; // Leave in the session information - $_SESSION['voted_document'][$document_srl] = 1; + $_SESSION['voted_document'][$document_srl] = $point; $output = executeQuery('document.updateVotedCount', $args); } if(!$output->toBool()) return $output; diff --git a/modules/document/document.item.php b/modules/document/document.item.php index aa6486d21..f78475e84 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -372,13 +372,9 @@ class documentItem extends Object function getVoted() { if(!$this->document_srl) return; - if($_SESSION['voted_document'][$this->document_srl] == '1') + if($_SESSION['voted_document'][$this->document_srl]) { - return 1; - } - else if($_SESSION['voted_document'][$this->document_srl] == '-1') - { - return -1; + return $_SESSION['voted_document'][$this->document_srl]; } $logged_info = Context::get('logged_info'); @@ -388,13 +384,9 @@ class documentItem extends Object $args->document_srl = $this->document_srl; $output = executeQuery('document.getDocumentVotedLog', $args); - if($output->data->point === '1') + if($output->data->point) { - return 1; - } - else if($output->data->point === '-1') - { - return -1; + return $output->data->point; } return false;