Lines 17-28
Link Here
|
17 |
# You should have received a copy of the GNU General Public License |
17 |
# You should have received a copy of the GNU General Public License |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
18 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
|
19 |
|
20 |
use strict; |
20 |
use Modern::Perl; |
21 |
use C4::Output; |
21 |
use C4::Output; |
22 |
use C4::Templates; |
22 |
use C4::Templates; |
23 |
use C4::Auth; |
23 |
use C4::Auth; |
24 |
use CGI qw ( -utf8 ); |
24 |
use CGI qw ( -utf8 ); |
25 |
use warnings; |
|
|
26 |
|
25 |
|
27 |
use vars qw($debug); |
26 |
use vars qw($debug); |
28 |
|
27 |
|
Lines 77-83
sub _get_filepath ($;$) {
Link Here
|
77 |
$type = 'create' if $type eq 'addnew'; |
76 |
$type = 'create' if $type eq 'addnew'; |
78 |
if ( $type eq 'create' || $type eq 'save' ) { |
77 |
if ( $type eq 'create' || $type eq 'save' ) { |
79 |
my $file = _get_filepath($referer); |
78 |
my $file = _get_filepath($referer); |
80 |
open my $fh, ">", $file; |
79 |
open my $fh, ">:encoding(utf-8)", $file; |
81 |
if ( $fh ) { |
80 |
if ( $fh ) { |
82 |
# file is open write to it |
81 |
# file is open write to it |
83 |
print $fh |
82 |
print $fh |
Lines 99-111
elsif ( $type eq 'modify' ) {
Link Here
|
99 |
} else { |
98 |
} else { |
100 |
(-w $file) or $error = |
99 |
(-w $file) or $error = |
101 |
"WARNING: You will not be able to save, because your webserver cannot write to '$file'. Contact your admin about help file permissions."; |
100 |
"WARNING: You will not be able to save, because your webserver cannot write to '$file'. Contact your admin about help file permissions."; |
102 |
open (my $fh, '<', $file) or die "Cannot read file '$file'"; # unlikely death, since we just checked |
101 |
open (my $fh, '<:encoding(utf-8)', $file) or die "Cannot read file '$file'"; # unlikely death, since we just checked |
103 |
my $help = ''; |
102 |
my $help = ''; |
104 |
while ( <$fh> ) { |
103 |
while ( <$fh> ) { |
105 |
$help .= /\[% INCLUDE .* %\](.*)$/ ? $1 : $_; |
104 |
$help .= /\[% INCLUDE .* %\](.*)$/ ? $1 : $_; |
106 |
} |
105 |
} |
107 |
close $fh; |
106 |
close $fh; |
108 |
$template->param( 'help' => $help ); |
107 |
$template->param( 'help' => $help ); |
109 |
$type = 'save'; |
108 |
$type = 'save'; |
110 |
} |
109 |
} |
111 |
} |
110 |
} |
112 |
- |
|
|