show_activity.cgi 1.52 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/.
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
use lib qw(. lib);
12

13
use Bugzilla;
14
use Bugzilla::Error;
15 16
use Bugzilla::Bug;

17
my $cgi = Bugzilla->cgi;
18 19
my $template = Bugzilla->template;
my $vars = {};
20

21
###############################################################################
22
# Begin Data/Security Validation
23
###############################################################################
24

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

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

33
###############################################################################
34
# End Data/Security Validation
35
###############################################################################
36

37 38 39 40
# 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;

41
($vars->{'operations'}, $vars->{'incomplete_data'}) = $bug->get_activity(undef, undef, 1);
42

43
$vars->{'bug'} = $bug;
44

45
print $cgi->header();
46

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