Compare commits

..

60 Commits

Author SHA1 Message Date
towards-a-new-leftypol 60d86d3a84 Fix commit 1c13ec98ba
- Unintentionally disabled that piece of code instead of removing adding
  the additional br tag that made double spaces between posts.
- add the postcontainers instead of post.reply (which is inside this
  container) to preserve the arrows
2024-12-26 02:39:08 -05:00
towards-a-new-leftypol 62e7a4b22e undo instance-config.php settings changes 2024-12-22 00:42:38 -05:00
towards-a-new-leftypol 29d429bd55 retab image.php (use vim, convert tabs to space) 2024-12-22 00:42:38 -05:00
towards-a-new-leftypol 221faac75b Improve posting error handling
- if spamnoticer was contacted, add cleanup callback to error handler if
  something goes wrong during the rest of the process (like thumbnail
  creation for example)

- add another allowed warning (string) that gm may safely report back
  and don't call error if we see it.
2024-12-22 00:42:38 -05:00
towards-a-new-leftypol f5a073f0b1 bunker_like: heading and subtitle font sizes 2024-12-01 13:07:37 +00:00
towards-a-new-leftypol a8be2a3fc3 Up the font sizes for bunker_like a little bit 2024-12-01 12:42:21 +00:00
towards-a-new-leftypol 66fe2659c7 Fix textarea size in bunker_like theme 2024-11-29 04:24:54 -05:00
towards-a-new-leftypol eb89db5246 bunker_like: submit button color 2024-11-27 19:23:13 -05:00
towards-a-new-leftypol 132aa54b84 bunker_like: submit button color 2024-11-27 19:21:31 -05:00
towards-a-new-leftypol 709b4ff32d bunker-like css fix 2024-11-27 19:17:23 -05:00
towards-a-new-leftypol 9f26de080e fix bunker-like css tweaks 2024-11-27 19:15:07 -05:00
towards-a-new-leftypol 7e189349a3 bunker_like: padding adjust 2024-11-27 19:12:41 -05:00
towards-a-new-leftypol 9fe1cf8713 bunker-like: form tweaks 2024-11-27 18:55:25 -05:00
towards-a-new-leftypol c864f3701e bunkerlike form css tweaks (by 1px) 2024-11-27 18:37:38 -05:00
towards-a-new-leftypol 958a58f016 retab 2024-11-27 18:37:28 -05:00
towards-a-new-leftypol 929e00675f bunker_like css form field padding tweak 2024-11-27 18:16:32 -05:00
towards-a-new-leftypol 91a0b3017b bunkerlike - fix form padding 2024-11-27 18:02:21 -05:00
towards-a-new-leftypol df01d50275 Bunker-like theme changes
- change post body font to 'serif'
- change border radius's to 2px (down from 5px, which was silly)
2024-11-27 14:18:25 -05:00
towards-a-new-leftypol d3fa904e11 Replace flag instead of creating a new one 2024-11-27 11:51:20 -05:00
towards-a-new-leftypol f39a7f6282 Add flags 2024-11-27 11:40:13 -05:00
towards-a-new-leftypol 6b7c7b6c6a Add music board and a link to nukechan 2024-09-17 15:41:38 -04:00
towards-a-new-leftypol e9fa6303ac expand.js: don't add weird spacing 2024-09-17 15:41:38 -04:00
towards-a-new-leftypol 8763b2cf40 Fix log.php 2024-08-25 17:24:34 -04:00
towards-a-new-leftypol ab1f4e3ca7 Make headings bolder and brighter for better readability 2024-08-25 15:09:24 -04:00
towards-a-new-leftypol 585029dbca Fix a rebuilding when moving (targetBoard -> originBoard) 2024-08-12 16:54:19 -04:00
towards-a-new-leftypol b989686b2c 8 new banners 2024-08-08 01:25:30 -04:00
towards-a-new-leftypol 66636df702 anti-bot: do not flag missing hash values as spam 2024-07-19 15:40:41 -04:00
towards-a-new-leftypol 3415319698 add banners 2024-07-19 15:22:11 -04:00
towards-a-new-leftypol 8ea0e124a3 add banners 2024-07-01 12:38:22 -04:00
towards-a-new-leftypol 499cdc279f Remove redundant leftypedia link 2024-06-18 18:12:18 -04:00
towards-a-new-leftypol 7ed48a1769 Update booru and wiki links 2024-06-18 18:03:12 -04:00
towards-a-new-leftypol ef01eef2a2 Enable anti-bot, except for the case where the hash is missing from the db (most bots don't seem to be that smart) 2024-06-15 20:29:25 -04:00
towards-a-new-leftypol 4349499ddd Up the anti-bot hash expiration time to 120 days 2024-06-15 20:06:32 -04:00
towards-a-new-leftypol 77aac51172 Autoformat (vim) anti-bot.php to use spaces instead of tabs and spaces 2024-06-11 18:51:10 -04:00
towards-a-new-leftypol ce93e6f442 Anti-bot: print out failure cases and construction
- enable anti-bot spam protection setting but comment out it's rejection
- will monitor the output log to check for false-positives and just see
  what it's rejecting...
2024-06-11 18:48:04 -04:00
towards-a-new-leftypol d478f65ba0 Fix a bug with i2p captcha
- if captcha_tor_only is set to true, posting over i2p requires a
  captcha but the javascript code removes it. Add a check to see if
  we're on a .i2p domain in this case.
2024-06-07 15:07:25 -04:00
towards-a-new-leftypol ad5383c196 Add missing import to auth.php 2024-06-07 15:06:50 -04:00
towards-a-new-leftypol 17bb78e17e Add maintenance message 2024-05-29 15:03:49 -04:00
towards-a-new-leftypol 0a04e747c4 Rebuild origin board themes if moving a thread and not leaving a shadow 2024-05-25 16:29:41 -04:00
towards-a-new-leftypol 1af3931a48 Don't forget to rebuild the themes on origin board when moving
- if you're moving a post to a different board it would only
  rebuildThemes of the target board
2024-05-21 16:19:12 -04:00
towards-a-new-leftypol bdd813cd77 Captcha for TOR users only 2024-05-08 17:16:07 -04:00
towards-a-new-leftypol b118588a82 Fix captcha generator securimage.php to work with php 8
- basically use intval() everywhere to avoid implicit conversion from
  float
2024-05-07 10:54:59 -04:00
towards-a-new-leftypol 4f5dcd1773 Add 4 new banners 2024-05-06 16:24:35 -04:00
towards-a-new-leftypol f027f87044 Revert "Add new banner"
This reverts commit a8dd6c57c8.
2024-05-05 18:26:10 -04:00
towards-a-new-leftypol a8dd6c57c8 Add new banner 2024-05-05 17:53:30 -04:00
towards-a-new-leftypol 495949666d Add opus to supported list of extensions 2024-05-02 17:06:07 -04:00
towards-a-new-leftypol e2b79a443e Fix banners (replace misspelt ones) 2024-04-29 17:00:55 -04:00
towards-a-new-leftypol 28258efd36 Add banners 2024-04-28 16:02:55 -04:00
towards-a-new-leftypol 6e8d85d5e7 Fix flag list ordering in config 2024-04-09 03:42:54 -04:00
towards-a-new-leftypol 669429863a Fix previous commit 2024-04-09 03:37:07 -04:00
towards-a-new-leftypol 9293f38bf5 Add flag 2024-04-09 03:29:23 -04:00
towards-a-new-leftypol 64c6a4d9f6 Add banners 2024-04-08 22:48:50 -04:00
towards-a-new-leftypol 93b8d216b1 API - threads.json last_modified is now really the timestamp of the last post, put bump time in a new field 'bump' 2024-03-31 17:22:42 -04:00
towards-a-new-leftypol 623e5929b6 Fix top bar on windows/firefox which caused the page to scroll horizontally. (jungle theme) 2024-03-31 03:28:39 +00:00
towards-a-new-leftypol bc4e64bcec homepage sidebar: remove padding 2024-03-18 23:43:45 -04:00
towards-a-new-leftypol bc22758e90 get rid of gap parameter in css layout 2024-03-18 23:39:41 -04:00
towards-a-new-leftypol 9fbe71f1f9 Rename sidebar heading to Boards for the boards list 2024-03-17 17:40:14 -04:00
towards-a-new-leftypol ac08768094 homepage sizing fixes 2024-03-17 17:36:53 -04:00
towards-a-new-leftypol 1095f773e0 Further homepage changes 2024-03-17 17:36:53 -04:00
towards-a-new-leftypol 548c613c12 Homepage: remove sidebar border, make sidebar wider (300px instead of
200px)
2024-03-17 17:36:53 -04:00
10 changed files with 286 additions and 383 deletions

View File

@ -38,10 +38,6 @@ $error_recursion=false;
function global_post_cleanup() { function global_post_cleanup() {
global $post_cleanup_list; global $post_cleanup_list;
if (!isset($post_cleanup_list)) {
return;
}
foreach ($post_cleanup_list as $f) { foreach ($post_cleanup_list as $f) {
$f(); $f();
} }

View File

@ -96,7 +96,6 @@ $config['db']['password'] = '';
$config['cookies']['mod'] = 'mod'; $config['cookies']['mod'] = 'mod';
$config['cookies']['salt'] = 'MGYwNjhlNjU5Y2QxNWU3YjQ3MzQ1Yj'; $config['cookies']['salt'] = 'MGYwNjhlNjU5Y2QxNWU3YjQ3MzQ1Yj';
$config['dns_system'] = true;
$config['search']['enable'] = true; $config['search']['enable'] = true;
$config['flood_cache'] = 60 * 15; // 15 minutes. The oldest a post can be in the flood table $config['flood_cache'] = 60 * 15; // 15 minutes. The oldest a post can be in the flood table
$config['flood_time_any'] = 120; // time between thread creation $config['flood_time_any'] = 120; // time between thread creation
@ -598,5 +597,5 @@ $config['filters'][] = array(
'message' => 'New threads are being created too quickly. Wait [at most] 10 minutes' 'message' => 'New threads are being created too quickly. Wait [at most] 10 minutes'
); );
$config['global_message'] = '<span><a href="https://talk.leftychan.net/#/room/#welcome:matrix.leftychan.net">Matrix</a></span> &nbsp; <span><a href="ircs://irc.leftychan.net:6697/#leftychan">IRC Chat</a></span> &nbsp; <span><a href="mumble://leftychan.net">Mumble</a></span> &nbsp; <span><a href="https://discord.gg/AcZeFKXPmZ">Discord</a></span>'; $config['global_message'] = '<span><a href="https://talk.leftychan.net/#/room/#welcome:matrix.leftychan.net">Matrix</a></span> &nbsp; <span><a href="ircs://irc.leftychan.net:6697/#leftychan">IRC Chat</a></span> &nbsp; <span><a href="mumble://leftychan.net">Mumble</a></span> &nbsp; <span><a href="https://t.me/+RegtyzzrE0M1NDMx">Telegram</a></span> &nbsp; <span><a href="https://discord.gg/AcZeFKXPmZ">Discord</a></span>';
$config['debug'] = false; $config['debug'] = false;

View File

@ -296,8 +296,6 @@ function checkWithSpamNoticer($config, $post, $boardname) {
print_err($body); print_err($body);
$reasons_bitmap = json_decode($body)->reason; $reasons_bitmap = json_decode($body)->reason;
$result->reason = renderReasons($reasons_bitmap); $result->reason = renderReasons($reasons_bitmap);
} else if ($config['debug']) {
print_err((string) $response->getBody());
} }
} else { } else {
print_err("spamnoticer status code: " . $status_code); print_err("spamnoticer status code: " . $status_code);

View File

@ -4,6 +4,7 @@
*/ */
globalThis.LCNSite = class LCNSite { globalThis.LCNSite = class LCNSite {
static INSTANCE = null;
static "createAbortable" () { static "createAbortable" () {
const obj = { "abort": null, "controller": null, "signal": null } const obj = { "abort": null, "controller": null, "signal": null }
@ -31,64 +32,54 @@ globalThis.LCNSite = class LCNSite {
} }
return null return null
};
constructor () {
this._isModerator = document.body.classList.contains("is-moderator");
this._isThreadPage = document.body.classList.contains("active-thread");
this._isBoardPage = document.body.classList.contains("active-board");
this._isCatalogPage = document.body.classList.contains("active-catalog");
this._isModPage = location.pathname == "/mod.php";
this._isModRecentsPage = this._isModPage && (location.search == "?/recent" || location.search.startsWith("?/recent/"));
this._isModReportsPage = this._isModPage && (location.search == "?/reports" || location.search.startsWith("?/reports/"));
this._isModLogPage = this._isModPage && (location.search == "?/log" || location.search.startsWith("?/log/"));
this._unseen = 0;
this._pageTitle = document.title;
this._favicon = document.querySelector("head > link[rel=\"shortcut icon\"]");
this._generatedStyle = null;
} }
"_doTitleUpdate" () { #isModerator = document.body.classList.contains("is-moderator");
document.title = (this._unseen > 0 ? `(${this._unseen}) ` : "") + this._pageTitle; #isThreadPage = document.body.classList.contains("active-thread");
}; #isBoardPage = document.body.classList.contains("active-board");
#isCatalogPage = document.body.classList.contains("active-catalog");
"isModerator" () { return this._isModerator; } #isModPage = location.pathname == "/mod.php";
"isThreadPage" () { #isModRecentsPage = this.#isModPage && (location.search == "?/recent" || location.search.startsWith("?/recent/"));
return this._isThreadPage; #isModReportsPage = this.#isModPage && (location.search == "?/reports" || location.search.startsWith("?/reports/"));
} #isModLogPage = this.#isModPage && (location.search == "?/log" || location.search.startsWith("?/log/"));
"isBoardPage" () { return this._isBoardPage; }
"isCatalogPage" () { return this._isCatalogPage; }
"isModPage" () { return this._isModPage; } "isModerator" () { return this.#isModerator; }
"isModRecentsPage" () { return this._isModRecentsPage; } "isThreadPage" () { return this.#isThreadPage; }
"isModReportsPage" () { return this._isModReportsPage; } "isBoardPage" () { return this.#isBoardPage; }
"isModLogPage" () { return this._isModLogPage; } "isCatalogPage" () { return this.#isCatalogPage; }
"getUnseen" () { return this._unseen; } "isModPage" () { return this.#isModPage; }
"clearUnseen" () { if (this._unseen != 0) { this.setUnseen(0); } } "isModRecentsPage" () { return this.#isModRecentsPage; }
"isModReportsPage" () { return this.#isModReportsPage; }
"isModLogPage" () { return this.#isModLogPage; }
#unseen = 0;
"getUnseen" () { return this.#unseen; }
"clearUnseen" () { if (this.#unseen != 0) { this.setUnseen(0); } }
"setUnseen" (int) { "setUnseen" (int) {
const bool = !!int const bool = !!int
if (bool != !!this._unseen) { if (bool != !!this.#unseen) {
this.setFaviconType(bool ? "reply" : null) this.setFaviconType(bool ? "reply" : null)
} }
this._unseen = int this.#unseen = int
this._doTitleUpdate() this.#doTitleUpdate()
} }
"getTitle" () { return this._pageTitle; } #pageTitle = document.title;
"setTitle" (title) { this._pageTitle = title; this._doTitleUpdate(); } "getTitle" () { return this.#pageTitle; }
"setTitle" (title) { this.#pageTitle = title; this.#doTitleUpdate(); }
#doTitleUpdate () { document.title = (this.#unseen > 0 ? `(${this.#unseen}) ` : "") + this.#pageTitle; }
#favicon = document.querySelector("head > link[rel=\"shortcut icon\"]");
"setFaviconType" (type=null) { "setFaviconType" (type=null) {
if (this._favicon == null) { if (this.#favicon == null) {
this._favicon = document.createElement("link") this.#favicon = document.createElement("link")
this._favicon.rel = "shortcut icon" this.#favicon.rel = "shortcut icon"
document.head.appendChild(this._favicon) document.head.appendChild(this.#favicon)
} }
this._favicon.href = `/favicon${type ? "-" + type : ""}.ico` this.#favicon.href = `/favicon${type ? "-" + type : ""}.ico`
} }
"getFloaterLContainer" () { return document.getElementById("bar-bottom-l"); } "getFloaterLContainer" () { return document.getElementById("bar-bottom-l"); }
@ -96,93 +87,85 @@ globalThis.LCNSite = class LCNSite {
"getThreadStatsLContainer" () { return document.getElementById("lcn-threadstats-l"); } "getThreadStatsLContainer" () { return document.getElementById("lcn-threadstats-l"); }
"getThreadStatsRContainer" () { return document.getElementById("lcn-threadstats-r"); } "getThreadStatsRContainer" () { return document.getElementById("lcn-threadstats-r"); }
#generatedStyle = null;
"writeCSSStyle" (origin, stylesheet) { "writeCSSStyle" (origin, stylesheet) {
if (this._generatedStyle == null && (this._generatedStyle = document.querySelector("head > style.generated-css")) == null) { if (this.#generatedStyle == null && (this.#generatedStyle = document.querySelector("head > style.generated-css")) == null) {
this._generatedStyle = document.createElement("style") this.#generatedStyle = document.createElement("style")
this._generatedStyle.classList.add("generated-css") this.#generatedStyle.classList.add("generated-css")
document.head.appendChild(this._generatedStyle) document.head.appendChild(this.#generatedStyle)
} }
this._generatedStyle.textContent += `${this._generatedStyle.textContent.length ? "\n\n" : ""}/*** Generated by ${origin} ***/\n${stylesheet}` this.#generatedStyle.textContent += `${this.#generatedStyle.textContent.length ? "\n\n" : ""}/*** Generated by ${origin} ***/\n${stylesheet}`
} }
} }
globalThis.LCNSite.INSTANCE = null;
globalThis.LCNPostInfo = class LCNPostInfo { globalThis.LCNPostInfo = class LCNPostInfo {
constructor () { static nodeAttrib = "$LCNPostInfo";
this._boardId = null; static selector = ".post:not(.grid-li)";
this._threadId = null; #boardId = null;
this._postId = null; #threadId = null;
this._name = null; #postId = null;
this._email = null; #name = null;
this._capcode = null; #email = null;
this._flag = null; #capcode = null;
this._ip = null; #flag = null;
this._subject = null; #ip = null;
this._createdAt = null; #subject = null;
this._parent = null; #createdAt = null;
this._isThread = false;
this._isReply = false;
this._isLocked = false;
this._isSticky = false;
}
#parent = null;
#isThread = false;
#isReply = false;
#isLocked = false;
#isSticky = false;
static "assign" (post) { static "assign" (post) { return post[this.nodeAttrib] ?? (post[this.nodeAttrib] = this.from(post)); }
if (post[this.nodeAttrib] == null) {
return post[this.nodeAttrib] = this.from(post);
} else {
return post[this.nodeAttrib];
}
}
static "from" (post) { static "from" (post) {
assert.ok(post.classList.contains("post"), "Arty must be expected Element."); assert.ok(post.classList.contains("post"), "Arty must be expected Element.")
const inst = new this(); const inst = new this()
const intro = post.querySelector(".intro"); const intro = post.querySelector(".intro")
const link = intro.querySelector(".post_no:not([id])").href.split("/").reverse(); const link = intro.querySelector(".post_no:not([id])").href.split("/").reverse()
inst._postId = link[0].slice(link[0].indexOf("#q") + 2); inst.#postId = link[0].slice(link[0].indexOf("#q") + 2)
inst._threadId = link[0].slice(0, link[0].indexOf(".")); inst.#threadId = link[0].slice(0, link[0].indexOf("."))
inst._boardId = link[2]; inst.#boardId = link[2]
inst._isThread = post.classList.contains("op"); inst.#isThread = post.classList.contains("op")
inst._isReply = !inst._isThread; inst.#isReply = !inst.#isThread
inst._subject = cont(intro.querySelector(".subject"), x => x.innerText); inst.#subject = intro.querySelector(".subject")?.innerText ?? null
inst._name = cont(intro.querySelector(".name"), x => x.innerText); inst.#name = intro.querySelector(".name")?.innerText ?? null
inst._email = cont(intro.querySelector(".email"), x => x.href.slice(7)); inst.#email = intro.querySelector(".email")?.href.slice(7) ?? null
inst._flag = cont(intro.querySelector(".flag"), x => x.src.split("/").reverse()[0].slice(0, -4)); inst.#flag = intro.querySelector(".flag")?.src.split("/").reverse()[0].slice(0, -4) ?? null
inst._capcode = cont(intro.querySelector(".capcode"), x => x.innerText); inst.#capcode = intro.querySelector(".capcode")?.innerText ?? null
inst._ip = cont(intro.querySelector(".ip-link"), x => x.innerText); inst.#ip = intro.querySelector(".ip-link")?.innerText ?? null
inst._createdAt = new Date(intro.querySelector("time[datetime]").dateTime || NaN); inst.#createdAt = new Date(intro.querySelector("time[datetime]").dateTime ?? NaN)
inst._isSticky = !!intro.querySelector("i.fa-thumb-tack"); inst.#isSticky = !!intro.querySelector("i.fa-thumb-tack")
inst._isLocked = !!intro.querySelector("i.fa-lock"); inst.#isLocked = !!intro.querySelector("i.fa-lock")
return inst; return inst
} }
"getParent" () { return this._parent; } "getParent" () { return this.#parent; }
"__setParent" (inst) { return this._parent = inst; } "__setParent" (inst) { return this.#parent = inst; }
"getBoardId" () { return this._boardId; } "getBoardId" () { return this.#boardId; }
"getThreadId" () { return this._threadId; } "getThreadId" () { return this.#threadId; }
"getPostId" () { return this._postId; } "getPostId" () { return this.#postId; }
"getHref" () { return `/${this.boardId}/res/${this.threadId}.html#q${this.postId}`; } "getHref" () { return `/${this.boardId}/res/${this.threadId}.html#q${this.postId}`; }
"getName" () { return this._name; } "getName" () { return this.#name; }
"getEmail" () { return this._email; } "getEmail" () { return this.#email; }
"getIP" () { return this._ip; } "getIP" () { return this.#ip; }
"getCapcode" () { return this._capcode; } "getCapcode" () { return this.#capcode; }
"getSubject" () { return this._subject; } "getSubject" () { return this.#subject; }
"getCreatedAt" () { return this._createdAt; } "getCreatedAt" () { return this.#createdAt; }
"isSticky" () { return this._isSticky; } "isSticky" () { return this.#isSticky; }
"isLocked" () { return this._isLocked; } "isLocked" () { return this.#isLocked; }
"isThread" () { return this._isThread; } "isThread" () { return this.#isThread; }
"isReply" () { return this._isReply; } "isReply" () { return this.#isReply; }
"is" (info) { "is" (info) {
assert.ok(info, "Must be LCNPost.") assert.ok(info, "Must be LCNPost.")
@ -191,48 +174,45 @@ globalThis.LCNPostInfo = class LCNPostInfo {
} }
LCNPostInfo.nodeAttrib = "$LCNPostInfo";
LCNPostInfo.selector = ".post:not(.grid-li)";
globalThis.LCNPost = class LCNPost { globalThis.LCNPost = class LCNPost {
static "assign" (post) { static nodeAttrib = "$LCNPost";
return post[this.nodeAttrib] || (post[this.nodeAttrib] = this.from(post)); static selector = ".post:not(.grid-li)";
} #parent = null;
#post = null;
#info = null;
#ipLink = null;
#controls = null;
#customControlsSeperatorNode = null;
static "assign" (post) { return post[this.nodeAttrib] ?? (post[this.nodeAttrib] = this.from(post)); }
static "from" (post) { return new this(post); } static "from" (post) { return new this(post); }
constructor (post) { "constructor" (post) {
this._parent = null; assert.ok(post.classList.contains("post"), "Arty must be expected Element.")
this._post = null; const intro = post.querySelector(".intro")
this._info = null; this.#post = post
this._ipLink = null; this.#info = LCNPostInfo.assign(post)
this._controls = null; this.#ipLink = intro.querySelector(".ip-link")
this._customControlsSeperatorNode = null; this.#controls = Array.prototype.at.apply(post.querySelectorAll(".controls"), [ -1 ])
assert.ok(post.classList.contains("post"), "Arty must be expected Element."); assert.equal(this.#info.getParent(), null, "Info should not have parent.")
const intro = post.querySelector(".intro"); this.#info.__setParent(this)
this._post = post;
this._info = LCNPostInfo.assign(post);
this._ipLink = intro.querySelector(".ip-link");
this._controls = Array.prototype.at.apply(post.querySelectorAll(".controls"), [ -1 ]);
//assert.equal(this._info.getParent(), null, "Info should not have parent.");
this._info.__setParent(this);
} }
"jQuery" () { return $(this.#post); }
"trigger" (event_id, data=null) { $(this.#post).trigger(event_id, [ data ]); }
"jQuery" () { return $(this._post); } "getElement" () { return this.#post; }
"trigger" (event_id, data=null) { $(this._post).trigger(event_id, [ data ]); } "getInfo" () { return this.#info; }
"getElement" () { return this._post; } "getIPLink" () { return this.#ipLink; }
"getInfo" () { return this._info; } "setIP" (ip) { this.#ipLink.innerText = ip; }
"getIPLink" () { return this._ipLink; } "getParent" () { return this.#parent; }
"setIP" (ip) { this._ipLink.innerText = ip; } "__setParent" (inst) { return this.#parent = inst; }
"getParent" () { return this._parent; }
"__setParent" (inst) { return this._parent = inst; }
static #NBSP = String.fromCharCode(160);
"addCustomControl" (obj) { "addCustomControl" (obj) {
if (LCNSite.INSTANCE.isModerator()) { if (LCNSite.INSTANCE.isModerator()) {
const link = document.createElement("a") const link = document.createElement("a")
@ -247,122 +227,115 @@ globalThis.LCNPost = class LCNPost {
link.addEventListener("click", e => { e.preventDefault(); obj.onClick(this); }) link.addEventListener("click", e => { e.preventDefault(); obj.onClick(this); })
} }
if (this._customControlsSeperatorNode == null) { if (this.#customControlsSeperatorNode == null) {
this._controls.insertBefore(this._customControlsSeperatorNode = new Text(`${this.constructor.NBSP}-${this.constructor.NBSP}`), this._controls.firstElementChild) this.#controls.insertBefore(this.#customControlsSeperatorNode = new Text(`${this.constructor.#NBSP}-${this.constructor.#NBSP}`), this.#controls.firstElementChild)
} else { } else {
this._controls.insertBefore(new Text(this.constructor.NBSP), this._customControlsSeperatorNode) this.#controls.insertBefore(new Text(this.constructor.#NBSP), this.#customControlsSeperatorNode)
} }
this._controls.insertBefore(link, this._customControlsSeperatorNode) this.#controls.insertBefore(link, this.#customControlsSeperatorNode)
} }
} }
} }
globalThis.LCNPost.nodeAttrib = "$LCNPost";
globalThis.LCNPost.selector = ".post:not(.grid-li)";
globalThis.LCNPost. NBSP = String.fromCharCode(160);
globalThis.LCNThread = class LCNThread { globalThis.LCNThread = class LCNThread {
static "assign" (thread) { static nodeAttrib = "$LCNThread";
return thread[this.nodeAttrib] || (thread[this.nodeAttrib] = this.from(thread)); static selector = ".thread:not(.grid-li)";
} #element = null;
#parent = null;
#op = null;
static "assign" (thread) { return thread[this.nodeAttrib] ?? (thread[this.nodeAttrib] = this.from(thread)); }
static "from" (thread) { return new this(thread); } static "from" (thread) { return new this(thread); }
constructor (thread) { "constructor" (thread) {
this._element = null;
this._parent = null;
this._op = null;
assert.ok(thread.classList.contains("thread"), "Arty must be expected Element.") assert.ok(thread.classList.contains("thread"), "Arty must be expected Element.")
this._element = thread this.#element = thread
this._op = LCNPost.assign(this._element.querySelector(".post.op")) this.#op = LCNPost.assign(this.#element.querySelector(".post.op"))
assert.equal(this._op.getParent(), null, "Op should not have parent.")
this._op.__setParent(this) //assert.equal(this.#op.getParent(), null, "Op should not have parent.")
this.#op.__setParent(this)
} }
"getElement" () { return this._element; } "getElement" () { return this.#element; }
"getContent" () { return this._op; } "getContent" () { return this.#op; }
"getPosts" () { return Array.prototype.map.apply(this._element.querySelectorAll(".post"), [ el => LCNPost.assign(el) ]); } "getPosts" () { return Array.prototype.map.apply(this.#element.querySelectorAll(".post"), [ el => LCNPost.assign(el) ]); }
"getReplies" () { return Array.prototype.map.apply(this._element.querySelectorAll(".post:not(.op)"), [ el => LCNPost.assign(el) ]); } "getReplies" () { return Array.prototype.map.apply(this.#element.querySelectorAll(".post:not(.op)"), [ el => LCNPost.assign(el) ]); }
"getParent" () { return this._parent; } "getParent" () { return this.#parent; }
"__setParent" (inst) { return this._parent = inst; } "__setParent" (inst) { return this.#parent = inst; }
} }
globalThis.LCNThread.nodeAttrib = "$LCNThread";
globalThis.LCNThread.selector = ".thread:not(.grid-li)";
globalThis.LCNPostContainer = class LCNPostContainer { globalThis.LCNPostContainer = class LCNPostContainer {
static "assign" (container) { return container[this.nodeAttrib] || (container[this.nodeAttrib] = this.from(container)); } static nodeAttrib = "$LCNPostContainer";
static selector = ".postcontainer";
#parent = null;
#element = null;
#content = null;
#postId = null;
#boardId = null;
static "assign" (container) { return container[this.nodeAttrib] ?? (container[this.nodeAttrib] = this.from(container)); }
static "from" (container) { return new this(container); } static "from" (container) { return new this(container); }
constructor (container) { "constructor" (container) {
this._parent = null;
this._element = null;
this._content = null;
this._postId = null;
this._boardId = null;
assert.ok(container.classList.contains("postcontainer"), "Arty must be expected Element.") assert.ok(container.classList.contains("postcontainer"), "Arty must be expected Element.")
const child = container.querySelector(".thread, .post") const child = container.querySelector(".thread, .post")
this._element = container this.#element = container
this._content = child.classList.contains("thread") ? LCNThread.assign(child) : LCNPost.assign(child) this.#content = child.classList.contains("thread") ? LCNThread.assign(child) : LCNPost.assign(child)
this._boardId = container.dataset.board this.#boardId = container.dataset.board
this._postId = container.id.slice(2) this.#postId = container.id.slice(2)
assert.equal(this._content.getParent(), null, "Content should not have parent.") assert.equal(this.#content.getParent(), null, "Content should not have parent.")
this._content.__setParent(this) this.#content.__setParent(this)
} }
"getElement" () { return this._element; } "getElement" () { return this.#element; }
"getContent" () { return this._content; } "getContent" () { return this.#content; }
"getBoardId" () { return this._boardId; } "getBoardId" () { return this.#boardId; }
"getPostId" () { return this._postId; } "getPostId" () { return this.#postId; }
"getParent" () { return this._parent; } "getParent" () { return this.#parent; }
"__setParent" (inst) { return this._parent = inst; } "__setParent" (inst) { return this.#parent = inst; }
} }
globalThis.LCNPostContainer.nodeAttrib = "$LCNPostContainer";
globalThis.LCNPostContainer.selector = ".postcontainer";
globalThis.LCNPostWrapper = class LCNPostWrapper { globalThis.LCNPostWrapper = class LCNPostWrapper {
static "assign" (wrapper) { return wrapper[this.nodeAttrib] || (wrapper[this.nodeAttrib] = this.from(wrapper)); } static nodeAttrib = "$LCNPostWrapper";
static selector = ".post-wrapper";
#wrapper = null;
#eitaLink = null;
#eitaId = null;
#eitaHref = null
#content = null;
static "assign" (wrapper) { return wrapper[this.nodeAttrib] ?? (wrapper[this.nodeAttrib] = this.from(wrapper)); }
static "from" (wrapper) { return new this(wrapper); } static "from" (wrapper) { return new this(wrapper); }
constructor (wrapper) { "constructor" (wrapper) {
this._wrapper = null;
this._eitaLink = null;
this._eitaId = null;
this._eitaHref = null
this._content = null;
assert.ok(wrapper.classList.contains("post-wrapper"), "Arty must be expected Element.") assert.ok(wrapper.classList.contains("post-wrapper"), "Arty must be expected Element.")
this._wrapper = wrapper this.#wrapper = wrapper
this._eitaLink = wrapper.querySelector(".eita-link") this.#eitaLink = wrapper.querySelector(".eita-link")
this._eitaId = this._eitaLink.id this.#eitaId = this.#eitaLink.id
this._eitaHref = this._eitaLink.href this.#eitaHref = this.#eitaLink.href
void Array.prototype.find.apply(wrapper.children, [ void Array.prototype.find.apply(wrapper.children, [
el => { el => {
if (el.classList.contains("thread")) { if (el.classList.contains("thread")) {
return this._content = LCNThread.assign(el) return this.#content = LCNThread.assign(el)
} else if (el.classList.contains("postcontainer")) { } else if (el.classList.contains("postcontainer")) {
return this._content = LCNPostContainer.assign(el) return this.#content = LCNPostContainer.assign(el)
} }
} }
]) ])
assert.ok(this._content, "Wrapper should contain content.") assert.ok(this.#content, "Wrapper should contain content.")
assert.equal(this._content.getParent(), null, "Content should not have parent.") assert.equal(this.#content.getParent(), null, "Content should not have parent.")
this._content.__setParent(this) this.#content.__setParent(this)
} }
"getPost" () { "getPost" () {
@ -371,62 +344,60 @@ globalThis.LCNPostWrapper = class LCNPostWrapper {
return post return post
} }
"getElement" () { return this._wrapper; } "getElement" () { return this.#wrapper; }
"getContent" () { return this._content; } "getContent" () { return this.#content; }
"getEitaId" () { return this._eitaId; } "getEitaId" () { return this.#eitaId; }
"getEitaHref" () { return this._eitaHref; } "getEitaHref" () { return this.#eitaHref; }
"getEitaLink" () { return this._eitaLink; } "getEitaLink" () { return this.#eitaLink; }
} }
globalThis.LCNPostWrapper.nodeAttrib = "$LCNPostWrapper";
globalThis.LCNPostWrapper.selector = ".post-wrapper";
globalThis.LCNSetting = class LCNSetting { globalThis.LCNSetting = class LCNSetting {
#id = null;
#eventId = null;
#label = null;
#hidden = false;
#value = null;
#valueDefault = null;
static "build" (id) { return new this(id); } static "build" (id) { return new this(id); }
constructor (id) { "constructor" (id) {
this._id = null; this.#id = id;
this._eventId = null; this.#eventId = `lcnsetting::${this.#id}`
this._label = null;
this._hidden = false;
this._value = null;
this._valueDefault = null;
this._id = id;
this._eventId = `lcnsetting::${this._id}`
} }
"_getValue" () { #getValue () {
const v = localStorage.getItem(this._id) const v = localStorage.getItem(this.#id)
if (v != null) { if (v != null) {
return this.__builtinValueImporter(v) return this.__builtinValueImporter(v)
} else { } else {
return this._valueDefault return this.#valueDefault
} }
} }
"isHidden" () { return this._hidden; } "isHidden" () { return this.#hidden; }
"setHidden" (v) { this._hidden = v; return this; } "setHidden" (v) { this.#hidden = v; return this; }
"getValue" () { return this._value || (this._value = this._getValue()); }
"getValue" () { return this.#value ?? (this.#value = this.#getValue()); }
"setValue" (v) { "setValue" (v) {
if (this._value !== v) { if (this.#value !== v) {
this._value = v this.#value = v
localStorage.setItem(this._id, this.__builtinValueExporter(this._value)) localStorage.setItem(this.#id, this.__builtinValueExporter(this.#value))
setTimeout(() => $(document).trigger(`${this._eventId}::change`, [ v, this ]), 1) setTimeout(() => $(document).trigger(`${this.#eventId}::change`, [ v, this ]), 1)
} }
} }
"getLabel" () { return this._label; } "getLabel" () { return this.#label; }
"setLabel" (label) { this._label = label; return this; } "setLabel" (label) { this.#label = label; return this; }
"getDefaultValue" () { return this._valueDefault; } "getDefaultValue" () { return this.#valueDefault; }
"setDefaultValue" (vd) { this._valueDefault = vd; return this; } "setDefaultValue" (vd) { this.#valueDefault = vd; return this; }
"onChange" (fn) { $(document).on(`${this._eventId}::change`, (_,v,i) => fn(v, i)); } "onChange" (fn) { $(document).on(`${this.#eventId}::change`, (_,v,i) => fn(v, i)); }
__setIdPrefix (prefix) { __setIdPrefix (prefix) {
this._id = `${prefix}_${this._id}` this.#id = `${prefix}_${this.#id}`
this._eventId = `lcnsetting::${this._id}` this.#eventId = `lcnsetting::${this.#id}`
} }
} }
@ -436,10 +407,10 @@ globalThis.LCNToggleSetting = class LCNToggleSetting extends LCNSetting {
__builtinDOMConstructor () { __builtinDOMConstructor () {
const div = document.createElement("div") const div = document.createElement("div")
const chk = document.createElement("input") const chk = document.createElement("input")
const lbl = document.createElement("label") const txt = document.createElement("label")
const id = `lcnts::${this.id}` const id = `lcnts::${this.id}`
lbl.htmlFor = id txt.id = id
lbl.innerText = this.getLabel() txt.innerText = this.getLabel()
chk.id = id chk.id = id
chk.type = "checkbox" chk.type = "checkbox"
chk.checked = this.getValue() chk.checked = this.getValue()
@ -450,17 +421,23 @@ globalThis.LCNToggleSetting = class LCNToggleSetting extends LCNSetting {
this.onChange(v => chk.checked = v) this.onChange(v => chk.checked = v)
div.appendChild(chk) div.appendChild(chk)
div.appendChild(lbl) div.appendChild(txt)
return div return div
} }
} }
globalThis.LCNSettingsSubcategory = class LCNSettingsSubcategory { globalThis.LCNSettingsSubcategory = class LCNSettingsSubcategory {
#tab_id = null;
#id = null;
#fieldset = null;
#legend = null;
#label = null;
static "for" (tab_id, id) { static "for" (tab_id, id) {
const domid = `lcnssc_${tab_id}_${id}` const domid = `lcnssc_${tab_id}_${id}`
const inst = cont(document.getElementById(domid), x => x.$LCNSettingsSubcategory) const inst = document.getElementById(domid)?.$LCNSettingsSubcategory
if (inst == null) { if (inst == null) {
const fieldset = document.createElement("fieldset") const fieldset = document.createElement("fieldset")
const legend = document.createElement("legend") const legend = document.createElement("legend")
@ -469,7 +446,7 @@ globalThis.LCNSettingsSubcategory = class LCNSettingsSubcategory {
// XXX: extend_tab only takes a string so this hacky workaround is used to let us use the regular dom api // XXX: extend_tab only takes a string so this hacky workaround is used to let us use the regular dom api
Options.extend_tab(tab_id, `<div id="__${domid}" hidden></div>`) Options.extend_tab(tab_id, `<div id="__${domid}" hidden></div>`)
const div = cont(document.getElementById(`__${domid}`), x => x.parentElement) const div = document.getElementById(`__${domid}`)?.parentElement
assert.ok(div) assert.ok(div)
div.replaceChildren(fieldset) div.replaceChildren(fieldset)
@ -479,23 +456,23 @@ globalThis.LCNSettingsSubcategory = class LCNSettingsSubcategory {
} }
} }
constructor (tab_id, id, fieldset) { "constructor" (tab_id, id, fieldset) {
this._tab_id = tab_id this.#tab_id = tab_id
this._id = id this.#id = id
this._fieldset = fieldset this.#fieldset = fieldset
this._legend = this._fieldset.querySelector("legend") this.#legend = this.#fieldset.querySelector("legend")
this._fieldset.$LCNSettingsSubcategory = this this.#fieldset.$LCNSettingsSubcategory = this
} }
"getLabel" () { return this._label; } "getLabel" () { return this.#label; }
"setLabel" (label) { this._legend.innerText = this._label = label; return this; } "setLabel" (label) { this.#legend.innerText = this.#label = label; return this; }
"addSetting" (setting) { "addSetting" (setting) {
assert.ok(setting instanceof LCNSetting) assert.ok(setting instanceof LCNSetting)
setting.__setIdPrefix(`lcnsetting_${this._tab_id}_${this._id}`) setting.__setIdPrefix(`lcnsetting_${this.#tab_id}_${this.#id}`)
if (!setting.isHidden() && setting.__builtinDOMConstructor != null) { if (!setting.isHidden() && setting.__builtinDOMConstructor != null) {
const div = setting.__builtinDOMConstructor() const div = setting.__builtinDOMConstructor()
div.classList.add("lcn-setting-entry") div.classList.add("lcn-setting-entry")
this._fieldset.appendChild(div) this.#fieldset.appendChild(div)
} }
return this return this
@ -513,7 +490,7 @@ $().ready(() => {
clazz.forEach = (fn, node=document) => clazz.allNodes(node).forEach(elem => fn(clazz.assign(elem))) clazz.forEach = (fn, node=document) => clazz.allNodes(node).forEach(elem => fn(clazz.assign(elem)))
clazz.filter = (fn, node=document) => clazz.all(node).filter(fn) clazz.filter = (fn, node=document) => clazz.all(node).filter(fn)
clazz.find = fn => clazz.all().find(fn) clazz.find = fn => clazz.all().find(fn)
clazz.first = (node=document) => { return clazz.assign(node.querySelector(clazz.selector)); } clazz.first = (node=document) => clazz.assign(node.querySelector(clazz.selector))
clazz.last = (node=document) => clazz.assign(Array.prototype.at.apply(clazz.allNodes(node), [ -1 ])) clazz.last = (node=document) => clazz.assign(Array.prototype.at.apply(clazz.allNodes(node), [ -1 ]))
} }

View File

@ -4,6 +4,7 @@
*/ */
$().ready(() => { $().ready(() => {
const kIsEnabled = LCNToggleSetting.build("enabled") const kIsEnabled = LCNToggleSetting.build("enabled")
const kUpdateOnReplyEnabled = LCNToggleSetting.build("updateOnReplyEnabled") const kUpdateOnReplyEnabled = LCNToggleSetting.build("updateOnReplyEnabled")
//const kIsBellEnabled = LCNToggleSetting.build("bellEnabled") //const kIsBellEnabled = LCNToggleSetting.build("bellEnabled")
@ -34,7 +35,7 @@ $().ready(() => {
const abortable = LCNSite.createAbortable() const abortable = LCNSite.createAbortable()
const threadStatsItems = [] const threadStatsItems = []
const updateDOMStatus = () => { const updateDOMStatus = () => {
const text = threadState || (secondsCounter >= 0 ? `${secondsCounter}s` : "…") const text = threadState ?? (secondsCounter >= 0 ? `${secondsCounter}s` : "…")
threadUpdateStatus.innerText = text threadUpdateStatus.innerText = text
} }
@ -63,7 +64,7 @@ $().ready(() => {
} }
const findMissingReplies = (thread_op, thread_dom, thread_latest) => { const findMissingReplies = (thread_op, thread_dom, thread_latest) => {
const lastPostTs = (cont(thread_dom.at(-1), x => x.getInfo()) || thread_op.getInfo()).getCreatedAt().getTime() const lastPostTs = (thread_dom.at(-1)?.getInfo() ?? thread_op.getInfo()).getCreatedAt().getTime()
const missing = [] const missing = []
for (const pc of thread_latest.reverse()) { for (const pc of thread_latest.reverse()) {
@ -134,7 +135,6 @@ $().ready(() => {
if (threadState == null) { if (threadState == null) {
if (secondsCounter < 0) { if (secondsCounter < 0) {
const thread = LCNThread.first() const thread = LCNThread.first()
try { try {
await updateStatsFn(thread) await updateStatsFn(thread)
if (threadState == null && threadStats.last_modified > (thread.getPosts().at(-1).getInfo().getCreatedAt().getTime() / 1000)) { if (threadState == null && threadStats.last_modified > (thread.getPosts().at(-1).getInfo().getCreatedAt().getTime() / 1000)) {
@ -154,7 +154,6 @@ $().ready(() => {
onTickId = setTimeout(onTickFn, 1000) onTickId = setTimeout(onTickFn, 1000)
} }
} }
const refreshFn = () => { const refreshFn = () => {
@ -245,7 +244,7 @@ $().ready(() => {
$(document).trigger("thread_manual_refresh") $(document).trigger("thread_manual_refresh")
} else { } else {
cont(floaterLinkBox, x => x.remove()) floaterLinkBox?.remove()
floaterLinkBox = null floaterLinkBox = null
statReplies = null statReplies = null
statFiles = null statFiles = null

View File

@ -3,71 +3,39 @@
* @author jonsmy * @author jonsmy
*/ */
function cont(value_to_test, fn) {
if (value_to_test != null) {
return fn(value_to_test);
} else {
return null;
}
}
const assert = { const assert = {
"equal": (actual, expected, message="No message set") => { "equal": (actual, expected, message="No message set") => {
if (actual !== expected) { if (actual !== expected) {
const err = new Error(`Assertion Failed. ${message}`); const err = new Error(`Assertion Failed. ${message}`)
err.data = { actual, expected} err.data = { actual, expected}
//Error.captureStackTrace?.(err, assert.equal); Error.captureStackTrace?.(err, assert.equal)
debugger; debugger
throw err; throw err
} }
}, },
"ok": (actual, message="No message set") => { "ok": (actual, message="No message set") => {
if (!actual) { if (!actual) {
const err = new Error(`Assertion Failed. ${message}`); const err = new Error(`Assertion Failed. ${message}`)
err.data = { actual } err.data = { actual }
//Error.captureStackTrace?.(err, assert.ok); Error.captureStackTrace?.(err, assert.ok)
debugger; debugger
throw err; throw err
} }
} }
}; }
if (AbortSignal.any == null) {
AbortSignal.any = (signals) => {
const controller = new AbortController();
const abortFn = () => {
for (const signal of signals) {
signal.removeEventListener("abort", abortFn);
}
controller.abort();
}
AbortSignal.any ??= function (signals) {
const controller = new AbortController()
const abortFn = () => {
for (const signal of signals) { for (const signal of signals) {
signal.addEventListener("abort", abortFn); signal.removeEventListener("abort", abortFn)
} }
controller.abort()
return controller.signal;
} }
}
// polyfill for replaceChildren for (const signal of signals) {
if( Node.prototype.replaceChildren === undefined) { signal.addEventListener("abort", abortFn)
Node.prototype.replaceChildren = function(addNodes) {
while(this.lastChild) {
this.removeChild(this.lastChild);
}
if (addNodes !== undefined) {
this.append(addNodes);
}
} }
}
if (Array.prototype.at === undefined) { return controller.signal
Array.prototype.at = function(index) {
if (index >= 0) {
return this[index];
} else {
return this[this.length + index];
}
};
} }

View File

@ -25,7 +25,7 @@ $(document).ready(function(){
else else
return; return;
$post = $('#reply_' + id + ', #op_' + id); $post = $('#reply_' + id);
if($post.length == 0) if($post.length == 0)
return; return;
@ -46,9 +46,9 @@ $(document).ready(function(){
}); });
}; };
$('div.post').each(showBackLinks); $('div.post.reply').each(showBackLinks);
$(document).on('new_post', function(e, post) { $(document).on('new_post', function(e, post) {
if ($(post).hasClass("reply")) { if ($(post).hasClass("reply")) {
showBackLinks.call(post); showBackLinks.call(post);
} }

View File

@ -152,7 +152,7 @@ $(document).ready(function(){
$('.boardlist').append('<span>[ <a class="watchlist-toggle" href="#">'+_('watchlist')+'</a> ]</span>'); $('.boardlist').append('<span>[ <a class="watchlist-toggle" href="#">'+_('watchlist')+'</a> ]</span>');
$('.compact-boardlist').append('<span>[ <a class="watchlist-toggle" href="#">'+_('watchlist')+'</a> ]</span>'); $('.compact-boardlist').append('<span>[ <a class="watchlist-toggle" href="#">'+_('watchlist')+'</a> ]</span>');
//Append a watch thread button after every OP. //Append a watch thread button after every OP.
$('.op>.intro>a:last').after('<a class="watchThread" href="#">['+_('Watch Thread')+']</a>'); $('.op>.intro').append('<a class="watchThread" href="#">['+_('Watch Thread')+']</a>');
//Draw the watchlist, hidden. //Draw the watchlist, hidden.
watchlist.render(); watchlist.render();

View File

@ -455,9 +455,7 @@ function validate_images(array $post_array) {
} }
function handle_post(){ function handle_post(){
global $config, $dropped_post, $board, $mod, $pdo, $debug; global $config,$dropped_post,$board, $mod,$pdo;
$time_1 = microtime(true);
init_global_post_cleanup(); init_global_post_cleanup();
@ -471,8 +469,6 @@ function handle_post(){
if (!openBoard($post['board'])) if (!openBoard($post['board']))
error($config['error']['noboard']); error($config['error']['noboard']);
$debug['time']['post'] = array();
$board_locked_check = (!isset($_POST['mod']) || !$_POST['mod']) $board_locked_check = (!isset($_POST['mod']) || !$_POST['mod'])
&& ($config['board_locked']===true && ($config['board_locked']===true
|| (is_array($config['board_locked']) && in_array(strtolower($_POST['board']), $config['board_locked']))); || (is_array($config['board_locked']) && in_array(strtolower($_POST['board']), $config['board_locked'])));
@ -554,14 +550,10 @@ function handle_post(){
error($config['error']['referer']); error($config['error']['referer']);
} }
$time_dnsbl = microtime(true);
checkDNSBL(); checkDNSBL();
$debug['time']['post']['dnsbl'] = round((microtime(true) - $time_dnsbl) * 1000, 2) . 'ms';
$time_ban = microtime(true);
// Check if banned // Check if banned
checkBan($board['uri']); checkBan($board['uri']);
$debug['time']['post']['check_ban'] = round((microtime(true) - $time_ban) * 1000, 2) . 'ms';
if ($post['mod'] = isset($_POST['mod']) && $_POST['mod']) { if ($post['mod'] = isset($_POST['mod']) && $_POST['mod']) {
check_login(false); check_login(false);
@ -601,10 +593,6 @@ function handle_post(){
else { else {
$mod = $post['mod'] = false; $mod = $post['mod'] = false;
} }
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer1'] = round(($time_rolling2 - $time_1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
//Check if thread exists //Check if thread exists
if (!$post['op']) { if (!$post['op']) {
@ -621,9 +609,6 @@ function handle_post(){
$thread = false; $thread = false;
} }
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer2'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
// Check for an embed field // Check for an embed field
if ($config['enable_embedding'] && isset($_POST['embed']) && !empty($_POST['embed'])) { if ($config['enable_embedding'] && isset($_POST['embed']) && !empty($_POST['embed'])) {
@ -724,10 +709,6 @@ function handle_post(){
} }
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer3'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
$post['name'] = $_POST['name'] != '' ? $_POST['name'] : $config['anonymous']; $post['name'] = $_POST['name'] != '' ? $_POST['name'] : $config['anonymous'];
$post['subject'] = $_POST['subject']; $post['subject'] = $_POST['subject'];
$post['email'] = str_replace(' ', '%20', htmlspecialchars($_POST['email'])); $post['email'] = str_replace(' ', '%20', htmlspecialchars($_POST['email']));
@ -771,10 +752,6 @@ function handle_post(){
} }
} }
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer4'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
if ($post['has_file']) { if ($post['has_file']) {
// Determine size sanity // Determine size sanity
$size = 0; $size = 0;
@ -810,10 +787,6 @@ function handle_post(){
$post['filesize'] = $size; $post['filesize'] = $size;
} }
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer5'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
$post['capcode'] = false; $post['capcode'] = false;
if ($mod && preg_match('/^((.+) )?## (.+)$/', $post['name'], $matches)) { if ($mod && preg_match('/^((.+) )?## (.+)$/', $post['name'], $matches)) {
@ -897,10 +870,6 @@ function handle_post(){
} }
} }
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer6'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
if ($config['strip_combining_chars']) { if ($config['strip_combining_chars']) {
$post['name'] = strip_combining_chars($post['name']); $post['name'] = strip_combining_chars($post['name']);
$post['email'] = strip_combining_chars($post['email']); $post['email'] = strip_combining_chars($post['email']);
@ -1060,13 +1029,6 @@ function handle_post(){
validate_images($post); validate_images($post);
$time_rolling2 = microtime(true);
$debug['time']['post']['pre_noticer7'] = round(($time_rolling2 - $time_rolling1) * 1000, 2) . 'ms';
$time_rolling1 = $time_rolling2;
$time_2 = microtime(true);
$debug['time']['post']['pre_noticer_total'] = round(($time_2 - $time_1) * 1000, 2) . 'ms';
if ($config['spam_noticer']['enabled']) { if ($config['spam_noticer']['enabled']) {
require_once 'inc/spamnoticer.php'; require_once 'inc/spamnoticer.php';
@ -1076,10 +1038,6 @@ function handle_post(){
$spam_noticer_result = checkWithSpamNoticer($config, $post, $board['uri']); $spam_noticer_result = checkWithSpamNoticer($config, $post, $board['uri']);
if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
}
/* /*
* If we have an error with posting this later, send back the * If we have an error with posting this later, send back the
* delete token to spamnoticer to remove the post from the recent * delete token to spamnoticer to remove the post from the recent
@ -1091,11 +1049,11 @@ function handle_post(){
push_global_post_cleanup($f_spamnoticer_cleanup_on_err); push_global_post_cleanup($f_spamnoticer_cleanup_on_err);
$debug['time']['post']['spam_noticer'] = round((microtime(true) - $time_2) * 1000, 2) . 'ms'; if ($spam_noticer_result->succeeded && $spam_noticer_result->noticed) {
error($config['error']['spam_noticer'] . $spam_noticer_result->reason);
}
} }
$time_3 = microtime(true);
if ($post['has_file']) { if ($post['has_file']) {
foreach ($post['files'] as $key => &$file) { foreach ($post['files'] as $key => &$file) {
if ($file['is_an_image']) { if ($file['is_an_image']) {
@ -1536,10 +1494,6 @@ function handle_post(){
$thread_id = $post['op'] ? $id : $post['thread']; $thread_id = $post['op'] ? $id : $post['thread'];
$time_end = microtime(true);
$debug['time']['post']['post_noticer'] = round(($time_end - $time_3) * 1000, 2) . 'ms';
$debug['time']['post']['total'] = round(($time_end - $time_1) * 1000, 2) . 'ms';
$rendered_thread = buildThread($thread_id); $rendered_thread = buildThread($thread_id);
if ($config['syslog']) if ($config['syslog'])

View File

@ -9,21 +9,34 @@ body {
font-size: 15px; font-size: 15px;
} }
.theme-catalog .replies {
font-family: serif;
}
div.post div.body {
font-family: serif;
}
span.heading { span.heading {
font-size: 15px; font-size: 15px;
} }
.theme-catalog .replies .meta,
.theme-catalog .replies .intro,
div.post div.body a,
div.post div.body .toolong {
font-family: Courier, monospace;
}
/* LINKS */ /* LINKS */
a, a:link, a:visited, .intro a.email span.name { a, a:link, a:visited, .intro a.email span.name {
color: #FFB300; color: #FFB300;
text-decoration: none; text-decoration: none;
} }
a:link:hover, a:visited:hover { a:link:hover, a:visited:hover {
color: #FFB300; color: #FFB300;
text-shadow: 0px 0px 5px #117743; text-shadow: 0px 0px 5px #117743;
} }
div.pages a.selected { div.pages a.selected {
color: #FFB300; color: #FFB300;
} }
@ -31,14 +44,13 @@ div.pages a.selected {
/* INTRO */ /* INTRO */
h1, div.title, header div.subtitle { h1, div.title, header div.subtitle {
color: #FFB300; color: #FFB300;
font-family: Courier, monospace;
} }
h1 { h1 {
font-size: 18pt; font-size: 18pt;
font-weight: bold; font-weight: bold;
letter-spacing: 0px; letter-spacing: 0px;
} }
header div.subtitle { header div.subtitle {
font-size: 10pt; font-size: 10pt;
} }