Changeset 2523 for trunk/wp-includes/classes.php
- Timestamp:
- 04/09/2005 05:12:36 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/classes.php
r2478 r2523 494 494 495 495 if ($this->is_page) { 496 $where .= ' AND (post_status = "static"'; 496 $where .= ' AND (post_status = "static")'; 497 } elseif ($this->is_single) { 498 $where .= ' AND (post_status != "static")'; 497 499 } else { 498 500 $where .= ' AND (post_status = "publish"'; 499 } 500 501 // Get private posts 502 if (isset($user_ID) && ('' != intval($user_ID))) 503 $where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')"; 504 else 505 $where .= ')'; 501 502 if (isset($user_ID) && ('' != intval($user_ID))) 503 $where .= " OR post_author = $user_ID AND post_status != 'draft' AND post_status != 'static')"; 504 else 505 $where .= ')'; 506 } 506 507 507 508 // Apply filters on where and join prior to paging so that any … … 544 545 $request = " SELECT $distinct * FROM $wpdb->posts $join WHERE 1=1".$where." ORDER BY " . $orderby . " $limits"; 545 546 546 if ($q['preview']) {547 $request = 'SELECT 1-1'; // dummy mysql query for the preview548 // little funky fix for IEwin, rawk on that code549 $is_winIE = ((preg_match('/MSIE/',$HTTP_USER_AGENT)) && (preg_match('/Win/',$HTTP_USER_AGENT)));550 if (($is_winIE) && (!isset($IEWin_bookmarklet_fix))) {551 $preview_content = preg_replace('/\%u([0-9A-F]{4,4})/e', "'&#'.base_convert('\\1',16,10).';'", $preview_content);552 }553 }554 555 547 $this->posts = $wpdb->get_results($request); 548 549 // Check post status to determine if post should be displayed. 550 if ($this->is_single) { 551 if ('publish' != $this->posts[0]->post_status) { 552 if ( ! (isset($user_ID) && ('' != intval($user_ID))) ) { 553 // User must be logged in to view unpublished posts. 554 $this->posts = array(); 555 } else { 556 if ('draft' == $this->posts[0]->post_status) { 557 // User must have edit permissions on the draft to preview. 558 if (! user_can_edit_post($user_ID, $this->posts[0]->ID)) 559 $this->posts = array(); 560 } elseif ('private' == $this->posts[0]->post_status) { 561 if ($this->posts[0]->post_author != $user_ID) 562 $this->posts = array(); 563 } 564 } 565 } 566 } 567 556 568 $this->posts = apply_filters('the_posts', $this->posts); 557 569 $this->post_count = count($this->posts);
Note: See TracChangeset
for help on using the changeset viewer.