Ticket #10758: 10758.patch
File 10758.patch, 16.5 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/post.php
Property changes on: . ___________________________________________________________________ Added: svn:ignore + wp-config.php
925 925 * 926 926 * @since unknown 927 927 * 928 * @param unknown_type $id929 * @param unknown_type $title930 * @param unknown_type $name931 * @return unknown928 * @param int|object $id Post ID or post object. 929 * @param string $title (optional) Title 930 * @param string $name (optional) Name 931 * @return array With two entries of type string 932 932 */ 933 933 function get_sample_permalink($id, $title = null, $name = null) { 934 934 $post = &get_post($id); … … 943 943 // drafts, so we will fake, that our post is published 944 944 if (in_array($post->post_status, array('draft', 'pending'))) { 945 945 $post->post_status = 'publish'; 946 $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID);946 $post->post_name = sanitize_title($post->post_name ? $post->post_name : $post->post_title, $post->ID); 947 947 } 948 948 949 949 $post->post_name = wp_unique_post_slug($post->post_name, $post->ID, $post->post_status, $post->post_type, $post->post_parent); … … 951 951 // If the user wants to set a new name -- override the current one 952 952 // Note: if empty name is supplied -- use the title instead, see #6072 953 953 if (!is_null($name)) { 954 $post->post_name = sanitize_title($name ? $name : $title, $post->ID);954 $post->post_name = sanitize_title($name ? $name : $title, $post->ID); 955 955 } 956 956 957 957 $post->filter = 'sample'; … … 979 979 } 980 980 981 981 /** 982 * {@internal Missing Short Description}}982 * sample permalink html 983 983 * 984 * intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. 985 * 984 986 * @since unknown 985 987 * 986 * @param unknown_type $id987 * @param unknown_type $new_title988 * @param unknown_type $new_slug989 * @return unknown988 * @param int|object $id Post ID or post object. 989 * @param string $new_title (optional) New title 990 * @param string $new_slug (optional) New slug 991 * @return string intended to be used for the inplace editor of the permalink post slug on in the post (and page?) editor. 990 992 */ 991 993 function get_sample_permalink_html( $id, $new_title = null, $new_slug = null ) { 992 994 $post = &get_post($id); -
wp-admin/includes/widgets.php
180 180 </div> 181 181 <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($id_format); ?>" /> 182 182 <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" /> 183 <input type="hidden" name="widget-width" class="widget-width" value="<?php echo esc_attr($control['width']); ?>" />184 <input type="hidden" name="widget-height" class="widget-height" value="<?php echo esc_attr($control['height']); ?>" />183 <input type="hidden" name="widget-width" class="widget-width" value="<?php if (isset( $control['width'] )) echo esc_attr($control['width']); ?>" /> 184 <input type="hidden" name="widget-height" class="widget-height" value="<?php if (isset( $control['height'] )) echo esc_attr($control['height']); ?>" /> 185 185 <input type="hidden" name="widget_number" class="widget_number" value="<?php echo esc_attr($widget_number); ?>" /> 186 186 <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" /> 187 187 <input type="hidden" name="add_new" class="add_new" value="<?php echo esc_attr($add_new); ?>" /> -
wp-admin/admin-footer.php
29 29 <?php 30 30 do_action('admin_footer', ''); 31 31 do_action('admin_print_footer_scripts'); 32 do_action("admin_footer-$hook_suffix"); 32 if (isset($hook_suffix)) 33 do_action("admin_footer-$hook_suffix"); 33 34 34 35 // get_site_option() won't exist when auto upgrading from <= 2.7 35 36 if ( function_exists('get_site_option') ) { -
wp-admin/upload.php
308 308 309 309 if ( $month_count && !( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) : ?> 310 310 <select name='m'> 311 <option<?php selected( @$_GET['m'], 0); ?> value='0'><?php _e('Show all dates'); ?></option>311 <option<?php selected(isset($_GET['m']) ? $_GET['m'] : null, 0); ?> value='0'><?php _e('Show all dates'); ?></option> 312 312 <?php 313 313 foreach ($arc_result as $arc_row) { 314 314 if ( $arc_row->yyear == 0 ) -
wp-includes/author-template.php
22 22 */ 23 23 function get_the_author($deprecated = '') { 24 24 global $authordata; 25 return apply_filters('the_author', $authordata->display_name);25 return apply_filters('the_author', is_object($authordata) ? $authordata->display_name : null); 26 26 } 27 27 28 28 /** -
wp-includes/capabilities.php
842 842 $post_author_data = get_userdata( $post->post_author ); 843 843 //echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br />"; 844 844 // If the user is the author... 845 if ( $user_id == $post_author_data->ID ) {845 if ( is_object($post_author_data) && $user_id == $post_author_data->ID ) { 846 846 // If the post is published... 847 847 if ( 'publish' == $post->post_status ) { 848 848 $caps[] = 'edit_published_posts'; -
wp-includes/comment.php
1122 1122 function wp_new_comment( $commentdata ) { 1123 1123 $commentdata = apply_filters('preprocess_comment', $commentdata); 1124 1124 1125 $commentdata['comment_post_ID'] = (int) $commentdata['comment_post_ID'];1126 $commentdata['user_ID'] = (int) $commentdata['user_ID'];1125 $commentdata['comment_post_ID'] = isset($commentdata['comment_post_ID']) ? (int) $commentdata['comment_post_ID'] : null; 1126 $commentdata['user_ID'] = isset($commentdata['user_ID']) ? (int) $commentdata['user_ID'] : null; 1127 1127 1128 $commentdata['comment_parent'] = absint($commentdata['comment_parent']);1128 $commentdata['comment_parent'] = isset($commentdata['comment_parent']) ? absint($commentdata['comment_parent']) : null; 1129 1129 $parent_status = ( 0 < $commentdata['comment_parent'] ) ? wp_get_comment_status($commentdata['comment_parent']) : ''; 1130 1130 $commentdata['comment_parent'] = ( 'approved' == $parent_status || 'unapproved' == $parent_status ) ? $commentdata['comment_parent'] : 0; 1131 1131 -
wp-includes/functions.wp-styles.php
11 11 * 12 12 * @since r79 13 13 * @uses do_action() Calls 'wp_print_styles' hook. 14 * @global object$wp_styles The WP_Styles object for printing styles.14 * @global WP_Styles $wp_styles The WP_Styles object for printing styles. 15 15 * 16 16 * @param array $handles (optional) Styles to be printed. (void) prints queue, (string) prints that style, (array of strings) prints those styles. 17 17 * @return bool True on success, false on failure. … … 21 21 if ( '' === $handles ) // for wp_head 22 22 $handles = false; 23 23 24 /* @var $wp_styles WP_Styles */ 24 25 global $wp_styles; 25 26 if ( !is_a($wp_styles, 'WP_Styles') ) { 26 27 if ( !$handles ) … … 37 38 * 38 39 * @since r79 39 40 * @see WP_Styles::add() For parameter and additional information. 41 * @global WP_Styles $wp_styles 42 * @return void 40 43 */ 41 44 function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) { 45 /* @var $wp_styles WP_Styles */ 42 46 global $wp_styles; 43 47 if ( !is_a($wp_styles, 'WP_Styles') ) 44 48 $wp_styles = new WP_Styles(); … … 51 55 * 52 56 * @since r79 53 57 * @see WP_Styles::remove() For parameter and additional information. 58 * @global WP_Styles $wp_styles 54 59 */ 55 60 function wp_deregister_style( $handle ) { 61 /* @var $wp_styles WP_Styles */ 56 62 global $wp_styles; 57 63 if ( !is_a($wp_styles, 'WP_Styles') ) 58 64 $wp_styles = new WP_Styles(); … … 65 71 * 66 72 * @since r79 67 73 * @see WP_Styles::add(), WP_Styles::enqueue() 74 * @global WP_Styles $wp_styles 68 75 */ 69 76 function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) { 77 /* @var $wp_styles WP_Styles */ 70 78 global $wp_styles; 71 79 if ( !is_a($wp_styles, 'WP_Styles') ) 72 80 $wp_styles = new WP_Styles(); … … 89 97 * @param string $handle Handle used to add style. 90 98 * @param string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do' 91 99 * @return bool 100 * @global WP_Styles $wp_styles 92 101 */ 93 102 function wp_style_is( $handle, $list = 'queue' ) { 103 /* @var $wp_styles WP_Styles */ 94 104 global $wp_styles; 95 105 if ( !is_a($wp_styles, 'WP_Styles') ) 96 106 $wp_styles = new WP_Styles(); -
wp-includes/pluggable.php
35 35 * actions on users who aren't signed in. 36 36 * 37 37 * @since 2.0.3 38 * @global object $current_userThe current user object which holds the user data.38 * @global WP_User $current_user User-object of request aka The current user object which holds the user data. 39 39 * @uses do_action() Calls 'set_current_user' hook after setting the current user. 40 40 * 41 41 * @param int $id User ID … … 43 43 * @return WP_User Current user User object 44 44 */ 45 45 function wp_set_current_user($id, $name = '') { 46 /* @var $current_user WP_User */ 46 47 global $current_user; 47 48 48 49 if ( isset($current_user) && ($id == $current_user->ID) ) … … 63 64 * Retrieve the current user object. 64 65 * 65 66 * @since 2.0.3 67 * @global WP_User $current_user User-object of request aka The current user object which holds the user data. 66 68 * 67 69 * @return WP_User Current user WP_User object 68 70 */ 69 71 function wp_get_current_user() { 72 /* @var $current_user WP_User */ 70 73 global $current_user; 71 74 72 75 get_currentuserinfo(); … … 84 87 * set the current user to 0, which is invalid and won't have any permissions. 85 88 * 86 89 * @since 0.71 87 * @ uses $current_user Checks if the current user is set90 * @global WP_User $current_user User-object of request aka The current user object which holds the user data. 88 91 * @uses wp_validate_auth_cookie() Retrieves current logged in user. 89 92 * 90 * @return bool|null False on XMLRPC Request and invalid auth cookie. Null when current user set 93 * @return bool|null False on XMLRPC Request and invalid auth cookie. Null when current user set or it was not empty 91 94 */ 92 95 function get_currentuserinfo() { 96 /* @var $current_user WP_User */ 93 97 global $current_user; 94 98 95 99 if ( defined('XMLRPC_REQUEST') && XMLRPC_REQUEST ) 96 100 return false; 97 101 98 102 if ( ! empty($current_user) ) 99 return ;103 return null; 100 104 101 105 if ( ! $user = wp_validate_auth_cookie() ) { 102 106 if ( empty($_COOKIE[LOGGED_IN_COOKIE]) || !$user = wp_validate_auth_cookie($_COOKIE[LOGGED_IN_COOKIE], 'logged_in') ) { … … 106 110 } 107 111 108 112 wp_set_current_user($user); 113 114 return null; 109 115 } 110 116 endif; 111 117 … … 1223 1229 * @return string The one use form token 1224 1230 */ 1225 1231 function wp_create_nonce($action = -1) { 1232 /* @var $user WP_User */ 1226 1233 $user = wp_get_current_user(); 1227 $uid = (int) $user->id;1228 1234 1235 if ( is_object($user) ) 1236 $uid = (int) $user->id; 1237 else 1238 $uid = 0; 1239 1229 1240 $i = wp_nonce_tick(); 1230 1241 1231 1242 return substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10); -
wp-includes/post.php
1811 1811 /** 1812 1812 * Given the desired slug and some post details computes a unique slug for the post. 1813 1813 * 1814 * @global wpdb $wpdb 1815 * @global WP_Rewrite $wp_rewrite 1814 1816 * @param string $slug the desired slug (post_name) 1815 1817 * @param integer $post_ID 1816 1818 * @param string $post_status no uniqueness checks are made if the post is still draft or pending … … 1822 1824 if ( in_array( $post_status, array( 'draft', 'pending' ) ) ) 1823 1825 return $slug; 1824 1826 1827 /* @var $wp_rewrite WP_Rewrite 1828 * @var $wpdb wpdb */ 1825 1829 global $wpdb, $wp_rewrite; 1830 1826 1831 $hierarchical_post_types = apply_filters('hierarchical_post_types', array('page')); 1827 1832 if ( 'attachment' == $post_type ) { 1828 1833 // Attachment slugs must be unique across all types. 1829 1834 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND ID != %d LIMIT 1"; 1830 1835 $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID)); 1831 1836 1832 if ( $post_name_check || in_array($slug, $wp_rewrite->feeds) ) { 1837 $feeds = $wp_rewrite->feeds; 1838 if ( is_null($feeds) ) 1839 $feeds = array(); 1840 1841 if ( $post_name_check || in_array($slug, $feeds) ) { 1833 1842 $suffix = 2; 1834 1843 do { 1835 1844 $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix"; … … 1843 1852 // separate namespace than posts so page slugs are allowed to overlap post slugs. 1844 1853 $check_sql = "SELECT post_name FROM $wpdb->posts WHERE post_name = %s AND post_type IN ( '" . implode("', '", esc_sql($hierarchical_post_types)) . "' ) AND ID != %d AND post_parent = %d LIMIT 1"; 1845 1854 $post_name_check = $wpdb->get_var($wpdb->prepare($check_sql, $slug, $post_ID, $post_parent)); 1855 1856 $feeds = $wp_rewrite->feeds; 1857 if ( is_null($feeds) ) 1858 $feeds = array(); 1846 1859 1847 if ( $post_name_check || in_array($slug, $ wp_rewrite->feeds) ) {1860 if ( $post_name_check || in_array($slug, $feeds) ) { 1848 1861 $suffix = 2; 1849 1862 do { 1850 1863 $alt_post_name = substr($slug, 0, 200-(strlen($suffix)+1)). "-$suffix"; -
wp-includes/vars.php
37 37 // Simple browser detection 38 38 $is_lynx = $is_gecko = $is_winIE = $is_macIE = $is_opera = $is_NS4 = $is_safari = $is_chrome = $is_iphone = false; 39 39 40 if ( !isset($_SERVER['HTTP_USER_AGENT']) ) 41 $_SERVER['HTTP_USER_AGENT'] = ''; 42 40 43 if (strpos($_SERVER['HTTP_USER_AGENT'], 'Lynx') !== false) { 41 44 $is_lynx = true; 42 45 } elseif ( strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'chrome') !== false ) { -
wp-comments-post.php
17 17 18 18 nocache_headers(); 19 19 20 $comment_post_ID = (int) $_POST['comment_post_ID'];20 $comment_post_ID = isset ($_POST['comment_post_ID']) ? (int) $_POST['comment_post_ID'] : null; 21 21 22 22 $status = $wpdb->get_row( $wpdb->prepare("SELECT post_status, comment_status FROM $wpdb->posts WHERE ID = %d", $comment_post_ID) ); 23 23 -
wp-trackback.php
36 36 // trackback is done by a POST 37 37 $request_array = 'HTTP_POST_VARS'; 38 38 39 if ( ! $_GET['tb_id'] ) {39 if ( !isset($_GET['tb_id']) || !$_GET['tb_id'] ) { 40 40 $tb_id = explode('/', $_SERVER['REQUEST_URI']); 41 41 $tb_id = intval( $tb_id[ count($tb_id) - 1 ] ); 42 42 } 43 43 44 $tb_url = $_POST['url'];45 $charset = $_POST['charset'];44 $tb_url = isset($_POST['url']) ? $_POST['url'] : ''; 45 $charset = isset($_POST['charset']) ? $_POST['charset'] : ''; 46 46 47 47 // These three are stripslashed here so that they can be properly escaped after mb_convert_encoding() 48 $title = stripslashes($_POST['title']);49 $excerpt = stripslashes($_POST['excerpt']);50 $blog_name = stripslashes($_POST['blog_name']);48 $title = isset($_POST['title']) ? stripslashes($_POST['title']) : ''; 49 $excerpt = isset($_POST['excerpt']) ? stripslashes($_POST['excerpt']) : ''; 50 $blog_name = isset($_POST['blog_name']) ? stripslashes($_POST['blog_name']) : ''; 51 51 52 52 if ($charset) 53 53 $charset = strtoupper( trim($charset) ); … … 72 72 if ( is_single() || is_page() ) 73 73 $tb_id = $posts[0]->ID; 74 74 75 if ( !i ntval( $tb_id ) )75 if ( !isset($tb_id) || !intval( $tb_id ) ) 76 76 trackback_response(1, 'I really need an ID for this to work.'); 77 77 78 78 if (empty($title) && empty($tb_url) && empty($blog_name)) {