summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Bugzilla/Flag.pm13
-rw-r--r--Bugzilla/Template.pm4
-rw-r--r--Bugzilla/Token.pm14
-rw-r--r--Bugzilla/User.pm9
-rwxr-xr-xattachment.cgi4
-rwxr-xr-xbuglist.cgi4
-rwxr-xr-xchart.cgi3
-rwxr-xr-xcolchange.cgi4
-rwxr-xr-xconfig.cgi2
-rwxr-xr-xcreateaccount.cgi6
-rwxr-xr-xdescribecomponents.cgi3
-rwxr-xr-xdescribekeywords.cgi5
-rwxr-xr-xduplicates.cgi4
-rwxr-xr-xeditcomponents.cgi4
-rwxr-xr-xeditflagtypes.cgi3
-rwxr-xr-xeditgroups.cgi4
-rwxr-xr-xeditkeywords.cgi5
-rwxr-xr-xeditmilestones.cgi4
-rwxr-xr-xeditparams.cgi3
-rwxr-xr-xeditproducts.cgi4
-rwxr-xr-xeditsettings.cgi4
-rwxr-xr-xeditusers.cgi3
-rwxr-xr-xeditversions.cgi4
-rwxr-xr-xeditwhines.cgi3
-rwxr-xr-xenter_bug.cgi4
-rw-r--r--globals.pl6
-rwxr-xr-xindex.cgi4
-rwxr-xr-xpage.cgi5
-rwxr-xr-xpost_bug.cgi6
-rwxr-xr-xprocess_bug.cgi4
-rwxr-xr-xquery.cgi4
-rwxr-xr-xquips.cgi4
-rwxr-xr-xreport.cgi4
-rwxr-xr-xreports.cgi22
-rwxr-xr-xrequest.cgi4
-rwxr-xr-xshow_activity.cgi3
-rwxr-xr-xshow_bug.cgi4
-rwxr-xr-xshowdependencygraph.cgi4
-rwxr-xr-xshowdependencytree.cgi5
-rwxr-xr-xsidebar.cgi6
-rwxr-xr-xsummarize_time.cgi6
-rwxr-xr-xtoken.cgi8
-rwxr-xr-xuserprefs.cgi5
-rwxr-xr-xvotes.cgi5
44 files changed, 118 insertions, 111 deletions
diff --git a/Bugzilla/Flag.pm b/Bugzilla/Flag.pm
index 54a8bea80..6f0cb94cc 100644
--- a/Bugzilla/Flag.pm
+++ b/Bugzilla/Flag.pm
@@ -74,10 +74,6 @@ use Bugzilla::BugMail;
use Bugzilla::Constants;
use Bugzilla::Field;
-# Note that this line doesn't actually import these variables for some reason,
-# so I have to use them as $::template and $::vars in the package code.
-use vars qw($template $vars);
-
######################################################################
# Global Variables
######################################################################
@@ -947,6 +943,9 @@ Sends an email notification about a flag being created or fulfilled.
sub notify {
my ($flag, $template_file) = @_;
+ my $template = Bugzilla->template;
+ my $vars = {};
+
my $attachment_is_private = $flag->{'target'}->{'attachment'} ?
$flag->{'target'}->{'attachment'}->{'isprivate'} : undef;
@@ -971,14 +970,14 @@ sub notify {
$flag->{'requestee'}->{'email'} .= Param('emailsuffix');
$flag->{'setter'}->{'email'} .= Param('emailsuffix');
- $::vars->{'flag'} = $flag;
+ $vars->{'flag'} = $flag;
my $message;
my $rv =
- $::template->process($template_file, $::vars, \$message);
+ $template->process($template_file, $vars, \$message);
if (!$rv) {
Bugzilla->cgi->header();
- ThrowTemplateError($::template->error());
+ ThrowTemplateError($template->error());
}
Bugzilla::BugMail::MessageToMTA($message);
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index b1646dbf0..4cbca29bd 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -44,7 +44,6 @@ use MIME::Base64;
use Date::Format ();
use base qw(Template);
-use vars qw($vars);
# Convert the constants in the Bugzilla::Constants module into a hash we can
# pass to the template object for reflection into its "constants" namespace
@@ -165,6 +164,7 @@ sub getTemplateIncludePath {
sub put_header {
my $self = shift;
+ my $vars = {};
($vars->{'title'}, $vars->{'h1'}, $vars->{'h2'}) = (@_);
$self->process("global/header.html.tmpl", $vars)
@@ -174,7 +174,7 @@ sub put_header {
sub put_footer {
my $self = shift;
- $self->process("global/footer.html.tmpl", $vars)
+ $self->process("global/footer.html.tmpl")
|| ThrowTemplateError($self->error());
}
diff --git a/Bugzilla/Token.pm b/Bugzilla/Token.pm
index 1cf51a332..6a263cbee 100644
--- a/Bugzilla/Token.pm
+++ b/Bugzilla/Token.pm
@@ -60,8 +60,8 @@ sub IssueEmailChangeToken {
# Mail the user the token along with instructions for using it.
- my $template = $::template;
- my $vars = $::vars;
+ my $template = Bugzilla->template;
+ my $vars = {};
$vars->{'oldemailaddress'} = $old_email . Param('emailsuffix');
$vars->{'newemailaddress'} = $new_email . Param('emailsuffix');
@@ -115,8 +115,8 @@ sub IssuePasswordToken {
# Mail the user the token along with instructions for using it.
- my $template = $::template;
- my $vars = $::vars;
+ my $template = Bugzilla->template;
+ my $vars = {};
$vars->{'token'} = $token;
$vars->{'emailaddress'} = $loginname . Param('emailsuffix');
@@ -180,9 +180,10 @@ sub Cancel {
# This should only happen when the user accidentally makes a token request
# or when a malicious hacker makes a token request on behalf of a user.
- my ($token, $cancelaction) = @_;
+ my ($token, $cancelaction, $vars) = @_;
my $dbh = Bugzilla->dbh;
+ $vars ||= {};
# Quote the token for inclusion in SQL statements.
my $quotedtoken = &::SqlQuote($token);
@@ -198,8 +199,7 @@ sub Cancel {
# Get the email address of the Bugzilla maintainer.
my $maintainer = Param('maintainer');
- my $template = $::template;
- my $vars = $::vars;
+ my $template = Bugzilla->template;
$vars->{'emailaddress'} = $loginname . Param('emailsuffix');
$vars->{'maintainer'} = $maintainer;
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index 744dbd34a..7f3736c28 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -892,8 +892,6 @@ sub match_field {
# prepare default form values
- my $vars = $::vars;
-
# What does a "--do_not_change--" field look like (if any)?
my $dontchange = $cgi->param('dontchange');
@@ -1056,6 +1054,9 @@ sub match_field {
# Skip confirmation if we were told to, or if we don't need to confirm.
return $retval if ($behavior == MATCH_SKIP_CONFIRM || !$need_confirm);
+ my $template = Bugzilla->template;
+ my $vars = {};
+
$vars->{'script'} = $ENV{'SCRIPT_NAME'}; # for self-referencing URLs
$vars->{'fields'} = $fields; # fields being matched
$vars->{'matches'} = $matches; # matches that were made
@@ -1063,8 +1064,8 @@ sub match_field {
print Bugzilla->cgi->header();
- $::template->process("global/confirm-user-match.html.tmpl", $vars)
- || ThrowTemplateError($::template->error());
+ $template->process("global/confirm-user-match.html.tmpl", $vars)
+ || ThrowTemplateError($template->error());
exit;
diff --git a/attachment.cgi b/attachment.cgi
index 964e6cbbc..0e03e45ce 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -35,8 +35,6 @@ use strict;
use lib qw(.);
-use vars qw($template $vars);
-
# Include the Bugzilla CGI and general utility library.
require "globals.pl";
use Bugzilla::Config qw(:locations);
@@ -53,6 +51,8 @@ use Bugzilla::Field;
Bugzilla->login();
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
################################################################################
# Main Body Execution
diff --git a/buglist.cgi b/buglist.cgi
index 11835c3a6..53f810c3c 100755
--- a/buglist.cgi
+++ b/buglist.cgi
@@ -34,8 +34,6 @@ use strict;
use lib qw(.);
-use vars qw($template $vars);
-
use Bugzilla;
use Bugzilla::Search;
use Bugzilla::Search::Quicksearch;
@@ -59,6 +57,8 @@ use vars qw($db_name
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
+my $template = Bugzilla->template;
+my $vars = {};
my $buffer = $cgi->query_string();
if (length($buffer) == 0) {
diff --git a/chart.cgi b/chart.cgi
index 566d0541f..2835bcaa2 100755
--- a/chart.cgi
+++ b/chart.cgi
@@ -52,10 +52,9 @@ use Bugzilla::Chart;
use Bugzilla::Series;
use Bugzilla::User;
-use vars qw($vars);
-
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
+my $vars = {};
# Go back to query.cgi if we are adding a boolean chart parameter.
if (grep(/^cmd-/, $cgi->param())) {
diff --git a/colchange.cgi b/colchange.cgi
index e99b81b70..43bfd86ee 100755
--- a/colchange.cgi
+++ b/colchange.cgi
@@ -27,8 +27,6 @@ use lib qw(.);
use vars qw(
@legal_keywords
- $template
- $vars
);
use Bugzilla;
@@ -41,6 +39,8 @@ Bugzilla->login();
GetVersionTable();
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
# The master list not only says what fields are possible, but what order
# they get displayed in.
diff --git a/config.cgi b/config.cgi
index 860115c81..bea4f6faa 100755
--- a/config.cgi
+++ b/config.cgi
@@ -51,7 +51,6 @@ use vars
# Use the global template variables defined in globals.pl
# to generate the output.
-use vars qw($vars);
my $user = Bugzilla->login(LOGIN_OPTIONAL);
@@ -65,6 +64,7 @@ if (Param('requirelogin') && !$user->id) {
GetVersionTable();
# Pass a bunch of Bugzilla configuration to the templates.
+my $vars = {};
$vars->{'priority'} = \@::legal_priority;
$vars->{'severity'} = \@::legal_severity;
$vars->{'platform'} = \@::legal_platform;
diff --git a/createaccount.cgi b/createaccount.cgi
index 1be63756d..8bb7829ef 100755
--- a/createaccount.cgi
+++ b/createaccount.cgi
@@ -36,9 +36,6 @@ use Bugzilla::User;
use Bugzilla::BugMail;
use Bugzilla::Util;
-# Shut up misguided -w warnings about "used only once":
-use vars qw($template $vars);
-
# Just in case someone already has an account, let them get the correct footer
# on an error message. The user is logged out just after the account is
# actually created.
@@ -46,6 +43,9 @@ Bugzilla->login(LOGIN_OPTIONAL);
my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
+
print $cgi->header();
# If we're using LDAP for login, then we can't create a new account here.
diff --git a/describecomponents.cgi b/describecomponents.cgi
index 8fec1ec26..4ce103905 100755
--- a/describecomponents.cgi
+++ b/describecomponents.cgi
@@ -28,7 +28,7 @@ use Bugzilla;
use Bugzilla::Constants;
require "globals.pl";
-use vars qw($vars @legal_product);
+use vars qw(@legal_product);
my $user = Bugzilla->login();
@@ -36,6 +36,7 @@ GetVersionTable();
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
+my $vars = {};
my $product = trim($cgi->param('product') || '');
my $product_id = get_product_id($product);
diff --git a/describekeywords.cgi b/describekeywords.cgi
index ab88c2f15..19140199f 100755
--- a/describekeywords.cgi
+++ b/describekeywords.cgi
@@ -29,13 +29,12 @@ use Bugzilla::User;
require "globals.pl";
-# Use the global template variables.
-use vars qw($vars $template);
-
Bugzilla->login();
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
+my $template = Bugzilla->template;
+my $vars = {};
SendSQL("SELECT keyworddefs.name, keyworddefs.description,
COUNT(keywords.bug_id)
diff --git a/duplicates.cgi b/duplicates.cgi
index 6348748bf..98b307526 100755
--- a/duplicates.cgi
+++ b/duplicates.cgi
@@ -50,8 +50,8 @@ if (defined $cgi->param('ctype') && $cgi->param('ctype') eq "xul") {
exit;
}
-# Use global templatisation variables.
-use vars qw($template $vars);
+my $template = Bugzilla->template;
+my $vars = {};
GetVersionTable();
diff --git a/editcomponents.cgi b/editcomponents.cgi
index 5b5333e31..5b0088bd6 100755
--- a/editcomponents.cgi
+++ b/editcomponents.cgi
@@ -39,10 +39,10 @@ use Bugzilla::Product;
use Bugzilla::Component;
use Bugzilla::Bug;
-use vars qw($template $vars);
-
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
+my $template = Bugzilla->template;
+my $vars = {};
#
# Preliminary checks:
diff --git a/editflagtypes.cgi b/editflagtypes.cgi
index 3e70e901c..795ce985e 100755
--- a/editflagtypes.cgi
+++ b/editflagtypes.cgi
@@ -39,7 +39,8 @@ use Bugzilla::FlagType;
use Bugzilla::Group;
use Bugzilla::Util;
-use vars qw( $template $vars );
+my $template = Bugzilla->template;
+my $vars = {};
# Make sure the user is logged in and is an administrator.
my $user = Bugzilla->login(LOGIN_REQUIRED);
diff --git a/editgroups.cgi b/editgroups.cgi
index d457303f1..b11d0425a 100755
--- a/editgroups.cgi
+++ b/editgroups.cgi
@@ -36,8 +36,8 @@ require "globals.pl";
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
-
-use vars qw($template $vars);
+my $template = Bugzilla->template;
+my $vars = {};
my $user = Bugzilla->login(LOGIN_REQUIRED);
diff --git a/editkeywords.cgi b/editkeywords.cgi
index 77b8f0a22..cdd01b77e 100755
--- a/editkeywords.cgi
+++ b/editkeywords.cgi
@@ -31,9 +31,8 @@ use Bugzilla::Config qw(:DEFAULT $datadir);
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
-
-use vars qw($template $vars);
-
+my $template = Bugzilla->template;
+my $vars = {};
sub Validate {
my ($name, $description) = @_;
diff --git a/editmilestones.cgi b/editmilestones.cgi
index 3ca7ea998..95babd737 100755
--- a/editmilestones.cgi
+++ b/editmilestones.cgi
@@ -27,10 +27,10 @@ use Bugzilla::Product;
use Bugzilla::Milestone;
use Bugzilla::Bug;
-use vars qw($template $vars);
-
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
+my $template = Bugzilla->template;
+my $vars = {};
#
# Preliminary checks:
diff --git a/editparams.cgi b/editparams.cgi
index 1aa52d81a..dec30ab83 100755
--- a/editparams.cgi
+++ b/editparams.cgi
@@ -30,11 +30,12 @@ use Bugzilla::Config qw(:DEFAULT :admin :params $datadir);
use Bugzilla::Config::Common;
require "globals.pl";
-use vars qw($vars @parampanels);
+use vars qw(@parampanels);
my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
+my $vars = {};
print $cgi->header();
diff --git a/editproducts.cgi b/editproducts.cgi
index 13614f269..23d212a9c 100755
--- a/editproducts.cgi
+++ b/editproducts.cgi
@@ -33,7 +33,6 @@
use strict;
use lib ".";
-use vars qw ($template $vars);
use Bugzilla::Constants;
require "globals.pl";
use Bugzilla::Bug;
@@ -55,6 +54,9 @@ my $user = Bugzilla->login(LOGIN_REQUIRED);
my $whoid = $user->id;
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
+
print $cgi->header();
$user->in_group('editcomponents')
diff --git a/editsettings.cgi b/editsettings.cgi
index 883666074..231c1aea8 100755
--- a/editsettings.cgi
+++ b/editsettings.cgi
@@ -25,8 +25,8 @@ use Bugzilla::User::Setting;
require "globals.pl";
-# Use global template variables.
-use vars qw($template $vars);
+my $template = Bugzilla->template;
+my $vars = {};
###############################
### Subroutine Definitions ###
diff --git a/editusers.cgi b/editusers.cgi
index d967123a7..5f577f061 100755
--- a/editusers.cgi
+++ b/editusers.cgi
@@ -21,8 +21,6 @@ use lib ".";
require "globals.pl";
-use vars qw( $vars );
-
use Bugzilla;
use Bugzilla::User;
use Bugzilla::Bug;
@@ -36,6 +34,7 @@ Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
+my $vars = {};
my $dbh = Bugzilla->dbh;
my $user = Bugzilla->user;
my $userid = $user->id;
diff --git a/editversions.cgi b/editversions.cgi
index bc7420b19..396a6e605 100755
--- a/editversions.cgi
+++ b/editversions.cgi
@@ -38,10 +38,10 @@ use Bugzilla::Config qw(:DEFAULT $datadir);
use Bugzilla::Product;
use Bugzilla::Version;
-use vars qw($template $vars);
-
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
+my $template = Bugzilla->template;
+my $vars = {};
#
# Preliminary checks:
diff --git a/editwhines.cgi b/editwhines.cgi
index 2b70acc13..49acb94ff 100755
--- a/editwhines.cgi
+++ b/editwhines.cgi
@@ -30,8 +30,6 @@ use strict;
use lib ".";
require "globals.pl";
-use vars qw( $vars );
-
use Bugzilla::Constants;
use Bugzilla::User;
use Bugzilla::Group;
@@ -44,6 +42,7 @@ my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
+my $vars = {};
my $dbh = Bugzilla->dbh;
my $userid = $user->id;
diff --git a/enter_bug.cgi b/enter_bug.cgi
index 569d9554c..230d39bf8 100755
--- a/enter_bug.cgi
+++ b/enter_bug.cgi
@@ -44,8 +44,6 @@ use Bugzilla::User;
require "globals.pl";
use vars qw(
- $template
- $vars
@enterable_products
@legal_opsys
@legal_platform
@@ -66,6 +64,8 @@ my $cloned_bug;
my $cloned_bug_id;
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
my $product = $cgi->param('product');
diff --git a/globals.pl b/globals.pl
index e7e3f7521..0f7128c6e 100644
--- a/globals.pl
+++ b/globals.pl
@@ -60,9 +60,7 @@ sub globals_pl_sillyness {
$zz = @main::milestoneurl;
$zz = %main::proddesc;
$zz = @main::prodmaxvotes;
- $zz = $main::template;
$zz = $main::userid;
- $zz = $main::vars;
}
#
@@ -808,8 +806,4 @@ sub OpenStates {
use Bugzilla;
-$::template = Bugzilla->template();
-
-$::vars = {};
-
1;
diff --git a/index.cgi b/index.cgi
index 694292fc7..f3e8ccd17 100755
--- a/index.cgi
+++ b/index.cgi
@@ -32,8 +32,6 @@ use strict;
use lib ".";
require "globals.pl";
-use vars qw($vars);
-
# Check whether or not the user is logged in and, if so, set the $::userid
use Bugzilla::Constants;
Bugzilla->login(LOGIN_OPTIONAL);
@@ -55,5 +53,5 @@ my $template = Bugzilla->template;
print $cgi->header();
# Generate and return the UI (HTML page) from the appropriate template.
-$template->process("index.html.tmpl", $vars)
+$template->process("index.html.tmpl")
|| ThrowTemplateError($template->error());
diff --git a/page.cgi b/page.cgi
index 97f425ba2..b160cf021 100755
--- a/page.cgi
+++ b/page.cgi
@@ -36,11 +36,10 @@ use Bugzilla;
require "globals.pl";
-use vars qw($template $vars);
-
Bugzilla->login();
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
my $id = $cgi->param('id');
if ($id) {
@@ -58,7 +57,7 @@ if ($id) {
print $cgi->header($format->{'ctype'});
- $template->process("$format->{'template'}", $vars)
+ $template->process("$format->{'template'}")
|| ThrowTemplateError($template->error());
}
else {
diff --git a/post_bug.cgi b/post_bug.cgi
index 0965728b7..c1af2a5d0 100755
--- a/post_bug.cgi
+++ b/post_bug.cgi
@@ -48,12 +48,12 @@ sub sillyness {
$zz = %::target_milestone;
}
-# Use global template variables.
-use vars qw($vars $template);
-
my $user = Bugzilla->login(LOGIN_REQUIRED);
+
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
+my $template = Bugzilla->template;
+my $vars = {};
# do a match on the fields if applicable
diff --git a/process_bug.cgi b/process_bug.cgi
index 9f556cc0a..1e8ed8494 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -80,11 +80,11 @@ my $grouplist = $user->groups_as_string;
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
+my $template = Bugzilla->template;
+my $vars = {};
my $requiremilestone = 0;
-use vars qw($template $vars);
-
######################################################################
# Begin Data/Security Validation
######################################################################
diff --git a/query.cgi b/query.cgi
index 986e2350b..114cb7f9f 100755
--- a/query.cgi
+++ b/query.cgi
@@ -50,12 +50,12 @@ use vars qw(
@log_columns
%versions
%components
- $template
- $vars
);
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
+my $template = Bugzilla->template;
+my $vars = {};
my $buffer = $cgi->query_string();
if ($cgi->param("GoAheadAndLogIn")) {
diff --git a/quips.cgi b/quips.cgi
index 364f51448..f661d5476 100755
--- a/quips.cgi
+++ b/quips.cgi
@@ -25,7 +25,7 @@
use strict;
-use vars qw($userid $template $vars);
+use vars qw($userid);
use lib qw(.);
@@ -36,6 +36,8 @@ use Bugzilla::Constants;
Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
my $action = $cgi->param('action') || "";
diff --git a/report.cgi b/report.cgi
index 79c72beaa..ad92e27f3 100755
--- a/report.cgi
+++ b/report.cgi
@@ -26,12 +26,14 @@ use lib ".";
require "globals.pl";
-use vars qw($template $vars @legal_opsys @legal_platform @legal_severity);
+use vars qw(@legal_opsys @legal_platform @legal_severity);
use Bugzilla;
use Bugzilla::Constants;
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
my $buffer = $cgi->query_string();
# Go straight back to query.cgi if we are adding a boolean chart.
diff --git a/reports.cgi b/reports.cgi
index c060045eb..5553f2c97 100755
--- a/reports.cgi
+++ b/reports.cgi
@@ -62,6 +62,7 @@ Bugzilla->switch_to_shadow_db();
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
+my $vars = {};
# We only want those products that the user has permissions for.
my @myproducts;
@@ -90,6 +91,7 @@ if (! defined $cgi->param('product')) {
print $cgi->header(-Content_Disposition=>'inline; filename=bugzilla_report.html');
$template->put_header("Bug Charts");
+ $vars->{'header_done'} = 1;
show_chart($product);
@@ -116,6 +118,7 @@ sub choose_product {
print $cgi->header();
$template->put_header("Bug Charts");
+ $vars->{'header_done'} = 1;
print <<FIN;
<center>
@@ -185,7 +188,7 @@ sub show_chart {
my ($product) = @_;
if (! defined $cgi->param('datasets')) {
- ThrowUserError("missing_datasets");
+ ThrowUserError("missing_datasets", $vars);
}
my $datasets = join('', $cgi->param('datasets'));
@@ -258,7 +261,8 @@ sub generate_chart {
$product = '';
}
- ThrowCodeError("chart_data_not_generated", {'product' => $product});
+ $vars->{'product'} = $product;
+ ThrowCodeError("chart_data_not_generated", $vars);
}
my @fields;
@@ -272,15 +276,19 @@ sub generate_chart {
if (/^#/) {
if (/^# fields?: (.*)\s*$/) {
@fields = split /\||\r/, $1;
- ThrowCodeError("chart_datafile_corrupt", {file => $data_file})
- unless $fields[0] =~ /date/i;
+ unless ($fields[0] =~ /date/i) {
+ $vars->{'file'} = $data_file;
+ ThrowCodeError("chart_datafile_corrupt", $vars);
+ }
push @labels, grep($datasets{$_}, @fields);
}
next;
}
- ThrowCodeError("chart_datafile_corrupt", {file => $data_file})
- unless @fields;
+ unless (@fields) {
+ $vars->{'file'} = $data_file;
+ ThrowCodeError("chart_datafile_corrupt", $vars);
+ }
my @line = split /\|/;
my $date = $line[0];
@@ -306,7 +314,7 @@ sub generate_chart {
close FILE;
if (! @{$data{DATE}}) {
- ThrowUserError("insufficient_data_points");
+ ThrowUserError("insufficient_data_points", $vars);
}
my $img = Chart::Lines->new (800, 600);
diff --git a/request.cgi b/request.cgi
index c7705f38d..5506f79ce 100755
--- a/request.cgi
+++ b/request.cgi
@@ -34,13 +34,13 @@ use Bugzilla::Flag;
use Bugzilla::FlagType;
use Bugzilla::User;
-use vars qw($template $vars);
-
# Make sure the user is logged in.
my $user = Bugzilla->login();
my $userid = $user->id;
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
################################################################################
diff --git a/show_activity.cgi b/show_activity.cgi
index b0ad42379..9b7273a4c 100755
--- a/show_activity.cgi
+++ b/show_activity.cgi
@@ -25,13 +25,14 @@
use strict;
use lib qw(.);
-use vars qw ($template $vars);
require "globals.pl";
use Bugzilla::Bug;
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
###############################################################################
# Begin Data/Security Validation
diff --git a/show_bug.cgi b/show_bug.cgi
index 31619800b..0a99598b5 100755
--- a/show_bug.cgi
+++ b/show_bug.cgi
@@ -30,11 +30,13 @@ use Bugzilla::User;
require "globals.pl";
-use vars qw($template $vars $userid);
+use vars qw($userid);
use Bugzilla::Bug;
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
if ($cgi->param('GoAheadAndLogIn')) {
Bugzilla->login(LOGIN_REQUIRED);
diff --git a/showdependencygraph.cgi b/showdependencygraph.cgi
index 39508290d..fee477f3a 100755
--- a/showdependencygraph.cgi
+++ b/showdependencygraph.cgi
@@ -36,12 +36,14 @@ require "globals.pl";
Bugzilla->login();
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
# Connect to the shadow database if this installation is using one to improve
# performance.
Bugzilla->switch_to_shadow_db();
-use vars qw($template $vars $userid);
+use vars qw($userid);
my %seen;
my %edgesdone;
diff --git a/showdependencytree.cgi b/showdependencytree.cgi
index 7c3b99465..dede3e1c7 100755
--- a/showdependencytree.cgi
+++ b/showdependencytree.cgi
@@ -30,12 +30,11 @@ require "globals.pl";
use Bugzilla::User;
use Bugzilla::Bug;
-# Use global template variables.
-use vars qw($template $vars);
-
Bugzilla->login();
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
# Connect to the shadow database if this installation is using one to improve
# performance.
diff --git a/sidebar.cgi b/sidebar.cgi
index 15506eba4..2f7743ebb 100755
--- a/sidebar.cgi
+++ b/sidebar.cgi
@@ -20,12 +20,10 @@ use strict;
use lib ".";
require "globals.pl";
-# Shut up "Used Only Once" errors
-use vars qw($template $vars);
-
Bugzilla->login();
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
###############################################################################
# Main Body Execution
@@ -43,7 +41,7 @@ my $useragent = $ENV{HTTP_USER_AGENT};
if ($useragent =~ m:Mozilla/([1-9][0-9]*):i && $1 >= 5 && $useragent !~ m/compatible/i) {
print $cgi->header("application/vnd.mozilla.xul+xml");
# Generate and return the XUL from the appropriate template.
- $template->process("sidebar.xul.tmpl", $vars)
+ $template->process("sidebar.xul.tmpl")
|| ThrowTemplateError($template->error());
} else {
ThrowUserError("sidebar_supports_mozilla_only");
diff --git a/summarize_time.cgi b/summarize_time.cgi
index c04a956d7..e65b7da95 100755
--- a/summarize_time.cgi
+++ b/summarize_time.cgi
@@ -29,10 +29,10 @@ use Bugzilla::Constants; # LOGIN_*
use Bugzilla::User; # UserInGroup
require "globals.pl";
-GetVersionTable();
+my $template = Bugzilla->template;
+my $vars = {};
-# Use global template variables.
-use vars qw($template $vars);
+GetVersionTable();
#
# Date handling
diff --git a/token.cgi b/token.cgi
index 3c818bc23..aaac4f7ac 100755
--- a/token.cgi
+++ b/token.cgi
@@ -29,14 +29,14 @@ use strict;
use lib qw(.);
-use vars qw($template $vars);
-
use Bugzilla;
use Bugzilla::Constants;
use Bugzilla::Util;
my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh;
+my $template = Bugzilla->template;
+my $vars = {};
# Include the Bugzilla CGI and general utility library.
require "globals.pl";
@@ -250,7 +250,7 @@ sub changeEmail {
# confirmed initially so cancel token if it is not still available
if (! is_available_username($new_email,$old_email)) {
$vars->{'email'} = $new_email; # Needed for Bugzilla::Token::Cancel's mail
- Bugzilla::Token::Cancel($::token,"account_exists");
+ Bugzilla::Token::Cancel($::token, "account_exists", $vars);
ThrowUserError("account_exists", { email => $new_email } );
}
@@ -324,7 +324,7 @@ sub cancelChangeEmail {
$vars->{'old_email'} = $old_email;
$vars->{'new_email'} = $new_email;
- Bugzilla::Token::Cancel($::token, $vars->{'message'});
+ Bugzilla::Token::Cancel($::token, $vars->{'message'}, $vars);
$dbh->bz_lock_tables('tokens WRITE');
$dbh->do(q{DELETE FROM tokens WHERE userid = ?
diff --git a/userprefs.cgi b/userprefs.cgi
index 07bc048cc..796f2e0f9 100755
--- a/userprefs.cgi
+++ b/userprefs.cgi
@@ -35,7 +35,10 @@ use Bugzilla::User;
require "globals.pl";
# Use global template variables.
-use vars qw($template $vars $userid);
+use vars qw($userid);
+
+my $template = Bugzilla->template;
+my $vars = {};
###############################################################################
# Each panel has two functions - panel Foo has a DoFoo, to get the data
diff --git a/votes.cgi b/votes.cgi
index 61a57e06f..f30eebe3c 100755
--- a/votes.cgi
+++ b/votes.cgi
@@ -32,10 +32,9 @@ use Bugzilla::Bug;
require "globals.pl";
-# Use global template variables
-use vars qw($template $vars);
-
my $cgi = Bugzilla->cgi;
+my $template = Bugzilla->template;
+my $vars = {};
# If the action is show_bug, you need a bug_id.
# If the action is show_user, you can supply a userid to show the votes for