diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/network/sites.php --- a/wp/wp-admin/network/sites.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/network/sites.php Tue Dec 15 13:49:49 2020 +0100 @@ -8,7 +8,7 @@ */ /** Load WordPress Administration Bootstrap */ -require_once( dirname( __FILE__ ) . '/admin.php' ); +require_once __DIR__ . '/admin.php'; if ( ! current_user_can( 'manage_sites' ) ) { wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); @@ -42,7 +42,7 @@ get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . - '

' . __( 'Documentation on Site Management' ) . '

' . + '

' . __( 'Documentation on Site Management' ) . '

' . '

' . __( 'Support Forums' ) . '

' ); @@ -61,14 +61,23 @@ // A list of valid actions and their associated messaging for confirmation output. $manage_actions = array( + /* translators: %s: Site URL. */ 'activateblog' => __( 'You are about to activate the site %s.' ), + /* translators: %s: Site URL. */ 'deactivateblog' => __( 'You are about to deactivate the site %s.' ), + /* translators: %s: Site URL. */ 'unarchiveblog' => __( 'You are about to unarchive the site %s.' ), + /* translators: %s: Site URL. */ 'archiveblog' => __( 'You are about to archive the site %s.' ), + /* translators: %s: Site URL. */ 'unspamblog' => __( 'You are about to unspam the site %s.' ), + /* translators: %s: Site URL. */ 'spamblog' => __( 'You are about to mark the site %s as spam.' ), + /* translators: %s: Site URL. */ 'deleteblog' => __( 'You are about to delete the site %s.' ), + /* translators: %s: Site URL. */ 'unmatureblog' => __( 'You are about to mark the site %s as mature.' ), + /* translators: %s: Site URL. */ 'matureblog' => __( 'You are about to mark the site %s as not mature.' ), ); @@ -99,7 +108,7 @@ $site_details = get_site( $id ); $site_address = untrailingslashit( $site_details->domain . $site_details->path ); - require_once( ABSPATH . 'wp-admin/admin-header.php' ); + require_once ABSPATH . 'wp-admin/admin-header.php'; ?>

@@ -108,13 +117,13 @@ -

+

site_id && current_user_can( 'delete_site', $id ) ) { + if ( '0' != $id && get_network()->site_id != $id && current_user_can( 'delete_site', $id ) ) { wpmu_delete_blog( $id, true ); $updated_action = 'delete'; } @@ -144,7 +153,7 @@ foreach ( (array) $_POST['site_ids'] as $site_id ) { $site_id = (int) $site_id; - if ( $site_id == get_network()->site_id ) { + if ( get_network()->site_id == $site_id ) { continue; } @@ -152,7 +161,14 @@ $site = get_site( $site_id ); $site_address = untrailingslashit( $site->domain . $site->path ); - wp_die( sprintf( __( 'Sorry, you are not allowed to delete the site %s.' ), $site_address ), 403 ); + wp_die( + sprintf( + /* translators: %s: Site URL. */ + __( 'Sorry, you are not allowed to delete the site %s.' ), + $site_address + ), + 403 + ); } $updated_action = 'all_delete'; @@ -162,13 +178,13 @@ case 'allblogs': if ( ( isset( $_POST['action'] ) || isset( $_POST['action2'] ) ) && isset( $_POST['allblogs'] ) ) { - $doaction = $_POST['action'] != -1 ? $_POST['action'] : $_POST['action2']; + $doaction = -1 != $_POST['action'] ? $_POST['action'] : $_POST['action2']; foreach ( (array) $_POST['allblogs'] as $key => $val ) { - if ( $val != '0' && $val != get_network()->site_id ) { + if ( '0' != $val && get_network()->site_id != $val ) { switch ( $doaction ) { case 'delete': - require_once( ABSPATH . 'wp-admin/admin-header.php' ); + require_once ABSPATH . 'wp-admin/admin-header.php'; ?>

@@ -193,8 +209,8 @@
id, $redirect_to, $doaction, $blogs, $id ); + $redirect_to = apply_filters( 'handle_network_bulk_actions-' . get_current_screen()->id, $redirect_to, $doaction, $blogs, $id ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores + wp_safe_redirect( $redirect_to ); - exit(); + exit; } } else { - $location = network_admin_url( 'sites.php' ); - if ( ! empty( $_REQUEST['paged'] ) ) { - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); - } + // Process query defined by WP_MS_Site_List_Table::extra_table_nav(). + $location = remove_query_arg( + array( '_wp_http_referer', '_wpnonce' ), + add_query_arg( $_POST, network_admin_url( 'sites.php' ) ) + ); + wp_redirect( $location ); - exit(); + exit; } + break; case 'archiveblog': @@ -252,6 +274,7 @@ * @param string $id The ID of the site being deactivated. */ do_action( 'deactivate_blog', $id ); + update_blog_status( $id, 'deleted', '1' ); break; @@ -272,7 +295,7 @@ if ( ! empty( $updated_action ) ) { wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) ); - exit(); + exit; } } @@ -336,7 +359,7 @@ $wp_list_table->prepare_items(); -require_once( ABSPATH . 'wp-admin/admin-header.php' ); +require_once ABSPATH . 'wp-admin/admin-header.php'; ?>
@@ -348,13 +371,15 @@ ' . __( 'Search results for “%s”' ) . '', esc_html( $s ) ); } ?>
+views(); ?> +
+require_once ABSPATH . 'wp-admin/admin-footer.php'; ?>