diff options
| author | Fredrick Brennan <admin@8chan.co> | 2015-03-13 12:45:57 +0800 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2016-05-05 12:57:52 +0200 |
| commit | 8943bb0bb378b629e0b1cf34f66094eb61f8453e (patch) | |
| tree | 04b2465590eaa1f90889954dea5be19904ce2cf9 /post.php | |
| parent | 95a9b7b72bde0a3b529154fc1f25d64dabd51ddb (diff) | |
Rewrite report system due to flooding
Diffstat (limited to 'post.php')
| -rw-r--r-- | post.php | 20 |
1 files changed, 19 insertions, 1 deletions
@@ -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' => '<div style="text-align:center"><a href="javascript:window.close()">[ ' . _('Close window') ." ]</a> <a href='$index'>[ " . _('Return') . ' ]</a></div>', 'title' => _('Report submitted!'))); } else { header('Content-Type: text/json'); echo json_encode(array('success' => true)); |
