init 4chan

This commit is contained in:
skidoodle 2025-04-17 09:20:34 +02:00
commit c850337f1e
Signed by: albert
SSH key fingerprint: SHA256:Cu/S7e7NSLXxcxcBsxd0qtCy6TJiN24ptIdit5aQXyI
390 changed files with 195936 additions and 0 deletions

738
views/imgboard-test.php Normal file
View file

@ -0,0 +1,738 @@
<?
function form( &$dat, $resno, $admin = '', $isreptemp = false, $stripm = false )
{
global $log, $thread_unique_ips;
log_cache( 0, $resno );
$maxbyte = MAX_KB * 1024;
$no = $resno;
$closed = 0;
$msg = $hidden = '';
$comlen = MAX_COM_CHARS;
if( $resno ) {
$closed = $log[$resno]['closed'] || $log[$resno]['archived'];
if( !$stripm ) {
$msg .= '<div class="navLinks mobile">
<span class="mobileib button"><a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a></span> <span class="mobileib button"><a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a></span> <span class="mobileib button"><a href="#bottom">' . S_BOTTOM . '</a></span> <span class="mobileib button"><a href="#top_r" id="refresh_top">' . S_REFRESH . '</a></span>
</div>';
}
if( !$stripm ) $msg .= '<div id="mpostform"><a href="#" class="mobilePostFormToggle mobile hidden button">' . S_FORM_REPLY . '</a></div>';
}
else {
if( !$stripm ) $msg .= '
<div class="navLinks mobile">
<span class="mobileib button"><a href="#bottom">' . S_BOTTOM . '</a></span> <span class="mobileib button"><a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a></span> <span class="mobileib button"><a href="#top_r" id="refresh_top">' . S_REFRESH . '</a></span>
</div>
<div id="mpostform"><a href="#" class="mobilePostFormToggle mobile hidden button">' . S_FORM_THREAD . '</a></div>';
}
if( $admin ) {
$hidden = '<input type="hidden" name="admin" value="' . ADMIN_PASS . '">';
$msg = '<h4>' . S_NOTAGS . '</h4>';
}
if ($closed != 1 || (BOARD_DIR === 'qa' && $log[$resno]['capcode'] !== 'none')) {
$dat .= $msg;
form_ads( $dat );
$hidden = STATS_USER_JS ? '<input type="hidden" name="hasjs" id="hasjs" class="hasjs" value="">' : '';
$dat .= '
<form name="post" action="' . SELF_PATH_POST . '" method="post" enctype="multipart/form-data">
' . $hidden . ( !TEXT_ONLY ? ('
<input type="hidden" name="MAX_FILE_SIZE" value="' . $maxbyte . '">') : '') . '
<input type="hidden" name="mode" value="regist">
<input id="postPassword" name="pwd" type="hidden">';
if( $no ) {
$dat .= '
<input type="hidden" name="resto" value="' . $no . '">
';
}
if (FORCED_ANON) {
$dat .= '
<input name="name" type="hidden">
';
}
$dat .= '<div id="togglePostFormLink" class="desktop">[<a href="#">'
. ($resno ? S_FORM_REPLY : S_FORM_THREAD)
. '</a>]</div><table class="postForm hideMobile" id="postForm">
<tbody>
';
$spoilers = '';
if( SPOILERS == 1 ) {
$spoilers = '<span class="desktop">[<label><input type="checkbox" name="spoiler" value="on" tabindex="9">' . S_SPOILERS . '</label>]</span>';
}
if (!FORCED_ANON) {
$dat .= '
<tr data-type="Name">
<td>' . S_NAME . '</td>
<td><input name="name" type="text" tabindex="1" placeholder="' . S_ANONAME. '"></td>
</tr>';
}
if ($spoilers && !$stripm && !TEXT_ONLY) {
$dat .= '
<tr class="mobile" data-type="Spoilers">
<td>' . S_SPOILERS . '</td>
<td class="mobileSpoiler">[<label><input type="checkbox" name="spoiler" value="on">' . S_SPOILERS . '</label>]</td>
</tr>
';
}
if (!$resno && !FORCED_ANON) {
$attr = TEXT_ONLY ? ' required' : '';
$dat .= '
<tr data-type="Options">
<td>' . S_EMAIL . '</td>
<td><input name="email" type="text" tabindex="2"></td>
</tr>
<tr data-type="Subject">
<td>' . S_SUBJECT . '</td>
<td><input name="sub"' . $attr . ' type="text" tabindex="3"><input type="submit" value="' . S_SUBMIT . '" tabindex="10"></td>
</tr>';
}
else {
$dat .= '
<tr data-type="Options">
<td>' . S_EMAIL . '</td>
<td><input name="email" type="text" tabindex="2"><input type="submit" value="' . S_SUBMIT . '" tabindex="10"></td>
</tr>';
}
$dat .= '
<tr data-type="Comment">
<td>' . S_COMMENT . '</td>
<td><textarea name="com" cols="48" rows="4" wrap="soft" tabindex="4"></textarea></td>
</tr>
';
if (CAPTCHA == 1) {
$dat .= '
<tr id="captchaFormPart">
<td class="desktop">' . S_CAPTCHA . '</td>
<td colspan="2">' . (CAPTCHA_TWISTER ? twister_captcha_form() : captcha_form()) . '<div class="passNotice">' . S_PASS_NOTICE . '</div></td>
</tr>
';
}
if (ENABLE_BOARD_FLAGS) {
$board_flags_selector = get_board_flags_selector();
if (SHOW_COUNTRY_FLAGS) {
$opts_html = '<option value="0">Geographic Location</option>';
}
else {
$opts_html = '<option value="0">None</option>';
}
foreach ($board_flags_selector as $flag_code => $flag_name) {
$opts_html .= '<option value="' . $flag_code . '">' . $flag_name . '</option>';
}
$dat .= '
<tr data-type="Flag">
<td>' . S_FLAG . '</td>
<td><select name="flag" class="flagSelector">' . $opts_html . '</select></td>
</tr>
';
}
$need_file_form = false;
if ($_GET['mode'] != 'oe_finish') {
if ((!TEXT_ONLY || (TEXT_ONLY_ALLOW_OP && !$resno)) && MAX_IMGRES != 0) {
$need_file_form = true;
}
}
if ($need_file_form) {
$dat .= '<tr data-type="File">
<td>' . S_UPLOADFILE . '</td>
<td><input id="postFile" name="upfile" type="file" tabindex="8">
' . $spoilers;
if( !$resno && NO_TEXTONLY != 1 ) {
$dat .= '[<label><input type="checkbox" name="textonly" value="on">' . S_NOFILE . '</label>]';
}
$dat .= '</tr>';
if (ENABLE_PAINTERJS) {
$dat .= '<tr data-type="Painter" class="desktop">
<td>Draw</td>
<td class="painter-ctrl">Size <input type="text" value="'
. PAINTERJS_DIMS . '" maxlength="4"> &times; <input type="text" value="'
. PAINTERJS_DIMS . '" maxlength="4"> ';
if (ENABLE_OEKAKI_REPLAYS) {
$dat .= '<label title="Generate a replay animation of your drawing"><input type="checkbox" checked class="oe-r-cb">Replay</label> ';
}
$dat .= '<button data-dims="'
. PAINTERJS_DIMS . '" type="button">Draw</button> <button disabled type="button">Clear</button></td>
</tr>';
}
}
if ($resno && SHOW_THREAD_UNIQUES) {
$unique = $thread_unique_ips;
if ($unique) {
$unique_plural = $unique > 1 ? 'are' : 'is';
$unique = sprintf("<li> There $unique_plural " . S_UNIQUE_POSTS_TH . '</li>', $unique, $unique > 1 ? 's' : '');
}
else {
$unique = '';
}
}
elseif (SHOW_UNIQUES) {
$unique = sprintf('<li>' . S_UNIQUE_POSTS . '</li>', $GLOBALS['ipcount']);
}
else {
$unique = '';
}
$blotter = get_blotter();
// XXX: mode=regist moved to the top
$dat .= '
<tr class="rules">
<td colspan="2">
<ul class="rules">
' . S_RULES . '
' . $unique . '
</ul>
</td>
</tr>
';
$dat .= '
</tbody>
<tfoot><tr><td colspan="2"><div id="postFormError"></div></td></tr></tfoot>
</table>' . $blotter . '
</form>
' . (!$resno ? EMBED_INDEX : '');
} else { // Closed thread
form_ads( $dat );
if( !$stripm ) $dat .= '
<div class="navLinks mobile">
<span class="mobileib button"><a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a></span> <span class="mobileib button"><a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a></span> <span class="mobileib button"><a href="#bottom">' . S_BOTTOM . '</a></span> <span class="mobileib button"><a href="#top_r" id="refresh_top">' . S_REFRESH . '</a></span>
</div>
<hr class="mobile">';
if ($log[$resno]['archived']) {
$dat .= '<div class="closed">' . S_THREAD_ARCHIVED . '</div>';
}
else {
$dat .= '<div class="closed">' . S_THREAD_CLOSED . '</div>';
}
}
if( AD_MIDDLE_ENABLE == 1 ) {
$middlead = "";
if( defined( "AD_MIDDLE_TEXT" ) && AD_MIDDLE_TEXT ) {
$middlead .= '<hr class="aboveMidAd"><div class="middlead center ad-cnt">' . ad_text_for( AD_MIDDLE_TEXT ) . '</div>' . (defined('AD_MIDDLE_PLEA') ? AD_MIDDLE_PLEA : '');
} else if( defined( "AD_MIDDLE_TABLE" ) && AD_MIDDLE_TABLE ) {
list( $middleimg, $middlelink ) = rid( AD_MIDDLE_TABLE, 1 );
$middlead .= "<hr><div class=\"center\"><a href=\"$middlelink\" target=\"_blank\"><img class=\"middlead\" src=\"$middleimg\" alt=\"\"></a></div>";
}
if( $middlead ) {
$dat .= "$middlead";
}
}
else if (!$stripm) { // not for catalog
// Contest banners
$dat .= '<hr class="aboveMidAd"><div class="middlead center">' . get_contest_banner() . '</div>';
}
if (!$resno || !$closed) {
list($globalmsgtxt,$globalmsgdate) = global_msg_txt();
if( $globalmsgtxt ) {
$dat .= "\n<hr><a href=\"#\" class=\"button redButton mobile hidden\" id=\"globalToggle\">" . S_VIEW_GMSG . "</a><div class=\"globalMessage hideMobile\" id=\"globalMessage\" data-utc=\"$globalmsgdate\">" . $globalmsgtxt . "</div>\n";
}
}
// Catalog
if ($stripm) {
if (defined('AD_CUSTOM_TOP') && AD_CUSTOM_TOP) {
$dat .= '<div><hr>' . AD_CUSTOM_TOP . '</div>';
}
/*else if (defined('AD_ABC_TOP_DESKTOP') && AD_ABC_TOP_DESKTOP) {
$dat .= '<div class="adg-rects desktop"><hr><div class="adg adp-90" data-abc="' . AD_ABC_TOP_DESKTOP . '"></div></div>';
}
else if (defined('AD_BIDGEAR_TOP') && AD_BIDGEAR_TOP) {
$dat .= '<div class="adc-resp-bg" data-ad-bg="' . AD_BIDGEAR_TOP . '"><hr></div>';
}*/
else if (defined('ADS_DANBO') && ADS_DANBO) {
$dat .= '<hr><div id="danbo-s-t" class="danbo-slot"></div><div class="adl">[<a target="_blank" href="https://www.4chan.org/advertise">Advertise on 4chan</a>]</div>';
}
}
// Not catalog
else if (defined('AD_CUSTOM_TOP') && AD_CUSTOM_TOP) {
$dat .= '<div><hr>' . AD_CUSTOM_TOP . '</div>';
}
/*else if (defined('AD_ABC_TOP_DESKTOP') && AD_ABC_TOP_DESKTOP) {
$dat .= '<div class="adg-rects desktop"><hr><div class="adg adp-90" data-abc="' . AD_ABC_TOP_DESKTOP . '"></div></div>';
}
else if (defined('AD_BIDGEAR_TOP') && AD_BIDGEAR_TOP) {
$dat .= '<div class="adc-resp-bg" data-ad-bg="' . AD_BIDGEAR_TOP . '"><hr></div>';
}*/
else if (defined('ADS_DANBO') && ADS_DANBO) {
$dat .= '<hr><div id="danbo-s-t" class="danbo-slot"></div><div class="adl">[<a target="_blank" href="https://www.4chan.org/advertise">Advertise on 4chan</a>]</div>';
}
if ($resno) {
$dat .= '<hr class="desktop" id="op">
<div class="navLinks desktop">
[<a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a>] [<a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a>] [<a href="#bottom">' . S_BOTTOM . '</a>]
</div>
';
}
if( JANITOR_BOARD == 1 ) {
$dat = broomcloset_form( $dat );
}
}
function updatelog_real( $resno = 0, $noidx = 0, $lazy_rebuild = false )
{
global $log, $mode, $index_rbl, $board_flags_array;
if (ENABLE_BOARD_FLAGS) {
$board_flags_array = get_board_flags_array();
}
if( !IS_REBUILDD ) set_time_limit( 60 );
// DDOS Protection
if( $_SERVER['REQUEST_METHOD'] == 'GET' && !has_level() ) {
die();
}
if( STATIC_REBUILD && $mode != 'nothing' ) {
$noidx = 1;
}
if( !$resno && $noidx ) {
return;
}
log_cache( 0, $noidx ? $resno : 0 );
// Image directories
/*
$imgdir = ( ( USE_SRC_CGI == 1 ) ? str_replace( 'src', 'src.cgi', IMG_DIR2 ) : IMG_DIR2 );
if( defined( 'INTERSTITIAL_LINK' ) ) {
$imgdir .= INTERSTITIAL_LINK;
}
*/
$resno = (int)$resno;
$inter_ad_html = null;
if( $resno ) {
if( !isset( $log[$resno] ) ) {
updatelog_real( 0, $noidx );
return;
} elseif( $log[$resno]['resto'] ) {
updatelog_real( $log[$resno]['resto'], $noidx );
return;
}
// Inter-reply ads
$inter_ad_html = '';
if (defined('AD_ABC_TOP_MOBILE') && AD_ABC_TOP_MOBILE) {
$inter_ad_html .= '<div class="adg-rects mobile"><hr><div class="adg-m adp-250" data-abc="' . AD_ABC_TOP_MOBILE . '"></div><hr></div>';
}
if (defined('AD_ABC_TOP_DESKTOP') && AD_ABC_TOP_DESKTOP) {
$inter_ad_html .= '<div class="adg-rects desktop adg-rep"><hr><div class="adg adp-90" data-abc="' . AD_ABC_TOP_DESKTOP . '"></div><hr></div>';
}
if ($inter_ad_html === '') {
$inter_ad_html = null;
}
}
if( $resno ) {
logtime( "Generating thread JSON" );
if (ENABLE_JSON) {
$tailSize = get_json_tail_size($resno);
if ($tailSize) {
generate_thread_json($resno, false, false, false, $tailSize);
}
generate_thread_json($resno);
}
$treeline = array($resno);
logtime( "Formatting thread page" );
} else {
logtime( "Generating index JSON" );
if( ENABLE_JSON_INDEXES ) generate_index_json();
if( ENABLE_JSON_CATALOG ) generate_board_catalogue();
if( ENABLE_JSON_THREADS ) {
generate_board_threads_json();
}
$treeline = $log['THREADS'];
logtime( "Formatting index page" );
}
$counttree = count( $treeline );
if( !$counttree ) {
$logfilename = SELF_PATH2_FILE;
$dat = '';
head( $dat, $resno );
form( $dat, $resno );
print_page( $logfilename, $dat );
$dat = '';
}
$st = 0;
$p = 0;
if ($lazy_rebuild) {
$start_page = $index_rbl * DEF_PAGES;
}
else {
$start_page = 0;
}
$index_page_ad_pos = ceil(DEF_PAGES / 2);
if (defined('REPLIES_SHOWN')) {
$shown_replies_default = REPLIES_SHOWN;
}
else {
$shown_replies_default = 5;
}
for( $page = $start_page; $page < $counttree; $page += DEF_PAGES ) {
$file_page_num = $page / DEF_PAGES + 1;
if (PAGE_MAX && $file_page_num > PAGE_MAX) {
break;
}
$dat = '';
head( $dat, $resno, 0, $page, $counttree );
form( $dat, $resno );
if( !$resno ) {
$st = $page;
$dat .= '<div id="ctrl-top" class="desktop"><hr><input type="text" id="search-box" placeholder="'. S_SEARCH .
'"> [<a href="' . SELF_PATH2 . 'catalog">' . S_CATALOG . '</a>]';
if (ENABLE_ARCHIVE) {
$dat .= ' [<a href="' . SELF_PATH2 . 'archive">' . S_ARCHIVE . '</a>]';
}
$dat .= '</div>';
if (floor( $page / DEF_PAGES ) > $index_rbl) {
return;
}
}
// Post form / board container container start.
$dat .= '<hr>
<form name="delform" id="delform" action="' . SELF_PATH_ABS . '" method="post">
<div class="board">
';
$index_page_th_id = 0;
for( $i = $st; $i < $st + DEF_PAGES; $i++ ) {
$no = $treeline[$i];
if (!$no) {
break;
}
/*
if (!isset($log[$no]['children'])) {
log_bad_cache_entry($no);
}
*/
$sorted_replies = $log[$no]['children'];
ksort($sorted_replies);
// Party hats
$party = PARTY ? '<img src="' . STATIC_IMG_DIR2 . PARTY_IMAGE
. '" class="party-hat">' : '';
// Omitted replies
$reply_count = $log[$no]['replycount'];
if ($log[$no]['sticky'] == 1) {
$shown_replies = min(1, $shown_replies_default);
}
else {
$shown_replies = $shown_replies_default;
}
// Open thread tag and render OP
$dat .= '<div class="thread" id="t' . $no . '">'
. $party
. renderPostHtml($no, $resno, $sorted_replies, $reply_count, $shown_replies);
// Render replies
if ($resno) {
$s = 0;
}
else {
$s = $reply_count - $shown_replies;
}
$repCount = 0;
if ($inter_ad_html && $reply_count >= 100) {
$middle_reply_idx = floor($reply_count / 2.0);
}
else {
$middle_reply_idx = 0;
}
while (list($resrow) = each($sorted_replies)) {
if( $s > 0 ) {
$s--;
continue;
}
if (!$log[$resrow]['no']) {
break;
}
$dat .= renderPostHtml($resrow, $resno);
$repCount++;
if ($repCount == $middle_reply_idx) {
$dat .= $inter_ad_html;
}
}
// Close thread tag
$dat .= '
</div>
<hr>
';
++$index_page_th_id;
if (!$resno && AD_INTERTHREAD_ENABLED && $index_page_ad_pos == $index_page_th_id) {
$dat .= AD_INTERTHREAD_TAG . '<hr>';
}
$p++;
if ($resno) {
break;
}
}
if ($resno) {
$dat .= '<div class="navLinks navLinksBot desktop">[<a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a>] [<a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a>] [<a href="#top">' . S_TOP . '</a>] </div><hr class="desktop">';
}
// Close board tag
$lang = $resno ? S_FORM_REPLY : S_FORM_THREAD;
$dat .= '
<div class="mobile center"><a class="mobilePostFormToggle button" href="#">' . $lang . '</a></div>
</div>';
if (!$resno) {
$dat .= '<div class="navLinks navLinksBot mobile"><span class="mobileib button"><a href="#top">' . S_TOP . '</a></span> <span class="mobileib button"><a href="#bottom_r" id="refresh_bottom">' . S_REFRESH . '</a></span></div><hr class="mobile">';
}
else {
$dat .= '<div class="navLinks mobile"><span class="mobileib button"><a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a></span> <span class="mobileib button"><a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a></span> <span class="mobileib button"><a href="#top">' . S_TOP . '</a></span> <span class="mobileib button"><a href="#bottom_r" id="refresh_bottom">' . S_REFRESH . '</a></span></div><hr class="mobile">';
}
/**
* ADS
*/
if (defined('AD_CUSTOM_BOTTOM') && AD_CUSTOM_BOTTOM) {
$dat .= '<div>' . AD_CUSTOM_BOTTOM . '<hr></div>';
}
/*
else if (defined('AD_ABC_BOTTOM_MOBILE') && AD_ABC_BOTTOM_MOBILE) {
$dat .= '<div class="adg-rects mobile"><div class="adg-m adp-250" data-abc="' . AD_ABC_BOTTOM_MOBILE . '"></div><hr></div>';
}
else if (defined('AD_BIDGEAR_BOTTOM') && AD_BIDGEAR_BOTTOM) {
$dat .= '<div class="adc-resp-bg" data-ad-bg="' . AD_BIDGEAR_BOTTOM . '"></div>';
}
*/
else if (defined('ADS_DANBO') && ADS_DANBO) {
$dat .= '<div id="danbo-s-b" class="danbo-slot"></div><div class="adl">[<a target="_blank" href="https://www.4chan.org/advertise">Advertise on 4chan</a>]</div><hr>';
}
if( $resno ) {
$resredir = '<input type="hidden" name="res" value="' . $resno . '">';
} else {
$resredir = '';
}
$dat .= '<div class="bottomCtrl desktop"><span class="deleteform"><input type="hidden" name="mode" value="usrdel">' . S_REPDEL . $resredir . ' [<input type="checkbox" name="onlyimgdel" value="on">' . S_DELPICONLY . ']<input type="hidden" id="delPassword" name="pwd"> <input type="submit" value="' . S_DELETE . '"><input id="bottomReportBtn" type="button" value="Report"></span>';
if( !defined( 'CSS_FORCE' ) ) {
$dat .= '<span class="stylechanger">Style:
<select id="styleSelector">
<option value="Yotsuba New">Yotsuba</option>
<option value="Yotsuba B New">Yotsuba B</option>
<option value="Futaba New">Futaba</option>
<option value="Burichan New">Burichan</option>
<option value="Tomorrow">Tomorrow</option>
<option value="Photon">Photon</option>';
if (defined('CSS_EVENT_NAME') && CSS_EVENT_NAME) {
$dat .= '<option value="_special">Special</option>';
}
$dat .= '</select>
</span>';
}
$dat .= '</div></form>';
if( !$resno ) {
$prev = $st - DEF_PAGES;
$next = $st + DEF_PAGES;
$dat .= '<div class="pagelist desktop"><div class="prev">';
$mpl = '<div class="mPagelist mobile">';
if( $prev >= 0 ) {
$link = ( $prev == 0 ) ? SELF_PATH2 : ( $prev / DEF_PAGES + 1 ) . PHP_EXT2;
$dat .= '<form class="pageSwitcherForm" action="' . $link . '">';
$dat .= '<input type="submit" value="' . S_PREV . '" accesskey="z"></form>';
$mprev = '<div class="prev"><a href="' . $link . '" class="button">' . S_PREV . '</a></div>';
} else {
$dat .= '<span>' . S_FIRSTPG . '</span> ';
$mprev = '';
}
$dat .= '</div><div class="pages">';
$mpl .= '<div class="pages">';
for( $i = 0; $i < $counttree; $i += DEF_PAGES ) {
$switcher_page_num = $i / DEF_PAGES + 1;
if (PAGE_MAX && $switcher_page_num > PAGE_MAX) {
break;
}
if( $st == $i ) {
$dat .= '[<strong><a href="">' . $switcher_page_num . '</a></strong>] ';
$mpl .= '<span>[<strong><a href="">' . $switcher_page_num . '</a></strong>]</span> ';
} else {
if( $i == 0 ) {
$dat .= '[<a href="' . SELF_PATH2 . '">1</a>] ';
$mpl .= '<span>[<a href="' . SELF_PATH2 . '">1</a>]</span> ';
} else {
$dat .= '[<a href="' . $switcher_page_num . PHP_EXT2 . '">' . $switcher_page_num . '</a>] ';
$mpl .= '<span>[<a href="' . $switcher_page_num . PHP_EXT2 . '">' . $switcher_page_num . '</a>]</span> ';
}
}
}
for( ; ( PAGE_MAX > 0 ) && $i < PAGE_MAX * DEF_PAGES; $i += DEF_PAGES ) {
$dat .= '[' . ( $i / DEF_PAGES + 1 ) . '] ';
$mpl .= '<span>[' . ( $i / DEF_PAGES + 1 ) . ']</span> ';
}
$dat .= '</div><div class="next">';
$mpl .= '<div class="mobileCatalogLink">[<a href="' . SELF_PATH2 . 'catalog">' . S_CATALOG . '</a>]</div></div>' . $mprev;
if( $p >= DEF_PAGES && $counttree > $next && $file_page_num != PAGE_MAX) {
$dat .= '<form class="pageSwitcherForm" action="' . ($next / DEF_PAGES + 1) . PHP_EXT2 . '">';
$dat .= '<input type="submit" value="' . S_NEXT . '" accesskey="x"></form>';
$mpl .= '<div class="next"><a href="' . ($next / DEF_PAGES + 1) . PHP_EXT2 . '" class="button">' . S_NEXT . '</a></div>';
} else {
$dat .= '<span>' . S_LASTPG . '</span>';
}
$catanav = ENABLE_CATALOG ? '<div class="pages cataloglink"><a href="' . SELF_PATH2 . 'catalog">' . S_CATALOG . '</a></div>' : '';
if (ENABLE_ARCHIVE) {
$catanav .= '<div class="pages cataloglink"><a href="'
. SELF_PATH2 . 'archive">' . S_ARCHIVE . '</a></div>';
}
// Close page navigator
$dat .= '</div>' . $catanav . '</div>';
$dat .= $mpl . '</div>';
}
if (true && (!$resno || (!$log[$resno]['closed'] && !$log[$resno]['archived']))) {
$dat .= '<script>(function(g){function d(b){h();k.call(b,"mode")&&l.call(b,"pwd",c)}function h(){if(!c)try{c=String(9*Math.random()+1).slice(2,10)}catch(b){c="?!"}}let c,e=document.forms.post;e&&e.pwd&&e.addEventListener("submit",function(){h();e.pwd.value=c});let m=g.FormData,f=m.prototype,n=f.append,l=f.set,p=f.delete,k=f.has;g.FormData=function(b){b=new m(b);d(b);try{b.append=function(...a){a=n.call(this,...a);d(this);return a},b.set=function(...a){a=l.call(this,...a);d(this);return a},b.delete=function(...a){a=p.call(this,...a);d(this);return a},b.has=function(...a){return k.call(this,...a)}}finally{return b}}})(window,navigator);</script>';
}
foot( $dat );
if( $resno ) {
logtime( 'Printing thread ' . $resno . ' page' );
$logfilename = RES_DIR . $resno . PHP_EXT;
print_page( $logfilename, $dat );
$dat = '';
if( !$noidx ) {
updatelog_real( 0 );
}
break;
}
logtime( "Printing index page" );
if ($page == 0) {
$logfilename = SELF_PATH2_FILE;
print_page($logfilename, $dat);
}
else {
$logfilename = INDEX_DIR . ($file_page_num) . PHP_EXT;
print_page($logfilename, $dat);
}
$dat = '';
if( !$resno && $page == 0 && USE_RSS == 1 ) {
include_once 'lib/rss.php';
rss_dump();
}
} // for
}
//wrapper function for forwarding updatelog calls
//resno - thread page to update (no of thread OP)
//noidx - don't rebuild page indexes
function updatelog( $resno = 0, $noidx = 0, $lazy_rebuild = false )
{
updatelog_real( $resno, $noidx, $lazy_rebuild );
if( !STATIC_REBUILD && ENABLE_CATALOG && !$noidx ) generate_catalog( true );
}
?>

