UserDB: log timestamps to second granularity
[interchange.git] / code / SystemTag / include.coretag
1 # Copyright 2002-2007 Interchange Development Group and others
2
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License as published by
5 # the Free Software Foundation; either version 2 of the License, or
6 # (at your option) any later version.  See the LICENSE file for details.
7
8 # $Id: include.coretag,v 1.8 2007-03-30 23:40:49 pajamian Exp $
9
10 UserTag include             Order        file locale
11 UserTag include             PosNumber    2
12 UserTag include             Version      $Revision: 1.8 $
13 UserTag include             Routine      <<EOR
14 sub {
15         my ($file, $locale) = @_;
16         $locale = 1 unless defined $locale;
17
18         $::Instance->{include_depth} ||= 0;
19         my $limit = $Vend::Cfg->{Limit}{include_depth} || 10;
20
21         if($::Instance->{include_depth}++ >= $limit) {
22                 logOnce(
23                                 'error',
24                                 "Depth of include (%s) exceeds limit of %s for file %s.", 
25                                 $::Instance->{include_depth},
26                                 $limit,
27                                 $file,
28                         );
29                 return;
30         }
31
32         my $out = Vend::Interpolate::interpolate_html(
33                                         Vend::Util::readfile($file, undef, $locale)
34                                 );
35         $::Instance->{include_depth}--;
36         return $out;
37 }
38 EOR