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 $focus['showreport'] = 'focus';
17 require_once('./global.php');
19 // ###################################################################
21 if (empty($_REQUEST['do']))
23 $message->error($lang->getlex('error_invalid_id'));
26 // ###################################################################
28 if ($_REQUEST['do'] == 'vote')
30 $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX
. "bug WHERE bugid = " . intval($bugsys->in
['bugid']) . ((!can_perform('canviewhidden')) ?
" AND !bug.hidden" : ''));
31 $vote = $db->query_first("SELECT *, FIND_IN_SET(" . $bugsys->userinfo
['userid'] . ", userids) AS uservote FROM " . TABLE_PREFIX
. "vote WHERE bugid = $bug[bugid]");
33 if (!can_perform('canvote', $bug['productid']))
35 $message->error_permission();
40 $message->error($lang->getlex('error_invalid_id'));
43 if ($vote['uservote'])
45 $message->error($lang->string('You have already voted on this bug.'));
49 $userids = $vote['userids'];
50 if ($bugsys->userinfo
['userid'])
52 if (trim($vote['userids']))
54 $userids .= ',' . $bugsys->userinfo
['userid'];
58 $userids = $bugsys->userinfo
['userid'];
62 $uservote = intval($bugsys->in
['vote']);
64 $votefor = $vote['votefor'];
65 $voteagainst = $vote['voteagainst'];
76 $db->query("UPDATE " . TABLE_PREFIX
. "vote SET userids = '$userids', votefor = $votefor, voteagainst = $voteagainst WHERE bugid = $bug[bugid]");
78 $message->redirect($lang->string('Your vote has been added.'), "showreport.php?bugid=$bug[bugid]");
81 /*=====================================================================*\
82 || ###################################################################
85 || ###################################################################
86 \*=====================================================================*/