Koha/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-illrequests.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

239 lines
13 KiB
Text

[% USE raw %]
[% USE Koha %]
[% USE Branches %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Your Interlibrary loan requests</title>[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-illrequests' bodyclass='scrollto' %]
[% BLOCK messages %]
[% IF message == "1" %]
<div class="alert alert-success" role="alert">Request updated</div>
[% ELSIF message == "2" %]
<div class="alert alert-success" role="alert">Request placed</div>
[% END %]
[% END %]
[% INCLUDE 'masthead.inc' %]
<div class="main">
<ul class="breadcrumb noprint">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
[% IF ( logged_in_user ) %]
<li><a href="/cgi-bin/koha/opac-user.pl">[% INCLUDE 'patron-title.inc' patron = logged_in_user %]</a> <span class="divider">&rsaquo;</span></li>
[% END %]
[% IF method != 'list' %]
<li><a href="/cgi-bin/koha/opac-illrequests.pl">Interlibrary loan requests</a> <span class="divider">&rsaquo;</span></li>
[% IF method == 'create' %]
<li>New Interlibrary loan request</li>
[% ELSIF method == 'view' %]
<li>View Interlibrary loan request</li>
[% END %]
[% ELSE %]
<li>Interlibrary loan requests</li>
[% END %]
</ul> <!-- / .breadcrumb -->
<div class="container-fluid">
<div class="row-fluid">
[% IF ( OpacNav||loggedinusername ) && !print %]
<div class="span2">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
[% END %]
[% IF ( OpacNav||loggedinusername ) %]
<div class="span10">
[% ELSE %]
<div class="span12">
[% END %]
[% IF !backends_available %]
<div class="alert">ILL module configuration problem. Contact your administrator.</div>
[% ELSE %]
<div id="illrequests" class="maincontent">
[% IF method == 'create' %]
<h2>New Interlibrary loan request</h2>
[% IF stage == 'copyrightclearance' %]
[% INCLUDE messages %]
<div>
<p>
[% Koha.Preference('ILLModuleCopyrightClearance') | $raw %]
</p>
<a href="?method=create&stage=copyrightclearance&backend=[% whole.value.backend | html %]"
class="btn btn-sm btn-default"><i class="fa fa-check"></i> Yes</a>
<a href="/cgi-bin/koha/opac-illrequests.pl"
class="btn btn-sm btn-default"><i class="fa fa-times"></i> No</a>
</div>
[% ELSE %]
[% INCLUDE messages %]
[% IF backends %]
<form method="post" id="illrequestcreate-form" novalidate="novalidate">
<fieldset class="rows">
<label for="backend">Provider:</label>
<select name="backend">
[% FOREACH backend IN backends %]
<option value="[% backend | html %]">[% backend | html %]</option>
[% END %]
</select>
</fieldset>
<fieldset class="action">
<input type="hidden" name="method" value="create">
<input type="submit" name="create_select_backend" value="Next">
</fieldset>
</form>
[% ELSE %]
[% PROCESS $whole.opac_template %]
[% END %]
[% END %]
[% ELSIF method == 'list' %]
<h2>Interlibrary loan requests</h2>
[% INCLUDE messages %]
<div id="illrequests-create-button" class="dropdown btn-group">
[% IF backends.size > 1 %]
<button class="btn btn-default dropdown-toggle" type="button" id="ill-backend-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
<i class="fa fa-plus"></i> Create a new request <span class="caret"></span>
</button>
<ul id="backend-dropdown-options" class="dropdown-menu nojs" aria-labelledby="ill-backend-dropdown">
[% FOREACH backend IN backends %]
<li><a href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backend | html %]">[% backend | html %]</a></li>
[% END %]
</ul>
[% ELSE %]
<a id="ill-new" class="btn btn-default" href="/cgi-bin/koha/opac-illrequests.pl?method=create&amp;backend=[% backends.0 | html %]">
<i class="fa fa-plus"></i> Create a new request
</a>
[% END %]
</div>
<table id="illrequestlist" class="table table-bordered table-striped">
<thead>
<tr>
<th>Author</th>
<th>Title</th>
<th>Requested from</th>
<th>Request type</th>
<th>Status</th>
<th>Request placed</th>
<th>Last updated</th>
<th></th>
</tr>
</thead>
<tbody>
[% FOREACH request IN requests %]
[% status = request.status | html %]
<tr>
<td>[% request.metadata.Author || 'N/A' | html %]</td>
<td>[% request.metadata.Title || 'N/A' | html %]</td>
<td>[% request.backend | html %]</td>
<td>[% request.medium | html %]</td>
<td>[% request.capabilities.$status.name | html %]</td>
<td>[% request.placed | html %]</td>
<td>[% request.updated | html %]</td>
<td>
<a href="/cgi-bin/koha/opac-illrequests.pl?method=view&amp;illrequest_id=[% request.id | html %]" class="btn btn-default btn-small pull-right">View</a>
</td>
</tr>
[% END %]
</tbody>
</table>
[% ELSIF method == 'view' %]
<h2>View Interlibrary loan request</h2>
[% INCLUDE messages %]
[% status = request.status | html %]
<form method="post" action="?method=update" id="illrequestupdate-form" novalidate="novalidate">
<fieldset class="rows">
<legend id="library_legend">Details from library</legend>
<ol>
<li>
<label for="backend">Requested from:</label>
[% request.backend | html %]
</li>
[% IF request.biblio_id %]
<li>
<label for="biblio">Requested item:</label>
<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% request.biblio_id | html %]">Click here to view</a>
</li>
[% END %]
<li>
<label for="branchcode">Collection library:</label>
[% Branches.GetName(request.branchcode) | html %]
</li>
<li>
<label for="status">Status:</label>
[% request.capabilities.$status.name | html %]
</li>
<li>
<label for="medium">Request type:</label>
[% request.medium | html %]
</li>
<li>
<label for="placed">Request placed:</label>
[% request.placed | html %]
</li>
<li>
<label for="updated">Last updated:</label>
[% request.updated | html %]
</li>
<li>
<label for="notesopac">Notes:</label>
[% IF !request.completed %]
<textarea name="notesopac" rows="5" cols="50">[% request.notesopac | html %]</textarea>
[% ELSE %]
[% request.notesopac | html %]
[% END %]
</li>
</ol>
</fieldset>
<div class="rows">
<legend id="backend_legend">Details from [% request.backend | html %]</legend>
[% FOREACH meta IN request.metadata %]
<div class="requestattr-[% meta.key | html %]">
<span class="label">[% meta.key | html %]:</span>
[% meta.value || 'N/A' | html %]
</div>
[% END %]
</div>
<fieldset class="action illrequest-actions">
<input type="hidden" name="illrequest_id" value="[% request.illrequest_id | html %]">
<input type="hidden" name="method" value="update">
[% IF !request.completed %]
[% IF request.status == "NEW" %]
<a class="cancel-illrequest btn btn-danger" href="/cgi-bin/koha/opac-illrequests.pl?method=cancreq&amp;illrequest_id=[% request.illrequest_id | html %]">Request cancellation</a>
[% END %]
<input type="submit" class="update-illrequest btn btn-default" value="Submit modifications">
[% END %]
<span class="cancel"><a href="/cgi-bin/koha/opac-illrequests.pl">Cancel</a></span>
</fieldset>
</form>
[% END %]
</div> <!-- / .maincontent -->
[% END %]
</div> <!-- / .span10/12 -->
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
[% INCLUDE 'datatables.inc' %]
<script>
//<![CDATA[
$("#illrequestlist").dataTable($.extend(true, {}, dataTablesDefaults, {
"columnDefs": [
{ "targets": [ -1 ], "sortable": false, "searchable": false }
],
"order": [[ 3, "desc" ]],
"deferRender": true
}));
$("#backend-dropdown-options").removeClass("nojs");
//]]>
</script>
[% TRY %]
[% PROCESS backend_jsinclude %]
[% CATCH %]
[% END %]
[% END %]