Compare commits

..

43 Commits

Author SHA1 Message Date
dkl%redhat.com
a31a313da3 Update to HEAD 2002/05/15
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@121553 18797224-902f-48f8-a5cc-f745e15eee43
2002-05-15 20:59:01 +00:00
(no author)
531c3206b0 This commit was manufactured by cvs2svn to create branch
'Bugzilla_Groups_Branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@121369 18797224-902f-48f8-a5cc-f745e15eee43
2002-05-13 06:24:50 +00:00
dkl%redhat.com
73df6d691e Update to HEAD 03/19/2002
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@116884 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-19 22:03:37 +00:00
(no author)
0a9a30bc20 This commit was manufactured by cvs2svn to create branch
'Bugzilla_Groups_Branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@116668 18797224-902f-48f8-a5cc-f745e15eee43
2002-03-15 23:23:13 +00:00
dkl%redhat.com
5c90c45d37 Update to HEAD 2002/02/26
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@115408 18797224-902f-48f8-a5cc-f745e15eee43
2002-02-27 04:47:33 +00:00
(no author)
8ff6fa900a This commit was manufactured by cvs2svn to create branch
'Bugzilla_Groups_Branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@115297 18797224-902f-48f8-a5cc-f745e15eee43
2002-02-24 09:28:22 +00:00
dkl%redhat.com
515970307d Update to HEAD 2002/02/04
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@113611 18797224-902f-48f8-a5cc-f745e15eee43
2002-02-04 16:57:48 +00:00
(no author)
f9c7591ccf This commit was manufactured by cvs2svn to create branch
'Bugzilla_Groups_Branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@113574 18797224-902f-48f8-a5cc-f745e15eee43
2002-02-03 09:28:49 +00:00
dkl%redhat.com
5b9228a8d9 Fixed unqiue() and index() in group_map creation
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@113020 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-28 06:20:35 +00:00
dkl%redhat.com
795aa1b273 Added support for Product groups. Large number of files converted
to use new CanSeeProduct() routine for checking for product privacy.


git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@113019 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-28 05:34:49 +00:00
dkl%redhat.com
3c43e59a41 Added group support for products in editproducts.cgi and checksetup.pl. Still need to add to enter_bug.cgi and other utility functions.
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112757 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-24 23:02:06 +00:00
bbaetz%student.usyd.edu.au
890bf283ee Misc other changes - typo fixes, extra quoting, missed bits from merges,
etc.


git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112684 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-24 11:35:13 +00:00
dkl%redhat.com
aa5f1c2843 Fix sql bug in enter_bug.cgi
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112664 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-24 06:01:35 +00:00
dkl%redhat.com
805b3f20cf Initial attempt at group conversion in checksetup.pl. Needs testing on large database.
Added changes suggested by bbaetz in his 2nd patch to bug 68022
Add way to add/remove admin status to certain users in editusers.cgi
Product_group_map table added to checksetup.pl but not yet used.
Bless_group_map table dropped in favor of canbless column in user_group_map.


git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112662 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-24 05:41:34 +00:00
dkl%redhat.com
37290580fb Fix runtests.sh error with processmail
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112508 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-21 23:31:31 +00:00
dkl%redhat.com
e490ca10d6 Fix syntax error in ValidateBugID() in CGI.pl
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112506 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-21 23:06:16 +00:00
dkl%redhat.com
d3d9ef8e9b Update to HEAD 2002/01/21
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112505 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-21 22:59:10 +00:00
dkl%redhat.com
53b2d9abb7 Fix botched earlier CVS merge with HEAD
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112498 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-21 20:37:24 +00:00
dkl%redhat.com
87fd19faa5 Initial attempt at group conversion in checksetup.pl
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112497 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-21 20:36:16 +00:00
(no author)
caa5a2a9d8 This commit was manufactured by cvs2svn to create branch
'Bugzilla_Groups_Branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112477 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-18 23:27:02 +00:00
dkl%redhat.com
889e4f5cc1 Sync to HEAD 2002/01/17
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@112410 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-18 00:53:35 +00:00
dkl%redhat.com
340c85f5cb Changed look back to original checkboxes
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@111507 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-07 23:04:30 +00:00
dkl%redhat.com
a8241fb46b Update to HEAD 2001/01/07
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@111473 18797224-902f-48f8-a5cc-f745e15eee43
2002-01-07 05:51:58 +00:00
dkl%redhat.com
315d3aee4b Merge with TRUNK: 2001/12/26
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@111104 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-27 07:45:26 +00:00
dkl%redhat.com
82fecacb42 Fixed sync screw up by backing out changes and recommitting.
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@110824 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-19 21:45:04 +00:00
dkl%redhat.com
b1604dfbf2 Resync with HEAD 2001/12/19
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@110820 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-19 20:27:13 +00:00
dkl%redhat.com
b34e2df62f Sync up with HEAD 2001/12/19
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@110816 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-19 20:09:55 +00:00
(no author)
09ff91168b This commit was manufactured by cvs2svn to create branch
'Bugzilla_Groups_Branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@110403 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-12 22:41:20 +00:00
dkl%redhat.com
e4fc4fc21c Further removal of SelectVisible() instances
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@110267 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-11 17:48:02 +00:00
dkl%redhat.com
e255392d0b Fixed multiple bug changes in buglist.cgi in regard to permission group changes
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@110266 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-11 17:46:44 +00:00
dkl%redhat.com
87df3f9338 readded asterisks next to private bugs in query list
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@110186 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-10 22:42:14 +00:00
dkl%redhat.com
38607f362c More enhancements for permission checking with a newly constructed CanSeeBug() subroutine
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@110183 18797224-902f-48f8-a5cc-f745e15eee43
2001-12-10 21:58:40 +00:00
(no author)
bd236995aa This commit was manufactured by cvs2svn to create branch
'Bugzilla_Groups_Branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@108716 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-21 19:56:29 +00:00
dkl%redhat.com
86704c0054 More SelectVisible fun
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@107914 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-12 05:15:44 +00:00
dkl%redhat.com
01548fcd18 More experimenting with SelectVisible and CanSeeBug
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@107910 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-12 03:49:54 +00:00
dkl%redhat.com
b46d40637d Changes to SelectVisible again
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@107658 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-08 06:48:00 +00:00
dkl%redhat.com
579dca85f0 Changes to SelectVisible again
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@107654 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-08 05:25:08 +00:00
dkl%redhat.com
8a7048fc74 Changes to SelectVisible
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@107652 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-08 05:19:28 +00:00
dkl%redhat.com
e17f87f7b6 Fixes in editgroups.cgi and added section to editusers.cgi for searching by group number
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@107476 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-06 21:57:47 +00:00
dkl%redhat.com
286fe25e42 Fixed tinderbox warnings, errors
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@107467 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-06 17:14:30 +00:00
dkl%redhat.com
4da15f4cb1 Fix tab warnings in Tinderbox
git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@107453 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-06 15:20:00 +00:00
justdave%syndicomm.com
084f85c308 Initial commit for experimental patches for bug 68022, new group schema to eliminate the bitsets. This is patch v0.3 from
that bug.


git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@107362 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-06 00:21:45 +00:00
(no author)
77b50d204b This commit was manufactured by cvs2svn to create branch
'Bugzilla_Groups_Branch'.

git-svn-id: svn://10.0.0.236/branches/Bugzilla_Groups_Branch@107352 18797224-902f-48f8-a5cc-f745e15eee43
2001-11-05 20:47:19 +00:00
78 changed files with 1318 additions and 4971 deletions

View File

