init 4chan

This commit is contained in:
skidoodle 2025-04-17 09:20:34 +02:00
commit c850337f1e
No known key found for this signature in database
390 changed files with 195936 additions and 0 deletions

327
forms/ban.php Normal file
View file

@ -0,0 +1,327 @@
<?php
/* options:
name_edit: make Name field editable
host_edit: make Host field editable
name,host,reverse,xff = string: load values explicitly
load_reporter = numeric-ip: load reporter
load_ban_request = id: load ban request values
load_post = postno: use 'board' value and no to fetch info
public_reason = string: load public reason with string
private_reason = string: load private reason with string
length = string: load days with number
scope = local|global|zonly: load scope
postban = delpost|delfile|delall: load postban action
board = ''|string : name of local board
hide_postbans: hide post-ban action list
action = url of form action
*/
/*
Unban in ...
Ban Duration [x Use] 0v/0v/0v (D/W/M)
*/
function head() {
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>Ban form</title>
<meta http-equiv="Content-type" content="text/html;charset=utf-8">
<style type="text/css">
body {
background: #ffe;
font-family: Verdana;
font-size: 10px;
color: #000000;
padding: 15px 10px;
margin: 0;
}
table {
border: 0px #606060 solid;
border-spacing: 0px;
padding: 5px;
border-collapse:collapse;
}
td,th {
font-family: Verdana;
font-size: 10px;
color: #000000;
border: 1px #606060 solid;
border-spacing: 0px;
border-collapse:collapse;
padding-top:2px;
padding-bottom:2px;
}
th { background: #fca; }
.redbg { background: #ffe0e0; }
input,select,.fakebutton {
font-family: Verdana;
font-size: 9pt;
color: #000000;
background-color: #F8F8F8;
border: 1px solid #808080;
vertical-align: middle;
}
select { vertical-align:top; }
option,optgroup {
font-family: Verdana;
font-size: 9pt;
}
td,th,body,input { font-family: Verdana,Tahoma,sans-serif; font-size: 12px; }
td,th { padding: 2px 2px; }
th { text-align: left; font-weight: normal; }
.title { background: #800; color: white; font-weight: bold; }
</style>
<script type="text/javascript">
function resizeToContent() {
// resize inner height to fit content
resizeTo(410, 400); // only way to know outer size for sure
var innerHeight = (window.innerHeight)?window.innerHeight:document.documentElement.clientHeight;
var outerHeight = 400;
var docHeight = document.body.clientHeight;
if(document.documentElement.clientHeight < docHeight) // e.g. opera?
docHeight = document.documentElement.clientHeight;
//alert(outerHeight);
//alert(innerHeight);
//alert(docHeight);
resizeTo(410, docHeight + (outerHeight - innerHeight));
}
function toggle(name){var visible=((document.all)?"block":"table-row"); var a=document.getElementById(name); a.style.display = ((a.style.display!=visible)?visible:"none");}
//window.onload = resizeToContent;
function callInOpener(code) {
if(window.opener && !window.opener.closed) {
window.opener.setTimeout(code, 0);
}
}
</script>
</head><body>
<?
}
function fancydie($err) {
head();
$err = "<h3><font color='#FF0000'>$err</font></h3>";
$err .= "<br><a href='javascript:history.go(-1)'>Back</a></body></html>";
die($err); // ok, not very fancy yet
}
function format_host($dec_ip,$reverse='') {
if(!$reverse)
$reverse = gethostbyaddr($dec_ip);
if($reverse && $reverse != $dec_ip) {
$reverse = htmlspecialchars($reverse);
return "$reverse ($dec_ip)";
}
else return "$dec_ip";
}
function format_name($name) {
$name = strip_tags($name);
$name = strtr($name, '!', '#');
$name = htmlspecialchars($name);
return $name;
}
function ban_history($dec_ip) {
$query = mysql_global_call("SELECT COUNT(*) as total,COUNT(active||NULL) as active FROM banned_users WHERE host='%s'", $dec_ip);
$row = mysql_fetch_assoc($query);
if(!$row)
return '';
if($row['total'] == 0)
return '';
if($row['active'] == 0)
$linkdesc = sprintf("{$row['total']} past ban%s for this IP.", ($row['total']>1)?'s':'' );
else if($row['active'] == $row['total'])
$linkdesc = sprintf("{$row['active']} ban%s already active for this IP.", ($row['active']>1)?'s':'');
else {
$row['total'] -= $row['active'];
$linkdesc = sprintf("{$row['total']} past ban%s and {$row['active']} ban%s already active for this IP.", ($row['total']>1)?'s':'' , ($row['active']>1)?'s':'');
}
$dec_ip = urlencode($dec_ip);
return "<a href=\"http://team.4chan.org/bans.php?admin=hist&ip=$dec_ip\" target=\"_blank\">$linkdesc</a>";
}
function other_ban_requests($than,$dec_ip) {
$query = mysql_global_call("SELECT COUNT(*) as total from ban_requests WHERE id!=%d AND host='%s'", $than, $dec_ip);
$row = mysql_fetch_assoc($query);
if(!$row)
return 0;
return $row['total'];
}
function get_xff($board,$tim) {
$query = mysql_global_call("SELECT xff from xff where tim='%s' AND board='%s'", $board, $tim);
$row = mysql_fetch_assoc($query);
if(!$row)
return '';
return format_host($row['host']);
}
function form_ban($o) {
head();
if($o['load_reporter']) {
$query = mysql_global_call("SELECT ip FROM reports where ip=%d LIMIT 1",$o['load_reporter']);
if(!($row=mysql_fetch_assoc($query)))
fancydie("No reports found with specified IP.");
$form['load_name'] = 'load_reporter';
$form['load_value'] = $o['load_reporter'];
$form['name'] = 'Anonymous';
$form['host'] = format_host(long2ip($row['ip']));
$form['xff'] = '';
$form['banhist'] = ban_history(long2ip($row['ip']));
$form['board'] = '';
$form['title'] = "Banning reporter " . long2ip($row['ip']);
$o['hide_postbans'] = 1;
$form['id'] = (int)$o['load_reporter'];
}
else if($o['load_ban_request']) {
$query = mysql_global_call("SELECT * FROM ban_requests where id=%d", $o['load_ban_request']);
if(!($row=mysql_fetch_assoc($query)))
fancydie("Specified ban request does not exist.");
$form['load_name'] = 'load_ban_request';
$form['load_value'] = $o['load_ban_request'];
$post = unserialize($row['spost']);
$form['name'] = format_name($post['name']);
$form['host'] = format_host($post['host'],$post['reverse']);
$form['xff'] = htmlspecialchars($post['xff']);
$form['banhist'] = ban_history($post['host']);
$form['board'] = $row['board'];
$form['title'] = htmlspecialchars("Filling {$row['janitor']}'s ban request for /{$row['board']}/{$post['no']}");
//$form['public_reason'] = htmlspecialchars($row['reason']);
//$form['private_reason'] = htmlspecialchars("requested by {$row['janitor']}");
$form['other_ban_reqs'] = other_ban_requests($o['load_ban_request'], $post['host']);
$o['hide_postbans'] = 1;
$form['id'] = (int)$o['load_ban_request'];
}
else if($o['load_post']) {
}
else if($GLOBALS['my_access']['manual_ban']) {
$o['name_edit'] = $o['host_edit'] = /*$o['bannedby_edit'] =*/ true;
$form['load_name'] = 'manual';
$form['load_value'] = 'yes';
}
// overrides
if(isset($_COOKIE['4chan_bpubr']))
$form['public_reason'] = htmlspecialchars($_COOKIE['4chan_bpubr']);
if(isset($_COOKIE['4chan_bprvr']))
$form['private_reason'] = htmlspecialchars($_COOKIE['4chan_bprvr']);
if(isset($_COOKIE['4chan_blen'])) {
$clen = (int)$_COOKIE['4chan_blen'];
if($clen==0)
$form['warn'] = 1;
else if($clen==-1)
$form['indef'] = 1;
else
$form['length'] = $clen;
$form['remember'] = 1;
}
if($o['public_reason'])
$form['public_reason'] = htmlspecialchars($o['public_reason']);
if($o['private_reason'])
$form['private_reason'] = htmlspecialchars($o['private_reason']);
if($o['length'])
$form['length'] = htmlspecialchars($o['length']);
$form['modname'] = htmlspecialchars($_COOKIE['4chan_auser']);
?>
<form name="banform" method="POST">
<input type="hidden" name="<?=$form['load_name']?>" value="<?=$form['load_value']?>">
<table border=0 cellspacing=0 cellpadding=0>
<tr><td colspan=2 align=center class="title">
<a href="javascript:toggle('more');resizeToContent();" style="position:absolute;width:13px;height:13px;border:1px solid white;left:11px;color:white;text-decoration:none;font-size:11px;">&#x25BC;</a></div>
<?=$form['title']?></td></tr>
<tr id="more" style="display:none"><th>More:</th>
<td>[<input type=checkbox name=remember value="1" <?= $form['remember']?'CHECKED':'' ?>> Remember ban reason and length]</td>
</tr>
<tr> <th>Name:</th>
<td><input type="text" name="name" value="<?=$form['name']?>" size=40 <?= $o['name_edit']?'':'DISABLED' ?>></td>
</tr>
<tr> <th>Host:</th>
<td><input type="text" name="host" value="<?=$form['host']?>" size=40 <?= $o['host_edit']?'':'DISABLED' ?>></td>
</tr>
<? if($form['xff']) { ?>
<tr> <th>Proxy For:</th>
<td><input type="text" name="xff" value="<?=$form['xff']?>" size=40 <?= $o['host_edit']?'':'DISABLED' ?> title="This is possibly the user's real IP, but only the above IP will be banned."></td>
</tr>
<? } ?>
<? if($form['banhist']) { ?>
<tr> <th>Ban History:</th>
<td><?= $form['banhist'] ?></td>
</tr>
<? } ?>
<tr> <th>Public Ban Reason:</th>
<td><textarea name="public_reason" cols=30 rows=2 title="This is the message that the user will see on the banned page."><?=$form['public_reason']?></textarea></td>
</tr>
<tr> <th>Private Info:</th>
<td><input type="text" name="private_reason" value="<?=$form['private_reason']?>" size=40 title="Additional info that will be not be shown to the user."></td>
</tr>
<tr> <th>Unban in:</th>
<td><input type="text" name="length" value="<?=$form['length']?>" size=3> days [<input type=checkbox name=warn value="1" title="Ban for 0 days" <?= $form['warn']?'CHECKED':'' ?>> Warn] [<input type=checkbox name=indefinite value="1" title="Ban forever" <?= $form['indef']?'CHECKED':'' ?>> Permanent]</td>
</tr>
<tr> <th>Banned by:</th>
<td><input type="text" name="modname" value="<?=$form['modname']?>" size=40 <?= $o['bannedby_edit']?'':'DISABLED' ?>></td>
</tr>
<tr> <th>Ban options:</th>
<td><select name="scope" style="float:left;">
<?
if($form['board']) {
?><option value="local" <?= ($o['scope']=='local')?'SELECTED':'' ?>>Ban from /<?=$form['board']?>/</option><?
}
?><option value="global" <?= ($o['scope']=='global')?'SELECTED':'' ?>>Global ban</option><?
?><option value="zonly" <?= ($o['scope']=='zonly')?'SELECTED':'' ?>>Banish to /z/</option><?
?>
</select>
<? if(!$o['hide_postbans']) { ?>
<span title="Display USER WAS BANNED... message" style="float:left;margin-left:5px">[<input type=checkbox name=banmsg value="1">msg]</span>
<? } ?>
<input type="submit" value="Ban" style="float:right;">
</td>
</tr>
<?
if(!$o['hide_postbans'] || $form['other_ban_reqs']) {
?>
<tr> <th>Post-ban actions:</th>
<td>
<? if(!$o['hide_postbans']) { ?>
<select name="postban">
<option value="" <?= ($o['postban']=='')?'SELECTED':'' ?>>None</option>
<option value="delpost" <?= ($o['postban']=='delpost')?'SELECTED':'' ?>>Delete post</option>
<option value="delfile" <?= ($o['postban']=='delfile')?'SELECTED':'' ?>>Delete file only</option>
<option value="delall" <?= ($o['postban']=='delall')?'SELECTED':'' ?>>Delete all by IP</option>
</select>
<? } ?>
<? if($form['other_ban_reqs']) { ?>
[<input type=checkbox name=clearbanreqs value=1 title="Clear ban reqs"> Clear <?= $form['other_ban_reqs'] ?> other ban request<?= ($form['other_ban_reqs']>1)?'s':'' ?> for this IP]
<? } ?>
</td>
</tr>
<?
}
?>
</table>
</form>
<? if($form['id']) { ?>
<script>
window.onunload = function() {
callInOpener("banCancel(<?=$form['id']?>)");
}
document.forms.banform.onsubmit = function() { window.onunload = function(){}; };
</script>
<? } ?>
</body></html>
<?
return;
}

205
forms/report-test.php Normal file
View file

@ -0,0 +1,205 @@
<?php
// where is report_get_style i can't find it anywhere?
function report_get_style_new( $group )
{
$style = ( $group == 'nws_style' ) ? 'yotsubanew' : 'yotsubluenew';
return '//s.4cdn.org/css/' . $style . '.' . CSS_VERSION . '.css';
}
function report_head( $no, $success = 0, $altCaptcha = false )
{
$defaultcss = DEFAULT_BURICHAN ? 'yotsubluenew' : 'yotsubanew';
if (TEST_BOARD) {
$cssVersion = CSS_VERSION_TEST;
$core_js = 'test/core-8psvqAqszI.' . JS_VERSION_TEST;
}
else {
$cssVersion = CSS_VERSION;
$core_js = 'core.min.' . JS_VERSION_CORE;
}
$sg = style_group();
$styles = array(
'Yotsuba New' => "yotsubanew.$cssVersion.css",
'Yotsuba B New' => "yotsubluenew.$cssVersion.css",
'Futaba New' => "futabanew.$cssVersion.css",
'Burichan New' => "burichannew.$cssVersion.css",
'Photon' => "photon.$cssVersion.css",
'Tomorrow' => "tomorrow.$cssVersion.css"
);
if( !$no ) $no = $_GET['no'];
$no = (int)$no;
$css = '';
if( isset( $_COOKIE[$sg] ) ) {
if( isset( $styles[$_COOKIE[$sg]] ) ) {
$css = '<link rel="stylesheet" title="switch" href="' . STATIC_SERVER . 'css/' . $styles[$_COOKIE[$sg]] . '">';
}
} else {
$dcssl = $defaultcss . '.' . $cssVersion . '.css';
$css = '<link rel="stylesheet" title="switch" href="' . STATIC_SERVER . 'css/' . $dcssl . '">';
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Report Post No.<?=$no ? $no : ""?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<?=$css?>
<style>
fieldset, #pass, button, .rules { margin-bottom: 10px; }
fieldset { width: 320px; }
fieldset legend { font-size: 11pt; font-weight: bold; }
.pass-msg { font-size: smaller; }
#cat-sel { width: 280px; }
.rules { font-size: 10pt; }
.tw:before {
border-bottom: 1px solid;
border-left: 1px solid;
content: " ";
display: inline-block;
height: 8px;
margin-bottom: 3px;
margin-right: 3px;
width: 8px;
}
.tw:before {
margin-left: 5px;
}
.tw {
margin-left: 5px;
margin-top: 2px;
margin-bottom: 12px;
}
</style>
<script>var style_group = "<?=style_group()?>";</script>
<script type="text/javascript" src="<?=STATIC_SERVER?>js/<?php echo $core_js ?>.js"></script>
<script type="text/javascript">
function get_cookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function onReportKeyDown(e) {
if (e.keyCode == 27 && !e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) {
self.close();
}
}
function onCatChange(e) {
document.getElementById('cat-sel').disabled = !document.getElementById('cat1').checked;
}
function onDOMReady(e) {
var el;
if (el = document.getElementById('cat1')) {
el.addEventListener('change', onCatChange, false);
document.getElementById('cat2').addEventListener('change', onCatChange, false);
onCatChange();
}
if (readCookie('pass_enabled') == 1 && (el = document.getElementById('pass'))) {
el.innerHTML = '<strong>You are using a 4chan Pass.</strong>';
}
<?php if( $success ): ?>
if (window.opener) {
window.opener.postMessage('done-report-<?=$no?>-<?php echo BOARD_DIR ?>', '*');
}
<?php endif; ?>
}
document.addEventListener('DOMContentLoaded', onDOMReady, false);
document.addEventListener('keydown', onReportKeyDown, false);
function postBack() {
if (window.opener) {
window.opener.postMessage('done-report', '*');
}
self.close();
}
</script>
</head>
<?
}
function fancydie($err, $success = 0) {
report_head( 0, $success );
$needs_back_button = in_array($err, array(S_NOCAPTCHA, S_BADCAPTCHA, S_CAPTCHATIMEOUT));
$err = "<body><h3><font color='#FF0000'>$err</font></h3>";
if ($needs_back_button) {
$err .= "<br>[<a href=''>Back</a>]</body></html>";
}
else {
if ($success) {
$err .= "<script language=\"JavaScript\">setTimeout(\"self.close()\", 3000);</script>";
}
$err .= "<br>[<a href='javascript:postBack()'>Close</a>]</body></html>";
}
die($err);
}
function form_report($board, $no, $no_captcha = false) {
report_head($no, 0);
$cats = get_report_categories($board, $no, DEFAULT_BURICHAN == 1);
?>
<body>
<form action='' method="POST">
<fieldset id="reportTypes" style="padding: 3px;">
<legend>Report type</legend>
<input type="radio" name="cat" id="cat1" value="" checked> <label for="cat1">This post violates a <a href='//www.<?php echo L::d(BOARD_DIR) ?>/rules#<?php echo $board?>' target="_blank">rule</a>.</label><div class="tw"><select name="cat_id" id="cat-sel"><option value=""></option><?php foreach ($cats['rule'] as $cat_id => $cat): ?>
<option value="<?php echo $cat_id ?>"><?php echo $cat['title'] ?></option><?php endforeach ?></select></div>
<input type="radio" name="cat" id="cat2" value="<?php echo $cats['illegal']['id'] ?>"> <label for="cat2"><?php echo $cats['illegal']['title'] ?></label><br/>
</fieldset>
<div id="pass">
<?php
if (!$no_captcha/* && !isset($_COOKIE['4chan_auser']) && !isset($_COOKIE['pass_enabled'])*/) {
$style_group = style_group();
$dark = isset($_COOKIE[$style_group]) && $_COOKIE[$style_group] === 'Tomorrow';
if (CAPTCHA_TWISTER) {
echo twister_captcha_form();
echo "<script>document.addEventListener('DOMContentLoaded', function() { TCaptcha.init(document.getElementById('t-root'), '" . BOARD_DIR . "', 1); }, false);</script>";
}
else {
echo captcha_form(true, null, $dark);
}
?>
<span class="pass-msg">4chan Pass users can bypass this CAPTCHA. [<a href="https://www.<?php echo L::d(BOARD_DIR) ?>/pass" target="_blank">More Info</a>]</span>
<?php
}
?>
</div>
<div class="rules">Submitting <b>false</b> or <b>misclassified</b> reports will result in a ban.</div>
<button type="submit">Submit</button>
<input type="hidden" name="board" value="<?php echo htmlspecialchars($board) ?>">
<input type="hidden" name="no" value="<?php echo((int)$no) ?>">
</form>
<?php
}

205
forms/report.php Normal file
View file

@ -0,0 +1,205 @@
<?php
// where is report_get_style i can't find it anywhere?
function report_get_style_new( $group )
{
$style = ( $group == 'nws_style' ) ? 'yotsubanew' : 'yotsubluenew';
return '//s.4cdn.org/css/' . $style . '.' . CSS_VERSION . '.css';
}
function report_head( $no, $success = 0, $altCaptcha = false )
{
$defaultcss = DEFAULT_BURICHAN ? 'yotsubluenew' : 'yotsubanew';
if (TEST_BOARD) {
$cssVersion = CSS_VERSION_TEST;
$core_js = 'test/core-8psvqAqszI.' . JS_VERSION_TEST;
}
else {
$cssVersion = CSS_VERSION;
$core_js = 'core.min.' . JS_VERSION_CORE;
}
$sg = style_group();
$styles = array(
'Yotsuba New' => "yotsubanew.$cssVersion.css",
'Yotsuba B New' => "yotsubluenew.$cssVersion.css",
'Futaba New' => "futabanew.$cssVersion.css",
'Burichan New' => "burichannew.$cssVersion.css",
'Photon' => "photon.$cssVersion.css",
'Tomorrow' => "tomorrow.$cssVersion.css"
);
if( !$no ) $no = $_GET['no'];
$no = (int)$no;
$css = '';
if( isset( $_COOKIE[$sg] ) ) {
if( isset( $styles[$_COOKIE[$sg]] ) ) {
$css = '<link rel="stylesheet" title="switch" href="' . STATIC_SERVER . 'css/' . $styles[$_COOKIE[$sg]] . '">';
}
} else {
$dcssl = $defaultcss . '.' . $cssVersion . '.css';
$css = '<link rel="stylesheet" title="switch" href="' . STATIC_SERVER . 'css/' . $dcssl . '">';
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Report Post No.<?=$no ? $no : ""?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<?=$css?>
<style>
fieldset, #pass, button, .rules { margin-bottom: 10px; }
fieldset { width: 320px; }
fieldset legend { font-size: 11pt; font-weight: bold; }
.pass-msg { font-size: smaller; }
#cat-sel { width: 280px; }
.rules { font-size: 10pt; }
.tw:before {
border-bottom: 1px solid;
border-left: 1px solid;
content: " ";
display: inline-block;
height: 8px;
margin-bottom: 3px;
margin-right: 3px;
width: 8px;
}
.tw:before {
margin-left: 5px;
}
.tw {
margin-left: 5px;
margin-top: 2px;
margin-bottom: 12px;
}
</style>
<script>var style_group = "<?=style_group()?>";</script>
<script type="text/javascript" src="<?=STATIC_SERVER?>js/<?php echo $core_js ?>.js"></script>
<script type="text/javascript">
function get_cookie(name) {
var nameEQ = name + "=";
var ca = document.cookie.split(';');
for (var i = 0; i < ca.length; i++) {
var c = ca[i];
while (c.charAt(0) == ' ') c = c.substring(1, c.length);
if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
}
return null;
}
function onReportKeyDown(e) {
if (e.keyCode == 27 && !e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey) {
self.close();
}
}
function onCatChange(e) {
document.getElementById('cat-sel').disabled = !document.getElementById('cat1').checked;
}
function onDOMReady(e) {
var el;
if (el = document.getElementById('cat1')) {
el.addEventListener('change', onCatChange, false);
document.getElementById('cat2').addEventListener('change', onCatChange, false);
onCatChange();
}
if (readCookie('pass_enabled') == 1 && (el = document.getElementById('pass'))) {
el.innerHTML = '<strong>You are using a 4chan Pass.</strong>';
}
<?php if( $success ): ?>
if (window.opener) {
window.opener.postMessage('done-report-<?=$no?>-<?php echo BOARD_DIR ?>', '*');
}
<?php endif; ?>
}
document.addEventListener('DOMContentLoaded', onDOMReady, false);
document.addEventListener('keydown', onReportKeyDown, false);
function postBack() {
if (window.opener) {
window.opener.postMessage('done-report', '*');
}
self.close();
}
</script>
</head>
<?
}
function fancydie($err, $success = 0) {
report_head( 0, $success );
$needs_back_button = in_array($err, array(S_NOCAPTCHA, S_BADCAPTCHA, S_CAPTCHATIMEOUT));
$err = "<body><h3><font color='#FF0000'>$err</font></h3>";
if ($needs_back_button) {
$err .= "<br>[<a href=''>Back</a>]</body></html>";
}
else {
if ($success) {
$err .= "<script language=\"JavaScript\">setTimeout(\"self.close()\", 3000);</script>";
}
$err .= "<br>[<a href='javascript:postBack()'>Close</a>]</body></html>";
}
die($err);
}
function form_report($board, $no, $no_captcha = false) {
report_head($no, 0);
$cats = get_report_categories($board, $no, DEFAULT_BURICHAN == 1);
?>
<body>
<form action='' method="POST">
<fieldset id="reportTypes" style="padding: 3px;">
<legend>Report type</legend>
<input type="radio" name="cat" id="cat1" value="" checked> <label for="cat1">This post violates a <a href='//www.<?php echo L::d(BOARD_DIR) ?>/rules#<?php echo $board?>' target="_blank">rule</a>.</label><div class="tw"><select name="cat_id" id="cat-sel"><option value=""></option><?php foreach ($cats['rule'] as $cat_id => $cat): ?>
<option value="<?php echo $cat_id ?>"><?php echo $cat['title'] ?></option><?php endforeach ?></select></div>
<input type="radio" name="cat" id="cat2" value="<?php echo $cats['illegal']['id'] ?>"> <label for="cat2"><?php echo $cats['illegal']['title'] ?></label><br/>
</fieldset>
<div id="pass">
<?php
if (!$no_captcha && !isset($_COOKIE['4chan_auser']) && !isset($_COOKIE['pass_enabled'])) {
$style_group = style_group();
$dark = isset($_COOKIE[$style_group]) && $_COOKIE[$style_group] === 'Tomorrow';
if (CAPTCHA_TWISTER) {
echo twister_captcha_form();
echo "<script>document.addEventListener('DOMContentLoaded', function() { TCaptcha.init(document.getElementById('t-root'), '" . BOARD_DIR . "', 1); }, false);</script>";
}
else {
echo captcha_form(true, null, $dark);
}
?>
<span class="pass-msg">4chan Pass users can bypass this CAPTCHA. [<a href="https://www.<?php echo L::d(BOARD_DIR) ?>/pass" target="_blank">More Info</a>]</span>
<?php
}
?>
</div>
<div class="rules">Submitting <b>false</b> or <b>misclassified</b> reports will result in a ban.</div>
<button type="submit">Submit</button>
<input type="hidden" name="board" value="<?php echo htmlspecialchars($board) ?>">
<input type="hidden" name="no" value="<?php echo((int)$no) ?>">
</form>
<?php
}