mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-03 06:57:35 +01:00
Anchor a regular expression in wp-mail.php to ensure we are matching the Reply-To: header, not the In-Reply-To: header.
Per RFCs *822, mail headers must start at the beginning of a line. This same pattern could be continued throughout this file. props solarissmoke. fixes #18923. git-svn-id: http://core.svn.wordpress.org/trunk@20682 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
5a37c2f523
commit
95ab5d397e
@ -105,7 +105,7 @@ for ( $i = 1; $i <= $count; $i++ ) {
|
|||||||
|
|
||||||
// Set the author using the email address (From or Reply-To, the last used)
|
// Set the author using the email address (From or Reply-To, the last used)
|
||||||
// otherwise use the site admin
|
// otherwise use the site admin
|
||||||
if ( preg_match('/(From|Reply-To): /', $line) ) {
|
if ( ! $author_found && preg_match( '/^(From|Reply-To): /', $line ) ) {
|
||||||
if ( preg_match('|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches) )
|
if ( preg_match('|[a-z0-9_.-]+@[a-z0-9_.-]+(?!.*<)|i', $line, $matches) )
|
||||||
$author = $matches[0];
|
$author = $matches[0];
|
||||||
else
|
else
|
||||||
@ -114,14 +114,10 @@ for ( $i = 1; $i <= $count; $i++ ) {
|
|||||||
if ( is_email($author) ) {
|
if ( is_email($author) ) {
|
||||||
echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
|
echo '<p>' . sprintf(__('Author is %s'), $author) . '</p>';
|
||||||
$userdata = get_user_by('email', $author);
|
$userdata = get_user_by('email', $author);
|
||||||
if ( empty($userdata) ) {
|
if ( ! empty( $userdata ) ) {
|
||||||
$author_found = false;
|
|
||||||
} else {
|
|
||||||
$post_author = $userdata->ID;
|
$post_author = $userdata->ID;
|
||||||
$author_found = true;
|
$author_found = true;
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
$author_found = false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user