2 || $rating < -2)) {
show_result_page(false, NULL, $choice);
}
$post = new Post($postId);
$thread = $post->getThread();
$forum = $thread->getForum();
/* Make sure the user has the forum's minimum amount of RAC and total credit
* before allowing them to rate a post.
*/
if ($user->getTotalCredit()<$forum->getRateMinTotalCredit() || $user->getExpavgCredit()<$forum->getRateMinExpavgCredit()) {
error_page("You need more average or total credit to rate a post.");
}
if ($post->hasRated($user)) {
$post_thread = $post->getThread();
error_page("You have already rated this post once.
getID()."#".$post->getID()."\">Return to thread");
} else {
$success = $post->rate($user, $rating);
show_result_page($success, $post, $choice);
}
}
function show_result_page($success, $post, $choice) {
if ($success) {
if ($choice) {
page_head('Input Recorded');
echo "
Your input has been successfully recorded. Thank you for your help.
"; } else { page_head('Vote Registered'); echo "Vote Registered"; echo "Your rating has been successfully recorded. Thank you for your input.
"; } $post_thread = $post->getThread(); echo "getID(), "#", $post->getID(), "\">Return to thread"; } else { page_head('Vote Submission Problem'); echo "Vote submission failed"; if ($post) { echo "There was a problem recording your vote in our database. Please try again later.
"; $post_thread = $post->getThread(); echo "getID(), "#", $post->getID(), "\">Return to thread"; } else { echo "There post you specified does not exist, or your rating was invalid.
"; } } page_tail(); exit; } ?>