aboutsummaryrefslogtreecommitdiff
path: root/phpBB
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB')
-rw-r--r--phpBB/includes/ucp/ucp_groups.php14
-rw-r--r--phpBB/language/en/common.php1
2 files changed, 10 insertions, 5 deletions
diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php
index c1db19774a..3f06e74159 100644
--- a/phpBB/includes/ucp/ucp_groups.php
+++ b/phpBB/includes/ucp/ucp_groups.php
@@ -595,18 +595,22 @@ class ucp_groups
$error[] = $user->lang['FORM_INVALID'];
}
- if (!sizeof($error))
+ if (!empty($submit_ary['colour']))
{
- // Make sure maximum length of 6 of group color is not exceeded
- if (strpos($submit_ary['colour'], '#') === 0)
+ preg_match('/^(#?)+(?:[0-9a-fA-F]{6}|[0-9a-fA-F]{3})\b/', $submit_ary['colour'], $group_colour);
+
+ if (sizeof($group_colour))
{
- $submit_ary['colour'] = substr($submit_ary['colour'], 1, 6);
+ $submit_ary['colour'] = (strpos($group_colour[0], '#') !== false) ? str_replace('#', '', $group_colour[0]) : $group_colour[0];
}
else
{
- $submit_ary['colour'] = substr($submit_ary['colour'], 0, 6);
+ $error[] = $user->lang['COLOUR_INVALID'];
}
+ }
+ if (!sizeof($error))
+ {
// Only set the rank, colour, etc. if it's changed or if we're adding a new
// group. This prevents existing group members being updated if no changes
// were made.
diff --git a/phpBB/language/en/common.php b/phpBB/language/en/common.php
index baf398b146..129deb551c 100644
--- a/phpBB/language/en/common.php
+++ b/phpBB/language/en/common.php
@@ -120,6 +120,7 @@ $lang = array_merge($lang, array(
'CLICK_VIEW_PRIVMSG' => '%sGo to your inbox%s',
'COLLAPSE_VIEW' => 'Collapse view',
'CLOSE_WINDOW' => 'Close window',
+ 'COLOUR_INVALID' => 'The colour value you entered is invalid.',
'COLOUR_SWATCH' => 'Colour swatch',
'COMMA_SEPARATOR' => ', ', // Used in pagination of ACP & prosilver, use localised comma if appropriate, eg: Ideographic or Arabic
'CONFIRM' => 'Confirm',