dcd1f5d48c
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>
296 lines
14 KiB
Text
296 lines
14 KiB
Text
[% USE raw %]
|
||
[% USE Koha %]
|
||
[% SET footerjs = 1 %]
|
||
[% INCLUDE 'doc-head-open.inc' %]
|
||
<title>Koha › Cataloging</title>
|
||
[% INCLUDE 'doc-head-close.inc' %]
|
||
</head>
|
||
|
||
<body id="cat_addbooks" class="cat">
|
||
[% INCLUDE 'header.inc' %]
|
||
[% INCLUDE 'cataloging-search.inc' %]
|
||
|
||
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › Cataloging</div>
|
||
|
||
<div id="doc" class="yui-t7">
|
||
|
||
<div id="bd">
|
||
<div id="yui-main">
|
||
|
||
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
|
||
<div id="toolbar" class="btn-toolbar">
|
||
[% IF Koha.Preference( 'EnableAdvancedCatalogingEditor' ) == 1 %]
|
||
<a id="useadvanced" href="/cgi-bin/koha/cataloguing/editor.pl" class="btn btn-default btn-sm"><i class="fa fa-pencil"></i> Advanced editor</a>
|
||
[% END %]
|
||
<div class="btn-group">
|
||
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown"><i class="fa fa-plus"></i> New record <span class="caret"></span></button>
|
||
<ul class="dropdown-menu">
|
||
<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=">Default framework</a></li>
|
||
[% FOREACH framework IN frameworks %]
|
||
<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?frameworkcode=[% framework.frameworkcode | html %]">[% framework.frameworktext | html %]</a></li>
|
||
[% END %]
|
||
</ul>
|
||
</div>
|
||
[% IF servers.count > 0 %]
|
||
<div class="btn-group">
|
||
<button class="btn btn-default btn-sm" id="z3950search"><i class="fa fa-search"></i> New from Z39.50/SRU</button>
|
||
<button class="btn btn-default btn-sm dropdown-toggle" data-toggle="dropdown">
|
||
<span class="caret"></span>
|
||
</button>
|
||
<ul class="dropdown-menu">
|
||
<li id="" class="z3950searchFw"><a href="#">Default framework</a></li>
|
||
[% FOREACH framework IN frameworks %]
|
||
<li id="[% framework.frameworkcode | html %]" class="z3950searchFw"><a href="#">[% framework.frameworktext | html %]</a></li>
|
||
[% END %]
|
||
</ul>
|
||
</div>
|
||
[% END %]
|
||
[% IF ( total ) %]
|
||
<div class="btn-group"><button type="submit" class="btn btn-default btn-sm merge-items"><i class="fa fa-compress"></i> Merge selected</button></div>
|
||
[% END %]
|
||
</div>
|
||
[% END %]
|
||
|
||
[% IF ( noitemsfound ) %]
|
||
No results found
|
||
[% END %]
|
||
|
||
[%# display the search results %]
|
||
|
||
[% IF ( total ) %]
|
||
<div>
|
||
[% total | html %] result(s) found in catalog,
|
||
<a href="#searchresult-breeding">[% breeding_count | html %] result(s) found in reservoir</a>
|
||
</div>
|
||
<div class="pages">[% pagination_bar | $raw %]</div>
|
||
<div class="searchresults">
|
||
<table>
|
||
<tr>
|
||
<th> </th>
|
||
<th>Title</th>
|
||
<th>Location</th>
|
||
<th> </th>
|
||
</tr>
|
||
[% FOREACH resultsloo IN resultsloop %]
|
||
<tr>
|
||
<td><input type="checkbox" class="selection" id="bib[% resultsloo.biblionumber | html %]" name="biblionumber" value="[% resultsloo.biblionumber | html %]" /></td>
|
||
<td>
|
||
<p>
|
||
<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=[% resultsloo.biblionumber | html %]">[% resultsloo.title | html %]</a>
|
||
[% FOREACH subtitl IN resultsloo.subtitle %][% subtitl.subfield | html %][% END %]</p>
|
||
[% IF ( resultsloo.summary ) %]
|
||
<p>[% resultsloo.summary | html %]</p>
|
||
[% ELSE %]
|
||
<p>
|
||
[% IF ( resultsloo.author ) %]
|
||
[% resultsloo.author | html %]
|
||
[% ELSE %]
|
||
|
||
[% END %]
|
||
[% IF ( resultsloo.isbn ) %] - [% resultsloo.isbn | html %] [% END %]
|
||
[% IF ( resultsloo.publicationyear ) %] - [% resultsloo.publicationyear | html %][% END %]
|
||
[% IF ( resultsloo.publishercode ) %]- [% resultsloo.publishercode | html %][% END %]
|
||
[% IF ( resultsloo.copyrightdate ) %] - [% resultsloo.copyrightdate | html %][% END %]
|
||
[% IF ( resultsloo.edition ) %]Edition: [% resultsloo.edition | html %][% END %]
|
||
[% IF ( resultsloo.place ) %] ; [% resultsloo.place | html %][% END %]
|
||
[% IF ( resultsloo.pages ) %] - [% resultsloo.pages | html %][% END %]
|
||
[% IF ( resultsloo.item('size') ) %] ; [% resultsloo.item('size') | html %][% END %]
|
||
[% IF ( resultsloo.timestamp ) %] <i>(modified on [% resultsloo.timestamp | html %])</i>[% END %]
|
||
</p>
|
||
[% END %]
|
||
</td>
|
||
<td>
|
||
[% IF ( resultsloo.available_items_loop ) %]
|
||
<span class="available">
|
||
[% FOREACH items_loo IN resultsloo.available_items_loop %]
|
||
[% items_loo.count | html %] [% items_loo.branchname | html %]
|
||
<i>
|
||
[% IF ( items_loo.location ) %][% items_loo.location | html %][% END %]
|
||
[% IF ( items_loo.itemcallnumber ) %][% items_loo.itemcallnumber | html %][% END %]
|
||
[% IF ( items_loo.classification ) %]
|
||
<a href="/cgi-bin/koha/catalogue/search.pl?q=callnum:[% items_loo.classification |url %]">
|
||
[% items_loo.classification | html %]
|
||
</a>
|
||
[% END %]
|
||
</i>
|
||
<br />
|
||
[% END %]
|
||
</span>
|
||
[% END %]
|
||
<span class="unavailable">
|
||
[% IF ( resultsloo.onloancount ) %] Checked out ([% resultsloo.onloancount | html %]),<br /> [% END %]
|
||
[% IF ( resultsloo.withdrawncount ) %] Withdrawn ([% resultsloo.withdrawncount | html %]),<br /> [% END %]
|
||
[% IF ( resultsloo.itemlostcount ) %] Lost ([% resultsloo.itemlostcount | html %])<br />[% END %]
|
||
[% IF ( resultsloo.orderedcount ) %] On order ([% resultsloo.orderedcount | html %])<br/>[% END %]
|
||
[% IF ( resultsloo.notforloancount ) %] Not for loan ([% resultsloo.notforloancount | html %])[% END %]
|
||
</span>
|
||
</td>
|
||
<td>
|
||
<div class="dropup">
|
||
<a class="btn btn-default btn-xs dropdown-toggle" id="cataloguesearchactions[% resultsloo.biblionumber | html %]" role="button" data-toggle="dropdown" href="#">
|
||
Actions <b class="caret"></b>
|
||
</a>
|
||
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="cataloguesearchactions[% resultsloo.biblionumber | html %]">
|
||
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% resultsloo.biblionumber | html %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
|
||
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&id=[% resultsloo.biblionumber | html %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
|
||
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?biblionumber=[% resultsloo.biblionumber | html %]"><i class="fa fa-pencil"></i> Edit biblio</a></li>[% END %]
|
||
[% IF ( CAN_user_editcatalogue_edit_items ) %]<li><a href="/cgi-bin/koha/cataloguing/additem.pl?biblionumber=[% resultsloo.biblionumber | html %]"><i class="fa fa-plus"></i> Add/Edit items</a></li>[% END %]
|
||
</ul>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
[% END %]
|
||
</table>
|
||
</div>
|
||
[% ELSE %]
|
||
[% IF ( query ) %]
|
||
[% IF ( error ) %]<div class="dialog alert">[% END %]<b>No results found</b>
|
||
[% IF ( error ) %]
|
||
Error: <span class="error">[% error | html %]</span></div>
|
||
[% END %]
|
||
[% END %]
|
||
[% END %]
|
||
|
||
[% IF ( query ) %]
|
||
<div id="searchresult-breeding">
|
||
<h3>Biblios in reservoir</h3>
|
||
[% IF ( breeding_loop ) %]
|
||
<table>
|
||
<tr>
|
||
<th>Title</th>
|
||
<th>ISBN</th>
|
||
<th>Date</th>
|
||
<th>Edition</th>
|
||
<th>Coming from</th>
|
||
<th> </th>
|
||
</tr>
|
||
[% FOREACH breeding_loo IN breeding_loop %]
|
||
<tr>
|
||
<td>[% breeding_loo.title | html %]
|
||
[% breeding_loo.author | html %]</td>
|
||
<td>[% breeding_loo.isbn | html %]</td>
|
||
<td>[% breeding_loo.copyrightdate | html %]</td>
|
||
<td>[% breeding_loo.edition | html %]</td>
|
||
<td>[% breeding_loo.file | html %]</td>
|
||
<td>
|
||
<div class="dropup">
|
||
<a class="btn btn-default btn-xs dropdown-toggle" id="reservoirsearchactions[% breeding_loo.id | html %]" role="button" data-toggle="dropdown" href="#">
|
||
Actions <b class="caret"></b>
|
||
</a>
|
||
<ul class="dropdown-menu pull-right" role="menu" aria-labelledby="reservoirsearchactions[% breeding_loo.id | html %]">
|
||
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?importid=[% breeding_loo.id | html %]" class="previewData"><i class="fa fa-eye"></i> MARC preview</a></li>
|
||
<li><a href="/cgi-bin/koha/catalogue/showmarc.pl?viewas=card&importid=[% breeding_loo.id | html %]" class="previewData"><i class="fa fa-eye"></i> Card preview</a></li>
|
||
[% IF ( CAN_user_editcatalogue_edit_catalogue ) %]
|
||
<li><a href="/cgi-bin/koha/cataloguing/addbiblio.pl?breedingid=[% breeding_loo.id | html %]"><i class="fa fa-plus"></i> Add biblio</a></li>
|
||
[% END %]
|
||
</ul>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
[% END %]
|
||
</table>
|
||
[% ELSE %]
|
||
<p>None</p>
|
||
[% END %]
|
||
</div>
|
||
[% END %]
|
||
|
||
<div id="dataPreview" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="dataPreviewLabel" aria-hidden="true">
|
||
<div class="modal-dialog">
|
||
<div class="modal-content">
|
||
<div class="modal-header">
|
||
<button type="button" class="closebtn" data-dismiss="modal" aria-hidden="true">×</button>
|
||
<h3 id="dataPreviewLabel">Preview</h3>
|
||
</div>
|
||
<div class="modal-body">
|
||
<div id="loading"> <img src="[% interface | html %]/[% theme | html %]/img/spinner-small.gif" alt="" /> Loading </div>
|
||
</div>
|
||
<div class="modal-footer">
|
||
<button class="btn btn-default" data-dismiss="modal" aria-hidden="true">Close</button>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
|
||
</div>
|
||
</div>
|
||
|
||
[% MACRO jsinclude BLOCK %]
|
||
<script type="text/javascript">
|
||
|
||
$(document).ready(function() {
|
||
//Set focus to cataloging search
|
||
$("input[name=q]:eq(0)").focus();
|
||
|
||
$("#z3950search").click(function(){
|
||
PopupZ3950("");
|
||
return false;
|
||
});
|
||
|
||
$(".z3950searchFw").click(function(){
|
||
PopupZ3950($(this).prop('id'));
|
||
return false;
|
||
});
|
||
$(".merge-items").on("click",function(e){
|
||
e.preventDefault();
|
||
MergeItems();
|
||
});
|
||
|
||
$("#useadvanced").click(function(){
|
||
$.cookie( 'catalogue_editor_[% logged_in_user.borrowernumber | html %]', 'advanced', { expires: 365, path: '/' } );
|
||
return true;
|
||
});
|
||
|
||
$(".previewData").on("click", function(e){
|
||
e.preventDefault();
|
||
var ltitle = $(this).text();
|
||
var page = $(this).attr("href");
|
||
$("#dataPreviewLabel").text(ltitle);
|
||
$("#dataPreview .modal-body").load(page + " div");
|
||
$('#dataPreview').modal({show:true});
|
||
});
|
||
$("#dataPreview").on("hidden", function(){
|
||
$("#dataPreviewLabel").html("");
|
||
$("#dataPreview .modal-body").html("<div id=\"loading\"><img src=\"[% interface | html %]/[% theme | html %]/img/spinner-small.gif\" alt=\"\" /> "+_("Loading")+"</div>");
|
||
});
|
||
|
||
});
|
||
|
||
/* this function open a popup to search on z3950 server. */
|
||
function PopupZ3950(fw) {
|
||
var strQuery = GetZ3950Terms(fw);
|
||
if(strQuery){
|
||
window.open("/cgi-bin/koha/cataloguing/z3950_search.pl?biblionumber=[% biblionumber | html %]"+strQuery,"z3950search",'width=800,height=500,location=yes,toolbar=no,scrollbars=yes,resize=yes');
|
||
}
|
||
}
|
||
/* provide Z3950 search points */
|
||
function GetZ3950Terms(fw){
|
||
var strQuery="&frameworkcode=" + fw;
|
||
[% FOREACH z3950_search_param IN z3950_search_params %]
|
||
strQuery += "&" + "[% z3950_search_param.name | uri %]" + "=" + "[% z3950_search_param.value | uri %]";
|
||
[% END %]
|
||
return strQuery;
|
||
}
|
||
|
||
/**
|
||
* This function checks if the adequate number of records are checked for merging
|
||
*/
|
||
function MergeItems() {
|
||
var checkboxes = $("input:checkbox:checked");
|
||
if (checkboxes.length < 2) {
|
||
alert(_("At least two records must be selected for merging."));
|
||
} else {
|
||
var params = [];
|
||
$(checkboxes).each(function() {
|
||
params.push('biblionumber=' + $(this).val());
|
||
});
|
||
var url = '/cgi-bin/koha/cataloguing/merge.pl?' + params.join('&');
|
||
location.href = url;
|
||
}
|
||
return false;
|
||
}
|
||
|
||
</script>
|
||
[% END %]
|
||
|
||
[% INCLUDE 'intranet-bottom.inc' %]
|