Author: orbiter
Date: 2008-02-25 22:26:49 +0100 (Mon, 25 Feb 2008)
New Revision: 4510
Modified:
trunk/htroot/CrawlProfileEditor_p.html
trunk/htroot/yacy/user/ysearch.html
trunk/htroot/yacy/user/ysearchitem.html
trunk/htroot/yacy/user/ysearchitem.java
trunk/source/de/anomic/htmlFilter/htmlFilterContentScraper.java
trunk/source/de/anomic/http/httpSSI.java
trunk/source/de/anomic/http/httpdFileHandler.java
trunk/source/de/anomic/yacy/yacyClient.java
Log:
added a search history to the new search page
the history distinguishes between different users and identifies them by their
ip
a history is only shown to the user who submitted the search
Modified: trunk/htroot/CrawlProfileEditor_p.html
===================================================================
--- trunk/htroot/CrawlProfileEditor_p.html 2008-02-25 19:00:11 UTC (rev
4509)
+++ trunk/htroot/CrawlProfileEditor_p.html 2008-02-25 21:26:49 UTC (rev
4510)
@@ -108,8 +108,8 @@
type="text" value="#[value]#"#(/type)# />::
<strong>#(type)##(checked)#false::true#(/checked)#::#[value]#::#[value]##(/type)#</strong>#(/readonly)#
</dd>#{/entries}#
+ <dt> </dt><dd><input type="submit" name="submit" value="Submit
changes" /></dd>
</dl>
- <input type="submit" name="submit" value="Submit changes" />
</fieldset>
</form>
#(/edit)#
Modified: trunk/htroot/yacy/user/ysearch.html
===================================================================
--- trunk/htroot/yacy/user/ysearch.html 2008-02-25 19:00:11 UTC (rev 4509)
+++ trunk/htroot/yacy/user/ysearch.html 2008-02-25 21:26:49 UTC (rev 4510)
@@ -142,46 +142,6 @@
<div id="sidebar">
<!-- attach the bottomline -->
<!--#include
virtual="/yacy/user/ysearchitem.html?bottomline=true&eventID=#[eventID]#" -->
-
- <!--
- <div id="updates" class="boxed">
- <h2 class="title">News</h2>
- <div class="content">
- <ul>
- <li>
- <h3>March 5, 2007</h3>
- <p><a href="#">In posuere eleifend odio quisque semper augue
mattis wisi maecenas…</a></p>
- </li>
- <li>
- <h3>March 3, 2007</h3>
- <p><a href="#">Quisque dictum integer nisl risus, sagittis
convallis, rutrum id, congue, and nibh…</a></p>
- </li>
- <li>
- <h3>February 28, 2007</h3>
- <p><a href="#">Donec leo, vivamus fermentum nibh in augue praesent
a lacus at urna congue rutrum…</a></p>
- </li>
- <li>
- <h3>February 25, 2007</h3>
- <p><a href="#">Nam pede erat, porta eu, lobortis eget, tempus et,
tellus. Etiam nequea…</a></p>
- </li>
- </ul>
- </div>
- </div>
- -->
- <div id="partners" class="boxed">
- <h2 class="title">Recent Searches</h2>
- <div class="content">
- <ul>
- <li><a href="#">Donec Dictum Metus</a></li>
- <li><a href="#">Etiam Rhoncus Volutpat</a></li>
- <li><a href="#">Integer Gravida Nibh</a></li>
- <li><a href="#">Maecenas Luctus Lectus</a></li>
- <li><a href="#">Mauris Vulputate Dolor</a></li>
- <li><a href="#">Nulla Luctus Eleifend</a></li>
- <li><a href="#">Posuere Augue Sit Nisl</a></li>
- </ul>
- </div>
- </div>
</div>
</div>
Modified: trunk/htroot/yacy/user/ysearchitem.html
===================================================================
--- trunk/htroot/yacy/user/ysearchitem.html 2008-02-25 19:00:11 UTC (rev
4509)
+++ trunk/htroot/yacy/user/ysearchitem.html 2008-02-25 21:26:49 UTC (rev
4510)
@@ -9,7 +9,7 @@
::
#{items}#
<div class="thumbcontainer">
- <a href="#[href]#" class="thumblink" onclick="return hs.expand(this)">
+ <a href="#[hrefCache]#" class="thumblink" onclick="return hs.expand(this)">
<img src="/ViewImage.png?maxwidth=96&maxheight=96&code=#[code]#"
alt="#[name]#">
</a>
<div class="highslide-caption"><a href="#[href]#">#[name]#<br \><a
href="#[source]#">#[sourcedom]#</a></a></div>
@@ -70,6 +70,18 @@
#(/topwords)#
</div>
</div>
-
#(/navigation)#
+#(history)#::
+ <div id="partners" class="boxed">
+ <h2 class="title">Recent Searches</h2>
+ <div class="content">
+ <ul>
+ #{list}#
+ <li><a
href="/yacy/user/ysearch.html?search=#[querystring]#&resource=#[searchdom]#&contentdom=#[contentdom]#">#[querystring]#</a></li>
+ #{/list}#
+ </ul>
+ <p>The search history is only visible for users from host #[host]#</p>
+ </div>
+ </div>
+#(/history)#
Modified: trunk/htroot/yacy/user/ysearchitem.java
===================================================================
--- trunk/htroot/yacy/user/ysearchitem.java 2008-02-25 19:00:11 UTC (rev
4509)
+++ trunk/htroot/yacy/user/ysearchitem.java 2008-02-25 21:26:49 UTC (rev
4510)
@@ -28,6 +28,7 @@
import java.net.MalformedURLException;
import java.net.URLEncoder;
import java.util.ArrayList;
+import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
import java.util.TreeSet;
@@ -189,6 +190,29 @@
prop.put("navigation_resnav", resnav.toString());
prop.put("navigation", "1");
+ // list search history
+ Iterator<plasmaSearchQuery> i = sb.localSearches.iterator();
+ String client = (String)
header.get(httpHeader.CONNECTION_PROP_CLIENTIP);
+ plasmaSearchQuery query;
+ int c = 0;
+ HashSet<String> visibleQueries = new HashSet<String>();
+ while (i.hasNext()) {
+ query = i.next();
+ if (query.resultcount == 0) continue;
+ if (query.offset != 0) continue;
+ if (!query.host.equals(client)) continue; // the search
history should only be visible from the user who initiated the search
+ if (visibleQueries.contains(query.queryString)) continue; //
avoid doubles
+ visibleQueries.add(query.queryString);
+ prop.put("history_list_" + c + "_querystring",
query.queryString);
+ prop.put("history_list_" + c + "_searchdom",
query.searchdom());
+ prop.put("history_list_" + c + "_contentdom",
query.contentdom());
+ c++;
+ if (c >= 10) break;
+ }
+ prop.put("history_list", c);
+ prop.put("history_host", client);
+ if (c == 0) prop.put("history", 0); else prop.put("history", 1);
// switch on if there is anything to see
+
return prop;
}
Modified: trunk/source/de/anomic/htmlFilter/htmlFilterContentScraper.java
===================================================================
--- trunk/source/de/anomic/htmlFilter/htmlFilterContentScraper.java
2008-02-25 19:00:11 UTC (rev 4509)
+++ trunk/source/de/anomic/htmlFilter/htmlFilterContentScraper.java
2008-02-25 21:26:49 UTC (rev 4510)
@@ -240,8 +240,8 @@
// System.out.println("ScrapeTag1: tagname=" + tagname + ", opts=" +
tagopts.toString() + ", text=" + new String(text));
if ((tagname.equalsIgnoreCase("a")) && (text.length < 2048)) {
String href = tagopts.getProperty("href", "");
- if (href.length() > 0) {
- yacyURL url = absolutePath(href);
+ yacyURL url;
+ if ((href.length() > 0) && ((url = absolutePath(href)) != null)) {
String f = url.getFile();
int p = f.lastIndexOf('.');
String type = (p < 0) ? "" : f.substring(p + 1);
Modified: trunk/source/de/anomic/http/httpSSI.java
===================================================================
--- trunk/source/de/anomic/http/httpSSI.java 2008-02-25 19:00:11 UTC (rev
4509)
+++ trunk/source/de/anomic/http/httpSSI.java 2008-02-25 21:26:49 UTC (rev
4510)
@@ -35,11 +35,11 @@
public class httpSSI {
- public static void writeSSI(serverByteBuffer in, OutputStream out, String
authorization) throws IOException {
- writeSSI(in, 0, out, authorization);
+ public static void writeSSI(serverByteBuffer in, OutputStream out, String
authorization, String requesthost) throws IOException {
+ writeSSI(in, 0, out, authorization, requesthost);
}
- public static void writeSSI(serverByteBuffer in, int off, OutputStream
out, String authorization) throws IOException {
+ public static void writeSSI(serverByteBuffer in, int off, OutputStream
out, String authorization, String requesthost) throws IOException {
int p = in.indexOf("<!--#".getBytes(), off);
if (p >= 0) {
int q = in.indexOf("-->".getBytes(), p + 10);
@@ -48,8 +48,8 @@
} else {
out.write(in.getBytes(off, p - off));
}
- parseSSI(in, p, q + 3 - p, out, authorization);
- writeSSI(in, q + 3, out, authorization);
+ parseSSI(in, p, q + 3 - p, out, authorization, requesthost);
+ writeSSI(in, q + 3, out, authorization, requesthost);
} else /* p < 0 */ {
if (out instanceof httpChunkedOutputStream) {
((httpChunkedOutputStream) out).write(in, off, in.length() -
off);
@@ -59,17 +59,17 @@
}
}
- private static void parseSSI(serverByteBuffer in, int off, int len,
OutputStream out, String authorization) {
+ private static void parseSSI(serverByteBuffer in, int off, int len,
OutputStream out, String authorization, String requesthost) {
if (in.startsWith("<!--#include virtual=\"".getBytes(), off)) {
int q = in.indexOf("\"".getBytes(), off + 22);
if (q > 0) {
String path = in.toString(off + 22, q);
- writeContent(path, out, authorization);
+ writeContent(path, out, authorization, requesthost);
}
}
}
- private static void writeContent(String path, OutputStream out, String
authorization) {
+ private static void writeContent(String path, OutputStream out, String
authorization, String requesthost) {
// check if there are arguments in path string
String args = "";
int argpos = path.indexOf('?');
@@ -85,7 +85,7 @@
conProp.setProperty(httpHeader.CONNECTION_PROP_PATH, path);
conProp.setProperty(httpHeader.CONNECTION_PROP_ARGS, args);
conProp.setProperty(httpHeader.CONNECTION_PROP_HTTP_VER,
httpHeader.HTTP_VERSION_0_9);
- conProp.setProperty(httpHeader.CONNECTION_PROP_CLIENTIP, "127.0.0.1");
+ conProp.setProperty(httpHeader.CONNECTION_PROP_CLIENTIP, requesthost);
header.put(httpHeader.AUTHORIZATION, authorization);
httpdFileHandler.doGet(conProp, header, out);
}
Modified: trunk/source/de/anomic/http/httpdFileHandler.java
===================================================================
--- trunk/source/de/anomic/http/httpdFileHandler.java 2008-02-25 19:00:11 UTC
(rev 4509)
+++ trunk/source/de/anomic/http/httpdFileHandler.java 2008-02-25 21:26:49 UTC
(rev 4510)
@@ -280,6 +280,7 @@
path = conProp.getProperty(httpHeader.CONNECTION_PROP_PATH);
String argsString =
conProp.getProperty(httpHeader.CONNECTION_PROP_ARGS); // is null if no args
were given
String httpVersion =
conProp.getProperty(httpHeader.CONNECTION_PROP_HTTP_VER);
+ String clientIP =
conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP, "unknown-host");
// check hack attacks in path
if (path.indexOf("..") >= 0) {
@@ -324,7 +325,6 @@
return;
} else {
// a wrong authentication was given or the userDB user
does not have admin access. Ask again
- String clientIP =
conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP, "unknown-host");
serverLog.logInfo("HTTPD", "Wrong log-in for account
'admin' in http file handler for path '" + path + "' from host '" + clientIP +
"'");
Integer attempts = (Integer)
serverCore.bfHost.get(clientIP);
if (attempts == null)
@@ -420,8 +420,7 @@
// a different language can be desired (by i.e. ConfigBasic.html)
than the one stored in the locale.language
String localeSelection =
switchboard.getConfig("locale.language","default");
- if (args != null && (args.containsKey("language")))
- {
+ if (args != null && (args.containsKey("language"))) {
// TODO 9.11.06 Bost: a class with information about available
languages is needed.
// the indexOf(".") is just a workaround because there from
ConfigLanguage.html commes "de.lng" and
// from ConfigBasic.html comes just "de" in the "language"
parameter
@@ -634,7 +633,6 @@
if
(tp.containsKey(servletProperties.ACTION_AUTHENTICATE)) {
// handle brute-force protection
if (authorization != null) {
- String clientIP =
conProp.getProperty(httpHeader.CONNECTION_PROP_CLIENTIP, "unknown-host");
serverLog.logInfo("HTTPD", "dynamic log-in
for account 'admin' in http file handler for path '" + path + "' from host '" +
clientIP + "'");
Integer attempts = (Integer)
serverCore.bfHost.get(clientIP);
if (attempts == null)
@@ -735,7 +733,7 @@
httpd.sendRespondHeader(conProp, out, httpVersion,
200, null, mimeType, -1, targetDate, null, tp.getOutgoingHeader(), null,
"chunked", nocache);
// send the content in chunked parts, see RFC 2616
section 3.6.1
httpChunkedOutputStream chos = new
httpChunkedOutputStream(out);
- httpSSI.writeSSI(o, chos, authorization);
+ httpSSI.writeSSI(o, chos, authorization, clientIP);
//chos.write(result);
chos.finish();
} else {
@@ -749,14 +747,14 @@
if (zipContent) {
GZIPOutputStream zippedOut = new
GZIPOutputStream(o);
- httpSSI.writeSSI(o1, zippedOut, authorization);
+ httpSSI.writeSSI(o1, zippedOut, authorization,
clientIP);
//httpTemplate.writeTemplate(fis, zippedOut, tp,
"-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
zippedOut.finish();
zippedOut.flush();
zippedOut.close();
zippedOut = null;
} else {
- httpSSI.writeSSI(o1, o, authorization);
+ httpSSI.writeSSI(o1, o, authorization, clientIP);
//httpTemplate.writeTemplate(fis, o, tp,
"-UNRESOLVED_PATTERN-".getBytes("UTF-8"));
}
if (method.equals(httpHeader.METHOD_HEAD)) {
Modified: trunk/source/de/anomic/yacy/yacyClient.java
===================================================================
--- trunk/source/de/anomic/yacy/yacyClient.java 2008-02-25 19:00:11 UTC (rev
4509)
+++ trunk/source/de/anomic/yacy/yacyClient.java 2008-02-25 21:26:49 UTC (rev
4510)
@@ -232,6 +232,7 @@
if (seedStr.length() > yacySeed.maxsize) {
yacyCore.log.logInfo("hello/client: rejected contacting seed;
too large (" + seedStr.length() + " > " + yacySeed.maxsize + ")");
} else {
+ //System.out.println("DEBUG yacyClient.publishMySeed seedStr =
" + seedStr);
if
(yacyCore.peerActions.peerArrival(yacySeed.genRemoteSeed(seedStr,
post.get("key", ""), true), (i == 1))) count++;
}
}
_______________________________________________
YaCy-svn mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/yacy-svn