diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2009-06-23 10:48:53 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2009-06-23 10:48:53 +0000 |
commit | c32f49679f635175d43de7264ee09782c56c628e (patch) | |
tree | be5368798e1bf839e42b6c28ffa5d126dd5fbc96 /phpBB/includes/message_parser.php | |
parent | 926640fc750ad2d90d4c86b234350dbdd0cc938c (diff) | |
download | forums-c32f49679f635175d43de7264ee09782c56c628e.tar forums-c32f49679f635175d43de7264ee09782c56c628e.tar.gz forums-c32f49679f635175d43de7264ee09782c56c628e.tar.bz2 forums-c32f49679f635175d43de7264ee09782c56c628e.tar.xz forums-c32f49679f635175d43de7264ee09782c56c628e.zip |
- 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
Diffstat (limited to 'phpBB/includes/message_parser.php')
-rw-r--r-- | phpBB/includes/message_parser.php | 18 |
1 files changed, 13 insertions, 5 deletions
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:"); $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; } } |