diff --git a/htroot/Wiki.html b/htroot/Wiki.html index 643381e69..cee22f331 100644 --- a/htroot/Wiki.html +++ b/htroot/Wiki.html @@ -5,32 +5,31 @@ #%env/templates/metas.template%#
- #(display)# - #%env/templates/simpleheader.template%# - #%env/templates/submenuPublication.template%# - :: - #%env/templates/header.template%# - #%env/templates/submenuPublication.template%# - :: - #%env/templates/embeddedheader.template%# + #(display)# + #%env/templates/simpleheader.template%# + #%env/templates/submenuPublication.template%# + :: + #%env/templates/header.template%# + #%env/templates/submenuPublication.template%# + :: + #%env/templates/embeddedheader.template%# #(/display)# #(mode)# -- last edited by #[author]# | change date #[date]# | Edit #(access)#(only granted to admin)::#(/access)# + last edited by #[author]# | change date #[date]# | Edit #(access)#(only granted to admin)::#(/access)#
Subject | @@ -112,7 +115,7 @@|||
#[subject]# | +#[subject]# | #[date]# | #[author]# |
IO Error reading wiki database: #[message]#
#(/error)# :: +IO Error reading wiki database: #[message]#
:: #(/error)# @@ -189,6 +195,7 @@ Wiki Code here. + @@ -197,8 +204,8 @@ #(/versioning)# #(/mode)# diff --git a/htroot/Wiki.java b/htroot/Wiki.java index b58119cbf..451007aea 100644 --- a/htroot/Wiki.java +++ b/htroot/Wiki.java @@ -47,8 +47,10 @@ import de.anomic.search.Switchboard; import de.anomic.server.serverObjects; import de.anomic.server.serverSwitch; import de.anomic.yacy.yacyNewsPool; +import java.util.Map; public class Wiki { + private static final String ANONYMOUS = "anonymous"; //private static String ListLevel = ""; //private static String numListLevel = ""; @@ -74,12 +76,11 @@ public class Wiki { String access = sb.getConfig("WikiAccess", "admin"); final String pagename = get(post, "page", "start"); final String ip = get(post, HeaderFramework.CONNECTION_PROP_CLIENTIP, "127.0.0.1"); - String author = get(post, "author", "anonymous"); - if (author.equals("anonymous")) { + String author = get(post, "author", ANONYMOUS); + if (author.equals(ANONYMOUS)) { author = wikiBoard.guessAuthor(ip); if (author == null) { - if (sb.peers.mySeed() == null) author = "anonymous"; - else author = sb.peers.mySeed().get("Name", "anonymous"); + author = (sb.peers.mySeed() == null) ? ANONYMOUS : sb.peers.mySeed().get("Name", ANONYMOUS); } } @@ -94,10 +95,13 @@ public class Wiki { access = post.get("access", "admin"); sb.setConfig("WikiAccess", access); } - if (access.equals("admin")) prop.put("mode_access", "0"); - if (access.equals("all")) prop.put("mode_access", "1"); + if (access.equals("admin")) { + prop.put("mode_access", "0"); + } else if (access.equals("all")) { + prop.put("mode_access", "1"); + } - wikiBoard.entry page = sb.wikiDB.read(pagename); + wikiBoard.Entry page = sb.wikiDB.read(pagename); if (post != null && post.containsKey("submit")) { @@ -114,18 +118,22 @@ public class Wiki { } catch (final UnsupportedEncodingException e) { content = post.get("content", "").getBytes(); } - final wikiBoard.entry newEntry = sb.wikiDB.newEntry(pagename, author, ip, post.get("reason", "edit"), content); + final wikiBoard.Entry newEntry = sb.wikiDB.newEntry(pagename, author, ip, post.get("reason", "edit"), content); sb.wikiDB.write(newEntry); // create a news message - final HashMap