[interchange-cvs] interchange - heins modified
code/SystemTag/include.coretag
interchange-cvs at icdevgroup.org
interchange-cvs at icdevgroup.org
Sat Jun 19 14:04:27 EDT 2004
User: heins
Date: 2004-06-19 18:04:26 GMT
Modified: code/SystemTag include.coretag
Log:
* Change [include ..] to check recursion depth and error out if exceeds
limit (default of 10). Change suggested and prototyped by Daniel
Davenport <ddavenport at newagedigital.com>.
* Limit is set in catalog.cfg with
Limit include_depth 10
It should not normally have to be changed, 10 is plenty.
Revision Changes Path
1.4 +20 -3 interchange/code/SystemTag/include.coretag
rev 1.4, prev_rev 1.3
Index: include.coretag
===================================================================
RCS file: /var/cvs/interchange/code/SystemTag/include.coretag,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- include.coretag 2 Apr 2003 18:48:05 -0000 1.3
+++ include.coretag 19 Jun 2004 18:04:26 -0000 1.4
@@ -1,11 +1,28 @@
UserTag include Order file locale
UserTag include PosNumber 2
+UserTag include Version $Revision: 1.4 $
UserTag include Routine <<EOR
sub {
my ($file, $locale) = @_;
$locale = 1 unless defined $locale;
- return Vend::Interpolate::interpolate_html(
- Vend::Util::readfile($file, undef, $locale)
- );
+
+ $::Instance->{include_depth} ||= 0;
+ my $limit = $Vend::Cfg->{Limit}{include_depth} || 10;
+
+ if($::Instance->{include_depth} >= $limit) {
+ logError(
+ "Depth of include exceeds limit of %s for file %s.",
+ $::Instance->{include_depth},
+ $file,
+ );
+ return;
+ }
+
+ $::Instance->{include_depth}++;
+ my $out = Vend::Interpolate::interpolate_html(
+ Vend::Util::readfile($file, undef, $locale)
+ );
+ $::Instance->{include_depth}--;
+ return $out;
}
EOR
More information about the interchange-cvs
mailing list