-sub template_params (@) {
- filter => sub {
- my $text_ref = shift;
- ${$text_ref} = decode_utf8(${$text_ref});
- },
- loop_context_vars => 1,
- die_on_bad_params => 0,
- @_,
- no_includes => 1,
-}
+ my $template=srcfile($tpage, 1);
+ if (defined $template) {
+ return $template, $tpage, 1 if wantarray;
+ return $template;
+ }
+ else {
+ $name=~s:/::; # avoid path traversal
+ foreach my $dir ($config{templatedir},
+ "$installdir/share/ikiwiki/templates") {
+ if (-e "$dir/$name") {
+ $template="$dir/$name";
+ last;
+ }
+ }
+ if (defined $template) {
+ return $template, $tpage if wantarray;
+ return $template;
+ }
+ }