~canonical-sysadmins/wordpress/3.9.x

« back to all changes in this revision

Viewing changes to wp-includes/pluggable.php

  • Committer: Chris Jones
  • Date: 2010-01-19 13:17:33 UTC
  • Revision ID: cmsj@tenshu.net-20100119131733-rf31jv9k1v0xzo2h
[CJ] Import wordpress 2.9.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
                return;
100
100
 
101
101
        if ( ! $user = wp_validate_auth_cookie() ) {
102
 
                 if ( empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) {
 
102
                 if ( is_admin() || empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) {
103
103
                        wp_set_current_user(0);
104
104
                        return false;
105
105
                 }
539
539
                return false;
540
540
        }
541
541
 
 
542
        if ( $expiration < time() ) // AJAX/POST grace period set above
 
543
                $GLOBALS['login_grace_period'] = 1;
 
544
 
542
545
        do_action('auth_cookie_valid', $cookie_elements, $user);
543
546
 
544
547
        return $user->ID;
750
753
                }
751
754
        }
752
755
 
753
 
        if ( $user_id = wp_validate_auth_cookie() ) {
 
756
        if ( $user_id = wp_validate_auth_cookie( '', apply_filters( 'auth_redirect_scheme', '' ) ) ) {
754
757
                do_action('auth_redirect', $user_id);
755
758
 
756
759
                // If the user wants ssl but the session is not ssl, redirect.
821
824
        if ( $query_arg )
822
825
                $nonce = $_REQUEST[$query_arg];
823
826
        else
824
 
                $nonce = $_REQUEST['_ajax_nonce'] ? $_REQUEST['_ajax_nonce'] : $_REQUEST['_wpnonce'];
 
827
                $nonce = isset($_REQUEST['_ajax_nonce']) ? $_REQUEST['_ajax_nonce'] : $_REQUEST['_wpnonce'];
825
828
 
826
829
        $result = wp_verify_nonce( $nonce, $action );
827
830
 
862
865
        } else {
863
866
                if ( php_sapi_name() != 'cgi-fcgi' )
864
867
                        status_header($status); // This causes problems on IIS and some FastCGI setups
865
 
                header("Location: $location");
 
868
                header("Location: $location", true, $status);
866
869
        }
867
870
}
868
871
endif;
973
976
        if ('' == $user->user_email) return false; // If there's no email to send the comment to
974
977
 
975
978
        $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
976
 
 
977
 
        $blogname = get_option('blogname');
 
979
        
 
980
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
 
981
        // we want to reverse this for the plain text arena of emails.
 
982
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
978
983
 
979
984
        if ( empty( $comment_type ) ) $comment_type = 'comment';
980
985
 
998
1003
                $notify_message .= sprintf( __('URL    : %s'), $comment->comment_author_url ) . "\r\n";
999
1004
                $notify_message .= __('Excerpt: ') . "\r\n" . $comment->comment_content . "\r\n\r\n";
1000
1005
                $notify_message .= __('You can see all trackbacks on this post here: ') . "\r\n";
1001
 
                /* translators: 1: blog name, 2: post title */          
 
1006
                /* translators: 1: blog name, 2: post title */
1002
1007
                $subject = sprintf( __('[%1$s] Trackback: "%2$s"'), $blogname, $post->post_title );
1003
1008
        } elseif ('pingback' == $comment_type) {
1004
1009
                /* translators: 1: post id, 2: post title */
1012
1017
                $subject = sprintf( __('[%1$s] Pingback: "%2$s"'), $blogname, $post->post_title );
1013
1018
        }
1014
1019
        $notify_message .= get_permalink($comment->comment_post_ID) . "#comments\r\n\r\n";
1015
 
        $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
1016
 
        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
 
1020
        if ( EMPTY_TRASH_DAYS )
 
1021
                $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
 
1022
        else
 
1023
                $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
 
1024
        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
1017
1025
 
1018
1026
        $wp_email = 'wordpress@' . preg_replace('#^www\.#', '', strtolower($_SERVER['SERVER_NAME']));
1019
1027
 
1064
1072
 
1065
1073
        $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
1066
1074
        $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
1067
 
 
 
1075
        
 
1076
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
 
1077
        // we want to reverse this for the plain text arena of emails.
 
1078
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
 
1079
        
