Browse Source

Pass the thread ID when banning/deleting

pull/40/head
Michael Walker 9 years ago
parent
commit
4184fdec6e
  1. 6
      inc/mod/pages.php
  2. 6
      mod.php
  3. 2
      templates/mod/confirm.html
  4. 10
      templates/post/post_controls.html

6
inc/mod/pages.php

@ -61,7 +61,11 @@ function mod_login($redirect = false) {
}
function mod_confirm($request) {
mod_page(_('Confirm action'), 'mod/confirm.html', array('request' => $request, 'token' => make_secure_link_token($request)));
$args = array('request' => $request, 'token' => make_secure_link_token($request));
if(isset($_GET['thread'])) {
$args['rest'] = 'thread=' . $_GET['thread'];
}
mod_page(_('Confirm action'), 'mod/confirm.html', $args);
}
function mod_logout() {

6
mod.php

@ -23,6 +23,12 @@ if (get_magic_quotes_gpc()) {
$query = isset($_SERVER['QUERY_STRING']) ? rawurldecode($_SERVER['QUERY_STRING']) : '';
// If there's a thread parameter (eg, for returning to after enacting a ban)
// drop it from the $query.
if(isset($_GET['thread'])) {
$query = explode("&thread=", $query)[0];
}
$pages = array(
'' => ':?/', // redirect to dashboard
'/' => 'dashboard', // dashboard

2
templates/mod/confirm.html

@ -1,5 +1,5 @@
<p style="text-align:center;font-size:1.1em">
{% trans 'Are you sure you want to do that?' %} <a href="?/{{ request }}/{{ token }}">{% trans 'Click to proceed to' %} ?/{{ request }}</a>.
{% trans 'Are you sure you want to do that?' %} <a href="?/{{ request }}/{{ token }}{% if rest %}&amp;{{ rest }}{% endif %}">{% trans 'Click to proceed to' %} ?/{{ request }}</a>.
</p>
<p class="unimportant" style="text-align:center">
{% trans 'You are probably seeing this message because Javascript being disabled. This is a necessary security measure to prevent CSRF attacks.' %}

10
templates/post/post_controls.html

@ -2,19 +2,19 @@
<span class="controls {% if not post.thread %}op{% endif %}">
{% if mod|hasPermission(config.mod.delete, board.uri) %}
<a title="{% trans %}Delete{% endtrans %}" onclick="if (event.which==2) return true;if (confirm('{% trans %}Are you sure you want to delete this?{% endtrans %}')) document.location='?/{{ secure_link(board.dir ~ 'delete/' ~ post.id) }}';return false;" href="?/{{ board.dir }}delete/{{ post.id }}">{{ config.mod.link_delete }}</a>&nbsp;
<a title="{% trans %}Delete{% endtrans %}" onclick="if (event.which==2) return true;if (confirm('{% trans %}Are you sure you want to delete this?{% endtrans %}')) document.location='?/{{ secure_link(board.dir ~ 'delete/' ~ post.id) }}{% if post.thread %}&amp;thread={{ post.thread }}{% endif %}';return false;" href="?/{{ board.dir }}delete/{{ post.id }}{% if post.thread %}&amp;thread={{ post.thread }}{% endif %}">{{ config.mod.link_delete }}</a>&nbsp;
{% endif %}
{% if mod|hasPermission(config.mod.deletebyip, board.uri) %}
<a title="{% trans %}Delete all posts by IP{% endtrans %}" onclick="if (event.which==2) return true;if (confirm('{% trans %}Are you sure you want to delete all posts by this IP address?{% endtrans %}')) document.location='?/{{ secure_link(board.dir ~ 'deletebyip/' ~ post.id) }}';return false;" href="?/{{ board.dir }}deletebyip/{{ post.id }}">{{ config.mod.link_deletebyip }}</a>&nbsp;
<a title="{% trans %}Delete all posts by IP{% endtrans %}" onclick="if (event.which==2) return true;if (confirm('{% trans %}Are you sure you want to delete all posts by this IP address?{% endtrans %}')) document.location='?/{{ secure_link(board.dir ~ 'deletebyip/' ~ post.id) }}{% if post.thread %}&amp;thread={{ post.thread }}{% endif %}';return false;" href="?/{{ board.dir }}deletebyip/{{ post.id }}{% if post.thread %}&amp;thread={{ post.thread }}{% endif %}">{{ config.mod.link_deletebyip }}</a>&nbsp;
{% endif %}
{% if mod|hasPermission(config.mod.deletebyip_global, board.uri) %}
<a title="{% trans %}Delete all posts by IP across all boards{% endtrans %}" onclick="if (event.which==2) return true;if (confirm('{% trans %}Are you sure you want to delete all posts by this IP address, across all boards?{% endtrans %}')) document.location='?/{{ secure_link(board.dir ~ 'deletebyip/' ~ post.id ~ '/global') }}';return false;" href="?/{{ board.dir }}deletebyip/{{ post.id }}/global">{{ config.mod.link_deletebyip_global }}</a>&nbsp;
<a title="{% trans %}Delete all posts by IP across all boards{% endtrans %}" onclick="if (event.which==2) return true;if (confirm('{% trans %}Are you sure you want to delete all posts by this IP address, across all boards?{% endtrans %}')) document.location='?/{{ secure_link(board.dir ~ 'deletebyip/' ~ post.id ~ '/global') }}{% if post.thread %}&amp;thread={{ post.thread }}{% endif %}';return false;" href="?/{{ board.dir }}deletebyip/{{ post.id }}/global{% if post.thread %}&amp;thread={{ post.thread }}{% endif %}">{{ config.mod.link_deletebyip_global }}</a>&nbsp;
{% endif %}
{% if mod|hasPermission(config.mod.ban, board.uri) %}
<a title="{% trans %}Ban{% endtrans %}" href="?/{{ board.dir }}ban/{{ post.id }}">{{ config.mod.link_ban }}</a>&nbsp;
<a title="{% trans %}Ban{% endtrans %}" href="?/{{ board.dir }}ban/{{ post.id }}{% if post.thread %}&amp;thread={{ post.thread }}{% endif %}">{{ config.mod.link_ban }}</a>&nbsp;
{% endif %}
{% if mod|hasPermission(config.mod.bandelete, board.uri) %}
<a title="{% trans %}Ban & Delete{% endtrans %}" href="?/{{ board.dir }}ban&amp;delete/{{ post.id }}">{{ config.mod.link_bandelete }}</a>&nbsp;
<a title="{% trans %}Ban & Delete{% endtrans %}" href="?/{{ board.dir }}ban&amp;delete/{{ post.id }}{% if post.thread %}&amp;thread={{ post.thread }}{% endif %}">{{ config.mod.link_bandelete }}</a>&nbsp;
{% endif %}
{% if not post.thread %}

Loading…
Cancel
Save