console escape fixes and cleanups

This commit is contained in:
zzz
2014-08-23 13:44:56 +00:00
parent e65ec2a589
commit 819504f08f
4 changed files with 8 additions and 12 deletions

View File

@ -10,16 +10,12 @@ import net.i2p.util.Log;
/** /**
* Handler to deal with form submissions from the tunnel config form and act * Handler to deal with form submissions from the tunnel config form and act
* upon the values. Holy crap, this is UUUUGLY * upon the values.
* *
*/ */
public class ConfigTunnelsHandler extends FormHandler { public class ConfigTunnelsHandler extends FormHandler {
private Map _settings;
private boolean _shouldSave;
public ConfigTunnelsHandler() { private boolean _shouldSave;
_shouldSave = false;
}
@Override @Override
protected void processForm() { protected void processForm() {
@ -35,8 +31,6 @@ public class ConfigTunnelsHandler extends FormHandler {
_shouldSave = true; _shouldSave = true;
} }
public void setSettings(Map settings) { _settings = new HashMap(settings); }
/** /**
* The user made changes to the network config and wants to save them, so * The user made changes to the network config and wants to save them, so
* lets go ahead and do so. * lets go ahead and do so.
@ -143,6 +137,7 @@ public class ConfigTunnelsHandler extends FormHandler {
addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs.")); addFormError(_("Error saving the configuration (applied but not saved) - please see the error logs."));
} }
} }
private static final int getInt(Object val) { private static final int getInt(Object val) {
if (val == null) return 0; if (val == null) return 0;
String str = null; String str = null;

View File

@ -4,6 +4,7 @@ import java.util.Iterator;
import java.util.Properties; import java.util.Properties;
import java.util.Set; import java.util.Set;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination; import net.i2p.data.Destination;
import net.i2p.router.TunnelPoolSettings; import net.i2p.router.TunnelPoolSettings;
@ -46,7 +47,7 @@ public class ConfigTunnelsHelper extends HelperBase {
name = dest.calculateHash().toBase64().substring(0,6); name = dest.calculateHash().toBase64().substring(0,6);
String prefix = dest.calculateHash().toBase64().substring(0,4); String prefix = dest.calculateHash().toBase64().substring(0,4);
renderForm(buf, cur, prefix, _("Client tunnels for {0}", _(name)), in, out); renderForm(buf, cur, prefix, _("Client tunnels for {0}", DataHelper.escapeHTML(_(name))), in, out);
cur++; cur++;
} }

View File

@ -433,9 +433,9 @@ public class SummaryHelper extends HelperBase {
buf.append("</td><td align=\"left\"><b><a href=\"tunnels#").append(h.toBase64().substring(0,4)); buf.append("</td><td align=\"left\"><b><a href=\"tunnels#").append(h.toBase64().substring(0,4));
buf.append("\" target=\"_top\" title=\"").append(_("Show tunnels")).append("\">"); buf.append("\" target=\"_top\" title=\"").append(_("Show tunnels")).append("\">");
if (name.length() < 18) if (name.length() < 18)
buf.append(name); buf.append(DataHelper.escapeHTML(name));
else else
buf.append(name.substring(0,15)).append("&hellip;"); buf.append(DataHelper.escapeHTML(name.substring(0,15))).append("&hellip;");
buf.append("</a></b></td>\n"); buf.append("</a></b></td>\n");
LeaseSet ls = _context.netDb().lookupLeaseSetLocally(h); LeaseSet ls = _context.netDb().lookupLeaseSetLocally(h);
if (ls != null && _context.tunnelManager().getOutboundClientTunnelCount(h) > 0) { if (ls != null && _context.tunnelManager().getOutboundClientTunnelCount(h) > 0) {

View File

@ -57,7 +57,7 @@ public class TunnelRenderer {
if (name == null) if (name == null)
name = client.toBase64().substring(0,4); name = client.toBase64().substring(0,4);
out.write("<h2><a name=\"" + client.toBase64().substring(0,4) out.write("<h2><a name=\"" + client.toBase64().substring(0,4)
+ "\" ></a>" + _("Client tunnels for") + ' ' + _(name)); + "\" ></a>" + _("Client tunnels for") + ' ' + DataHelper.escapeHTML(_(name)));
if (isLocal) if (isLocal)
out.write(" (<a href=\"/configtunnels#" + client.toBase64().substring(0,4) +"\">" + _("configure") + "</a>)</h2>\n"); out.write(" (<a href=\"/configtunnels#" + client.toBase64().substring(0,4) +"\">" + _("configure") + "</a>)</h2>\n");
else else