52
52
/** This action is documented in wp-admin/network/edit.php */
53
53
do_action( 'wpmuadminedit' );
55
// A list of valid actions and their associated messaging for confirmation output.
56
$manage_actions = array(
57
'activateblog' => __( 'You are about to activate the site %s' ),
58
'deactivateblog' => __( 'You are about to deactivate the site %s' ),
59
'unarchiveblog' => __( 'You are about to unarchive the site %s.' ),
60
'archiveblog' => __( 'You are about to archive the site %s.' ),
61
'unspamblog' => __( 'You are about to unspam the site %s.' ),
62
'spamblog' => __( 'You are about to mark the site %s as spam.' ),
63
'deleteblog' => __( 'You are about to delete the site %s.' ),
64
'unmatureblog' => __( 'You are about to mark the site %s as mature.' ),
65
'matureblog' => __( 'You are about to mark the site %s as not mature.' ),
55
68
if ( 'confirm' === $_GET['action'] ) {
56
check_admin_referer( 'confirm' );
69
// The action2 parameter contains the action being taken on the site.
70
$site_action = $_GET['action2'];
72
if ( ! array_key_exists( $site_action, $manage_actions ) ) {
73
wp_die( __( 'The requested action is not valid.' ) );
76
// The mature/unmature UI exists only as external code. Check the "confirm" nonce for backward compatibility.
77
if ( 'matureblog' === $site_action || 'unmatureblog' === $site_action ) {
78
check_admin_referer( 'confirm' );
80
check_admin_referer( $site_action . '_' . $id );
58
83
if ( ! headers_sent() ) {
64
89
wp_die( __( 'You are not allowed to change the current site.' ) );
92
$site_details = get_blog_details( $id );
93
$site_address = untrailingslashit( $site_details->domain . $site_details->path );
67
95
require_once( ABSPATH . 'wp-admin/admin-header.php' );
70
<h2><?php _e( 'Confirm your action' ); ?></h2>
71
<form action="sites.php?action=<?php echo esc_attr( $_GET['action2'] ) ?>" method="post">
72
<input type="hidden" name="action" value="<?php echo esc_attr( $_GET['action2'] ) ?>" />
98
<h1><?php _e( 'Confirm your action' ); ?></h1>
99
<form action="sites.php?action=<?php echo esc_attr( $site_action ); ?>" method="post">
100
<input type="hidden" name="action" value="<?php echo esc_attr( $site_action ); ?>" />
73
101
<input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" />
74
102
<input type="hidden" name="_wp_http_referer" value="<?php echo esc_attr( wp_get_referer() ); ?>" />
75
<?php wp_nonce_field( $_GET['action2'], '_wpnonce', false ); ?>
76
<p><?php echo esc_html( wp_unslash( $_GET['msg'] ) ); ?></p>
103
<?php wp_nonce_field( $site_action . '_' . $id, '_wpnonce', false ); ?>
104
<p><?php echo sprintf( $manage_actions[ $site_action ], $site_address ); ?></p>
77
105
<?php submit_button( __( 'Confirm' ), 'button' ); ?>
81
109
require_once( ABSPATH . 'wp-admin/admin-footer.php' );
111
} elseif ( array_key_exists( $_GET['action'], $manage_actions ) ) {
112
$action = $_GET['action'];
113
check_admin_referer( $action . '_' . $id );
114
} elseif ( 'allblogs' === $_GET['action'] ) {
115
check_admin_referer( 'bulk-sites' );
85
118
$updated_action = '';
87
$manage_actions = array( 'deleteblog', 'allblogs', 'archiveblog', 'unarchiveblog', 'activateblog', 'deactivateblog', 'unspamblog', 'spamblog', 'unmatureblog', 'matureblog' );
88
if ( in_array( $_GET['action'], $manage_actions ) ) {
89
$action = $_GET['action'];
90
if ( 'allblogs' === $action )
91
$action = 'bulk-sites';
93
check_admin_referer( $action );
96
120
switch ( $_GET['action'] ) {
98
122
case 'deleteblog':
181
if ( empty( $updated_action ) && in_array( $_GET['action'], $manage_actions ) )
205
if ( empty( $updated_action ) && array_key_exists( $_GET['action'], $manage_actions ) ) {
182
206
$updated_action = $_GET['action'];
184
209
if ( ! empty( $updated_action ) ) {
185
210
wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) );
250
275
<div class="wrap">
251
<h2><?php _e( 'Sites' ) ?>
276
<h1><?php _e( 'Sites' ); ?>
253
278
<?php if ( current_user_can( 'create_sites') ) : ?>
254
<a href="<?php echo network_admin_url('site-new.php'); ?>" class="add-new-h2"><?php echo esc_html_x( 'Add New', 'site' ); ?></a>
279
<a href="<?php echo network_admin_url('site-new.php'); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'site' ); ?></a>
257
282
<?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) {
258
283
printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( $s ) );
262
287
<?php echo $msg; ?>