Changeset 2523
- Timestamp:
- 04/09/2005 05:12:36 PM (20 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-blog-header.php
r2512 r2523 86 86 } 87 87 88 $wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence', 'preview','debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup');88 $wpvarstoreset = array('m','p','posts','w', 'cat','withcomments','s','search','exact', 'sentence', 'debug', 'calendar','page','paged','more','tb', 'pb','author','order','orderby', 'year', 'monthnum', 'day', 'hour', 'minute', 'second', 'name', 'category_name', 'feed', 'author_name', 'static', 'pagename', 'page_id', 'error', 'comments_popup'); 89 89 90 90 $wpvarstoreset = apply_filters('query_vars', $wpvarstoreset); … … 168 168 169 169 update_category_cache(); 170 get_currentuserinfo(); 170 171 171 172 // Call query posts to do the work. -
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); -
trunk/wp-includes/functions-post.php
r2453 r2523 352 352 function user_can_edit_post($user_id, $post_id, $blog_id = 1) { 353 353 $author_data = get_userdata($user_id); 354 $post _data = get_postdata($post_id);355 $post_author_data = get_userdata($post _data['Author_ID']);356 357 if ( (($user_id == $post_author_data->ID) && !($post _data['post_status']== 'publish' && $author_data->user_level < 2))354 $post = get_post($post_id); 355 $post_author_data = get_userdata($post->post_author); 356 357 if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2)) 358 358 || ($author_data->user_level > $post_author_data->user_level) 359 359 || ($author_data->user_level >= 10) ) { -
trunk/wp-includes/functions.php
r2516 r2523 857 857 // Setup global post data. 858 858 function setup_postdata($post) { 859 global $id, $postdata, $authordata, $day, $p review, $page, $pages, $multipage, $more, $numpages, $wp_query;859 global $id, $postdata, $authordata, $day, $page, $pages, $multipage, $more, $numpages, $wp_query; 860 860 global $pagenow; 861 861 862 if (!$preview) { 863 $id = $post->ID; 864 } else { 865 $id = 0; 866 $postdata = array ( 867 'ID' => 0, 868 'Author_ID' => $_GET['preview_userid'], 869 'Date' => $_GET['preview_date'], 870 'Content' => $_GET['preview_content'], 871 'Excerpt' => $_GET['preview_excerpt'], 872 'Title' => $_GET['preview_title'], 873 'Category' => $_GET['preview_category'], 874 'Notify' => 1 875 ); 876 } 862 $id = $post->ID; 863 877 864 $authordata = get_userdata($post->post_author); 878 865 … … 1159 1146 FROM $wpdb->posts 1160 1147 LEFT JOIN $wpdb->comments ON ( comment_post_ID = ID AND comment_approved = '1') 1161 WHERE post_status = 'publish' ANDID IN ($post_id_list)1148 WHERE ID IN ($post_id_list) 1162 1149 GROUP BY ID"); 1163 1150 -
trunk/wp-includes/template-functions-links.php
r2499 r2523 45 45 $permalink = get_settings('permalink_structure'); 46 46 47 if ('' != $permalink ) {47 if ('' != $permalink && 'draft' != $post->post_status) { 48 48 $unixtime = strtotime($post->post_date); 49 49
Note: See TracChangeset
for help on using the changeset viewer.