From 95a9b7b72bde0a3b529154fc1f25d64dabd51ddb Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 28 Feb 2015 05:06:50 -0800 Subject: Completely rewrite fix-report-delete-submit.js, add report/delete to menu --- js/fix-report-delete-submit.js | 64 ++++++++++++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 11 deletions(-) (limited to 'js/fix-report-delete-submit.js') diff --git a/js/fix-report-delete-submit.js b/js/fix-report-delete-submit.js index 73b6dd9c..71c97f74 100644 --- a/js/fix-report-delete-submit.js +++ b/js/fix-report-delete-submit.js @@ -1,26 +1,68 @@ /* * fix-report-delete-submit.js - * https://github.com/savetheinternet/Tinyboard/blob/master/js/fix-report-delete-submit.js - * - * Fixes a known bug regarding the delete/report submit buttons. - * - * Released under the MIT license - * Copyright (c) 2012 Michael Save * * Usage: * $config['additional_javascript'][] = 'js/jquery.min.js'; + * $config['additional_javascript'][] = 'js/post-menu.js'; * $config['additional_javascript'][] = 'js/fix-report-delete-submit.js'; * */ +if (active_page == 'thread' || active_page == 'index') { $(document).ready(function(){ - $('form[name="postcontrols"] div.delete input:not([type="checkbox"]):not([type="submit"]):not([type="hidden"])').keypress(function(e) { - if(e.which == 13) { + +if ($('.delete #password').length) { + Menu.add_item("delete_post_menu", "Delete post"); + Menu.add_item("delete_file_menu", "Delete file"); + Menu.onclick(function(e, $buf) { + var ele = e.target.parentElement.parentElement; + var $ele = $(ele); + var threadId = $ele.parent().attr('id').replace('thread_', ''); + var postId = $ele.find('.post_no').not('[id]').text(); + + $buf.find('#delete_post_menu,#delete_file_menu').click(function(e) { e.preventDefault(); - $(this).next().click(); - return false; + $('#delete_'+postId).prop('checked', 'checked'); + + if ($(this).attr('id') === 'delete_file_menu') { + $('#delete_file').prop('checked', 'checked'); + } else { + $('#delete_file').prop('checked', ''); + } + $('input[name=delete][type=submit]').click(); + }); + }); +} + +Menu.add_item("report_menu", "Report"); +Menu.add_item("global_report_menu", "Global report"); +Menu.onclick(function(e, $buf) { + var ele = e.target.parentElement.parentElement; + var $ele = $(ele); + var threadId = $ele.parent().attr('id').replace('thread_', ''); + var postId = $ele.find('.post_no').not('[id]').text(); + + $buf.find('#report_menu,#global_report_menu').click(function(e) { + $('#delete_'+postId).prop('checked', 'checked'); + if ($(this).attr('id') === 'global_report_menu') { + header = "

Attention!

This form is only for reporting child pornography, bot spam and credit card numbers, social security numbers or banking information. DMCA requests and all other deletion requests MUST be sent via email to admin@8chan.co.

8chan is unmoderated and allows posts without collecting ANY information from the poster less the details of their post. Furthermore, all boards on 8chan are user created and not actively monitored by anyone but the board creator.

8chan has a small volunteer staff to handle this queue, please do not waste their time by filling it with nonsense! If you made a report with this tool and the post was not deleted, do not make the report again! Email admin@8chan.co instead. Abuse of the global report system could lead to address blocks against your IP from 8chan.

Again, 8chan's global volunteers do not handle board specific issues. You most likely want to click \"Report\" instead to reach the creator and volunteers he assigned to this board.

"; + $('#global_report').prop('checked', 'checked'); + } else { + header = ""; + $('#global_report').prop('checked', ''); } - return true; + alert(header+"Enter reason below...
", true, function(){ + $('#reason').val($('#alert_reason').val()); + $('input[name=report][type=submit]').click(); + }); + }); }); +$(document).on('new_post', function(){ + $('div.delete').hide(); + $('input.delete').hide(); +}); +$('div.delete').hide(); +$('input.delete').hide(); +})} -- cgit v1.3 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 --- inc/config.php | 3 +++ js/fix-report-delete-submit.js | 15 ++++----------- post.php | 20 +++++++++++++++++++- templates/report.html | 17 +++++++++++++++++ 4 files changed, 43 insertions(+), 12 deletions(-) create mode 100644 templates/report.html (limited to 'js/fix-report-delete-submit.js') diff --git a/inc/config.php b/inc/config.php index b92c4ac0..ad659343 100644 --- a/inc/config.php +++ b/inc/config.php @@ -1687,3 +1687,6 @@ // If set to 0, it won't upgrade hashes using old password encryption schema, only create new. // You can set it to a higher value, to further migrate to other password hashing function. $config['password_crypt_version'] = 1; + + // Use CAPTCHA for reports? + $config['report_captcha'] = false; diff --git a/js/fix-report-delete-submit.js b/js/fix-report-delete-submit.js index 71c97f74..0b1ff840 100644 --- a/js/fix-report-delete-submit.js +++ b/js/fix-report-delete-submit.js @@ -43,19 +43,12 @@ Menu.onclick(function(e, $buf) { var postId = $ele.find('.post_no').not('[id]').text(); $buf.find('#report_menu,#global_report_menu').click(function(e) { - $('#delete_'+postId).prop('checked', 'checked'); - if ($(this).attr('id') === 'global_report_menu') { - header = "

Attention!

This form is only for reporting child pornography, bot spam and credit card numbers, social security numbers or banking information. DMCA requests and all other deletion requests MUST be sent via email to admin@8chan.co.

8chan is unmoderated and allows posts without collecting ANY information from the poster less the details of their post. Furthermore, all boards on 8chan are user created and not actively monitored by anyone but the board creator.

8chan has a small volunteer staff to handle this queue, please do not waste their time by filling it with nonsense! If you made a report with this tool and the post was not deleted, do not make the report again! Email admin@8chan.co instead. Abuse of the global report system could lead to address blocks against your IP from 8chan.

Again, 8chan's global volunteers do not handle board specific issues. You most likely want to click \"Report\" instead to reach the creator and volunteers he assigned to this board.

"; - $('#global_report').prop('checked', 'checked'); + if ($(this).attr('id') === "global_report_menu") { + var global = '&global'; } else { - header = ""; - $('#global_report').prop('checked', ''); + var global = ''; } - alert(header+"Enter reason below...
", true, function(){ - $('#reason').val($('#alert_reason').val()); - $('input[name=report][type=submit]').click(); - }); - + window.open(configRoot+'report.php?board='+board_name+'&post=delete_'+postId+global, "", (global?"width=600, height=575":"width=500, height=275")); }); }); 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' => '', 'title' => _('Report submitted!'))); } else { header('Content-Type: text/json'); echo json_encode(array('success' => true)); diff --git a/templates/report.html b/templates/report.html new file mode 100644 index 00000000..291f9313 --- /dev/null +++ b/templates/report.html @@ -0,0 +1,17 @@ +
+ + + {% if global %} + +

Attention!

This form is only for reporting child pornography, bot spam and credit card numbers, social security numbers or banking information. DMCA requests and all other deletion requests MUST be sent via email to admin@8chan.co.

8chan is unmoderated and allows posts without collecting ANY information from the poster less the details of their post. Furthermore, all boards on 8chan are user created and not actively monitored by anyone but the board creator.

8chan has a small volunteer staff to handle this queue, please do not waste their time by filling it with nonsense! If you made a report with this tool and the post was not deleted, do not make the report again! Email admin@8chan.co instead. Abuse of the global report system could lead to address blocks against your IP from 8chan.

Again, 8chan's global volunteers do not handle board specific issues. You most likely want to click "Report" instead to reach the creator and volunteers he assigned to this board.

+ {% endif %} +

{% trans %}Enter reason below...{% endtrans %}

+ + {% if config.report_captcha %} +

{% trans %}To submit your report, please fill out the CAPTCHA below.{% endtrans %}

+ {{ captcha['html'] }}
+ +
+ {% endif %} + + -- cgit v1.3 From cac428b30ccc2815264b15797e6397d6942b7adc Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Fri, 20 Mar 2015 16:09:21 +0800 Subject: Add some missing i18n tags --- js/comment-toolbar.js | 26 +++++++++++++------------- js/fix-report-delete-submit.js | 8 ++++---- js/inline.js | 4 ++-- js/post-filter.js | 40 ++++++++++++++++++++-------------------- js/thread-watcher.js | 12 ++++++------ 5 files changed, 45 insertions(+), 45 deletions(-) (limited to 'js/fix-report-delete-submit.js') diff --git a/js/comment-toolbar.js b/js/comment-toolbar.js index 65bdc529..51aa9808 100644 --- a/js/comment-toolbar.js +++ b/js/comment-toolbar.js @@ -13,7 +13,7 @@ if (active_page == 'thread' || active_page == 'index') { var self = {}; self.rules = { spoiler: { - text: 'Spoiler', + text: _('Spoiler'), key: 's', multiline: false, exclusiveline: false, @@ -21,7 +21,7 @@ if (active_page == 'thread' || active_page == 'index') { suffix:'**' }, italics: { - text: 'Italics', + text: _('Italics'), key: 'i', multiline: false, exclusiveline: false, @@ -29,7 +29,7 @@ if (active_page == 'thread' || active_page == 'index') { suffix: "''" }, bold: { - text: 'Bold', + text: _('Bold'), key: 'b', multiline: false, exclusiveline: false, @@ -37,7 +37,7 @@ if (active_page == 'thread' || active_page == 'index') { suffix: "'''" }, underline: { - text: 'Underline', + text: _('Underline'), key: 'u', multiline: false, exclusiveline: false, @@ -45,7 +45,7 @@ if (active_page == 'thread' || active_page == 'index') { suffix:'__' }, code: { - text: 'Code', + text: _('Code'), key: 'f', multiline: true, exclusiveline: false, @@ -53,7 +53,7 @@ if (active_page == 'thread' || active_page == 'index') { suffix: '[/code]' }, strike: { - text: 'Strike', + text: _('Strike'), key: 'd', multiline:false, exclusiveline:false, @@ -61,7 +61,7 @@ if (active_page == 'thread' || active_page == 'index') { suffix:'~~' }, heading: { - text: 'Heading', + text: _('Heading'), key: 'r', multiline:false, exclusiveline:true, @@ -271,7 +271,7 @@ if (active_page == 'thread' || active_page == 'index') { // add the tab for customizing the format settings if (window.Options && !Options.get_tab('formatting')) { - Options.add_tab('formatting', 'angle-right', 'Customize Formatting'); + Options.add_tab('formatting', 'angle-right', _('Customize Formatting')); Options.extend_tab('formatting', '\