Bugzilla – Attachment 70283 Details for
Bug 19847
tracklinks.pl accepts any url from a parameter for proxying
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19847: Track links within the records and 404 for others
Bug-19847-Track-links-within-the-records-and-404-f.patch (text/plain), 2.25 KB, created by
Nick Clemens (kidclamp)
on 2018-01-05 11:25:37 UTC
(
hide
)
Description:
Bug 19847: Track links within the records and 404 for others
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2018-01-05 11:25:37 UTC
Size:
2.25 KB
patch
obsolete
>From 66ac1bf306f317a6c03f3bc46a9ab6e86751e911 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 20 Dec 2017 12:13:10 -0300 >Subject: [PATCH] Bug 19847: Track links within the records and 404 for others > >Test plan: >Behave like a robot, you will get 404 >Be a human, you will be tracked > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > opac/tracklinks.pl | 32 ++++++++++++++++++-------------- > 1 file changed, 18 insertions(+), 14 deletions(-) > >diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl >index 02b402d..48076cf 100755 >--- a/opac/tracklinks.pl >+++ b/opac/tracklinks.pl >@@ -21,6 +21,7 @@ > use Modern::Perl; > use C4::Context; > use C4::Auth qw(checkauth); >+use C4::Biblio; > use Koha::Linktracker; > use CGI qw ( -utf8 ); > >@@ -54,25 +55,28 @@ if ($uri) { > my $biblionumber = $cgi->param('biblionumber') || 0; > my $itemnumber = $cgi->param('itemnumber') || 0; > >- $tracker->trackclick( >- { >- uri => $uri, >- biblionumber => $biblionumber, >- borrowernumber => $borrowernumber, >- itemnumber => $itemnumber >- } >- ); >- print $cgi->redirect($uri); >+ my $record = C4::Biblio::GetMarcBiblio({ biblionumber => $biblionumber }); >+ my $marc_urls = C4::Biblio::GetMarcUrls($record, C4::Context->preference('marcflavour')); >+ if ( grep { /^$uri$/ } map { $_->{MARCURL} } @$marc_urls ) { >+ $tracker->trackclick( >+ { >+ uri => $uri, >+ biblionumber => $biblionumber, >+ borrowernumber => $borrowernumber, >+ itemnumber => $itemnumber >+ } >+ ); >+ print $cgi->redirect($uri); >+ exit; >+ } > } > else { > > # We have a valid url, but we shouldn't track it, just redirect > print $cgi->redirect($uri); >+ exit; > } > } >-else { > >- # we shouldn't be here, bail out >- print $cgi->redirect("/cgi-bin/koha/errors/404.pl"); # escape early >- exit; >-} >+print $cgi->redirect("/cgi-bin/koha/errors/404.pl"); # escape early >+exit; >-- >2.1.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 19847
:
69949
|
69975
|
70167
| 70283