Index: branches/5.2.x/core/kernel/db/cat_event_handler.php =================================================================== diff -u -N -r14736 -r14780 --- branches/5.2.x/core/kernel/db/cat_event_handler.php (.../cat_event_handler.php) (revision 14736) +++ branches/5.2.x/core/kernel/db/cat_event_handler.php (.../cat_event_handler.php) (revision 14780) @@ -1,6 +1,6 @@ Application->GetVar('ajax') == 'yes' ) { + $event->status = kEvent::erSTOP; + } + $review_id = (int)$this->Application->GetVar('review_id'); if ( !$review_id ) { @@ -2835,13 +2839,21 @@ /* @var $spam_helper SpamHelper */ $spam_helper->InitHelper($review_id, 'ReviewHelpful', strtotime('+1 month') - strtotime('now')); + $field = (int)$this->Application->GetVar('helpful') ? 'HelpfulCount' : 'NotHelpfulCount'; + $sql = 'SELECT ' . $field . ' + FROM ' . $this->Application->getUnitOption('rev', 'TableName') . ' + WHERE ' . $this->Application->getUnitOption('rev', 'IDField') . ' = ' . $review_id; + $count = $this->Conn->GetOne($sql); + if ( $spam_helper->InSpamControl() ) { + if ( $this->Application->GetVar('ajax') == 'yes' ) { + echo $count; + } + return; } - $field = (int)$this->Application->GetVar('helpful') ? 'HelpfulCount' : 'NotHelpfulCount'; - $sql = 'UPDATE ' . $this->Application->getUnitOption('rev', 'TableName') . ' SET ' . $field . ' = ' . $field . ' + 1 WHERE ' . $this->Application->getUnitOption('rev', 'IDField') . ' = ' . $review_id; @@ -2851,6 +2863,10 @@ // db was changed -> review with such ID exists $spam_helper->AddToSpamControl(); } + + if ( $this->Application->GetVar('ajax') == 'yes' ) { + echo $count + 1; + } } /**