Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-readingrecord.tt
Jonathan Druart dcd1f5d48c Bug 13618: Add html filters to all the variables
Here we go, next step then.
As we did not fix the performance issue when autofiltering
the variables (see bug 20975), the only solution we have is to add the
filters explicitely.

This patch has been autogenerated (using add_html_filters.pl, see next
pathces) and add the html filter to all the variables displayed in the
template.
Exceptions are made (using the new 'raw' TT filter) to the variable we
already listed in the previous versions of this patch.

To test:
- Use t/db_dependent/Koha/Patrons.t to populate your DB with autogenerated
data which contain <script> tags

- Remove them from borrower_debarments.comments (there are allowed here)
update  borrower_debarments set comment="html tags possible here";

- From the interface hit page and try to catch alert box.
If you find one it means you find a possible XSS.
To know where it comes from:
* note the exact URL where you found it
* note the alert box content
* Dump your DB and search for the string in the dump to identify its
location (for instance table.field)

Next:
* Ideally we would like to use the raw filter when it is not necessary
to HTML escape the variables (in big loop for instance)
* Provide a QA script to catch missing filters (we want html, uri, url
or raw, certainly others that I am forgetting now)
* Replace the html filters with uri when needed (!)

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-08-17 15:55:05 +00:00

210 lines
13 KiB
Text

