error(L_INVALID_ID); } // ################################################################### if ($_REQUEST['do'] == 'vote') { $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $bugsys->input_clean('bugid', TYPE_UINT)); $vote = $db->query_first("SELECT *, FIND_IN_SET(" . $bugsys->userinfo['userid'] . ", userids) AS uservote FROM " . TABLE_PREFIX . "vote WHERE bugid = $bug[bugid]"); if (!check_bug_permissions($bug)) { $message->errorPermission(); } if (!can_perform('canvote', $bug['product'])) { $message->errorPermission(); } if (!$bug) { $message->error(L_INVALID_ID); } if ($vote['uservote']) { $message->error(_('You have already voted on this bug.')); } // handle userids $userids = $vote['userids']; if ($bugsys->userinfo['userid']) { if (trim($vote['userids'])) { $userids .= ',' . $bugsys->userinfo['userid']; } else { $userids = $bugsys->userinfo['userid']; } } $uservote = $bugsys->input_clean('vote', TYPE_INT); $votefor = $vote['votefor']; $voteagainst = $vote['voteagainst']; if ($uservote > 0) { $votefor++; } else if ($uservote < 0) { $voteagainst++; } else { $message->error(_('You need to specify whether you want to vote for or against this bug.')); } $db->query("UPDATE " . TABLE_PREFIX . "vote SET userids = '$userids', votefor = $votefor, voteagainst = $voteagainst WHERE bugid = $bug[bugid]"); $message->redirect(_('Your vote has been added.'), "showreport.php?bugid=$bug[bugid]"); } /*=====================================================================*\ || ################################################################### || # $HeadURL$ || # $Id$ || ################################################################### \*=====================================================================*/ ?>