Changeset 3566
- Timestamp:
- 02/22/2006 07:08:55 PM (19 years ago)
- Location:
- trunk
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin.php
r3517 r3566 18 18 update_category_cache(); 19 19 20 get_currentuserinfo();20 wp_get_current_user(); 21 21 22 22 $posts_per_page = get_settings('posts_per_page'); -
trunk/wp-admin/comment.php
r3563 r3566 27 27 require_once ('admin-header.php'); 28 28 29 get_currentuserinfo();30 31 29 $comment = (int) $_GET['comment']; 32 30 -
trunk/wp-admin/edit-form-ajax-cat.php
r3517 r3566 3 3 require_once('admin-functions.php'); 4 4 require_once('admin-db.php'); 5 6 get_currentuserinfo();7 5 8 6 if ( !current_user_can('manage_categories') ) -
trunk/wp-admin/list-manipulation.php
r3529 r3566 4 4 require_once('admin-db.php'); 5 5 6 get_currentuserinfo();7 6 if ( !is_user_logged_in() ) 8 7 die('-1'); -
trunk/wp-admin/options.php
r3517 r3566 69 69 // If home changed, write rewrite rules to new location. 70 70 $wp_rewrite->flush_rules(); 71 // Get currently logged in user and password.72 get_currentuserinfo();73 71 // Clear cookies for old paths. 74 72 wp_clearcookie(); -
trunk/wp-admin/page-new.php
r3563 r3566 14 14 if ( current_user_can('edit_pages') ) { 15 15 $action = 'post'; 16 get_currentuserinfo();17 18 16 $post = get_default_post_to_edit(); 19 17 $post->post_type = 'page'; -
trunk/wp-comments-post.php
r3542 r3566 25 25 26 26 // If the user is logged in 27 get_currentuserinfo();28 if ( $user _ID ) :29 $comment_author = $wpdb->escape($user _identity);30 $comment_author_email = $wpdb->escape($user _email);31 $comment_author_url = $wpdb->escape($user _url);27 $user = wp_get_current_user(); 28 if ( $user->ID ) : 29 $comment_author = $wpdb->escape($user->display_name); 30 $comment_author_email = $wpdb->escape($user->user_email); 31 $comment_author_url = $wpdb->escape($user->user_url); 32 32 else : 33 33 if ( get_option('comment_registration') ) … … 37 37 $comment_type = ''; 38 38 39 if ( get_settings('require_name_email') && !$user _ID ) {39 if ( get_settings('require_name_email') && !$user->ID ) { 40 40 if ( 6 > strlen($comment_author_email) || '' == $comment_author ) 41 41 die( __('Error: please fill the required fields (name, email).') ); … … 51 51 wp_new_comment( $commentdata ); 52 52 53 if ( !$user _ID ) :53 if ( !$user->ID ) : 54 54 setcookie('comment_author_' . COOKIEHASH, stripslashes($comment_author), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); 55 55 setcookie('comment_author_email_' . COOKIEHASH, stripslashes($comment_author_email), time() + 30000000, COOKIEPATH, COOKIE_DOMAIN); -
trunk/wp-includes/capabilities.php
r3526 r3566 396 396 // Capability checking wrapper around the global $current_user object. 397 397 function current_user_can($capability) { 398 global $current_user;398 $current_user = wp_get_current_user(); 399 399 400 400 $args = array_slice(func_get_args(), 1); -
trunk/wp-includes/classes.php
r3564 r3566 1588 1588 1589 1589 function send_headers() { 1590 global $current_user;1591 1590 @header('X-Pingback: '. get_bloginfo('pingback_url')); 1592 1591 if ( is_user_logged_in() ) … … 1665 1664 1666 1665 function init() { 1667 get_currentuserinfo();1666 wp_get_current_user(); 1668 1667 } 1669 1668 -
trunk/wp-includes/comment-functions.php
r3537 r3566 18 18 $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post->ID' AND ( comment_approved = '1' OR ( comment_author = '$author_db' AND comment_author_email = '$email_db' AND comment_approved = '0' ) ) ORDER BY comment_date"); 19 19 } 20 21 get_currentuserinfo();22 20 23 21 define('COMMENTS_TEMPLATE', true); -
trunk/wp-includes/functions.php
r3559 r3566 304 304 305 305 function get_user_option( $option, $user = 0 ) { 306 global $wpdb , $current_user;306 global $wpdb; 307 307 308 308 if ( empty($user) ) 309 $user = $current_user;309 $user = wp_get_current_user(); 310 310 else 311 311 $user = get_userdata($user); … … 1177 1177 } 1178 1178 1179 // Setup global user vars. Used by set_current_user() for back compat. 1180 function setup_userdata($user_id = '') { 1181 global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity; 1182 1183 if ( '' == $user_id ) 1184 $user = wp_get_current_user(); 1185 else 1186 $user = new WP_User($user_id); 1187 1188 if ( 0 == $user->ID ) 1189 return; 1190 1191 $userdata = $user->data; 1192 $user_login = $user->user_login; 1193 $user_level = $user->user_level; 1194 $user_ID = $user->ID; 1195 $user_email = $user->user_email; 1196 $user_url = $user->user_url; 1197 $user_pass_md5 = md5($user->user_pass); 1198 $user_identity = $user->display_name; 1199 } 1200 1179 1201 function is_new_day() { 1180 1202 global $day, $previousday; -
trunk/wp-includes/kses.php
r3430 r3566 529 529 530 530 function kses_init() { 531 global $current_user;532 533 531 remove_filter('pre_comment_author', 'wp_filter_kses'); 534 532 remove_filter('pre_comment_content', 'wp_filter_kses'); 535 533 remove_filter('content_save_pre', 'wp_filter_post_kses'); 536 534 remove_filter('title_save_pre', 'wp_filter_kses'); 537 538 if (! defined('XMLRPC_REQUEST') )539 get_currentuserinfo();540 535 541 536 if (current_user_can('unfiltered_html') == false) -
trunk/wp-includes/pluggable-functions.php
r3565 r3566 6 6 if ( !function_exists('set_current_user') ) : 7 7 function set_current_user($id, $name = '') { 8 global $user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $current_user; 9 10 $current_user = ''; 11 12 $current_user = new WP_User($id, $name); 13 14 $userdata = get_userdatabylogin($user_login); 15 16 $user_login = $userdata->user_login; 17 $user_level = $userdata->user_level; 18 $user_ID = $userdata->ID; 19 $user_email = $userdata->user_email; 20 $user_url = $userdata->user_url; 21 $user_pass_md5 = md5($userdata->user_pass); 22 $user_identity = $userdata->display_name; 8 return wp_set_current_user($id, $name); 9 } 10 endif; 11 12 if ( !function_exists('wp_set_current_user') ) : 13 function wp_set_current_user($id, $name = '') { 14 global $current_user; 15 16 if ( isset($current_user) && ($id == $current_user->ID) ) 17 return $current_user; 18 19 $current_user = new WP_User($id, $name); 20 21 setup_userdata($current_user->ID); 23 22 24 23 do_action('set_current_user'); … … 28 27 endif; 29 28 29 if ( !function_exists('current_user') ) : 30 function wp_get_current_user() { 31 global $current_user; 32 33 get_currentuserinfo(); 34 35 return $current_user; 36 } 37 endif; 30 38 31 39 if ( !function_exists('get_currentuserinfo') ) : 32 40 function get_currentuserinfo() { 33 global $ user_login, $userdata, $user_level, $user_ID, $user_email, $user_url, $user_pass_md5, $user_identity, $current_user;41 global $current_user; 34 42 35 43 if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) 36 44 return false; 45 46 if ( ! empty($current_user) ) 47 return; 37 48 38 49 if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) || 39 50 !wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) { 40 $current_user = new WP_User(0); 41 return false; 42 } 43 $user_login = $_COOKIE[USER_COOKIE]; 44 $userdata = get_userdatabylogin($user_login); 45 $user_level = $userdata->user_level; 46 $user_ID = $userdata->ID; 47 $user_email = $userdata->user_email; 48 $user_url = $userdata->user_url; 49 $user_pass_md5 = md5($userdata->user_pass); 50 $user_identity = $userdata->display_name; 51 52 if ( empty($current_user) ) 53 $current_user = new WP_User($user_ID); 51 wp_set_current_user(0); 52 return false; 53 } 54 55 $user_login = $_COOKIE[USER_COOKIE]; 56 wp_set_current_user(0, $user_login); 54 57 } 55 58 endif; … … 202 205 if ( !function_exists('is_user_logged_in') ) : 203 206 function is_user_logged_in() { 204 global $current_user; 205 206 if ( $current_user->id == 0 ) 207 return false; 207 $user = wp_get_current_user(); 208 209 if ( $user->id == 0 ) 210 return false; 211 208 212 return true; 209 213 } -
trunk/wp-includes/registration-functions.php
r3517 r3566 102 102 103 103 function wp_update_user($userdata) { 104 global $wpdb , $current_user;104 global $wpdb; 105 105 106 106 $ID = (int) $userdata['ID']; … … 123 123 124 124 // Update the cookies if the password changed. 125 $current_user = wp_get_current_user(); 125 126 if( $current_user->id == $ID ) { 126 127 if ( isset($plaintext_pass) ) { -
trunk/wp-includes/template-functions-general.php
r3549 r3566 28 28 29 29 function wp_loginout() { 30 global $user_ID; 31 get_currentuserinfo(); 32 33 if ('' == $user_ID) 30 if ( ! is_user_logged_in() ) 34 31 $link = '<a href="' . get_settings('siteurl') . '/wp-login.php">' . __('Login') . '</a>'; 35 32 else … … 41 38 42 39 function wp_register( $before = '<li>', $after = '</li>' ) { 43 global $user_ID; 44 45 get_currentuserinfo(); 46 47 if ( '' == $user_ID && get_settings('users_can_register') ) 48 $link = $before . '<a href="' . get_settings('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after; 49 elseif ( '' == $user_ID && !get_settings('users_can_register') ) 50 $link = ''; 51 else 40 41 if ( ! is_user_logged_in() ) { 42 if ( get_settings('users_can_register') ) 43 $link = $before . '<a href="' . get_settings('siteurl') . '/wp-register.php">' . __('Register') . '</a>' . $after; 44 else 45 $link = ''; 46 } else { 52 47 $link = $before . '<a href="' . get_settings('siteurl') . '/wp-admin/">' . __('Site Admin') . '</a>' . $after; 48 } 53 49 54 50 echo apply_filters('register', $link);
Note: See TracChangeset
for help on using the changeset viewer.