diff --git a/phpBB/docs/CHANGELOG.html b/phpBB/docs/CHANGELOG.html
index 8c91666f58..e62833ed13 100644
--- a/phpBB/docs/CHANGELOG.html
+++ b/phpBB/docs/CHANGELOG.html
@@ -97,6 +97,7 @@ p,ul,td {font-size:10pt;}
Added GMT + 13 to English lang_main, all translators are encouraged to do likewise - within the last release a language variable was missing
Deleted doubled 'U_MEMBERLIST' assignment from page_header.php
Fixed wrong display of Signature Checkbox while editing Private Message
+Fixed disappearing post text if emoticon was inserted directly after pressing a BBCode button
1.ii. Changes since 2.0.3
diff --git a/phpBB/includes/usercp_register.php b/phpBB/includes/usercp_register.php
index 241a248902..096bdd539d 100644
--- a/phpBB/includes/usercp_register.php
+++ b/phpBB/includes/usercp_register.php
@@ -27,6 +27,9 @@ if ( !defined('IN_PHPBB') )
exit;
}
+$unhtml_specialchars_match = array('#>#', '#<#', '#"#', '#&#');
+$unhtml_specialchars_replace = array('>', '<', '"', '&');
+
// ---------------------------------------
// Load agreement template since user has not yet
// agreed to registration conditions/coppa
@@ -463,7 +466,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
- 'USERNAME' => $username,
+ 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $username),
'EMAIL_SIG' => (!empty($board_config['board_email_sig'])) ? str_replace('
', "\n", "-- \n" . $board_config['board_email_sig']) : '',
'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
@@ -574,7 +577,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
- 'USERNAME' => $username,
+ 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $username),
'PASSWORD' => $password_confirm,
'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . $board_config['board_email_sig']),
@@ -596,7 +599,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$emailer->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'WELCOME_MSG' => sprintf($lang['Welcome_subject'], $board_config['sitename']),
- 'USERNAME' => $username,
+ 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $username),
'PASSWORD' => $password_confirm,
'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . $board_config['board_email_sig']),
@@ -632,7 +635,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
$emailer->extra_headers($email_headers . "Bcc: $bcc_list\n");
$emailer->assign_vars(array(
- 'USERNAME' => $username,
+ 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, $username),
'EMAIL_SIG' => str_replace('
', "\n", "-- \n" . $board_config['board_email_sig']),
'U_ACTIVATE' => $server_url . '?mode=activate&' . POST_USERS_URL . '=' . $user_id . '&act_key=' . $user_actkey)
diff --git a/phpBB/privmsg.php b/phpBB/privmsg.php
index 7c5d0e3d85..986c33521e 100644
--- a/phpBB/privmsg.php
+++ b/phpBB/privmsg.php
@@ -1455,7 +1455,7 @@ else if ( $submit || $refresh || $mode != '' )
$privmsg_message = str_replace('
', "\n", $privmsg_message);
$privmsg_message = preg_replace('##si', '</textarea>', $privmsg_message);
- $user_sig = ( $board_config['allow_sig'] ) ? (($privmsg['privmsgs_type'] == PRIVMSGS_NEW_MAIL && %) ? $user_sig : $privmsg['user_sig']) : '';
+ $user_sig = ( $board_config['allow_sig'] ) ? (($privmsg['privmsgs_type'] == PRIVMSGS_NEW_MAIL) ? $user_sig : $privmsg['user_sig']) : '';
$to_username = $privmsg['username'];
$to_userid = $privmsg['user_id'];
diff --git a/phpBB/templates/subSilver/posting_body.tpl b/phpBB/templates/subSilver/posting_body.tpl
index 701aebda22..a89e160783 100644
--- a/phpBB/templates/subSilver/posting_body.tpl
+++ b/phpBB/templates/subSilver/posting_body.tpl
@@ -96,7 +96,7 @@ function emoticon(text) {
text = ' ' + text + ' ';
if (txtarea.createTextRange && txtarea.caretPos) {
var caretPos = txtarea.caretPos;
- caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
+ caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? caretPos.text + text + ' ' : caretPos.text + text;
txtarea.focus();
} else {
txtarea.value += text;