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) { - +
  • 'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types').""; foreach ( $post_mime_types as $mime_type => $label ) { $class = ''; @@ -1730,7 +1737,7 @@ foreach ( $post_mime_types as $mime_type => $label ) { if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) continue; - if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) + if ( isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) $class = ' class="current"'; $type_links[] = "
  • $mime_type, 'paged'=>false))) . "'$class>" . sprintf(_n($label[2][0], $label[2][1], $num_posts[$mime_type]), "" . number_format_i18n( $num_posts[$mime_type] ) . '') . ''; diff --git a/wp-admin/media.php b/wp-admin/media.php index 906238f7d..a22da8a4d 100644 --- a/wp-admin/media.php +++ b/wp-admin/media.php @@ -94,7 +94,7 @@ case 'edit' :

    - +