cleaned;

git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@746 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
borg-0300 20 years ago
parent 11e175630b
commit effbf35f57

@ -4,7 +4,10 @@
// (C) by Michael Peter Christen; mc@anomic.de // (C) by Michael Peter Christen; mc@anomic.de
// first published on http://www.anomic.de // first published on http://www.anomic.de
// Frankfurt, Germany, 2004, 2005 // Frankfurt, Germany, 2004, 2005
// last major change: 15.02.2005 //
// $LastChangedDate$
// $LastChangedRevision$
// $LastChangedBy$
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -38,7 +41,7 @@
// done inside the copyright notive above. A re-distribution must contain // done inside the copyright notive above. A re-distribution must contain
// the intact and unchanged copyright notice. // the intact and unchanged copyright notice.
// Contributions and changes to the program code must be marked as such. // Contributions and changes to the program code must be marked as such.
//
// You must compile this file with // You must compile this file with
// javac -classpath <application_root>/classes <application_root>/htroot/htdocsdefault/dir.java // javac -classpath <application_root>/classes <application_root>/htroot/htdocsdefault/dir.java
// which most probably means to compile this with // which most probably means to compile this with
@ -53,7 +56,6 @@ import java.util.Date;
import java.util.Set; import java.util.Set;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import de.anomic.http.httpHeader; import de.anomic.http.httpHeader;
import de.anomic.plasma.plasmaCondenser; import de.anomic.plasma.plasmaCondenser;
import de.anomic.plasma.plasmaCrawlLURL; import de.anomic.plasma.plasmaCrawlLURL;
@ -77,20 +79,20 @@ public class dir {
} }
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
plasmaSwitchboard switchboard = (plasmaSwitchboard) env; final plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
serverObjects prop = new serverObjects(); final serverObjects prop = new serverObjects();
//System.out.println("###Header="+ header); // System.out.println("###Header="+ header);
//System.out.println("###post=" + post); // System.out.println("###post=" + post);
String action = ((post == null) ? "info" : post.get("action", "info")); String action = ((post == null) ? "info" : post.get("action", "info"));
String tree = ""; String tree = "";
// variables for this path // variables for this path
//File htroot = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath", "htroot")); // File htroot = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath", "htroot"));
File htroot = new File(switchboard.getRootPath(), switchboard.getConfig("htDocsPath", "DATA/HTDOCS")); final File htroot = new File(switchboard.getRootPath(), switchboard.getConfig("htDocsPath", "DATA/HTDOCS"));
String path = (String) header.get("PATH", "/"); String path = (String) header.get("PATH", "/");
int p = path.lastIndexOf("/"); int pos = path.lastIndexOf("/");
if (p >= 0) path = path.substring(0, p + 1); if (pos >= 0) { path = path.substring(0, pos + 1); }
File dir = new File(htroot, path); final File dir = new File(htroot, path);
// general settings // general settings
prop.put("peername", env.getConfig("peerName", "<nameless>")); prop.put("peername", env.getConfig("peerName", "<nameless>"));
@ -105,35 +107,31 @@ public class dir {
prop.put("port", env.getConfig("port", "8080")); prop.put("port", env.getConfig("port", "8080"));
// generate upload/download authorizations // generate upload/download authorizations
String adminAccountBase64MD5 = switchboard.getConfig("adminAccountBase64MD5", ""); final String adminAccountBase64MD5 = switchboard.getConfig("adminAccountBase64MD5", "");
String uploadAccountBase64MD5 = switchboard.getConfig("uploadAccountBase64MD5", ""); final String uploadAccountBase64MD5 = switchboard.getConfig("uploadAccountBase64MD5", "");
String downloadAccountBase64MD5 = switchboard.getConfig("downloadAccountBase64MD5", ""); final String downloadAccountBase64MD5 = switchboard.getConfig("downloadAccountBase64MD5", "");
String logoutAccountBase64MD5 = de.anomic.server.serverCodings.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String(":")); final String logoutAccountBase64MD5 = de.anomic.server.serverCodings.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String(":"));
String authorizationMD5 = de.anomic.server.serverCodings.encodeMD5Hex(((String) header.get("Authorization", "xxxxxx")).trim().substring(6)); final String authorizationMD5 = de.anomic.server.serverCodings.encodeMD5Hex(((String) header.get("Authorization", "xxxxxx")).trim().substring(6));
//if (logoutAccountBase64.equals(authorization)) // if (logoutAccountBase64.equals(authorization))
boolean adminAuthorization = final boolean adminAuthorization = (adminAccountBase64MD5.length() != 0 &&
((adminAccountBase64MD5.length() != 0) && adminAccountBase64MD5.equals(authorizationMD5));
(adminAccountBase64MD5.equals(authorizationMD5))); final boolean uploadAuthorization = (adminAuthorization ||(uploadAccountBase64MD5.length() != 0 &&
boolean uploadAuthorization = uploadAccountBase64MD5.equals(authorizationMD5)));
((adminAuthorization) || final boolean downloadAuthorization = (adminAuthorization || uploadAuthorization ||
((uploadAccountBase64MD5.length() != 0) && downloadAccountBase64MD5.length() == 0 ||
(uploadAccountBase64MD5.equals(authorizationMD5)))); downloadAccountBase64MD5.equals(authorizationMD5));
boolean downloadAuthorization =
((adminAuthorization) || (uploadAuthorization) ||
(downloadAccountBase64MD5.length() == 0) ||
(downloadAccountBase64MD5.equals(authorizationMD5)));
// do authentitcate processes by triggering the http authenticate method // do authentitcate processes by triggering the http authenticate method
if ((action.equals("authenticateAdmin")) && (!(adminAuthorization))) { if (action.equals("authenticateAdmin") && !adminAuthorization) {
prop.put("AUTHENTICATE", "admin log-in"); prop.put("AUTHENTICATE", "admin log-in");
return prop; return prop;
} }
if ((action.equals("authenticateUpload")) && (!(uploadAuthorization))) { if (action.equals("authenticateUpload") && !uploadAuthorization) {
prop.put("AUTHENTICATE", "upload log-in"); prop.put("AUTHENTICATE", "upload log-in");
return prop; return prop;
} }
if ((action.equals("authenticateDownload")) && (!(downloadAuthorization))) { if (action.equals("authenticateDownload") && !downloadAuthorization) {
prop.put("AUTHENTICATE", "download log-in"); prop.put("AUTHENTICATE", "download log-in");
return prop; return prop;
} }
@ -153,21 +151,20 @@ public class dir {
action = ""; action = "";
} }
} }
if ((action.equals("downloadPassword")) && (adminAuthorization)) { if (action.equals("downloadPassword") && adminAuthorization) {
switchboard.setConfig("downloadAccountBase64MD5", (post.get("password", "").length() == 0) ? "" : serverCodings.standardCoder.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String("download:" + post.get("password", "")))); switchboard.setConfig("downloadAccountBase64MD5", (post.get("password", "").length() == 0) ? "" : serverCodings.standardCoder.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String("download:" + post.get("password", ""))));
} }
if ((action.equals("uploadPassword")) && (adminAuthorization)) { if (action.equals("uploadPassword") && adminAuthorization) {
switchboard.setConfig("uploadAccountBase64MD5", (post.get("password", "").length() == 0) ? "" : serverCodings.standardCoder.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String("upload:" + post.get("password", "")))); switchboard.setConfig("uploadAccountBase64MD5", (post.get("password", "").length() == 0) ? "" : serverCodings.standardCoder.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String("upload:" + post.get("password", ""))));
} }
if ((action.equals("upload")) && if (action.equals("upload") && (uploadAuthorization || adminAuthorization)) {
((uploadAuthorization) || (adminAuthorization))) {
String filename = new File(post.get("file", "dummy")).getName(); String filename = new File(post.get("file", "dummy")).getName();
String description = post.get("description", ""); String description = post.get("description", "");
p = filename.lastIndexOf("\\"); pos = filename.lastIndexOf("\\");
if (p >= 0) filename = filename.substring(p + 1); if (pos >= 0) { filename = filename.substring(pos + 1); }
File newfile = new File(dir, filename); final File newfile = new File(dir, filename);
File newfilemd5 = new File(dir, filename + ".md5"); final File newfilemd5 = new File(dir, filename + ".md5");
byte[] binary = (byte[]) post.get((Object) "file$file", (Object) new byte[0]); final byte[] binary = (byte[]) post.get((Object) "file$file", (Object) new byte[0]);
try { try {
serverFileUtils.write(binary, newfile); serverFileUtils.write(binary, newfile);
String md5s = serverCodings.encodeMD5Hex(newfile); String md5s = serverCodings.encodeMD5Hex(newfile);
@ -175,19 +172,16 @@ public class dir {
// index file info // index file info
if (post.get("indexing", "").equals("on")) { if (post.get("indexing", "").equals("on")) {
String urlstring = yacyhURL(yacyCore.seedDB.mySeed, filename, md5s); final String urlstring = yacyhURL(yacyCore.seedDB.mySeed, filename, md5s);
String phrase = filename.replace('.', ' ').replace('_', ' ').replace('-', ' '); final String phrase = filename.replace('.', ' ').replace('_', ' ').replace('-', ' ');
indexPhrase(switchboard, urlstring, phrase, description); indexPhrase(switchboard, urlstring, phrase, description);
} }
} catch (IOException e) {} } catch (IOException e) {}
} }
if ((action.equals("newdir")) && if (action.equals("newdir") && (uploadAuthorization || adminAuthorization)) {
((uploadAuthorization) || (adminAuthorization))) { final String newdirname = post.get("directory", "EmptyDir");
String newdirname = post.get("directory", "EmptyDir"); if (newdirname != null && newdirname.length() > 0) {
if ((newdirname != null) && (newdirname.length() > 0)) { final File newdir = new File(dir, newdirname);
File newdir = new File(dir, newdirname);
newdir.mkdir(); newdir.mkdir();
try { try {
serverFileUtils.copy(new File(dir,"dir.html"), new File(newdir, "dir.html")); serverFileUtils.copy(new File(dir,"dir.html"), new File(newdir, "dir.html"));
@ -195,25 +189,25 @@ public class dir {
} catch (IOException e) {} } catch (IOException e) {}
} }
} }
if ((action.equals("delete")) && (adminAuthorization)) { if (action.equals("delete") && adminAuthorization) {
String filename = post.get("file", "foo"); String filename = post.get("file", "foo");
File file = new File(dir, filename); final File file = new File(dir, filename);
if (file.exists()) { if (file.exists()) {
File filemd5 = new File(dir, post.get("file", "foo") + ".md5"); final File filemd5 = new File(dir, post.get("file", "foo") + ".md5");
// read md5 and phrase // read md5 and phrase
String md5s = ""; String md5s = "";
String description = ""; String description = "";
if (filemd5.exists()) try { if (filemd5.exists()) try {
md5s = new String(serverFileUtils.read(filemd5)); md5s = new String(serverFileUtils.read(filemd5));
p = md5s.indexOf('\n'); pos = md5s.indexOf('\n');
if (p >= 0) { if (pos >= 0) {
description = md5s.substring(p + 1); description = md5s.substring(pos + 1);
md5s = md5s.substring(0, p); md5s = md5s.substring(0, pos);
} }
} catch (IOException e) {} } catch (IOException e) {}
// delete file(s) // delete file(s)
if (file.isDirectory()) { if (file.isDirectory()) {
String[] content = file.list(); final String[] content = file.list();
for (int i = 0; i < content.length; i++) (new File(file, content[i])).delete(); for (int i = 0; i < content.length; i++) (new File(file, content[i])).delete();
file.delete(); file.delete();
} else if (file.isFile()) { } else if (file.isFile()) {
@ -221,8 +215,8 @@ public class dir {
if (filemd5.exists()) filemd5.delete(); if (filemd5.exists()) filemd5.delete();
} }
// delete index // delete index
String urlstring = yacyhURL(yacyCore.seedDB.mySeed, filename, md5s); final String urlstring = yacyhURL(yacyCore.seedDB.mySeed, filename, md5s);
String phrase = filename.replace('.', ' ').replace('_', ' ').replace('-', ' '); final String phrase = filename.replace('.', ' ').replace('_', ' ').replace('-', ' ');
deletePhrase(switchboard, urlstring, phrase, description); deletePhrase(switchboard, urlstring, phrase, description);
} }
} }
@ -230,11 +224,11 @@ public class dir {
// if authorized, generate directory tree listing // if authorized, generate directory tree listing
if ((adminAuthorization) || (uploadAuthorization) || (downloadAuthorization)) { if ((adminAuthorization) || (uploadAuthorization) || (downloadAuthorization)) {
// generate dir listing // generate dir listing
String[] list = dir.list(); final String[] list = dir.list();
File f, fmd5; File f, fmd5;
String md5s, description; String md5s, description;
Date d; Date d;
//tree += "<span class=\"tt\">path&nbsp;=&nbsp;" + path + "</span><br><br>"; // tree += "<span class=\"tt\">path&nbsp;=&nbsp;" + path + "</span><br><br>";
if (list == null) if (list == null)
tree += "This directory is empty.<br>"; tree += "This directory is empty.<br>";
else { else {
@ -242,18 +236,20 @@ public class dir {
tree += "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">" + tree += "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">" +
"<tr height=\"8\" class=\"TableHeader\"><td colspan=\"7\" class=tt>" + path + "</td></tr>"; "<tr height=\"8\" class=\"TableHeader\"><td colspan=\"7\" class=tt>" + path + "</td></tr>";
boolean dark = false; boolean dark = false;
for (int i = 0; i < list.length; i++) if (!((list[i].startsWith("dir.")) || (list[i].endsWith(".md5")))) { for (int i = 0; i < list.length; i++) {
tree += "<tr height=\"8\" class=\"TableCell" + ((dark) ? "Dark" : "Light") + "\" valign=\"top\">"; dark = !dark; if (!((list[i].startsWith("dir.")) || (list[i].endsWith(".md5")))) {
tree += "<tr height=\"8\" class=\"TableCell" + ((dark) ? "Dark" : "Light") + "\" valign=\"top\">";
dark = !dark;
filecount++; filecount++;
f = new File(dir, list[i]); f = new File(dir, list[i]);
fmd5 = new File(dir, list[i] + ".md5"); fmd5 = new File(dir, list[i] + ".md5");
try { try {
if (fmd5.exists()) { if (fmd5.exists()) {
md5s = new String(serverFileUtils.read(fmd5)); md5s = new String(serverFileUtils.read(fmd5));
p = md5s.indexOf('\n'); pos = md5s.indexOf('\n');
if (p >= 0) { if (pos >= 0) {
description = md5s.substring(p + 1); description = md5s.substring(pos + 1);
md5s = md5s.substring(0, p); md5s = md5s.substring(0, pos);
} else { } else {
description = ""; description = "";
} }
@ -282,15 +278,17 @@ public class dir {
tree += "<td class=\"tt\" align=\"left\" width=\"220\"><a href=\"" + yacyhURL(yacyCore.seedDB.mySeed, f.getName(), md5s) + "\" class=\"tt\">" + md5s + "</a></td>"; tree += "<td class=\"tt\" align=\"left\" width=\"220\"><a href=\"" + yacyhURL(yacyCore.seedDB.mySeed, f.getName(), md5s) + "\" class=\"tt\">" + md5s + "</a></td>";
tree += "<td class=\"small\" align=\"left\">" + (((description.length() == 0) && ((list[i].endsWith(".jpg")) || (list[i].endsWith(".gif")) || (list[i].endsWith(".png")))) ? ("<img src=\"" + list[i] + "\" border=\"0\" height=\"32\" width=\"32\"") : description) + "</td>"; tree += "<td class=\"small\" align=\"left\">" + (((description.length() == 0) && ((list[i].endsWith(".jpg")) || (list[i].endsWith(".gif")) || (list[i].endsWith(".png")))) ? ("<img src=\"" + list[i] + "\" border=\"0\" height=\"32\" width=\"32\"") : description) + "</td>";
} }
if (adminAuthorization) tree += if (adminAuthorization) {
"<td class=\"small\" align=\"center\" width=\"50\">" + tree += "<td class=\"small\" align=\"center\" width=\"50\">" +
"<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" + "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
"<input type=\"hidden\" name=\"action\" value=\"delete\">" + "<input type=\"hidden\" name=\"action\" value=\"delete\">" +
"<input type=\"hidden\" name=\"file\" value=\"" + list[i] + "\">" + "<input type=\"hidden\" name=\"file\" value=\"" + list[i] + "\">" +
"<input type=\"submit\" value=\"delete\" class=\"small\"></form></td>"; "<input type=\"submit\" value=\"delete\" class=\"small\"></form></td>";
//if (adminAuthorization) tree += "</form> "; else tree += "<br>"; }
// if (adminAuthorization) tree += "</form> "; else tree += "<br>";
tree += "</tr>" + serverCore.crlfString; tree += "</tr>" + serverCore.crlfString;
} }
}
tree += "</table>"; tree += "</table>";
if (filecount == 0) { if (filecount == 0) {
tree += "<b>EMPTY</b><br>"; tree += "<b>EMPTY</b><br>";
@ -349,13 +347,14 @@ public class dir {
"<input type=\"hidden\" name=\"action\" value=\"authenticateAdmin\">" + "<input type=\"hidden\" name=\"action\" value=\"authenticateAdmin\">" +
"<input type=\"submit\" value=\"Log-In as Administrator\" class=\"small\">" + "<input type=\"submit\" value=\"Log-In as Administrator\" class=\"small\">" +
"</form>"; "</form>";
if (uploadAccountBase64MD5.length() == 0) if (uploadAccountBase64MD5.length() == 0) {
logout = ""; logout = "";
else } else {
logout = "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" + logout = "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
"<input type=\"hidden\" name=\"action\" value=\"logout\">" + "<input type=\"hidden\" name=\"action\" value=\"logout\">" +
"<input type=\"submit\" value=\"Log-Out 'upload'\" class=\"small\">&nbsp;(enter&nbsp;empty&nbsp;account)" + "<input type=\"submit\" value=\"Log-Out 'upload'\" class=\"small\">&nbsp;(enter&nbsp;empty&nbsp;account)" +
"</form>"; "</form>";
}
service = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">" + service = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">" +
"<tr class=\"TableCellDark\">" + "<tr class=\"TableCellDark\">" +
"<td class=\"small\">New Directory:</td>" + "<td class=\"small\">New Directory:</td>" +
@ -385,9 +384,9 @@ public class dir {
"<input type=\"hidden\" name=\"action\" value=\"authenticateUpload\" class=\"small\">" + "<input type=\"hidden\" name=\"action\" value=\"authenticateUpload\" class=\"small\">" +
"<input type=\"submit\" value=\"Log-In as user 'upload'\" class=\"small\">" + "<input type=\"submit\" value=\"Log-In as user 'upload'\" class=\"small\">" +
"</form>"; "</form>";
if (downloadAccountBase64MD5.length() == 0) if (downloadAccountBase64MD5.length() == 0) {
logout = ""; logout = "";
else } else {
logout = "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" + logout = "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
"<input type=\"hidden\" name=\"action\" value=\"logout\">" + "<input type=\"hidden\" name=\"action\" value=\"logout\">" +
"<input type=\"submit\" value=\"Log-Out 'download'\" class=\"small\">&nbsp;(enter&nbsp;empty&nbsp;account)" + "<input type=\"submit\" value=\"Log-Out 'download'\" class=\"small\">&nbsp;(enter&nbsp;empty&nbsp;account)" +
@ -397,6 +396,7 @@ public class dir {
info = "Download is granted even if no download account has been defined. " + info = "Download is granted even if no download account has been defined. " +
"If you are an administrator and you wish to block non-authorized downloades, please log in as user 'admin' " + "If you are an administrator and you wish to block non-authorized downloades, please log in as user 'admin' " +
"and set a download password."; "and set a download password.";
}
} else { } else {
ident = "not authorized"; ident = "not authorized";
tree = "To inspect this directory you need either an admin, upload or download account. Please log in."; tree = "To inspect this directory you need either an admin, upload or download account. Please log in.";
@ -423,14 +423,13 @@ public class dir {
prop.put("service", service); prop.put("service", service);
prop.put("info", info); prop.put("info", info);
prop.put("logout", logout); prop.put("logout", logout);
// return rewrite properties // return rewrite properties
return prop; return prop;
} }
private static String formatLong(long l, int length) { private static String formatLong(long l, int length) {
String r = "" + l; String r = "" + l;
int rl = r.length(); for (int i = r.length(); i < length; i++) { r = "&nbsp;" + r; }
for (int i = rl; i < length; i++) r = "&nbsp;" + r;
return r; return r;
} }
@ -449,9 +448,9 @@ public class dir {
public static void indexPhrase(plasmaSwitchboard switchboard, String urlstring, String phrase, String descr) { public static void indexPhrase(plasmaSwitchboard switchboard, String urlstring, String phrase, String descr) {
try { try {
URL url = new URL(urlstring); final URL url = new URL(urlstring);
plasmaCondenser condenser = new plasmaCondenser(new ByteArrayInputStream(("yacyshare. " + phrase + ". " + descr).getBytes())); final plasmaCondenser condenser = new plasmaCondenser(new ByteArrayInputStream(("yacyshare. " + phrase + ". " + descr).getBytes()));
plasmaCrawlLURL.Entry newEntry = switchboard.urlPool.loadedURL.addEntry( final plasmaCrawlLURL.Entry newEntry = switchboard.urlPool.loadedURL.addEntry(
url, "YaCyShare: " + descr, new Date(), new Date(), url, "YaCyShare: " + descr, new Date(), new Date(),
"____________", /*initiator*/ "____________", /*initiator*/
yacyCore.seedDB.mySeed.hash, /*executor*/ yacyCore.seedDB.mySeed.hash, /*executor*/
@ -466,19 +465,20 @@ public class dir {
5 /*process case*/ 5 /*process case*/
); );
String urlHash = newEntry.hash(); final String urlHash = newEntry.hash();
int words = switchboard.searchManager.addPageIndex(url, urlHash, new Date(), condenser, "**", plasmaWordIndexEntry.DT_SHARE); final int words = switchboard.searchManager.addPageIndex(url, urlHash, new Date(), condenser, "**", plasmaWordIndexEntry.DT_SHARE);
} catch (IOException e) {} } catch (IOException e) {}
} }
public static void deletePhrase(plasmaSwitchboard switchboard, String urlstring, String phrase, String descr) { public static void deletePhrase(plasmaSwitchboard switchboard, String urlstring, String phrase, String descr) {
try { try {
String urlhash = plasmaURL.urlHash(new URL(urlstring)); final String urlhash = plasmaURL.urlHash(new URL(urlstring));
Set words = plasmaCondenser.getWords(("yacyshare " + phrase + " " + descr).getBytes()); final Set words = plasmaCondenser.getWords(("yacyshare " + phrase + " " + descr).getBytes());
switchboard.removeReferences(urlhash, words); switchboard.removeReferences(urlhash, words);
switchboard.urlPool.loadedURL.remove(urlhash); switchboard.urlPool.loadedURL.remove(urlhash);
} catch (Exception e) { } catch (Exception e) {
serverLog.logSevere("DIR", "INTERNAL ERROR in dir.deletePhrase", e); serverLog.logSevere("DIR", "INTERNAL ERROR in dir.deletePhrase", e);
} }
} }
} }

@ -4,7 +4,10 @@
// (C) by Michael Peter Christen; mc@anomic.de // (C) by Michael Peter Christen; mc@anomic.de
// first published on http://www.anomic.de // first published on http://www.anomic.de
// Frankfurt, Germany, 2004 // Frankfurt, Germany, 2004
// last change: 05.08.2004 //
// $LastChangedDate$
// $LastChangedRevision$
// $LastChangedBy$
// //
// This program is free software; you can redistribute it and/or modify // This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by // it under the terms of the GNU General Public License as published by
@ -38,14 +41,13 @@
// done inside the copyright notive above. A re-distribution must contain // done inside the copyright notive above. A re-distribution must contain
// the intact and unchanged copyright notice. // the intact and unchanged copyright notice.
// Contributions and changes to the program code must be marked as such. // Contributions and changes to the program code must be marked as such.
//
// You must compile this file with // You must compile this file with
// javac -classpath .:../Classes index.java // javac -classpath .:../classes index.java
// if the shell's current path is HTROOT // if the shell's current path is HTROOT
import java.net.InetAddress; import java.net.InetAddress;
import java.net.UnknownHostException; import java.net.UnknownHostException;
import de.anomic.http.httpHeader; import de.anomic.http.httpHeader;
import de.anomic.server.serverCore; import de.anomic.server.serverCore;
import de.anomic.server.serverObjects; import de.anomic.server.serverObjects;
@ -56,11 +58,7 @@ public class welcome {
public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) { public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
// return variable that accumulates replacements // return variable that accumulates replacements
serverObjects prop = new serverObjects(); final serverObjects prop = new serverObjects();
// set values
String s;
int pos;
// update seed info // update seed info
yacyCore.peerActions.updateMySeed(); yacyCore.peerActions.updateMySeed();
@ -77,10 +75,10 @@ public class welcome {
prop.put("port", env.getConfig("port", "8080")); prop.put("port", env.getConfig("port", "8080"));
prop.put("clientip", header.get("CLIENTIP", "")); prop.put("clientip", header.get("CLIENTIP", ""));
String peertype = (yacyCore.seedDB.mySeed == null) ? serverSwitch.PEERTYPE_JUNIOR : yacyCore.seedDB.mySeed.get(serverSwitch.PEERTYPE, serverSwitch.PEERTYPE_VIRGIN); final String peertype = (yacyCore.seedDB.mySeed == null) ? serverSwitch.PEERTYPE_JUNIOR : yacyCore.seedDB.mySeed.get(serverSwitch.PEERTYPE, serverSwitch.PEERTYPE_VIRGIN);
boolean senior = (peertype.equals(serverSwitch.PEERTYPE_SENIOR)) || (peertype.equals(serverSwitch.PEERTYPE_PRINCIPAL)); final boolean senior = (peertype.equals(serverSwitch.PEERTYPE_SENIOR)) || (peertype.equals(serverSwitch.PEERTYPE_PRINCIPAL));
if (senior) prop.put("couldcan", "can"); else prop.put("couldcan", "could"); if (senior) { prop.put("couldcan", "can"); } else { prop.put("couldcan", "could"); }
if (senior) prop.put("seniorinfo", "This peer runs in senior mode which means that your peer can be accessed using the addresses shown above."); else prop.put("seniorinfo", "<b>Nobody can access your peer from the outside of your intranet. You must open your firewall and/or set a 'virtual server' in the settings of your router to enable access to the addresses as shown below.</b>"); if (senior) { prop.put("seniorinfo", "This peer runs in senior mode which means that your peer can be accessed using the addresses shown above."); } else { prop.put("seniorinfo", "<b>Nobody can access your peer from the outside of your intranet. You must open your firewall and/or set a 'virtual server' in the settings of your router to enable access to the addresses as shown below.</b>"); }
prop.put("wwwpath", "<application_root_path>/" + env.getConfig("htDocsPath", "DATA/HTDOCS")); prop.put("wwwpath", "<application_root_path>/" + env.getConfig("htDocsPath", "DATA/HTDOCS"));
// return rewrite properties // return rewrite properties

Loading…
Cancel
Save