Changeset 3510
- Timestamp:
- 02/09/2006 10:03:48 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 21 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/admin-functions.php
r3501 r3510 35 35 if ('' != $_POST['advanced']) 36 36 $_POST['post_status'] = 'draft'; 37 if ('' != $_POST['savepage'])38 $_POST['post_status'] = 'static';37 //if ('' != $_POST['savepage']) { 38 // $_POST['post_status'] = 'draft'; 39 39 40 40 if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) 41 41 $_POST['post_status'] = 'draft'; 42 42 43 if (' static' == $_POST['post_status'] && !current_user_can('edit_pages'))43 if ('page' == $_POST['post_type'] && !current_user_can('edit_pages')) 44 44 die(__('This user cannot edit pages.')); 45 45 … … 155 155 if ('' != $_POST['advanced']) 156 156 $_POST['post_status'] = 'draft'; 157 if ('' != $_POST['savepage'])158 $_POST['post_status'] = 'static';157 //if ('' != $_POST['savepage']) 158 // $_POST['post_status'] = 'static'; 159 159 160 160 if ('publish' == $_POST['post_status'] && !current_user_can('publish_posts')) … … 255 255 $post->post_title = apply_filters('title_edit_pre', $post->post_title); 256 256 257 if ($post->post_ status == 'static')257 if ($post->post_type == 'page') 258 258 $post->page_template = get_post_meta($id, '_wp_page_template', true); 259 259 … … 614 614 global $wpdb, $class, $post; 615 615 if (!$pages) 616 $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_ status = 'static' ORDER BY menu_order");616 $pages = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page' ORDER BY menu_order"); 617 617 618 618 if ($pages) { … … 1177 1177 function parent_dropdown($default = 0, $parent = 0, $level = 0) { 1178 1178 global $wpdb, $post_ID; 1179 $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_ status = 'static' ORDER BY menu_order");1179 $items = $wpdb->get_results("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order"); 1180 1180 1181 1181 if ($items) { … … 1849 1849 $post = & get_post($id); 1850 1850 1851 if ( $post->post_ status!= 'attachment' )1851 if ( $post->post_type != 'attachment' ) 1852 1852 return false; 1853 1853 -
trunk/wp-admin/edit-form-advanced.php
r3456 r3510 52 52 <input type="hidden" name="action" value="<?php echo $form_action ?>" /> 53 53 <input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" /> 54 <input type="hidden" name="post_type" value="post" /> 54 55 55 56 <?php echo $form_extra ?> -
trunk/wp-admin/edit-page-form.php
r3456 r3510 31 31 <input type="hidden" name="action" value='<?php echo $form_action ?>' /> 32 32 <?php echo $form_extra ?> 33 <input type="hidden" name="post_ status" value="static" />33 <input type="hidden" name="post_type" value="page" /> 34 34 35 35 <script type="text/javascript"> … … 54 54 <label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label> 55 55 </div> 56 </fieldset> 57 58 <fieldset class="dbx-box"> 59 <h3 class="dbx-handle"><?php _e('Page Status') ?></h3> 60 <div class="dbx-content"><?php if ( current_user_can('publish_posts') ) : ?> 61 <label for="post_status_publish" class="selectit"><input id="post_status_publish" name="post_status" type="radio" value="publish" <?php checked($post->post_status, 'publish'); ?> /> <?php _e('Published') ?></label> 62 <?php endif; ?> 63 <label for="post_status_draft" class="selectit"><input id="post_status_draft" name="post_status" type="radio" value="draft" <?php checked($post->post_status, 'draft'); ?> /> <?php _e('Draft') ?></label> 64 <label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="radio" value="private" <?php checked($post->post_status, 'private'); ?> /> <?php _e('Private') ?></label></div> 56 65 </fieldset> 57 66 -
trunk/wp-admin/edit-pages.php
r3422 r3510 26 26 wp(); 27 27 else 28 $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_ status = 'static'");28 $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'page'"); 29 29 30 30 if ($posts) { -
trunk/wp-admin/index.php
r3443 r3510 61 61 62 62 <?php 63 if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_ status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) :63 if ( $recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND post_date_gmt < '$today' ORDER BY post_date DESC LIMIT 5") ) : 64 64 ?> 65 65 <div> … … 80 80 81 81 <?php 82 if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_ status = 'publish' AND post_date_gmt > '$today' ORDER BY post_date ASC") ) :82 if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' AND post_date_gmt > '$today' ORDER BY post_date ASC") ) : 83 83 ?> 84 84 <div> … … 99 99 <h3><?php _e('Blog Stats'); ?></h3> 100 100 <?php 101 $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_ status = 'publish'");101 $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'"); 102 102 if (0 < $numposts) $numposts = number_format($numposts); 103 103 -
trunk/wp-admin/inline-uploading.php
r3469 r3510 61 61 'post_title' => $imgtitle ? $imgtitle : $filename, 62 62 'post_content' => $descr, 63 'post_ status' => 'attachment',63 'post_type' => 'attachment', 64 64 'post_parent' => $post, 65 65 'post_mime_type' => $type, … … 125 125 126 126 if ( $last ) 127 $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_ status= 'attachment' $and_user $and_post") - $num;127 $start = $wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_type = 'attachment' $and_user $and_post") - $num; 128 128 else 129 129 $start = (int) $start; … … 135 135 $sort = "post_date_gmt DESC"; 136 136 137 $attachments = $wpdb->get_results("SELECT ID, post_date, post_title, post_mime_type, guid FROM $wpdb->posts WHERE post_ status= 'attachment' $and_type $and_post $and_user ORDER BY $sort LIMIT $start, $double", ARRAY_A);137 $attachments = $wpdb->get_results("SELECT ID, post_date, post_title, post_mime_type, guid FROM $wpdb->posts WHERE post_type = 'attachment' $and_type $and_post $and_user ORDER BY $sort LIMIT $start, $double", ARRAY_A); 138 138 139 139 if ( count($attachments) == 0 ) { … … 644 644 <li<?php echo $current_2; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&post=<?php echo $post; ?>&all=false"><?php _e('Browse'); ?></a></li> 645 645 <?php } ?> 646 <?php if ($wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_ status= 'attachment'")) { ?>646 <?php if ($wpdb->get_var("SELECT count(ID) FROM $wpdb->posts WHERE post_type = 'attachment'")) { ?> 647 647 <li<?php echo $current_3; ?>><a href="<?php echo basename(__FILE__); ?>?action=view&post=<?php echo $post; ?>&all=true"><?php _e('Browse All'); ?></a></li> 648 648 <?php } ?> -
trunk/wp-admin/install.php
r3373 r3510 171 171 // First Page 172 172 173 $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, post_status, to_ping, pinged, post_content_filtered) VALUES ('1', '$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(__('about'))."', '$now', '$now_gmt', 'static', '', '', '')");173 $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, post_status, post_type, to_ping, pinged, post_content_filtered) VALUES ('1', '$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(__('about'))."', '$now', '$now_gmt', 'publish', 'page', '', '', '')"); 174 174 $wp_rewrite->flush_rules(); 175 175 -
trunk/wp-admin/page-new.php
r2762 r3510 17 17 18 18 $post = get_default_post_to_edit(); 19 $post->post_ status = 'static';19 $post->post_type = 'page'; 20 20 21 21 include('edit-page-form.php'); -
trunk/wp-admin/post.php
r3473 r3510 24 24 25 25 // Fix submenu highlighting for pages. 26 if ( isset($_REQUEST['post']) && ' static' == get_post_status($_REQUEST['post']) )26 if ( isset($_REQUEST['post']) && 'page' == get_post_type($_REQUEST['post']) ) 27 27 $submenu_file = 'page-new.php'; 28 28 … … 51 51 } 52 52 53 if ( ' static' == $_POST['post_status'] )53 if ( 'page' == $_POST['post_type'] ) 54 54 $location = "page-new.php?saved=true"; 55 55 … … 73 73 $post = get_post_to_edit($post_ID); 74 74 75 if ($post->post_ status == 'static')75 if ($post->post_type == 'page') 76 76 include('edit-page-form.php'); 77 77 else … … 91 91 // Don't let these be changed 92 92 unset($_POST['guid']); 93 $_POST['post_ status'] = 'attachment';93 $_POST['post_type'] = 'attachment'; 94 94 95 95 // Update the thumbnail filename … … 135 135 die( __('You are not allowed to delete this post.') ); 136 136 137 if ( $post->post_ status== 'attachment' ) {137 if ( $post->post_type == 'attachment' ) { 138 138 if ( ! wp_delete_attachment($post_id) ) 139 139 die( __('Error in deleting...') ); -
trunk/wp-admin/upgrade-functions.php
r3373 r3510 33 33 if ( $wp_current_db_version < 3308 ) 34 34 upgrade_160(); 35 36 if ( $wp_current_db_version < 3506 ) 37 upgrade_210(); 35 38 36 39 $wp_rewrite->flush_rules(); … … 324 327 add_post_meta($object->ID, '_wp_attached_file', $meta['file']); 325 328 } 329 } 330 } 331 332 function upgrade_210() { 333 global $wpdb, $table_prefix, $wp_current_db_version; 334 335 // Update status and type. 336 $posts = $wpdb->get_results("SELECT ID, post_status FROM $wpdb->posts"); 337 338 if ( ! empty($posts) ) foreach ($posts as $post) { 339 $status = $post->post_status; 340 $type = 'post'; 341 342 if ( 'static' == $status ) { 343 $status = 'publish'; 344 $type = 'page'; 345 } else if ( 'attachment' == $status ) { 346 $status = 'inherit'; 347 $type = 'attachment'; 348 } 349 350 $wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'"); 326 351 } 327 352 } -
trunk/wp-admin/upgrade-schema.php
r3453 r3510 107 107 post_category int(4) NOT NULL default '0', 108 108 post_excerpt text NOT NULL, 109 post_status enum('publish','draft','private','static','object','attachment' ) NOT NULL default 'publish',109 post_status enum('publish','draft','private','static','object','attachment','inherit') NOT NULL default 'publish', 110 110 comment_status enum('open','closed','registered_only') NOT NULL default 'open', 111 111 ping_status enum('open','closed') NOT NULL default 'open', … … 120 120 guid varchar(255) NOT NULL default '', 121 121 menu_order int(11) NOT NULL default '0', 122 post_type varchar(100) NOT NULL default ' ',122 post_type varchar(100) NOT NULL default 'post', 123 123 post_mime_type varchar(100) NOT NULL default '', 124 124 comment_count bigint(20) NOT NULL default '0', -
trunk/wp-admin/users.php
r3483 r3510 235 235 $short_url = substr($short_url, 0, 32).'...'; 236 236 $style = ('class="alternate"' == $style) ? '' : 'class="alternate"'; 237 $numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$user_object->ID' and post_status = 'publish'");237 $numposts = get_usernumposts($user_object->ID); 238 238 if (0 < $numposts) $numposts = "<a href='edit.php?author=$user_object->ID' title='" . __('View posts') . "'>$numposts</a>"; 239 239 echo " -
trunk/wp-commentsrss2.php
r3314 r3510 33 33 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 34 34 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE comment_post_ID = '$id' 35 AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status IN ('publish', 'static', 'object')35 AND $wpdb->comments.comment_approved = '1' AND $wpdb->posts.post_status = 'publish') 36 36 AND post_date_gmt < '" . gmdate("Y-m-d H:i:59") . "' 37 37 ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') ); … … 40 40 comment_author_url, comment_date, comment_date_gmt, comment_content, comment_post_ID, 41 41 $wpdb->posts.ID, $wpdb->posts.post_password FROM $wpdb->comments 42 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status IN ('publish', 'static', 'object')42 LEFT JOIN $wpdb->posts ON comment_post_id = id WHERE $wpdb->posts.post_status = 'publish' 43 43 AND $wpdb->comments.comment_approved = '1' AND post_date_gmt < '" . gmdate("Y-m-d H:i:s") . "' 44 44 ORDER BY comment_date_gmt DESC LIMIT " . get_settings('posts_per_rss') ); -
trunk/wp-includes/classes.php
r3484 r3510 594 594 595 595 if ( $this->is_attachment ) { 596 $where .= ' AND (post_ status= "attachment")';596 $where .= ' AND (post_type = "attachment")'; 597 597 } elseif ($this->is_page) { 598 $where .= ' AND (post_ status = "static")';598 $where .= ' AND (post_type = "page")'; 599 599 } elseif ($this->is_single) { 600 $where .= ' AND (post_ status != "static")';600 $where .= ' AND (post_type = "post")'; 601 601 } else { 602 $where .= ' AND (post_ status = "publish"';602 $where .= ' AND (post_type = "post" AND post_status = "publish"'; 603 603 604 604 if (isset($user_ID) && ('' != intval($user_ID))) 605 $where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')";605 $where .= " OR post_author = $user_ID AND post_status = 'private')"; 606 606 else 607 607 $where .= ')'; 608 608 } 609 610 if (! $this->is_attachment )611 $where .= ' AND post_status != "attachment"';612 609 613 610 // Apply filters on where and join prior to paging so that any … … 655 652 656 653 // Check post status to determine if post should be displayed. 657 if ($this->is_single ) {654 if ($this->is_single || $this->is_page) { 658 655 $status = get_post_status($this->posts[0]); 659 if ( ('publish' != $status) && ('static' != $status)) {660 if ( ! (isset($user_ID) && ('' != intval($user_ID))) ) {656 if ( ('publish' != $status) ) { 657 if ( ! is_user_logged_in() ) { 661 658 // User must be logged in to view unpublished posts. 662 659 $this->posts = array(); -
trunk/wp-includes/functions-post.php
r3506 r3510 44 44 if ( empty($post_status) ) 45 45 $post_status = 'draft'; 46 46 47 if ( empty($post_type) ) 48 $post_type = 'post'; 49 47 50 // Get the post ID. 48 51 if ( $update ) … … 102 105 $post_password = ''; 103 106 104 if ( ('publish' == $post_status) || ('static' == $post_status) ) { 105 $post_name_check = ('publish' == $post_status) 106 ? $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'publish' AND ID != '$post_ID' LIMIT 1") 107 : $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'static' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1"); 107 if ( 'draft' != $post_status ) { 108 $post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_type = '$post_type' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1"); 108 109 109 110 if ($post_name_check) { … … 111 112 while ($post_name_check) { 112 113 $alt_post_name = $post_name . "-$suffix"; 113 $post_name_check = ('publish' == $post_status) 114 ? $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_status = 'publish' AND ID != '$post_ID' LIMIT 1") 115 : $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_status = 'static' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1"); 114 $post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_type = '$post_type' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1"); 116 115 $suffix++; 117 116 } … … 131 130 post_excerpt = '$post_excerpt', 132 131 post_status = '$post_status', 132 post_type = '$post_type', 133 133 comment_status = '$comment_status', 134 134 ping_status = '$ping_status', … … 145 145 $wpdb->query( 146 146 "INSERT IGNORE INTO $wpdb->posts 147 (post_author, post_date, post_date_gmt, post_content, post_content_filtered, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type)147 (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_modified, post_modified_gmt, post_parent, menu_order, post_mime_type) 148 148 VALUES 149 ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_content_filtered', '$post_title', '$post_excerpt', '$post_status', '$ comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type')");149 ('$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')"); 150 150 $post_ID = $wpdb->insert_id; 151 151 } … … 158 158 wp_set_post_cats('', $post_ID, $post_category); 159 159 160 if ( ' static' == $post_status) {160 if ( 'page' == $post_type ) { 161 161 clean_page_cache($post_ID); 162 162 wp_cache_delete($post_ID, 'pages'); … … 179 179 } 180 180 181 if ($post_status == 'publish' ) {181 if ($post_status == 'publish' && $post_type == 'post') { 182 182 do_action('publish_post', $post_ID); 183 183 … … 196 196 spawn_pinger(); 197 197 } 198 } else if ($post_ status == 'static') {198 } else if ($post_type == 'page') { 199 199 wp_cache_delete('all_page_ids', 'pages'); 200 200 $wp_rewrite->flush_rules(); … … 239 239 $post_author = $user_ID; 240 240 241 $post_status = 'attachment'; 241 $post_type = 'attachment'; 242 $post_status = 'inherit'; 242 243 243 244 // Are we updating or creating? … … 306 307 post_excerpt = '$post_excerpt', 307 308 post_status = '$post_status', 309 post_type = '$post_type', 308 310 comment_status = '$comment_status', 309 311 ping_status = '$ping_status', … … 322 324 $wpdb->query( 323 325 "INSERT INTO $wpdb->posts 324 (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid)326 (post_author, post_date, post_date_gmt, post_content, post_title, post_excerpt, post_status, post_type, comment_status, ping_status, post_password, post_name, to_ping, pinged, post_modified, post_modified_gmt, post_parent, menu_order, post_mime_type, guid) 325 327 VALUES 326 ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$post_title', '$post_excerpt', '$post_status', '$ comment_status', '$ping_status', '$post_password', '$post_name', '$to_ping', '$pinged', '$post_date', '$post_date_gmt', '$post_parent', '$menu_order', '$post_mime_type', '$guid')");328 ('$post_author', '$post_date', '$post_date_gmt', '$post_content', '$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')"); 327 329 $post_ID = $wpdb->insert_id; 328 330 } … … 356 358 return $post; 357 359 358 if ( 'attachment' != $post->post_ status)360 if ( 'attachment' != $post->post_type ) 359 361 return false; 360 362 … … 408 410 } 409 411 410 $sql = "SELECT * FROM $wpdb->posts WHERE post_ status IN ('publish', 'draft', 'private')ORDER BY post_date DESC $limit";412 $sql = "SELECT * FROM $wpdb->posts WHERE post_type = 'post' ORDER BY post_date DESC $limit"; 411 413 $result = $wpdb->get_results($sql,ARRAY_A); 412 414 … … 448 450 } 449 451 450 if ($postarr['post_ status'] == 'attachment')452 if ($postarr['post_type'] == 'attachment') 451 453 return wp_insert_attachment($postarr); 452 454 … … 517 519 $all_affected_cats = array_unique(array_merge($post_categories, $old_categories)); 518 520 foreach ( $all_affected_cats as $cat_id ) { 519 $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status ='publish' AND category_id = '$cat_id'");521 $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status = 'publish' AND post_type = 'post' AND category_id = '$cat_id'"); 520 522 $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); 521 523 wp_cache_delete($cat_id, 'category'); … … 530 532 return $post; 531 533 532 if ( 'attachment' == $post->post_ status)534 if ( 'attachment' == $post->post_type ) 533 535 return wp_delete_attachment($postid); 534 536 535 537 do_action('delete_post', $postid); 536 538 537 if ( 'publish' == $post->post_status ) {539 if ( 'publish' == $post->post_status && 'post' == $post->post_type ) { 538 540 $categories = wp_get_post_cats('', $post->ID); 539 541 if( is_array( $categories ) ) { … … 545 547 } 546 548 547 if ( ' static' == $post->post_status)548 $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_ status = 'static'");549 if ( 'page' == $post->post_type ) 550 $wpdb->query("UPDATE $wpdb->posts SET post_parent = $post->post_parent WHERE post_parent = $postid AND post_type = 'page'"); 549 551 550 552 $wpdb->query("DELETE FROM $wpdb->posts WHERE ID = $postid"); … … 556 558 $wpdb->query("DELETE FROM $wpdb->postmeta WHERE post_id = $postid"); 557 559 558 if ( ' static' == $post->post_status) {560 if ( 'page' == $post->type ) { 559 561 wp_cache_delete('all_page_ids', 'pages'); 560 562 $wp_rewrite->flush_rules(); … … 795 797 796 798 //get pages in order of hierarchy, i.e. children after parents 797 $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_ status = 'static'"));799 $posts = get_page_hierarchy($wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'page'")); 798 800 //now reverse it, because we need parents after children for rewrite rules to work properly 799 801 $posts = array_reverse($posts, true); … … 808 810 // URI => page name 809 811 $uri = get_page_uri($id); 810 $attachments = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_ status= 'attachment' AND post_parent = '$id'");812 $attachments = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_type = 'attachment' AND post_parent = '$id'"); 811 813 if ( $attachments ) { 812 814 foreach ( $attachments as $attachment ) { … … 830 832 831 833 if ( is_object($post) ) { 832 if ( ('attachment' == $post->post_ status) && $post->post_parent && ($post->ID != $post->post_parent) )834 if ( ('attachment' == $post->post_type) && $post->post_parent && ($post->ID != $post->post_parent) ) 833 835 return get_post_status($post->post_parent); 834 836 else 835 837 return $post->post_status; 836 838 } 839 840 return false; 841 } 842 843 function get_post_type($post = false) { 844 global $wpdb, $posts; 845 846 if ( false === $post ) 847 $post = $posts[0]; 848 elseif ( (int) $post ) 849 $post = get_post($post, OBJECT); 850 851 if ( is_object($post) ) 852 return $post->post_type; 837 853 838 854 return false; -
trunk/wp-includes/functions.php
r3495 r3510 172 172 function get_usernumposts($userid) { 173 173 global $wpdb; 174 return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$userid' AND post_ status = 'publish'");174 return $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = '$userid' AND post_type = 'post' AND post_status = 'publish'"); 175 175 } 176 176 … … 575 575 $_post = null; 576 576 } elseif ( is_object($post) ) { 577 if ( ' static' == $post->post_status)577 if ( 'page' == $post->post_type ) 578 578 return get_page($post, $output); 579 579 if ( !isset($post_cache[$post->ID]) ) … … 588 588 $query = "SELECT * FROM $wpdb->posts WHERE ID = '$post' LIMIT 1"; 589 589 $_post = & $wpdb->get_row($query); 590 if ( ' static' == $_post->post_status)590 if ( 'page' == $_post->post_type ) 591 591 return get_page($_post, $output); 592 592 $post_cache[$post] = & $_post; … … 679 679 } 680 680 } elseif ( is_object($page) ) { 681 if ( ' static' != $page->post_status)681 if ( 'post' == $page->post_type ) 682 682 return get_post($page, $output); 683 683 wp_cache_add($page->ID, $page, 'pages'); … … 694 694 $query = "SELECT * FROM $wpdb->posts WHERE ID= '$page' LIMIT 1"; 695 695 $_page = & $wpdb->get_row($query); 696 if ( ' static' != $_page->post_status)696 if ( 'post' == $_page->post_type ) 697 697 return get_post($_page, $output); 698 698 wp_cache_add($_page->ID, $_page, 'pages'); … … 702 702 if (!isset($_page->fullpath)) { 703 703 $_page = set_page_path($_page); 704 wp_cache_replace($_page-> cat_ID, $_page, 'pages');704 wp_cache_replace($_page->ID, $_page, 'pages'); 705 705 } 706 706 … … 816 816 817 817 if ( ! $page_ids = wp_cache_get('all_page_ids', 'pages') ) { 818 $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_ status='static'");818 $page_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type = 'page'"); 819 819 wp_cache_add('all_page_ids', $page_ids, 'pages'); 820 820 } … … 1326 1326 "SELECT DISTINCT * FROM $wpdb->posts " . 1327 1327 ( empty( $r['category'] ) ? "" : ", $wpdb->post2cat " ) . 1328 " WHERE post_date <= '$now' AND (post_ status = 'publish') ".1328 " WHERE post_date <= '$now' AND (post_type = 'post' AND post_status = 'publish') ". 1329 1329 ( empty( $r['category'] ) ? "" : "AND $wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $r['category']. " " ) . 1330 1330 " GROUP BY $wpdb->posts.ID ORDER BY " . $r['orderby'] . " " . $r['order'] . " LIMIT " . $r['offset'] . ',' . $r['numberposts'] ); -
trunk/wp-includes/template-functions-category.php
r3338 r3510 309 309 UNIX_TIMESTAMP( MAX(post_date) ) AS ts 310 310 FROM $wpdb->posts, $wpdb->post2cat, $wpdb->categories 311 WHERE post_ status = 'publish' AND post_id = ID $exclusions311 WHERE post_type = 'post' AND post_status = 'publish' AND post_id = ID $exclusions 312 312 GROUP BY category_id"); 313 313 foreach ( $cat_dates as $cat_date ) { -
trunk/wp-includes/template-functions-general.php
r3493 r3510 331 331 332 332 if ( 'monthly' == $type ) { 333 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_ status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);333 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, count(ID) as posts FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); 334 334 if ( $arcresults ) { 335 335 $afterafter = $after; … … 346 346 } 347 347 } elseif ( 'daily' == $type ) { 348 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_ status = 'publish' ORDER BY post_date DESC" . $limit);348 $arcresults = $wpdb->get_results("SELECT DISTINCT YEAR(post_date) AS `year`, MONTH(post_date) AS `month`, DAYOFMONTH(post_date) AS `dayofmonth` FROM $wpdb->posts WHERE post_date < '$now' AND post_date != '0000-00-00 00:00:00' AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 349 349 if ( $arcresults ) { 350 350 foreach ( $arcresults as $arcresult ) { … … 357 357 } elseif ( 'weekly' == $type ) { 358 358 $start_of_week = get_settings('start_of_week'); 359 $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $wpdb->posts WHERE post_date < '$now' AND post_ status = 'publish' ORDER BY post_date DESC" . $limit);359 $arcresults = $wpdb->get_results("SELECT DISTINCT WEEK(post_date, $start_of_week) AS `week`, YEAR(post_date) AS yr, DATE_FORMAT(post_date, '%Y-%m-%d') AS yyyymmdd FROM $wpdb->posts WHERE post_date < '$now' AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 360 360 $arc_w_last = ''; 361 361 if ( $arcresults ) { … … 374 374 } 375 375 } elseif ( 'postbypost' == $type ) { 376 $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_date < '$now' AND post_ status = 'publish' ORDER BY post_date DESC" . $limit);376 $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_date < '$now' AND post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 377 377 if ( $arcresults ) { 378 378 foreach ( $arcresults as $arcresult ) { … … 404 404 // Quick check. If we have no posts at all, abort! 405 405 if ( !$posts ) { 406 $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_ status = 'publish' ORDER BY post_date DESC LIMIT 1");406 $gotsome = $wpdb->get_var("SELECT ID from $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC LIMIT 1"); 407 407 if ( !$gotsome ) 408 408 return; … … 444 444 FROM $wpdb->posts 445 445 WHERE post_date < '$thisyear-$thismonth-01' 446 AND post_ status = 'publish'446 AND post_type = 'post' AND post_status = 'publish' 447 447 ORDER BY post_date DESC 448 448 LIMIT 1"); … … 451 451 WHERE post_date > '$thisyear-$thismonth-01' 452 452 AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' ) 453 AND post_ status = 'publish'453 AND post_type = 'post' AND post_status = 'publish' 454 454 ORDER BY post_date ASC 455 455 LIMIT 1"); … … 509 509 FROM $wpdb->posts WHERE MONTH(post_date) = $thismonth 510 510 AND YEAR(post_date) = $thisyear 511 AND post_ status = 'publish'511 AND post_type = 'post' AND post_status = 'publish' 512 512 AND post_date < '" . current_time('mysql') . '\'', ARRAY_N); 513 513 if ( $dayswithposts ) { … … 532 532 ."AND MONTH(post_date) = '$thismonth' " 533 533 ."AND post_date < '".current_time('mysql')."' " 534 ."AND post_ status = 'publish'"534 ."AND post_type = 'post' AND post_status = 'publish'" 535 535 ); 536 536 if ( $ak_post_titles ) { -
trunk/wp-includes/template-functions-links.php
r3508 r3510 43 43 44 44 $post = &get_post($id); 45 if ( $post->post_ status == 'static' )45 if ( $post->post_type == 'page' ) 46 46 return get_page_link($post->ID); 47 elseif ($post->post_ status== 'attachment')47 elseif ($post->post_type == 'attachment') 48 48 return get_attachment_link($post->ID); 49 49 … … 262 262 } 263 263 264 return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join WHERE post_date < '$current_post_date' AND post_ status = 'publish' $posts_in_ex_cats_sql ORDER BY post_date DESC LIMIT 1");264 return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join WHERE post_date < '$current_post_date' AND post_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql ORDER BY post_date DESC LIMIT 1"); 265 265 } 266 266 … … 297 297 $now = current_time('mysql'); 298 298 299 return @$wpdb->get_row("SELECT ID,post_title FROM $wpdb->posts $join WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_ status = 'publish' $posts_in_ex_cats_sql AND ID != $post->ID ORDER BY post_date ASC LIMIT 1");299 return @$wpdb->get_row("SELECT ID,post_title FROM $wpdb->posts $join WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql AND ID != $post->ID ORDER BY post_date ASC LIMIT 1"); 300 300 } 301 301 -
trunk/wp-includes/template-functions-post.php
r3486 r3510 315 315 $pages = $wpdb->get_results("SELECT * " . 316 316 "FROM $wpdb->posts " . 317 "WHERE post_ status = 'static' " .317 "WHERE post_type = 'page' AND post_status = 'publish' " . 318 318 "$exclusions " . 319 319 "ORDER BY " . $r['sort_column'] . " " . $r['sort_order']); … … 451 451 $_post = & get_post($id); 452 452 453 if ( ('attachment' != $_post->post_ status) || ('' == $_post->guid) )453 if ( ('attachment' != $_post->post_type) || ('' == $_post->guid) ) 454 454 return __('Missing Attachment'); 455 455 -
trunk/wp-includes/version.php
r3502 r3510 3 3 // This just holds the version number, in a separate file so we can bump it without cluttering the SVN 4 4 5 $wp_version = '2. 0.1';6 $wp_db_version = 3 437;5 $wp_version = '2.1-aplha1'; 6 $wp_db_version = 3506; 7 7 8 8 ?>
Note: See TracChangeset
for help on using the changeset viewer.