739
views/imgboard.php Normal file
View file

@ -0,0 +1,739 @@
<?
function form( &$dat, $resno, $admin = '', $isreptemp = false, $stripm = false )
{
global $log, $thread_unique_ips;
log_cache( 0, $resno );
$maxbyte = MAX_KB * 1024;
$no = $resno;
$closed = 0;
$msg = $hidden = '';
$comlen = MAX_COM_CHARS;
if( $resno ) {
$closed = $log[$resno]['closed'] || $log[$resno]['archived'];
if( !$stripm ) {
$msg .= '<div class="navLinks mobile">
<span class="mobileib button"><a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a></span> <span class="mobileib button"><a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a></span> <span class="mobileib button"><a href="#bottom">' . S_BOTTOM . '</a></span> <span class="mobileib button"><a href="#top_r" id="refresh_top">' . S_REFRESH . '</a></span>
</div>';
}
if( !$stripm ) $msg .= '<div id="mpostform"><a href="#" class="mobilePostFormToggle mobile hidden button">' . S_FORM_REPLY . '</a></div>';
}
else {
if( !$stripm ) $msg .= '
<div class="navLinks mobile">
<span class="mobileib button"><a href="#bottom">' . S_BOTTOM . '</a></span> <span class="mobileib button"><a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a></span> <span class="mobileib button"><a href="#top_r" id="refresh_top">' . S_REFRESH . '</a></span>
</div>
<div id="mpostform"><a href="#" class="mobilePostFormToggle mobile hidden button">' . S_FORM_THREAD . '</a></div>';
}
if( $admin ) {
$hidden = '<input type="hidden" name="admin" value="' . ADMIN_PASS . '">';
$msg = '<h4>' . S_NOTAGS . '</h4>';
}
if ($closed != 1 || (BOARD_DIR === 'qa' && $log[$resno]['capcode'] !== 'none')) {
$dat .= $msg;
form_ads( $dat );
$hidden = STATS_USER_JS ? '<input type="hidden" name="hasjs" id="hasjs" class="hasjs" value="">' : '';
$dat .= '
<form name="post" action="' . SELF_PATH_POST . '" method="post" enctype="multipart/form-data">
' . $hidden . ( !TEXT_ONLY ? ('
<input type="hidden" name="MAX_FILE_SIZE" value="' . $maxbyte . '">') : '') . '
<input type="hidden" name="mode" value="regist">
<input id="postPassword" name="pwd" type="hidden">';
if( $no ) {
$dat .= '
<input type="hidden" name="resto" value="' . $no . '">
';
}
if (FORCED_ANON) {
$dat .= '
<input name="name" type="hidden">
';
}
$dat .= '<div id="togglePostFormLink" class="desktop">[<a href="#">'
. ($resno ? S_FORM_REPLY : S_FORM_THREAD)
. '</a>]</div><table class="postForm hideMobile" id="postForm">
<tbody>
';
$spoilers = '';
if( SPOILERS == 1 ) {
$spoilers = '<span class="desktop">[<label><input type="checkbox" name="spoiler" value="on" tabindex="9">' . S_SPOILERS . '</label>]</span>';
}
if (!FORCED_ANON) {
$dat .= '
<tr data-type="Name">
<td>' . S_NAME . '</td>
<td><input name="name" type="text" tabindex="1" placeholder="' . S_ANONAME. '"></td>
</tr>';
}
if ($spoilers && !$stripm && !TEXT_ONLY) {
$dat .= '
<tr class="mobile" data-type="Spoilers">
<td>' . S_SPOILERS . '</td>
<td class="mobileSpoiler">[<label><input type="checkbox" name="spoiler" value="on">' . S_SPOILERS . '</label>]</td>
</tr>
';
}
if (!$resno && !FORCED_ANON) {
$attr = TEXT_ONLY ? ' required' : '';
$dat .= '
<tr data-type="Options">
<td>' . S_EMAIL . '</td>
<td><input name="email" type="text" tabindex="2"></td>
</tr>
<tr data-type="Subject">
<td>' . S_SUBJECT . '</td>
<td><input name="sub"' . $attr . ' type="text" tabindex="3"><input type="submit" value="' . S_SUBMIT . '" tabindex="10"></td>
</tr>';
}
else {
$dat .= '
<tr data-type="Options">
<td>' . S_EMAIL . '</td>
<td><input name="email" type="text" tabindex="2"><input type="submit" value="' . S_SUBMIT . '" tabindex="10"></td>
</tr>';
}
$dat .= '
<tr data-type="Comment">
<td>' . S_COMMENT . '</td>
<td><textarea name="com" cols="48" rows="4" wrap="soft" tabindex="4"></textarea></td>
</tr>
';
if (CAPTCHA == 1) {
$dat .= '
<tr id="captchaFormPart">
<td class="desktop">' . S_CAPTCHA . '</td>
<td colspan="2">' . (CAPTCHA_TWISTER ? twister_captcha_form() : captcha_form()) . '<div class="passNotice">' . S_PASS_NOTICE . '</div></td>
</tr>
';
}
if (ENABLE_BOARD_FLAGS) {
$board_flags_selector = get_board_flags_selector();
if (SHOW_COUNTRY_FLAGS) {
$opts_html = '<option value="0">Geographic Location</option>';
}
else {
$opts_html = '<option value="0">None</option>';
}
foreach ($board_flags_selector as $flag_code => $flag_name) {
$opts_html .= '<option value="' . $flag_code . '">' . $flag_name . '</option>';
}
$dat .= '
<tr data-type="Flag">
<td>' . S_FLAG . '</td>
<td><select name="flag" class="flagSelector">' . $opts_html . '</select></td>
</tr>
';
}
$need_file_form = false;
if ($_GET['mode'] != 'oe_finish') {
if ($resno) {
if (!TEXT_ONLY && MAX_IMGRES != 0) {
$need_file_form = true;
}
}
else {
$need_file_form = true;
}
}
if ($need_file_form) {
$dat .= '<tr data-type="File">
<td>' . S_UPLOADFILE . '</td>
<td><input id="postFile" name="upfile" type="file" tabindex="8">
' . $spoilers;
if( !$resno && NO_TEXTONLY != 1 ) {
$dat .= '[<label><input type="checkbox" name="textonly" value="on">' . S_NOFILE . '</label>]';
}
$dat .= '</tr>';
if (ENABLE_PAINTERJS) {
$dat .= '<tr data-type="Painter" class="desktop">
<td>Draw</td>
<td class="painter-ctrl">Size <input type="text" value="'
. PAINTERJS_DIMS . '" maxlength="4"> &times; <input type="text" value="'
. PAINTERJS_DIMS . '" maxlength="4"> ';
if (ENABLE_OEKAKI_REPLAYS) {
$dat .= '<label title="Generate a replay animation of your drawing"><input type="checkbox" checked class="oe-r-cb">Replay</label> ';
}
$dat .= '<button data-dims="'
. PAINTERJS_DIMS . '" type="button">Draw</button> <button disabled type="button">Clear</button></td>
</tr>';
}
}
if ($resno && SHOW_THREAD_UNIQUES) {
$unique = $thread_unique_ips;
if ($unique) {
$unique_plural = $unique > 1 ? 'are' : 'is';
$unique = sprintf("<li> There $unique_plural " . S_UNIQUE_POSTS_TH . '</li>', $unique, $unique > 1 ? 's' : '');
}
else {
$unique = '';
}
}
elseif (SHOW_UNIQUES) {
$unique = sprintf('<li>' . S_UNIQUE_POSTS . '</li>', $GLOBALS['ipcount']);
}
else {
$unique = '';
}
$blotter = get_blotter();
// XXX: mode=regist moved to the top
$dat .= '
<tr class="rules">
<td colspan="2">
<ul class="rules">
' . S_RULES . '
' . $unique . '
</ul>
</td>
</tr>
';
$dat .= '
</tbody>
<tfoot><tr><td colspan="2"><div id="postFormError"></div></td></tr></tfoot>
</table>' . $blotter . '
</form>
' . (!$resno ? EMBED_INDEX : '');
} else { // Closed thread
form_ads( $dat );
if( !$stripm ) $dat .= '
<div class="navLinks mobile">
<span class="mobileib button"><a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a></span> <span class="mobileib button"><a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a></span> <span class="mobileib button"><a href="#bottom">' . S_BOTTOM . '</a></span> <span class="mobileib button"><a href="#top_r" id="refresh_top">' . S_REFRESH . '</a></span>
</div>
<hr class="mobile">';
if ($log[$resno]['archived']) {
$dat .= '<div class="closed">' . S_THREAD_ARCHIVED . '</div>';
}
else {
$dat .= '<div class="closed">' . S_THREAD_CLOSED . '</div>';
}
}
if( AD_MIDDLE_ENABLE == 1 ) {
$middlead = "";
if( defined( "AD_MIDDLE_TEXT" ) && AD_MIDDLE_TEXT ) {
$middlead .= '<hr class="aboveMidAd"><div class="middlead center ad-cnt">' . ad_text_for( AD_MIDDLE_TEXT ) . '</div>' . (defined('AD_MIDDLE_PLEA') ? AD_MIDDLE_PLEA : '');
} else if( defined( "AD_MIDDLE_TABLE" ) && AD_MIDDLE_TABLE ) {
list( $middleimg, $middlelink ) = rid( AD_MIDDLE_TABLE, 1 );
$middlead .= "<hr><div class=\"center\"><a href=\"$middlelink\" target=\"_blank\"><img class=\"middlead\" src=\"$middleimg\" alt=\"\"></a></div>";
}
if( $middlead ) {
$dat .= "$middlead";
}
}
else if (!$stripm) { // not for catalog
// Contest banners
$dat .= '<hr class="aboveMidAd"><div class="middlead center">' . get_contest_banner() . '</div>';
}
if (!$resno || !$closed) {
list($globalmsgtxt,$globalmsgdate) = global_msg_txt();
if( $globalmsgtxt ) {
$dat .= "\n<hr><a href=\"#\" class=\"button redButton mobile hidden\" id=\"globalToggle\">" . S_VIEW_GMSG . "</a><div class=\"globalMessage hideMobile\" id=\"globalMessage\" data-utc=\"$globalmsgdate\">" . $globalmsgtxt . "</div>\n";
}
}
// Catalog
if ($stripm) {
if (defined('AD_CUSTOM_TOP') && AD_CUSTOM_TOP) {
$dat .= '<div><hr>' . AD_CUSTOM_TOP . '</div>';
}
/*else if (defined('AD_ABC_TOP_DESKTOP') && AD_ABC_TOP_DESKTOP) {
$dat .= '<div class="adg-rects desktop"><hr><div class="adg adp-90" data-abc="' . AD_ABC_TOP_DESKTOP . '"></div></div>';
}
else if (defined('AD_BIDGEAR_TOP') && AD_BIDGEAR_TOP) {
$dat .= '<div class="adc-resp-bg" data-ad-bg="' . AD_BIDGEAR_TOP . '"><hr></div>';
}*/
else if (defined('ADS_DANBO') && ADS_DANBO) {
$dat .= '<hr><div id="danbo-s-t" class="danbo-slot"></div><div class="adl">[<a target="_blank" href="https://www.4chan.org/advertise">Advertise on 4chan</a>]</div>';
}
}
// Not catalog
else if (defined('AD_CUSTOM_TOP') && AD_CUSTOM_TOP) {
$dat .= '<div><hr>' . AD_CUSTOM_TOP . '</div>';
}
/*else if (defined('AD_ABC_TOP_DESKTOP') && AD_ABC_TOP_DESKTOP) {
$dat .= '<div class="adg-rects desktop"><hr><div class="adg adp-90" data-abc="' . AD_ABC_TOP_DESKTOP . '"></div></div>';
}
else if (defined('AD_BIDGEAR_TOP') && AD_BIDGEAR_TOP) {
$dat .= '<div class="adc-resp-bg" data-ad-bg="' . AD_BIDGEAR_TOP . '"><hr></div>';
}*/
else if (defined('ADS_DANBO') && ADS_DANBO) {
$dat .= '<hr><div id="danbo-s-t" class="danbo-slot"></div><div class="adl">[<a target="_blank" href="https://www.4chan.org/advertise">Advertise on 4chan</a>]</div>';
}
if ($resno) {
$dat .= '<hr class="desktop" id="op">
<div class="navLinks desktop">
[<a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a>] [<a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a>] [<a href="#bottom">' . S_BOTTOM . '</a>]
</div>
';
}
if( JANITOR_BOARD == 1 ) {
$dat = broomcloset_form( $dat );
}
}
function updatelog_real( $resno = 0, $noidx = 0, $lazy_rebuild = false )
{
global $log, $mode, $index_rbl, $board_flags_array;
if (ENABLE_BOARD_FLAGS) {
$board_flags_array = get_board_flags_array();
}
if( !IS_REBUILDD ) set_time_limit( 60 );
// DDOS Protection
if( $_SERVER['REQUEST_METHOD'] == 'GET' && !has_level() ) {
die();
}
if( STATIC_REBUILD && $mode != 'nothing' ) {
$noidx = 1;
}
if( !$resno && $noidx ) {
return;
}
log_cache( 0, $noidx ? $resno : 0 );
// Image directories
/*
$imgdir = ( ( USE_SRC_CGI == 1 ) ? str_replace( 'src', 'src.cgi', IMG_DIR2 ) : IMG_DIR2 );
if( defined( 'INTERSTITIAL_LINK' ) ) {
$imgdir .= INTERSTITIAL_LINK;
}
*/
$resno = (int)$resno;
$inter_ad_html = null;
if( $resno ) {
if( !isset( $log[$resno] ) ) {
updatelog_real( 0, $noidx );
return;
} elseif( $log[$resno]['resto'] ) {
updatelog_real( $log[$resno]['resto'], $noidx );
return;
}
// Inter-reply ads
$inter_ad_html = '';
if (defined('AD_ABC_TOP_MOBILE') && AD_ABC_TOP_MOBILE) {
$inter_ad_html .= '<div class="adg-rects mobile"><hr><div class="adg-m adp-250" data-abc="' . AD_ABC_TOP_MOBILE . '"></div><hr></div>';
}
if (defined('AD_ABC_TOP_DESKTOP') && AD_ABC_TOP_DESKTOP) {
$inter_ad_html .= '<div class="adg-rects desktop adg-rep"><hr><div class="adg adp-90" data-abc="' . AD_ABC_TOP_DESKTOP . '"></div><hr></div>';
}
if ($inter_ad_html === '') {
$inter_ad_html = null;
}
}
if( $resno ) {
logtime( "Generating thread JSON" );
if (ENABLE_JSON) {
$tailSize = get_json_tail_size($resno);
if ($tailSize) {
generate_thread_json($resno, false, false, false, $tailSize);
}
generate_thread_json($resno);
}
$treeline = array($resno);
logtime( "Formatting thread page" );
} else {
logtime( "Generating index JSON" );
if( ENABLE_JSON_INDEXES ) generate_index_json();
if( ENABLE_JSON_CATALOG ) generate_board_catalogue();
if( ENABLE_JSON_THREADS ) {
generate_board_threads_json();
}
$treeline = $log['THREADS'];
logtime( "Formatting index page" );
}
$counttree = count( $treeline );
if( !$counttree ) {
$logfilename = SELF_PATH2_FILE;
$dat = '';
head( $dat, $resno );
form( $dat, $resno );
print_page( $logfilename, $dat );
$dat = '';
}
$st = 0;
$p = 0;
if ($lazy_rebuild) {
$start_page = $index_rbl * DEF_PAGES;
}
else {
$start_page = 0;
}
$index_page_ad_pos = ceil(DEF_PAGES / 2);
if (defined('REPLIES_SHOWN')) {
$shown_replies_default = REPLIES_SHOWN;
}
else {
$shown_replies_default = 5;
}
for( $page = $start_page; $page < $counttree; $page += DEF_PAGES ) {
$file_page_num = $page / DEF_PAGES + 1;
if (PAGE_MAX && $file_page_num > PAGE_MAX) {
break;
}
$dat = '';
head( $dat, $resno, 0, $page, $counttree );
form( $dat, $resno );
if( !$resno ) {
$st = $page;
$dat .= '<div id="ctrl-top" class="desktop"><hr><input type="text" id="search-box" placeholder="'. S_SEARCH .
'"> [<a href="' . SELF_PATH2 . 'catalog">' . S_CATALOG . '</a>]';
if (ENABLE_ARCHIVE) {
$dat .= ' [<a href="' . SELF_PATH2 . 'archive">' . S_ARCHIVE . '</a>]';
}
$dat .= '</div>';
if (floor( $page / DEF_PAGES ) > $index_rbl) {
return;
}
}
// Post form / board container container start.
$dat .= '<hr>
<form name="delform" id="delform" action="' . SELF_PATH_ABS . '" method="post">
<div class="board">
';
$index_page_th_id = 0;
for( $i = $st; $i < $st + DEF_PAGES; $i++ ) {
$no = $treeline[$i];
if (!$no) {
break;
}
/*
if (!isset($log[$no]['children'])) {
log_bad_cache_entry($no);
}
*/
$sorted_replies = $log[$no]['children'];
ksort($sorted_replies);
// Party hats
$party = PARTY ? '<img src="' . STATIC_IMG_DIR2 . PARTY_IMAGE
. '" class="party-hat">' : '';
// Omitted replies
$reply_count = $log[$no]['replycount'];
if ($log[$no]['sticky'] == 1) {
$shown_replies = min(1, $shown_replies_default);
}
else {
$shown_replies = $shown_replies_default;
}
// Open thread tag and render OP
$dat .= '<div class="thread" id="t' . $no . '">'
. $party
. renderPostHtml($no, $resno, $sorted_replies, $reply_count, $shown_replies);
// Render replies
if ($resno) {
$s = 0;
}
else {
$s = $reply_count - $shown_replies;
}
$repCount = 0;
if ($inter_ad_html && $reply_count >= 100) {
$middle_reply_idx = floor($reply_count / 2.0);
}
else {
$middle_reply_idx = 0;
}
while (list($resrow) = each($sorted_replies)) {
if( $s > 0 ) {
$s--;
continue;
}
if (!$log[$resrow]['no']) {
break;
}
$dat .= renderPostHtml($resrow, $resno);
$repCount++;
if ($repCount == $middle_reply_idx) {
$dat .= $inter_ad_html;
}
}
// Close thread tag
$dat .= '
</div>
<hr>
';
++$index_page_th_id;
if (!$resno && AD_INTERTHREAD_ENABLED && $index_page_ad_pos == $index_page_th_id) {
$dat .= AD_INTERTHREAD_TAG . '<hr>';
}
$p++;
if ($resno) {
break;
}
}
if ($resno) {
$dat .= '<div class="navLinks navLinksBot desktop">[<a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a>] [<a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a>] [<a href="#top">' . S_TOP . '</a>] </div><hr class="desktop">';
}
// Close board tag
$lang = $resno ? S_FORM_REPLY : S_FORM_THREAD;
$dat .= '
<div class="mobile center"><a class="mobilePostFormToggle button" href="#">' . $lang . '</a></div>
</div>';
if (!$resno) {
$dat .= '<div class="navLinks navLinksBot mobile"><span class="mobileib button"><a href="#top">' . S_TOP . '</a></span> <span class="mobileib button"><a href="#bottom_r" id="refresh_bottom">' . S_REFRESH . '</a></span></div><hr class="mobile">';
}
else {
$dat .= '<div class="navLinks mobile"><span class="mobileib button"><a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a></span> <span class="mobileib button"><a href="/' . BOARD_DIR . '/catalog">' . S_CATALOG . '</a></span> <span class="mobileib button"><a href="#top">' . S_TOP . '</a></span> <span class="mobileib button"><a href="#bottom_r" id="refresh_bottom">' . S_REFRESH . '</a></span></div><hr class="mobile">';
}
/**
* ADS
*/
if (defined('AD_CUSTOM_BOTTOM') && AD_CUSTOM_BOTTOM) {
$dat .= '<div>' . AD_CUSTOM_BOTTOM . '<hr></div>';
}
/*
else if (defined('AD_ABC_BOTTOM_MOBILE') && AD_ABC_BOTTOM_MOBILE) {
$dat .= '<div class="adg-rects mobile"><div class="adg-m adp-250" data-abc="' . AD_ABC_BOTTOM_MOBILE . '"></div><hr></div>';
}
else if (defined('AD_BIDGEAR_BOTTOM') && AD_BIDGEAR_BOTTOM) {
$dat .= '<div class="adc-resp-bg" data-ad-bg="' . AD_BIDGEAR_BOTTOM . '"></div>';
}
*/
else if (defined('ADS_DANBO') && ADS_DANBO) {
$dat .= '<div id="danbo-s-b" class="danbo-slot"></div><div class="adl">[<a target="_blank" href="https://www.4chan.org/advertise">Advertise on 4chan</a>]</div><hr>';
}
if( $resno ) {
$resredir = '<input type="hidden" name="res" value="' . $resno . '">';
} else {
$resredir = '';
}
$dat .= '<div class="bottomCtrl desktop"><span class="deleteform"><input type="hidden" name="mode" value="usrdel">' . S_REPDEL . $resredir . ' [<input type="checkbox" name="onlyimgdel" value="on">' . S_DELPICONLY . ']<input type="hidden" id="delPassword" name="pwd"> <input type="submit" value="' . S_DELETE . '"><input id="bottomReportBtn" type="button" value="Report"></span>';
if( !defined( 'CSS_FORCE' ) ) {
$dat .= '<span class="stylechanger">Style:
<select id="styleSelector">
<option value="Yotsuba New">Yotsuba</option>
<option value="Yotsuba B New">Yotsuba B</option>
<option value="Futaba New">Futaba</option>
<option value="Burichan New">Burichan</option>
<option value="Tomorrow">Tomorrow</option>
<option value="Photon">Photon</option>';
if (defined('CSS_EVENT_NAME') && CSS_EVENT_NAME) {
$dat .= '<option value="_special">Special</option>';
}
$dat .= '</select>
</span>';
}
$dat .= '</div></form>';
if( !$resno ) {
$prev = $st - DEF_PAGES;
$next = $st + DEF_PAGES;
$dat .= '<div class="pagelist desktop"><div class="prev">';
$mpl = '<div class="mPagelist mobile">';
if( $prev >= 0 ) {
$link = ( $prev == 0 ) ? SELF_PATH2 : ( $prev / DEF_PAGES + 1 ) . PHP_EXT2;
$dat .= '<form class="pageSwitcherForm" action="' . $link . '">';
$dat .= '<input type="submit" value="' . S_PREV . '" accesskey="z"></form>';
$mprev = '<div class="prev"><a href="' . $link . '" class="button">' . S_PREV . '</a></div>';
} else {
$dat .= '<span>' . S_FIRSTPG . '</span> ';
$mprev = '';
}
$dat .= '</div><div class="pages">';
$mpl .= '<div class="pages">';
for( $i = 0; $i < $counttree; $i += DEF_PAGES ) {
$switcher_page_num = $i / DEF_PAGES + 1;
if (PAGE_MAX && $switcher_page_num > PAGE_MAX) {
break;
}
if( $st == $i ) {
$dat .= '[<strong><a href="">' . $switcher_page_num . '</a></strong>] ';
$mpl .= '<span>[<strong><a href="">' . $switcher_page_num . '</a></strong>]</span> ';
} else {
if( $i == 0 ) {
$dat .= '[<a href="' . SELF_PATH2 . '">1</a>] ';
$mpl .= '<span>[<a href="' . SELF_PATH2 . '">1</a>]</span> ';
} else {
$dat .= '[<a href="' . $switcher_page_num . PHP_EXT2 . '">' . $switcher_page_num . '</a>] ';
$mpl .= '<span>[<a href="' . $switcher_page_num . PHP_EXT2 . '">' . $switcher_page_num . '</a>]</span> ';
}
}
}
for( ; ( PAGE_MAX > 0 ) && $i < PAGE_MAX * DEF_PAGES; $i += DEF_PAGES ) {
$dat .= '[' . ( $i / DEF_PAGES + 1 ) . '] ';
$mpl .= '<span>[' . ( $i / DEF_PAGES + 1 ) . ']</span> ';
}
$dat .= '</div><div class="next">';
$mpl .= '<div class="mobileCatalogLink">[<a href="' . SELF_PATH2 . 'catalog">' . S_CATALOG . '</a>]</div></div>' . $mprev;
if( $p >= DEF_PAGES && $counttree > $next && $file_page_num != PAGE_MAX) {
$dat .= '<form class="pageSwitcherForm" action="' . ($next / DEF_PAGES + 1) . PHP_EXT2 . '">';
$dat .= '<input type="submit" value="' . S_NEXT . '" accesskey="x"></form>';
$mpl .= '<div class="next"><a href="' . ($next / DEF_PAGES + 1) . PHP_EXT2 . '" class="button">' . S_NEXT . '</a></div>';
} else {
$dat .= '<span>' . S_LASTPG . '</span>';
}
$catanav = ENABLE_CATALOG ? '<div class="pages cataloglink"><a href="' . SELF_PATH2 . 'catalog">' . S_CATALOG . '</a></div>' : '';
if (ENABLE_ARCHIVE) {
$catanav .= '<div class="pages cataloglink"><a href="'
. SELF_PATH2 . 'archive">' . S_ARCHIVE . '</a></div>';
}
// Close page navigator
$dat .= '</div>' . $catanav . '</div>';
$dat .= $mpl . '</div>';
}
foot( $dat );
if( $resno ) {
logtime( 'Printing thread ' . $resno . ' page' );
$logfilename = RES_DIR . $resno . PHP_EXT;
print_page( $logfilename, $dat );
$dat = '';
if( !$noidx ) {
updatelog_real( 0 );
}
break;
}
logtime( "Printing index page" );
if ($page == 0) {
$logfilename = SELF_PATH2_FILE;
print_page($logfilename, $dat);
}
else {
$logfilename = INDEX_DIR . ($file_page_num) . PHP_EXT;
print_page($logfilename, $dat);
}
$dat = '';
if( !$resno && $page == 0 && USE_RSS == 1 ) {
include_once 'lib/rss.php';
rss_dump();
}
} // for
}
//wrapper function for forwarding updatelog calls
//resno - thread page to update (no of thread OP)
//noidx - don't rebuild page indexes
function updatelog( $resno = 0, $noidx = 0, $lazy_rebuild = false )
{
updatelog_real( $resno, $noidx, $lazy_rebuild );
if( !STATIC_REBUILD && ENABLE_CATALOG && !$noidx ) generate_catalog( true );
}
?>

