Lines 47-52
BEGIN {
Link Here
|
47 |
setlanguagecookie getlanguagecookie pagination_bar parametrized_url |
47 |
setlanguagecookie getlanguagecookie pagination_bar parametrized_url |
48 |
output_html_with_http_headers output_ajax_with_http_headers output_with_http_headers |
48 |
output_html_with_http_headers output_ajax_with_http_headers output_with_http_headers |
49 |
output_and_exit_if_error output_and_exit output_error |
49 |
output_and_exit_if_error output_and_exit output_error |
|
|
50 |
redirect_if_opac_suppressed |
50 |
); |
51 |
); |
51 |
} |
52 |
} |
52 |
|
53 |
|
Lines 412-417
sub parametrized_url {
Link Here
|
412 |
return $ret; |
413 |
return $ret; |
413 |
} |
414 |
} |
414 |
|
415 |
|
|
|
416 |
=item redirect_if_opac_suppressed |
417 |
|
418 |
redirect_if_opac_suppressed( $query, $biblio ) |
419 |
if C4::Context->preference('OpacSuppression'); |
420 |
|
421 |
For a given I<Koha::Biblio> object, it handles redirection if it is suppressed |
422 |
from the OPAC. |
423 |
|
424 |
=cut |
425 |
|
426 |
sub redirect_if_opac_suppressed { |
427 |
my ( $query, $biblio ) = @_; |
428 |
|
429 |
# redirect to opac-blocked info page or 404? |
430 |
my $redirect_url; |
431 |
if ( C4::Context->preference("OpacSuppressionRedirect") ) { |
432 |
$redirect_url = "/cgi-bin/koha/opac-blocked.pl"; |
433 |
} else { |
434 |
$redirect_url = "/cgi-bin/koha/errors/404.pl"; |
435 |
} |
436 |
if ( $biblio->opac_suppressed() ) { |
437 |
|
438 |
# if OPAC suppression by IP address |
439 |
if ( C4::Context->preference('OpacSuppressionByIPRange') ) { |
440 |
my $IPAddress = $ENV{'REMOTE_ADDR'}; |
441 |
my $IPRange = C4::Context->preference('OpacSuppressionByIPRange'); |
442 |
if ( $IPAddress !~ /^$IPRange/ ) { |
443 |
print $query->redirect($redirect_url); |
444 |
C4::Auth::safe_exit(); |
445 |
} |
446 |
} else { |
447 |
print $query->redirect($redirect_url); |
448 |
C4::Auth::safe_exit(); |
449 |
} |
450 |
} |
451 |
} |
452 |
|
415 |
END { } # module clean-up code here (global destructor) |
453 |
END { } # module clean-up code here (global destructor) |
416 |
|
454 |
|
417 |
1; |
455 |
1; |
418 |
- |
|
|