1998-09-16 01:49:26 +04:00
|
|
|
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
|
|
|
#
|
1999-11-02 02:33:56 +03:00
|
|
|
# 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.
|
|
|
|
#
|
1998-09-16 01:49:26 +04:00
|
|
|
# The Original Code is the Bugzilla Bug Tracking System.
|
1999-11-02 02:33:56 +03:00
|
|
|
#
|
1998-09-16 01:49:26 +04:00
|
|
|
# The Initial Developer of the Original Code is Netscape Communications
|
1999-11-02 02:33:56 +03:00
|
|
|
# Corporation. Portions created by Netscape are
|
|
|
|
# Copyright (C) 1998 Netscape Communications Corporation. All
|
|
|
|
# Rights Reserved.
|
|
|
|
#
|
1998-09-16 01:49:26 +04:00
|
|
|
# Contributor(s): Terry Weissman <terry@mozilla.org>
|
1999-12-03 02:21:42 +03:00
|
|
|
# Dan Mosedale <dmose@mozilla.org>
|
2000-09-15 22:35:18 +04:00
|
|
|
# Joe Robins <jmrobins@tgix.com>
|
2001-06-08 00:26:40 +04:00
|
|
|
# Dave Miller <justdave@syndicomm.com>
|
2001-08-26 22:51:45 +04:00
|
|
|
# Christopher Aillon <christopher@aillon.com>
|
2001-09-11 01:26:05 +04:00
|
|
|
# Gervase Markham <gerv@gerv.net>
|
2001-10-11 03:36:29 +04:00
|
|
|
# Christian Reis <kiko@async.com.br>
|
1998-09-16 01:49:26 +04:00
|
|
|
|
|
|
|
# Contains some global routines used throughout the CGI scripts of Bugzilla.
|
|
|
|
|
|
|
|
use strict;
|
2001-11-19 01:23:31 +03:00
|
|
|
use lib ".";
|
|
|
|
|
2000-03-10 20:45:09 +03:00
|
|
|
# use Carp; # for confess
|
2000-10-24 04:44:21 +04:00
|
|
|
|
2002-08-19 17:59:45 +04:00
|
|
|
use Bugzilla::Util;
|
2002-08-29 13:25:54 +04:00
|
|
|
use Bugzilla::Config;
|
2003-03-22 07:47:35 +03:00
|
|
|
use Bugzilla::Constants;
|
2003-04-02 16:35:07 +04:00
|
|
|
use Bugzilla::Error;
|
2000-10-24 04:44:21 +04:00
|
|
|
|
2001-11-18 06:54:54 +03:00
|
|
|
# Shut up misguided -w warnings about "used only once". For some reason,
|
|
|
|
# "use vars" chokes on me when I try it here.
|
1999-10-19 03:57:58 +04:00
|
|
|
|
1999-10-19 04:04:59 +04:00
|
|
|
sub CGI_pl_sillyness {
|
1999-10-19 03:57:58 +04:00
|
|
|
my $zz;
|
2003-10-30 04:31:58 +03:00
|
|
|
$zz = $::buffer;
|
1999-10-19 03:57:58 +04:00
|
|
|
}
|
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
use CGI::Carp qw(fatalsToBrowser);
|
|
|
|
|
|
|
|
require 'globals.pl';
|
|
|
|
|
2002-04-04 03:00:29 +04:00
|
|
|
use vars qw($template $vars);
|
|
|
|
|
2002-02-03 12:28:48 +03:00
|
|
|
# If Bugzilla is shut down, do not go any further, just display a message
|
|
|
|
# to the user about the downtime. (do)editparams.cgi is exempted from
|
|
|
|
# this message, of course, since it needs to be available in order for
|
|
|
|
# the administrator to open Bugzilla back up.
|
2003-10-07 23:15:35 +04:00
|
|
|
if (Param("shutdownhtml") && $0 !~ m:(^|[\\/])(do)?editparams\.cgi$:) {
|
2002-08-20 02:34:32 +04:00
|
|
|
$::vars->{'message'} = "shutdown";
|
2002-02-03 12:28:48 +03:00
|
|
|
|
|
|
|
# Return the appropriate HTTP response headers.
|
2003-05-05 05:15:38 +04:00
|
|
|
print Bugzilla->cgi->header();
|
2002-02-03 12:28:48 +03:00
|
|
|
|
|
|
|
# Generate and return an HTML message about the downtime.
|
|
|
|
$::template->process("global/message.html.tmpl", $::vars)
|
2002-04-24 11:24:50 +04:00
|
|
|
|| ThrowTemplateError($::template->error());
|
2002-02-03 12:28:48 +03:00
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
# Implementations of several of the below were blatently stolen from CGI.pm,
|
|
|
|
# by Lincoln D. Stein.
|
|
|
|
|
|
|
|
# Get rid of all the %xx encoding and the like from the given URL.
|
|
|
|
sub url_decode {
|
|
|
|
my ($todecode) = (@_);
|
|
|
|
$todecode =~ tr/+/ /; # pluses become spaces
|
|
|
|
$todecode =~ s/%([0-9a-fA-F]{2})/pack("c",hex($1))/ge;
|
|
|
|
return $todecode;
|
|
|
|
}
|
|
|
|
|
1999-12-03 02:21:42 +03:00
|
|
|
# check and see if a given field exists, is non-empty, and is set to a
|
|
|
|
# legal value. assume a browser bug and abort appropriately if not.
|
|
|
|
# if $legalsRef is not passed, just check to make sure the value exists and
|
|
|
|
# is non-NULL
|
|
|
|
sub CheckFormField (\%$;\@) {
|
|
|
|
my ($formRef, # a reference to the form to check (a hash)
|
|
|
|
$fieldname, # the fieldname to check
|
|
|
|
$legalsRef # (optional) ref to a list of legal values
|
|
|
|
) = @_;
|
|
|
|
|
|
|
|
if ( !defined $formRef->{$fieldname} ||
|
|
|
|
trim($formRef->{$fieldname}) eq "" ||
|
|
|
|
(defined($legalsRef) &&
|
|
|
|
lsearch($legalsRef, $formRef->{$fieldname})<0) ){
|
|
|
|
|
2001-10-20 04:50:27 +04:00
|
|
|
SendSQL("SELECT description FROM fielddefs WHERE name=" . SqlQuote($fieldname));
|
|
|
|
my $result = FetchOneColumn();
|
2003-09-14 10:05:23 +04:00
|
|
|
my $field;
|
2001-10-20 04:50:27 +04:00
|
|
|
if ($result) {
|
2003-09-14 10:05:23 +04:00
|
|
|
$field = $result;
|
2001-10-20 04:50:27 +04:00
|
|
|
}
|
|
|
|
else {
|
2003-09-14 10:05:23 +04:00
|
|
|
$field = $fieldname;
|
2001-10-20 04:50:27 +04:00
|
|
|
}
|
2002-08-15 10:43:47 +04:00
|
|
|
|
2003-09-14 10:05:23 +04:00
|
|
|
ThrowCodeError("illegal_field", { field => $field }, "abort");
|
1999-12-03 02:21:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
# check and see if a given field is defined, and abort if not
|
|
|
|
sub CheckFormFieldDefined (\%$) {
|
|
|
|
my ($formRef, # a reference to the form to check (a hash)
|
|
|
|
$fieldname, # the fieldname to check
|
|
|
|
) = @_;
|
|
|
|
|
2002-04-29 01:57:10 +04:00
|
|
|
if (!defined $formRef->{$fieldname}) {
|
2003-10-16 22:26:09 +04:00
|
|
|
ThrowCodeError("undefined_field", { field => $fieldname });
|
2002-08-15 10:43:47 +04:00
|
|
|
}
|
1999-12-03 02:21:42 +03:00
|
|
|
}
|
1999-04-08 18:40:46 +04:00
|
|
|
|
2002-07-04 03:07:14 +04:00
|
|
|
sub BugAliasToID {
|
|
|
|
# Queries the database for the bug with a given alias, and returns
|
|
|
|
# the ID of the bug if it exists or the undefined value if it doesn't.
|
|
|
|
|
|
|
|
my ($alias) = @_;
|
|
|
|
|
|
|
|
return undef unless Param("usebugaliases");
|
|
|
|
|
|
|
|
PushGlobalSQLState();
|
|
|
|
SendSQL("SELECT bug_id FROM bugs WHERE alias = " . SqlQuote($alias));
|
|
|
|
my $id = FetchOneColumn();
|
|
|
|
PopGlobalSQLState();
|
|
|
|
|
|
|
|
return $id;
|
|
|
|
}
|
|
|
|
|
2001-05-31 19:52:25 +04:00
|
|
|
sub ValidateBugID {
|
2001-06-03 02:02:02 +04:00
|
|
|
# Validates and verifies a bug ID, making sure the number is a
|
|
|
|
# positive integer, that it represents an existing bug in the
|
|
|
|
# database, and that the user is authorized to access that bug.
|
2002-01-20 04:44:52 +03:00
|
|
|
# We detaint the number here, too
|
2001-06-03 02:02:02 +04:00
|
|
|
|
2002-07-04 03:07:14 +04:00
|
|
|
my ($id, $skip_authorization) = @_;
|
|
|
|
|
|
|
|
# Get rid of white-space around the ID.
|
|
|
|
$id = trim($id);
|
|
|
|
|
|
|
|
# If the ID isn't a number, it might be an alias, so try to convert it.
|
2002-07-06 22:27:18 +04:00
|
|
|
my $alias = $id;
|
|
|
|
if (!detaint_natural($id)) {
|
|
|
|
$id = BugAliasToID($alias);
|
2002-09-29 01:44:27 +04:00
|
|
|
$id || ThrowUserError("invalid_bug_id_or_alias", {'bug_id' => $id});
|
2002-07-04 03:07:14 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
# Modify the calling code's original variable to contain the trimmed,
|
|
|
|
# converted-from-alias ID.
|
|
|
|
$_[0] = $id;
|
|
|
|
|
2001-10-23 19:44:53 +04:00
|
|
|
# First check that the bug exists
|
|
|
|
SendSQL("SELECT bug_id FROM bugs WHERE bug_id = $id");
|
2001-08-13 04:46:20 +04:00
|
|
|
|
2001-10-23 19:44:53 +04:00
|
|
|
FetchOneColumn()
|
2002-09-29 01:44:27 +04:00
|
|
|
|| ThrowUserError("invalid_bug_id_non_existent", {'bug_id' => $id});
|
2001-08-26 22:51:45 +04:00
|
|
|
|
2002-07-04 03:07:14 +04:00
|
|
|
return if $skip_authorization;
|
|
|
|
|
2002-09-22 21:15:13 +04:00
|
|
|
return if CanSeeBug($id, $::userid);
|
2001-08-13 04:46:20 +04:00
|
|
|
|
|
|
|
# The user did not pass any of the authorization tests, which means they
|
|
|
|
# are not authorized to see the bug. Display an error and stop execution.
|
|
|
|
# The error the user sees depends on whether or not they are logged in
|
2001-10-23 19:44:53 +04:00
|
|
|
# (i.e. $::userid contains the user's positive integer ID).
|
|
|
|
if ($::userid) {
|
2002-09-29 01:44:27 +04:00
|
|
|
ThrowUserError("bug_access_denied", {'bug_id' => $id});
|
2001-08-13 04:46:20 +04:00
|
|
|
} else {
|
2002-09-29 01:44:27 +04:00
|
|
|
ThrowUserError("bug_access_query", {'bug_id' => $id});
|
2001-08-13 04:46:20 +04:00
|
|
|
}
|
2001-05-31 19:52:25 +04:00
|
|
|
}
|
|
|
|
|
2002-03-11 10:33:03 +03:00
|
|
|
sub ValidateComment {
|
|
|
|
# Make sure a comment is not too large (greater than 64K).
|
|
|
|
|
|
|
|
my ($comment) = @_;
|
|
|
|
|
|
|
|
if (defined($comment) && length($comment) > 65535) {
|
2002-09-29 01:44:27 +04:00
|
|
|
ThrowUserError("comment_too_long");
|
2002-03-11 10:33:03 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
sub PasswordForLogin {
|
|
|
|
my ($login) = (@_);
|
|
|
|
SendSQL("select cryptpassword from profiles where login_name = " .
|
2001-10-13 05:36:17 +04:00
|
|
|
SqlQuote($login));
|
1998-10-13 22:15:37 +04:00
|
|
|
my $result = FetchOneColumn();
|
|
|
|
if (!defined $result) {
|
|
|
|
$result = "";
|
|
|
|
}
|
|
|
|
return $result;
|
1998-09-16 01:49:26 +04:00
|
|
|
}
|
|
|
|
|
1999-03-27 05:28:51 +03:00
|
|
|
sub CheckEmailSyntax {
|
|
|
|
my ($addr) = (@_);
|
1999-06-14 21:33:52 +04:00
|
|
|
my $match = Param('emailregexp');
|
2001-07-04 11:06:00 +04:00
|
|
|
if ($addr !~ /$match/ || $addr =~ /[\\\(\)<>&,;:"\[\] \t\r\n]/) {
|
2003-04-02 16:35:07 +04:00
|
|
|
ThrowUserError("illegal_email_address", { addr => $addr });
|
1999-03-27 05:28:51 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-05-08 02:07:21 +04:00
|
|
|
sub MailPassword {
|
|
|
|
my ($login, $password) = (@_);
|
|
|
|
my $urlbase = Param("urlbase");
|
2000-02-08 01:11:55 +03:00
|
|
|
my $template = Param("passwordmail");
|
|
|
|
my $msg = PerformSubsts($template,
|
|
|
|
{"mailaddress" => $login . Param('emailsuffix'),
|
|
|
|
"login" => $login,
|
|
|
|
"password" => $password});
|
1999-05-08 02:07:21 +04:00
|
|
|
|
2002-02-17 11:22:31 +03:00
|
|
|
open SENDMAIL, "|/usr/lib/sendmail -t -i";
|
1999-05-08 02:07:21 +04:00
|
|
|
print SENDMAIL $msg;
|
|
|
|
close SENDMAIL;
|
|
|
|
}
|
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
sub PutHeader {
|
2002-05-06 23:30:21 +04:00
|
|
|
($vars->{'title'}, $vars->{'h1'}, $vars->{'h2'}) = (@_);
|
2002-04-29 01:57:10 +04:00
|
|
|
|
|
|
|
$::template->process("global/header.html.tmpl", $::vars)
|
|
|
|
|| ThrowTemplateError($::template->error());
|
2002-10-17 03:09:31 +04:00
|
|
|
$vars->{'header_done'} = 1;
|
1998-09-16 01:49:26 +04:00
|
|
|
}
|
|
|
|
|
2000-01-15 01:35:49 +03:00
|
|
|
sub PutFooter {
|
2002-04-29 01:57:10 +04:00
|
|
|
$::template->process("global/footer.html.tmpl", $::vars)
|
|
|
|
|| ThrowTemplateError($::template->error());
|
2000-01-15 01:35:49 +03:00
|
|
|
}
|
|
|
|
|
2000-02-17 08:15:23 +03:00
|
|
|
sub CheckIfVotedConfirmed {
|
|
|
|
my ($id, $who) = (@_);
|
|
|
|
SendSQL("SELECT bugs.votes, bugs.bug_status, products.votestoconfirm, " .
|
|
|
|
" bugs.everconfirmed " .
|
|
|
|
"FROM bugs, products " .
|
2002-10-02 04:46:22 +04:00
|
|
|
"WHERE bugs.bug_id = $id AND products.id = bugs.product_id");
|
2000-02-17 08:15:23 +03:00
|
|
|
my ($votes, $status, $votestoconfirm, $everconfirmed) = (FetchSQLData());
|
|
|
|
if ($votes >= $votestoconfirm && $status eq $::unconfirmedstate) {
|
|
|
|
SendSQL("UPDATE bugs SET bug_status = 'NEW', everconfirmed = 1 " .
|
|
|
|
"WHERE bug_id = $id");
|
|
|
|
my $fieldid = GetFieldID("bug_status");
|
|
|
|
SendSQL("INSERT INTO bugs_activity " .
|
2001-07-20 19:18:30 +04:00
|
|
|
"(bug_id,who,bug_when,fieldid,removed,added) VALUES " .
|
2000-02-17 08:15:23 +03:00
|
|
|
"($id,$who,now(),$fieldid,'$::unconfirmedstate','NEW')");
|
|
|
|
if (!$everconfirmed) {
|
|
|
|
$fieldid = GetFieldID("everconfirmed");
|
|
|
|
SendSQL("INSERT INTO bugs_activity " .
|
2001-07-20 19:18:30 +04:00
|
|
|
"(bug_id,who,bug_when,fieldid,removed,added) VALUES " .
|
2000-02-17 08:15:23 +03:00
|
|
|
"($id,$who,now(),$fieldid,'0','1')");
|
|
|
|
}
|
2002-04-29 01:57:10 +04:00
|
|
|
|
2000-02-17 08:15:23 +03:00
|
|
|
AppendComment($id, DBID_to_name($who),
|
2002-08-20 01:17:28 +04:00
|
|
|
"*** This bug has been confirmed by popular vote. ***", 0);
|
2002-04-29 01:57:10 +04:00
|
|
|
|
|
|
|
$vars->{'type'} = "votes";
|
|
|
|
$vars->{'id'} = $id;
|
2003-02-10 01:04:25 +03:00
|
|
|
$vars->{'mailrecipients'} = { 'changer' => $who };
|
2002-04-29 01:57:10 +04:00
|
|
|
|
|
|
|
$template->process("bug/process/results.html.tmpl", $vars)
|
|
|
|
|| ThrowTemplateError($template->error());
|
2000-02-17 08:15:23 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
2002-10-17 08:31:56 +04:00
|
|
|
sub LogActivityEntry {
|
|
|
|
my ($i,$col,$removed,$added,$whoid,$timestamp) = @_;
|
|
|
|
# in the case of CCs, deps, and keywords, there's a possibility that someone # might try to add or remove a lot of them at once, which might take more
|
|
|
|
# space than the activity table allows. We'll solve this by splitting it
|
|
|
|
# into multiple entries if it's too long.
|
|
|
|
while ($removed || $added) {
|
|
|
|
my ($removestr, $addstr) = ($removed, $added);
|
|
|
|
if (length($removestr) > 254) {
|
|
|
|
my $commaposition = FindWrapPoint($removed, 254);
|
|
|
|
$removestr = substr($removed,0,$commaposition);
|
|
|
|
$removed = substr($removed,$commaposition);
|
|
|
|
$removed =~ s/^[,\s]+//; # remove any comma or space
|
|
|
|
} else {
|
|
|
|
$removed = ""; # no more entries
|
|
|
|
}
|
|
|
|
if (length($addstr) > 254) {
|
|
|
|
my $commaposition = FindWrapPoint($added, 254);
|
|
|
|
$addstr = substr($added,0,$commaposition);
|
|
|
|
$added = substr($added,$commaposition);
|
|
|
|
$added =~ s/^[,\s]+//; # remove any comma or space
|
|
|
|
} else {
|
|
|
|
$added = ""; # no more entries
|
|
|
|
}
|
|
|
|
$addstr = SqlQuote($addstr);
|
|
|
|
$removestr = SqlQuote($removestr);
|
|
|
|
my $fieldid = GetFieldID($col);
|
|
|
|
SendSQL("INSERT INTO bugs_activity " .
|
|
|
|
"(bug_id,who,bug_when,fieldid,removed,added) VALUES " .
|
|
|
|
"($i,$whoid," . SqlQuote($timestamp) . ",$fieldid,$removestr,$addstr)");
|
|
|
|
}
|
|
|
|
}
|
2000-02-17 08:15:23 +03:00
|
|
|
|
2002-04-03 22:54:18 +04:00
|
|
|
sub GetBugActivity {
|
1999-05-25 23:22:31 +04:00
|
|
|
my ($id, $starttime) = (@_);
|
|
|
|
my $datepart = "";
|
2000-03-07 21:23:00 +03:00
|
|
|
|
|
|
|
die "Invalid id: $id" unless $id=~/^\s*\d+\s*$/;
|
|
|
|
|
1999-05-25 23:22:31 +04:00
|
|
|
if (defined $starttime) {
|
2001-11-27 18:04:52 +03:00
|
|
|
$datepart = "and bugs_activity.bug_when > " . SqlQuote($starttime);
|
1999-05-25 23:22:31 +04:00
|
|
|
}
|
2002-04-03 22:54:18 +04:00
|
|
|
|
1999-05-25 23:22:31 +04:00
|
|
|
my $query = "
|
2001-08-31 07:54:37 +04:00
|
|
|
SELECT IFNULL(fielddefs.description, bugs_activity.fieldid),
|
2002-10-13 08:26:24 +04:00
|
|
|
fielddefs.name,
|
2001-08-31 07:54:37 +04:00
|
|
|
bugs_activity.attach_id,
|
2002-11-27 19:00:44 +03:00
|
|
|
DATE_FORMAT(bugs_activity.bug_when,'%Y.%m.%d %H:%i'),
|
2001-07-20 19:18:30 +04:00
|
|
|
bugs_activity.removed, bugs_activity.added,
|
1999-05-25 23:22:31 +04:00
|
|
|
profiles.login_name
|
2000-01-23 00:43:30 +03:00
|
|
|
FROM bugs_activity LEFT JOIN fielddefs ON
|
|
|
|
bugs_activity.fieldid = fielddefs.fieldid,
|
|
|
|
profiles
|
2000-01-22 07:24:42 +03:00
|
|
|
WHERE bugs_activity.bug_id = $id $datepart
|
|
|
|
AND profiles.userid = bugs_activity.who
|
|
|
|
ORDER BY bugs_activity.bug_when";
|
1999-05-25 23:22:31 +04:00
|
|
|
|
|
|
|
SendSQL($query);
|
|
|
|
|
2002-04-03 22:54:18 +04:00
|
|
|
my @operations;
|
|
|
|
my $operation = {};
|
|
|
|
my $changes = [];
|
2001-08-09 10:12:18 +04:00
|
|
|
my $incomplete_data = 0;
|
2002-04-03 22:54:18 +04:00
|
|
|
|
2002-10-13 08:26:24 +04:00
|
|
|
while (my ($field, $fieldname, $attachid, $when, $removed, $added, $who)
|
2002-04-03 22:54:18 +04:00
|
|
|
= FetchSQLData())
|
|
|
|
{
|
|
|
|
my %change;
|
2002-10-13 08:26:24 +04:00
|
|
|
my $activity_visible = 1;
|
2002-04-03 22:54:18 +04:00
|
|
|
|
2002-10-13 08:26:24 +04:00
|
|
|
# check if the user should see this field's activity
|
|
|
|
if ($fieldname eq 'remaining_time' ||
|
|
|
|
$fieldname eq 'estimated_time' ||
|
|
|
|
$fieldname eq 'work_time') {
|
2002-04-03 22:54:18 +04:00
|
|
|
|
2002-10-13 08:26:24 +04:00
|
|
|
if (!UserInGroup(Param('timetrackinggroup'))) {
|
|
|
|
$activity_visible = 0;
|
|
|
|
} else {
|
|
|
|
$activity_visible = 1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$activity_visible = 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ($activity_visible) {
|
|
|
|
# This gets replaced with a hyperlink in the template.
|
|
|
|
$field =~ s/^Attachment// if $attachid;
|
|
|
|
|
|
|
|
# Check for the results of an old Bugzilla data corruption bug
|
|
|
|
$incomplete_data = 1 if ($added =~ /^\?/ || $removed =~ /^\?/);
|
2002-04-03 22:54:18 +04:00
|
|
|
|
2002-10-13 08:26:24 +04:00
|
|
|
# An operation, done by 'who' at time 'when', has a number of
|
|
|
|
# 'changes' associated with it.
|
|
|
|
# If this is the start of a new operation, store the data from the
|
|
|
|
# previous one, and set up the new one.
|
|
|
|
if ($operation->{'who'}
|
|
|
|
&& ($who ne $operation->{'who'}
|
|
|
|
|| $when ne $operation->{'when'}))
|
|
|
|
{
|
|
|
|
$operation->{'changes'} = $changes;
|
|
|
|
push (@operations, $operation);
|
2002-04-03 22:54:18 +04:00
|
|
|
|
2002-10-13 08:26:24 +04:00
|
|
|
# Create new empty anonymous data structures.
|
|
|
|
$operation = {};
|
|
|
|
$changes = [];
|
|
|
|
}
|
2002-04-03 22:54:18 +04:00
|
|
|
|
2002-10-13 08:26:24 +04:00
|
|
|
$operation->{'who'} = $who;
|
|
|
|
$operation->{'when'} = $when;
|
2002-04-03 22:54:18 +04:00
|
|
|
|
2002-10-13 08:26:24 +04:00
|
|
|
$change{'field'} = $field;
|
|
|
|
$change{'fieldname'} = $fieldname;
|
|
|
|
$change{'attachid'} = $attachid;
|
|
|
|
$change{'removed'} = $removed;
|
|
|
|
$change{'added'} = $added;
|
|
|
|
push (@$changes, \%change);
|
|
|
|
}
|
2001-08-09 10:12:18 +04:00
|
|
|
}
|
2002-04-03 22:54:18 +04:00
|
|
|
|
|
|
|
if ($operation->{'who'}) {
|
|
|
|
$operation->{'changes'} = $changes;
|
|
|
|
push (@operations, $operation);
|
1999-05-25 23:22:31 +04:00
|
|
|
}
|
2002-04-03 22:54:18 +04:00
|
|
|
|
|
|
|
return(\@operations, $incomplete_data);
|
1999-05-25 23:22:31 +04:00
|
|
|
}
|
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
############# Live code below here (that is, not subroutine defs) #############
|
|
|
|
|
2002-12-20 10:21:43 +03:00
|
|
|
use Bugzilla;
|
1998-09-16 01:49:26 +04:00
|
|
|
|
2002-12-20 10:21:43 +03:00
|
|
|
# XXX - mod_perl - reset this between runs
|
2003-02-07 10:19:15 +03:00
|
|
|
$::cgi = Bugzilla->cgi;
|
1998-09-16 01:49:26 +04:00
|
|
|
|
2002-10-26 05:57:09 +04:00
|
|
|
# Set up stuff for compatibility with the old CGI.pl code
|
|
|
|
# This code will be removed as soon as possible, in favour of
|
|
|
|
# using the CGI.pm stuff directly
|
1998-09-16 01:49:26 +04:00
|
|
|
|
2002-10-26 05:57:09 +04:00
|
|
|
# XXX - mod_perl - reset these between runs
|
|
|
|
|
|
|
|
foreach my $name ($::cgi->param()) {
|
|
|
|
my @val = $::cgi->param($name);
|
|
|
|
$::FORM{$name} = join('', @val);
|
|
|
|
$::MFORM{$name} = \@val;
|
1998-09-16 01:49:26 +04:00
|
|
|
}
|
|
|
|
|
2002-10-26 05:57:09 +04:00
|
|
|
$::buffer = $::cgi->query_string();
|
|
|
|
|
|
|
|
foreach my $name ($::cgi->cookie()) {
|
|
|
|
$::COOKIE{$name} = $::cgi->cookie($name);
|
1998-09-16 01:49:26 +04:00
|
|
|
}
|
|
|
|
|
2002-11-27 00:11:23 +03:00
|
|
|
# This could be needed in any CGI, so we set it here.
|
|
|
|
$vars->{'help'} = $::cgi->param('help') ? 1 : 0;
|
|
|
|
|
1998-09-16 01:49:26 +04:00
|
|
|
1;
|