Changes from branches/3.0/wp-includes/pluggable.php at r17387 to trunk/wp-includes/pluggable.php at r17385
- File:
-
- 1 edited
-
trunk/wp-includes/pluggable.php (modified) (17 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/pluggable.php
r17387 r17385 82 82 83 83 if ( ! $user = wp_validate_auth_cookie() ) { 84 if ( is_ admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) {84 if ( is_blog_admin() || is_network_admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) { 85 85 wp_set_current_user(0); 86 86 return false; … … 672 672 $secure = is_ssl(); 673 673 674 $secure = apply_filters('secure_auth_cookie', $secure, $user_id); 675 $secure_logged_in_cookie = apply_filters('secure_logged_in_cookie', false, $user_id, $secure); 676 674 677 if ( $secure ) { 675 678 $auth_cookie_name = SECURE_AUTH_COOKIE; … … 690 693 setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, COOKIE_DOMAIN, $secure, true); 691 694 setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, $secure, true); 692 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, false, true);695 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true); 693 696 if ( COOKIEPATH != SITECOOKIEPATH ) 694 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, false, true);697 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, COOKIE_DOMAIN, $secure_logged_in_cookie, true); 695 698 } else { 696 699 $cookie_domain = COOKIE_DOMAIN; … … 699 702 setcookie($auth_cookie_name, $auth_cookie, $expire, PLUGINS_COOKIE_PATH, $cookie_domain, $secure); 700 703 setcookie($auth_cookie_name, $auth_cookie, $expire, ADMIN_COOKIE_PATH, $cookie_domain, $secure); 701 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, $cookie_domain );704 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, COOKIEPATH, $cookie_domain, $secure_logged_in_cookie); 702 705 if ( COOKIEPATH != SITECOOKIEPATH ) 703 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, $cookie_domain );706 setcookie(LOGGED_IN_COOKIE, $logged_in_cookie, $expire, SITECOOKIEPATH, $cookie_domain, $secure_logged_in_cookie); 704 707 } 705 708 } … … 764 767 765 768 $secure = ( is_ssl() || force_ssl_admin() ); 769 770 $secure = apply_filters('secure_auth_redirect', $secure); 766 771 767 772 // If https is required and request is http, redirect … … 776 781 } 777 782 778 if ( $user_id = wp_validate_auth_cookie( '', apply_filters( 'auth_redirect_scheme', '' ) ) ) { 783 if ( is_user_admin() ) 784 $scheme = 'logged_in'; 785 else 786 $scheme = apply_filters( 'auth_redirect_scheme', '' ); 787 788 if ( $user_id = wp_validate_auth_cookie( '', $scheme) ) { 779 789 do_action('auth_redirect', $user_id); 780 790 … … 862 872 if ( !function_exists('wp_redirect') ) : 863 873 /** 864 * Redirects to another page, with a workaround for the IIS Set-Cookie bug. 865 * 866 * @link http://support.microsoft.com/kb/q176113/ 874 * Redirects to another page. 875 * 867 876 * @since 1.5.1 868 877 * @uses apply_filters() Calls 'wp_redirect' hook on $location and $status. … … 883 892 $location = wp_sanitize_redirect($location); 884 893 885 if ( $is_IIS ) { 886 header("Refresh: 0;url=$location"); 887 } else { 888 if ( php_sapi_name() != 'cgi-fcgi' ) 889 status_header($status); // This causes problems on IIS and some FastCGI setups 890 header("Location: $location", true, $status); 891 } 894 if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' ) 895 status_header($status); // This causes problems on IIS and some FastCGI setups 896 897 header("Location: $location", true, $status); 892 898 } 893 899 endif; … … 1001 1007 * @return bool False if user email does not exist. True on completion. 1002 1008 */ 1003 function wp_notify_postauthor($comment_id, $comment_type='') { 1004 $comment = get_comment($comment_id); 1005 $post = get_post($comment->comment_post_ID); 1006 $user = get_userdata( $post->post_author ); 1007 1008 if ( $comment->user_id == $post->post_author ) return false; // The author moderated a comment on his own post 1009 1010 if ('' == $user->user_email) return false; // If there's no email to send the comment to 1009 function wp_notify_postauthor( $comment_id, $comment_type = '' ) { 1010 $comment = get_comment( $comment_id ); 1011 $post = get_post( $comment->comment_post_ID ); 1012 $author = get_userdata( $post->post_author ); 1013 1014 // The comment was left by the author 1015 if ( $comment->user_id == $post->post_author ) 1016 return false; 1017 1018 // The author moderated a comment on his own post 1019 if ( $post->post_author == get_current_user_id() ) 1020 return false; 1021 1022 // If there's no email to send the comment to 1023 if ( '' == $author->user_email ) 1024 return false; 1011 1025 1012 1026 $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); … … 1024 1038 $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; 1025 1039 $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; 1026 $notify_message .= sprintf( __('Whois : http://w s.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";1040 $notify_message .= sprintf( __('Whois : http://whois.arin.net/rest/ip/%s'), $comment->comment_author_IP ) . "\r\n"; 1027 1041 $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; 1028 1042 $notify_message .= __('You can see all comments on this post here: ') . "\r\n"; … … 1049 1063 } 1050 1064 $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n"; 1065 $notify_message .= sprintf( __('Permalink: %s'), get_permalink( $comment->comment_post_ID ) . '#comment-' . $comment_id ) . "\r\n"; 1051 1066 if ( EMPTY_TRASH_DAYS ) 1052 1067 $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n"; … … 1077 1092 $message_headers = apply_filters('comment_notification_headers', $message_headers, $comment_id); 1078 1093 1079 @wp_mail( $user->user_email, $subject, $notify_message, $message_headers);1094 @wp_mail( $author->user_email, $subject, $notify_message, $message_headers ); 1080 1095 1081 1096 return true; … … 1096 1111 global $wpdb; 1097 1112 1098 if ( get_option( "moderation_notify" ) == 0)1113 if ( 0 == get_option( 'moderation_notify' ) ) 1099 1114 return true; 1100 1115 1101 $comment = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_ID=%d LIMIT 1", $comment_id)); 1102 $post = $wpdb->get_row($wpdb->prepare("SELECT * FROM $wpdb->posts WHERE ID=%d LIMIT 1", $comment->comment_post_ID)); 1116 $comment = get_comment($comment_id); 1117 $post = get_post($comment->comment_post_ID); 1118 $user = get_userdata( $post->post_author ); 1119 // Send to the administation and to the post author if the author can modify the comment. 1120 $email_to = array( get_option('admin_email') ); 1121 if ( user_can($user->ID, 'edit_comment', $comment_id) && !empty($user->user_email) && ( get_option('admin_email') != $user->user_email) ) 1122 $email_to[] = $user->user_email; 1103 1123 1104 1124 $comment_author_domain = @gethostbyaddr($comment->comment_author_IP); … … 1131 1151 $notify_message .= sprintf( __('E-mail : %s'), $comment->comment_author_email ) . "\r\n"; 1132 1152 $notify_message .= sprintf( __('URL : %s'), $comment->comment_author_url ) . "\r\n"; 1133 $notify_message .= sprintf( __('Whois : http://w s.arin.net/cgi-bin/whois.pl?queryinput=%s'), $comment->comment_author_IP ) . "\r\n";1153 $notify_message .= sprintf( __('Whois : http://whois.arin.net/rest/ip/%s'), $comment->comment_author_IP ) . "\r\n"; 1134 1154 $notify_message .= __('Comment: ') . "\r\n" . $comment->comment_content . "\r\n\r\n"; 1135 1155 break; … … 1148 1168 1149 1169 $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title ); 1150 $admin_email = get_option('admin_email');1151 1170 $message_headers = ''; 1152 1171 … … 1155 1174 $message_headers = apply_filters('comment_moderation_headers', $message_headers); 1156 1175 1157 @wp_mail($admin_email, $subject, $notify_message, $message_headers); 1176 foreach ( $email_to as $email ) 1177 @wp_mail($email, $subject, $notify_message, $message_headers); 1158 1178 1159 1179 return true; … … 1647 1667 } else { 1648 1668 if ( !empty($email) ) 1649 $host = sprintf( "http://%d.gravatar.com", ( hexdec( $email_hash {0}) % 2 ) );1669 $host = sprintf( "http://%d.gravatar.com", ( hexdec( $email_hash[0] ) % 2 ) ); 1650 1670 else 1651 1671 $host = 'http://0.gravatar.com';
Note: See TracChangeset
for help on using the changeset viewer.