Lines 20-35
use Modern::Perl;
Link Here
|
20 |
use CGI qw ( -utf8 ); |
20 |
use CGI qw ( -utf8 ); |
21 |
use Encode qw(encode); |
21 |
use Encode qw(encode); |
22 |
use Carp; |
22 |
use Carp; |
23 |
|
23 |
use Digest::MD5 qw(md5_base64); |
24 |
use Mail::Sendmail; |
24 |
use Mail::Sendmail; |
25 |
use MIME::QuotedPrint; |
25 |
use MIME::QuotedPrint; |
26 |
use MIME::Base64; |
26 |
use MIME::Base64; |
|
|
27 |
|
27 |
use C4::Biblio; |
28 |
use C4::Biblio; |
28 |
use C4::Items; |
29 |
use C4::Items; |
29 |
use C4::Auth; |
30 |
use C4::Auth; |
30 |
use C4::Output; |
31 |
use C4::Output; |
31 |
use C4::Templates (); |
32 |
use C4::Templates (); |
32 |
use Koha::Email; |
33 |
use Koha::Email; |
|
|
34 |
use Koha::Token; |
33 |
|
35 |
|
34 |
my $query = new CGI; |
36 |
my $query = new CGI; |
35 |
|
37 |
|
Lines 43-54
my ( $template, $borrowernumber, $cookie ) = get_template_and_user (
Link Here
|
43 |
} |
45 |
} |
44 |
); |
46 |
); |
45 |
|
47 |
|
46 |
my $bib_list = $query->param('bib_list'); |
48 |
my $bib_list = $query->param('bib_list') || ''; |
47 |
my $email_add = $query->param('email_add'); |
49 |
my $email_add = $query->param('email_add'); |
48 |
|
50 |
|
49 |
my $dbh = C4::Context->dbh; |
51 |
my $dbh = C4::Context->dbh; |
50 |
|
52 |
|
|
|
53 |
my $csrf_err; |
51 |
if ( $email_add ) { |
54 |
if ( $email_add ) { |
|
|
55 |
$csrf_err = 1 unless Koha::Token->new->check_csrf({ |
56 |
id => C4::Context->userenv->{id}, |
57 |
secret => md5_base64( C4::Context->config('pass') ), |
58 |
token => scalar $query->param('csrf_token'), |
59 |
}); |
60 |
} |
61 |
|
62 |
if( $csrf_err ) { |
63 |
$template->param( csrf_error => 1, email_add => 1 ); |
64 |
output_html_with_http_headers $query, $cookie, $template->output; |
65 |
} elsif ( $email_add ) { |
52 |
my $email = Koha::Email->new(); |
66 |
my $email = Koha::Email->new(); |
53 |
my %mail = $email->create_message_headers({ to => $email_add }); |
67 |
my %mail = $email->create_message_headers({ to => $email_add }); |
54 |
my $comment = $query->param('comment'); |
68 |
my $comment = $query->param('comment'); |
Lines 165-175
END_OF_BODY
Link Here
|
165 |
output_html_with_http_headers $query, $cookie, $template->output; |
179 |
output_html_with_http_headers $query, $cookie, $template->output; |
166 |
} |
180 |
} |
167 |
else { |
181 |
else { |
168 |
$template->param( bib_list => $bib_list ); |
|
|
169 |
$template->param( |
182 |
$template->param( |
|
|
183 |
bib_list => $bib_list, |
170 |
url => "/cgi-bin/koha/basket/sendbasket.pl", |
184 |
url => "/cgi-bin/koha/basket/sendbasket.pl", |
171 |
suggestion => C4::Context->preference("suggestion"), |
185 |
suggestion => C4::Context->preference("suggestion"), |
172 |
virtualshelves => C4::Context->preference("virtualshelves"), |
186 |
virtualshelves => C4::Context->preference("virtualshelves"), |
|
|
187 |
csrf_token => Koha::Token->new->generate_csrf( |
188 |
{ id => C4::Context->userenv->{id}, |
189 |
secret => md5_base64( C4::Context->config('pass') ), |
190 |
} |
191 |
), |
173 |
); |
192 |
); |
174 |
output_html_with_http_headers $query, $cookie, $template->output; |
193 |
output_html_with_http_headers $query, $cookie, $template->output; |
175 |
} |
194 |
} |