diff --git a/htroot/Blog.java b/htroot/Blog.java index 41cbcd21d..4886bd225 100644 --- a/htroot/Blog.java +++ b/htroot/Blog.java @@ -82,11 +82,13 @@ public class Blog { final serverObjects prop = new serverObjects(); blogBoard.entry page = null; - final boolean authenticated = switchboard.adminAuthenticated(header) >= 2; - final int display = ((post == null) || (!authenticated)) ? 0 : post.getInt("display", 0); - prop.put("display", display); - boolean hasRights = switchboard.verifyAuthentication(header, true); + + //final int display = (hasRights || post == null) ? 1 : post.getInt("display", 0); + //prop.put("display", display); + prop.put("display", 1); // Fixed to 1 + + final boolean xml = ((String)header.get(httpHeader.CONNECTION_PROP_PATH)).endsWith(".xml"); final String address = yacyCore.seedDB.mySeed().getPublicAddress(); diff --git a/source/de/anomic/data/blogBoard.java b/source/de/anomic/data/blogBoard.java index aef56c434..c3127b236 100644 --- a/source/de/anomic/data/blogBoard.java +++ b/source/de/anomic/data/blogBoard.java @@ -67,6 +67,7 @@ import de.anomic.kelondro.kelondroDyn; import de.anomic.kelondro.kelondroMapObjects; import de.anomic.kelondro.kelondroNaturalOrder; import de.anomic.server.serverDate; +import de.anomic.server.logging.serverLog; public class blogBoard { @@ -163,7 +164,8 @@ public class blogBoard { try { String c = record.get("date"); if (c == null) { - System.out.println("DEBUG - ERROR: date field missing in blogBoard"); + serverLog.logFinest("Blog", "ERROR: date field missing in blogBoard"); + //System.out.println("DEBUG - ERROR: date field missing in blogBoard"); return new Date(); } return serverDate.parseShortSecond(c); @@ -175,7 +177,8 @@ public class blogBoard { public String timestamp() { String c = record.get("date"); if (c == null) { - System.out.println("DEBUG - ERROR: date field missing in blogBoard"); + serverLog.logFinest("Blog", "ERROR: date field missing in blogBoard"); + //System.out.println("DEBUG - ERROR: date field missing in blogBoard"); return serverDate.formatShortSecond(); } return c; diff --git a/source/de/anomic/data/blogBoardComments.java b/source/de/anomic/data/blogBoardComments.java index bff065684..98d1eb5e1 100644 --- a/source/de/anomic/data/blogBoardComments.java +++ b/source/de/anomic/data/blogBoardComments.java @@ -68,6 +68,7 @@ import de.anomic.kelondro.kelondroBase64Order; import de.anomic.kelondro.kelondroDyn; import de.anomic.kelondro.kelondroMapObjects; import de.anomic.kelondro.kelondroNaturalOrder; +import de.anomic.server.logging.serverLog; public class blogBoardComments { @@ -123,109 +124,111 @@ public class blogBoardComments { } public CommentEntry newEntry(String key, byte[] subject, byte[] author, String ip, Date date, byte[] page) { - return new CommentEntry(normalize(key), subject, author, ip, date, page); + return new CommentEntry(normalize(key), subject, author, ip, date, page); } public class CommentEntry { - String key; - HashMap record; - - public CommentEntry(String nkey, byte[] subject, byte[] author, String ip, Date date, byte[] page) { - record = new HashMap(); - key = nkey; - if (key.length() > keyLength) key = key.substring(0, keyLength); - if(date == null) date = new Date(); - record.put("date", dateString(date)); - if (subject == null) record.put("subject",""); - else record.put("subject", kelondroBase64Order.enhancedCoder.encode(subject)); - if (author == null) record.put("author",""); - else record.put("author", kelondroBase64Order.enhancedCoder.encode(author)); - if ((ip == null) || (ip.length() == 0)) ip = ""; - record.put("ip", ip); - if (page == null) record.put("page", ""); - else record.put("page", kelondroBase64Order.enhancedCoder.encode(page)); - - wikiBoard.setAuthor(ip, new String(author)); - //System.out.println("DEBUG: setting author " + author + " for ip = " + ip + ", authors = " + authors.toString()); - } - - private CommentEntry(String key, HashMap record) { - this.key = key; - this.record = record; - if (this.record.get("comments")==null) this.record.put("comments", listManager.collection2string(new ArrayList())); - } - - public String key() { - return key; - } - - public byte[] subject() { - String m = (String) record.get("subject"); - if (m == null) return new byte[0]; - byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoardComments.subject()"); - if (b == null) return "".getBytes(); - return b; - } - - public Date date() { - try { - String c = (String) record.get("date"); - if (c == null) { - System.out.println("DEBUG - ERROR: date field missing in blogBoard"); + String key; + HashMap record; + + public CommentEntry(String nkey, byte[] subject, byte[] author, String ip, Date date, byte[] page) { + record = new HashMap(); + key = nkey; + if (key.length() > keyLength) key = key.substring(0, keyLength); + if(date == null) date = new Date(); + record.put("date", dateString(date)); + if (subject == null) record.put("subject",""); + else record.put("subject", kelondroBase64Order.enhancedCoder.encode(subject)); + if (author == null) record.put("author",""); + else record.put("author", kelondroBase64Order.enhancedCoder.encode(author)); + if ((ip == null) || (ip.length() == 0)) ip = ""; + record.put("ip", ip); + if (page == null) record.put("page", ""); + else record.put("page", kelondroBase64Order.enhancedCoder.encode(page)); + + wikiBoard.setAuthor(ip, new String(author)); + //System.out.println("DEBUG: setting author " + author + " for ip = " + ip + ", authors = " + authors.toString()); + } + + private CommentEntry(String key, HashMap record) { + this.key = key; + this.record = record; + if (this.record.get("comments")==null) this.record.put("comments", listManager.collection2string(new ArrayList())); + } + + public String key() { + return key; + } + + public byte[] subject() { + String m = (String) record.get("subject"); + if (m == null) return new byte[0]; + byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoardComments.subject()"); + if (b == null) return "".getBytes(); + return b; + } + + public Date date() { + try { + String c = (String) record.get("date"); + if (c == null) { + serverLog.logFinest("Blog", "ERROR: date field missing in blogBoard"); + //System.out.println("DEBUG - ERROR: date field missing in blogBoard"); return new Date(); } synchronized (SimpleFormatter) { return SimpleFormatter.parse(c); } - } catch (ParseException e) { - return new Date(); - } - } - - public String timestamp() { - String c = (String) record.get("date"); - if (c == null) { - System.out.println("DEBUG - ERROR: date field missing in blogBoard"); - return dateString(new Date()); - } - return c; - } - - public byte[] author() { - String m = (String) record.get("author"); - if (m == null) return new byte[0]; - byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoardComments.author()"); - if (b == null) return "".getBytes(); - return b; - } - - public String ip() { - String a = (String) record.get("ip"); - if (a == null) return "127.0.0.1"; - return a; - } - - public byte[] page() { - String m = (String) record.get("page"); - if (m == null) return new byte[0]; - byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoardComments.page()"); - if (b == null) return "".getBytes(); - return b; - } - - public boolean isAllowed() { - return (record.get("moderated") != null) && record.get("moderated").equals("true"); - } + } catch (ParseException e) { + return new Date(); + } + } + + public String timestamp() { + String c = (String) record.get("date"); + if (c == null) { + serverLog.logFinest("Blog", "ERROR: date field missing in blogBoard"); + //System.out.println("DEBUG - ERROR: date field missing in blogBoard"); + return dateString(new Date()); + } + return c; + } + + public byte[] author() { + String m = (String) record.get("author"); + if (m == null) return new byte[0]; + byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoardComments.author()"); + if (b == null) return "".getBytes(); + return b; + } + + public String ip() { + String a = (String) record.get("ip"); + if (a == null) return "127.0.0.1"; + return a; + } + + public byte[] page() { + String m = (String) record.get("page"); + if (m == null) return new byte[0]; + byte[] b = kelondroBase64Order.enhancedCoder.decode(m, "de.anomic.data.blogBoardComments.page()"); + if (b == null) return "".getBytes(); + return b; + } - public void allow() { - record.put("moderated", "true"); - } + public boolean isAllowed() { + return (record.get("moderated") != null) && record.get("moderated").equals("true"); + } + + public void allow() { + record.put("moderated", "true"); + } } public String write(CommentEntry page) { - // writes a new page and returns key + // writes a new page and returns key try { datbase.set(page.key, page.record); return page.key; @@ -345,7 +348,7 @@ public class blogBoardComments { } public Iterator keys(boolean up) throws IOException { - return datbase.keys(up, false); + return datbase.keys(up, false); } }