Fix Bug #47295 - Min/max characters per posts also affects polls option

Authorised by: AcydBurn



git-svn-id: file:///svn/phpbb/branches/phpBB-3_0_0@9892 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Joas Schilling 2009-07-30 13:39:38 +00:00
parent 49625a2aec
commit e1db7e08dc
2 changed files with 18 additions and 6 deletions

View file

@ -181,6 +181,7 @@
<li>[Fix] Do not send private message back to sender if sender is in the same group the private message was sent to.</li> <li>[Fix] Do not send private message back to sender if sender is in the same group the private message was sent to.</li>
<li>[Fix] Correctly add user to a group making it a default one. (Bug #48345 - Patch by rxu)</li> <li>[Fix] Correctly add user to a group making it a default one. (Bug #48345 - Patch by rxu)</li>
<li>[Fix] Add log entry when copying forum permissions.</li> <li>[Fix] Add log entry when copying forum permissions.</li>
<li>[Fix] Min/max characters per posts also affects polls option (Bug #47295 - Patch by nickvergessen)</li>
<li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li> <li>[Change] Change the data format of the default file ACM to be more secure from tampering and have better performance.</li>
<li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li> <li>[Change] Add index on log_time to the log table to prevent slowdown on boards with many log entries. (Bug #44665 - Patch by bantu)</li>
<li>[Change] Template engine now permits to a limited extent variable includes.</li> <li>[Change] Template engine now permits to a limited extent variable includes.</li>

View file

@ -1062,10 +1062,21 @@ class parse_message extends bbcode_firstpass
{ {
global $config, $db, $user; global $config, $db, $user;
$mode = ($mode != 'post') ? 'sig' : 'post';
$this->mode = $mode; $this->mode = $mode;
if (!isset($config['max_' . $mode . '_chars']))
{
$config['max_' . $mode . '_chars'] = 0;
}
if (!isset($config['max_' . $mode . '_smilies']))
{
$config['max_' . $mode . '_smilies'] = 0;
}
if (!isset($config['max_' . $mode . '_urls']))
{
$config['max_' . $mode . '_urls'] = 0;
}
$this->allow_img_bbcode = $allow_img_bbcode; $this->allow_img_bbcode = $allow_img_bbcode;
$this->allow_flash_bbcode = $allow_flash_bbcode; $this->allow_flash_bbcode = $allow_flash_bbcode;
$this->allow_quote_bbcode = $allow_quote_bbcode; $this->allow_quote_bbcode = $allow_quote_bbcode;
@ -1100,7 +1111,7 @@ class parse_message extends bbcode_firstpass
} }
// Minimum message length check for post only // Minimum message length check for post only
if ($mode !== 'sig') if ($mode === 'post')
{ {
if (!$message_length || $message_length < (int) $config['min_post_chars']) if (!$message_length || $message_length < (int) $config['min_post_chars'])
{ {
@ -1153,7 +1164,7 @@ class parse_message extends bbcode_firstpass
// Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length. // Check for "empty" message. We do not check here for maximum length, because bbcode, smilies, etc. can add to the length.
// The maximum length check happened before any parsings. // The maximum length check happened before any parsings.
if ($mode !== 'sig' && utf8_clean_string($this->message) === '') if ($mode === 'post' && utf8_clean_string($this->message) === '')
{ {
$this->warn_msg[] = $user->lang['TOO_FEW_CHARS']; $this->warn_msg[] = $user->lang['TOO_FEW_CHARS'];
return (!$update_this_message) ? $return_message : $this->warn_msg; return (!$update_this_message) ? $return_message : $this->warn_msg;
@ -1629,7 +1640,7 @@ class parse_message extends bbcode_firstpass
$this->message = $poll['poll_option_text']; $this->message = $poll['poll_option_text'];
$bbcode_bitfield = $this->bbcode_bitfield; $bbcode_bitfield = $this->bbcode_bitfield;
$poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false); $poll['poll_option_text'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll');
$bbcode_bitfield = base64_encode(base64_decode($bbcode_bitfield) | base64_decode($this->bbcode_bitfield)); $bbcode_bitfield = base64_encode(base64_decode($bbcode_bitfield) | base64_decode($this->bbcode_bitfield));
$this->message = $tmp_message; $this->message = $tmp_message;
@ -1652,7 +1663,7 @@ class parse_message extends bbcode_firstpass
{ {
$this->warn_msg[] = $user->lang['POLL_TITLE_TOO_LONG']; $this->warn_msg[] = $user->lang['POLL_TITLE_TOO_LONG'];
} }
$poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false); $poll['poll_title'] = $this->parse($poll['enable_bbcode'], ($config['allow_post_links']) ? $poll['enable_urls'] : false, $poll['enable_smilies'], $poll['img_status'], false, false, $config['allow_post_links'], false, 'poll');
if (strlen($poll['poll_title']) > 255) if (strlen($poll['poll_title']) > 255)
{ {
$this->warn_msg[] = $user->lang['POLL_TITLE_COMP_TOO_LONG']; $this->warn_msg[] = $user->lang['POLL_TITLE_COMP_TOO_LONG'];