Changeset 817
- Timestamp:
- 12/01/06 12:27:29 (2 years ago)
- Files:
-
- trunk/wp-admin/admin-ajax.php (modified) (3 diffs)
- trunk/wp-admin/admin-functions.php (modified) (2 diffs)
- trunk/wp-admin/export.php (modified) (2 diffs)
- trunk/wp-admin/upgrade-schema.php (modified) (2 diffs)
- trunk/wp-content/themes/default/archive.php (modified) (2 diffs)
- trunk/wp-content/themes/default/style.css (modified) (2 diffs)
- trunk/wp-includes/classes.php (modified) (3 diffs)
- trunk/wp-includes/comment-template.php (modified) (1 diff)
- trunk/wp-includes/formatting.php (modified) (7 diffs)
- trunk/wp-includes/js/dbx.compressed.js (added)
- trunk/wp-includes/js/fat.compressed.js (added)
- trunk/wp-includes/js/prototype.compressed.js (added)
- trunk/wp-includes/js/quicktags.compressed.js (added)
- trunk/wp-includes/js/tw-sack.compressed.js (added)
- trunk/wp-includes/post.php (modified) (1 diff)
- trunk/wp-includes/query.php (modified) (2 diffs)
- trunk/xmlrpc.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/admin-ajax.php
r810 r817 156 156 die('-1'); 157 157 if ( $id < 0 ) { 158 if ( $pid = wp_insert_post() ) 158 $now = current_time('timestamp'); 159 if ( $pid = wp_insert_post( array( 160 'post_title' => sprintf('Draft created on %s at %s', date(get_option('date_format'), $now), date(get_option('time_format'), $now)) 161 ) ) ) 159 162 $mid = add_meta( $pid ); 160 163 else … … 182 185 $value = $_POST['meta'][$mid]['value']; 183 186 if ( !$meta = get_post_meta_by_id( $mid ) ) 184 die('0'); 187 die('0'); // if meta doesn't exist 185 188 if ( !current_user_can( 'edit_post', $meta->post_id ) ) 186 189 die('-1'); … … 196 199 $x->send(); 197 200 } 198 die(' 0');201 die('1'); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems). 199 202 break; 200 203 case 'add-user' : trunk/wp-admin/admin-functions.php
r816 r817 1269 1269 1270 1270 if (!$wp_rewrite->using_mod_rewrite_permalinks() ) 1271 return ;1271 return false; 1272 1272 1273 1273 if (!((!file_exists( $home_path.'.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path.'.htaccess' ) ) ) 1274 return ;1274 return false; 1275 1275 1276 1276 if (! got_mod_rewrite() ) 1277 return ;1277 return false; 1278 1278 1279 1279 $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() ); 1280 insert_with_markers( $home_path.'.htaccess', 'WordPress', $rules );1280 return insert_with_markers( $home_path.'.htaccess', 'WordPress', $rules ); 1281 1281 } 1282 1282 … … 2098 2098 return $post_id; 2099 2099 2100 $old_slugs = get_post_meta($post_id, '_wp_old_slug');2100 $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug'); 2101 2101 2102 2102 // if we haven't added this old slug before, add it now trunk/wp-admin/export.php
r816 r817 51 51 52 52 header('Content-Description: File Transfer'); 53 header('Content-Type: application/octet-stream');54 53 header("Content-Disposition: attachment; filename=$filename"); 55 header('Content-type: text/ wxr+xml; charset=' . get_option('blog_charset'), true);54 header('Content-type: text/xml; charset=' . get_option('blog_charset'), true); 56 55 57 56 $where = ''; … … 128 127 <!-- It contains information about your blog's posts, comments, and categories. --> 129 128 <!-- You may use this file to transfer that content from one site to another. --> 130 <!-- To import this information into a WordPress blog, --> 131 <!-- 1. Log into that blog as an administrator --> 132 <!-- 2. Go to Manage: Import in the blog's admin panels --> 133 <!-- 3. Choose "WordPress" from the list --> 134 <!-- 4. Upload this file using the form provided on that page --> 135 <!-- You will be taken through the simple import procedure. --> 129 <!-- This file is not intended to serve as a complete backup of your blog. --> 130 131 <!-- To import this information into a WordPress blog follow these steps. --> 132 <!-- 1. Log into that blog as an administrator. --> 133 <!-- 2. Go to Manage: Import in the blog's admin panels. --> 134 <!-- 3. Choose "WordPress" from the list. --> 135 <!-- 4. Upload this file using the form provided on that page. --> 136 <!-- 5. You will first be asked to map the authors in this export file to users --> 137 <!-- on the blog. For each author, you may choose to map to an --> 138 <!-- existing user on the blog or to create a new user --> 139 <!-- 6. WordPress will then import each of the posts, comments, and categories --> 140 <!-- contained in this file into your blog --> 136 141 137 142 <!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:m'); ?>"--> trunk/wp-admin/upgrade-schema.php
r810 r817 290 290 // 2.0 291 291 add_option('default_role', 'subscriber'); 292 add_option('rich_editing', 'true');293 292 add_option('db_version', $wp_db_version); 294 293 // 2.0.1 … … 311 310 312 311 // Delete unused options 313 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action' );312 $unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing'); 314 313 foreach ($unusedoptions as $option) : 315 314 delete_option($option); trunk/wp-content/themes/default/archive.php
r734 r817 7 7 <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> 8 8 <?php /* If this is a category archive */ if (is_category()) { ?> 9 <h2 class="pagetitle">Archive for the '<?php echo single_cat_title(); ?>'Category</h2>9 <h2 class="pagetitle">Archive for the ‘<?php echo single_cat_title(); ?>’ Category</h2> 10 10 11 11 <?php /* If this is a daily archive */ } elseif (is_day()) { ?> … … 41 41 </div> 42 42 43 <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> 43 <p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p> 44 44 45 45 </div> trunk/wp-content/themes/default/style.css
r731 r817 187 187 } 188 188 189 #wp-calendar #prev a {189 #wp-calendar #prev a, #wp-calendar #next a { 190 190 font-size: 9pt; 191 191 } … … 252 252 margin: 0 0 40px; 253 253 text-align: justify; 254 } 255 256 .post hr { 257 display: block; 254 258 } 255 259 trunk/wp-includes/classes.php
r810 r817 431 431 $cb_args = array_merge( array($output, $depth - 1), $args); 432 432 $output = call_user_func_array(array(&$this, 'start_lvl'), $cb_args); 433 } else { // If we've reached depth, end the previous element. 434 $cb_args = array_merge( array($output, $previous_element, $depth - 1), $args); 435 $output = call_user_func_array(array(&$this, 'end_el'), $cb_args); 433 436 } 434 437 } else if ( $element->$parent_field == $previous_element->$parent_field) { … … 501 504 502 505 $css_class = 'page_item'; 506 $_current_page = get_page( $current_page ); 503 507 if ( $page->ID == $current_page ) 504 508 $css_class .= ' current_page_item'; 509 elseif ( $_current_page && $page->ID == $_current_page->post_parent ) 510 $css_class .= ' current_page_parent'; 505 511 506 512 $output .= $indent . '<li class="' . $css_class . '"><a href="' . get_page_link($page->ID) . '" title="' . wp_specialchars($page->post_title, 1) . '">' . $page->post_title . '</a>'; … … 610 616 $link .= ' ' . gmdate('Y-m-d', $category->last_update_timestamp); 611 617 } 612 618 619 $_current_category = get_category( $current_category ); 620 613 621 if ( 'list' == $args['style'] ) { 614 622 $output .= "\t<li"; 615 623 if ( ($category->cat_ID == $current_category) && is_category() ) 616 624 $output .= ' class="current-cat"'; 625 elseif ( ($category->cat_ID == $_current_category->category_parent) && is_category() ) 626 $output .= ' class="current-cat-parent"'; 617 627 $output .= ">$link\n"; 618 628 } else { trunk/wp-includes/comment-template.php
r810 r817 291 291 } 292 292 293 $comments = apply_filters( 'comments_array', $comments, $post->ID ); 294 293 295 define('COMMENTS_TEMPLATE', true); 294 296 $include = apply_filters('comments_template', TEMPLATEPATH . $file ); trunk/wp-includes/formatting.php
r816 r817 33 33 // regular expressions 34 34 $curl = preg_replace($dynamic_characters, $dynamic_replacements, $curl); 35 } elseif ( strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd' || strstr($curl, '<style') || strstr($curl, '<script'))) {35 } elseif ( strstr($curl, '<code') || strstr($curl, '<pre') || strstr($curl, '<kbd') || strstr($curl, '<style') || strstr($curl, '<script') ) { 36 36 $next = false; 37 37 } else { … … 57 57 $pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee); 58 58 // Space things out a little 59 $pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|input|param|script)[^>]*>)!', "\n$1", $pee); 60 $pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6]|input|param|script)>)!', "$1\n\n", $pee); 59 $allblocks = '(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|style|script|object|input|param|p|h[1-6])'; 60 $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "\n$1", $pee); 61 $pee = preg_replace('!(</' . $allblocks . '>)!', "$1\n\n", $pee); 61 62 $pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines 62 63 $pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates 63 64 $pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end 64 65 $pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace 65 $pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag 66 $pee = preg_replace( '|<p>(<div[^>]*>\s*)|', "$1<p>", $pee ); 67 $pee = preg_replace('!<p>([^<]+)\s*?(</(?:div|address|form)[^>]*>)!', "<p>$1</p>$2", $pee); 68 $pee = preg_replace( '|<p>|', "$1<p>", $pee ); 69 $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag 66 70 $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists 67 71 $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee); 68 72 $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee); 69 $pee = preg_replace('!<p>\s*(</? (?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee);70 $pee = preg_replace('!(</? (?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);73 $pee = preg_replace('!<p>\s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee); 74 $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*</p>!', "$1", $pee); 71 75 if ($br) { 72 76 $pee = preg_replace('/<(script|style).*?<\/\\1>/se', 'str_replace("\n", "<WPPreserveNewline />", "\\0")', $pee); … … 74 78 $pee = str_replace('<WPPreserveNewline />', "\n", $pee); 75 79 } 76 $pee = preg_replace('!(</? (?:table|thead|tfoot|caption|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*<br />!', "$1", $pee);80 $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)\s*<br />!', "$1", $pee); 77 81 $pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee); 78 $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee); 79 82 if ( strstr( $pee, '<pre' ) ) 83 $pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee); 84 $pee = preg_replace( "|\n</p>$|", '</p>', $pee ); 85 /**/ 80 86 return $pee; 81 87 } … … 117 123 } 118 124 119 function utf8_uri_encode( $utf8_string ) {125 function utf8_uri_encode( $utf8_string, $length = 0 ) { 120 126 $unicode = ''; 121 127 $values = array(); … … 127 133 128 134 if ( $value < 128 ) { 135 if ( $length && ( strlen($unicode) + 1 > $length ) ) 136 break; 129 137 $unicode .= chr($value); 130 138 } else { … … 133 141 $values[] = $value; 134 142 143 if ( $length && ( (strlen($unicode) + ($num_octets * 3)) > $length ) ) 144 break; 135 145 if ( count( $values ) == $num_octets ) { 136 if ($num_octets == 3) {137 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);138 } else {139 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);140 }141 142 $values = array();143 $num_octets = 1;146 if ($num_octets == 3) { 147 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]); 148 } else { 149 $unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]); 150 } 151 152 $values = array(); 153 $num_octets = 1; 144 154 } 145 155 } … … 329 339 $title = mb_strtolower($title, 'UTF-8'); 330 340 } 331 $title = utf8_uri_encode($title );341 $title = utf8_uri_encode($title, 200); 332 342 } 333 343 trunk/wp-includes/post.php
r811 r817 1249 1249 else 1250 1250 $post_name = sanitize_title($post_name); 1251 1252 $post_name_check = 1253 $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$post_name' AND post_status = 'inherit' AND ID != '$post_ID' LIMIT 1"); 1254 1255 if ($post_name_check) { 1256 $suffix = 2; 1257 while ($post_name_check) { 1258 $alt_post_name = $post_name . "-$suffix"; 1259 $post_name_check = $wpdb->get_var("SELECT post_name FROM $wpdb->posts WHERE post_name = '$alt_post_name' AND post_status = 'inherit' AND ID != '$post_ID' AND post_parent = '$post_parent' LIMIT 1"); 1260 $suffix++; 1261 } 1262 $post_name = $alt_post_name; 1263 } 1251 1264 1252 1265 if (empty($post_date)) trunk/wp-includes/query.php
r816 r817 972 972 $distinct = apply_filters('posts_distinct', $distinct); 973 973 $fields = apply_filters('posts_fields', "$wpdb->posts.*"); 974 $limits = apply_filters( 'post_limits', $limits ); 974 975 $found_rows = ''; 975 976 if ( !empty($limits) ) 976 977 $found_rows = 'SQL_CALC_FOUND_ROWS'; 978 977 979 $request = " SELECT $found_rows $distinct $fields FROM $wpdb->posts $join WHERE 1=1 $where $groupby ORDER BY $orderby $limits"; 978 980 $this->request = apply_filters('posts_request', $request); … … 980 982 $this->posts = $wpdb->get_results($this->request); 981 983 if ( !empty($limits) ) { 982 $this->found_posts = $wpdb->get_var('SELECT FOUND_ROWS()'); 984 $found_posts_query = apply_filters( 'found_posts_query', 'SELECT FOUND_ROWS()' ); 985 $this->found_posts = $wpdb->get_var( $found_posts_query ); 986 $this->found_posts = apply_filters( 'found_posts', $this->found_posts ); 983 987 $this->max_num_pages = ceil($this->found_posts / $q['posts_per_page']); 984 988 } trunk/xmlrpc.php
r812 r817 406 406 return new IXR_Error(500, 'Sorry, your entry could not be posted. Something wrong happened.'); 407 407 } 408 $this->attach_uploads( $post_ID, $post_content ); 408 409 409 410 logIO('O', "Posted ! ID: $post_ID"); … … 455 456 return new IXR_Error(500, 'For some strange yet very annoying reason, this post could not be edited.'); 456 457 } 458 $this->attach_uploads( $ID, $post_content ); 457 459 458 460 return true; … … 575 577 } 576 578 579 $this->attach_uploads( $post_ID, $post_content ); 580 577 581 logIO('O', "Posted ! ID: $post_ID"); 578 582 … … 580 584 } 581 585 586 function attach_uploads( $post_ID, $post_content ) { 587 global $wpdb; 588 589 // find any unattached files 590 $attachments = $wpdb->get_results( "SELECT ID, guid FROM {$wpdb->posts} WHERE post_parent = '-1' AND post_type = 'attachment'" ); 591 if( is_array( $attachments ) ) { 592 foreach( $attachments as $file ) { 593 if( strpos( $post_content, $file->guid ) !== false ) { 594 $wpdb->query( "UPDATE {$wpdb->posts} SET post_parent = '$post_ID' WHERE ID = '{$file->ID}'" ); 595 } 596 } 597 } 598 } 582 599 583 600 /* metaweblog.editPost ...edits a post */ … … 654 671 return new IXR_Error(500, 'Sorry, your entry could not be edited. Something wrong happened.'); 655 672 } 673 $this->attach_uploads( $ID, $post_content ); 656 674 657 675 logIO('O',"(MW) Edited ! ID: $post_ID"); … … 852 870 return new IXR_Error(500, 'Could not write file '.$name); 853 871 } 872 // Construct the attachment array 873 // attach to post_id -1 874 $post_id = -1; 875 $attachment = array( 876 'post_title' => $name, 877 'post_content' => '', 878 'post_type' => 'attachment', 879 'post_parent' => $post_id, 880 'post_mime_type' => $type, 881 'guid' => $upload[ 'url' ] 882 ); 883 // Save the data 884 $id = wp_insert_attachment($attachment, $upload[ 'file' ], $post_id); 885 add_post_meta($id, '_wp_attachment_metadata', array()); 886 854 887 return apply_filters( 'wp_handle_upload', array( 'file' => $upload[ 'file' ], 'url' => $upload[ 'url' ], 'type' => $type ) ); 855 888 }
