Distributed Peer-to-Peer Web Search Engine and Intranet Search Appliance
Java decentralizedintranet-searchintranet-search-enginep2pp2p-networkprivacyprivacy-protectionsearch-enginesearchenginewebweb-search-enginewebsearchwebseearch-engine
tried to solve some problems with new picture viewer
orbiter14d6e476c9f9
diff --git a/htroot/ViewImage.java b/htroot/ViewImage.javaindex d88feb630..553064535 100644--- a/htroot/ViewImage.java+++ b/htroot/ViewImage.java@@ -76,9 +76,10 @@ public class ViewImage {// create imageMediaTracker mediaTracker = new MediaTracker(new Container());- Image original = Toolkit.getDefaultToolkit().createImage(imgb);- mediaTracker.addImage(original, 0);- try {mediaTracker.waitForID(0);} catch (InterruptedException e) {}+ Image original = Toolkit.getDefaultToolkit().createImage(imgb);+ int handle = original.hashCode();+ mediaTracker.addImage(original, handle);+ try {mediaTracker.waitForID(handle);} catch (InterruptedException e) {}boolean auth = ((String) header.get("CLIENTIP", "")).equals("localhost") || sb.verifyAuthentication(header, false); // handle access rightsif ((auth) && ((width == 0) || (height == 0)) && (maxwidth == 0) && (maxheight == 0)) return original;@@ -106,6 +107,10 @@ public class ViewImage {}}+ // check for minimum values+ width = Math.max(width, 1);+ height = Math.max(height, 1);+// scale imageImage scaled = original.getScaledInstance(width, height, Image.SCALE_AREA_AVERAGING);mediaTracker.addImage(scaled, 0);diff --git a/htroot/yacysearch.html b/htroot/yacysearch.htmlindex a867f7a78..1f6e171a4 100644--- a/htroot/yacysearch.html+++ b/htroot/yacysearch.html@@ -111,7 +111,7 @@ available for everyone. Then stay online to support crawls from other peers. Tha#{results}#<!-- link begin --><p style="border-bottom:1px #000 dashed; padding-bottom: 1em;">-<a href="/Bookmarks_p.html?edit=#[urlhash]#" onMouseover="document.plus_#[urlhexhash]#.src=picPlus.src" onMouseout="document.plus_#[urlhexhash]#.src=picEmpty.src">+<a href="/Bookmarks.html?edit=#[urlhash]#" onMouseover="document.plus_#[urlhexhash]#.src=picPlus.src" onMouseout="document.plus_#[urlhexhash]#.src=picEmpty.src"><img src="/env/grafics/empty.gif" title="bookmark" alt="bookmark" name="plus_#[urlhexhash]#" border="0"></a><span class="ResultDescription">#[description]#</span><br><a href="#[delete]#" onMouseover="document.minus_#[urlhexhash]#.src=picMinus.src" onMouseout="document.minus_#[urlhexhash]#.src=picEmpty.src">@@ -119,7 +119,7 @@ available for everyone. Then stay online to support crawls from other peers. Tha<span class="#(snippet)#snippetLoading::snippetLoaded#(/snippet)#" id="#[urlhash]#">#(snippet)#loading snippet ...::#[text]##(/snippet)#</span><br><img src="/env/grafics/empty.gif" border="0"> <a id="url#[urlhash]#" href="#[url]#">#[urlname]#</a><br><img src="/env/grafics/empty.gif"><span class="ResultDateYBR"> #[date]#</span> |-<span class="ResultDateYBR">YBR-#[ybr]#</span> | <a href="ViewFile.html?urlHash=#[urlhash]#&words=#[words]#">Info</a> | <a href="yacysearch.html?cat=image&url=#[url]#">Pictures</a>+<span class="ResultDateYBR">YBR-#[ybr]#</span> | <a href="ViewFile.html?urlHash=#[urlhash]#&words=#[words]#">Info</a> | <a href="yacysearch.html?cat=image&url=#[url]#&search=#[former]#">Pictures</a><br></p><!-- link end -->diff --git a/htroot/yacysearch.java b/htroot/yacysearch.javaindex 58bac30fa..63f93de65 100644--- a/htroot/yacysearch.java+++ b/htroot/yacysearch.java@@ -78,11 +78,7 @@ public class yacysearch {boolean authenticated = sb.adminAuthenticated(header) >= 2;int display = ((post == null) || (!authenticated)) ? 0 : post.getInt("display", 0);- boolean global = (post == null) ? true : post.get("resource", "global").equals("global");- final boolean indexDistributeGranted = sb.getConfig("allowDistributeIndex", "true").equals("true");- final boolean indexReceiveGranted = sb.getConfig("allowReceiveIndex", "true").equals("true");- if (!indexDistributeGranted || !indexReceiveGranted) { global = false; }-+// case if no values are requestedfinal String referer = (String) header.get("Referer");if (post == null || env == null) {@@ -134,6 +130,21 @@ public class yacysearch {serverObjects prop = new serverObjects();+ final int count = Integer.parseInt(post.get("count", "10"));+ final String order = post.get("order", plasmaSearchPreOrder.canUseYBR() ? "YBR-Date-Quality" : "Date-Quality-YBR");+ boolean global = (post == null) ? true : post.get("resource", "global").equals("global");+ final boolean indexDistributeGranted = sb.getConfig("allowDistributeIndex", "true").equals("true");+ final boolean indexReceiveGranted = sb.getConfig("allowReceiveIndex", "true").equals("true");+ if (!indexDistributeGranted || !indexReceiveGranted) { global = false; }+ final long searchtime = 1000 * Long.parseLong(post.get("time", "10"));+ String urlmask = "";+ if (post.containsKey("urlmask") && post.get("urlmask").equals("no")) {+ urlmask = ".*";+ } else {+ urlmask = (post.containsKey("urlmaskfilter")) ? (String) post.get("urlmaskfilter") : ".*";+ }+ String prefer = post.get("prefer", ".*");+if (post.get("cat", "href").equals("href")) {prop.put("type", 0); // set type of result: normal link list@@ -156,9 +167,7 @@ public class yacysearch {}// prepare search order- final String order = post.get("order", plasmaSearchPreOrder.canUseYBR() ? "YBR-Date-Quality" : "Date-Quality-YBR");- final int count = Integer.parseInt(post.get("count", "10"));- final long searchtime = 1000 * Long.parseLong(post.get("time", "10"));+final boolean yacyonline = ((yacyCore.seedDB != null) && (yacyCore.seedDB.mySeed != null) && (yacyCore.seedDB.mySeed.getAddress() != null));String order1 = plasmaSearchRankingProfile.ORDER_DATE;@@ -173,13 +182,7 @@ public class yacysearch {if (order.endsWith("YBR")) order3 = plasmaSearchRankingProfile.ORDER_YBR;if (order.endsWith("Date")) order3 = plasmaSearchRankingProfile.ORDER_DATE;if (order.endsWith("Quality")) order3 = plasmaSearchRankingProfile.ORDER_QUALITY;- String urlmask = "";- if (post.containsKey("urlmask") && post.get("urlmask").equals("no")) {- urlmask = ".*";- } else {- urlmask = (post.containsKey("urlmaskfilter")) ? (String) post.get("urlmaskfilter") : ".*";- }-+// do the searchplasmaSearchQuery thisSearch = new plasmaSearchQuery(query,@@ -296,16 +299,9 @@ public class yacysearch {}}- prop.put("former", post.get("search", ""));- prop.put("count", count);- prop.put("order", order);- prop.put("resource", (global) ? "global" : "local");- prop.put("time", searchtime / 1000);- prop.put("urlmaskfilter", urlmask);prop.put("type", "0");prop.put("cat", "href");prop.put("depth", "0");-// adding some additional properties needed for the rss feedString hostName = (String) header.get("Host", "localhost");@@ -340,13 +336,21 @@ public class yacysearch {line++;}prop.put("type_results", line);-- prop.put("cat", "image");+prop.put("type", 1); // set type of result: image list- prop.put("former", post.get("search", ""));+ prop.put("cat", "href");prop.put("depth", depth);}++ prop.put("former", post.get("search", ""));+ prop.put("count", count);+ prop.put("order", order);+ prop.put("resource", (global) ? "global" : "local");+ prop.put("time", searchtime / 1000);+ prop.put("urlmaskfilter", urlmask);+ prop.put("prefer", prefer);prop.put("display", display);+// return rewrite propertiesreturn prop;}diff --git a/source/de/anomic/http/httpdFileHandler.java b/source/de/anomic/http/httpdFileHandler.javaindex 4abb7b065..4ca17621d 100644--- a/source/de/anomic/http/httpdFileHandler.java+++ b/source/de/anomic/http/httpdFileHandler.java@@ -515,9 +515,11 @@ public final class httpdFileHandler extends httpdAbstractHandler implements httpString mimeType = mimeTable.getProperty(targetExt, "text/html");// generate an byte array from the generated image+ int width = i.getWidth(null);+ int height = i.getHeight(null);+ BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);+ bi.createGraphics().drawImage(i, 0, 0, width, height, null);serverByteBuffer baos = new serverByteBuffer();- BufferedImage bi = new BufferedImage(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_RGB);- bi.createGraphics().drawImage(i, 0, 0, i.getWidth(null), i.getHeight(null), null);ImageIO.write(bi, targetExt, baos);byte[] result = baos.toByteArray();diff --git a/source/de/anomic/plasma/plasmaSwitchboard.java b/source/de/anomic/plasma/plasmaSwitchboard.javaindex 1a409a743..3afa54b77 100644--- a/source/de/anomic/plasma/plasmaSwitchboard.java+++ b/source/de/anomic/plasma/plasmaSwitchboard.java@@ -1878,7 +1878,8 @@ public final class plasmaSwitchboard extends serverAbstractSwitch implements serprop.put("type_results_" + i + "_date", dateString(urlentry.moddate()));prop.put("type_results_" + i + "_ybr", plasmaSearchPreOrder.ybr(urlentry.hash()));prop.put("type_results_" + i + "_size", Long.toString(urlentry.size()));- prop.put("type_results_" + i + "_words",URLEncoder.encode(query.queryWords.toString(),"UTF-8"));+ prop.put("type_results_" + i + "_words", URLEncoder.encode(query.queryWords.toString(),"UTF-8"));+ prop.put("type_results_" + i + "_former", formerSearch);// adding snippet if availableif (snippet.exists()) {prop.put("type_results_" + i + "_snippet", 1);