forked from I2P_Developers/i2p.i2p
Fix for #588 part 2: moved escape/unescape functions to net.i2p.data.DataHelper
This commit is contained in:
@ -3,14 +3,13 @@ package net.i2p.router.web;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import net.i2p.data.DataHelper;
|
||||
import net.i2p.router.client.ClientManagerFacadeImpl;
|
||||
import net.i2p.router.startup.ClientAppConfig;
|
||||
import net.i2p.util.Addresses;
|
||||
@ -236,7 +235,7 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
boolean enabled, boolean ro, String desc, boolean edit,
|
||||
boolean showEditButton, boolean showUpdateButton, boolean showStopButton,
|
||||
boolean showDeleteButton, boolean showStartButton) {
|
||||
String escapeddesc = escapeHTML(desc);
|
||||
String escapeddesc = DataHelper.escapeHTML(desc);
|
||||
buf.append("<tr><td class=\"mediumtags\" align=\"right\" width=\"25%\">");
|
||||
if (urlify && enabled) {
|
||||
String link = "/";
|
||||
@ -301,22 +300,4 @@ public class ConfigClientsHelper extends HelperBase {
|
||||
String rv = t1.replace('>', ' ');
|
||||
return rv;
|
||||
}
|
||||
|
||||
/**
|
||||
* Escapes a string for inclusion in HTML
|
||||
*/
|
||||
private String escapeHTML(String unescaped) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
map.put("\"",""");
|
||||
map.put("&","&");
|
||||
map.put("<","<");
|
||||
map.put(">",">");
|
||||
String escaped = unescaped;
|
||||
for (Map.Entry<String, String> entry : map.entrySet()) {
|
||||
String k = entry.getKey();
|
||||
String v = entry.getValue();
|
||||
escaped = escaped.replaceAll(k, v);
|
||||
}
|
||||
return escaped;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user