package FS::CGI;
use strict;
-use vars qw(@EXPORT_OK @ISA);
+use vars qw(@EXPORT_OK @ISA @header);
use Exporter;
use CGI;
use URI::URL;
@ISA = qw(Exporter);
@EXPORT_OK = qw(header menubar idiot eidiot popurl table itable ntable);
+@header = ( '-Expires' => '-1',
+ '-Pragma' => 'no-cache',
+ '-Cache-Control' => 'no-cache' );
+
=head1 NAME
FS::CGI - Subroutines for the web interface
=cut
sub header {
- my($title,$menubar)=@_;
+ my($title,$menubar,$etc)=@_; #$etc is for things like onLoad= etc.
+ use Carp;
+ $etc = '' unless defined $etc;
my $x = <<END;
<HTML>
$title
</TITLE>
</HEAD>
- <BODY BGCOLOR="#e8e8e8">
+ <BODY BGCOLOR="#e8e8e8"$etc>
<FONT SIZE=7>
$title
</FONT>
#warn "idiot depriciated";
my($error)=@_;
my $cgi = &FS::UID::cgi();
- if ( $cgi->isa('CGI::Base') ) {
- no strict 'subs';
- &CGI::Base::SendHeaders;
- } else {
- print $cgi->header( '-expires' => 'now' );
- }
+# if ( $cgi->isa('CGI::Base') ) {
+# no strict 'subs';
+# &CGI::Base::SendHeaders;
+# } else {
+ print $cgi->header( @FS::CGI::header );
+# }
print <<END;
<HTML>
<HEAD>
=cut
sub eidiot {
- #warn "eidiot depriciated";
+ warn "eidiot depriciated";
idiot(@_);
- exit;
+ if (exists $ENV{MOD_PERL}) {
+ $main::Response->End()
+ if defined $main::Response
+ && $main::Response->isa('Apache::ASP::Response');
+ require Apache;
+ Apache::exit();
+ } else {
+ exit;
+ }
}
=item popurl LEVEL
sub popurl {
my($up)=@_;
- my($cgi)=&FS::UID::cgi;
- my($url)=new URI::URL $cgi->url;
+ my $cgi = &FS::UID::cgi;
+ my $url = new URI::URL ( $cgi->isa('Apache') ? $cgi->uri : $cgi->url );
my(@path)=$url->path_components;
splice @path, 0-$up;
$url->path_components(@path);