From edd0071a6f00002b8724d5684291fe47038db416 Mon Sep 17 00:00:00 2001 From: azaozz Date: Mon, 29 Sep 2008 12:03:30 +0000 Subject: [PATCH] Fix "select all" checkboxes and upload.php git-svn-id: http://svn.automattic.com/wordpress/trunk@9029 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/edit-comments.php | 2 +- wp-admin/js/forms.js | 2 +- wp-admin/upload.php | 82 ++++++++++++++++++++++++++------------ 3 files changed, 58 insertions(+), 28 deletions(-) diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 4fac09b33b..77441d4167 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -14,7 +14,7 @@ wp_enqueue_script( 'admin-comments' ); wp_enqueue_script( 'admin-forms' ); wp_enqueue_script( 'jquery-table-hotkeys' ); -if ( isset( $_POST['delete_all_spam'] ) ) { +if ( isset( $_POST['delete_all_spam'] ) || isset( $_POST['delete_all_spam2'] ) ) { check_admin_referer('bulk-spam-delete'); $deleted_spam = $wpdb->query( "DELETE FROM $wpdb->comments WHERE comment_approved = 'spam'" ); diff --git a/wp-admin/js/forms.js b/wp-admin/js/forms.js index a586bd8016..add3de4dea 100644 --- a/wp-admin/js/forms.js +++ b/wp-admin/js/forms.js @@ -20,7 +20,7 @@ jQuery( function($) { lastClicked = this; return true; } ); - $( 'thead :checkbox' ).click( function() { + $( 'thead :checkbox, tfoot :checkbox' ).click( function() { checkAll( $(this).parents( 'form:first' ) ); } ); } ); diff --git a/wp-admin/upload.php b/wp-admin/upload.php index 312178e474..be0fb28002 100644 --- a/wp-admin/upload.php +++ b/wp-admin/upload.php @@ -8,8 +8,6 @@ /** WordPress Administration Bootstrap */ require_once('admin.php'); -//add_thickbox(); -wp_enqueue_script( 'media-upload' ); wp_enqueue_script( 'wp-ajax-response' ); wp_enqueue_script( 'jquery-ui-draggable' ); wp_enqueue_script( 'jquery-ui-resizable' ); @@ -56,15 +54,25 @@ if ( isset($_GET['find_detached'] ) ) { if ( ! empty($attach) ) { $attach = implode(',', $attach); $attached = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ($attach)", $parent_id) ); - - $message = sprintf( __ngettext('Added %1$s attachment to %2$s', 'Added %1$s attachments to %2$s', $attached, apply_filters( "the_title", $parent->post_title ) ) , $attached, apply_filters( "the_title", $parent->post_title ) ); } - $_GET['detached'] = 1; + if ( isset($attached) ) { + $location = 'upload.php'; + if ( $referer = wp_get_referer() ) { + if ( false !== strpos($referer, 'upload.php') ) + $location = $referer; + } + + $location = add_query_arg( array( 'detached' => 1, 'attached' => $attached ) , $location ); + wp_redirect($location); + exit; + } -} elseif ( isset($_GET['action']) && isset($_GET['media']) && isset($_GET['doaction']) ) { +} elseif ( isset($_GET['action']) && isset($_GET['media']) && ( -1 != $_GET['action'] || -1 != $_GET['action2'] ) ) { check_admin_referer('bulk-media'); - if ( $_GET['action'] == 'delete' ) { + $doaction = ( -1 != $_GET['action'] ) ? $_GET['action'] : $_GET['action2']; + + if ( 'delete' == $doaction ) { foreach( (array) $_GET['media'] as $post_id_del ) { $post_del = & get_post($post_id_del); @@ -87,9 +95,9 @@ if ( isset($_GET['find_detached'] ) ) { wp_redirect($location); exit; } -} elseif ( !empty($_GET['_wp_http_referer']) ) { - wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']))); - exit; +} elseif ( isset($_GET['_wp_http_referer']) && ! empty($_GET['_wp_http_referer']) ) { + wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), stripslashes($_SERVER['REQUEST_URI']) ) ); + exit; } $title = __('Media Library'); @@ -156,6 +164,12 @@ if ( isset($_GET['posted']) && (int) $_GET['posted'] ) { $_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']); } +if ( isset($_GET['attached']) && (int) $_GET['attached'] ) { + $attached = (int) $_GET['attached']; + $message = sprintf( __ngettext('Reattached %d attachment', 'Reattached %d attachments', $attached), $attached ); + $_SERVER['REQUEST_URI'] = remove_query_arg(array('attached'), $_SERVER['REQUEST_URI']); +} + $messages[1] = __('Media attachment updated.'); $messages[2] = __('Media deleted.'); $messages[3] = __('Error saving media attachment.'); @@ -293,14 +307,14 @@ if ( $page_links ) ?>
- + - + @@ -325,6 +339,15 @@ if ( $page_links ) + + + + + + + + + - +
- + - +

@@ -463,6 +477,22 @@ endif; // posts;
+