forked from I2P_Developers/i2p.i2p
2006-02-15 jrandom
* Merged in the i2p_0_6_1_10_PRE branch to the trunk, so CVS HEAD is no
longer backwards compatible (and should not be used until 0.6.1.1 is
out)
This commit is contained in:
@@ -51,7 +51,7 @@ public class Updater {
|
||||
User user = new User();
|
||||
RemoteArchiveBean rab = new RemoteArchiveBean();
|
||||
|
||||
rab.fetchIndex(user, "web", archive, bm.getDefaultProxyHost(), bm.getDefaultProxyPort());
|
||||
rab.fetchIndex(user, "web", archive, bm.getDefaultProxyHost(), bm.getDefaultProxyPort(), true);
|
||||
if (rab.getRemoteIndex() != null) {
|
||||
HashMap parameters = new HashMap();
|
||||
parameters.put("action", new String[] {"Fetch all new entries"});
|
||||
|
||||
@@ -117,8 +117,9 @@ public class User {
|
||||
PetName pn = _petnames.getByName(name);
|
||||
if (pn == null) continue;
|
||||
String proto = pn.getProtocol();
|
||||
if ( (proto != null) && (AddressesServlet.PROTO_TAG.equals(proto)) )
|
||||
rv.add(pn.getLocation());
|
||||
String loc = pn.getLocation();
|
||||
if ( (proto != null) && (AddressesServlet.PROTO_TAG.equals(proto)) && (loc != null) )
|
||||
rv.add(loc);
|
||||
}
|
||||
if (rv.size() <= 0) {
|
||||
for (int i = 0; i < DEFAULT_FAVORITE_TAGS.length; i++) {
|
||||
|
||||
@@ -162,7 +162,7 @@ public class BlogPostInfoRenderer extends EventReceiverImpl {
|
||||
if (pn != null)
|
||||
out.append(HTMLRenderer.sanitizeString(pn.getName()));
|
||||
else
|
||||
out.append(HTMLRenderer.sanitizeString(blog.name));
|
||||
out.append(HTMLRenderer.sanitizeTagParam(blog.name));
|
||||
out.append(" on ").append(getEntryDate(blog.entryId));
|
||||
out.append("</a>");
|
||||
} else if (blog.hash != null) {
|
||||
@@ -183,7 +183,7 @@ public class BlogPostInfoRenderer extends EventReceiverImpl {
|
||||
// generate a new nym
|
||||
while ( (pn = db.getByName(blog.name)) != null)
|
||||
blog.name = blog.name + ".";
|
||||
out.append(HTMLRenderer.sanitizeString(blog.name)).append("</a>");
|
||||
out.append(HTMLRenderer.sanitizeTagParam(blog.name)).append("</a>");
|
||||
/* <a href=\"profile.jsp?");
|
||||
_bodyBuffer.append(ThreadedHTMLRenderer.PARAM_AUTHOR).append("=");
|
||||
_bodyBuffer.append(HTMLRenderer.sanitizeTagParam(blog.hash)).append("\" title=\"View their profile\">");
|
||||
|
||||
@@ -320,23 +320,24 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
if ( (description != null) && (description.trim().length() > 0) ) {
|
||||
_bodyBuffer.append(sanitizeString(description));
|
||||
} else if ( (name != null) && (name.trim().length() > 0) ) {
|
||||
_bodyBuffer.append(sanitizeString(name));
|
||||
_bodyBuffer.append(sanitizeTagParam(name));
|
||||
} else {
|
||||
_bodyBuffer.append("[view entry]");
|
||||
}
|
||||
_bodyBuffer.append("</a>");
|
||||
} else if ( (description != null) && (description.trim().length() > 0) ) {
|
||||
_bodyBuffer.append(sanitizeString(description));
|
||||
}
|
||||
|
||||
|
||||
//String url = getPageURL(blog, null, -1, -1, -1, (_user != null ? _user.getShowExpanded() : false), (_user != null ? _user.getShowImages() : false));
|
||||
String url = getMetadataURL(blog);
|
||||
_bodyBuffer.append(getSpan("blogEntrySummary")).append(" [<a ").append(getClass("blogLink")).append(" href=\"").append(url);
|
||||
_bodyBuffer.append("\">");
|
||||
_bodyBuffer.append(getSpan("blogEntrySummary"));
|
||||
_bodyBuffer.append(" [<a ").append(getClass("blogLink")).append(" href=\"").append(url).append("\">");
|
||||
if ( (name != null) && (name.trim().length() > 0) )
|
||||
_bodyBuffer.append(sanitizeString(name));
|
||||
_bodyBuffer.append(sanitizeTagParam(name));
|
||||
else
|
||||
_bodyBuffer.append("view");
|
||||
_bodyBuffer.append("</a> ");
|
||||
_bodyBuffer.append("</a>");
|
||||
//_bodyBuffer.append("</a> (<a ").append(getClass("blogMeta")).append(" href=\"").append(getMetadataURL(blog)).append("\">meta</a>)");
|
||||
if ( (tag != null) && (tag.trim().length() > 0) ) {
|
||||
url = getPageURL(blog, tag, -1, -1, -1, false, false);
|
||||
@@ -348,7 +349,7 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
for (int i = 0; i < locations.size(); i++) {
|
||||
SafeURL surl = (SafeURL)locations.get(i);
|
||||
if (_user.getAuthenticated() && BlogManager.instance().authorizeRemote(_user) )
|
||||
_bodyBuffer.append("<a ").append(getClass("blogArchiveView")).append(" href=\"").append(getArchiveURL(blog, surl)).append("\">").append(sanitizeString(surl.toString())).append("</a> ");
|
||||
_bodyBuffer.append(" <a ").append(getClass("blogArchiveView")).append(" href=\"").append(getArchiveURL(blog, surl)).append("\">").append(sanitizeString(surl.toString())).append("</a> ");
|
||||
else
|
||||
_bodyBuffer.append(getSpan("blogArchiveURL")).append(sanitizeString(surl.toString())).append("</span> ");
|
||||
}
|
||||
@@ -900,9 +901,13 @@ public class HTMLRenderer extends EventReceiverImpl {
|
||||
if (str == null) return "";
|
||||
//str = str.replace('&', '_'); // this should be &
|
||||
str = str.replaceAll("&", "&");
|
||||
if (str.indexOf('\"') < 0)
|
||||
|
||||
if (str.indexOf("\"") < 0 && str.indexOf("'") < 0)
|
||||
return sanitizeString(str);
|
||||
str = str.replace('\"', '\'');
|
||||
|
||||
str = str.replaceAll("\"", """);
|
||||
str = str.replaceAll("'", "'"); // as ', but supported by IE
|
||||
|
||||
return sanitizeString(str);
|
||||
}
|
||||
|
||||
|
||||
@@ -160,7 +160,7 @@ public class RSSRenderer extends HTMLRenderer {
|
||||
if ( (description != null) && (description.trim().length() > 0) ) {
|
||||
_bodyBuffer.append(sanitizeString(description));
|
||||
} else if ( (name != null) && (name.trim().length() > 0) ) {
|
||||
_bodyBuffer.append(sanitizeString(name));
|
||||
_bodyBuffer.append(sanitizeTagParam(name));
|
||||
} else {
|
||||
_bodyBuffer.append("[view entry]");
|
||||
}
|
||||
|
||||
@@ -322,7 +322,7 @@ public class SMLParser {
|
||||
try {
|
||||
return Integer.parseInt(val.trim());
|
||||
} catch (NumberFormatException nfe) {
|
||||
nfe.printStackTrace();
|
||||
//nfe.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@@ -336,7 +336,7 @@ public class SMLParser {
|
||||
try {
|
||||
return Long.parseLong(val.trim());
|
||||
} catch (NumberFormatException nfe) {
|
||||
nfe.printStackTrace();
|
||||
//nfe.printStackTrace();
|
||||
return -1;
|
||||
}
|
||||
} else {
|
||||
@@ -370,7 +370,7 @@ public class SMLParser {
|
||||
} else if (c == EQ) {
|
||||
if (nameEnd < 0)
|
||||
nameEnd = off;
|
||||
} else if ( (c == QUOTE) || (c == DQUOTE) ) {
|
||||
} else if ( c == DQUOTE ) {
|
||||
if (valStart < 0) {
|
||||
valStart = off;
|
||||
} else {
|
||||
@@ -450,11 +450,11 @@ public class SMLParser {
|
||||
|
||||
test("A: B\nC: D\n\n<a href=\"http://odci.gov\">hi</a>");
|
||||
|
||||
test("A: B\n\n[a b='c']d[/a]");
|
||||
test("A: B\n\n[a b='c' d='e' f='g']h[/a]");
|
||||
test("A: B\n\n[a b='c' d='e' f='g']h[/a][a b='c' d='e' f='g']h[/a][a b='c' d='e' f='g']h[/a]");
|
||||
test("A: B\n\n[a b=\"c\"]d[/a]");
|
||||
test("A: B\n\n[a b=\"c\" d=\"e\" f=\"g\"]h[/a]");
|
||||
test("A: B\n\n[a b=\"c\" d=\"e\" f=\"g\"]h[/a][a b=\"c\" d=\"e\" f=\"g\"]h[/a][a b=\"c\" d=\"e\" f=\"g\"]h[/a]");
|
||||
|
||||
test("A: B\n\n[a b='c' ]d[/a]");
|
||||
test("A: B\n\n[a b=\"plural c's\" ]d[/a]");
|
||||
test("A: B\n\n[a b=\"c\" ]d[/a]");
|
||||
|
||||
test("A: B\n\n[b]This[/b] is [i]special[/i][cut]why?[/cut][u]because I say so[/u].\neven if you dont care");
|
||||
|
||||
@@ -34,14 +34,20 @@ public class AdminServlet extends BaseServlet {
|
||||
writeAuthActionFields(out);
|
||||
out.write("<tr><td colspan=\"3\">");
|
||||
|
||||
// stop people from shooting themselves in the foot - only geeks can enable multiuser mode
|
||||
// (by adding the single user flag to their syndie.config)
|
||||
if (BlogManager.instance().isSingleUser())
|
||||
out.write("<input type=\"hidden\" name=\"singleuser\" value=\"checked\" />\n");
|
||||
/*
|
||||
out.write("<em class=\"b_adminField\">Single user?</em> <input type=\"checkbox\" class=\"b_adminField\" name=\"singleuser\" ");
|
||||
if (BlogManager.instance().isSingleUser())
|
||||
out.write(" checked=\"true\" ");
|
||||
out.write(" /><br />\n");
|
||||
|
||||
|
||||
out.write("<span class=\"b_adminDescr\">If this is checked, the registration, admin, and remote passwords are unnecessary - anyone");
|
||||
out.write("can register and administer Syndie, as well as use any remote functionality. This should not be checked if untrusted");
|
||||
out.write("parties can access this web interface.</span><br />\n");
|
||||
*/
|
||||
out.write("<span class=\"b_adminField\">Default user:</span> <input class=\"b_adminField\" type=\"text\" name=\"defaultUser\" size=\"10\" value=\"");
|
||||
out.write(BlogManager.instance().getDefaultLogin());
|
||||
out.write("\" />\n");
|
||||
|
||||
@@ -716,11 +716,13 @@ public abstract class BaseServlet extends HttpServlet {
|
||||
for (Iterator iter = names.iterator(); iter.hasNext(); ) {
|
||||
String name = (String) iter.next();
|
||||
PetName pn = db.getByName(name);
|
||||
if ("syndieblog".equals(pn.getProtocol()) && pn.isMember(FilteredThreadIndex.GROUP_FAVORITE)) {
|
||||
String proto = pn.getProtocol();
|
||||
String loc = pn.getLocation();
|
||||
if (proto != null && loc != null && "syndieblog".equals(proto) && pn.isMember(FilteredThreadIndex.GROUP_FAVORITE)) {
|
||||
if ( (author != null) && (author.equals(pn.getLocation())) )
|
||||
out.write("<option value=\"" + pn.getLocation() + "\" selected=\"true\">Threads " + name + " posted in</option>\n");
|
||||
out.write("<option value=\"" + loc + "\" selected=\"true\">Threads " + name + " posted in</option>\n");
|
||||
else
|
||||
out.write("<option value=\"" + pn.getLocation() + "\">Threads " + name + " posted in</option>\n");
|
||||
out.write("<option value=\"" + loc + "\">Threads " + name + " posted in</option>\n");
|
||||
}
|
||||
}
|
||||
out.write("</select>\n");
|
||||
|
||||
@@ -217,7 +217,7 @@ public class PostServlet extends BaseServlet {
|
||||
out.write("<span class=\"b_postField\">Post subject:</span> ");
|
||||
out.write("<input type=\"text\" class=\"b_postSubject\" size=\"80\" name=\"" + PARAM_SUBJECT
|
||||
+ "\" value=\"" + HTMLRenderer.sanitizeTagParam(subject) + "\" title=\"One line summary\" /><br />\n");
|
||||
out.write("<span class=\"b_postField\">Post content (in raw <a href=\"smlref.jsp\" target=\"_blank\">SML</a>, no headers):</span><br />\n");
|
||||
out.write("<span class=\"b_postField\">Post content (in raw <a href=\"smlref.jsp\" target=\"_blank\" title=\"SML cheatsheet\">SML</a>, no headers):</span><br />\n");
|
||||
out.write("<textarea class=\"b_postText\" rows=\"6\" cols=\"80\" name=\"" + PARAM_TEXT + "\">" + getParam(req, PARAM_TEXT) + "</textarea><br />\n");
|
||||
out.write("<span class=\"b_postField\">SML post headers:</span><br />\n");
|
||||
out.write("<textarea class=\"b_postHeaders\" rows=\"2\" cols=\"80\" name=\"" + PARAM_HEADERS + "\" title=\"Most people can leave this empty\" >" + getParam(req, PARAM_HEADERS) + "</textarea><br />\n");
|
||||
@@ -273,7 +273,7 @@ public class PostServlet extends BaseServlet {
|
||||
out.write("<span class=\"b_postField\">Post subject:</span> ");
|
||||
out.write("<input type=\"text\" class=\"b_postSubject\" size=\"80\" name=\"" + PARAM_SUBJECT
|
||||
+ "\" value=\"" + HTMLRenderer.sanitizeTagParam(subject) + "\" /><br />\n");
|
||||
out.write("<span class=\"b_postField\">Post content (in raw <a href=\"smlref.jsp\" target=\"_blank\">SML</a>, no headers):</span><br />\n");
|
||||
out.write("<span class=\"b_postField\">Post content (in raw <a href=\"smlref.jsp\" target=\"_blank\" title=\"SML cheatsheet\">SML</a>, no headers):</span><br />\n");
|
||||
out.write("<textarea class=\"b_postText\" rows=\"6\" cols=\"80\" name=\"" + PARAM_TEXT + "\">" + getParam(req, PARAM_TEXT) + "</textarea><br />\n");
|
||||
out.write("<span class=\"b_postField\">SML post headers:</span><br />\n");
|
||||
out.write("<textarea class=\"b_postHeaders\" rows=\"3\" cols=\"80\" name=\"" + PARAM_HEADERS + "\">" + getParam(req, PARAM_HEADERS) + "</textarea><br />\n");
|
||||
|
||||
@@ -278,7 +278,7 @@ public class RemoteArchiveBean {
|
||||
scheduler.fetch(shouldBlock);
|
||||
}
|
||||
|
||||
public void fetchIndex(User user, String schema, String location, String proxyHost, String proxyPort) {
|
||||
public void fetchIndex(User user, String schema, String location, String proxyHost, String proxyPort, boolean allowCaching) {
|
||||
_fetchIndexInProgress = true;
|
||||
_remoteIndex = null;
|
||||
_remoteLocation = location;
|
||||
@@ -330,9 +330,12 @@ public class RemoteArchiveBean {
|
||||
} catch (IOException ioe) {
|
||||
//ignore
|
||||
}
|
||||
|
||||
|
||||
String tag = null;
|
||||
if (allowCaching)
|
||||
tag = etags.getProperty(location);
|
||||
EepGet eep = new EepGet(I2PAppContext.getGlobalContext(), ((_proxyHost != null) && (_proxyPort > 0)),
|
||||
_proxyHost, _proxyPort, 0, archiveFile.getAbsolutePath(), location, true, etags.getProperty(location));
|
||||
_proxyHost, _proxyPort, 0, archiveFile.getAbsolutePath(), location, allowCaching, tag);
|
||||
eep.addStatusListener(new IndexFetcherStatusListener(archiveFile));
|
||||
eep.fetch();
|
||||
|
||||
|
||||
@@ -49,9 +49,11 @@ public class SyndicateServlet extends BaseServlet {
|
||||
if (pnval != null) location = pnval.getLocation();
|
||||
}
|
||||
|
||||
// dont allow caching if they explicit ask for a fetch
|
||||
boolean allowCaching = false;
|
||||
remote.fetchIndex(user, req.getParameter(PARAM_SCHEMA), location,
|
||||
req.getParameter("proxyhost"),
|
||||
req.getParameter("proxyport"));
|
||||
req.getParameter("proxyport"), allowCaching);
|
||||
} else if ("Fetch metadata".equals(action)) {
|
||||
remote.fetchMetadata(user, req.getParameterMap());
|
||||
} else if ("Fetch selected entries".equals(action)) {
|
||||
|
||||
Reference in New Issue
Block a user