Skip to content

Commit

Permalink
fix for profile
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3231 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
allo committed Jan 17, 2007
1 parent 02522ed commit e1fb355
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
17 changes: 10 additions & 7 deletions htroot/ViewProfile.java
Expand Up @@ -164,19 +164,22 @@ public static serverObjects respond(httpHeader header, serverObjects post, serve
String key = ((String) entry.getKey());
String value = new String();

// only comments get "wikified"
// this prevents broken links ending in <br>
if (key.equals("comment")) {
value = wikiTransformer.transform(((String) entry.getValue()).replaceAll("\r", "").replaceAll("\\\\n", "\n"));
} else { // else only HTML tags get transformed to regular text
value = wikiCode.replaceHTML(((String) entry.getValue()).replaceAll("\r", "").replaceAll("\\\\n", "\n"));
}
value=((String) entry.getValue()).replaceAll("\r", "").replaceAll("\\\\n", "\n");

//all known Keys which should be set as they are
if (knownKeys.contains(key)) {
if (value.length() > 0) {
prop.put("success_" + key, 1);
prop.put("success_" + key + "_value", value);
// only comments get "wikified"
if(key.equals("comment")){
prop.putASIS(
"success_" + key + "_value",
wikiTransformer.transform(((String) entry.getValue()).replaceAll("\r", "").replaceAll("\\\\n", "\n"))
);
}else{
prop.put("success_" + key + "_value", value); //put replaces HTML Chars by entities.
}
}
//special handling, hide flower if no icq uin is set
} else if (key.equals("homepage")) {
Expand Down
7 changes: 5 additions & 2 deletions source/de/anomic/server/serverObjects.java
Expand Up @@ -106,14 +106,17 @@ public Object put(Object key, Object value) {

// byte[] variant
public byte[] put(String key, byte[] value) {
return (byte[]) this.put((Object) key, (Object) value);
return (byte[]) this.put((Object) key, (Object) value); //TODO: use wikiCode.replaceXMLEntities?!
}

// string variant
public String put(String key, String value) {
//return putASIS(key, value);
return (String)putSafeXML(key, value); //XSS Safe!
}
public byte[] putASIS(String key, byte[] value) {
return (byte[]) this.put((Object) key, (Object) value);
}
public String putASIS(Object key, String value) {
return (String) this.put(key, (Object) value);
}
Expand Down Expand Up @@ -221,4 +224,4 @@ public Object clone() {
return super.clone();
}

}
}

0 comments on commit e1fb355

Please sign in to comment.