Revision 7678
Added by ben leinfelder almost 11 years ago
search.js | ||
---|---|---|
1 |
function encodeXML(theString) { |
|
2 |
return theString.replace(/&/g, '&') |
|
3 |
.replace(/</g, '<') |
|
4 |
.replace(/>/g, '>') |
|
5 |
.replace(/"/g, '"'); |
|
6 |
} |
|
7 |
|
|
1 | 8 |
function trim(stringToTrim) { |
2 | 9 |
return stringToTrim.replace(/^\s*/, '').replace(/\s*$/,''); |
3 | 10 |
} |
4 | 11 |
|
5 | 12 |
function checkSearch(submitFormObj) { |
6 | 13 |
var searchString = trim(submitFormObj.searchstring.value); |
14 |
searchString = encodeXML(searchString); |
|
7 | 15 |
var checkBox = document.getElementById("searchAll"); |
8 | 16 |
|
9 | 17 |
if (searchString=="") { |
Also available in: Unified diff
escape reserved XML characters when constructing a pathquery from user input (&). https://projects.ecoinformatics.org/ecoinfo/issues/3017