Bug 12497: Fix OPAC search history reachable by URL even when disabled

Test plan:
1. Set EnableOpacSearchHistory syspref to "Keep"
2. Make a search in the OPAC
3. Go to /cgi-bin/koha/opac-search-history.pl
4. Set the EnableOpacSearchHistory syspref to "Don't keep"
5. Refresh the OPAC page to show that history is still accessible
6. Apply the patch
7. Refresh the OPAC page, you should end on the 404 page
8. Set EnableOpacSearchHistory syspref to "Keep"
9. Go to /cgi-bin/koha/opac-search-history.pl which should be reachable

Signed-off-by: David Bourgault <david.bourgault@inlibro.com>
Signed-off-by: Charles Farmer <charles.farmer@inLibro.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Victor Grousset 2017-11-24 12:02:47 +01:00 committed by Jonathan Druart
parent edc8031f4a
commit 14f8bce9ae
1 changed files with 5 additions and 0 deletions

View File

@ -45,6 +45,11 @@ my ($template, $loggedinuser, $cookie) = get_template_and_user(
}
);
unless ( C4::Context->preference("EnableOpacSearchHistory") ) {
print $cgi->redirect("/cgi-bin/koha/errors/404.pl"); # escape early
exit;
}
my $type = $cgi->param('type');
my $action = $cgi->param('action') || q{};
my $previous = $cgi->param('previous');