67
views/pass_auth.tpl.php Normal file
View file

@ -0,0 +1,67 @@
<!DOCTYPE html>
<html<?php if (IS_4CHANNEL) echo(' class="is_channel"'); ?>>
<head>
<meta charset="utf-8">
<title>4chan Pass - Authenticate</title>
<link rel="stylesheet" type="text/css" href="//s.4cdn.org/css/pass_auth.css">
<link rel="shortcut icon" href="//s.4cdn.org/image/favicon<?php if (IS_4CHANNEL) echo('-ws'); ?>.ico" type="image/x-icon">
</head>
<body>
<header>
<h1 id="title">4chan Pass</h1>
</header>
<div id="content">
<?php if ($this->auth_status === self::AUTH_NO): ?>
<div id="auth-cnt">
<h3 id="xhr-error" class="msg-error hidden"></h3>
<form id="auth-form" action="" method="POST"><fieldset id="auth-fields">
<table>
<tr>
<th>Token</th>
<td><input id="field-id" name="id" type="text" required></td>
</tr>
<tr>
<th>PIN</th>
<td><input id="field-pin" name="pin" type="password" required></td>
</tr>
<tfoot>
<tr class="row-space">
<td colspan="2"><input id="field-long-login" type="checkbox" name="long_login" value="1"><label for="field-long-login">Remember this device for 1 year</label></td>
</tr>
<tr class="row-space">
<td colspan="2"><button id="auth-btn" data-label="Submit" type="submit">Submit</button></td>
</tr>
<tr class="row-sep">
<td colspan="2"><hr></td>
</tr>
<tr>
<td colspan="2"><p>Forgot your 4chan Pass login details?<br><a href="https://www.4chan.org/pass?reset">Go here</a> to reset your PIN.</p><p>Don't have a 4chan Pass?<br><a href="https://www.4chan.org/pass">Click here</a> to learn more.</p></td>
</tr>
</tfoot>
</table></fieldset>
</form>
</div>
<?php elseif ($this->auth_status === self::AUTH_YES): ?>
<div id="auth-cnt">
<h3 id="xhr-error" class="msg-error hidden"></h3>
<h2 class="msg-success">You are authenticated.</h2>
<form method="POST" id="logout-form"><fieldset id="logout-fields"><button id="logout-btn" data-label="Logout" name="logout" value="1" type="submit">Logout</button></fieldset></form>
</div>
<?php elseif ($this->auth_status === self::AUTH_SUCCESS): ?>
<div id="auth-cnt">
<h2 class="msg-success">Success! Your device is now authorized.</h2>
</div>
<?php elseif ($this->auth_status === self::AUTH_ERROR): ?>
<div id="auth-cnt">
<h2 class="msg-error"><?php echo $this->message ? $this->message : 'Something went wrong.' ?></h2>
<p>[<a href="https://sys.<?php echo THIS_DOMAIN ?>/auth">Return</a>]</p>
</div>
<?php elseif ($this->auth_status === self::AUTH_OUT): ?>
<div id="auth-cnt">
<h2 class="msg-success">You are now logged out.</h2>
</div>
<?php endif ?>
</div>
<footer></footer>
</body>
</html>