[% USE raw %]
[% USE Koha %]
[% USE KohaDates %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your checkout history</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %]
<style>ul.ui-tabs-nav li a, ul.ui-tabs-nav li span.a { padding:0.6em 1em; }</style>
[% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-readingrecord' %]
[% INCLUDE 'masthead.inc' %]
[% IF Koha.Preference('AmazonAssocTag') %]
[% AmazonAssocTag = '?tag=' _ Koha.Preference('AmazonAssocTag') | html %]
[% ELSE %]
[% AmazonAssocTag = '' | html %]
[% END %]
<div class="main">
<ul class="breadcrumb">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
<li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
<li><a href="#">Your checkout history</a></li>
</ul>
<div class="container-fluid">
<div class="row-fluid">
<div class="span2">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
<div class="span10">
<div id="userreadingrecord">
<h3>Checkout history</h3>
[% IF READING_RECORD.size == 0 %]
You have never borrowed anything from this library.
[% ELSE %]
<div id="opac-user-readingrec">
<div class="resultscontrol resort">
<form id="sortform" action="/cgi-bin/koha/opac-readingrecord.pl" method="get">
[% UNLESS ( limit ) %]<input type="hidden" name="limit" value="full" />[% END %]
<select name="order" id="order">
[% IF ( orderbydate ) %]<option value="" selected="selected">Order by date</option>[% ELSE %]<option value="">Order by date</option>[% END %]
[% IF ( orderbytitle ) %]<option value="title" selected="selected">Order by title</option>[% ELSE %]<option value="title">Order by title</option>[% END %]
[% IF ( orderbyauthor ) %]<option value="author" selected="selected">Order by author</option>[% ELSE %]<option value="author">Order by author</option>[% END %]
</select>
<input type="submit" value="Go" id="sortsubmit" class="submit clearfix" />
</form>
</div>
[% IF limit %]
<p>
Showing last 50 items. <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=full[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show all items</a>
</p>
[% ELSE %]
<p>
Showing all items. <a href="/cgi-bin/koha/opac-readingrecord.pl?limit=50[% IF ( orderbytitle ) %]&amp;order=title[% END %]">Show last 50 items</a>
</p>
[% END %]
[% IF Koha.Preference( 'OnSiteCheckouts' ) == 1 %]
<div id="tabs" class="toptabs">
<ul>
<li><a href="#tabs-container" id="tab_all">All</a></li>
<li><a href="#tabs-container" id="tab_checkout">Checkouts</a></li>
<li><a href="#tabs-container" id="tab_onsite_checkout">On-site checkouts</a></li>
</ul>
[% END %]
<div id="tabs-container" style="overflow:hidden">
<table id="readingrec" class="table table-bordered table-striped">
<thead>
<tr>
<th style="display:none;">Type</th>
<th class="nosort"></th>
<th class="anti-the">Title</th>
<th>Item type</th>
<th>Call no.</th>
<th class="title-string">Date</th>
[% IF ( OPACMySummaryHTML ) %]
<th>Links</th>
[% END %]
</tr>
</thead>
<tbody>
[% FOREACH issue IN READING_RECORD %]
<tr>
<td style="display:none;">
[% IF issue.onsite_checkout %][% issuetype = 'onsite_checkout' | html %]
[% ELSE %][% issuetype = 'standard_checkout' | html %]
[% END %]
[% issuetype | html %]
</td>
<td>
[% IF OPACAmazonCoverImages %]
[% IF issue.normalized_isbn %]
<a href="http://www.amazon.com/gp/reader/[% issue.normalized_isbn | html %][% AmazonAssocTag | html %]#reader-link"><img border="0" src="https://images-na.ssl-images-amazon.com/images/P/[% issue.normalized_isbn | html %].01.THUMBZZZ.jpg" alt="" class="item-thumbnail" /></a>
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF GoogleJackets %]
[% IF issue.normalized_isbn %]
<div title="[% issue.biblionumber |url %]" class="[% issue.normalized_isbn | html %]" id="gbs-thumbnail[% loop.count | html %]"></div>
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF BakerTaylorEnabled %]
[% bt_id = ( issue.normalized_upc || issue.normalized_isbn ) | html %]
[% IF ( bt_id ) %]
<a href="https://[% BakerTaylorBookstoreURL | html %][% bt_id | html %]"><img alt="See Baker &amp; Taylor" src="[% BakerTaylorImageURL | html %][% bt_id | html %]" /></a>
[% ELSE %]
<span class="no-image">No cover image available</span>
[% END %]
[% END %]
[% IF SyndeticsEnabled && SyndeticsCoverImages %]
<img src="https://secure.syndetics.com/index.aspx?isbn=[% issue.normalized_isbn | html %]/SC.GIF&amp;client=[% SyndeticsClientCode | html %]&amp;type=xw10&amp;upc=[% issue.normalized_upc | html %]&amp;oclc=[% issue.normalized_oclc | html %]" alt="" class="item-thumbnail" />
[% END %]
</td>
<td>
[% IF issue.BiblioDefaultViewmarc %]
<a class="title" href="/cgi-bin/koha/opac-MARCdetail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title | html %] [% IF issue.subtitle %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield | html %][% END %][% END %]</a>
[% ELSIF issue.BiblioDefaultViewisbd %]
<a class="title" href="/cgi-bin/koha/opac-ISBDdetail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title | html %] [% IF issue.subtitle %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield | html %][% END %][% END %]</a>
[% ELSE %]
<a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% issue.biblionumber |url %]">[% issue.title | html %] [% IF issue.subtitle %][% FOREACH subtitl IN issue.subtitle %][% subtitl.subfield | html %][% END %][% END %]</a>
[% END %]
<span class="item-details">[% issue.author | html %]</span>
</td>
<td>
[% UNLESS ( noItemTypeImages ) %]
[% IF ( issue.imageurl ) %]
<img src="[% issue.imageurl | html %]" alt="" />
[% END %]
[% END %]
<span class="tdlabel">Item type:</span>
[% issue.translated_description | html %]</td>
<td>
<span class="tdlabel">Call number:</span>
[% issue.itemcallnumber | html %]
</td>
<td>
[% IF issue.returndate %]
<span class="tdlabel">Check-in date:</span>
<span title="[% issue.returndate | html %]">[% issue.returndate | $KohaDates %]</span>
[% ELSE %]
<span title="Checked out"><em>(Checked out)</em></span>
[% END %]
</td>
[% IF OPACMySummaryHTML %]
<td>[% issue.MySummaryHTML | $raw %]</td>
[% END %]
</tr>
[% END # / FOREACH issue %]
</tbody>
</table>
</div> <!-- / .tabs-container -->
[% IF ( Koha.Preference( 'OnSiteCheckouts' ) == 1 ) %]
</div> <!-- /#tabs -->
[% END %]
</div> <!-- / .opac-user-readingrec -->
[% END # / IF READING_RECORD.size %]
</div> <!-- / .userreadingrecord -->
</div> <!-- / .span10 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% INCLUDE 'datatables.inc' %]
<script>
//<![CDATA[
$(document).ready(function(){
[% IF ( GoogleJackets ) %]KOHA.Google.GetCoverFromIsbn();[% END %]
$('#sortsubmit').hide();
$('#order').change(function() {
$('#sortform').submit();
});
var table = $("#readingrec").dataTable($.extend(true, {}, dataTablesDefaults, {
"sPaginationType": "four_button",
"columnDefs": [
{ "targets": [ "nosort" ],"sortable": false,"searchable": false },
{ "type": "anti-the", "targets" : [ "anti-the" ] },
{ "type": "title-string", "targets" : [ "title-string" ] }
]
}));
var tabs = $("#tabs").tabs({
select: function(e, ui) {
var id = $(ui.tab).attr("id");
if ( id == "tab_checkout" ) {
table.fnFilter("standard_checkout", 0);
} else if ( id == "tab_onsite_checkout" ) {
table.fnFilter("onsite_checkout", 0);
} else { // all
table.fnFilter('', 0);
}
}
});
});
//]]>
</script>
[% END %]