mirror of
https://github.com/ChronosX88/psyced.git
synced 2024-11-13 22:11:02 +00:00
no textdb proliferation necessary
This commit is contained in:
parent
c2aa52adfa
commit
b9ac38a361
@ -384,12 +384,6 @@ object compile_object(string file) {
|
|||||||
return rob;
|
return rob;
|
||||||
}
|
}
|
||||||
# endif
|
# 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 != "") {
|
if (sscanf(file, "place/%s.c", name) && name != "") {
|
||||||
#ifdef SANDBOX
|
#ifdef SANDBOX
|
||||||
string t;
|
string t;
|
||||||
@ -450,6 +444,12 @@ object compile_object(string file) {
|
|||||||
rob, name, path));)
|
rob, name, path));)
|
||||||
return rob;
|
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
|
# ifdef JABBER_PATH
|
||||||
if (abbrev("S:xmpp:", file)) {
|
if (abbrev("S:xmpp:", file)) {
|
||||||
rob = clone_object(JABBER_PATH "gateway");
|
rob = clone_object(JABBER_PATH "gateway");
|
||||||
|
@ -4,15 +4,16 @@
|
|||||||
|
|
||||||
// html-escaping of generic strings -lynx
|
// html-escaping of generic strings -lynx
|
||||||
// to make sure they won't trigger
|
// 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)
|
ASSERT("htquote", stringp(s), s)
|
||||||
s = replace(s, "&", "&");
|
s = replace(s, "&", "&");
|
||||||
// s = replace(s, "\"", """); //"
|
// s = replace(s, "\"", """); //"
|
||||||
s = replace(s, "<", "<");
|
s = replace(s, "<", "<");
|
||||||
s = replace(s, ">", ">");
|
s = replace(s, ">", ">");
|
||||||
if (newlines) s = replace(s, "\n", "<br>\n");
|
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,13 +216,17 @@ int qSaveImmediately() {
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _limit_amount_history_persistent
|
||||||
int qHistoryPersistentLimit() {
|
int qHistoryPersistentLimit() {
|
||||||
return _limit_amount_history_persistent;
|
return _limit_amount_history_persistent;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef _limit_amount_history_export
|
||||||
int qHistoryExportLimit() {
|
int qHistoryExportLimit() {
|
||||||
return _limit_amount_history_export;
|
return _limit_amount_history_export;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// to be overloaded by place.gen
|
// to be overloaded by place.gen
|
||||||
qNewsfeed() { return 0; }
|
qNewsfeed() { return 0; }
|
||||||
@ -281,7 +285,7 @@ msgView(source, mc, data, vars, showingLog) {
|
|||||||
s = psyctext( T(mc, ""), vars, data, source );
|
s = psyctext( T(mc, ""), vars, data, source );
|
||||||
if (strlen(s) < 7) return;
|
if (strlen(s) < 7) return;
|
||||||
s = s[..<2];
|
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, "\&", "\\\&", 1);
|
s = regreplace(s, "\&", "\\\&", 1);
|
||||||
s = regreplace(s, "<", "\\\<", 1);
|
s = regreplace(s, "<", "\\\<", 1);
|
||||||
s = regreplace(s, ">", "\\\>", 1);
|
s = regreplace(s, ">", "\\\>", 1);
|
||||||
@ -468,7 +472,8 @@ showTopic(rcpt, verbose, mc) {
|
|||||||
htget(prot, query, headers, qs, data, noprocess) {
|
htget(prot, query, headers, qs, data, noprocess) {
|
||||||
//P3((">> archetype.gen:htget(%O, %O, %O, %O, %O, %O)\n", 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
|
# 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"])) {
|
if (!noprocess && (!qs || query["scratchpad"])) {
|
||||||
string rand, buf, len;
|
string rand, buf, len;
|
||||||
// microscopic wiki functionality .. cheap imitation of tobi's save.pike
|
// microscopic wiki functionality .. cheap imitation of tobi's save.pike
|
||||||
@ -607,8 +612,9 @@ htget(prot, query, headers, qs, data, noprocess) {
|
|||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
default:
|
default:
|
||||||
sTextPath(query["layout"] || MYNICK, query["lang"], "html");
|
sTextPath(query["layout"], query["lang"], "html");
|
||||||
htok(prot);
|
htok(prot);
|
||||||
|
// we could output a css something here..
|
||||||
// w("_HTML_head");
|
// w("_HTML_head");
|
||||||
write("\n\n<table>");
|
write("\n\n<table>");
|
||||||
logView(a, "html", 15);
|
logView(a, "html", 15);
|
||||||
|
@ -274,8 +274,12 @@ varargs string htmlComments(array(mixed) entries, int level) {
|
|||||||
string ht = "", style;
|
string ht = "", style;
|
||||||
foreach(entry : entries) {
|
foreach(entry : entries) {
|
||||||
vars = entry[LOG_VARS];
|
vars = entry[LOG_VARS];
|
||||||
|
ht = htquote(vars["_text"]);
|
||||||
|
ht = replace(ht, "\n", "<br/>\n");
|
||||||
|
|
||||||
style = level ? "style='padding-left: " + level + "em'" : "";
|
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);
|
if (sizeof(entry) >= LOG_CHILDREN + 1) ht += htmlComments(entry[LOG_CHILDREN], level + 1);
|
||||||
}
|
}
|
||||||
return ht;
|
return ht;
|
||||||
@ -295,8 +299,7 @@ varargs string htmlEntries(array(mixed) entries, int nojs, string chan, string s
|
|||||||
foreach (entry : entries) {
|
foreach (entry : entries) {
|
||||||
P3((">>> entry: %O\n", entry))
|
P3((">>> entry: %O\n", entry))
|
||||||
vars = entry[LOG_VARS];
|
vars = entry[LOG_VARS];
|
||||||
|
text = replace(htquote(vars["_text"]), "\n", "<br/>\n");
|
||||||
text = htquote(vars["_text"], 1);
|
|
||||||
|
|
||||||
string comments = "";
|
string comments = "";
|
||||||
if (sizeof(entry) >= LOG_CHILDREN + 1) comments = htmlComments(entry[LOG_CHILDREN]);
|
if (sizeof(entry) >= LOG_CHILDREN + 1) comments = htmlComments(entry[LOG_CHILDREN]);
|
||||||
@ -349,13 +352,17 @@ string rssEntries(array(mixed) entries) {
|
|||||||
"</channel>\n";
|
"</channel>\n";
|
||||||
|
|
||||||
mapping entry, vars;
|
mapping entry, vars;
|
||||||
|
string ht;
|
||||||
foreach (entry : entries) {
|
foreach (entry : entries) {
|
||||||
vars = entry[LOG_VARS];
|
vars = entry[LOG_VARS];
|
||||||
|
ht = htquote(vars["_text"]);
|
||||||
|
// does RSS define <br/> for linebreaks?
|
||||||
|
//ht = replace(ht, "\n", "<br/>\n");
|
||||||
rss +=
|
rss +=
|
||||||
"\n<item>\n"
|
"\n<item>\n"
|
||||||
"\t<title>"+ (vars["_title"] || "no title") +"</title>\n"
|
"\t<title>"+ (vars["_title"] || "no title") +"</title>\n"
|
||||||
"\t<link>http://" + HTTP_OR_HTTPS_URL + "/" + pathName() + "?id=" + vars["_id"] + "</link>\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:date>" + isotime(ctime(vars["_time_place"]), 1) + "</dc:date>\n"
|
||||||
"\t<dc:creator>" + vars["_nick"] + "</dc:creator>\n"
|
"\t<dc:creator>" + vars["_nick"] + "</dc:creator>\n"
|
||||||
"</item>\n";
|
"</item>\n";
|
||||||
@ -379,6 +386,7 @@ string jsEntries(array(mixed) entries) {
|
|||||||
mapping entry, vars;
|
mapping entry, vars;
|
||||||
foreach (entry : entries) {
|
foreach (entry : entries) {
|
||||||
vars = entry[LOG_VARS];
|
vars = entry[LOG_VARS];
|
||||||
|
// should probably be htquoted too
|
||||||
js += "new Entry(" + vars["_id"] + ","
|
js += "new Entry(" + vars["_id"] + ","
|
||||||
"\"" + vars["_title"] + "\","
|
"\"" + vars["_title"] + "\","
|
||||||
"\"" + vars["_nick"] + "\","
|
"\"" + vars["_nick"] + "\","
|
||||||
@ -447,8 +455,7 @@ htget(prot, query, headers, qs, data) {
|
|||||||
int limit = to_int(query["limit"]) || DEFAULT_BACKLOG;
|
int limit = to_int(query["limit"]) || DEFAULT_BACKLOG;
|
||||||
int offset = to_int(query["offset"]);
|
int offset = to_int(query["offset"]);
|
||||||
string webact = PLACE_PATH + MYLOWERNICK;
|
string webact = PLACE_PATH + MYLOWERNICK;
|
||||||
// shouldnt it be "html" here?
|
sTextPath(query["layout"], query["lang"], "html");
|
||||||
sTextPath(query["layout"] || MYNICK, query["lang"], "ht");
|
|
||||||
|
|
||||||
// Kommentare anzeigen
|
// Kommentare anzeigen
|
||||||
if (query["id"]) {
|
if (query["id"]) {
|
||||||
@ -545,7 +552,6 @@ htget(prot, query, headers, qs, data) {
|
|||||||
} else if (export == "rss" || export == "rdf") {
|
} else if (export == "rss" || export == "rdf") {
|
||||||
// export als RSS
|
// export als RSS
|
||||||
// scheinbar gibt es ein limit von 15 items / channel
|
// scheinbar gibt es ein limit von 15 items / channel
|
||||||
// htquote auch hier anwenden
|
|
||||||
// check If-Modified-Since header
|
// check If-Modified-Since header
|
||||||
htok3(prot, "text/xml", "");
|
htok3(prot, "text/xml", "");
|
||||||
rssExport(limit, offset);
|
rssExport(limit, offset);
|
||||||
|
Loading…
Reference in New Issue
Block a user