99
views/signin-test.tpl.php Normal file
View file

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>4chan - Email Verification</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="robots" content="noindex">
<meta http-equiv="Accept-CH" content="Sec-CH-UA-Model">
<?php if ($this->mode === 'index'): ?>
<?php if (self::CAPTCHA_MODE === 2): ?>
<script src="https://hcaptcha.com/1/api.js" async defer></script>
<?php else: ?>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<?php endif ?>
<?php elseif ($this->mode === 'verify'): ?>
<?php if ($this->use_recaptcha): ?>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<?php else: ?>
<script src="https://s.4cdn.org/js/tcaptcha.js"></script>
<style type="text/css">
#t-root {
background-color: #eee;
overflow: hidden;
margin-bottom: 3px;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
padding: 4px;
border-radius: 6px;
}
</style>
<?php endif ?>
<?php endif ?>
<link rel="stylesheet" type="text/css" href="//s.4cdn.org/css/signin.css">
<link rel="shortcut icon" href="//s.4cdn.org/image/favicon.ico" type="image/x-icon">
</head>
<body>
<header>
<img id="logo" alt="4chan" src="//s.4cdn.org/image/fp/minileaf-transparent.png" width="46" height="47">
</header>
<div id="content">
<?php if ($this->mode === 'index'): ?>
<?php if ($this->authed): ?>
<div class="protip"><p>This session is already verified.</p><p>You can clear your verified status by clicking the <i>Logout</i> button below.</p></div>
<form id="logout-form" action="" method="POST">
<button>Logout</button>
<input type="hidden" name="<?php echo self::CSRF_ARG ?>" value="<?php echo $this->csrf_token ?>">
<input type="hidden" name="action" value="signout">
</form>
<?php elseif ($this->pass_user): ?>
<h3 class="msg-success"><?php echo self::ERR_PASS_USER ?></h3>
<?php else: ?>
<h1 id="title">Email Verification</h1>
<div class="protip"><p>A verified email address may be used to bypass<br>anti-spam filters on some boards. If you are having trouble posting, try verifying your email.</p><p>Enter your email below and click <i>Send</i> to receive a verification link.</p><p>Your email address will be stored on our servers only briefly (usually for just a couple of minutes while the verification link is awaiting delivery).</p><p>Email verification is not required for <a href="https://www.4chan.org/pass">4chan Pass</a> users.</p></div>
<form id="auth-form" action="" method="POST">
<div class="form-line"><div class="g-recaptcha" data-sitekey="<?php echo self::CAPTCHA_MODE === 2 ? HCAPTCHA_API_KEY_PUBLIC : RECAPTCHA_API_KEY_PUBLIC ?>"></div></div>
<div class="form-line"><label for="email">Email</label><input id="email" <?php if (self::VERIFY_EMAIL_DOMAIN) { echo('pattern="[^@+]+@(' . implode('|', self::$allowed_domains) . ')"'); } ?> name="email" type="email" required><button>Send</button></div>
<?php if (self::VERIFY_EMAIL_DOMAIN): ?><div class="form-line domain-list"><b>Allowed domains are:</b> <?php echo implode(', ', self::$allowed_domains) ?></div><?php endif; ?>
<input type="hidden" name="<?php echo self::CSRF_ARG ?>" value="<?php echo $this->csrf_token ?>">
<input type="hidden" name="action" value="request">
</form>
<?php endif ?>
<?php elseif ($this->mode === 'verify-captcha-failed'): ?>
<h3>You seem to have mistyped the CAPTCHA.</h3>
<h4><a href="?action=verify&amp;tkn=<?php echo htmlspecialchars($this->token) ?>">Click here</a> to try again.</h4>
<?php elseif ($this->mode === 'verify'): ?>
<div class="protip"><p>Please solve the CAPTCHA to finish the verification.</p><p>Make sure cookies are not blocked before continuing.</p></div>
<form id="auth-form" action="<?php echo self::WEB_PATH ?>" method="POST">
<?php if (!$this->use_recaptcha): ?>
<div class="form-line"><div id="t-root"></div></div>
<script>
TCaptcha.init(document.getElementById('t-root'), '!signin', 1);
TCaptcha.onReloadClick();
window.addEventListener('pageshow', (e) => {
if (e.persisted) {
TCaptcha.clearChallenge();
}
});
</script>
<?php else: ?>
<div class="form-line"><div class="g-recaptcha" data-sitekey="<?php echo RECAPTCHA_API_KEY_PUBLIC ?>"></div></div>
<?php endif ?>
<button>Verify</button>
<input type="hidden" name="<?php echo self::CSRF_ARG ?>" value="<?php echo $this->csrf_token ?>">
<input type="hidden" name="action" value="verify">
<input type="hidden" name="tkn" value="<?php echo htmlspecialchars($this->token) ?>">
</form>
<?php elseif ($this->mode === 'verify-done'): ?>
<h3 class="msg-success">This session is now verified.</h3>
</div>
<?php elseif ($this->mode === 'request'): ?>
<h3 class="msg-success">An email containing the verification link will be sent out shortly.</h3>
<?php elseif ($this->mode === 'signout'): ?>
<h3 class="msg-success">Session cleared.</h3>
<?php elseif ($this->mode === 'error'): ?>
<h3 class="msg-error"><?php echo $this->msg ?></h3>
<?php endif ?>
</div>
<footer></footer>
</body>
</html>

