Changeset 896
- Timestamp:
- 02/22/07 14:24:41 (2 years ago)
- Files:
-
- trunk/wp-admin/custom-header.php (modified) (1 diff)
- trunk/wp-admin/edit-pages.php (modified) (1 diff)
- trunk/wp-includes/functions.php (modified) (2 diffs)
- trunk/wp-includes/query.php (modified) (1 diff)
- trunk/xmlrpc.php (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/wp-admin/custom-header.php
r873 r896 287 287 $file = get_attached_file( $_POST['attachment_id'] ); 288 288 $medium = str_replace(basename($file), 'midsize-'.basename($file), $file); 289 @unlink( $medium ); 290 apply_filters( 'wp_delete_file', $medium ); 289 @unlink( apply_filters( 'wp_delete_file', $medium ) ); 291 290 wp_delete_attachment( $_POST['attachment_id'] ); 292 291 trunk/wp-admin/edit-pages.php
r828 r896 20 20 21 21 <?php 22 wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1 ');22 wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1&order=asc'); 23 23 24 24 if ( $_GET['s'] ) trunk/wp-includes/functions.php
r890 r896 1114 1114 } 1115 1115 1116 function wp_upload_bits($name, $type, $bits ) {1116 function wp_upload_bits($name, $type, $bits, $overwrite = false) { 1117 1117 if ( empty($name) ) 1118 1118 return array('error' => __("Empty filename")); … … 1135 1135 else 1136 1136 $ext = ".$ext"; 1137 while ( file_exists($upload['path'] . "/$filename") ) {1137 while ( file_exists($upload['path'] . "/$filename") && !$overwrite ) { 1138 1138 if ( '' == "$number$ext" ) 1139 1139 $filename = $filename . ++$number . $ext; trunk/wp-includes/query.php
r882 r896 766 766 } 767 767 $term = addslashes_gpc($q['s']); 768 if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) $search .= " OR (post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}')"; 769 770 $search = " AND ({$search}) "; 768 if (!$q['sentence'] && count($q['search_terms']) > 1 && $q['search_terms'][0] != $q['s'] ) 769 $search .= " OR (post_title LIKE '{$n}{$term}{$n}') OR (post_content LIKE '{$n}{$term}{$n}')"; 770 771 if ( !empty($search) ) 772 $search = " AND ({$search}) "; 771 773 } 772 774 trunk/xmlrpc.php
r885 r896 80 80 'wp.newCategory' => 'this:wp_newCategory', 81 81 'wp.suggestCategories' => 'this:wp_suggestCategories', 82 'wp.uploadFile' => 'this:mw_newMediaObject', // Alias 82 83 83 84 // Blogger API … … 423 424 SELECT ID page_id, 424 425 post_title page_title, 425 post_parent page_parent_id 426 post_parent page_parent_id, 427 post_date 426 428 FROM {$wpdb->posts} 427 429 WHERE post_type = 'page' 428 430 ORDER BY ID 429 431 "); 432 433 // The date needs to be formated properly. 434 $num_pages = count($page_list); 435 for($i = 0; $i < $num_pages; $i++) { 436 $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date); 437 $page_list[$i]->dateCreated = new IXR_Date($post_date); 438 439 unset($page_list[$i]->post_date); 440 } 430 441 431 442 return($page_list); … … 487 498 // If no parent_id was provided make it empty 488 499 // so that it will be a top level page (no parent). 489 if( empty($category["parent_id"])) {500 if(!isset($category["parent_id"])) { 490 501 $category["parent_id"] = ""; 491 502 } … … 948 959 949 960 // Only set a post parent if one was provided. 950 if( !empty($content_struct["wp_page_parent_id"])) {961 if(isset($content_struct["wp_page_parent_id"])) { 951 962 $post_parent = $content_struct["wp_page_parent_id"]; 952 963 } … … 988 999 $post_more = $content_struct['mt_text_more']; 989 1000 990 $comment_status = ( empty($content_struct['mt_allow_comments'])) ?1001 $comment_status = (!isset($content_struct['mt_allow_comments'])) ? 991 1002 get_option('default_comment_status') 992 1003 : $content_struct['mt_allow_comments']; 993 1004 994 $ping_status = ( empty($content_struct['mt_allow_pings'])) ?1005 $ping_status = (!isset($content_struct['mt_allow_pings'])) ? 995 1006 get_option('default_ping_status') 996 1007 : $content_struct['mt_allow_pings']; … … 1000 1011 } 1001 1012 1002 $to_ping = $content_struct['mt_tb_ping_urls']; 1013 $to_ping = $content_struct['mt_tb_ping_urls']; 1014 if ( is_array($to_ping) ) 1015 $to_ping = implode(' ', $to_ping); 1003 1016 1004 1017 // Do some timestamp voodoo … … 1162 1175 } 1163 1176 1164 $to_ping = $content_struct['mt_tb_ping_urls']; 1165 1166 $comment_status = (empty($content_struct['mt_allow_comments'])) ? 1177 $to_ping = $content_struct['mt_tb_ping_urls']; 1178 if ( is_array($to_ping) ) 1179 $to_ping = implode(' ', $to_ping); 1180 1181 $comment_status = (!isset($content_struct['mt_allow_comments'])) ? 1167 1182 get_option('default_comment_status') 1168 1183 : $content_struct['mt_allow_comments']; … … 1380 1395 $bits = $data['bits']; 1381 1396 1397 // Default to new file, not over write. 1398 $overwrite = false; 1399 if(!empty($data["overwrite"]) && ($data["overwrite"] == true)) { 1400 $overwrite = true; 1401 } 1402 1382 1403 logIO('O', '(MW) Received '.strlen($bits).' bytes'); 1383 1404 … … 1395 1416 return new IXR_Error(500, $upload_err); 1396 1417 1397 $upload = wp_upload_bits($name, $type, $bits );1418 $upload = wp_upload_bits($name, $type, $bits, $overwrite); 1398 1419 if ( ! empty($upload['error']) ) { 1399 1420 logIO('O', '(MW) Could not write file '.$name); … … 1411 1432 'guid' => $upload[ 'url' ] 1412 1433 ); 1413 // Save the data 1414 $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); 1415 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 1434 1435 // Only make a database entry if this is a new file. 1436 if(!$overwrite) { 1437 // Save the data 1438 $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id ); 1439 wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) ); 1440 } 1416 1441 1417 1442 return apply_filters( 'wp_handle_upload', array( 'file' => $upload[ 'file' ], 'url' => $upload[ 'url' ], 'type' => $type ) );
