Changeset 33173
- Timestamp:
- 07/12/2015 02:35:11 AM (9 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php
r33097 r33173 502 502 if ( get_current_site()->blog_id != $blog['blog_id'] ) { 503 503 if ( $blog['deleted'] == '1' ) { 504 $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Activate' ) . '</a></span>';504 $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a></span>'; 505 505 } else { 506 $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Deactivate' ) . '</a></span>';506 $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a></span>'; 507 507 } 508 508 509 509 if ( $blog['archived'] == '1' ) { 510 $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Unarchive' ) . '</a></span>';510 $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a></span>'; 511 511 } else { 512 $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';512 $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>'; 513 513 } 514 514 515 515 if ( $blog['spam'] == '1' ) { 516 $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';516 $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>'; 517 517 } else { 518 $actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';518 $actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a></span>'; 519 519 } 520 520 521 521 if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) { 522 $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to delete the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Delete' ) . '</a></span>';522 $actions['delete'] = '<span class="delete"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a></span>'; 523 523 } 524 524 } -
trunk/src/wp-admin/network/sites.php
r33067 r33173 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 'allblogs' => '', 67 ); 68 55 69 if ( 'confirm' === $_GET['action'] ) { 56 check_admin_referer( 'confirm' ); 70 // The action2 parameter contains the action being taken on the site. 71 $site_action = $_GET['action2']; 72 73 if ( ! array_key_exists( $site_action, $manage_actions ) ) { 74 wp_die( __( 'The requested action is not valid.' ) ); 75 } 76 77 // The mature/unmature UI exists only as external code. Check the "confirm" nonce for backward compatibility. 78 if ( 'matureblog' === $site_action || 'unmatureblog' === $site_action ) { 79 check_admin_referer( 'confirm' ); 80 } else { 81 check_admin_referer( $site_action . '_' . $id ); 82 } 57 83 58 84 if ( ! headers_sent() ) { … … 64 90 wp_die( __( 'You are not allowed to change the current site.' ) ); 65 91 } 92 93 $site_details = get_blog_details( $id ); 94 $site_address = untrailingslashit( $site_details->domain . $site_details->path ); 66 95 67 96 require_once( ABSPATH . 'wp-admin/admin-header.php' ); … … 69 98 <div class="wrap"> 70 99 <h1><?php _e( 'Confirm your action' ); ?></h1> 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'] )?>" />100 <form action="sites.php?action=<?php echo esc_attr( $site_action ); ?>" method="post"> 101 <input type="hidden" name="action" value="<?php echo esc_attr( $site_action ); ?>" /> 73 102 <input type="hidden" name="id" value="<?php echo esc_attr( $id ); ?>" /> 74 103 <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>104 <?php wp_nonce_field( $site_action . '_' . $id, '_wpnonce', false ); ?> 105 <p><?php echo sprintf( $manage_actions[ $site_action ], $site_address ); ?></p> 77 106 <?php submit_button( __( 'Confirm' ), 'button' ); ?> 78 107 </form> … … 85 114 $updated_action = ''; 86 115 87 $manage_actions = array( 'deleteblog', 'allblogs', 'archiveblog', 'unarchiveblog', 'activateblog', 'deactivateblog', 'unspamblog', 'spamblog', 'unmatureblog', 'matureblog' ); 88 if ( in_array( $_GET['action'], $manage_actions ) ) { 116 if ( array_key_exists( $_GET['action'], $manage_actions ) ) { 89 117 $action = $_GET['action']; 90 if ( 'allblogs' === $action ) 118 if ( 'allblogs' === $action ) { 91 119 $action = 'bulk-sites'; 92 93 check_admin_referer( $action ); 120 } 121 122 check_admin_referer( $action . '_' . $id ); 94 123 } 95 124 … … 179 208 } 180 209 181 if ( empty( $updated_action ) && in_array( $_GET['action'], $manage_actions ) )210 if ( empty( $updated_action ) && array_key_exists( $_GET['action'], $manage_actions ) ) { 182 211 $updated_action = $_GET['action']; 212 } 183 213 184 214 if ( ! empty( $updated_action ) ) {
Note: See TracChangeset
for help on using the changeset viewer.