99
views/signin.tpl.php Normal file
View file

@ -0,0 +1,99 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>4chan - Email Verification</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="robots" content="noindex">
<meta http-equiv="Accept-CH" content="Sec-CH-UA-Model">
<?php if ($this->mode === 'index'): ?>
<?php if (self::CAPTCHA_MODE === 2): ?>
<script src="https://hcaptcha.com/1/api.js" async defer></script>
<?php else: ?>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<?php endif ?>
<?php elseif ($this->mode === 'verify'): ?>
<?php if ($this->use_recaptcha): ?>
<script src="https://www.google.com/recaptcha/api.js" async defer></script>
<?php else: ?>
<script src="https://s.4cdn.org/js/tcaptcha.js"></script>
<style type="text/css">
#t-root {
background-color: #eee;
overflow: hidden;
margin-bottom: 3px;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.25);
padding: 4px;
border-radius: 6px;
}
</style>
<?php endif ?>
<?php endif ?>
<link rel="stylesheet" type="text/css" href="//s.4cdn.org/css/signin.css">
<link rel="shortcut icon" href="//s.4cdn.org/image/favicon.ico" type="image/x-icon">
</head>
<body>
<header>
<img id="logo" alt="4chan" src="//s.4cdn.org/image/fp/minileaf-transparent.png" width="46" height="47">
</header>
<div id="content">
<?php if ($this->mode === 'index'): ?>
<?php if ($this->authed): ?>
<div class="protip"><p>This session is already verified.</p><p>You can clear your verified status by clicking the <i>Logout</i> button below.</p></div>
<form id="logout-form" action="" method="POST">
<button>Logout</button>
<input type="hidden" name="<?php echo self::CSRF_ARG ?>" value="<?php echo $this->csrf_token ?>">
<input type="hidden" name="action" value="signout">
</form>
<?php elseif ($this->pass_user): ?>
<h3 class="msg-success"><?php echo self::ERR_PASS_USER ?></h3>
<?php else: ?>
<h1 id="title">Email Verification</h1>
<div class="protip"><p>A verified email address may be used to bypass<br>anti-spam filters on some boards. If you are having trouble posting, try verifying your email.</p><p>Enter your email below and click <i>Send</i> to receive a verification link.</p><p>Your email address will be stored on our servers only briefly (usually for just a couple of minutes while the verification link is awaiting delivery).</p><p>Email verification is not required for <a href="https://www.4chan.org/pass">4chan Pass</a> users.</p></div>
<form id="auth-form" action="" method="POST">
<div class="form-line"><div class="g-recaptcha" data-sitekey="<?php echo self::CAPTCHA_MODE === 2 ? HCAPTCHA_API_KEY_PUBLIC : RECAPTCHA_API_KEY_PUBLIC ?>"></div></div>
<div class="form-line"><label for="email">Email</label><input id="email" <?php if (self::VERIFY_EMAIL_DOMAIN) { echo('pattern="[^@+]+@(' . implode('|', self::$allowed_domains) . ')"'); } ?> name="email" type="email" required><button>Send</button></div>
<?php if (self::VERIFY_EMAIL_DOMAIN): ?><div class="form-line domain-list"><b>Allowed domains are:</b> <?php echo implode(', ', self::$allowed_domains) ?></div><?php endif; ?>
<input type="hidden" name="<?php echo self::CSRF_ARG ?>" value="<?php echo $this->csrf_token ?>">
<input type="hidden" name="action" value="request">
</form>
<?php endif ?>
<?php elseif ($this->mode === 'verify-captcha-failed'): ?>
<h3>You seem to have mistyped the CAPTCHA.</h3>
<h4><a href="?action=verify&amp;tkn=<?php echo htmlspecialchars($this->token) ?>">Click here</a> to try again.</h4>
<?php elseif ($this->mode === 'verify'): ?>
<div class="protip"><p>Please solve the CAPTCHA to finish the verification.</p><p>Make sure cookies are not blocked before continuing.</p></div>
<form id="auth-form" action="<?php echo self::WEB_PATH ?>" method="POST">
<?php if (!$this->use_recaptcha): ?>
<div class="form-line"><div id="t-root"></div></div>
<script>
TCaptcha.init(document.getElementById('t-root'), '!signin', 1);
TCaptcha.onReloadClick();
window.addEventListener('pageshow', (e) => {
if (e.persisted) {
TCaptcha.clearChallenge();
}
});
</script>
<?php else: ?>
<div class="form-line"><div class="g-recaptcha" data-sitekey="<?php echo RECAPTCHA_API_KEY_PUBLIC ?>"></div></div>
<?php endif ?>
<button>Verify</button>
<input type="hidden" name="<?php echo self::CSRF_ARG ?>" value="<?php echo $this->csrf_token ?>">
<input type="hidden" name="action" value="verify">
<input type="hidden" name="tkn" value="<?php echo htmlspecialchars($this->token) ?>">
</form>
<?php elseif ($this->mode === 'verify-done'): ?>
<h3 class="msg-success">This session is now verified.</h3>
</div>
<?php elseif ($this->mode === 'request'): ?>
<h3 class="msg-success">An email containing the verification link will be sent out shortly.</h3>
<?php elseif ($this->mode === 'signout'): ?>
<h3 class="msg-success">Session cleared.</h3>
<?php elseif ($this->mode === 'error'): ?>
<h3 class="msg-error"><?php echo $this->msg ?></h3>
<?php endif ?>
</div>
<footer></footer>
</body>
</html>

