[show modes: view create_thread mark_as_read] [begin mode mark_as_read] [children("mark_read", _id); refresh_to({/?id=[_parent]}, 1);] Marked! <b><a href="/?id=[_parent]">Back to [get_title(_parent)].</a></b> [end mode mark_as_read] [begin mode mark_read][ children("mark_read", _id); ][end mode mark_read] [begin mode abbr] [ ndd = retrieve({ select post.date, post.author from entries thread inner join entries post on post.parent = thread.id where thread.parent = [_id] order by post.id desc limit 1; }); if(has_key(ndd, "0")) {[ newest_age = soft_age(ndd.0.date) & " ago"; newest_author = ndd.0.author; newest_author_profile = get_profile_id(newest_author); ]} else {[ newest_age = "never"; newest_author = 0; ]}; ncs = children("postquery", _id); nqc = 0; mute foreach(ncs) nqc += _data; if(nqc == 0) msg_start() else msg_start({border-color: #0086b6;}, "new_post"); ] <table style="width: 100%"> <tr><td> <a href="/?id=[_id]" style="font-size: 140%;">[_title]</a> <div style="font-size: 70%">last new post <span title="[ndd.0.date]">[newest_age]</a> by [ if(newest_author == 0) { no one } else if(newest_author_profile > 0) { <a href="/?id=[newest_author_profile]">[uid2name(newest_author)]</a> } else uid2name(newest_author); ]</div> [_body] [if(nqc > 0) { <td style="width: 70px"> <table style="width: 100%; border-collapse: collapse;"><tr><td style="font-size: 80%; text-align: center; border-bottom: 1px rgba(128, 128, 128, 0.2) solid;">new posts <tr><td style="text-align: center; font-weight: bold">[nqc] </table> }] <td style="width: 50px"> <table style="width: 100%; border-collapse: collapse;"><tr><td style="font-size: 80%; text-align: center; border-bottom: 1px rgba(128, 128, 128, 0.2) solid;">threads <tr><td style="text-align: center; font-weight: bold">[cs = linesplit(children("id", _id)); count(cs)] </table> </table> [msg_end()] [end mode abbr] [begin mode view] [ _forum_updater(); msg(_body); if(can_comment()) { <center><b><a href="/?id=[_id]&mode=create_thread">create thread</a></b></center> }; q = query("threads", 50, "date DESC, id DESC, title", "parent", _id); query_run("abbr", q); np = next_page(q); pp = previous_page(q); pl = page_list(q, 0); if((pp == "-1") && (np == "-1")) {} else if(pp == "-1") msg({[pl] <a href="[np]">next</a>}) else if(np == "-1") msg({<a href="[pp]">previous</a> [pl]}) else msg({<a href="[pp]">previous</a> [pl] <a href="[np]">next</a>}); ] [end mode view] [begin mode create_thread] [ _forum_updater(); _postform(); override_title(_title, "Create New Thread"); override_parent("/?id=" & _id, _title); ] [end mode create_thread] [begin mode preview][ override_title("Preview Thread", _title); _postform(_params.title, _params.body); ][end mode preview] [begin mode post] [ if(_params.title == "") { <p><b>Couldn't post the thread!</b></p> <p>Please don't give a blank thread title!</p> <p><b><a href="##" onClick="history.go(-1); return false;">Go back.</a></b></p> } else {[ thread = _generate(_id, _params.title, title2id("Thread"), ""); if(thread == -1) { <p><b>Couldn't post the thread!</b></p> <p>Maybe the title was already used?</p> <p><b><a href="##" onClick="history.go(-1); return false;">Go back.</a></b></p> } else {[ set_group(thread, _group); set_permissions(thread, "cadrecadrec-dr-c-dr-"); post = _generate(thread, _params.title, title2id("Linear Post"), _params.body); set_body(thread, {<!>origin=[post]}); if(post == -1) { [delete_page(thread)] <p><b>Couldn't post the first thread post!</b></p> <p>I really don't know why that would happen. Oops.</p> <p><b><a href="##" onClick="history.go(-1); return false;">Go back.</a></b></p> } else { [ @the_post = (import entry post); locstyle = getu("locstyle"); if(locstyle == "country") {[ locinfo = ip2location(_viewer.ip); @the_post.location = locinfo.geoplugin_countryName; ]} else if(locstyle == "city") {[ locinfo = ip2location(_viewer.ip); @the_post.location = {[locinfo.geoplugin_city], [locinfo.geoplugin_countryName]}; ]} else {[ @the_post.location = ""; ]}; refresh_to({/?id=[_id]}, 1); ] <p>Done! <b><a href="/?id=[_id]">Click here to go view it.</a></b></p> [putu("posts", getu("posts") + 1)] }; ]}; ]}; ] [end mode post]