summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Template.pm
diff options
context:
space:
mode:
authorjocuri%softhome.net <>2006-02-28 23:39:00 +0100
committerjocuri%softhome.net <>2006-02-28 23:39:00 +0100
commit90e1688ef09332be00b31278f8d5ee7703ac81b2 (patch)
tree5bc8d02bc88eda0c195229b3bd2cb6c96c0037d5 /Bugzilla/Template.pm
parentda1db1402be5d249990d1beb5f41390b92f7e0be (diff)
downloadbugzilla-90e1688ef09332be00b31278f8d5ee7703ac81b2.tar.gz
bugzilla-90e1688ef09332be00b31278f8d5ee7703ac81b2.tar.xz
Patch for bug 298341: Implement code hook mechanism; patch by zach@zachlipton.com, r=timeless, a=justdave.
Diffstat (limited to 'Bugzilla/Template.pm')
-rw-r--r--Bugzilla/Template.pm25
1 files changed, 20 insertions, 5 deletions
diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm
index 6327a31a5..57d113ef7 100644
--- a/Bugzilla/Template.pm
+++ b/Bugzilla/Template.pm
@@ -100,6 +100,7 @@ sub sortAcceptLanguage {
# Returns the path to the templates based on the Accept-Language
# settings of the user and of the available languages
# If no Accept-Language is present it uses the defined default
+# Templates may also be found in the extensions/ tree
sub getTemplateIncludePath {
# Return cached value if available
@@ -113,17 +114,14 @@ sub getTemplateIncludePath {
$template_include_path = [
"$templatedir/$languages/$project",
"$templatedir/$languages/custom",
- "$templatedir/$languages/extension",
"$templatedir/$languages/default"
];
} else {
$template_include_path = [
"$templatedir/$languages/custom",
- "$templatedir/$languages/extension",
"$templatedir/$languages/default"
];
}
- return $template_include_path;
}
my @languages = sortAcceptLanguage($languages);
my @accept_language = sortAcceptLanguage($ENV{'HTTP_ACCEPT_LANGUAGE'} || "" );
@@ -144,7 +142,6 @@ sub getTemplateIncludePath {
map((
"$templatedir/$_/$project",
"$templatedir/$_/custom",
- "$templatedir/$_/extension",
"$templatedir/$_/default"
), @usedlanguages
)
@@ -153,12 +150,30 @@ sub getTemplateIncludePath {
$template_include_path = [
map((
"$templatedir/$_/custom",
- "$templatedir/$_/extension",
"$templatedir/$_/default"
), @usedlanguages
)
];
}
+
+ # add in extension template directories:
+ my @extensions = glob($Bugzilla::Config::extensionsdir."/*");
+ foreach my $extension (@extensions) {
+ trick_taint($extension); # since this comes right from the filesystem
+ # we have bigger issues if it is insecure
+ push(@$template_include_path,
+ map((
+ $extension."/template/".$_),
+ @usedlanguages));
+ }
+
+ # remove duplicates since they keep popping up:
+ my @dirs;
+ foreach my $dir (@$template_include_path) {
+ push(@dirs, $dir) unless grep ($dir eq $_, @dirs);
+ }
+ $template_include_path = [@dirs];
+
return $template_include_path;
}