@@ -115,9 +115,7 @@ sub initBug {
return $self;
}
my $query = "";
if ($::driver eq 'mysql') {
$query = "
my $query = "
select
bugs.bug_id, product, version, rep_platform, op_sys, bug_status,
resolution, priority, bug_severity, component, assigned_to, reporter,
@@ -127,21 +125,6 @@ sub initBug {
from bugs left join votes using(bug_id)
where bugs.bug_id = $bug_id
group by bugs.bug_id";
} elsif ($::driver eq 'Pg') {
$query = "
select
bugs.bug_id, product, version, rep_platform, op_sys, bug_status,
resolution, priority, bug_severity, component, assigned_to, reporter,
bug_file_loc, short_desc, target_milestone, qa_contact,
status_whiteboard, creation_ts,
delta_ts, sum(votes.count)
from bugs left join votes using(bug_id)
where bugs.bug_id = $bug_id
group by bugs.bug_id, product, version, rep_platform, op_sys, bug_status,
resolution, priority, bug_severity, component, assigned_to, reporter,
bug_file_loc, short_desc, target_milestone, qa_contact, status_whiteboard,
creation_ts, delta_ts";
}
&::SendSQL($query);
my @row;
@@ -441,18 +424,14 @@ sub Collision {
my $self = shift();
my $write = "WRITE"; # Might want to make a param to control
# whether we do LOW_PRIORITY ...
if ($::driver eq 'mysql') {
&::SendSQL("LOCK TABLES bugs $write, bugs_activity $write, cc $write, " .
"cc AS selectVisible_cc $write, " .
"profiles $write, dependencies $write, votes $write, " .
"keywords $write, longdescs $write, fielddefs $write, " .
"keyworddefs READ, groups READ, attachments READ, products READ");
}
&::SendSQL("LOCK TABLES bugs $write, bugs_activity $write, cc $write, " .
"cc AS selectVisible_cc $write, " .
"profiles $write, dependencies $write, votes $write, " .
"keywords $write, longdescs $write, fielddefs $write, " .
"keyworddefs READ, groups READ, attachments READ, products READ");
&::SendSQL("SELECT delta_ts FROM bugs where bug_id=$self->{'bug_id'}");
my $delta_ts = &::FetchOneColumn();
if ($::driver eq 'mysql') {
&::SendSQL("unlock tables");
}
&::SendSQL("unlock tables");
if ($self->{'delta_ts'} ne $delta_ts) {
return 1;
}

View File

@@ -505,8 +505,7 @@ sub GetUserInfo {
SendSQL("SELECT mybugslink, realname FROM profiles " .
"WHERE userid = $userid");
($user{'showmybugslink'}, $user{'realname'}) =
FetchSQLData();
($user{'showmybugslink'}, $user{'realname'}) = FetchSQLData();
SendSQL("SELECT name, query, linkinfooter FROM namedqueries " .
"WHERE userid = $userid");
@@ -519,9 +518,8 @@ sub GetUserInfo {
$user{'queries'} = \@queries;
SendSQL("SELECT groups.name FROM groups, user_group_map " .
"WHERE groups.group_id = user_group_map.group_id " .
"AND user_group_map.user_id = $userid");
SendSQL("select name from groups, user_group_map where groups.group_id = user_group_map.group_id " .
"and user_group_map.user_id = $userid");
while (MoreSQLData()) {
my ($name) = FetchSQLData();
$groups{$name} = 1;
@@ -766,7 +764,8 @@ sub confirm_login {
if($enteredlogin ne "") {
$::COOKIE{"Bugzilla_login"} = $enteredlogin;
SendSQL("insert into logincookies (userid,ipaddr) values (@{[DBNameToIdAndCheck($enteredlogin)]}, @{[SqlQuote($ENV{'REMOTE_ADDR'})]})");
my $logincookie = CurrId("logincookies_cookie_seq");
SendSQL("select LAST_INSERT_ID()");
my $logincookie = FetchOneColumn();
$::COOKIE{"Bugzilla_logincookie"} = $logincookie;
my $cookiepath = Param("cookiepath");
@@ -879,13 +878,8 @@ Content-type: text/html
# crufty junk in the logincookies table. Get rid of any entry
# that hasn't been used in a month.
if ($::dbwritesallowed) {
if ($::driver eq 'mysql') {
SendSQL("DELETE FROM logincookies " .
"WHERE TO_DAYS(NOW()) - TO_DAYS(lastused) > 30");
} elsif ($::driver eq 'Pg') {
SendSQL("DELETE FROM logincookies " .
"WHERE NOW() - lastused > 30");
}
SendSQL("DELETE FROM logincookies " .
"WHERE TO_DAYS(NOW()) - TO_DAYS(lastused) > 30");
}
@@ -895,7 +889,7 @@ Content-type: text/html
# Update the timestamp on our logincookie, so it'll keep on working.
if ($::dbwritesallowed) {
SendSQL("UPDATE logincookies SET lastused = NULL " .
SendSQL("UPDATE logincookies SET lastused = null " .
"WHERE cookie = $::COOKIE{'Bugzilla_logincookie'}");
}
return $userid;
@@ -930,8 +924,6 @@ sub DisplayError {
$template->process("global/user-error.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
RollBack();
return 1;
}
@@ -941,16 +933,14 @@ sub ThrowCodeError {
($vars->{'error'}, $vars->{'variables'}, my $unlock_tables) = (@_);
$vars->{'title'} = "Code Error";
SendSQL("UNLOCK TABLES") if $unlock_tables && $::driver eq 'mysql';
SendSQL("UNLOCK TABLES") if $unlock_tables;
# We may optionally log something to file here.
print "Content-type: text/html\n\n" if !$vars->{'header_done'};
$template->process("global/code-error.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
RollBack();
exit;
}
@@ -959,7 +949,7 @@ sub ThrowUserError {
($vars->{'error'}, $vars->{'title'}, my $unlock_tables) = (@_);
$vars->{'title'} ||= "Error";
SendSQL("UNLOCK TABLES") if $unlock_tables && $::driver eq 'mysql';
SendSQL("UNLOCK TABLES") if $unlock_tables;
print "Content-type: text/html\n\n" if !$vars->{'header_done'};
$template->process("global/user-error.html.tmpl", $vars)
@@ -1042,48 +1032,25 @@ sub CheckIfVotedConfirmed {
sub GetBugActivity {
my ($id, $starttime) = (@_);
my $datepart = "";
my $query = "";
die "Invalid id: $id" unless $id=~/^\s*\d+\s*$/;
if (defined $starttime) {
$datepart = "and bugs_activity.bug_when > " . SqlQuote($starttime);
}
if ($::driver eq 'mysql') {
$query = "
SELECT
IFNULL(fielddefs.name, bugs_activity.fieldid),
bugs_activity.attach_id,
bugs_activity.bug_when, ";
} elsif ($::driver eq 'Pg') {
# $query = "
# SELECT
# COALESCE(fielddefs.name, chr(bugs_activity.fieldid)),
# bugs_activity.attach_id,
# TO_CHAR(bugs_activity.bug_when, 'YYYY-MM-DD'), ";
$query = "
SELECT
bugs_activity.fieldid,
bugs_activity.attach_id,
TO_CHAR(bugs_activity.bug_when, 'YYYY-MM-DD'), ";
}
$query .= "
bugs_activity.removed,
bugs_activity.added,
profiles.login_name
FROM
bugs_activity LEFT JOIN fielddefs ON
bugs_activity.fieldid = fielddefs.fieldid,
profiles
WHERE
bugs_activity.bug_id = $id $datepart
AND profiles.userid = bugs_activity.who
ORDER BY
bugs_activity.bug_when";
my $query = "
SELECT IFNULL(fielddefs.description, bugs_activity.fieldid),
bugs_activity.attach_id,
bugs_activity.bug_when,
bugs_activity.removed, bugs_activity.added,
profiles.login_name
FROM bugs_activity LEFT JOIN fielddefs ON
bugs_activity.fieldid = fielddefs.fieldid,
profiles
WHERE bugs_activity.bug_id = $id $datepart
AND profiles.userid = bugs_activity.who
ORDER BY bugs_activity.bug_when";
SendSQL($query);

View File

@@ -123,13 +123,13 @@ sub IssuePasswordToken {
# Generate a unique token and insert it into the tokens table.
# We have to lock the tokens table before generating the token,
# since the database must be queried for token uniqueness.
&::SendSQL("LOCK TABLE tokens WRITE") if $::driver eq 'mysql';
&::SendSQL("LOCK TABLES tokens WRITE");
my $token = GenerateUniqueToken();
my $quotedtoken = &::SqlQuote($token);
my $quotedipaddr = &::SqlQuote($::ENV{'REMOTE_ADDR'});
&::SendSQL("INSERT INTO tokens ( userid , issuedate , token , tokentype , eventdata )
VALUES ( $userid , '$issuedate' , $quotedtoken , 'password' , $quotedipaddr )");
&::SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
&::SendSQL("UNLOCK TABLES");
# Mail the user the token along with instructions for using it.
@@ -155,13 +155,10 @@ sub IssuePasswordToken {
sub CleanTokenTable {
&::SendSQL("LOCK TABLES tokens WRITE") if $::driver eq 'mysql';
if ($::driver eq 'mysql') {
&::SendSQL("DELETE FROM tokens WHERE TO_DAYS(NOW()) - TO_DAYS(issuedate) >= " . $maxtokenage);
} elsif ($::driver eq 'Pg') {
&::SendSQL("DELETE FROM tokens WHERE now() - issuedate >= '$maxtokenage days'");
}
&::SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
&::SendSQL("LOCK TABLES tokens WRITE");
&::SendSQL("DELETE FROM tokens
WHERE TO_DAYS(NOW()) - TO_DAYS(issuedate) >= " . $maxtokenage);
&::SendSQL("UNLOCK TABLES");
}
@@ -238,9 +235,9 @@ sub Cancel {
close SENDMAIL;
# Delete the token from the database.
&::SendSQL("LOCK TABLE tokens WRITE") if $::driver eq 'mysql';
&::SendSQL("LOCK TABLES tokens WRITE");
&::SendSQL("DELETE FROM tokens WHERE token = $quotedtoken");
&::SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
&::SendSQL("UNLOCK TABLES");
}
sub HasPasswordToken {

View File

@@ -480,7 +480,8 @@ sub insert
VALUES ($::FORM{'bugid'}, $filename, $description, $contenttype, $::FORM{'ispatch'}, $userid, $thedata)");
# Retrieve the ID of the newly created attachment record.
my $attachid = CurrId('attachments_attach_id_seq');
SendSQL("SELECT LAST_INSERT_ID()");
my $attachid = FetchOneColumn();
# Insert a comment about the new attachment into the database.
my $comment = "Created an attachment (id=$attachid)\n$::FORM{'description'}\n";
@@ -528,7 +529,6 @@ sub insert
# Generate and return the UI (HTML page) from the appropriate template.
$template->process("attachment/created.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
SendSQL("SELECT short_desc FROM bugs WHERE bug_id = $::FORM{'bugid'}");
}
@@ -554,7 +554,7 @@ sub edit
# Retrieve a list of status flags that have been set on the attachment.
my %statuses;
SendSQL("SELECT id, name
FROM attachstatuses, attachstatusdefs
FROM attachstatuses JOIN attachstatusdefs
WHERE attachstatuses.statusid = attachstatusdefs.id
AND attach_id = $::FORM{'id'}");
while ( my ($id, $name) = FetchSQLData() )
@@ -607,7 +607,7 @@ sub edit
}
sub update
sub update
{
# Update an attachment record.
@@ -618,10 +618,8 @@ sub update
&& exit;
# Lock database tables in preparation for updating the attachment.
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES attachments WRITE , attachstatuses WRITE ,
attachstatusdefs READ , fielddefs READ , bugs_activity WRITE");
}
SendSQL("LOCK TABLES attachments WRITE , attachstatuses WRITE ,
attachstatusdefs READ , fielddefs READ , bugs_activity WRITE");
# Get a copy of the attachment record before we make changes
# so we can record those changes in the activity table.
@@ -712,9 +710,7 @@ sub update
}
# Unlock all database tables now that we are finished updating the database.
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
# If this installation has enabled the request manager, let the manager know
# an attachment was updated so it can check for requests on that attachment

View File

@@ -77,61 +77,16 @@ sub show_bug {
# Populate the bug hash with the info we get directly from the DB.
my $query = "
SELECT
bugs.bug_id,
product,
version,
rep_platform,
op_sys,
bug_status,
resolution,
priority,
bug_severity,
component,
assigned_to,
reporter,
bug_file_loc,
short_desc,
target_milestone,
qa_contact,
status_whiteboard, ";
if ($::driver eq 'mysql') {
$query .= "
date_format(creation_ts, '%Y-%m-%d %H:%i'),
delta_ts, ";
} elsif ($::driver eq 'Pg') {
$query .= "
TO_CHAR(creation_ts, 'YYYY-MM-DD HH24:MI:SS'),
TO_CHAR(delta_ts, 'YYYYMMDDHH24MISS'), ";
}
$query .= "
SUM(votes.count)
FROM
bugs LEFT JOIN votes USING(bug_id)
WHERE
bugs.bug_id = $id
GROUP BY
bugs.bug_id,
product,
version,
rep_platform,
op_sys,
bug_status,
resolution,
priority,
bug_severity,
component,
assigned_to,
reporter,
bug_file_loc,
short_desc,
target_milestone,
qa_contact,
status_whiteboard,
creation_ts,
delta_ts ";
SELECT bugs.bug_id, product, version, rep_platform,
op_sys, bug_status, resolution, priority,
bug_severity, component, assigned_to, reporter,
bug_file_loc, short_desc, target_milestone,
qa_contact, status_whiteboard,
date_format(creation_ts,'%Y-%m-%d %H:%i'),
delta_ts, sum(votes.count)
FROM bugs LEFT JOIN votes USING(bug_id)
WHERE bugs.bug_id = $id
GROUP BY bugs.bug_id";
SendSQL($query);
@@ -165,7 +120,15 @@ GROUP BY
next;
}
next if !CanSeeProduct($userid, $product);
if (Param("usebuggroupsentry")
&& GroupExists($product)
&& !UserInGroup($userid, $product))
{
# If we're using bug groups to restrict entry on products, and
# this product has a bug group, and the user is not in that
# group, we don't want to include that product in this list.
next;
}
push(@prodlist, $product);
}
@@ -311,18 +274,18 @@ GROUP BY
# User permissions
# In the below, if the person hasn't logged in ($::userid == 0), then
# In the below, if the person hasn't logged in ($userid == 0), then
# we treat them as if they can do anything. That's because we don't
# know why they haven't logged in; it may just be because they don't
# use cookies. Display everything as if they have all the permissions
# in the world; their permissions will get checked when they log in
# and actually try to make the change.
$user{'canedit'} = $::userid == 0
|| $::userid == $bug{'reporter'}
|| $::userid == $bug{'qa_contact'}
|| $::userid == $bug{'assigned_to'}
|| UserInGroup($userid, "editbugs");
$user{'canconfirm'} = ($::userid == 0) || UserInGroup($userid, "canconfirm");
$user{'canedit'} = $userid == 0
|| $userid == $bug{'reporter'}
|| $userid == $bug{'qa_contact'}
|| $userid == $bug{'assigned_to'}
|| UserInGroup("editbugs");
$user{'canconfirm'} = ($userid == 0) || UserInGroup($userid, "canconfirm");
# Bug states
$bug{'isunconfirmed'} = ($bug{'bug_status'} eq $::unconfirmedstate);

View File

@@ -195,7 +195,7 @@ sub GetByWordList {
$word =~ s/^'//;
$word =~ s/'$//;
$word = '(^|[^a-z0-9])' . $word . '($|[^a-z0-9])';
push(@list, SqlRegEx($field, SqlQuote($word)));
push(@list, "lower($field) regexp '$word'");
}
}
@@ -211,7 +211,7 @@ sub GetByWordListSubstr {
foreach my $word (split(/[\s,]+/, $strs)) {
if ($word ne "") {
push(@list, SqlStrSearch($field, SqlQuote($word), "lower"));
push(@list, "INSTR(LOWER($field), " . lc(SqlQuote($word)) . ")");
}
}
@@ -283,13 +283,11 @@ sub GetGroupsByGroupSet {
sub GenerateSQL {
my $debug = 0;
my ($fieldsref, $urlstr, $groupbyref) = (@_);
my ($fieldsref, $urlstr) = (@_);
my @fields;
my @groupbylist;
my @supptables;
my @wherepart;
@fields = @$fieldsref if $fieldsref;
@groupbylist = @$groupbyref if $groupbyref;
my %F;
my %M;
ParseUrlString($urlstr, \%F, \%M);
@@ -300,15 +298,10 @@ sub GenerateSQL {
# First, deal with all the old hard-coded non-chart-based poop.
# unshift(@supptables,
# ("profiles map_assigned_to",
# "profiles map_reporter",
# "LEFT JOIN profiles map_qa_contact ON bugs.qa_contact = map_qa_contact.userid"));
unshift(@supptables,
("profiles map_assigned_to",
"profiles map_reporter"));
"profiles map_reporter",
"LEFT JOIN profiles map_qa_contact ON bugs.qa_contact = map_qa_contact.userid"));
unshift(@wherepart,
("bugs.assigned_to = map_assigned_to.userid",
"bugs.reporter = map_reporter.userid"));
@@ -642,11 +635,7 @@ sub GenerateSQL {
}
},
"^changedin," => sub {
if ($::driver eq 'mysql') {
$f = "(to_days(now()) - to_days(bugs.delta_ts))";
} elsif ($::driver eq 'Pg') {
$f = "(now() - bugs.delta_ts)";
}
$f = "(to_days(now()) - to_days(bugs.delta_ts))";
},
"^keywords," => sub {
@@ -714,19 +703,19 @@ sub GenerateSQL {
$term = "$ff != $q";
},
",casesubstring" => sub {
$term = SqlStrSearch($ff, $q);
$term = "INSTR($ff, $q)";
},
",(substring|substr)" => sub {
$term = SqlStrSearch($ff, $q, "lower", "not");
$term = "INSTR(LOWER($ff), " . lc($q) . ")";
},
",notsubstring" => sub {
$term = SqlStrSearch($ff, $q, "lower");
$term = "INSTR(LOWER($ff), " . lc($q) . ") = 0";
},
",regexp" => sub {
$term = SqlRegEx($ff, $q);
$term = "LOWER($ff) REGEXP $q";
},
",notregexp" => sub {
$term = SqlRegEx($ff, $q);
",notregexp" => sub {
$term = "LOWER($ff) NOT REGEXP $q";
},
",lessthan" => sub {
$term = "$ff < $q";
@@ -1016,7 +1005,6 @@ sub GenerateSQL {
}
}
}
my %suppseen = ("bugs" => 1);
my $suppstring = "bugs";
foreach my $str (@supptables) {
@@ -1030,10 +1018,7 @@ sub GenerateSQL {
}
my $query = ("SELECT DISTINCT " . join(', ', @fields) .
" FROM $suppstring" .
" WHERE " . join(' AND ', (@wherepart, @andlist)) .
" GROUP BY " . join(", ", @groupbylist));
# $query = SelectVisible($query, $::userid, $::usergroupset);
" WHERE " . join(' AND ', (@wherepart, @andlist)));
if ($debug) {
print "<P><CODE>" . value_quote($query) . "</CODE><P>\n";
@@ -1093,21 +1078,8 @@ CMD: for ($::FORM{'cmdtype'}) {
my $userid = DBNameToIdAndCheck($::COOKIE{"Bugzilla_login"});
my $qname = SqlQuote($::defaultqueryname);
my $qbuffer = SqlQuote($::buffer);
if ($::driver eq 'mysql') {
SendSQL("REPLACE INTO namedqueries (userid, name, query)" .
"VALUES ($userid, $qname, $qbuffer)");
} elsif ($::driver eq 'Pg') {
SendSQL("SELECT userid FROM namedqueries WHERE userid = $userid " .
"AND name = $qname");
my $result = FetchOneColumn();
if ( $result ) {
SendSQL("UPDATE namedqueries SET query = $qbuffer " .
"WHERE userid = $userid AND name = $qname");
} else {
SendSQL("INSERT INTO namedqueries (userid, name, query, watchfordiffs, linkinfooter) VALUES " .
"($userid, $qname, $qbuffer, '', '')");
}
}
SendSQL("REPLACE INTO namedqueries (userid, name, query)
VALUES ($userid, $qname, $qbuffer)");
print "Content-Type: text/html\n\n";
# Generate and return the UI (HTML page) from the appropriate template.
$vars->{'title'} = "OK, default is set";
@@ -1146,7 +1118,7 @@ CMD: for ($::FORM{'cmdtype'}) {
WHERE userid = $userid AND name = $qname");
}
else {
SendSQL("INSERT INTO namedqueries (userid, name, query, linkinfooter)
SendSQL("REPLACE INTO namedqueries (userid, name, query, linkinfooter)
VALUES ($userid, $qname, $qbuffer, $tofooter)");
}
@@ -1207,17 +1179,8 @@ sub DefineColumn {
# Column: ID Name Title
DefineColumn("id" , "bugs.bug_id" , "ID" );
if ($::driver eq 'mysql') {
DefineColumn("opendate", "unix_timestamp(bugs.creation_ts)", "Opened",
"bugs.creation_ts");
DefineColumn("changeddate", "unix_timestamp(bugs.delta_ts)", "Changed",
"bugs.delta_ts");
} elsif ($::driver eq 'Pg') {
DefineColumn("opendate", "bugs.creation_ts", "Opened",
"bugs.creation_ts");
DefineColumn("changeddate", "bugs.delta_ts", "Changed",
"bugs.delta_ts");
}
DefineColumn("opendate" , "bugs.creation_ts" , "Opened" );
DefineColumn("changeddate" , "bugs.delta_ts" , "Changed" );
DefineColumn("severity" , "bugs.bug_severity" , "Severity" );
DefineColumn("priority" , "bugs.priority" , "Priority" );
DefineColumn("platform" , "bugs.rep_platform" , "Platform" );
@@ -1284,9 +1247,6 @@ if (trim($::FORM{'votes'}) && !grep($_ eq 'votes', @displaycolumns)) {
push(@displaycolumns, 'votes');
}
################################################################################
# Select Column Determination
################################################################################
################################################################################
# Select Column Determination
@@ -1294,23 +1254,18 @@ if (trim($::FORM{'votes'}) && !grep($_ eq 'votes', @displaycolumns)) {
# Generate the list of columns that will be selected in the SQL query.
# The bug ID is always selected because bug IDs are always
# displayed
# The bug IDs are always selected because bug IDs are always displayed
my @selectcolumns = ("id");
my @groupbylist = ("id");
# Display columns are selected because otherwise we could not display them.
push (@selectcolumns, @displaycolumns);
push (@groupbylist, @displaycolumns);
# If the user is editing multiple bugs, we also make sure to select the product
# and status because the values of those fields determine what options the user
# has for modifying the bugs.
if ($dotweak) {
push(@selectcolumns, "product") if !grep($_ eq 'product', @selectcolumns);
push(@groupbylist, "product") if !grep($_ eq 'product', @groupbylist);
push(@selectcolumns, "status") if !grep($_ eq 'status', @selectcolumns);
push(@groupbylist, "status") if !grep($_ eq 'product', @groupbylist);
}
@@ -1320,10 +1275,10 @@ if ($dotweak) {
# Convert the list of columns being selected into a list of column names.
my @selectnames = map($columns->{$_}->{'name'}, @selectcolumns);
my @groupbynames = map($columns->{$_}->{'name'}, @groupbylist);
# Generate the basic SQL query that will be used to generate the bug list.
my $query = GenerateSQL(\@selectnames, $::buffer, \@groupbynames);
my $query = GenerateSQL(\@selectnames, $::buffer);
################################################################################
# Sort Order Determination
@@ -1428,7 +1383,7 @@ ReconnectToShadowDatabase();
# Tell MySQL to store temporary tables on the hard drive instead of memory
# to avoid "table out of space" errors on MySQL versions less than 3.23.2.
SendSQL("SET OPTION SQL_BIG_TABLES=1") if Param('expectbigqueries') && $::driver eq 'mysql';
SendSQL("SET OPTION SQL_BIG_TABLES=1") if Param('expectbigqueries');
# Normally, we ignore SIGTERM and SIGPIPE (see globals.pl) but we need to
# respond to them here to prevent someone DOSing us by reloading a query
@@ -1439,6 +1394,7 @@ $::SIG{PIPE} = 'DEFAULT';
# Execute the query.
SendSQL($query);
################################################################################
# Results Retrieval
################################################################################
@@ -1492,7 +1448,7 @@ foreach my $bug (@bugs) {
# Switch back from the shadow database to the regular database so PutFooter()
# can determine the current user even if the "logincookies" table is corrupted
# in the shadow database.
SendSQL("USE $::db_name") if $::driver eq 'mysql';
SendSQL("USE $::db_name");
################################################################################
# Template Variable Definition
@@ -1524,6 +1480,7 @@ $vars->{'order'} = $order;
my $login = $::COOKIE{'Bugzilla_login'};
$vars->{'caneditbugs'} = UserInGroup($userid, 'editbugs');
$vars->{'usebuggroups'} = Param('usebuggroups');
# Whether or not this user is authorized to move bugs to another installation.
$vars->{'ismover'} = 1
@@ -1638,4 +1595,3 @@ $template->process("list/$format->{'template'}", $vars)
################################################################################
print "\n--thisrandomstring--\n" if $serverpush;

View File

@@ -174,50 +174,20 @@ sub have_vers {
}
# Check versions of dependencies. 0 for version = any version acceptible
my $modules = [
{
name => 'AppConfig',
version => '1.52'
},
{
name => 'CGI::Carp',
version => '0'
},
{
name => 'Data::Dumper',
version => '0'
},
{
name => 'Date::Parse',
version => '0'
},
{
name => 'DBI',
version => '1.13'
},
{
name => 'DBD::mysql',
version => '1.2209'
},
{
name => 'File::Spec',
version => '0.82'
},
{
name => 'Template',
version => '2.07'
},
{
name => 'Text::Wrap',
version => '2001.0131'
}
];
my %modules = (
"DBI" => "1.13",
"Data::Dumper" => "0",
"DBD::mysql" => "1.2209",
"Date::Parse" => "0",
"AppConfig" => "1.52",
"Template" => "2.07",
"Text::Wrap" => "2001.0131",
"File::Spec" => "0.82"
);
my %missing = ();
foreach my $module (@{$modules}) {
unless (have_vers($module->{name}, $module->{version})) {
$missing{$module->{name}} = $module->{version};
}
foreach my $module (keys %modules) {
unless (have_vers($module, $modules{$module})) { $missing{$module} = $modules{$module} }
}
# If CGI::Carp was loaded successfully for version checking, it changes the
@@ -398,11 +368,12 @@ LocalVar('webservergroup', '
$webservergroup = "nobody";
');
LocalVar('db_host', '
#
# How to access the SQL database:
#
$db_driver = "mysql"; # Which database we are using
$db_host = "localhost"; # where is the database?
$db_port = 3306; # which port to use
$db_name = "bugs"; # name of the MySQL database

View File

@@ -30,7 +30,6 @@ use strict;
use lib qw(.);
require "CGI.pl";
require "globals.pl";
# Shut up misguided -w warnings about "used only once":
use vars qw(

View File

@@ -126,7 +126,7 @@ DefParam("maintainer",
'THE MAINTAINER HAS NOT YET BEEN SET');
DefParam("urlbase",
"The URL that is the common initial leading part of all Bugzilla URLs. Must end with a / character.",
"The URL that is the common initial leading part of all Bugzilla URLs.",
"t",
"http://cvs-mirror.mozilla.org/webtools/bugzilla/",
\&check_urlbase);
@@ -149,11 +149,17 @@ DefParam("usequip",
"b",
1);
# Added parameter - dkl, 5/28/02
DefParam("usetransactions",
"If this is on, Bugzilla will enable transaction support (currently PostgreSQL only).",
# Added parameter - JMR, 2/16/00
DefParam("usebuggroups",
"If this is on, Bugzilla will associate a bug group with each product in the database, and use it for querying bugs.",
"b",
0);
0);
# Added parameter - JMR, 2/16/00
DefParam("usebuggroupsentry",
"If this is on, Bugzilla will use product bug groups to restrict who can enter bugs. Requires usebuggroups to be on as well.",
"b",
0);
DefParam("shadowdb",
"If non-empty, then this is the name of another database in which Bugzilla will keep a shadow read-only copy of everything. This is done so that long slow read-only operations can be used against this db, and not lock up things for everyone else. Turning on this parameter will create the given database; be careful not to use the name of an existing database with useful data in it!",

View File

@@ -23,7 +23,6 @@
use vars qw(
%FORM
%proddesc
$userid
);
@@ -67,7 +66,7 @@ if (!defined $::FORM{'product'}) {
exit;
}
$::FORM{'product'} = (keys %products)[0];
$::FORM{'product'} = (keys %::proddesc)[0];
}
my $product = $::FORM{'product'};
@@ -79,14 +78,24 @@ my $product = $::FORM{'product'};
# whether or not certain products exist in Bugzilla, even if they
# cannot get any other information about that product.
grep($product eq $_ , @::legal_product)
|| DisplayError("The product name is invalid.")
&& exit;
|| DisplayError("The product name is invalid.")
&& exit;
# Make sure the user is authorized to access this product.
!CanSeeProduct($userid, $product)
&& DisplayError("You are not authorized to access that product.")
&& exit;
# Make sure the user specified a valid product name. Note that
# if the user specifies a valid product name but is not authorized
# to access that product, they will receive a different error message
# which could enable people guessing product names to determine
# whether or not certain products exist in Bugzilla, even if they
# cannot get any other information about that product.
grep($product eq $_ , @::legal_product)
|| DisplayError("The product name is invalid.")
&& exit;
######################################################################
# End Data/Security Validation
######################################################################

View File

@@ -37,7 +37,7 @@ my $userid = quietly_check_login();
SendSQL("SELECT keyworddefs.name, keyworddefs.description,
COUNT(keywords.bug_id)
FROM keyworddefs LEFT JOIN keywords ON keyworddefs.id=keywords.keywordid
GROUP BY keyworddefs.id, keyworddefs.name, keyworddefs.description, keywords.bug_id
GROUP BY keyworddefs.id
ORDER BY keyworddefs.name");
my @keywords;

View File

@@ -41,7 +41,7 @@ GetVersionTable();
my $userid = quietly_check_login();
use vars qw (%FORM $userid @legal_product);
use vars qw (%FORM $userid $usergroupset @legal_product);
my %dbmcount;
my %count;
@@ -151,18 +151,21 @@ my @bugs;
my @bug_ids;
my $loop = 0;
# Determine which bugs we are allowed to see
my @canseebugs = keys %count;
my $canseeref = CanSeeBug(\@canseebugs, $userid);
foreach my $id (keys(%count)) {
# Skip if we cannot see this bug
next if !$canseeref->{$id};
# Maximum row count is dealt with in the template.
# If there's a buglist, restrict the bugs to that list.
next if $sortvisible && $buglist[0] && (lsearch(\@buglist, $id) == -1);
# Skip if we cannot see this bug
next if !$canseeref->{$id};
SendSQL("$generic_query bugs.bug_id = $id");
SendSQL(SelectVisible("$generic_query bugs.bug_id = $id",
$userid,
$usergroupset));
next unless MoreSQLData();
my ($component, $bug_severity, $op_sys, $target_milestone,

View File

@@ -184,7 +184,7 @@ sub list
SendSQL("SELECT id, name, description, sortkey, product, count(statusid)
FROM attachstatusdefs LEFT JOIN attachstatuses
ON attachstatusdefs.id=attachstatuses.statusid
GROUP BY id, name, description, sortkey, product
GROUP BY id
ORDER BY sortkey");
my @statusdefs;
while ( MoreSQLData() )
@@ -239,17 +239,13 @@ sub insert
my $desc = SqlQuote($::FORM{'desc'});
my $product = SqlQuote($::FORM{'product'});
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES attachstatusdefs WRITE");
}
SendSQL("LOCK TABLES attachstatusdefs WRITE");
SendSQL("SELECT MAX(id) FROM attachstatusdefs");
my $id = FetchSQLData() || 0;
$id++;
SendSQL("INSERT INTO attachstatusdefs (id, name, description, sortkey, product)
VALUES ($id, $name, $desc, $::FORM{'sortkey'}, $product)");
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
# Display the "administer attachment status flags" page
# along with a message that the flag has been created.
@@ -291,9 +287,7 @@ sub update
my $name = SqlQuote($::FORM{'name'});
my $desc = SqlQuote($::FORM{'desc'});
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES attachstatusdefs WRITE");
}
SendSQL("LOCK TABLES attachstatusdefs WRITE");
SendSQL("
UPDATE attachstatusdefs
SET name = $name ,
@@ -301,9 +295,7 @@ sub update
sortkey = $::FORM{'sortkey'}
WHERE id = $::FORM{'id'}
");
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
# Display the "administer attachment status flags" page
# along with a message that the flag has been updated.
@@ -341,14 +333,11 @@ sub confirmDelete
sub deleteStatus
{
# Delete an attachment status flag from the database.
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES attachstatusdefs WRITE, attachstatuses WRITE");
}
SendSQL("LOCK TABLES attachstatusdefs WRITE, attachstatuses WRITE");
SendSQL("DELETE FROM attachstatuses WHERE statusid = $::FORM{'id'}");
SendSQL("DELETE FROM attachstatusdefs WHERE id = $::FORM{'id'}");
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
# Display the "administer attachment status flags" page
# along with a message that the flag has been deleted.

View File

@@ -227,7 +227,7 @@ unless ($product) {
SendSQL("SELECT products.product,products.description,COUNT(bug_id)
FROM products LEFT JOIN bugs
ON products.product=bugs.product
GROUP BY products.product, products.description
GROUP BY products.product
ORDER BY products.product");
} else {
SendSQL("SELECT products.product,products.description
@@ -275,13 +275,12 @@ unless ($action) {
FROM components LEFT JOIN bugs
ON components.program=bugs.product AND components.value=bugs.component
WHERE program=" . SqlQuote($product) . "
GROUP BY value, description, initialowner, initialqacontact
ORDER BY value");
GROUP BY value");
} else {
SendSQL("SELECT value,description,initialowner,initialqacontact
FROM components
WHERE program=" . SqlQuote($product) . "
ORDER BY value");
GROUP BY value");
}
print "<TABLE BORDER=1 CELLPADDING=4 CELLSPACING=0><TR BGCOLOR=\"#6666FF\">\n";
print " <TH ALIGN=\"left\">Edit component ...</TH>\n";
@@ -580,13 +579,12 @@ if ($action eq 'delete') {
CheckComponent($product,$component);
# lock the tables before we start to change everything:
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES attachments WRITE,
bugs WRITE,
bugs_activity WRITE,
components WRITE,
dependencies WRITE");
}
SendSQL("LOCK TABLES attachments WRITE,
bugs WRITE,
bugs_activity WRITE,
components WRITE,
dependencies WRITE");
# According to MySQL doc I cannot do a DELETE x.* FROM x JOIN Y,
# so I have to iterate over bugs and delete all the indivial entries
@@ -621,9 +619,8 @@ if ($action eq 'delete') {
WHERE program=" . SqlQuote($product) . "
AND value=" . SqlQuote($component));
print "Components deleted.<P>\n";
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
unlink "data/versioncache";
PutTrailer($localtrailer);
exit;
@@ -717,18 +714,15 @@ if ($action eq 'update') {
# Note that the order of this tests is important. If you change
# them, be sure to test for WHERE='$component' or WHERE='$componentold'
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES bugs WRITE,
components WRITE, profiles READ");
}
SendSQL("LOCK TABLES bugs WRITE,
components WRITE, profiles READ");
if ($description ne $descriptionold) {
unless ($description) {
print "Sorry, I can't delete the description.";
PutTrailer($localtrailer);
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
exit;
}
SendSQL("UPDATE components
@@ -741,10 +735,8 @@ if ($action eq 'update') {
if ($initialowner ne $initialownerold) {
unless ($initialowner) {
print "Sorry, I can't delete the initial owner.";
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
print "Sorry, I can't delete the initial owner.";
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer);
exit;
}
@@ -752,9 +744,7 @@ if ($action eq 'update') {
my $initialownerid = DBname_to_id($initialowner);
unless ($initialownerid) {
print "Sorry, you must use an existing Bugzilla account as initial owner.";
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer);
exit;
}
@@ -770,9 +760,7 @@ if ($action eq 'update') {
my $initialqacontactid = DBname_to_id($initialqacontact);
if (!$initialqacontactid && $initialqacontact ne '') {
print "Sorry, you must use an existing Bugzilla account as initial QA contact.";
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer);
exit;
}
@@ -789,17 +777,13 @@ if ($action eq 'update') {
unless ($component) {
print "Sorry, I can't delete the product name.";
PutTrailer($localtrailer);
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
exit;
}
if (TestComponent($product,$component)) {
print "Sorry, component name '$component' is already in use.";
PutTrailer($localtrailer);
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
exit;
}
@@ -816,9 +800,7 @@ if ($action eq 'update') {
unlink "data/versioncache";
print "Updated product name.<BR>\n";
}
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer);
exit;

View File

@@ -309,7 +309,7 @@ if ($action eq 'new') {
push(@adminlist, $row[0]);
}
foreach my $userid (@adminlist) {
SendSQL("INSERT INTO user_group_map (user_id, group_id, canbless) VALUES ($userid, $id, 1)");
SendSQL("INSERT INTO user_group_map (user_id, group_id) VALUES ($userid, $id)");
}
# Add people who match regular expression to this group.
@@ -318,7 +318,7 @@ if ($action eq 'new') {
while (my ($userid) = FetchSQLData()) {
if ($userid =~ /$regexp/) {
PushGlobalSQLState();
SendSQL("INSERT INTO user_group_map (user_id, group_id, canbless) VALUES ($userid, $id, 0)");
SendSQL("INSERT INTO user_group_map (user_id, group_id) VALUES ($userid, $id)");
PopGlobalSQLState();
}
}
@@ -398,9 +398,8 @@ restriction for me<BR>
<B>NOTE:</B> It's quite possible to make confidential bugs public by checking
this box. It is <B>strongly</B> suggested that you review the bugs in this
group before checking the box.<P>
";
";
}
SendSQL("SELECT product FROM products WHERE product=" . SqlQuote($name));
if (MoreSQLData()) {
$cantdelete = 1;
@@ -449,9 +448,9 @@ if ($action eq 'delete') {
SendSQL("SELECT COUNT(user_id) FROM user_group_map WHERE group_id = $groupid");
if (FetchOneColumn()) {
if (!defined $::FORM{'removeusers'}) {
$cantdelete = 1;
}
if (!defined $::FORM{'removeusers'}) {
$cantdelete = 1;
}
}
SendSQL("SELECT COUNT(bug_id) FROM bug_group_map WHERE group_id = $groupid");
if (FetchOneColumn()) {

View File

@@ -142,7 +142,7 @@ if ($action eq "") {
SendSQL("SELECT keyworddefs.id, keyworddefs.name, keyworddefs.description,
COUNT(keywords.bug_id), keywords.bug_id
FROM keyworddefs LEFT JOIN keywords ON keyworddefs.id = keywords.keywordid
GROUP BY keyworddefs.id, keyworddefs.name, keyworddefs.description, keywords.bug_id
GROUP BY keyworddefs.id
ORDER BY keyworddefs.name");
while (MoreSQLData()) {
my ($id, $name, $description, $bugs, $onebug) = FetchSQLData();

View File

@@ -74,6 +74,12 @@ sub CheckProduct ($)
PutTrailer();
exit;
}
unless (CanSeeProduct($userid, $prod)) {
print "Sorry, You do not have permission to modify product '$prod'.";
PutTrailer();
exit;
}
}
@@ -81,9 +87,9 @@ sub CheckProduct ($)
# Displays the form to edit a products parameters
#
sub EmitFormElements ($$$$$$$$$)
sub EmitFormElements ($$$$$$$$)
{
my ($product, $description, $milestoneurl, $userregexp, $disallownew,
my ($product, $description, $milestoneurl, $disallownew,
$votesperuser, $maxvotesperbug, $votestoconfirm, $defaultmilestone)
= @_;
@@ -112,17 +118,6 @@ sub EmitFormElements ($$$$$$$$$)
print qq{<INPUT TYPE=HIDDEN NAME="defaultmilestone" VALUE="$defaultmilestone">\n};
}
print "</tr><tr>\n";
print " <TH ALIGN=\"right\">Create Product Specific Group:</TH>\n";
SendSQL("SELECT group_id FROM groups WHERE name = " . SqlQuote($product));
my $checked = FetchOneColumn() ? "CHECKED" : "";
print " <TD><INPUT TYPE=\"CHECKBOX\" NAME=\"productgroup\" $checked></TD>\n";
$userregexp = value_quote($userregexp);
print "</TR><TR>\n";
print " <TH ALIGN=\"right\">User Regexp for Product Group:</TH>\n";
print " <TD><INPUT TYPE=TEXT SIZE=64 MAXLENGTH=255 NAME=\"userregexp\" VALUE=\"$userregexp\"></TD>\n";
print "</TR><TR>\n";
print " <TH ALIGN=\"right\">Closed for bug entry:</TH>\n";
my $closed = $disallownew ? "CHECKED" : "";
@@ -142,15 +137,15 @@ sub EmitFormElements ($$$$$$$$$)
# Find list of groups that this product can be marked private to
print "</TR><TR>\n";
print " <TH ALIGN=\"right\">Other Group Access:</TH>\n";
print " <TH ALIGN=\"right\">Group Access:</TH>\n";
print " <TD><TABLE>\n";
my $productid = 0;
my %productbelongs = ();
if ($product) {
SendSQL("select product_id from products where product = " . SqlQuote($product));
$productid = FetchOneColumn();
SendSQL("select groups.group_id from groups, product_group_map " .
"where groups.group_id = product_group_map.group_id ".
SendSQL("select groups.group_id from groups, product_group_map " .
"where groups.group_id = product_group_map.group_id ".
"and product_group_map.product_id = $productid");
while (my ($groupid) = FetchSQLData()) {
$productbelongs{$groupid} = 1;
@@ -159,7 +154,7 @@ sub EmitFormElements ($$$$$$$$$)
my %groupsbelong = ();
my %groupsbelongname = ();
my %groupsbelongdesc = ();
my %groupsbelongdesc = ();
SendSQL("select groups.group_id, groups.name, groups.description " .
"from groups, user_group_map " .
"where groups.group_id = user_group_map.group_id " .
@@ -249,18 +244,11 @@ my $localtrailer = "<A HREF=\"editproducts.cgi\">edit</A> more products";
unless ($action) {
PutHeader("Select product");
# SendSQL("SELECT products.product,description,disallownew,
# votesperuser,maxvotesperbug,votestoconfirm,COUNT(bug_id)
# FROM products LEFT JOIN bugs
# ON products.product=bugs.product
# GROUP BY products.product,description,disallownew,
# votesperuser,maxvotesperbug,votestoconfirm
# ORDER BY products.product");
SendSQL("SELECT products.product,description,disallownew,
votesperuser,maxvotesperbug,votestoconfirm
FROM products
GROUP BY products.product,description,disallownew,
votesperuser,maxvotesperbug,votestoconfirm
votesperuser,maxvotesperbug,votestoconfirm,COUNT(bug_id)
FROM products LEFT JOIN bugs
ON products.product=bugs.product
GROUP BY products.product
ORDER BY products.product");
print "<TABLE BORDER=1 CELLPADDING=4 CELLSPACING=0><TR BGCOLOR=\"#6666FF\">\n";
print " <TH ALIGN=\"left\">Edit product ...</TH>\n";
@@ -269,13 +257,16 @@ unless ($action) {
print " <TH ALIGN=\"left\">Votes<br>per<br>user</TH>\n";
print " <TH ALIGN=\"left\">Max<br>Votes<br>per<br>bug</TH>\n";
print " <TH ALIGN=\"left\">Votes<br>to<br>confirm</TH>\n";
# print " <TH ALIGN=\"left\">Bugs</TH>\n";
print " <TH ALIGN=\"left\">Bugs</TH>\n";
print " <TH ALIGN=\"left\">Action</TH>\n";
print "</TR>";
while ( MoreSQLData() ) {
my ($product, $description, $disallownew, $votesperuser,
$maxvotesperbug, $votestoconfirm, $bugs) = FetchSQLData();
# Skip this product if user cannot see it
next if !CanSeeProduct($userid, $product);
$description ||= "<FONT COLOR=\"red\">missing</FONT>";
$disallownew = $disallownew ? 'closed' : 'open';
$bugs ||= 'none';
@@ -286,13 +277,12 @@ unless ($action) {
print " <TD VALIGN=\"top\" ALIGN=\"right\">$votesperuser</TD>\n";
print " <TD VALIGN=\"top\" ALIGN=\"right\">$maxvotesperbug</TD>\n";
print " <TD VALIGN=\"top\" ALIGN=\"right\">$votestoconfirm</TD>\n";
# print " <TD VALIGN=\"top\" ALIGN=\"right\">$bugs</TD>\n";
print " <TD VALIGN=\"top\" ALIGN=\"right\">$bugs</TD>\n";
print " <TD VALIGN=\"top\"><A HREF=\"editproducts.cgi?action=del&product=", url_quote($product), "\">Delete</A></TD>\n";
print "</TR>";
}
print "<TR>\n";
print " <TD VALIGN=\"top\" COLSPAN=6>Add a new product</TD>\n";
# print " <TD VALIGN=\"top\" COLSPAN=7>Add a new product</TD>\n";
print " <TD VALIGN=\"top\" COLSPAN=7>Add a new product</TD>\n";
print " <TD VALIGN=\"top\" ALIGN=\"middle\"><FONT SIZE =-1><A HREF=\"editproducts.cgi?action=add\">Add</A></FONT></TD>\n";
print "</TR></TABLE>\n";
@@ -317,7 +307,7 @@ if ($action eq 'add') {
print "<FORM METHOD=POST ACTION=editproducts.cgi>\n";
print "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0><TR>\n";
EmitFormElements('', '', '', '', 0, 0, 10000, 0, "---");
EmitFormElements('', '', '', 0, 0, 10000, 0, "---");
print "</TR><TR>\n";
print " <TH ALIGN=\"right\">Version:</TH>\n";
@@ -369,7 +359,6 @@ if ($action eq 'new') {
my $description = trim($::FORM{description} || '');
my $milestoneurl = trim($::FORM{milestoneurl} || '');
my $userregexp = trim($::FORM{userregexp} || '');
my $disallownew = 0;
$disallownew = 1 if $::FORM{disallownew};
my $votesperuser = $::FORM{votesperuser};
@@ -379,7 +368,6 @@ if ($action eq 'new') {
my $votestoconfirm = $::FORM{votestoconfirm};
$votestoconfirm ||= 0;
my $defaultmilestone = $::FORM{defaultmilestone} || "---";
my $productgroup = $::FORM{'productgroup'} || "";
# Add the new product.
SendSQL("INSERT INTO products ( " .
@@ -393,7 +381,8 @@ if ($action eq 'new') {
"$votesperuser, $maxvotesperbug, $votestoconfirm, " .
SqlQuote($defaultmilestone) . ")");
my $productid = CurrId('products_product_id_seq');
SendSQL("SELECT LAST_INSERT_ID()");
my $productid = FetchOneColumn();
SendSQL("INSERT INTO versions ( " .
"value, program" .
@@ -401,66 +390,11 @@ if ($action eq 'new') {
SqlQuote($version) . "," .
SqlQuote($product) . ")" );
SendSQL("INSERT INTO milestones (product, value, sortkey) VALUES (" .
SqlQuote($product) . ", " . SqlQuote($defaultmilestone) . ", 0)");
if ($productgroup) {
# Check for a group already by this name
SendSQL("SELECT name FROM groups WHERE name = " . SqlQuote($product));
my $name = FetchOneColumn();
if ($name) {
DisplayError("There is already a group by that name.")
&& exit;
} else {
# Next we insert into the groups table
SendSQL("INSERT INTO groups " .
"(name, description, isbuggroup, userregexp) " .
"VALUES (" .
SqlQuote($product) . ", " .
SqlQuote($product . " Bugs Access") . ", " .
"1, " .
SqlQuote($userregexp) . ")");
}
SendSQL("SELECT group_id FROM groups WHERE name = " . SqlQuote($product));
my $groupid = FetchOneColumn();
# And last, we need to add any existing users that match the regexp
# to the group.
# There may be a better way to do this in MySql, but I need to compare
# the login_names to this regexp, and the only way I can think of to
# do that is to get the list of login_names, and then update them
# one by one if they match. Furthermore, I need to do it with two
# separate loops, since opening a new SQL statement to do the update
# seems to clobber the previous one.
# Modified, 7/17/00, Joe Robins
# If the userregexp is left empty, then no users should be added to
# the bug group. As is, it was adding all users, since they all
# matched the empty pattern.
# In addition, I've replaced the rigamarole I was going through to
# find matching users with a much simpler statement that lets the
# mySQL database do the work.
unless($userregexp eq "") {
SendSQL("SELECT DISTINCT userid FROM profiles " .
"WHERE admin = 1 OR " . SqlRegEx('login_name', "$userregexp"));
my @winners = ();
while (my ($userid) = FetchSQLData()) {
push (@winners, $userid);
}
foreach my $userid (@winners) {
SendSQL("SELECT user_id FROM user_group_map " .
"WHERE user_id = $userid AND group_id = $groupid");
my $result = FetchOneColumn();
if (!$result) {
SendSQL("INSERT INTO user_group_map VALUES ($userid, $groupid, 0)");
}
}
}
}
SendSQL("INSERT INTO milestones (product, value) VALUES (" .
SqlQuote($product) . ", " . SqlQuote($defaultmilestone) . ")");
# Update group permissions for this product
my %newgroups = ();
foreach (keys %::FORM) {
next unless /^group_/;
@@ -651,20 +585,18 @@ if ($action eq 'delete') {
CheckProduct($product);
# lock the tables before we start to change everything:
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES attachments WRITE,
bugs WRITE,
bugs_activity WRITE,
components WRITE,
dependencies WRITE,
versions WRITE,
products WRITE,
groups WRITE,
profiles WRITE,
milestones WRITE,
user_group_map WRITE,
product_group_map WRITE");
}
SendSQL("LOCK TABLES attachments WRITE,
bugs WRITE,
bugs_activity WRITE,
components WRITE,
dependencies WRITE,
versions WRITE,
products WRITE,
groups WRITE,
profiles WRITE,
milestones WRITE,
product_group_map WRITE");
SendSQL("SELECT product_id FROM products WHERE product = " . SqlQuote($product));
my $productid = FetchOneColumn();
@@ -709,24 +641,15 @@ if ($action eq 'delete') {
WHERE product=" . SqlQuote($product));
print "Milestones deleted.<BR>\n";
# Deleting any users from product group and delete group
SendSQL("SELECT group_id FROM groups WHERE name = " . SqlQuote($product));
my $groupid = FetchOneColumn();
if ($groupid) {
SendSQL("DELETE FROM user_group_map WHERE group_id = $groupid");
SendSQL("DELETE FROM groups WHERE group_id = $groupid");
print "Users removed from product group and group removed.<br>\n";
}
# Deleting any product groups
SendSQL("DELETE FROM product_group_map WHERE product_id = $productid");
print "Other product groups deleted.<BR>\n";
print "Product groups deleted.<BR>\n";
SendSQL("DELETE FROM products
WHERE product=" . SqlQuote($product));
print "Product '$product' deleted.<BR>\n";
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
SendSQL("UNLOCK TABLES");
unlink "data/versioncache";
PutTrailer($localtrailer);
@@ -755,15 +678,17 @@ if ($action eq 'edit') {
FetchSQLData();
my $userregexp = '';
SendSQL("SELECT userregexp
FROM groups
WHERE name=" . SqlQuote($product));
$userregexp = FetchOneColumn() || "";
if(Param("usebuggroups")) {
SendSQL("SELECT userregexp
FROM groups
WHERE name=" . SqlQuote($product));
$userregexp = FetchOneColumn() || "";
}
print "<FORM METHOD=POST ACTION=editproducts.cgi>\n";
print "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0><TR>\n";
EmitFormElements($product, $description, $milestoneurl, $userregexp,
EmitFormElements($product, $description, $milestoneurl,
$disallownew, $votesperuser, $maxvotesperbug,
$votestoconfirm, $defaultmilestone);
@@ -849,8 +774,6 @@ if ($action eq 'edit') {
value_quote($description) . "\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"milestoneurlold\" VALUE=\"" .
value_quote($milestoneurl) . "\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"userregexpold\" VALUE=\"" .
value_quote($userregexp) . "\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"disallownewold\" VALUE=\"$disallownew\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"votesperuserold\" VALUE=\"$votesperuser\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"maxvotesperbugold\" VALUE=\"$maxvotesperbug\">\n";
@@ -887,16 +810,13 @@ if ($action eq 'update') {
my $milestoneurlold = trim($::FORM{milestoneurlold} || '');
my $votesperuser = trim($::FORM{votesperuser} || 0);
my $votesperuserold = trim($::FORM{votesperuserold} || 0);
my $userregexp = trim($::FORM{userregexp} || '');
my $userregexpold = trim($::FORM{userregexpold} || '');
my $maxvotesperbug = trim($::FORM{maxvotesperbug} || 0);
my $maxvotesperbugold = trim($::FORM{maxvotesperbugold} || 0);
my $votestoconfirm = trim($::FORM{votestoconfirm} || 0);
my $votestoconfirmold = trim($::FORM{votestoconfirmold} || 0);
my $defaultmilestone = trim($::FORM{defaultmilestone} || '---');
my $defaultmilestoneold = trim($::FORM{defaultmilestoneold} || '---');
my $productgroup = trim($::FORM{productgroup} || 0);
my $productgroupold = trim($::FORM{productgroupold} || 0);
my $checkvotes = 0;
CheckProduct($productold);
@@ -909,17 +829,16 @@ if ($action eq 'update') {
# Note that the order of this tests is important. If you change
# them, be sure to test for WHERE='$product' or WHERE='$productold'
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES bugs WRITE,
components WRITE,
products WRITE,
versions WRITE,
groups WRITE,
profiles WRITE,
milestones WRITE,
user_group_map WRITE,
product_group_map WRITE");
}
SendSQL("LOCK TABLES bugs WRITE,
components WRITE,
products WRITE,
versions WRITE,
groups WRITE,
profiles WRITE,
milestones WRITE,
user_group_map WRITE,
product_group_map WRITE");
if ($disallownew ne $disallownewold) {
$disallownew ||= 0;
@@ -932,9 +851,7 @@ if ($action eq 'update') {
if ($description ne $descriptionold) {
unless ($description) {
print "Sorry, I can't delete the description.";
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer);
exit;
}
@@ -951,89 +868,6 @@ if ($action eq 'update') {
print "Updated mile stone URL.<BR>\n";
}
if ($userregexp ne $userregexpold && $productgroup) {
# This will take a little bit of work here, since there may not be
# an existing bug group for this product, and we will also have to
# update users groupsets.
# First we find out if there's an existing group for this product, and
# get its bit if there is.
SendSQL("SELECT group_id FROM groups WHERE name = " . SqlQuote($productold));
my $groupid = FetchOneColumn();
if($groupid) {
# Group exists, so we do an update statement.
SendSQL("UPDATE groups " .
"SET userregexp = " . SqlQuote($userregexp) . " " .
"WHERE name = " . SqlQuote($productold));
print "Updated user regexp for bug group.<BR>\n";
} else {
# Next we insert into the groups table
SendSQL("INSERT INTO groups " .
"(name, description, isbuggroup, userregexp) " .
"VALUES (" .
SqlQuote($product) . ", " .
SqlQuote($product . " Bugs Access") . ", " .
"1, " .
SqlQuote($userregexp) . ")");
print "Created bug group.<br>\n";
}
SendSQL("SELECT group_id FROM groups WHERE name = " . SqlQuote($productold));
$groupid = FetchOneColumn();
# And last, we need to add any existing users that match the regexp
# to the group. This does not remove pre-existing users that used to match.
unless($userregexp eq "") {
SendSQL("SELECT DISTINCT userid FROM profiles " .
"WHERE admin = 1 OR " . SqlRegEx('login_name', $userregexp));
my @winners = ();
while (my ($userid) = FetchSQLData()) {
push (@winners, $userid);
}
foreach my $userid (@winners) {
SendSQL("SELECT user_id FROM user_group_map " .
"WHERE user_id = $userid AND group_id = $groupid");
my $result = FetchOneColumn();
if (!$result) {
SendSQL("INSERT INTO user_group_map VALUES ($userid, $groupid, 0)");
}
}
print "Added users matching regexp to group.<BR>\n";
}
}
# Update group permissions for this product
my %newgroups = ();
foreach (keys %::FORM) {
next unless /^group_/;
detaint_natural($::FORM{$_});
$newgroups{$::FORM{$_}} = 1;
}
my %groupsbelong = ();
SendSQL("select groups.group_id from groups, user_group_map " .
"where groups.group_id = user_group_map.group_id " .
"and groups.isbuggroup = 1 " .
"and user_group_map.user_id = $userid");
while (my ($groupid) = FetchSQLData()) {
$groupsbelong{$groupid} = 1;
}
foreach my $groupid (keys %groupsbelong) {
if ($newgroups{$groupid}) {
SendSQL("SELECT group_id FROM product_group_map " .
"WHERE product_id = $productid AND group_id = $groupid");
if (!FetchOneColumn()) {
SendSQL("INSERT INTO product_group_map (product_id, group_id) VALUES ($productid, $groupid)");
}
} else {
SendSQL("DELETE FROM product_group_map " .
"WHERE product_id = $productid AND group_id = $groupid");
}
}
print "Groups updated.<br>\n";
if ($votesperuser ne $votesperuserold) {
SendSQL("UPDATE products
SET votesperuser=$votesperuser
@@ -1067,9 +901,7 @@ if ($action eq 'update') {
" AND product = " . SqlQuote($productold));
if (!FetchOneColumn()) {
print "Sorry, the milestone $defaultmilestone must be defined first.";
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer);
exit;
}
@@ -1085,17 +917,13 @@ if ($action eq 'update') {
if ($product ne $productold) {
unless ($product) {
print "Sorry, I can't delete the product name.";
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer);
exit;
}
if (TestProduct($product)) {
print "Sorry, product name '$product' is already in use.";
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer);
exit;
}
@@ -1109,11 +937,44 @@ if ($action eq 'update') {
print "Updated product name.<BR>\n";
}
unlink "data/versioncache";
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
# Update group permissions for this product
my %newgroups = ();
foreach (keys %::FORM) {
next unless /^group_/;
detaint_natural($::FORM{$_});
$newgroups{$::FORM{$_}} = 1;
}
my %groupsbelong = ();
SendSQL("select groups.group_id from groups, user_group_map " .
"where groups.group_id = user_group_map.group_id " .
"and groups.isbuggroup = 1 " .
"and user_group_map.user_id = $userid");
while (my ($groupid) = FetchSQLData()) {
$groupsbelong{$groupid} = 1;
}
my %oldgroups = ();
SendSQL("select groups.group_id from groups, product_group_map " .
"where groups.group_id = product_group_map.group_id " .
"and product_group_map.product_id = $productid");
while (my ($groupid) = FetchSQLData()) {
$oldgroups{$groupid} = 1;
}
foreach my $groupid (keys %groupsbelong) {
if (!$oldgroups{$groupid} && $newgroups{$groupid}) {
SendSQL("INSERT INTO product_group_map (product_id, group_id) VALUES ($productid, $groupid)");
}
if ($oldgroups{$groupid} && !$newgroups{$groupid}) {
SendSQL("DELETE FROM product_group_map WHERE product_id = $productid AND group_id = $groupid");
}
}
print "Updated product permissions<br>\n";
unlink "data/versioncache";
SendSQL("UNLOCK TABLES");
if ($checkvotes) {
print "Checking existing votes in this product for anybody who now has too many votes.";
if ($maxvotesperbug < $votesperuser) {

View File

@@ -1,534 +0,0 @@
#!/usr/bonsaitools/bin/perl -w
# -*- 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 mozilla.org code
#
# This code was based on editversions.cgi code by Holger Schurig
# <holgerschurig@nikocity.de>
#
# The Initial Developer of the Original code is Alex
# Schuilenburg. Portions created by Alex Schuilenburg are
# Copyright (C) 2002 Alex Schuilenburg. All
# Rights Reserved.
#
# Contributor(s): Alex Schuilenburg <alex@schuilenburg.org>
#
#
# Direct any questions on this source code to
#
# Alex Schuilenburg <alex@schuilenburg.org>
use diagnostics;
use strict;
use lib ".";
require "CGI.pl";
require "globals.pl";
# This could be moved to localparams or globals.pl
my %TableMap = (
'bug_status' => 'States in which a bug can be in during its lifecycle',
'bug_severity' => 'Impact the bug has on the application',
'priority' => 'Subjective priority placed on a bug',
'op_sys' => 'Host operating systems',
'rep_platform' => 'Target platforms',
'resolution' => 'State in which the bug was resolved'
);
# CheckTable: same check, optionally emit an error text
# TestValue: just returns if the specified table/value combination exists
# CheckValue: same check, optionally emit an error text
sub CheckTable ($)
{
my $table = shift;
my $ret;
# do we have a table?
unless ($table) {
print "Sorry, you haven't specified a table.";
PutTrailer();
exit;
}
$ret = $TableMap{$table};
unless ($ret) {
print "Sorry, table '$table' does not exist or is not editable.";
PutTrailer();
exit;
}
return $ret;
}
sub TestValue ($$)
{
my ($table,$value) = @_;
# does the value exist?
SendSQL("SELECT value
FROM $table
WHERE value=" . SqlQuote($value));
return FetchOneColumn();
}
sub CheckValue ($$)
{
my ($table,$value) = @_;
# do we have the value?
unless ($value) {
print "Sorry, you haven't specified a value.";
PutTrailer();
exit;
}
my $desc = CheckTable($table);
unless (TestValue($table,$value)) {
print "Sorry, value '$value' for table '$table' does not exist.";
PutTrailer();
exit;
}
}
#
# Displays the form to edit a value
#
sub EmitFormElements ($$)
{
my ($table, $value) = @_;
print " <TH ALIGN=\"right\">Value:</TH>\n";
print " <TD><INPUT SIZE=64 MAXLENGTH=64 NAME=\"value\" VALUE=\"" .
value_quote($value) . "\">\n";
print " <INPUT TYPE=HIDDEN NAME=\"table\" VALUE=\"" .
value_quote($table) . "\"></TD>\n";
}
#
# Displays a text like "a.", "a or b.", "a, b or c.", "a, b, c or d."
#
sub PutTrailer (@)
{
my (@links) = ("Back to the <A HREF=\"query.cgi\">query page</A>", @_);
my $count = $#links;
my $num = 0;
print "<P>\n";
foreach (@links) {
print $_;
if ($num == $count) {
print ".\n";
}
elsif ($num == $count-1) {
print " or ";
}
else {
print ", ";
}
$num++;
}
PutFooter();
}
#
# Preliminary checks:
#
confirm_login();
print "Content-type: text/html\n\n";
unless (UserInGroup("editcomponents")) {
PutHeader("Not allowed");
print "Sorry, you aren't a member of the 'editcomponents' group.\n";
print "And so, you aren't allowed to add, modify or delete table values.\n";
PutTrailer();
exit;
}
#
# often used variables
#
my $table = trim($::FORM{table} || '');
my $value = trim($::FORM{value} || '');
my $action = trim($::FORM{action} || '');
my $localtrailer;
if ($value) {
$localtrailer = "<A HREF=\"edittable.cgi?table=" . url_quote($table) . "\">edit</A> more values";
} else {
$localtrailer = "<A HREF=\"edittable.cgi\">edit</A> more values";
}
#
# table = '' -> Show nice list of values
#
unless ($table) {
PutHeader("Select table");
print "<TABLE BORDER=1 CELLPADDING=4 CELLSPACING=0><TR BGCOLOR=\"#6666FF\">\n";
print " <TH ALIGN=\"left\">Edit values of ...</TH>\n";
print " <TH ALIGN=\"left\">Description</TH>\n";
print "</TR>";
foreach $table ( keys %TableMap ) {
my $description = $TableMap{$table};
$description ||= "<FONT COLOR=\"red\">missing</FONT>";
print "<TR>\n";
print " <TD VALIGN=\"top\"><A HREF=\"edittable.cgi?table=", url_quote($table), "\"><B>$table</B></A></TD>\n";
print " <TD VALIGN=\"top\">$description</TD>\n";
#print " <TD VALIGN=\"top\"><A HREF=\"edittable.cgi?action=edit&table=", url_quote($table), "\">Edit</A></TD>\n";
}
print "</TR></TABLE>\n";
PutTrailer();
exit;
}
#
# action='' -> Show nice list of values
#
unless ($action) {
PutHeader("Select value of $table ($TableMap{$table})");
CheckTable($table);
SendSQL("SELECT value
FROM $table
ORDER BY value");
print "<TABLE BORDER=1 CELLPADDING=4 CELLSPACING=0><TR BGCOLOR=\"#6666FF\">\n";
print " <TH ALIGN=\"left\">Edit value ...</TH>\n";
print " <TH ALIGN=\"left\">Action</TH>\n";
print "</TR>";
while ( MoreSQLData() ) {
my ($value) = FetchSQLData();
print "<TR>\n";
print " <TD VALIGN=\"top\"><A HREF=\"edittable.cgi?table=", url_quote($table), "&value=", url_quote($value), "&action=edit\"><B>$value</B></A></TD>\n";
print " <TD VALIGN=\"top\"><A HREF=\"edittable.cgi?table=", url_quote($table), "&value=", url_quote($value), "&action=del\"><B>Delete</B></A></TD>\n";
print "</TR>";
}
print "<TR>\n";
print " <TD VALIGN=\"top\">Add a new value</TD>\n";
print " <TD VALIGN=\"top\" ALIGN=\"middle\"><A HREF=\"edittable.cgi?table=", url_quote($table) . "&action=add\">Add</A></TD>\n";
print "</TR></TABLE>\n";
PutTrailer();
exit;
}
#
# action='add' -> present form for parameters for new value
#
# (next action will be 'new')
#
if ($action eq 'add') {
PutHeader("Add value to $table ($TableMap{$table})");
CheckTable($table);
#print "This page lets you add a new value to a table in bugzilla.\n";
print "<FORM METHOD=POST ACTION=edittable.cgi>\n";
print "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0><TR>\n";
EmitFormElements($table, $value);
print "</TABLE>\n<HR>\n";
print "<INPUT TYPE=SUBMIT VALUE=\"Add\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"action\" VALUE=\"new\">\n";
print "</FORM>";
my $other = $localtrailer;
$other =~ s/more/other/;
PutTrailer($other);
exit;
}
#
# action='new' -> add value entered in the 'action=add' screen
#
if ($action eq 'new') {
PutHeader("Adding new value to $table ($TableMap{$table})");
CheckTable($table);
# Cleanups and valididy checks
unless ($value) {
print "You must enter text for the new value. Please press\n";
print "<b>Back</b> and try again.\n";
PutTrailer($localtrailer);
exit;
}
if (TestValue($table,$value)) {
print "The value '$value' already exists. Please press\n";
print "<b>Back</b> and try again.\n";
PutTrailer($localtrailer);
exit;
}
# Add the new value
SendSQL("INSERT INTO $table ( " .
"value" .
" ) VALUES ( " .
SqlQuote($value) . ")");
# Make versioncache flush
unlink "data/versioncache";
print "OK, done.<p>\n";
PutTrailer($localtrailer);
exit;
}
#
# action='del' -> ask if user really wants to delete
#
# (next action would be 'delete')
#
if ($action eq 'del') {
PutHeader("Delete $value from $table ($TableMap{$table})");
CheckValue($table, $value);
SendSQL("SELECT count(bug_id),$table
FROM bugs
GROUP BY $table
HAVING $table
=" . SqlQuote($value));
my $bugs = FetchOneColumn();
print "<TABLE BORDER=1 CELLPADDING=4 CELLSPACING=0>\n";
print "<TR BGCOLOR=\"#6666FF\">\n";
print " <TH VALIGN=\"top\" ALIGN=\"left\">Part</TH>\n";
print " <TH VALIGN=\"top\" ALIGN=\"left\">Value</TH>\n";
print "</TR><TR>\n";
print " <TH ALIGN=\"left\" VALIGN=\"top\">Table:</TH>\n";
print " <TD VALIGN=\"top\">" . url_quote($table) . "</TD>\n";
print "</TR><TR>\n";
print " <TH ALIGN=\"left\" VALIGN=\"top\">Value:</TH>\n";
print " <TD VALIGN=\"top\">" . url_quote($value) . "</TD>\n";
print "</TR><TR>\n";
print " <TH ALIGN=\"left\" VALIGN=\"top\">Bugs:</TH>\n";
print " <TD VALIGN=\"top\">", $bugs || 'none' , "</TD>\n";
print "</TR></TABLE>\n";
print "<H2>Confirmation</H2>\n";
if ($bugs) {
if (!Param("allowbugdeletion")) {
print "Sorry, there are $bugs bugs outstanding with this value.
You must reassign those bugs to another value before you can delete this
one.";
PutTrailer($localtrailer);
exit;
}
print "<TABLE BORDER=0 CELLPADDING=20 WIDTH=\"70%\" BGCOLOR=\"red\"><TR><TD>\n",
"There are bugs entered for this value! When you delete this ",
"value, <B><BLINK>all</BLINK></B> stored bugs will be deleted, too. ",
"You could not even see the bug history for this value anymore!\n",
"</TD></TR></TABLE>\n";
}
print "<P>Do you really want to delete this value?<P>\n";
print "<FORM METHOD=POST ACTION=edittable.cgi>\n";
print "<INPUT TYPE=SUBMIT VALUE=\"Yes, delete\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"action\" VALUE=\"delete\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"table\" VALUE=\"" .
value_quote($table) . "\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"value\" VALUE=\"" .
value_quote($value) . "\">\n";
print "</FORM>";
PutTrailer($localtrailer);
exit;
}
#
# action='delete' -> really delete the value
#
if ($action eq 'delete') {
PutHeader("Deleting $value from $table ($TableMap{$table})");
CheckValue($table,$value);
# lock the tables before we start to change everything:
SendSQL("LOCK TABLES attachments WRITE,
bugs WRITE,
bugs_activity WRITE,
$table WRITE,
dependencies WRITE") if $::driver eq 'mysql';
# According to MySQL doc I cannot do a DELETE x.* FROM x JOIN Y,
# so I have to iterate over bugs and delete all the indivial entries
# in bugs_activies and attachments.
if (Param("allowbugdeletion")) {
SendSQL("SELECT bug_id
FROM bugs
WHERE $table=" . SqlQuote($value));
while (MoreSQLData()) {
my $bugid = FetchOneColumn();
PushGlobalSQLState();
SendSQL("DELETE FROM attachments WHERE bug_id=$bugid");
SendSQL("DELETE FROM bugs_activity WHERE bug_id=$bugid");
SendSQL("DELETE FROM dependencies WHERE blocked=$bugid");
PopGlobalSQLState();
}
print "Attachments, bug activity and dependencies deleted.<BR>\n";
# Deleting the rest is easier:
SendSQL("DELETE FROM bugs
WHERE $table=" . SqlQuote($value));
print "Bugs deleted.<BR>\n";
}
SendSQL("DELETE FROM $table
WHERE value=" . SqlQuote($value));
print "Value deleted.<P>\n";
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
unlink "data/versioncache";
PutTrailer($localtrailer);
exit;
}
#
# action='edit' -> present the edit value form
#
# (next action would be 'update')
#
if ($action eq 'edit') {
PutHeader("Edit value of $table ($TableMap{$table})");
CheckValue($table,$value);
print "<FORM METHOD=POST ACTION=edittable.cgi>\n";
print "<TABLE BORDER=0 CELLPADDING=4 CELLSPACING=0><TR>\n";
EmitFormElements($table, $value);
print "</TR></TABLE>\n";
print "<INPUT TYPE=HIDDEN NAME=\"valueold\" VALUE=\"" .
value_quote($value) . "\">\n";
print "<INPUT TYPE=HIDDEN NAME=\"action\" VALUE=\"update\">\n";
print "<INPUT TYPE=SUBMIT VALUE=\"Update\">\n";
print "</FORM>";
my $other = $localtrailer;
$other =~ s/more/other/;
PutTrailer($other);
exit;
}
#
# action='update' -> update the value
#
if ($action eq 'update') {
PutHeader("Update value of $table ($TableMap{$table})");
my $valueold = trim($::FORM{valueold} || '');
CheckValue($table,$valueold);
# Note that the order of this tests is important. If you change
# them, be sure to test for WHERE='$value' or WHERE='$valueold'
SendSQL("LOCK TABLES bugs WRITE, $table WRITE") if $::driver eq 'mysql';
if ($value ne $valueold) {
unless ($value) {
print "Sorry, I can't delete the value text.";
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
PutTrailer($localtrailer);
exit;
}
if (TestValue($table,$value)) {
print "Sorry, value '$value' is already in use.";
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
PutTrailer($localtrailer);
exit;
}
SendSQL("UPDATE bugs
SET $table=" . SqlQuote($value) . ",
delta_ts = delta_ts
WHERE $table=" . SqlQuote($valueold));
SendSQL("UPDATE $table
SET value=" . SqlQuote($value) . "
WHERE value=" . SqlQuote($valueold));
unlink "data/versioncache";
print "Updated value.<BR>\n";
}
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
PutTrailer($localtrailer);
exit;
}
#
# No valid action found
#
PutHeader("Error");
print "I don't have a clue what you want.<BR>\n";
foreach ( sort keys %::FORM) {
print "$_: $::FORM{$_}<BR>\n";
}


View File

@@ -47,7 +47,7 @@ sub TestUser ($)
{
my $user = shift;
# does the user exist?
# does the product exist?
SendSQL("SELECT login_name
FROM profiles
WHERE login_name=" . SqlQuote($user));
@@ -58,7 +58,7 @@ sub CheckUser ($)
{
my $user = shift;
# do we have a user?
# do we have a product?
unless ($user) {
print "Sorry, you haven't specified a user.";
PutTrailer();
@@ -125,7 +125,7 @@ sub EmitFormElements ($$$$$$)
}
if ($user ne "") {
if($user ne "") {
# Select admin access if user has 'edituser' privileges
if ($editall) {
my $adminchecked = $adminuser ? "CHECKED" : "";
@@ -143,8 +143,7 @@ sub EmitFormElements ($$$$$$)
print "<TD COLSPAN=3 ALIGN=LEFT><B>Can turn this on for other users</B></TD>\n";
print "</TR><TR>\n";
print "<TD ALIGN=CENTER><B>|</B></TD>\n";
}
else {
} else {
print "<TD COLSPAN=3></TD>\n</TR><TR>\n<TD></TD>\n";
}
print "<TD COLSPAN=2 ALIGN=LEFT><B>User is a member of these groups</B></TD>\n";
@@ -204,9 +203,20 @@ sub EmitFormElements ($$$$$$)
if ($editall || $blessgroupset{$groupid}) {
$group_checked = $groups_belong->{$groupid} ? "CHECKED" : "";
print "<TD ALIGN=CENTER><INPUT TYPE=CHECKBOX NAME=\"group_$name\" $group_checked VALUE=\"$groupid\"></TD>";
print "<TD><B>" . ucfirst($name) . "</B>: $description</TD>\n";
$canedit = 1;
}
print "<TD COLSPAN=2 ALIGN=LEFT><B>User has these privileges</B></TD>\n";
while (MoreSQLData()) {
my ($bit,$name,$description,$checked,$blchecked) = FetchSQLData();
print "</TR><TR>\n";
if ($editall) {
$blchecked = ($blchecked) ? "CHECKED" : "";
print "<TD ALIGN=CENTER><INPUT TYPE=CHECKBOX NAME=\"blbit_$name\" $blchecked VALUE=\"$bit\"></TD>";
}
$checked = ($checked) ? "CHECKED" : "";
print "<TD ALIGN=CENTER><INPUT TYPE=CHECKBOX NAME=\"bit_$name\" $checked VALUE=\"$bit\"></TD>";
print "<TD><B>" . ucfirst($name) . "</B>: $description</TD>\n";
}
}
} else {
print "</TR><TR><TH ALIGN=RIGHT>Groups and<br>Privileges:</TH><TD><TABLE><TR>";
@@ -323,18 +333,24 @@ if ($action eq 'list') {
my $query = "";
my $matchstr = $::FORM{'matchstr'};
if (exists $::FORM{'matchtype'}) {
$query = "SELECT login_name,realname,disabledtext " .
"FROM profiles WHERE ";
if ($::FORM{'matchtype'} eq 'substr') {
$query .= "login_name like '%" . $::FORM{'matchstr'} . "%'";
} elsif ($::FORM{'matchtype'} eq 'regexp') {
$query .= SqlRegEx("login_name", SqlQuote($::FORM{'matchstr'}));
} elsif ($::FORM{'matchtype'} eq 'notregexp') {
$query .= SqlRegEx("login_name", SqlQuote($::FORM{'matchstr'}), "not");
} else {
die "Unknown match type";
}
$query .= " ORDER BY login_name";
$query = "SELECT login_name,realname,disabledtext " .
"FROM profiles " .
"WHERE login_name ";
if ($::FORM{'matchtype'} eq 'substr') {
$query .= "like";
$matchstr = '%' . $matchstr . '%';
} elsif ($::FORM{'matchtype'} eq 'regexp') {
$query .= "regexp";
$matchstr = '.'
unless $matchstr;
} elsif ($::FORM{'matchtype'} eq 'notregexp') {
$query .= "not regexp";
$matchstr = '.'
unless $matchstr;
} else {
die "Unknown match type";
}
$query .= SqlQuote($matchstr) . " ORDER BY login_name";
} elsif (exists $::FORM{'query'}) {
$query = "SELECT login_name,realname,disabledtext " .
"FROM profiles WHERE " . $::FORM{'query'} . " ORDER BY login_name";

View File

@@ -74,7 +74,7 @@ sub TestVersion ($$)
{
my ($prod,$ver) = @_;
# does the version exist?
# does the product exist?
SendSQL("SELECT program,value
FROM versions
WHERE program=" . SqlQuote($prod) . " and value=" . SqlQuote($ver));
@@ -417,13 +417,12 @@ if ($action eq 'delete') {
CheckVersion($product,$version);
# lock the tables before we start to change everything:
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES attachments WRITE,
bugs WRITE,
bugs_activity WRITE,
versions WRITE,
dependencies WRITE");
}
SendSQL("LOCK TABLES attachments WRITE,
bugs WRITE,
bugs_activity WRITE,
versions WRITE,
dependencies WRITE");
# According to MySQL doc I cannot do a DELETE x.* FROM x JOIN Y,
# so I have to iterate over bugs and delete all the indivial entries
@@ -459,9 +458,7 @@ if ($action eq 'delete') {
WHERE program=" . SqlQuote($product) . "
AND value=" . SqlQuote($version));
print "Version deleted.<P>\n";
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
unlink "data/versioncache";
PutTrailer($localtrailer);
@@ -515,26 +512,21 @@ if ($action eq 'update') {
# Note that the order of this tests is important. If you change
# them, be sure to test for WHERE='$version' or WHERE='$versionold'
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES bugs WRITE,
versions WRITE");
}
SendSQL("LOCK TABLES bugs WRITE,
versions WRITE");
if ($version ne $versionold) {
unless ($version) {
print "Sorry, I can't delete the version text.";
PutTrailer($localtrailer);
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
exit;
}
if (TestVersion($product,$version)) {
print "Sorry, version '$version' is already in use.";
PutTrailer($localtrailer);
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
exit;
}
SendSQL("UPDATE bugs
@@ -549,9 +541,7 @@ if ($action eq 'update') {
unlink "data/versioncache";
print "Updated version.<BR>\n";
}
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
PutTrailer($localtrailer);
exit;

View File

@@ -66,7 +66,7 @@ my $userid = confirm_login();
if (!defined $::FORM{'product'}) {
GetVersionTable();
$userid = quietly_check_login();
quietly_check_login();
my %products;
@@ -77,7 +77,7 @@ if (!defined $::FORM{'product'}) {
next if !CanSeeProduct($userid, $p);
$products{$p} = $proddesc{$p};
}
my $prodsize = scalar(keys %products);
if ($prodsize == 0) {
DisplayError("Either no products have been defined to enter bugs ".
@@ -217,15 +217,19 @@ sub pickos {
# default
return "other";
}
##############################################################################
# End of subroutines
##############################################################################
$userid = confirm_login();
if (!CanSeeProduct($userid, $product)) {
DisplayError("Sorry; you do not have the permissions necessary to " .
"enter a bug against this product.\n");
print "Content-type: text/html\n\n";
PutHeader("Permission denied.", "Enter Bug", "This page lets you enter a new bug into Bugzilla.");
print "<H1>Permission denied.</H1>\n";
print "Sorry; you do not have the permissions necessary to enter\n";
print "a bug against this product.\n";
print "<P>\n";
PutFooter();
exit;
}
@@ -309,62 +313,49 @@ if (UserInGroup($userid, "editbugs") || UserInGroup($userid, "canconfirm")) {
$vars->{'bug_status'} = \@status;
$default{'bug_status'} = $status[0];
if ($userid) {
my %productgroups;
SendSQL("SELECT product_group_map.group_id " .
"FROM product_group_map, products " .
"WHERE product_group_map.product_id = products.product_id " .
"AND products.product = " . SqlQuote($product));
while (my ($groupid) = FetchSQLData()) {
$productgroups{$groupid} = 1;
}
SendSQL("SELECT user_group_map.group_id, groups.name, groups.description " .
"FROM user_group_map, groups " .
"WHERE user_group_map.group_id = groups.group_id " .
"AND user_group_map.user_id = $userid " .
"AND groups.isbuggroup != 0 AND groups.isactive = 1 " .
"ORDER BY description");
my %productgroups = ();
my @groups;
my @groups;
while (MoreSQLData()) {
my ($id, $name, $description) = FetchSQLData();
# Don't want to include product groups other than this product.
next unless($name eq $product ||
!defined($::proddesc{$name}));
my $check;
# If this is the group for this product, make it checked.
if(formvalue("maketemplate") eq
"Remember values as bookmarkable template")
{
# If this is a bookmarked template, then we only want to set the
# bit for those bits set in the template.
$check = formvalue("group-$id", 0);
}
else {
# $group_bit will only have a non-zero value if we're using
# bug groups and have one for this product.
# If $group_bit is 0, it won't match the current group, so compare
# it to the current bit instead of checking for non-zero.
$check = $productgroups{$id} ? 1 : 0;
}
my $group =
{
'bit' => $id ,
'checked' => $check ,
'description' => $description
};
push @groups, $group;
}
$vars->{'group'} = \@groups;
SendSQL("SELECT product_group_map.group_id FROM products, product_group_map " .
"WHERE products.product_id = product_group_map.product_id " .
"AND products.product = " . SqlQuote($product) .
" ORDER BY products.product_id");
while (MoreSQLData()) {
my ($prodid) = FetchSQLData();
$productgroups{$prodid} = 1;
}
SendSQL("SELECT groups.group_id, groups.description " .
"FROM groups, user_group_map " .
"WHERE groups.group_id = user_group_map.group_id " .
"AND user_group_map.user_id = $userid " .
"AND isbuggroup != 0 AND isactive = 1 ORDER BY description");
while (MoreSQLData()) {
my ($group_id, $description) = (FetchSQLData());
my $check;
# If this is the group for this product, make it checked.
if (formvalue("maketemplate") eq "Remember values as bookmarkable template") {
# If this is a bookmarked template, then we only want to set the
# bit for those bits set in the template.
$check = formvalue("group-$group_id", 0);
} elsif ($productgroups{$group_id}) {
$check = 1;
}
my $group =
{
'bit' => $group_id,
'checked' => $check ,
'description' => $description
};
push @groups, $group;
}
$vars->{'group'} = \@groups;
$vars->{'default'} = \%default;
my $format = ValidateOutputFormat($::FORM{'format'}, "create", "bug/create");

View File

@@ -68,11 +68,7 @@ $::db_host = "localhost";
$::db_port = 3306;
$::db_name = "bugs";
$::db_user = "bugs";
$::db_pass = "n0morehax";
# Set this your database driver
# $::driver = "mysql";
$::driver = "Pg";
$::db_pass = "";
do 'localconfig';
@@ -136,44 +132,16 @@ sub ConnectToDatabase {
$name = Param("shadowdb");
$::dbwritesallowed = 0;
}
my $connectstring = "DBI:$::driver:";
if ($::driver eq 'mysql') {
$connectstring .= "database=$name;port=$::db_port";
} elsif ($::driver eq 'Pg') {
$connectstring .= "dbname=$name";
}
$connectstring .= ";host=$::db_host";
$::db = DBI->connect($connectstring, $::db_user, $::db_pass)
$::db = DBI->connect("DBI:mysql:host=$::db_host;database=$name;port=$::db_port", $::db_user, $::db_pass)
|| die "Bugzilla is currently broken. Please try again later. " .
"If the problem persists, please contact " . Param("maintainer") .
". The error you should quote is: " . $DBI::errstr;
if ($::driver eq 'Pg' && Param('usetransactions')) {
$::db->{AutoCommit} = 1;
}
}
}
sub EndTransaction {
if ($::driver eq 'Pg' && Param('usetransactions')) {
if ($::db) {
$::db->commit || die "Error commiting current transaction: " . $DBI::errstr;
}
}
}
sub RollBack {
if ($::driver eq 'Pg' && Param('usetransactions')) {
if ($::db) {
$::db->rollback || die "Error rolling back current transaction: " . $DBI::errstr;
}
"If the problem persists, please contact " . Param("maintainer") .
". The error you should quote is: " . $DBI::errstr;
}
}
sub ReconnectToShadowDatabase {
if (Param("shadowdb") && Param("queryagainstshadowdb")) {
if ($::driver eq 'mysql') {
SendSQL("USE " . Param("shadowdb"));
}
SendSQL("USE " . Param("shadowdb"));
$::dbwritesallowed = 0;
}
}
@@ -351,74 +319,8 @@ sub FetchOneColumn {
return $row[0];
}
# subroutine: SqlRegEx
# description: Outputs SQL syntax for doing regular expressions searches in format
# suitable for a given database.
# Params: $field = name of db field regular expression applied against (scalar)
# $pattern = regular express search pattern (scalar)
# $not = return if not within search patter (scalar)
# Returns: formatted SQL for regular expression search (scalar)
sub SqlRegEx {
my ($field, $pattern, $not) = @_;
if ($::driver eq 'mysql') {
if (!$not) {
return " LOWER($field) REGEXP $pattern ";
} else {
return " LOWER($field) NOT REGEXP $pattern ";
}
} elsif ($::driver eq 'Pg') {
if (!$not) {
return " LOWER($field) ~ '$pattern' ";
} else {
return " LOWER($field) !~ '$pattern' ";
}
}
}
# subroutine: SqlStrSearch
# description: Outputs SQL syntax for doing string searches in format
# suitable for a given database.
# Params: $field = name of db field containing string search for (scalar)
# $str = string to search for (scalar)
# $lower = whether the search is case sensitive or not (scalar)
# $not = return SQL for when string is NOT in searched field (scalar)
# Returns: formatted SQL for regular expression search (scalar)
sub SqlStrSearch {
my ($field, $str, $lower, $not) = @_;
if ($::driver eq 'mysql') {
if (!$lower) {
if (!$not) {
return " INSTR($field, $str) != 0 ";
} else {
return " INSTR($field, $str) = 0 ";
}
} else {
if (!$not) {
return " INSTR(LOWER($field), " . lc($str) . ") != 0 ";
} else {
return " INSTR(LOWER($field), " . lc($str) . ") = 0 ";
}
}
} elsif ($::driver eq 'Pg') {
if (!$lower) {
if (!$not) {
return " STRPOS($field, $str) != 0 ";
} else {
return " STRPOS($field, $str) = 0 ";
}
} else {
if (!$not) {
return " STRPOS(LOWER($field), " . lc($str) . ") != 0 ";
} else {
return " STRPOS(LOWER($field), " . lc($str) . ") = 0 ";
}
}
}
}
@::default_column_list = ("severity", "priority", "platform", "owner",
"status", "resolution", "summary");
@@ -444,13 +346,9 @@ sub GetFieldID {
my $fieldid = FetchOneColumn();
if (!$fieldid) {
my $q = SqlQuote($f);
if ($::driver eq 'mysql') {
SendSQL("REPLACE INTO fielddefs (name, description) VALUES ($q, $q)");
} elsif ($::driver eq 'Pg') {
SendSQL("INSERT INTO fielddefs (name, description, sortkey) " .
"VALUES ($q, $q, 1)");
}
$fieldid = CurrId("fielddefs_fieldid_seq");
SendSQL("REPLACE INTO fielddefs (name, description) VALUES ($q, $q)");
SendSQL("SELECT LAST_INSERT_ID()");
$fieldid = FetchOneColumn();
}
return $fieldid;
}
@@ -594,21 +492,12 @@ sub GenerateVersionTable {
}
@::log_columns = (sort(@::log_columns));
if ($::driver eq 'mysql') {
@::legal_priority = SplitEnumType($cols->{"priority,type"});
@::legal_severity = SplitEnumType($cols->{"bug_severity,type"});
@::legal_platform = SplitEnumType($cols->{"rep_platform,type"});
@::legal_opsys = SplitEnumType($cols->{"op_sys,type"});
@::legal_bug_status = SplitEnumType($cols->{"bug_status,type"});
@::legal_resolution = SplitEnumType($cols->{"resolution,type"});
} elsif ($::driver eq 'Pg') {
@::legal_priority = SplitTableValues("priority");
@::legal_severity = SplitTableValues("bug_severity");
@::legal_platform = SplitTableValues("rep_platform");
@::legal_opsys = SplitTableValues("op_sys");
@::legal_bug_status = SplitTableValues("bug_status");
@::legal_resolution = SplitTableValues("resolution");
}
@::legal_priority = SplitEnumType($cols->{"priority,type"});
@::legal_severity = SplitEnumType($cols->{"bug_severity,type"});
@::legal_platform = SplitEnumType($cols->{"rep_platform,type"});
@::legal_opsys = SplitEnumType($cols->{"op_sys,type"});
@::legal_bug_status = SplitEnumType($cols->{"bug_status,type"});
@::legal_resolution = SplitEnumType($cols->{"resolution,type"});
# 'settable_resolution' is the list of resolutions that may be set
# directly by hand in the bug form. Start with the list of legal
@@ -922,31 +811,9 @@ sub CanSeeProduct {
my ($userid, $product) = (@_);
my @groups = ();
# If group name same as product and user in that group then return success
# Based on the old method of handling product privacy.
return 1 if UserInGroup($userid, $product);
ConnectToDatabase();
PushGlobalSQLState();
# Check first to see if this product is private
SendSQL("SELECT count(*) FROM product_group_map, products " .
"WHERE products.product_id = product_group_map.product_id " .
"AND products.product = " . SqlQuote($product));
my $count = FetchOneColumn();
# Product is not private to any groups so user can see it.
if (!$count) {
return 1;
}
# User does not have account or is not logged in and product is private so
# return 0 value.
if (!$userid && $count) {
return 0;
}
SendSQL("SELECT groups.group_id FROM groups " .
SendSQL("SELECT groups.group_id FROM groups " .
"LEFT JOIN user_group_map ON groups.group_id = user_group_map.group_id " .
"WHERE user_group_map.user_id = $userid");
while (MoreSQLData()) {
@@ -966,10 +833,11 @@ sub CanSeeProduct {
LEFT JOIN product_group_map ON products.product_id = product_group_map.product_id
WHERE
products.product = " . SqlQuote($product) . "
AND product_group_map.group_id IN (" . join(",", @groups) . ")");
AND (product_group_map.group_id IN (" . join(",", @groups) . ") OR product_group_map.group_id IS NULL)");
my $result = FetchOneColumn();
PopGlobalSQLState();
return 1 if $result;
return 0;
}
sub ValidatePassword {
@@ -1221,8 +1089,8 @@ sub GetBugLink {
PushGlobalSQLState();
SendSQL("SELECT bugs.bug_status, resolution, short_desc " .
"FROM bugs WHERE bugs.bug_id = $bug_num");
"FROM bugs WHERE bugs.bug_id = $bug_num");
# If the bug exists, save its data off for use later in the sub
if (MoreSQLData()) {
my ($bug_state, $bug_res, $bug_desc) = FetchSQLData();
@@ -1271,43 +1139,20 @@ sub GetLongDescriptionAsText {
my ($id, $start, $end) = (@_);
my $result = "";
my $count = 0;
my $query = "
SELECT
profiles.login_name, ";
if ($::driver eq 'mysql') {
$query .= "
longdescs.bug_when, ";
} elsif ($::driver eq 'Pg') {
$query .= "
TO_CHAR(longdescs.bug_when, 'YYYY-MM-DD HH24:MI:SS'), ";
}
$query .= "
longdescs.thetext
FROM
longdescs,
profiles
WHERE
profiles.userid = longdescs.who
AND longdescs.bug_id = $id ";
my ($query) = ("SELECT profiles.login_name, longdescs.bug_when, " .
" longdescs.thetext " .
"FROM longdescs, profiles " .
"WHERE profiles.userid = longdescs.who " .
"AND longdescs.bug_id = $id ");
if ($start && $start =~ /[1-9]/) {
# If the start is all zeros, then don't do this (because we want to
# not emit a leading "Additional Comments" line in that case.)
if ($::driver eq 'mysql') {
$query .= "AND longdescs.bug_when > '$start' ";
} elsif ($::driver eq 'Pg') {
$query .= "AND TO_CHAR(longdescs.bug_when, 'YYYYMMDDHH24MISS') > '$start' ";
}
$query .= "AND longdescs.bug_when > '$start'";
$count = 1;
}
if ($end) {
if ($::driver eq 'mysql') {
$query .= "AND longdescs.bug_when <= '$end' ";
} elsif ($::driver eq 'Pg') {
$query .= "AND TO_CHAR(longdescs.bug_when, 'YYYYMMDDHH24MISS') <= '$end' ";
}
$query .= "AND longdescs.bug_when <= '$end'";
}
$query .= "ORDER BY longdescs.bug_when";
@@ -1328,21 +1173,14 @@ sub GetLongDescriptionAsText {
sub GetComments {
my ($id) = (@_);
my @comments;
my $query = "SELECT profiles.realname, profiles.login_name, ";
if ($::driver eq 'mysql') {
$query .= "date_format(longdescs.bug_when,'%Y-%m-%d %H:%i'), ";
} elsif ($::driver eq 'Pg') {
$query .= "TO_CHAR(longdescs.bug_when,'YYYY-MM-DD HH24:MI'), ";
}
$query .= "longdescs.thetext
SendSQL("SELECT profiles.realname, profiles.login_name,
date_format(longdescs.bug_when,'%Y-%m-%d %H:%i'),
longdescs.thetext
FROM longdescs, profiles
WHERE profiles.userid = longdescs.who
AND longdescs.bug_id = $id
ORDER BY longdescs.bug_when";
SendSQL($query);
ORDER BY longdescs.bug_when");
while (MoreSQLData()) {
my %comment;
@@ -1366,23 +1204,13 @@ sub GetComments {
sub LearnAboutColumns {
my ($table) = (@_);
my %a;
SendSQL("show columns from $table");
my @list = ();
if ($::driver eq 'mysql') {
SendSQL("show columns from $table");
while ( my @row = FetchSQLData() ) {
my ($name,$type) = (@row);
$a{"$name,type"} = $type;
push (@list, $name);
}
} elsif ($::driver eq 'Pg') {
my $ref = $::db->func($table, "table_attributes");
for my $index ( 0..@{$ref} ) {
next if !$ref->[$index]->{'NAME'};
my $name = $ref->[$index]->{'NAME'};
my $type = $ref->[$index]->{'TYPE'};
$a{"$name,type"} = $type;
push (@list, $name);
}
my @row;
while (@row = FetchSQLData()) {
my ($name,$type) = (@row);
$a{"$name,type"} = $type;
push @list, $name;
}
$a{"-list-"} = \@list;
return \%a;
@@ -1406,21 +1234,6 @@ sub SplitEnumType {
return @result;
}
# subroutine: SplitTableValues
# description: This will take a table of values that were previously enum data types and return
# the legal values
sub SplitTableValues {
my ($str) = (@_);
my @result = ();
my @row = ();
my $query = "select value from $str";
SendSQL($query);
while (@row = FetchSQLData()) {
push (@result, $row[0]);
}
return @result;
}
# This routine is largely copied from Mysql.pm.
@@ -1469,7 +1282,7 @@ sub BugInGroup {
sub GroupExists {
my ($groupname) = (@_);
ConnectToDatabase();
SendSQL("select count(*) from groups where name = " . SqlQuote($groupname));
SendSQL("select count(*) from groups where name=" . SqlQuote($groupname));
my $count = FetchOneColumn();
return $count;
}
@@ -1610,7 +1423,7 @@ sub RemoveVotes {
SendSQL("SELECT SUM(count) FROM votes WHERE bug_id = $id");
my $v = FetchOneColumn();
$v ||= 0;
SendSQL("UPDATE bugs SET votes = $v, delta_ts = now() " .
SendSQL("UPDATE bugs SET votes = $v, delta_ts = delta_ts " .
"WHERE bug_id = $id");
}
}
@@ -1708,30 +1521,6 @@ sub trim {
return $str;
}
# Returns current value from a given sequence or auto_increment depending
# on the database being used.
sub CurrId {
my $seqname = shift;
if ($::driver eq 'mysql') {
SendSQL("select LAST_INSERT_ID()");
return FetchOneColumn();
} elsif ($::driver eq 'Pg') {
if ( !$seqname ) {
return 0;
}
SendSQL("SELECT last_value FROM $seqname");
return FetchOneColumn();
} elsif ($::driver eq 'Oracle') {
if (!$seqname) {
return 0;
}
SendSQL("select $seqname.currval from dual");
return FetchOneColumn();
} else {
return 0;
}
}
###############################################################################
# Global Templatization Code

View File

@@ -46,7 +46,8 @@ use vars qw(
ConnectToDatabase();
# Check whether or not the user is logged in
my $userid = quietly_check_login();
$::userid = 0;
$::userid = quietly_check_login();
###############################################################################
# Main Body Execution

View File

@@ -27,7 +27,7 @@ use lib qw(.);
require "CGI.pl";
use vars qw($userid @legal_keywords %FORM);
use vars qw($userid $usergroupset @legal_keywords %FORM);
# Use global template variables.
use vars qw($template $vars);

File diff suppressed because it is too large Load Diff

View File

@@ -44,7 +44,6 @@ sub sillyness {
$zz = @::legal_product;
$zz = @::legal_severity;
$zz = %::target_milestone;
$zz = $::driver;
}
# Use global template variables.
@@ -94,10 +93,12 @@ umask 0;
ConnectToDatabase();
# Some sanity checking
if(!CanSeeProduct($product, $userid)) {
DisplayError("Sorry; you do not have the permissions necessary to enter
a bug against this product.", "Permission Denied");
exit;
if(Param("usebuggroupsentry") && GroupExists($product)) {
if(!UserInGroup($userid, $product)) {
DisplayError("Sorry; you do not have the permissions necessary to enter
a bug against this product.", "Permission Denied");
exit;
}
}
if (!$::FORM{'component'}) {
@@ -140,9 +141,7 @@ if (Param("useqacontact")) {
$::FORM{'qa_contact'} = $qa_contact;
push(@bug_fields, "qa_contact");
}
} # else {
# $::FORM{'qa_contact'} = "0";
#}
}
if (exists $::FORM{'bug_status'}) {
# Ignore the given status, so that we can set it to UNCONFIRMED
@@ -248,7 +247,9 @@ SendSQL("LOCK TABLES bugs WRITE, longdescs WRITE, cc WRITE, bug_group_map WRITE"
# Add the bug report to the DB.
SendSQL($sql);
my $id = CurrId("bugs_bug_id_seq");
# Get the bug ID back.
SendSQL("select LAST_INSERT_ID()");
my $id = FetchOneColumn();
# Add the comment
SendSQL("INSERT INTO longdescs (bug_id, who, bug_when, thetext)
@@ -276,7 +277,7 @@ foreach my $group (@groupids) {
SendSQL("INSERT INTO bug_group_map (bug_id, group_id) VALUES ($id, $group)");
}
SendSQL("UNLOCK TABLES") if Param("shadowdb") && $::driver eq 'mysql';
SendSQL("UNLOCK TABLES") if Param("shadowdb");
# Assemble the -force* strings so this counts as "Added to this capacity"
my @ARGLIST = ();

View File

@@ -32,8 +32,6 @@ my $hasCanConfirmGroup = -1;
use lib qw(.);
use lib qw(.);
require "CGI.pl";
require "bug_form.pl";
@@ -52,7 +50,7 @@ use vars qw(%versions
%settable_resolution
%target_milestone
%legal_severity
$userid
%superusergroupset
$next_bug);
my $whoid = confirm_login();
@@ -291,7 +289,7 @@ sub CheckCanChangeField {
$qacontactid eq $whoid) {
return 1;
}
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
SendSQL("UNLOCK TABLES");
$oldvalue = html_quote($oldvalue);
$newvalue = html_quote($newvalue);
ThrowUserError("You tried to change the <strong>$f</strong> field
@@ -409,19 +407,9 @@ sub ChangeStatus {
# to handle that.
my @open_state = map(SqlQuote($_), OpenStates());
my $open_state = join(", ", @open_state);
if ($::driver eq 'mysql') {
$::query .= "bug_status = IF(bug_status IN ($open_state), '$str', bug_status)";
} elsif ($::driver eq 'Pg') {
$::query .= "bug_status = CASE WHEN bug_status IN ($open_state) " .
"THEN '$str' ELSE bug_status END ";
}
$::query .= "bug_status = IF(bug_status IN($open_state), '$str', bug_status)";
} elsif (IsOpenedState($str)) {
if ($::driver eq 'mysql') {
$::query .= "bug_status = IF(everconfirmed = 1, '$str', '$::unconfirmedstate')";
} elsif ($::driver eq 'Pg') {
$::query .= "bug_status = CASE WHEN (select everconfirmed from bugs where bug_id = $::FORM{'id'}) = 1 " .
"THEN '$str' ELSE '$::unconfirmedstate' END ";
}
$::query .= "bug_status = IF(everconfirmed = 1, '$str', '$::unconfirmedstate')";
} else {
$::query .= "bug_status = '$str'";
}
@@ -701,13 +689,8 @@ my $delta_ts;
sub SnapShotBug {
my ($id) = (@_);
if ($::driver eq 'mysql') {
SendSQL("select delta_ts, " . join(',', @::log_columns) .
" from bugs where bug_id = $id");
} elsif ($::driver eq 'Pg') {
SendSQL("SELECT TO_CHAR(delta_ts, 'YYYYMMDDHH24MISS'), " . join(',', @::log_columns) .
" FROM bugs WHERE bug_id = $id");
}
SendSQL("select delta_ts, " . join(',', @::log_columns) .
" from bugs where bug_id = $id");
my @row = FetchSQLData();
$delta_ts = shift @row;
@@ -805,13 +788,11 @@ foreach my $id (@idlist) {
$bug_changed = 0;
my $write = "WRITE"; # Might want to make a param to control
# whether we do LOW_PRIORITY ...
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES bugs $write, bugs_activity $write, cc $write, " .
"profiles $write, dependencies $write, votes $write, " .
"keywords $write, longdescs $write, fielddefs $write, " .
"keyworddefs READ, groups READ, attachments READ, products READ, " .
"user_group_map READ, bug_group_map WRITE");
}
SendSQL("LOCK TABLES bugs $write, bugs_activity $write, cc $write, " .
"profiles $write, dependencies $write, votes $write, " .
"keywords $write, longdescs $write, fielddefs $write, " .
"keyworddefs READ, groups READ, attachments READ, products READ, " .
"user_group_map READ, bug_group_map WRITE, product_group_map READ");
my @oldvalues = SnapShotBug($id);
my %oldhash;
my $i = 0;
@@ -826,12 +807,11 @@ foreach my $id (@idlist) {
my $value = $::FORM{'target_milestone'};
if (!defined $value || $value eq $::dontchange) {
$value = $oldhash{'target_milestone'};
$value = $oldhash{'target_milestone'};
}
SendSQL("SELECT defaultmilestone FROM products WHERE product = " .
SqlQuote($oldhash{'product'}));
if ($value eq FetchOneColumn()) {
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
SendSQL("UNLOCK TABLES");
ThrowUserError("You must determine a target milestone for bug $id
if you are going to accept it. Part of accepting
a bug is giving an estimate of when it will be fixed.",
@@ -851,7 +831,7 @@ foreach my $id (@idlist) {
$vars->{'bug_id'} = $id;
$vars->{'quoteUrls'} = \&quoteUrls;
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
SendSQL("UNLOCK TABLES");
# Warn the user about the mid-air collision and ask them what to do.
$template->process("bug/process/midair.html.tmpl", $vars)
@@ -1138,6 +1118,9 @@ foreach my $id (@idlist) {
LogActivityEntry($id,$col,$old,$new);
}
}
if ($bug_changed) {
SendSQL("UPDATE bugs SET delta_ts = " . SqlQuote($timestamp) . " WHERE bug_id = $id");
}
# Make necessary group membership changes
# Changing this so that it will process groups from checkboxes instead of
@@ -1175,16 +1158,7 @@ foreach my $id (@idlist) {
}
}
if ($bug_changed) {
if ($::driver eq 'mysql') {
SendSQL("UPDATE bugs SET delta_ts = " . SqlQuote($timestamp) . " WHERE bug_id = $id");
} elsif ($::driver eq 'Pg') {
SendSQL("UPDATE bugs SET delta_ts = TO_DATE(" . SqlQuote($timestamp) .
", 'YYYYMMDDHH24MISS') WHERE bug_id = $id");
}
}
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
SendSQL("UNLOCK TABLES");
my @ARGLIST = ();
if ( $removedCcString ne "" ) {
@@ -1272,7 +1246,7 @@ if ($::COOKIE{"BUGLIST"} && $::FORM{'id'}) {
my $cur = lsearch(\@bugs, $::FORM{"id"});
if ($cur >= 0 && $cur < $#bugs) {
my $next_bug = $bugs[$cur + 1];
if (detaint_natural($next_bug) && CanSeeBug($next_bug, $userid)) {
if (detaint_natural($next_bug) && CanSeeBug($next_bug)) {
$::FORM{'id'} = $next_bug;
$vars->{'next_id'} = $next_bug;

View File

@@ -50,7 +50,7 @@ my %nomail;
my @excludedAddresses = ();
# disable email flag for offline debugging work
my $enableSendMail = 0;
my $enableSendMail = 1;
my %force;
@{$force{'QAcontact'}} = ();
@@ -103,23 +103,13 @@ sub ProcessOneBug {
$defmailhead{$field} = $mailhead;
$fielddescription{$field} = $description;
}
if ($::driver eq 'mysql') {
SendSQL("SELECT " . join(',', @::log_columns) . ", lastdiffed, " .
"now() FROM bugs WHERE bug_id = $id");
} elsif ($::driver eq 'Pg') {
SendSQL("SELECT " . join(',', @::log_columns) . ", to_char(lastdiffed, 'YYYYMMDDHH24MISS'), " .
"to_char(now(), 'YYYYMMDDHH24MISS') FROM bugs WHERE bug_id = $id");
}
SendSQL("SELECT " . join(',', @::log_columns) . ", lastdiffed, now() " .
"FROM bugs WHERE bug_id = $id");
my @row = FetchSQLData();
foreach my $i (@::log_columns) {
$values{$i} = shift(@row);
}
my ($start, $end) = (@row);
if (!$start && $::driver eq 'Pg') {
$start = '00000000000000';
}
# $start and $end are considered safe because users can't touch them
trick_taint($start);
trick_taint($end);
@@ -142,24 +132,19 @@ sub ProcessOneBug {
}
my @diffs;
my $datepart = "";
if ($::driver eq 'mysql') {
$datepart = " AND bug_when > '$start' AND bug_when <= '$end' ";
} elsif ($::driver eq 'Pg') {
$datepart = " AND to_char(bug_when, 'YYYYMMDDHH24MISS') > '$start' " .
" AND to_char(bug_when, 'YYYYMMDDHH24MISS') <= '$end' ";
}
SendSQL("SELECT profiles.login_name, fielddefs.description, " .
" bug_when, removed, added, attach_id " .
" bug_when, removed, added, attach_id " .
"FROM bugs_activity, fielddefs, profiles " .
"WHERE bug_id = $id " .
" AND fielddefs.fieldid = bugs_activity.fieldid " .
" AND profiles.userid = who " .
$datepart .
"ORDER BY bug_when");
" AND profiles.userid = who " .
" AND bug_when > '$start' " .
" AND bug_when <= '$end' " .
"ORDER BY bug_when"
);
while (MoreSQLData()) {
my @row = FetchSQLData();
push(@diffs, \@row);
@@ -181,9 +166,10 @@ sub ProcessOneBug {
$difftext = trim($difftext);
my $deptext = "";
my $resid =
my $resid =
SendSQL("SELECT bugs_activity.bug_id, bugs.short_desc, fielddefs.name, " .
" removed, added " .
@@ -194,9 +180,10 @@ sub ProcessOneBug {
" AND fielddefs.fieldid = bugs_activity.fieldid" .
" AND (fielddefs.name = 'bug_status' " .
" OR fielddefs.name = 'resolution') " .
$datepart .
" AND bug_when > '$start' " .
" AND bug_when <= '$end' " .
"ORDER BY bug_when, bug_id");
my $thisdiff = "";
my $lastbug = "";
my $interestingchange = 0;
@@ -292,7 +279,7 @@ sub ProcessOneBug {
@excludedAddresses = filterExcludeList(\@excludedAddresses,
\@allEmail);
#print LOG "excluded: " . join(',',@excludedAddresses) . "\n\n";
# print LOG "excluded: " . join(',',@excludedAddresses) . "\n\n";
foreach my $person ( @allEmail ) {
my @reasons;
@@ -322,15 +309,9 @@ sub ProcessOneBug {
}
}
if ($::driver eq 'mysql') {
SendSQL("UPDATE bugs SET lastdiffed = '$end', delta_ts = now() " .
"WHERE bug_id = $id");
} else {
# SendSQL("UPDATE bugs SET lastdiffed = TO_DATE('$end', 'YYYYMMDDHH24MISS'), delta_ts = now() " .
# "WHERE bug_id = $id");
SendSQL("UPDATE bugs SET lastdiffed = now(), delta_ts = now() " .
"WHERE bug_id = $id");
}
SendSQL("UPDATE bugs SET lastdiffed = '$end', delta_ts = delta_ts " .
"WHERE bug_id = $id");
# Filter the exclude list for dupes one last time
@excludedAddresses = filterExcludeList(\@excludedAddresses,
@@ -786,11 +767,11 @@ sub NewProcessOnePerson ($$$$$$$$$$$$) {
}
if ($enableSendMail == 1) {
open(SENDMAIL, "|/usr/lib/sendmail $sendmailparam -t -i") ||
die "Can't open sendmail";
open(SENDMAIL, "|/usr/lib/sendmail $sendmailparam -t -i") ||
die "Can't open sendmail";
print SENDMAIL trim($msg) . "\n";
close SENDMAIL;
print SENDMAIL trim($msg) . "\n";
close SENDMAIL;
}
push(@sentlist, $person);
return 1;
@@ -852,16 +833,7 @@ if ($#ARGV == 1) {
if ($ARGV[0] eq "rescanall") {
print "Collecting bug ids...\n";
if ($::driver eq 'mysql') {
SendSQL("select bug_id, lastdiffed, delta_ts from bugs " .
"where lastdiffed < delta_ts AND delta_ts < date_sub(now(), INTERVAL 30 minute) " .
"order by bug_id");
} else {
SendSQL("select bug_id, TO_CHAR(lastdiffed, 'YYYY-MM-DD HH24:MI:SS'), " .
"TO_CHAR(delta_ts, 'YYYY-MM-DD HH24:MI:SS') from bugs " .
"where lastdiffed < delta_ts AND now() - delta_ts <= '30 minutes' " .
"order by bug_id");
}
SendSQL("select bug_id, lastdiffed, delta_ts from bugs where lastdiffed < delta_ts AND delta_ts < date_sub(now(), INTERVAL 30 minute) order by bug_id");
my @list;
while (my @row = FetchSQLData()) {
my $time = $row[2];

View File

@@ -51,7 +51,6 @@ use vars qw(
);
my $userid = 0;
ConnectToDatabase();
if (defined $::FORM{"GoAheadAndLogIn"}) {
# We got here from a login page, probably from relogin.cgi. We better
# make sure the password is legit.
@@ -80,12 +79,12 @@ if ($userid) {
if ($value) {
my $qname = SqlQuote($name);
SendSQL("SELECT query FROM namedqueries " .
"WHERE userid = $::userid AND name = $qname");
"WHERE userid = $userid AND name = $qname");
my $query = FetchOneColumn();
if (!$query) {
SendSQL("REPLACE INTO namedqueries " .
"(userid, name, query) VALUES " .
"($::userid, $qname, " . SqlQuote($value) . ")");
"($userid, $qname, " . SqlQuote($value) . ")");
}
}
print "Set-Cookie: $cookiename= ; path=" . Param("cookiepath") .
@@ -95,17 +94,17 @@ if ($userid) {
}
if ($::FORM{'nukedefaultquery'}) {
if ($::userid) {
if ($userid) {
SendSQL("DELETE FROM namedqueries " .
"WHERE userid = $::userid AND name = '$::defaultqueryname'");
"WHERE userid = $userid AND name = '$::defaultqueryname'");
}
$::buffer = "";
}
my $userdefaultquery;
if ($::userid) {
if ($userid) {
SendSQL("SELECT query FROM namedqueries " .
"WHERE userid = $::userid AND name = '$::defaultqueryname'");
"WHERE userid = $userid AND name = '$::defaultqueryname'");
$userdefaultquery = FetchOneColumn();
}
@@ -189,7 +188,7 @@ if ($default{'chfieldto'}->[0] eq "") {
GetVersionTable();
# if using usebuggroups, then we don't want people to see products they don't
# We don't want people to see products they don't
# have access to. Remove them from the list.
my @products = ();
@@ -303,6 +302,7 @@ $vars->{'userid'} = $userid;
# Boolean charts
my @fields;
push(@fields, { name => "noop", description => "---" });
ConnectToDatabase();
SendSQL("SELECT name, description FROM fielddefs ORDER BY sortkey");
while (MoreSQLData()) {
my ($name, $description) = FetchSQLData();

View File

@@ -577,7 +577,7 @@ my $max_table_size = 50;
SendSQL("SELECT keyworddefs.name, keyworddefs.description,
COUNT(keywords.bug_id), keywords.bug_id
FROM keyworddefs LEFT JOIN keywords ON keyworddefs.id=keywords.keywordid
GROUP BY keywords.bug_id, keyworddefs.name, keyworddefs.description
GROUP BY keyworddefs.id
ORDER BY keyworddefs.name");
while (MoreSQLData()) {

View File

@@ -42,7 +42,7 @@ if ($action eq "show") {
my @quips;
push (@quips, $_) while (<COMMENTS>);
close COMMENTS;
$vars->{'quips'} = \@quips;
$vars->{'show_quips'} = 1;
}

View File

@@ -30,26 +30,6 @@ use vars qw($template $vars);
use lib qw(.);
require "CGI.pl";
require "globals.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
# the logincookie must be correct
ConnectToDatabase();
quietly_check_login();
if ($::userid) {
# Even though we know the userid must match, we still check it in the
# SQL as a sanity check, since there is no locking here, and if
# the user logged out from two machines simulataniously, while someone
# else logged in and got the same cookie, we could be logging the
# other user out here. Yes, this is very very very unlikely, but why
# take chances? - bbaetz
SendSQL("DELETE FROM logincookies WHERE cookie = " .
SqlQuote($::COOKIE{"Bugzilla_logincookie"}) .
"AND userid = $::userid");
}
# 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
@@ -86,8 +66,8 @@ delete $::COOKIE{"Bugzilla_login"};
$vars->{'link'} = "Log in again here";
$vars->{'user'} = {};
print "Content-Type: text/html\n\n";
$template->process("global/message.html.tmpl", $vars)
print "Content-Type: text/html\n\n";
$template->process("global/message.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;

View File

@@ -76,7 +76,7 @@ my $userid = quietly_check_login();
GetVersionTable();
my @myproducts;
push( @myproducts, "-All-");
push(@myproducts, "-All-");
foreach my $this_product (@legal_product) {
if (!CanSeeProduct($userid, $this_product)) {
next;
@@ -100,13 +100,6 @@ if (! defined $FORM{'product'}) {
grep($_ eq $FORM{'product'}, @myproducts)
|| DisplayError("You entered an invalid product name.") && exit;
# If usebuggroups is on, we don't want people to be able to view
# reports for products they don't have permissions for...
$::FORM{'product'} != '-All-'
&& !CanSeeProduct($::FORM{'product'}, $userid)
&& DisplayError("You do not have the permissions necessary to view reports for this product.")
&& exit;
# For security and correctness, validate the value of the "output" form variable.
# Valid values are the keys from the %reports hash defined above which appear in
# the "output" drop-down menu on the report generation form.
@@ -164,7 +157,7 @@ sub choose_product {
<h1>Welcome to the Bugzilla Query Kitchen</h1>
</center>
<form method=get action=reports.cgi>
<table border=1 cellpadding=5 align="center">
<table border=1 cellpadding=5>
<tr>
<td align=center><b>Product:</b></td>
<td align=center>
@@ -265,33 +258,17 @@ FIN
# Build up $query string
my $query;
if ($::driver eq 'mysql') {
$query = <<FIN;
SELECT
$query = <<FIN;
select
bugs.bug_id,
bugs.bug_status,
assign.login_name,
unix_timestamp(date_format(bugs.creation_ts, '%Y-%m-%d %h:%m:%s'))
FROM
bugs,
profiles assign
WHERE
bugs.assigned_to = assign.userid
from bugs,
profiles assign
where bugs.assigned_to = assign.userid
FIN
} elsif ($::driver eq 'Pg') {
$query = <<FIN;
SELECT
bugs.bug_id,
bugs.bug_status,
assign.login_name,
bugs.creation_ts
FROM
bugs,
profiles assign
WHERE
bugs.assigned_to = assign.userid
FIN
}
if ($FORM{'product'} ne "-All-" ) {
$query .= "and bugs.product=".SqlQuote($FORM{'product'});
@@ -303,7 +280,7 @@ FIN
$query .= " and (" . join (" or ", @sqlproducts) . ")";
}
$query .= " AND bugs.bug_status IN ('NEW', 'ASSIGNED', 'REOPENED')";
$query .= "AND bugs.bug_status IN ('NEW', 'ASSIGNED', 'REOPENED')";
# End build up $query string
print "<font color=purple><tt>$query</tt></font><p>\n"
@@ -708,7 +685,7 @@ sub most_doomed_for_milestone {
# Build up $query string
my $query;
$query = "select distinct assigned_to from bugs where target_milestone = '$ms' ";
$query = "select distinct assigned_to from bugs where target_milestone=\"$ms\"";
if ($FORM{'product'} ne "-All-" ) {
$query .= "and bugs.product=".SqlQuote($FORM{'product'});
} else {
@@ -740,7 +717,7 @@ FIN
my $person = "";
my $bugtotal = 0;
foreach $person (@people) {
my $query = "select count(bug_id) from bugs,profiles where target_milestone = '$ms' and userid=assigned_to and userid = '$person' ";
my $query = "select count(bug_id) from bugs,profiles where target_milestone=\"$ms\" and userid=assigned_to and userid=\"$person\"";
if( $FORM{'product'} ne "-All-" ) {
$query .= "and bugs.product=".SqlQuote($FORM{'product'});
} else {

View File

@@ -23,9 +23,6 @@
use diagnostics;
use strict;
use POSIX;
use lib qw(.);
use lib qw(.);
@@ -52,9 +49,7 @@ UserInGroup($userid, "editbugs")
print "Content-type: text/html\n";
print "\n";
if ($::driver eq 'mysql') {
SendSQL("set SQL_BIG_TABLES=1");
}
SendSQL("set SQL_BIG_TABLES=1");
my $offervotecacherebuild = 0;
@@ -126,16 +121,10 @@ my @checklist;
PutHeader("Bugzilla Sanity Check");
###########################################################################
# Fix vote cache
###########################################################################
if (exists $::FORM{'rebuildvotecache'}) {
Status("OK, now rebuilding vote cache.");
if ($::driver eq 'mysql') {
SendSQL("lock tables bugs write, votes read");
}
SendSQL("update bugs set votes = 0, delta_ts=now()");
SendSQL("lock tables bugs write, votes read");
SendSQL("update bugs set votes = 0, delta_ts=delta_ts");
SendSQL("select bug_id, sum(count) from votes group by bug_id");
my %votes;
while (@row = FetchSQLData()) {
@@ -143,11 +132,9 @@ if (exists $::FORM{'rebuildvotecache'}) {
$votes{$id} = $v;
}
foreach my $id (keys %votes) {
SendSQL("update bugs set votes = $votes{$id}, delta_ts=now() where bug_id = $id");
}
if ($::driver eq 'mysql') {
SendSQL("unlock tables");
SendSQL("update bugs set votes = $votes{$id}, delta_ts=delta_ts where bug_id = $id");
}
SendSQL("unlock tables");
Status("Vote cache has been rebuilt.");
}
@@ -171,10 +158,6 @@ foreach my $field (("bug_severity", "bug_status", "op_sys",
}
}
###########################################################################
# Perform referential (cross) checks
###########################################################################
CrossCheck("keyworddefs", "id",
["keywords", "keywordid"]);
@@ -217,24 +200,6 @@ CrossCheck("profiles", "userid",
["components", "initialowner", "value"],
["components", "initialqacontact", "value", ["0"]]);
#Status("Checking passwords");
#SendSQL("SELECT COUNT(*) FROM profiles WHERE cryptpassword != ENCRYPT(password, left(cryptpassword, 2))");
#my $count = FetchOneColumn();
#if ($count) {
# Alert("$count entries have problems in their crypted password.");
# if ($::FORM{'rebuildpasswords'}) {
# Status("Rebuilding passwords");
# SendSQL("UPDATE profiles
# SET cryptpassword = ENCRYPT(password,
# left(cryptpassword, 2))
# WHERE cryptpassword != ENCRYPT(password,
# left(cryptpassword, 2))");
# Status("Passwords have been rebuilt.");
# } else {
# print qq{<a href="sanitycheck.cgi?rebuildpasswords=1">Click here to rebuild the crypted passwords</a><p>\n};
# }
#}
CrossCheck("products", "product",
["bugs", "product", "bug_id"],
["components", "program", "value"],
@@ -242,9 +207,6 @@ CrossCheck("products", "product",
["versions", "program", "value"],
["attachstatusdefs", "product", "name"]);
###########################################################################
# Perform group checks
###########################################################################
Status("Checking groups");
my %legal_groups = ();
@@ -334,24 +296,19 @@ foreach my $ref (@checklist) {
}
}
###########################################################################
# Perform login checks
###########################################################################
Status("Checking profile logins");
my $emailregexp = Param("emailregexp");
$emailregexp =~ s/'/\\'/g;
SendSQL("SELECT userid, login_name FROM profiles " .
"WHERE " . SqlRegEx("login_name", $emailregexp, "not"));
"WHERE login_name NOT REGEXP '" . $emailregexp . "'");
while (my ($id,$email) = (FetchSQLData())) {
Alert "Bad profile email address, id=$id, &lt;$email&gt;."
}
###########################################################################
# Perform vote/keyword cache checks
###########################################################################
SendSQL("SELECT bug_id,votes,keywords FROM bugs " .
"WHERE votes != 0 OR keywords != ''");
@@ -429,9 +386,7 @@ Status("Checking cached keywords");
my %realk;
if (exists $::FORM{'rebuildkeywordcache'}) {
if ($::driver eq 'mysql') {
SendSQL("LOCK TABLES bugs write, keywords read, keyworddefs read");
}
SendSQL("LOCK TABLES bugs write, keywords read, keyworddefs read");
}
SendSQL("SELECT keywords.bug_id, keyworddefs.name " .
@@ -480,13 +435,10 @@ if (@badbugs) {
if (exists($realk{$b})) {
$k = $realk{$b};
}
SendSQL("UPDATE bugs SET delta_ts = now(), keywords = " .
SendSQL("UPDATE bugs SET delta_ts = delta_ts, keywords = " .
SqlQuote($k) .
" WHERE bug_id = $b");
}
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
Status("Keyword cache fixed.");
} else {
print qq{<a href="sanitycheck.cgi?rebuildkeywordcache=1">Click here to rebuild the keyword cache</a><p>\n};
@@ -494,9 +446,7 @@ if (@badbugs) {
}
if (exists $::FORM{'rebuildkeywordcache'}) {
if ($::driver eq 'mysql') {
SendSQL("UNLOCK TABLES");
}
SendSQL("UNLOCK TABLES");
}
###########################################################################
@@ -647,32 +597,6 @@ if (@badbugs > 0) {
join (", ", @badbugs));
}
############################################################################
# Check for missing values in enum tables that are present in bugs table
############################################################################
foreach my $enum ( "bug_status", "resolution", "bug_severity", "op_sys", "priority", "rep_platform" ) {
my %bug_values;
my %table_values;
Status("Checking for orphan $enum entries");
SendSQL("select distinct $enum from bugs");
while ( my @row = FetchSQLData() ) {
$bug_values{$row[0]} = 1;
}
SendSQL("select value from $enum");
while ( my @row = FetchSQLData() ) {
$table_values{$row[0]} = 1;
}
foreach my $value ( keys %bug_values ) {
if ( !$table_values{$value} ) {
SendSQL("select count(bug_id) from bugs where $enum = " . SqlQuote($value));
my $count = FetchOneColumn();
Alert("There were $count bugs with a $enum value of $value which is not in the $enum enum table.");
}
}
}
###########################################################################
# Unsent mail
###########################################################################
@@ -681,17 +605,10 @@ Status("Checking for unsent mail");
@badbugs = ();
if ($::driver eq 'mysql') {
SendSQL("SELECT bug_id " .
"FROM bugs WHERE lastdiffed < delta_ts AND ".
"delta_ts < date_sub(now(), INTERVAL 30 minute) ".
"ORDER BY bug_id");
} elsif ($::driver eq 'Pg') {
SendSQL("SELECT bug_id " .
"FROM bugs WHERE lastdiffed < delta_ts AND ".
"now() - INTERVAL '30 minutes' > delta_ts ".
"ORDER BY bug_id");
}
SendSQL("SELECT bug_id " .
"FROM bugs WHERE lastdiffed < delta_ts AND ".
"delta_ts < date_sub(now(), INTERVAL 30 minute) ".
"ORDER BY bug_id");
while (@row = FetchSQLData()) {
my ($id) = (@row);
@@ -704,7 +621,6 @@ if (@badbugs > 0) {
print("Run <code>processmail rescanall</code> to fix this<p>\n");
}
###########################################################################
# End
###########################################################################

View File

@@ -23,9 +23,6 @@
use diagnostics;
use strict;
use MIME::Base64;
use lib qw(.);
use lib qw(.);
@@ -37,3 +34,4 @@ my $id = $::FORM{'attach_id'} || "";
print "Status: 301 Permanent Redirect\n";
print "Location: attachment.cgi?id=$id&action=view\n\n";
exit;

View File

@@ -32,7 +32,7 @@ ConnectToDatabase();
my $userid = quietly_check_login();
use vars qw($template $vars $userid);
use vars qw($template $vars $userid $usergroupset);
my %seen;
my %edgesdone;
@@ -148,8 +148,9 @@ foreach my $k (keys(%seen)) {
}
my @params;
foreach my $k (keys(%baselist)) {
$seen{$k} = 1;
if ($summary ne "") {
$summary =~ s/([\\\"])/\\$1/g;
push(@params, qq{label="$k\\n$summary"});
}
if (exists $baselist{$k}) {

View File

@@ -40,6 +40,7 @@ my $userid = quietly_check_login();
# More warning suppression silliness.
$::userid = $::userid;
$::usergroupset = $::usergroupset;
################################################################################
# Data/Security Validation #
@@ -90,7 +91,7 @@ $vars->{'realdepth'} = $realdepth;
$vars->{'bugid'} = $id;
$vars->{'maxdepth'} = $maxdepth;
$vars->{'hide_resolved'} = $hide_resolved;
$vars->{'canedit'} = UserInGroup($userid, "editbugs");
$vars->{'canedit'} = UserInGroup("editbugs");
print "Content-Type: text/html\n\n";
$template->process("bug/dependency-tree.html.tmpl", $vars)

View File

@@ -45,14 +45,14 @@ $vars->{'anyvotesallowed'} = $::anyvotesallowed;
$vars->{'userid'} = $userid;
if ($userid) {
SendSQL("SELECT mybugslink FROM profiles WHERE userid = $userid");
SendSQL("SELECT mybugslink FROM profiles WHERE user_id = $userid");
my $mybugslink = FetchOneColumn();
if ($mybugslink) {
my $mybugstemplate = Param("mybugstemplate");
my %substs = ( 'userid' => url_quote($::COOKIE{'Bugzilla_login'}) );
$vars->{'mybugsurl'} = PerformSubsts($mybugstemplate, \%substs);
}
SendSQL("SELECT name FROM namedqueries WHERE userid = $userid AND linkinfooter = 1");
SendSQL("SELECT name FROM namedqueries WHERE userid = $userid AND linkinfooter");
while (MoreSQLData()) {
my ($name) = FetchSQLData();
push(@{$vars->{'namedqueries'}}, $name);

View File

@@ -0,0 +1,339 @@
[%# 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): Myk Melez <myk@mozilla.org>
#%]
<script type="text/javascript" language="JavaScript">
var numelements = document.forms.changeform.elements.length;
function SetCheckboxes(value) {
var item;
for (var i=0 ; i<numelements ; i++) {
item = document.forms.changeform.elements[i];
item.checked = value;
}
}
document.write(' <input type="button" value="Uncheck All" onclick="SetCheckboxes(false);">');
document.write(' <input type="button" value="Check All" onclick="SetCheckboxes(true);">');
</script>
<hr />
<p><font size="-1">
To change multiple bugs:
<ol>
<li>Check the bugs you want to change above.</li>
<li>Make your changes in the form fields below. If the change
you are making requires an explanation, include it in
the comments box.</li>
<li>Click the <em>Commit</em> button.</li>
</ol>
</font></p>
<table id="form">
<tr>
<th><label for="product">Product:</label></th>
<td>
[% PROCESS selectmenu menuname = "product"
menuitems = products %]
</td>
<th><label for="version">Version:</label></th>
<td>
[% PROCESS selectmenu menuname = "version"
menuitems = versions %]
</td>
</tr>
<tr>
<th>
<label for="rep_platform">
<a href="bug_status.html#rep_platform">Platform:</a>
</label>
</th>
<td>
[% PROCESS selectmenu menuname = "rep_platform"
menuitems = platforms %]
</td>
<th>
<label for="priority">
<a href="bug_status.html#priority">Priority:</a>
</label>
</th>
<td>
[% PROCESS selectmenu menuname = "priority"
menuitems = priorities %]
</td>
</tr>
<tr>
<th><label for="component">Component:</label></th>
<td>
[% PROCESS selectmenu menuname = "component"
menuitems = components %]
</td>
<th>
<label for="severity">
<a href="bug_status.html#severity">Severity:</a>
</label>
</th>
<td>
[% PROCESS selectmenu menuname = "severity"
menuitems = severities %]
</td>
</tr>
<tr>
<th><label for="target_milestone">Target Milestone:</label></th>
<td colspan="3">
[% PROCESS selectmenu menuname = "target_milestone"
menuitems = targetmilestones %]
</td>
</tr>
[% IF Param("useqacontact") %]
<tr>
<th><label for="qa_contact">QA Contact:</label></th>
<td colspan="3">
<input id="qa_contact"
name="qa_contact"
value="[% dontchange FILTER html %]"
size="32">
</td>
</tr>
[% END %]
<tr>
<th><label for="masscc">CC List:</label></th>
<td colspan="3">
<input id="masscc" name="masscc" size="32">
<select name="ccaction">
<option value="add">Add these to the CC List</option>
<option value="remove">Remove these from the CC List</option>
</select>
</td>
</tr>
[% IF use_keywords %]
<tr>
<th>
<label for="keywords">
<a href="describekeywords.cgi">Keywords:</a>
</label>
</th>
<td colspan="3">
<input id="keywords" name="keywords" size="32">
<select name="keywordaction">
<option value="add">Add these keywords</option>
<option value="delete">Delete these keywords</option>
<option value="makeexact">Make the keywords be exactly this list</option>
</select>
</td>
</tr>
[% END %]
<tr>
<th>Depends on:</th>
<td colspan="3">
<input id="dependson" name="dependson" size="32">
<select name="dependsonaction">
<option value="add">Add these dependencies</option>
<option value="delete">Remove these dependencies</option>
<option value="makeexact">Make the dependencies be exactly this list</option>
</select>
</td>
</tr>
<tr>
<th>Blocks:</th>
<td colspan="3">
<input id="blocked" name="blocked" size="32">
<select name="blockedaction">
<option value="add">Add these dependencies</option>
<option value="delete">Remove these dependencies</option>
<option value="makeexact">Make the dependencies be exactly this list</option>
</select>
</td>
</tr>
</table>
<input type="hidden" name="multiupdate" value="Y">
<label for="comment"><b>Additional Comments:</b></label><br />
<textarea id="comment" name="comment" rows="5" cols="80" wrap="hard"></textarea><br />
[% IF groups.size > 0 %]
<b>Groupset:</b><br />
<table border="1">
<tr>
<th>Don't<br />change<br />this group<br />restriction</td>
<th>Remove<br />bugs<br />from this<br />group</td>
<th>Add<br />bugs<br />to this<br />group</td>
<th>Group Name:</td>
</tr>
[% FOREACH group = groups %]
<tr>
<td align="center">
<input type="radio" name="group-[% group.bit %]" value="-1" checked>
</td>
<td align="center">
<input type="radio" name="group-[% group.bit %]" value="0">
</td>
[% IF group.isactive %]
<td align="center">
<input type="radio" name="group-[% group.bit %]" value="1">
</td>
[% ELSE %]
<td>&nbsp;</td>
[% foundinactive = 1 %]
[% END %]
<td>
[% IF group.isactive %]
[% group.description %]
[% ELSE %]
[% group.description FILTER strike %]
[% END %]
</td>
</tr>
[% END %]
</table>
[% IF foundinactive %]
<font size="-1">(Note: Bugs may not be added to <strike>inactive
groups</strike>, only removed.)</font><br />
[% END %]
[% END %]
[% knum = 0 %]
<input id="knob-none" type="radio" name="knob" value="none" CHECKED>
<label for="knob-none">Do nothing else</label><br />
[% IF bugstatuses.size == 1 && bugstatuses.0 == unconfirmedstate %]
[% knum = knum + 1 %]
<input id="knob-confirm" type="radio" name="knob" value="confirm>
<label for="knob-confirm">
Confirm bugs (change status to <b>NEW</b>)
</label><br />
[% END %]
[% knum = knum + 1 %]
<input id="knob-accept" type="radio" name="knob" value="accept">
<label for="knob-accept">
Accept bugs (change status to <b>ASSIGNED</b>)
</label><br />
[%# If all the bugs being changed are open, allow the user to close them. %]
[% IF !bugstatuses.containsany(closedstates) %]
[% knum = knum + 1 %]
<input id="knob-clearresolution" type="radio" name="knob" value="clearresolution">
<label for="knob-clearresolution">Clear the resolution</label><br />
[% knum = knum + 1 %]
<input id="knob-resolve" type="radio" name="knob" value="resolve">
<label for="knob-resolve">
Resolve bugs, changing <A HREF="bug_status.html">resolution</A> to
</label>
<select name="resolution" onchange="document.forms.changeform.knob[[% knum %]].checked=true">
[% FOREACH resolution = resolutions %]
[% NEXT IF !resolution %]
<option value="[% resolution %]" [% selected IF resolution == "FIXED" %]>
[% resolution %]
</option>
[% END %]
</select><br />
[% END %]
[%# If all the bugs are closed, allow the user to reopen them. %]
[% IF !bugstatuses.containsany(openstates) %]
[% knum = knum + 1 %]
<input id="knob-reopen" type="radio" name="knob" value="reopen">
<label for="knob-reopen">Reopen bugs</label><br />
[% END %]
[% IF bugstatuses.size == 1 %]
[% IF bugstatuses.contains('RESOLVED') %]
[% knum = knum + 1 %]
<input id="knob-verify" type="radio" name="knob" value="verify">
<label for="knob-verify">Mark bugs as <b>VERIFIED</b></label><br />
[% ELSIF bugstatuses.contains('VERIFIED') %]
[% knum = knum + 1 %]
<input id="knob-close" type="radio" name="knob" value="close">
<label for="knob-close">Mark bugs as <b>CLOSED</b></label><br />
[% END %]
[% END %]
[% knum = knum + 1 %]
<input id="knob-reassign" type="radio" name="knob" value="reassign">
<label for="knob-reassign"><a href="bug_status.html#assigned_to">
Reassign</A> bugs to
</label>
<input name="assigned_to"
value="[% user %]"
onchange="document.forms.changeform.knob[[% knum %]].checked = true;"
size="32"><br />
[% knum = knum + 1 %]
<input id="knob-reassignbycomponent"
type="radio"
name="knob"
value="reassignbycomponent">
<label for="knob-reassignbycomponent">
Reassign bugs to owner of selected component
</label><br />
<input type="submit" value="Commit">
[% IF ismover %]
<input type="submit" name="action" value="[% Param('move-button-text') %]">
[% END %]
[%############################################################################%]
[%# Select Menu Block #%]
[%############################################################################%]
[% BLOCK selectmenu %]
<select id="[% menuname %]" name="[% menuname %]">
<option value="[% dontchange FILTER html %]" selected>
[% dontchange FILTER html %]
</option>
[% FOREACH menuitem = menuitems %]
<option value="[% menuitem FILTER html %]">[% menuitem FILTER html %]</option>
[% END %]
</select>
[% END %]

View File

@@ -0,0 +1,256 @@
[%# 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): Gervase Markham <gerv@gerv.net>
# Ville Skyttä <ville.skytta@iki.fi>
#%]
[% INCLUDE global/header
title = "Enter Bug"
h2 = "This page lets you enter a new bug into Bugzilla."
%]
<form method="post" action="post_bug.cgi">
<input type="hidden" name="product" value="[% product FILTER html %]" />
<table cellspacing="2" cellpadding="0" border="0">
<tr>
<td><br /></td>
</tr>
<tr>
<td></td>
<td colspan="3">
Before filling this in, please read the
<a href="bugwritinghelp.html">bug-writing guidelines</a>.
</td>
</tr>
<tr>
<td><br /></td>
</tr>
<tr>
<td align="right" valign="top"><strong>Reporter:</strong></td>
<td valign="top">[% reporter FILTER html %]</td>
<td align="right" valign="top"><strong>Product:</strong></td>
<td valign="top">[% product FILTER html %]</td>
</tr>
[%# We can't use the select block in these two cases for various reasons. %]
<tr>
<td align="right" valign="top">
<strong>Version:</strong>
</td>
<td>
<select name="version" size="5">
[%- FOREACH v = version %]
<option value="[% v FILTER html %]"
[% " selected=\"selected\"" IF v == default.version %]>[% v FILTER html -%]
</option>
[%- END %]
</select>
</td>
<td align="right" valign="top">
<strong>
<a href="describecomponents.cgi?product=[% product FILTER uri %]">
Component:</a>
</strong>
</td>
<td>
<select name="component" size="5">
[%- FOREACH c = component_ %]
<option value="[% c FILTER html %]"
[% " selected=\"selected\"" IF c == default.component_ %]>[% c FILTER html -%]
</option>
[%- END %]
</select>
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"></td>
</tr>
<tr>
[% sel = { description => 'Platform', name => 'rep_platform' } %]
[% INCLUDE select %]
[% sel = { description => 'OS', name => 'op_sys' } %]
[% INCLUDE select %]
</tr>
<tr>
[% IF Param('letsubmitterchoosepriority') %]
[% sel = { description => 'Priority', name => 'priority' } %]
[% INCLUDE select %]
[% ELSE %]
<input type="hidden" name="priority" value="[% default.priority %]" />
[% END %]
[% sel = { description => 'Severity', name => 'bug_severity' } %]
[% INCLUDE select %]
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"></td>
</tr>
[% IF bug_status.size > 1 %]
<tr>
[% sel = { description => 'Initial State', name => 'bug_status' } %]
[% INCLUDE select %]
<td colspan="2"></td>
</tr>
[% ELSE %]
<input type="hidden" name="bug_status" value="[% default.bug_status %]" />
[% END %]
<tr>
<td align="right">
<strong>
<a href="bug_status.html#assigned_to">Assigned To:</a>
</strong>
</td>
<td colspan="3">
<input name="assigned_to" size="32"
value="[% assigned_to FILTER html %]" />
(Leave blank to assign to default component owner)
</td>
</tr>
<tr>
<td align="right"><strong>Cc:</strong></td>
<td colspan="3">
<input name="cc" size="45" value="[% cc FILTER html %]" />
</td>
</tr>
<tr>
<td>&nbsp;</td>
<td colspan="3"></td>
</tr>
<tr>
<td align="right"<strong>URL:</strong></td>
<td colspan="3">
<input name="bug_file_loc" size="60"
value="[% bug_file_loc FILTER html %]" />
</td>
</tr>
<tr>
<td align="right"><strong>Summary:</strong></td>
<td colspan="3">
<input name="short_desc" size="60" value="[% short_desc FILTER html %]" />
</td>
</tr>
<tr><td align="right" valign="top"><strong>Description:</strong></td>
<td colspan="3">
<textarea wrap="hard" name="comment" rows="10" cols="80">
[% comment FILTER html %]</textarea>
<br />
</td>
</tr>
<tr>
<td></td>
<td colspan="3">
[% IF group.size %]
<br />
<strong>
Only users in the selected groups can view this bug:
</strong>
<br />
<font size="-1">
(Leave all boxes unchecked to make this a public bug.)
</font>
<br />
<br />
<!-- Checkboxes -->
[% FOREACH g = group %]
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="group-[% g.bit %]" value="1"
[% " checked=\"checked\"" IF g.checked %] />[% g.description %]<br />
[% END %]
<br />
[% END %]
</td>
</tr>
<tr>
<td></td>
<td colspan="3">
<input type="submit" value=" Commit "
onclick="if (this.form.short_desc.value == '')
{ alert('Please enter a summary sentence for this bug.');
return false; } return true;">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="maketemplate"
value="Remember values as bookmarkable template" />
</td>
</tr>
[% IF Param('usebrowserinfo') %]
<tr>
<td></td>
<td colspan="3">
<br />
We've made a guess at your operating system and platform.
Please check them and, if we got it wrong, email
[% Param('maintainer') %].
</td>
</tr>
[% END %]
</table>
<input type="hidden" name="form_name" value="enter_bug" />
</form>
[% INCLUDE global/footer %]
[%############################################################################%]
[%# Block for SELECT fields #%]
[%############################################################################%]
[% BLOCK select %]
[% IF sel.description %]
<td align="right">
<strong>
<a href="bug_status.html#[% sel.name %]">[% sel.description %]:</a>
</strong>
</td>
[% END %]
<td>
<select name="[% sel.name %]">
[%- FOREACH x = ${sel.name} %]
<option value="[% x FILTER html %]"
[% " selected=\"selected\"" IF x == default.${sel.name} %]>[% x FILTER html -%]
</option>
[%- END %]
</select>
</td>
[% END %]

View File

@@ -30,7 +30,7 @@
</p>
<form method="post" action="token.cgi">
<input type="hidden" name="t" value="[% token FILTER html %]">
<input type="hidden" name="t" value=[% token FILTER html %]>
<input type="hidden" name="a" value="chgem">
<table>
<tr>

View File

@@ -28,11 +28,11 @@
%]
<form method="get" action="token.cgi">
<input type="hidden" name="a" value="reqpw">
<input type="hidden" name="loginname" value="[% login FILTER html %]">
<input type="hidden" name="a" value="reqpw" />
<input type="hidden" name="loginname" value="[% login FILTER html %]" />
A Bugzilla account for <tt>[% login FILTER html %]</tt> already exists. If you
are the account holder and have forgotten your password,
<input type="submit" value="submit a request to change it">.
<input type="submit" value="submit a request to change it" />.
</form>
[% PROCESS global/footer.html.tmpl %]

View File

@@ -26,27 +26,27 @@
</p>
<form method="post" action="token.cgi">
<input type="hidden" name="t" value="[% token FILTER html %]">
<input type="hidden" name="a" value="chgpw">
<input type="hidden" name="t" value="[% token FILTER html %]" />
<input type="hidden" name="a" value="chgpw" />
<table>
<tr>
<th align="right">New Password:</th>
<td>
<input type="password" name="password" size="16" maxlength="16">
<input type="password" name="password" size="16" maxlength="16" />
</td>
</tr>
<tr>
<th align="right">New Password Again:</th>
<td>
<input type="password" name="matchpassword" size="16" maxlength="16">
<input type="password" name="matchpassword" size="16" maxlength="16" />
</td>
</tr>
<tr>
<th align="right">&nbsp;</th>
<td>
<input type="submit" value="Submit">
<input type="submit" value="Submit" />
</td>
</tr>
</table>

View File

@@ -36,8 +36,8 @@
<th align="right">Password:</th>
<td>
<input type="hidden" name="Bugzilla_login"
value="[% login FILTER html %]">
<input type="password" name="Bugzilla_password">
value="[% login FILTER html %]" />
<input type="password" name="Bugzilla_password" />
</td>
</tr>
<tr>
@@ -47,21 +47,21 @@
<tr>
<th align="right">New password:</th>
<td>
<input type="password" name="new_password1">
<input type="password" name="new_password1" />
</td>
</tr>
<tr>
<th align="right">Re-enter new password:</th>
<td>
<input type="password" name="new_password2">
<input type="password" name="new_password2" />
</td>
</tr>
<tr>
<th align="right">Your real name (optional, but encouraged):</th>
<td>
<input size="35" name="realname" value="[% realname FILTER html %]">
<input size="35" name="realname" value="[% realname FILTER html %]" />
</td>
</tr>

View File

@@ -35,7 +35,7 @@
[% IF Param('supportwatchers') %]
<tr>
<td colspan="4">
<hr>
<hr />
</td>
</tr>
@@ -52,7 +52,7 @@
<tr>
<th align="right">Users to watch:</th>
<td>
<input size="35" name="watchedusers" value="[% watchedusers %]">
<input size="35" name="watchedusers" value="[% watchedusers %]" />
</td>
</tr>
[% END %]
@@ -68,7 +68,7 @@
</tr>
</table>
<hr>
<hr />
<table>
<tr>
@@ -88,7 +88,7 @@
</tr>
</table>
<hr>
<hr />
<b>Field/recipient specific options:</b>
<br>
<br>

View File

@@ -39,7 +39,7 @@
</td>
</tr>
<input type="hidden" name="numqueries" value="[% queries.size %]">
<input type="hidden" name="numqueries" value="[% queries.size %]" />
[% IF queries.size %]
[% FOREACH query = queries %]
<tr>
@@ -56,7 +56,7 @@
</tr>
<input type="hidden" name="name-[% loop.index %]"
value="[% query.name FILTER html %]">
value="[% query.name FILTER html %]" />
[% END %]
[% ELSE %]

View File

@@ -43,7 +43,7 @@
[% IF set_bits.size %]
And you can turn on or off the following bits for
<a href="editusers.cgi">other users</a>:
<a HREF="editusers.cgi">other users</a>:
<p>
<ul>
[% FOREACH bit_description = set_bits %]

View File

@@ -71,7 +71,7 @@
</td>
[% ELSE %]
<td align="center" bgcolor="#BBBBEE" class="unselected_tab">
<a href="userprefs.cgi?tab=[% tab.name %]">[% tab.description %]</a>
<a HREF="userprefs.cgi?tab=[% tab.name %]">[% tab.description %]</a>
</td>
[% END %]
[% END %]

View File

@@ -83,7 +83,7 @@
[% IF attachments.size %]
[% FOREACH attachment = attachments %]
<input type="checkbox" name="obsolete" value="[% attachment.id %]">
<a href="attachment.cgi?id=[% attachment.id %]&amp;action=edit">[% attachment.id %]: [% attachment.description FILTER html %]</a><br>
<a href="attachment.cgi?id=[% attachment.id %]&action=edit">[% attachment.id %]: [% attachment.description FILTER html %]</a><br>
[% END %]
[% ELSE %]
[no attachments can be made obsolete]

View File

@@ -38,7 +38,7 @@
<tr>
<td>
<h2>
<a title="[% description FILTER html %]" href="attachment.cgi?id=[% attachid %]&amp;action=edit">Attachment #[% attachid %]</a>
<a title="[% description FILTER html %]" href="attachment.cgi?id=[% attachid %]&action=edit">Attachment #[% attachid %]</a>
to <a href="show_bug.cgi?id=[% bugid %]">Bug #[% bugid %]</a> Created
</h2>
@@ -49,7 +49,7 @@
<b>Note:</b> Bugzilla automatically detected the content type
<em>[% contenttype %]</em> for this attachment. If this is
incorrect, correct the value by
<a href="attachment.cgi?id=[% attachid %]&amp;action=edit">editing the attachment</a>.
<a href="attachment.cgi?id=[% attachid %]&action=edit">editing the attachment</a>.
</p>
[% END %]
</td>
@@ -60,7 +60,7 @@
</table>
<p>
<a href="attachment.cgi?bugid=[% bugid %]&amp;action=enter">Create Another Attachment to Bug #[% bugid %]</a>
<a href="attachment.cgi?bugid=[% bugid %]&action=enter">Create Another Attachment to Bug #[% bugid %]</a>
</p>
[% PROCESS global/footer.html.tmpl %]

View File

@@ -182,9 +182,9 @@
[% IF isviewable %]
<td width="75%">
<textarea id="editFrame" name="comment" style="height: 400px; width: 100%; display: none;" cols="80" wrap="soft"></textarea>
<iframe id="viewFrame" src="attachment.cgi?id=[% attachid %]&amp;action=view" style="height: 400px; width: 100%;">
<iframe id="viewFrame" src="attachment.cgi?id=[% attachid %]&action=view" style="height: 400px; width: 100%;">
<b>You cannot view the attachment while editing it because your browser does not support IFRAMEs.
<a href="attachment.cgi?id=[% attachid %]&amp;action=view">View the attachment on a separate page</a>.</b>
<a href="attachment.cgi?id=[% attachid %]&action=view">View the attachment on a separate page</a>.</b>
</iframe>
<script type="application/x-javascript" language="JavaScript">
<!--
@@ -200,7 +200,7 @@
<td id="noview" width="50%">
<p><b>
Attachment cannot be viewed because its MIME type is not either text/*, image/*, or application/vnd.mozilla.*.
<a href="attachment.cgi?id=[% attachid %]&amp;action=view">Download the attachment instead</a>.
<a href="attachment.cgi?id=[% attachid %]&action=view">Download the attachment instead</a>.
</b></p>
</td>
[% END %]
@@ -214,7 +214,7 @@
[% IF a == attachid %]
#[% a %]
[% ELSE %]
<a href="attachment.cgi?id=[% a %]&amp;action=edit">#[% a %]</a>
<a href="attachment.cgi?id=[% a %]&action=edit">#[% a %]</a>
[% END %]
[% "|" UNLESS loop.last() %]
[% END %]

View File

@@ -73,15 +73,15 @@
</td>
<td valign="top">
<a href="attachment.cgi?id=[% a.attachid %]&amp;action=edit">Edit</a>
<a href="attachment.cgi?id=[% a.attachid %]&action=edit">Edit</a>
</td>
</tr>
</table>
[% IF a.isviewable %]
<iframe src="attachment.cgi?id=[% a.attachid %]&amp;action=view" width="75%" height="350">
<iframe src="attachment.cgi?id=[% a.attachid %]&action=view" width="75%" height="350">
<b>You cannot view the attachment on this page because your browser does not support IFRAMEs.
<a href="attachment.cgi?id=[% a.attachid %]&amp;action=view">View the attachment on a separate page</a>.</b>
<a href="attachment.cgi?id=[% a.attachid %]&action=view">View the attachment on a separate page</a>.</b>
</iframe>
[% ELSE %]
<p><b>

View File

@@ -37,7 +37,7 @@
<tr>
<td>
<h2>Changes to
<a href="attachment.cgi?id=[% attachid %]&amp;action=edit">attachment [% attachid %]</a>
<a href="attachment.cgi?id=[% attachid %]&action=edit">attachment [% attachid %]</a>
of bug [% bugid %] submitted
</h2>
[% mailresults %]

View File

@@ -29,7 +29,7 @@
[% PROCESS global/header.html.tmpl
title = "Changes made to bug $bug_id"
h1 = "Activity log"
h2 = "Bug <a href=\"show_bug.cgi?id=$bug_id\">$bug_id</a>"
h2 = "Bug <a href='show_bug.cgi?id=$bug_id'>$bug_id</a>"
%]
<br>

View File

@@ -34,8 +34,8 @@
Display bugs as XML by entering a list of bug numbers here:
</td>
<td>
<input name="id" size="30">
<input type="submit" value="Display as XML">
<input name="id" size="30" />
<input type="submit" value="Display as XML" />
</td>
</tr>

View File

@@ -26,7 +26,7 @@
%]
<form method="post" action="post_bug.cgi">
<input type="hidden" name="product" value="[% product FILTER html %]">
<input type="hidden" name="product" value="[% product FILTER html %]" />
<table cellspacing="2" cellpadding="0" border="0">
@@ -105,7 +105,7 @@
[% sel = { description => 'Priority', name => 'priority' } %]
[% INCLUDE select %]
[% ELSE %]
<input type="hidden" name="priority" value="[% default.priority %]">
<input type="hidden" name="priority" value="[% default.priority %]" />
[% END %]
[% sel = { description => 'Severity', name => 'bug_severity' } %]
@@ -125,7 +125,7 @@
<td colspan="2"></td>
</tr>
[% ELSE %]
<input type="hidden" name="bug_status" value="[% default.bug_status %]">
<input type="hidden" name="bug_status" value="[% default.bug_status %]" />
[% END %]
<tr>
@@ -136,7 +136,7 @@
</td>
<td colspan="3">
<input name="assigned_to" size="32"
value="[% assigned_to FILTER html %]">
value="[% assigned_to FILTER html %]" />
(Leave blank to assign to default component owner)
</td>
</tr>
@@ -144,7 +144,7 @@
<tr>
<td align="right"><strong>Cc:</strong></td>
<td colspan="3">
<input name="cc" size="45" value="[% cc FILTER html %]">
<input name="cc" size="45" value="[% cc FILTER html %]" />
</td>
</tr>
@@ -157,14 +157,14 @@
<td align="right"<strong>URL:</strong></td>
<td colspan="3">
<input name="bug_file_loc" size="60"
value="[% bug_file_loc FILTER html %]">
value="[% bug_file_loc FILTER html %]" />
</td>
</tr>
<tr>
<td align="right"><strong>Summary:</strong></td>
<td colspan="3">
<input name="short_desc" size="60" value="[% short_desc FILTER html %]">
<input name="short_desc" size="60" value="[% short_desc FILTER html %]" />
</td>
</tr>
@@ -194,8 +194,8 @@
<!-- Checkboxes -->
[% FOREACH g = group %]
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="group-[% g.bit %]" value="1"
[% " checked=\"checked\"" IF g.checked %]>[% g.description %]<br>
<input type="checkbox" name="bit-[% g.bit %]" value="1"
[% " checked=\"checked\"" IF g.checked %] />[% g.description %]<br />
[% END %]
<br>
[% END %]
@@ -211,7 +211,7 @@
return false; } return true;">
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="submit" name="maketemplate"
value="Remember values as bookmarkable template">
value="Remember values as bookmarkable template" />
</td>
</tr>

View File

@@ -0,0 +1,21 @@
[%# 1.0@bugzilla.org %]
[%# 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): Gervase Markham <gerv@gerv.net>
#%]
[% form.comment %]

View File

@@ -38,7 +38,7 @@
[% IF NOT multiple_bugs AND NOT doall %]
[% title = "$title for bug $bug_id"
h1 = "$h1 for bug <a href=\"show_bug.cgi?id=$bug_id\">$bug_id</a>"
h1 = "$h1 for bug <a href='show_bug.cgi?id=$bug_id'>$bug_id</a>"
%]
[% END %]
@@ -54,7 +54,7 @@
<img src="[% image_url %]" usemap="#imagemap">
[% ELSE %]
<a href="[% map_url %]">
<img src="[% image_url %]" ismap="ismap">
<img src="[% image_url %]" ismap>
</a>
[% END %]

View File

@@ -116,7 +116,7 @@
</td>
<td rowspan="4" valign="top">
[% IF bug.cc %]
<select name="cc" multiple="multiple" size="5">
<select name="cc" multiple size="5">
[% FOREACH c = bug.cc %]
<option value="[% c FILTER html %]">[% c FILTER html %]</option>
[% END %]
@@ -288,9 +288,9 @@
</th>
<td>
[% bug.votes %]&nbsp;&nbsp;&nbsp;
<a href="votes.cgi?action=show_bug&amp;bug_id=[% bug.bug_id %]">Show
<a href="votes.cgi?action=show_bug&bug_id=[% bug.bug_id %]">Show
votes for this bug</a>&nbsp;&nbsp;&nbsp;
<a href="votes.cgi?action=show_user&amp;bug_id=[% bug.bug_id %]">Vote
<a href="votes.cgi?action=show_user&bug_id=[% bug.bug_id %]">Vote
for this bug</a>
</td>
</tr>
@@ -316,9 +316,9 @@
[% FOREACH group = groups %]
&nbsp;&nbsp;&nbsp;&nbsp;
<input type="checkbox" name="group-[% group.bit %]" value="1"
[% " checked=\"checked\"" IF group.ison %]
[% " disabled=\"disabled\"" IF NOT group.ingroup %]>
<input type="checkbox" name="bit-[% group.bit %]" value="1"
[% " checked='checked'" IF group.ison %]
[% " disabled='disabled'" IF NOT group.ingroup %]>
[% group.description %]
<br>
[% END %]
@@ -357,7 +357,7 @@
[%# *** Knob *** %]
<br>
<input type="radio" name="knob" value="none" checked="checked">
<input type="radio" name="knob" value="none" checked>
Leave as <b>[% bug.bug_status FILTER html %]&nbsp;
[% bug.resolution FILTER html %]</b>
<br>
@@ -410,7 +410,7 @@
[% knum = knum + 1 %]
<input type="radio" name="knob" value="reassign">
<a href="bug_status.html#assigned_to">Reassign</a> bug to
<a href="bug_status.html#assigned_to">Reassign</A> bug to
<input name="assigned_to" size="32"
onchange="if ((this.value != '[% bug.assigned_to_email FILTER js %]') &&
(this.value != '')) {

View File

@@ -86,7 +86,7 @@
<p>
<input type="radio" name="addtonewgroup" value="no"><b>no</b><br>
<input type="radio" name="addtonewgroup" value="yes"><b>yes</b><br>
<input type="radio" name="addtonewgroup" value="yesifinold" checked="checked">
<input type="radio" name="addtonewgroup" value="yesifinold" checked>
<b>yes, but only if the bug was in its old product's group</b><br>
</p>
[% END %]

View File

@@ -104,7 +104,7 @@
<tr>
<td colspan="4">
<b>URL:</b>&nbsp;
<a href="[% bug.bug_file_loc %]">[% bug.bug_file_loc FILTER html %]</a>
<A HREF="[% bug.bug_file_loc %]">[% bug.bug_file_loc FILTER html %]</a>
</tr>
<tr>

View File

@@ -29,7 +29,7 @@
[% PROCESS global/header.html.tmpl
title = "Show Votes"
h2 = "Bug <a href=\"show_bug.cgi?id=$bug_id\">$bug_id</a>"
h2 = "Bug <a href='show_bug.cgi?id=$bug_id'>$bug_id</a>"
%]
<table cellspacing="4">
@@ -41,7 +41,7 @@
[% FOREACH user = users %]
<tr>
<td>
<a href="votes.cgi?action=show_user&amp;user=[% user.name %]">
<a href="votes.cgi?action=show_user&user=[% user.name %]">
[% user.name %]
</a>
</td>

View File

@@ -73,7 +73,7 @@
[% "</strike>" IF NOT bug.opened %]
</td>
<td>
<a href="votes.cgi?action=show_bug&amp;bug_id=[% bug.id %]">
<a href="votes.cgi?action=show_bug&bug_id=[% bug.id %]">
[% bug.summary FILTER html %]
</a>
</td>

View File

@@ -91,7 +91,7 @@
<td valign="top" align="left">
<table border="0" cellpadding="0" cellspacing="2">
<tr>
<td valign="top" align="left" nowrap="nowrap">
<td valign="top" align="left" nowrap>
<font size="+1"><b>[% h1 %]</b></font>
</td>
</tr>

View File

@@ -78,7 +78,7 @@ function addSidebar() {
</p>
</form>
</td>
<td align="right"><img src="ant.jpg" width="329" height="220" border="2" alt="ant.jpg [8.5k]"></td>
<td align="right"><img src="ant.jpg" width=329 height=220 border=2 alt="ant.jpg [8.5k]"></td>
</tr></table>
<script type="text/javascript" language="JavaScript" src="localconfig.js"></script>

View File

@@ -28,11 +28,11 @@
item.checked = value;
}
}
document.write(' <input type="button" name="uncheck_all" value="Uncheck All" onclick="SetCheckboxes(false);">');
document.write(' <input type="button" name="check_all" value="Check All" onclick="SetCheckboxes(true);">');
document.write(' <input type="button" value="Uncheck All" onclick="SetCheckboxes(false);">');
document.write(' <input type="button" value="Check All" onclick="SetCheckboxes(true);">');
</script>
<hr>
<hr />
<p><font size="-1">
To change multiple bugs:
@@ -162,24 +162,24 @@
<input type="hidden" name="multiupdate" value="Y">
<label for="comment"><b>Additional Comments:</b></label><br>
<textarea id="comment" name="comment" rows="5" cols="80" wrap="hard"></textarea><br>
<label for="comment"><b>Additional Comments:</b></label><br />
<textarea id="comment" name="comment" rows="5" cols="80" wrap="hard"></textarea><br />
[% IF groups.size > 0 %]
<b>Groupset:</b><br>
<b>Groupset:</b><br />
<table border="1">
<tr>
<th>Don&apos;t<br>change<br>this group<br>restriction</td>
<th>Remove<br>bugs<br>from this<br>group</td>
<th>Add<br>bugs<br>to this<br>group</td>
<th>Don't<br />change<br />this group<br />restriction</td>
<th>Remove<br />bugs<br />from this<br />group</td>
<th>Add<br />bugs<br />to this<br />group</td>
<th>Group Name:</td>
</tr>
[% FOREACH group = groups %]
<tr>
<td align="center">
<input type="radio" name="bit-[% group.bit %]" value="-1" checked="checked">
<input type="radio" name="bit-[% group.bit %]" value="-1" checked>
</td>
<td align="center">
<input type="radio" name="bit-[% group.bit %]" value="0">
@@ -208,7 +208,7 @@
[% IF foundinactive %]
<font size="-1">(Note: Bugs may not be added to <strike>inactive
groups</strike>, only removed.)</font><br>
groups</strike>, only removed.)</font><br />
[% END %]
[% END %]
@@ -216,33 +216,33 @@
[% knum = 0 %]
<input id="knob-none" type="radio" name="knob" value="none" checked="checked">
<label for="knob-none">Do nothing else</label><br>
<input id="knob-none" type="radio" name="knob" value="none" CHECKED>
<label for="knob-none">Do nothing else</label><br />
[% IF bugstatuses.size == 1 && bugstatuses.0 == unconfirmedstate %]
[% knum = knum + 1 %]
<input id="knob-confirm" type="radio" name="knob" value="confirm">
<label for="knob-confirm">
Confirm bugs (change status to <b>NEW</b>)
</label><br>
</label><br />
[% END %]
[% knum = knum + 1 %]
<input id="knob-accept" type="radio" name="knob" value="accept">
<label for="knob-accept">
Accept bugs (change status to <b>ASSIGNED</b>)
</label><br>
</label><br />
[%# If all the bugs being changed are open, allow the user to close them. %]
[% IF !bugstatuses.containsany(closedstates) %]
[% knum = knum + 1 %]
<input id="knob-clearresolution" type="radio" name="knob" value="clearresolution">
<label for="knob-clearresolution">Clear the resolution</label><br>
<label for="knob-clearresolution">Clear the resolution</label><br />
[% knum = knum + 1 %]
<input id="knob-resolve" type="radio" name="knob" value="resolve">
<label for="knob-resolve">
Resolve bugs, changing <a href="bug_status.html">resolution</a> to
Resolve bugs, changing <A HREF="bug_status.html">resolution</A> to
</label>
<select name="resolution" onchange="document.forms.changeform.knob[[% knum %]].checked=true">
[% FOREACH resolution = resolutions %]
@@ -251,7 +251,7 @@
[% resolution FILTER html %]
</option>
[% END %]
</select><br>
</select><br />
[% END %]
@@ -259,30 +259,30 @@
[% IF !bugstatuses.containsany(openstates) %]
[% knum = knum + 1 %]
<input id="knob-reopen" type="radio" name="knob" value="reopen">
<label for="knob-reopen">Reopen bugs</label><br>
<label for="knob-reopen">Reopen bugs</label><br />
[% END %]
[% IF bugstatuses.size == 1 %]
[% IF bugstatuses.contains('RESOLVED') %]
[% knum = knum + 1 %]
<input id="knob-verify" type="radio" name="knob" value="verify">
<label for="knob-verify">Mark bugs as <b>VERIFIED</b></label><br>
<label for="knob-verify">Mark bugs as <b>VERIFIED</b></label><br />
[% ELSIF bugstatuses.contains('VERIFIED') %]
[% knum = knum + 1 %]
<input id="knob-close" type="radio" name="knob" value="close">
<label for="knob-close">Mark bugs as <b>CLOSED</b></label><br>
<label for="knob-close">Mark bugs as <b>CLOSED</b></label><br />
[% END %]
[% END %]
[% knum = knum + 1 %]
<input id="knob-reassign" type="radio" name="knob" value="reassign">
<label for="knob-reassign"><a href="bug_status.html#assigned_to">
Reassign</a> bugs to
Reassign</A> bugs to
</label>
<input name="assigned_to"
value="[% user.login FILTER html %]"
onchange="document.forms.changeform.knob[[% knum %]].checked = true;"
size="32"><br>
size="32"><br />
[% knum = knum + 1 %]
<input id="knob-reassignbycomponent"
@@ -291,7 +291,7 @@
value="reassignbycomponent">
<label for="knob-reassignbycomponent">
Reassign bugs to owner of selected component
</label><br>
</label><br />
<input type="submit" value="Commit">
@@ -306,7 +306,7 @@
[% BLOCK selectmenu %]
<select id="[% menuname %]" name="[% menuname %]">
<option value="[% dontchange FILTER html %]" selected="selected">
<option value="[% dontchange FILTER html %]" selected>
[% dontchange FILTER html %]
</option>
[% FOREACH menuitem = menuitems %]

View File

@@ -39,7 +39,7 @@
<head>
<title>[% title %]</title>
<link href="css/buglist.css" rel="stylesheet" type="text/css">
<link href="css/buglist.css" rel="stylesheet" type="text/css" />
</head>
<body>

View File

@@ -38,7 +38,7 @@
%]
<div align="center">
<b>[% currenttime %]</b><br>
<b>[% currenttime %]</b><br />
[% IF debug %]
<p>[% query FILTER html %]</p>
@@ -57,7 +57,7 @@
</h2>
[% END %]
<hr>
<hr />
[%############################################################################%]
@@ -105,7 +105,7 @@
[% END %]
<br>
<br />
[%############################################################################%]
@@ -118,7 +118,7 @@
</form>
<hr>
<hr />
[% END %]

View File

@@ -46,10 +46,10 @@
</p>
<form method="post" action="quips.cgi">
<input type="hidden" name="action" value="add">
<input size="80" name="quip">
<input type="hidden" name="action" value="add" />
<input size="80" name="quip" />
<p>
<input type="submit" value="Add This Quip">
<input type="submit" value="Add This Quip" />
</p>
</form>

View File

@@ -55,7 +55,7 @@
[% INCLUDE describe_comp %]
[% END %]
<tr>
<td colspan="[% numcols %]">
<td colspan='[% numcols %]'>
<hr>
</td>
</tr>
@@ -75,7 +75,7 @@
</td>
</tr>
<tr>
<td rowspan="2">
<td rowspan='2'>
<a name="[% comp.name FILTER html %]">[% comp.name FILTER html %]</a>
</td>
<td>

View File

@@ -44,7 +44,7 @@
[%# *** Column Headers *** %]
<table border>
<tr bgcolor="#CCCCCC">
<tr BGCOLOR="#CCCCCC">
[% FOREACH column = [ { name => "id", description => "Bug #" },
{ name => "count", description => "Dupe<br>Count" },
{ name => "delta",
@@ -111,7 +111,7 @@
<td>
<center>
[% "<strike>" IF bug.resolution != "" %]
<a href="show_bug.cgi?id=[% bug.id %]">[% bug.id %]</a>
<A HREF="show_bug.cgi?id=[% bug.id %]">[% bug.id %]</a>
[% "</strike>" IF bug.resolution != "" %]
</center>
</td>

View File

@@ -59,8 +59,8 @@
<h3><a name="params">Change Parameters</a></h3>
<form method="get" action="duplicates.cgi">
<input type="hidden" name="sortby" value="[% sortby %]">
<input type="hidden" name="reverse" value="[% reverse %]">
<input type="hidden" name="sortby" value="[% sortby %]" />
<input type="hidden" name="reverse" value="[% reverse %]" />
<input type="hidden" name="bug_id" value="[% bug_ids_string %]">
<table>
<tr>
@@ -68,20 +68,20 @@
work with:</td>
<td>
<input type="radio" name="sortvisible" id="entirelist" value="0"
[% "checked" IF NOT sortvisible %]>
[% "checked" IF NOT sortvisible %] />
<label for="entirelist">
entire list
</label>
<br>
<br />
<input type="radio" name="sortvisible" id="visiblelist" value="1"
[% "checked" IF sortvisible %]>
[% "checked" IF sortvisible %] />
<label for="visiblelist">
currently visible list
</label>
</td>
<td rowspan="4" valign="top">Restrict to products:</td>
<td rowspan="4" valign="top">
<select name="product" size="5" multiple="multiple">
<select name="product" size="5" multiple>
[% FOREACH p = products %]
<option name="[% p %]"
[% " selected" IF product == p %]>[% p %]</option>
@@ -93,14 +93,14 @@
<tr>
<td>Max rows:</td>
<td>
<input size="4" name="maxrows" value="[% maxrows %]">
<input size="4" name="maxrows" value="[% maxrows %]" />
</td>
</tr>
<tr>
<td>Change column is change in the last:</td>
<td>
<input size="4" name="changedsince" value="[% changedsince %]"> days
<input size="4" name="changedsince" value="[% changedsince %]" /> days
</td>
</tr>
@@ -112,13 +112,13 @@
</td>
<td>
<input type="checkbox" name="openonly" id="openonly" value="1"
[% "checked" IF openonly %]>
[% "checked" IF openonly %] />
</td>
</tr>
</table>
<input type="submit" value="Change">
<input type="submit" value="Change" />
</form>
<form method="post" action="buglist.cgi">
@@ -128,7 +128,7 @@
(Note: the order may not be the same.)
</form>
<hr>
<hr />
<b>
<a name="explanation">What are "Most Frequently Reported Bugs"?</a>

View File

@@ -368,7 +368,7 @@ function selectProduct(f) {
[%# Can't use the select block here because of onChange and the fact that
'component' is a toolkit reserved word - we use 'component_' instead. %]
<td align="left">
<select name="product" multiple="multiple" size="5" onchange="selectProduct(this.form);">
<select name="product" multiple size="5" onChange="selectProduct(this.form);">
[% FOREACH p = product %]
<option value="[% p FILTER html %]"
[% " selected" IF lsearch(default.product, p) != -1 %]>
@@ -378,7 +378,7 @@ function selectProduct(f) {
</td>
<td align="left">
<select name="component" multiple="multiple" size="5">
<select name="component" multiple size="5">
[% FOREACH c = component_ %]
<option value="[% c FILTER html %]"
[% " selected" IF lsearch(default.component, c) != -1 %]>
@@ -618,13 +618,13 @@ function selectProduct(f) {
<dl>
<dt>Only bugs changed in the last </dt>
<dd><input name="changedin" size="3" value="[% default.changedin.0 FILTER html %]"> days</dd>
<dd><input name=changedin size=3 value="[% default.changedin.0 FILTER html %]"> days</dd>
</dl>
<dl>
<dt>Only bugs where any of the fields</dt>
<dd>
<select name="chfield" multiple="multiple" size="4">
<select name="chfield" multiple size="4">
[% FOREACH field = chfield %]
<option value="[% field FILTER html %]"
[% " selected" IF lsearch(default.chfield, field) != -1 %]>
@@ -659,7 +659,7 @@ function selectProduct(f) {
[% BLOCK select %]
<td align="left">
<select name="[% sel.name %]" multiple="multiple" size="[% sel.size %]">
<select name="[% sel.name %]" multiple size="[% sel.size %]">
[% FOREACH name = ${sel.name} %]
<option value="[% name FILTER html %]"
[% " selected" IF lsearch(default.${sel.name}, name) != -1 %]>

View File

@@ -36,7 +36,7 @@
<input type="hidden" name="cmdtype" value="doit">
[% ELSE %]
<br>
<input type="radio" name="cmdtype" value="doit" checked="checked"> Run this query
<input type="radio" name="cmdtype" value="doit" checked> Run this query
<br>
[% IF namedqueries.size > 0 %]

View File

@@ -212,54 +212,12 @@ sub changePassword {
# Update the user's password in the profiles table and delete the token
# from the tokens table.
SendSQL("LOCK TABLE profiles WRITE , tokens WRITE") if $::driver eq 'mysql';
SendSQL("LOCK TABLES profiles WRITE , tokens WRITE");
SendSQL("UPDATE profiles
SET cryptpassword = $quotedpassword
WHERE userid = $userid");
SendSQL("DELETE FROM tokens WHERE token = $::quotedtoken");
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
InvalidateLogins($userid);
$vars->{'title'} = "Password Changed";
$vars->{'message'} = "Your password has been changed.";
print "Content-Type: text/html\n\n";
$template->process("global/message.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
sub changeEmail {
# Get the user's ID from the tokens table.
SendSQL("SELECT userid, eventdata FROM tokens
WHERE token = $::quotedtoken");
my ($userid, $eventdata) = FetchSQLData();
my ($old_email, $new_email) = split(/:/,$eventdata);
my $quotednewemail = SqlQuote($new_email);
# Check the user entered the correct old email address
if($::FORM{'email'} ne $old_email) {
DisplayError("Email Address confirmation failed");
exit;
}
# The new email address should be available as this was
# confirmed initially so cancel token if it is not still available
if (! ValidateNewUser($new_email,$old_email)) {
DisplayError("Account $new_email already exists.");
Token::Cancel($::token,"Account $new_email already exists.");
exit;
}
# Update the user's login name in the profiles table and delete the token
# from the tokens table.
SendSQL("LOCK TABLES profiles WRITE , tokens WRITE") if $::driver eq 'mysql';
SendSQL("UPDATE profiles
SET login_name = $quotednewemail
WHERE userid = $userid");
SendSQL("DELETE FROM tokens WHERE token = $::quotedtoken");
SendSQL("DELETE FROM tokens WHERE userid = $userid
AND tokentype = 'emailnew'");
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
SendSQL("UNLOCK TABLES");
InvalidateLogins($userid);
@@ -282,6 +240,51 @@ sub confirmChangeEmail {
|| ThrowTemplateError($template->error());
}
sub changeEmail {
# Get the user's ID from the tokens table.
SendSQL("SELECT userid, eventdata FROM tokens
WHERE token = $::quotedtoken");
my ($userid, $eventdata) = FetchSQLData();
my ($old_email, $new_email) = split(/:/,$eventdata);
my $quotednewemail = SqlQuote($new_email);
# Check the user entered the correct old email address
if($::FORM{'email'} ne $old_email) {
DisplayError("Email Address confirmation failed");
exit;
}
# The new email address should be available as this was
# confirmed initially so cancel token if it is not still available
if (! ValidateNewUser($new_email,$old_email)) {
DisplayError("Account $new_email already exists.");
Token::Cancel($::token,"Account $new_email already exists.");
exit;
}
# Update the user's login name in the profiles table and delete the token
# from the tokens table.
SendSQL("LOCK TABLES profiles WRITE , tokens WRITE");
SendSQL("UPDATE profiles
SET login_name = $quotednewemail
WHERE userid = $userid");
SendSQL("DELETE FROM tokens WHERE token = $::quotedtoken");
SendSQL("DELETE FROM tokens WHERE userid = $userid
AND tokentype = 'emailnew'");
SendSQL("UNLOCK TABLES");
# Return HTTP response headers.
print "Content-Type: text/html\n\n";
# Let the user know their email address has been changed.
$vars->{'title'} = "Bugzilla Login Changed";
$vars->{'message'} = "Your Bugzilla login has been changed.";
$template->process("global/message.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
}
sub cancelChangeEmail {
# Get the user's ID from the tokens table.
SendSQL("SELECT userid, tokentype, eventdata FROM tokens
@@ -300,11 +303,11 @@ sub cancelChangeEmail {
if($actualemail ne $old_email) {
my $quotedoldemail = SqlQuote($old_email);
SendSQL("LOCK TABLES profiles WRITE") if $::driver eq 'mysql';
SendSQL("LOCK TABLES profiles WRITE");
SendSQL("UPDATE profiles
SET login_name = $quotedoldemail
WHERE userid = $userid");
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
SendSQL("UNLOCK TABLES");
$vars->{'message'} .=
" Your old account settings have been reinstated.";
}
@@ -315,11 +318,11 @@ sub cancelChangeEmail {
}
Token::Cancel($::token, $vars->{'message'});
SendSQL("LOCK TABLES tokens WRITE") if $::driver eq 'mysql';
SendSQL("LOCK TABLES tokens WRITE");
SendSQL("DELETE FROM tokens
WHERE userid = $userid
AND tokentype = 'emailold' OR tokentype = 'emailnew'");
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
SendSQL("UNLOCK TABLES");
# Return HTTP response headers.
print "Content-Type: text/html\n\n";

View File

@@ -66,19 +66,11 @@ sub DoAccount {
$vars->{'realname'} = FetchSQLData();
if(Param('allowemailchange')) {
if ($::driver eq 'mysql') {
SendSQL("SELECT tokentype, issuedate + INTERVAL 3 DAY, eventdata
SendSQL("SELECT tokentype, issuedate + INTERVAL 3 DAY, eventdata
FROM tokens
WHERE userid = $userid
AND tokentype LIKE 'email%'
ORDER BY tokentype ASC LIMIT 1");
} elsif ($::driver eq 'Pg') {
SendSQL("SELECT tokentype, issuedate + INTERVAL '3 days', eventdata
FROM tokens
WHERE userid = $userid
AND tokentype LIKE 'email%'
ORDER BY tokentype ASC LIMIT 1");
}
if(MoreSQLData()) {
my ($tokentype, $change_date, $eventdata) = &::FetchSQLData();
$vars->{'login_change_date'} = $change_date;
@@ -281,7 +273,7 @@ sub SaveEmail {
($CCDELTAS[0] eq "") || SendSQL($CCDELTAS[0]);
($CCDELTAS[1] eq "") || SendSQL($CCDELTAS[1]);
SendSQL("UNLOCK TABLES") if $::driver eq 'mysql';
SendSQL("UNLOCK TABLES");
}
}

View File

@@ -29,6 +29,8 @@ use lib ".";
require "CGI.pl";
use vars qw($usergroupset);
# Use global template variables
use vars qw($template $vars);
@@ -187,7 +189,7 @@ sub show_user {
# and they can see there are votes 'missing', but not on what bug
# they are. This seems a reasonable compromise; the alternative is
# to lie in the totals.
next if !CanSeeBug($id, $who);
next if !CanSeeBug($id, $who, $usergroupset);
push (@bugs, { id => $id,
summary => $summary,
@@ -212,7 +214,7 @@ sub show_user {
SendSQL("DELETE FROM votes WHERE count <= 0");
SendSQL("UNLOCK TABLES");
$vars->{'voting_user'} = { "login" => $name };
$vars->{'user'} = { canedit => $canedit, name => $name, id => $who };
$vars->{'products'} = \@products;
print "Content-type: text/html\n\n";

View File

@@ -33,15 +33,9 @@ require "globals.pl";
ConnectToDatabase();
if ($::driver eq 'mysql') {
SendSQL("select bug_id,login_name from bugs,profiles where " .
"bug_status = 'NEW' and to_days(now()) - to_days(delta_ts) > " .
Param('whinedays') . " and userid=assigned_to order by bug_id");
} elsif ($::driver eq 'Pg') {
SendSQL("select bug_id,login_name from bugs,profiles where " .
"bug_status = 'NEW' and to_days(now()) - to_days(delta_ts) > '" .
Param('whinedays') . " days' and userid=assigned_to order by bug_id");
}
SendSQL("select bug_id,login_name from bugs,profiles where " .
"bug_status = 'NEW' and to_days(now()) - to_days(delta_ts) > " .
Param('whinedays') . " and userid=assigned_to order by bug_id");
my %bugs;
my @row;