diff --git a/phpBB/includes/emailer.php b/phpBB/includes/emailer.php
index 2aed527da1..0073a7dbb9 100755
--- a/phpBB/includes/emailer.php
+++ b/phpBB/includes/emailer.php
@@ -213,9 +213,6 @@ class emailer
// Build header
$this->extra_headers = (($this->replyto != '') ? "Reply-to: <$this->replyto>\n" : '') . (($this->from != '') ? "From: <$this->from>\n" : "From: <" . $board_config['board_email'] . ">\n") . "Return-Path: <" . $board_config['board_email'] . ">\nMessage-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">\nMIME-Version: 1.0\nContent-type: text/plain; charset=" . $this->encoding . "\nContent-transfer-encoding: 8bit\nDate: " . gmdate('D, d M Y H:i:s Z', time()) . "\nX-Priority: 3\nX-MSMail-Priority: Normal\nX-Mailer: PHP\nX-MimeOLE: Produced By phpBB2\n" . $this->extra_headers . (($cc != '') ? "Cc:$cc\n" : '') . (($bcc != '') ? "Bcc:$bcc\n" : '');
- $empty_to_header = ($to == '') ? TRUE : FALSE;
- $to = ($to == '') ? (($board_config['sendmail_fix'] && !$this->use_smtp) ? ' ' : 'Undisclosed-recipients:;') : $to;
-
// Send message ... removed $this->encode() from subject for time being
if ( $this->use_smtp )
{
@@ -228,6 +225,9 @@ class emailer
}
else
{
+ $empty_to_header = ($to == '') ? TRUE : FALSE;
+ $to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to;
+
$result = @mail($to, $this->subject, preg_replace("#(?msg), $this->extra_headers);
if (!$result && !$board_config['sendmail_fix'] && $empty_to_header)
diff --git a/phpBB/includes/functions_search.php b/phpBB/includes/functions_search.php
index 80ea0554c8..3937b6617c 100644
--- a/phpBB/includes/functions_search.php
+++ b/phpBB/includes/functions_search.php
@@ -58,16 +58,7 @@ function clean_words($mode, &$entry, &$stopword_list, &$synonym_list)
$entry = str_replace('*', ' ', $entry);
// 'words' that consist of <3 or >20 characters are removed.
- $entry = explode(' ', $entry);
- for ($i = 0; $i < sizeof($entry); $i++)
- {
- $entry[$i] = trim($entry[$i]);
- if ((strlen($entry[$i]) < 3) || (strlen($entry[$i]) > 20))
- {
- $entry[$i] = '';
- }
- }
- $entry = implode(' ', $entry);
+ $entry = preg_replace('/[ ]([\S]{1,2}|[\S]{21,})[ ]/',' ', $entry);
}
if ( !empty($stopword_list) )
@@ -107,17 +98,8 @@ function split_words(&$entry, $mode = 'post')
return $split_entries[1];
*/
- $split_entries = array();
- $split = explode(' ', $entry);
- for ($i = 0; $i < count($split); $i++)
- {
- if (trim($split[$i]) != '')
- {
- $split_entries[] = trim($split[$i]);
- }
- }
-
- return $split_entries;
+ // Trim 1+ spaces to one space and split this trimmed string into words.
+ return explode(' ', trim(preg_replace('#\s+#', ' ', $entry)));
}
function add_search_words($mode, $post_id, $post_text, $post_title = '')
diff --git a/phpBB/includes/smtp.php b/phpBB/includes/smtp.php
index ca8c45144f..5abbac3fe4 100644
--- a/phpBB/includes/smtp.php
+++ b/phpBB/includes/smtp.php
@@ -150,13 +150,13 @@ function smtpmail($mail_to, $subject, $message, $headers = '')
while(list(, $mail_to_address) = each($mail_to_array))
{
// Add an additional bit of error checking to the To field.
- $mail_to_address = trim($mail_to_address);
+ $mail_to_address = ($mail_to_address == '') ? 'Undisclosed-recipients:;' : '<' . trim($mail_to_address) . '>';
if (preg_match('#[^ ]+\@[^ ]+#', $mail_to_address))
{
- fputs($socket, "RCPT TO: <$mail_to_address>\r\n");
+ fputs($socket, "RCPT TO: $mail_to_address\r\n");
server_parse($socket, "250", __LINE__);
}
- $to_header .= (($to_header != '') ? ', ' : '') . "<$mail_to_address>";
+ $to_header .= (($to_header != '') ? ', ' : '') . "$mail_to_address";
}
// Ok now do the CC and BCC fields...
diff --git a/phpBB/includes/usercp_register.php b/phpBB/includes/usercp_register.php
index 2e6d1f8708..ebde9cde3a 100644
--- a/phpBB/includes/usercp_register.php
+++ b/phpBB/includes/usercp_register.php
@@ -612,7 +612,7 @@ if ( isset($HTTP_POST_VARS['submit']) )
if ( $board_config['require_activation'] == USER_ACTIVATION_ADMIN )
{
- $sql = "SELECT user_email
+ $sql = "SELECT user_email, user_lang
FROM " . USERS_TABLE . "
WHERE user_level = " . ADMIN;
@@ -621,22 +621,25 @@ if ( isset($HTTP_POST_VARS['submit']) )
message_die(GENERAL_ERROR, 'Could not select Administrators', '', __LINE__, __FILE__, $sql);
}
+ $emailer->from($board_config['board_email']);
+ $emailer->replyto($board_config['board_email']);
+
while ($row = $db->sql_fetchrow($result))
{
- $emailer->bcc(trim($row['user_email']));
+ $emailer->email_address(trim($row['user_email']));
+ $emailer->use_template("admin_activate", $row['user_lang']);
+ $emailer->set_subject($lang['New_account_subject']);
+
+ $emailer->assign_vars(array(
+ 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
+ '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)
+ );
+ $emailer->send();
+ $emailer->reset();
}
-
- $emailer->use_template("admin_activate", $board_config['default_lang']);
- $emailer->set_subject($lang['New_account_subject']);
-
- $emailer->assign_vars(array(
- 'USERNAME' => preg_replace($unhtml_specialchars_match, $unhtml_specialchars_replace, substr(str_replace("\'", "'", $username), 0, 25)),
- '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)
- );
- $emailer->send();
- $emailer->reset();
+ $db->sql_freeresult($result);
}
$message = $message . '
' . sprintf($lang['Click_return_index'], '', '');
diff --git a/phpBB/install/schemas/mssql_schema.sql b/phpBB/install/schemas/mssql_schema.sql
index 059db6b1f7..52729be4cf 100644
--- a/phpBB/install/schemas/mssql_schema.sql
+++ b/phpBB/install/schemas/mssql_schema.sql
@@ -412,7 +412,7 @@ GO
ALTER TABLE [phpbb_confirm] WITH NOCHECK ADD
CONSTRAINT [PK_phpbb_confirm] PRIMARY KEY CLUSTERED
(
- [session_id, confirm_id]
+ [session_id],[confirm_id]
) ON [PRIMARY]
GO
diff --git a/phpBB/install/update_to_205.php b/phpBB/install/update_to_205.php
index d7e90878f8..e787034da3 100644
--- a/phpBB/install/update_to_205.php
+++ b/phpBB/install/update_to_205.php
@@ -499,7 +499,7 @@ switch ($row['config_value'])
case 'mssql':
case 'mssql-odbc':
$sql[] = 'CREATE TABLE [' . $table_prefix . 'confirm] ([confirm_id] [char] (32) NOT NULL , [session_id] [char] (32) NOT NULL , [code] [char] (6) NOT NULL ) ON [PRIMARY]';
- $sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [PK_' . $table_prefix . 'confirm] PRIMARY KEY CLUSTERED ( [session_id, confirm_id]) ON [PRIMARY]';
+ $sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [PK_' . $table_prefix . 'confirm] PRIMARY KEY CLUSTERED ( [session_id],[confirm_id]) ON [PRIMARY]';
$sql[] = 'ALTER TABLE [' . $table_prefix . 'confirm] WITH NOCHECK ADD CONSTRAINT [DF_' . $table_prefix . 'confirm_confirm_id] DEFAULT (\'\') FOR [confirm_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_session_id] DEFAULT (\'\') FOR [session_id], CONSTRAINT [DF_' . $table_prefix . 'confirm_code] DEFAULT (\'\') FOR [code]';
break;