okay, both Apache::ASP and Mason should set no-cache headers now (closes: Bug#23)
[freeside.git] / htetc / global.asa
1 use strict;
2 use vars qw( $cgi $p );
3 use CGI;
4 #use CGI::Carp qw(fatalsToBrowser);
5 use Date::Format;
6 use Date::Parse;
7 use Tie::IxHash;
8 use HTML::Entities;
9 use IO::Handle;
10 use IO::File;
11 use String::Approx qw(amatch);
12 use FS::UID qw(cgisuidsetup dbh getotaker datasrc);
13 use FS::Record qw(qsearch qsearchs fields dbdef);
14 use FS::Conf;
15 use FS::CGI qw(header menubar popurl table itable ntable idiot eidiot
16                small_custview);
17
18 use FS::agent;
19 use FS::agent_type;
20 use FS::domain_record;
21 use FS::cust_bill;
22 use FS::cust_bill_pay;
23 use FS::cust_credit;
24 use FS::cust_credit_bill;
25 use FS::cust_main;
26 use FS::cust_main_county;
27 use FS::cust_pay;
28 use FS::cust_pkg;
29 use FS::cust_refund;
30 use FS::cust_svc;
31 use FS::nas;
32 use FS::part_bill_event;
33 use FS::part_pkg;
34 use FS::part_referral;
35 use FS::part_svc;
36 use FS::pkg_svc;
37 use FS::port;
38 use FS::queue;
39 use FS::raddb;
40 use FS::session;
41 use FS::svc_acct;
42 use FS::svc_acct_pop qw(popselector);
43 use FS::svc_acct_sm;
44 use FS::svc_domain;
45 use FS::svc_forward;
46 use FS::svc_www;
47 use FS::type_pkgs;
48
49 sub Script_OnStart {
50   $Response->AddHeader('Pragma' => 'no-cache');
51   $Response->AddHeader('Cache-control' => 'no-cache');
52   $Response->AddHeader('Expires' => 0);
53
54   $cgi = new CGI;
55   &cgisuidsetup($cgi);
56   $p = popurl(2);
57   #print $cgi->header( '-expires' => 'now' );
58 }
59
60 sub Script_OnFlush {
61   my $ref = $Response->{BinaryRef};
62   $$ref = $cgi->header( @FS::CGI::header ) . $$ref;
63   if ( dbh->can('sprintProfile') ) {
64
65     $$ref =~ s/<\/BODY>[\s\n]*<\/HTML>[\s\n]*$//i
66       or warn "can't remove";
67   
68     $$ref .= '<PRE>'. ("\n"x96). encode_entities(dbh->sprintProfile()). '</PRE>';
69
70     $$ref .= '</BODY></HTML>';
71     
72     dbh->{'private_profile'} = {};
73   }
74 }