show_activity.cgi 1.54 KB
Newer Older
1
#!/usr/bin/perl -T
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/.
terry%netscape.com's avatar
terry%netscape.com committed
5
#
6 7
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.
terry%netscape.com's avatar
terry%netscape.com committed
8

9
use 5.10.1;
10
use strict;
11 12
use warnings;

13
use lib qw(. lib);
14

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

19
my $cgi      = Bugzilla->cgi;
20
my $template = Bugzilla->template;
21
my $vars     = {};
22

23
###############################################################################
24
# Begin Data/Security Validation
25
###############################################################################
26

27
# Check whether or not the user is currently logged in.
28
Bugzilla->login();
29 30 31

# Make sure the bug ID is a positive integer representing an existing
# bug that the user is authorized to access.
32
my $id  = $cgi->param('id');
33
my $bug = Bugzilla::Bug->check($id);
34

35
###############################################################################
36
# End Data/Security Validation
37
###############################################################################
38

39 40 41 42
# Run queries against the shadow DB. In the worst case, new changes are not
# visible immediately due to replication lag.
Bugzilla->switch_to_shadow_db;

43 44
($vars->{'operations'}, $vars->{'incomplete_data'})
  = $bug->get_activity(undef, undef, 1);
45

46
$vars->{'bug'} = $bug;
47

48
print $cgi->header();
49

50 51
$template->process("bug/activity/show.html.tmpl", $vars)
  || ThrowTemplateError($template->error());