|
|
@ -52,6 +52,8 @@ import de.anomic.server.serverSwitch;
|
|
|
|
|
|
|
|
|
|
|
|
public class BlogComments {
|
|
|
|
public class BlogComments {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final String DEFAULT_PAGE = "blog_default";
|
|
|
|
|
|
|
|
|
|
|
|
public static String dateString(final Date date) {
|
|
|
|
public static String dateString(final Date date) {
|
|
|
|
return Blog.dateString(date);
|
|
|
|
return Blog.dateString(date);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -72,32 +74,31 @@ public class BlogComments {
|
|
|
|
final UserDB.Entry userentry = sb.userDB.proxyAuth(header.get(RequestHeader.AUTHORIZATION, "xxxxxx"));
|
|
|
|
final UserDB.Entry userentry = sb.userDB.proxyAuth(header.get(RequestHeader.AUTHORIZATION, "xxxxxx"));
|
|
|
|
if (userentry != null && userentry.hasRight(UserDB.AccessRight.BLOG_RIGHT)) {
|
|
|
|
if (userentry != null && userentry.hasRight(UserDB.AccessRight.BLOG_RIGHT)) {
|
|
|
|
hasRights = true;
|
|
|
|
hasRights = true;
|
|
|
|
}
|
|
|
|
} else if (post.containsKey("login")) {
|
|
|
|
//opens login window if login link is clicked
|
|
|
|
//opens login window if login link is clicked
|
|
|
|
else if (post.containsKey("login")) {
|
|
|
|
|
|
|
|
prop.put("AUTHENTICATE","admin log-in");
|
|
|
|
prop.put("AUTHENTICATE","admin log-in");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
final String pagename = post.get("page", "blog_default");
|
|
|
|
String pagename = post.get("page", DEFAULT_PAGE);
|
|
|
|
final String ip = post.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
|
|
|
|
final String ip = post.get(HeaderFramework.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
|
|
|
|
|
|
|
|
|
|
|
|
String StrAuthor = post.get("author", "anonymous");
|
|
|
|
String strAuthor = post.get("author", "anonymous");
|
|
|
|
|
|
|
|
|
|
|
|
if ("anonymous".equals(StrAuthor)) {
|
|
|
|
if ("anonymous".equals(strAuthor)) {
|
|
|
|
StrAuthor = sb.blogDB.guessAuthor(ip);
|
|
|
|
strAuthor = sb.blogDB.guessAuthor(ip);
|
|
|
|
|
|
|
|
|
|
|
|
if (StrAuthor == null || StrAuthor.length() == 0) {
|
|
|
|
if (strAuthor == null || strAuthor.length() == 0) {
|
|
|
|
if (sb.peers.mySeed() == null) {
|
|
|
|
if (sb.peers.mySeed() == null) {
|
|
|
|
StrAuthor = "anonymous";
|
|
|
|
strAuthor = "anonymous";
|
|
|
|
} else {
|
|
|
|
} else {
|
|
|
|
StrAuthor = sb.peers.mySeed().get("Name", "anonymous");
|
|
|
|
strAuthor = sb.peers.mySeed().get("Name", "anonymous");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
byte[] author;
|
|
|
|
byte[] author;
|
|
|
|
author = UTF8.getBytes(StrAuthor);
|
|
|
|
author = UTF8.getBytes(strAuthor);
|
|
|
|
|
|
|
|
|
|
|
|
final BlogBoard.BlogEntry page = sb.blogDB.readBlogEntry(pagename); //maybe "if(page == null)"
|
|
|
|
final BlogBoard.BlogEntry page = sb.blogDB.readBlogEntry(pagename); //maybe "if(page == null)"
|
|
|
|
final boolean pageExists = sb.blogDB.contains(pagename);
|
|
|
|
final boolean pageExists = sb.blogDB.contains(pagename);
|
|
|
@ -127,13 +128,13 @@ public class BlogComments {
|
|
|
|
sb.blogCommentDB.write(sb.blogCommentDB.newEntry(commentID, subject, author, ip, date, content));
|
|
|
|
sb.blogCommentDB.write(sb.blogCommentDB.newEntry(commentID, subject, author, ip, date, content));
|
|
|
|
prop.putHTML("LOCATION","BlogComments.html?page=" + pagename);
|
|
|
|
prop.putHTML("LOCATION","BlogComments.html?page=" + pagename);
|
|
|
|
|
|
|
|
|
|
|
|
MessageBoard.entry msgEntry = null;
|
|
|
|
MessageBoard.entry msgEntry = sb.messageDB.newEntry(
|
|
|
|
sb.messageDB.write(msgEntry = sb.messageDB.newEntry(
|
|
|
|
|
|
|
|
"blogComment",
|
|
|
|
"blogComment",
|
|
|
|
StrAuthor,
|
|
|
|
strAuthor,
|
|
|
|
sb.peers.mySeed().hash,
|
|
|
|
sb.peers.mySeed().hash,
|
|
|
|
sb.peers.mySeed().getName(), sb.peers.mySeed().hash,
|
|
|
|
sb.peers.mySeed().getName(), sb.peers.mySeed().hash,
|
|
|
|
"new blog comment: " + UTF8.String(blogEntry.getSubject()), content));
|
|
|
|
"new blog comment: " + UTF8.String(blogEntry.getSubject()), content);
|
|
|
|
|
|
|
|
sb.messageDB.write(msgEntry);
|
|
|
|
|
|
|
|
|
|
|
|
messageForwardingViaEmail(sb, msgEntry);
|
|
|
|
messageForwardingViaEmail(sb, msgEntry);
|
|
|
|
|
|
|
|
|
|
|
|