2 /*=====================================================================*\
3 || ################################################################### ||
4 || # BugStrike [#]version[#]
5 || # --------------------------------------------------------------- # ||
6 || # Copyright ©2002-[#]year[#] by Iris Studios, Inc. All Rights Reserved. # ||
7 || # This file may not be reproduced in any way without permission. # ||
8 || # --------------------------------------------------------------- # ||
9 || # User License Agreement at http://www.iris-studios.com/license/ # ||
10 || ################################################################### ||
11 \*=====================================================================*/
13 define('SVN', '$Id$');
15 require_once('./global.php');
17 // ###################################################################
19 if (empty($_REQUEST['do']))
21 $message->error(lang
::p('error_invalid_id'));
24 // ###################################################################
26 if ($_REQUEST['do'] == 'vote')
28 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "bug WHERE bugid = " . intval($bugsys->in
['bugid']) . ((!can_perform('canviewhidden')) ?
" AND !bug.hidden" : ''));
29 $vote = $db->query_first("SELECT *, FIND_IN_SET(" . $bugsys->userinfo
['userid'] . ", userids) AS uservote FROM " . TABLE_PREFIX
. "vote WHERE bugid = $bug[bugid]");
33 $message->error(lang
::p('error_invalid_id'));
36 if ($vote['uservote'])
38 $message->error('you have already voted on this bug');
42 $userids = $vote['userids'];
43 if ($bugsys->userinfo
['userid'])
45 if (trim($vote['userids']))
47 $userids .= ',' . $bugsys->userinfo
['userid'];
51 $userids = $bugsys->userinfo
['userid'];
55 $uservote = intval($bugsys->in
['vote']);
57 $votefor = $vote['votefor'];
58 $voteagainst = $vote['voteagainst'];
69 $db->query("UPDATE " . TABLE_PREFIX
. "vote SET userids = '$userids', votefor = $votefor, voteagainst = $voteagainst WHERE bugid = $bug[bugid]");
71 $message->redirect('your vote has been added', "showreport.php?bugid=$bug[bugid]");
74 /*=====================================================================*\
75 || ###################################################################
78 || ###################################################################
79 \*=====================================================================*/