Changeset 896

Show
Ignore:
Timestamp:
02/22/07 14:24:41 (2 years ago)
Author:
donncha
Message:

WP Merge to 4914

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/custom-header.php

    r873 r896  
    287287                $file = get_attached_file( $_POST['attachment_id'] ); 
    288288                $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 ) ); 
    291290                wp_delete_attachment( $_POST['attachment_id'] ); 
    292291 
  • trunk/wp-admin/edit-pages.php

    r828 r896  
    2020 
    2121<?php 
    22 wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1'); 
     22wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1&order=asc'); 
    2323 
    2424if ( $_GET['s'] ) 
  • trunk/wp-includes/functions.php

    r890 r896  
    11141114} 
    11151115 
    1116 function wp_upload_bits($name, $type, $bits) { 
     1116function wp_upload_bits($name, $type, $bits, $overwrite = false) { 
    11171117        if ( empty($name) ) 
    11181118                return array('error' => __("Empty filename")); 
     
    11351135        else 
    11361136                $ext = ".$ext"; 
    1137         while ( file_exists($upload['path'] . "/$filename") ) { 
     1137        while ( file_exists($upload['path'] . "/$filename") && !$overwrite ) { 
    11381138                if ( '' == "$number$ext" ) 
    11391139                        $filename = $filename . ++$number . $ext; 
  • trunk/wp-includes/query.php

    r882 r896  
    766766                        } 
    767767                        $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}) "; 
    771773                } 
    772774 
  • trunk/xmlrpc.php

    r885 r896  
    8080                        'wp.newCategory'                => 'this:wp_newCategory', 
    8181                        'wp.suggestCategories'  => 'this:wp_suggestCategories', 
     82                        'wp.uploadFile'                 => 'this:mw_newMediaObject',    // Alias 
    8283 
    8384                        // Blogger API 
     
    423424                        SELECT ID page_id, 
    424425                                post_title page_title, 
    425                                 post_parent page_parent_id 
     426                                post_parent page_parent_id, 
     427                                post_date 
    426428                        FROM {$wpdb->posts} 
    427429                        WHERE post_type = 'page' 
    428430                        ORDER BY ID 
    429431                "); 
     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                } 
    430441 
    431442                return($page_list); 
     
    487498                // If no parent_id was provided make it empty 
    488499                // so that it will be a top level page (no parent). 
    489                 if(empty($category["parent_id"])) { 
     500                if(!isset($category["parent_id"])) { 
    490501                        $category["parent_id"] = ""; 
    491502                } 
     
    948959 
    949960                // 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"])) { 
    951962                        $post_parent = $content_struct["wp_page_parent_id"]; 
    952963                } 
     
    988999          $post_more = $content_struct['mt_text_more']; 
    9891000 
    990           $comment_status = (empty($content_struct['mt_allow_comments'])) ? 
     1001          $comment_status = (!isset($content_struct['mt_allow_comments'])) ? 
    9911002            get_option('default_comment_status') 
    9921003            : $content_struct['mt_allow_comments']; 
    9931004 
    994           $ping_status = (empty($content_struct['mt_allow_pings'])) ? 
     1005          $ping_status = (!isset($content_struct['mt_allow_pings'])) ? 
    9951006            get_option('default_ping_status') 
    9961007            : $content_struct['mt_allow_pings']; 
     
    10001011          } 
    10011012 
    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); 
    10031016 
    10041017          // Do some timestamp voodoo 
     
    11621175          } 
    11631176 
    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'])) ? 
    11671182            get_option('default_comment_status') 
    11681183            : $content_struct['mt_allow_comments']; 
     
    13801395                $bits = $data['bits']; 
    13811396 
     1397                // Default to new file, not over write. 
     1398                $overwrite = false; 
     1399                if(!empty($data["overwrite"]) && ($data["overwrite"] == true)) { 
     1400                        $overwrite = true; 
     1401                } 
     1402 
    13821403                logIO('O', '(MW) Received '.strlen($bits).' bytes'); 
    13831404 
     
    13951416                        return new IXR_Error(500, $upload_err); 
    13961417 
    1397                 $upload = wp_upload_bits($name, $type, $bits); 
     1418                $upload = wp_upload_bits($name, $type, $bits, $overwrite); 
    13981419                if ( ! empty($upload['error']) ) { 
    13991420                        logIO('O', '(MW) Could not write file '.$name); 
     
    14111432                        'guid' => $upload[ 'url' ] 
    14121433                ); 
    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                } 
    14161441 
    14171442                return apply_filters( 'wp_handle_upload', array( 'file' => $upload[ 'file' ], 'url' => $upload[ 'url' ], 'type' => $type ) );