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
* upon the values. Holy crap, this is UUUUGLY
* upon the values.
*
*/
public class ConfigTunnelsHandler extends FormHandler {
private Map _settings;
private boolean _shouldSave;
public ConfigTunnelsHandler() {
_shouldSave = false;
}
private boolean _shouldSave;
@Override
protected void processForm() {
@ -35,8 +31,6 @@ public class ConfigTunnelsHandler extends FormHandler {
_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
* 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."));
}
}
private static final int getInt(Object val) {
if (val == null) return 0;
String str = null;

View File

@ -4,6 +4,7 @@ import java.util.Iterator;
import java.util.Properties;
import java.util.Set;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.router.TunnelPoolSettings;
@ -46,7 +47,7 @@ public class ConfigTunnelsHelper extends HelperBase {
name = dest.calculateHash().toBase64().substring(0,6);
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++;
}

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("\" target=\"_top\" title=\"").append(_("Show tunnels")).append("\">");
if (name.length() < 18)
buf.append(name);
buf.append(DataHelper.escapeHTML(name));
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");
LeaseSet ls = _context.netDb().lookupLeaseSetLocally(h);
if (ls != null && _context.tunnelManager().getOutboundClientTunnelCount(h) > 0) {

View File

@ -57,7 +57,7 @@ public class TunnelRenderer {
if (name == null)
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)
out.write(" (<a href=\"/configtunnels#" + client.toBase64().substring(0,4) +"\">" + _("configure") + "</a>)</h2>\n");
else