Merge pull request #95 from Macil/nosubject

Add field_disable_subject and field_disable_reply_subject config options
This commit is contained in:
Michael 2013-01-18 23:44:44 -08:00
commit 5c4421b4fd
3 changed files with 18 additions and 2 deletions

View File

@ -348,6 +348,10 @@
$config['field_disable_name'] = false; $config['field_disable_name'] = false;
// When true, no email will be able to be set. // When true, no email will be able to be set.
$config['field_disable_email'] = false; $config['field_disable_email'] = false;
// When true, no subject will be able to be set.
$config['field_disable_subject'] = false;
// When true, no subject will be able to be set in replies.
$config['field_disable_reply_subject'] = false;
// When true, a blank password will be used for files (not usable for deletion). // When true, a blank password will be used for files (not usable for deletion).
$config['field_disable_password'] = false; $config['field_disable_password'] = false;

View File

@ -139,7 +139,7 @@ if (isset($_POST['delete'])) {
header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']); header('Location: ' . $root . $board['dir'] . $config['file_index'], true, $config['redirect_http']);
} elseif (isset($_POST['post'])) { } elseif (isset($_POST['post'])) {
if (!isset($_POST['subject'], $_POST['body'], $_POST['board'])) if (!isset($_POST['body'], $_POST['board']))
error($config['error']['bot']); error($config['error']['bot']);
if (!isset($_POST['name'])) if (!isset($_POST['name']))
@ -148,6 +148,9 @@ if (isset($_POST['delete'])) {
if (!isset($_POST['email'])) if (!isset($_POST['email']))
$_POST['email'] = ''; $_POST['email'] = '';
if (!isset($_POST['subject']))
$_POST['subject'] = '';
if (!isset($_POST['password'])) if (!isset($_POST['password']))
$_POST['password'] = ''; $_POST['password'] = '';
@ -271,6 +274,9 @@ if (isset($_POST['delete'])) {
if ($config['field_disable_password']) if ($config['field_disable_password'])
$_POST['password'] = ''; $_POST['password'] = '';
if ($config['field_disable_subject'] || (!$post['op'] && $config['field_disable_reply_subject']))
$_POST['subject'] = '';
} }
// Check for a file // Check for a file

View File

@ -27,12 +27,18 @@
</td> </td>
</tr>{% endif %} </tr>{% endif %}
<tr> <tr>
<th> {% if not (config.field_disable_subject or (id and config.field_disable_reply_subject)) or (mod and post.mod|hasPermission(config.mod.bypass_field_disable, board.uri)) %}<th>
{% trans %}Subject{% endtrans %} {% trans %}Subject{% endtrans %}
{{ antibot.html() }} {{ antibot.html() }}
</th> </th>
<td> <td>
<input style="float:left;" type="text" name="subject" size="25" maxlength="100" autocomplete="off"> <input style="float:left;" type="text" name="subject" size="25" maxlength="100" autocomplete="off">
{% else %}<th>
{% trans %}Submit{% endtrans %}
{{ antibot.html() }}
</th>
<td>
{% endif %}
<input accesskey="s" style="margin-left:2px;" type="submit" name="post" value="{% if id %}{{ config.button_reply }}{% else %}{{ config.button_newtopic }}{% endif %}" />{% if config.spoiler_images %} <input id="spoiler" name="spoiler" type="checkbox"> <label for="spoiler">{% trans %}Spoiler Image{% endtrans %}</label>{% endif %} <input accesskey="s" style="margin-left:2px;" type="submit" name="post" value="{% if id %}{{ config.button_reply }}{% else %}{{ config.button_newtopic }}{% endif %}" />{% if config.spoiler_images %} <input id="spoiler" name="spoiler" type="checkbox"> <label for="spoiler">{% trans %}Spoiler Image{% endtrans %}</label>{% endif %}
</td> </td>
</tr> </tr>