]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Fix for bug 234175: Remove deprecated ConnectToDatabase() and
authorkiko%async.com.br <>
Sat, 27 Mar 2004 11:51:43 +0000 (11:51 +0000)
committerkiko%async.com.br <>
Sat, 27 Mar 2004 11:51:43 +0000 (11:51 +0000)
quietly_check_login()/confirm_login() calls.  Cleans up callsites
(consisting of most of our CGIs), swapping (where appropriate) for calls
to Bugzilla->login. Patch by Teemu Mannermaa <wicked@etlicon.fi>.
r=bbaetz, kiko. a=justdave.

50 files changed:
Bugzilla/DB.pm
CGI.pl
attachment.cgi
buglist.cgi
chart.cgi
colchange.cgi
collectstats.pl
config.cgi
contrib/bug_email.pl
contrib/bugzilla_email_append.pl
contrib/syncLDAP.pl
createaccount.cgi
describecomponents.cgi
describekeywords.cgi
doeditparams.cgi
duplicates.cgi
editcomponents.cgi
editflagtypes.cgi
editgroups.cgi
editkeywords.cgi
editmilestones.cgi
editparams.cgi
editproducts.cgi
editusers.cgi
editversions.cgi
enter_bug.cgi
importxml.pl
index.cgi
long_list.cgi
move.pl
page.cgi
post_bug.cgi
process_bug.cgi
query.cgi
queryhelp.cgi
quips.cgi
relogin.cgi
report.cgi
reports.cgi
request.cgi
sanitycheck.cgi
show_activity.cgi
show_bug.cgi
showdependencygraph.cgi
showdependencytree.cgi
sidebar.cgi
token.cgi
userprefs.cgi
votes.cgi
whineatnews.pl

