Revision b3b1b699
Von Moritz Bunkus vor fast 13 Jahren hinzugefügt
SL/Form.pm | ||
---|---|---|
1094 | 1094 |
|
1095 | 1095 |
# OUT is used for the media, screen, printer, email |
1096 | 1096 |
# for postscript we store a copy in a temporary file |
1097 |
my $fileid = time; |
|
1098 |
my $prepend_userspath; |
|
1099 |
|
|
1100 |
if (!$self->{tmpfile}) { |
|
1101 |
$self->{tmpfile} = "${fileid}.$self->{IN}"; |
|
1102 |
$prepend_userspath = 1; |
|
1103 |
} |
|
1104 |
|
|
1105 |
$prepend_userspath = 1 if substr($self->{tmpfile}, 0, length $userspath) eq $userspath; |
|
1106 |
|
|
1107 |
$self->{tmpfile} =~ s|.*/||; |
|
1108 |
$self->{tmpfile} =~ s/[^a-zA-Z0-9\._\ \-]//g; |
|
1109 |
$self->{tmpfile} = "$userspath/$self->{tmpfile}" if $prepend_userspath; |
|
1097 |
my ($temp_fh, $suffix); |
|
1098 |
$suffix = $self->{IN}; |
|
1099 |
$suffix =~ s/.*\.//; |
|
1100 |
($temp_fh, $self->{tmpfile}) = File::Temp::tempfile( |
|
1101 |
'lx-office-printXXXXXX', |
|
1102 |
SUFFIX => '.' . ($suffix || 'tex'), |
|
1103 |
DIR => $userspath, |
|
1104 |
UNLINK => 1, |
|
1105 |
); |
|
1106 |
close $temp_fh; |
|
1110 | 1107 |
|
1111 | 1108 |
if ($template->uses_temp_file() || $self->{media} eq 'email') { |
1112 | 1109 |
$out = $self->{OUT}; |
... | ... | |
1152 | 1149 |
$mail->{charset} = $::lx_office_conf{system}->{dbcharset} || Common::DEFAULT_CHARSET; |
1153 | 1150 |
$mail->{to} = $self->{EMAIL_RECIPIENT} ? $self->{EMAIL_RECIPIENT} : $self->{email}; |
1154 | 1151 |
$mail->{from} = qq|"$myconfig->{name}" <$myconfig->{email}>|; |
1155 |
$mail->{fileid} = "$fileid.";
|
|
1152 |
$mail->{fileid} = time() . '.' . $$ . '.';
|
|
1156 | 1153 |
$myconfig->{signature} =~ s/\r//g; |
1157 | 1154 |
|
1158 | 1155 |
# if we send html or plain text inline |
Auch abrufbar als: Unified diff
File::Temp für Erzeugung temporärer Dateinamen nutzen
Fix für Bug 1747.