aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/session.php15
-rw-r--r--phpBB/language/en/common.php1
2 files changed, 14 insertions, 2 deletions
diff --git a/phpBB/includes/session.php b/phpBB/includes/session.php
index cd1975b9d3..4e5257506c 100644
--- a/phpBB/includes/session.php
+++ b/phpBB/includes/session.php
@@ -1901,6 +1901,10 @@ class user extends session
/**
* Determine which plural form we should use.
* For some languages this is not as simple as for English.
+ *
+ * @param $number int The number we want to get the plural case for
+ * @param $force_rule mixed False to use the plural rule of the language package
+ * or an integer to force a certain plural rule
*/
function get_plural_form($number, $force_rule = false)
{
@@ -1910,10 +1914,17 @@ class user extends session
return 0;
}
- // Default to english system
+ // Default to English system
$plural_rule = ($force_rule !== false) ? $force_rule : ((isset($this->lang['PLURAL_RULE'])) ? $this->lang['PLURAL_RULE'] : 1);
- $plural_rule = max(0, min($plural_rule, 15));
+ if ($plural_rule > 15 || $plural_rule < 0)
+ {
+ trigger_error('INVALID_PLURAL_RULE');
+ }
+ /**
+ * The following plural rules are based on a list published by the Mozilla Developer Network
+ * https://developer.mozilla.org/en/Localization_and_Plurals
+ */
switch ($plural_rule)
{
case 0:
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index 57c9d916a2..cf01c6f32e 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -285,6 +285,7 @@ $lang = array_merge($lang, array(
'INTERESTS' => 'Interests',
'INVALID_DIGEST_CHALLENGE' => 'Invalid digest challenge.',
'INVALID_EMAIL_LOG' => '<strong>%s</strong> possibly an invalid e-mail address?',
+ 'INVALID_PLURAL_RULE' => 'The chosen plural rule is invalid. Valid values are integers between 0 and 15.',
'IP' => 'IP',
'IP_BLACKLISTED' => 'Your IP %1$s has been blocked because it is blacklisted. For details please see <a href="%2$s">%2$s</a>.',