summaryrefslogtreecommitdiff
path: root/rt/lib
diff options
context:
space:
mode:
Diffstat (limited to 'rt/lib')
-rw-r--r--rt/lib/RT.pm2
-rw-r--r--rt/lib/RT/Action/CreateTickets.pm4
-rw-r--r--rt/lib/RT/Approval/Rule/Created.pm2
-rw-r--r--rt/lib/RT/Approval/Rule/NewPending.pm2
-rw-r--r--rt/lib/RT/Approval/Rule/Passed.pm23
-rw-r--r--rt/lib/RT/Approval/Rule/Rejected.pm25
-rw-r--r--rt/lib/RT/Base.pm4
-rw-r--r--rt/lib/RT/Crypt/GnuPG.pm23
-rw-r--r--rt/lib/RT/CustomField_Overlay.pm2
-rw-r--r--rt/lib/RT/I18N.pm80
-rw-r--r--rt/lib/RT/I18N/fi.po2
-rw-r--r--rt/lib/RT/I18N/ru.po2
-rw-r--r--rt/lib/RT/I18N/sv.po2
-rw-r--r--rt/lib/RT/Interface/Web.pm10
-rw-r--r--rt/lib/RT/Interface/Web/Session.pm2
-rw-r--r--rt/lib/RT/Shredder/Plugin.pm2
-rw-r--r--rt/lib/RT/Ticket_Overlay.pm12
-rw-r--r--rt/lib/RT/Transaction_Overlay.pm2
18 files changed, 89 insertions, 112 deletions
diff --git a/rt/lib/RT.pm b/rt/lib/RT.pm
index edfe1fb..adc5422 100644
--- a/rt/lib/RT.pm
+++ b/rt/lib/RT.pm
@@ -57,7 +57,7 @@ use Cwd ();
use vars qw($Config $System $SystemUser $Nobody $Handle $Logger $_INSTALL_MODE);
-our $VERSION = '3.8.10';
+our $VERSION = '3.8.11';
diff --git a/rt/lib/RT/Action/CreateTickets.pm b/rt/lib/RT/Action/CreateTickets.pm
index 7b8a136..08763d5 100644
--- a/rt/lib/RT/Action/CreateTickets.pm
+++ b/rt/lib/RT/Action/CreateTickets.pm
@@ -723,7 +723,7 @@ sub ParseLines {
}
}
- foreach my $date qw(due starts started resolved) {
+ foreach my $date (qw(due starts started resolved)) {
my $dateobj = RT::Date->new( $self->CurrentUser );
next unless $args{$date};
if ( $args{$date} =~ /^\d+$/ ) {
@@ -1080,7 +1080,7 @@ sub UpdateWatchers {
my @results;
- foreach my $type qw(Requestor Cc AdminCc) {
+ foreach my $type (qw(Requestor Cc AdminCc)) {
my $method = $type . 'Addresses';
my $oldaddr = $ticket->$method;
diff --git a/rt/lib/RT/Approval/Rule/Created.pm b/rt/lib/RT/Approval/Rule/Created.pm
index 324061e..40382f9 100644
--- a/rt/lib/RT/Approval/Rule/Created.pm
+++ b/rt/lib/RT/Approval/Rule/Created.pm
@@ -68,4 +68,6 @@ sub Commit {
$self->RunScripAction('Open Tickets' => 'Blank');
}
+RT::Base->_ImportOverlays();
+
1;
diff --git a/rt/lib/RT/Approval/Rule/NewPending.pm b/rt/lib/RT/Approval/Rule/NewPending.pm
index 6d93d82..026f7e6 100644
--- a/rt/lib/RT/Approval/Rule/NewPending.pm
+++ b/rt/lib/RT/Approval/Rule/NewPending.pm
@@ -94,4 +94,6 @@ sub Commit {
}
+RT::Base->_ImportOverlays();
+
1;
diff --git a/rt/lib/RT/Approval/Rule/Passed.pm b/rt/lib/RT/Approval/Rule/Passed.pm
index 1618e6e..e0560ba 100644
--- a/rt/lib/RT/Approval/Rule/Passed.pm
+++ b/rt/lib/RT/Approval/Rule/Passed.pm
@@ -62,13 +62,7 @@ sub Prepare {
sub Commit {
my $self = shift;
- my $note;
- my $t = $self->TicketObj->Transactions;
-
- while ( my $o = $t->Next ) {
- next unless $o->Type eq 'Correspond';
- $note .= $o->Content . "\n" if $o->ContentObj;
- }
+ my $note = $self->GetNotes;
my ($top) = $self->TicketObj->AllDependedOnBy( Type => 'ticket' );
my $links = $self->TicketObj->DependedOnBy;
@@ -108,4 +102,19 @@ sub Commit {
return;
}
+sub GetNotes {
+ my $self = shift;
+ my $t = $self->TicketObj->Transactions;
+ my $note = '';
+
+ while ( my $o = $t->Next ) {
+ next unless $o->Type eq 'Correspond';
+ $note .= $o->Content . "\n" if $o->ContentObj;
+ }
+ return $note;
+
+}
+
+RT::Base->_ImportOverlays();
+
1;
diff --git a/rt/lib/RT/Approval/Rule/Rejected.pm b/rt/lib/RT/Approval/Rule/Rejected.pm
index b10f5f0..a97cf47 100644
--- a/rt/lib/RT/Approval/Rule/Rejected.pm
+++ b/rt/lib/RT/Approval/Rule/Rejected.pm
@@ -65,14 +65,7 @@ sub Commit { # XXX: from custom prepare code
my $self = shift;
if ( my ($rejected) =
$self->TicketObj->AllDependedOnBy( Type => 'ticket' ) ) {
- my $note = '';
- if ( RT->Config->Get('ApprovalRejectionNotes') ) {
- my $t = $self->TicketObj->Transactions;
- while ( my $o = $t->Next ) {
- next unless $o->Type eq 'Correspond';
- $note .= $o->Content . "\n" if $o->ContentObj;
- }
- }
+ my $note = $self->GetNotes;
my $template = $self->GetTemplate('Approval Rejected',
TicketObj => $rejected,
@@ -112,4 +105,20 @@ sub Commit { # XXX: from custom prepare code
}
+sub GetNotes {
+ my $self = shift;
+ my $note = '';
+
+ if ( RT->Config->Get('ApprovalRejectionNotes') ) {
+ my $t = $self->TicketObj->Transactions;
+ while ( my $o = $t->Next ) {
+ next unless $o->Type eq 'Correspond';
+ $note .= $o->Content . "\n" if $o->ContentObj;
+ }
+ }
+ return $note;
+}
+
+RT::Base->_ImportOverlays();
+
1;
diff --git a/rt/lib/RT/Base.pm b/rt/lib/RT/Base.pm
index 3970850..c7fc66e 100644
--- a/rt/lib/RT/Base.pm
+++ b/rt/lib/RT/Base.pm
@@ -168,8 +168,8 @@ sub _ImportOverlays {
my $class = shift;
my ($package,undef,undef) = caller();
$package =~ s|::|/|g;
- for (qw(Overlay Vendor Local)) {
- my $filename = $package."_".$_.".pm";
+ for my $type (qw(Overlay Vendor Local)) {
+ my $filename = $package."_".$type.".pm";
eval { require $filename };
die $@ if ($@ && $@ !~ qr{^Can't locate $filename});
}
diff --git a/rt/lib/RT/Crypt/GnuPG.pm b/rt/lib/RT/Crypt/GnuPG.pm
index 314e6cc..bb8b2db 100644
--- a/rt/lib/RT/Crypt/GnuPG.pm
+++ b/rt/lib/RT/Crypt/GnuPG.pm
@@ -351,6 +351,8 @@ my %supported_opt = map { $_ => 1 } qw(
verbose
);
+our $RE_FILE_EXTENSIONS = qr/pgp|asc/i;
+
# DEV WARNING: always pass all STD* handles to GnuPG interface even if we don't
# need them, just pass 'new IO::Handle' and then close it after safe_run_child.
# we don't want to leak anything into FCGI/Apache/MP handles, this break things.
@@ -891,6 +893,8 @@ sub FindProtectedParts {
# inline PGP block, only in singlepart
unless ( $entity->is_multipart ) {
+ my $file = ($entity->head->recommended_filename||'') =~ /\.${RE_FILE_EXTENSIONS}$/;
+
my $io = $entity->open('r');
unless ( $io ) {
$RT::Logger->warning( "Entity of type ". $entity->effective_type ." has no body" );
@@ -902,8 +906,8 @@ sub FindProtectedParts {
$RT::Logger->debug("Found $type inline part");
return {
Type => $type,
- Format => 'Inline',
- Data => $entity,
+ Format => !$file || $type eq 'signed'? 'Inline' : 'Attachment',
+ Data => $entity,
};
}
$io->close;
@@ -1000,7 +1004,7 @@ sub FindProtectedParts {
# attachments with inline encryption
my @encrypted_indices =
- grep {($entity->parts($_)->head->recommended_filename || '') =~ /\.pgp$/}
+ grep {($entity->parts($_)->head->recommended_filename || '') =~ /\.${RE_FILE_EXTENSIONS}$/}
0 .. $entity->parts - 1;
foreach my $i ( @encrypted_indices ) {
@@ -1472,9 +1476,16 @@ sub DecryptAttachment {
$args{'Data'}->bodyhandle( new MIME::Body::File $res_fn );
$args{'Data'}->{'__store_tmp_handle_to_avoid_early_cleanup'} = $res_fh;
- my $filename = $args{'Data'}->head->recommended_filename;
- $filename =~ s/\.pgp$//i;
- $args{'Data'}->head->mime_attr( $_ => $filename )
+ my $head = $args{'Data'}->head;
+
+ # we can not trust original content type
+ # TODO: and don't have way to detect, so we just use octet-stream
+ # some clients may send .asc files (encryped) as text/plain
+ $head->mime_attr( "Content-Type" => 'application/octet-stream' );
+
+ my $filename = $head->recommended_filename;
+ $filename =~ s/\.${RE_FILE_EXTENSIONS}$//i;
+ $head->mime_attr( $_ => $filename )
foreach (qw(Content-Type.name Content-Disposition.filename));
return %res;
diff --git a/rt/lib/RT/CustomField_Overlay.pm b/rt/lib/RT/CustomField_Overlay.pm
index 9cf608e..5db11db 100644
--- a/rt/lib/RT/CustomField_Overlay.pm
+++ b/rt/lib/RT/CustomField_Overlay.pm
@@ -1417,7 +1417,7 @@ sub SetBasedOn {
return (0, "Permission denied")
unless $cf->Id && $cf->CurrentUserHasRight('SeeCustomField');
- return $self->AddAttribute(
+ return $self->SetAttribute(
Name => "BasedOn",
Description => "Custom field whose CF we depend on",
Content => $cf->Id,
diff --git a/rt/lib/RT/I18N.pm b/rt/lib/RT/I18N.pm
index 2056b3e..4c70922 100644
--- a/rt/lib/RT/I18N.pm
+++ b/rt/lib/RT/I18N.pm
@@ -203,11 +203,6 @@ charset encoding (encoded as octets, *not* unicode-strings). It will
iterate all the entities in $entity, and try to convert each one into
specified charset if whose Content-Type is 'text/plain'.
-the methods are tries in order:
-1) to convert the entity to $encoding,
-2) to interpret the entity as iso-8859-1 and then convert it to $encoding,
-3) forcibly convert it to $encoding.
-
This function doesn't return anything meaningful.
=cut
@@ -248,46 +243,21 @@ sub SetMIMEEntityToEncoding {
if ( $enc ne $charset && $body ) {
my $string = $body->as_string or return;
- # NOTE:: see the comments at the end of the sub.
- Encode::_utf8_off($string);
- my $orig_string = $string;
# {{{ Convert the body
- eval {
- $RT::Logger->debug( "Converting '$charset' to '$enc' for "
- . $head->mime_type . " - "
- . ( $head->get('subject') || 'Subjectless message' ) );
- Encode::from_to( $string, $charset => $enc, Encode::FB_CROAK );
- };
-
- if ($@) {
- $RT::Logger->error( "Encoding error: "
- . $@
- . " falling back to iso-8859-1 => $enc" );
- $string = $orig_string;
- eval {
- Encode::from_to(
- $string,
- 'iso-8859-1' => $enc,
- Encode::FB_CROAK
- );
- };
- if ($@) {
- $RT::Logger->error( "Encoding error: "
- . $@
- . " forcing conversion to $charset => $enc" );
- $string = $orig_string;
- Encode::from_to( $string, $charset => $enc );
- }
- }
+ $RT::Logger->debug( "Converting '$charset' to '$enc' for " . $head->mime_type . " - " . ( $head->get('subject') || 'Subjectless message' ) );
+
+ # NOTE:: see the comments at the end of the sub.
+ Encode::_utf8_off( $string);
+ Encode::from_to( $string, $charset => $enc );
# }}}
- my $new_body = MIME::Body::InCore->new($string);
+ my $new_body = MIME::Body::InCore->new( $string);
# set up the new entity
$head->mime_attr( "content-type" => 'text/plain' )
- unless ( $head->mime_attr("content-type") );
+ unless ( $head->mime_attr("content-type") );
$head->mime_attr( "content-type.charset" => $enc );
$entity->bodyhandle($new_body);
}
@@ -361,13 +331,7 @@ sub DecodeMIMEWordsToEncoding {
# now we have got a decoded subject, try to convert into the encoding
unless ( $charset eq $to_charset ) {
- my $orig_str = $enc_str;
- eval { Encode::from_to( $enc_str, $charset, $to_charset, Encode::FB_CROAK ) };
- if ($@) {
- $enc_str = $orig_str;
- $charset = _GuessCharset( $enc_str );
- Encode::from_to( $enc_str, $charset, $to_charset );
- }
+ Encode::from_to( $enc_str, $charset, $to_charset );
}
# XXX TODO: RT doesn't currently do the right thing with mime-encoded headers
@@ -514,32 +478,10 @@ sub SetMIMEHeadToEncoding {
my @values = $head->get_all($tag);
$head->delete($tag);
foreach my $value (@values) {
- Encode::_utf8_off($value);
- my $orig_value = $value;
if ( $charset ne $enc ) {
- eval {
- Encode::from_to( $value, $charset => $enc, Encode::FB_CROAK );
- };
- if ($@) {
- $RT::Logger->error( "Encoding error: "
- . $@
- . " falling back to iso-8859-1 => $enc" );
- $value = $orig_value;
- eval {
- Encode::from_to(
- $value,
- 'iso-8859-1' => $enc,
- Encode::FB_CROAK
- );
- };
- if ($@) {
- $RT::Logger->error( "Encoding error: "
- . $@
- . " forcing conversion to $charset => $enc" );
- $value = $orig_value;
- Encode::from_to( $value, $charset => $enc );
- }
- }
+
+ Encode::_utf8_off($value);
+ Encode::from_to( $value, $charset => $enc );
}
$value = DecodeMIMEWordsToEncoding( $value, $enc, $tag )
unless $preserve_words;
diff --git a/rt/lib/RT/I18N/fi.po b/rt/lib/RT/I18N/fi.po
index ea75553..fb5d479 100644
--- a/rt/lib/RT/I18N/fi.po
+++ b/rt/lib/RT/I18N/fi.po
@@ -263,7 +263,7 @@ msgstr "%1 muutettu arvosta %2 arvoon %3"
#. ($m->scomp('Elements/SelectChartType', Name => 'ChartStyle', Default => $ChartStyle), $m->scomp('Elements/SelectGroupBy', Name => 'PrimaryGroupBy', Query => $ARGS{Query}, Default => $PrimaryGroupBy))
#. ($m->scomp('SelectChartType', Name => 'ChartStyle'), $m->scomp('SelectGroupBy', Name => 'PrimaryGroupBy', Query => $Query))
msgid "%1 chart by %2"
-msgstr "% kaavio %2"
+msgstr "%1 kaavio %2"
#: share/html/Search/Elements/EditSearches:200
#. ($SavedSearch->{'Object'}->Description)
diff --git a/rt/lib/RT/I18N/ru.po b/rt/lib/RT/I18N/ru.po
index 60111a4..0580e82 100644
--- a/rt/lib/RT/I18N/ru.po
+++ b/rt/lib/RT/I18N/ru.po
@@ -251,7 +251,7 @@ msgstr "%1 изменено с '%2' на '%3'"
#. ($m->scomp('Elements/SelectChartType', Name => 'ChartStyle', Default => $ChartStyle), $m->scomp('Elements/SelectGroupBy', Name => 'PrimaryGroupBy', Query => $ARGS{Query}, Default => $PrimaryGroupBy))
#. ($m->scomp('SelectChartType', Name => 'ChartStyle'), $m->scomp('SelectGroupBy', Name => 'PrimaryGroupBy', Query => $Query))
msgid "%1 chart by %2"
-msgstr "график %1 группированный по"
+msgstr "график %1 группированный по %2"
#: share/html/Search/Elements/EditSearches:200
#. ($SavedSearch->{'Object'}->Description)
diff --git a/rt/lib/RT/I18N/sv.po b/rt/lib/RT/I18N/sv.po
index a156907..5efa87e 100644
--- a/rt/lib/RT/I18N/sv.po
+++ b/rt/lib/RT/I18N/sv.po
@@ -269,7 +269,7 @@ msgstr "%1 ändrat från %2 till %3"
#. ($m->scomp('Elements/SelectChartType', Name => 'ChartStyle', Default => $ChartStyle), $m->scomp('Elements/SelectGroupBy', Name => 'PrimaryGroupBy', Query => $ARGS{Query}, Default => $PrimaryGroupBy))
#. ($m->scomp('SelectChartType', Name => 'ChartStyle'), $m->scomp('SelectGroupBy', Name => 'PrimaryGroupBy', Query => $Query))
msgid "%1 chart by %2"
-msgstr "%1diagram enligt %2"
+msgstr "%1 diagram enligt %2"
#: share/html/Search/Elements/EditSearches:200
#. ($SavedSearch->{'Object'}->Description)
diff --git a/rt/lib/RT/Interface/Web.pm b/rt/lib/RT/Interface/Web.pm
index f56abb3..b3f593a 100644
--- a/rt/lib/RT/Interface/Web.pm
+++ b/rt/lib/RT/Interface/Web.pm
@@ -657,10 +657,11 @@ sub InstantiateNewSession {
sub SendSessionCookie {
my $cookie = CGI::Cookie->new(
- -name => _SessionCookieName(),
- -value => $HTML::Mason::Commands::session{_session_id},
- -path => RT->Config->Get('WebPath'),
- -secure => ( RT->Config->Get('WebSecureCookies') ? 1 : 0 )
+ -name => _SessionCookieName(),
+ -value => $HTML::Mason::Commands::session{_session_id},
+ -path => RT->Config->Get('WebPath'),
+ -secure => ( RT->Config->Get('WebSecureCookies') ? 1 : 0 ),
+ -httponly => ( RT->Config->Get('WebHttpOnlyCookies') ? 1 : 0 ),
);
$HTML::Mason::Commands::r->err_headers_out->{'Set-Cookie'} = $cookie->as_string;
@@ -2299,6 +2300,7 @@ sub _parse_saved_search {
return ( _load_container_object( $obj_type, $obj_id ), $search_id );
}
+package RT::Interface::Web;
RT::Base->_ImportOverlays();
1;
diff --git a/rt/lib/RT/Interface/Web/Session.pm b/rt/lib/RT/Interface/Web/Session.pm
index 0cce092..8ce8afd 100644
--- a/rt/lib/RT/Interface/Web/Session.pm
+++ b/rt/lib/RT/Interface/Web/Session.pm
@@ -170,7 +170,7 @@ sub ClearOld {
my $class = shift || __PACKAGE__;
my $attributes = $class->Attributes;
if( $attributes->{Directory} ) {
- return $class->_CleariOldDir( $attributes->{Directory}, @_ );
+ return $class->_ClearOldDir( $attributes->{Directory}, @_ );
} else {
return $class->_ClearOldDB( $RT::Handle->dbh, @_ );
}
diff --git a/rt/lib/RT/Shredder/Plugin.pm b/rt/lib/RT/Shredder/Plugin.pm
index b7c63ec..3438068 100644
--- a/rt/lib/RT/Shredder/Plugin.pm
+++ b/rt/lib/RT/Shredder/Plugin.pm
@@ -129,7 +129,7 @@ sub List
my %res;
for my $f (reverse @files) {
- $res{$1} = $_ if $f =~ /([^\\\/]+)\.pm$/;
+ $res{$1} = $f if $f =~ /([^\\\/]+)\.pm$/;
}
return %res unless $type;
diff --git a/rt/lib/RT/Ticket_Overlay.pm b/rt/lib/RT/Ticket_Overlay.pm
index 8dd88c9..9f1e26c 100644
--- a/rt/lib/RT/Ticket_Overlay.pm
+++ b/rt/lib/RT/Ticket_Overlay.pm
@@ -471,13 +471,13 @@ sub Create {
);
# Parameters passed in during an import that we probably don't want to touch, otherwise
- foreach my $attr qw(id Creator Created LastUpdated LastUpdatedBy) {
+ foreach my $attr (qw(id Creator Created LastUpdated LastUpdatedBy)) {
$params{$attr} = $args{$attr} if $args{$attr};
}
# Delete null integer parameters
foreach my $attr
- qw(TimeWorked TimeLeft TimeEstimated InitialPriority FinalPriority)
+ (qw(TimeWorked TimeLeft TimeEstimated InitialPriority FinalPriority))
{
delete $params{$attr}
unless ( exists $params{$attr} && $params{$attr} );
@@ -745,7 +745,7 @@ sub _Parse822HeadersForAttributes {
}
- foreach my $date qw(due starts started resolved) {
+ foreach my $date (qw(due starts started resolved)) {
my $dateobj = RT::Date->new($RT::SystemUser);
if ( defined ($args{$date}) and $args{$date} =~ /^\d+$/ ) {
$dateobj->Set( Format => 'unix', Value => $args{$date} );
@@ -2600,7 +2600,7 @@ sub MergeInto {
}
# Update time fields
- foreach my $type qw(TimeEstimated TimeWorked TimeLeft) {
+ foreach my $type (qw(TimeEstimated TimeWorked TimeLeft)) {
my $mutator = "Set$type";
$MergeInto->$mutator(
@@ -2608,7 +2608,7 @@ sub MergeInto {
}
#add all of this ticket's watchers to that ticket.
- foreach my $watcher_type qw(Requestors Cc AdminCc) {
+ foreach my $watcher_type (qw(Requestors Cc AdminCc)) {
my $people = $self->$watcher_type->MembersObj;
my $addwatcher_type = $watcher_type;
@@ -3226,7 +3226,7 @@ sub _ApplyTransactionBatch {
my $batch = $self->TransactionBatch;
my %seen;
- my $types = join ',', grep !$seen{$_}++, grep defined, map $_->Type, grep defined, @{$batch};
+ my $types = join ',', grep !$seen{$_}++, grep defined, map $_->__Value('Type'), grep defined, @{$batch};
require RT::Scrips;
RT::Scrips->new($RT::SystemUser)->Apply(
diff --git a/rt/lib/RT/Transaction_Overlay.pm b/rt/lib/RT/Transaction_Overlay.pm
index b8ea938..4870973 100644
--- a/rt/lib/RT/Transaction_Overlay.pm
+++ b/rt/lib/RT/Transaction_Overlay.pm
@@ -144,7 +144,7 @@ sub Create {
);
# Parameters passed in during an import that we probably don't want to touch, otherwise
- foreach my $attr qw(id Creator Created LastUpdated TimeTaken LastUpdatedBy) {
+ foreach my $attr (qw(id Creator Created LastUpdated TimeTaken LastUpdatedBy)) {
$params{$attr} = $args{$attr} if ($args{$attr});
}