mirror of
https://github.com/yacy/yacy_search_server.git
synced 2024-09-19 00:01:41 +02:00
- added decode of HTML-entities in request lines
- removed Bookmark symbol on search pages and surftips if not authenticated git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@3172 6c8d7289-2bf4-0310-a012-ef5d649a1542
This commit is contained in:
parent
22a8826515
commit
00aa9472d6
|
@ -220,9 +220,6 @@
|
|||
</fieldset>
|
||||
</form>
|
||||
|
||||
<p>
|
||||
<strong></strong>
|
||||
</p>
|
||||
<form action="PerformanceQueues_p.html" method="post" enctype="multipart/form-data">
|
||||
<fieldset><legend>Proxy Performance Settings</legend>
|
||||
<p>
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#{results}#
|
||||
<!-- link begin -->
|
||||
<div class="searchresults">
|
||||
#(authorized)#::
|
||||
<div class="urlactions">
|
||||
<a href="/Bookmarks.html?edit=#[urlhash]#" class="bookmarklink" title="bookmark"><img src="/env/grafics/empty.gif" title="bookmark" alt="Add to bookmarks" class="bookmarkIcon" /></a>
|
||||
#(recommend)#
|
||||
|
@ -41,6 +42,7 @@
|
|||
<a href="#[negativeVoteLink]#" title="negative vote" class="deletelink" ><img src="/env/grafics/empty.gif" title="negative vote" alt="Give negative vote" class="deleteIcon" /></a>
|
||||
#(/recommend)#
|
||||
</div>
|
||||
#(/authorized)#
|
||||
<h4 class="linktitle"><a href="#[url]#">#[title]#</a></h4>
|
||||
<p class="snippet">#[description]#</p>
|
||||
</div>
|
||||
|
|
|
@ -137,9 +137,10 @@ public class Surftips {
|
|||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
prop.put("surftips_results_" + i + "_recommend", (voted || !authenticated) ? 0 : 1);
|
||||
prop.put("surftips_results_" + i + "_recommend_negativeVoteLink", "/Surftips.html?voteNegative=" + urlhash + "&refid=" + refid + "&,display=" + display + ((showScore) ? "&score=" : "")); // for negaive votes, we don't send around the bad url again, the hash is enough
|
||||
prop.put("surftips_results_" + i + "_recommend_positiveVoteLink", "/Surftips.html?votePositive=" + urlhash + "&refid=" + refid + "&url=" + crypt.simpleEncode(url,null,'b') + "&title=" + crypt.simpleEncode(title,null,'b') + "&description=" + crypt.simpleEncode(description,null,'b') + "&display=" + display + ((showScore) ? "&score=" : ""));
|
||||
prop.put("surftips_results_" + i + "_authorized", (authenticated) ? 1 : 0);
|
||||
prop.put("surftips_results_" + i + "_authorized_recommend", (voted) ? 0 : 1);
|
||||
prop.put("surftips_results_" + i + "_authorized_recommend_negativeVoteLink", "/Surftips.html?voteNegative=" + urlhash + "&refid=" + refid + "&,display=" + display + ((showScore) ? "&score=" : "")); // for negaive votes, we don't send around the bad url again, the hash is enough
|
||||
prop.put("surftips_results_" + i + "_authorized_recommend_positiveVoteLink", "/Surftips.html?votePositive=" + urlhash + "&refid=" + refid + "&url=" + crypt.simpleEncode(url,null,'b') + "&title=" + crypt.simpleEncode(title,null,'b') + "&description=" + crypt.simpleEncode(description,null,'b') + "&display=" + display + ((showScore) ? "&score=" : ""));
|
||||
prop.put("surftips_results_" + i + "_url", de.anomic.data.wikiCode.replaceHTMLonly(url));
|
||||
prop.put("surftips_results_" + i + "_urlname", nxTools.shortenURLString(url, 60));
|
||||
prop.put("surftips_results_" + i + "_urlhash", urlhash);
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
<script type="text/javascript" src="/js/yacysearch.js"></script>
|
||||
|
||||
</head>
|
||||
<body id="yacysearch" onload="document.getElementById('SearchInput').focus()">
|
||||
<body id="yacysearch" onload="document.getElementById('search').focus()">
|
||||
|
||||
#(display)#
|
||||
#%env/templates/simpleheader.template%#
|
||||
|
@ -18,15 +18,15 @@
|
|||
#%env/templates/header.template%#
|
||||
#(/display)#
|
||||
|
||||
<form class="search small" action="yacysearch.html" method="get" accept-charset="ascii">
|
||||
<form class="search small" action="yacysearch.html" method="get">
|
||||
<p class="yacylogo"><a href="http://yacy.net/yacy/" class="yacylogo"><img src="/env/grafics/yacy.png" alt="yacy" /></a></p>
|
||||
<h2>#[promoteSearchPageGreeting]#</h2>
|
||||
<fieldset class="maininput">
|
||||
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
||||
<tr>
|
||||
<td>
|
||||
<input id="SearchInput" name="search" type="text" size="50" maxlength="80" value="#[former]#" onclick="document.getElementById('Search').value = 'Search'" />
|
||||
<input id="Search" type="submit" name="Enter" value="Search" />
|
||||
<input id="search" name="search" type="text" size="50" maxlength="80" value="#[former]#" onclick="document.getElementById('Enter').value = 'Search'" />
|
||||
<input id="Enter" type="submit" name="Enter" value="Search" />
|
||||
</td>
|
||||
<td>
|
||||
<a href="index.html?display=#[display]#&searchoptions=1&count=#[count]#&order=#[order]#&resource=#[resource]#&time=#[time]#&urlmaskfilter=#[urlmaskfilter]#&prefermaskfilter=#[prefermaskfilter]#&cat=#[cat]#&type=#[type]#&constraint=#[constraint]#&contentdom=#[contentdom]#&former=#[former]#">more options</a>
|
||||
|
@ -63,7 +63,7 @@
|
|||
</form>
|
||||
|
||||
<script type="text/javascript">
|
||||
document.getElementById("Search").value = "search again - catch up more links";
|
||||
document.getElementById("Enter").value = "search again - catch up more links";
|
||||
</script>
|
||||
|
||||
<!-- show information about search key handling -->
|
||||
|
@ -116,6 +116,7 @@ document.getElementById("Search").value = "search again - catch up more links";
|
|||
#{results}#
|
||||
<!-- link begin -->
|
||||
<div class="searchresults">
|
||||
#(authorized)#::
|
||||
<div class="urlactions">
|
||||
<a href="/Bookmarks.html?edit=#[urlhash]#" class="bookmarklink" title="bookmark"><img src="/env/grafics/empty.gif" title="bookmark" alt="bookmark" class="bookmarkIcon" /></a>
|
||||
#(recommend)#
|
||||
|
@ -126,6 +127,7 @@ document.getElementById("Search").value = "search again - catch up more links";
|
|||
<a href="#[deletelink]#" title="delete" class="deletelink" ><img src="/env/grafics/empty.gif" title="delete" alt="delete" class="deleteIcon" /></a>
|
||||
#(/recommend)#
|
||||
</div>
|
||||
#(/authorized)#
|
||||
<h4 class="linktitle"><a href="#[url]#">#[description]#</a></h4>
|
||||
<p class="snippet"><span class="#(snippet)#snippetLoading::snippetLoaded#(/snippet)#" id="#[urlhash]#">#(snippet)#loading snippet ...::#[text]##(/snippet)#</span></p>
|
||||
<p class="url"><a href="#[url]#" id="url#[urlhash]#">#[urlname]#</a></p>
|
||||
|
|
|
@ -52,8 +52,10 @@ import java.util.HashMap;
|
|||
import java.util.Iterator;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import de.anomic.data.wikiCode;
|
||||
import de.anomic.htmlFilter.htmlFilterImageEntry;
|
||||
import de.anomic.http.httpHeader;
|
||||
import de.anomic.http.httpd;
|
||||
import de.anomic.index.indexURLEntry;
|
||||
import de.anomic.kelondro.kelondroBitfield;
|
||||
import de.anomic.kelondro.kelondroMSetTools;
|
||||
|
@ -390,16 +392,14 @@ public class yacysearch {
|
|||
prop.put("cat", "href");
|
||||
prop.put("depth", depth);
|
||||
}
|
||||
|
||||
|
||||
// if user is not authenticated, he may not vote for URLs
|
||||
if (!authenticated) {
|
||||
int linkcount = Integer.parseInt(prop.get("num-results_linkcount", "0"));
|
||||
for (int i=0; i<linkcount; i++)
|
||||
prop.put("type_results_" + i + "_recommend", 0);
|
||||
}
|
||||
int linkcount = Integer.parseInt(prop.get("num-results_linkcount", "0"));
|
||||
for (int i=0; i<linkcount; i++)
|
||||
prop.put("type_results_" + i + "_authorized", (authenticated) ? 1 : 0);
|
||||
|
||||
prop.put("promoteSearchPageGreeting", promoteSearchPageGreeting);
|
||||
prop.put("former", post.get("search", ""));
|
||||
prop.put("former", wikiCode.replaceHTMLonly(post.get("search", "")));
|
||||
prop.put("count", count);
|
||||
prop.put("order", order);
|
||||
prop.put("resource", (global) ? "global" : "local");
|
||||
|
|
|
@ -62,6 +62,7 @@ import java.util.Properties;
|
|||
import java.util.StringTokenizer;
|
||||
|
||||
import de.anomic.data.userDB;
|
||||
import de.anomic.data.wikiCode;
|
||||
import de.anomic.net.URL;
|
||||
import de.anomic.plasma.plasmaSwitchboard;
|
||||
import de.anomic.server.serverByteBuffer;
|
||||
|
@ -85,6 +86,9 @@ import de.anomic.yacy.yacySeed;
|
|||
*/
|
||||
public final class httpd implements serverHandler {
|
||||
|
||||
public static final int ERRORCASE_MESSAGE = 4;
|
||||
public static final int ERRORCASE_FILE = 5;
|
||||
|
||||
/**
|
||||
* A hashset containing extensions that indicate content that should not be transported
|
||||
* using zipped content encoding
|
||||
|
@ -781,9 +785,37 @@ public final class httpd implements serverHandler {
|
|||
baos.write(s.charAt(pos++));
|
||||
}
|
||||
}
|
||||
return baos.toString();
|
||||
return decodeHtmlEntities(baos.toString());
|
||||
}
|
||||
|
||||
// 06.01.2007: decode HTML entities by [FB]
|
||||
public static String decodeHtmlEntities(String s) {
|
||||
// replace all entities defined in wikiCode.characters and htmlentities
|
||||
for (int i=1; i<wikiCode.characters.length; i+=2) {
|
||||
s = s.replaceAll(wikiCode.characters[i], wikiCode.characters[i - 1]);
|
||||
}
|
||||
for (int i=1; i<wikiCode.htmlentities.length; i+=2) {
|
||||
s = s.replaceAll(wikiCode.htmlentities[i], wikiCode.htmlentities[i - 1]);
|
||||
}
|
||||
|
||||
// replace all other
|
||||
CharArrayWriter b = new CharArrayWriter(s.length());
|
||||
int end;
|
||||
for (int i=0; i<s.length(); i++) {
|
||||
if (s.charAt(i) == '&' && (end = s.indexOf(';', i + 1)) > i) {
|
||||
if (s.charAt(i + 1) == '#') { // Ӓ symbols
|
||||
b.write(Integer.parseInt(s.substring(i + 2, end)));
|
||||
i += end - i;
|
||||
} else { // 'named' smybols
|
||||
serverLog.logFine("HTTPD", "discovered yet unimplemented HTML entity '" + s.substring(i, end + 1) + "'");
|
||||
b.write(s.charAt(i));
|
||||
}
|
||||
} else {
|
||||
b.write(s.charAt(i));
|
||||
}
|
||||
}
|
||||
return b.toString();
|
||||
}
|
||||
|
||||
public static HashMap parseMultipart(httpHeader header, serverObjects args, InputStream in, int length) throws IOException {
|
||||
// this is a quick hack using a previously coded parseMultipart based on a buffer
|
||||
|
@ -1103,10 +1135,10 @@ public final class httpd implements serverHandler {
|
|||
tp.put("requestURL", urlString);
|
||||
|
||||
switch (errorcase) {
|
||||
case 4:
|
||||
case ERRORCASE_MESSAGE:
|
||||
tp.put("errorMessageType_detailedErrorMsg",(detailedErrorMsgText==null)?"":detailedErrorMsgText.replaceAll("\n","<br>"));
|
||||
break;
|
||||
case 5:
|
||||
case ERRORCASE_FILE:
|
||||
tp.put("errorMessageType_file",(detailedErrorMsgFile==null)?"":detailedErrorMsgFile);
|
||||
if ((detailedErrorMsgValues != null)&&(detailedErrorMsgValues.size()>0)) {
|
||||
// rewriting the value-names and add the proper name prefix:
|
||||
|
|
Loading…
Reference in New Issue
Block a user