Changeset 5092
- Timestamp:
- 03/23/2007 03:18:00 AM (19 years ago)
- Location:
- branches/2.1
- Files:
-
- 24 edited
-
wp-admin/admin-ajax.php (modified) (1 diff)
-
wp-admin/admin-db.php (modified) (6 diffs)
-
wp-admin/admin-functions.php (modified) (5 diffs)
-
wp-admin/edit-comments.php (modified) (1 diff)
-
wp-admin/import/blogware.php (modified) (1 diff)
-
wp-admin/import/dotclear.php (modified) (1 diff)
-
wp-admin/import/livejournal.php (modified) (1 diff)
-
wp-admin/import/mt.php (modified) (2 diffs)
-
wp-admin/import/wordpress.php (modified) (2 diffs)
-
wp-includes/author-template.php (modified) (1 diff)
-
wp-includes/bookmark-template.php (modified) (1 diff)
-
wp-includes/category-template.php (modified) (1 diff)
-
wp-includes/comment-template.php (modified) (1 diff)
-
wp-includes/comment.php (modified) (1 diff)
-
wp-includes/feed.php (modified) (1 diff)
-
wp-includes/functions.php (modified) (2 diffs)
-
wp-includes/link-template.php (modified) (3 diffs)
-
wp-includes/pluggable.php (modified) (2 diffs)
-
wp-includes/post.php (modified) (6 diffs)
-
wp-includes/registration.php (modified) (2 diffs)
-
wp-includes/theme.php (modified) (1 diff)
-
wp-includes/user.php (modified) (1 diff)
-
wp-trackback.php (modified) (1 diff)
-
xmlrpc.php (modified) (18 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/2.1/wp-admin/admin-ajax.php
r4883 r5092 232 232 $_POST['temp_ID'] = $_POST['post_ID']; 233 233 $id = wp_write_post(); 234 if( is_wp_error($id))234 if( is_wp_error($id) ) 235 235 die($id->get_error_message()); 236 236 else -
branches/2.1/wp-admin/admin-db.php
r5030 r5092 124 124 if (!$update) { 125 125 $wpdb->query("INSERT INTO $wpdb->categories (cat_ID, cat_name, category_nicename, category_description, category_parent, links_private, posts_private) VALUES ('0', '$cat_name', '$category_nicename', '$category_description', '$category_parent', '$links_private', '$posts_private')"); 126 $cat_ID = $wpdb->insert_id;126 $cat_ID = (int) $wpdb->insert_id; 127 127 } else { 128 128 $wpdb->query ("UPDATE $wpdb->categories SET cat_name = '$cat_name', category_nicename = '$category_nicename', category_description = '$category_description', category_parent = '$category_parent', links_private = '$links_private', posts_private = '$posts_private' WHERE cat_ID = '$cat_ID'"); … … 246 246 return 0; 247 247 248 return $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'");248 return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'"); 249 249 } 250 250 … … 299 299 if ( !empty($link_id) ) 300 300 $update = true; 301 302 $link_id = (int) $link_id; 301 303 302 304 if( trim( $link_name ) == '' ) … … 361 363 } else { 362 364 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')"); 363 $link_id = $wpdb->insert_id;365 $link_id = (int) $wpdb->insert_id; 364 366 } 365 367 … … 444 446 SELECT category_id 445 447 FROM $wpdb->link2cat 446 WHERE link_id = $link_ID");448 WHERE link_id = '$link_ID'"); 447 449 448 450 if (!$old_categories) { … … 457 459 if ($delete_cats) { 458 460 foreach ($delete_cats as $del) { 461 $del = (int) $del; 459 462 $wpdb->query(" 460 463 DELETE FROM $wpdb->link2cat 461 WHERE category_id = $del462 AND link_id = $link_ID464 WHERE category_id = '$del' 465 AND link_id = '$link_ID' 463 466 "); 464 467 } -
branches/2.1/wp-admin/admin-functions.php
r5073 r5092 152 152 continue; 153 153 154 $id = $id_matches[3];154 $id = (int) $id_matches[3]; 155 155 156 156 // While we have the attachment ID, let's adopt any orphans. … … 436 436 if ( func_num_args() ) { // The hackiest hack that ever did hack 437 437 global $current_user, $wp_roles; 438 $user_id = func_get_arg( 0 );438 $user_id = (int) func_get_arg( 0 ); 439 439 440 440 if ( isset( $_POST['role'] ) ) { … … 454 454 if ( $user_id != 0 ) { 455 455 $update = true; 456 $user->ID = $user_id;456 $user->ID = (int) $user_id; 457 457 $userdata = get_userdata( $user_id ); 458 458 $user->user_login = $wpdb->escape( $userdata->user_login ); … … 782 782 if ( current_user_can( 'manage_categories' ) ) { 783 783 $edit = "<a href='categories.php?action=edit&cat_ID=$category->cat_ID' class='edit'>".__( 'Edit' )."</a></td>"; 784 $default_cat_id = get_option( 'default_category' );785 $default_link_cat_id = get_option( 'default_link_category' );784 $default_cat_id = (int) get_option( 'default_category' ); 785 $default_link_cat_id = (int) get_option( 'default_link_category' ); 786 786 787 787 if ( ($category->cat_ID != $default_cat_id ) && ($category->cat_ID != $default_link_cat_id ) ) … … 822 822 $post->post_title = wp_specialchars( $post->post_title ); 823 823 $pad = str_repeat( '— ', $level ); 824 $id = $post->ID;824 $id = (int) $post->ID; 825 825 $class = ('alternate' == $class ) ? '' : 'alternate'; 826 826 ?> -
branches/2.1/wp-admin/edit-comments.php
r5057 r5092 57 57 foreach ($_POST['delete_comments'] as $comment) : // Check the permissions on each 58 58 $comment = (int) $comment; 59 $post_id = $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");59 $post_id = (int) $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment"); 60 60 // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") ); 61 61 if ( current_user_can('edit_post', $post_id) ) { -
branches/2.1/wp-admin/import/blogware.php
r4495 r5092 105 105 106 106 if ( $comments ) { 107 $comment_post_ID = $post_id;107 $comment_post_ID = (int) $post_id; 108 108 $num_comments = 0; 109 109 foreach ($comments as $comment) { -
branches/2.1/wp-admin/import/dotclear.php
r4608 r5092 438 438 439 439 // WordPressify Data 440 $comment_ID = ltrim($comment_id, '0');441 $comment_post_ID = $postarr[$post_id];440 $comment_ID = (int) ltrim($comment_id, '0'); 441 $comment_post_ID = (int) $postarr[$post_id]; 442 442 $comment_approved = "$comment_pub"; 443 443 $name = $wpdb->escape(csc ($comment_auteur)); -
branches/2.1/wp-admin/import/livejournal.php
r4608 r5092 83 83 84 84 if ( $comments ) { 85 $comment_post_ID = $post_id;85 $comment_post_ID = (int) $post_id; 86 86 $num_comments = 0; 87 87 foreach ($comments as $comment) { -
branches/2.1/wp-admin/import/mt.php
r4608 r5092 172 172 } 173 173 $this->file = $file['file']; 174 $this->id = $file['id'];174 $this->id = (int) $file['id']; 175 175 176 176 $this->get_entries(); … … 296 296 } 297 297 298 $comment_post_ID = $post_id;298 $comment_post_ID = (int) $post_id; 299 299 $comment_approved = 1; 300 300 -
branches/2.1/wp-admin/import/wordpress.php
r4742 r5092 175 175 } 176 176 $this->file = $file['file']; 177 $this->id = $file['id'];177 $this->id = (int) $file['id']; 178 178 179 179 $this->get_entries(); … … 202 202 $category_parent = '0'; 203 203 else 204 $category_parent = (int)category_exists($parent);204 $category_parent = category_exists($parent); 205 205 206 206 $catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name'); -
branches/2.1/wp-includes/author-template.php
r4656 r5092 145 145 function get_author_posts_url($author_id, $author_nicename = '') { 146 146 global $wpdb, $wp_rewrite, $post, $cache_userdata; 147 $auth_ID = $author_id;147 $auth_ID = (int) $author_id; 148 148 $link = $wp_rewrite->get_author_permastruct(); 149 149 -
branches/2.1/wp-includes/bookmark-template.php
r5057 r5092 166 166 return ''; 167 167 168 $cat_id = $cats[0]; // Take the first cat.168 $cat_id = (int) $cats[0]; // Take the first cat. 169 169 170 170 $cat = get_category($cat_id); -
branches/2.1/wp-includes/category-template.php
r5083 r5092 65 65 $id = (int) $id; 66 66 if ( !$id ) 67 $id = $post->ID;67 $id = (int) $post->ID; 68 68 69 69 if ( !isset($category_cache[$blog_id][$id]) ) -
branches/2.1/wp-includes/comment-template.php
r5040 r5092 151 151 152 152 if ( !$post_id ) 153 $post_id = $id;153 $post_id = (int) $id; 154 154 155 155 $post = get_post($post_id); -
branches/2.1/wp-includes/comment.php
r5057 r5092 346 346 "); 347 347 348 $id = $wpdb->insert_id;348 $id = (int) $wpdb->insert_id; 349 349 350 350 if ( $comment_approved == 1) -
branches/2.1/wp-includes/feed.php
r4626 r5092 109 109 110 110 function get_author_rss_link($echo = false, $author_id, $author_nicename) { 111 $auth_ID = $author_id;111 $auth_ID = (int) $author_id; 112 112 $permalink_structure = get_option('permalink_structure'); 113 113 -
branches/2.1/wp-includes/functions.php
r5057 r5092 567 567 $count = count( $post_id_array); 568 568 for ( $i = 0; $i < $count; $i++ ) { 569 $post_id = $post_id_array[ $i ];569 $post_id = (int) $post_id_array[ $i ]; 570 570 if ( isset( $category_cache[$blog_id][$post_id] ) ) { 571 571 unset( $post_id_array[ $i ] ); … … 621 621 $count = count( $post_id_array); 622 622 for ( $i = 0; $i < $count; $i++ ) { 623 $post_id = $post_id_array[ $i ];623 $post_id = (int) $post_id_array[ $i ]; 624 624 if ( isset( $post_meta_cache[$blog_id][$post_id] ) ) { // If the meta is already cached 625 625 unset( $post_id_array[ $i ] ); -
branches/2.1/wp-includes/link-template.php
r5079 r5092 96 96 $id = (int) $id; 97 97 if ( !$id ) 98 $id = $post->ID;98 $id = (int) $post->ID; 99 99 100 100 if ( 'page' == get_option('show_on_front') && $id == get_option('page_on_front') ) … … 111 111 112 112 if ( !$id ) 113 $id = $post->ID;113 $id = (int) $post->ID; 114 114 115 115 $pagestruct = $wp_rewrite->get_page_permastruct(); … … 132 132 133 133 if (! $id) { 134 $id = $post->ID;134 $id = (int) $post->ID; 135 135 } 136 136 -
branches/2.1/wp-includes/pluggable.php
r4516 r5092 474 474 function wp_verify_nonce($nonce, $action = -1) { 475 475 $user = wp_get_current_user(); 476 $uid = $user->id;476 $uid = (int) $user->id; 477 477 478 478 $i = ceil(time() / 43200); … … 488 488 function wp_create_nonce($action = -1) { 489 489 $user = wp_get_current_user(); 490 $uid = $user->id;490 $uid = (int) $user->id; 491 491 492 492 $i = ceil(time() / 43200); -
branches/2.1/wp-includes/post.php
r5085 r5092 376 376 377 377 if ( !$post_id ) 378 $post_id = $id;378 $post_id = (int) $id; 379 379 380 380 $post_id = (int) $post_id; … … 540 540 // Get the post ID. 541 541 if ( $update ) 542 $post_ID = $ID;542 $post_ID = (int) $ID; 543 543 544 544 // Create a valid post name. Drafts are allowed to have an empty … … 644 644 VALUES 645 645 ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')"); 646 $post_ID = $wpdb->insert_id;646 $post_ID = (int) $wpdb->insert_id; 647 647 } 648 648 … … 1255 1255 if ( !empty($ID) ) { 1256 1256 $update = true; 1257 $post_ID = $ID;1257 $post_ID = (int) $ID; 1258 1258 } 1259 1259 … … 1350 1350 VALUES 1351 1351 ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$post_type', '$comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')"); 1352 $post_ID = $wpdb->insert_id;1352 $post_ID = (int) $wpdb->insert_id; 1353 1353 } 1354 1354 … … 1505 1505 if ( !$post =& get_post( $mime ) ) 1506 1506 return false; 1507 $post_id = $post->ID;1507 $post_id = (int) $post->ID; 1508 1508 $mime = $post->post_mime_type; 1509 1509 } -
branches/2.1/wp-includes/registration.php
r4651 r5092 90 90 $query = apply_filters('update_user_query', $query); 91 91 $wpdb->query( $query ); 92 $user_id = $ID;92 $user_id = (int) $ID; 93 93 } else { 94 94 $query = "INSERT INTO $wpdb->users … … 98 98 $query = apply_filters('create_user_query', $query); 99 99 $wpdb->query( $query ); 100 $user_id = $wpdb->insert_id;100 $user_id = (int) $wpdb->insert_id; 101 101 } 102 102 -
branches/2.1/wp-includes/theme.php
r4778 r5092 346 346 global $wp_query; 347 347 348 $id = $wp_query->post->ID;348 $id = (int) $wp_query->post->ID; 349 349 $template = get_post_meta($id, '_wp_page_template', true); 350 350 -
branches/2.1/wp-includes/user.php
r5037 r5092 162 162 $userdata = $user->data; 163 163 $user_login = $user->user_login; 164 $user_level = $user->user_level;165 $user_ID = $user->ID;164 $user_level = (int) $user->user_level; 165 $user_ID = (int) $user->ID; 166 166 $user_email = $user->user_email; 167 167 $user_url = $user->user_url; -
branches/2.1/wp-trackback.php
r4676 r5092 85 85 } 86 86 87 $comment_post_ID = $tb_id;87 $comment_post_ID = (int) $tb_id; 88 88 $comment_author = $blog_name; 89 89 $comment_author_email = ''; -
branches/2.1/xmlrpc.php
r5083 r5092 210 210 $this->escape($args); 211 211 212 $post_ID = $args[1];212 $post_ID = (int) $args[1]; 213 213 $user_login = $args[2]; 214 214 $user_pass = $args[3]; … … 245 245 $this->escape($args); 246 246 247 $blog_ID = $args[1]; /* though we don't use it yet */247 $blog_ID = (int) $args[1]; /* though we don't use it yet */ 248 248 $user_login = $args[2]; 249 249 $user_pass = $args[3]; … … 293 293 $this->escape($args); 294 294 295 $blog_ID = $args[1];295 $blog_ID = (int) $args[1]; 296 296 $user_login = $args[2]; 297 297 $user_pass = $args[3]; … … 327 327 $this->escape($args); 328 328 329 $blog_ID = $args[1];329 $blog_ID = (int) $args[1]; 330 330 $user_login = $args[2]; 331 331 $user_pass = $args[3]; … … 364 364 $this->escape($args); 365 365 366 $blog_ID = $args[1]; /* though we don't use it yet */366 $blog_ID = (int) $args[1]; /* though we don't use it yet */ 367 367 $user_login = $args[2]; 368 368 $user_pass = $args[3]; … … 463 463 $this->escape($args); 464 464 465 $post_ID = $args[1];465 $post_ID = (int) $args[1]; 466 466 $user_login = $args[2]; 467 467 $user_pass = $args[3]; … … 504 504 $this->escape($args); 505 505 506 $blog_ID = $args[0]; // we will support this in the near future506 $blog_ID = (int) $args[0]; // we will support this in the near future 507 507 $user_login = $args[1]; 508 508 $user_pass = $args[2]; … … 688 688 $this->escape($args); 689 689 690 $post_ID = $args[0];690 $post_ID = (int) $args[0]; 691 691 $user_login = $args[1]; 692 692 $user_pass = $args[2]; … … 743 743 $this->escape($args); 744 744 745 $blog_ID = $args[0];745 $blog_ID = (int) $args[0]; 746 746 $user_login = $args[1]; 747 747 $user_pass = $args[2]; 748 $num_posts = $args[3];748 $num_posts = (int) $args[3]; 749 749 750 750 if (!$this->login_pass_ok($user_login, $user_pass)) { … … 809 809 $this->escape($args); 810 810 811 $blog_ID = $args[0];811 $blog_ID = (int) $args[0]; 812 812 $user_login = $args[1]; 813 813 $user_pass = $args[2]; … … 843 843 global $wpdb; 844 844 845 $blog_ID = $wpdb->escape($args[0]);845 $blog_ID = (int) $args[0]; 846 846 $user_login = $wpdb->escape($args[1]); 847 847 $user_pass = $wpdb->escape($args[2]); … … 901 901 $this->escape($args); 902 902 903 $blog_ID = $args[0];903 $blog_ID = (int) $args[0]; 904 904 $user_login = $args[1]; 905 905 $user_pass = $args[2]; 906 $num_posts = $args[3];906 $num_posts = (int) $args[3]; 907 907 908 908 if (!$this->login_pass_ok($user_login, $user_pass)) { … … 946 946 $this->escape($args); 947 947 948 $blog_ID = $args[0];948 $blog_ID = (int) $args[0]; 949 949 $user_login = $args[1]; 950 950 $user_pass = $args[2]; … … 975 975 $this->escape($args); 976 976 977 $post_ID = $args[0];977 $post_ID = (int) $args[0]; 978 978 $user_login = $args[1]; 979 979 $user_pass = $args[2]; … … 1005 1005 $this->escape($args); 1006 1006 1007 $post_ID = $args[0];1007 $post_ID = (int) $args[0]; 1008 1008 $user_login = $args[1]; 1009 1009 $user_pass = $args[2]; … … 1088 1088 $this->escape($args); 1089 1089 1090 $post_ID = $args[0];1090 $post_ID = (int) $args[0]; 1091 1091 $user_login = $args[1]; 1092 1092 $user_pass = $args[2]; … … 1150 1150 // the path defines the post_ID (archives/p/XXXX) 1151 1151 $blah = explode('/', $match[0]); 1152 $post_ID = $blah[1];1152 $post_ID = (int) $blah[1]; 1153 1153 $way = 'from the path'; 1154 1154 } elseif (preg_match('#p=[0-9]{1,}#', $urltest['query'], $match)) { 1155 1155 // the querystring defines the post_ID (?p=XXXX) 1156 1156 $blah = explode('=', $match[0]); 1157 $post_ID = $blah[1];1157 $post_ID = (int) $blah[1]; 1158 1158 $way = 'from the querystring'; 1159 1159 } elseif (isset($urltest['fragment'])) { … … 1161 1161 if (intval($urltest['fragment'])) { 1162 1162 // ...an integer #XXXX (simpliest case) 1163 $post_ID = $urltest['fragment'];1163 $post_ID = (int) $urltest['fragment']; 1164 1164 $way = 'from the fragment (numeric)'; 1165 1165 } elseif (preg_match('/post-[0-9]+/',$urltest['fragment'])) {
Note: See TracChangeset
for help on using the changeset viewer.