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>
121 lines
5.1 KiB
Text
121 lines
5.1 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% SET footerjs = 1 %]
|
|
[% BLOCK pluginlist %]
|
|
<div class="pluginlist">
|
|
[% FOREACH plugin IN plugins %]
|
|
<div class="plugin">
|
|
<div class="pluginname">
|
|
[% IF plugin.enabled %]<input type="checkbox" checked="checked" id="checkbox_[% type | html %][% plugin.name | html %]">[% ELSE %]<input type="checkbox" id="checkbox_[% type | html %][% plugin.name | html %]">[% END %]
|
|
<label class='pluginlabel' for="checkbox_[% type | html %][% plugin.name | html %]">[% plugin.name | html %]</label></div>
|
|
<div class="plugindesc">
|
|
[% SWITCH plugin.name %]
|
|
[% CASE 'AuthorityFile' %]
|
|
Suggest authorities which are relevant to the term the user searched for.
|
|
[% CASE 'ExplodedTerms' %]
|
|
Suggest that patrons expand their searches to include
|
|
broader/narrower/related terms.
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Administration › Did you mean?</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<body id="admin_didyoumean" class="admin">
|
|
[% INCLUDE 'header.inc' %]
|
|
[% INCLUDE 'prefs-admin-search.inc' %]
|
|
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> › <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a> › Did you mean?</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
<h3>Did you mean?</h3>
|
|
<noscript><div class="dialog alert"><strong>Please enable Javascript:</strong>
|
|
Configuring 'Did you mean?' plugins requires Javascript. If
|
|
you are unable to use Javascript, you may be able to enter the
|
|
configuration (which is stored in JSON in the OPACdidyoumean and
|
|
INTRAdidyoumean system preferences) in the Local Preferences tab in
|
|
the system preference editor, but this is unsupported, not
|
|
recommended, and likely will not work.</div></noscript>
|
|
<div id="didyoumeanlegend">
|
|
Please put the 'Did you mean?' plugins in order by significance, from
|
|
most significant to least significant, and check the box to enable those
|
|
plugins that you want to use. (NOTE: 'Did you mean?' functionality
|
|
is not yet enabled on the staff client)
|
|
</div>
|
|
<form action="/cgi-bin/koha/admin/didyoumean.pl" method="post">
|
|
<fieldset id="didyoumeanopac">
|
|
<legend>OPAC</legend>
|
|
[% PROCESS pluginlist plugins=OPACpluginlist type='opac' %]
|
|
</fieldset>
|
|
<fieldset id="didyoumeanintranet">
|
|
<legend>Intranet</legend>
|
|
[% PROCESS pluginlist plugins=INTRApluginlist type='intranet' %]
|
|
</fieldset>
|
|
<fieldset class="action"><button class="save-all submit" type="submit">Save configuration</button> <a href="/cgi-bin/koha/admin/didyoumean.pl" class="force_reload cancel">Cancel</a></fieldset>
|
|
</form>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'admin-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% Asset.js("js/admin-menu.js") | $raw %]
|
|
<script type="text/javascript">
|
|
$(document).ready(function() {
|
|
$( ".pluginlist" ).sortable();
|
|
$( ".plugin" ).addClass( "ui-widget ui-widget-content ui-helper-clearfix ui-corner-all" )
|
|
.find( ".pluginname" )
|
|
.addClass( "ui-widget-header ui-corner-all" )
|
|
.end()
|
|
.find( ".plugindesc" );
|
|
$(".save-all").on("click",function(e){
|
|
e.preventDefault();
|
|
yesimeant();
|
|
});
|
|
$(".force_reload").on("click",function(e){
|
|
e.preventDefault();
|
|
window.location.reload(true);
|
|
});
|
|
});
|
|
|
|
function yesimeant() {
|
|
var OPACdidyoumean = serialize_plugins('opac');
|
|
var INTRAdidyoumean = serialize_plugins('intranet');
|
|
|
|
var data = "pref_OPACdidyoumean=" + encodeURIComponent(OPACdidyoumean) + "&pref_INTRAdidyoumean=" + encodeURIComponent(INTRAdidyoumean);
|
|
|
|
$.ajax({
|
|
data: data,
|
|
type: 'POST',
|
|
url: '/cgi-bin/koha/svc/config/systempreferences/',
|
|
success: function () { alert(_("Successfully saved configuration")); },
|
|
});
|
|
return false;
|
|
}
|
|
|
|
function serialize_plugins(interface) {
|
|
var serializedconfig = '[';
|
|
$('#didyoumean' + interface + ' .pluginlist .plugin').each(function(index) {
|
|
var name = $(this).find('.pluginlabel').text();
|
|
var enabled = $(this).find('input:checkbox:checked').length ?
|
|
', "enabled": 1' : '';
|
|
serializedconfig += '{ "name": "' + name + '"' + enabled + '}, ';
|
|
});
|
|
serializedconfig = serializedconfig.substring(0, serializedconfig.length - 2);
|
|
serializedconfig += ']';
|
|
return serializedconfig;
|
|
}
|
|
</script>
|
|
[% END %]
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|