Allow post deletion switch

This commit is contained in:
Fredrick Brennan 2014-05-05 18:03:51 -04:00
parent 7f725713a1
commit d31a353962
3 changed files with 9 additions and 1 deletions

View File

@ -450,6 +450,8 @@
// Maximum filename length to display (the rest can be viewed upon mouseover). // Maximum filename length to display (the rest can be viewed upon mouseover).
$config['max_filename_display'] = 30; $config['max_filename_display'] = 30;
// Allow users to delete their own posts?
$config['allow_delete'] = true;
// How long after posting should you have to wait before being able to delete that post? (In seconds.) // How long after posting should you have to wait before being able to delete that post? (In seconds.)
$config['delete_time'] = 10; $config['delete_time'] = 10;
// Reply limit (stops bumping thread when this is reached). // Reply limit (stops bumping thread when this is reached).

View File

@ -43,6 +43,10 @@ if (isset($_POST['delete'])) {
// Check if banned // Check if banned
checkBan($board['uri']); checkBan($board['uri']);
// Check if deletion enabled
if (!$config['allow_delete'])
error(_('Post deletion is not allowed!'));
if (empty($delete)) if (empty($delete))
error($config['error']['nodelete']); error($config['error']['nodelete']);
@ -88,7 +92,7 @@ if (isset($_POST['delete'])) {
echo json_encode(array('success' => true)); echo json_encode(array('success' => true));
} }
} elseif (isset($_POST['report'])) { } elseif (isset($_POST['report'])) {
if (!isset($_POST['board'], $_POST['password'], $_POST['reason'])) if (!isset($_POST['board'], $_POST['reason']))
error($config['error']['bot']); error($config['error']['bot']);
$report = array(); $report = array();

View File

@ -1,9 +1,11 @@
{% if config.allow_delete %}
<div class="delete"> <div class="delete">
{% trans %}Delete Post{% endtrans %} [<input title="Delete file only" type="checkbox" name="file" id="delete_file" /> {% trans %}Delete Post{% endtrans %} [<input title="Delete file only" type="checkbox" name="file" id="delete_file" />
<label for="delete_file">{% trans %}File{% endtrans %}</label>] <label for="password">{% trans %}Password{% endtrans %}</label> <label for="delete_file">{% trans %}File{% endtrans %}</label>] <label for="password">{% trans %}Password{% endtrans %}</label>
<input id="password" type="password" name="password" size="12" maxlength="18" /> <input id="password" type="password" name="password" size="12" maxlength="18" />
<input type="submit" name="delete" value="{% trans %}Delete{% endtrans %}" /> <input type="submit" name="delete" value="{% trans %}Delete{% endtrans %}" />
</div> </div>
{% endif %}
<div class="delete" style="clear:both"> <div class="delete" style="clear:both">
<label for="reason">{% trans %}Reason{% endtrans %}</label> <label for="reason">{% trans %}Reason{% endtrans %}</label>
<input id="reason" type="text" name="reason" size="20" maxlength="30" /> <input id="reason" type="text" name="reason" size="20" maxlength="30" />