[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

SF.net SVN: ledger-smb: [1673] trunk/LedgerSMB/Template.pm



Revision: 1673
          http://ledger-smb.svn.sourceforge.net/ledger-smb/?rev=1673&view=rev
Author:   tetragon
Date:     2007-09-28 12:12:05 -0700 (Fri, 28 Sep 2007)

Log Message:
-----------
Adding some limitations to template format names

Modified Paths:
--------------
    trunk/LedgerSMB/Template.pm

Modified: trunk/LedgerSMB/Template.pm
===================================================================
--- trunk/LedgerSMB/Template.pm	2007-09-27 03:24:20 UTC (rev 1672)
+++ trunk/LedgerSMB/Template.pm	2007-09-28 19:12:05 UTC (rev 1673)
@@ -137,6 +137,9 @@
 
 	bless $self, $class;
 
+	if ($self->{format} !~ /^\p{IsAlnum}+$/) {
+		throw Error::Simple "Invalid format";
+	}
 	if (!$self->{include_path}){
 		$self->{include_path} = $self->{'myconfig'}->{'templates'};
 		if (defined $self->{language}){
@@ -169,6 +172,9 @@
 sub render {
 	my $self = shift;
 	my $vars = shift;
+	if ($self->{format} !~ /^\p{IsAlnum}+$/) {
+		throw Error::Simple "Invalid format";
+	}
 	my $format = "LedgerSMB::Template::$self->{format}";
 
 	eval "require $format";
@@ -217,6 +223,9 @@
 	my $self = shift;
 	my $data = shift;
 	$data ||= $self->{output};
+	if ($self->{format} !~ /^\p{IsAlnum}+$/) {
+		throw Error::Simple "Invalid format";
+	}
 	my $format = "LedgerSMB::Template::$self->{format}";
 	my $disposition = "\n";
 	my $name = $format->can('postprocess')->($self);


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.