%Bugzilla::DB::EXPORT_TAGS =
(
- deprecated => [qw(ConnectToDatabase SendSQL SqlQuote
+ deprecated => [qw(SendSQL SqlQuote
MoreSQLData FetchSQLData FetchOneColumn
PushGlobalSQLState PopGlobalSQLState)
],
# 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.
=item *
-ConnectToDatabase
-
-=item *
-
SendSQL
=item *
return $result;
}
-sub quietly_check_login {
- return Bugzilla->login($_[0] ? LOGIN_OPTIONAL : LOGIN_NORMAL);
-}
-
sub CheckEmailSyntax {
my ($addr) = (@_);
my $match = Param('emailregexp');
close SENDMAIL;
}
-sub confirm_login {
- return Bugzilla->login(LOGIN_REQUIRED);
-}
-
sub PutHeader {
($vars->{'title'}, $vars->{'h1'}, $vars->{'h2'}) = (@_);
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
}
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'});
}
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'});
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
use Bugzilla;
use Bugzilla::Search;
+use Bugzilla::Constants;
# Include the Bugzilla CGI and general utility library.
require "CGI.pl";
ThrowUserError("buglist_parameters_required");
}
-ConnectToDatabase();
-
################################################################################
# Data and Security Validation
################################################################################
# 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.
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");
$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");
}
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);
$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'});
use lib qw(.);
require "CGI.pl";
+use Bugzilla::Constants;
use Bugzilla::Chart;
use Bugzilla::Series;
exit;
}
-ConnectToDatabase();
-
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
# Only admins may create public queries
UserInGroup('admin') || $cgi->delete('public');
require "CGI.pl";
-ConnectToDatabase();
-quietly_check_login();
+Bugzilla->login();
GetVersionTable();
chdir("..");
}
-ConnectToDatabase();
GetVersionTable();
Bugzilla->switch_to_shadow_db();
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();
#
# 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)
chomp( $Sender );
chomp( $Message_ID );
-ConnectToDatabase();
-
$SenderShort = $Sender;
$SenderShort =~ s/^.*?([a-zA-Z0-9_.-]+?\@[a-zA-Z0-9_.-]+\.[a-zA-Z0-9_.-]+).*$/$1/;
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/;
}
}
-ConnectToDatabase();
-
my %bugzilla_users;
my %ldap_users;
$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");
}
use vars qw(
%legal_product
- $userid
);
use strict;
use lib qw(.);
use Bugzilla;
+use Bugzilla::Constants;
require "CGI.pl";
-ConnectToDatabase();
-quietly_check_login();
+Bugzilla->login();
GetVersionTable();
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};
# Use the global template variables.
use vars qw($vars $template);
-ConnectToDatabase();
-
-quietly_check_login();
+Bugzilla->login();
my $cgi = Bugzilla->cgi;
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;
# Use global templatisation variables.
use vars qw($template $vars);
-ConnectToDatabase();
GetVersionTable();
# collectstats.pl uses duplicates.cgi to generate the RDF duplicates stats.
Bugzilla->login(LOGIN_OPTIONAL);
}
else {
- Bugzilla->login(LOGIN_NORMAL);
+ Bugzilla->login();
}
Bugzilla->switch_to_shadow_db();
require "CGI.pl";
require "globals.pl";
+use Bugzilla::Constants;
use Bugzilla::Config qw(:DEFAULT $datadir);
use Bugzilla::Series;
# Preliminary checks:
#
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
print Bugzilla->cgi->header();
# 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" });
use vars qw($template $vars);
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
print Bugzilla->cgi->header();
require "CGI.pl";
+use Bugzilla::Constants;
use Bugzilla::Config qw(:DEFAULT $datadir);
my $cgi = Bugzilla->cgi;
# Preliminary checks:
#
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
print Bugzilla->cgi->header();
require "CGI.pl";
require "globals.pl";
+use Bugzilla::Constants;
use Bugzilla::Config qw(:DEFAULT $datadir);
# TestProduct: just returns if the specified product does exists
# Preliminary checks:
#
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
print Bugzilla->cgi->header();
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();
# Preliminary checks:
#
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
print Bugzilla->cgi->header();
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.
# Preliminary checks:
#
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
print Bugzilla->cgi->header();
require "CGI.pl";
require "globals.pl";
+use Bugzilla::Constants;
use Bugzilla::Config qw(:DEFAULT $datadir);
# TestProduct: just returns if the specified product does exists
# Preliminary checks:
#
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
print Bugzilla->cgi->header();
$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;
# 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.
require "globals.pl";
$::lockcount = 0;
-ConnectToDatabase();
GetVersionTable();
$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
# Use global template variables.
use vars qw($template $vars);
-ConnectToDatabase();
-
-quietly_check_login();
+Bugzilla->login();
GetVersionTable();
use vars qw($template $userid %COOKIE);
use Bugzilla;
+use Bugzilla::Constants;
use Bugzilla::Bug;
use Bugzilla::Config qw(:DEFAULT $datadir);
use Bugzilla::BugMail;
exit;
}
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
use vars qw($template $vars);
-ConnectToDatabase();
-
-quietly_check_login();
+Bugzilla->login();
my $cgi = Bugzilla->cgi;
# Use global template variables.
use vars qw($vars $template);
-ConnectToDatabase();
-my $user = confirm_login();
+my $user = Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
%legal_severity
);
-ConnectToDatabase();
-my $user = confirm_login();
+my $user = Bugzilla->login(LOGIN_REQUIRED);
my $whoid = $user->id;
my $cgi = Bugzilla->cgi;
require "CGI.pl";
+use Bugzilla::Constants;
+
use vars qw(
@CheckOptionValues
@legal_resolution
$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;
require "CGI.pl";
-ConnectToDatabase();
-quietly_check_login();
+Bugzilla->login();
GetVersionTable();
require "CGI.pl";
-ConnectToDatabase();
-confirm_login();
+use Bugzilla::Constants;
+
+Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
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();
use vars qw($template $vars);
use Bugzilla;
+use Bugzilla::Constants;
my $cgi = Bugzilla->cgi;
use Bugzilla::Search;
-ConnectToDatabase();
-
GetVersionTable();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
Bugzilla->switch_to_shadow_db();
# 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();
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;
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
# Start
###########################################################################
-ConnectToDatabase();
-
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
my $cgi = Bugzilla->cgi;
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.
use lib qw(.);
use Bugzilla;
+use Bugzilla::Constants;
require "CGI.pl";
-ConnectToDatabase();
-
use vars qw($template $vars $userid);
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
require "CGI.pl";
-ConnectToDatabase();
-
-quietly_check_login();
+Bugzilla->login();
my $cgi = Bugzilla->cgi;
# Use global template variables.
use vars qw($template $vars);
-ConnectToDatabase();
-
-quietly_check_login();
+Bugzilla->login();
my $cgi = Bugzilla->cgi;
$vars
);
-ConnectToDatabase();
-quietly_check_login();
+Bugzilla->login();
my $cgi = Bugzilla->cgi;
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.
# Live code (not subroutine definitions) starts here
###############################################################################
-ConnectToDatabase();
-confirm_login();
+Bugzilla->login(LOGIN_REQUIRED);
GetVersionTable();
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.
if ($action eq "show_bug" ||
($action eq "show_user" && defined($::FORM{'user'})))
{
- quietly_check_login();
+ Bugzilla->login();
}
else {
- confirm_login();
+ Bugzilla->login(LOGIN_REQUIRED);
}
################################################################################
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') .