$self->{action} = lc $self->{action};
$self->{action} =~ s/( |-|,|#)/_/g;
- $self->{version} = "2.2.0";
- $self->{dbversion} = "2.2.0";
+ $self->{version} = "2.3.0";
$main::lxdebug->leave_sub();
my ($self, $str) = @_;
if ($str && !ref($str)) {
- $str =~ s/"/"/g;
+ $str =~ s/\"/"/g;
}
$str;
my ($self, $str) = @_;
if ($str && !ref($str)) {
- $str =~ s/"/"/g;
+ $str =~ s/"/\"/g;
}
$str;
$main::lxdebug->enter_sub();
my ($self, $file, $additional_params) = @_;
+ my $language;
- if (-f "templates/webpages/${file}_" . $main::myconfig{"countrycode"} .
- ".html") {
- $file = "templates/webpages/${file}_" . $main::myconfig{"countrycode"} .
- ".html";
+ if (!defined($main::myconfig) || !defined($main::myconfig{"countrycode"})) {
+ $language = $main::language;
+ } else {
+ $language = $main::myconfig{"countrycode"};
+ }
+
+ if (-f "templates/webpages/${file}_${language}.html") {
+ if ((-f ".developer") &&
+ (-f "templates/webpages/${file}_master.html") &&
+ ((stat("templates/webpages/${file}_master.html"))[9] >
+ (stat("templates/webpages/${file}_${language}.html"))[9])) {
+ my $info = "Developper information: templates/webpages/${file}_master.html is newer than the localized version.\n" .
+ "Please re-run 'locales.pl' in 'locale/${language}'.";
+ print(qq|<pre>$info</pre>|);
+ die($info);
+ }
+
+ $file = "templates/webpages/${file}_${language}.html";
} elsif (-f "templates/webpages/${file}.html") {
$file = "templates/webpages/${file}.html";
} else {
- $self->error("Web page template '${file}' not found.");
+ my $info = "Web page template '${file}' not found.\n" .
+ "Please re-run 'locales.pl' in 'locale/${language}'.";
+ print(qq|<pre>$info</pre>|);
+ die($info);
}
my $template = HTML::Template->new("filename" => $file,
}
if ($myconfig->{numberformat} eq "1'000.00") {
- $amount =~ s/'//g;
+ $amount =~ s/\'//g;
}
$amount =~ s/,//g;
$par = "";
$var = $_;
-
+
+ # Switch <%analyse%> for template checking
+ # If <%analyse%> is set in the template, you'll find the
+ # parsed output in the user Directory for analysing
+ # Latex errors
+ # <%analyse%> is a switch (allways off, on if set), not a Variable
+ # Set $form->{analysing}="" for system state: never analyse.
+ # Set $form->{analysing}="1" for system state: ever analyse.
+ $self->{analysing} = "1" if (/<%analyse%>/ && !defined $self->{analysing});
+
$two_passes = 1 if (/\\pageref/);
# { Moritz Bunkus
# check for <%include filename%>
if (/\s*<%include /) {
- # get the filename
+ # get the directory/filename
chomp $var;
$var =~ s/\s*<%include (.+?)%>/$1/;
- # mangle filename
- $var =~ s/(\/|\.\.)//g;
+ # mangle filename on basedir
+ $var =~ s/^(\/|\.\.)//g;
# prevent the infinite loop!
next if ($self->{"$var"});
close(FH);
}
- if ($self->{tmpfile}) {
+ if ($self->{analysing} eq "") {
+ if ($self->{tmpfile}) {
- # strip extension
- $self->{tmpfile} =~ s/\.\w+$//g;
- my $tmpfile = $self->{tmpfile};
- unlink(<$tmpfile.*>);
+ # strip extension
+ $self->{tmpfile} =~ s/\.\w+$//g;
+ my $tmpfile = $self->{tmpfile};
+ unlink(<$tmpfile.*>);
+ }
}
chdir("$self->{cwd}");
'&', quotemeta('\n'), '
',
'"', '\$', '%', '_', '#', quotemeta('^'),
- '{', '}', '<', '>', '£', "\r"
+ '{', '}', '<', '>', '£', "\r", '²'
]
},
'html' => {
'
' => '\newline ',
'£' => '\pounds ',
+ '²' => '$^2$',
"\r" => ""
});