index a747aebd6ce6c9c037106e277587030f66d6c5e1..684869006ecdc1ff8e4cbbd85b0d078c48712bef 100644 (file)
@@ -33,7 +33,7 @@ use base qw(Exporter);
 
 %Bugzilla::DB::EXPORT_TAGS =
   (
-   deprecated => [qw(ConnectToDatabase SendSQL SqlQuote
+   deprecated => [qw(SendSQL SqlQuote
                      MoreSQLData FetchSQLData FetchOneColumn
                      PushGlobalSQLState PopGlobalSQLState)
                  ],
@@ -49,10 +49,6 @@ use Bugzilla::Util;
 # having a separate package for it, or otherwise trying to avoid the circular
 # dependancy
 
-sub ConnectToDatabase {
-    # We've already been connected in Bugzilla.pm
-}
-
 # XXX - mod_perl
 # These use |our| instead of |my| because they need to be cleared from
 # Bugzilla.pm. See bug 192531 for details.
@@ -222,10 +218,6 @@ and so are not documented.
 
 =item *
 
-ConnectToDatabase
-
-=item *
-
 SendSQL
 
 =item *
diff --git a/CGI.pl b/CGI.pl
index 982b067b224d1f1e1ce2cac3b031dea94acb4aad..6d10268d38791e1d0e88652f7000503661981267 100644 (file)
--- a/CGI.pl
+++ b/CGI.pl
@@ -198,10 +198,6 @@ sub PasswordForLogin {
     return $result;
 }
 
-sub quietly_check_login {
-    return Bugzilla->login($_[0] ? LOGIN_OPTIONAL : LOGIN_NORMAL);
-}
-
 sub CheckEmailSyntax {
     my ($addr) = (@_);
     my $match = Param('emailregexp');
@@ -224,10 +220,6 @@ sub MailPassword {
     close SENDMAIL;
 }
 
-sub confirm_login {
-    return Bugzilla->login(LOGIN_REQUIRED);
-}
-
 sub PutHeader {
     ($vars->{'title'}, $vars->{'h1'}, $vars->{'h2'}) = (@_);
      
index 8df562120023d7397c676daf8bde6d9ff2c2d281..61565f01f6a6ec93f9cafd3568d572119ebc9669 100755 (executable)
@@ -42,16 +42,14 @@ use vars qw(
 require "CGI.pl";
 
 # Use these modules to handle flags.
+use Bugzilla::Constants;
 use Bugzilla::Flag; 
 use Bugzilla::FlagType; 
 use Bugzilla::User;
 use Bugzilla::Util;
 
-# Establish a connection to the database backend.
-ConnectToDatabase();
-
 # Check whether or not the user is logged in and, if so, set the $::userid 
-quietly_check_login();
+Bugzilla->login();
 
 # The ID of the bug to which the attachment is attached.  Gets set
 # by validateID() (which validates the attachment ID, not the bug ID, but has
@@ -104,14 +102,14 @@ elsif ($action eq "viewall")
 }
 elsif ($action eq "enter") 
 { 
-  confirm_login();
+  Bugzilla->login(LOGIN_REQUIRED);
   ValidateBugID($::FORM{'bugid'});
   validateCanChangeBug($::FORM{'bugid'});
   enter(); 
 }
 elsif ($action eq "insert")
 {
-  confirm_login();
+  Bugzilla->login(LOGIN_REQUIRED);
   ValidateBugID($::FORM{'bugid'});
   validateCanChangeBug($::FORM{'bugid'});
   ValidateComment($::FORM{'comment'});
@@ -125,14 +123,13 @@ elsif ($action eq "insert")
 }
 elsif ($action eq "edit") 
 { 
-  quietly_check_login();
   validateID();
   validateCanEdit($::FORM{'id'});
   edit(); 
 }
 elsif ($action eq "update") 
 { 
-  confirm_login();
+  Bugzilla->login(LOGIN_REQUIRED);
   ValidateComment($::FORM{'comment'});
   validateID();
   validateCanEdit($::FORM{'id'});
@@ -216,9 +213,10 @@ sub validateCanEdit
     my ($attach_id) = (@_);
 
     # If the user is not logged in, claim that they can edit. This allows
-    # the edit scrren to be displayed to people who aren't logged in.
+    # the edit screen to be displayed to people who aren't logged in.
     # People not logged in can't actually commit changes, because that code
-    # calls confirm_login, not quietly_check_login, before calling this sub
+    # calls Bugzilla->login with LOGIN_REQUIRED, not with LOGIN_NORMAL,
+    # before calling this sub
     return if $::userid == 0;
 
     # People in editbugs can edit all attachments
index 8a02ca4906e0b39a502fed951239277becc37784..2a71450aaf2665333790504a0cfc91740d387031 100755 (executable)
@@ -37,6 +37,7 @@ use vars qw($template $vars);
 
 use Bugzilla;
 use Bugzilla::Search;
+use Bugzilla::Constants;
 
 # Include the Bugzilla CGI and general utility library.
 require "CGI.pl";
@@ -63,8 +64,6 @@ if (length($::buffer) == 0) {
     ThrowUserError("buglist_parameters_required");
 }
 
-ConnectToDatabase();
-
 ################################################################################
 # Data and Security Validation
 ################################################################################
@@ -74,12 +73,12 @@ my $dotweak = $::FORM{'tweak'} ? 1 : 0;
 
 # Log the user in
 if ($dotweak) {
-    confirm_login();
+    Bugzilla->login(LOGIN_REQUIRED);
     UserInGroup("editbugs") || ThrowUserError("insufficient_privs_for_multi");
     GetVersionTable();
 }
 else {
-    quietly_check_login();
+    Bugzilla->login();
 }
 
 # Hack to support legacy applications that think the RDF ctype is at format=rdf.
@@ -182,7 +181,7 @@ sub iCalendarDateTime {
 
 sub LookupNamedQuery {
     my ($name) = @_;
-    confirm_login();
+    Bugzilla->login(LOGIN_REQUIRED);
     my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
     my $qname = SqlQuote($name);
     SendSQL("SELECT query FROM namedqueries WHERE userid = $userid AND name = $qname");
@@ -305,7 +304,7 @@ if ($::FORM{'cmdtype'} eq "dorem") {
         $order = $params->param('order') || $order;
     }
     elsif ($::FORM{'remaction'} eq "forget") {
-        confirm_login();
+        Bugzilla->login(LOGIN_REQUIRED);
         my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
         my $qname = SqlQuote($::FORM{'namedcmd'});
         SendSQL("DELETE FROM namedqueries WHERE userid = $userid AND name = $qname");
@@ -325,7 +324,7 @@ if ($::FORM{'cmdtype'} eq "dorem") {
 }
 elsif (($::FORM{'cmdtype'} eq "doit") && $::FORM{'remtype'}) {
     if ($::FORM{'remtype'} eq "asdefault") {
-        confirm_login();
+        Bugzilla->login(LOGIN_REQUIRED);
         my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
         my $qname = SqlQuote($::defaultqueryname);
         my $qbuffer = SqlQuote($::buffer);
@@ -335,7 +334,7 @@ elsif (($::FORM{'cmdtype'} eq "doit") && $::FORM{'remtype'}) {
         $vars->{'message'} = "buglist_new_default_query";
     }
     elsif ($::FORM{'remtype'} eq "asnamed") {
-        confirm_login();
+        Bugzilla->login(LOGIN_REQUIRED);
         my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
 
         my $name = trim($::FORM{'newqueryname'});
index dbdd818bc0e4fa64998d8f37119b98cfef3a25c8..229e9bbf7b689416645d8a3b263cb517cf95f511 100755 (executable)
--- a/chart.cgi
+++ b/chart.cgi
@@ -45,6 +45,7 @@ use strict;
 use lib qw(.);
 
 require "CGI.pl";
+use Bugzilla::Constants;
 use Bugzilla::Chart;
 use Bugzilla::Series;
 
@@ -81,9 +82,7 @@ if ($action eq "search") {
     exit;
 }
 
-ConnectToDatabase();
-
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 # Only admins may create public queries
 UserInGroup('admin') || $cgi->delete('public');
index 726e60d510a5cc692ba559b10e952664fe7dd5f7..dcd611dad573727eaccb7cda93eb463d2cb082aa 100755 (executable)
@@ -36,8 +36,7 @@ use Bugzilla;
 
 require "CGI.pl";
 
-ConnectToDatabase();
-quietly_check_login();
+Bugzilla->login();
 
 GetVersionTable();
 
index e0416945314726f50e49bf876fa05026fca9a698..7391d32da1cb4ff652290fc97047f5c687f7a63f 100755 (executable)
@@ -51,7 +51,6 @@ if (chdir("graphs")) {
     chdir("..");
 }
 
-ConnectToDatabase();
 GetVersionTable();
 
 Bugzilla->switch_to_shadow_db();
index f7cb95ee52ba6e9371caaefe032bbf3463117a90..a2c22d0019b6ec236e03d7002b0c67f40816f7b2 100755 (executable)
@@ -33,10 +33,6 @@ use strict;
 use lib qw(.);
 require "CGI.pl";
 
-# Connect to the database so we can check whether the user is a member
-# of each product group.
-ConnectToDatabase();
-
 # Retrieve this installation's configuration.
 GetVersionTable();
 
index a8b89714de296c549fa51f9665a70ca5acf6856d..a4bae060c829055caace8c6d2a5e8874340a91d7 100755 (executable)
@@ -38,7 +38,7 @@
 #
 # You need to work with bug_email.pl the MIME::Parser installed.
 # 
-# $Id: bug_email.pl,v 1.18 2004/01/20 06:03:38 justdave%syndicomm.com Exp $
+# $Id: bug_email.pl,v 1.19 2004/03/27 03:51:44 kiko%async.com.br Exp $
 ###############################################################
 
 # 02/12/2000 (SML)
@@ -746,8 +746,6 @@ die (" *** Cant find Sender-adress in sent mail ! ***\n" ) unless defined( $Send
 chomp( $Sender );
 chomp( $Message_ID );
 
-ConnectToDatabase();
-
 $SenderShort = $Sender;
 $SenderShort =~ s/^.*?([a-zA-Z0-9_.-]+?\@[a-zA-Z0-9_.-]+\.[a-zA-Z0-9_.-]+).*$/$1/;
 
index da098e66c5aa1ffa7f32a89bce64d741142ced17..007fd153ce646e5be3619db94117a91a474cabf2 100755 (executable)
@@ -68,8 +68,6 @@ chomp( $Message_ID );
 
 print "Dealing with the sender $Sender\n";
 
-ConnectToDatabase();
-
 my $SenderShort = $Sender;
 $SenderShort =~ s/^.*?([a-zA-Z0-9_.-]+?\@[a-zA-Z0-9_.-]+\.[a-zA-Z0-9_.-]+).*$/$1/;
 
index 701695aea4bd95ae9d506ac879603af28d7f7dad..b9d3e8a5fa2da1b7db0b671ae34bcb2b764fdd59 100755 (executable)
@@ -74,8 +74,6 @@ foreach my $arg (@ARGV)
    }
 }
 
-ConnectToDatabase();
-
 my %bugzilla_users;
 my %ldap_users;
 
index 6c624b0ba4c5b7b93858236d815aa2c438050cb7..6364e20bcb1d85c41362674099c16260e657227a 100755 (executable)
@@ -36,13 +36,11 @@ use vars qw(
   $vars
 );
 
-ConnectToDatabase();
-
 # If we're using LDAP for login, then we can't create a new account here.
 unless (Bugzilla::Auth->can_edit) {
   # Just in case someone already has an account, let them get the correct
   # footer on the error message
-  quietly_check_login();
+  Bugzilla->login();
   ThrowUserError("auth_cant_create_account");
 }
 
index 1926a8826998c46260776f853a673d4759691c63..6c99a0a633633e0036b396fef48d83fa388221a7 100755 (executable)
@@ -23,7 +23,6 @@
 
 use vars qw(
   %legal_product
-  $userid
 );
 
 use strict;
@@ -31,11 +30,11 @@ use strict;
 use lib qw(.);
 
 use Bugzilla;
+use Bugzilla::Constants;
 
 require "CGI.pl";
 
-ConnectToDatabase();
-quietly_check_login();
+Bugzilla->login();
 
 GetVersionTable();
 
@@ -48,7 +47,7 @@ if (!defined $product) {
 
     if (AnyEntryGroups()) {
         # OK, now only add products the user can see
-        confirm_login() unless $::userid;
+        Bugzilla->login(LOGIN_REQUIRED) unless Bugzilla->user;
         foreach my $p (@::legal_product) {
             if (CanEnterProduct($p)) {
                 $products{$p} = $::proddesc{$p};
index 60c5a9fd8eb44a357b3598e7495da80afb12802b..8597e67910d79aeb510622530e9f074a9134e49a 100755 (executable)
@@ -31,9 +31,7 @@ require "CGI.pl";
 # Use the global template variables. 
 use vars qw($vars $template);
 
-ConnectToDatabase();
-
-quietly_check_login();
+Bugzilla->login();
 
 my $cgi = Bugzilla->cgi;
 
index 4799c99c0858527bcad6fe2355f3dd5ba71eb3ac..679bd74e3ffe3782d82fd7fd8a4d46a764e77657 100755 (executable)
@@ -26,12 +26,12 @@ use strict;
 use lib qw(.);
 
 use Bugzilla;
+use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT :admin $datadir);
 
 require "CGI.pl";
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 my $cgi = Bugzilla->cgi;
 
index aa627fc40171c058c6f04095060c3003d4831ee8..b45bd27106261169e8214ffd522e7d18f358988f 100755 (executable)
@@ -54,7 +54,6 @@ if (defined $cgi->param('ctype') && $cgi->param('ctype') eq "xul") {
 # Use global templatisation variables.
 use vars qw($template $vars);
 
-ConnectToDatabase();
 GetVersionTable();
 
 # collectstats.pl uses duplicates.cgi to generate the RDF duplicates stats.
@@ -64,7 +63,7 @@ if ($::ENV{'GATEWAY_INTERFACE'} eq "cmdline") {
     Bugzilla->login(LOGIN_OPTIONAL);
 }
 else {
-    Bugzilla->login(LOGIN_NORMAL);
+    Bugzilla->login();
 }
 
 Bugzilla->switch_to_shadow_db();
index 1cac27a991a24f3c45401efe728b64f7a1cbbcdf..5ed7a28d70564c63b910b3cd4e0459251b11a724 100755 (executable)
@@ -31,6 +31,7 @@ use lib ".";
 require "CGI.pl";
 require "globals.pl";
 
+use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT $datadir);
 use Bugzilla::Series;
 
@@ -195,8 +196,7 @@ sub PutTrailer (@)
 # Preliminary checks:
 #
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 print Bugzilla->cgi->header();
 
index 711828b6a768712b781d238bc840161e8d8bd7de..5fcabd73fd560c5bdce0938e496a690eb9bfada6 100755 (executable)
@@ -31,18 +31,16 @@ use lib ".";
 # Include the Bugzilla CGI and general utility library.
 require "CGI.pl";
 
-# Establish a connection to the database backend.
-ConnectToDatabase();
-
 # Use Bugzilla's flag modules for handling flag types.
 use Bugzilla;
+use Bugzilla::Constants;
 use Bugzilla::Flag;
 use Bugzilla::FlagType;
 
 use vars qw( $template $vars );
 
 # Make sure the user is logged in and is an administrator.
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 UserInGroup("editcomponents")
   || ThrowUserError("authorization_failure", 
                     { action => "administer flag types" });
index e96545768849c4ea35a45d466159735ef3f87cba..4f97972b30093b56b192ad793a479798f86248d4 100755 (executable)
@@ -34,8 +34,7 @@ require "CGI.pl";
 
 use vars qw($template $vars);
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 print Bugzilla->cgi->header();
 
index 0069886cd3d7a18fd5d171675e1d2ed788456291..0083f8ee9bac92a228140850557e04b58e2b74d6 100755 (executable)
@@ -25,6 +25,7 @@ use lib ".";
 
 require "CGI.pl";
 
+use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT $datadir);
 
 my $cgi = Bugzilla->cgi;
@@ -53,8 +54,7 @@ sub Validate ($$) {
 # Preliminary checks:
 #
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 print Bugzilla->cgi->header();
 
index 7a77de155d9ebc1012d633d933dc767461c9fd6d..e707cf46d7adde365dfefd9721e32d76ff6e8297 100755 (executable)
@@ -19,6 +19,7 @@ use lib ".";
 require "CGI.pl";
 require "globals.pl";
 
+use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT $datadir);
 
 # TestProduct:  just returns if the specified product does exists
@@ -144,8 +145,7 @@ sub PutTrailer (@)
 # Preliminary checks:
 #
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 print Bugzilla->cgi->header();
 
index dd61e9543774cac43138d4977e2f5cc39c171e41..aaa2b087af4af6f90295a58f196b7a4a6a54a1eb 100755 (executable)
 use strict;
 use lib ".";
 
+use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT :admin);
 
 require "CGI.pl";
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 print Bugzilla->cgi->header();
 
index f5377950179578e83edfcad92df1b3a02e1ba5c9..051fdb86c5cf3bb8c29150002c005bfcc976eff1 100755 (executable)
@@ -179,8 +179,7 @@ sub PutTrailer (@)
 # Preliminary checks:
 #
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 print Bugzilla->cgi->header();
 
index e7ef0e7d30fbfda908458b24fa4c7ca4023e24b2..3db5aef86322b847415e7b7b71ae6308d91c7580 100755 (executable)
@@ -36,6 +36,7 @@ require "globals.pl";
 
 use Bugzilla;
 use Bugzilla::User;
+use Bugzilla::Constants;
 
 # Shut up misguided -w warnings about "used only once".  "use vars" just
 # doesn't work for me.
@@ -238,8 +239,7 @@ sub PutTrailer (@)
 # Preliminary checks:
 #
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 print Bugzilla->cgi->header();
 
index 9c4a5e5ea7556d6a4963a15530aae425eab34558..527f42aafe42b8eb3b69cbf5ea50d0e35cb0e793 100755 (executable)
@@ -32,6 +32,7 @@ use lib ".";
 require "CGI.pl";
 require "globals.pl";
 
+use Bugzilla::Constants;
 use Bugzilla::Config qw(:DEFAULT $datadir);
 
 # TestProduct:  just returns if the specified product does exists
@@ -153,8 +154,7 @@ sub PutTrailer (@)
 # Preliminary checks:
 #
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 print Bugzilla->cgi->header();
 
index eca672a45b98b3828d09123a58a758615fd85287..1dd02c90c4407362b7eadacb0006e33a5e48c060 100755 (executable)
@@ -57,20 +57,15 @@ use vars qw(
   $proddesc
 );
 
-# We have to connect to the database, even though we don't use it in this code,
-# because we might occasionally rebuild the version cache, which causes tokens
-# to get deleted from the database, which needs a database connection.
-ConnectToDatabase();
-
 # If we're using bug groups to restrict bug entry, we need to know who the 
 # user is right from the start. 
-confirm_login() if AnyEntryGroups();
+Bugzilla->login(LOGIN_REQUIRED) if AnyEntryGroups();
 
 my $cgi = Bugzilla->cgi;
 
 if (!defined $::FORM{'product'}) {
     GetVersionTable();
-    quietly_check_login();
+    Bugzilla->login();
 
     my %products;
 
@@ -225,7 +220,7 @@ sub pickos {
 # End of subroutines
 ##############################################################################
 
-confirm_login() if (!(AnyEntryGroups()));
+Bugzilla->login(LOGIN_REQUIRED) if (!(AnyEntryGroups()));
 
 # We need to check and make sure
 # that the user has permission to enter a bug against this product.
index 5b0599e988cae18e40108488114a9726d0feab7d..f233871765d207c8f426469b39b37a924ec9b50c 100755 (executable)
@@ -71,7 +71,6 @@ require "CGI.pl";
 require "globals.pl";
 $::lockcount = 0;
 
-ConnectToDatabase();
 GetVersionTable();
 
 
index bbe936207f077b12cd5837d01cb961d1551d9a34..88393b41787700c13d33f2c8dcc617b1fe2f49ad 100755 (executable)
--- a/index.cgi
+++ b/index.cgi
@@ -36,11 +36,9 @@ use vars qw(
   $vars
 );
 
-# Establish a connection to the database backend.
-ConnectToDatabase();
-
 # Check whether or not the user is logged in and, if so, set the $::userid 
-quietly_check_login('permit_anonymous');
+use Bugzilla::Constants;
+Bugzilla->login(LOGIN_OPTIONAL);
 
 ###############################################################################
 # Main Body Execution
index 72c579ac4dc0ffa73055fa568bfd174239b92e18..657ff9e24f08106b673e60396fe619958d2cec03 100755 (executable)
@@ -33,9 +33,7 @@ use vars qw($userid @legal_keywords);
 # Use global template variables.
 use vars qw($template $vars);
 
-ConnectToDatabase();
-
-quietly_check_login();
+Bugzilla->login();
 
 GetVersionTable();
 
diff --git a/move.pl b/move.pl
index b4d47a40fc35c8aa734c6b5a53c586deba862ed6..99ed585f32971b5e1ad8d0712bf32b8679a419bf 100755 (executable)
--- a/move.pl
+++ b/move.pl
@@ -31,6 +31,7 @@ require "CGI.pl";
 use vars qw($template $userid %COOKIE);
 
 use Bugzilla;
+use Bugzilla::Constants;
 use Bugzilla::Bug;
 use Bugzilla::Config qw(:DEFAULT $datadir);
 use Bugzilla::BugMail;
@@ -43,8 +44,7 @@ unless ( Param("move-enabled") ) {
   exit;
 }
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 my $cgi = Bugzilla->cgi;
 
index 91027ff4f77587ee91adf1e4ec1d9ae7e35e3cec..b68a9313b4853e61ae50fb2e22838a9c69952b09 100755 (executable)
--- a/page.cgi
+++ b/page.cgi
@@ -38,9 +38,7 @@ require "CGI.pl";
 
 use vars qw($template $vars);
 
-ConnectToDatabase();
-
-quietly_check_login();
+Bugzilla->login();
 
 my $cgi = Bugzilla->cgi;
 
index d6fda9b3bfc4749053de34e4d29d7fc69ea2cfaf..800b46f01656e666d5a4b518e5bf336b0d98a3a1 100755 (executable)
@@ -53,8 +53,7 @@ sub sillyness {
 # Use global template variables.
 use vars qw($vars $template);
 
-ConnectToDatabase();
-my $user = confirm_login();
+my $user = Bugzilla->login(LOGIN_REQUIRED);
 
 my $cgi = Bugzilla->cgi;
 
index 4df90efd2fcff695659b11a0e5add52ba764f47f..e54a4696573b02193a75314681b40c96a49d3192 100755 (executable)
@@ -55,8 +55,7 @@ use vars qw(%versions
           %legal_severity
            );
 
-ConnectToDatabase();
-my $user = confirm_login();
+my $user = Bugzilla->login(LOGIN_REQUIRED);
 my $whoid = $user->id;
 
 my $cgi = Bugzilla->cgi;
index 7786da96bd1adba8a673daf3b563227f7eb19668..a37fc91256c0af34b154140b3ebd2d56fa1f0781 100755 (executable)
--- a/query.cgi
+++ b/query.cgi
@@ -28,6 +28,8 @@ use lib ".";
 
 require "CGI.pl";
 
+use Bugzilla::Constants;
+
 use vars qw(
     @CheckOptionValues
     @legal_resolution
@@ -49,16 +51,14 @@ use vars qw(
     $vars
 );
 
-ConnectToDatabase();
-
 my $cgi = Bugzilla->cgi;
 
 if (defined $::FORM{"GoAheadAndLogIn"}) {
     # We got here from a login page, probably from relogin.cgi.  We better
     # make sure the password is legit.
-    confirm_login();
+    Bugzilla->login(LOGIN_REQUIRED);
 } else {
-    quietly_check_login();
+    Bugzilla->login();
 }
 
 my $user = Bugzilla->user;
index 60ebdd120f234bb1b174f2ec6578618bc2cc9f11..361ebc382863bbb5c122d8c5471e4cc4d4eeb7fb 100755 (executable)
@@ -28,8 +28,7 @@ use lib qw(.);
 
 require "CGI.pl";
 
-ConnectToDatabase();
-quietly_check_login();
+Bugzilla->login();
 
 GetVersionTable();
 
index bf1c41450de88a24e6dd26ff30d6057449fc8954..9bb6ea43a2c1faa58bb35210898b4295a5b8234a 100755 (executable)
--- a/quips.cgi
+++ b/quips.cgi
@@ -36,8 +36,9 @@ use lib qw(.);
 
 require "CGI.pl";
 
-ConnectToDatabase();
-confirm_login();
+use Bugzilla::Constants;
+
+Bugzilla->login(LOGIN_REQUIRED);
 
 my $cgi = Bugzilla->cgi;
 
index b7ba4f61e332c4001a03a8c460fb440100413979..6843405c20ef8e8f7bd7e4d663f021f36fec66fe 100755 (executable)
@@ -30,11 +30,9 @@ use lib qw(.);
 require "CGI.pl";
 
 # We don't want to remove a random logincookie from the db, so
-# call quietly_check_login. If we're logged in after this, then
+# call Bugzilla->login(). If we're logged in after this, then
 # the logincookie must be correct
-
-ConnectToDatabase();
-quietly_check_login();
+Bugzilla->login();
 
 Bugzilla->logout();
 
index 2c0c430a932129c9db9222c6f2666624510262a9..cb872fc5bc7dd87f8fa7934f668f2329977d09a9 100755 (executable)
@@ -29,6 +29,7 @@ require "CGI.pl";
 use vars qw($template $vars);
 
 use Bugzilla;
+use Bugzilla::Constants;
 
 my $cgi = Bugzilla->cgi;
 
@@ -44,11 +45,9 @@ if (grep(/^cmd-/, $cgi->param())) {
 
 use Bugzilla::Search;
 
-ConnectToDatabase();
-
 GetVersionTable();
 
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 Bugzilla->switch_to_shadow_db();
 
index b863249d6ffe46e205ac8bcfd971c988235168d0..01ce9927724b30bd2795c1aa6619e68352402582 100755 (executable)
@@ -56,8 +56,7 @@ use Bugzilla;
 
 # If we're using bug groups for products, we should apply those restrictions
 # to viewing reports, as well.  Time to check the login in that case.
-ConnectToDatabase();
-quietly_check_login();
+Bugzilla->login();
 
 GetVersionTable();
 
index 90304a2b9201ffdd179365494facd9163cf0eaa2..43be69856339c9cd1679000c24754e3f708a1455 100755 (executable)
@@ -31,9 +31,6 @@ use strict;
 use lib qw(.);
 require "CGI.pl";
 
-# Establish a connection to the database backend.
-ConnectToDatabase();
-
 # Use Bugzilla's Request module which contains utilities for handling requests.
 use Bugzilla::Flag;
 use Bugzilla::FlagType;
@@ -44,7 +41,7 @@ use Bugzilla::User;
 use vars qw($template $vars @legal_product @legal_components %components);
 
 # Make sure the user is logged in.
-quietly_check_login();
+Bugzilla->login();
 
 ################################################################################
 # Main Body Execution
index 8060c1c9974c2b301769893e9b43a07a6f5d2dc0..51b4990252214c50fa86887d20e1ed09bd3ac8dc 100755 (executable)
@@ -70,9 +70,7 @@ sub BugListLinks {
 # Start
 ###########################################################################
 
-ConnectToDatabase();
-
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 my $cgi = Bugzilla->cgi;
 
index e1697255b7091ef112e3b2f0e4474368a25a8bed..5ab4e366e69c87ab12aea251cc7d12ebf7c2f4a2 100755 (executable)
@@ -30,14 +30,12 @@ use vars qw ($template $vars);
 require "CGI.pl";
 my $cgi = Bugzilla->cgi;
 
-ConnectToDatabase();
-
 ###############################################################################
 # Begin Data/Security Validation
 ###############################################################################
 
 # Check whether or not the user is currently logged in. 
-quietly_check_login();
+Bugzilla->login();
 
 # Make sure the bug ID is a positive integer representing an existing
 # bug that the user is authorized to access.
index 6d971bbfcc712254d8fa9dddd1df4432a945f53b..4b2459f90dabfb4251570d5e61821645a3336eab 100755 (executable)
@@ -25,11 +25,10 @@ use strict;
 use lib qw(.);
 
 use Bugzilla;
+use Bugzilla::Constants;
 
 require "CGI.pl";
 
-ConnectToDatabase();
-
 use vars qw($template $vars $userid);
 
 use Bugzilla::Bug;
@@ -37,9 +36,9 @@ use Bugzilla::Bug;
 my $cgi = Bugzilla->cgi;
 
 if ($::FORM{'GoAheadAndLogIn'}) {
-    confirm_login();
+    Bugzilla->login(LOGIN_REQUIRED);
 } else {
-    quietly_check_login();
+    Bugzilla->login();
 }
 
 # Editable, 'single' HTML bugs are treated slightly specially in a few places
index a863df142047e0d7956b34cf0db6f2c96bf0fe44..e0bd376d55d4cc9c243ad25d7be64219bdb212fd 100755 (executable)
@@ -31,9 +31,7 @@ use Bugzilla::Config qw(:DEFAULT $webdotdir);
 
 require "CGI.pl";
 
-ConnectToDatabase();
-
-quietly_check_login();
+Bugzilla->login();
 
 my $cgi = Bugzilla->cgi;
 
index b82443226e576476121b3ba32fdb7a140148f43a..202043acdc538140cc4bb21f5609a3cc98cb7e63 100755 (executable)
@@ -31,9 +31,7 @@ require "CGI.pl";
 # Use global template variables.
 use vars qw($template $vars);
 
-ConnectToDatabase();
-
-quietly_check_login();
+Bugzilla->login();
 
 my $cgi = Bugzilla->cgi;
 
index cf801eba3337e93d2d0eaa43a4d4896ad66f83b5..73a22d1b339a80c81a1815e1b0fadac9634549d5 100755 (executable)
@@ -26,8 +26,7 @@ use vars qw(
   $vars
 );
 
-ConnectToDatabase();
-quietly_check_login();
+Bugzilla->login();
 
 my $cgi = Bugzilla->cgi;
 
index 697da39b18a557a4a66d644112af195111c9637f..36508f0a538a2543a69b5357ecf36cb955c8253c 100755 (executable)
--- a/token.cgi
+++ b/token.cgi
@@ -32,14 +32,14 @@ use lib qw(.);
 use vars qw($template $vars);
 
 use Bugzilla;
+use Bugzilla::Constants;
+
 my $cgi = Bugzilla->cgi;
 
 # Include the Bugzilla CGI and general utility library.
 require "CGI.pl";
 
-# Establish a connection to the database backend.
-ConnectToDatabase();
-quietly_check_login('permit_anonymous');
+Bugzilla->login(LOGIN_OPTIONAL);
 
 # Use the "Bugzilla::Token" module that contains functions for doing various
 # token-related tasks.
index 15afdb21c196de8fdc689490b9525b543a522473..eefe40205b9ed7ff42c3d8c15df518a1d86688cd 100755 (executable)
@@ -308,8 +308,7 @@ sub DoSavedSearches() {
 # Live code (not subroutine definitions) starts here
 ###############################################################################
 
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
 
 GetVersionTable();
 
index ed7f6ad5197f2be4e7c1acfd5e463ea222b6323c..937149b3d69f83133a8cf0639b262008ce194428 100755 (executable)
--- a/votes.cgi
+++ b/votes.cgi
@@ -27,14 +27,13 @@ use strict;
 use lib ".";
 
 use Bugzilla;
+use Bugzilla::Constants;
 
 require "CGI.pl";
 
 # Use global template variables
 use vars qw($template $vars);
 
-ConnectToDatabase();
-
 my $cgi = Bugzilla->cgi;
 
 # If the action is show_bug, you need a bug_id.
@@ -51,10 +50,10 @@ my $action = $::FORM{'action'} ||
 if ($action eq "show_bug" ||
     ($action eq "show_user" && defined($::FORM{'user'}))) 
 {
-    quietly_check_login();
+    Bugzilla->login();
 }
 else {
-    confirm_login();
+    Bugzilla->login(LOGIN_REQUIRED);
 }
 
 ################################################################################
index 57a8235830002ed4e2bd645d54517af3ada2ac85..b5fd020a9faf515cd868bd149a1a96220c1a76eb 100755 (executable)
@@ -31,8 +31,6 @@ use strict;
 
 require "globals.pl";
 
-ConnectToDatabase();
-
 SendSQL("select bug_id,short_desc,login_name from bugs,profiles where " .
         "(bug_status = 'NEW' or bug_status = 'REOPENED') and " . 
         "to_days(now()) - to_days(delta_ts) > " . Param('whinedays') .