diff options
author | ivan <ivan> | 2012-01-21 03:46:24 +0000 |
---|---|---|
committer | ivan <ivan> | 2012-01-21 03:46:24 +0000 |
commit | fb4ab1073f0d15d660c6cdc4e07afebf68ef3924 (patch) | |
tree | e27a6336cc67eb403c9276a6a1967b904ecfdbbe /rt/lib | |
parent | a7de168188ff30192238c20a194c144e2bfd1716 (diff) | |
parent | 24548f7cf666bac02335d0bc74f81251c7b4ab50 (diff) |
This commit was generated by cvs2svn to compensate for changes in r12472,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'rt/lib')
-rw-r--r-- | rt/lib/RT/Approval/Rule/Created.pm | 2 | ||||
-rw-r--r-- | rt/lib/RT/Approval/Rule/NewPending.pm | 2 | ||||
-rw-r--r-- | rt/lib/RT/Approval/Rule/Passed.pm | 23 | ||||
-rw-r--r-- | rt/lib/RT/Approval/Rule/Rejected.pm | 25 | ||||
-rw-r--r-- | rt/lib/RT/Base.pm | 4 | ||||
-rw-r--r-- | rt/lib/RT/Crypt/GnuPG.pm | 23 | ||||
-rw-r--r-- | rt/lib/RT/I18N.pm | 80 | ||||
-rw-r--r-- | rt/lib/RT/I18N/fi.po | 2 | ||||
-rw-r--r-- | rt/lib/RT/I18N/ru.po | 2 | ||||
-rw-r--r-- | rt/lib/RT/I18N/sv.po | 2 | ||||
-rw-r--r-- | rt/lib/RT/Interface/Web/Session.pm | 2 | ||||
-rw-r--r-- | rt/lib/RT/Shredder/Plugin.pm | 2 |
12 files changed, 72 insertions, 97 deletions
diff --git a/rt/lib/RT/Approval/Rule/Created.pm b/rt/lib/RT/Approval/Rule/Created.pm index 324061e88..40382f9ef 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 6d93d8252..026f7e680 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 1618e6e8f..e0560bac1 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 b10f5f0ea..a97cf47b2 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 39708504a..c7fc66e98 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 314e6cc38..bb8b2dbfc 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/I18N.pm b/rt/lib/RT/I18N.pm index 2056b3e28..4c70922ef 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 ea7555350..fb5d479a2 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 60111a457..0580e82c9 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 a15690797..5efa87ed2 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/Session.pm b/rt/lib/RT/Interface/Web/Session.pm index 0cce092df..8ce8afd2b 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 b7c63ec7f..34380689a 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; |