Changeset 15642
- Timestamp:
- 09/22/2010 12:10:39 AM (14 years ago)
- Location:
- trunk/wp-admin
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit-comments.php
r15596 r15642 13 13 $wp_list_table->check_permissions(); 14 14 15 if ( isset( $_REQUEST['doaction'] ) || isset( $_REQUEST['doaction2'] ) || isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { 15 $doaction = $wp_list_table->current_action(); 16 17 if ( $doaction ) { 16 18 check_admin_referer( 'bulk-comments' ); 17 19 18 if ( ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )&& !empty( $_REQUEST['pagegen_timestamp'] ) ) {20 if ( 'delete_all' == $do_action && !empty( $_REQUEST['pagegen_timestamp'] ) ) { 19 21 $comment_status = $wpdb->escape( $_REQUEST['comment_status'] ); 20 22 $delete_time = $wpdb->escape( $_REQUEST['pagegen_timestamp'] ); 21 23 $comment_ids = $wpdb->get_col( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = '$comment_status' AND '$delete_time' > comment_date_gmt" ); 22 24 $doaction = 'delete'; 23 } elseif ( ( $_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1 ) &&isset( $_REQUEST['delete_comments'] ) ) {25 } elseif ( isset( $_REQUEST['delete_comments'] ) ) { 24 26 $comment_ids = $_REQUEST['delete_comments']; 25 27 $doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2']; 26 } elseif ( $_REQUEST['doaction'] == 'undo' &&isset( $_REQUEST['ids'] ) ) {28 } elseif ( isset( $_REQUEST['ids'] ) ) { 27 29 $comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) ); 28 $doaction = $_REQUEST['action'];29 30 } else { 30 31 wp_redirect( wp_get_referer() ); -
trunk/wp-admin/edit-tags.php
r15528 r15642 23 23 } 24 24 25 if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' == $_REQUEST['action'] || 'delete' == $_REQUEST['action2'] ) ) 26 $action = 'bulk-delete'; 27 28 switch ( $action ) { 25 switch ( $wp_list_table->current_action() ) { 29 26 30 27 case 'add-tag': -
trunk/wp-admin/edit.php
r15578 r15642 22 22 23 23 // Handle bulk actions 24 if ( isset($_REQUEST['doaction']) || isset($_REQUEST['doaction2']) || isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2']) || isset($_REQUEST['bulk_edit']) ) { 24 $doaction = $wp_list_table->current_action(); 25 26 if ( $doaction ) { 25 27 check_admin_referer('bulk-posts'); 26 28 $sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), wp_get_referer() ); … … 29 31 $sendback = admin_url($post_new_file); 30 32 31 if ( isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2']) ) { 32 $post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']); 33 $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) ); 33 if ( 'delete_all' == $doaction ) { 34 $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" ); 34 35 $doaction = 'delete'; 35 } elseif ( ( $_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1 ) && ( isset($_REQUEST['post']) || isset($_REQUEST['ids']) ) ) { 36 $post_ids = isset($_REQUEST['post']) ? array_map( 'intval', (array) $_REQUEST['post'] ) : explode(',', $_REQUEST['ids']); 37 $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2']; 38 } else { 36 } elseif ( isset( $_REQUEST['media'] ) ) { 37 $post_ids = $_REQUEST['media']; 38 } elseif ( isset( $_REQUEST['ids'] ) ) { 39 $post_ids = explode( ',', $_REQUEST['ids'] ); 40 } 41 42 if ( !isset( $post_ids ) ) { 39 43 wp_redirect( admin_url("edit.php?post_type=$post_type") ); 40 44 } … … 98 102 } 99 103 100 if ( isset($_REQUEST['action']) ) 101 $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback ); 104 $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback ); 102 105 103 106 wp_redirect($sendback); -
trunk/wp-admin/includes/default-list-tables.php
r15633 r15642 214 214 <?php 215 215 } 216 } 217 218 function current_action() { 219 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) 220 return 'delete_all'; 221 222 return parent::current_action(); 216 223 } 217 224 … … 1081 1088 } 1082 1089 1090 function current_action() { 1091 if ( isset( $_REQUEST['find_detached'] ) ) 1092 return 'find_detached'; 1093 1094 if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) 1095 return 'attach'; 1096 1097 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) 1098 return 'delete_all'; 1099 1100 return parent::current_action(); 1101 } 1102 1083 1103 function has_items() { 1084 1104 return have_posts(); … … 1483 1503 } 1484 1504 1505 function current_action() { 1506 if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && ( 'delete' == $_REQUEST['action'] || 'delete' == $_REQUEST['action2'] ) ) 1507 return 'bulk-delete'; 1508 1509 return parent::current_action(); 1510 } 1511 1485 1512 function get_columns() { 1486 1513 global $taxonomy; … … 1861 1888 </div> 1862 1889 <?php 1890 } 1891 1892 function current_action() { 1893 if ( isset($_REQUEST['changeit']) && !empty($_REQUEST['new_role']) ) 1894 return 'promote'; 1895 1896 return parent::current_action(); 1863 1897 } 1864 1898 … … 2213 2247 do_action( 'manage_comments_nav', $comment_status ); 2214 2248 echo '</div>'; 2249 } 2250 2251 function current_action() { 2252 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) 2253 return 'delete_all'; 2254 2255 return parent::current_action(); 2215 2256 } 2216 2257 … … 3459 3500 } 3460 3501 3502 function current_action() { 3503 if ( isset($_POST['clear-recent-list']) ) 3504 return 'clear-recent-list'; 3505 3506 return parent::current_action(); 3507 } 3508 3461 3509 function display_rows() { 3462 3510 global $status, $page; -
trunk/wp-admin/includes/list-table.php
r15629 r15642 245 245 246 246 echo "<input type='submit' value='" . esc_attr__( 'Apply' ) . "' name='doaction$two' id='doaction$two' class='button-secondary action' />\n"; 247 } 248 249 /** 250 * Get the current action selected from the bulk actions dropdown. 251 * 252 * @since 3.1.0 253 * @access public 254 * 255 * @return string|bool The action name or False if no action was selected 256 */ 257 function current_action() { 258 if ( isset( $_REQUEST['action'] ) && -1 != $_REQUEST['action'] ) 259 return $_REQUEST['action']; 260 261 if ( isset( $_REQUEST['action2'] ) && -1 != $_REQUEST['action2'] ) 262 return $_REQUEST['action2']; 263 264 return false; 247 265 } 248 266 -
trunk/wp-admin/link-manager.php
r15528 r15642 14 14 15 15 // Handle bulk deletes 16 if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['linkcheck'] ) ) { 16 $doaction = $wp_list_table->current_action(); 17 18 if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) { 17 19 check_admin_referer( 'bulk-bookmarks' ); 18 19 $doaction = $_REQUEST['action'] ? $_REQUEST['action'] : $_REQUEST['action2'];20 20 21 21 if ( 'delete' == $doaction ) { -
trunk/wp-admin/plugins.php
r15578 r15642 13 13 $wp_list_table->check_permissions(); 14 14 15 if ( isset($_POST['clear-recent-list']) ) 16 $action = 'clear-recent-list'; 17 elseif ( !empty($_REQUEST['action']) ) 18 $action = $_REQUEST['action']; 19 elseif ( !empty($_REQUEST['action2']) ) 20 $action = $_REQUEST['action2']; 21 else 22 $action = false; 15 $action = $wp_list_table->current_action(); 23 16 24 17 $plugin = isset($_REQUEST['plugin']) ? $_REQUEST['plugin'] : ''; 25 18 26 // Clean up request URI from temporary args for screen options/paging uri's to work as expected.19 // Clean up request URI from temporary args for screen options/paging uri's to work as expected. 27 20 $_SERVER['REQUEST_URI'] = remove_query_arg(array('error', 'deleted', 'activate', 'activate-multi', 'deactivate', 'deactivate-multi', '_error_nonce'), $_SERVER['REQUEST_URI']); 28 21 29 if ( !empty($action)) {22 if ( $action ) { 30 23 $network_wide = false; 31 24 if ( ( isset( $_GET['networkwide'] ) || 'network-activate-selected' == $action ) && is_multisite() && current_user_can( 'manage_network_plugins' ) ) -
trunk/wp-admin/upload.php
r15578 r15642 14 14 15 15 // Handle bulk actions 16 if ( isset($_REQUEST['find_detached']) ) { 16 $doaction = $wp_list_table->current_action(); 17 18 if ( $doaction ) { 17 19 check_admin_referer('bulk-media'); 18 20 19 if ( !current_user_can('edit_posts') ) 20 wp_die( __('You are not allowed to scan for lost attachments.') ); 21 22 $lost = $wpdb->get_col( " 23 SELECT ID FROM $wpdb->posts 24 WHERE post_type = 'attachment' AND post_parent > '0' 25 AND post_parent NOT IN ( 26 SELECT ID FROM $wpdb->posts 27 WHERE post_type NOT IN ( 'attachment', '" . join( "', '", get_post_types( array( 'public' => false ) ) ) . "' ) 28 ) 29 " ); 30 31 $_REQUEST['detached'] = 1; 32 33 } elseif ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) { 34 check_admin_referer( 'bulk-media' ); 35 36 $parent_id = (int) $_REQUEST['found_post_id']; 37 if ( !$parent_id ) 38 return; 39 40 $parent = &get_post( $parent_id ); 41 if ( !current_user_can( 'edit_post', $parent_id ) ) 42 wp_die( __( 'You are not allowed to edit this post.' ) ); 43 44 $attach = array(); 45 foreach ( (array) $_REQUEST['media'] as $att_id ) { 46 $att_id = (int) $att_id; 47 48 if ( !current_user_can( 'edit_post', $att_id ) ) 49 continue; 50 51 $attach[] = $att_id; 52 clean_attachment_cache( $att_id ); 53 } 54 55 if ( ! empty( $attach ) ) { 56 $attach = implode( ',', $attach ); 57 $attached = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $attach )", $parent_id ) ); 58 } 59 60 if ( isset( $attached ) ) { 61 $location = 'upload.php'; 62 if ( $referer = wp_get_referer() ) { 63 if ( false !== strpos( $referer, 'upload.php' ) ) 64 $location = $referer; 65 } 66 67 $location = add_query_arg( array( 'attached' => $attached ) , $location ); 68 wp_redirect( $location ); 69 exit; 70 } 71 72 } elseif ( isset( $_REQUEST['doaction'] ) || isset( $_REQUEST['doaction2'] ) || isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { 73 check_admin_referer( 'bulk-media' ); 74 75 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { 21 if ( 'delete_all' == $doaction ) { 76 22 $post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" ); 77 23 $doaction = 'delete'; 78 } elseif ( ( $_REQUEST['action'] != -1 || $_REQUEST['action2'] != -1 ) && ( isset( $_REQUEST['media'] ) || isset( $_REQUEST['ids'] ) ) ) { 79 $post_ids = isset( $_REQUEST['media'] ) ? $_REQUEST['media'] : explode( ',', $_REQUEST['ids'] ); 80 $doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2']; 81 } else { 82 wp_redirect( $_SERVER['HTTP_REFERER'] ); 24 } elseif ( isset( $_REQUEST['media'] ) ) { 25 $post_ids = $_REQUEST['media']; 26 } elseif ( isset( $_REQUEST['ids'] ) ) { 27 $post_ids = explode( ',', $_REQUEST['ids'] ); 83 28 } 84 29 … … 90 35 91 36 switch ( $doaction ) { 37 case 'find_detached': 38 if ( !current_user_can('edit_posts') ) 39 wp_die( __('You are not allowed to scan for lost attachments.') ); 40 41 $lost = $wpdb->get_col( " 42 SELECT ID FROM $wpdb->posts 43 WHERE post_type = 'attachment' AND post_parent > '0' 44 AND post_parent NOT IN ( 45 SELECT ID FROM $wpdb->posts 46 WHERE post_type NOT IN ( 'attachment', '" . join( "', '", get_post_types( array( 'public' => false ) ) ) . "' ) 47 ) 48 " ); 49 50 $_REQUEST['detached'] = 1; 51 break; 52 case 'attach': 53 $parent_id = (int) $_REQUEST['found_post_id']; 54 if ( !$parent_id ) 55 return; 56 57 $parent = &get_post( $parent_id ); 58 if ( !current_user_can( 'edit_post', $parent_id ) ) 59 wp_die( __( 'You are not allowed to edit this post.' ) ); 60 61 $attach = array(); 62 foreach ( (array) $_REQUEST['media'] as $att_id ) { 63 $att_id = (int) $att_id; 64 65 if ( !current_user_can( 'edit_post', $att_id ) ) 66 continue; 67 68 $attach[] = $att_id; 69 clean_attachment_cache( $att_id ); 70 } 71 72 if ( ! empty( $attach ) ) { 73 $attach = implode( ',', $attach ); 74 $attached = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts SET post_parent = %d WHERE post_type = 'attachment' AND ID IN ( $attach )", $parent_id ) ); 75 } 76 77 if ( isset( $attached ) ) { 78 $location = 'upload.php'; 79 if ( $referer = wp_get_referer() ) { 80 if ( false !== strpos( $referer, 'upload.php' ) ) 81 $location = $referer; 82 } 83 84 $location = add_query_arg( array( 'attached' => $attached ) , $location ); 85 wp_redirect( $location ); 86 exit; 87 } 88 break; 92 89 case 'trash': 93 90 foreach ( (array) $post_ids as $post_id ) { -
trunk/wp-admin/users.php
r15578 r15642 30 30 ); 31 31 32 $update = $doaction = '';33 if ( isset($_REQUEST['action']) )34 $doaction = $_REQUEST['action'] ? $_REQUEST['action'] : $_REQUEST['action2'];35 36 if ( "-1" == $doaction ) {37 if ( isset($_REQUEST['changeit']) && !empty($_REQUEST['new_role']) )38 $doaction = 'promote';39 }40 41 32 if ( empty($_REQUEST) ) { 42 33 $referer = '<input type="hidden" name="wp_http_referer" value="'. esc_attr(stripslashes($_SERVER['REQUEST_URI'])) . '" />'; … … 49 40 } 50 41 51 switch ($doaction) { 42 $update = ''; 43 44 switch ( $wp_list_table->current_action() ) { 52 45 53 46 /* Bulk Dropdown menu Role changes */
Note: See TracChangeset
for help on using the changeset viewer.