From 8943bb0bb378b629e0b1cf34f66094eb61f8453e Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Fri, 13 Mar 2015 12:45:57 +0800 Subject: Rewrite report system due to flooding --- post.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'post.php') diff --git a/post.php b/post.php index 1c511f9c..3b4f3311 100644 --- a/post.php +++ b/post.php @@ -124,6 +124,23 @@ if (isset($_POST['delete'])) { 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']); + } + + if ($config['report_captcha']) { + $resp = file_get_contents($config['captcha']['provider_check'] . "?" . http_build_query([ + 'mode' => 'check', + 'text' => $_POST['captcha_text'], + 'extra' => $config['captcha']['extra'], + 'cookie' => $_POST['captcha_cookie'] + ])); + + if ($resp !== '1') { + error($config['error']['captcha']); + } + } $reason = escape_markup_modifiers($_POST['reason']); markup($reason); @@ -153,7 +170,8 @@ if (isset($_POST['delete'])) { $root = $is_mod ? $config['root'] . $config['file_mod'] . '?/' : $config['root']; if (!isset($_POST['json_response'])) { - header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); + $index = $root . $board['dir'] . $config['file_index']; + echo Element('page.html', array('config' => $config, 'body' => '
[ ' . _('Close window') ." ] [ " . _('Return') . ' ]
', 'title' => _('Report submitted!'))); } else { header('Content-Type: text/json'); echo json_encode(array('success' => true)); -- cgit v1.3