Add the wesnothd usernames rule patch for phpbb 3.0.5

This commit is contained in:
Ignacio R. Morelle 2009-08-10 14:45:39 +00:00
parent 59282b41ac
commit 2cdcf373f4
2 changed files with 77 additions and 0 deletions

View file

@ -0,0 +1,65 @@
diff --git a/includes/acp/acp_board.php b/includes/acp/acp_board.php
index 8fd2c3d..4f5f218 100644
--- a/includes/acp/acp_board.php
+++ b/includes/acp/acp_board.php
@@ -724,7 +724,10 @@ class acp_board
{
global $user;
- $user_char_ary = array('USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII');
+ // wesnoth mod begin
+ // WESNOTHD HACK: added USERNAME_WESNOTHD to array
+ $user_char_ary = array('USERNAME_CHARS_ANY', 'USERNAME_ALPHA_ONLY', 'USERNAME_ALPHA_SPACERS', 'USERNAME_LETTER_NUM', 'USERNAME_LETTER_NUM_SPACERS', 'USERNAME_ASCII', 'USERNAME_WESNOTHD');
+ // wesnoth mod end
$user_char_options = '';
foreach ($user_char_ary as $user_type)
{
diff --git a/includes/functions_user.php b/includes/functions_user.php
index b536c92..5c54bcb 100644
--- a/includes/functions_user.php
+++ b/includes/functions_user.php
@@ -1398,6 +1398,14 @@ function validate_username($username, $allowed_username = false)
switch ($config['allow_name_chars'])
{
+ // wesnoth mod begin
+ // WESNOTHD HACK: added USERNAME_WESNOTHD to switch block
+ case 'USERNAME_WESNOTHD':
+ $prcre = true;
+ $regex = '[A-Za-z0-9_-]+';
+ break;
+ // wesnoth mod end
+
case 'USERNAME_CHARS_ANY':
$pcre = true;
$regex = '.+';
diff --git a/language/en/acp/board.php b/language/en/acp/board.php
index 2719ec9..2069698 100644
--- a/language/en/acp/board.php
+++ b/language/en/acp/board.php
@@ -227,6 +227,10 @@ $lang = array_merge($lang, array(
'USERNAME_CHARS' => 'Limit username chars',
'USERNAME_CHARS_ANY' => 'Any character',
'USERNAME_CHARS_EXPLAIN' => 'Restrict type of characters that may be used in usernames, spacers are: space, -, +, _, [ and ].',
+ // wesnoth mod begin
+ // WESNOTHD HACK: added USERNAME_WESNOTHD to array
+ 'USERNAME_WESNOTHD' => 'MP server - alphanumeric, hyphens or underscores',
+ // wesnoth mod end
'USERNAME_LENGTH' => 'Username length',
'USERNAME_LENGTH_EXPLAIN' => 'Minimum and maximum number of characters in usernames.',
));
diff --git a/language/en/ucp.php b/language/en/ucp.php
index 5baef21..a493ab7 100644
--- a/language/en/ucp.php
+++ b/language/en/ucp.php
@@ -462,6 +462,10 @@ $lang = array_merge($lang, array(
'USERNAME_ASCII_EXPLAIN' => 'Username must be between %1$d and %2$d chars long and use only ASCII characters, so no special symbols.',
'USERNAME_LETTER_NUM_EXPLAIN' => 'Username must be between %1$d and %2$d chars long and use only letter or number characters.',
'USERNAME_LETTER_NUM_SPACERS_EXPLAIN'=> 'Username must be between %1$d and %2$d chars long and use letter, number, space or -+_[] characters.',
+ // wesnoth mod begin
+ // WESNOTHD HACK: added USERNAME_WESNOTHD_EXPLAIN to array
+ 'USERNAME_WESNOTHD_EXPLAIN' => 'Only alpha-numeric characters, underscores and hyphens are allowed.',
+ // wesnoth mod end
'USERNAME_CHARS_ANY_EXPLAIN' => 'Length must be between %1$d and %2$d characters.',
'USERNAME_TAKEN_USERNAME' => 'The username you entered is already in use, please select an alternative.',
'USERNAME_DISALLOWED_USERNAME' => 'The username you entered has been disallowed or contains a disallowed word. Please choose a different name.',

View file

@ -0,0 +1,12 @@
By Ignacio R. Morelle <shadowmaster>.
This patch adds a new option for the username characters limit
in the ACP User Registration Settings page, titled "MP server".
When selected, new users may only register usernames which are
compatible with the Wesnoth 1.6 wesnothd username rules (only
alphanumeric characters, 7-bit ASCII hyphens or underscores).
After applying the patch, you will need to select the correct
option in the aforementioned ACP page. Existing usernames are
not affected by this.