diff --git a/wp-admin/admin.php b/wp-admin/admin.php
index 503e4ed2d..ac7f08b19 100644
--- a/wp-admin/admin.php
+++ b/wp-admin/admin.php
@@ -11,7 +11,8 @@
*
* @since unknown
*/
-define('WP_ADMIN', TRUE);
+if ( !defined('WP_ADMIN') )
+ define('WP_ADMIN', TRUE);
if ( defined('ABSPATH') )
require_once(ABSPATH . 'wp-load.php');
diff --git a/wp-admin/includes/media.php b/wp-admin/includes/media.php
index 0f427271a..1202b3291 100644
--- a/wp-admin/includes/media.php
+++ b/wp-admin/includes/media.php
@@ -396,6 +396,8 @@ function media_upload_form_handler() {
if ( isset($post['errors']) ) {
$errors[$attachment_id] = $post['errors'];
unset($post['errors']);
+ } else {
+ $errors = array();
}
if ( $post != $_post )
@@ -429,7 +431,7 @@ function media_upload_form_handler() {
return media_send_to_editor($html);
}
- return $errors;
+ return isset($errors) ? $errors : '';
}
/**
@@ -987,7 +989,7 @@ function get_attachment_fields_to_edit($post, $errors = null) {
'label' => __('File URL'),
'input' => 'html',
'html' => "
",
- 'value' => $edit_post->post_url,
+ 'value' => isset($edit_post->post_url) ? $edit_post->post_url : '',
'helps' => __('Location of the uploaded file.'),
)
);
@@ -1222,7 +1224,7 @@ function get_media_item( $attachment_id, $args = null ) {
foreach ( $hidden_fields as $name => $value )
$item .= "\t\n";
- if ( $post->post_parent < 1 && (int) $_REQUEST['post_id'] ) {
+ if ( $post->post_parent < 1 && isset($_REQUEST['post_id']) ) {
$parent = (int) $_REQUEST['post_id'];
$parent_name = "attachments[$attachment_id][post_parent]";
@@ -1700,7 +1702,7 @@ function media_upload_library_form($errors) {
-
+
@@ -1715,7 +1717,10 @@ $_num_posts = (array) wp_count_attachments(); $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts)); foreach ( $matches as $_type => $reals ) foreach ( $reals as $real ) - $num_posts[$_type] += $_num_posts[$real]; + if ( isset($num_posts[$_type]) ) + $num_posts[$_type] += $_num_posts[$real]; + else + $num_posts[$_type] = $_num_posts[$real]; // If available type specified by media button clicked, filter by that type if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) { $_GET['post_mime_type'] = $type; @@ -1723,6 +1728,8 @@ if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) { } if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' ) $class = ' class="current"'; +else + $class = ''; $type_links[] = "
- +