88
views/syncframe.html Normal file
View file

@ -0,0 +1,88 @@
<!DOCTYPE html>
<html>
<head>
<title>4chan</title>
</head>
<body>
<script>
var SyncFrame = {
init: function() {
if (window.self === window.parent) {
return;
}
this.remoteOrigin = location.protocol + '//boards.'
+ (location.host === 'boards.4channel.org' ? '4chan' : '4channel')
+ '.org';
this.domain = location.host.replace(/^boards\./, '');
window.addEventListener('message', this.onMessage, false);
window.parent.postMessage('ready', this.remoteOrigin);
},
onMessage: function(e) {
var self = SyncFrame;
if (e.origin !== self.remoteOrigin) {
return;
}
if (!e.data) {
return;
}
if (e.data.storage) {
self.setStorage(e.data.storage);
}
if (e.data.cookie) {
self.setCookie(e.data.cookie);
}
},
setStorage: function(data) {
for (var key in data) {
if (data[key] === null) {
localStorage.removeItem(key);
}
else {
localStorage.setItem(key, data[key]);
}
}
},
setCookie: function(data) {
var domain, path, date, self;
self = SyncFrame;
date = new Date();
date.setTime(date.getTime() + (data.days * 24 * 60 * 60 * 1000));
if (!data.domain) {
domain = self.domain;
}
else {
domain = data.domain + self.domain;
}
if (!data.path) {
path = '/';
}
else {
path = data.path;
}
document.cookie = data.name + '=' + data.value
+ '; expires=' + date.toGMTString()
+ '; path=' + path + '; domain=' + domain;
}
};
SyncFrame.init();
</script>
</body>
</html>

993
views/upboard.php Normal file
View file

