diff --git a/Slash/Custom/ApacheSSI/ApacheSSI.pm b/Slash/Custom/ApacheSSI/ApacheSSI.pm new file mode 100644 index 000000000..353553260 --- /dev/null +++ b/Slash/Custom/ApacheSSI/ApacheSSI.pm @@ -0,0 +1,60 @@ +# This code is a part of Slash, and is released under the GPL. +# Copyright 1997-2003 by Open Source Development Network. See README +# and COPYING for more information, or see http://slashcode.com/. +# $Id$ + +# this merely overrides a "broken" method in Apache::SSI, +# where include directives don't work for mixing with Apache::Compress +# -- patch comes from author of Apache::SSI and Apache::Compress + +# also fudges the Slash ssi directives to not print, but merely return + + +package Slash::Custom::ApacheSSI; + +use strict; +use base 'Apache::SSI'; +use vars qw($VERSION); + +use Apache::Constants qw(:common OPT_INCNOEXEC); + +($VERSION) = ' $Revision$ ' =~ /\$Revision:\s+([^\s]+)/; + +sub ssi_perl { + my($self, $args, $margs) = @_; + $args->{'sub'} =~ s/print Slash::getAd/Slash::getAd/; + $margs = [ %$args ]; + $self->SUPER::ssi_perl($args, $margs); +} + +sub ssi_include { + my ($self, $args) = @_; + unless (exists $args->{file} or exists $args->{virtual}) { + return $self->error("No 'file' or 'virtual' attribute found in SSI 'include' tag"); + } + my $subr = $self->find_file($args); + if (lc($self->{_r}->dir_config('ASSI_Subrequests')) eq 'off') { + if (my $fh = Apache::File->new($subr->filename())) { + $subr->dir_config->add('ASSI_Subrequests' => 'off'); + do {local $/; ref($self)->new( scalar(<$fh>), $subr )}->output; + } else { + $self->error("Include of ", $subr->filename, " failed: $!"); + } + } else { + unless ($subr->run == OK) { + $self->error("Include of '@{[$subr->filename()]}' failed: $!"); + } + } + + ## Make sure that all of the variables set in the include are present here. + #my $env = $subr->subprocess_env(); + #foreach ( keys %$env ) { + # $self->{_r}->subprocess_env($_, $env->{$_}); + #} + + return ''; +} + +1; + +__END__ diff --git a/Slash/Custom/ApacheSSI/MANIFEST b/Slash/Custom/ApacheSSI/MANIFEST new file mode 100644 index 000000000..7cc96db46 --- /dev/null +++ b/Slash/Custom/ApacheSSI/MANIFEST @@ -0,0 +1,3 @@ +ApacheSSI.pm +Makefile.PL +MANIFEST diff --git a/Slash/Custom/ApacheSSI/Makefile.PL b/Slash/Custom/ApacheSSI/Makefile.PL new file mode 100644 index 000000000..84dfbb015 --- /dev/null +++ b/Slash/Custom/ApacheSSI/Makefile.PL @@ -0,0 +1,7 @@ +use ExtUtils::MakeMaker; +# See lib/ExtUtils/MakeMaker.pm for details of how to influence +# the contents of the Makefile that is written. +WriteMakefile( + 'NAME' => 'Slash::Custom::ApacheSSI', + 'VERSION_FROM' => 'ApacheSSI.pm', # finds $VERSION +);