From de1b4a1731974ba98f9431f27d96ba1177e7a491 Mon Sep 17 00:00:00 2001 From: karlchenofhell Date: Thu, 8 Mar 2007 13:50:24 +0000 Subject: [PATCH] - don't publish news if empty or equal page is submitted in wiki git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3451 6c8d7289-2bf4-0310-a012-ef5d649a1542 --- htroot/Wiki.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htroot/Wiki.java b/htroot/Wiki.java index 3d18e87b3..c0f52f0c1 100644 --- a/htroot/Wiki.java +++ b/htroot/Wiki.java @@ -106,6 +106,8 @@ public class Wiki { } if (access.equals("admin")) prop.put("mode_access", 0); if (access.equals("all")) prop.put("mode_access", 1); + + wikiBoard.entry page = switchboard.wikiDB.read(pagename); if (post.containsKey("submit")) { @@ -122,17 +124,18 @@ public class Wiki { } catch (UnsupportedEncodingException e) { content = post.get("content", "").getBytes(); } - switchboard.wikiDB.write(switchboard.wikiDB.newEntry(pagename, author, ip, post.get("reason", "edit"), content)); + wikiBoard.entry newEntry = switchboard.wikiDB.newEntry(pagename, author, ip, post.get("reason", "edit"), content); + switchboard.wikiDB.write(newEntry); // create a news message HashMap map = new HashMap(); map.put("page", pagename); map.put("author", author.replace(',', ' ')); - yacyCore.newsPool.publishMyNews(new yacyNewsRecord("wiki_upd", map)); + if (!page.page().equals(content)) + yacyCore.newsPool.publishMyNews(new yacyNewsRecord("wiki_upd", map)); + page = newEntry; prop.put("LOCATION", "/Wiki.html?page=" + pagename); } - wikiBoard.entry page = switchboard.wikiDB.read(pagename); - if (post.containsKey("edit")) { if ((access.equals("admin") && (!switchboard.verifyAuthentication(header, true)))) { // check access right for admin