Ticket #16031: 16021-4.7-2.patch
File 16021-4.7-2.patch, 21.0 KB (added by , 7 years ago) |
---|
-
src
-
src/wp-admin/edit-comments.php
Property changes on: src ___________________________________________________________________ Modified: svn:ignore ## -1,2 +1,3 ## .wp-tests-version .htaccess +.idea
46 46 47 47 wp_defer_comment_counting( true ); 48 48 49 foreach ( $comment_ids as $comment_id ) { // Check the permissions on each50 if ( !current_user_can( 'edit_comment', $comment_id ) )51 continue;52 53 switch ( $doaction ) {54 case 'approve' :49 switch ( $doaction ) { 50 case 'approve' : 51 foreach ( $comment_ids as $comment_id ) { // Check the permissions on each 52 if ( ! current_user_can( 'edit_comment', $comment_id ) ) { 53 continue; 54 } 55 55 wp_set_comment_status( $comment_id, 'approve' ); 56 $approved++; 57 break; 58 case 'unapprove' : 56 $approved ++; 57 } 58 break; 59 case 'unapprove' : 60 foreach ( $comment_ids as $comment_id ) { // Check the permissions on each 61 if ( ! current_user_can( 'edit_comment', $comment_id ) ) { 62 continue; 63 } 59 64 wp_set_comment_status( $comment_id, 'hold' ); 60 $unapproved++; 61 break; 62 case 'spam' : 65 $unapproved ++; 66 } 67 break; 68 case 'spam' : 69 foreach ( $comment_ids as $comment_id ) { // Check the permissions on each 70 if ( ! current_user_can( 'edit_comment', $comment_id ) ) { 71 continue; 72 } 63 73 wp_spam_comment( $comment_id ); 64 $spammed++; 65 break; 66 case 'unspam' : 74 $spammed ++; 75 } 76 break; 77 case 'unspam' : 78 foreach ( $comment_ids as $comment_id ) { // Check the permissions on each 79 if ( ! current_user_can( 'edit_comment', $comment_id ) ) { 80 continue; 81 } 67 82 wp_unspam_comment( $comment_id ); 68 $unspammed++; 69 break; 70 case 'trash' : 83 $unspammed ++; 84 } 85 break; 86 case 'trash' : 87 foreach ( $comment_ids as $comment_id ) { // Check the permissions on each 88 if ( ! current_user_can( 'edit_comment', $comment_id ) ) { 89 continue; 90 } 71 91 wp_trash_comment( $comment_id ); 72 $trashed++; 73 break; 74 case 'untrash' : 92 $trashed ++; 93 } 94 break; 95 case 'untrash' : 96 foreach ( $comment_ids as $comment_id ) { // Check the permissions on each 97 if ( ! current_user_can( 'edit_comment', $comment_id ) ) { 98 continue; 99 } 75 100 wp_untrash_comment( $comment_id ); 76 $untrashed++; 77 break; 78 case 'delete' : 101 $untrashed ++; 102 } 103 break; 104 case 'delete' : 105 foreach ( $comment_ids as $comment_id ) { // Check the permissions on each 106 if ( ! current_user_can( 'edit_comment', $comment_id ) ) { 107 continue; 108 } 79 109 wp_delete_comment( $comment_id ); 80 $deleted++; 81 break; 82 } 110 $deleted ++; 111 } 112 break; 113 default: 114 /** 115 * Fires when a custom bulk action should be handled. 116 * 117 * The sendback link should be modified with success or failure feedback 118 * from the action to be used to display feedback to the user. 119 * 120 * @since 4.7.0 121 * 122 * @param string $redirect_to The redirect URL. 123 * @param string $doaction The action being taken. 124 * @param array $comment_ids The comments to take the action on. 125 */ 126 $redirect_to = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $comment_ids ); 83 127 } 84 128 85 129 wp_defer_comment_counting( false ); … … 100 144 $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); 101 145 if ( $trashed || $spammed ) 102 146 $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); 103 147 104 148 wp_safe_redirect( $redirect_to ); 105 149 exit; 106 150 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { -
src/wp-admin/edit-tags.php
195 195 else 196 196 $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $location ); 197 197 break; 198 default: 199 /** 200 * Fires when a custom bulk action should be handled. 201 * 202 * The sendback link should be modified with success or failure feedback 203 * from the action to be used to display feedback to the user. 204 * 205 * @since 4.7.0 206 * 207 * @param string $location The redirect URL. 208 * @param string $action The action being taken. 209 * @param array $tag_ids The tags to take the action on. 210 */ 211 $location = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $location, $wp_list_table->current_action(), $_REQUEST['delete_tags'] ); 212 break; 198 213 } 199 214 200 215 if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { 201 216 $location = remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ); 202 217 } 203 218 204 219 if ( $location ) { 205 220 if ( ! empty( $_REQUEST['paged'] ) ) { 206 221 $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); -
src/wp-admin/edit.php
162 162 } 163 163 } 164 164 break; 165 default: 166 /** 167 * Fires when a custom bulk action should be handled. 168 * 169 * The sendback link should be modified with success or failure feedback 170 * from the action to be used to display feedback to the user. 171 * 172 * @since 4.7.0 173 * 174 * @param string $sendback The redirect URL. 175 * @param string $doaction The action being taken. 176 * @param array $post_ids The posts to take the action on. 177 */ 178 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $post_ids ); 179 break; 165 180 } 166 181 167 182 $sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback ); -
src/wp-admin/includes/class-wp-list-table.php
436 436 */ 437 437 protected function bulk_actions( $which = '' ) { 438 438 if ( is_null( $this->_actions ) ) { 439 $ no_new_actions = $this->_actions = $this->get_bulk_actions();439 $this->_actions = $this->get_bulk_actions(); 440 440 /** 441 441 * Filters the list table Bulk Actions drop-down. 442 442 * … … 450 450 * @param array $actions An array of the available bulk actions. 451 451 */ 452 452 $this->_actions = apply_filters( "bulk_actions-{$this->screen->id}", $this->_actions ); 453 $this->_actions = array_intersect_assoc( $this->_actions, $no_new_actions );454 453 $two = ''; 455 454 } else { 456 455 $two = '2'; -
src/wp-admin/link-manager.php
18 18 19 19 if ( $doaction && isset( $_REQUEST['linkcheck'] ) ) { 20 20 check_admin_referer( 'bulk-bookmarks' ); 21 22 $redirect_to = admin_url( 'link-manager.php' ); 23 $bulklinks = (array) $_REQUEST['linkcheck']; 21 24 22 25 if ( 'delete' == $doaction ) { 23 $bulklinks = (array) $_REQUEST['linkcheck'];26 24 27 foreach ( $bulklinks as $link_id ) { 25 28 $link_id = (int) $link_id; 26 29 27 30 wp_delete_link( $link_id ); 28 31 } 29 32 30 wp_redirect( add_query_arg('deleted', count( $bulklinks ), admin_url( 'link-manager.php' ) ) ); 31 exit; 33 $redirect_to = add_query_arg('deleted', count( $bulklinks ), $redirect_to ); 34 } else { 35 /** 36 * Fires when a custom bulk action should be handled. 37 * 38 * The sendback link should be modified with success or failure feedback 39 * from the action to be used to display feedback to the user. 40 * 41 * @since 4.7.0 42 * 43 * @param string $redirect_to The redirect URL. 44 * @param string $doaction The action being taken. 45 * @param array $bulklinks The links to take the action on. 46 */ 47 $redirect_to = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $bulklinks ); 32 48 } 49 50 wp_redirect( $redirect_to ); 51 exit; 33 52 } elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { 34 53 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); 35 54 exit; -
src/wp-admin/network/site-themes.php
122 122 $n = 'none'; 123 123 } 124 124 break; 125 default: 126 /** 127 * Fires when a custom bulk action should be handled. 128 * 129 * The sendback link should be modified with success or failure feedback 130 * from the action to be used to display feedback to the user. 131 * 132 * @since 4.7.0 133 * 134 * @param string $referer The redirect URL. 135 * @param string $action The action being taken. 136 * @param array $theme_ids The themes to take the action on. 137 * @param int $site_id The current site id 138 */ 139 $referer = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $referer, $action, $_REQUEST['checked'], $id ); 140 $n = count( $themes ); 125 141 } 126 142 127 143 update_option( 'allowedthemes', $allowed_themes ); -
src/wp-admin/network/site-users.php
164 164 $update = 'err_promote'; 165 165 } 166 166 break; 167 default: 168 /** 169 * Fires when a custom bulk action should be handled. 170 * 171 * The sendback link should be modified with success or failure feedback 172 * from the action to be used to display feedback to the user. 173 * 174 * @since 4.7.0 175 * 176 * @param string $referer The redirect URL. 177 * @param string $action The action being taken. 178 * @param array $user_ids The users to take the action on. 179 * @param int $site_id The id of the current site 180 */ 181 $referer = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $referer, $action, $_REQUEST['users'], $id ); 182 $update = $action; 183 break; 167 184 } 168 185 169 186 wp_safe_redirect( add_query_arg( 'update', $update, $referer ) ); -
src/wp-admin/network/sites.php
138 138 case 'allblogs': 139 139 if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) { 140 140 $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; 141 142 foreach ( (array) $_POST['allblogs'] as $key => $val ) { 143 if ( $val != '0' && $val != $current_site->blog_id ) { 144 switch ( $doaction ) { 145 case 'delete': 146 if ( ! current_user_can( 'delete_site', $val ) ) 141 switch ( $doaction ) { 142 case 'delete': 143 foreach ( (array) $_POST['allblogs'] as $key => $val ) { 144 if ( $val != '0' && $val != $current_site->blog_id ) { 145 if ( ! current_user_can( 'delete_site', $val ) ) { 147 146 wp_die( __( 'Sorry, you are not allowed to delete the site.' ) ); 147 } 148 148 149 149 $updated_action = 'all_delete'; 150 150 wpmu_delete_blog( $val, true ); 151 break; 151 } else { 152 wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); 153 } 154 } 155 break; 152 156 153 case 'spam': 154 case 'notspam': 157 case 'spam': 158 case 'notspam': 159 foreach ( (array) $_POST['allblogs'] as $key => $val ) { 160 if ( $val != '0' && $val != $current_site->blog_id ) { 155 161 $updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam'; 156 162 update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? '1' : '0' ); 157 break; 163 } else { 164 wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); 165 } 158 166 } 159 } else { 160 wp_die( __( 'Sorry, you are not allowed to change the current site.' ) ); 161 } 167 break; 168 169 default: 170 if ( isset($_REQUEST['allblogs']) ) { 171 $sendback = wp_get_referer(); 172 173 /** 174 * Fires when a custom bulk action should be handled. 175 * 176 * The sendback link should be modified with success or failure feedback 177 * from the action to be used to display feedback to the user. 178 * 179 * @since 4.7.0 180 * 181 * @param string $sendback The redirect URL. 182 * @param string $action The action being taken. 183 * @param array $blog_ids The blogs to take the action on. 184 * @param int $site_id The current site id. 185 */ 186 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $_REQUEST['allblogs'], $id ); 187 188 if ( $sendback ) { 189 wp_safe_redirect( $sendback ); 190 exit(); 191 } 192 } 162 193 } 194 163 195 } else { 164 196 $location = network_admin_url( 'sites.php' ); 165 197 if ( ! empty( $_REQUEST['paged'] ) ) { … … 219 251 wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) ); 220 252 exit(); 221 253 } 254 222 255 } 223 256 224 257 $msg = ''; -
src/wp-admin/network/themes.php
195 195 's' => $s 196 196 ), network_admin_url( 'themes.php' ) ) ); 197 197 exit; 198 break; 199 default: 200 if ( isset($_POST['checked']) ) { 201 $sendback = wp_get_referer(); 202 203 /** 204 * Fires when a custom bulk action should be handled. 205 * 206 * The sendback link should be modified with success or failure feedback 207 * from the action to be used to display feedback to the user. 208 * 209 * @since 4.7.0 210 * 211 * @param string $sendback The redirect URL. 212 * @param string $action The action being taken. 213 * @param array $theme_ids The themes to take the action on. 214 */ 215 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $action, $_REQUEST['checked'] ); 216 217 if ( $sendback ) { 218 wp_safe_redirect( $sendback ); 219 exit; 220 } 221 } 198 222 } 223 199 224 } 200 225 201 226 $wp_list_table->prepare_items(); -
src/wp-admin/network/users.php
52 52 $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; 53 53 $userfunction = ''; 54 54 55 foreach ( (array) $_POST['allusers'] as $user_id) {56 if ( !empty( $user_id ) ) {57 switch ( $doaction) {58 case 'delete':59 if ( ! current_user_can( 'delete_users' ) ) 55 switch ( $doaction ) { 56 case 'delete': 57 foreach ( (array) $_POST['allusers'] as $user_id ) { 58 if ( !empty( $user_id ) ) { 59 if ( ! current_user_can( 'delete_users' ) ) { 60 60 wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); 61 $title = __( 'Users' ); 61 } 62 $title = __( 'Users' ); 62 63 $parent_file = 'users.php'; 63 64 require_once( ABSPATH . 'wp-admin/admin-header.php' ); 64 65 echo '<div class="wrap">'; … … 66 67 echo '</div>'; 67 68 require_once( ABSPATH . 'wp-admin/admin-footer.php' ); 68 69 exit(); 69 70 case 'spam': 70 } 71 } 72 break; 73 74 case 'spam': 75 foreach ( (array) $_POST['allusers'] as $user_id ) { 76 if ( !empty( $user_id ) ) { 71 77 $user = get_userdata( $user_id ); 72 if ( is_super_admin( $user->ID ) ) 78 if ( is_super_admin( $user->ID ) ) { 73 79 wp_die( sprintf( __( 'Warning! User cannot be modified. The user %s is a network administrator.' ), esc_html( $user->user_login ) ) ); 80 } 74 81 75 82 $userfunction = 'all_spam'; 76 $blogs = get_blogs_of_user( $user_id, true );83 $blogs = get_blogs_of_user( $user_id, true ); 77 84 foreach ( (array) $blogs as $details ) { 78 85 if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam ! 86 { 79 87 update_blog_status( $details->userblog_id, 'spam', '1' ); 88 } 80 89 } 81 90 update_user_status( $user_id, 'spam', '1' ); 82 break; 91 } 92 } 93 break; 83 94 84 case 'notspam': 95 case 'notspam': 96 foreach ( (array) $_POST['allusers'] as $user_id ) { 97 if ( ! empty( $user_id ) ) { 85 98 $userfunction = 'all_notspam'; 86 $blogs = get_blogs_of_user( $user_id, true );87 foreach ( (array) $blogs as $details ) 99 $blogs = get_blogs_of_user( $user_id, true ); 100 foreach ( (array) $blogs as $details ) { 88 101 update_blog_status( $details->userblog_id, 'spam', '0' ); 102 } 89 103 90 104 update_user_status( $user_id, 'spam', '0' ); 91 break;105 } 92 106 } 93 } 107 break; 108 109 default: 110 if ( isset( $_POST['allusers'] ) ) { 111 112 $sendback = wp_get_referer(); 113 114 /** 115 * Fires when a custom bulk action should be handled. 116 * 117 * The sendback link should be modified with success or failure feedback 118 * from the action to be used to display feedback to the user. 119 * 120 * @since 4.7.0 121 * 122 * @param string $sendback The redirect URL. 123 * @param string $action The action being taken. 124 * @param array $user_ids The users to take the action on. 125 * @param int $site_id The id of the current site 126 */ 127 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $_POST['allusers'], $id ); 128 129 if ( $sendback ) { 130 wp_safe_redirect( $sendback ); 131 exit(); 132 } 133 } 134 break; 94 135 } 95 136 96 137 wp_safe_redirect( add_query_arg( array( 'updated' => 'true', 'action' => $userfunction ), wp_get_referer() ) ); -
src/wp-admin/plugins.php
356 356 update_site_option( 'recently_activated', array() ); 357 357 } 358 358 break; 359 360 default: 361 if ( isset( $_POST['checked'] ) ) { 362 $sendback = wp_get_referer(); 363 364 /** 365 * Fires when a custom bulk action should be handled. 366 * 367 * The sendback link should be modified with success or failure feedback 368 * from the action to be used to display feedback to the user. 369 * 370 * @since 4.7.0 371 * 372 * @param string $sendback The redirect URL. 373 * @param string $action The action being taken. 374 * @param array $plugin_ids The plugins to take the action on. 375 */ 376 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $action, $_POST['checked'] ); 377 378 if ( $sendback ) { 379 wp_safe_redirect( $sendback ); 380 exit; 381 } 382 } 383 break; 359 384 } 385 360 386 } 361 387 362 388 $wp_list_table->prepare_items(); -
src/wp-admin/upload.php
163 163 } 164 164 $location = add_query_arg( 'deleted', count( $post_ids ), $location ); 165 165 break; 166 default: 167 /** 168 * Fires when a custom bulk action should be handled. 169 * 170 * The sendback link should be modified with success or failure feedback 171 * from the action to be used to display feedback to the user. 172 * 173 * @since 4.7.0 174 * 175 * @param string $location The redirect URL. 176 * @param string $doaction The action being taken. 177 * @param array $post_ids The posts to take the action on. 178 */ 179 $location = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $location, $doaction, $post_ids ); 166 180 } 167 181 168 182 wp_redirect( $location ); -
src/wp-admin/users.php
410 410 exit; 411 411 } 412 412 413 if ( !empty($_REQUEST['users']) ) { 414 $sendback = wp_get_referer(); 415 416 /** 417 * Fires when a custom bulk action should be handled. 418 * 419 * The sendback link should be modified with success or failure feedback 420 * from the action to be used to display feedback to the user. 421 * 422 * @since 4.7.0 423 * 424 * @param string $sendback The redirect URL. 425 * @param string $action The action being taken. 426 * @param array $user_ids The users to take the action on. 427 */ 428 $sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $wp_list_table->current_action(), $_REQUEST['users'] ); 429 430 if ( $sendback ) { 431 wp_safe_redirect( $sendback ); 432 exit; 433 } 434 } 435 413 436 $wp_list_table->prepare_items(); 414 437 $total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); 415 438 if ( $pagenum > $total_pages && $total_pages > 0 ) {