diff options
author | Meik Sievertsen <acydburn@phpbb.com> | 2006-11-03 11:26:14 +0000 |
---|---|---|
committer | Meik Sievertsen <acydburn@phpbb.com> | 2006-11-03 11:26:14 +0000 |
commit | daa3288a368ddac0335dde7ee2a718883bfb2fdc (patch) | |
tree | ddca8411bb3c8fc81050ea1e654a8ea726d9c5a0 /phpBB/includes | |
parent | a3bf1ed63ec7aa281b0d47d6f3e87eeeeafbaff5 (diff) | |
download | forums-daa3288a368ddac0335dde7ee2a718883bfb2fdc.tar forums-daa3288a368ddac0335dde7ee2a718883bfb2fdc.tar.gz forums-daa3288a368ddac0335dde7ee2a718883bfb2fdc.tar.bz2 forums-daa3288a368ddac0335dde7ee2a718883bfb2fdc.tar.xz forums-daa3288a368ddac0335dde7ee2a718883bfb2fdc.zip |
- implemented the suggested html_entity_decode function made by david
- fixed string length checking by also decoding entities for the sake of checking
- used the new html_entity_decode function
git-svn-id: file:///svn/phpbb/trunk@6545 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes')
-rw-r--r-- | phpBB/includes/acp/acp_ban.php | 4 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_email.php | 8 | ||||
-rwxr-xr-x | phpBB/includes/acp/acp_inactive.php | 6 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_language.php | 2 | ||||
-rw-r--r-- | phpBB/includes/acp/acp_users.php | 8 | ||||
-rw-r--r-- | phpBB/includes/auth/auth_ldap.php | 4 | ||||
-rw-r--r-- | phpBB/includes/functions.php | 2 | ||||
-rw-r--r-- | phpBB/includes/functions_posting.php | 10 | ||||
-rw-r--r-- | phpBB/includes/functions_privmsgs.php | 10 | ||||
-rw-r--r-- | phpBB/includes/functions_user.php | 12 | ||||
-rw-r--r-- | phpBB/includes/mcp/mcp_queue.php | 22 | ||||
-rwxr-xr-x | phpBB/includes/mcp/mcp_reports.php | 12 | ||||
-rw-r--r-- | phpBB/includes/message_parser.php | 8 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_activate.php | 6 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_groups.php | 8 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_profile.php | 10 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_register.php | 14 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_remind.php | 6 | ||||
-rw-r--r-- | phpBB/includes/ucp/ucp_resend.php | 12 | ||||
-rw-r--r-- | phpBB/includes/utf/utf_tools.php | 45 |
20 files changed, 126 insertions, 83 deletions
diff --git a/phpBB/includes/acp/acp_ban.php b/phpBB/includes/acp/acp_ban.php index 420deb975f..868421e988 100644 --- a/phpBB/includes/acp/acp_ban.php +++ b/phpBB/includes/acp/acp_ban.php @@ -189,7 +189,7 @@ class acp_ban $template->assign_block_vars('ban_reason', array( 'BAN_ID' => $ban_id, 'REASON' => $reason, - 'A_REASON' => addslashes(html_entity_decode($reason))) + 'A_REASON' => addslashes(utf8_html_entity_decode($reason))) ); } } @@ -201,7 +201,7 @@ class acp_ban $template->assign_block_vars('ban_give_reason', array( 'BAN_ID' => $ban_id, 'REASON' => $reason, - 'A_REASON' => addslashes(html_entity_decode($reason))) + 'A_REASON' => addslashes(utf8_html_entity_decode($reason))) ); } } diff --git a/phpBB/includes/acp/acp_email.php b/phpBB/includes/acp/acp_email.php index 48ad8546d1..81e1e52ea4 100644 --- a/phpBB/includes/acp/acp_email.php +++ b/phpBB/includes/acp/acp_email.php @@ -150,15 +150,15 @@ class acp_email $messenger->headers('X-AntiAbuse: Username - ' . $user->data['username']); $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); - $messenger->subject(html_entity_decode($subject)); + $messenger->subject(utf8_html_entity_decode($subject)); $messenger->replyto($config['board_email']); $messenger->set_mail_priority($priority); $messenger->assign_vars(array( - 'SITENAME' => $config['sitename'], + 'SITENAME' => utf8_html_entity_decode($config['sitename']), 'CONTACT_EMAIL' => $config['board_contact'], - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), - 'MESSAGE' => html_entity_decode($message)) + 'EMAIL_SIG' => utf8_html_entity_decode(str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])), + 'MESSAGE' => utf8_html_entity_decode($message)) ); if (!($messenger->send($used_method))) diff --git a/phpBB/includes/acp/acp_inactive.php b/phpBB/includes/acp/acp_inactive.php index 9a26a3595d..616360f422 100755 --- a/phpBB/includes/acp/acp_inactive.php +++ b/phpBB/includes/acp/acp_inactive.php @@ -108,9 +108,9 @@ class acp_inactive $messenger->im($row['user_jabber'], $row['username']); $messenger->assign_vars(array( - 'EMAIL_SIG' => $sig, - 'USERNAME' => html_entity_decode($row['username']), - 'SITENAME' => $config['sitename'], + 'EMAIL_SIG' => utf8_html_entity_decode($sig), + 'USERNAME' => utf8_html_entity_decode($row['username']), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), 'REGISTER_DATE' => $user->format_date($row['user_regdate']), 'U_ACTIVATE' => "$board_url&mode=activate&u=" . $row['user_id'] . '&k=' . $row['user_actkey']) diff --git a/phpBB/includes/acp/acp_language.php b/phpBB/includes/acp/acp_language.php index c901c73ddc..39fbc057bc 100644 --- a/phpBB/includes/acp/acp_language.php +++ b/phpBB/includes/acp/acp_language.php @@ -827,7 +827,7 @@ class acp_language // Write ISO File $iso_src = html_entity_decode($row['lang_english_name']) . "\n"; - $iso_src .= html_entity_decode($row['lang_local_name']) . "\n"; + $iso_src .= utf8_html_entity_decode($row['lang_local_name']) . "\n"; $iso_src .= html_entity_decode($row['lang_author']); $compress->add_data($iso_src, 'language/' . $row['lang_iso'] . '/iso.txt'); diff --git a/phpBB/includes/acp/acp_users.php b/phpBB/includes/acp/acp_users.php index 6b817235b2..ac832d14e3 100644 --- a/phpBB/includes/acp/acp_users.php +++ b/phpBB/includes/acp/acp_users.php @@ -305,10 +305,10 @@ class acp_users $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array( - 'SITENAME' => $config['sitename'], - 'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']), - 'USERNAME' => html_entity_decode($user_row['username']), - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'WELCOME_MSG' => utf8_html_entity_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'USERNAME' => utf8_html_entity_decode($user_row['username']), + 'EMAIL_SIG' => utf8_html_entity_decode(str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])), 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey") ); diff --git a/phpBB/includes/auth/auth_ldap.php b/phpBB/includes/auth/auth_ldap.php index b1ee7491b0..fd8e5cccfc 100644 --- a/phpBB/includes/auth/auth_ldap.php +++ b/phpBB/includes/auth/auth_ldap.php @@ -38,7 +38,7 @@ function init_ldap() $search = @ldap_search( $ldap, $config['ldap_base_dn'], - '(' . $config['ldap_uid'] . '=' . ldap_escape(html_entity_decode($user->data['username'])) . ')', + '(' . $config['ldap_uid'] . '=' . ldap_escape(utf8_html_entity_decode($user->data['username'])) . ')', (empty($config['ldap_email'])) ? array($config['ldap_uid']) : array($config['ldap_uid'], $config['ldap_email']), 0, 1 @@ -98,7 +98,7 @@ function login_ldap(&$username, &$password) $search = @ldap_search( $ldap, $config['ldap_base_dn'], - '(' . $config['ldap_uid'] . '=' . ldap_escape(html_entity_decode($username)) . ')', + '(' . $config['ldap_uid'] . '=' . ldap_escape(utf8_html_entity_decode($username)) . ')', (empty($config['ldap_email'])) ? array($config['ldap_uid']) : array($config['ldap_uid'], $config['ldap_email']), 0, 1 diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 27b935d759..c3c8616567 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -2728,7 +2728,7 @@ function truncate_string($string, $max_length = 60, $allow_reply = true) $string = substr($string, 4); } - $_chars = utf8_str_split(html_entity_decode($string)); + $_chars = utf8_str_split(utf8_html_entity_decode($string)); $chars = array_map('htmlspecialchars', $_chars); // Now check the length ;) diff --git a/phpBB/includes/functions_posting.php b/phpBB/includes/functions_posting.php index 86e60a72e6..141d4813e2 100644 --- a/phpBB/includes/functions_posting.php +++ b/phpBB/includes/functions_posting.php @@ -1116,11 +1116,11 @@ function user_notification($mode, $subject, $topic_title, $forum_name, $forum_id $messenger->im($addr['jabber'], $addr['name']); $messenger->assign_vars(array( - 'EMAIL_SIG' => $email_sig, - 'SITENAME' => html_entity_decode($config['sitename']), - 'USERNAME' => html_entity_decode($addr['name']), - 'TOPIC_TITLE' => html_entity_decode($topic_title), - 'FORUM_NAME' => html_entity_decode($forum_name), + 'EMAIL_SIG' => utf8_html_entity_decode($email_sig), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'USERNAME' => utf8_html_entity_decode($addr['name']), + 'TOPIC_TITLE' => utf8_html_entity_decode($topic_title), + 'FORUM_NAME' => utf8_html_entity_decode($forum_name), 'U_FORUM' => generate_board_url() . "/viewforum.$phpEx?f=$forum_id&e=0", 'U_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t=$topic_id&e=0", diff --git a/phpBB/includes/functions_privmsgs.php b/phpBB/includes/functions_privmsgs.php index 66f6d63ce1..9eefcf9174 100644 --- a/phpBB/includes/functions_privmsgs.php +++ b/phpBB/includes/functions_privmsgs.php @@ -1598,11 +1598,11 @@ function pm_notification($mode, $author, $recipients, $subject, $message) $messenger->im($addr['jabber'], $addr['name']); $messenger->assign_vars(array( - 'EMAIL_SIG' => $email_sig, - 'SITENAME' => $config['sitename'], - 'SUBJECT' => html_entity_decode($subject), - 'AUTHOR_NAME' => html_entity_decode($author), - 'USERNAME' => html_entity_decode($addr['name']), + 'EMAIL_SIG' => utf8_html_entity_decode($email_sig), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'SUBJECT' => utf8_html_entity_decode($subject), + 'AUTHOR_NAME' => utf8_html_entity_decode($author), + 'USERNAME' => utf8_html_entity_decode($addr['name']), 'U_INBOX' => generate_board_url() . "/ucp.$phpEx?i=pm&folder=inbox") ); diff --git a/phpBB/includes/functions_user.php b/phpBB/includes/functions_user.php index 96b7fb4cec..07416887ba 100644 --- a/phpBB/includes/functions_user.php +++ b/phpBB/includes/functions_user.php @@ -1054,11 +1054,11 @@ function validate_string($string, $optional = false, $min = 0, $max = 0) return false; } - if ($min && utf8_strlen($string) < $min) + if ($min && utf8_strlen(utf8_html_entity_decode($string)) < $min) { return 'TOO_SHORT'; } - else if ($max && utf8_strlen($string) > $max) + else if ($max && utf8_strlen(utf8_html_entity_decode($string)) > $max) { return 'TOO_LONG'; } @@ -2011,10 +2011,10 @@ function group_user_attributes($action, $group_id, $user_id_ary = false, $userna $messenger->im($row['user_jabber'], $row['username']); $messenger->assign_vars(array( - 'EMAIL_SIG' => $email_sig, - 'SITENAME' => $config['sitename'], - 'USERNAME' => html_entity_decode($row['username']), - 'GROUP_NAME' => html_entity_decode($group_name), + 'EMAIL_SIG' => utf8_html_entity_decode($email_sig), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'USERNAME' => utf8_html_entity_decode($row['username']), + 'GROUP_NAME' => utf8_html_entity_decode($group_name), 'U_GROUP' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=membership") ); diff --git a/phpBB/includes/mcp/mcp_queue.php b/phpBB/includes/mcp/mcp_queue.php index 7e23cf3219..e43a861cb9 100644 --- a/phpBB/includes/mcp/mcp_queue.php +++ b/phpBB/includes/mcp/mcp_queue.php @@ -537,11 +537,11 @@ function approve_post($post_id_list, $mode) $messenger->im($post_data['user_jabber'], $post_data['username']); $messenger->assign_vars(array( - 'EMAIL_SIG' => $email_sig, - 'SITENAME' => $config['sitename'], - 'USERNAME' => html_entity_decode($post_data['username']), - 'POST_SUBJECT' => html_entity_decode(censor_text($post_data['post_subject'])), - 'TOPIC_TITLE' => html_entity_decode(censor_text($post_data['topic_title'])), + 'EMAIL_SIG' => utf8_html_entity_decode($email_sig), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'USERNAME' => utf8_html_entity_decode($post_data['username']), + 'POST_SUBJECT' => utf8_html_entity_decode(censor_text($post_data['post_subject'])), + 'TOPIC_TITLE' => utf8_html_entity_decode(censor_text($post_data['topic_title'])), 'U_VIEW_TOPIC' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t={$post_data['topic_id']}&e=0", 'U_VIEW_POST' => generate_board_url() . "/viewtopic.$phpEx?f=$forum_id&t={$post_data['topic_id']}&p=$post_id&e=$post_id") @@ -752,12 +752,12 @@ function disapprove_post($post_id_list, $mode) $messenger->im($post_data['user_jabber'], $post_data['username']); $messenger->assign_vars(array( - 'EMAIL_SIG' => $email_sig, - 'SITENAME' => $config['sitename'], - 'USERNAME' => html_entity_decode($post_data['username']), - 'REASON' => html_entity_decode($disapprove_reason), - 'POST_SUBJECT' => html_entity_decode(censor_text($post_data['post_subject'])), - 'TOPIC_TITLE' => html_entity_decode(censor_text($post_data['topic_title']))) + 'EMAIL_SIG' => utf8_html_entity_decode($email_sig), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'USERNAME' => utf8_html_entity_decode($post_data['username']), + 'REASON' => utf8_html_entity_decode($disapprove_reason), + 'POST_SUBJECT' => utf8_html_entity_decode(censor_text($post_data['post_subject'])), + 'TOPIC_TITLE' => utf8_html_entity_decode(censor_text($post_data['topic_title']))) ); $messenger->send($post_data['user_notify_type']); diff --git a/phpBB/includes/mcp/mcp_reports.php b/phpBB/includes/mcp/mcp_reports.php index 4ede1ab416..f9103dcd40 100755 --- a/phpBB/includes/mcp/mcp_reports.php +++ b/phpBB/includes/mcp/mcp_reports.php @@ -491,12 +491,12 @@ function close_report($post_id_list, $mode, $action) $messenger->im($reporter['user_jabber'], $reporter['username']); $messenger->assign_vars(array( - 'EMAIL_SIG' => $email_sig, - 'SITENAME' => $config['sitename'], - 'USERNAME' => html_entity_decode($reporter['username']), - 'CLOSER_NAME' => html_entity_decode($user->data['username']), - 'POST_SUBJECT' => html_entity_decode(censor_text($post_info[$post_id]['post_subject'])), - 'TOPIC_TITLE' => html_entity_decode(censor_text($post_info[$post_id]['topic_title']))) + 'EMAIL_SIG' => utf8_html_entity_decode($email_sig), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'USERNAME' => utf8_html_entity_decode($reporter['username']), + 'CLOSER_NAME' => utf8_html_entity_decode($user->data['username']), + 'POST_SUBJECT' => utf8_html_entity_decode(censor_text($post_info[$post_id]['post_subject'])), + 'TOPIC_TITLE' => utf8_html_entity_decode(censor_text($post_info[$post_id]['topic_title']))) ); $messenger->send($reporter['user_notify_type']); diff --git a/phpBB/includes/message_parser.php b/phpBB/includes/message_parser.php index 46dfd1cf6d..90d08a64c5 100644 --- a/phpBB/includes/message_parser.php +++ b/phpBB/includes/message_parser.php @@ -365,10 +365,10 @@ class bbcode_firstpass extends bbcode // Having it here saves us one preg_replace per message containing [code] blocks // Additionally, magic url parsing should go after parsing bbcodes, but for safety those are stripped out too... $htm_match = get_preg_expression('bbcode_htm'); - $htm_match[3] = '#&\#([0-9]+);#'; - unset($htm_match[4]); +// $htm_match[3] = '/&#([0-9]+);/'; + unset($htm_match[3], $htm_match[4]); - $htm_replace = array('\1', '\2', '\1', '&#\1;'); + $htm_replace = array('\1', '\2', '\1'); //, '&#\1;'); $out = ''; @@ -419,7 +419,7 @@ class bbcode_firstpass extends bbcode } // Because highlight_string is specialcharing the text (but we already did this before), we have to reverse this in order to get correct results - $code = html_entity_decode($code); + $code = utf8_html_entity_decode($code); $code = highlight_string($code, true); $str_from = array('<span style="color: ', '<font color="syntax', '</font>', '<code>', '</code>','[', ']', '.', ':'); diff --git a/phpBB/includes/ucp/ucp_activate.php b/phpBB/includes/ucp/ucp_activate.php index a6c1f82529..6a23498fe6 100644 --- a/phpBB/includes/ucp/ucp_activate.php +++ b/phpBB/includes/ucp/ucp_activate.php @@ -93,10 +93,10 @@ class ucp_activate $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array( - 'SITENAME' => $config['sitename'], - 'USERNAME' => html_entity_decode($user_row['username']), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'USERNAME' => utf8_html_entity_decode($user_row['username']), - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])) + 'EMAIL_SIG' => utf8_html_entity_decode(str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']))) ); $messenger->send($user_row['user_notify_type']); diff --git a/phpBB/includes/ucp/ucp_groups.php b/phpBB/includes/ucp/ucp_groups.php index 47fd2f6d02..aad6bbc45a 100644 --- a/phpBB/includes/ucp/ucp_groups.php +++ b/phpBB/includes/ucp/ucp_groups.php @@ -190,10 +190,10 @@ class ucp_groups $messenger->im($row['user_jabber'], $row['username']); $messenger->assign_vars(array( - 'EMAIL_SIG' => $email_sig, - 'SITENAME' => $config['sitename'], - 'USERNAME' => html_entity_decode($row['username']), - 'GROUP_NAME' => html_entity_decode($group_row[$group_id]['group_name']), + 'EMAIL_SIG' => utf8_html_entity_decode($email_sig), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'USERNAME' => utf8_html_entity_decode($row['username']), + 'GROUP_NAME' => utf8_html_entity_decode($group_row[$group_id]['group_name']), 'U_PENDING' => generate_board_url() . "/ucp.$phpEx?i=groups&mode=manage&action=list&g=$group_id", 'U_GROUP' => generate_board_url() . "/memberlist.$phpEx?mode=group&g=$group_id") diff --git a/phpBB/includes/ucp/ucp_profile.php b/phpBB/includes/ucp/ucp_profile.php index b6a6d625d6..671cb6fac1 100644 --- a/phpBB/includes/ucp/ucp_profile.php +++ b/phpBB/includes/ucp/ucp_profile.php @@ -144,9 +144,9 @@ class ucp_profile $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array( - 'SITENAME' => $config['sitename'], - 'USERNAME' => html_entity_decode($username, ENT_COMPAT, 'UTF-8'), - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'USERNAME' => utf8_html_entity_decode($username), + 'EMAIL_SIG' => utf8_html_entity_decode(str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])), 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey") ); @@ -180,8 +180,8 @@ class ucp_profile $messenger->im($row['user_jabber'], $row['username']); $messenger->assign_vars(array( - 'USERNAME' => html_entity_decode($username, ENT_COMPAT, 'UTF-8'), - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), + 'USERNAME' => utf8_html_entity_decode($username), + 'EMAIL_SIG' => utf8_html_entity_decode(str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])), 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user->data['user_id']}&k=$user_actkey") ); diff --git a/phpBB/includes/ucp/ucp_register.php b/phpBB/includes/ucp/ucp_register.php index bb204d524f..2bc26bed78 100644 --- a/phpBB/includes/ucp/ucp_register.php +++ b/phpBB/includes/ucp/ucp_register.php @@ -336,11 +336,11 @@ class ucp_register $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array( - 'SITENAME' => $config['sitename'], - 'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']), - 'USERNAME' => html_entity_decode($data['username'], ENT_COMPAT, 'UTF-8'), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'WELCOME_MSG' => utf8_html_entity_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'USERNAME' => utf8_html_entity_decode($data['username']), 'PASSWORD' => html_entity_decode($data['new_password']), - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), + 'EMAIL_SIG' => utf8_html_entity_decode(str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])), 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey") ); @@ -351,7 +351,7 @@ class ucp_register 'FAX_INFO' => $config['coppa_fax'], 'MAIL_INFO' => $config['coppa_mail'], 'EMAIL_ADDRESS' => $data['email'], - 'SITENAME' => $config['sitename']) + 'SITENAME' => utf8_html_entity_decode($config['sitename'])) ); } @@ -384,8 +384,8 @@ class ucp_register $messenger->im($row['user_jabber'], $row['username']); $messenger->assign_vars(array( - 'USERNAME' => html_entity_decode($data['username'], ENT_COMPAT, 'UTF-8'), - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), + 'USERNAME' => utf8_html_entity_decode($data['username']), + 'EMAIL_SIG' => utf8_html_entity_decode(str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])), 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u=$user_id&k=$user_actkey") ); diff --git a/phpBB/includes/ucp/ucp_remind.php b/phpBB/includes/ucp/ucp_remind.php index b9bc14e60a..1f9db8f28b 100644 --- a/phpBB/includes/ucp/ucp_remind.php +++ b/phpBB/includes/ucp/ucp_remind.php @@ -69,10 +69,10 @@ class ucp_remind $messenger->im($user_row['user_jabber'], $user_row['username']); $messenger->assign_vars(array( - 'SITENAME' => $config['sitename'], - 'USERNAME' => html_entity_decode($user_row['username']), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'USERNAME' => utf8_html_entity_decode($user_row['username']), 'PASSWORD' => html_entity_decode($user_password), - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), + 'EMAIL_SIG' => utf8_html_entity_decode(str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])), 'U_ACTIVATE' => "$server_url/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k=$user_actkey") ); diff --git a/phpBB/includes/ucp/ucp_resend.php b/phpBB/includes/ucp/ucp_resend.php index 145d0f2e7e..afa58f4e1b 100644 --- a/phpBB/includes/ucp/ucp_resend.php +++ b/phpBB/includes/ucp/ucp_resend.php @@ -77,10 +77,10 @@ class ucp_resend $messenger->headers('X-AntiAbuse: User IP - ' . $user->ip); $messenger->assign_vars(array( - 'SITENAME' => $config['sitename'], - 'WELCOME_MSG' => sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename']), - 'USERNAME' => html_entity_decode($user_row['username']), - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), + 'SITENAME' => utf8_html_entity_decode($config['sitename']), + 'WELCOME_MSG' => utf8_html_entity_decode(sprintf($user->lang['WELCOME_SUBJECT'], $config['sitename'])), + 'USERNAME' => utf8_html_entity_decode($user_row['username']), + 'EMAIL_SIG' => utf8_html_entity_decode(str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])), 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}") ); @@ -116,8 +116,8 @@ class ucp_resend $messenger->im($row['user_jabber'], $row['username']); $messenger->assign_vars(array( - 'USERNAME' => html_entity_decode($user_row['username']), - 'EMAIL_SIG' => str_replace('<br />', "\n", "-- \n" . $config['board_email_sig']), + 'USERNAME' => utf8_html_entity_decode($user_row['username']), + 'EMAIL_SIG' => utf8_html_entity_decode(str_replace('<br />', "\n", "-- \n" . $config['board_email_sig'])), 'U_ACTIVATE' => generate_board_url() . "/ucp.$phpEx?mode=activate&u={$user_row['user_id']}&k={$user_row['user_actkey']}") ); diff --git a/phpBB/includes/utf/utf_tools.php b/phpBB/includes/utf/utf_tools.php index 24aeb35d02..fdf68d092e 100644 --- a/phpBB/includes/utf/utf_tools.php +++ b/phpBB/includes/utf/utf_tools.php @@ -8,7 +8,7 @@ * * @todo make sure the replacements are called correctly * already done: strtolower, strtoupper, ucfirst, str_split, strrpos, strlen (hopefully!), strpos, substr -* remaining: clean_username, htmlentities (no longer needed for internal data?), htmlspecialchars (using charset), html_entity_decode (own function to reverse htmlspecialchars and not htmlentities) +* remaining: clean_username, htmlentities (no longer needed for internal data?), htmlspecialchars (using charset) * strspn, chr, ord */ @@ -929,6 +929,9 @@ function utf8_case_fold($text, $option = 'full') return $text; } +/** +* @todo needs documenting +*/ function utf8_clean_string($text) { $text = utf8_case_fold($text); @@ -964,4 +967,44 @@ function utf8_clean_string($text) return $text; } +if (version_compare(phpversion(), '5', '>=')) +{ + /** + * @ignore + */ + function utf8_html_entity_decode($string, $quote_style = ENT_COMPAT) + { + return html_entity_decode($string, $quote_style, 'UTF-8'); + } +} +else +{ + /** + * @todo needs documenting + */ + function utf8_html_entity_decode($string, $quote_style = ENT_COMPAT) + { + static $static_table; + + if ($static_table === null) + { + $static_table = array_map('utf8_encode', array_flip(get_html_translation_table(HTML_ENTITIES))); + } + + $modified_table = $static_table; + + if ($quote_style === ENT_QUOTES) + { + $modified_table['''] = "'"; + } + + if ($quote_style === ENT_NOQUOTES) + { + unset($modified_table['"']); + } + + return strtr($string, $modified_table); + } +} + ?>
\ No newline at end of file |