diff --git a/phpBB/includes/acp/acp_groups.php b/phpBB/includes/acp/acp_groups.php index 089fe4baa1..83c355540e 100644 --- a/phpBB/includes/acp/acp_groups.php +++ b/phpBB/includes/acp/acp_groups.php @@ -421,7 +421,7 @@ class acp_groups */ $validation_checks = array( 'max_recipients' => array('num', false, 0, 16777215), - 'colour' => array('hex_colour'), + 'colour' => array('hex_colour', true), ); if ($validation_error = validate_data($submit_ary, $validation_checks)) diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index f8e1fcaa45..61972c3876 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1903,14 +1903,16 @@ function validate_jabber($jid) * Validate hex colour value * * @param string $colour The hex colour value -* @return bool|string Error message if colour value is incorrect, false if it +* @param bool $optional Whether the colour value is optional. True if an empty +* string will be accepted as correct input, false if not. +* @return bool|string Error message if colour value is incorrect, false if it * fits the hex colour code */ -function phpbb_validate_hex_colour($colour) +function phpbb_validate_hex_colour($colour, $optional = false) { if (empty($colour)) { - return false; + return (($optional) ? false : 'WRONG_DATA'); } if (!preg_match('/^([0-9a-fA-F]{6}|[0-9a-fA-F]{3})$/', $colour)) diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 20a55d8c32..9365913541 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -596,7 +596,7 @@ class ucp_groups } // Validate submitted colour value - if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour')))) + if ($colour_error = validate_data($submit_ary, array('colour' => array('hex_colour', true)))) { // Replace "error" string with its real, localised form $error = array_merge($error, array_map(array(&$user, 'lang'), $colour_error));