no textdb proliferation necessary

This commit is contained in:
psyc://psyced.org/~lynX 2010-03-01 17:46:42 +01:00
parent c2aa52adfa
commit b9ac38a361
4 changed files with 32 additions and 19 deletions

View File

@ -384,12 +384,6 @@ object compile_object(string file) {
return rob;
}
# endif
if (sscanf(file, "%s/text.c", path) && path != "") {
rob = clone_object(NET_PATH "text");
rob -> sPath(path);
D2(if (rob) PP(("DB CLONED: %O becomes %s/text\n", rob, path));)
return rob;
}
if (sscanf(file, "place/%s.c", name) && name != "") {
#ifdef SANDBOX
string t;
@ -450,6 +444,12 @@ object compile_object(string file) {
rob, name, path));)
return rob;
}
if (sscanf(file, "%s/text.c", path) && path != "") {
rob = clone_object(NET_PATH "text");
rob -> sPath(path);
D2(if (rob) PP(("DB CLONED: %O becomes %s/text\n", rob, path));)
return rob;
}
# ifdef JABBER_PATH
if (abbrev("S:xmpp:", file)) {
rob = clone_object(JABBER_PATH "gateway");

View File

@ -4,15 +4,16 @@
// html-escaping of generic strings -lynx
// to make sure they won't trigger
// html commands
// html commands. this should become an inline macro, maybe use
// regreplace if that is faster, or even better, be implemented in C
// together with an auto hyperlink and a linebreak conversion option.
//
varargs string htquote(string s, int newlines) {
varargs string htquote(string s) {
ASSERT("htquote", stringp(s), s)
s = replace(s, "&", "&");
// s = replace(s, "\"", """); //"
s = replace(s, "<", "&lt;");
s = replace(s, ">", "&gt;");
if (newlines) s = replace(s, "\n", "<br>\n");
return s;
}

View File

@ -216,13 +216,17 @@ int qSaveImmediately() {
#endif
}
#ifdef _limit_amount_history_persistent
int qHistoryPersistentLimit() {
return _limit_amount_history_persistent;
}
#endif
#ifdef _limit_amount_history_export
int qHistoryExportLimit() {
return _limit_amount_history_export;
}
#endif
// to be overloaded by place.gen
qNewsfeed() { return 0; }
@ -281,7 +285,7 @@ msgView(source, mc, data, vars, showingLog) {
s = psyctext( T(mc, ""), vars, data, source );
if (strlen(s) < 7) return;
s = s[..<2];
// htquote ist nicht so gründlich wie für javascript notwendig
// htquote doesn't do the job as necessary for javascript
s = regreplace(s, "\&", "\\\&amp;", 1);
s = regreplace(s, "<", "\\\&lt;", 1);
s = regreplace(s, ">", "\\\&gt;", 1);
@ -468,7 +472,8 @@ showTopic(rcpt, verbose, mc) {
htget(prot, query, headers, qs, data, noprocess) {
//P3((">> archetype.gen:htget(%O, %O, %O, %O, %O, %O)\n", prot, query, headers, qs, data, noprocess))
# ifdef PLACE_SCRATCHPAD
sTextPath(query["layout"] || MYNICK, query["lang"], "html");
// we *could* allow each place to define its own textdb.. but why?
sTextPath(query["layout"] /* || MYNICK */, query["lang"], "html");
if (!noprocess && (!qs || query["scratchpad"])) {
string rand, buf, len;
// microscopic wiki functionality .. cheap imitation of tobi's save.pike
@ -607,8 +612,9 @@ htget(prot, query, headers, qs, data, noprocess) {
break;
#endif
default:
sTextPath(query["layout"] || MYNICK, query["lang"], "html");
sTextPath(query["layout"], query["lang"], "html");
htok(prot);
// we could output a css something here..
// w("_HTML_head");
write("\n\n<table>");
logView(a, "html", 15);

View File

@ -274,8 +274,12 @@ varargs string htmlComments(array(mixed) entries, int level) {
string ht = "", style;
foreach(entry : entries) {
vars = entry[LOG_VARS];
ht = htquote(vars["_text"]);
ht = replace(ht, "\n", "<br/>\n");
style = level ? "style='padding-left: " + level + "em'" : "";
ht += "<div class='comment' title='" + isotime(ctime(vars["_time_place"]), 1) + "' " + style + "><span class='comment-author'>" + vars["_nick"] + "</span>: <span class='comment-text'>" + htquote(vars["_text"], 1) + "</span></div>\n";
ht += "<div class='comment' title='" + isotime(ctime(vars["_time_place"]), 1) + "' " + style + "><span class='comment-author'>" + vars["_nick"] + "</span>: <span class='comment-text'>"+ ht +"</span></div>\n";
if (sizeof(entry) >= LOG_CHILDREN + 1) ht += htmlComments(entry[LOG_CHILDREN], level + 1);
}
return ht;
@ -295,8 +299,7 @@ varargs string htmlEntries(array(mixed) entries, int nojs, string chan, string s
foreach (entry : entries) {
P3((">>> entry: %O\n", entry))
vars = entry[LOG_VARS];
text = htquote(vars["_text"], 1);
text = replace(htquote(vars["_text"]), "\n", "<br/>\n");
string comments = "";
if (sizeof(entry) >= LOG_CHILDREN + 1) comments = htmlComments(entry[LOG_CHILDREN]);
@ -349,13 +352,17 @@ string rssEntries(array(mixed) entries) {
"</channel>\n";
mapping entry, vars;
string ht;
foreach (entry : entries) {
vars = entry[LOG_VARS];
ht = htquote(vars["_text"]);
// does RSS define <br/> for linebreaks?
//ht = replace(ht, "\n", "<br/>\n");
rss +=
"\n<item>\n"
"\t<title>"+ (vars["_title"] || "no title") +"</title>\n"
"\t<link>http://" + HTTP_OR_HTTPS_URL + "/" + pathName() + "?id=" + vars["_id"] + "</link>\n"
"\t<description>" + vars["_text"] + "</description>\n"
"\t<description>"+ ht +"</description>\n"
"\t<dc:date>" + isotime(ctime(vars["_time_place"]), 1) + "</dc:date>\n"
"\t<dc:creator>" + vars["_nick"] + "</dc:creator>\n"
"</item>\n";
@ -379,6 +386,7 @@ string jsEntries(array(mixed) entries) {
mapping entry, vars;
foreach (entry : entries) {
vars = entry[LOG_VARS];
// should probably be htquoted too
js += "new Entry(" + vars["_id"] + ","
"\"" + vars["_title"] + "\","
"\"" + vars["_nick"] + "\","
@ -447,8 +455,7 @@ htget(prot, query, headers, qs, data) {
int limit = to_int(query["limit"]) || DEFAULT_BACKLOG;
int offset = to_int(query["offset"]);
string webact = PLACE_PATH + MYLOWERNICK;
// shouldnt it be "html" here?
sTextPath(query["layout"] || MYNICK, query["lang"], "ht");
sTextPath(query["layout"], query["lang"], "html");
// Kommentare anzeigen
if (query["id"]) {
@ -545,7 +552,6 @@ htget(prot, query, headers, qs, data) {
} else if (export == "rss" || export == "rdf") {
// export als RSS
// scheinbar gibt es ein limit von 15 items / channel
// htquote auch hier anwenden
// check If-Modified-Since header
htok3(prot, "text/xml", "");
rssExport(limit, offset);