Koha/koha-tmpl/intranet-tmpl/prog/en/modules/reports/serials_stats.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

155 lines
5.1 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE KohaDates %]
[% USE Branches %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Reports &rsaquo; Serials subscriptions stats</title>
[% INCLUDE 'doc-head-close.inc' %]
<style type="text/css">
.sql {display: none;}
</style>
[% Asset.css("css/datatables.css") | $raw %]
</head>
<body id="rep_serials_stats" class="rep">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/reports/reports-home.pl">Reports</a> &rsaquo; Serials subscriptions stats</div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<h1>Serials subscriptions</h1>
[% IF ( do_it ) %]
<table id="resulttable">
<thead>
<tr>
<th>Vendor</th>
<th>Title</th>
<th>Subscription id</th>
<th>Branch</th>
<th>Call number</th>
<th>Subscription begin</th>
<th>Subscription end</th>
<th>Expired? / Closed?</th>
</tr>
</thead>
<tbody>
<tr>
[% FOREACH data IN datas %]
<td><a href="/cgi-bin/koha/acqui/supplier.pl?booksellerid=[% data.aqbooksellerid | html %]">[% data.name | html %]</a></td>
<td><a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% data.subscriptionid | html %]">[% data.title | html %]</a></td>
<td>[% data.subscriptionid | html %]</td>
<td>[% Branches.GetName( data.branchcode ) | html %]</td>
<td>[% data.callnumber | html %]</td>
<td><span title="[% data.startdate | html %]">[% data.startdate | $KohaDates %]</span></td>
<td><span title="[% data.enddate | html %]">[% data.enddate | $KohaDates %]</span></td>
<td>
[% IF data.closed %]
Closed
[% ELSIF data.expired %]
Expired
[% END %]
</td>
</tr>
[% END %]
</tr>
</tbody>
</table>
[% ELSE %]
<form method="post" action="/cgi-bin/koha/reports/serials_stats.pl">
<fieldset class="rows">
<ol>
<li>
<label for="bookseller">
Vendor:
</label>
<select name="bookseller" id="bookseller">
<option value="">Any vendor</option>
[% FOREACH bookseller IN booksellers %]
<option value="[% bookseller.aqbooksellerid | html %]">[% bookseller.name | html %]</option>
[% END %]
</select>
</li><li>
<label for="branchcode">
Library:
</label>
<select name="branchcode" id="branchcode">
<option value="">Any library</option>
[% PROCESS options_for_libraries libraries => Branches.all() %]
</select>
</li>
<li>
<label for="expired">Include expired subscriptions: </label>
<input type="checkbox" name="expired" id="expired" />
</li>
</ol>
</fieldset>
<fieldset class="rows">
<legend>Output</legend>
<ol>
<li>
<label for="outputscreen">To screen into the browser: </label><input type="radio" checked="checked" name="output" id="outputscreen" value="screen" />
</li>
<li>
<label for="outputfile">To a file:</label> <input type="radio" name="output" value="file" id="outputfile" />
<label class="inline" for="basename">Named: </label><input type="text" name="basename" id="basename" value="Export" />
<label class="inline" for="MIME">Into an application:</label>
<select name="MIME" id="MIME" size="1">
[% FOREACH value IN CGIextChoice %]
<option value="[% value | html %]">[% value | html %]</option>
[% END %]
</select>
<select name="sep" id="sep" size="1">
[% FOREACH value IN CGIsepChoice.values.sort() %]
[% IF ( value == CGIsepChoice.default ) %]
<option value="[% value | html %]" selected="selected">[% value | html %]</option>
[% ELSE %]
<option value="[% value | html %]">[% value | html %]</option>
[% END %]
[% END %]
</select>
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Submit" />
<input type="hidden" name="report_name" value="[% report_name | html %]" />
<input type="hidden" name="do_it" value="1" />
</fieldset>
</form>
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'reports-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
$(document).ready(function() {
$("#resulttable").dataTable($.extend(true, {}, dataTablesDefaults, {
"sDom": 't',
"bPaginate": false,
"aoColumns": [
null,{ "sType": "anti-the" },null,null,null,{ "sType": "title-string" },{ "sType": "title-string" },null
],
}));
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]