Bugzilla – Attachment 69335 Details for
Bug 19691
Enforce OPAC SEARCH LIMIT server-side
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19691 - Move code to opac-search.pl
Bug-19691---Move-code-to-opac-searchpl.patch (text/plain), 3.11 KB, created by
David Bourgault
on 2017-11-24 15:21:20 UTC
(
hide
)
Description:
Bug 19691 - Move code to opac-search.pl
Filename:
MIME Type:
Creator:
David Bourgault
Created:
2017-11-24 15:21:20 UTC
Size:
3.11 KB
patch
obsolete
>From 661526beab158a77b814652a6e829f57eb368cc5 Mon Sep 17 00:00:00 2001 >From: David Bourgault <david.bourgault@inlibro.com> >Date: Fri, 24 Nov 2017 10:20:13 -0500 >Subject: [PATCH] Bug 19691 - Move code to opac-search.pl > >Removes the hidden input from masthead.inc, and adds a line to opac-search.pl to enforce the limit. > >Test plan: >Before: >0) Set OPAC_SEARCH_LIMIT and OPAC_LIMIT_OVERRIDE to valid values in koha-httpd.conf (they should be commented) >1) Reload apache >2) Perform a search in the OPAC. You'll see the limit you specified appended to the URL and reflected in the results. >3) Manually remove the limit from the URL and load the page; the search results will not reflect the limit. > >After: >0) With the same apache config >1) Perform a search from the OPAC. The limit will not show up in the URL, but will be reflected in the search results. There should be no way of circumventing the limit. >--- > koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc | 12 +++--------- > opac/opac-search.pl | 1 + > 2 files changed, 4 insertions(+), 9 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >index e2ff5fa..a837a90 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/masthead.inc >@@ -253,15 +253,9 @@ > <button type="submit" id="searchsubmit" class="btn btn-primary">Go</button> > </div> > [% ELSE %] >- [% IF ( opac_limit_override ) %] >- [% IF ( opac_search_limit ) %] >- <input name="limit" value="[% opac_search_limit %]" type="hidden" /> >- [% END %] >- [% ELSE %] >- [% IF ( mylibraryfirst ) %] >- <input name="limit" value="branch:[% mylibraryfirst %]" type="hidden" /> >- [% END %] >- [% END # / opac_limit_override %] >+ [% IF ( mylibraryfirst ) %] >+ <input name="limit" value="branch:[% mylibraryfirst %]" type="hidden" /> >+ [% END %] > [% END # / OpacAddMastheadLibraryPulldown %] > > </form> >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index ccde617..7370d65 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -470,6 +470,7 @@ if ($operands[0] && !$operands[1]) { > > # limits are use to limit to results to a pre-defined category such as branch or language > my @limits = $cgi->multi_param('limit'); >+push @limits, $ENV{OPAC_SEARCH_LIMIT} if ( $ENV{OPAC_SEARCH_LIMIT} and $ENV{OPAC_LIMIT_OVERRIDE} ); > @limits = map { uri_unescape($_) } @limits; > my @nolimits = $cgi->multi_param('nolimit'); > @nolimits = map { uri_unescape($_) } @nolimits; >-- >2.7.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 19691
: 69335