From: Stephen L Johnson Date: Mon, 6 Mar 2000 00:58:40 +0000 (+0000) Subject: fixed recursion problem with header() and footer() functions X-Git-Tag: spong-2_7-alpha5~52 X-Git-Url: http://git.etc.gen.nz/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b22bfccf6346c1ebd02306e3e74555adff8f3830;p=spong.git fixed recursion problem with header() and footer() functions --- diff --git a/src/www-spong.pl b/src/www-spong.pl index eb00eff..8ac0987 100755 --- a/src/www-spong.pl +++ b/src/www-spong.pl @@ -601,31 +601,33 @@ sub header { if( $reload == 1 && &can_reload() ) { print "\n"; } - &show( "header" ) if -f "$main::WWWHTML/header.html"; + &show( "header", 1 ) if -f "$main::WWWHTML/header.html"; } sub footer { - &show( "footer" ) if -f "$main::WWWHTML/footer.html"; } + if ($main::footer_printer == 1 ) { return; } + $main::footer_printer = 1; + &show( "footer", 1 ) if -f "$main::WWWHTML/footer.html"; } # This just takes a HTML template with a given name, and sends it to STDOUT. # This is used primarily for the help documentation. sub show { - my $file = shift; + my ($file, $hf) = @_; my $show = $main::WWWSPONG . "/help"; if( -f "$main::WWWHTML/$file.html" ) { - &header( '', "Help", '', 0 ); + &header( '', "Help", '', 0 ) unless $hf; open( FILE, "$main::WWWHTML/$file.html" ); while( ) { s/!!WWWSHOW!!/$show/g; print $_; } close( FILE ); - &footer(); + &footer() unless $hf; } else { - &header( '', "Help", '', 0 ); + &header( '', "Help", '', 0 ) unless $hf; print "

Help Not Available

\n"; print "Sorry, but no help has been provided for that topic.\n"; - &footer(); + &footer() unless $hf; } }