diff options
Diffstat (limited to 'LedgerSMB')
-rwxr-xr-x | LedgerSMB/Form.pm | 18 | ||||
-rw-r--r-- | LedgerSMB/Sysconfig.pm | 6 |
2 files changed, 14 insertions, 10 deletions
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm index d5e699b4..c5828f12 100755 --- a/LedgerSMB/Form.pm +++ b/LedgerSMB/Form.pm @@ -88,7 +88,8 @@ sub new { if (($self->{script} =~ m#(..|\\|/)#)){ $self->error("Access Denied"); } - if (not first {$_ eq $self->{script}} @{LedgerSMB::Sysconfig::scripts}){ + if (($self->{script}) and not first {$_ eq $self->{script}} + @{LedgerSMB::Sysconfig::scripts}){ $self->error('Access Denied'); } @@ -627,7 +628,7 @@ sub parse_template { my $fileid = time; my $tmpfile = $self->{IN}; $tmpfile =~ s/\./_$self->{fileid}./ if $self->{fileid}; - $self->{tmpfile} = "${LedgerSMB::Sysconfig::userspath}/${fileid}_${tmpfile}"; + $self->{tmpfile} = "${LedgerSMB::Sysconfig::tempdir}/${fileid}_${tmpfile}"; my $temphash; if ($self->{format} =~ /(postscript|pdf)/ || $self->{media} eq 'email') { @@ -851,19 +852,16 @@ sub parse_template { # Convert the tex file to postscript if ($self->{format} =~ /(postscript|pdf)/) { - use Cwd; - $self->{cwd} = cwd(); - $self->{tmpdir} = "$self->{cwd}/${LedgerSMB::Sysconfig::userspath}"; - $self->{tmpdir} = "${LedgerSMB::Sysconfig::userspath}" if - ${LedgerSMB::Sysconfig::userspath} =~ /^\//; + $self->{tmpdir} = "${LedgerSMB::Sysconfig::tempdir}"; - unless (chdir("${LedgerSMB::Sysconfig::userspath}")) { + unless (chdir($self->{tmpdir})) { $err = $!; $self->cleanup; - $self->error("chdir : $err"); + $self->debug; + $self->error("chdir : $self->{tmpdir} : $err"); } - $self->{tmpfile} =~ s/${LedgerSMB::Sysconfig::userspath}\///g; + $self->{tmpfile} =~ s/$self->{tmpdir}\///g; $self->{errfile} = $self->{tmpfile}; $self->{errfile} =~ s/tex$/err/; diff --git a/LedgerSMB/Sysconfig.pm b/LedgerSMB/Sysconfig.pm index ef91c45d..d16cb60a 100644 --- a/LedgerSMB/Sysconfig.pm +++ b/LedgerSMB/Sysconfig.pm @@ -34,6 +34,9 @@ $userspath = "users"; # templates base directory $templates = "templates"; +# Temporary files stored at" +$tempdir = ($ENV{TEMP} || '/tmp'); + # member file $memberfile = "users/members"; @@ -64,6 +67,8 @@ $localepath = 'locale/po'; my %config; read_config('ledgersmb.conf' => %config) or die; +# We should clean this code up for 1.3 :-) Chris T. + $logging = $config{''}{logging} if $config{''}{logging}; $check_max_invoices = $config{''}{check_max_invoices} if $config{''}{check_max_invoices}; @@ -81,6 +86,7 @@ $ENV{PERL5LIB} .= ":".(join ':', @{$config{environment}{PERL5LIB}}) if $localepath = $config{paths}{localepath} if $config{paths}{localepath}; $spool = $config{paths}{spool} if $config{paths}{spool}; $templates = $config{paths}{templates} if $config{paths}{templates}; +$tempdir = $config{paths}{tempdir} if $config{paths}{tempdir}; $gzip = $config{programs}{gzip} if $config{programs}{gzip}; |