1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-05-06 07:35:29 +02:00

- add options for quick reply (forum-based and board-wide)

- add option for minimum post chars (which is a required setting for quick reply, therefore we introduce it here)


git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9656 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2009-06-23 10:48:53 +00:00
parent 926640fc75
commit c32f49679f
13 changed files with 76 additions and 17 deletions

View File

@ -217,6 +217,11 @@
<dd><label><input type="radio" class="radio" name="enable_post_review" value="1"<!-- IF S_ENABLE_POST_REVIEW --> id="enable_post_review" checked="checked"<!-- ENDIF --> /> {L_YES}</label>
<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>

View File

@ -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>

View File

@ -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' => ' %'),

View File

@ -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,

View File

@ -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);

View File

@ -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)
{
$msg_len = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message));
// Store message length...
$message_length = ($mode == 'post') ? utf8_strlen($this->message) : utf8_strlen(preg_replace('#\[\/?[a-z\*\+\-]+(=[\S]+)?\]#ius', ' ', $this->message));
if ((!$msg_len && $mode !== 'sig') || $config['max_' . $mode . '_chars'] && $msg_len > $config['max_' . $mode . '_chars'])
// Maximum message length check. 0 disables this check completely.
if ((int) $config['max_' . $mode . '_chars'] > 0 && $message_length > (int) $config['max_' . $mode . '_chars'])
{
$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;
}
// 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;
}
}

View File

@ -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;
',

View File

@ -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']))
{
set_config('allow_avatar', '1');
if ($config['allow_avatar_upload'] || $config['allow_avatar_local'] || $config['allow_avatar_remote'])
{
set_config('allow_avatar', '1');
}
else
{
set_config('allow_avatar', '0');
}
}
else
// Minimum number of characters
if (!isset($config['min_post_chars']))
{
set_config('allow_avatar', '0');
set_config('min_post_chars', '1');
}
if (!isset($config['allow_quick_reply']))
{
set_config('allow_quick_reply', '1');
}
$no_updates = false;

View File

@ -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(

View File

@ -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');

View File

@ -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',

View File

@ -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',

View File

@ -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.',