Skip to content

Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance

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

low012e19ededd66a1
diff --git a/htroot/ViewProfile.java b/htroot/ViewProfile.java
index a0f51a32c..b9f7dd369 100644
--- a/htroot/ViewProfile.java
+++ b/htroot/ViewProfile.java
@@ -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
diff --git a/source/de/anomic/data/wikiCode.java b/source/de/anomic/data/wikiCode.java
index ef4086259..899ff8fdf 100644
--- a/source/de/anomic/data/wikiCode.java
+++ b/source/de/anomic/data/wikiCode.java
@@ -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]