~canonical-sysadmins/wordpress/4.6

« back to all changes in this revision

Viewing changes to wp-admin/network/sites.php

  • Committer: Ryan Finnie
  • Date: 2015-08-31 16:09:47 UTC
  • mfrom: (1.1.9 upstream)
  • Revision ID: ryan.finnie@canonical.com-20150831160947-1h6rfxby9z1ec62u
Merge WP4.3 from upstream

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
        /** This action is documented in wp-admin/network/edit.php */
53
53
        do_action( 'wpmuadminedit' );
54
54
 
 
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.' ),
 
66
        );
 
67
 
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'];
 
71
 
 
72
                if ( ! array_key_exists( $site_action, $manage_actions ) ) {
 
73
                        wp_die( __( 'The requested action is not valid.' ) );
 
74
                }
 
75
 
 
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' );
 
79
                } else {
 
80
                        check_admin_referer( $site_action . '_' . $id );
 
81
                }
57
82
 
58
83
                if ( ! headers_sent() ) {
59
84
                        nocache_headers();
64
89
                        wp_die( __( 'You are not allowed to change the current site.' ) );
65
90
                }
66
91
 
 
92
                $site_details = get_blog_details( $id );
 
93
                $site_address = untrailingslashit( $site_details->domain . $site_details->path );
 
94
 
67
95
                require_once( ABSPATH . 'wp-admin/admin-header.php' );
68
96
                ?>
69
97
                        <div class="wrap">
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' ); ?>
78
106
                                </form>
79
107
                        </div>
80
108
                <?php
81
109
                require_once( ABSPATH . 'wp-admin/admin-footer.php' );
82
110
                exit();
 
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' );
83
116
        }
84
117
 
85
118
        $updated_action = '';
86
119
 
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';
92
 
 
93
 
                check_admin_referer( $action );
94
 
        }
95
 
 
96
120
        switch ( $_GET['action'] ) {
97
121
 
98
122
                case 'deleteblog':
178
202
                break;
179
203
        }
180
204
 
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'];
 
207
        }
183
208
 
184
209
        if ( ! empty( $updated_action ) ) {
185
210
                wp_safe_redirect( add_query_arg( array( 'updated' => $updated_action ), wp_get_referer() ) );
248
273
?>
249
274
 
250
275
<div class="wrap">
251
 
<h2><?php _e( 'Sites' ) ?>
 
276
<h1><?php _e( 'Sites' ); ?>
252
277
 
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>
255
280
<?php endif; ?>
256
281
 
257
282
<?php if ( isset( $_REQUEST['s'] ) && $_REQUEST['s'] ) {
258
283
        printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', esc_html( $s ) );
259
284
} ?>
260
 
</h2>
 
285
</h1>
261
286
 
262
287
<?php echo $msg; ?>
263
288