Commit 44de29d0 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 312157: Remove $::template and $::vars from globals.pl - Patch by Olav…

Bug 312157: Remove $::template and $::vars from globals.pl - Patch by Olav Vitters <bugzilla-mozilla@bkor.dhs.org> r=LpSolit a=justdave
parent 46aba0e7
...@@ -74,10 +74,6 @@ use Bugzilla::BugMail; ...@@ -74,10 +74,6 @@ use Bugzilla::BugMail;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Field; 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 # Global Variables
###################################################################### ######################################################################
...@@ -947,6 +943,9 @@ Sends an email notification about a flag being created or fulfilled. ...@@ -947,6 +943,9 @@ Sends an email notification about a flag being created or fulfilled.
sub notify { sub notify {
my ($flag, $template_file) = @_; my ($flag, $template_file) = @_;
my $template = Bugzilla->template;
my $vars = {};
my $attachment_is_private = $flag->{'target'}->{'attachment'} ? my $attachment_is_private = $flag->{'target'}->{'attachment'} ?
$flag->{'target'}->{'attachment'}->{'isprivate'} : undef; $flag->{'target'}->{'attachment'}->{'isprivate'} : undef;
...@@ -971,14 +970,14 @@ sub notify { ...@@ -971,14 +970,14 @@ sub notify {
$flag->{'requestee'}->{'email'} .= Param('emailsuffix'); $flag->{'requestee'}->{'email'} .= Param('emailsuffix');
$flag->{'setter'}->{'email'} .= Param('emailsuffix'); $flag->{'setter'}->{'email'} .= Param('emailsuffix');
$::vars->{'flag'} = $flag; $vars->{'flag'} = $flag;
my $message; my $message;
my $rv = my $rv =
$::template->process($template_file, $::vars, \$message); $template->process($template_file, $vars, \$message);
if (!$rv) { if (!$rv) {
Bugzilla->cgi->header(); Bugzilla->cgi->header();
ThrowTemplateError($::template->error()); ThrowTemplateError($template->error());
} }
Bugzilla::BugMail::MessageToMTA($message); Bugzilla::BugMail::MessageToMTA($message);
......
...@@ -44,7 +44,6 @@ use MIME::Base64; ...@@ -44,7 +44,6 @@ use MIME::Base64;
use Date::Format (); use Date::Format ();
use base qw(Template); use base qw(Template);
use vars qw($vars);
# Convert the constants in the Bugzilla::Constants module into a hash we can # Convert the constants in the Bugzilla::Constants module into a hash we can
# pass to the template object for reflection into its "constants" namespace # pass to the template object for reflection into its "constants" namespace
...@@ -165,6 +164,7 @@ sub getTemplateIncludePath { ...@@ -165,6 +164,7 @@ sub getTemplateIncludePath {
sub put_header { sub put_header {
my $self = shift; my $self = shift;
my $vars = {};
($vars->{'title'}, $vars->{'h1'}, $vars->{'h2'}) = (@_); ($vars->{'title'}, $vars->{'h1'}, $vars->{'h2'}) = (@_);
$self->process("global/header.html.tmpl", $vars) $self->process("global/header.html.tmpl", $vars)
...@@ -174,7 +174,7 @@ sub put_header { ...@@ -174,7 +174,7 @@ sub put_header {
sub put_footer { sub put_footer {
my $self = shift; my $self = shift;
$self->process("global/footer.html.tmpl", $vars) $self->process("global/footer.html.tmpl")
|| ThrowTemplateError($self->error()); || ThrowTemplateError($self->error());
} }
......
...@@ -60,8 +60,8 @@ sub IssueEmailChangeToken { ...@@ -60,8 +60,8 @@ sub IssueEmailChangeToken {
# Mail the user the token along with instructions for using it. # Mail the user the token along with instructions for using it.
my $template = $::template; my $template = Bugzilla->template;
my $vars = $::vars; my $vars = {};
$vars->{'oldemailaddress'} = $old_email . Param('emailsuffix'); $vars->{'oldemailaddress'} = $old_email . Param('emailsuffix');
$vars->{'newemailaddress'} = $new_email . Param('emailsuffix'); $vars->{'newemailaddress'} = $new_email . Param('emailsuffix');
...@@ -115,8 +115,8 @@ sub IssuePasswordToken { ...@@ -115,8 +115,8 @@ sub IssuePasswordToken {
# Mail the user the token along with instructions for using it. # Mail the user the token along with instructions for using it.
my $template = $::template; my $template = Bugzilla->template;
my $vars = $::vars; my $vars = {};
$vars->{'token'} = $token; $vars->{'token'} = $token;
$vars->{'emailaddress'} = $loginname . Param('emailsuffix'); $vars->{'emailaddress'} = $loginname . Param('emailsuffix');
...@@ -180,9 +180,10 @@ sub Cancel { ...@@ -180,9 +180,10 @@ sub Cancel {
# This should only happen when the user accidentally makes a token request # 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. # 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; my $dbh = Bugzilla->dbh;
$vars ||= {};
# Quote the token for inclusion in SQL statements. # Quote the token for inclusion in SQL statements.
my $quotedtoken = &::SqlQuote($token); my $quotedtoken = &::SqlQuote($token);
...@@ -198,8 +199,7 @@ sub Cancel { ...@@ -198,8 +199,7 @@ sub Cancel {
# Get the email address of the Bugzilla maintainer. # Get the email address of the Bugzilla maintainer.
my $maintainer = Param('maintainer'); my $maintainer = Param('maintainer');
my $template = $::template; my $template = Bugzilla->template;
my $vars = $::vars;
$vars->{'emailaddress'} = $loginname . Param('emailsuffix'); $vars->{'emailaddress'} = $loginname . Param('emailsuffix');
$vars->{'maintainer'} = $maintainer; $vars->{'maintainer'} = $maintainer;
......
...@@ -892,8 +892,6 @@ sub match_field { ...@@ -892,8 +892,6 @@ sub match_field {
# prepare default form values # prepare default form values
my $vars = $::vars;
# What does a "--do_not_change--" field look like (if any)? # What does a "--do_not_change--" field look like (if any)?
my $dontchange = $cgi->param('dontchange'); my $dontchange = $cgi->param('dontchange');
...@@ -1056,6 +1054,9 @@ sub match_field { ...@@ -1056,6 +1054,9 @@ sub match_field {
# Skip confirmation if we were told to, or if we don't need to confirm. # Skip confirmation if we were told to, or if we don't need to confirm.
return $retval if ($behavior == MATCH_SKIP_CONFIRM || !$need_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->{'script'} = $ENV{'SCRIPT_NAME'}; # for self-referencing URLs
$vars->{'fields'} = $fields; # fields being matched $vars->{'fields'} = $fields; # fields being matched
$vars->{'matches'} = $matches; # matches that were made $vars->{'matches'} = $matches; # matches that were made
...@@ -1063,8 +1064,8 @@ sub match_field { ...@@ -1063,8 +1064,8 @@ sub match_field {
print Bugzilla->cgi->header(); print Bugzilla->cgi->header();
$::template->process("global/confirm-user-match.html.tmpl", $vars) $template->process("global/confirm-user-match.html.tmpl", $vars)
|| ThrowTemplateError($::template->error()); || ThrowTemplateError($template->error());
exit; exit;
......
...@@ -35,8 +35,6 @@ use strict; ...@@ -35,8 +35,6 @@ use strict;
use lib qw(.); use lib qw(.);
use vars qw($template $vars);
# Include the Bugzilla CGI and general utility library. # Include the Bugzilla CGI and general utility library.
require "globals.pl"; require "globals.pl";
use Bugzilla::Config qw(:locations); use Bugzilla::Config qw(:locations);
...@@ -53,6 +51,8 @@ use Bugzilla::Field; ...@@ -53,6 +51,8 @@ use Bugzilla::Field;
Bugzilla->login(); Bugzilla->login();
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
################################################################################ ################################################################################
# Main Body Execution # Main Body Execution
......
...@@ -34,8 +34,6 @@ use strict; ...@@ -34,8 +34,6 @@ use strict;
use lib qw(.); use lib qw(.);
use vars qw($template $vars);
use Bugzilla; use Bugzilla;
use Bugzilla::Search; use Bugzilla::Search;
use Bugzilla::Search::Quicksearch; use Bugzilla::Search::Quicksearch;
...@@ -59,6 +57,8 @@ use vars qw($db_name ...@@ -59,6 +57,8 @@ use vars qw($db_name
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
my $buffer = $cgi->query_string(); my $buffer = $cgi->query_string();
if (length($buffer) == 0) { if (length($buffer) == 0) {
......
...@@ -52,10 +52,9 @@ use Bugzilla::Chart; ...@@ -52,10 +52,9 @@ use Bugzilla::Chart;
use Bugzilla::Series; use Bugzilla::Series;
use Bugzilla::User; use Bugzilla::User;
use vars qw($vars);
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template; my $template = Bugzilla->template;
my $vars = {};
# Go back to query.cgi if we are adding a boolean chart parameter. # Go back to query.cgi if we are adding a boolean chart parameter.
if (grep(/^cmd-/, $cgi->param())) { if (grep(/^cmd-/, $cgi->param())) {
......
...@@ -27,8 +27,6 @@ use lib qw(.); ...@@ -27,8 +27,6 @@ use lib qw(.);
use vars qw( use vars qw(
@legal_keywords @legal_keywords
$template
$vars
); );
use Bugzilla; use Bugzilla;
...@@ -41,6 +39,8 @@ Bugzilla->login(); ...@@ -41,6 +39,8 @@ Bugzilla->login();
GetVersionTable(); GetVersionTable();
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
# The master list not only says what fields are possible, but what order # The master list not only says what fields are possible, but what order
# they get displayed in. # they get displayed in.
......
...@@ -51,7 +51,6 @@ use vars ...@@ -51,7 +51,6 @@ use vars
# Use the global template variables defined in globals.pl # Use the global template variables defined in globals.pl
# to generate the output. # to generate the output.
use vars qw($vars);
my $user = Bugzilla->login(LOGIN_OPTIONAL); my $user = Bugzilla->login(LOGIN_OPTIONAL);
...@@ -65,6 +64,7 @@ if (Param('requirelogin') && !$user->id) { ...@@ -65,6 +64,7 @@ if (Param('requirelogin') && !$user->id) {
GetVersionTable(); GetVersionTable();
# Pass a bunch of Bugzilla configuration to the templates. # Pass a bunch of Bugzilla configuration to the templates.
my $vars = {};
$vars->{'priority'} = \@::legal_priority; $vars->{'priority'} = \@::legal_priority;
$vars->{'severity'} = \@::legal_severity; $vars->{'severity'} = \@::legal_severity;
$vars->{'platform'} = \@::legal_platform; $vars->{'platform'} = \@::legal_platform;
......
...@@ -36,9 +36,6 @@ use Bugzilla::User; ...@@ -36,9 +36,6 @@ use Bugzilla::User;
use Bugzilla::BugMail; use Bugzilla::BugMail;
use Bugzilla::Util; 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 # 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 # on an error message. The user is logged out just after the account is
# actually created. # actually created.
...@@ -46,6 +43,9 @@ Bugzilla->login(LOGIN_OPTIONAL); ...@@ -46,6 +43,9 @@ Bugzilla->login(LOGIN_OPTIONAL);
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
print $cgi->header(); print $cgi->header();
# If we're using LDAP for login, then we can't create a new account here. # If we're using LDAP for login, then we can't create a new account here.
......
...@@ -28,7 +28,7 @@ use Bugzilla; ...@@ -28,7 +28,7 @@ use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
require "globals.pl"; require "globals.pl";
use vars qw($vars @legal_product); use vars qw(@legal_product);
my $user = Bugzilla->login(); my $user = Bugzilla->login();
...@@ -36,6 +36,7 @@ GetVersionTable(); ...@@ -36,6 +36,7 @@ GetVersionTable();
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template; my $template = Bugzilla->template;
my $vars = {};
my $product = trim($cgi->param('product') || ''); my $product = trim($cgi->param('product') || '');
my $product_id = get_product_id($product); my $product_id = get_product_id($product);
......
...@@ -29,13 +29,12 @@ use Bugzilla::User; ...@@ -29,13 +29,12 @@ use Bugzilla::User;
require "globals.pl"; require "globals.pl";
# Use the global template variables.
use vars qw($vars $template);
Bugzilla->login(); Bugzilla->login();
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
SendSQL("SELECT keyworddefs.name, keyworddefs.description, SendSQL("SELECT keyworddefs.name, keyworddefs.description,
COUNT(keywords.bug_id) COUNT(keywords.bug_id)
......
...@@ -50,8 +50,8 @@ if (defined $cgi->param('ctype') && $cgi->param('ctype') eq "xul") { ...@@ -50,8 +50,8 @@ if (defined $cgi->param('ctype') && $cgi->param('ctype') eq "xul") {
exit; exit;
} }
# Use global templatisation variables. my $template = Bugzilla->template;
use vars qw($template $vars); my $vars = {};
GetVersionTable(); GetVersionTable();
......
...@@ -39,10 +39,10 @@ use Bugzilla::Product; ...@@ -39,10 +39,10 @@ use Bugzilla::Product;
use Bugzilla::Component; use Bugzilla::Component;
use Bugzilla::Bug; use Bugzilla::Bug;
use vars qw($template $vars);
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
# #
# Preliminary checks: # Preliminary checks:
......
...@@ -39,7 +39,8 @@ use Bugzilla::FlagType; ...@@ -39,7 +39,8 @@ use Bugzilla::FlagType;
use Bugzilla::Group; use Bugzilla::Group;
use Bugzilla::Util; 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. # Make sure the user is logged in and is an administrator.
my $user = Bugzilla->login(LOGIN_REQUIRED); my $user = Bugzilla->login(LOGIN_REQUIRED);
......
...@@ -36,8 +36,8 @@ require "globals.pl"; ...@@ -36,8 +36,8 @@ require "globals.pl";
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
use vars qw($template $vars); my $vars = {};
my $user = Bugzilla->login(LOGIN_REQUIRED); my $user = Bugzilla->login(LOGIN_REQUIRED);
......
...@@ -31,9 +31,8 @@ use Bugzilla::Config qw(:DEFAULT $datadir); ...@@ -31,9 +31,8 @@ use Bugzilla::Config qw(:DEFAULT $datadir);
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
use vars qw($template $vars); my $vars = {};
sub Validate { sub Validate {
my ($name, $description) = @_; my ($name, $description) = @_;
......
...@@ -27,10 +27,10 @@ use Bugzilla::Product; ...@@ -27,10 +27,10 @@ use Bugzilla::Product;
use Bugzilla::Milestone; use Bugzilla::Milestone;
use Bugzilla::Bug; use Bugzilla::Bug;
use vars qw($template $vars);
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
# #
# Preliminary checks: # Preliminary checks:
......
...@@ -30,11 +30,12 @@ use Bugzilla::Config qw(:DEFAULT :admin :params $datadir); ...@@ -30,11 +30,12 @@ use Bugzilla::Config qw(:DEFAULT :admin :params $datadir);
use Bugzilla::Config::Common; use Bugzilla::Config::Common;
require "globals.pl"; require "globals.pl";
use vars qw($vars @parampanels); use vars qw(@parampanels);
my $user = Bugzilla->login(LOGIN_REQUIRED); my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template; my $template = Bugzilla->template;
my $vars = {};
print $cgi->header(); print $cgi->header();
......
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
use strict; use strict;
use lib "."; use lib ".";
use vars qw ($template $vars);
use Bugzilla::Constants; use Bugzilla::Constants;
require "globals.pl"; require "globals.pl";
use Bugzilla::Bug; use Bugzilla::Bug;
...@@ -55,6 +54,9 @@ my $user = Bugzilla->login(LOGIN_REQUIRED); ...@@ -55,6 +54,9 @@ my $user = Bugzilla->login(LOGIN_REQUIRED);
my $whoid = $user->id; my $whoid = $user->id;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
print $cgi->header(); print $cgi->header();
$user->in_group('editcomponents') $user->in_group('editcomponents')
......
...@@ -25,8 +25,8 @@ use Bugzilla::User::Setting; ...@@ -25,8 +25,8 @@ use Bugzilla::User::Setting;
require "globals.pl"; require "globals.pl";
# Use global template variables. my $template = Bugzilla->template;
use vars qw($template $vars); my $vars = {};
############################### ###############################
### Subroutine Definitions ### ### Subroutine Definitions ###
......
...@@ -21,8 +21,6 @@ use lib "."; ...@@ -21,8 +21,6 @@ use lib ".";
require "globals.pl"; require "globals.pl";
use vars qw( $vars );
use Bugzilla; use Bugzilla;
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::Bug; use Bugzilla::Bug;
...@@ -36,6 +34,7 @@ Bugzilla->login(LOGIN_REQUIRED); ...@@ -36,6 +34,7 @@ Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template; my $template = Bugzilla->template;
my $vars = {};
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $user = Bugzilla->user; my $user = Bugzilla->user;
my $userid = $user->id; my $userid = $user->id;
......
...@@ -38,10 +38,10 @@ use Bugzilla::Config qw(:DEFAULT $datadir); ...@@ -38,10 +38,10 @@ use Bugzilla::Config qw(:DEFAULT $datadir);
use Bugzilla::Product; use Bugzilla::Product;
use Bugzilla::Version; use Bugzilla::Version;
use vars qw($template $vars);
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
# #
# Preliminary checks: # Preliminary checks:
......
...@@ -30,8 +30,6 @@ use strict; ...@@ -30,8 +30,6 @@ use strict;
use lib "."; use lib ".";
require "globals.pl"; require "globals.pl";
use vars qw( $vars );
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::Group; use Bugzilla::Group;
...@@ -44,6 +42,7 @@ my $user = Bugzilla->login(LOGIN_REQUIRED); ...@@ -44,6 +42,7 @@ my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template; my $template = Bugzilla->template;
my $vars = {};
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $userid = $user->id; my $userid = $user->id;
......
...@@ -44,8 +44,6 @@ use Bugzilla::User; ...@@ -44,8 +44,6 @@ use Bugzilla::User;
require "globals.pl"; require "globals.pl";
use vars qw( use vars qw(
$template
$vars
@enterable_products @enterable_products
@legal_opsys @legal_opsys
@legal_platform @legal_platform
...@@ -66,6 +64,8 @@ my $cloned_bug; ...@@ -66,6 +64,8 @@ my $cloned_bug;
my $cloned_bug_id; my $cloned_bug_id;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
my $product = $cgi->param('product'); my $product = $cgi->param('product');
......
...@@ -60,9 +60,7 @@ sub globals_pl_sillyness { ...@@ -60,9 +60,7 @@ sub globals_pl_sillyness {
$zz = @main::milestoneurl; $zz = @main::milestoneurl;
$zz = %main::proddesc; $zz = %main::proddesc;
$zz = @main::prodmaxvotes; $zz = @main::prodmaxvotes;
$zz = $main::template;
$zz = $main::userid; $zz = $main::userid;
$zz = $main::vars;
} }
# #
...@@ -808,8 +806,4 @@ sub OpenStates { ...@@ -808,8 +806,4 @@ sub OpenStates {
use Bugzilla; use Bugzilla;
$::template = Bugzilla->template();
$::vars = {};
1; 1;
...@@ -32,8 +32,6 @@ use strict; ...@@ -32,8 +32,6 @@ use strict;
use lib "."; use lib ".";
require "globals.pl"; require "globals.pl";
use vars qw($vars);
# Check whether or not the user is logged in and, if so, set the $::userid # Check whether or not the user is logged in and, if so, set the $::userid
use Bugzilla::Constants; use Bugzilla::Constants;
Bugzilla->login(LOGIN_OPTIONAL); Bugzilla->login(LOGIN_OPTIONAL);
...@@ -55,5 +53,5 @@ my $template = Bugzilla->template; ...@@ -55,5 +53,5 @@ my $template = Bugzilla->template;
print $cgi->header(); print $cgi->header();
# Generate and return the UI (HTML page) from the appropriate template. # 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()); || ThrowTemplateError($template->error());
...@@ -36,11 +36,10 @@ use Bugzilla; ...@@ -36,11 +36,10 @@ use Bugzilla;
require "globals.pl"; require "globals.pl";
use vars qw($template $vars);
Bugzilla->login(); Bugzilla->login();
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $id = $cgi->param('id'); my $id = $cgi->param('id');
if ($id) { if ($id) {
...@@ -58,7 +57,7 @@ if ($id) { ...@@ -58,7 +57,7 @@ if ($id) {
print $cgi->header($format->{'ctype'}); print $cgi->header($format->{'ctype'});
$template->process("$format->{'template'}", $vars) $template->process("$format->{'template'}")
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
} }
else { else {
......
...@@ -48,12 +48,12 @@ sub sillyness { ...@@ -48,12 +48,12 @@ sub sillyness {
$zz = %::target_milestone; $zz = %::target_milestone;
} }
# Use global template variables.
use vars qw($vars $template);
my $user = Bugzilla->login(LOGIN_REQUIRED); my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
# do a match on the fields if applicable # do a match on the fields if applicable
......
...@@ -80,11 +80,11 @@ my $grouplist = $user->groups_as_string; ...@@ -80,11 +80,11 @@ my $grouplist = $user->groups_as_string;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
my $requiremilestone = 0; my $requiremilestone = 0;
use vars qw($template $vars);
###################################################################### ######################################################################
# Begin Data/Security Validation # Begin Data/Security Validation
###################################################################### ######################################################################
......
...@@ -50,12 +50,12 @@ use vars qw( ...@@ -50,12 +50,12 @@ use vars qw(
@log_columns @log_columns
%versions %versions
%components %components
$template
$vars
); );
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
my $buffer = $cgi->query_string(); my $buffer = $cgi->query_string();
if ($cgi->param("GoAheadAndLogIn")) { if ($cgi->param("GoAheadAndLogIn")) {
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
use strict; use strict;
use vars qw($userid $template $vars); use vars qw($userid);
use lib qw(.); use lib qw(.);
...@@ -36,6 +36,8 @@ use Bugzilla::Constants; ...@@ -36,6 +36,8 @@ use Bugzilla::Constants;
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
my $action = $cgi->param('action') || ""; my $action = $cgi->param('action') || "";
......
...@@ -26,12 +26,14 @@ use lib "."; ...@@ -26,12 +26,14 @@ use lib ".";
require "globals.pl"; 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;
use Bugzilla::Constants; use Bugzilla::Constants;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
my $buffer = $cgi->query_string(); my $buffer = $cgi->query_string();
# Go straight back to query.cgi if we are adding a boolean chart. # Go straight back to query.cgi if we are adding a boolean chart.
......
...@@ -62,6 +62,7 @@ Bugzilla->switch_to_shadow_db(); ...@@ -62,6 +62,7 @@ Bugzilla->switch_to_shadow_db();
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template; my $template = Bugzilla->template;
my $vars = {};
# We only want those products that the user has permissions for. # We only want those products that the user has permissions for.
my @myproducts; my @myproducts;
...@@ -90,6 +91,7 @@ if (! defined $cgi->param('product')) { ...@@ -90,6 +91,7 @@ if (! defined $cgi->param('product')) {
print $cgi->header(-Content_Disposition=>'inline; filename=bugzilla_report.html'); print $cgi->header(-Content_Disposition=>'inline; filename=bugzilla_report.html');
$template->put_header("Bug Charts"); $template->put_header("Bug Charts");
$vars->{'header_done'} = 1;
show_chart($product); show_chart($product);
...@@ -116,6 +118,7 @@ sub choose_product { ...@@ -116,6 +118,7 @@ sub choose_product {
print $cgi->header(); print $cgi->header();
$template->put_header("Bug Charts"); $template->put_header("Bug Charts");
$vars->{'header_done'} = 1;
print <<FIN; print <<FIN;
<center> <center>
...@@ -185,7 +188,7 @@ sub show_chart { ...@@ -185,7 +188,7 @@ sub show_chart {
my ($product) = @_; my ($product) = @_;
if (! defined $cgi->param('datasets')) { if (! defined $cgi->param('datasets')) {
ThrowUserError("missing_datasets"); ThrowUserError("missing_datasets", $vars);
} }
my $datasets = join('', $cgi->param('datasets')); my $datasets = join('', $cgi->param('datasets'));
...@@ -258,7 +261,8 @@ sub generate_chart { ...@@ -258,7 +261,8 @@ sub generate_chart {
$product = ''; $product = '';
} }
ThrowCodeError("chart_data_not_generated", {'product' => $product}); $vars->{'product'} = $product;
ThrowCodeError("chart_data_not_generated", $vars);
} }
my @fields; my @fields;
...@@ -272,15 +276,19 @@ sub generate_chart { ...@@ -272,15 +276,19 @@ sub generate_chart {
if (/^#/) { if (/^#/) {
if (/^# fields?: (.*)\s*$/) { if (/^# fields?: (.*)\s*$/) {
@fields = split /\||\r/, $1; @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); push @labels, grep($datasets{$_}, @fields);
} }
next; 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 @line = split /\|/;
my $date = $line[0]; my $date = $line[0];
...@@ -306,7 +314,7 @@ sub generate_chart { ...@@ -306,7 +314,7 @@ sub generate_chart {
close FILE; close FILE;
if (! @{$data{DATE}}) { if (! @{$data{DATE}}) {
ThrowUserError("insufficient_data_points"); ThrowUserError("insufficient_data_points", $vars);
} }
my $img = Chart::Lines->new (800, 600); my $img = Chart::Lines->new (800, 600);
......
...@@ -34,13 +34,13 @@ use Bugzilla::Flag; ...@@ -34,13 +34,13 @@ use Bugzilla::Flag;
use Bugzilla::FlagType; use Bugzilla::FlagType;
use Bugzilla::User; use Bugzilla::User;
use vars qw($template $vars);
# Make sure the user is logged in. # Make sure the user is logged in.
my $user = Bugzilla->login(); my $user = Bugzilla->login();
my $userid = $user->id; my $userid = $user->id;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
################################################################################ ################################################################################
......
...@@ -25,13 +25,14 @@ ...@@ -25,13 +25,14 @@
use strict; use strict;
use lib qw(.); use lib qw(.);
use vars qw ($template $vars);
require "globals.pl"; require "globals.pl";
use Bugzilla::Bug; use Bugzilla::Bug;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
############################################################################### ###############################################################################
# Begin Data/Security Validation # Begin Data/Security Validation
......
...@@ -30,11 +30,13 @@ use Bugzilla::User; ...@@ -30,11 +30,13 @@ use Bugzilla::User;
require "globals.pl"; require "globals.pl";
use vars qw($template $vars $userid); use vars qw($userid);
use Bugzilla::Bug; use Bugzilla::Bug;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
if ($cgi->param('GoAheadAndLogIn')) { if ($cgi->param('GoAheadAndLogIn')) {
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
......
...@@ -36,12 +36,14 @@ require "globals.pl"; ...@@ -36,12 +36,14 @@ require "globals.pl";
Bugzilla->login(); Bugzilla->login();
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
# Connect to the shadow database if this installation is using one to improve # Connect to the shadow database if this installation is using one to improve
# performance. # performance.
Bugzilla->switch_to_shadow_db(); Bugzilla->switch_to_shadow_db();
use vars qw($template $vars $userid); use vars qw($userid);
my %seen; my %seen;
my %edgesdone; my %edgesdone;
......
...@@ -30,12 +30,11 @@ require "globals.pl"; ...@@ -30,12 +30,11 @@ require "globals.pl";
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::Bug; use Bugzilla::Bug;
# Use global template variables.
use vars qw($template $vars);
Bugzilla->login(); Bugzilla->login();
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
my $vars = {};
# Connect to the shadow database if this installation is using one to improve # Connect to the shadow database if this installation is using one to improve
# performance. # performance.
......
...@@ -20,12 +20,10 @@ use strict; ...@@ -20,12 +20,10 @@ use strict;
use lib "."; use lib ".";
require "globals.pl"; require "globals.pl";
# Shut up "Used Only Once" errors
use vars qw($template $vars);
Bugzilla->login(); Bugzilla->login();
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
############################################################################### ###############################################################################
# Main Body Execution # Main Body Execution
...@@ -43,7 +41,7 @@ my $useragent = $ENV{HTTP_USER_AGENT}; ...@@ -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) { if ($useragent =~ m:Mozilla/([1-9][0-9]*):i && $1 >= 5 && $useragent !~ m/compatible/i) {
print $cgi->header("application/vnd.mozilla.xul+xml"); print $cgi->header("application/vnd.mozilla.xul+xml");
# Generate and return the XUL from the appropriate template. # Generate and return the XUL from the appropriate template.
$template->process("sidebar.xul.tmpl", $vars) $template->process("sidebar.xul.tmpl")
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
} else { } else {
ThrowUserError("sidebar_supports_mozilla_only"); ThrowUserError("sidebar_supports_mozilla_only");
......
...@@ -29,10 +29,10 @@ use Bugzilla::Constants; # LOGIN_* ...@@ -29,10 +29,10 @@ use Bugzilla::Constants; # LOGIN_*
use Bugzilla::User; # UserInGroup use Bugzilla::User; # UserInGroup
require "globals.pl"; require "globals.pl";
GetVersionTable(); my $template = Bugzilla->template;
my $vars = {};
# Use global template variables. GetVersionTable();
use vars qw($template $vars);
# #
# Date handling # Date handling
......
...@@ -29,14 +29,14 @@ use strict; ...@@ -29,14 +29,14 @@ use strict;
use lib qw(.); use lib qw(.);
use vars qw($template $vars);
use Bugzilla; use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Util; use Bugzilla::Util;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $template = Bugzilla->template;
my $vars = {};
# Include the Bugzilla CGI and general utility library. # Include the Bugzilla CGI and general utility library.
require "globals.pl"; require "globals.pl";
...@@ -250,7 +250,7 @@ sub changeEmail { ...@@ -250,7 +250,7 @@ sub changeEmail {
# confirmed initially so cancel token if it is not still available # confirmed initially so cancel token if it is not still available
if (! is_available_username($new_email,$old_email)) { if (! is_available_username($new_email,$old_email)) {
$vars->{'email'} = $new_email; # Needed for Bugzilla::Token::Cancel's mail $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 } ); ThrowUserError("account_exists", { email => $new_email } );
} }
...@@ -324,7 +324,7 @@ sub cancelChangeEmail { ...@@ -324,7 +324,7 @@ sub cancelChangeEmail {
$vars->{'old_email'} = $old_email; $vars->{'old_email'} = $old_email;
$vars->{'new_email'} = $new_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->bz_lock_tables('tokens WRITE');
$dbh->do(q{DELETE FROM tokens WHERE userid = ? $dbh->do(q{DELETE FROM tokens WHERE userid = ?
......
...@@ -35,7 +35,10 @@ use Bugzilla::User; ...@@ -35,7 +35,10 @@ use Bugzilla::User;
require "globals.pl"; require "globals.pl";
# Use global template variables. # 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 # Each panel has two functions - panel Foo has a DoFoo, to get the data
......
...@@ -32,10 +32,9 @@ use Bugzilla::Bug; ...@@ -32,10 +32,9 @@ use Bugzilla::Bug;
require "globals.pl"; require "globals.pl";
# Use global template variables
use vars qw($template $vars);
my $cgi = Bugzilla->cgi; 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_bug, you need a bug_id.
# If the action is show_user, you can supply a userid to show the votes for # If the action is show_user, you can supply a userid to show the votes for
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment