/**
* cached return value of getVotes
- * @var int|bool $votes
+ * @var bool|array $votes
*/
var $votes = false;
/**
* cached return value of getVoters
- * @var int|bool $voters
+ * @var bool|array $voters
*/
var $voters = false;
return $this->votes;
}
- $voters = $this->getVoters();
- unset($voters[0]); /* just in case */
- unset($voters[100]); /* need users */
- if (($numvoters = count($voters)) < 1) {
+ $lvoters = $this->getVoters();
+ unset($lvoters[0]); /* just in case */
+ unset($lvoters[100]); /* need users */
+ if (($numvoters = count($lvoters)) < 1) {
$this->votes = array(0, 0, 0);
return $this->votes;
}
$res = db_query_params('SELECT COUNT(*) AS count FROM frs_release_votes WHERE release_id = $1 AND user_id = ANY($2)',
- array($this->getID(), db_int_array_to_any_clause($voters)));
+ array($this->getID(), db_int_array_to_any_clause($lvoters)));
$db_count = db_fetch_array($res);
$numvotes = $db_count['count'];
if ($numvotes < 0 || $numvoters < $numvotes) {
$this->votes = array(-1, -1, 0);
} else {
- $this->votes = array($numvotes, $numvoters,
- (int)($numvotes * 100 / $numvoters + 0.5));
+ $this->votes = array($numvotes, $numvoters, (int)($numvotes * 100 / $numvoters + 0.5));
}
return $this->votes;
}
$this->voters = array();
if (($engine = RBACEngine::getInstance())
- && ($voters = $engine->getUsersByAllowedAction('frs', $this->getID(), 'read'))
- && (count($voters) > 0)) {
- foreach ($voters as $voter) {
+ && ($lvoters = $engine->getUsersByAllowedAction('frs', $this->getID(), 'read'))
+ && (count($lvoters) > 0)) {
+ foreach ($lvoters as $voter) {
$voter_id = $voter->getID();
$this->voters[$voter_id] = $voter_id;
}