votes.cgi 1.11 KB
Newer Older
1
#!/usr/bin/perl -wT
2 3 4
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
#
6 7
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
8 9 10

# This script remains as a backwards-compatibility URL for before
# the time that Voting was an extension.
11

12
use 5.10.1;
13
use strict;
14
use lib qw(. lib);
15

16
use Bugzilla;
17
use Bugzilla::Error;
18

19 20
my $is_enabled = grep { $_->NAME eq 'Voting' } @{ Bugzilla->extensions };
$is_enabled || ThrowCodeError('extension_disabled', { name => 'Voting' });
21

22 23
my $cgi = Bugzilla->cgi;
my $action = $cgi->param('action') || 'show_user';
24 25

if ($action eq "show_bug") {
26 27
    $cgi->delete('action');
    $cgi->param('id', 'voting/bug.html');
28
} 
29 30 31
elsif ($action eq "show_user" or $action eq 'vote') {
    $cgi->delete('action') unless $action eq 'vote';
    $cgi->param('id', 'voting/user.html');
32 33
}
else {
34
    ThrowUserError('unknown_action', {action => $action});
35 36
}

37
print $cgi->redirect('page.cgi?' . $cgi->query_string);
38
exit;