1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-30 21:40:43 +02:00

[ticket/12371] Do not add unlimited users as responders

We run into the risc that the data is longer then the character limit
of the table column. However as we trim the users list anyway, we can
also just stop adding them and display "many others" instead of "x others"

PHPBB3-12371
This commit is contained in:
Joas Schilling
2014-04-11 12:50:29 +02:00
parent 418747ed34
commit 37751b51f9
2 changed files with 27 additions and 3 deletions

View File

@@ -210,7 +210,11 @@ class post extends \phpbb\notification\type\base
}
}
if ($trimmed_responders_cnt)
if ($trimmed_responders_cnt > 20)
{
$usernames[] = $this->user->lang('NOTIFICATION_MANY_OTHERS');
}
else if ($trimmed_responders_cnt)
{
$usernames[] = $this->user->lang('NOTIFICATION_X_OTHERS', $trimmed_responders_cnt);
}
@@ -403,6 +407,14 @@ class post extends \phpbb\notification\type\base
$responders = ($responders === null) ? array() : $responders;
// Do not add more then 25 responder,
// we trim the username list to "a, b, c and x others" anyway
// so there is no use to add all of them anyway.
if (sizeof($responders) > 25)
{
return array();
}
foreach ($responders as $responder)
{
// Do not add them as a responder multiple times
@@ -420,6 +432,15 @@ class post extends \phpbb\notification\type\base
$this->set_data('responders', $responders);
$serialized_data = serialize($this->get_data(false));
// If the data is longer then 4000 characters, it would cause a SQL error
// so we just don't add the username to the list, when this would be the
// case.
if (utf8_strlen($serialized_data) >= 4000)
{
return array();
}
return array('notification_data' => $serialized_data);
}
}