summaryrefslogtreecommitdiff
path: root/rt/lib/RT/Interface
diff options
context:
space:
mode:
Diffstat (limited to 'rt/lib/RT/Interface')
-rw-r--r--rt/lib/RT/Interface/CLI.pm8
-rwxr-xr-xrt/lib/RT/Interface/Email.pm106
-rwxr-xr-xrt/lib/RT/Interface/Email/Auth/GnuPG.pm6
-rw-r--r--rt/lib/RT/Interface/Email/Auth/MailFrom.pm6
-rw-r--r--rt/lib/RT/Interface/Email/Filter/SpamAssassin.pm6
-rw-r--r--rt/lib/RT/Interface/REST.pm34
-rw-r--r--rt/lib/RT/Interface/Web.pm207
-rw-r--r--rt/lib/RT/Interface/Web/Handler.pm23
-rwxr-xr-xrt/lib/RT/Interface/Web/QueryBuilder.pm6
-rwxr-xr-xrt/lib/RT/Interface/Web/QueryBuilder/Tree.pm6
-rwxr-xr-xrt/lib/RT/Interface/Web/Standalone.pm47
11 files changed, 141 insertions, 314 deletions
diff --git a/rt/lib/RT/Interface/CLI.pm b/rt/lib/RT/Interface/CLI.pm
index a96551bef..31650392f 100644
--- a/rt/lib/RT/Interface/CLI.pm
+++ b/rt/lib/RT/Interface/CLI.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -22,9 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# CONTRIBUTION SUBMISSION POLICY:
@@ -57,7 +55,7 @@ BEGIN {
use vars qw ($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
# set the version for version checking
- $VERSION = do { my @r = (q$Revision: 1.1.1.4 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
+ $VERSION = do { my @r = (q$Revision: 1.1.1.5 $ =~ /\d+/g); sprintf "%d."."%02d" x $#r, @r }; # must be all one line, for MakeMaker
@ISA = qw(Exporter);
diff --git a/rt/lib/RT/Interface/Email.pm b/rt/lib/RT/Interface/Email.pm
index 3179938a7..de125f560 100755
--- a/rt/lib/RT/Interface/Email.pm
+++ b/rt/lib/RT/Interface/Email.pm
@@ -1,40 +1,38 @@
# BEGIN BPS TAGGED BLOCK {{{
-#
+#
# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+#
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
-#
+#
# (Except where explicitly superseded by other copyright notices)
-#
-#
+#
+#
# LICENSE:
-#
+#
# This work is made available to you under the terms of Version 2 of
# the GNU General Public License. A copy of that license should have
# been provided with this software, but in any event can be snarfed
# from www.gnu.org.
-#
+#
# This work is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
-#
-#
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+#
+#
# CONTRIBUTION SUBMISSION POLICY:
-#
+#
# (The following paragraph is not intended to limit the rights granted
# to you to modify and distribute this software under the terms of
# the GNU General Public License and is only of importance to you if
# you choose to contribute your changes and enhancements to the
# community by submitting them to Best Practical Solutions, LLC.)
-#
+#
# By intentionally submitting any modifications, corrections or
# derivatives to this work, or any other work intended for use with
# Request Tracker, to Best Practical Solutions, LLC, you confirm that
@@ -43,7 +41,7 @@
# royalty-free, perpetual, license to use, copy, create derivative
# works based on those contributions, and sublicense and distribute
# those contributions and any derivatives thereof.
-#
+#
# END BPS TAGGED BLOCK }}}
package RT::Interface::Email;
@@ -221,7 +219,7 @@ Returns the same array with any IsRTAddress()es weeded out.
=cut
sub CullRTAddresses {
- return grep !IsRTAddress($_), @_;
+ return ( grep { IsRTAddress($_) } @_ );
}
# }}}
@@ -244,16 +242,14 @@ sub MailError {
level => $args{'LogLevel'},
message => $args{'Explanation'}
);
- # the colons are necessary to make ->build include non-standard headers
my $entity = MIME::Entity->build(
Type => "multipart/mixed",
From => $args{'From'},
Bcc => $args{'Bcc'},
To => $args{'To'},
Subject => $args{'Subject'},
- 'Precedence:' => 'bulk',
- 'X-RT-Loop-Prevention:' => $RT::rtname,
- 'In-Reply-To:' => $args{'MIMEObj'} ? $args{'MIMEObj'}->head->get('Message-Id') : undef
+ Precedence => 'bulk',
+ 'X-RT-Loop-Prevention' => $RT::rtname,
);
$entity->attach( Data => $args{'Explanation'} . "\n" );
@@ -301,6 +297,7 @@ sub CreateUser {
unless ($Val) {
# Deal with the race condition of two account creations at once
+ #
if ($Username) {
$NewUser->LoadByName($Username);
}
@@ -445,12 +442,11 @@ Takes an address from $head->get('Line') and returns a tuple: user@host, friendl
sub ParseAddressFromHeader {
my $Addr = shift;
- # Some broken mailers send: ""Vincent, Jesse"" <jesse@fsck.com>. Hate
- $Addr =~ s/\"\"(.*?)\"\"/\"$1\"/g;
my @Addresses = Mail::Address->parse($Addr);
- my ($AddrObj) = grep ref $_, @Addresses;
- unless ( $AddrObj ) {
+ my $AddrObj = $Addresses[0];
+
+ unless ( ref($AddrObj) ) {
return ( undef, undef );
}
@@ -572,22 +568,6 @@ sub Gateway {
#Pull apart the subject line
my $Subject = $head->get('Subject') || '';
chomp $Subject;
-
- # {{{ Lets check for mail loops of various sorts.
- my ($should_store_machine_generated_message, $IsALoop, $result);
- ( $should_store_machine_generated_message, $ErrorsTo, $result, $IsALoop ) =
- _HandleMachineGeneratedMail(
- Message => $Message,
- ErrorsTo => $ErrorsTo,
- Subject => $Subject,
- MessageId => $MessageId
- );
-
- # Do not pass loop messages to MailPlugins, to make sure the loop
- # is broken, unless $RT::StoreLoops is set.
- if ($IsALoop && !$should_store_machine_generated_message) {
- return ( 0, $result, undef );
- }
$args{'ticket'} ||= ParseTicketId($Subject);
@@ -663,10 +643,6 @@ sub Gateway {
$skip_action{$action}++ if $AuthStat == -2;
}
- # strip actions we should skip
- @actions = grep !$skip_action{$_}, @actions if $AuthStat == -2;
- last unless @actions;
-
last if $AuthStat == -1;
}
# {{{ If authentication fails and no new user was created, get out.
@@ -703,11 +679,22 @@ sub Gateway {
);
}
+ # {{{ Lets check for mail loops of various sorts.
+ my ($continue, $result);
+ ( $continue, $ErrorsTo, $result ) = _HandleMachineGeneratedMail(
+ Message => $Message,
+ ErrorsTo => $ErrorsTo,
+ Subject => $Subject,
+ MessageId => $MessageId
+ );
- unless ($should_store_machine_generated_message) {
+ unless ($continue) {
return ( 0, $result, undef );
}
+ # strip actions we should skip
+ @actions = grep !$skip_action{$_}, @actions;
+
# if plugin's updated SystemTicket then update arguments
$args{'ticket'} = $SystemTicket->Id if $SystemTicket && $SystemTicket->Id;
@@ -737,7 +724,7 @@ sub Gateway {
if ( $id == 0 ) {
MailError(
To => $ErrorsTo,
- Subject => "Ticket creation failed: $Subject",
+ Subject => "Ticket creation failed",
Explanation => $ErrStr,
MIMEObj => $Message
);
@@ -749,23 +736,20 @@ sub Gateway {
@actions = grep !/^(comment|correspond)$/, @actions;
$args{'ticket'} = $id;
- } elsif ( $args{'ticket'} ) {
+ } else {
$Ticket->Load( $args{'ticket'} );
unless ( $Ticket->Id ) {
my $error = "Could not find a ticket with id " . $args{'ticket'};
MailError(
To => $ErrorsTo,
- Subject => "Message not recorded: $Subject",
+ Subject => "Message not recorded",
Explanation => $error,
MIMEObj => $Message
);
return ( 0, $error );
}
- $args{'ticket'} = $Ticket->id;
- } else {
- return ( 1, "Success", $Ticket );
}
# }}}
@@ -780,7 +764,7 @@ sub Gateway {
#Warn the sender that we couldn't actually submit the comment.
MailError(
To => $ErrorsTo,
- Subject => "Message not recorded: $Subject",
+ Subject => "Message not recorded",
Explanation => $msg,
MIMEObj => $Message
);
@@ -872,7 +856,6 @@ EOT
);
# Also notify the requestor that his request has been dropped.
- if ($args{'Requestor'} ne $RT::OwnerEmail) {
MailError(
To => $args{'Requestor'},
Subject => "Could not load a valid user",
@@ -884,7 +867,6 @@ EOT
MIMEObj => $args{'Message'},
LogLevel => 'error'
);
- }
}
=head2 _HandleMachineGeneratedMail
@@ -895,8 +877,7 @@ Takes named params:
Subject
Checks the message to see if it's a bounce, if it looks like a loop, if it's autogenerated, etc.
-Returns a triple of ("Should we continue (boolean)", "New value for $ErrorsTo", "Status message",
-"This message appears to be a loop (boolean)" );
+Returns a triple of ("Should we continue (boolean)", "New value for $ErrorsTo", "Status message");
=cut
@@ -924,7 +905,7 @@ sub _HandleMachineGeneratedMail {
# Warn someone if it's a loop, before we drop it on the ground
if ($IsALoop) {
- $RT::Logger->crit("RT Received mail (".$args{MessageId}.") from itself.");
+ $RT::Logger->crit("RT Recieved mail (".$args{MessageId}.") from itself.");
#Should we mail it to RTOwner?
if ($RT::LoopsToRTOwner) {
@@ -937,7 +918,7 @@ sub _HandleMachineGeneratedMail {
}
#Do we actually want to store it?
- return ( 0, $ErrorsTo, "Message Bounced", $IsALoop ) unless ($RT::StoreLoops);
+ return ( 0, $ErrorsTo, "Message Bounced" ) unless ($RT::StoreLoops);
}
# Squelch replies if necessary
@@ -961,7 +942,7 @@ sub _HandleMachineGeneratedMail {
$head->add( 'RT-Squelch-Replies-To', $Sender );
$head->add( 'RT-DetectedAutoGenerated', 'true' );
}
- return ( 1, $ErrorsTo, "Handled machine detection", $IsALoop );
+ return ( 1, $ErrorsTo, "Handled machine detection" );
}
=head2 IsCorrectAction
@@ -972,8 +953,7 @@ Returns a list of valid actions we've found for this message
sub IsCorrectAction {
my $action = shift;
- my @actions = grep $_, split /-/, $action;
- return ( 0, '(no value)' ) unless @actions;
+ my @actions = split /-/, $action;
foreach (@actions) {
return ( 0, $_ ) unless /^(?:comment|correspond|take|resolve)$/;
}
diff --git a/rt/lib/RT/Interface/Email/Auth/GnuPG.pm b/rt/lib/RT/Interface/Email/Auth/GnuPG.pm
index 115080722..2dfada755 100755
--- a/rt/lib/RT/Interface/Email/Auth/GnuPG.pm
+++ b/rt/lib/RT/Interface/Email/Auth/GnuPG.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -22,9 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# CONTRIBUTION SUBMISSION POLICY:
diff --git a/rt/lib/RT/Interface/Email/Auth/MailFrom.pm b/rt/lib/RT/Interface/Email/Auth/MailFrom.pm
index 32009c372..5143764e1 100644
--- a/rt/lib/RT/Interface/Email/Auth/MailFrom.pm
+++ b/rt/lib/RT/Interface/Email/Auth/MailFrom.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -22,9 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# CONTRIBUTION SUBMISSION POLICY:
diff --git a/rt/lib/RT/Interface/Email/Filter/SpamAssassin.pm b/rt/lib/RT/Interface/Email/Filter/SpamAssassin.pm
index 2f8b61cdb..c552d76e6 100644
--- a/rt/lib/RT/Interface/Email/Filter/SpamAssassin.pm
+++ b/rt/lib/RT/Interface/Email/Filter/SpamAssassin.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -22,9 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# CONTRIBUTION SUBMISSION POLICY:
diff --git a/rt/lib/RT/Interface/REST.pm b/rt/lib/RT/Interface/REST.pm
index 90e3b3511..4eeb468c4 100644
--- a/rt/lib/RT/Interface/REST.pm
+++ b/rt/lib/RT/Interface/REST.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -22,9 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# CONTRIBUTION SUBMISSION POLICY:
@@ -56,37 +54,25 @@ BEGIN {
use Exporter ();
use vars qw($VERSION @ISA @EXPORT);
- $VERSION = do { my @r = (q$Revision: 1.1.1.4 $ =~ /\d+/g); sprintf "%d."."%02d"x$#r, @r };
+ $VERSION = do { my @r = (q$Revision: 1.1.1.5 $ =~ /\d+/g); sprintf "%d."."%02d"x$#r, @r };
@ISA = qw(Exporter);
@EXPORT = qw(expand_list form_parse form_compose vpush vsplit);
}
-my $field = '(?i:[a-z][a-z0-9_-]*|C(?:ustom)?F(?:ield)?-[a-z0-9_ -]+)';
+my $field = '[a-zA-Z][a-zA-Z0-9_-]*';
-# WARN: this code is duplicated in bin/rt.in,
-# change both functions at once
sub expand_list {
my ($list) = @_;
+ my ($elt, @elts, %elts);
- my @elts;
- foreach (split /,/, $list) {
- push @elts, /^(\d+)-(\d+)$/? ($1..$2): $_;
+ foreach $elt (split /,/, $list) {
+ if ($elt =~ /^(\d+)-(\d+)$/) { push @elts, ($1..$2) }
+ else { push @elts, $elt }
}
- return map $_->[0], # schwartzian transform
- sort {
- defined $a->[1] && defined $b->[1]?
- # both numbers
- $a->[1] <=> $b->[1]
- :!defined $a->[1] && !defined $b->[1]?
- # both letters
- $a->[2] cmp $b->[2]
- # mix, number must be first
- :defined $a->[1]? -1: 1
- }
- map [ $_, (defined( /^(\d+)$/ )? $1: undef), lc($_) ],
- @elts;
+ @elts{@elts}=();
+ return sort {$a<=>$b} keys %elts;
}
# Returns a reference to an array of parsed forms.
diff --git a/rt/lib/RT/Interface/Web.pm b/rt/lib/RT/Interface/Web.pm
index 16945ab07..8bc840ba4 100644
--- a/rt/lib/RT/Interface/Web.pm
+++ b/rt/lib/RT/Interface/Web.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -22,9 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# CONTRIBUTION SUBMISSION POLICY:
@@ -64,13 +62,10 @@ use_ok(RT::Interface::Web);
=cut
+package RT::Interface::Web;
use strict;
-use warnings;
-package RT::Interface::Web;
-use HTTP::Date;
-use RT::SavedSearches;
-use URI;
+
# {{{ EscapeUTF8
@@ -132,7 +127,7 @@ sub WebCanonicalizeInfo {
my $user;
if ( defined $ENV{'REMOTE_USER'} ) {
- $user = lc ( $ENV{'REMOTE_USER'} ) if( length($ENV{'REMOTE_USER'}) );
+ $user = lc ( $ENV{'REMOTE_USER'} ) if( length($ENV{'REMOTE_USER'}) );
}
return $user;
@@ -156,14 +151,14 @@ sub WebExternalAutoInfo {
$user_info{'Privileged'} = 1;
if ($^O !~ /^(?:riscos|MacOS|MSWin32|dos|os2)$/) {
- # Populate fields with information from Unix /etc/passwd
+ # Populate fields with information from Unix /etc/passwd
- my ($comments, $realname) = (getpwnam($user))[5, 6];
- $user_info{'Comments'} = $comments if defined $comments;
- $user_info{'RealName'} = $realname if defined $realname;
+ my ($comments, $realname) = (getpwnam($user))[5, 6];
+ $user_info{'Comments'} = $comments if defined $comments;
+ $user_info{'RealName'} = $realname if defined $realname;
}
elsif ($^O eq 'MSWin32' and eval 'use Net::AdminMisc; 1') {
- # Populate fields with information from NT domain controller
+ # Populate fields with information from NT domain controller
}
# and return the wad of stuff
@@ -173,57 +168,8 @@ sub WebExternalAutoInfo {
# }}}
-
-=head2 Redirect URL
-
-This routine ells the current user's browser to redirect to URL.
-Additionally, it unties the user's currently active session, helping to avoid
-A bug in Apache::Session 1.81 and earlier which clobbers sessions if we try to use
-a cached DBI statement handle twice at the same time.
-
-=cut
-
-
-sub Redirect {
- my $redir_to = shift;
- untie $HTML::Mason::Commands::session;
- my $uri = URI->new($redir_to);
- my $server_uri = URI->new($RT::WebURL);
-
- # If the user is coming in via a non-canonical
- # hostname, don't redirect them to the canonical host,
- # it will just upset them (and invalidate their credentials)
- if ($uri->host eq $server_uri->host &&
- $uri->port eq $server_uri->port) {
- $uri->host($ENV{'HTTP_HOST'});
- $uri->port($ENV{'SERVER_PORT'});
- }
-
- $HTML::Mason::Commands::m->redirect($uri->canonical);
- $HTML::Mason::Commands::m->abort;
-}
-
-
-=head2 StaticFileHeaders
-
-Send the browser a few headers to try to get it to (somewhat agressively)
-cache RT's static Javascript and CSS files.
-
-This routine could really use _accurate_ heuristics. (XXX TODO)
-
-=cut
-
-sub StaticFileHeaders {
- # Expire things in a month.
- $HTML::Mason::Commands::r->headers_out->{'Expires'} = HTTP::Date::time2str( time() + 2592000 );
-
- # Last modified at server start time
- $HTML::Mason::Commands::r->headers_out->{'Last-Modified'} = HTTP::Date::time2str($^T);
-
-}
-
-
package HTML::Mason::Commands;
+use strict;
use vars qw/$r $m %session/;
@@ -248,8 +194,8 @@ sub loc {
return ($u->loc(@_));
}
else {
- # pathetic case -- SystemUser is gone.
- return $_[0];
+ # pathetic case -- SystemUser is gone.
+ return $_[0];
}
}
@@ -375,12 +321,13 @@ sub CreateTicket {
MIMEObj => $MIMEObj
);
foreach my $arg (keys %ARGS) {
- next if $arg =~ /-(?:Magic|Category)$/;
+ my $cfid = $1;
+ next if ($arg =~ /-Magic$/);
+ #Object-RT::Ticket--CustomField-3-Values
if ($arg =~ /^Object-RT::Transaction--CustomField-/) {
$create_args{$arg} = $ARGS{$arg};
}
- # Object-RT::Ticket--CustomField-3-Values
elsif ($arg =~ /^Object-RT::Ticket--CustomField-(\d+)(.*?)$/) {
my $cfid = $1;
my $cf = RT::CustomField->new( $session{'CurrentUser'});
@@ -411,42 +358,42 @@ sub CreateTicket {
my (@dependson, @dependedonby, @parents, @children, @refersto, @referredtoby);
foreach my $luri ( split ( / /, $ARGS{"new-DependsOn"} ) ) {
- $luri =~ s/\s*$//; # Strip trailing whitespace
- push @dependson, $luri;
+ $luri =~ s/\s*$//; # Strip trailing whitespace
+ push @dependson, $luri;
}
$create_args{'DependsOn'} = \@dependson;
foreach my $luri ( split ( / /, $ARGS{"DependsOn-new"} ) ) {
- push @dependedonby, $luri;
+ push @dependedonby, $luri;
}
$create_args{'DependedOnBy'} = \@dependedonby;
foreach my $luri ( split ( / /, $ARGS{"new-MemberOf"} ) ) {
- $luri =~ s/\s*$//; # Strip trailing whitespace
- push @parents, $luri;
+ $luri =~ s/\s*$//; # Strip trailing whitespace
+ push @parents, $luri;
}
$create_args{'Parents'} = \@parents;
foreach my $luri ( split ( / /, $ARGS{"MemberOf-new"} ) ) {
- push @children, $luri;
+ push @children, $luri;
}
$create_args{'Children'} = \@children;
foreach my $luri ( split ( / /, $ARGS{"new-RefersTo"} ) ) {
- $luri =~ s/\s*$//; # Strip trailing whitespace
- push @refersto, $luri;
+ $luri =~ s/\s*$//; # Strip trailing whitespace
+ push @refersto, $luri;
}
$create_args{'RefersTo'} = \@refersto;
foreach my $luri ( split ( / /, $ARGS{"RefersTo-new"} ) ) {
- push @referredtoby, $luri;
+ push @referredtoby, $luri;
}
$create_args{'ReferredToBy'} = \@referredtoby;
# }}}
my ( $id, $Trans, $ErrMsg ) = $Ticket->Create(%create_args);
- unless ( $id ) {
+ unless ( $id && $Trans ) {
Abort($ErrMsg);
}
@@ -627,7 +574,7 @@ sub MakeMIMEEntity {
Subject => $args{'Subject'} || "",
From => $args{'From'},
Cc => $args{'Cc'},
- 'Charset:' => 'utf8',
+ Charset => 'utf8',
Data => [ $args{'Body'} ]
);
}
@@ -955,7 +902,7 @@ sub ProcessACLChanges {
if ($object_type eq 'RT::System') {
$obj = $RT::System;
- } elsif ($RT::ACE::OBJECT_TYPES{$object_type}) {
+ } elsif ($RT::ACE::OBJECT_TYPES{$object_type}) {
$obj = $object_type->new($session{'CurrentUser'});
$obj->Load($object_id);
} else {
@@ -984,7 +931,7 @@ sub ProcessACLChanges {
if ($object_type eq 'RT::System') {
$obj = $RT::System;
- } elsif ($RT::ACE::OBJECT_TYPES{$object_type}) {
+ } elsif ($RT::ACE::OBJECT_TYPES{$object_type}) {
$obj = $object_type->new($session{'CurrentUser'});
$obj->Load($object_id);
} else {
@@ -1026,9 +973,9 @@ sub UpdateRecordObject {
my $Object = $args{'Object'};
my @results = $Object->Update(AttributesRef => $args{'AttributesRef'},
- ARGSRef => $args{'ARGSRef'},
+ ARGSRef => $args{'ARGSRef'},
AttributePrefix => $args{'AttributePrefix'}
- );
+ );
return (@results);
}
@@ -1126,7 +1073,6 @@ sub ProcessTicketBasics {
Queue
);
-
if ( $ARGSRef->{'Queue'} and ( $ARGSRef->{'Queue'} !~ /^(\d+)$/ ) ) {
my $tempqueue = RT::Queue->new($RT::SystemUser);
$tempqueue->Load( $ARGSRef->{'Queue'} );
@@ -1177,11 +1123,11 @@ sub ProcessTicketCustomFieldUpdates {
my %custom_fields_to_mod;
foreach my $arg ( keys %$ARGSRef ) {
if ( $arg =~ /^Ticket-(\d+-.*)/) {
- $ARGSRef->{"Object-RT::Ticket-$1"} = delete $ARGSRef->{$arg};
- }
+ $ARGSRef->{"Object-RT::Ticket-$1"} = delete $ARGSRef->{$arg};
+ }
elsif ( $arg =~ /^CustomField-(\d+-.*)/) {
- $ARGSRef->{"Object-RT::Ticket--$1"} = delete $ARGSRef->{$arg};
- }
+ $ARGSRef->{"Object-RT::Ticket--$1"} = delete $ARGSRef->{$arg};
+ }
}
return ProcessObjectCustomFieldUpdates(%args, ARGSRef => $ARGSRef);
@@ -1356,8 +1302,8 @@ sub _ProcessObjectCustomFieldUpdates {
}
}
else {
- push ( @results,
- loc("User asked for an unknown update type for custom field [_1] for [_2] object #[_3]",
+ push ( @results, loc("User asked for an unknown update type"
+ ." for custom field [_1] for [_2] object #[_3]",
$cf->Name, ref $args{'Object'}, $args{'Object'}->id )
);
}
@@ -1384,30 +1330,27 @@ sub ProcessTicketWatchers {
my $Ticket = $args{'TicketObj'};
my $ARGSRef = $args{'ARGSRef'};
- # Munge watchers
+ # {{{ Munge watchers
foreach my $key ( keys %$ARGSRef ) {
- # Delete deletable watchers
- if ( ( $key =~ /^Ticket-DeleteWatcher-Type-(.*)-Principal-(\d+)$/ ) )
- {
- my ( $code, $msg ) = $Ticket->DeleteWatcher(
- PrincipalId => $2,
- Type => $1
- );
+ # {{{ Delete deletable watchers
+ if ( ( $key =~ /^Ticket-DeleteWatcher-Type-(.*)-Principal-(\d+)$/ ) ) {
+ my ( $code, $msg ) =
+ $Ticket->DeleteWatcher(PrincipalId => $2,
+ Type => $1);
push @results, $msg;
}
# Delete watchers in the simple style demanded by the bulk manipulator
- elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) {
- my ( $code, $msg ) = $Ticket->DeleteWatcher(
- Email => $ARGSRef->{$key},
- Type => $1
- );
+ elsif ( $key =~ /^Delete(Requestor|Cc|AdminCc)$/ ) {
+ my ( $code, $msg ) = $Ticket->DeleteWatcher( Email => $ARGSRef->{$key}, Type => $1 );
push @results, $msg;
}
- # Add new wathchers by email address
+ # }}}
+
+ # Add new wathchers by email address
elsif ( ( $ARGSRef->{$key} =~ /^(AdminCc|Cc|Requestor)$/ )
and ( $key =~ /^WatcherTypeEmail(\d*)$/ ) )
{
@@ -1430,21 +1373,18 @@ sub ProcessTicketWatchers {
}
# Add new watchers by owner
- elsif ( $key =~ /^Ticket-AddWatcher-Principal-(\d*)$/ ) {
- my $principal_id = $1;
- my $form = $ARGSRef->{$key};
- foreach my $value ( ref($form) ? @{$form} : ($form) ) {
- next unless $value =~ /^(?:AdminCc|Cc|Requestor)$/i;
+ elsif ( ( $ARGSRef->{$key} =~ /^(AdminCc|Cc|Requestor)$/ )
+ and ( $key =~ /^Ticket-AddWatcher-Principal-(\d*)$/ ) ) {
- my ( $code, $msg ) = $Ticket->AddWatcher(
- Type => $value,
- PrincipalId => $principal_id
- );
- push @results, $msg;
- }
+ #They're in this order because otherwise $1 gets clobbered :/
+ my ( $code, $msg ) =
+ $Ticket->AddWatcher( Type => $ARGSRef->{$key}, PrincipalId => $1 );
+ push @results, $msg;
}
-
}
+
+ # }}}
+
return (@results);
}
@@ -1526,7 +1466,7 @@ sub ProcessTicketLinks {
my (@results) = ProcessRecordLinks(RecordObj => $Ticket,
- ARGSRef => $ARGSRef);
+ ARGSRef => $ARGSRef);
#Merge if we need to
if ( $ARGSRef->{ $Ticket->Id . "-MergeInto" } ) {
@@ -1622,37 +1562,6 @@ sub _UploadedFile {
};
}
-=head2 _load_container_object ( $type, $id );
-
-Instantiate container object for saving searches.
-
-=cut
-
-sub _load_container_object {
- my ($obj_type, $obj_id) = @_;
- return RT::SavedSearch->new($session{'CurrentUser'})->_load_privacy_object($obj_type, $obj_id);
-}
-
-=head2 _parse_saved_search ( $arg );
-
-Given a serialization string for saved search, and returns the
-container object and the search id.
-
-=cut
-
-sub _parse_saved_search {
- my $spec = shift;
- return unless $spec;
- if ($spec !~ /^(.*?)-(\d+)-SavedSearch-(\d+)$/ ) {
- return;
- }
- my $obj_type = $1;
- my $obj_id = $2;
- my $search_id = $3;
-
- return (_load_container_object ($obj_type, $obj_id), $search_id);
-}
-
eval "require RT::Interface::Web_Vendor";
die $@ if ($@ && $@ !~ qr{^Can't locate RT/Interface/Web_Vendor.pm});
eval "require RT::Interface::Web_Local";
diff --git a/rt/lib/RT/Interface/Web/Handler.pm b/rt/lib/RT/Interface/Web/Handler.pm
index 1e871ec59..e41490f8f 100644
--- a/rt/lib/RT/Interface/Web/Handler.pm
+++ b/rt/lib/RT/Interface/Web/Handler.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -22,9 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# CONTRIBUTION SUBMISSION POLICY:
@@ -45,6 +43,7 @@
# those contributions and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
+
package RT::Interface::Web::Handler;
use CGI qw/-private_tempfiles/;
@@ -55,6 +54,7 @@ use Time::ParseDate;
use Time::HiRes;
use HTML::Entities;
use HTML::Scrubber;
+use Text::Quoted;
use RT::Interface::Web::Handler;
use File::Path qw( rmtree );
use File::Glob qw( bsd_glob );
@@ -88,6 +88,16 @@ sub new {
$class->InitSessionDir;
if ( $mod_perl::VERSION && $mod_perl::VERSION >= 1.9908 ) {
+# require Apache::RequestUtil;
+# no warnings 'redefine';
+# my $sub = *Apache::request{CODE};
+# *Apache::request = sub {
+# my $r;
+# eval { $r = $sub->('Apache'); };
+#
+# # warn $@ if $@;
+# return $r;
+# };
goto &NewApacheHandler;
}
elsif ($CGI::MOD_PERL) {
@@ -107,11 +117,12 @@ sub InitSessionDir {
# Clean up our umask to protect session files
umask(0077);
- if ($CGI::MOD_PERL) { local $@; eval {
+ if ($CGI::MOD_PERL and $CGI::MOD_PERL < 1.9908 ) {
chown( Apache->server->uid, Apache->server->gid,
$RT::MasonSessionDir )
- }}
+ if Apache->server->can('uid');
+ }
# Die if WebSessionDir doesn't exist or we can't write to it
stat($RT::MasonSessionDir);
diff --git a/rt/lib/RT/Interface/Web/QueryBuilder.pm b/rt/lib/RT/Interface/Web/QueryBuilder.pm
index 56c5b038c..b7526b30a 100755
--- a/rt/lib/RT/Interface/Web/QueryBuilder.pm
+++ b/rt/lib/RT/Interface/Web/QueryBuilder.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -22,9 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# CONTRIBUTION SUBMISSION POLICY:
diff --git a/rt/lib/RT/Interface/Web/QueryBuilder/Tree.pm b/rt/lib/RT/Interface/Web/QueryBuilder/Tree.pm
index 467627313..67b728339 100755
--- a/rt/lib/RT/Interface/Web/QueryBuilder/Tree.pm
+++ b/rt/lib/RT/Interface/Web/QueryBuilder/Tree.pm
@@ -2,7 +2,7 @@
#
# COPYRIGHT:
#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+# This software is Copyright (c) 1996-2005 Best Practical Solutions, LLC
# <jesse@bestpractical.com>
#
# (Except where explicitly superseded by other copyright notices)
@@ -22,9 +22,7 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
# CONTRIBUTION SUBMISSION POLICY:
diff --git a/rt/lib/RT/Interface/Web/Standalone.pm b/rt/lib/RT/Interface/Web/Standalone.pm
index 319e317b8..bc2423e6d 100755
--- a/rt/lib/RT/Interface/Web/Standalone.pm
+++ b/rt/lib/RT/Interface/Web/Standalone.pm
@@ -1,50 +1,3 @@
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
-# <jesse@bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
package RT::Interface::Web::Standalone;
use strict;