summaryrefslogtreecommitdiff
path: root/htroot/htdocsdefault
diff options
context:
space:
mode:
Diffstat (limited to 'htroot/htdocsdefault')
-rw-r--r--htroot/htdocsdefault/dir.html102
-rw-r--r--htroot/htdocsdefault/dir.java467
-rw-r--r--htroot/htdocsdefault/welcome.html69
-rw-r--r--htroot/htdocsdefault/welcome.java83
4 files changed, 721 insertions, 0 deletions
diff --git a/htroot/htdocsdefault/dir.html b/htroot/htdocsdefault/dir.html
new file mode 100644
index 000000000..0172b88dd
--- /dev/null
+++ b/htroot/htdocsdefault/dir.html
@@ -0,0 +1,102 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+<title>YACY: Public Files</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="Content-Language" content="English, Englisch">
+<meta name="keywords" content="yacy file share">
+<meta name="description" content="YACY public share zone">
+<meta name="copyright" content="Michael Christen">
+<link rel="stylesheet" media="all" href="/env/style.css">
+<!-- (C), Architecture and Realisation: Michael Peter Christen; Contact: mc <at> anomic.de -->
+
+</head>
+<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
+<table border="0" cellspacing="0" cellpadding="0" width="100%">
+<tr><td>
+ <table class="Heading" border="0" cellspacing="0" cellpadding="0" width="100%">
+ <tr height="36">
+ <td width="240">
+ <a href="http://www.yacy.net">
+ <img width="52" height="33" border="0" src="/env/grafics/yacy.gif" align="top">
+ </a>
+ </td>
+ <td width="50%" align="center">
+ <table border="0" cellspacing="0" cellpadding="0" width="100%">
+ <tr><td height="4"></td></tr>
+ <tr><td valign="top">
+ <center>
+ <font size="4" face="Helvetica, Arial" color="#ffffff">
+ <b>Public&nbsp;File&nbsp;Directory</b>
+ </font>
+ </center>
+ </td></tr>
+ </table>
+ </td>
+ <td width="240" align="right">
+ <table border="0" cellspacing="0" cellpadding="0">
+ <tr><td height="4"></td><td></td></tr>
+ <tr><td valign="top">
+ <form action="http://#[peerdomain]#.yacy" method="get">
+ <input type="submit" value="#[peername]#'s Console" class="small">
+ </form>
+ </td><td>&nbsp;&nbsp;</td></tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+</td></tr>
+<tr><td height="2"></td></tr>
+</table>
+
+<!-- BODY -->
+
+<table border="0" cellspacing="0" cellpadding="0" width="100%"><tr><td width="10">&nbsp;</td><td>
+
+<!-- steering elements -->
+
+<table border="0" cellspacing="0" cellpadding="0" width="100%">
+<tr height="8"><td></td><td></td></tr>
+<tr height="10" valign="top">
+<td>Welcome! You are identified and authorized as "<b>#[ident]#</b>".</td>
+<td align="right">#[logout]#</td></tr>
+</table>
+
+<table border="0" cellpadding="0" cellspacing="6" width="100%">
+<tr valign="top"><td width="50%">
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr valign="top" class="TableHeader" height="6"><td class="small">Service</td></tr>
+<tr valign="top" class="TableCellLight"><td class="small">#[service]#</td></tr>
+</table>
+</td><td rowspan="2" width="50%">
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr valign="top" class="TableHeader" height="6"><td width="130" class="small">Account</td></tr>
+<tr valign="top" class="TableCellLight"><td width="130" class="small">#[account]#</td></tr>
+</table>
+</td></tr>
+<tr valign="top">
+<td>
+<table border="0" cellpadding="0" cellspacing="0" width="100%">
+<tr valign="top" class="TableHeader" height="6"><td class="small">Info</td></tr>
+<tr valign="top" class="TableCellLight"><td class="small">#[info]#</td></tr>
+</table>
+</td>
+<td></td>
+</tr>
+</table>
+
+<br>
+
+<!-- directory listing -->
+<hr>
+<p>#[dir]#</p>
+<hr>
+<p class="small">
+Access of this page with the URL's:
+<a href="http://#[peeraddress]#/share/" class="tt">http://#[peeraddress]#/share/</a>, or
+<a href="http://share.#[peerdomain]#.yacy" class="tt">http://share.#[peerdomain]#.yacy</a> from within the YACY network.
+</p>
+
+</td><td width="20">&nbsp;</td></tr></table>
+</body>
+</html>
diff --git a/htroot/htdocsdefault/dir.java b/htroot/htdocsdefault/dir.java
new file mode 100644
index 000000000..a1126738a
--- /dev/null
+++ b/htroot/htdocsdefault/dir.java
@@ -0,0 +1,467 @@
+// dir.java
+// -----------------------
+// part of the AnomicHTTPD caching proxy
+// (C) by Michael Peter Christen; mc@anomic.de
+// first published on http://www.anomic.de
+// Frankfurt, Germany, 2004, 2005
+// last major change: 15.02.2005
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Using this software in any meaning (reading, learning, copying, compiling,
+// running) means that you agree that the Author(s) is (are) not responsible
+// for cost, loss of data or any harm that may be caused directly or indirectly
+// by usage of this softare or this documentation. The usage of this software
+// is on your own risk. The installation and usage (starting/running) of this
+// software may allow other people or application to access your computer and
+// any attached devices and is highly dependent on the configuration of the
+// software which must be done by the user of the software; the author(s) is
+// (are) also not responsible for proper configuration and usage of the
+// software, even if provoked by documentation provided together with
+// the software.
+//
+// Any changes to this file according to the GPL as documented in the file
+// gpl.txt aside this file in the shipment you received can be done to the
+// lines that follows this copyright notice here, but changes must not be
+// done inside the copyright notive above. A re-distribution must contain
+// the intact and unchanged copyright notice.
+// Contributions and changes to the program code must be marked as such.
+
+// you must compile this file with
+// javac -classpath <application_root>/classes <application_root>/htroot/htdocsdefault/dir.java
+// which most probably means to compile this with
+// javac -classpath ../../classes dir.java
+
+import java.util.*;
+import java.text.*;
+import java.io.*;
+import java.net.*;
+import de.anomic.tools.*;
+import de.anomic.server.*;
+import de.anomic.yacy.*;
+import de.anomic.data.*;
+import de.anomic.plasma.*;
+import de.anomic.http.*;
+import de.anomic.htmlFilter.*;
+
+public class dir {
+
+ private static SimpleDateFormat SimpleFormatter = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
+ public static String dateString(Date date) {
+ return SimpleFormatter.format(date);
+ }
+
+ public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
+ plasmaSwitchboard switchboard = (plasmaSwitchboard) env;
+ serverObjects prop = new serverObjects();
+
+ //System.out.println("###Header="+ header);
+ //System.out.println("###post=" + post);
+ String action = ((post == null) ? "info" : post.get("action", "info"));
+ String tree = "";
+ // variables for this path
+ //File htroot = new File(switchboard.getRootPath(), switchboard.getConfig("htRootPath", "htroot"));
+ File htroot = new File(switchboard.getRootPath(), switchboard.getConfig("htDocsPath", "DATA/HTDOCS"));
+ String path = (String) header.get("PATH", "/");
+ int p = path.lastIndexOf("/");
+ if (p >= 0) path = path.substring(0, p + 1);
+ File dir = new File(htroot, path);
+
+ // general settings
+ prop.put("peername", env.getConfig("peerName", "<nameless>"));
+ prop.put("peerdomain", env.getConfig("peerName", "<nameless>").toLowerCase());
+ prop.put("peeraddress", yacyCore.seedDB.mySeed.getAddress());
+ prop.put("hostname", serverCore.publicIP().getHostName());
+ prop.put("hostip", serverCore.publicIP().getHostAddress());
+ prop.put("port", env.getConfig("port", "8080"));
+
+ // generate upload/download authorizations
+ String adminAccountBase64MD5 = switchboard.getConfig("adminAccountBase64MD5", "");
+ String uploadAccountBase64MD5 = switchboard.getConfig("uploadAccountBase64MD5", "");
+ String downloadAccountBase64MD5 = switchboard.getConfig("downloadAccountBase64MD5", "");
+ String logoutAccountBase64MD5 = serverCodings.standardCoder.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String(":"));
+ String authorizationMD5 = serverCodings.standardCoder.encodeMD5Hex(((String) header.get("Authorization", "xxxxxx")).trim().substring(6));
+ //if (logoutAccountBase64.equals(authorization))
+ boolean adminAuthorization =
+ ((adminAccountBase64MD5.length() != 0) &&
+ (adminAccountBase64MD5.equals(authorizationMD5)));
+ boolean uploadAuthorization =
+ ((adminAuthorization) ||
+ ((uploadAccountBase64MD5.length() != 0) &&
+ (uploadAccountBase64MD5.equals(authorizationMD5))));
+ boolean downloadAuthorization =
+ ((adminAuthorization) || (uploadAuthorization) ||
+ (downloadAccountBase64MD5.length() == 0) ||
+ (downloadAccountBase64MD5.equals(authorizationMD5)));
+
+ // do authentitcate processes by triggering the http authenticate method
+ if ((action.equals("authenticateAdmin")) && (!(adminAuthorization))) {
+ prop.put("AUTHENTICATE", "admin log-in");
+ return prop;
+ }
+ if ((action.equals("authenticateUpload")) && (!(uploadAuthorization))) {
+ prop.put("AUTHENTICATE", "upload log-in");
+ return prop;
+ }
+ if ((action.equals("authenticateDownload")) && (!(downloadAuthorization))) {
+ prop.put("AUTHENTICATE", "download log-in");
+ return prop;
+ }
+
+ // work off actions
+ if (action.equals("logout")) {
+ if (adminAuthorization) {
+ prop.put("AUTHENTICATE", "admin log-in");
+ return prop;
+ } else if (uploadAuthorization) {
+ prop.put("AUTHENTICATE", "upload log-in");
+ return prop;
+ } else if (downloadAuthorization) {
+ prop.put("AUTHENTICATE", "download log-in");
+ return prop;
+ } else {
+ action = "";
+ }
+ }
+ if ((action.equals("downloadPassword")) && (adminAuthorization)) {
+ switchboard.setConfig("downloadAccountBase64MD5", (post.get("password", "").length() == 0) ? "" : serverCodings.standardCoder.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String("download:" + post.get("password", ""))));
+ }
+ if ((action.equals("uploadPassword")) && (adminAuthorization)) {
+ switchboard.setConfig("uploadAccountBase64MD5", (post.get("password", "").length() == 0) ? "" : serverCodings.standardCoder.encodeMD5Hex(serverCodings.standardCoder.encodeBase64String("upload:" + post.get("password", ""))));
+ }
+ if ((action.equals("upload")) &&
+ ((uploadAuthorization) || (adminAuthorization))) {
+ String filename = new File(post.get("file", "dummy")).getName();
+ String description = post.get("description", "");
+ p = filename.lastIndexOf("\\");
+ if (p >= 0) filename = filename.substring(p + 1);
+ File newfile = new File(dir, filename);
+ File newfilemd5 = new File(dir, filename + ".md5");
+ byte[] binary = (byte[]) post.get((Object) "file$file", (Object) new byte[0]);
+ try {
+ serverFileUtils.write(binary, newfile);
+ String md5s = serverCodings.encodeMD5Hex(newfile);
+ serverFileUtils.write((md5s + "\n" + description).getBytes(), newfilemd5); // generate md5
+
+ // index file info
+ if (post.get("indexing", "").equals("on")) {
+ String urlstring = yacyhURL(yacyCore.seedDB.mySeed, filename, md5s);
+ String phrase = filename.replace('.', ' ').replace('_', ' ').replace('-', ' ');
+ indexPhrase(switchboard, urlstring, phrase, description);
+ }
+ } catch (IOException e) {}
+
+
+ }
+ if ((action.equals("newdir")) &&
+ ((uploadAuthorization) || (adminAuthorization))) {
+ String newdirname = post.get("directory", "EmptyDir");
+ if ((newdirname != null) && (newdirname.length() > 0)) {
+ File newdir = new File(dir, newdirname);
+ newdir.mkdir();
+ try {
+ serverFileUtils.copy(new File(dir,"dir.html"), new File(newdir, "dir.html"));
+ serverFileUtils.copy(new File(dir,"dir.class"), new File(newdir, "dir.class"));
+ } catch (IOException e) {}
+ }
+ }
+ if ((action.equals("delete")) && (adminAuthorization)) {
+ String filename = post.get("file", "foo");
+ File file = new File(dir, filename);
+ if (file.exists()) {
+ File filemd5 = new File(dir, post.get("file", "foo") + ".md5");
+ // read md5 and phrase
+ String md5s = "";
+ String description = "";
+ if (filemd5.exists()) try {
+ md5s = new String(serverFileUtils.read(filemd5));
+ p = md5s.indexOf('\n');
+ if (p >= 0) {
+ description = md5s.substring(p + 1);
+ md5s = md5s.substring(0, p);
+ }
+ } catch (IOException e) {}
+ // delete file(s)
+ if (file.isDirectory()) {
+ String[] content = file.list();
+ for (int i = 0; i < content.length; i++) (new File(file, content[i])).delete();
+ file.delete();
+ } else if (file.isFile()) {
+ file.delete();
+ if (filemd5.exists()) filemd5.delete();
+ }
+ // delete index
+ String urlstring = yacyhURL(yacyCore.seedDB.mySeed, filename, md5s);
+ String phrase = filename.replace('.', ' ').replace('_', ' ').replace('-', ' ');
+ deletePhrase(switchboard, urlstring, phrase, description);
+ }
+ }
+
+ // if authorized, generate directory tree listing
+ if ((adminAuthorization) || (uploadAuthorization) || (downloadAuthorization)) {
+ // generate dir listing
+ String[] list = dir.list();
+ File f, fmd5;
+ String md5s, description;
+ Date d;
+ //tree += "<span class=\"tt\">path&nbsp;=&nbsp;" + path + "</span><br><br>";
+ if (list == null)
+ tree += "This directory is empty.<br>";
+ else {
+ int filecount = 0;
+ tree += "<table border=\"0\" cellpadding=\"2\" cellspacing=\"1\" width=\"100%\">" +
+ "<tr height=\"8\" class=\"TableHeader\"><td colspan=\"7\" class=tt>" + path + "</td></tr>";
+ boolean dark = false;
+ for (int i = 0; i < list.length; i++) if (!((list[i].startsWith("dir.")) || (list[i].endsWith(".md5")))) {
+ tree += "<tr height=\"8\" class=\"TableCell" + ((dark) ? "Dark" : "Light") + "\" valign=\"top\">"; dark = !dark;
+ filecount++;
+ f = new File(dir, list[i]);
+ fmd5 = new File(dir, list[i] + ".md5");
+ try {
+ if (fmd5.exists()) {
+ md5s = new String(serverFileUtils.read(fmd5));
+ p = md5s.indexOf('\n');
+ if (p >= 0) {
+ description = md5s.substring(p + 1);
+ md5s = md5s.substring(0, p);
+ } else {
+ description = "";
+ }
+ } else {
+ // generate md5 on-the-fly
+ md5s = serverCodings.encodeMD5Hex(f);
+ description = "";
+ serverFileUtils.write((md5s + "\n" + description).getBytes(), fmd5);
+ }
+ } catch (IOException e) {
+ md5s = "";
+ description = "";
+ }
+ d = new Date(f.lastModified());
+ if (f.isDirectory()) {
+ tree += "<td class=\"tt\" align=\"left\" width=\"20\"><img src=\"/env/grafics/folderIconSmall.gif\" align=\"top\" class=\"small\"></td>";
+ tree += "<td class=\"tt\" align=\"left\" width=\"60\">" + dateString(d) + "</td>";
+ tree += "<td class=\"tt\" align=\"left\" width=\"150\"><a href=\"" /*+ path*/ + list[i] + "/dir.html\" class=\"tt\">" + list[i] + "</a></td>";
+ tree += "<td class=\"tt\" align=\"right\" width=\"60\">" + formatLong(0, 10) + "</td>";
+ tree += "<td class=\"tt\" align=\"left\" colspan=\"2\"><i>Directory</i></td>";
+ } else {
+ tree += "<td class=\"tt\" align=\"left\" width=\"20\"><img src=\"/env/grafics/fileIconSmall.gif\" align=\"top\">";
+ tree += "<td class=\"tt\" align=\"left\" width=\"60\">" + dateString(d) + "&nbsp;";
+ tree += "<td class=\"tt\" align=\"left\" width=\"150\"><a href=\"" /*+ path*/ + list[i] + "\" class=\"tt\">" + list[i] + "</a></td>";
+ tree += "<td class=\"tt\" align=\"right\" width=\"60\">" + formatLong(f.length(), 10) + "</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>";
+ }
+ if (adminAuthorization) tree +=
+ "<td class=\"small\" align=\"center\" width=\"50\">" +
+ "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"delete\">" +
+ "<input type=\"hidden\" name=\"file\" value=\"" + list[i] + "\">" +
+ "<input type=\"submit\" value=\"delete\" class=\"small\"></form></td>";
+ //if (adminAuthorization) tree += "</form> "; else tree += "<br>";
+ tree += "</tr>" + serverCore.crlfString;
+ }
+ tree += "</table>";
+ if (filecount == 0) {
+ tree += "<b>EMPTY</b><br>";
+ }
+ }
+ }
+
+ String ident = "";
+ String account = "";
+ String service = "";
+ String info = "";
+ String logout = "";
+ if (adminAuthorization) {
+ ident = "Administrator";
+ account = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">" +
+ "<tr class=\"TableCellDark\"><td class=\"small\">upload:</td><td><form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"uploadPassword\">" +
+ "<input type=\"password\" name=\"password\" size=\"12\">&nbsp;" +
+ "<input type=\"submit\" value=\"Set Password\" class=\"small\">" +
+ "</form></td></tr>" +
+ "<tr class=\"TableCellLight\"><td class=\"small\">download:</td><td><form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"downloadPassword\">" +
+ "<input type=\"password\" name=\"password\" size=\"12\">&nbsp;" +
+ "<input type=\"submit\" value=\"Set Password\" class=\"small\">" +
+ "</form></td></tr>" +
+ "</table>";
+ logout = "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"logout\">" +
+ "<input type=\"submit\" value=\"Log-Out Administrator\" class=\"small\">&nbsp;(enter&nbsp;empty&nbsp;account)" +
+ "</form>";
+ service = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">" +
+ "<tr class=\"TableCellDark\">" +
+ "<td class=\"small\">New Directory:</td>" +
+ "<td><form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"newdir\">" +
+ "<input type=\"text\" name=\"directory\" size=\"10\" class=\"small\">&nbsp;" +
+ "<input type=\"submit\" value=\"Create\" class=\"small\">" +
+ "</form></td></tr>" +
+ "<tr class=\"TableCellLight\">" +
+ "<td class=\"small\">File Upload:</td>" +
+ "<td class=\"small\"><form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "Resource&nbsp;=&nbsp;<input type=\"hidden\" name=\"action\" value=\"upload\">" +
+ "<input type=\"file\" name=\"file\" size=\"10\" class=\"small\"><br>" +
+ "Description&nbsp;=&nbsp;<input type=\"text\" name=\"description\" size=\"30\" class=\"small\"><br>" +
+ "Indexing&nbsp;:&nbsp;<input type=\"checkbox\" name=\"indexing\" checked><br>" +
+ "<input type=\"submit\" value=\"Transfer\" class=\"small\">" +
+ "</form></td></tr>" +
+ "</table>";
+ info = "Admin and download accounts are necessary to grant their services to clients; " +
+ "no password is required for the download-account unless you set one. " +
+ "Files uploaded and indexed here have a special index entry 'yacyshare'; " +
+ "if you want to find files that are indexed in any share zone, add the word 'yacyshare' to the search words.";
+ } else if (uploadAuthorization) {
+ ident = "Uploader";
+ account = "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"authenticateAdmin\">" +
+ "<input type=\"submit\" value=\"Log-In as Administrator\" class=\"small\">" +
+ "</form>";
+ if (uploadAccountBase64MD5.length() == 0)
+ logout = "";
+ else
+ logout = "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"logout\">" +
+ "<input type=\"submit\" value=\"Log-Out 'upload'\" class=\"small\">&nbsp;(enter&nbsp;empty&nbsp;account)" +
+ "</form>";
+ service = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"2\" width=\"100%\">" +
+ "<tr class=\"TableCellDark\">" +
+ "<td class=\"small\">New Directory:</td>" +
+ "<td class=\"small\"><form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"newdir\">" +
+ "<input type=\"text\" name=\"directory\" size=\"10\" class=\"small\">&nbsp;" +
+ "<input type=\"submit\" value=\"Create\" class=\"small\">" +
+ "</form></td></tr>" +
+ "<tr class=\"TableCellLight\">" +
+ "<td class=\"small\">File Upload:</td>" +
+ "<td class=\"small\"><form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "Resource&nbsp;=&nbsp;<input type=\"hidden\" name=\"action\" value=\"upload\">" +
+ "<input type=\"file\" name=\"file\" size=\"10\" class=\"small\"><br>" +
+ "Description&nbsp;=&nbsp;<input type=\"text\" name=\"description\" size=\"30\" class=\"small\"><br>" +
+ "Indexing&nbsp;:&nbsp;<input type=\"checkbox\" name=\"indexing\"><br>" +
+ "<input type=\"submit\" value=\"Transfer\" class=\"small\">" +
+ "</form></td></tr>" +
+ "</table>";
+ info = "Uploaders are not granted to delete files or directories. If you want to do this, log-in as admin.";
+ } else if (downloadAuthorization) {
+ ident = "Downloader";
+ account = "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"authenticateAdmin\" class=\"small\">" +
+ "<input type=\"submit\" value=\"Log-In as Administrator\" class=\"small\">" +
+ "</form> " +
+ "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"authenticateUpload\" class=\"small\">" +
+ "<input type=\"submit\" value=\"Log-In as user 'upload'\" class=\"small\">" +
+ "</form>";
+ if (downloadAccountBase64MD5.length() == 0)
+ logout = "";
+ else
+ logout = "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"logout\">" +
+ "<input type=\"submit\" value=\"Log-Out 'download'\" class=\"small\">&nbsp;(enter&nbsp;empty&nbsp;account)" +
+ "</form>";
+ service = "You are granted to view directory listings and do downloads in this directory.<br>" +
+ "If you want to upload, please log in as user 'upload'";
+ 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' " +
+ "and set a download password.";
+ } else {
+ ident = "not authorized";
+ tree = "To inspect this directory you need either an admin, upload or download account. Please log in.";
+ account = "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"authenticateAdmin\">" +
+ "<input type=\"submit\" value=\"Log-In as Administrator\" class=\"small\">" +
+ "</form> " +
+ "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"authenticateUpload\">" +
+ "<input type=\"submit\" value=\"Log-In as user 'upload'\" class=\"small\">" +
+ "</form> " +
+ "<form action=\"dir.html\" method=\"post\" enctype=\"multipart/form-data\">" +
+ "<input type=\"hidden\" name=\"action\" value=\"authenticateDownload\">" +
+ "<input type=\"submit\" value=\"Log-In as user 'download'\" class=\"small\">" +
+ "</form>";
+ logout = "";
+ service = "No service available.";
+ info = "You must log-in to upload or download.";
+ }
+
+ prop.put("dir", tree);
+ prop.put("ident", ident);
+ prop.put("account", account);
+ prop.put("service", service);
+ prop.put("info", info);
+ prop.put("logout", logout);
+ // return rewrite properties
+ return prop;
+ }
+
+ private static String formatLong(long l, int length) {
+ String r = "" + l;
+ int rl = r.length();
+ for (int i = rl; i < length; i++) r = "&nbsp;" + r;
+ return r;
+ }
+
+ // rDNS services:
+ // http://www.xdr2.net/reverse_DNS_lookup.asp
+ // http://remote.12dt.com/rns/
+ // http://bl.reynolds.net.au/search/
+ // http://www.declude.com/Articles.asp?ID=97
+ // http://www.dnsstuff.com/
+
+ // listlist: http://www.aspnetimap.com/help/welcome/dnsbl.html
+
+ public static String yacyhURL(yacySeed seed, String filename, String md5) {
+ return "http://share." + seed.getHexHash() + ".yacyh/" + filename + "?md5=" + md5;
+ }
+
+ public static void indexPhrase(plasmaSwitchboard switchboard, String urlstring, String phrase, String descr) {
+ try {
+ URL url = new URL(urlstring);
+ plasmaCondenser condenser = new plasmaCondenser(new ByteArrayInputStream(("yacyshare. " + phrase + ". " + descr).getBytes()));
+ plasmaCrawlLURL.entry newEntry = switchboard.loadedURL.newEntry(
+ url, "YaCyShare: " + descr, new Date(), new Date(),
+ "____________", /*initiator*/
+ yacyCore.seedDB.mySeed.hash, /*executor*/
+ "AAAAAAAAAAAA", /*referrer*/
+ 0, /*copycount*/
+ false, /*localneed*/
+ Integer.parseInt(condenser.getAnalysis().getProperty("INFORMATION_VALUE","0"), 16),
+ "**", /*language*/
+ plasmaWordIndexEntry.DT_SHARE, /*doctype*/
+ phrase.length(), /*size*/
+ (int) Long.parseLong(condenser.getAnalysis().getProperty("NUMB_WORDS","0"), 16),
+ 5 /*process case*/
+ );
+
+ String urlHash = newEntry.hash();
+ int words = switchboard.searchManager.addPageIndex(url, urlHash, new Date(), condenser, "**", plasmaWordIndexEntry.DT_SHARE);
+ } catch (IOException e) {}
+ }
+
+ public static void deletePhrase(plasmaSwitchboard switchboard, String urlstring, String phrase, String descr) {
+ try {
+ String urlhash = plasmaURL.urlHash(new URL(urlstring));
+ Set words = plasmaSwitchboard.getWords(("yacyshare " + phrase + " " + descr).getBytes());
+ switchboard.removeReferences(urlhash, words);
+ switchboard.loadedURL.remove(urlhash);
+ } catch (Exception e) {
+ System.out.println("INTERNAL ERROR in dir.deletePhrase:");
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/htroot/htdocsdefault/welcome.html b/htroot/htdocsdefault/welcome.html
new file mode 100644
index 000000000..0b639178c
--- /dev/null
+++ b/htroot/htdocsdefault/welcome.html
@@ -0,0 +1,69 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
+<html>
+<head>
+<title>YACY: Default Page for Individual Peer Content</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<meta name="Content-Language" content="English, Englisch">
+<meta name="keywords" content="yacy individual html content">
+<meta name="description" content="YACY www default page">
+<meta name="copyright" content="Michael Christen">
+<link rel="stylesheet" media="all" href="/env/style.css">
+<!-- (C), Architecture and Realisation: Michael Peter Christen; Contact: mc <at> anomic.de -->
+
+</head>
+<body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0">
+<table border="0" cellspacing="0" cellpadding="0" width="100%">
+<tr><td>
+ <table class="Heading" border="0" cellspacing="0" cellpadding="0" width="100%">
+ <tr height="36">
+ <td width="240">
+ <a href="http://www.yacy.net">
+ <img width="52" height="33" border="0" src="/env/grafics/yacy.gif" align="top">
+ </a>
+ </td>
+ <td width="50%" align="center">
+ <div class="Headline">Individual&nbsp;Web&nbsp;Page</div>
+ </td>
+ <td width="240" align="right">
+ <form action="http://#[peerdomain]#.yacy" method="get">
+ <input type="submit" value="#[peername]#'s Console" class="small">
+ </form>
+ </td>
+ </tr>
+ </table>
+</td></tr>
+</table>
+<br><br>
+
+<table border="0" cellspacing="0" cellpadding="0" width="100%">
+<tr>
+<td width="80"></td>
+<td>
+<h2>Welcome to your own web page<br>in the <b>YACY Network</b>!</h2><br>
+
+<p>
+THIS IS A DEMONSTRATION PAGE FOUR YOUR OWN INDIVIDUAL WEB SERVER!
+PLEASE REPLACE THIS PAGE BY PUTTING A FILE index.html INTO THE PATH
+&lt;your-application-home&gt;<b>#[wwwpath]#</b>
+</p>
+
+<p>
+This is peer '<b>#[peername]#</b>', running on host <b>#[hostname]#</b>.<br>
+Your are accessing this page from the host '#[clientip]#'.<br>
+<!--, IP <b>#[hostip]#</b>, port <b>#[port]#</b>-->
+Every user of YaCy #[couldcan]# access this page
+using the URL <a href="http://#[peeraddress]#/www/"><b>http://#[peeraddress]#/www/</b></a>
+or <a href="http://www.#[peerdomain]#.yacy"><b>http://www.#[peerdomain]#.yacy</b></a> from within the YACY network.</p>
+
+<p>#[seniorinfo]#</p>
+
+<p>We integrated an easy mechanism for web page authoring
+which can also be used for simple file-sharing.
+Please open the sample page <a href="http://share.#[peerdomain]#.yacy"><b>http://share.#[peerdomain]#.yacy</b></a>
+and set upload/download accounts to author and access content on this peer.</p>
+
+</td>
+<td width="80"></td>
+</tr></table>
+</body>
+</html>
diff --git a/htroot/htdocsdefault/welcome.java b/htroot/htdocsdefault/welcome.java
new file mode 100644
index 000000000..d80562369
--- /dev/null
+++ b/htroot/htdocsdefault/welcome.java
@@ -0,0 +1,83 @@
+// welcome.java
+// -----------------------
+// part of the AnomicHTTPD caching proxy
+// (C) by Michael Peter Christen; mc@anomic.de
+// first published on http://www.anomic.de
+// Frankfurt, Germany, 2004
+// last change: 05.08.2004
+//
+// 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
+// the Free Software Foundation; either version 2 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+//
+// Using this software in any meaning (reading, learning, copying, compiling,
+// running) means that you agree that the Author(s) is (are) not responsible
+// for cost, loss of data or any harm that may be caused directly or indirectly
+// by usage of this softare or this documentation. The usage of this software
+// is on your own risk. The installation and usage (starting/running) of this
+// software may allow other people or application to access your computer and
+// any attached devices and is highly dependent on the configuration of the
+// software which must be done by the user of the software; the author(s) is
+// (are) also not responsible for proper configuration and usage of the
+// software, even if provoked by documentation provided together with
+// the software.
+//
+// Any changes to this file according to the GPL as documented in the file
+// gpl.txt aside this file in the shipment you received can be done to the
+// lines that follows this copyright notice here, but changes must not be
+// done inside the copyright notive above. A re-distribution must contain
+// the intact and unchanged copyright notice.
+// Contributions and changes to the program code must be marked as such.
+
+// you must compile this file with
+// javac -classpath .:../Classes index.java
+// if the shell's current path is HTROOT
+
+import java.util.*;
+import de.anomic.tools.*;
+import de.anomic.server.*;
+import de.anomic.yacy.*;
+import de.anomic.http.*;
+
+public class welcome {
+
+ public static serverObjects respond(httpHeader header, serverObjects post, serverSwitch env) {
+ // return variable that accumulates replacements
+ serverObjects prop = new serverObjects();
+
+ // set values
+ String s;
+ int pos;
+
+ // update seed info
+ yacyCore.peerActions.updateMySeed();
+
+ prop.put("peername", env.getConfig("peerName", "<nameless>"));
+ prop.put("peerdomain", env.getConfig("peerName", "<nameless>").toLowerCase());
+ prop.put("peeraddress", yacyCore.seedDB.mySeed.getAddress());
+ prop.put("hostname", serverCore.publicIP().getHostName());
+ prop.put("hostip", serverCore.publicIP().getHostAddress());
+ prop.put("port", env.getConfig("port", "8080"));
+ prop.put("clientip", header.get("CLIENTIP", ""));
+
+ String peertype = (yacyCore.seedDB.mySeed == null) ? "virgin" : yacyCore.seedDB.mySeed.get("PeerType", "virgin");
+ boolean senior = (peertype.equals("senior")) || (peertype.equals("principal"));
+ 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' at your router settings to enable access to the addresses as shown below.</b>");
+ prop.put("wwwpath", "<application_root_path>/" + env.getConfig("htDocsPath", "DATA/HTDOCS"));
+
+ // return rewrite properties
+ return prop;
+ }
+
+}