Changeset 10730
- Timestamp:
- 03/06/2009 04:27:51 AM (16 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/includes/post.php
r10723 r10730 757 757 $old_ID = (int) $old_ID; 758 758 $new_ID = (int) $new_ID; 759 return $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_parent = %d", $new_ID,$old_ID) );759 return $wpdb->update($wpdb->posts, array('post_parent' => $new_ID), array('post_parent' => $old_ID) ); 760 760 } 761 761 -
trunk/wp-admin/includes/schema.php
r10553 r10730 311 311 // Set up a few options not to load by default 312 312 $fatoptions = array( 'moderation_keys', 'recently_edited', 'blacklist_keys' ); 313 foreach ($fatoptions as $fatoption) : 314 $wpdb->query("UPDATE $wpdb->options SET `autoload` = 'no' WHERE option_name = '$fatoption'"); 315 endforeach; 313 foreach ($fatoptions as $fatoption) 314 $wpdb->update( $wpdb->options, array('autoload' => 'no'), array('option_name' => $fatoption) ); 316 315 } 317 316 -
trunk/wp-admin/includes/upgrade.php
r10575 r10730 94 94 95 95 // Default category 96 $cat_name = $wpdb->escape(__('Uncategorized'));96 $cat_name = __('Uncategorized'); 97 97 $cat_slug = sanitize_title(_c('Uncategorized|Default category slug')); 98 $wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')"); 99 $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('1', 'category', '', '0', '1')"); 98 99 $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); 100 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '1', 'taxonomy' => 'category', 'description' => '', 'parent' => 0, 'count' => 1)); 100 101 101 102 // Default link category 102 $cat_name = $wpdb->escape(__('Blogroll'));103 $cat_name = __('Blogroll'); 103 104 $cat_slug = sanitize_title(_c('Blogroll|Default link category slug')); 104 $wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$cat_name', '$cat_slug', '0')"); 105 $wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('2', 'link_category', '', '0', '7')"); 105 106 $wpdb->insert( $wpdb->terms, array('name' => $cat_name, 'slug' => $cat_slug, 'term_group' => 0) ); 107 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => '2', 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 7)); 106 108 107 109 // Now drop in some default links 108 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://codex.wordpress.org/', 'Documentation', 0, '', '');"); 109 $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (1, 2)" ); 110 111 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://wordpress.org/development/', 'Development Blog', 0, 'http://wordpress.org/development/feed/', '');"); 112 $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (2, 2)" ); 113 114 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://wordpress.org/extend/ideas/', 'Suggest Ideas', 0, '', '');"); 115 $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (3, 2)" ); 116 117 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://wordpress.org/support/', 'Support Forum', 0, '', '');"); 118 $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (4, 2)" ); 119 120 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://wordpress.org/extend/plugins/', 'Plugins', 0, '', '');"); 121 $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (5, 2)" ); 122 123 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://wordpress.org/extend/themes/', 'Themes', 0, '', '');"); 124 $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (6, 2)" ); 125 126 $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_category, link_rss, link_notes) VALUES ('http://planet.wordpress.org/', 'WordPress Planet', 0, '', '');"); 127 $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (7, 2)" ); 110 $default_links = array(); 111 $default_links[] = array( 'link_url' => 'http://codex.wordpress.org/', 112 'link_name' => 'Documentation', 113 'link_category' => 0, 114 'link_rss' => '', 115 'link_notes' => ''); 116 117 $default_links[] = array( 'link_url' => 'http://wordpress.org/development/', 118 'link_name' => 'Development Blog', 119 'link_category' => 0, 120 'link_rss' => 'http://wordpress.org/development/feed/', 121 'link_notes' => ''); 122 123 $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/ideas/', 124 'link_name' => 'Suggest Ideas', 125 'link_category' => 0, 126 'link_rss' => '', 127 'link_notes' =>''); 128 129 $default_links[] = array( 'link_url' => 'http://wordpress.org/support/', 130 'link_name' => 'Support Forum', 131 'link_category' => 0, 132 'link_rss' => '', 133 'link_notes' =>''); 134 135 $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/plugins/', 136 'link_name' => 'Plugins', 137 'link_category' => 0, 138 'link_rss' => '', 139 'link_notes' =>''); 140 141 $default_links[] = array( 'link_url' => 'http://wordpress.org/extend/themes/', 142 'link_name' => 'Themes', 143 'link_category' => 0, 144 'link_rss' => '', 145 'link_notes' =>''); 146 147 $default_links[] = array( 'link_url' => 'http://planet.wordpress.org/', 148 'link_name' => 'WordPress Planet', 149 'link_category' => 0, 150 'link_rss' => '', 151 'link_notes' =>''); 152 153 foreach ( default_links as $link ) { 154 $wpdb->insert( $wpdb->links, $link); 155 $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => 2, 'object_id' => $wpdb->insert_id) ); 156 } 128 157 129 158 // First post … … 131 160 $now_gmt = gmdate('Y-m-d H:i:s'); 132 161 $first_post_guid = get_option('home') . '/?p=1'; 133 $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, comment_count, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'))."', '', '".$wpdb->escape(__('Hello world!'))."', '0', '".$wpdb->escape(_c('hello-world|Default post slug'))."', '$now', '$now_gmt', '$first_post_guid', '1', '', '', '')"); 134 $wpdb->query( "INSERT INTO $wpdb->term_relationships (`object_id`, `term_taxonomy_id`) VALUES (1, 1)" ); 162 163 $wpdb->insert( $wpdb->posts, array( 164 'post_author' => $user_id, 165 'post_date' => $now, 166 'post_date_gmt' => $now_gmt, 167 'post_content' => __('Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!'), 168 'post_excerpt' => '', 169 'post_title' => __('Hello world!'), 170 'post_category' => 0, 171 'post_name' => _c('hello-world|Default post slug'), 172 'post_modified' => $now, 173 'post_modified_gmt' => $now_gmt, 174 'guid' => $first_post_guid, 175 'comment_count' => 1, 176 'to_ping' => '', 177 'pinged' => '', 178 'post_content_filtered' => '' 179 )); 180 $wpdb->insert( $wpdb->term_relationships, array('term_taxonomy_id' => 1, 'object_id' => 1) ); 135 181 136 182 // Default comment 137 $wpdb->query("INSERT INTO $wpdb->comments (comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_date, comment_date_gmt, comment_content) VALUES ('1', '".$wpdb->escape(__('Mr WordPress'))."', '', 'http://wordpress.org/', '$now', '$now_gmt', '".$wpdb->escape(__('Hi, this is a comment.<br />To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.'))."')"); 138 183 $wpdb->insert( $wpdb->comments, array( 184 'comment_post_ID' => 1, 185 'comment_author' => __('Mr WordPress'), 186 'comment_author_email' => '', 187 'comment_author_url' => 'http://wordpress.org/', 188 'comment_date' => $now, 189 'comment_date_gmt' => $now_gmt, 190 'comment_content' => __('Hi, this is a comment.<br />To delete a comment, just log in and view the post's comments. There you will have the option to edit or delete them.') 191 )); 139 192 // First Page 140 193 $first_post_guid = get_option('home') . '/?page_id=2'; 141 $wpdb->query("INSERT INTO $wpdb->posts (post_author, post_date, post_date_gmt, post_content, post_excerpt, post_title, post_category, post_name, post_modified, post_modified_gmt, guid, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ($user_id, '$now', '$now_gmt', '".$wpdb->escape(__('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'))."', '', '".$wpdb->escape(__('About'))."', '0', '".$wpdb->escape(_c('about|Default page slug'))."', '$now', '$now_gmt','$first_post_guid', 'publish', 'page', '', '', '')"); 194 $wpdb->insert( $wpdb->posts, array( 195 'post_author' => $user_id, 196 'post_date' => $now, 197 'post_date_gmt' => $now_gmt, 198 'post_content' => __('This is an example of a WordPress page, you could edit this to put information about yourself or your site so readers know where you are coming from. You can create as many pages like this one or sub-pages as you like and manage all of your content inside of WordPress.'), 199 'post_excerpt' => '', 200 'post_title' => __('About'), 201 'post_category' => '', 202 'post_name' => _c('about|Default page slug'), 203 'post_modified' => $now, 204 'post_modified_gmt' => $now_gmt, 205 'guid' => $first_post_guid, 206 'post_type' => 'page', 207 'to_ping' => '', 208 'pinged' => '', 209 'post_content_filtered' => '' 210 )); 142 211 } 143 212 endif; … … 307 376 if ('' == $category->category_nicename) { 308 377 $newtitle = sanitize_title($category->cat_name); 309 $wpdb ->query( $wpdb->prepare("UPDATE $wpdb->categories SET category_nicename = %s WHERE cat_ID = %d", $newtitle,$category->cat_ID) );378 $wpdb>update( $wpdb->categories, array('category_nicename' => $newtitle), array('cat_ID' => $category->cat_ID) ); 310 379 } 311 380 } … … 331 400 $cat = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category) ); 332 401 if (!$cat && 0 != $post->post_category) { // If there's no result 333 $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->post2cat 334 (post_id, category_id) 335 VALUES (%s, %s) 336 ", $post->ID, $post->post_category) ); 402 $wpdb->insert( $wpdb->post2cat, array('post_id' => $post->ID, 'category_id' => $post->post_category) ); 337 403 } 338 404 } … … 371 437 if ('' == $user->user_nicename) { 372 438 $newname = sanitize_title($user->user_nickname); 373 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->users SET user_nicename = %s WHERE ID = %d", $newname,$user->ID) );439 $wpdb->update( $wpdb->users, array('user_nicename' => $newname), array('ID' => $user->ID) ); 374 440 } 375 441 } … … 378 444 foreach ($users as $row) { 379 445 if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) { 380 $wpdb-> query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');446 $wpdb->update( $wpdb->users, array('user_pass' => md5($row->user_pass)), array('ID' => $row->ID) ); 381 447 } 382 448 } … … 438 504 $guid = $post->guid; 439 505 440 $wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'"); 506 $wpdb->update( $wpdb->posts, compact('post_title', 'post_content', 'post_excerpt', 'guid'), array('ID' => $post->ID) ); 507 441 508 } 442 509 } … … 446 513 if ($comments) { 447 514 foreach($comments as $comment) { 448 $comment_content = addslashes(deslash($comment->comment_content)); 449 $comment_author = addslashes(deslash($comment->comment_author)); 450 $wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'"); 515 $comment_content = deslash($comment->comment_content); 516 $comment_author = deslash($comment->comment_author); 517 518 $wpdb->update($wpdb->comments, compact('comment_content', 'comment_author'), array('comment_ID' => $comment->comment_ID) ); 451 519 } 452 520 } … … 456 524 if ($links) { 457 525 foreach($links as $link) { 458 $link_name = addslashes(deslash($link->link_name)); 459 $link_description = addslashes(deslash($link->link_description)); 460 $wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'"); 526 $link_name = deslash($link->link_name); 527 $link_description = deslash($link->link_description); 528 529 $wpdb->update( $wpdb->links, compact('link_name', 'link_description'), array('link_id' => $link->link_id) ); 461 530 } 462 531 } 463 532 464 533 // The "paged" option for what_to_show is no more. 465 if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') { 466 $wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'"); 467 } 534 if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') 535 $wpdb->update( $wpdb->options, array('option_value' => 'posts'), array('option_name' => 'what_to_show') ); 468 536 469 537 $active_plugins = __get_option('active_plugins'); … … 540 608 if ($idmode == 'namelf') $id = $user->user_lastname.' '.$user->user_firstname; 541 609 if (!$idmode) $id = $user->user_nickname; 542 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->users SET display_name = %s WHERE ID = %d", $id,$user->ID) );610 $wpdb->update( $wpdb->users, array('display_name' => $id), array('ID' => $user->ID) ); 543 611 endif; 544 612 … … 560 628 // populate comment_count field of posts table 561 629 $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" ); 562 if( is_array( $comments ) ) { 563 foreach ($comments as $comment) { 564 $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET comment_count = %d WHERE ID = %d", $comment->c, $comment->comment_post_ID) ); 565 } 566 } 630 if( is_array( $comments ) ) 631 foreach ($comments as $comment) 632 $wpdb->update( $wpdb->posts, array('comment_count' => $comment->c), array('ID' => $comment->comment_post_ID) ); 567 633 568 634 // Some alpha versions used a post status of object instead of attachment and put … … 571 637 $objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'"); 572 638 foreach ($objects as $object) { 573 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status ='attachment',574 post_mime_type = %s,575 post_type = ''576 WHERE ID = %d", $object->post_type, $object->ID) );639 $wpdb->update( $wpdb->posts, array( 'post_status' => 'attachment', 640 'post_mime_type' => $object->post_type, 641 'post_type' => ''), 642 array( 'ID' => $object->ID ) ); 577 643 578 644 $meta = get_post_meta($object->ID, 'imagedata', true); … … 692 758 $count = (int) $category->tag_count; 693 759 $taxonomy = 'post_tag'; 694 $wpdb-> query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );760 $wpdb->insert( $wpdb->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent', 'count') ); 695 761 $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id; 696 762 } … … 699 765 $count = 0; 700 766 $taxonomy = 'category'; 701 $wpdb-> query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );767 $wpdb->insert( $wpdb->term_taxonomy, compact('term_id', 'taxonomy', 'description', 'parent', 'count') ); 702 768 $tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id; 703 769 } … … 719 785 continue; 720 786 721 $wpdb-> query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $post_id,$tt_id) );787 $wpdb->insert( $wpdb->term_relationships, array('object_id' => $post_id, 'term_taxonomy_id' => $tt_id) ); 722 788 } 723 789 … … 744 810 745 811 if ( empty($term_id) ) { 746 $wpdb-> query( $wpdb->prepare("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES (%s, %s, %d)", $name, $slug, $term_group) );812 $wpdb->insert( $wpdb->terms, compact('name', 'slug', 'term_group') ); 747 813 $term_id = (int) $wpdb->insert_id; 748 814 } … … 751 817 $default_link_cat = $term_id; 752 818 753 $wpdb-> query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES (%d, 'link_category', '', '0', '0')", $term_id) );819 $wpdb->insert( $wpdb->term_taxonomy, array('term_id' => $term_id, 'taxonomy' => 'link_category', 'description' => '', 'parent' => 0, 'count' => 0) ); 754 820 $tt_ids[$term_id] = (int) $wpdb->insert_id; 755 821 } … … 767 833 continue; 768 834 769 $wpdb-> query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link->link_id,$tt_id) );835 $wpdb->insert( $wpdb->term_relationships, array('object_id' => $link->link_id, 'term_taxonomy_id' => $tt_id) ); 770 836 } 771 837 … … 781 847 if ( empty($tt_id) ) 782 848 continue; 783 784 $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link_id, $tt_id) ); 849 $wpdb->insert( $wpdb->term_relationships, array('object_id' => $link_id, 'term_taxonomy_id' => $tt_id) ); 785 850 } 786 851 } … … 798 863 else 799 864 $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id) ); 800 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_taxonomy_id = %d", $count,$term->term_taxonomy_id) );865 $wpdb->update( $wpdb->term_taxonomy, array('count' => $count), array('term_taxonomy_id' => $term->term_taxonomy_id) ); 801 866 } 802 867 } -
trunk/wp-includes/comment.php
r10681 r10730 1021 1021 global $wpdb; 1022 1022 1023 $status = '0'; 1023 1024 switch ( $comment_status ) { 1024 1025 case 'hold': 1025 $ query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID = %d LIMIT 1", $comment_id);1026 $status = '0'; 1026 1027 break; 1027 1028 case 'approve': 1028 $ query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID = %d LIMIT 1", $comment_id);1029 $status = '1'; 1029 1030 if ( get_option('comments_notify') ) { 1030 1031 $comment = get_comment($comment_id); … … 1033 1034 break; 1034 1035 case 'spam': 1035 $ query = $wpdb->prepare("UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID = %d LIMIT 1", $comment_id);1036 $status = 'spam'; 1036 1037 break; 1037 1038 case 'delete': … … 1042 1043 } 1043 1044 1044 if ( !$wpdb-> query($query) ) {1045 if ( !$wpdb->update( $wpdb->comments, array('comment_approved' => $status), array('comment_ID' => $comment_id) ) ) { 1045 1046 if ( $wp_error ) 1046 1047 return new WP_Error('db_update_error', __('Could not update comment status'), $wpdb->last_error); … … 1351 1352 $pinged = get_pung($post_id); 1352 1353 if ( empty($to_ping) ) { 1353 $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->posts SET to_ping = '' WHERE ID = %d", $post_id) );1354 $wpdb->update($wpdb->posts, array('to_ping' => ''), array('ID' => $post_id) ); 1354 1355 return; 1355 1356 } -
trunk/wp-includes/functions.php
r10665 r10730 518 518 } 519 519 520 $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->options SET option_value = %s WHERE option_name = %s", $newvalue, $option_name ) ); 520 $wpdb->update($wpdb->options, array('option_value' => $newvalue), array('option_name' => $option_name) ); 521 521 522 if ( $wpdb->rows_affected == 1 ) { 522 523 do_action( "update_option_{$option_name}", $oldvalue, $_newvalue ); … … 585 586 } 586 587 587 $wpdb-> query( $wpdb->prepare( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES (%s, %s, %s)", $name, $value, $autoload) );588 $wpdb->insert($wpdb->options, array('option_name' => $name, 'option_value' => $value, 'autoload' => $autoload) ); 588 589 589 590 do_action( "add_option_{$name}", $name, $value ); … … 1091 1092 if ( $headers = wp_get_http_headers( $url) ) { 1092 1093 $len = (int) $headers['content-length']; 1093 $type = $ wpdb->escape( $headers['content-type'] );1094 $type = $headers['content-type']; 1094 1095 $allowed_types = array( 'video', 'audio' ); 1095 1096 if ( in_array( substr( $type, 0, strpos( $type, "/" ) ), $allowed_types ) ) { 1096 1097 $meta_value = "$url\n$len\n$type\n"; 1097 $wpdb->query( $wpdb->prepare( "INSERT INTO `$wpdb->postmeta` ( `post_id` , `meta_key` , `meta_value` ) 1098 VALUES ( %d, 'enclosure' , %s)", $post_ID, $meta_value ) ); 1098 $wpdb->insert($wpdb->postmeta, array('post_id' => $post_ID, 'meta_key' => 'enclosure', 'meta_value' => $meta_value) ); 1099 1099 } 1100 1100 } -
trunk/wp-includes/pluggable.php
r10691 r10730 1459 1459 1460 1460 $hash = wp_hash_password($password); 1461 $ query = $wpdb->prepare("UPDATE $wpdb->users SET user_pass = %s, user_activation_key = '' WHERE ID = %d", $hash, $user_id);1462 $wpdb->query($query); 1461 $wpdb->update($wpdb->users, array('user_pass' => $hash, 'user_activation_key' => ''), array('ID' => $user_id) ); 1462 1463 1463 wp_cache_delete($user_id, 'users'); 1464 1464 } -
trunk/wp-includes/post.php
r10725 r10730 425 425 426 426 $post_type = sanitize_post_field('post_type', $post_type, $post_id, 'db'); 427 $return = $wpdb-> query( $wpdb->prepare("UPDATE $wpdb->posts SET post_type = %s WHERE ID = %d", $post_type,$post_id) );427 $return = $wpdb->update($wpdb->posts, array('post_type' => $post_type), array('ID' => $post_id) ); 428 428 429 429 if ( 'page' == $post_type ) -
trunk/wp-includes/taxonomy.php
r10637 r10730 1330 1330 // The alias isn't in a group, so let's create a new one and firstly add the alias term to it. 1331 1331 $term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms") + 1; 1332 $wpdb-> query( $wpdb->prepare( "UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $alias->term_id) );1332 $wpdb->update($wpdb->terms, compact('term_group'), array('term_id' => $alias->term_id) ); 1333 1333 } 1334 1334 } -
trunk/wp-includes/user.php
r10683 r10730 400 400 401 401 $cur = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->usermeta WHERE user_id = %d AND meta_key = %s", $user_id, $meta_key) ); 402 if ( !$cur ) { 403 $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->usermeta ( user_id, meta_key, meta_value ) 404 VALUES 405 ( %d, %s, %s )", $user_id, $meta_key, $meta_value) ); 406 } else if ( $cur->meta_value != $meta_value ) { 407 $wpdb->query( $wpdb->prepare("UPDATE $wpdb->usermeta SET meta_value = %s WHERE user_id = %d AND meta_key = %s", $meta_value, $user_id, $meta_key) ); 408 } else { 402 if ( !$cur ) 403 $wpdb->insert($wpdb->usermeta, compact('user_id', 'meta_key', 'meta_value') ); 404 else if ( $cur->meta_value != $meta_value ) 405 $wpdb->update($wpdb->usermeta, compact('meta_value'), compact('user_id', 'meta_key') ); 406 else 409 407 return false; 410 }411 408 412 409 wp_cache_delete($user_id, 'users'); -
trunk/wp-login.php
r10705 r10730 141 141 do_action('retrieve_password_key', $user_login, $key); 142 142 // Now insert the new md5 key into the db 143 $wpdb-> query($wpdb->prepare("UPDATE $wpdb->users SET user_activation_key = %s WHERE user_login = %s", $key,$user_login));143 $wpdb->update($wpdb->users, array('user_activation_key' => $key), array('user_login' => $user_login)); 144 144 } 145 145 $message = __('Someone has asked to reset the password for the following site and username.') . "\r\n\r\n"; -
trunk/xmlrpc.php
r10587 r10730 2274 2274 foreach( $attachments as $file ) { 2275 2275 if( strpos( $post_content, $file->guid ) !== false ) { 2276 $wpdb-> query( $wpdb->prepare("UPDATE {$wpdb->posts} SET post_parent = %d WHERE ID = %d", $post_ID,$file->ID) );2276 $wpdb->update($wpdb->posts, array('post_parent' => $post_ID), array('ID' => $file->ID) ); 2277 2277 } 2278 2278 }
Note: See TracChangeset
for help on using the changeset viewer.