1068
1080
        switch ($comment->comment_type)
1069
1081
        {
1070
1082
                case 'trackback':
1092
1104
                        break;
1093
1105
        }
1094
1106
 
1095
 
        $notify_message .= sprintf( __('Approve it: %s'),  admin_url("comment.php?action=mac&c=$comment_id") ) . "\r\n";
1096
 
        $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=cdc&c=$comment_id") ) . "\r\n";
1097
 
        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=cdc&dt=spam&c=$comment_id") ) . "\r\n";
 
1107
        $notify_message .= sprintf( __('Approve it: %s'),  admin_url("comment.php?action=approve&c=$comment_id") ) . "\r\n";
 
1108
        if ( EMPTY_TRASH_DAYS )
 
1109
                $notify_message .= sprintf( __('Trash it: %s'), admin_url("comment.php?action=trash&c=$comment_id") ) . "\r\n";
 
1110
        else
 
1111
                $notify_message .= sprintf( __('Delete it: %s'), admin_url("comment.php?action=delete&c=$comment_id") ) . "\r\n";
 
1112
        $notify_message .= sprintf( __('Spam it: %s'), admin_url("comment.php?action=spam&c=$comment_id") ) . "\r\n";
1098
1113
 
1099
1114
        $notify_message .= sprintf( _n('Currently %s comment is waiting for approval. Please visit the moderation panel:',
1100
1115
                'Currently %s comments are waiting for approval. Please visit the moderation panel:', $comments_waiting), number_format_i18n($comments_waiting) ) . "\r\n";
1101
1116
        $notify_message .= admin_url("edit-comments.php?comment_status=moderated") . "\r\n";
1102
1117
 
1103
 
        $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), get_option('blogname'), $post->post_title );
 
1118
        $subject = sprintf( __('[%1$s] Please moderate: "%2$s"'), $blogname, $post->post_title );
1104
1119
        $admin_email = get_option('admin_email');
1105
1120
        $message_headers = '';
1106
1121
 
1127
1142
        // but check to see if it's the admin whose password we're changing, and skip this
1128
1143
        if ( $user->user_email != get_option('admin_email') ) {
1129
1144
                $message = sprintf(__('Password Lost and Changed for user: %s'), $user->user_login) . "\r\n";
1130
 
                wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), get_option('blogname')), $message);
 
1145
                // The blogname option is escaped with esc_html on the way into the database in sanitize_option
 
1146
                // we want to reverse this for the plain text arena of emails.
 
1147
                $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
 
1148
                wp_mail(get_option('admin_email'), sprintf(__('[%s] Password Lost/Changed'), $blogname), $message);
1131
1149
        }
1132
1150
}
1133
1151
endif;
1146
1164
 
1147
1165
        $user_login = stripslashes($user->user_login);
1148
1166
        $user_email = stripslashes($user->user_email);
 
1167
        
 
1168
        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
 
1169
        // we want to reverse this for the plain text arena of emails.
 
1170
        $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
1149
1171
 
1150
 
        $message  = sprintf(__('New user registration on your blog %s:'), get_option('blogname')) . "\r\n\r\n";
 
1172
        $message  = sprintf(__('New user registration on your blog %s:'), $blogname) . "\r\n\r\n";
1151
1173
        $message .= sprintf(__('Username: %s'), $user_login) . "\r\n\r\n";
1152
1174
        $message .= sprintf(__('E-mail: %s'), $user_email) . "\r\n";
1153
1175
 
1154
 
        @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), get_option('blogname')), $message);
 
1176
        @wp_mail(get_option('admin_email'), sprintf(__('[%s] New User Registration'), $blogname), $message);
1155
1177
 
1156
1178
        if ( empty($plaintext_pass) )
1157
1179
                return;
1160
1182
        $message .= sprintf(__('Password: %s'), $plaintext_pass) . "\r\n";
1161
1183
        $message .= wp_login_url() . "\r\n";
1162
1184
 
1163
 
        wp_mail($user_email, sprintf(__('[%s] Your username and password'), get_option('blogname')), $message);
 
1185
        wp_mail($user_email, sprintf(__('[%s] Your username and password'), $blogname), $message);
1164
1186
 
1165
1187
}
1166
1188
endif;
1767
1789
}
1768
1790
endif;
1769
1791
 
1770
 
?>