aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--phpBB/adm/style/acp_forums.html5
-rw-r--r--phpBB/docs/CHANGELOG.html2
-rw-r--r--phpBB/includes/acp/acp_board.php3
-rw-r--r--phpBB/includes/acp/acp_forums.php5
-rw-r--r--phpBB/includes/constants.php1
-rw-r--r--phpBB/includes/message_parser.php18
-rw-r--r--phpBB/install/convertors/convert_phpbb20.php2
-rw-r--r--phpBB/install/database_update.php38
-rw-r--r--phpBB/install/install_convert.php4
-rw-r--r--phpBB/install/schemas/schema_data.sql2
-rw-r--r--phpBB/language/en/acp/board.php8
-rw-r--r--phpBB/language/en/acp/forums.php2
-rw-r--r--phpBB/language/en/posting.php1
13 files changed, 75 insertions, 16 deletions
diff --git a/phpBB/adm/style/acp_forums.html b/phpBB/adm/style/acp_forums.html
index 547ac66e3c..937a288cb2 100644
--- a/phpBB/adm/style/acp_forums.html
+++ b/phpBB/adm/style/acp_forums.html
@@ -218,6 +218,11 @@
<label><input type="radio" class="radio" name="enable_post_review" value="0"<!-- IF not S_ENABLE_POST_REVIEW --> id="enable_post_review" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
</dl>
<dl>
+ <dt><label for="enable_quick_reply">{L_ENABLE_QUICK_REPLY}:</label><br /><span>{L_ENABLE_QUICK_REPLY_EXPLAIN}</span></dt>
+ <dd><label><input type="radio" class="radio" name="enable_quick_reply" value="1"<!-- IF S_ENABLE_QUICK_REPLY --> id="enable_quick_reply" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
+ <label><input type="radio" class="radio" name="enable_quick_reply" value="0"<!-- IF not S_ENABLE_QUICK_REPLY --> id="enable_quick_reply" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
+ </dl>
+ <dl>
<dt><label for="enable_indexing">{L_ENABLE_INDEXING}:</label><br /><span>{L_ENABLE_INDEXING_EXPLAIN}</span></dt>
<dd><label><input type="radio" class="radio" name="enable_indexing" value="1"<!-- IF S_ENABLE_INDEXING --> id="enable_indexing" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<label><input type="radio" class="radio" name="enable_indexing" value="0"<!-- IF not S_ENABLE_INDEXING --> id="enable_indexing" checked="checked"<!-- ENDIF --> /> {L_NO}</label></dd>
diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 7e806ae25c..f34349fb51 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -161,7 +161,9 @@
<li>[Feature] Add unapproved topic icon for moderators on forum list (Bug #46865 - Patch by nickvergessen)</li>
<li>[Feature] Add confirm-box when deleting permissions (Bug #13673 - Patch by nickvergessen)</li>
<li>[Feature] Add unread posts quick search option (Bug #46765 - Patch by rxu)</li>
+ <li>[Feature] Ability to define minimum number of characters for posts/pms</li>
</ul>
+
<a name="v304"></a><h3>1.ii. Changes since 3.0.4</h3>
<ul>
diff --git a/phpBB/includes/acp/acp_board.php b/phpBB/includes/acp/acp_board.php
index 7866b1b81f..41849b909a 100644
--- a/phpBB/includes/acp/acp_board.php
+++ b/phpBB/includes/acp/acp_board.php
@@ -87,6 +87,7 @@ class acp_board
'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'allow_birthdays' => array('lang' => 'ALLOW_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'legend2' => 'ACP_LOAD_SETTINGS',
'load_birthdays' => array('lang' => 'YES_BIRTHDAYS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
@@ -169,6 +170,7 @@ class acp_board
'allow_nocensors' => array('lang' => 'ALLOW_NO_CENSORS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'allow_bookmarks' => array('lang' => 'ALLOW_BOOKMARKS', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'enable_post_confirm' => array('lang' => 'VISUAL_CONFIRM_POST', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
+ 'allow_quick_reply' => array('lang' => 'ALLOW_QUICK_REPLY', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
'legend2' => 'POSTING',
'bump_type' => false,
@@ -181,6 +183,7 @@ class acp_board
'hot_threshold' => array('lang' => 'HOT_THRESHOLD', 'validate' => 'int:0', 'type' => 'text:3:4', 'explain' => true),
'max_poll_options' => array('lang' => 'MAX_POLL_OPTIONS', 'validate' => 'int:2:127', 'type' => 'text:4:4', 'explain' => false),
'max_post_chars' => array('lang' => 'CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true),
+ 'min_post_chars' => array('lang' => 'MIN_CHAR_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:6', 'explain' => true),
'max_post_smilies' => array('lang' => 'SMILIES_LIMIT', 'validate' => 'int:0', 'type' => 'text:4:4', 'explain' => true),
'max_post_urls' => array('lang' => 'MAX_POST_URLS', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true),
'max_post_font_size' => array('lang' => 'MAX_POST_FONT_SIZE', 'validate' => 'int:0', 'type' => 'text:5:4', 'explain' => true, 'append' => ' %'),
diff --git a/phpBB/includes/acp/acp_forums.php b/phpBB/includes/acp/acp_forums.php
index bf5242ace6..810caa62d5 100644
--- a/phpBB/includes/acp/acp_forums.php
+++ b/phpBB/includes/acp/acp_forums.php
@@ -139,6 +139,7 @@ class acp_forums
'enable_icons' => request_var('enable_icons', false),
'enable_prune' => request_var('enable_prune', false),
'enable_post_review' => request_var('enable_post_review', true),
+ 'enable_quick_reply' => request_var('enable_quick_reply', false),
'prune_days' => request_var('prune_days', 7),
'prune_viewed' => request_var('prune_viewed', 7),
'prune_freq' => request_var('prune_freq', 1),
@@ -423,6 +424,7 @@ class acp_forums
$forum_data['forum_flags'] += (request_var('prune_sticky', false)) ? FORUM_FLAG_PRUNE_STICKY : 0;
$forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0;
$forum_data['forum_flags'] += (request_var('enable_post_review', true)) ? FORUM_FLAG_POST_REVIEW : 0;
+ $forum_data['forum_flags'] += (request_var('enable_quick_reply', false)) ? FORUM_FLAG_QUICK_REPLY : 0;
}
// Show form to create/modify a forum
@@ -682,6 +684,7 @@ class acp_forums
'S_PRUNE_STICKY' => ($forum_data['forum_flags'] & FORUM_FLAG_PRUNE_STICKY) ? true : false,
'S_DISPLAY_ACTIVE_TOPICS' => ($forum_data['forum_flags'] & FORUM_FLAG_ACTIVE_TOPICS) ? true : false,
'S_ENABLE_POST_REVIEW' => ($forum_data['forum_flags'] & FORUM_FLAG_POST_REVIEW) ? true : false,
+ 'S_ENABLE_QUICK_REPLY' => ($forum_data['forum_flags'] & FORUM_FLAG_QUICK_REPLY) ? true : false,
'S_CAN_COPY_PERMISSIONS' => ($action != 'edit' || empty($forum_id) || ($auth->acl_get('a_fauth') && $auth->acl_get('a_authusers') && $auth->acl_get('a_authgroups') && $auth->acl_get('a_mauth'))) ? true : false,
));
@@ -941,6 +944,7 @@ class acp_forums
$forum_data['forum_flags'] += ($forum_data['prune_sticky']) ? FORUM_FLAG_PRUNE_STICKY : 0;
$forum_data['forum_flags'] += ($forum_data['show_active']) ? FORUM_FLAG_ACTIVE_TOPICS : 0;
$forum_data['forum_flags'] += ($forum_data['enable_post_review']) ? FORUM_FLAG_POST_REVIEW : 0;
+ $forum_data['forum_flags'] += ($forum_data['enable_quick_reply']) ? FORUM_FLAG_QUICK_REPLY : 0;
// Unset data that are not database fields
$forum_data_sql = $forum_data;
@@ -951,6 +955,7 @@ class acp_forums
unset($forum_data_sql['prune_sticky']);
unset($forum_data_sql['show_active']);
unset($forum_data_sql['enable_post_review']);
+ unset($forum_data_sql['enable_quick_reply']);
unset($forum_data_sql['forum_password_confirm']);
// What are we going to do tonight Brain? The same thing we do everynight,
diff --git a/phpBB/includes/constants.php b/phpBB/includes/constants.php
index 4cb21bc637..2e2c239d89 100644
--- a/phpBB/includes/constants.php
+++ b/phpBB/includes/constants.php
@@ -91,6 +91,7 @@ define('FORUM_FLAG_PRUNE_ANNOUNCE', 4);
define('FORUM_FLAG_PRUNE_STICKY', 8);
define('FORUM_FLAG_ACTIVE_TOPICS', 16);
define('FORUM_FLAG_POST_REVIEW', 32);
+define('FORUM_FLAG_QUICK_REPLY', 64);
// Optional text flags
define('OPTION_FLAG_BBCODE', 1);
diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php
index ab6fc3f4f3..4cdc8b933e 100644
--- a/phpBB/includes/message_parser.php
+++ b/phpBB/includes/message_parser.php
@@ -1089,14 +1089,22 @@ class parse_message extends bbcode_firstpass
$replace = array("\\1&#058;");
$this->message = preg_replace($match, $replace, trim($this->message));
- // Message length check. 0 disables this check completely.
- if ($config['max_' . $mode . '_chars'] > 0)
+ // Store message length...
+ $message_length = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message));
+
+ // Maximum message length check. 0 disables this check completely.
+ if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars'])
{
- $msg_len = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message));
+ $this->warn_msg[] = sprintf($user->lang['TOO_MANY_CHARS_' . strtoupper($mode)], $message_length, (int) $config['max_' . $mode . '_chars']);
+ return (!$update_this_message) ? $return_message : $this->warn_msg;
+ }
- if ((!$msg_len && $mode !== 'sig') || $config['max_' . $mode . '_chars'] && $msg_len > $config['max_' . $mode . '_chars'])
+ // Minimum message length check for post only
+ if ($mode !== 'sig')
+ {
+ if (!$message_length || $message_length < (int) $config['min_post_chars'])
{
- $this->warn_msg[] = (!$msg_len) ? $user->lang['TOO_FEW_CHARS'] : sprintf($user->lang['TOO_MANY_CHARS_' . strtoupper($mode)], $msg_len, $config['max_' . $mode . '_chars']);
+ $this->warn_msg[] = (!$message_length) ? $user->lang['TOO_FEW_CHARS'] : sprintf($user->lang['TOO_FEW_CHARS_LIMIT'], $message_length, (int) $config['min_post_chars']);
return (!$update_this_message) ? $return_message : $this->warn_msg;
}
}
diff --git a/phpBB/install/convertors/convert_phpbb20.php b/phpBB/install/convertors/convert_phpbb20.php
index 805c67b92d..f4fc466ac7 100644
--- a/phpBB/install/convertors/convert_phpbb20.php
+++ b/phpBB/install/convertors/convert_phpbb20.php
@@ -611,6 +611,7 @@ if (!$get_info)
'query_first' => array('target', $convert->truncate_statement . POSTS_TABLE),
'execute_first' => '
$config["max_post_chars"] = 0;
+ $config["min_post_chars"] = 0;
$config["max_quote_depth"] = 0;
',
@@ -660,6 +661,7 @@ if (!$get_info)
'execute_first' => '
$config["max_post_chars"] = 0;
+ $config["min_post_chars"] = 0;
$config["max_quote_depth"] = 0;
',
diff --git a/phpBB/install/database_update.php b/phpBB/install/database_update.php
index 44bcf2a112..c3f8b40de6 100644
--- a/phpBB/install/database_update.php
+++ b/phpBB/install/database_update.php
@@ -1200,9 +1200,19 @@ function change_database_data(&$no_updates, $version)
}
}
- // Set every members user_new column to 0 (old users)
- $sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0';
- _sql($sql, $errored, $error_ary);
+ // Set every members user_new column to 0 (old users) only if there is no one yet (this makes sure we do not execute this more than once)
+ $sql = 'SELECT 1
+ FROM ' . USERS_TABLE . '
+ WHERE user_new = 0';
+ $result = $db->sql_query_limit($sql, 1);
+ $row = $db->sql_fetchrow($result);
+ $db->sql_freeresult($result);
+
+ if (!$row)
+ {
+ $sql = 'UPDATE ' . USERS_TABLE . ' SET user_new = 0';
+ _sql($sql, $errored, $error_ary);
+ }
// Newly registered users limit
if (!isset($config['new_member_post_limit']))
@@ -1246,13 +1256,27 @@ function change_database_data(&$no_updates, $version)
$auth_admin = new auth_admin();
$auth_admin->acl_clear_prefetch();
- if ($config['allow_avatar_upload'] || $config['allow_avatar_local'] || $config['allow_avatar_remote'])
+ if (!isset($config['allow_avatar']))
+ {
+ if ($config['allow_avatar_upload'] || $config['allow_avatar_local'] || $config['allow_avatar_remote'])
+ {
+ set_config('allow_avatar', '1');
+ }
+ else
+ {
+ set_config('allow_avatar', '0');
+ }
+ }
+
+ // Minimum number of characters
+ if (!isset($config['min_post_chars']))
{
- set_config('allow_avatar', '1');
+ set_config('min_post_chars', '1');
}
- else
+
+ if (!isset($config['allow_quick_reply']))
{
- set_config('allow_avatar', '0');
+ set_config('allow_quick_reply', '1');
}
$no_updates = false;
diff --git a/phpBB/install/install_convert.php b/phpBB/install/install_convert.php
index 7a4155e09d..38bfe96fcd 100644
--- a/phpBB/install/install_convert.php
+++ b/phpBB/install/install_convert.php
@@ -611,7 +611,7 @@ class install_convert extends module
$config['max_quote_depth'] = 0;
// @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues
- $config['max_post_chars'] = 0;
+ $config['max_post_chars'] = $config['min_post_chars'] = 0;
// Set up a user as well. We _should_ have enough of a database here at this point to do this
// and it helps for any core code we call
@@ -989,7 +989,7 @@ class install_convert extends module
$config['max_quote_depth'] = 0;
// @todo Need to confirm that max post length in source is <= max post length in destination or there may be interesting formatting issues
- $config['max_post_chars'] = 0;
+ $config['max_post_chars'] = $config['min_post_chars'] = 0;
}
$template->assign_block_vars('checks', array(
diff --git a/phpBB/install/schemas/schema_data.sql b/phpBB/install/schemas/schema_data.sql
index 100809ec24..86432a3084 100644
--- a/phpBB/install/schemas/schema_data.sql
+++ b/phpBB/install/schemas/schema_data.sql
@@ -25,6 +25,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_pm_attach',
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_flash', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_post_links', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_privmsg', '1');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_quick_reply', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_bbcode', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('allow_sig_flash', '0');
@@ -191,6 +192,7 @@ INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_smilies',
INSERT INTO phpbb_config (config_name, config_value) VALUES ('max_sig_urls', '5');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_name_chars', '3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_pass_chars', '6');
+INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_post_chars', '1');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('min_search_author_chars', '3');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('mime_triggers', 'body|head|html|img|plaintext|a href|pre|script|table|title');
INSERT INTO phpbb_config (config_name, config_value) VALUES ('new_member_post_limit', '3');
diff --git a/phpBB/language/en/acp/board.php b/phpBB/language/en/acp/board.php
index 4c3d5326ab..9247a87e52 100644
--- a/phpBB/language/en/acp/board.php
+++ b/phpBB/language/en/acp/board.php
@@ -70,6 +70,8 @@ $lang = array_merge($lang, array(
'ALLOW_NO_CENSORS' => 'Allow disabling of word censoring',
'ALLOW_NO_CENSORS_EXPLAIN' => 'Users can choose to disable the automatic word censoring of posts and private messages.',
'ALLOW_PM_ATTACHMENTS' => 'Allow attachments in private messages',
+ 'ALLOW_QUICK_REPLY' => 'Allow quick reply',
+ 'ALLOW_QUICK_REPLY_EXPLAIN' => 'This setting defines if quick reply is enabled or not. If this setting is enabled, forums need to have their quick reply option enabled too.',
'ALLOW_SIG' => 'Allow signatures',
'ALLOW_SIG_BBCODE' => 'Allow BBCode in user signatures',
'ALLOW_SIG_FLASH' => 'Allow use of <code>[FLASH]</code> BBCode tag in user signatures',
@@ -144,8 +146,8 @@ $lang = array_merge($lang, array(
'BUMP_INTERVAL' => 'Bump interval',
'BUMP_INTERVAL_EXPLAIN' => 'Number of minutes, hours or days between the last post to a topic and the ability to bump this topic.',
- 'CHAR_LIMIT' => 'Maximum characters per post',
- 'CHAR_LIMIT_EXPLAIN' => 'The number of characters allowed within a post. Set to 0 for unlimited characters.',
+ 'CHAR_LIMIT' => 'Maximum characters per post/message',
+ 'CHAR_LIMIT_EXPLAIN' => 'The number of characters allowed within a post/private message. Set to 0 for unlimited characters.',
'DISPLAY_LAST_EDITED' => 'Display last edited time information',
'DISPLAY_LAST_EDITED_EXPLAIN' => 'Choose if the last edited by information to be displayed on posts.',
'EDIT_TIME' => 'Limit editing time',
@@ -163,6 +165,8 @@ $lang = array_merge($lang, array(
'MAX_POST_IMG_WIDTH_EXPLAIN' => 'Maximum width of an image/flash file in postings. Set to 0 for unlimited size.',
'MAX_POST_URLS' => 'Maximum links per post',
'MAX_POST_URLS_EXPLAIN' => 'Maximum number of URLs in a post. Set to 0 for unlimited links.',
+ 'MIN_CHAR_LIMIT' => 'Minimum characters per post/message',
+ 'MIN_CHAR_LIMIT_EXPLAIN' => 'The minimum number of characters the user need to enter within a post/private message.',
'POSTING' => 'Posting',
'POSTS_PER_PAGE' => 'Posts per page',
'QUOTE_DEPTH_LIMIT' => 'Maximum nested quotes per post',
diff --git a/phpBB/language/en/acp/forums.php b/phpBB/language/en/acp/forums.php
index 52919f4f40..7f3b1b997d 100644
--- a/phpBB/language/en/acp/forums.php
+++ b/phpBB/language/en/acp/forums.php
@@ -62,6 +62,8 @@ $lang = array_merge($lang, array(
'ENABLE_INDEXING_EXPLAIN' => 'If set to yes posts made to this forum will be indexed for searching.',
'ENABLE_POST_REVIEW' => 'Enable post review',
'ENABLE_POST_REVIEW_EXPLAIN' => 'If set to yes users are able to review their post if new posts were made to the topic while users wrote theirs. This should be disabled for chat forums.',
+ 'ENABLE_QUICK_REPLY' => 'Enable quick reply',
+ 'ENABLE_QUICK_REPLY_EXPLAIN' => 'If set to yes users get a quick reply box for this forum. If the global option for quick reply is disabled or the forum not postable to the quick reply box will not be displayed, even if set to yes here.',
'ENABLE_RECENT' => 'Display active topics',
'ENABLE_RECENT_EXPLAIN' => 'If set to yes topics made to this forum will be shown in the active topics list.',
'ENABLE_TOPIC_ICONS' => 'Enable topic icons',
diff --git a/phpBB/language/en/posting.php b/phpBB/language/en/posting.php
index 8733fc5b10..e665f540eb 100644
--- a/phpBB/language/en/posting.php
+++ b/phpBB/language/en/posting.php
@@ -188,6 +188,7 @@ $lang = array_merge($lang, array(
'STYLES_TIP' => 'Tip: Styles can be applied quickly to selected text.',
'TOO_FEW_CHARS' => 'Your message contains too few characters.',
+ 'TOO_FEW_CHARS_LIMIT' => 'Your message contains %1$d characters. The minimum number of characters you need to enter is %2$d.',
'TOO_FEW_POLL_OPTIONS' => 'You must enter at least two poll options.',
'TOO_MANY_ATTACHMENTS' => 'Cannot add another attachment, %d is the maximum.',
'TOO_MANY_CHARS' => 'Your message contains too many characters.',