Browse Source

Added Feature - Warn and Delete [W&D] function

main
PupperWoff 7 years ago
committed by discomrade
parent
commit
e712b12ad9
  1. 1
      inc/config.php
  2. 14
      inc/mod/pages.php
  3. 6
      mod.php
  4. 4
      templates/mod/warning_form.html
  5. 3
      templates/post/post_controls.html

1
inc/config.php

@ -1452,6 +1452,7 @@
// Mod links (full HTML).
$config['mod']['link_delete'] = '[D]';
$config['mod']['link_warning'] = '[W]';
$config['mod']['link_warningdelete'] = '[W&D]';
$config['mod']['link_ban'] = '[B]';
$config['mod']['link_bandelete'] = '[B&D]';
$config['mod']['link_deletefile'] = '[F]';

14
inc/mod/pages.php

@ -1960,7 +1960,7 @@ function mod_ban_post($board, $delete, $post, $token = false) {
mod_page(_('New ban'), 'mod/ban_form.html', $args);
}
function mod_warning_post($board, $post, $token = false) {
function mod_warning_post($board, $delete, $post, $token = false) {
global $config, $mod;
if (!openBoard($board))
@ -2002,6 +2002,17 @@ function mod_warning_post($board, $post, $token = false) {
modLog("Attached a public warning message to post #{$post}: " . utf8tohtml($_POST['message']));
buildThread($thread ? $thread : $post);
buildIndex();
} elseif (isset($_POST['delete']) && (int) $_POST['delete']) {
if (!hasPermission($config['mod']['delete'], $board))
error($config['error']['noaccess']);
// Delete post
deletePost($post);
modLog("Deleted post #{$post}");
// Rebuild board
buildIndex();
// Rebuild themes
rebuildThemes('post-delete', $board);
}
if(isset($_POST['thread'])) {
// Redirect to thread
@ -2018,6 +2029,7 @@ function mod_warning_post($board, $post, $token = false) {
'post' => $post,
'board' => $board,
'boards' => listBoards(),
'delete' => (bool)$delete,
'reasons' => $config['warning_reasons'],
'token' => $security_token
);

6
mod.php

@ -62,7 +62,7 @@ $pages = array(
'/IP/([\w.:]+)' => 'secure_POST ip', // view ip address
'/IP/([\w.:]+)/remove_note/(\d+)' => 'secure ip_remove_note', // remove note from ip address
'/IP/([\w.:-]+)/remove_telegram/(\d+)' => 'secure ip_remove_telegram', // remove telegram from ip address
'/ban' => 'secure_POST ban', // new ban
'/bans' => 'secure_POST bans', // ban list
'/bans.json' => 'secure bans_json', // ban list JSON
@ -71,14 +71,14 @@ $pages = array(
'/recent/(\d+)' => 'recent_posts', // view recent posts
'/recent/(\d+)/([\w,]+?)' => 'recent_posts', // view recent posts
'/recent/(\d+)/([\w,]+?)/(json)?' => 'recent_posts', // view recent posts JSON
'/search' => 'search_redirect', // search
'/search/(posts|IP_notes|bans|log)/(.+)/(\d+)' => 'search', // search
'/search/(posts|IP_notes|bans|log)/(.+)' => 'search', // search
'/(\%b)/archive/' => 'secure_POST view_archive', // view archive
'/(\%b)/featured/' => 'secure_POST view_archive_featured', // view featured Archive
'/(\%b)/warning/(\d+)' => 'secure_POST warning_post', // issue warning for post
'/(\%b)/warning(&delete)?/(\d+)' => 'secure_POST warning_post', // issue warning for post
'/(\%b)/ban(&delete)?/(\d+)' => 'secure_POST ban_post', // ban poster
'/(\%b)/move/(\d+)' => 'secure_POST move', // move thread
'/(\%b)/move_reply/(\d+)' => 'secure_POST move_reply', // move reply

4
templates/mod/warning_form.html

@ -22,9 +22,7 @@ $(document).ready(function(){
{% if post and board %}
<input type="hidden" name="delete" value="{% if delete %}1{% else %}0{% endif %}">
{% endif %}
<table>
<tr>
<th>
<label for="ip">{% trans 'IP' %}</label>
@ -45,7 +43,7 @@ $(document).ready(function(){
<textarea name="reason" id="reason" rows="5" cols="30">{{ reason|e }}</textarea>
</td>
</tr>
{% if post and board %}
{% if post and board and not delete %}
<tr>
<th>
<label for="message">{% trans 'Message' %}</label>

3
templates/post/post_controls.html

@ -13,6 +13,9 @@
{% if mod|hasPermission(config.mod.warning, board.uri) %}
<a title="{% trans %}Issue Warning{% endtrans %}" href="?/{{ board.dir }}warning/{{ post.id }}">{{ config.mod.link_warning }}</a>&nbsp;
{% endif %}
{% if mod|hasPermission(config.mod.warning, board.uri) and mod|hasPermission(config.mod.delete, board.uri) %}
<a title="{% trans %}Issue Warning{% endtrans %}" href="?/{{ board.dir }}warning&amp;delete/{{ post.id }}">{{ config.mod.link_warningdelete }}</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;
{% endif %}

Loading…
Cancel
Save