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

108 lines
4.7 KiB
Text

[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle | html %][% ELSE %]Koha online[% END %] catalog &rsaquo; Share a list</title>
[% INCLUDE 'doc-head-close.inc' %]
[% BLOCK cssinclude %][% END %]
</head>
[% INCLUDE 'bodytag.inc' bodyid='opac-shareshelf' bodyclass='scrollto' %]
[% INCLUDE 'masthead.inc' %]
<div class="main">
<ul class="breadcrumb">
<li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
[% IF ( loggedinusername ) %]
<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 %]
<li><a href="/cgi-bin/koha/opac-shelves.pl">Lists</a> <span class="divider">&rsaquo;</span></li>
<li>Share a list</li>
</ul> <!-- / .breadcrumb -->
<div class="container-fluid">
<div class="row-fluid">
[% IF ( OpacNav ) %]
<div class="span2">
<div id="navigation">
[% INCLUDE 'navigation.inc' IsPatronPage=1 %]
</div>
</div>
[% END %]
<div class="span10">
<div id="shareshelf" class="maincontent">
[%# This section contains the essential code for error messages and three operations: invite, confirm_invite and accept. %]
<h2>Share a list with another patron</h2>
[% IF errcode %]
[% IF errcode==1 && op %]<div class="alert">The operation [% op | html %] is not supported.</div>[% END %]
[% IF errcode==1 && !op %]<div class="alert">No operation parameter has been passed.</div>[% END %]
[% IF errcode==2 %]<div class="alert">Invalid shelf number.</div>[% END %]
[% IF errcode==3 %]<div class="alert">The feature of sharing lists is not in use in this library.</div>[% END %]
[% IF errcode==4 %]<div class="alert">You can only share a list if you are the owner.</div>[% END %]
[% IF errcode==5 %]<div class="alert">You cannot share a public list.</div>[% END %]
[% IF errcode==6 %]<div class="alert">Sorry, but you did not enter a valid email address.</div>[% END %]
[% IF errcode==7 %]<div class="alert">Sorry, but we could not accept this key. The invitation may have expired. Contact the patron who sent you the invitation.</div>[% END %]
[% IF errcode==8 %]<div class="alert">As owner of a list you cannot accept an invitation for sharing it.</div>[% END %]
<p><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1">Return to your lists</a></p>
[% ELSIF op=='invite' %]
<div id="invite">
<form id="share_list">
<fieldset class="rows">
<ol>
<input type="hidden" name="op" value="conf_invite"/>
<input type="hidden" name="shelfnumber" value="[% shelfnumber | html %]"/>
<li><label for="name">List name:</label> [% shelfname | html %]</li>
<li>
<label for="invite_address">Email address:</label>
<input id="invite_address" name="invite_address" size="40" />
</li>
</ol>
</fieldset>
<fieldset class="action">
<input type="submit" value="Send" class="btn" />
<a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1" class="cancel">Cancel</a>
</fieldset>
</form>
</div>
[% ELSIF op=='conf_invite' %]
<div id="conf_invite">
[% IF approvedaddress %]
<p>An invitation to share list <i>[% shelfname | html %]</i> will be sent shortly to [% approvedaddress | html %].</p>
[% END %]
[% IF failaddress %]
<p>Something went wrong while processing the following addresses. Please check them. These are: [% failaddress | html %]</p>
[% END %]
[% IF approvedaddress %]
<p>You will receive an email notification if someone accepts your share within two weeks.</p>
[% END %]
<p><a href="/cgi-bin/koha/opac-shelves.pl?op=list&amp;category=1">Return to your lists</a></p>
</div>
[% ELSIF op=='accept' %]
[%# Nothing to do: we already display an error or we redirect. %]
[% END %]
</div> <!-- / .span10 -->
</div> <!-- / .maincontent -->
[%# End of essential part %]
</div> <!-- / .row-fluid -->
</div> <!-- / .container-fluid -->
</div> <!-- / .main -->
[% INCLUDE 'opac-bottom.inc' %]
[% BLOCK jsinclude %]
<script>
//<![CDATA[
$(document).ready(function(){
$("#share_list").on('submit', function(e) {
var address = $("#invite_address").val();
if ( address.length == 0) {
e.preventDefault();
}
});
});
//]]>
</script>
[% END %]