Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
- added buttons to add complete domain or single URL to blacklist to IndexControl_p
karlchenofhell31ad42535a71
diff --git a/htroot/IndexControl_p.html b/htroot/IndexControl_p.htmlindex f57f41395..6a374ccdf 100644--- a/htroot/IndexControl_p.html+++ b/htroot/IndexControl_p.html@@ -32,7 +32,7 @@</tr><tr valign="top" class="TableCellLight"><td colspan="2"></td>- <td><input type="submit" name="keyhashtransfer" value="Transfer to other peer" />+ <td><input type="submit" name="keyhashtransfer" value="Transfer to other peer" /><br /><select name="hostHash">#{hosts}#<option value="#[hosthash]#">#[hostname]#</option>@@ -117,44 +117,66 @@</table></form>#(keyhashsimilar)#- ::Sequential List of Word-Hashes:<br />#{rows}# #{cols}#<a href="/IndexControl_p.html?keyhash=#[wordHash]#&keyhashsearch=1" class="tt">#[wordHash]#</a> #{/cols}#<br />#{/rows}#+ ::Sequential List of Word-Hashes:<br />#{rows}#+ #{cols}#+ <a href="/IndexControl_p.html?keyhash=#[wordHash]#&keyhashsearch=1" class="tt">#[wordHash]#</a>#{/cols}#<br />+ #{/rows}##(/keyhashsimilar)##(urlhashsimilar)#- ::Sequential List of URL-Hashes:<br />#{rows}# #{cols}#<a href="/IndexControl_p.html?urlhash=#[urlHash]#&urlhashsearch=1" class="tt">#[urlHash]#</a> #{/cols}#<br />#{/rows}#+ ::Sequential List of URL-Hashes:<br />+ #{rows}#+ #{cols}#<a href="/IndexControl_p.html?urlhash=#[urlHash]#&urlhashsearch=1" class="tt">#[urlHash]#</a> #{/cols}#<br />+ #{/rows}##(/urlhashsimilar)##(genUrlList)#::No URL entries related to this word hash <span class="tt">#[keyHash]#</span>.::- #[count]# URL entries related to this word hash <span class="tt">#[keyHash]#</span><br /><br />+ <p>#[count]# URL entries related to this word hash <span class="tt">#[keyHash]#</span></p><form action="IndexControl_p.html" method="post" enctype="multipart/form-data">- #{urlList}# #(urlExists)#- <input type="checkbox" name="urlhx.#[urlhxCount]#" checked value="#[urlhxValue]#" align="top" /><span class="tt">#[urlhxValue]# <unresolved URL Hash></span><br />- ::<input type="checkbox" name="urlhx.#[urlhxCount]#" #(urlhxChecked)#::checked="checked" #(/urlhxChecked)#value="#[urlhxValue]#" align="top" />- <a href="/IndexControl_p.html?keystring=#[keyString]#&keyhash=#[keyHash]#&urlhash=#[urlhxValue]#&urlstringsearch=&urlstring=#[urlString]#" class="tt">#[urlhxValue]#</a><span class="tt"> #[urlString]#, pos=#[pos]#</span><br />- #(/urlExists)# #{/urlList}#- <input type="hidden" name="keystring" value="#[keyString]#" />- <input type="hidden" name="keyhash" value="#[keyHash]#" />- <input type="hidden" name="urlstring" value="" />- <input type="hidden" name="urlhash" value="" /><br />- <fieldset><legend>Reference Deletion</legend>- <table border="0" cellspacing="5" cellpadding="5">- <tr valign="top">- <td>- <br /><br /><input type="submit" value="Delete reference to selected URLs" name="keyhashdelete" />- <br /><br /><input type="submit" value="Delete reference to ALL URLs" name="keyhashdeleteall" /><span class="small"><br /> (= delete Word)</span>- </td>- <td width="150">- <center><input type="checkbox" name="delurl" value="" align="top" checked /></center><br />- <span class="small">delete also the referenced URL itself (reasonable and recommended, may produce unresolved references at other word indexes but they do not harm)</span>- </td>- <td width="150">- <center><input type="checkbox" name="delurlref" value="" align="top" /></center><br />- <span class="small">for every resolveable and deleted URL reference, delete the same reference at every other word where the reference exists (very extensive, but prevents further unresolved references)</span>- </td>- </tr>- </table>- </fieldset></form><br />#(/genUrlList)#+ <p>#{urlList}# #(urlExists)#+ <input type="checkbox" id="urlhx.#[urlhxCount]#" name="urlhx.#[urlhxCount]#" checked value="#[urlhxValue]#" align="top" /><label for="urlhx.#[urlhxCount]#" class="tt">#[urlhxValue]# <unresolved URL Hash></span><br />+ ::<input type="checkbox" id="urlhx.#[urlhxCount]#" name="urlhx.#[urlhxCount]#" #(urlhxChecked)#::checked="checked" #(/urlhxChecked)#value="#[urlhxValue]#" align="top" />+ <a href="/IndexControl_p.html?keystring=#[keyString]#&keyhash=#[keyHash]#&urlhash=#[urlhxValue]#&urlstringsearch=&urlstring=#[urlString]#" class="tt">#[urlhxValue]#</a><label for="urlhx.#[urlhxCount]#" class="tt"> #[urlString]#, pos=#[pos]#</label><br />+ #(/urlExists)# #{/urlList}#</p>+ <input type="hidden" name="keystring" value="#[keyString]#" />+ <input type="hidden" name="keyhash" value="#[keyHash]#" />+ <input type="hidden" name="urlstring" value="" />+ <input type="hidden" name="urlhash" value="" /><br />+ <fieldset><legend>Reference Deletion</legend>+ <dl>+ <dt><input type="checkbox" id="delurl" name="delurl" value="" align="top" checked /></dt>+ <dd>+ <label for="delurl" class="small">+ delete also the referenced URL itself (reasonable and recommended, may produce unresolved references<br />+ at other word indexes but they do not harm)+ </label>+ </dt>+ <dt><input type="checkbox" id="delurlref" name="delurlref" value="" align="top" /></dt>+ <dd>+ <label for="delurlref" class="small">+ for every resolveable and deleted URL reference, delete the same reference at every other word where<br />+ the reference exists (very extensive, but prevents further unresolved references)+ </label>+ </dt>+ <dt> </dt>+ <dd>+ <input type="submit" value="Delete reference to selected URLs" name="keyhashdelete" /><br />+ <input type="submit" value="Delete reference to ALL URLs" name="keyhashdeleteall" /><span class="small"> (= delete Word)</span>+ </dd>+ <dt>+ <select name="blacklist" size="1">#{blacklists}#+ <option value="#[name]#">#[name]#</option>#{/blacklists}#+ </select>+ </dt>+ <dd>+ <input type="submit" value="Add selected URLs to blacklist" name="blacklisturls" /><br />+ <input type="submit" value="Add selected domains to blacklist" name="blacklistdomains" />+ </dd>+ </dl>+ </fieldset>+ </form>+ <br />#(/genUrlList)##(genUrlProfile)#::No entry found for URL-hash #[urlhash]#::<table>diff --git a/htroot/IndexControl_p.java b/htroot/IndexControl_p.javaindex 6b82b51f6..9874aeb67 100644--- a/htroot/IndexControl_p.java+++ b/htroot/IndexControl_p.java@@ -46,7 +46,10 @@// javac -classpath .:../classes IndexControl_p.java// if the shell's current path is HTROOT+import java.io.File;+import java.io.FileWriter;import java.io.IOException;+import java.io.PrintWriter;import java.net.MalformedURLException;import java.util.Enumeration;import java.util.HashMap;@@ -55,6 +58,7 @@ import java.util.Iterator;import java.util.Set;import java.util.TreeMap;+import de.anomic.data.listManager;import de.anomic.http.httpHeader;import de.anomic.index.indexContainer;import de.anomic.index.indexRWIEntry;@@ -383,6 +387,61 @@ public class IndexControl_p {}}+ if (post.containsKey("blacklist")) {+ String blacklist = post.get("blacklist", "");+ if (post.containsKey("blacklisturls")) {+ PrintWriter pw;+ try {+ String[] supportedBlacklistTypes = env.getConfig("BlackLists.types", "").split(",");+ pw = new PrintWriter(new FileWriter(new File(listManager.listsPath, blacklist), true));+ URL url;+ for (int i=0; i<urlx.length; i++) {+ indexURLEntry e = switchboard.wordIndex.loadedURL.load(urlx[i], null);+ if (e != null) {+ url = e.comp().url();+ pw.println(url.getHost() + "/" + url.getFile());+ for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {+ if (listManager.ListInListslist(supportedBlacklistTypes[blTypes] + ".BlackLists", blacklist)) {+ plasmaSwitchboard.urlBlacklist.add(+ supportedBlacklistTypes[blTypes],+ url.getHost(),+ url.getFile());+ }+ }+ }+ }+ pw.close();+ } catch (IOException e) {+ }+ }++ if (post.containsKey("blacklistdomains")) {+ PrintWriter pw;+ try {+ String[] supportedBlacklistTypes = env.getConfig("BlackLists.types", "").split(",");+ pw = new PrintWriter(new FileWriter(new File(listManager.listsPath, blacklist), true));+ URL url;+ for (int i=0; i<urlx.length; i++) {+ indexURLEntry e = switchboard.wordIndex.loadedURL.load(urlx[i], null);+ if (e != null) {+ url = e.comp().url();+ pw.println(url.getHost() + "/.*");+ for (int blTypes=0; blTypes < supportedBlacklistTypes.length; blTypes++) {+ if (listManager.ListInListslist(supportedBlacklistTypes[blTypes] + ".BlackLists", blacklist)) {+ plasmaSwitchboard.urlBlacklist.add(+ supportedBlacklistTypes[blTypes],+ url.getHost(),+ ".*");+ }+ }+ }+ }+ pw.close();+ } catch (IOException e) {+ }+ }+ }+listHosts(prop, keyhash);// insert constants@@ -512,6 +571,7 @@ public class IndexControl_p {prop.put("genUrlList_urlList", i);prop.put("genUrlList_keyString", keystring);prop.put("genUrlList_count", i);+ putBlacklists(prop, listManager.getDirListing(listManager.listsPath));}index = null;return prop;@@ -521,5 +581,10 @@ public class IndexControl_p {if (index != null) index = null;}}-++ private static void putBlacklists(serverObjects prop, String[] lists) {+ prop.put("genUrlList_blacklists", lists.length);+ for (int i=0; i<lists.length; i++)+ prop.put("genUrlList_blacklists_" + i + "_name", lists[i]);+ }}