]> git.ipfire.org Git - thirdparty/bugzilla.git/blob - show_activity.cgi
add a new hook: template_after_create (#60)
[thirdparty/bugzilla.git] / show_activity.cgi
1 #!/usr/bin/perl -T
2 # This Source Code Form is subject to the terms of the Mozilla Public
3 # License, v. 2.0. If a copy of the MPL was not distributed with this
4 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 #
6 # This Source Code Form is "Incompatible With Secondary Licenses", as
7 # defined by the Mozilla Public License, v. 2.0.
8
9 use 5.10.1;
10 use strict;
11 use warnings;
12
13 use lib qw(. lib);
14
15 use Bugzilla;
16 use Bugzilla::Error;
17 use Bugzilla::Bug;
18
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 # Make sure the bug ID is a positive integer representing an existing
31 # 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 # Run queries against the shadow DB. In the worst case, new changes are not
40 # visible immediately due to replication lag.
41 Bugzilla->switch_to_shadow_db;
42
43 ($vars->{'operations'}, $vars->{'incomplete_data'}) = $bug->get_activity(undef, undef, 1);
44
45 $vars->{'bug'} = $bug;
46
47 print $cgi->header();
48
49 $template->process("bug/activity/show.html.tmpl", $vars)
50 || ThrowTemplateError($template->error());