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>
201 lines
12 KiB
Text
201 lines
12 KiB
Text
[% USE raw %]
|
|
[% USE Asset %]
|
|
[% USE Koha %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Administration › System preferences</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
[% Asset.css("css/datatables.css") | $raw %]
|
|
[% Asset.css("css/preferences.css") | $raw %]
|
|
[% Asset.css("lib/jquery/plugins/multiple-select/multiple-select.css") | $raw %]
|
|
[% Asset.css("css/humanmsg.css") | $raw %]
|
|
</head>
|
|
<body id="admin_preferences" 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> › System preferences</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
|
|
[% IF ( jump_not_found ) %]
|
|
<h2>System preferences</h2>
|
|
<div class="dialog alert">
|
|
Could not find a system preference named <code>[% jumpfield | html %]</code>.
|
|
</div>
|
|
[% END %]
|
|
[% IF ( search_not_found ) %]
|
|
<div class="dialog alert">
|
|
No system preferences matched your search for: <strong>[% searchfield | html %]</strong>
|
|
</div>
|
|
[% ELSIF searchfield %]
|
|
<h1>You searched for: [% searchfield | html %]</h1>
|
|
[% END %]
|
|
[% FOREACH TAB IN TABS %]
|
|
<div class="prefs-tab">
|
|
<h2>[% TAB.tab_title | html %] preferences</h2>
|
|
<form action="/cgi-bin/koha/admin/preferences.pl" method="post">
|
|
[% UNLESS ( searchfield ) %]<div id="toolbar"><button class="save-all submit" type="submit">Save all [% TAB.tab_title | html %] preferences</button></div>[% END %]
|
|
<input type="hidden" name="op" value="save" />
|
|
<input type="hidden" name="tab" value="[% TAB.tab_id | html %]" />
|
|
|
|
[% FOREACH LINE IN TAB.LINES %]
|
|
[% IF ( LINE.is_group_title ) %]
|
|
[% UNLESS ( loop.first ) %]</tbody></table>[% END %]
|
|
<h3>[% LINE.title | html %]</h3>
|
|
<table class="preferences">
|
|
<thead><tr><th>Preference</th><th>Value</th></tr></thead>
|
|
[% UNLESS ( loop.last ) %]<tbody>[% END %]
|
|
[% ELSE %]
|
|
[% IF ( loop.first ) %]<table class="preferences"><thead><tr><th>Preference</th><th>Value</th></tr></thead><tbody>[% END %]
|
|
<tr class="name-row">
|
|
<td class="name-cell">
|
|
<code>
|
|
[% FOREACH NAME IN LINE.NAMES %]
|
|
<label for="pref_[% NAME.name | html %]">
|
|
[% IF ( NAME.jumped ) %]
|
|
<span class="term" id="jumped">[% NAME.name | html %]</span>
|
|
[% ELSIF ( NAME.highlighted ) %]
|
|
<span class="term">[% NAME.name | html %]</span>
|
|
[% ELSE %]
|
|
[% NAME.name | html %]
|
|
[% END %]
|
|
|
|
[% IF NAME.overridden %]
|
|
<span class="overridden" title="The system preference [% NAME.name | html %] may have been overridden from this value by one or more virtual hosts.">
|
|
[Overridden]
|
|
</span>
|
|
[% END %]
|
|
</label>
|
|
[% UNLESS ( loop.last ) %]<br />[% END %]
|
|
[% END %]
|
|
</code>
|
|
</td>
|
|
<td><div>
|
|
[% FOREACH CHUNK IN LINE.CHUNKS %]
|
|
[% IF ( CHUNK.type_text ) %]
|
|
[% CHUNK.contents | $raw %]
|
|
[% ELSIF ( CHUNK.type_input ) %]
|
|
<input type="[%IF CHUNK.input_type %][% CHUNK.input_type | html %][% ELSE %]text[% END %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %]" value="[% CHUNK.value | html %]" autocomplete="off" /> [% IF ( CHUNK.dateinput ) %]<span class="hint">[% INCLUDE 'date-format.inc' %]</span>[% END %]
|
|
[% ELSIF ( CHUNK.type_select ) %]
|
|
<select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]">
|
|
[% FOREACH CHOICE IN CHUNK.CHOICES.sort('value') %]
|
|
[% IF ( CHOICE.selected ) %]
|
|
<option value="[% CHOICE.value | html %]" selected="selected">
|
|
[% ELSE %]
|
|
<option value="[% CHOICE.value | html %]">
|
|
[% END %]
|
|
[% CHOICE.text | html %]
|
|
</option>
|
|
[% END %]
|
|
</select>
|
|
[% ELSIF ( CHUNK.type_multiple ) %]
|
|
<select name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "choice" | html %]" multiple="multiple">
|
|
[% FOREACH CHOICE IN CHUNK.CHOICES %][% IF ( CHOICE.selected ) %]<option value="[% CHOICE.value | html %]" selected="selected">[% ELSE %]<option value="[% CHOICE.value | html %]">[% END %][% CHOICE.text | html %]</option>[% END %]
|
|
</select>
|
|
[% ELSIF ( CHUNK.type_textarea ) || ( CHUNK.type_htmlarea )%]
|
|
[% IF ( CHUNK.type_htmlarea ) && ( Koha.Preference('UseWYSIWYGinSystemPreferences') ) %]
|
|
<textarea name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %] mce" rows="20" cols="60">[% CHUNK.value | html %]</textarea>
|
|
[% ELSE %]
|
|
<a class="expand-textarea" style="display: none" href="#">Click to Edit</a>
|
|
<textarea name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]" class="preference preference-[% CHUNK.class or "short" | html %]" rows="10" cols="40">[% CHUNK.value | html %]</textarea>
|
|
<a class="collapse-textarea" style="display:none" href="#">Click to collapse</br></a>
|
|
[% END %]
|
|
[% ELSIF ( CHUNK.type_languages ) %]
|
|
<dl class="sortable">
|
|
[% FOREACH language IN CHUNK.languages %]
|
|
<div>
|
|
[% IF ( language.plural ) %]
|
|
<dt>
|
|
[% IF ( language.native_description ) %][% language.native_description | html %][% ELSE %][% language.rfc4646_subtag | html %][% END %]
|
|
</dt>
|
|
[% FOREACH sublanguages_loo IN language.sublanguages_loop %]
|
|
<dd>
|
|
<label for="pref_[% CHUNK.name | html %]_[% sublanguages_loo.rfc4646_subtag | html %]">[% sublanguages_loo.native_description | html %] [% sublanguages_loo.script_description | html %] [% sublanguages_loo.region_description | html %] [% sublanguages_loo.variant_description | html %]([% sublanguages_loo.rfc4646_subtag | html %])</label>
|
|
[% IF ( sublanguages_loo.enabled ) %]
|
|
<input value="[% sublanguages_loo.rfc4646_subtag | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% sublanguages_loo.rfc4646_subtag | html %]" type="checkbox" checked="checked" class="preference preference-checkbox"/>
|
|
[% ELSE %]
|
|
<input value="[% sublanguages_loo.rfc4646_subtag | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% sublanguages_loo.rfc4646_subtag | html %]" type="checkbox" class="preference preference-checkbox"/>
|
|
[% END %]
|
|
</dd>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<dt>
|
|
<label for="pref_[% CHUNK.name | html %]_[% language.rfc4646_subtag | html %]">[% language.native_description | html %]([% language.rfc4646_subtag | html %])</label>
|
|
[% IF ( language.group_enabled ) %]
|
|
<input value="[% language.rfc4646_subtag | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% language.rfc4646_subtag | html %]" type="checkbox" checked="checked" class="preference preference-checkbox"/>
|
|
[% ELSE %]
|
|
<input value="[% language.rfc4646_subtag | html %]" name="pref_[% CHUNK.name | html %]" id="pref_[% CHUNK.name | html %]_[% language.rfc4646_subtag | html %]" type="checkbox" class="preference preference-checkbox"/>
|
|
[% END %]
|
|
</dt>
|
|
[% END %]
|
|
</div>
|
|
[% END %]
|
|
</dl>
|
|
[% END %]
|
|
[% END %]
|
|
</div></td>
|
|
</tr>
|
|
[% IF ( loop.last ) %]</tbody></table>[% END %]
|
|
[% END %]
|
|
[% END %]
|
|
<fieldset class="action"><button class="save-all submit" type="submit">Save all [% TAB.tab_title | html %] preferences</button> <a href="/cgi-bin/koha/admin/preferences.pl" class="force_reload cancel">Cancel</a></fieldset>
|
|
</form>
|
|
</div>
|
|
[% END %]
|
|
</div>
|
|
</div>
|
|
<div class="yui-b">
|
|
[% INCLUDE 'prefs-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% INCLUDE 'datatables.inc' %]
|
|
[% Asset.js("lib/jquery/plugins/jquery.fixFloat.js") | $raw %]
|
|
[% Asset.js("lib/jquery/plugins/multiple-select/jquery.multiple.select.js") | $raw %]
|
|
<script type="text/javascript">
|
|
[% UNLESS ( searchfield ) %]$(document).ready(function(){
|
|
$('#toolbar').fixFloat();
|
|
});[% END %]
|
|
|
|
$(document).ready(function(){
|
|
$("select[multiple='multiple']").multipleSelect( {
|
|
placeholder: _("Please select ..."),
|
|
selectAllText: _("Select all"),
|
|
allSelected: _("All selected"),
|
|
countSelected: _("# of % selected"),
|
|
noMatchesFound: _("No matches found")
|
|
} );
|
|
$(".force_reload").on("click",function(e){
|
|
e.preventDefault();
|
|
window.location.reload(true);
|
|
});
|
|
});
|
|
// This is here because of its dependence on template variables, everything else should go in js/pages/preferences.js - jpw
|
|
var to_highlight = "[% searchfield |replace("'", "\'") |replace('"', '\"') |replace('\n', '\\n') |replace('\r', '\\r') | html %]";
|
|
var search_jumped = [% IF ( search_jumped ) %]true[% ELSE %]false[% END %];
|
|
var MSG_NOTHING_TO_SAVE = _("Nothing to save");
|
|
var MSG_SAVING = _("Saving...");
|
|
var MSG_SAVED_PREFERENCE = _("Saved preference %s");
|
|
var MSG_MODIFIED = _("modified");
|
|
var MSG_MADE_CHANGES = _("You have made changes to system preferences.");
|
|
var MSG_CLICK_TO_EXPAND = _("Click to expand this section");
|
|
var MSG_CLICK_TO_COLLAPSE = _("Click to collapse this section");
|
|
var MSG_INTERNAL_SERVER_ERROR = _( "Internal Server Error, please reload the page" );
|
|
var MSG_SESSION_TIMED_OUT = _( "You need to log in again, your session has timed out" );
|
|
var MSG_DATA_NOT_SAVED = _( "Error; your data might not have been saved" );
|
|
var MSG_LOADING = _( "Loading..." );
|
|
</script>
|
|
<script src="[% interface | html %]/lib/jquery/plugins/humanmsg.js" type="text/javascript"></script>
|
|
<script src="[% interface | html %]/[% theme | html %]/js/ajax.js" type="text/javascript"></script>
|
|
<script src="[% interface | html %]/[% theme | html %]/js/pages/preferences.js" type="text/javascript"></script>
|
|
[%# Add WYSIWYG editor for htmlarea system preferences %]
|
|
[% INCLUDE 'wysiwyg-systempreferences.inc' %]
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|