@ -0,0 +1,993 @@
<?
function upboard_tags()
{
// if you add tags to this, make sure to keep the numbers the same
// (they can be out of order)
static $tags = array(
0 => array("long" => "Hentai", "short" => "[H]"),
6 => array("long" => "Porn", "short" => '[P]'),
1 => array("long" => "Japanese", "short" => "[J]"),
2 => array("long" => "Anime", "short" => "[A]"),
3 => array("long" => "Game", "short" => "[G]"),
5 => array("long" => "Loop", "short" => "[L]"),
4 => array("long" => "Other", "short" => "[?]")
);
return $tags;
}
function updatelog( $resno = 0, $rebuild = 0 )
{
$tags = upboard_tags();
$imgdir = IMG_DIR2;
$thumbdir = THUMB_DIR2;
$imgurl = STATIC_IMG_DIR2;
$sqlog = SQLLOG; // to make this a shite load easier
$find = false;
$resno = (int)$resno;
log_cache();
if( $resno ) {
$result = mysql_board_call( "SELECT `no` FROM `$sqlog` WHERE `root` > 0 AND `no` = '$resno'" );
if( $result ) {
$find = mysql_fetch_row( $result );
mysql_free_result( $result );
}
if( !$find ) {
$result2 = mysql_board_call( "SELECT `no`, `resto` FROM `$sqlog` WHERE `no` = '$resno'" );
list( $chkno, $resto ) = mysql_fetch_row( $result2 );
if( !$resto ) {
error( S_REPORTERR );
}
mysql_free_result( $result2 );
$result3 = mysql_board_call( "SELECT `no` FROM `$sqlog` WHERE `no` = '$resto'" );
if( $result3 ) {
$chkfind = mysql_fetch_row( $result3 );
mysql_free_result( $result3 );
}
if( !$chkfind ) {
error( S_REPORTERR );
}
}
}
if( $resno ) {
if( !$treeline = mysql_board_call( "SELECT * FROM `$sqlog` WHERE `root` > 0 AND `no` = '$resno' ORDER BY `root` DESC" ) ) {
echo S_SQLFAIL;
}
} else {
if( !$treeline = mysql_board_call( "SELECT * FROM `$sqlog` WHERE `root` > 0 ORDER BY `root` DESC" ) ) {
echo S_SQLFAIL;
}
}
if( $resno ) {
//logtime("Generating thread JSON");
if( ENABLE_JSON ) generate_thread_json( $resno );
//$treeline = array( $resno );
//logtime("Formatting thread page");
} else {
//logtime("Generating index JSON");
if( ENABLE_JSON_INDEXES ) generate_index_json();
if( ENABLE_JSON_CATALOG ) generate_board_catalogue();
if( ENABLE_JSON_THREADS ) generate_board_threads_json();
//$treeline = $log['THREADS'];
//logtime("Formatting index page");
}
if( !$result = mysql_board_call( "SELECT MAX(`no`) FROM `$sqlog`" ) ) {
echo S_SQLFAIL;
}
$row = mysql_fetch_array( $result );
$lastno = (int)$row[0];
mysql_free_result( $result );
$counttree = mysql_num_rows( $treeline );
if( !$counttree ) {
$logfilename = SELF_PATH2_FILE;
$dat = '';
head( $dat, $resno );
form( $dat, $resno );
print_page( $logfilename, $dat );
}
$page = 0;
$dat = '';
head( $dat, $resno );
form( $dat, $resno );
if( !$resno ) {
$st = $page;
}
$dat .= '<hr style="clear:both"><form name="delform" action="' . SELF_PATH_ABS . '" method="post" id="delform"><div class="board">';
// here we go
if( !$resno ) {
$dat .= <<<HTML
<table class="flashListing">
<tr>
<td class="postblock">No.</td>
<td class="postblock">Name</td>
<td class="postblock">File</td>
<td class="postblock">Tag</td>
<td class="postblock">Subject</td>
<td class="postblock">Size</td>
<td class="postblock">Date</td>
<td class="postblock">Replies</td>
<td class="postblock"></td>
</tr>
HTML;
}
$delarr = array();
$limit = (int)round( DEF_PAGES * 0.83 );
$lim = DEF_PAGES - $limit;
if( !$result = mysql_board_call( "SELECT COUNT(*) FROM `$sqlog` WHERE `resto` = '0'" ) ) {
echo S_SQLFAIL;
}
$row = mysql_fetch_array( $result );
$countth = (int)$row[0];
if( $limit < $countth ) {
if( !$result = mysql_board_call( "SELECT `no` FROM `$sqlog` WHERE `resto` = '0' ORDER BY `no` ASC LIMIT $lim" ) ) {
echo S_SQLFAIL;
}
while( $row = mysql_fetch_array( $result ) ) {
$delarr[] = (int)$row[0];
}
}
mysql_free_result( $result );
for( $i = $st; $i < $st + DEF_PAGES; $i++ ) { // NO PAGES FOR /f/ (apparently!)
//if( !mysql_fetch_assoc($treeline) ) continue;
$thistree = mysql_fetch_assoc( $treeline );
if( !$thistree ) break;
extract( $thistree );
//list($no,$sticky,$permasage,$closed,$now,$name,$email,$sub,$com,$host,$pwd,$filename,$ext,$w,$h,$tn_w,$tn_h,$tim,$time,$md5,$fsize,$root,$resto,$filedeleted,$tmd5,$id,$capcode)=mysql_fetch_row($treeline);
$tag_matches = array();
$tag = 4;
if( preg_match( '/^(\d+)\|/', $sub, $tag_matches ) ) {
$tag = (int)( $tag_matches[1] );
$sub = preg_replace( '/^(\d+)\|/', '', $sub );
}
if( $resno ) {
if( !$no ) {
break;
}
$sub = str_replace( '&#44;', ',', $sub );
$emailstart = $emailend = '';
//if( $email != '' ) {
// $email = emailencode($email);
// $emailstart = '<a href="mailto:' . $email . '" class="useremail">';
// $emailend = '</a>';
//}
// NEW CAPCODE STUFF
switch( $capcode ) {
case 'admin':
$capcodeStart = ' <strong class="capcode">## Admin</strong>';
$capcode_class = ' capcodeAdmin';
$capcode = ' <img src="' . $imgurl . 'adminicon.gif" alt="This user is the 4chan Administrator." title="This user is the 4chan Administrator." class="identityIcon">';
$highlight = '';
break;
case 'admin_highlight':
$capcodeStart = ' <strong class="capcode">## Admin</strong>';
$capcode_class = ' capcodeAdmin';
$capcode = ' <img src="' . $imgurl . 'adminicon.gif" alt="This user is the 4chan Administrator." title="This user is the 4chan Administrator." class="identityIcon">';
$highlight = ' highlightPost';
break;
case 'mod':
$capcodeStart = ' <strong class="capcode">## Mod</strong>';
$capcode_class = ' capcodeMod';
$capcode = ' <img src="' . $imgurl . 'modicon.gif" alt="This user is a 4chan Moderator." title="This user is a 4chan Moderator." class="identityIcon">';
$highlight = '';
break;
case 'developer':
$capcodeStart = ' <strong class="capcode">## Developer</strong>';
$capcode_class = ' capcodeDeveloper';
$capcode = ' <img src="' . $imgurl . 'developericon.gif" alt="This user is a 4chan Developer." title="This user is a 4chan Developer." class="identityIcon">';
$highlight = '';
break;
case 'manager':
$capcodeStart = ' <strong class="capcode hand id_manager" title="Highlight posts by Managers">## Manager</strong>';
$capcode_class = ' capcodeManager';
$capcode = ' <img src="' . $imgurl . 'managericon.gif" alt="Manager Icon" title="This user is a 4chan Manager." class="identityIcon retina">';
$highlight = '';
break;
case 'verified':
$capcodeStart = ' <strong class="capcode hand id_verified" title="Highlight posts by Verified Users">## Verified</strong>';
$capcode_class = ' capcodeVerified';
$capcode = '';
$highlight = '';
break;
default:
$capcode = $capcodeStart = $highlight = $capcode_class = '';
break;
}
$com = auto_link( $com, $resno );
$subshort = $sub;
if( mb_strlen( $sub ) > 28 ) {
$subshort = '<span title="' . $sub . '">' . mb_substr( $sub, 0, 25, 'UTF-8' ) . '(...)</span>';
}
$file = '';
if( $ext ) {
$img = IMG_DIR . $tim . $ext;
$displaysrc = $imgdir . rawurlencode( $filename ) . $ext;
$src = IMG_DIR . $filename . $ext;
$longname = $filename . $ext;
if( $fsize >= 1048576 ) {
$size = round( $fsize / 1048576, 2 ) . ' M';
} elseif( $fsize >= 1024 ) {
$size = round( $fsize / 1048 ) . ' K';
} else {
$size = $fsize . ' ';
}
if( $filedeleted ) {
$imgsrc = '[<b>File Deleted</b>]';
$class = '';
} else {
$imgsrc = '<span class="fileText" id="fT' . $no . '">' . S_PICNAME . ': <a data-width="' . $w . '" data-height="' . $h . '" href="' . $displaysrc . '" target="_blank">' . $longname . '</a>-(' . $size . 'B, ' . $w . 'x' . $h . ', ' . $tags[$tag]['long'] . ')';
$class = ' class="fileInfo"';
}
$imgClassStart = ( $imgsrc == '' ) ? '' : '<div class="fileInfo">';
$imgClassEnd = ( $imgsrc == '' ) ? '' : '</div>';
$file = <<<HTML
<div class="file" id="f$no">
$imgClassStart
$imgsrc
$imgClassEnd
</div>
HTML;
}
// Main creatio
if( $sticky == 1 ) {
$threadmodes .= ' <img src="' . $imgurl . 'sticky.gif" alt="Sticky" title="Sticky" style="height: 18px; width: 18px;"/>';
}
if( $closed == 1 ) {
$threadmodes .= ' <img src="' . $imgurl . 'closed.gif" alt="Closed" title="Closed" style="height: 18px; width: 18px;"/>';
}
$href = ( $resno ) ? $no . PHP_EXT2 : RES_DIR2 . $no . PHP_EXT2;
$quote = ( $resno ) ? 'javascript:quote(\'' . $no . '\');' : $href . '#q' . $no;
$extra = '';
$stickies = array();
if( !$result = mysql_board_call( "SELECT `no` FROM `$sqlog` WHERE `sticky` = '1'" ) ) {
echo S_SQLFAIL;
}
while( $stickrow = mysql_fetch_row( $result ) ) {
list( $stickno ) = $stickrow;
$stickies[] = $stickno;
}
if( in_array( $no, $delarr ) ) {
if( in_array( $no, $stickies ) ) {
$stuck = 1;
}
if( $stuck != 1 ) {
$extra = '<span class="oldpost">' . S_OLD . '</span>';
}
}
$dat .= <<<HTML
<div class="thread" id="t$no">
<div class="postContainer opContainer" id="pc$no">
<div id="p$no" class="post op$highlight">
<div class="postInfoM mobile" id="pim$no">
<span class="nameBlock$capcode_class">
$emailstart<span class="name">$name</span>$capcodeStart$emailend$dispuid$countryFlag$threadmodes<br>
<span class="subject">$subshort</span>
</span>
<span class="dateTime postNum" data-utc="$time">$now<br><em><a href="$href#p$no">No.</a><a href="$quote">$no</a></em></span>
</div>
$file
<div class="postInfo desktop" id="pi$no">
<input type="checkbox" name="$no" value="delete">
<span class="subject">$sub</span>
<span class="nameBlock$capcode_class">
$emailstart<span class="name">$name</span>$capcodeStart$emailend$dispuid$countryFlag
</span>
<span class="dateTime" data-utc="$time">$now</span>
<span class="postNum">
<a href="$href#p$no" title="Link to this post">No.</a><a href="$quote" title="Reply to this post">$no</a>$threadmodes$postinfo_extra
</span>
</div>
<blockquote class="postMessage" id="m$no">$com</blockquote>
</div>
$postInfo
</div>
$extra
HTML;
if( !$resline = mysql_board_call( "SELECT * FROM `$sqlog` WHERE `resto` = '$no' ORDER BY `no`" ) ) {
echo S_SQLFAIL;
}
$countres = mysql_num_rows( $resline );
$s = 0;
while( $resrow = mysql_fetch_assoc( $resline ) ) {
extract( $resrow );
//list($no,$sticky,$permasage,$closed,$now,$name,$email,$sub,$com,$host,$pwd,$filename,$ext,$w,$h,$tn_w,$tn_h,$tim,$time,$md5,$fsize,$root,$resto)=$resrow;
if( !$no ) {
break;
}
$emailstart = $emailend = '';
//if( $email != '' ) {
// $email = emailencode($email);
// $emailstart = '<a href="mailto:' . $email . '" class="useremail">';
// $emailend = '</a>';
//}
// NEW CAPCODE STUFF
switch( $capcode ) {
case 'admin':
$capcodeStart = ' <strong class="capcode">## Admin</strong>';
$capcode_class = ' capcodeAdmin';
$capcode = ' <img src="' . $imgurl . 'adminicon.gif" alt="This user is the 4chan Administrator." title="This user is the 4chan Administrator." class="identityIcon">';
$highlight = '';
break;
case 'admin_highlight':
$capcodeStart = ' <strong class="capcode">## Admin</strong>';
$capcode_class = ' capcodeAdmin';
$capcode = ' <img src="' . $imgurl . 'adminicon.gif" alt="This user is the 4chan Administrator." title="This user is the 4chan Administrator." class="identityIcon">';
$highlight = ' highlightPost';
break;
case 'mod':
$capcodeStart = ' <strong class="capcode">## Mod</strong>';
$capcode_class = ' capcodeMod';
$capcode = ' <img src="' . $imgurl . 'modicon.gif" alt="This user is a 4chan Moderator." title="This user is a 4chan Moderator." class="identityIcon">';
$highlight = '';
break;
case 'developer':
$capcodeStart = ' <strong class="capcode">## Developer</strong>';
$capcode_class = ' capcodeDeveloper';
$capcode = ' <img src="' . $imgurl . 'developericon.gif" alt="This user is a 4chan Developer." title="This user is a 4chan Developer." class="identityIcon">';
$highlight = '';
break;
case 'manager':
$capcodeStart = ' <strong class="capcode hand id_manager" title="Highlight posts by Managers">## Manager</strong>';
$capcode_class = ' capcodeManager';
$capcode = ' <img src="' . $imgurl . 'managericon.gif" alt="Manager Icon" title="This user is a 4chan Manager." class="identityIcon retina">';
$highlight = '';
break;
default:
$capcode = $capcodeStart = $highlight = $capcode_class = '';
break;
}
$com = auto_link( $com, $no );
$subshort = $sub;
if( mb_strlen( $sub ) > 28 ) {
$subshort = '<span title="' . $sub . '">' . mb_substr( $sub, 0, 25, 'UTF-8' ) . '(...)</span>';
}
$href = ( $resno ) ? $resto . PHP_EXT2 : RES_DIR2 . $resto . PHP_EXT2;
$quote = ( $resno ) ? 'javascript:quote(\'' . $no . '\');' : $href . '#q' . $no;
$dat .= <<<HTML
<div class="postContainer replyContainer" id="pc$no">
<div class="sideArrows" id="sa$no">&gt;&gt;</div>
<div id="p$no" class="post reply$highlight">
<div class="postInfoM mobile" id="pim$no">
<span class="nameBlock$capcode_class">
$emailstart<span class="name">$name</span>$capcodeStart$emailend$dispuid$countryFlag$threadmodes<br>
<span class="subject">$subshort</span>
</span>
<span class="dateTime postNum" data-utc="$time">$now<br><em><a href="$href#p$no" title="Link to this post">No.</a><a href="$quote" title="Reply to this post">$no</a></em></span>
</div>
<div class="postInfo desktop" id="pi$no">
<input type="checkbox" name="$no" value="delete">
<span class="subject">$sub</span>
<span class="nameBlock$capcode_class">
$emailstart<span class="name">$name</span>$capcodeStart$emailend $dispuid$countryFlag
</span>
<span class="dateTime" data-utc="$time">$now</span>
<span class="postNum desktop">
<a href="$href#p$no" title="Link to this post">No.</a><a href="$quote" title="Reply to this post">$no</a>
</span>
</div>
<blockquote class="postMessage" id="m$no">$com</blockquote>
</div>
</div>
HTML;
}
// end thread
$dat .= '</div><hr>';
//clearstatcache();
mysql_free_result( $resline );
$p++;
break;
} else {
/** BUILD /f/ INDEX **/
if( !$resline = mysql_board_call( "SELECT * FROM `$sqlog` WHERE `resto` = '$no' ORDER BY `no`" ) ) {
echo S_SQLFAIL;
}
$countres = mysql_num_rows( $resline );
if( $fsize >= 1048576 ) {
$kbsize = round( ( $fsize / 1048576 ), 2 ) . ' M';
} elseif( $fsize >= 1024 ) {
$kbsize = round( $fsize / 1024 ) . ' K';
} else {
$kbsize = $fsize . ' ';
}
$kbsize .= 'B';
$emailstart = $emailend = '';
//if( $email != '' ) {
// $email = emailencode($email);
// $emailstart = '<a href="mailto:' . $email . '" class="useremail">';
// $emailend = '</a>';
//}
if( mb_strlen( $filename ) > 25 ) {
$shortname = mb_substr( $filename, 0, 25, 'UTF-8' ) . "(...)";
} else {
$shortname = $filename;
}
if( $kbsize != '0 B' ) {
$class = '';
if( in_array( $no, $delarr ) ) {
$class = 'class="oldpost"';
}
$texttag = $tags[$tag]['short'];
if ($sub != '') {
$sub = str_replace('&#44;', ',', $sub);
if (mb_strlen($sub) > 30) {
$shortsub = mb_substr($sub, 0, 30, 'UTF-8') . '(...)';
}
else {
$shortsub = $sub;
}
}
else {
$com = str_replace('&#44;', ',', $com);
$com = explode('<', $com)[0];
if (mb_strlen($com) > 30) {
$shortsub = mb_substr($com, 0, 30, 'UTF-8') . '(...)';
}
else {
$shortsub = $com;
}
}
$replink = RES_DIR2 . $no . PHP_EXT2;
$semantic_url = generate_href_context($sub, $com);
if ($semantic_url != '') {
$semantic_url = "/$semantic_url";
}
$filelink = IMG_DIR2 . rawurlencode( $filename ) . '.swf';
// NEW CAPCODE STUFF
if( $capcode === 'admin' ) {
$capcodeStart = ' <strong class="capcode capcodeAdmin">## Admin</strong>';
$capcode_class = ' capcodeAdmin';
$capcode = ' <img src="' . $imgurl . 'adminicon.gif" alt="This user is the 4chan Administrator." title="This user is the 4chan Administrator." class="identityIcon">';
$highlight = '';
} elseif( $capcode === 'mod' ) {
$capcodeStart = ' <strong class="capcode capcodeAdmin">## Mod</strong>';
$capcode_class = ' capcodeMod';
$capcode = ' <img src="' . $imgurl . 'modicon.gif" alt="This user is a 4chan Moderator." title="This user is a 4chan Moderator." class="identityIcon">';
$highlight = '';
} elseif( $capcode === 'admin_highlight' ) {
$capcodeStart = ' <strong class="capcode capcodeAdmin">## Admin</strong>';
$capcode_class = ' capcodeAdmin';
$capcode = ' <img src="' . $imgurl . 'adminicon.gif" alt="This user is the 4chan Administrator." title="This user is the 4chan Administrator." class="identityIcon">';
$highlight = ' highlightPost';
} else {
$capcode = $capcodeStart = $highlight = $capcode_class = '';
}
$oldclass = in_array( $no, $delarr ) ? ' class="highlightPost"' : '';
$dat .= <<<HTML
<tr$oldclass>
<td>$no</td>
<td class="name-col$capcode_class">$emailStart<span class="name">$name</span>$emailEnd$capcodeStart$capcode</td>
<td class="file-col">[<a href="$filelink" title="$filename" data-width="$w" data-height="$h" target="_blank">$shortname</a>]</td>
<td>$texttag</td>
<td class="subject"><span title="$sub">$shortsub</span></td>
<td>$kbsize</td>
<td>$now</td>
<td>$countres</td>
<td>[<a href="$replink$semantic_url">Reply</a>]</td>
</tr>
HTML;
}
//clearstatcache();
mysql_free_result( $resline );
} // end /f/
} // no pages for /f/
$lang = $resno ? S_FORM_REPLY : S_FORM_THREAD;
if( !$resno ) {
$dat .= '</table><hr></div>';
} else {
$dat .= '<div class="navLinks navLinksBot desktop">[<a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a>] [<a href="#top">' . S_TOP . '</a>] </div><hr class="desktop">';
$dat .= '
<div class="mobile center"><a class="mobilePostFormToggle button" href="#">' . $lang . '</a></div>
</div>';
}
if (!$resno) {
$dat .= '<div class="navLinks navLinksBot mobile"><span class="mobileib button"><a href="#top">' . S_TOP . '</a></span> <span class="mobileib button"><a href="#bottom_r" id="refresh_bottom">' . S_REFRESH . '</a></span></div><hr class="mobile">';
}
else {
$dat .= '<div class="navLinks mobile"><span class="mobileib button"><a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a></span> <span class="mobileib button"><a href="#top">' . S_TOP . '</a></span> <span class="mobileib button"><a href="#bottom_r" id="refresh_bottom">' . S_REFRESH . '</a></span></div><hr class="mobile">';
}
/*
if( AD_BOTTOM_ENABLE == 1 ) {
$bottomad = "";
if( defined( "AD_BOTTOM_TEXT" ) && AD_BOTTOM_TEXT ) {
$bottomad .= '<div class="bottomad center ad-cnt">' . ad_text_for( AD_BOTTOM_TEXT ) . '</div>' . (defined('AD_BOTTOM_PLEA') ? AD_BOTTOM_PLEA : '');
} else if( defined( "AD_BOTTOM_TABLE" ) && AD_BOTTOM_TABLE ) {
list( $bottomimg, $bottomlink ) = rid( AD_BOTTOM_TABLE, 1 );
$bottomad .= "<div class=\"center\"><a href=\"$bottomlink\" target=\"_blank\"><img class=\"bottomad\" src=\"$bottomimg\" alt=\"\"></a></div>";
}
if( $bottomad ) {
$dat .= "$bottomad<hr>";
}
}
*/
/**
* ADS
*/
if (defined('AD_ADGLARE_BOTTOM') && AD_ADGLARE_BOTTOM) {
$dat .= '<div class="adg-rects desktop"><div class="adg adp-90" id=zone' . AD_ADGLARE_BOTTOM . '></div><hr></div>';
}
if (defined('AD_ADGLARE_BOTTOM_MOBILE') && AD_ADGLARE_BOTTOM_MOBILE) {
$dat .= '<div class="adg-rects mobile"><div class="adg-m adp-250" id=zone' . AD_ADGLARE_BOTTOM_MOBILE . '></div><hr></div>';
}
if (defined('AD_RC_BOTTOM') && AD_RC_BOTTOM) {
$dat .= '<div class="adg-rects desktop"><div class="adg adp-228" data-rc="' . AD_RC_BOTTOM . '" id="rcjsload_bottom"></div><hr></div>';
}
if (defined('AD_RC_BOTTOM_MOBILE') && AD_RC_BOTTOM_MOBILE) {
$dat .= '<div class="adg-rects mobile"><div class="adg-m adp-50" data-rc="' . AD_RC_BOTTOM_MOBILE . '" id="rcjsload_bottom_m"></div><hr></div>';
}
if (defined('AD_ADNIUM_BOTTOM_MOBILE') && AD_ADNIUM_BOTTOM_MOBILE) {
$dat .= '<div class="adg-rects mobile"><div class="adg-m adp-250" id="adn-' . AD_ADNIUM_BOTTOM_MOBILE . '" data-adn></div><hr></div>';
}
$dat .= '<div class="bottomCtrl desktop"><span class="deleteform"><input type="hidden" name="mode" value="usrdel">' . S_REPDEL . $resredir . ' [<input type="checkbox" name="onlyimgdel" value="on">' . S_DELPICONLY . ']<input type="hidden" id="delPassword" name="pwd"> <input type="submit" value="' . S_DELETE . '"><input id="bottomReportBtn" type="button" value="Report"></span>';
if( !defined( 'CSS_FORCE' ) ) {
$dat .= '<span class="stylechanger">Style:
<select id="styleSelector">
<option value="Yotsuba New">Yotsuba</option>
<option value="Yotsuba B New">Yotsuba B</option>
<option value="Futaba New">Futaba</option>
<option value="Burichan New">Burichan</option>
<option value="Tomorrow">Tomorrow</option>
<option value="Photon">Photon</option>
</select>
</span>';
}
$dat .= '</div></form>';
foot( $dat );
if( $page == 0 ) {
$logfilename = SELF_PATH2_FILE;
}
if( $resno ) {
$logfilename = RES_DIR . $resno . PHP_EXT;
print_page( $logfilename, $dat );
if( !$rebuild ) {
updatelog();
}
} else {
print_page( $logfilename, $dat );
}
mysql_free_result( $treeline );
}
function form( &$dat, $resno, $admin = '' )
{
global $thread_unique_ips;
$maxbyte = MAX_KB * 1024;
$no = $resno;
$closed = 0;
$msg = $hidden = '';
$tags = upboard_tags();
if( $resno ) {
if( !$cchk = mysql_board_call( "select closed from `" . SQLLOG . "` where no=" . $resno ) ) {
echo S_SQLFAIL;
}
list( $closed ) = mysql_fetch_row( $cchk );
$msg .= '<div class="navLinks mobile">
<span class="mobileib button"><a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a></span> <span class="mobileib button"><a href="#bottom">' . S_BOTTOM . '</a></span> <span class="mobileib button"><a href="#top_r" id="refresh_top">' . S_REFRESH . '</a></span>
</div>
<div id="mpostform"><a href="#" class="mobilePostFormToggle mobile hidden button">' . S_FORM_REPLY . '</a></div>';
}
else {
$msg .= '
<div class="navLinks mobile">
<span class="mobileib button"><a href="#bottom">' . S_BOTTOM . '</a></span> <span class="mobileib button"><a href="#top_r" id="refresh_top">' . S_REFRESH . '</a></span>
</div>
<div id="mpostform"><a href="#" class="mobilePostFormToggle mobile hidden button">' . S_FORM_THREAD . '</a></div>';
}
if( $admin ) {
$hidden = '<input type="hidden" name="admin" value="' . ADMIN_PASS . '"/>';
$msg = '<h4>' . S_NOTAGS . '</h4>';
}
if( $closed != 1 ) {
$dat .= $msg;
form_ads( $dat );
$dat .= '
<form name="post" action="' . SELF_PATH_POST . '" method="post" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="' . $maxbyte . '">
<input type="hidden" name="mode" value="regist">
<input id="postPassword" name="pwd" type="hidden">';
if( $no ) {
$dat .= '
<input type="hidden" name="resto" value="' . $no . '"/>
';
}
$dat .= '<div id="togglePostFormLink" class="desktop">[<a href="#">'
. ($resno ? S_FORM_REPLY : S_FORM_THREAD)
. '</a>]</div><noscript><style type="text/css">#postForm { display: table !important; }</style></noscript><table class="postForm hideMobile" id="postForm">
<tbody>
';
// TODO: ADS
$spoilers = '';
if( SPOILERS == 1 ) {
$spoilers = '<span class="desktop">[<label><input type="checkbox" name="spoiler" value="on" tabindex="8">' . S_SPOILERS . '</label>]</span>';
}
if( FORCED_ANON == 1 ) {
$dat .= '
<tr data-type="Options">
<td>' . S_EMAIL . '</td>
<td><input type="hidden" name="name"><input type="hidden" name="sub"><input name="email" type="text" tabindex="2"><input type="submit" value="' . S_SUBMIT . '" tabindex="6"></td>
</tr>
';
if( $spoilers ) {
if( !$stripm ) $dat .= '
<tr class="mobile" data-type="Spoilers">
<td>Spoilers</td>
<td class="mobileSpoiler">[<label><input type="checkbox" name="spoiler" value="on">' . S_SPOILERS . '</label>]</td>
</tr>
';
}
}
else {
$dat .= '
<tr data-type="Name">
<td>' . S_NAME . '</td>
<td><input name="name" type="text" tabindex="1"></td>
</tr>';
if ($resno) {
$dat .= '
<tr data-type="Options">
<td>' . S_EMAIL . '</td>
<td><input name="email" type="text" tabindex="2"><input type="submit" value="' . S_SUBMIT . '" tabindex="6"></td>
</tr>';
}
else {
$dat .= '
<tr data-type="Options">
<td>' . S_EMAIL . '</td>
<td><input name="email" type="text" tabindex="2"></td>
</tr>
<tr data-type="Subject">
<td>' . S_SUBJECT . '</td>
<td><input name="sub" type="text" tabindex="3"><input type="submit" value="' . S_SUBMIT . '" tabindex="6"></td>
</tr>';
}
if( $spoilers ) {
if( !$stripm ) $dat .= '
<tr class="mobile" data-type="Spoilers">
<td>' . S_SPOILERS . '</td>
<td class="mobileSpoiler">[<label><input type="checkbox" name="spoiler" value="on">' . S_SPOILERS . '</label>]</td>
</tr>
';
}
}
if( $admin ) {
$dat .= '
<tr>
<td>Reply ID</td>
<td><input name="resto" type="text"/> [<label><input type="checkbox" name="age" value="1"/>Age</label></td>
</tr>
';
}
//if( EXPANDING_POST_ )
$dat .= '
<tr data-type="Comment">
<td>' . S_COMMENT . '</td>
<td><textarea name="com" cols="48" rows="4" wrap="soft"></textarea></td>
</tr>
';
if( CAPTCHA ) {
$dat .= '
<tr id="captchaFormPart">
<td class="desktop">' . S_CAPTCHA . '</td>
<td colspan="2">' . captcha_form() . '<div class="passNotice">' . S_PASS_NOTICE . '</div></td>
</tr>
';
}
if( !$resno ) {
$dat .= '
<tr>
<td>' . S_UPLOADFILE . '</td>
<td><input id="postFile" name="upfile" type="file"/><div id="fileError"></div></td>
</tr>
<tr>
<td>Tag</td>
<td><select name="filetag">
<option value="9999" selected="selected">Choose one:</option>';
foreach( upboard_tags() as $tagval => $tagnames ) {
$dat .= '<option value="' . $tagval . '">' . $tagnames['long'] . '</option>';
}
$dat .= '</select></td></tr>';
}
if ($resno && SHOW_THREAD_UNIQUES) {
$unique = $thread_unique_ips;
if ($unique) {
$unique_plural = $unique > 1 ? 'are' : 'is';
$unique = sprintf("<li> There $unique_plural " . S_UNIQUE_POSTS_TH . '</li>', $unique, $unique > 1 ? 's' : '');
}
else {
$unique = '';
}
}
elseif (SHOW_UNIQUES) {
$unique = sprintf('<li>' . S_UNIQUE_POSTS . '</li>', $GLOBALS['ipcount']);
}
else {
$unique = '';
}
// XXX: mode=regist moved to the top
$dat .= '
<tr class="rules">
<td colspan="2">
<ul class="rules">
' . S_RULES . '
' . $unique . '
</ul>
</td>
</tr>
';
$blotter = $resno ? '' : get_blotter();
$dat .= '
</tbody>
</table>' . $blotter . '
</form>
' . DONATE . '
<script>with(document.post) {name.value=get_cookie("4chan_name"); email.value=get_cookie("4chan_email"); pwd.value=get_pass("4chan_pass"); }</script>
';
} else { // Closed thread
form_ads( $dat );
$dat .= '<div class="navLinks">
[<a href="../' . SELF_PATH2 . '" accesskey="a">' . S_RETURN . '</a>] [<a href="#bottom">Bottom</a>]
</div>
<div class="closed">Thread closed.<br>You may not reply at this time.</div>';
}
if( AD_MIDDLE_ENABLE == 1 ) {
$middlead = "";
if( defined( "AD_MIDDLE_TEXT" ) && AD_MIDDLE_TEXT ) {
$middlead .= '<hr class="aboveMidAd"><div class="middlead center ad-cnt">' . ad_text_for( AD_MIDDLE_TEXT ) . '</div>' . (defined('AD_MIDDLE_PLEA') ? AD_MIDDLE_PLEA : '');
} else if( defined( "AD_MIDDLE_TABLE" ) && AD_MIDDLE_TABLE ) {
list( $middleimg, $middlelink ) = rid( AD_MIDDLE_TABLE, 1 );
$middlead .= "<hr><div class=\"center\"><a href=\"$middlelink\" target=\"_blank\"><img class=\"middlead\" src=\"$middleimg\" alt=\"\"></a></div>";
}
if( $middlead ) {
$dat .= "$middlead";
}
}
list($globalmsgtxt,$globalmsgdate) = global_msg_txt();
if( $globalmsgtxt ) {
$dat .= "\n<hr><a href=\"#\" class=\"button redButton mobile hidden\" id=\"globalToggle\">View Important Announcement</a><div class=\"globalMessage hideMobile\" id=\"globalMessage\" data-utc=\"$globalmsgdate\">" . $globalmsgtxt . "</div>\n";
}
if (defined('AD_ADGLARE_TOP') && AD_ADGLARE_TOP) {
$dat .= '<div class="adg-rects desktop"><hr><div class="adg adp-90" id=zone' . AD_ADGLARE_TOP . '></div></div>';
}
else if (defined('AD_RC_TOP') && AD_RC_TOP) {
$dat .= '<div class="adg-rects desktop"><hr><div class="adg adp-228" data-rc="' . AD_RC_TOP . '" id="rcjsload_top"></div></div>';
}
else if (defined('AD_ABC_TOP_DESKTOP') && AD_ABC_TOP_DESKTOP) {
list($_abc_left, $_abc_right) = explode(',', AD_ABC_TOP_DESKTOP);
$dat .= '<div class="adg-rects desktop"><hr><div class="adg adp-250 adp-row" data-abc="' . $_abc_left . '"></div><div class="adg adp-250 adp-row" data-abc="' . $_abc_right . '"></div></div>';
}
if ($resno) {
$dat .= '<hr class="desktop" id="op">
<div class="navLinks desktop">
[<a href="/' . BOARD_DIR . '/" accesskey="a">' . S_RETURN . '</a>] [<a href="#bottom">' . S_BOTTOM . '</a>]
</div>
';
}
}
?>