*) prevents problems due to HTML code in profiles (my posting from 05.Sep.2005 http://www.yacy-forum.de/viewtopic.php?t=964)

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@657 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
low012 20 years ago
parent 4e07828807
commit e19ededd66

@ -122,9 +122,10 @@ public class ViewProfile {
//this prevents broken links ending in <br>
if(key.equals("comment")){
value=wikiTransformer.transform( ((String)entry.getValue()).replaceAll("\r","").replaceAll("\\\\n","\n") );
}
}
//else only HTML tags get transformed to regular text
else{
value=((String)entry.getValue()).replaceAll("\r","").replaceAll("\\\\n","\n");
value=wikiTransformer.replaceHTML( ((String)entry.getValue()).replaceAll("\r","").replaceAll("\\\\n","\n") );
}
//all known Keys which should be set as they are

@ -99,12 +99,10 @@ public class wikiCode {
return "internal error: " + e.getMessage();
}
}
public String transformLine(String result, plasmaSwitchboard switchboard) {
// transform page
int p0, p1;
boolean defList = false; //needed for definition lists
public String replaceHTML(String result) {
int p0;
// avoide html inside
//p0 = 0; while ((p0 = result.indexOf("&", p0)) >= 0) result = result.substring(0, p0) + "&amp;" + result.substring(p0 + 1);
p0 = 0; while ((p0 = result.indexOf('"', p0)) >= 0) result = result.substring(0, p0) + "&quot;" + result.substring(p0 + 1);
@ -113,6 +111,15 @@ public class wikiCode {
//p0 = 0; while ((p0 = result.indexOf("*", p0)) >= 0) result = result.substring(0, p0) + "&#149;" + result.substring(p0 + 1);
p0 = 0; while ((p0 = result.indexOf("(C)", p0)) >= 0) result = result.substring(0, p0) + "&copy;" + result.substring(p0 + 3);
return result;
}
public String transformLine(String result, plasmaSwitchboard switchboard) {
// transform page
int p0, p1;
boolean defList = false; //needed for definition lists
result = replaceHTML(result);
//check if line contains any escape symbol of if we are in an esacpe sequence already
//if that's the case the program will continue further below [MN]

Loading…
Cancel
Save