Skip to content

Commit

Permalink
*)fix for broken subject in Blog-News
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@2175 6c8d7289-2bf4-0310-a012-ef5d649a1542
  • Loading branch information
auron_x committed Jun 4, 2006
1 parent 962bc70 commit 3af867c
Showing 1 changed file with 20 additions and 24 deletions.
44 changes: 20 additions & 24 deletions htroot/Blog.java
Expand Up @@ -101,31 +101,26 @@ else if(post.containsKey("login")){
String pagename = post.get("page", "blog_default");
String ip = post.get("CLIENTIP", "127.0.0.1");

byte[] author;
try {
author = post.get("author", "").getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
author = post.get("author", "").getBytes();
}
String StrAuthor = post.get("author", "");

if (author.equals("anonymous")) {
try {
author = switchboard.blogDB.guessAuthor(ip).getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
author = switchboard.blogDB.guessAuthor(ip).getBytes();
}
if (author == null) {
if (StrAuthor.equals("anonymous")) {
StrAuthor = switchboard.blogDB.guessAuthor(ip);

if (StrAuthor == null || StrAuthor.length() == 0) {
if (de.anomic.yacy.yacyCore.seedDB.mySeed == null)
author = "anonymous".getBytes();
StrAuthor = "anonymous";
else {
try {
author = de.anomic.yacy.yacyCore.seedDB.mySeed.get("Name", "anonymous").getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
author = de.anomic.yacy.yacyCore.seedDB.mySeed.get("Name", "anonymous").getBytes();
}
StrAuthor = de.anomic.yacy.yacyCore.seedDB.mySeed.get("Name", "anonymous");
}
}
}

byte[] author;
try {
author = StrAuthor.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
author = StrAuthor.getBytes();
}

if(hasRights && post.containsKey("delete") && post.get("delete").equals("sure")) {
switchboard.blogDB.delete(pagename);
Expand All @@ -150,12 +145,13 @@ else if(post.containsKey("login")){
page = switchboard.blogDB.read(pagename); //must I read it again after submitting?
date = page.date();
}


String StrSubject = post.get("subject", "");
byte[] subject;
try {
subject = post.get("subject", "").getBytes("UTF-8");
subject = StrSubject.getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
subject = post.get("subject", "").getBytes();
subject = StrSubject.getBytes();
}

try {
Expand All @@ -164,9 +160,9 @@ else if(post.containsKey("login")){

// create a news message
HashMap map = new HashMap();
map.put("subject", subject);
map.put("subject", StrSubject);
map.put("page", pagename);
map.put("author", author);
map.put("author", StrAuthor);
map.put("ip", ip);
try {
yacyCore.newsPool.publishMyNews(new yacyNewsRecord("blog_add", map));
Expand Down

0 comments on commit 3af867c

Please sign in to comment.