Changeset 3514
- Timestamp:
- 02/12/2006 07:41:56 AM (19 years ago)
- Location:
- trunk
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/upgrade-functions.php
r3513 r3514 34 34 upgrade_160(); 35 35 36 if ( $wp_current_db_version < 351 3)36 if ( $wp_current_db_version < 3514 ) 37 37 upgrade_210(); 38 38 -
trunk/wp-admin/upgrade-schema.php
r3513 r3514 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','inherit' ) NOT NULL default 'publish',109 post_status enum('publish','draft','private','static','object','attachment','inherit','future') 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', -
trunk/wp-includes/classes.php
r3511 r3514 572 572 } 573 573 574 $now = gmdate('Y-m-d H:i:59');574 //$now = gmdate('Y-m-d H:i:59'); 575 575 576 576 //only select past-dated posts, except if a logged in user is viewing a single: then, if they 577 577 //can edit the post, we let them through 578 if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) {579 $where .= " AND post_date_gmt <= '$now'";580 $distinct = 'DISTINCT';581 }578 //if ($pagenow != 'post.php' && $pagenow != 'edit.php' && !($this->is_single && $user_ID)) { 579 // $where .= " AND post_date_gmt <= '$now'"; 580 // $distinct = 'DISTINCT'; 581 //} 582 582 583 583 if ( $this->is_attachment ) { … … 590 590 $where .= ' AND (post_type = "post" AND post_status = "publish"'; 591 591 592 if (isset($user_ID) && ('' != intval($user_ID))) 592 if ( $pagenow == 'post.php' || $pagenow == 'edit.php' ) 593 $where .= " OR post_status = 'future'"; 594 else 595 $distinct = 'DISTINCT'; 596 597 if ( is_user_logged_in() ) 593 598 $where .= " OR post_author = $user_ID AND post_status = 'private')"; 594 599 else … … 642 647 if ($this->is_single || $this->is_page) { 643 648 $status = get_post_status($this->posts[0]); 649 //$type = get_post_type($this->posts[0]); 644 650 if ( ('publish' != $status) ) { 645 651 if ( ! is_user_logged_in() ) { … … 655 661 $this->posts[0]->post_date = current_time('mysql'); 656 662 } 663 } else if ('future' == $status) { 664 $this->is_preview = true; 665 if (!current_user_can('edit_post', $this->posts[0]->ID)) { 666 $this->posts = array ( ); 667 } 657 668 } else { 658 669 if (! current_user_can('read_post', $this->posts[0]->ID)) 659 670 $this->posts = array(); 660 }661 }662 } else {663 if (mysql2date('U', $this->posts[0]->post_date_gmt) > mysql2date('U', $now)) { //it's future dated664 $this->is_preview = true;665 if (!current_user_can('edit_post', $this->posts[0]->ID)) {666 $this->posts = array ( );667 671 } 668 672 } -
trunk/wp-includes/default-filters.php
r3009 r3514 85 85 add_action('publish_post', 'generic_ping'); 86 86 add_action('wp_head', 'rsd_link'); 87 add_action('publish_future_post', 'wp_publish_post', 10, 1); 87 88 88 89 ?> -
trunk/wp-includes/functions-post.php
r3511 r3514 72 72 $post_date_gmt = get_gmt_from_date($post_date); 73 73 } 74 75 if ( 'publish' == $post_status && (mysql2date('U', $post_date_gmt) > time()) ) 76 $post_status = 'future'; 74 77 75 78 if ( empty($comment_status) ) { … … 204 207 add_post_meta($post_ID, '_wp_page_template', $page_template, true); 205 208 } 209 210 if ( 'future' == $post_status ) 211 wp_schedule_event(mysql2date('U', $post_date_gmt), 'once', 'publish_future_post', $post_ID); 206 212 207 213 do_action('save_post', $post_ID); … … 456 462 } 457 463 464 function wp_publish_post($post_id) { 465 $post = get_post($post_id); 466 467 if ( empty($post) ) 468 return; 469 470 if ( 'publish' == $post->post_status ) 471 return; 472 473 return wp_update_post(array('post_status' => 'publish', 'ID' => $post_id)); 474 } 475 458 476 function wp_get_post_cats($blogid = '1', $post_ID = 0) { 459 477 global $wpdb; -
trunk/wp-includes/functions.php
r3512 r3514 111 111 $add_seconds_blog = get_settings('gmt_offset') * 3600; 112 112 $add_seconds_server = date('Z'); 113 $now = current_time('mysql', 1);114 113 if ( !isset($cache_lastpostdate[$timezone]) ) { 115 114 switch(strtolower($timezone)) { 116 115 case 'gmt': 117 $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_ date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");116 $lastpostdate = $wpdb->get_var("SELECT post_date_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1"); 118 117 break; 119 118 case 'blog': 120 $lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_ date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");119 $lastpostdate = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1"); 121 120 break; 122 121 case 'server': 123 $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_ date_gmt <= '$now' AND post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1");122 $lastpostdate = $wpdb->get_var("SELECT DATE_ADD(post_date_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date_gmt DESC LIMIT 1"); 124 123 break; 125 124 } … … 135 134 $add_seconds_blog = get_settings('gmt_offset') * 3600; 136 135 $add_seconds_server = date('Z'); 137 $now = current_time('mysql', 1);138 136 if ( !isset($cache_lastpostmodified[$timezone]) ) { 139 137 switch(strtolower($timezone)) { 140 138 case 'gmt': 141 $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_ modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");139 $lastpostmodified = $wpdb->get_var("SELECT post_modified_gmt FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1"); 142 140 break; 143 141 case 'blog': 144 $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_ modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");142 $lastpostmodified = $wpdb->get_var("SELECT post_modified FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1"); 145 143 break; 146 144 case 'server': 147 $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_ modified_gmt <= '$now' AND post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1");145 $lastpostmodified = $wpdb->get_var("SELECT DATE_ADD(post_modified_gmt, INTERVAL '$add_seconds_server' SECOND) FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_modified_gmt DESC LIMIT 1"); 148 146 break; 149 147 } … … 1351 1349 $r['order'] = 'DESC'; 1352 1350 1353 $now = current_time('mysql');1354 1355 1351 $posts = $wpdb->get_results( 1356 1352 "SELECT DISTINCT * FROM $wpdb->posts " . 1357 1353 ( empty( $r['category'] ) ? "" : ", $wpdb->post2cat " ) . 1358 " WHERE post_date <= '$now' AND(post_type = 'post' AND post_status = 'publish') ".1354 " WHERE (post_type = 'post' AND post_status = 'publish') ". 1359 1355 ( empty( $r['category'] ) ? "" : "AND $wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $r['category']. " " ) . 1360 1356 " GROUP BY $wpdb->posts.ID ORDER BY " . $r['orderby'] . " " . $r['order'] . " LIMIT " . $r['offset'] . ',' . $r['numberposts'] ); -
trunk/wp-includes/template-functions-general.php
r3510 r3514 328 328 $add_minutes = intval(60 * (get_settings('gmt_offset') - $add_hours)); 329 329 330 $now = current_time('mysql');331 332 330 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_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit);331 $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_type = 'post' AND post_status = 'publish' GROUP BY YEAR(post_date), MONTH(post_date) ORDER BY post_date DESC" . $limit); 334 332 if ( $arcresults ) { 335 333 $afterafter = $after; … … 346 344 } 347 345 } 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_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);346 $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_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 349 347 if ( $arcresults ) { 350 348 foreach ( $arcresults as $arcresult ) { … … 357 355 } elseif ( 'weekly' == $type ) { 358 356 $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_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit);357 $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_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 360 358 $arc_w_last = ''; 361 359 if ( $arcresults ) { … … 374 372 } 375 373 } elseif ( 'postbypost' == $type ) { 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);374 $arcresults = $wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish' ORDER BY post_date DESC" . $limit); 377 375 if ( $arcresults ) { 378 376 foreach ( $arcresults as $arcresult ) { -
trunk/wp-includes/template-functions-links.php
r3510 r3514 295 295 } 296 296 297 $now = current_time('mysql'); 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_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql AND ID != $post->ID ORDER BY post_date ASC LIMIT 1"); 297 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 AND ID != $post->ID ORDER BY post_date ASC LIMIT 1"); 300 298 } 301 299 -
trunk/wp-includes/version.php
r3513 r3514 4 4 5 5 $wp_version = '2.1-aplha1'; 6 $wp_db_version = 351 3;6 $wp_db_version = 3514; 7 7 8 8 ?> -
trunk/wp-settings.php
r3499 r3514 218 218 function shutdown_action_hook() { 219 219 do_action('shutdown'); 220 wp_cron(); 220 221 wp_cache_close(); 221 222 }
Note: See TracChangeset
for help on using the changeset viewer.