X-Git-Url: http://git.freeside.biz/gitweb/?a=blobdiff_plain;f=htetc%2Fglobal.asa;h=f00ae57f53751a08a4f20ae9551afdcd755900f8;hb=4196bc59e8cceb04c6f76fab46ce249ff0178c43;hp=d87f1eac6ba5b8f718ac0f0a2aecceb6d54af872;hpb=d3eefd3591dbd54a1626cca247c7a34b57d89f96;p=freeside.git diff --git a/htetc/global.asa b/htetc/global.asa index d87f1eac6..f00ae57f5 100644 --- a/htetc/global.asa +++ b/htetc/global.asa @@ -9,6 +9,7 @@ use CGI; use Date::Format; use Date::Parse; use Time::Local; +use File::Basename; use Tie::IxHash; use HTML::Entities; use IO::Handle; @@ -42,6 +43,7 @@ use FS::part_pkg; use FS::part_referral; use FS::part_svc; use FS::part_svc_router; +use FS::part_virtual_field; use FS::pkg_svc; use FS::port; use FS::queue qw(joblisting); @@ -53,11 +55,7 @@ use FS::svc_domain; use FS::svc_forward; use FS::svc_www; use FS::router; -use FS::part_router_field; -use FS::router_field; use FS::addr_block; -use FS::part_sb_field; -use FS::sb_field; use FS::svc_broadband; use FS::type_pkgs; use FS::part_export; @@ -75,7 +73,8 @@ sub Script_OnStart { &cgisuidsetup($cgi); $p = popurl(2); #print $cgi->header( '-expires' => 'now' ); - dbh->{'private_profile'} = {} if dbh->can('sprintProfile'); + #dbh->{'private_profile'} = {} if dbh->can('sprintProfile'); + dbh->{'private_profile'} = {} if UNIVERSAL::can(dbh, 'sprintProfile'); #really should check for FS::Profiler or something # Devel::AutoProfiler _our_ VERSION? thanks a fucking lot @@ -112,7 +111,7 @@ sub Script_OnFlush { #$$ref = $cgi->header() . $$ref; #warn "Script_OnFlush called with dbh ". dbh. "\n"; #if ( dbh->can('sprintProfile') ) { - if ( UNIVERSAL::can(dbh,'sprintProfile') ) { + if ( UNIVERSAL::can(dbh, 'sprintProfile') ) { #warn "dbh can sprintProfile\n"; if ( lc($Response->{ContentType}) eq 'text/html' ) { #con #warn "contenttype is sprintProfile\n"; @@ -139,8 +138,12 @@ if ( defined(@DBIx::Profile::ISA) ) { my( $self, $location) = @_; my $page = $cgi->header. - qq!Redirect to $location

!. - '
'. encode_entities(dbh->sprintProfile()).
+      qq!Redirect to $location!.
+      '

'.
+        ( UNIVERSAL::can(dbh, 'sprintProfile')
+            ? encode_entities(dbh->sprintProfile())
+            : 'DBIx::Profile missing sprintProfile method;'.
+              'unpatched or too old?'                        ).
       "\n\n". &sprintAutoProfile().  '
'. ''; dbh->{'private_profile'} = {}; @@ -189,5 +192,40 @@ sub sprintAutoProfile { } +sub include { + $Response->Include(@_); +} + +if ( defined(@DBIx::Profile::ISA) ) { + + #false laziness w/above + *redirect = sub { + my($location) = @_; + + ${$Response->{BinaryRef}} = + $cgi->header. + qq!Redirect to $location!. + '

'.
+        ( UNIVERSAL::can(dbh, 'sprintProfile')
+            ? encode_entities(dbh->sprintProfile())
+            : 'DBIx::Profile missing sprintProfile method;'.
+              'unpatched or too old?'                        ).
+      "\n\n". &sprintAutoProfile().  '
'. + ''; + + dbh->{'private_profile'} = {}; + + $Response->End; + + }; + +} else { + + *redirect = sub { + $Response->Redirect(@_); + } + +} + 1;