<?php
/*=====================================================================*\
|| ###################################################################
-|| # Bugdar [#]version[#]
-|| # Copyright ©2002-[#]year[#] Iris Studios, Inc.
+|| # Bugdar
+|| # Copyright (c)2004-2009 Blue Static
|| #
|| # This program is free software; you can redistribute it and/or modify
|| # it under the terms of the GNU General Public License as published by
-|| # the Free Software Foundation; version [#]gpl[#] of the License.
+|| # the Free Software Foundation; version 2 of the License.
|| #
|| # This program is distributed in the hope that it will be useful, but
|| # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|| ###################################################################
\*=====================================================================*/
-define('SVN', '$Id$');
$focus['showreport'] = 'focus';
if (empty($_REQUEST['do']))
{
- $message->error($lang->getlex('error_invalid_id'));
+ $message->error(L_INVALID_ID);
}
// ###################################################################
if ($_REQUEST['do'] == 'vote')
{
- $bug = $db->query_first("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . intval($bugsys->in['bugid']) . ((!can_perform('canviewhidden')) ? " AND !hidden" : ''));
- $vote = $db->query_first("SELECT *, FIND_IN_SET(" . $bugsys->userinfo['userid'] . ", userids) AS uservote FROM " . TABLE_PREFIX . "vote WHERE bugid = $bug[bugid]");
+ $bug = $db->queryFirst("SELECT * FROM " . TABLE_PREFIX . "bug WHERE bugid = " . $input->inputClean('bugid', TYPE_UINT));
+ $vote = $db->queryFirst("SELECT *, FIND_IN_SET(" . bugdar::$userinfo['userid'] . ", userids) AS uservote FROM " . TABLE_PREFIX . "vote WHERE bugid = $bug[bugid]");
- if (!can_perform('canvote', $bug['productid']))
+ if (!check_bug_permissions($bug))
{
- $message->error_permission();
+ $message->errorPermission();
+ }
+
+ if (!can_perform('canvote', $bug['product']))
+ {
+ $message->errorPermission();
}
if (!$bug)
{
- $message->error($lang->getlex('error_invalid_id'));
+ $message->error(L_INVALID_ID);
}
if ($vote['uservote'])
{
- $message->error($lang->string('You have already voted on this bug.'));
+ $message->error(T('You have already voted on this bug.'));
}
// handle userids
$userids = $vote['userids'];
- if ($bugsys->userinfo['userid'])
+ if (bugdar::$userinfo['userid'])
{
if (trim($vote['userids']))
{
- $userids .= ',' . $bugsys->userinfo['userid'];
+ $userids .= ',' . bugdar::$userinfo['userid'];
}
else
{
- $userids = $bugsys->userinfo['userid'];
+ $userids = bugdar::$userinfo['userid'];
}
}
- $uservote = intval($bugsys->in['vote']);
+ $uservote = $input->inputClean('vote', TYPE_INT);
$votefor = $vote['votefor'];
$voteagainst = $vote['voteagainst'];
}
else
{
- $message->error($lang->string('You need to specify whether you want to vote for or against this bug.'));
+ $message->error(T('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($lang->string('Your vote has been added.'), "showreport.php?bugid=$bug[bugid]");
+ $message->redirect(T('Your vote has been added.'), "showreport.php?bugid=$bug[bugid]");
}
-/*=====================================================================*\
-|| ###################################################################
-|| # $HeadURL$
-|| # $Id$
-|| ###################################################################
-\*=====================================================================*/
?>
\ No newline at end of file