summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-02-22 14:24:41 +0000
committerdonncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36>2007-02-22 14:24:41 +0000
commit5fd2feb54c38fc6f357026aadd8abfd224631c26 (patch)
treee656773b126e32d85ba8d9578a6e7e5fff90652a
parentc463abff16013fb7b011758a314d444278212894 (diff)
downloadwordpress-mu-5fd2feb54c38fc6f357026aadd8abfd224631c26.tar.gz
wordpress-mu-5fd2feb54c38fc6f357026aadd8abfd224631c26.tar.xz
wordpress-mu-5fd2feb54c38fc6f357026aadd8abfd224631c26.zip
WP Merge to 4914
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@896 7be80a69-a1ef-0310-a953-fb0f7c49ff36
-rw-r--r--wp-admin/custom-header.php3
-rw-r--r--wp-admin/edit-pages.php2
-rw-r--r--wp-includes/functions.php4
-rw-r--r--wp-includes/query.php8
-rw-r--r--xmlrpc.php51
5 files changed, 47 insertions, 21 deletions
diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php
index 8b0ad34..4db9f71 100644
--- a/wp-admin/custom-header.php
+++ b/wp-admin/custom-header.php
@@ -286,8 +286,7 @@ Event.observe( window, 'load', hide_text );
// cleanup
$file = get_attached_file( $_POST['attachment_id'] );
$medium = str_replace(basename($file), 'midsize-'.basename($file), $file);
- @unlink( $medium );
- apply_filters( 'wp_delete_file', $medium );
+ @unlink( apply_filters( 'wp_delete_file', $medium ) );
wp_delete_attachment( $_POST['attachment_id'] );
return $this->finished();
diff --git a/wp-admin/edit-pages.php b/wp-admin/edit-pages.php
index 7076a73..627a031 100644
--- a/wp-admin/edit-pages.php
+++ b/wp-admin/edit-pages.php
@@ -19,7 +19,7 @@ require_once('admin-header.php');
</form>
<?php
-wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1');
+wp('post_type=page&orderby=menu_order&what_to_show=posts&posts_per_page=-1&posts_per_archive_page=-1&order=asc');
if ( $_GET['s'] )
$all = false;
diff --git a/wp-includes/functions.php b/wp-includes/functions.php
index 0a43602..aaaefc1 100644
--- a/wp-includes/functions.php
+++ b/wp-includes/functions.php
@@ -1113,7 +1113,7 @@ function wp_upload_dir() {
return apply_filters('upload_dir', $uploads);
}
-function wp_upload_bits($name, $type, $bits) {
+function wp_upload_bits($name, $type, $bits, $overwrite = false) {
if ( empty($name) )
return array('error' => __("Empty filename"));
@@ -1134,7 +1134,7 @@ function wp_upload_bits($name, $type, $bits) {
$ext = '';
else
$ext = ".$ext";
- while ( file_exists($upload['path'] . "/$filename") ) {
+ while ( file_exists($upload['path'] . "/$filename") && !$overwrite ) {
if ( '' == "$number$ext" )
$filename = $filename . ++$number . $ext;
else
diff --git a/wp-includes/query.php b/wp-includes/query.php
index 01a28a9..b93b5bb 100644
--- a/wp-includes/query.php
+++ b/wp-includes/query.php
@@ -765,9 +765,11 @@ class WP_Query {
$searchand = ' AND ';
}
$term = addslashes_gpc($q['s']);
- 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}')";
-
- $search = " AND ({$search}) ";
+ 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}')";
+
+ if ( !empty($search) )
+ $search = " AND ({$search}) ";
}
// Category stuff
diff --git a/xmlrpc.php b/xmlrpc.php
index 5242742..aede600 100644
--- a/xmlrpc.php
+++ b/xmlrpc.php
@@ -79,6 +79,7 @@ class wp_xmlrpc_server extends IXR_Server {
'wp.getCategories' => 'this:mw_getCategories', // Alias
'wp.newCategory' => 'this:wp_newCategory',
'wp.suggestCategories' => 'this:wp_suggestCategories',
+ 'wp.uploadFile' => 'this:mw_newMediaObject', // Alias
// Blogger API
'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
@@ -422,12 +423,22 @@ class wp_xmlrpc_server extends IXR_Server {
$page_list = $wpdb->get_results("
SELECT ID page_id,
post_title page_title,
- post_parent page_parent_id
+ post_parent page_parent_id,
+ post_date
FROM {$wpdb->posts}
WHERE post_type = 'page'
ORDER BY ID
");
+ // The date needs to be formated properly.
+ $num_pages = count($page_list);
+ for($i = 0; $i < $num_pages; $i++) {
+ $post_date = mysql2date("Ymd\TH:i:s", $page_list[$i]->post_date);
+ $page_list[$i]->dateCreated = new IXR_Date($post_date);
+
+ unset($page_list[$i]->post_date);
+ }
+
return($page_list);
}
@@ -486,7 +497,7 @@ class wp_xmlrpc_server extends IXR_Server {
// If no parent_id was provided make it empty
// so that it will be a top level page (no parent).
- if(empty($category["parent_id"])) {
+ if(!isset($category["parent_id"])) {
$category["parent_id"] = "";
}
@@ -947,7 +958,7 @@ class wp_xmlrpc_server extends IXR_Server {
}
// Only set a post parent if one was provided.
- if(!empty($content_struct["wp_page_parent_id"])) {
+ if(isset($content_struct["wp_page_parent_id"])) {
$post_parent = $content_struct["wp_page_parent_id"];
}
@@ -987,11 +998,11 @@ class wp_xmlrpc_server extends IXR_Server {
$post_excerpt = $content_struct['mt_excerpt'];
$post_more = $content_struct['mt_text_more'];
- $comment_status = (empty($content_struct['mt_allow_comments'])) ?
+ $comment_status = (!isset($content_struct['mt_allow_comments'])) ?
get_option('default_comment_status')
: $content_struct['mt_allow_comments'];
- $ping_status = (empty($content_struct['mt_allow_pings'])) ?
+ $ping_status = (!isset($content_struct['mt_allow_pings'])) ?
get_option('default_ping_status')
: $content_struct['mt_allow_pings'];
@@ -999,7 +1010,9 @@ class wp_xmlrpc_server extends IXR_Server {
$post_content = $post_content . "\n<!--more-->\n" . $post_more;
}
- $to_ping = $content_struct['mt_tb_ping_urls'];
+ $to_ping = $content_struct['mt_tb_ping_urls'];
+ if ( is_array($to_ping) )
+ $to_ping = implode(' ', $to_ping);
// Do some timestamp voodoo
$dateCreatedd = $content_struct['dateCreated'];
@@ -1161,9 +1174,11 @@ class wp_xmlrpc_server extends IXR_Server {
$post_content = $post_content . "\n<!--more-->\n" . $post_more;
}
- $to_ping = $content_struct['mt_tb_ping_urls'];
-
- $comment_status = (empty($content_struct['mt_allow_comments'])) ?
+ $to_ping = $content_struct['mt_tb_ping_urls'];
+ if ( is_array($to_ping) )
+ $to_ping = implode(' ', $to_ping);
+
+ $comment_status = (!isset($content_struct['mt_allow_comments'])) ?
get_option('default_comment_status')
: $content_struct['mt_allow_comments'];
@@ -1379,6 +1394,12 @@ class wp_xmlrpc_server extends IXR_Server {
$type = $data['type'];
$bits = $data['bits'];
+ // Default to new file, not over write.
+ $overwrite = false;
+ if(!empty($data["overwrite"]) && ($data["overwrite"] == true)) {
+ $overwrite = true;
+ }
+
logIO('O', '(MW) Received '.strlen($bits).' bytes');
if ( !$this->login_pass_ok($user_login, $user_pass) )
@@ -1394,7 +1415,7 @@ class wp_xmlrpc_server extends IXR_Server {
if ( $upload_err = apply_filters( "pre_upload_error", false ) )
return new IXR_Error(500, $upload_err);
- $upload = wp_upload_bits($name, $type, $bits);
+ $upload = wp_upload_bits($name, $type, $bits, $overwrite);
if ( ! empty($upload['error']) ) {
logIO('O', '(MW) Could not write file '.$name);
return new IXR_Error(500, 'Could not write file '.$name);
@@ -1410,9 +1431,13 @@ class wp_xmlrpc_server extends IXR_Server {
'post_mime_type' => $type,
'guid' => $upload[ 'url' ]
);
- // Save the data
- $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
- wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
+
+ // Only make a database entry if this is a new file.
+ if(!$overwrite) {
+ // Save the data
+ $id = wp_insert_attachment( $attachment, $upload[ 'file' ], $post_id );
+ wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $upload['file'] ) );
+ }
return apply_filters( 'wp_handle_upload', array( 'file' => $upload[ 'file' ], 'url' => $upload[ 'url' ], 'type' => $type ) );
}