if ($current_user->user_id == 0 && !anonymous_vote) { error($main_smarty->get_config_vars('PLIGG_Visual_Vote_NoAnon')); } $post_user = sanitize($_POST['user'], 3); if ($current_user->user_id != $post_user) { error($main_smarty->get_config_vars('PLIGG_Visual_Vote_BadUser') . $current_user->user_id . '-' . $post_user); } $md5 = md5($post_user . $link->randkey); if ($md5 !== sanitize($_POST['md5'], 3)) { error($main_smarty->get_config_vars('PLIGG_Visual_Vote_BadKey')); } $value = sanitize($_POST['value'], 3); if (sanitize($_POST['unvote'], 3) == 'true') { $link->remove_vote($current_user->user_id, $value); } else { if ($link->votes($current_user->user_id) > 0 || $link->reports($current_user->user_id) > 0 || votes_per_ip > 0 && $link->votes_from_ip() + $link->reports_from_ip() >= votes_per_ip) { ///// error($main_smarty->get_config_vars('PLIGG_Visual_Vote_AlreadyVoted')); } $link->insert_vote($current_user->user_id, $value); } if ($link->status == 'discard') { $link->read(); $link->status = 'queued'; $link->store(); } if (Voting_Method == 2) { $link_rating = $link->rating($link->id) / 2; $rating_width = $link_rating * 25; $vote_count = $link->countvotes(); echo $rating_width . "~" . $link_rating . "~" . $vote_count . "~<li class='one-star-noh'>1</li><li class='two-stars-noh'>2</li><li class='three-stars-noh'>3</li><li class='four-stars-noh'>4</li><li class='five-stars-noh'>5</li>";
} $md5 = md5($post_user . $link->randkey); if ($md5 !== sanitize($_POST['md5'], 3)) { error($main_smarty->get_config_vars('PLIGG_Visual_Vote_BadKey')); } $value = intval($_POST['value']); if (sanitize($_POST['unvote'], 3) == 'true') { $link->remove_vote($current_user->user_id, $value); } else { //Checking for ip vote if ($current_user->user_id != 0) { if ($link->votes($current_user->user_id) > 0) { error($main_smarty->get_config_vars('PLIGG_Visual_Vote_AlreadyVoted') . $link->votes($current_user->user_id) . '/' . $value); } } else { if ($value == 10 && votes_per_ip > 0 && $link->votes_from_ip() >= votes_per_ip + 1) { error($main_smarty->get_config_vars('PLIGG_Visual_Vote_AlreadyVoted') . '/' . $value); } if ($value == -10 && votes_per_ip > 0 && $link->reports_from_ip() >= votes_per_ip + 1) { error($main_smarty->get_config_vars('PLIGG_Visual_Vote_AlreadyVoted') . '/' . $value); } } /* if($link->votes($current_user->user_id, 10) > 0 || $link->votes($current_user->user_id, -10) > 0 || (votes_per_ip > 0 && $link->votes_from_ip() + $link->reports_from_ip() >= votes_per_ip)) { //error($main_smarty->get_config_vars('PLIGG_Visual_Vote_AlreadyVoted').$link->votes($current_user->user_id, $value).'/'.$value); }*/ // ***** The remove_vote was to offset the double update of insert_vote that was wrongly done. We don't need it ***** //$link->remove_vote($current_user->user_id, -$value); $link->insert_vote($current_user->user_id, $value); } if ($link->status == 'discard') {