Commit 8d06d1ef authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 301508: Remove CGI.pl - Patch by Frédéric Buclin <LpSolit@gmail.com> r=mkanat,wicked a=justdave

parent 67b67a2e
...@@ -28,8 +28,8 @@ use strict; ...@@ -28,8 +28,8 @@ use strict;
package Bugzilla::Attachment; package Bugzilla::Attachment;
# This module requires that its caller have said "require CGI.pl" to import # This module requires that its caller have said "require globals.pl" to import
# relevant functions from that script and its companion globals.pl. # relevant functions from that script.
# Use the Flag module to handle flags. # Use the Flag module to handle flags.
use Bugzilla::Flag; use Bugzilla::Flag;
......
...@@ -37,12 +37,11 @@ See below for more information. ...@@ -37,12 +37,11 @@ See below for more information.
=item * =item *
Prior to calling routines in this module, it's assumed that you have Prior to calling routines in this module, it's assumed that you have
already done a C<require CGI.pl>. This will eventually change in a already done a C<require globals.pl>.
future version when CGI.pl is removed.
=item * =item *
Import relevant functions from that script and its companion globals.pl. Import relevant functions from that script.
=item * =item *
......
...@@ -35,8 +35,7 @@ See below for more information. ...@@ -35,8 +35,7 @@ See below for more information.
=item * =item *
Prior to calling routines in this module, it's assumed that you have Prior to calling routines in this module, it's assumed that you have
already done a C<require CGI.pl>. This will eventually change in a already done a C<require globals.pl>.
future version when CGI.pl is removed.
=item * =item *
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
use strict; use strict;
# The caller MUST require CGI.pl and globals.pl before using this # The caller MUST require globals.pl before using this module.
use vars qw($userid); use vars qw($userid);
......
...@@ -37,8 +37,8 @@ use Bugzilla::Util; ...@@ -37,8 +37,8 @@ use Bugzilla::Util;
use Date::Format; use Date::Format;
use Date::Parse; use Date::Parse;
# This module requires that its caller have said "require CGI.pl" to import # This module requires that its caller have said "require globals.pl" to import
# relevant functions from that script and its companion globals.pl. # relevant functions from that script.
################################################################################ ################################################################################
# Constants # Constants
......
# -*- Mode: perl; indent-tabs-mode: nil -*-
#
# The contents of this file are subject to the Mozilla Public
# License Version 1.1 (the "License"); you may not use this file
# except in compliance with the License. You may obtain a copy of
# the License at http://www.mozilla.org/MPL/
#
# Software distributed under the License is distributed on an "AS
# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
# implied. See the License for the specific language governing
# rights and limitations under the License.
#
# The Original Code is the Bugzilla Bug Tracking System.
#
# The Initial Developer of the Original Code is Netscape Communications
# Corporation. Portions created by Netscape are
# Copyright (C) 1998 Netscape Communications Corporation. All
# Rights Reserved.
#
# Contributor(s): Terry Weissman <terry@mozilla.org>
# Dan Mosedale <dmose@mozilla.org>
# Joe Robins <jmrobins@tgix.com>
# Dave Miller <justdave@syndicomm.com>
# Christopher Aillon <christopher@aillon.com>
# Gervase Markham <gerv@gerv.net>
# Christian Reis <kiko@async.com.br>
# Contains some global routines used throughout the CGI scripts of Bugzilla.
use strict;
use lib ".";
# use Carp; # for confess
use Bugzilla::Util;
use Bugzilla::Config;
use Bugzilla::Constants;
use Bugzilla::Error;
use Bugzilla::BugMail;
use Bugzilla::Bug;
use Bugzilla::User;
# Shut up misguided -w warnings about "used only once". For some reason,
# "use vars" chokes on me when I try it here.
sub CGI_pl_sillyness {
my $zz;
$zz = $::buffer;
}
require 'globals.pl';
use vars qw($vars);
############# Live code below here (that is, not subroutine defs) #############
use Bugzilla;
# XXX - mod_perl - reset this between runs
$::cgi = Bugzilla->cgi;
$::buffer = $::cgi->query_string();
# This could be needed in any CGI, so we set it here.
$vars->{'help'} = $::cgi->param('help') ? 1 : 0;
1;
...@@ -35,13 +35,10 @@ use strict; ...@@ -35,13 +35,10 @@ use strict;
use lib qw(.); use lib qw(.);
use vars qw( use vars qw($template $vars);
$template
$vars
);
# Include the Bugzilla CGI and general utility library. # Include the Bugzilla CGI and general utility library.
require "CGI.pl"; require "globals.pl";
use Bugzilla::Config qw(:locations); use Bugzilla::Config qw(:locations);
# Use these modules to handle flags. # Use these modules to handle flags.
...@@ -135,7 +132,7 @@ sub validateID ...@@ -135,7 +132,7 @@ sub validateID
# Happens when calling plain attachment.cgi from the urlbar directly # Happens when calling plain attachment.cgi from the urlbar directly
if ($param eq 'id' && !$cgi->param('id')) { if ($param eq 'id' && !$cgi->param('id')) {
print Bugzilla->cgi->header(); print $cgi->header();
$template->process("attachment/choose.html.tmpl", $vars) || $template->process("attachment/choose.html.tmpl", $vars) ||
ThrowTemplateError($template->error()); ThrowTemplateError($template->error());
exit; exit;
...@@ -512,7 +509,7 @@ sub view ...@@ -512,7 +509,7 @@ sub view
$filename =~ s/\\/\\\\/g; # escape backslashes $filename =~ s/\\/\\\\/g; # escape backslashes
$filename =~ s/"/\\"/g; # escape quotes $filename =~ s/"/\\"/g; # escape quotes
print Bugzilla->cgi->header(-type=>"$contenttype; name=\"$filename\"", print $cgi->header(-type=>"$contenttype; name=\"$filename\"",
-content_disposition=> "inline; filename=\"$filename\"", -content_disposition=> "inline; filename=\"$filename\"",
-content_length => $filesize); -content_length => $filesize);
...@@ -746,7 +743,6 @@ sub diff ...@@ -746,7 +743,6 @@ sub diff
require PatchReader::DiffPrinter::raw; require PatchReader::DiffPrinter::raw;
$last_reader->sends_data_to(new PatchReader::DiffPrinter::raw()); $last_reader->sends_data_to(new PatchReader::DiffPrinter::raw());
# Actually print out the patch # Actually print out the patch
use vars qw($cgi);
print $cgi->header(-type => 'text/plain', print $cgi->header(-type => 'text/plain',
-expires => '+3M'); -expires => '+3M');
$reader->iterate_string("Attachment $attach_id", $thedata); $reader->iterate_string("Attachment $attach_id", $thedata);
...@@ -830,7 +826,7 @@ sub viewall ...@@ -830,7 +826,7 @@ sub viewall
$vars->{'bugsummary'} = $bugsummary; $vars->{'bugsummary'} = $bugsummary;
$vars->{'GetBugLink'} = \&GetBugLink; $vars->{'GetBugLink'} = \&GetBugLink;
print Bugzilla->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("attachment/show-multiple.html.tmpl", $vars) $template->process("attachment/show-multiple.html.tmpl", $vars)
...@@ -887,7 +883,7 @@ sub enter ...@@ -887,7 +883,7 @@ sub enter
$vars->{'any_flags_requesteeble'} = grep($_->{'is_requesteeble'}, $vars->{'any_flags_requesteeble'} = grep($_->{'is_requesteeble'},
@$flag_types); @$flag_types);
print Bugzilla->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("attachment/create.html.tmpl", $vars) $template->process("attachment/create.html.tmpl", $vars)
...@@ -1070,7 +1066,7 @@ sub insert ...@@ -1070,7 +1066,7 @@ sub insert
$vars->{'contenttypemethod'} = $cgi->param('contenttypemethod'); $vars->{'contenttypemethod'} = $cgi->param('contenttypemethod');
$vars->{'contenttype'} = $cgi->param('contenttype'); $vars->{'contenttype'} = $cgi->param('contenttype');
print Bugzilla->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("attachment/created.html.tmpl", $vars) $template->process("attachment/created.html.tmpl", $vars)
...@@ -1135,7 +1131,7 @@ sub edit ...@@ -1135,7 +1131,7 @@ sub edit
require PatchReader; require PatchReader;
$vars->{'patchviewerinstalled'} = 1; $vars->{'patchviewerinstalled'} = 1;
}; };
print Bugzilla->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("attachment/edit.html.tmpl", $vars) $template->process("attachment/edit.html.tmpl", $vars)
...@@ -1290,7 +1286,7 @@ sub update ...@@ -1290,7 +1286,7 @@ sub update
$vars->{'attachid'} = $attach_id; $vars->{'attachid'} = $attach_id;
$vars->{'bugid'} = $bugid; $vars->{'bugid'} = $bugid;
print Bugzilla->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("attachment/updated.html.tmpl", $vars) $template->process("attachment/updated.html.tmpl", $vars)
......
...@@ -42,7 +42,7 @@ use Bugzilla::Constants; ...@@ -42,7 +42,7 @@ use Bugzilla::Constants;
use Bugzilla::User; use Bugzilla::User;
# Include the Bugzilla CGI and general utility library. # Include the Bugzilla CGI and general utility library.
require "CGI.pl"; require "globals.pl";
use vars qw($db_name use vars qw($db_name
@components @components
...@@ -58,8 +58,9 @@ use vars qw($db_name ...@@ -58,8 +58,9 @@ use vars qw($db_name
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $buffer = $cgi->query_string();
if (length($::buffer) == 0) { if (length($buffer) == 0) {
print $cgi->header(-refresh=> '10; URL=query.cgi'); print $cgi->header(-refresh=> '10; URL=query.cgi');
ThrowUserError("buglist_parameters_required"); ThrowUserError("buglist_parameters_required");
} }
...@@ -146,8 +147,8 @@ if (defined $cgi->param('regetlastlist')) { ...@@ -146,8 +147,8 @@ if (defined $cgi->param('regetlastlist')) {
}); });
} }
if ($::buffer =~ /&cmd-/) { if ($buffer =~ /&cmd-/) {
my $url = "query.cgi?$::buffer#chart"; my $url = "query.cgi?$buffer#chart";
print $cgi->redirect(-location => $url); print $cgi->redirect(-location => $url);
# Generate and return the UI (HTML page) from the appropriate template. # Generate and return the UI (HTML page) from the appropriate template.
$vars->{'message'} = "buglist_adding_field"; $vars->{'message'} = "buglist_adding_field";
...@@ -361,18 +362,18 @@ if ($cgi->param('cmdtype') eq "dorem" && $cgi->param('remaction') =~ /^run/) { ...@@ -361,18 +362,18 @@ if ($cgi->param('cmdtype') eq "dorem" && $cgi->param('remaction') =~ /^run/) {
# Take appropriate action based on user's request. # Take appropriate action based on user's request.
if ($cgi->param('cmdtype') eq "dorem") { if ($cgi->param('cmdtype') eq "dorem") {
if ($cgi->param('remaction') eq "run") { if ($cgi->param('remaction') eq "run") {
$::buffer = LookupNamedQuery(scalar $cgi->param("namedcmd")); $buffer = LookupNamedQuery(scalar $cgi->param("namedcmd"));
$vars->{'searchname'} = $cgi->param('namedcmd'); $vars->{'searchname'} = $cgi->param('namedcmd');
$vars->{'searchtype'} = "saved"; $vars->{'searchtype'} = "saved";
$params = new Bugzilla::CGI($::buffer); $params = new Bugzilla::CGI($buffer);
$order = $params->param('order') || $order; $order = $params->param('order') || $order;
} }
elsif ($cgi->param('remaction') eq "runseries") { elsif ($cgi->param('remaction') eq "runseries") {
$::buffer = LookupSeries(scalar $cgi->param("series_id")); $buffer = LookupSeries(scalar $cgi->param("series_id"));
$vars->{'searchname'} = $cgi->param('namedcmd'); $vars->{'searchname'} = $cgi->param('namedcmd');
$vars->{'searchtype'} = "series"; $vars->{'searchtype'} = "series";
$params = new Bugzilla::CGI($::buffer); $params = new Bugzilla::CGI($buffer);
$order = $params->param('order') || $order; $order = $params->param('order') || $order;
} }
elsif ($cgi->param('remaction') eq "forget") { elsif ($cgi->param('remaction') eq "forget") {
...@@ -402,7 +403,7 @@ if ($cgi->param('cmdtype') eq "dorem") { ...@@ -402,7 +403,7 @@ if ($cgi->param('cmdtype') eq "dorem") {
elsif (($cgi->param('cmdtype') eq "doit") && defined $cgi->param('remtype')) { elsif (($cgi->param('cmdtype') eq "doit") && defined $cgi->param('remtype')) {
if ($cgi->param('remtype') eq "asdefault") { if ($cgi->param('remtype') eq "asdefault") {
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
InsertNamedQuery(Bugzilla->user->id, DEFAULT_QUERY_NAME, $::buffer); InsertNamedQuery(Bugzilla->user->id, DEFAULT_QUERY_NAME, $buffer);
$vars->{'message'} = "buglist_new_default_query"; $vars->{'message'} = "buglist_new_default_query";
} }
elsif ($cgi->param('remtype') eq "asnamed") { elsif ($cgi->param('remtype') eq "asnamed") {
...@@ -439,7 +440,7 @@ elsif (($cgi->param('cmdtype') eq "doit") && defined $cgi->param('remtype')) { ...@@ -439,7 +440,7 @@ elsif (($cgi->param('cmdtype') eq "doit") && defined $cgi->param('remtype')) {
# form - see bug 252295 # form - see bug 252295
if (!$params->param('query_format')) { if (!$params->param('query_format')) {
$params->param('query_format', 'advanced'); $params->param('query_format', 'advanced');
$::buffer = $params->query_string; $buffer = $params->query_string;
} }
################################################################################ ################################################################################
...@@ -937,7 +938,7 @@ $vars->{'closedstates'} = ['CLOSED', 'VERIFIED', 'RESOLVED']; ...@@ -937,7 +938,7 @@ $vars->{'closedstates'} = ['CLOSED', 'VERIFIED', 'RESOLVED'];
# buffer that was created when we initially parsed the URL on script startup, # buffer that was created when we initially parsed the URL on script startup,
# then we remove all non-query fields from it, f.e. the sort order (order) # then we remove all non-query fields from it, f.e. the sort order (order)
# and command type (cmdtype) fields. # and command type (cmdtype) fields.
$vars->{'urlquerypart'} = $::buffer; $vars->{'urlquerypart'} = $buffer;
$vars->{'urlquerypart'} =~ s/(order|cmdtype)=[^&]*&?//g; $vars->{'urlquerypart'} =~ s/(order|cmdtype)=[^&]*&?//g;
$vars->{'order'} = $order; $vars->{'order'} = $order;
......
...@@ -44,13 +44,17 @@ ...@@ -44,13 +44,17 @@
use strict; use strict;
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Chart; use Bugzilla::Chart;
use Bugzilla::Series; use Bugzilla::Series;
use Bugzilla::User; use Bugzilla::User;
use vars qw($cgi $template $vars); use vars qw($vars);
my $cgi = Bugzilla->cgi;
my $template = Bugzilla->template;
# 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())) {
...@@ -60,7 +64,6 @@ if (grep(/^cmd-/, $cgi->param())) { ...@@ -60,7 +64,6 @@ if (grep(/^cmd-/, $cgi->param())) {
exit; exit;
} }
my $template = Bugzilla->template;
my $action = $cgi->param('action'); my $action = $cgi->param('action');
my $series_id = $cgi->param('series_id'); my $series_id = $cgi->param('series_id');
......
...@@ -27,7 +27,6 @@ use lib qw(.); ...@@ -27,7 +27,6 @@ use lib qw(.);
use vars qw( use vars qw(
@legal_keywords @legal_keywords
$buffer
$template $template
$vars $vars
); );
...@@ -35,7 +34,7 @@ use vars qw( ...@@ -35,7 +34,7 @@ use vars qw(
use Bugzilla; use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::User; use Bugzilla::User;
require "CGI.pl"; require "globals.pl";
Bugzilla->login(); Bugzilla->login();
...@@ -150,7 +149,7 @@ if (defined $cgi->cookie('COLUMNLIST')) { ...@@ -150,7 +149,7 @@ if (defined $cgi->cookie('COLUMNLIST')) {
$vars->{'collist'} = \@collist; $vars->{'collist'} = \@collist;
$vars->{'splitheader'} = $cgi->cookie('SPLITHEADER') ? 1 : 0; $vars->{'splitheader'} = $cgi->cookie('SPLITHEADER') ? 1 : 0;
$vars->{'buffer'} = $::buffer; $vars->{'buffer'} = $cgi->query_string();
# Generate and return the UI (HTML page) from the appropriate template. # Generate and return the UI (HTML page) from the appropriate template.
print $cgi->header(); print $cgi->header();
......
...@@ -31,7 +31,7 @@ use strict; ...@@ -31,7 +31,7 @@ use strict;
# Include the Bugzilla CGI and general utility library. # Include the Bugzilla CGI and general utility library.
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
# Retrieve this installation's configuration. # Retrieve this installation's configuration.
GetVersionTable(); GetVersionTable();
......
...@@ -25,7 +25,7 @@ use strict; ...@@ -25,7 +25,7 @@ use strict;
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::BugMail; use Bugzilla::BugMail;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
use strict; use strict;
require "CGI.pl"; require "globals.pl";
use lib qw(.); use lib qw(.);
......
...@@ -28,7 +28,7 @@ use strict; ...@@ -28,7 +28,7 @@ use strict;
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
use Bugzilla; use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
......
...@@ -26,7 +26,7 @@ use lib qw(.); ...@@ -26,7 +26,7 @@ use lib qw(.);
use Bugzilla; use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
require "CGI.pl"; require "globals.pl";
use vars qw($vars @legal_product); use vars qw($vars @legal_product);
......
...@@ -27,7 +27,7 @@ use lib "."; ...@@ -27,7 +27,7 @@ use lib ".";
use Bugzilla; use Bugzilla;
use Bugzilla::User; use Bugzilla::User;
require "CGI.pl"; require "globals.pl";
# Use the global template variables. # Use the global template variables.
use vars qw($vars $template); use vars qw($vars $template);
......
...@@ -30,7 +30,7 @@ use Bugzilla::Constants; ...@@ -30,7 +30,7 @@ use Bugzilla::Constants;
use Bugzilla::Config qw(:DEFAULT :admin $datadir); use Bugzilla::Config qw(:DEFAULT :admin $datadir);
use Bugzilla::User; use Bugzilla::User;
require "CGI.pl"; require "globals.pl";
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
......
...@@ -30,7 +30,6 @@ use AnyDBM_File; ...@@ -30,7 +30,6 @@ use AnyDBM_File;
use lib qw(.); use lib qw(.);
require "globals.pl"; require "globals.pl";
require "CGI.pl";
use Bugzilla; use Bugzilla;
use Bugzilla::Search; use Bugzilla::Search;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
use strict; use strict;
use lib "."; use lib ".";
require "CGI.pl";
require "globals.pl"; require "globals.pl";
use Bugzilla::Constants; use Bugzilla::Constants;
...@@ -36,6 +35,7 @@ use Bugzilla::Config qw(:DEFAULT $datadir); ...@@ -36,6 +35,7 @@ use Bugzilla::Config qw(:DEFAULT $datadir);
use Bugzilla::Series; use Bugzilla::Series;
use Bugzilla::Util; use Bugzilla::Util;
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::Bug;
use vars qw($template $vars); use vars qw($template $vars);
......
...@@ -29,7 +29,7 @@ use strict; ...@@ -29,7 +29,7 @@ use strict;
use lib "."; use lib ".";
# Include the Bugzilla CGI and general utility library. # Include the Bugzilla CGI and general utility library.
require "CGI.pl"; require "globals.pl";
# Use Bugzilla's flag modules for handling flag types. # Use Bugzilla's flag modules for handling flag types.
use Bugzilla; use Bugzilla;
......
...@@ -32,7 +32,7 @@ use lib "."; ...@@ -32,7 +32,7 @@ use lib ".";
use Bugzilla; use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::User; use Bugzilla::User;
require "CGI.pl"; require "globals.pl";
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
use strict; use strict;
use lib "."; use lib ".";
require "CGI.pl"; require "globals.pl";
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Config qw(:DEFAULT $datadir); use Bugzilla::Config qw(:DEFAULT $datadir);
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
use strict; use strict;
use lib "."; use lib ".";
require "CGI.pl";
require "globals.pl"; require "globals.pl";
use Bugzilla::Constants; use Bugzilla::Constants;
......
...@@ -29,7 +29,7 @@ use Bugzilla::Constants; ...@@ -29,7 +29,7 @@ use Bugzilla::Constants;
use Bugzilla::Config qw(:DEFAULT :admin); use Bugzilla::Config qw(:DEFAULT :admin);
use Bugzilla::User; use Bugzilla::User;
require "CGI.pl"; require "globals.pl";
Bugzilla->login(LOGIN_REQUIRED); Bugzilla->login(LOGIN_REQUIRED);
......
...@@ -33,7 +33,6 @@ use strict; ...@@ -33,7 +33,6 @@ use strict;
use lib "."; use lib ".";
use vars qw ($template $vars); use vars qw ($template $vars);
use Bugzilla::Constants; use Bugzilla::Constants;
require "CGI.pl";
require "globals.pl"; require "globals.pl";
use Bugzilla::Bug; use Bugzilla::Bug;
use Bugzilla::Series; use Bugzilla::Series;
......
...@@ -24,7 +24,7 @@ use Bugzilla::Constants; ...@@ -24,7 +24,7 @@ use Bugzilla::Constants;
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::User::Setting; use Bugzilla::User::Setting;
require "CGI.pl"; require "globals.pl";
# Use global template variables. # Use global template variables.
use vars qw($template $vars); use vars qw($template $vars);
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
use strict; use strict;
use lib "."; use lib ".";
require "CGI.pl";
require "globals.pl"; require "globals.pl";
use vars qw( $vars ); use vars qw( $vars );
......
...@@ -31,7 +31,6 @@ ...@@ -31,7 +31,6 @@
use strict; use strict;
use lib "."; use lib ".";
require "CGI.pl";
require "globals.pl"; require "globals.pl";
use Bugzilla::Constants; use Bugzilla::Constants;
......
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
use strict; use strict;
use lib "."; use lib ".";
require "CGI.pl";
require "globals.pl"; require "globals.pl";
use vars qw( $vars ); use vars qw( $vars );
......
...@@ -41,7 +41,7 @@ use Bugzilla; ...@@ -41,7 +41,7 @@ use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Bug; use Bugzilla::Bug;
use Bugzilla::User; use Bugzilla::User;
require "CGI.pl"; require "globals.pl";
use vars qw( use vars qw(
$template $template
......
...@@ -37,6 +37,7 @@ use Bugzilla::Util; ...@@ -37,6 +37,7 @@ use Bugzilla::Util;
use Bugzilla::Config qw(:DEFAULT ChmodDataFile $localconfig $datadir); use Bugzilla::Config qw(:DEFAULT ChmodDataFile $localconfig $datadir);
use Bugzilla::BugMail; use Bugzilla::BugMail;
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::Error;
# Shut up misguided -w warnings about "used only once". For some reason, # Shut up misguided -w warnings about "used only once". For some reason,
# "use vars" chokes on me when I try it here. # "use vars" chokes on me when I try it here.
......
...@@ -69,7 +69,6 @@ $Data::Dumper::Useqq = 1; ...@@ -69,7 +69,6 @@ $Data::Dumper::Useqq = 1;
use Bugzilla::BugMail; use Bugzilla::BugMail;
use Bugzilla::User; use Bugzilla::User;
require "CGI.pl";
require "globals.pl"; require "globals.pl";
GetVersionTable(); GetVersionTable();
......
...@@ -30,11 +30,9 @@ use strict; ...@@ -30,11 +30,9 @@ use strict;
# Include the Bugzilla CGI and general utility library. # Include the Bugzilla CGI and general utility library.
use lib "."; use lib ".";
require "CGI.pl"; require "globals.pl";
use vars qw( use vars qw($vars);
$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;
......
...@@ -23,10 +23,9 @@ ...@@ -23,10 +23,9 @@
use strict; use strict;
use lib qw(.); use lib qw(.);
use Bugzilla;
require "CGI.pl"; my $cgi = Bugzilla->cgi;
our $cgi;
# Convert comma/space separated elements into separate params # Convert comma/space separated elements into separate params
my @ids = (); my @ids = ();
......
...@@ -26,7 +26,7 @@ use strict; ...@@ -26,7 +26,7 @@ use strict;
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
use vars qw($template $userid); use vars qw($template $userid);
......
...@@ -34,7 +34,7 @@ use lib "."; ...@@ -34,7 +34,7 @@ use lib ".";
use Bugzilla; use Bugzilla;
require "CGI.pl"; require "globals.pl";
use vars qw($template $vars); use vars qw($template $vars);
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
use strict; use strict;
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
use Bugzilla; use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Bug; use Bugzilla::Bug;
...@@ -37,7 +37,6 @@ use Bugzilla::Field; ...@@ -37,7 +37,6 @@ use Bugzilla::Field;
# "use vars" chokes on me when I try it here. # "use vars" chokes on me when I try it here.
sub sillyness { sub sillyness {
my $zz; my $zz;
$zz = $::buffer;
$zz = %::components; $zz = %::components;
$zz = %::versions; $zz = %::versions;
$zz = @::legal_opsys; $zz = @::legal_opsys;
...@@ -52,9 +51,7 @@ sub sillyness { ...@@ -52,9 +51,7 @@ sub sillyness {
use vars qw($vars $template); 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;
# do a match on the fields if applicable # do a match on the fields if applicable
...@@ -94,7 +91,7 @@ if (defined $cgi->param('product')) { ...@@ -94,7 +91,7 @@ if (defined $cgi->param('product')) {
} }
if (defined $cgi->param('maketemplate')) { if (defined $cgi->param('maketemplate')) {
$vars->{'url'} = $::buffer; $vars->{'url'} = $cgi->query_string();
print $cgi->header(); print $cgi->header();
$template->process("bug/create/make-template.html.tmpl", $vars) $template->process("bug/create/make-template.html.tmpl", $vars)
......
...@@ -46,7 +46,7 @@ my $PrivilegesRequired = 0; ...@@ -46,7 +46,7 @@ my $PrivilegesRequired = 0;
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
use Bugzilla; use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Bug; use Bugzilla::Bug;
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
use strict; use strict;
use lib "."; use lib ".";
require "CGI.pl"; require "globals.pl";
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Search; use Bugzilla::Search;
...@@ -36,7 +36,6 @@ use Bugzilla::User; ...@@ -36,7 +36,6 @@ use Bugzilla::User;
use Bugzilla::Util; use Bugzilla::Util;
use vars qw( use vars qw(
@CheckOptionValues
@legal_resolution @legal_resolution
@legal_bug_status @legal_bug_status
@legal_components @legal_components
...@@ -57,6 +56,7 @@ use vars qw( ...@@ -57,6 +56,7 @@ use vars qw(
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
my $buffer = $cgi->query_string();
if ($cgi->param("GoAheadAndLogIn")) { if ($cgi->param("GoAheadAndLogIn")) {
# We got here from a login page, probably from relogin.cgi. We better # We got here from a login page, probably from relogin.cgi. We better
...@@ -112,7 +112,7 @@ if ($cgi->param('nukedefaultquery')) { ...@@ -112,7 +112,7 @@ if ($cgi->param('nukedefaultquery')) {
" WHERE userid = ? AND name = ?", " WHERE userid = ? AND name = ?",
undef, ($userid, DEFAULT_QUERY_NAME)); undef, ($userid, DEFAULT_QUERY_NAME));
} }
$::buffer = ""; $buffer = "";
} }
my $userdefaultquery; my $userdefaultquery;
...@@ -200,7 +200,7 @@ sub PrefillForm { ...@@ -200,7 +200,7 @@ sub PrefillForm {
} }
if (!PrefillForm($::buffer)) { if (!PrefillForm($buffer)) {
# Ah-hah, there was no form stuff specified. Do it again with the # Ah-hah, there was no form stuff specified. Do it again with the
# default query. # default query.
if ($userdefaultquery) { if ($userdefaultquery) {
......
...@@ -25,15 +25,11 @@ ...@@ -25,15 +25,11 @@
use strict; use strict;
use vars qw( use vars qw($userid $template $vars);
$userid
$template
$vars
);
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
use Bugzilla::Constants; use Bugzilla::Constants;
......
...@@ -23,11 +23,9 @@ ...@@ -23,11 +23,9 @@
use strict; use strict;
use vars qw($template $vars);
use lib qw(.); use lib qw(.);
use Bugzilla;
require "CGI.pl"; use Bugzilla::Error;
# We don't want to remove a random logincookie from the db, so # We don't want to remove a random logincookie from the db, so
# call Bugzilla->login(). If we're logged in after this, then # call Bugzilla->login(). If we're logged in after this, then
...@@ -36,9 +34,11 @@ Bugzilla->login(); ...@@ -36,9 +34,11 @@ Bugzilla->login();
Bugzilla->logout(); Bugzilla->logout();
my $template = Bugzilla->template;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
print $cgi->header(); print $cgi->header();
my $vars = {};
$vars->{'message'} = "logged_out"; $vars->{'message'} = "logged_out";
$template->process("global/message.html.tmpl", $vars) $template->process("global/message.html.tmpl", $vars)
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
use strict; use strict;
use lib "."; use lib ".";
require "CGI.pl"; require "globals.pl";
use vars qw($template $vars @legal_opsys @legal_platform @legal_severity); use vars qw($template $vars @legal_opsys @legal_platform @legal_severity);
...@@ -32,6 +32,7 @@ use Bugzilla; ...@@ -32,6 +32,7 @@ use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
my $cgi = Bugzilla->cgi; my $cgi = Bugzilla->cgi;
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.
if (grep(/^cmd-/, $cgi->param())) { if (grep(/^cmd-/, $cgi->param())) {
...@@ -266,9 +267,9 @@ if ($action eq "wrap") { ...@@ -266,9 +267,9 @@ if ($action eq "wrap") {
# We need to keep track of the defined restrictions on each of the # We need to keep track of the defined restrictions on each of the
# axes, because buglistbase, below, throws them away. Without this, we # axes, because buglistbase, below, throws them away. Without this, we
# get buglistlinks wrong if there is a restriction on an axis field. # get buglistlinks wrong if there is a restriction on an axis field.
$vars->{'col_vals'} = join("&", $::buffer =~ /[&?]($col_field=[^&]+)/g); $vars->{'col_vals'} = join("&", $buffer =~ /[&?]($col_field=[^&]+)/g);
$vars->{'row_vals'} = join("&", $::buffer =~ /[&?]($row_field=[^&]+)/g); $vars->{'row_vals'} = join("&", $buffer =~ /[&?]($row_field=[^&]+)/g);
$vars->{'tbl_vals'} = join("&", $::buffer =~ /[&?]($tbl_field=[^&]+)/g); $vars->{'tbl_vals'} = join("&", $buffer =~ /[&?]($tbl_field=[^&]+)/g);
# We need a number of different variants of the base URL for different # We need a number of different variants of the base URL for different
# URLs in the HTML. # URLs in the HTML.
......
...@@ -39,8 +39,6 @@ use lib qw(.); ...@@ -39,8 +39,6 @@ use lib qw(.);
use Bugzilla::Config qw(:DEFAULT $datadir); use Bugzilla::Config qw(:DEFAULT $datadir);
require "CGI.pl";
require "globals.pl"; require "globals.pl";
use vars qw(@legal_product); # globals from er, globals.pl use vars qw(@legal_product); # globals from er, globals.pl
......
...@@ -29,7 +29,7 @@ use strict; ...@@ -29,7 +29,7 @@ use strict;
# Include the Bugzilla CGI and general utility library. # Include the Bugzilla CGI and general utility library.
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
# Use Bugzilla's Request module which contains utilities for handling requests. # Use Bugzilla's Request module which contains utilities for handling requests.
use Bugzilla::Flag; use Bugzilla::Flag;
......
...@@ -27,7 +27,7 @@ use strict; ...@@ -27,7 +27,7 @@ use strict;
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::User; use Bugzilla::User;
......
...@@ -27,7 +27,7 @@ use strict; ...@@ -27,7 +27,7 @@ use strict;
use lib qw(.); use lib qw(.);
use vars qw ($template $vars); use vars qw ($template $vars);
require "CGI.pl"; require "globals.pl";
use Bugzilla::Bug; use Bugzilla::Bug;
...@@ -54,7 +54,7 @@ ValidateBugID($bug_id); ...@@ -54,7 +54,7 @@ ValidateBugID($bug_id);
$vars->{'bug_id'} = $bug_id; $vars->{'bug_id'} = $bug_id;
print Bugzilla->cgi->header(); print $cgi->header();
$template->process("bug/activity/show.html.tmpl", $vars) $template->process("bug/activity/show.html.tmpl", $vars)
|| ThrowTemplateError($template->error()); || ThrowTemplateError($template->error());
......
...@@ -28,7 +28,7 @@ use Bugzilla; ...@@ -28,7 +28,7 @@ use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::User; use Bugzilla::User;
require "CGI.pl"; require "globals.pl";
use vars qw($template $vars $userid); use vars qw($template $vars $userid);
......
...@@ -32,7 +32,7 @@ use Bugzilla::Util; ...@@ -32,7 +32,7 @@ use Bugzilla::Util;
use Bugzilla::BugMail; use Bugzilla::BugMail;
use Bugzilla::Bug; use Bugzilla::Bug;
require "CGI.pl"; require "globals.pl";
Bugzilla->login(); Bugzilla->login();
......
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
use strict; use strict;
use lib qw(.); use lib qw(.);
require "CGI.pl"; require "globals.pl";
use Bugzilla::User; use Bugzilla::User;
use Bugzilla::Bug; use Bugzilla::Bug;
......
...@@ -18,13 +18,10 @@ ...@@ -18,13 +18,10 @@
use strict; use strict;
use lib "."; use lib ".";
require "CGI.pl"; require "globals.pl";
# Shut up "Used Only Once" errors # Shut up "Used Only Once" errors
use vars qw( use vars qw($template $vars);
$template
$vars
);
Bugzilla->login(); Bugzilla->login();
......
...@@ -27,7 +27,7 @@ use Bugzilla::Bug; # EmitDependList ...@@ -27,7 +27,7 @@ use Bugzilla::Bug; # EmitDependList
use Bugzilla::Util; # trim use Bugzilla::Util; # trim
use Bugzilla::Constants; # LOGIN_* use Bugzilla::Constants; # LOGIN_*
use Bugzilla::User; # UserInGroup use Bugzilla::User; # UserInGroup
require "CGI.pl"; require "globals.pl";
GetVersionTable(); GetVersionTable();
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
[% USE Bugzilla %] [% USE Bugzilla %]
[% cgi = Bugzilla.cgi %] [% cgi = Bugzilla.cgi %]
[% IF help %] [% IF cgi.param("help") %]
[% IF cgi.user_agent("Mozilla/5") %] [% IF cgi.user_agent("Mozilla/5") %]
<style type="text/css"> <style type="text/css">
.help { .help {
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
[% USE Bugzilla %] [% USE Bugzilla %]
[% cgi = Bugzilla.cgi %] [% cgi = Bugzilla.cgi %]
[% IF help %] [% IF cgi.param("help") %]
[% IF cgi.user_agent("Mozilla/5") %] [% IF cgi.user_agent("Mozilla/5") %]
[% FOREACH h = help_html %] [% FOREACH h = help_html %]
<div id="[% h.id %]_help" class="help" style="display: none;"> <div id="[% h.id %]_help" class="help" style="display: none;">
......
...@@ -51,7 +51,7 @@ var queryform = "queryform" ...@@ -51,7 +51,7 @@ var queryform = "queryform"
[% button_name = "Search" %] [% button_name = "Search" %]
[%# The decent help requires Javascript %] [%# The decent help requires Javascript %]
[% IF NOT help %] [% IF NOT cgi.param("help") %]
[% IF cgi.user_agent("Mozilla/5") %] [% IF cgi.user_agent("Mozilla/5") %]
<script type="text/javascript"> <!-- <script type="text/javascript"> <!--
document.write("<p><a href='query.cgi?help=1&amp;format=advanced'>Give me some help</a> (reloads page.)</p>"); document.write("<p><a href='query.cgi?help=1&amp;format=advanced'>Give me some help</a> (reloads page.)</p>");
...@@ -82,6 +82,6 @@ var queryform = "queryform" ...@@ -82,6 +82,6 @@ var queryform = "queryform"
</form> </form>
[% PROCESS "search/search-help.html.tmpl" IF help %] [% PROCESS "search/search-help.html.tmpl" IF cgi.param("help") %]
[% PROCESS global/footer.html.tmpl %] [% PROCESS global/footer.html.tmpl %]
...@@ -39,7 +39,7 @@ my $cgi = Bugzilla->cgi; ...@@ -39,7 +39,7 @@ my $cgi = Bugzilla->cgi;
my $dbh = Bugzilla->dbh; my $dbh = Bugzilla->dbh;
# Include the Bugzilla CGI and general utility library. # Include the Bugzilla CGI and general utility library.
require "CGI.pl"; require "globals.pl";
Bugzilla->login(LOGIN_OPTIONAL); Bugzilla->login(LOGIN_OPTIONAL);
......
...@@ -32,7 +32,7 @@ use Bugzilla::Search; ...@@ -32,7 +32,7 @@ use Bugzilla::Search;
use Bugzilla::Util; use Bugzilla::Util;
use Bugzilla::User; use Bugzilla::User;
require "CGI.pl"; require "globals.pl";
# Use global template variables. # Use global template variables.
use vars qw($template $vars $userid); use vars qw($template $vars $userid);
......
...@@ -30,7 +30,7 @@ use Bugzilla; ...@@ -30,7 +30,7 @@ use Bugzilla;
use Bugzilla::Constants; use Bugzilla::Constants;
use Bugzilla::Bug; use Bugzilla::Bug;
require "CGI.pl"; require "globals.pl";
# Use global template variables # Use global template variables
use vars qw($template $vars); use vars qw($template $vars);
......
...@@ -25,10 +25,9 @@ ...@@ -25,10 +25,9 @@
use strict; use strict;
use lib qw(.); use lib qw(.);
use Bugzilla;
require "CGI.pl"; my $cgi = Bugzilla->cgi;
our $cgi;
# Convert comma/space separated elements into separate params # Convert comma/space separated elements into separate params
my @ids = (); my @ids = ();
......
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