Ticket #9393: 9393-media-fixes.2.diff
| File 9393-media-fixes.2.diff, 4.1 KB (added by , 17 years ago) |
|---|
-
wp-admin/media.php
94 94 95 95 <p class="submit"> 96 96 <input type="submit" class="button-primary" name="save" value="<?php _e('Update Media'); ?>" /> 97 <input type="hidden" name="post_id" id="post_id" value="<?php echo $post_id; ?>" />97 <input type="hidden" name="post_id" id="post_id" value="<?php echo isset($post_id) ? $post_id : ''; ?>" /> 98 98 <input type="hidden" name="attachment_id" id="attachment_id" value="<?php echo $att_id; ?>" /> 99 99 <input type="hidden" name="action" value="editattachment" /> 100 100 <?php wp_original_referer_field(true, 'previous'); ?> -
wp-admin/includes/media.php
397 397 if ( isset($post['errors']) ) { 398 398 $errors[$attachment_id] = $post['errors']; 399 399 unset($post['errors']); 400 } else { 401 $errors = array(); 400 402 } 401 403 402 404 if ( $post != $_post ) … … 988 990 'label' => __('File URL'), 989 991 'input' => 'html', 990 992 'html' => "<input type='text' class='urlfield' readonly='readonly' name='attachments[$post->ID][url]' value='" . attribute_escape($image_url) . "' /><br />", 991 'value' => $edit_post->post_url,993 'value' => isset($edit_post->post_url) ? $edit_post->post_url : '', 992 994 'helps' => __('Location of the uploaded file.'), 993 995 ) 994 996 ); … … 1223 1225 foreach ( $hidden_fields as $name => $value ) 1224 1226 $item .= "\t<input type='hidden' name='$name' id='$name' value='" . attribute_escape( $value ) . "' />\n"; 1225 1227 1226 if ( $post->post_parent < 1 && (int) $_REQUEST['post_id']) {1228 if ( $post->post_parent < 1 && isset($_REQUEST['post_id']) ) { 1227 1229 $parent = (int) $_REQUEST['post_id']; 1228 1230 $parent_name = "attachments[$attachment_id][post_parent]"; 1229 1231 … … 1701 1703 <input type="hidden" name="type" value="<?php echo attribute_escape( $type ); ?>" /> 1702 1704 <input type="hidden" name="tab" value="<?php echo attribute_escape( $tab ); ?>" /> 1703 1705 <input type="hidden" name="post_id" value="<?php echo (int) $post_id; ?>" /> 1704 <input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" />1706 <input type="hidden" name="post_mime_type" value="<?php echo isset( $_GET['post_mime_type'] ) ? attribute_escape( $_GET['post_mime_type'] ) : ''; ?>" /> 1705 1707 1706 1708 <p id="media-search" class="search-box"> 1707 1709 <label class="hidden" for="media-search-input"><?php _e('Search Media');?>:</label> … … 1716 1718 $matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts)); 1717 1719 foreach ( $matches as $_type => $reals ) 1718 1720 foreach ( $reals as $real ) 1719 $num_posts[$_type] += $_num_posts[$real]; 1721 if ( isset($num_posts[$_type]) ) 1722 $num_posts[$_type] += $_num_posts[$real]; 1723 else 1724 $num_posts[$_type] = $_num_posts[$real]; 1720 1725 // If available type specified by media button clicked, filter by that type 1721 1726 if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) { 1722 1727 $_GET['post_mime_type'] = $type; … … 1724 1729 } 1725 1730 if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' ) 1726 1731 $class = ' class="current"'; 1732 else 1733 $class = ''; 1727 1734 $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>"; 1728 1735 foreach ( $post_mime_types as $mime_type => $label ) { 1729 1736 $class = ''; … … 1731 1738 if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) 1732 1739 continue; 1733 1740 1734 if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )1741 if ( isset($_GET['post_mime_type']) && wp_match_mime_types($mime_type, $_GET['post_mime_type']) ) 1735 1742 $class = ' class="current"'; 1736 1743 1737 1744 $type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf(_n($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';