From 17a27175fd769db449aef44a82d16747a440d452 Mon Sep 17 00:00:00 2001 From: Nils Adermann Date: Wed, 3 Jan 2007 18:58:19 +0000 Subject: [PATCH] - allow login with redirect parameter - altered URL regular expression so it won't cause problem with long URLs - PCRE >:( [Bug #6720] - moderator list on index should have coloured groups in bold as everywhere else too - correctly handle password requirements in UCP [Bug #6692] - added soft-hyphen to utf8_clean_string(), if you know any more evil characters (or whitespace characters that are not in ASCII range) then tell me about them (bug report) ;-) git-svn-id: file:///svn/phpbb/trunk@6832 89ea8834-ac86-4346-8a33-228a782c2dd0 --- phpBB/develop/regex.php | 7 +++--- phpBB/includes/functions.php | 4 ++-- phpBB/includes/functions_display.php | 2 +- phpBB/includes/ucp/ucp_profile.php | 5 ++--- phpBB/includes/utf/utf_tools.php | 32 ++++++++++++++++------------ phpBB/ucp.php | 2 +- 6 files changed, 28 insertions(+), 24 deletions(-) diff --git a/phpBB/develop/regex.php b/phpBB/develop/regex.php index 2b736afec2..1719fe03e9 100644 --- a/phpBB/develop/regex.php +++ b/phpBB/develop/regex.php @@ -46,13 +46,14 @@ $sub_delims = '!$&\'()*+,;='; $pchar = "(?:[$unreserved$sub_delims:@|]+|$pct_encoded)"; // rfc: no "|" $scheme = '[a-z][a-z\d+\-.]*'; -$reg_name = "(?:[$unreserved$sub_delims|]+|$pct_encoded)+"; // rfc: * instead of + and no "|" -$userinfo = "(?:(?:[$unreserved$sub_delims:]+|$pct_encoded))*"; +$reg_name = "(?:[$unreserved$sub_delims|@]+|$pct_encoded)+"; // rfc: * instead of + and no "|" and no "@" (included instead of userinfo +//$userinfo = "(?:(?:[$unreserved$sub_delims:]+|$pct_encoded))*"; $ipv4_simple = '[0-9.]+'; $ipv6_simple = '\[[a-z0-9.:]+\]'; $host = "(?:$reg_name|$ipv4_simple|$ipv6_simple)"; $port = '\d*'; -$authority = "(?:$userinfo@)?$host(?::$port)?"; +//$authority = "(?:$userinfo@)?$host(?::$port)?"; +$authority = "$host(?::$port)?"; $segment = "$pchar*"; $path_abempty = "(?:/$segment)*"; $hier_part = "/{2}$authority$path_abempty"; diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index a160bee7d3..42046ff265 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -3023,11 +3023,11 @@ function get_preg_expression($mode) case 'url': // generated with regex generation file in the develop folder - return "[a-z][a-z\d+\-.]*:/{2}(?:(?:(?:[a-z0-9\-._~!$&'()*+,;=:]+|%[\dA-F]{2}))*@)?(?:(?:[a-z0-9\-._~!$&'()*+,;=|]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.:]+\])(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; + return "[a-z][a-z\d+\-.]*:/{2}(?:(?:[a-z0-9\-._~!$&'()*+,;=|@]+|%[\dA-F]{2})+|[0-9.]+|\[[a-z0-9.:]+\])(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; break; case 'www_url': - return "www\.(?:[a-z0-9\-._~!$&'()*+,;=|]+|%[\dA-F]{2})+(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; + return "www\.(?:[a-z0-9\-._~!$&'()*+,;=|@]+|%[\dA-F]{2})+(?::\d*)?(?:/(?:[a-z0-9\-._~!$&'()*+,;=:@|]+|%[\dA-F]{2})*)*(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?(?:\#(?:[a-z0-9\-._~!$&'()*+,;=:@/?|]+|%[\dA-F]{2})*)?"; break; case 'relative_url': diff --git a/phpBB/includes/functions_display.php b/phpBB/includes/functions_display.php index 60e35709c9..bfff31af6a 100644 --- a/phpBB/includes/functions_display.php +++ b/phpBB/includes/functions_display.php @@ -598,7 +598,7 @@ function get_moderators(&$forum_moderators, $forum_id = false) } else { - $forum_moderators[$row['forum_id']][] = '' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . ''; + $forum_moderators[$row['forum_id']][] = '' . (($row['group_type'] == GROUP_SPECIAL) ? $user->lang['G_' . $row['group_name']] : $row['group_name']) . ''; } } $db->sql_freeresult($result); diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index e6be8acd3d..e0d375c7ff 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -210,8 +210,7 @@ class ucp_profile $error = preg_replace('#^([A-Z_]+)$#e', "(!empty(\$user->lang['\\1'])) ? \$user->lang['\\1'] : '\\1'", $error); } - $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[\w]+' => 'USERNAME_ALPHA_ONLY', '[\w_\+\. \-\[\]]+' => 'USERNAME_ALPHA_SPACERS'); - $pass_char_ary = array('.*' => 'PASS_TYPE_ANY', '[a-zA-Z]' => 'PASS_TYPE_CASE', '[a-zA-Z0-9]' => 'PASS_TYPE_ALPHA', '[a-zA-Z\W]' => 'PASS_TYPE_SYMBOL'); + $user_char_ary = array('.*' => 'USERNAME_CHARS_ANY', '[a-z]+' => 'USERNAME_ALPHA_ONLY', '[-\]_+ [a-z]+' => 'USERNAME_ALPHA_SPACERS', '\w+' => 'USERNAME_LETTER_NUM', '[-\]_+ [\w]+' => 'USERNAME_LETTER_NUM_SPACERS', '[\x01-\x7F]+' => 'USERNAME_ASCII'); $template->assign_vars(array( 'ERROR' => (sizeof($error)) ? implode('
', $error) : '', @@ -223,7 +222,7 @@ class ucp_profile 'CUR_PASSWORD' => '', 'L_USERNAME_EXPLAIN' => sprintf($user->lang[$user_char_ary[str_replace('\\\\', '\\', $config['allow_name_chars'])] . '_EXPLAIN'], $config['min_name_chars'], $config['max_name_chars']), - 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$pass_char_ary[str_replace('\\\\', '\\', $config['pass_complex'])] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), + 'L_CHANGE_PASSWORD_EXPLAIN' => sprintf($user->lang[$config['pass_complex'] . '_EXPLAIN'], $config['min_pass_chars'], $config['max_pass_chars']), 'S_FORCE_PASSWORD' => ($config['chg_passforce'] && $user->data['user_passchg'] < time() - $config['chg_passforce']) ? true : false, 'S_CHANGE_USERNAME' => ($config['allow_namechange'] && $auth->acl_get('u_chgname')) ? true : false, diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index ca4aa86ce3..c3c15b2c3b 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -1092,22 +1092,26 @@ function utf8_clean_string($text) static $homographs = array( // cyrllic - "\xD0\xB0" => "\x61", - "\xD0\xB5" => "\x65", - "\xD0\xBE" => "\x6F", - "\xD1\x80" => "\x70", - "\xD1\x81" => "\x63", - "\xD1\x83" => "\x79", - "\xD1\x85" => "\x78", - "\xD1\x95" => "\x73", - "\xD1\x96" => "\x69", - "\xD1\x98" => "\x6A", - "\xD2\xBB" => "\x68", + "\xD0\xB0" => "\x61", + "\xD0\xB5" => "\x65", + "\xD0\xBE" => "\x6F", + "\xD1\x80" => "\x70", + "\xD1\x81" => "\x63", + "\xD1\x83" => "\x79", + "\xD1\x85" => "\x78", + "\xD1\x95" => "\x73", + "\xD1\x96" => "\x69", + "\xD1\x98" => "\x6A", + "\xD2\xBB" => "\x68", // greek - "\xCE\xB1" => "\x61", - "\xCE\xBF" => "\x6F", + "\xCE\xB1" => "\x61", + "\xCE\xBF" => "\x6F", // other - "\xC2\xA1" => "\x69", + "\xC2\xA1" => "\x69", + "\xC2\xAD" => '', + "\x08" => '', + "\x09" => "\x32", + "\x11" => "\x32", ); $text = strtr($text, $homographs); diff --git a/phpBB/ucp.php b/phpBB/ucp.php index d0163d9daf..4568592081 100755 --- a/phpBB/ucp.php +++ b/phpBB/ucp.php @@ -78,7 +78,7 @@ switch ($mode) redirect(append_sid("{$phpbb_root_path}index.$phpEx")); } - login_box("index.$phpEx"); + login_box(request_var('redirect', "index.$phpEx")); break; case 'logout':