Bugzilla – Attachment 70167 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.20 KB, created by
Katrin Fischer
on 2017-12-26 21:27:05 UTC
(
hide
)
Description:
Bug 19847: Track links within the records and 404 for others
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2017-12-26 21:27:05 UTC
Size:
2.20 KB
patch
obsolete
>From dfc5f02d9833c518cec55f9a0ccbe5b12f57ffb4 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> >--- > opac/tracklinks.pl | 32 ++++++++++++++++++-------------- > 1 file changed, 18 insertions(+), 14 deletions(-) > >diff --git a/opac/tracklinks.pl b/opac/tracklinks.pl >index 02b402deac..48076cf860 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.11.0
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