]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 312157: Remove $::template and $::vars from globals.pl - Patch by Olav Vitters...
authorlpsolit%gmail.com <>
Tue, 25 Oct 2005 06:11:55 +0000 (06:11 +0000)
committerlpsolit%gmail.com <>
Tue, 25 Oct 2005 06:11:55 +0000 (06:11 +0000)
44 files changed:
Bugzilla/Flag.pm
Bugzilla/Template.pm
Bugzilla/Token.pm
Bugzilla/User.pm
attachment.cgi
buglist.cgi
chart.cgi
colchange.cgi
config.cgi
createaccount.cgi
describecomponents.cgi
describekeywords.cgi
duplicates.cgi
editcomponents.cgi
editflagtypes.cgi
editgroups.cgi
editkeywords.cgi
editmilestones.cgi
editparams.cgi
editproducts.cgi
editsettings.cgi
editusers.cgi
editversions.cgi
editwhines.cgi
enter_bug.cgi
globals.pl
index.cgi
page.cgi
post_bug.cgi
process_bug.cgi
query.cgi
quips.cgi
report.cgi
reports.cgi
request.cgi
show_activity.cgi
show_bug.cgi
showdependencygraph.cgi
showdependencytree.cgi
sidebar.cgi
summarize_time.cgi
token.cgi
userprefs.cgi
votes.cgi

index 54a8bea80f3e821b2e6e329132af8150b2e47df9..6f0cb94ccd6f4f6889e80320b5c82bc27aebad70 100644 (file)
@@ -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);
index b1646dbf0c0027fc601f6b7faf8f1898887f76dc..4cbca29bd926161627f069ba33e70bbfcb4f054d 100644 (file)
@@ -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());
 }
 
index 1cf51a33215ff8fc902da2259b0b24ae21e169c9..6a263cbeeb88b2b1b7792dff79dc3c73312cc101 100644 (file)
@@ -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;
index 744dbd34afdfe8a9698971a7f4c80cd3017bfdb5..7f3736c28d65e33bc9b0d2ab9e96ac89b88042ea 100644 (file)
@@ -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;
 
index 964e6cbbc742d30a44aa78a2b7a1b8b3d9cd5bf5..0e03e45ce2ca94f5c9283ac73a29222c83a19040 100755 (executable)
@@ -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
index 11835c3a6885168d049cf27a2f229e798a3b64da..53f810c3cc0a79324319271e8458ce3cdb4fc690 100755 (executable)
@@ -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) {
index 566d0541fc141ba06dcdfc3337e64c6b67be0e51..2835bcaa2b9f0ac4417243e499b783ed496f39dc 100755 (executable)
--- 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())) {
index e99b81b70773248b2357feaf4dc46bfb4a69def8..43bfd86eeccedb741cf7d33552267e90132acd3a 100755 (executable)
@@ -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.
index 860115c81d8fe521d3594c8ab04f021bb623dfe7..bea4f6faa66290873aa0e4dd95f725a97b19806f 100755 (executable)
@@ -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;
index 1be63756da365c800f0e83cc8d0c568f54971428..8bb7829efc2749e249a8cbd482c3fb8c533f45ac 100755 (executable)
@@ -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.
index 8fec1ec262d67a91ccf672022f59a957d86441a9..4ce10390585b1f59e45d61c335b557d0d0f95297 100755 (executable)
@@ -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);
 
index ab88c2f152b0c09054a739fb542a63061375c989..19140199fefe78bdb6258e934f5757c09ea06486 100755 (executable)
@@ -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)
index 6348748bf9439aebe2db5a45df97384c6a407fd8..98b307526f0f709e75a8e152e8ef9d3a64af98c3 100755 (executable)
@@ -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();
 
index 5b5333e31f638a76ffab03b242fae4d933b09113..5b0088bd6604668e59e75ef62d3ea96f6037b47a 100755 (executable)
@@ -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:
index 3e70e901c8994024d2fdb1b541bf5cef8a8ea227..795ce985edadb75564453235681c55a57d756f86 100755 (executable)
@@ -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);
index d457303f1efe272b19b5e5a17f68181fc0a610ce..b11d0425a10bc6e0beaa77106b2b7eb537fb05bf 100755 (executable)
@@ -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);
 
index 77b8f0a22cdf1f43587458c910227d6c8bd75298..cdd01b77ebdf9a542ae3bd6a051b620472d40147 100755 (executable)
@@ -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) = @_;
index 3ca7ea998abdb00ed7f9f39147f45a8807d3f56b..95babd737a9ddc9925d57c2a52a7c4eac9d3bc99 100755 (executable)
@@ -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:
index 1aa52d81a4e278a190d1d7666f7da207979f3b9d..dec30ab83fcfe0f099c7e3461528c11d320a5704 100755 (executable)
@@ -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();
 
