summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2005-10-25 08:11:55 +0200
committerlpsolit%gmail.com <>2005-10-25 08:11:55 +0200
commit44de29d04d1ca7e3b047b2a847508dc949c29038 (patch)
tree934c0ccce39c238b3bf6a0337014e6f1fde9918b /Bugzilla
parent46aba0e761e99db24b5de10f13bbc108fdc982a4 (diff)
downloadbugzilla-44de29d04d1ca7e3b047b2a847508dc949c29038.tar.gz
bugzilla-44de29d04d1ca7e3b047b2a847508dc949c29038.tar.xz
Bug 312157: Remove $::template and $::vars from globals.pl - Patch by Olav Vitters <bugzilla-mozilla@bkor.dhs.org> r=LpSolit a=justdave
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Flag.pm13
-rw-r--r--Bugzilla/Template.pm4
-rw-r--r--Bugzilla/Token.pm14
-rw-r--r--Bugzilla/User.pm9
4 files changed, 20 insertions, 20 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;