Lines 10-16
Link Here
|
10 |
# |
10 |
# |
11 |
# Koha is free software; you can redistribute it and/or modify it under the |
11 |
# Koha is free software; you can redistribute it and/or modify it under the |
12 |
# terms of the GNU General Public License as published by the Free Software |
12 |
# terms of the GNU General Public License as published by the Free Software |
13 |
# Foundation; either version 2 of the License, or (at your option) any later |
13 |
# Foundation; either version 3 of the License, or (at your option) any later |
14 |
# version. |
14 |
# version. |
15 |
# |
15 |
# |
16 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
16 |
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY |
Lines 36-47
my $file_id = $input->param("id");
Link Here
|
36 |
my $directory = C4::Context->config('publicdir'); |
36 |
my $directory = C4::Context->config('publicdir'); |
37 |
|
37 |
|
38 |
my ($template, $borrowernumber, $cookie) |
38 |
my ($template, $borrowernumber, $cookie) |
39 |
= get_template_and_user({template_name => "reports/report_files.tt", |
39 |
= get_template_and_user({template_name => "reports/report_files.tt", |
40 |
query => $input, |
40 |
query => $input, |
41 |
type => "intranet", |
41 |
type => "intranet", |
42 |
authnotrequired => 0, |
42 |
authnotrequired => 0, |
43 |
flagsrequired => {reports => '*'}, |
43 |
flagsrequired => {reports => '*'}, |
44 |
}); |
44 |
}); |
45 |
|
45 |
|
46 |
unless($directory) { |
46 |
unless($directory) { |
47 |
$template->param(error_no_publicdir => 1); |
47 |
$template->param(error_no_publicdir => 1); |
Lines 49-58
unless($directory) {
Link Here
|
49 |
else { |
49 |
else { |
50 |
#Get the files list |
50 |
#Get the files list |
51 |
my @files_list; |
51 |
my @files_list; |
52 |
opendir(DIR, $directory); |
52 |
opendir(DIR, $directory); |
53 |
|
53 |
|
54 |
foreach my $filename (readdir(DIR)) { |
54 |
foreach my $filename (readdir(DIR)) { |
55 |
my $id = md5_hex($filename); |
55 |
my $id = md5_hex($filename); |
56 |
my $full_path = "$directory/$filename"; |
56 |
my $full_path = "$directory/$filename"; |
57 |
next if ($filename =~ /^\./ or -d $full_path); |
57 |
next if ($filename =~ /^\./ or -d $full_path); |
58 |
|
58 |
|
Lines 75-88
else {
Link Here
|
75 |
-Content_length => -s "$directory/$filename", |
75 |
-Content_length => -s "$directory/$filename", |
76 |
-attachment => "$filename"); |
76 |
-attachment => "$filename"); |
77 |
|
77 |
|
78 |
open FILE, "<:utf8", "$directory/$filename"; |
78 |
my $fh; |
79 |
binmode FILE; |
79 |
open $fh, "<:encoding(UTF-8)", "$directory/$filename"; |
|
|
80 |
binmode $fh; |
80 |
|
81 |
|
81 |
my $buf; |
82 |
my $buf; |
82 |
while(read(FILE, $buf, 65536)) { |
83 |
while(read($fh, $buf, 65536)) { |
83 |
print $buf; |
84 |
print $buf; |
84 |
} |
85 |
} |
85 |
close FILE; |
86 |
close $fh; |
86 |
|
87 |
|
87 |
exit(1); |
88 |
exit(1); |
88 |
} |
89 |
} |
89 |
- |
|
|