Warning: session_start(): open(/var/lib/php/sessions/sess_p2el9cbtgrumj7g7if1fpifjib, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
sclass GazellePost {
long id;
long created, modified, bumped; // timestamps
GazelleUser creator;
S text, title, type, botInfo;
bool creating, hidden;
L postRefs;
LS postRefTags;
O importedFrom;
*() {}
*(Map map) {
id = toLong(map.get("id"));
created = toLong(map.get("created"));
modified = toLong(map.get("_modified"));
bumped = toLong(map.get("bumped"));
text = (S) map.get("text");
title = (S) map.get("title");
type = (S) map.get("type");
botInfo = (S) map.get("botInfo");
creating = isTrue(map.get("creating"));
hidden = isTrue(map.get("hidden"));
postRefs = allToLong((L) map.get("postRefs"));
postRefTags = checkedListCast S(map.get("postRefTags"));
long creatorID = toLong(map.get("creatorID"));
S creatorName = cast map.get("creatorName");
if (creatorID != 0 || nempty(creatorName)) {
creator = new GazelleUser(creatorID, creatorName);
creator.isMaster = isTrue(map.get("creatorIsMaster"));
}
}
LPair taggedRefs() { ret zipTwoListsToPairs_lengthOfFirst(postRefs, postRefTags); }
// extended to length
LS postRefTags() {
ret padList(postRefTags, l(postRefs));
}
long refWithTag(S tag) { ret unnull(first(refsWithTag(tag))); }
long refWithTagOrFail(S tag) {
long ref = refWithTag(tag);
if (ref == 0) fail("Need " + quote(ref) + " reference");
ret ref;
}
L refsWithTag(S tag) {
ret pairsAWhereB(taggedRefs(), t -> eqic_unnull(t, tag));
}
long parentID() { ret refWithTag(""); }
toString {
S content = nempty(title) ? shorten(title) : escapeNewLines(shorten(text));
ret content + " [by " + author() + "]";
}
S author() {
S author = or2(strOrNull(creator), "unknown");
if (isBotPost()) author += "'s bot " + quote(botInfo);
ret author;
}
bool isReply() { ret nempty(postRefs); }
bool isBotPost() { ret nempty(botInfo); }
bool isJavaXCode() { ret eqicOrSwicPlusSpace(type, "JavaX Code"); }
bool isPythonCode() { ret eqicOrSwicPlusSpace(type, "Python Code") && !ewic(typem " Checker"); }
bool isAutoBotMade() { ret swic(botInfo, "Auto-Bot "); }
bool isMasterMade() { ret creator != null && creator.isMaster; }
long modifiedOrBumped() { ret max(modified, bumped); }
S text() { ret text; }
}