|
|
@ -7,7 +7,8 @@ require_once 'inc/bootstrap.php'; |
|
|
|
|
|
|
|
$dropped_post = false; |
|
|
|
|
|
|
|
function handle_nntpchan() { |
|
|
|
function handle_nntpchan() |
|
|
|
{ |
|
|
|
global $config; |
|
|
|
if ($_SERVER['REMOTE_ADDR'] != $config['nntpchan']['trusted_peer']) { |
|
|
|
error("NNTPChan: Forbidden. $_SERVER[REMOTE_ADDR] is not a trusted peer"); |
|
|
@ -21,10 +22,12 @@ function handle_nntpchan() { |
|
|
|
if (!isset($_GET['Message-Id'])) { |
|
|
|
if (!isset($_GET['Message-ID'])) { |
|
|
|
error("NNTPChan: No message ID"); |
|
|
|
} else { |
|
|
|
$msgid = $_GET['Message-ID']; |
|
|
|
} |
|
|
|
else $msgid = $_GET['Message-ID']; |
|
|
|
} else { |
|
|
|
$msgid = $_GET['Message-Id']; |
|
|
|
} |
|
|
|
else $msgid = $_GET['Message-Id']; |
|
|
|
|
|
|
|
$groups = preg_split("/,\s*/", $_GET['Newsgroups']); |
|
|
|
if (count($groups) != 1) { |
|
|
@ -82,8 +85,7 @@ function handle_nntpchan() { |
|
|
|
|
|
|
|
if ($ct == 'text/plain') { |
|
|
|
$content = file_get_contents("php://input"); |
|
|
|
} |
|
|
|
elseif ($ct == 'multipart/mixed' || $ct == 'multipart/form-data') { |
|
|
|
} elseif ($ct == 'multipart/mixed' || $ct == 'multipart/form-data') { |
|
|
|
_syslog(LOG_INFO, "MM: Files: " . print_r($GLOBALS, true)); // Debug |
|
|
|
|
|
|
|
$content = ''; |
|
|
@ -92,10 +94,10 @@ function handle_nntpchan() { |
|
|
|
foreach ($_FILES['attachment']['error'] as $id => $error) { |
|
|
|
if ($_FILES['attachment']['type'][$id] == 'text/plain') { |
|
|
|
$content .= file_get_contents($_FILES['attachment']['tmp_name'][$id]); |
|
|
|
} |
|
|
|
elseif ($_FILES['attachment']['type'][$id] == 'message/rfc822') { // Signed message, ignore for now |
|
|
|
} |
|
|
|
else { // A real attachment :^) |
|
|
|
} elseif ($_FILES['attachment']['type'][$id] == 'message/rfc822') { |
|
|
|
// Signed message, ignore for now |
|
|
|
} else { |
|
|
|
// A real attachment :^) |
|
|
|
$file = array(); |
|
|
|
$file['name'] = $_FILES['attachment']['name'][$id]; |
|
|
|
$file['type'] = $_FILES['attachment']['type'][$id]; |
|
|
@ -108,8 +110,7 @@ function handle_nntpchan() { |
|
|
|
} |
|
|
|
|
|
|
|
$_FILES = $newfiles; |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
error("NNTPChan: Wrong mime type: $ct"); |
|
|
|
} |
|
|
|
|
|
|
@ -140,14 +141,12 @@ function handle_nntpchan() { |
|
|
|
$ary = $query->fetchAll(PDO::FETCH_ASSOC); |
|
|
|
if (count($ary) == 0) { |
|
|
|
return ">>>>$id"; |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
$ret = array(); |
|
|
|
foreach ($ary as $v) { |
|
|
|
if ($v['board'] != $xboard) { |
|
|
|
$ret[] = ">>>/" . $v['board'] . "/" . $v['id']; |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
$ret[] = ">>" . $v['id']; |
|
|
|
} |
|
|
|
} |
|
|
@ -164,15 +163,15 @@ function handle_nntpchan() { |
|
|
|
'headers' => $headers, |
|
|
|
'from_nntp' => true, |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function handle_delete(){ |
|
|
|
function handle_delete() |
|
|
|
{ |
|
|
|
// Delete |
|
|
|
global $config, $board, $mod; |
|
|
|
if (!isset($_POST['board'], $_POST['password'])) |
|
|
|
if (!isset($_POST['board'], $_POST['password'])) { |
|
|
|
error($config['error']['bot']); |
|
|
|
} |
|
|
|
|
|
|
|
check_login(false); |
|
|
|
$is_mod = !!$mod; |
|
|
@ -182,11 +181,11 @@ function handle_delete(){ |
|
|
|
error($config['error']['notamod']); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
$password = &$_POST['password']; |
|
|
|
|
|
|
|
if ($password == '') |
|
|
|
if ($password == '') { |
|
|
|
error($config['error']['invalidpassword']); |
|
|
|
} |
|
|
|
|
|
|
|
$delete = array(); |
|
|
|
foreach ($_POST as $post => $value) { |
|
|
@ -198,22 +197,26 @@ function handle_delete(){ |
|
|
|
checkDNSBL(); |
|
|
|
|
|
|
|
// Check if board exists |
|
|
|
if (!openBoard($_POST['board'])) |
|
|
|
if (!openBoard($_POST['board'])) { |
|
|
|
error($config['error']['noboard']); |
|
|
|
} |
|
|
|
|
|
|
|
// Check if mod has permission to delete posts in this board |
|
|
|
if ($is_mod && !hasPermission($config['mod']['delete'], $board)) |
|
|
|
if ($is_mod && !hasPermission($config['mod']['delete'], $board)) { |
|
|
|
error($config['error']['noaccess']); |
|
|
|
} |
|
|
|
|
|
|
|
// Check if banned |
|
|
|
checkBan($board['uri']); |
|
|
|
|
|
|
|
// Check if deletion is enabled |
|
|
|
if (!$is_mod && !$config['allow_delete']) |
|
|
|
if (!$is_mod && !$config['allow_delete']) { |
|
|
|
error(_('Post deletion is not allowed!')); |
|
|
|
} |
|
|
|
|
|
|
|
if (empty($delete)) |
|
|
|
if (empty($delete)) { |
|
|
|
error($config['error']['nodelete']); |
|
|
|
} |
|
|
|
|
|
|
|
foreach ($delete as &$id) { |
|
|
|
$query = prepare(sprintf("SELECT `thread`, `time`,`password` FROM ``posts_%s`` WHERE `id` = :id", $board['uri'])); |
|
|
@ -234,10 +237,12 @@ function handle_delete(){ |
|
|
|
error($config['error']['nodeletethread']); |
|
|
|
} |
|
|
|
|
|
|
|
if ($password != '' |
|
|
|
if ( |
|
|
|
$password != '' |
|
|
|
&& $post['password'] != $password |
|
|
|
&& (!$thread || $thread['password'] != $password) |
|
|
|
&& !$is_mod) { |
|
|
|
&& !$is_mod |
|
|
|
) { |
|
|
|
error($config['error']['invalidpassword']); |
|
|
|
} |
|
|
|
|
|
|
@ -255,7 +260,9 @@ function handle_delete(){ |
|
|
|
modLog("User deleted his own post #$id"); |
|
|
|
} |
|
|
|
|
|
|
|
_syslog(LOG_INFO, 'Deleted post: ' . |
|
|
|
_syslog( |
|
|
|
LOG_INFO, |
|
|
|
'Deleted post: ' . |
|
|
|
'/' . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $post['thread'] ? $post['thread'] : $id) . ($post['thread'] ? '#' . $id : '') |
|
|
|
); |
|
|
|
} |
|
|
@ -279,10 +286,10 @@ function handle_delete(){ |
|
|
|
@fastcgi_finish_request(); |
|
|
|
|
|
|
|
rebuildThemes('post-delete', $board['uri']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function handle_report(){ |
|
|
|
function handle_report() |
|
|
|
{ |
|
|
|
global $config, $board; |
|
|
|
if (!isset($_POST['board'], $_POST['reason'])) |
|
|
|
error($config['error']['bot']); |
|
|
@ -303,14 +310,17 @@ function handle_report(){ |
|
|
|
// Check if banned |
|
|
|
checkBan($board['uri']); |
|
|
|
|
|
|
|
if (empty($report)) |
|
|
|
if (empty($report)) { |
|
|
|
error($config['error']['noreport']); |
|
|
|
} |
|
|
|
|
|
|
|
if (strlen($_POST['reason']) > $config['report_max_length']) |
|
|
|
if (strlen($_POST['reason']) > $config['report_max_length']) { |
|
|
|
error($config['error']['toolongreport']); |
|
|
|
} |
|
|
|
|
|
|
|
if (count($report) > $config['report_limit']) |
|
|
|
if (count($report) > $config['report_limit']) { |
|
|
|
error($config['error']['toomanyreports']); |
|
|
|
} |
|
|
|
|
|
|
|
if ($config['report_captcha'] && !isset($_POST['captcha_text'], $_POST['captcha_cookie'])) { |
|
|
|
error($config['error']['bot']); |
|
|
@ -345,7 +355,9 @@ function handle_report(){ |
|
|
|
} |
|
|
|
|
|
|
|
if ($config['syslog']) |
|
|
|
_syslog(LOG_INFO, 'Reported post: ' . |
|
|
|
_syslog( |
|
|
|
LOG_INFO, |
|
|
|
'Reported post: ' . |
|
|
|
'/' . $board['dir'] . $config['dir']['res'] . link_for($thread) . ($thread['thread'] ? '#' . $id : '') . |
|
|
|
' for "' . $reason . '"' |
|
|
|
); |
|
|
@ -357,17 +369,17 @@ function handle_report(){ |
|
|
|
$query->bindValue(':reason', $reason, PDO::PARAM_STR); |
|
|
|
$query->execute() or error(db_error($query)); |
|
|
|
|
|
|
|
if ($config['slack']) |
|
|
|
{ |
|
|
|
|
|
|
|
if ($config['slack']) { |
|
|
|
function slack($message, $room = "reports", $icon = ":no_entry_sign:") |
|
|
|
{ |
|
|
|
$room = ($room) ? $room : "reports"; |
|
|
|
$data = "payload=" . json_encode(array( |
|
|
|
$data = "payload=" . json_encode( |
|
|
|
array( |
|
|
|
"channel" => "#{$room}", |
|
|
|
"text" => urlencode($message), |
|
|
|
"icon_emoji" => $icon |
|
|
|
)); |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
// You can get your webhook endpoint from your Slack settings |
|
|
|
// For some reason using the configuration key doesn't work |
|
|
@ -386,7 +398,6 @@ function handle_report(){ |
|
|
|
$slackmessage = '<' . $config['domain'] . "/mod.php?/" . $board['dir'] . $config['dir']['res'] . ($thread['thread'] ? $thread['thread'] : $id) . ".html" . ($thread['thread'] ? '#' . $id : '') . '> \n ' . $reason . '\n ' . $postcontent . '\n'; |
|
|
|
|
|
|
|
$slackresult = slack($slackmessage, $config['slack_channel']); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -397,10 +408,12 @@ function handle_report(){ |
|
|
|
$trimmed_post = strlen($thread['body_nomarkup']) > $config['matrix']['max_message_length'] ? ' [...]' : ''; |
|
|
|
$postcontent = mb_substr($thread['body_nomarkup'], 0, $config['matrix']['max_message_length']) . $trimmed_post; |
|
|
|
$matrix_message = $reported_post_url . ($thread['thread'] ? '#' . $id : '') . " \nReason:\n" . $reason . " \nPost:\n" . $postcontent . " \n"; |
|
|
|
$post_data = json_encode(array( |
|
|
|
$post_data = json_encode( |
|
|
|
array( |
|
|
|
"msgtype" => "m.text", |
|
|
|
"body" => $matrix_message |
|
|
|
)); |
|
|
|
) |
|
|
|
); |
|
|
|
|
|
|
|
$ch = curl_init($post_url); |
|
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data); |
|
|
@ -423,10 +436,10 @@ function handle_report(){ |
|
|
|
header('Content-Type: text/json'); |
|
|
|
echo json_encode(array('success' => true)); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
function handle_post(){ |
|
|
|
function handle_post() |
|
|
|
{ |
|
|
|
global $config, $dropped_post, $board, $mod, $pdo; |
|
|
|
|
|
|
|
if (!isset($_POST['body'], $_POST['board']) && !$dropped_post) { |
|
|
@ -436,8 +449,9 @@ function handle_post(){ |
|
|
|
$post = array('board' => $_POST['board'], 'files' => array()); |
|
|
|
|
|
|
|
// Check if board exists |
|
|
|
if (!openBoard($post['board'])) |
|
|
|
if (!openBoard($post['board'])) { |
|
|
|
error($config['error']['noboard']); |
|
|
|
} |
|
|
|
|
|
|
|
$board_locked_check = (!isset($_POST['mod']) || !$_POST['mod']) |
|
|
|
&& ($config['board_locked'] === true |
|
|
@ -447,14 +461,17 @@ function handle_post(){ |
|
|
|
error("Board is locked"); |
|
|
|
} |
|
|
|
|
|
|
|
if (!isset($_POST['name'])) |
|
|
|
if (!isset($_POST['name'])) { |
|
|
|
$_POST['name'] = $config['anonymous']; |
|
|
|
} |
|
|
|
|
|
|
|
if (!isset($_POST['email'])) |
|
|
|
if (!isset($_POST['email'])) { |
|
|
|
$_POST['email'] = ''; |
|
|
|
} |
|
|
|
|
|
|
|
if (!isset($_POST['subject'])) |
|
|
|
if (!isset($_POST['subject'])) { |
|
|
|
$_POST['subject'] = ''; |
|
|
|
} |
|
|
|
|
|
|
|
if (!isset($_POST['password'])) |
|
|
|
$_POST['password'] = ''; |
|
|
@ -473,10 +490,14 @@ function handle_post(){ |
|
|
|
if (!isset($_POST['g-recaptcha-response'])) |
|
|
|
error($config['error']['bot']); |
|
|
|
// Check what reCAPTCHA has to say... |
|
|
|
$resp = json_decode(file_get_contents(sprintf('https://www.google.com/recaptcha/api/siteverify?secret=%s&response=%s&remoteip=%s', |
|
|
|
$resp = json_decode(file_get_contents( |
|
|
|
sprintf( |
|
|
|
'https://www.google.com/recaptcha/api/siteverify?secret=%s&response=%s&remoteip=%s', |
|
|
|
$config['recaptcha_private'], |
|
|
|
urlencode($_POST['g-recaptcha-response']), |
|
|
|
$_SERVER['REMOTE_ADDR'])), true); |
|
|
|
$_SERVER['REMOTE_ADDR'] |
|
|
|
) |
|
|
|
), true); |
|
|
|
|
|
|
|
if (!$resp['success']) { |
|
|
|
error($config['error']['captcha']); |
|
|
@ -490,7 +511,6 @@ function handle_post(){ |
|
|
|
} |
|
|
|
|
|
|
|
if (isset($config['securimage']) && $config['securimage']) { |
|
|
|
|
|
|
|
if (!isset($_POST['captcha'])) { |
|
|
|
error($config['error']['securimage']['missing']); |
|
|
|
} |
|
|
@ -510,15 +530,18 @@ function handle_post(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!(($post['op'] && $_POST['post'] == $config['button_newtopic']) || |
|
|
|
(!$post['op'] && $_POST['post'] == $config['button_reply']))) { |
|
|
|
|
|
|
|
if ( |
|
|
|
!(($post['op'] && $_POST['post'] == $config['button_newtopic']) || |
|
|
|
(!$post['op'] && $_POST['post'] == $config['button_reply'])) |
|
|
|
) { |
|
|
|
error($config['error']['bot']); |
|
|
|
} |
|
|
|
|
|
|
|
// Check the referrer |
|
|
|
if ($config['referer_match'] !== false && |
|
|
|
(!isset($_SERVER['HTTP_REFERER']) || !preg_match($config['referer_match'], rawurldecode($_SERVER['HTTP_REFERER'])))) { |
|
|
|
if ( |
|
|
|
$config['referer_match'] !== false && |
|
|
|
(!isset($_SERVER['HTTP_REFERER']) || !preg_match($config['referer_match'], rawurldecode($_SERVER['HTTP_REFERER']))) |
|
|
|
) { |
|
|
|
error($config['error']['referer']); |
|
|
|
} |
|
|
|
|
|
|
@ -538,18 +561,23 @@ function handle_post(){ |
|
|
|
$post['locked'] = $post['op'] && isset($_POST['lock']); |
|
|
|
$post['raw'] = isset($_POST['raw']); |
|
|
|
|
|
|
|
if ($post['sticky'] && !hasPermission($config['mod']['sticky'], $board['uri'])) |
|
|
|
if ($post['sticky'] && !hasPermission($config['mod']['sticky'], $board['uri'])) { |
|
|
|
error($config['error']['noaccess']); |
|
|
|
if ($post['locked'] && !hasPermission($config['mod']['lock'], $board['uri'])) |
|
|
|
} |
|
|
|
if ($post['locked'] && !hasPermission($config['mod']['lock'], $board['uri'])) { |
|
|
|
error($config['error']['noaccess']); |
|
|
|
if ($post['raw'] && !hasPermission($config['mod']['rawhtml'], $board['uri'])) |
|
|
|
} |
|
|
|
if ($post['raw'] && !hasPermission($config['mod']['rawhtml'], $board['uri'])) { |
|
|
|
error($config['error']['noaccess']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!$post['mod'] && $config['spam']['enabled'] == true) { |
|
|
|
$post['antispam_hash'] = checkSpam( |
|
|
|
array($board['uri'], |
|
|
|
isset($post['thread']) ? $post['thread'] : ($config['try_smarter'] && isset($_POST['page']) ? 0 - (int)$_POST['page'] : null)) |
|
|
|
array( |
|
|
|
$board['uri'], |
|
|
|
isset($post['thread']) ? $post['thread'] : ($config['try_smarter'] && isset($_POST['page']) ? 0 - (int) $_POST['page'] : null) |
|
|
|
) |
|
|
|
); |
|
|
|
//$post['antispam_hash'] = checkSpam(); |
|
|
|
|
|
|
@ -561,8 +589,7 @@ function handle_post(){ |
|
|
|
if ($config['robot_enable'] && $config['robot_mute']) { |
|
|
|
checkMute(); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
$mod = $post['mod'] = false; |
|
|
|
} |
|
|
|
|
|
|
@ -576,8 +603,7 @@ function handle_post(){ |
|
|
|
// Non-existant |
|
|
|
error($config['error']['nonexistant']); |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
$thread = false; |
|
|
|
} |
|
|
|
|
|
|
@ -601,43 +627,53 @@ function handle_post(){ |
|
|
|
} |
|
|
|
|
|
|
|
if (!hasPermission($config['mod']['bypass_field_disable'], $board['uri'])) { |
|
|
|
if ($config['field_disable_name']) |
|
|
|
$_POST['name'] = $config['anonymous']; // "forced anonymous" |
|
|
|
if ($config['field_disable_name']) { |
|
|
|
// "forced anonymous". |
|
|
|
$_POST['name'] = $config['anonymous']; |
|
|
|
} |
|
|
|
|
|
|
|
if ($config['field_disable_email']) |
|
|
|
if ($config['field_disable_email']) { |
|
|
|
$_POST['email'] = ''; |
|
|
|
} |
|
|
|
|
|
|
|
if ($config['field_disable_password']) |
|
|
|
if ($config['field_disable_password']) { |
|
|
|
$_POST['password'] = ''; |
|
|
|
} |
|
|
|
|
|
|
|
if ($config['field_disable_subject'] || (!$post['op'] && $config['field_disable_reply_subject'])) |
|
|
|
if ($config['field_disable_subject'] || (!$post['op'] && $config['field_disable_reply_subject'])) { |
|
|
|
$_POST['subject'] = ''; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ($config['allow_upload_by_url'] && isset($_POST['file_url1']) && !empty($_POST['file_url1'])) { |
|
|
|
function unlink_tmp_file($file) { |
|
|
|
function unlink_tmp_file($file) |
|
|
|
{ |
|
|
|
@unlink($file); |
|
|
|
fatal_error_handler(); |
|
|
|
} |
|
|
|
|
|
|
|
function upload_by_url($config,$post,$url) { |
|
|
|
function upload_by_url($config, $post, $url) |
|
|
|
{ |
|
|
|
$post['file_url'] = $url; |
|
|
|
if (!preg_match('@^https?://@', $post['file_url'])) |
|
|
|
if (!preg_match('@^https?://@', $post['file_url'])) { |
|
|
|
error($config['error']['invalidimg']); |
|
|
|
} |
|
|
|
|
|
|
|
if (mb_strpos($post['file_url'], '?') !== false) |
|
|
|
if (mb_strpos($post['file_url'], '?') !== false) { |
|
|
|
$url_without_params = mb_substr($post['file_url'], 0, mb_strpos($post['file_url'], '?')); |
|
|
|
else |
|
|
|
} else { |
|
|
|
$url_without_params = $post['file_url']; |
|
|
|
} |
|
|
|
|
|
|
|
$post['extension'] = strtolower(mb_substr($url_without_params, mb_strrpos($url_without_params, '.') + 1)); |
|
|
|
|
|
|
|
if ($post['op'] && $config['allowed_ext_op']) { |
|
|
|
if (!in_array($post['extension'], $config['allowed_ext_op'])) |
|
|
|
if (!in_array($post['extension'], $config['allowed_ext_op'])) { |
|
|
|
error($config['error']['unknownext']); |
|
|
|
} |
|
|
|
else if (!in_array($post['extension'], $config['allowed_ext']) && !in_array($post['extension'], $config['allowed_ext_files'])) |
|
|
|
} else if (!in_array($post['extension'], $config['allowed_ext']) && !in_array($post['extension'], $config['allowed_ext_files'])) { |
|
|
|
error($config['error']['unknownext']); |
|
|
|
} |
|
|
|
|
|
|
|
$post['file_tmp'] = tempnam($config['tmp'], 'url'); |
|
|
|
register_shutdown_function('unlink_tmp_file', $post['file_tmp']); |
|
|
@ -656,8 +692,9 @@ function handle_post(){ |
|
|
|
curl_setopt($curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS); |
|
|
|
curl_setopt($curl, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4); |
|
|
|
|
|
|
|
if (curl_exec($curl) === false) |
|
|
|
if (curl_exec($curl) === false) { |
|
|
|
error($config['error']['nomove'] . '<br/>Curl says: ' . curl_error($curl)); |
|
|
|
} |
|
|
|
|
|
|
|
curl_close($curl); |
|
|
|
|
|
|
@ -678,7 +715,6 @@ function handle_post(){ |
|
|
|
upload_by_url($config, $post, $_POST[$varname]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Convert multiple upload format to array of files. This makes the following code |
|
|
@ -738,8 +774,7 @@ function handle_post(){ |
|
|
|
error($config['error']['image_hard_limit']); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
if (!$post['op']) { |
|
|
|
$numposts = numPosts($post['thread']); |
|
|
|
} |
|
|
@ -772,11 +807,14 @@ function handle_post(){ |
|
|
|
} |
|
|
|
|
|
|
|
if ($size > $max_size) |
|
|
|
error(sprintf3($config['error']['filesize'], array( |
|
|
|
error(sprintf3( |
|
|
|
$config['error']['filesize'], |
|
|
|
array( |
|
|
|
'sz' => number_format($size), |
|
|
|
'filesz' => number_format($size), |
|
|
|
'maxsz' => number_format($config['max_filesize']) |
|
|
|
))); |
|
|
|
) |
|
|
|
)); |
|
|
|
$post['filesize'] = $size; |
|
|
|
} |
|
|
|
|
|
|
@ -787,22 +825,22 @@ function handle_post(){ |
|
|
|
$cap = $matches[3]; |
|
|
|
|
|
|
|
if (isset($config['mod']['capcode'][$mod['type']])) { |
|
|
|
if ( $config['mod']['capcode'][$mod['type']] === true || |
|
|
|
if ( |
|
|
|
$config['mod']['capcode'][$mod['type']] === true || |
|
|
|
(is_array($config['mod']['capcode'][$mod['type']]) && |
|
|
|
in_array($cap, $config['mod']['capcode'][$mod['type']]) |
|
|
|
)) { |
|
|
|
) |
|
|
|
) { |
|
|
|
|
|
|
|
$post['capcode'] = utf8tohtml($cap); |
|
|
|
$post['name'] = $name; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else if ($config['joke_capcode']) { |
|
|
|
} else if ($config['joke_capcode']) { |
|
|
|
if (strtolower($post['email']) == 'joke') { |
|
|
|
if (isset($config['joke_capcode_default'])) { |
|
|
|
$cap = $config['joke_capcode_default']; |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
$cap = "joke"; |
|
|
|
} |
|
|
|
$post['capcode'] = utf8tohtml($cap); |
|
|
@ -821,17 +859,22 @@ function handle_post(){ |
|
|
|
} elseif (strtolower($post['email']) == 'nonoko') { |
|
|
|
$noko = false; |
|
|
|
$post['email'] = ''; |
|
|
|
} else $noko = $config['always_noko']; |
|
|
|
} else { |
|
|
|
$noko = $config['always_noko']; |
|
|
|
} |
|
|
|
|
|
|
|
if ($post['has_file']) { |
|
|
|
$i = 0; |
|
|
|
foreach ($_FILES as $key => $file) { |
|
|
|
if ($file['size'] && $file['tmp_name']) { |
|
|
|
if (!in_array($file['error'], array(UPLOAD_ERR_NO_FILE, UPLOAD_ERR_OK))) { |
|
|
|
error(sprintf3($config['error']['phpfileserror'], array( |
|
|
|
error(sprintf3( |
|
|
|
$config['error']['phpfileserror'], |
|
|
|
array( |
|
|
|
'index' => $i + 1, |
|
|
|
'code' => $file['error'] |
|
|
|
))); |
|
|
|
) |
|
|
|
)); |
|
|
|
} |
|
|
|
$post['files'][] = process_filenames($file, $board['dir'], (sizeof($_FILES) > 1), $i); |
|
|
|
$i++; |
|
|
@ -839,7 +882,9 @@ function handle_post(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (empty($post['files'])) $post['has_file'] = false; |
|
|
|
if (empty($post['files'])) { |
|
|
|
$post['has_file'] = false; |
|
|
|
} |
|
|
|
|
|
|
|
if (!$dropped_post) { |
|
|
|
// Check for a file |
|
|
@ -896,11 +941,13 @@ function handle_post(){ |
|
|
|
if (($config['country_flags'] && !$config['allow_no_country']) || ($config['country_flags'] && $config['allow_no_country'] && !isset($_POST['no_country']))) { |
|
|
|
$gi = geoip_open('inc/lib/geoip/GeoIPv6.dat', GEOIP_STANDARD); |
|
|
|
|
|
|
|
function ipv4to6($ip) { |
|
|
|
function ipv4to6($ip) |
|
|
|
{ |
|
|
|
if (strpos($ip, ':') !== false) { |
|
|
|
if (strpos($ip, '.') > 0) |
|
|
|
$ip = substr($ip, strrpos($ip, ':') + 1); |
|
|
|
else return $ip; //native ipv6 |
|
|
|
else |
|
|
|
return $ip; //native ipv6 |
|
|
|
} |
|
|
|
$iparr = array_pad(explode('.', $ip), 4, 0); |
|
|
|
$part7 = base_convert(($iparr[0] * 256) + $iparr[1], 10, 16); |
|
|
@ -917,11 +964,11 @@ function handle_post(){ |
|
|
|
|
|
|
|
if ($config['user_flag'] && isset($_POST['user_flag'])) |
|
|
|
if (!empty($_POST['user_flag'])) { |
|
|
|
|
|
|
|
$user_flag = $_POST['user_flag']; |
|
|
|
|
|
|
|
if (!isset($config['user_flags'][$user_flag])) |
|
|
|
if (!isset($config['user_flags'][$user_flag])) { |
|
|
|
error(_('Invalid flag selection!')); |
|
|
|
} |
|
|
|
|
|
|
|
$flag_alt = isset($user_flag_alt) ? $user_flag_alt : $config['user_flags'][$user_flag]; |
|
|
|
|
|
|
@ -933,11 +980,12 @@ function handle_post(){ |
|
|
|
$post['body'] .= "\n<tinyboard tag>" . $_POST['tag'] . "</tinyboard>"; |
|
|
|
} |
|
|
|
|
|
|
|
if (!$dropped_post) |
|
|
|
if (!$dropped_post) { |
|
|
|
if ($config['proxy_save'] && isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { |
|
|
|
$proxy = preg_replace("/[^0-9a-fA-F.,: ]/", '', $_SERVER['HTTP_X_FORWARDED_FOR']); |
|
|
|
$post['body'] .= "\n<tinyboard proxy>" . $proxy . "</tinyboard>"; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (mysql_version() >= 50503) { |
|
|
|
$post['body_nomarkup'] = $post['body']; // Assume we're using the utf8mb4 charset |
|
|
@ -960,8 +1008,12 @@ function handle_post(){ |
|
|
|
|
|
|
|
if ($post['has_file']) { |
|
|
|
$md5cmd = false; |
|
|
|
if ($config['bsd_md5']) $md5cmd = '/sbin/md5 -r'; |
|
|
|
if ($config['gnu_md5']) $md5cmd = 'md5sum'; |
|
|
|
if ($config['bsd_md5']) { |
|
|
|
$md5cmd = '/sbin/md5 -r'; |
|
|
|
} |
|
|
|
if ($config['gnu_md5']) { |
|
|
|
$md5cmd = 'md5sum'; |
|
|
|
} |
|
|
|
|
|
|
|
$allhashes = ''; |
|
|
|
|
|
|
@ -981,15 +1033,15 @@ function handle_post(){ |
|
|
|
|
|
|
|
$upload = $file['tmp_name']; |
|
|
|
|
|
|
|
if (!is_readable($upload)) |
|
|
|
if (!is_readable($upload)) { |
|
|
|
error($config['error']['nomove']); |
|
|
|
} |
|
|
|
|
|
|
|
if ($md5cmd) { |
|
|
|
$output = shell_exec_error($md5cmd . " " . escapeshellarg($upload)); |
|
|
|
$output = explode(' ', $output); |
|
|
|
$hash = $output[0]; |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
$hash = md5_file($upload); |
|
|
|
} |
|
|
|
|
|
|
@ -999,15 +1051,13 @@ function handle_post(){ |
|
|
|
|
|
|
|
if (count($post['files']) == 1) { |
|
|
|
$post['filehash'] = $hash; |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
$post['filehash'] = md5($allhashes); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!hasPermission($config['mod']['bypass_filters'], $board['uri']) && !$dropped_post) { |
|
|
|
require_once 'inc/filters.php'; |
|
|
|
|
|
|
|
do_filters($post); |
|
|
|
} |
|
|
|
|
|
|
@ -1048,14 +1098,16 @@ function handle_post(){ |
|
|
|
$error = shell_exec_error(($gm ? 'gm ' : '') . 'convert ' . |
|
|
|
escapeshellarg($file['tmp_name']) . ' ' . |
|
|
|
ImageConvert::jpeg_exif_orientation(false, $exif) . ' ' . |
|
|
|
($config['strip_exif'] ? '+profile "*"' : |
|
|
|
($config['use_exiftool'] ? '' : '+profile "*"') |
|
|
|
($config['strip_exif'] ? '+profile "*"' : ($config['use_exiftool'] ? '' : '+profile "*"') |
|
|
|
) . ' ' . |
|
|
|
escapeshellarg($file['tmp_name'])); |
|
|
|
if ($config['use_exiftool'] && !$config['strip_exif']) { |
|
|
|
if ($exiftool_error = shell_exec_error( |
|
|
|
if ( |
|
|
|
$exiftool_error = shell_exec_error( |
|
|
|
'exiftool -overwrite_original -q -q -orientation=1 -n ' . |
|
|
|
escapeshellarg($file['tmp_name']))) |
|
|
|
escapeshellarg($file['tmp_name']) |
|
|
|
) |
|
|
|
) |
|
|
|
error(_('exiftool failed!'), null, $exiftool_error); |
|
|
|
} else { |
|
|
|
// TODO: Find another way to remove the Orientation tag from the EXIF profile |
|
|
@ -1069,12 +1121,13 @@ function handle_post(){ |
|
|
|
error(_('Could not auto-orient image!'), null, $error); |
|
|
|
} |
|
|
|
$size = @getimagesize($file['tmp_name']); |
|
|
|
if ($config['strip_exif']) |
|
|
|
if ($config['strip_exif']) { |
|
|
|
$file['exif_stripped'] = true; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// create image object |
|
|
|
$image = new Image($file['tmp_name'], $file['extension'], $size); |
|
|
@ -1093,11 +1146,12 @@ function handle_post(){ |
|
|
|
$size = @getimagesize($config['spoiler_image']); |
|
|
|
$file['thumbwidth'] = $size[0]; |
|
|
|
$file['thumbheight'] = $size[1]; |
|
|
|
} elseif ($config['minimum_copy_resize'] && |
|
|
|
} elseif ( |
|
|
|
$config['minimum_copy_resize'] && |
|
|
|
$image->size->width <= $config['thumb_width'] && |
|
|
|
$image->size->height <= $config['thumb_height'] && |
|
|
|
$file['extension'] == ($config['thumb_ext'] ? $config['thumb_ext'] : $file['extension'])) { |
|
|
|
|
|
|
|
$file['extension'] == ($config['thumb_ext'] ? $config['thumb_ext'] : $file['extension']) |
|
|
|
) { |
|
|
|
// Copy, because there's nothing to resize |
|
|
|
copy($file['tmp_name'], $file['thumb']); |
|
|
|
|
|
|
@ -1120,14 +1174,17 @@ function handle_post(){ |
|
|
|
|
|
|
|
if ($config['redraw_image'] || (!@$file['exif_stripped'] && $config['strip_exif'] && ($file['extension'] == 'jpg' || $file['extension'] == 'jpeg'))) { |
|
|
|
if (!$config['redraw_image'] && $config['use_exiftool']) { |
|
|
|
if($error = shell_exec_error('exiftool -overwrite_original -ignoreMinorErrors -q -q -all= ' . |
|
|
|
escapeshellarg($file['tmp_name']))) { |
|
|
|
if ( |
|
|
|
$error = shell_exec_error('exiftool -overwrite_original -ignoreMinorErrors -q -q -all= ' . |
|
|
|
escapeshellarg($file['tmp_name'])) |
|
|
|
) { |
|
|
|
error(_('Could not strip EXIF metadata!'), null, $error); |
|
|
|
} else { |
|
|
|
clearstatcache(true, $file['tmp_name']); |
|
|
|
if (($newfilesize = filesize($file['tmp_name'])) !== false) |
|
|
|
if (($newfilesize = filesize($file['tmp_name'])) !== false) { |
|
|
|
$file['size'] = $newfilesize; |
|
|
|
} |
|
|
|
} |
|
|
|
} else { |
|
|
|
$image->to($file['file']); |
|
|
|
$dont_copy_file = true; |
|
|
@ -1135,8 +1192,10 @@ function handle_post(){ |
|
|
|
} |
|
|
|
$image->destroy(); |
|
|
|
} else { |
|
|
|
if (($file['extension'] == "pdf" && $config['pdf_file_thumbnail']) || |
|
|
|
($file['extension'] == "djvu" && $config['djvu_file_thumbnail']) ){ |
|
|
|
if ( |
|
|
|
($file['extension'] == "pdf" && $config['pdf_file_thumbnail']) || |
|
|
|
($file['extension'] == "djvu" && $config['djvu_file_thumbnail']) |
|
|
|
) { |
|
|
|
$path = $file['thumb']; |
|
|
|
$error = shell_exec_error('convert -size ' . $config['thumb_width'] . 'x' . $config['thumb_height'] . ' -thumbnail ' . $config['thumb_width'] . 'x' . $config['thumb_height'] . ' -background white -alpha remove ' . |
|
|
|
escapeshellarg($file['tmp_name'] . '[0]') . ' ' . |
|
|
@ -1197,8 +1256,7 @@ function handle_post(){ |
|
|
|
$file['thumbheight'] = $size[1]; |
|
|
|
$file['width'] = $size[0]; |
|
|
|
$file['height'] = $size[1]; |
|
|
|
}*/ |
|
|
|
else if ($file['extension'] == "txt" && $config['txt_file_thumbnail']){ |
|
|
|
}*/ else if ($file['extension'] == "txt" && $config['txt_file_thumbnail']) { |
|
|
|
$path = $file['thumb']; |
|
|
|
$error = shell_exec_error('convert -thumbnail x300 xc:white -pointsize 12 -fill black -annotate +15+15 ' . |
|
|
|
escapeshellarg('@' . $file['tmp_name']) . ' ' . |
|
|
@ -1214,39 +1272,41 @@ function handle_post(){ |
|
|
|
$file['thumbheight'] = $size[1]; |
|
|
|
$file['width'] = $size[0]; |
|
|
|
$file['height'] = $size[1]; |
|
|
|
} |
|
|
|
else if ($file['extension'] == "svg"){ |
|
|
|
} else if ($file['extension'] == "svg") { |
|
|
|
// Copy, because there's nothing to resize |
|
|
|
$file['thumb'] = substr_replace($file['thumb'], $file['extension'], strrpos($file['thumb'], '.') + 1); |
|
|
|
copy($file['tmp_name'], $file['thumb']); |
|
|
|
$file['thumbwidth'] = $config['thumb_width']; |
|
|
|
$file['thumbheight'] = $config['thumb_height']; |
|
|
|
$file['thumb'] = basename($file['thumb']); |
|
|
|
|
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
// not an image |
|
|
|
//copy($config['file_thumb'], $post['thumb']); |
|
|
|
$file['thumb'] = 'file'; |
|
|
|
|
|
|
|
$size = @getimagesize(sprintf($config['file_thumb'], |
|
|
|
$size = @getimagesize( |
|
|
|
sprintf( |
|
|
|
$config['file_thumb'], |
|
|
|
isset($config['file_icons'][$file['extension']]) ? |
|
|
|
$config['file_icons'][$file['extension']] : $config['file_icons']['default'])); |
|
|
|
$config['file_icons'][$file['extension']] : $config['file_icons']['default'] |
|
|
|
) |
|
|
|
); |
|
|
|
$file['thumbwidth'] = $size[0]; |
|
|
|
$file['thumbheight'] = $size[1]; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ($config['tesseract_ocr'] && $file['thumb'] != 'file') { // Let's OCR it! |
|
|
|
if ($config['tesseract_ocr'] && $file['thumb'] != 'file') { |
|
|
|
// Let's OCR it! |
|
|
|
$fname = $file['tmp_name']; |
|
|
|
|
|
|
|
if ($file['height'] > 500 || $file['width'] > 500) { |
|
|
|
$fname = $file['thumb']; |
|
|
|
} |
|
|
|
|
|
|
|
if ($fname == 'spoiler') { // We don't have that much CPU time, do we? |
|
|
|
} |
|
|
|
else { |
|
|
|
if ($fname == 'spoiler') { |
|
|
|
// We don't have that much CPU time, do we? |
|
|
|
} else { |
|
|
|
$tmpname = __DIR__ . "/tmp/tesseract/" . rand(0, 10000000); |
|
|
|
|
|
|
|
// Preprocess command is an ImageMagick b/w quantization |
|
|
@ -1267,18 +1327,22 @@ function handle_post(){ |
|
|
|
|
|
|
|
if (!isset($dont_copy_file) || !$dont_copy_file) { |
|
|
|
if (isset($file['file_tmp'])) { |
|
|
|
if (!@rename($file['tmp_name'], $file['file'])) |
|
|
|
if (!@rename($file['tmp_name'], $file['file'])) { |
|
|
|
error($config['error']['nomove']); |
|
|
|
} |
|
|
|
chmod($file['file'], 0644); |
|
|
|
} elseif (!@move_uploaded_file($file['tmp_name'], $file['file'])) |
|
|
|
} elseif (!@move_uploaded_file($file['tmp_name'], $file['file'])) { |
|
|
|
error($config['error']['nomove']); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if ($config['image_reject_repost']) { |
|
|
|
if ($p = getPostByHash($post['filehash'])) { |
|
|
|
undoImage($post); |
|
|
|
error(sprintf($config['error']['fileexists'], |
|
|
|
error( |
|
|
|
sprintf( |
|
|
|
$config['error']['fileexists'], |
|
|
|
($post['mod'] ? $config['root'] . $config['file_mod'] . '?/' : $config['root']) . |
|
|
|
($board['dir'] . $config['dir']['res'] . |
|
|
|
($p['thread'] ? |
|
|
@ -1286,12 +1350,15 @@ function handle_post(){ |
|
|
|
: |
|
|
|
$p['id'] . '.html' |
|
|
|
)) |
|
|
|
)); |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
} else if (!$post['op'] && $config['image_reject_repost_in_thread']) { |
|
|
|
if ($p = getPostByHashInThread($post['filehash'], $post['thread'])) { |
|
|
|
undoImage($post); |
|
|
|
error(sprintf($config['error']['fileexistsinthread'], |
|
|
|
error( |
|
|
|
sprintf( |
|
|
|
$config['error']['fileexistsinthread'], |
|
|
|
($post['mod'] ? $config['root'] . $config['file_mod'] . '?/' : $config['root']) . |
|
|
|
($board['dir'] . $config['dir']['res'] . |
|
|
|
($p['thread'] ? |
|
|
@ -1299,10 +1366,10 @@ function handle_post(){ |
|
|
|
: |
|
|
|
$p['id'] . '.html' |
|
|
|
)) |
|
|
|
)); |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Do filters again if OCRing |
|
|
@ -1325,19 +1392,24 @@ function handle_post(){ |
|
|
|
$file['file_path'] = $file['file']; |
|
|
|
$file['thumb_path'] = $file['thumb']; |
|
|
|
$file['file'] = mb_substr($file['file'], mb_strlen($board['dir'] . $config['dir']['img'])); |
|
|
|
if ($file['is_an_image'] && $file['thumb'] != 'spoiler') |
|
|
|
if ($file['is_an_image'] && $file['thumb'] != 'spoiler') { |
|
|
|
$file['thumb'] = mb_substr($file['thumb'], mb_strlen($board['dir'] . $config['dir']['thumb'])); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// Custom /leftypol/ var to check if Tor |
|
|
|
$tor = ($_SERVER['REMOTE_ADDR'] == '127.0.0.1'); |
|
|
|
|
|
|
|
$post = (object) $post; |
|
|
|
$post->files = array_map(function($a) { return (object)$a; }, $post->files); |
|
|
|
$post->files = array_map(function ($a) { |
|
|
|
return (object) $a; |
|
|
|
}, $post->files); |
|
|
|
|
|
|
|
$error = event('post', $post, $tor); |
|
|
|
$post->files = array_map(function($a) { return (array)$a; }, $post->files); |
|
|
|
$post->files = array_map(function ($a) { |
|
|
|
return (array) $a; |
|
|
|
}, $post->files); |
|
|
|
|
|
|
|
if ($error) { |
|
|
|
undoImage((array) $post); |
|
|
@ -1421,10 +1493,12 @@ function handle_post(){ |
|
|
|
|
|
|
|
if (isset($_SERVER['HTTP_REFERER'])) { |
|
|
|
// Tell Javascript that we posted successfully |
|
|
|
if (isset($_COOKIE[$config['cookies']['js']])) |
|
|
|
if (isset($_COOKIE[$config['cookies']['js']])) { |
|
|
|
$js = json_decode($_COOKIE[$config['cookies']['js']]); |
|
|
|
else |
|
|
|
} |
|
|
|
else { |
|
|
|
$js = (object) array(); |
|
|
|
} |
|
|
|
// Tell it to delete the cached post for referer |
|
|
|
$js->{$_SERVER['HTTP_REFERER']} = true; |
|
|
|
// Encode and set cookie |
|
|
@ -1453,26 +1527,30 @@ function handle_post(){ |
|
|
|
} |
|
|
|
} else { |
|
|
|
$redirect = $root . $board['dir'] . $config['file_index']; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
buildThread($post['op'] ? $id : $post['thread']); |
|
|
|
|
|
|
|
if ($config['syslog']) |
|
|
|
if ($config['syslog']) { |
|
|
|
_syslog(LOG_INFO, 'New post: /' . $board['dir'] . $config['dir']['res'] . |
|
|
|
link_for($post) . (!$post['op'] ? '#' . $id : '')); |
|
|
|
} |
|
|
|
|
|
|
|
if (!$post['mod']) header('X-Associated-Content: "' . $redirect . '"'); |
|
|
|
if (!$post['mod']) { |
|
|
|
header('X-Associated-Content: "' . $redirect . '"'); |
|
|
|
} |
|
|
|
|
|
|
|
if (!isset($_POST['json_response'])) { |
|
|
|
header('Location: ' . $redirect, true, $config['redirect_http']); |
|
|
|
} else { |
|
|
|
header('Content-Type: text/json; charset=utf-8'); |
|
|
|
echo json_encode(array( |
|
|
|
echo json_encode( |
|
|
|
array( |
|
|
|
'redirect' => $redirect, |
|
|
|
'noko' => $noko, |
|
|
|
'id' => $id |
|
|
|
)); |
|
|
|
) |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
if ($post['op']) { |
|
|
@ -1485,16 +1563,18 @@ function handle_post(){ |
|
|
|
event('post-after', $post); |
|
|
|
|
|
|
|
// If this is a new thread or the poster is returning to the index, let's build it before they redirect |
|
|
|
if ($post['op'] || !$noko) |
|
|
|
if ($post['op'] || !$noko) { |
|
|
|
buildIndex(); |
|
|
|
} |
|
|
|
|
|
|
|
// We are already done, let's continue our heavy-lifting work in the background (if we run off FastCGI) |
|
|
|
if (function_exists('fastcgi_finish_request')) { |
|
|
|
@fastcgi_finish_request(); |
|
|
|
} |
|
|
|
|
|
|
|
if (!$post['op'] && $noko) |
|
|
|
if (!$post['op'] && $noko) { |
|
|
|
buildIndex(); |
|
|
|
} |
|
|
|
|
|
|
|
if ($post['op']) { |
|
|
|
rebuildThemes('post-thread', $board['uri']); |
|
|
@ -1503,7 +1583,8 @@ function handle_post(){ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function handle_appeal(){ |
|
|
|
function handle_appeal() |
|
|
|
{ |
|
|
|
global $config; |
|
|
|
if (!isset($_POST['ban_id'])) |
|
|
|
error($config['error']['bot']); |
|
|
@ -1534,9 +1615,10 @@ function handle_appeal(){ |
|
|
|
} |
|
|
|
|
|
|
|
foreach ($ban_appeals as $is_denied) { |
|
|
|
if (!$is_denied) |
|
|
|
if (!$is_denied) { |
|
|
|
error($config['error']['pendingappeal']); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (strlen($_POST['appeal']) > $config['ban_appeal_max_chars']) { |
|
|
|
error($config['error']['toolongappeal']); |
|
|
@ -1549,18 +1631,15 @@ function handle_appeal(){ |
|
|
|
$query->execute() or error(db_error($query)); |
|
|
|
|
|
|
|
displayBan($ban); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// Is it a post coming from NNTP? Let's extract it and pretend it's a normal post. |
|
|
|
if (isset($_GET['Newsgroups'])) { |
|
|
|
if ($config['nntpchan']['enabled']) { |
|
|
|
handle_nntpchan(); |
|
|
|
} |
|
|
|
else { |
|
|
|
} else { |
|
|
|
error("NNTPChan: NNTPChan support is disabled"); |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (isset($_POST['delete'])) { |
|
|
|