Koha::Exceptions::NoPermission->throw( 'bad template path' );
} else {
# Check allowed dirs
my $dirs = C4::Context->config("pluginsdir");
my $cdirs = C4::Context->config("pluginsdir");
$dirs = [ $dirs ] if !ref($dirs);
my $dirs = [!ref($cdirs)?$cdirs:@$cdirs];
unshift @$dirs, C4::Context->config('opachtdocs'), C4::Context->config('intrahtdocs');
my $found = 0;
foreach my $dir ( @$dirs ) {
-