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

338 lines
14 KiB
Text

[% USE raw %]
[% USE Asset %]
[% USE AuthorisedValues %]
[% USE Branches %]
[% USE KohaDates %]
[% SET footerjs = 1 %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Serials &rsaquo; Serial collection information for [% bibliotitle | html %]</title>
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("css/datatables.css") | $raw %]
</head>
<body id="ser_serials-collection" class="ser">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'serials-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/serials/serials-home.pl">Serials</a> &rsaquo; Serial collection information for <i>[% bibliotitle | html %]</i></div>
<div id="doc3" class="yui-t2">
<div id="bd">
<div id="yui-main">
<div class="yui-b">
[% INCLUDE 'modals/serials_multi_receiving.inc' %]
[% UNLESS ( popup ) %]
[% INCLUDE 'serials-toolbar.inc' %]
<h1>Serial collection information for <i>[% bibliotitle | html %]</i>
[% IF location %] ([% AuthorisedValues.GetByCode( 'LOC', location ) | html %]) [% END %]
[% IF ( callnumber ) %]callnumber: [% callnumber | html %][% END %]</h1>
[% END %]
[% IF ( subscriptions ) %]
<table>
[% IF ( subscriptions.size == 1 ) %]
<caption> Subscription summary</caption>
[% ELSE %]
<caption> Subscription summaries</caption>
[% END %]
<tr>
<th>Subscription num.</th>
<th>Frequency</th>
<th>Numbering pattern</th>
<th>Library</th>
<th>Call number</th>
<th>Notes</th>
<th>&nbsp;</th>
</tr>
[% FOREACH subscription IN subscriptions %]
<tr>
<td><a href="subscription-detail.pl?subscriptionid=[% subscription.subscriptionid | html %]"># [% subscription.subscriptionid | html %]</a> </td>
<td>[% subscription.frequency.description | html %]</td>
<td>[% subscription.numberpattern.label | html %]</td>
<td>[% IF subscription.branchcode %][% Branches.GetName( subscription.branchcode ) | html %][% END %]</td>
<td> [% subscription.callnumber | html %]</td>
<td> [% subscription.notes | html %]
[% UNLESS subscription.closed %]
[% IF ( subscription.subscriptionexpired ) %]
<br /><span class="problem"> Subscription expired</span>
[% END %]
[% ELSE %]
<br /> Subscription closed
[% END %]
</td>
[% IF ( subscription.abouttoexpire ) || ( subscription.subscriptionexpired ) %]<td class="problem actions">[% ELSE %]<td class="actions">[% END %]
[% UNLESS subscription.closed %]
[% IF ( routing && CAN_user_serials_routing ) %]
[% IF ( subscription.hasRouting ) %]
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid | html %]"><i class="fa fa-pencil"></i> Edit routing list</a>
[% ELSE %]
<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscription.subscriptionid | html %]&amp;op=new"><i class="fa fa-plus"></i> Create routing list</a>
[% END %]
[% END %]
[% IF ( subscription.abouttoexpire ) %]<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscription.subscriptionid | html %]" onclick="popup([% subscription.subscriptionid | html %]); return false;"><i class="fa fa-refresh"></i> Renew</a>
[% ELSE %]
[% IF ( subscription.subscriptionexpired ) %]<a class="btn btn-default btn-xs" href="/cgi-bin/koha/serials/subscription-renew.pl?subscriptionid=[% subscription.subscriptionid | html %]" onclick="popup([% subscription.subscriptionid | html %]); return false;"><i class="fa fa-refresh"></i> Renew</a>
[% ELSE %]
&nbsp;
[% END %]
[% END %]
[% ELSE %]
&nbsp;
[% END %]
</td>
</tr>
[% END %]
[% IF ( subscr ) %]
[% IF ( subscriptioncount > 1 ) %]
<tr ><td colspan="8"> <a href="serials-collection.pl?biblionumber=[% biblionumber | html %]">See any subscription attached to this biblio</a></td>
</tr>
[% END %]
[% END %]
</table>
[% END %]
[% IF ( years ) %]<form name="edition" action="serials-edit.pl" method="post">
<div id="subscription_years" class="toptabs numbered">
<ul>
[% FOREACH year IN years %]
[% IF ( year.year ) %]
[% IF year.year == 'manage' %]
<li><a href="#subscription-year-manage">Manage</a></li>
[% ELSE %]
<li><a href="#subscription-year-[% year.year | html %]">[% year.year | html %]</a></li>
[% END %]
[% END %]
[% END %]
</ul>
[% FOREACH year IN years %]
<div id="subscription-year-[% year.year | html %]">
[% IF ( CAN_user_serials_receive_serials ) %]
<p>
<div class="btn-group"><input type="submit" value="Edit serials" class="btn btn-default btn-sm" /></div>
[% UNLESS subscription.closed %]
<div class="btn-group"><input type="button" value="Generate next" onclick="javascription:generateNext([% subscriptionidlist | html %])" class="btn btn-default btn-sm" /></div>
[% IF ( subscriptions.size == 1 and !serialsadditems ) %]&nbsp;
<div class="btn-group"><input type="button" value="Multi receiving" href="#multi_receiving" class="btn btn-default btn-sm" data-toggle="modal"></div>
[% END %]
[% END %]
</p>
[% END %]
<span class="checkall">
<a class="CheckAll" href="#" onclick="CheckAll('subscription-year-[% year.year | html %]'); return false;">Select all</a>
</span> |
<span class="clearall">
<a class="CheckNone" href="#" onclick="CheckNone('subscription-year-[% year.year | html %]'); return false;">Clear all</a>
</span>
<table class="subscription-year-table">
<thead>
<tr>
[% IF ( CAN_user_serials_receive_serials ) %]<th>Edit</th>[% END %]
[% IF ( subscriptions.size > 1 ) %]
<th># Subs</th>
[% END %]
<th class="title-string">Date published
</th>
<th class="title-string">Date published (text)
</th>
<th class="title-string">Date received
</th>
<th>Number
</th>
<th>Status
</th>
<th>Notes
</th>
<th>Library
</th>
[% IF ( routing ) %]<th>Routing</th>[% END %]
</tr>
</thead>
<tbody>
[% FOREACH serial IN year.serials %]
<tr>
[% IF ( CAN_user_serials_receive_serials ) %]
<td>
[% UNLESS CAN_user_serials_receive_serials %]
disabled
[% ELSE %]
[% IF ( serial.subscriptionexpired ) %]
<input type="checkbox" name="serialid" value="[% serial.serialid | html %]" disabled="disabled" />
[% ELSE %]
[% IF ( serial.checked ) %]
<input type="checkbox" class="checkboxed" name="serialid" checked="checked" value="[% serial.serialid | html %]" />
[% ELSE %]
<input type="checkbox" class="checkboxed" name="serialid" value="[% serial.serialid | html %]" />
[% END %]
[% END %]
[% END %]
</td>
[% END %]
[% IF ( subscriptions.size > 1 ) %]
<td><a href="serials-collection.pl?subscriptionid=[% serial.subscriptionid | html %]">[% serial.subscriptionid | html %]</a></td>
[% END %]
<td>
<span title="[% serial.publisheddate | html %]">
[% IF serial.publisheddate %]
[% serial.publisheddate | $KohaDates %]
[% ELSE %]
Unknown
[% END %]
</span>
</td>
<td>
[% IF serial.publisheddatetext %]
<span title="[% serial.publisheddatetext | html %]">
[% serial.publisheddatetext | html %]
</span>
[% END %]
</td>
<td>
<span title="[% serial.planneddate | html %]">
[% IF serial.planneddate %]
[% serial.planneddate | $KohaDates %]
[% ELSE %]
Unknown
[% END %]
</span>
</td>
<td>
[% IF ( matches = serial.serialseq.match('(.*)Spring(.*)') ) %]
[% matches.0 | html %]Spring[% matches.1 | html %]
[% ELSIF ( matches = serial.serialseq.match('(.*)Summer(.*)') ) %]
[% matches.0 | html %]Summer[% matches.1 | html %]
[% ELSIF ( matches = serial.serialseq.match('(.*)Fall(.*)') ) %]
[% matches.0 | html %]Fall[% matches.1 | html %]
[% ELSIF ( matches = serial.serialseq.match('(.*)Winter(.*)') ) %]
[% matches.0 | html %]Winter[% matches.1 | html %]
[% ELSIF ( matches = prediction.number.match('(.*)Spr(.*)') ) %]
[% matches.0 | html %]Spr[% matches.1 | html %]
[% ELSIF ( matches = prediction.number.match('(.*)Sum(.*)') ) %]
[% matches.0 | html %]Sum[% matches.1 | html %]
[% ELSIF ( matches = prediction.number.match('(.*)Fal(.*)') ) %]
[% matches.0 | html %]Fal[% matches.1 | html %]
[% ELSIF ( matches = prediction.number.match('(.*)Win(.*)') ) %]
[% matches.0 | html %]Win[% matches.1 | html %]
[% ELSE %]
[% serial.serialseq | html %]
[% END %]
</td>
<td>
[% IF ( serial.status1 ) %]Expected[% END %]
[% IF ( serial.status2 ) %]Arrived[% END %]
[% IF ( serial.status3 ) %]Late[% END %]
[% IF ( serial.status4 ) %]Missing[% END %]
[% IF ( serial.status41 ) %]Missing (never received)[% END %]
[% IF ( serial.status42 ) %]Missing (sold out)[% END %]
[% IF ( serial.status43 ) %]Missing (damaged)[% END %]
[% IF ( serial.status44 ) %]Missing (lost)[% END %]
[% IF ( serial.status5 ) %]Not issued[% END %]
[% IF ( serial.status6 ) %]Delete[% END %]
[% IF ( serial.status7 ) %]Claimed[% END %]
[% IF ( serial.status8 ) %]Stopped[% END %]
</td>
<td>
[% serial.notes | html %]
</td>
<td>
[% Branches.GetName( serial.branchcode ) | html %]
</td>
[% IF ( routing ) %]
<td class="actions">
<a href="" onclick="print_slip([% serial.subscriptionid | html %], '[% serial.serialseq.replace("'", "\\'") | html %] ([% serial.publisheddate | $KohaDates %])'); return false" class="btn btn-default btn-xs"><i class="fa fa-print"></i> Print list</a>
</td>
[% END %]
</tr>
[% END %]
</tbody>
</table>
</div>
[% END %]
<input type="hidden" name="subscriptionid" value="[% subscriptionidlist | html %]" />
</div>
</form>
[% END %]
</div>
</div>
<div class="yui-b">
[% INCLUDE 'serials-menu.inc' %]
</div>
</div>
[% MACRO jsinclude BLOCK %]
[% INCLUDE 'datatables.inc' %]
<script type="text/javascript">
var subscriptionid = "[% subscriptionid | html %]";
var MSG_CLOSE_SUBSCRIPTION = _("Are you sure you want to close this subscription?");
var MSG_REOPEN_SUBSCRIPTION = _("Are you sure you want to reopen this subscription?");
var CONFIRM_DELETE_SUBSCRIPTION = _("Are you sure you want to delete this subscription?");
</script>
[% Asset.js("js/serials-toolbar.js") | $raw %]
[% Asset.js("lib/jquery/plugins/jquery.checkboxes.min.js") | $raw %]
<script type="text/javascript">
function print_slip(subscriptionid,issue){
var myurl = 'routing-preview.pl?ok=1&subscriptionid='+subscriptionid+'&issue='+issue;
window.open(myurl,'PrintSlip','width=500,height=500,toolbar=no,scrollbars=yes');
}
function popup(subscriptionid) {
newin=window.open('subscription-renew.pl?mode=popup&subscriptionid='+subscriptionid,'popup','width=500,height=400,toolbar=false,scrollbars=yes');
}
function generateNext(subscriptionid) {
if(confirm(_("Do you really want to generate next serial?"))){
document.location = 'serials-collection.pl?op=gennext&subscriptionid='+subscriptionid;
}
}
function CheckAll( node ) {
$("#"+node).checkCheckboxes();
return false;
}
function CheckNone( node ) {
$("#"+node).unCheckCheckboxes();
return false;
}
$(document).ready(function() {
$('#subscription_years').tabs();
$(".subscription-year-table").dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumnDefs": [
{ "aTargets": [ 0,-1 ], "bSortable": false, "bSearchable": false },
{ "sType": "title-string", "aTargets" : [ "title-string" ] }
],
"aaSorting": [[0, 'desc']],
"sDom": 't',
"bAutoWidth": false,
"bPaginate": false,
"bInfo": false,
"bFilter": false,
} ));
$('#multi_receiving').on('show', function () {
$(this).find(".modal-body").html($(".serials_multi_receiving")[0].outerHTML);
});
$("form[name='edition']").on('submit', function(e){
if ( $(this).find("input[name='serialid']:checked").size() == 0 ) {
e.preventDefault();
alert(_("You must select at least one serial to edit"));
return 0;
}
return 1;
});
});
</script>
[% END %]
[% INCLUDE 'intranet-bottom.inc' %]