Changes from branches/3.1/wp-includes/pluggable.php at r17386 to trunk/wp-includes/pluggable.php at r18195
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/pluggable.php
r17386 r18195 282 282 require_once ABSPATH . WPINC . '/class-phpmailer.php'; 283 283 require_once ABSPATH . WPINC . '/class-smtp.php'; 284 $phpmailer = new PHPMailer( );284 $phpmailer = new PHPMailer( true ); 285 285 } 286 286 … … 297 297 } 298 298 $headers = array(); 299 $cc = array(); 300 $bcc = array(); 299 301 300 302 // If it's actually got contents … … 401 403 402 404 foreach ( (array) $to as $recipient ) { 403 $phpmailer->AddAddress( trim( $recipient ) ); 405 try { 406 // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>" 407 $recipient_name = ''; 408 if( preg_match( '/(.+)\s?<(.+)>/', $recipient, $matches ) ) { 409 if ( count( $matches ) == 3 ) { 410 $recipient_name = $matches[1]; 411 $recipient = $matches[2]; 412 } 413 } 414 $phpmailer->AddAddress( trim( $recipient ), $recipient_name); 415 } catch ( phpmailerException $e ) { 416 continue; 417 } 404 418 } 405 419 … … 411 425 if ( !empty( $cc ) ) { 412 426 foreach ( (array) $cc as $recipient ) { 413 $phpmailer->AddCc( trim($recipient) ); 427 try { 428 // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>" 429 $recipient_name = ''; 430 if( preg_match( '/(.+)\s?<(.+)>/', $recipient, $matches ) ) { 431 if ( count( $matches ) == 3 ) { 432 $recipient_name = $matches[1]; 433 $recipient = $matches[2]; 434 } 435 } 436 $phpmailer->AddCc( trim($recipient), $recipient_name ); 437 } catch ( phpmailerException $e ) { 438 continue; 439 } 414 440 } 415 441 } … … 417 443 if ( !empty( $bcc ) ) { 418 444 foreach ( (array) $bcc as $recipient) { 419 $phpmailer->AddBcc( trim($recipient) ); 445 try { 446 // Break $recipient into name and address parts if in the format "Foo <bar@baz.com>" 447 $recipient_name = ''; 448 if( preg_match( '/(.+)\s?<(.+)>/', $recipient, $matches ) ) { 449 if ( count( $matches ) == 3 ) { 450 $recipient_name = $matches[1]; 451 $recipient = $matches[2]; 452 } 453 } 454 $phpmailer->AddBcc( trim($recipient), $recipient_name ); 455 } catch ( phpmailerException $e ) { 456 continue; 457 } 420 458 } 421 459 } … … 456 494 if ( !empty( $attachments ) ) { 457 495 foreach ( $attachments as $attachment ) { 458 $phpmailer->AddAttachment($attachment); 496 try { 497 $phpmailer->AddAttachment($attachment); 498 } catch ( phpmailerException $e ) { 499 continue; 500 } 459 501 } 460 502 } … … 463 505 464 506 // Send! 465 $result = @$phpmailer->Send(); 466 467 return $result; 507 try { 508 $phpmailer->Send(); 509 } catch ( phpmailerException $e ) { 510 return false; 511 } 512 513 return true; 468 514 } 469 515 endif; … … 689 735 do_action('set_logged_in_cookie', $logged_in_cookie, $expire, $expiration, $user_id, 'logged_in'); 690 736 691 // Set httponly if the php version is >= 5.2.0 692 if ( version_compare(phpversion(), '5.2.0', 'ge') ) { 693 setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true); 694 setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true); 695 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true); 696 if ( COOKIEPATH != SITECOOKIEPATH ) 697 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true); 698 } else { 699 $cookie_domain = COOKIE_DOMAIN; 700 if ( !empty($cookie_domain) ) 701 $cookie_domain .= '; HttpOnly'; 702 setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, $cookie_domain, $secure); 703 setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, $cookie_domain, $secure); 704 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, $cookie_domain, $secure_logged_in_cookie); 705 if ( COOKIEPATH != SITECOOKIEPATH ) 706 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, $cookie_domain, $secure_logged_in_cookie); 707 } 737 setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true); 738 setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true); 739 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true); 740 if ( COOKIEPATH != SITECOOKIEPATH ) 741 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true); 708 742 } 709 743 endif; … … 833 867 */ 834 868 function check_admin_referer($action = -1, $query_arg = '_wpnonce') { 869 if ( -1 == $action ) 870 _doing_it_wrong( __FUNCTION__, __( 'You should specify a nonce action to be verified by using the first parameter.' ), '3.2' ); 871 835 872 $adminurl = strtolower(admin_url()); 836 873 $referer = strtolower(wp_get_referer());
Note: See TracChangeset
for help on using the changeset viewer.