index 13614f2697ee5a00211ea7cdc6a91a2f7929fbb5..23d212a9c602f1d32f44b10c8c5fdc4e4e1513eb 100755 (executable)
@@ -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')
index 883666074fca51034851afe2bb321ffd94179d29..231c1aea8c2b5802373bcddba5cb6cc6c49e121e 100755 (executable)
@@ -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 ###
index d967123a75cd21011e794c202f6906208d0b8cdd..5f577f061ed4d19f4407f6f6a8afbe859d95bb5f 100755 (executable)
@@ -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;
index bc7420b19113eef51209e823aba4dbfbfcbc9687..396a6e6052e16a423cb5656746e3cae91a6eeee8 100755 (executable)
@@ -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:
index 2b70acc139a903de3d1fe19f69bdab3ff56df7cb..49acb94ff15fa8165b1fc83c5b71d56acae5e546 100755 (executable)
@@ -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;
index 569d9554c33159416c9739b2a55c4645d2fd72b7..230d39bf847e1cb80c642184da704670d9525b61 100755 (executable)
@@ -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');
 
index e7e3f752194d1e2d77cab2ae427a4593e3fc5c37..0f7128c6e8ac12aa8af76d89a232973b053b4295 100644 (file)
@@ -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;
index 694292fc7bf0446d6ffab3793011633881125c96..f3e8ccd17fbd86c049af1bb54f6049a18ef27e9c 100755 (executable)
--- 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());
index 97f425ba22fd1dc3ae83e2de79ccee0ff00281db..b160cf021bec2768d24b9c465037641a6828b7c9 100755 (executable)
--- 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 {
index 0965728b70012cc6c288818e69aa1a78814b9f21..c1af2a5d04580a4be168f1b1eb1b8387c91b6b2e 100755 (executable)
@@ -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
 
index 9f556cc0ae95eb97794281b3aeebfe90db4add84..1e8ed8494b74138af6f470936fa87af95dbd16e7 100755 (executable)
@@ -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
 ######################################################################
index 986e2350b651647be23bb04b15f7cea3c3df10b3..114cb7f9f4428b53b7401dee6150446d1d1c5743 100755 (executable)
--- 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")) {
index 364f51448d8e59a0d81bb54053222cffac56aea4..f661d5476db8bf953ace6227f79979f2fa019cdd 100755 (executable)
--- 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') || "";
 
index 79c72beaaa244d019a2bd202b3345e14c71844ff..ad92e27f3b1358e824520d6811c4731e5f31fcaa 100755 (executable)
@@ -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.
index c060045eb0d5049587065af4171c4c6bed317374..5553f2c9766b98973f5c2cd12f25c22b6908d1a2 100755 (executable)
@@ -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);
index c7705f38dc53e729f876971e9a249e227b3d68bd..5506f79ce7271e7246ac17aafb17fd7f8a3c2211 100755 (executable)
@@ -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 = {};
 
 
 ################################################################################
index b0ad42379c07ddac3ef7b451f033abf9a79f1ae9..9b7273a4cd35c133c818d2f1b354b83a2f4ccf92 100755 (executable)
 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
index 31619800b4fcd2398e1c104e310b7182b9e5ffbb..0a99598b56ef88458cb5246fef2498cae534315f 100755 (executable)
@@ -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);
index 39508290d4388f6e79c23986d992ac22fa01bd7a..fee477f3aa9867ca932ccc4ae7f2a4befb90380b 100755 (executable)
@@ -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;
index 7c3b9946512f50822914f6f04206a99fe24c277f..dede3e1c77e678e7fe82a572b61f01b07c54b84b 100755 (executable)
@@ -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.
index 15506eba43e9e2564d51c4ac520afc45355c2cae..2f7743ebb59a6f1bcf74bfaa9fbcb1c7553ea003 100755 (executable)
@@ -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");
index c04a956d763e78850f776a8e27f913e57f3b92c5..e65b7da95f7691140ae9f26c3d29a7681ab9d396 100755 (executable)
@@ -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
index 3c818bc23605daa20e5d4e29d312981274700fae..aaac4f7acefeb09533a3dfb64cfa376109eb84b3 100755 (executable)
--- 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 = ?
index 07bc048cc8a360ab4af3ba31d5cd1370b9c582c9..796f2e0f9327920bf70078bc2b8d3e9d79043aa1 100755 (executable)
@@ -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 
index 61a57e06f284b5b66ce9c8bc15be9929ed00a93a..f30eebe3cab417ce486914833912fd9dc2c8a53a 100755 (executable)
--- 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