mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Squelch warning in pkgbase_vote()
Do not trigger a PHP warning if there are no votes to be added or removed. Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
92f140c5ca
commit
06cf067d4f
1 changed files with 17 additions and 13 deletions
|
@ -735,6 +735,8 @@ function pkgbase_vote ($base_ids, $action=true) {
|
|||
$uid = uid_from_sid($_COOKIE["AURSID"]);
|
||||
|
||||
$first = 1;
|
||||
$vote_ids = "";
|
||||
$vote_clauses = "";
|
||||
foreach ($base_ids as $pid) {
|
||||
if ($action) {
|
||||
$check = !isset($my_votes[$pid]);
|
||||
|
@ -758,6 +760,7 @@ function pkgbase_vote ($base_ids, $action=true) {
|
|||
}
|
||||
}
|
||||
|
||||
if (!empty($vote_ids)) {
|
||||
/* Only add votes for packages the user hasn't already voted for. */
|
||||
$op = $action ? "+" : "-";
|
||||
$q = "UPDATE PackageBases SET NumVotes = NumVotes $op 1 ";
|
||||
|
@ -774,6 +777,7 @@ function pkgbase_vote ($base_ids, $action=true) {
|
|||
}
|
||||
|
||||
$dbh->exec($q);
|
||||
}
|
||||
|
||||
if ($action) {
|
||||
return array(true, __("Your votes have been cast for the selected packages."));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue