X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htetc%2Fhandler.pl;h=1660cb3fa354354daa49e04a1f82657e132c600b;hb=4196bc59e8cceb04c6f76fab46ce249ff0178c43;hp=b28cfe9e27d3c76d0f5ce93167e53f62a8321d34;hpb=abf5c5442afce5198f6289840791c96f58254e85;p=freeside.git diff --git a/htetc/handler.pl b/htetc/handler.pl index b28cfe9e2..1660cb3fa 100644 --- a/htetc/handler.pl +++ b/htetc/handler.pl @@ -67,6 +67,7 @@ sub handler use Date::Format; use Date::Parse; use Time::Local; + use File::Basename; use Tie::IxHash; use HTML::Entities; use IO::Handle; @@ -120,33 +121,31 @@ sub handler use FS::export_svc; use FS::msgcat; - *notCGI::redirect = sub { + *CGI::redirect = sub { my( $self, $location ) = @_; use vars qw($m); if ( defined(@DBIx::Profile::ISA) ) { #profiling redirect - # my $page = - - - # return $page; + my $page = + qq!Redirect to $location!. + '

'.
+              ( UNIVERSAL::can(dbh, 'sprintProfile')
+                  ? encode_entities(dbh->sprintProfile())
+                  : 'DBIx::Profile missing sprintProfile method;'.
+                    'unpatched or too old?'                        ).
+            #"\n\n". &sprintAutoProfile().  '
'. + "\n\n". ''. + ''; + dbh->{'private_profile'} = {}; + return $page; } else { #normal redirect - #http://www.masonhq.com/docs/faq/#how_do_i_do_an_external_redirect - $m->clear_buffer; - # The next two lines are necessary to stop Apache from re-reading - # POSTed data. - $r->method('GET'); - $r->headers_in->unset('Content-length'); - $r->content_type('text/html'); - #$r->err_header_out('Location' => $location); - $r->header_out('Location' => $location); - $r->header_out('Content-Type' => 'text/html'); - $m->abort(302); - + $m->redirect($location); ''; - } + + } }; @@ -160,6 +159,36 @@ sub handler $m->scomp(@_); } + sub redirect { + my( $location ) = @_; + use vars qw($m); + $m->clear_buffer; + #false laziness w/above + if ( defined(@DBIx::Profile::ISA) ) { #profiling redirect + + $m->print( + qq!Redirect to $location!. + '

'.
+              ( UNIVERSAL::can(dbh, 'sprintProfile')
+                  ? encode_entities(dbh->sprintProfile())
+                  : 'DBIx::Profile missing sprintProfile method;'.
+                    'unpatched or too old?'                        ).
+            #"\n\n". &sprintAutoProfile().  '
'. + "\n\n". ''. + '' + ); + dbh->{'private_profile'} = {}; + + $m->abort(200); + + } else { #normal redirect + + $m->redirect($location); + + } + + } + } # end package HTML::Mason::Commands; $r->content_type('text/html');